Skip to content

Commit

Permalink
Add data masking to fragments read by useFragment/watchFragment (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
jerelmiller committed Sep 24, 2024
1 parent b1a28a6 commit 1e4f9e3
Show file tree
Hide file tree
Showing 22 changed files with 1,554 additions and 45 deletions.
9 changes: 9 additions & 0 deletions .api-reports/api-report-cache.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ export abstract class ApolloCache<TSerialized> implements DataProxy {
// (undocumented)
identify(object: StoreObject | Reference): string | undefined;
// (undocumented)
maskFragment<TData = unknown>(options: MaskFragmentOptions<TData>): TData;
// (undocumented)
maskOperation<TData = unknown>(document: DocumentNode, data: TData): TData;
// (undocumented)
modify<Entity extends Record<string, any> = Record<string, any>>(options: Cache_2.ModifyOptions<Entity>): boolean;
Expand Down Expand Up @@ -702,6 +704,13 @@ export function makeReference(id: string): Reference;
// @public (undocumented)
export function makeVar<T>(value: T): ReactiveVar<T>;

// @public (undocumented)
export interface MaskFragmentOptions<TData> {
data: TData;
fragment: DocumentNode | TypedDocumentNode<TData>;
fragmentName?: string;
}

// @public (undocumented)
export interface MergeInfo {
// (undocumented)
Expand Down
17 changes: 15 additions & 2 deletions .api-reports/api-report-core.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ export abstract class ApolloCache<TSerialized> implements DataProxy {
getMemoryInternals?: typeof getApolloCacheMemoryInternals;
// (undocumented)
identify(object: StoreObject | Reference): string | undefined;
// Warning: (ae-forgotten-export) The symbol "MaskFragmentOptions" needs to be exported by the entry point index.d.ts
//
// (undocumented)
maskFragment<TData = unknown>(options: MaskFragmentOptions<TData>): TData;
// (undocumented)
maskOperation<TData = unknown>(document: DocumentNode, data: TData): TData;
// (undocumented)
Expand Down Expand Up @@ -1311,6 +1315,13 @@ export function makeReference(id: string): Reference;
// @public (undocumented)
export function makeVar<T>(value: T): ReactiveVar<T>;

// @public (undocumented)
interface MaskFragmentOptions<TData> {
data: TData;
fragment: DocumentNode | TypedDocumentNode<TData>;
fragmentName?: string;
}

// @public (undocumented)
type MaybeAsync<T> = T | PromiseLike<T>;

Expand Down Expand Up @@ -1847,6 +1858,8 @@ class QueryManager<TStore> {
keepRootFields?: boolean;
}, cache?: ApolloCache<TStore>): Promise<FetchResult<TData>>;
// (undocumented)
maskFragment<TData = unknown>(options: MaskFragmentOptions<TData>): TData;
// (undocumented)
mutate<TData, TVariables extends OperationVariables, TContext extends Record<string, any>, TCache extends ApolloCache<any>>({ mutation, variables, optimisticResponse, updateQueries, refetchQueries, awaitRefetchQueries, update: updateWithProxyFn, onQueryUpdated, fetchPolicy, errorPolicy, keepRootFields, context, }: MutationOptions<TData, TVariables, TContext>): Promise<FetchResult<TData>>;
// (undocumented)
mutationStore?: {
Expand Down Expand Up @@ -2330,8 +2343,8 @@ interface WriteContext extends ReadMergeModifyContext {
// src/cache/inmemory/types.ts:139:3 - (ae-forgotten-export) The symbol "KeyFieldsFunction" needs to be exported by the entry point index.d.ts
// src/core/ObservableQuery.ts:116:5 - (ae-forgotten-export) The symbol "QueryManager" needs to be exported by the entry point index.d.ts
// src/core/ObservableQuery.ts:117:5 - (ae-forgotten-export) The symbol "QueryInfo" needs to be exported by the entry point index.d.ts
// src/core/QueryManager.ts:140:5 - (ae-forgotten-export) The symbol "MutationStoreValue" needs to be exported by the entry point index.d.ts
// src/core/QueryManager.ts:385:7 - (ae-forgotten-export) The symbol "UpdateQueries" needs to be exported by the entry point index.d.ts
// src/core/QueryManager.ts:144:5 - (ae-forgotten-export) The symbol "MutationStoreValue" needs to be exported by the entry point index.d.ts
// src/core/QueryManager.ts:389:7 - (ae-forgotten-export) The symbol "UpdateQueries" needs to be exported by the entry point index.d.ts
// src/core/watchQueryOptions.ts:275:2 - (ae-forgotten-export) The symbol "UpdateQueryFn" needs to be exported by the entry point index.d.ts
// src/link/http/selectHttpOptionsAndBody.ts:128:32 - (ae-forgotten-export) The symbol "HttpQueryOptions" needs to be exported by the entry point index.d.ts

Expand Down
17 changes: 15 additions & 2 deletions .api-reports/api-report-react.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ abstract class ApolloCache<TSerialized> implements DataProxy {
//
// (undocumented)
identify(object: StoreObject | Reference): string | undefined;
// Warning: (ae-forgotten-export) The symbol "MaskFragmentOptions" needs to be exported by the entry point index.d.ts
//
// (undocumented)
maskFragment<TData = unknown>(options: MaskFragmentOptions<TData>): TData;
// (undocumented)
maskOperation<TData = unknown>(document: DocumentNode, data: TData): TData;
// (undocumented)
Expand Down Expand Up @@ -1068,6 +1072,13 @@ type LocalStateOptions<TCacheShape> = {
fragmentMatcher?: FragmentMatcher;
};

// @public (undocumented)
interface MaskFragmentOptions<TData> {
data: TData;
fragment: DocumentNode | TypedDocumentNode<TData>;
fragmentName?: string;
}

// @public (undocumented)
type MaybeAsync<T> = T | PromiseLike<T>;

Expand Down Expand Up @@ -1625,6 +1636,8 @@ class QueryManager<TStore> {
keepRootFields?: boolean;
}, cache?: ApolloCache<TStore>): Promise<FetchResult<TData>>;
// (undocumented)
maskFragment<TData = unknown>(options: MaskFragmentOptions<TData>): TData;
// (undocumented)
mutate<TData, TVariables extends OperationVariables, TContext extends Record<string, any>, TCache extends ApolloCache<any>>({ mutation, variables, optimisticResponse, updateQueries, refetchQueries, awaitRefetchQueries, update: updateWithProxyFn, onQueryUpdated, fetchPolicy, errorPolicy, keepRootFields, context, }: MutationOptions<TData, TVariables, TContext>): Promise<FetchResult<TData>>;
// (undocumented)
mutationStore?: {
Expand Down Expand Up @@ -2354,8 +2367,8 @@ interface WatchQueryOptions<TVariables extends OperationVariables = OperationVar
// src/core/LocalState.ts:46:5 - (ae-forgotten-export) The symbol "FragmentMap" needs to be exported by the entry point index.d.ts
// src/core/ObservableQuery.ts:116:5 - (ae-forgotten-export) The symbol "QueryManager" needs to be exported by the entry point index.d.ts
// src/core/ObservableQuery.ts:117:5 - (ae-forgotten-export) The symbol "QueryInfo" needs to be exported by the entry point index.d.ts
// src/core/QueryManager.ts:140:5 - (ae-forgotten-export) The symbol "MutationStoreValue" needs to be exported by the entry point index.d.ts
// src/core/QueryManager.ts:385:7 - (ae-forgotten-export) The symbol "UpdateQueries" needs to be exported by the entry point index.d.ts
// src/core/QueryManager.ts:144:5 - (ae-forgotten-export) The symbol "MutationStoreValue" needs to be exported by the entry point index.d.ts
// src/core/QueryManager.ts:389:7 - (ae-forgotten-export) The symbol "UpdateQueries" needs to be exported by the entry point index.d.ts
// src/core/types.ts:174:3 - (ae-forgotten-export) The symbol "MutationQueryReducer" needs to be exported by the entry point index.d.ts
// src/core/types.ts:203:5 - (ae-forgotten-export) The symbol "Resolver" needs to be exported by the entry point index.d.ts
// src/core/watchQueryOptions.ts:275:2 - (ae-forgotten-export) The symbol "UpdateQueryFn" needs to be exported by the entry point index.d.ts
Expand Down
17 changes: 15 additions & 2 deletions .api-reports/api-report-react_components.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ abstract class ApolloCache<TSerialized> implements DataProxy {
//
// (undocumented)
identify(object: StoreObject | Reference): string | undefined;
// Warning: (ae-forgotten-export) The symbol "MaskFragmentOptions" needs to be exported by the entry point index.d.ts
//
// (undocumented)
maskFragment<TData = unknown>(options: MaskFragmentOptions<TData>): TData;
// (undocumented)
maskOperation<TData = unknown>(document: DocumentNode, data: TData): TData;
// (undocumented)
Expand Down Expand Up @@ -929,6 +933,13 @@ type LocalStateOptions<TCacheShape> = {
fragmentMatcher?: FragmentMatcher;
};

// @public (undocumented)
interface MaskFragmentOptions<TData> {
data: TData;
fragment: DocumentNode | TypedDocumentNode<TData>;
fragmentName?: string;
}

// @public (undocumented)
type MaybeAsync<T> = T | PromiseLike<T>;

Expand Down Expand Up @@ -1439,6 +1450,8 @@ class QueryManager<TStore> {
keepRootFields?: boolean;
}, cache?: ApolloCache<TStore>): Promise<FetchResult<TData>>;
// (undocumented)
maskFragment<TData = unknown>(options: MaskFragmentOptions<TData>): TData;
// (undocumented)
mutate<TData, TVariables extends OperationVariables, TContext extends Record<string, any>, TCache extends ApolloCache<any>>({ mutation, variables, optimisticResponse, updateQueries, refetchQueries, awaitRefetchQueries, update: updateWithProxyFn, onQueryUpdated, fetchPolicy, errorPolicy, keepRootFields, context, }: MutationOptions<TData, TVariables, TContext>): Promise<FetchResult<TData>>;
// (undocumented)
mutationStore?: {
Expand Down Expand Up @@ -1833,8 +1846,8 @@ interface WatchQueryOptions<TVariables extends OperationVariables = OperationVar
// src/core/LocalState.ts:46:5 - (ae-forgotten-export) The symbol "FragmentMap" needs to be exported by the entry point index.d.ts
// src/core/ObservableQuery.ts:116:5 - (ae-forgotten-export) The symbol "QueryManager" needs to be exported by the entry point index.d.ts
// src/core/ObservableQuery.ts:117:5 - (ae-forgotten-export) The symbol "QueryInfo" needs to be exported by the entry point index.d.ts
// src/core/QueryManager.ts:140:5 - (ae-forgotten-export) The symbol "MutationStoreValue" needs to be exported by the entry point index.d.ts
// src/core/QueryManager.ts:385:7 - (ae-forgotten-export) The symbol "UpdateQueries" needs to be exported by the entry point index.d.ts
// src/core/QueryManager.ts:144:5 - (ae-forgotten-export) The symbol "MutationStoreValue" needs to be exported by the entry point index.d.ts
// src/core/QueryManager.ts:389:7 - (ae-forgotten-export) The symbol "UpdateQueries" needs to be exported by the entry point index.d.ts
// src/core/types.ts:174:3 - (ae-forgotten-export) The symbol "MutationQueryReducer" needs to be exported by the entry point index.d.ts
// src/core/types.ts:203:5 - (ae-forgotten-export) The symbol "Resolver" needs to be exported by the entry point index.d.ts
// src/core/watchQueryOptions.ts:275:2 - (ae-forgotten-export) The symbol "UpdateQueryFn" needs to be exported by the entry point index.d.ts
Expand Down
17 changes: 15 additions & 2 deletions .api-reports/api-report-react_context.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ abstract class ApolloCache<TSerialized> implements DataProxy {
//
// (undocumented)
identify(object: StoreObject | Reference): string | undefined;
// Warning: (ae-forgotten-export) The symbol "MaskFragmentOptions" needs to be exported by the entry point index.d.ts
//
// (undocumented)
maskFragment<TData = unknown>(options: MaskFragmentOptions<TData>): TData;
// (undocumented)
maskOperation<TData = unknown>(document: DocumentNode, data: TData): TData;
// (undocumented)
Expand Down Expand Up @@ -926,6 +930,13 @@ type LocalStateOptions<TCacheShape> = {
fragmentMatcher?: FragmentMatcher;
};

// @public (undocumented)
interface MaskFragmentOptions<TData> {
data: TData;
fragment: DocumentNode | TypedDocumentNode<TData>;
fragmentName?: string;
}

// @public (undocumented)
type MaybeAsync<T> = T | PromiseLike<T>;

Expand Down Expand Up @@ -1367,6 +1378,8 @@ class QueryManager<TStore> {
keepRootFields?: boolean;
}, cache?: ApolloCache<TStore>): Promise<FetchResult<TData>>;
// (undocumented)
maskFragment<TData = unknown>(options: MaskFragmentOptions<TData>): TData;
// (undocumented)
mutate<TData, TVariables extends OperationVariables, TContext extends Record<string, any>, TCache extends ApolloCache<any>>({ mutation, variables, optimisticResponse, updateQueries, refetchQueries, awaitRefetchQueries, update: updateWithProxyFn, onQueryUpdated, fetchPolicy, errorPolicy, keepRootFields, context, }: MutationOptions<TData, TVariables, TContext>): Promise<FetchResult<TData>>;
// (undocumented)
mutationStore?: {
Expand Down Expand Up @@ -1753,8 +1766,8 @@ interface WatchQueryOptions<TVariables extends OperationVariables = OperationVar
// src/core/LocalState.ts:46:5 - (ae-forgotten-export) The symbol "FragmentMap" needs to be exported by the entry point index.d.ts
// src/core/ObservableQuery.ts:116:5 - (ae-forgotten-export) The symbol "QueryManager" needs to be exported by the entry point index.d.ts
// src/core/ObservableQuery.ts:117:5 - (ae-forgotten-export) The symbol "QueryInfo" needs to be exported by the entry point index.d.ts
// src/core/QueryManager.ts:140:5 - (ae-forgotten-export) The symbol "MutationStoreValue" needs to be exported by the entry point index.d.ts
// src/core/QueryManager.ts:385:7 - (ae-forgotten-export) The symbol "UpdateQueries" needs to be exported by the entry point index.d.ts
// src/core/QueryManager.ts:144:5 - (ae-forgotten-export) The symbol "MutationStoreValue" needs to be exported by the entry point index.d.ts
// src/core/QueryManager.ts:389:7 - (ae-forgotten-export) The symbol "UpdateQueries" needs to be exported by the entry point index.d.ts
// src/core/types.ts:174:3 - (ae-forgotten-export) The symbol "MutationQueryReducer" needs to be exported by the entry point index.d.ts
// src/core/types.ts:203:5 - (ae-forgotten-export) The symbol "Resolver" needs to be exported by the entry point index.d.ts
// src/core/watchQueryOptions.ts:275:2 - (ae-forgotten-export) The symbol "UpdateQueryFn" needs to be exported by the entry point index.d.ts
Expand Down
17 changes: 15 additions & 2 deletions .api-reports/api-report-react_hoc.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ abstract class ApolloCache<TSerialized> implements DataProxy {
//
// (undocumented)
identify(object: StoreObject | Reference): string | undefined;
// Warning: (ae-forgotten-export) The symbol "MaskFragmentOptions" needs to be exported by the entry point index.d.ts
//
// (undocumented)
maskFragment<TData = unknown>(options: MaskFragmentOptions<TData>): TData;
// (undocumented)
maskOperation<TData = unknown>(document: DocumentNode, data: TData): TData;
// (undocumented)
Expand Down Expand Up @@ -933,6 +937,13 @@ type LocalStateOptions<TCacheShape> = {
fragmentMatcher?: FragmentMatcher;
};

// @public (undocumented)
interface MaskFragmentOptions<TData> {
data: TData;
fragment: DocumentNode | TypedDocumentNode<TData>;
fragmentName?: string;
}

// @public (undocumented)
type MaybeAsync<T> = T | PromiseLike<T>;

Expand Down Expand Up @@ -1412,6 +1423,8 @@ class QueryManager<TStore> {
keepRootFields?: boolean;
}, cache?: ApolloCache<TStore>): Promise<FetchResult<TData>>;
// (undocumented)
maskFragment<TData = unknown>(options: MaskFragmentOptions<TData>): TData;
// (undocumented)
mutate<TData, TVariables extends OperationVariables, TContext extends Record<string, any>, TCache extends ApolloCache<any>>({ mutation, variables, optimisticResponse, updateQueries, refetchQueries, awaitRefetchQueries, update: updateWithProxyFn, onQueryUpdated, fetchPolicy, errorPolicy, keepRootFields, context, }: MutationOptions<TData, TVariables, TContext>): Promise<FetchResult<TData>>;
// (undocumented)
mutationStore?: {
Expand Down Expand Up @@ -1780,8 +1793,8 @@ export function withSubscription<TProps extends TGraphQLVariables | {} = {}, TDa
// src/core/LocalState.ts:46:5 - (ae-forgotten-export) The symbol "FragmentMap" needs to be exported by the entry point index.d.ts
// src/core/ObservableQuery.ts:116:5 - (ae-forgotten-export) The symbol "QueryManager" needs to be exported by the entry point index.d.ts
// src/core/ObservableQuery.ts:117:5 - (ae-forgotten-export) The symbol "QueryInfo" needs to be exported by the entry point index.d.ts
// src/core/QueryManager.ts:140:5 - (ae-forgotten-export) The symbol "MutationStoreValue" needs to be exported by the entry point index.d.ts
// src/core/QueryManager.ts:385:7 - (ae-forgotten-export) The symbol "UpdateQueries" needs to be exported by the entry point index.d.ts
// src/core/QueryManager.ts:144:5 - (ae-forgotten-export) The symbol "MutationStoreValue" needs to be exported by the entry point index.d.ts
// src/core/QueryManager.ts:389:7 - (ae-forgotten-export) The symbol "UpdateQueries" needs to be exported by the entry point index.d.ts
// src/core/types.ts:174:3 - (ae-forgotten-export) The symbol "MutationQueryReducer" needs to be exported by the entry point index.d.ts
// src/core/types.ts:203:5 - (ae-forgotten-export) The symbol "Resolver" needs to be exported by the entry point index.d.ts
// src/core/watchQueryOptions.ts:275:2 - (ae-forgotten-export) The symbol "UpdateQueryFn" needs to be exported by the entry point index.d.ts
Expand Down
17 changes: 15 additions & 2 deletions .api-reports/api-report-react_hooks.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ abstract class ApolloCache<TSerialized> implements DataProxy {
//
// (undocumented)
identify(object: StoreObject | Reference): string | undefined;
// Warning: (ae-forgotten-export) The symbol "MaskFragmentOptions" needs to be exported by the entry point index.d.ts
//
// (undocumented)
maskFragment<TData = unknown>(options: MaskFragmentOptions<TData>): TData;
// (undocumented)
maskOperation<TData = unknown>(document: DocumentNode, data: TData): TData;
// (undocumented)
Expand Down Expand Up @@ -1017,6 +1021,13 @@ type LocalStateOptions<TCacheShape> = {
fragmentMatcher?: FragmentMatcher;
};

// @public (undocumented)
interface MaskFragmentOptions<TData> {
data: TData;
fragment: DocumentNode | TypedDocumentNode<TData>;
fragmentName?: string;
}

// @public (undocumented)
type MaybeAsync<T> = T | PromiseLike<T>;

Expand Down Expand Up @@ -1494,6 +1505,8 @@ class QueryManager<TStore> {
keepRootFields?: boolean;
}, cache?: ApolloCache<TStore>): Promise<FetchResult<TData>>;
// (undocumented)
maskFragment<TData = unknown>(options: MaskFragmentOptions<TData>): TData;
// (undocumented)
mutate<TData, TVariables extends OperationVariables, TContext extends Record<string, any>, TCache extends ApolloCache<any>>({ mutation, variables, optimisticResponse, updateQueries, refetchQueries, awaitRefetchQueries, update: updateWithProxyFn, onQueryUpdated, fetchPolicy, errorPolicy, keepRootFields, context, }: MutationOptions<TData, TVariables, TContext>): Promise<FetchResult<TData>>;
// (undocumented)
mutationStore?: {
Expand Down Expand Up @@ -2178,8 +2191,8 @@ interface WatchQueryOptions<TVariables extends OperationVariables = OperationVar
// src/core/LocalState.ts:46:5 - (ae-forgotten-export) The symbol "FragmentMap" needs to be exported by the entry point index.d.ts
// src/core/ObservableQuery.ts:116:5 - (ae-forgotten-export) The symbol "QueryManager" needs to be exported by the entry point index.d.ts
// src/core/ObservableQuery.ts:117:5 - (ae-forgotten-export) The symbol "QueryInfo" needs to be exported by the entry point index.d.ts
// src/core/QueryManager.ts:140:5 - (ae-forgotten-export) The symbol "MutationStoreValue" needs to be exported by the entry point index.d.ts
// src/core/QueryManager.ts:385:7 - (ae-forgotten-export) The symbol "UpdateQueries" needs to be exported by the entry point index.d.ts
// src/core/QueryManager.ts:144:5 - (ae-forgotten-export) The symbol "MutationStoreValue" needs to be exported by the entry point index.d.ts
// src/core/QueryManager.ts:389:7 - (ae-forgotten-export) The symbol "UpdateQueries" needs to be exported by the entry point index.d.ts
// src/core/types.ts:174:3 - (ae-forgotten-export) The symbol "MutationQueryReducer" needs to be exported by the entry point index.d.ts
// src/core/types.ts:203:5 - (ae-forgotten-export) The symbol "Resolver" needs to be exported by the entry point index.d.ts
// src/core/watchQueryOptions.ts:275:2 - (ae-forgotten-export) The symbol "UpdateQueryFn" needs to be exported by the entry point index.d.ts
Expand Down
Loading

0 comments on commit 1e4f9e3

Please sign in to comment.