Skip to content

Commit

Permalink
Don't throw on missing results with cache.diff and other changes (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
jerelmiller authored Jan 28, 2025
1 parent ae5d06a commit 86469a2
Show file tree
Hide file tree
Showing 41 changed files with 667 additions and 411 deletions.
21 changes: 14 additions & 7 deletions .api-reports/api-report-cache.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export abstract class ApolloCache<TSerialized> implements DataProxy {
readonly assumeImmutableResults: boolean;
// (undocumented)
batch<U>(options: Cache_2.BatchOptions<this, U>): U;
// (undocumented)
abstract diff<T>(query: Cache_2.DiffOptions): Cache_2.DiffResult<T>;
// (undocumented)
abstract evict(options: Cache_2.EvictOptions): boolean;
Expand Down Expand Up @@ -254,9 +253,14 @@ interface DataMasking {
export namespace DataProxy {
// (undocumented)
export type DiffResult<T> = {
result?: T;
complete?: boolean;
missing?: MissingFieldError[];
result: T;
complete: true;
missing?: never;
fromOptimisticTransaction?: boolean;
} | {
result: DeepPartial<T> | null;
complete: false;
missing?: MissingFieldError;
fromOptimisticTransaction?: boolean;
};
// (undocumented)
Expand Down Expand Up @@ -324,8 +328,6 @@ export interface DataProxy {
// @public (undocumented)
type DeepPartial<T> = T extends DeepPartialPrimitive ? T : T extends Map<infer TKey, infer TValue> ? DeepPartialMap<TKey, TValue> : T extends ReadonlyMap<infer TKey, infer TValue> ? DeepPartialReadonlyMap<TKey, TValue> : T extends Set<infer TItem> ? DeepPartialSet<TItem> : T extends ReadonlySet<infer TItem> ? DeepPartialReadonlySet<TItem> : T extends (...args: any[]) => unknown ? T | undefined : T extends object ? T extends (ReadonlyArray<infer TItem>) ? TItem[] extends (T) ? readonly TItem[] extends T ? ReadonlyArray<DeepPartial<TItem | undefined>> : Array<DeepPartial<TItem | undefined>> : DeepPartialObject<T> : DeepPartialObject<T> : unknown;

// Warning: (ae-forgotten-export) The symbol "DeepPartial" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
type DeepPartialMap<TKey, TValue> = {} & Map<DeepPartial<TKey>, DeepPartial<TValue>>;

Expand Down Expand Up @@ -661,6 +663,10 @@ export class InMemoryCache extends ApolloCache<NormalizedCacheObject> {
// (undocumented)
readonly policies: Policies;
// (undocumented)
read<T>(options: Cache_2.ReadOptions & {
returnPartialData: true;
}): T | DeepPartial<T> | null;
// (undocumented)
read<T>(options: Cache_2.ReadOptions): T | null;
// (undocumented)
release(rootId: string, optimistic?: boolean): number;
Expand Down Expand Up @@ -1182,7 +1188,8 @@ interface WriteContext extends ReadMergeModifyContext {

// Warnings were encountered during analysis:
//
// src/cache/core/cache.ts:92:7 - (ae-forgotten-export) The symbol "MaybeMasked" needs to be exported by the entry point index.d.ts
// src/cache/core/cache.ts:91:7 - (ae-forgotten-export) The symbol "MaybeMasked" needs to be exported by the entry point index.d.ts
// src/cache/core/types/DataProxy.ts:152:9 - (ae-forgotten-export) The symbol "DeepPartial" needs to be exported by the entry point index.d.ts
// src/cache/inmemory/policies.ts:93:3 - (ae-forgotten-export) The symbol "FragmentMap" needs to be exported by the entry point index.d.ts
// src/cache/inmemory/policies.ts:162:3 - (ae-forgotten-export) The symbol "KeySpecifier" needs to be exported by the entry point index.d.ts
// src/cache/inmemory/policies.ts:162:3 - (ae-forgotten-export) The symbol "KeyArgsFunction" needs to be exported by the entry point index.d.ts
Expand Down
19 changes: 13 additions & 6 deletions .api-reports/api-report-core.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ export abstract class ApolloCache<TSerialized> implements DataProxy {
readonly assumeImmutableResults: boolean;
// (undocumented)
batch<U>(options: Cache_2.BatchOptions<this, U>): U;
// (undocumented)
abstract diff<T>(query: Cache_2.DiffOptions): Cache_2.DiffResult<T>;
// (undocumented)
abstract evict(options: Cache_2.EvictOptions): boolean;
Expand Down Expand Up @@ -506,9 +505,14 @@ export interface DataMasking {
export namespace DataProxy {
// (undocumented)
export type DiffResult<T> = {
result?: T;
complete?: boolean;
missing?: MissingFieldError[];
result: T;
complete: true;
missing?: never;
fromOptimisticTransaction?: boolean;
} | {
result: DeepPartial<T> | null;
complete: false;
missing?: MissingFieldError;
fromOptimisticTransaction?: boolean;
};
// (undocumented)
Expand Down Expand Up @@ -576,8 +580,6 @@ export interface DataProxy {
// @public (undocumented)
type DeepPartial<T> = T extends DeepPartialPrimitive ? T : T extends Map<infer TKey, infer TValue> ? DeepPartialMap<TKey, TValue> : T extends ReadonlyMap<infer TKey, infer TValue> ? DeepPartialReadonlyMap<TKey, TValue> : T extends Set<infer TItem> ? DeepPartialSet<TItem> : T extends ReadonlySet<infer TItem> ? DeepPartialReadonlySet<TItem> : T extends (...args: any[]) => unknown ? T | undefined : T extends object ? T extends (ReadonlyArray<infer TItem>) ? TItem[] extends (T) ? readonly TItem[] extends T ? ReadonlyArray<DeepPartial<TItem | undefined>> : Array<DeepPartial<TItem | undefined>> : DeepPartialObject<T> : DeepPartialObject<T> : unknown;

// Warning: (ae-forgotten-export) The symbol "DeepPartial" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
type DeepPartialMap<TKey, TValue> = {} & Map<DeepPartial<TKey>, DeepPartial<TValue>>;

Expand Down Expand Up @@ -1187,6 +1189,10 @@ export class InMemoryCache extends ApolloCache<NormalizedCacheObject> {
// (undocumented)
readonly policies: Policies;
// (undocumented)
read<T>(options: Cache_2.ReadOptions & {
returnPartialData: true;
}): T | DeepPartial<T> | null;
// (undocumented)
read<T>(options: Cache_2.ReadOptions): T | null;
// (undocumented)
release(rootId: string, optimistic?: boolean): number;
Expand Down Expand Up @@ -2506,6 +2512,7 @@ interface WriteContext extends ReadMergeModifyContext {

// Warnings were encountered during analysis:
//
// src/cache/core/types/DataProxy.ts:152:9 - (ae-forgotten-export) The symbol "DeepPartial" needs to be exported by the entry point index.d.ts
// src/cache/inmemory/policies.ts:93:3 - (ae-forgotten-export) The symbol "FragmentMap" needs to be exported by the entry point index.d.ts
// src/cache/inmemory/policies.ts:162:3 - (ae-forgotten-export) The symbol "KeySpecifier" needs to be exported by the entry point index.d.ts
// src/cache/inmemory/policies.ts:162:3 - (ae-forgotten-export) The symbol "KeyArgsFunction" needs to be exported by the entry point index.d.ts
Expand Down
17 changes: 10 additions & 7 deletions .api-reports/api-report-masking.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ abstract class ApolloCache<TSerialized> implements DataProxy {
readonly assumeImmutableResults: boolean;
// (undocumented)
batch<U>(options: Cache_2.BatchOptions<this, U>): U;
// (undocumented)
abstract diff<T>(query: Cache_2.DiffOptions): Cache_2.DiffResult<T>;
// (undocumented)
abstract evict(options: Cache_2.EvictOptions): boolean;
Expand Down Expand Up @@ -235,9 +234,14 @@ export interface DataMasking {
namespace DataProxy {
// (undocumented)
type DiffResult<T> = {
result?: T;
complete?: boolean;
missing?: MissingFieldError[];
result: T;
complete: true;
missing?: never;
fromOptimisticTransaction?: boolean;
} | {
result: DeepPartial<T> | null;
complete: false;
missing?: MissingFieldError;
fromOptimisticTransaction?: boolean;
};
// (undocumented)
Expand Down Expand Up @@ -317,8 +321,6 @@ interface DataProxy {
// @public (undocumented)
type DeepPartial<T> = T extends DeepPartialPrimitive ? T : T extends Map<infer TKey, infer TValue> ? DeepPartialMap<TKey, TValue> : T extends ReadonlyMap<infer TKey, infer TValue> ? DeepPartialReadonlyMap<TKey, TValue> : T extends Set<infer TItem> ? DeepPartialSet<TItem> : T extends ReadonlySet<infer TItem> ? DeepPartialReadonlySet<TItem> : T extends (...args: any[]) => unknown ? T | undefined : T extends object ? T extends (ReadonlyArray<infer TItem>) ? TItem[] extends (T) ? readonly TItem[] extends T ? ReadonlyArray<DeepPartial<TItem | undefined>> : Array<DeepPartial<TItem | undefined>> : DeepPartialObject<T> : DeepPartialObject<T> : unknown;

// Warning: (ae-forgotten-export) The symbol "DeepPartial" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
type DeepPartialMap<TKey, TValue> = {} & Map<DeepPartial<TKey>, DeepPartial<TValue>>;

Expand Down Expand Up @@ -648,7 +650,8 @@ type WatchFragmentResult<TData> = {

// Warnings were encountered during analysis:
//
// src/cache/core/types/DataProxy.ts:147:7 - (ae-forgotten-export) The symbol "MissingFieldError" needs to be exported by the entry point index.d.ts
// src/cache/core/types/DataProxy.ts:152:9 - (ae-forgotten-export) The symbol "DeepPartial" needs to be exported by the entry point index.d.ts
// src/cache/core/types/DataProxy.ts:154:7 - (ae-forgotten-export) The symbol "MissingFieldError" needs to be exported by the entry point index.d.ts
// src/cache/core/types/common.ts:101:3 - (ae-forgotten-export) The symbol "ReadFieldFunction" needs to be exported by the entry point index.d.ts
// src/cache/core/types/common.ts:102:3 - (ae-forgotten-export) The symbol "CanReadFunction" needs to be exported by the entry point index.d.ts
// src/cache/core/types/common.ts:103:3 - (ae-forgotten-export) The symbol "isReference" needs to be exported by the entry point index.d.ts
Expand Down
17 changes: 10 additions & 7 deletions .api-reports/api-report-react.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ abstract class ApolloCache<TSerialized> implements DataProxy {
readonly assumeImmutableResults: boolean;
// (undocumented)
batch<U>(options: Cache_2.BatchOptions<this, U>): U;
// (undocumented)
abstract diff<T>(query: Cache_2.DiffOptions): Cache_2.DiffResult<T>;
// (undocumented)
abstract evict(options: Cache_2.EvictOptions): boolean;
Expand Down Expand Up @@ -599,9 +598,14 @@ interface DataMasking {
namespace DataProxy {
// (undocumented)
type DiffResult<T> = {
result?: T;
complete?: boolean;
missing?: MissingFieldError[];
result: T;
complete: true;
missing?: never;
fromOptimisticTransaction?: boolean;
} | {
result: DeepPartial<T> | null;
complete: false;
missing?: MissingFieldError;
fromOptimisticTransaction?: boolean;
};
// (undocumented)
Expand Down Expand Up @@ -681,8 +685,6 @@ interface DataProxy {
// @public (undocumented)
type DeepPartial<T> = T extends DeepPartialPrimitive ? T : T extends Map<infer TKey, infer TValue> ? DeepPartialMap<TKey, TValue> : T extends ReadonlyMap<infer TKey, infer TValue> ? DeepPartialReadonlyMap<TKey, TValue> : T extends Set<infer TItem> ? DeepPartialSet<TItem> : T extends ReadonlySet<infer TItem> ? DeepPartialReadonlySet<TItem> : T extends (...args: any[]) => unknown ? T | undefined : T extends object ? T extends (ReadonlyArray<infer TItem>) ? TItem[] extends (T) ? readonly TItem[] extends T ? ReadonlyArray<DeepPartial<TItem | undefined>> : Array<DeepPartial<TItem | undefined>> : DeepPartialObject<T> : DeepPartialObject<T> : unknown;

// Warning: (ae-forgotten-export) The symbol "DeepPartial" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
type DeepPartialMap<TKey, TValue> = {} & Map<DeepPartial<TKey>, DeepPartial<TValue>>;

Expand Down Expand Up @@ -2511,7 +2513,8 @@ interface WatchQueryOptions<TVariables extends OperationVariables = OperationVar

// Warnings were encountered during analysis:
//
// src/cache/core/types/DataProxy.ts:147:7 - (ae-forgotten-export) The symbol "MissingFieldError" needs to be exported by the entry point index.d.ts
// src/cache/core/types/DataProxy.ts:152:9 - (ae-forgotten-export) The symbol "DeepPartial" needs to be exported by the entry point index.d.ts
// src/cache/core/types/DataProxy.ts:154:7 - (ae-forgotten-export) The symbol "MissingFieldError" needs to be exported by the entry point index.d.ts
// src/cache/core/types/common.ts:101:3 - (ae-forgotten-export) The symbol "ReadFieldFunction" needs to be exported by the entry point index.d.ts
// src/cache/core/types/common.ts:102:3 - (ae-forgotten-export) The symbol "CanReadFunction" needs to be exported by the entry point index.d.ts
// src/cache/core/types/common.ts:103:3 - (ae-forgotten-export) The symbol "isReference" needs to be exported by the entry point index.d.ts
Expand Down
17 changes: 10 additions & 7 deletions .api-reports/api-report-react_context.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ abstract class ApolloCache<TSerialized> implements DataProxy {
readonly assumeImmutableResults: boolean;
// (undocumented)
batch<U>(options: Cache_2.BatchOptions<this, U>): U;
// (undocumented)
abstract diff<T>(query: Cache_2.DiffOptions): Cache_2.DiffResult<T>;
// (undocumented)
abstract evict(options: Cache_2.EvictOptions): boolean;
Expand Down Expand Up @@ -532,9 +531,14 @@ interface DataMasking {
namespace DataProxy {
// (undocumented)
type DiffResult<T> = {
result?: T;
complete?: boolean;
missing?: MissingFieldError[];
result: T;
complete: true;
missing?: never;
fromOptimisticTransaction?: boolean;
} | {
result: DeepPartial<T> | null;
complete: false;
missing?: MissingFieldError;
fromOptimisticTransaction?: boolean;
};
// (undocumented)
Expand Down Expand Up @@ -614,8 +618,6 @@ interface DataProxy {
// @public (undocumented)
type DeepPartial<T> = T extends DeepPartialPrimitive ? T : T extends Map<infer TKey, infer TValue> ? DeepPartialMap<TKey, TValue> : T extends ReadonlyMap<infer TKey, infer TValue> ? DeepPartialReadonlyMap<TKey, TValue> : T extends Set<infer TItem> ? DeepPartialSet<TItem> : T extends ReadonlySet<infer TItem> ? DeepPartialReadonlySet<TItem> : T extends (...args: any[]) => unknown ? T | undefined : T extends object ? T extends (ReadonlyArray<infer TItem>) ? TItem[] extends (T) ? readonly TItem[] extends T ? ReadonlyArray<DeepPartial<TItem | undefined>> : Array<DeepPartial<TItem | undefined>> : DeepPartialObject<T> : DeepPartialObject<T> : unknown;

// Warning: (ae-forgotten-export) The symbol "DeepPartial" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
type DeepPartialMap<TKey, TValue> = {} & Map<DeepPartial<TKey>, DeepPartial<TValue>>;

Expand Down Expand Up @@ -1913,7 +1915,8 @@ interface WatchQueryOptions<TVariables extends OperationVariables = OperationVar

// Warnings were encountered during analysis:
//
// src/cache/core/types/DataProxy.ts:147:7 - (ae-forgotten-export) The symbol "MissingFieldError" needs to be exported by the entry point index.d.ts
// src/cache/core/types/DataProxy.ts:152:9 - (ae-forgotten-export) The symbol "DeepPartial" needs to be exported by the entry point index.d.ts
// src/cache/core/types/DataProxy.ts:154:7 - (ae-forgotten-export) The symbol "MissingFieldError" needs to be exported by the entry point index.d.ts
// src/cache/core/types/common.ts:101:3 - (ae-forgotten-export) The symbol "ReadFieldFunction" needs to be exported by the entry point index.d.ts
// src/cache/core/types/common.ts:102:3 - (ae-forgotten-export) The symbol "CanReadFunction" needs to be exported by the entry point index.d.ts
// src/cache/core/types/common.ts:103:3 - (ae-forgotten-export) The symbol "isReference" needs to be exported by the entry point index.d.ts
Expand Down
17 changes: 10 additions & 7 deletions .api-reports/api-report-react_hooks.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ abstract class ApolloCache<TSerialized> implements DataProxy {
readonly assumeImmutableResults: boolean;
// (undocumented)
batch<U>(options: Cache_2.BatchOptions<this, U>): U;
// (undocumented)
abstract diff<T>(query: Cache_2.DiffOptions): Cache_2.DiffResult<T>;
// (undocumented)
abstract evict(options: Cache_2.EvictOptions): boolean;
Expand Down Expand Up @@ -561,9 +560,14 @@ interface DataMasking {
namespace DataProxy {
// (undocumented)
type DiffResult<T> = {
result?: T;
complete?: boolean;
missing?: MissingFieldError[];
result: T;
complete: true;
missing?: never;
fromOptimisticTransaction?: boolean;
} | {
result: DeepPartial<T> | null;
complete: false;
missing?: MissingFieldError;
fromOptimisticTransaction?: boolean;
};
// (undocumented)
Expand Down Expand Up @@ -643,8 +647,6 @@ interface DataProxy {
// @public (undocumented)
type DeepPartial<T> = T extends DeepPartialPrimitive ? T : T extends Map<infer TKey, infer TValue> ? DeepPartialMap<TKey, TValue> : T extends ReadonlyMap<infer TKey, infer TValue> ? DeepPartialReadonlyMap<TKey, TValue> : T extends Set<infer TItem> ? DeepPartialSet<TItem> : T extends ReadonlySet<infer TItem> ? DeepPartialReadonlySet<TItem> : T extends (...args: any[]) => unknown ? T | undefined : T extends object ? T extends (ReadonlyArray<infer TItem>) ? TItem[] extends (T) ? readonly TItem[] extends T ? ReadonlyArray<DeepPartial<TItem | undefined>> : Array<DeepPartial<TItem | undefined>> : DeepPartialObject<T> : DeepPartialObject<T> : unknown;

// Warning: (ae-forgotten-export) The symbol "DeepPartial" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
type DeepPartialMap<TKey, TValue> = {} & Map<DeepPartial<TKey>, DeepPartial<TValue>>;

Expand Down Expand Up @@ -2338,7 +2340,8 @@ interface WatchQueryOptions<TVariables extends OperationVariables = OperationVar

// Warnings were encountered during analysis:
//
// src/cache/core/types/DataProxy.ts:147:7 - (ae-forgotten-export) The symbol "MissingFieldError" needs to be exported by the entry point index.d.ts
// src/cache/core/types/DataProxy.ts:152:9 - (ae-forgotten-export) The symbol "DeepPartial" needs to be exported by the entry point index.d.ts
// src/cache/core/types/DataProxy.ts:154:7 - (ae-forgotten-export) The symbol "MissingFieldError" needs to be exported by the entry point index.d.ts
// src/cache/core/types/common.ts:101:3 - (ae-forgotten-export) The symbol "ReadFieldFunction" needs to be exported by the entry point index.d.ts
// src/cache/core/types/common.ts:102:3 - (ae-forgotten-export) The symbol "CanReadFunction" needs to be exported by the entry point index.d.ts
// src/cache/core/types/common.ts:103:3 - (ae-forgotten-export) The symbol "isReference" needs to be exported by the entry point index.d.ts
Expand Down
Loading

0 comments on commit 86469a2

Please sign in to comment.