diff --git a/.api-reports/api-report-cache.md b/.api-reports/api-report-cache.md index 7eed64d3052..10deafdae0e 100644 --- a/.api-reports/api-report-cache.md +++ b/.api-reports/api-report-cache.md @@ -8,9 +8,10 @@ import type { DocumentNode } from 'graphql'; import type { FieldNode } from 'graphql'; import type { FragmentDefinitionNode } from 'graphql'; import type { InlineFragmentNode } from 'graphql'; +import { Observable } from 'zen-observable-ts'; import type { SelectionSetNode } from 'graphql'; import { Trie } from '@wry/trie'; -import type { TypedDocumentNode } from '@graphql-typed-document-node/core'; +import { TypedDocumentNode } from '@graphql-typed-document-node/core'; // Warning: (ae-forgotten-export) The symbol "StoreObjectValueMaybeReference" needs to be exported by the entry point index.d.ts // @@ -63,6 +64,12 @@ export abstract class ApolloCache implements DataProxy { updateQuery(options: Cache_2.UpdateQueryOptions, update: (data: TData | null) => TData | null | void): TData | null; // (undocumented) abstract watch(watch: Cache_2.WatchOptions): () => void; + // Warning: (ae-forgotten-export) The symbol "OperationVariables" needs to be exported by the entry point index.d.ts + // Warning: (ae-forgotten-export) The symbol "WatchFragmentOptions" needs to be exported by the entry point index.d.ts + // Warning: (ae-forgotten-export) The symbol "WatchFragmentResult" needs to be exported by the entry point index.d.ts + // + // (undocumented) + watchFragment(options: WatchFragmentOptions): Observable>; // (undocumented) abstract write(write: Cache_2.WriteOptions): Reference | undefined; // (undocumented) @@ -274,6 +281,40 @@ export interface DataProxy { writeQuery(options: DataProxy.WriteQueryOptions): Reference | undefined; } +// Warning: (ae-forgotten-export) The symbol "DeepPartialPrimitive" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "DeepPartialMap" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "DeepPartialReadonlyMap" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "DeepPartialSet" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "DeepPartialReadonlySet" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "DeepPartialObject" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type DeepPartial = T extends DeepPartialPrimitive ? T : T extends Map ? DeepPartialMap : T extends ReadonlyMap ? DeepPartialReadonlyMap : T extends Set ? DeepPartialSet : T extends ReadonlySet ? DeepPartialReadonlySet : T extends (...args: any[]) => unknown ? T | undefined : T extends object ? T extends (ReadonlyArray) ? TItem[] extends (T) ? readonly TItem[] extends T ? ReadonlyArray> : Array> : DeepPartialObject : DeepPartialObject : unknown; + +// Warning: (ae-forgotten-export) The symbol "DeepPartial" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type DeepPartialMap = {} & Map, DeepPartial>; + +// @public (undocumented) +type DeepPartialObject = { + [K in keyof T]?: DeepPartial; +}; + +// Warning: (ae-forgotten-export) The symbol "Primitive" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type DeepPartialPrimitive = Primitive | Date | RegExp; + +// @public (undocumented) +type DeepPartialReadonlyMap = {} & ReadonlyMap, DeepPartial>; + +// @public (undocumented) +type DeepPartialReadonlySet = {} & ReadonlySet>; + +// @public (undocumented) +type DeepPartialSet = {} & Set>; + // Warning: (ae-forgotten-export) The symbol "KeyFieldsContext" needs to be exported by the entry point index.d.ts // // @public (undocumented) @@ -533,8 +574,6 @@ export class InMemoryCache extends ApolloCache { protected broadcastWatches(options?: BroadcastOptions): void; // (undocumented) protected config: InMemoryCacheConfig; - // Warning: (ae-forgotten-export) The symbol "OperationVariables" needs to be exported by the entry point index.d.ts - // // (undocumented) diff(options: Cache_2.DiffOptions): Cache_2.DiffResult; // (undocumented) @@ -824,6 +863,9 @@ export type PossibleTypesMap = { [supertype: string]: string[]; }; +// @public (undocumented) +type Primitive = null | undefined | string | number | boolean | symbol | bigint; + // @public (undocumented) type ReactiveListener = (value: T) => any; @@ -936,6 +978,32 @@ export type TypePolicy = { }; }; +// @public (undocumented) +interface WatchFragmentOptions { + // @deprecated (undocumented) + canonizeResults?: boolean; + // (undocumented) + fragment: DocumentNode | TypedDocumentNode; + // (undocumented) + fragmentName?: string; + // (undocumented) + from: StoreObject | Reference | string; + // (undocumented) + optimistic?: boolean; + variables?: TVars; +} + +// @public (undocumented) +type WatchFragmentResult = { + data: TData; + complete: true; + missing?: never; +} | { + data: DeepPartial; + complete: false; + missing: MissingTree; +}; + // @public (undocumented) interface WriteContext extends ReadMergeModifyContext { // (undocumented) diff --git a/.api-reports/api-report-core.md b/.api-reports/api-report-core.md index 1ebf61607a3..98d5c19e43b 100644 --- a/.api-reports/api-report-core.md +++ b/.api-reports/api-report-core.md @@ -79,6 +79,11 @@ export abstract class ApolloCache implements DataProxy { updateQuery(options: Cache_2.UpdateQueryOptions, update: (data: TData | null) => TData | null | void): TData | null; // (undocumented) abstract watch(watch: Cache_2.WatchOptions): () => void; + // Warning: (ae-forgotten-export) The symbol "WatchFragmentOptions" needs to be exported by the entry point index.d.ts + // Warning: (ae-forgotten-export) The symbol "WatchFragmentResult" needs to be exported by the entry point index.d.ts + // + // (undocumented) + watchFragment(options: WatchFragmentOptions): Observable>; // (undocumented) abstract write(write: Cache_2.WriteOptions): Reference | undefined; // (undocumented) @@ -136,6 +141,10 @@ export class ApolloClient implements DataProxy { readonly typeDefs: ApolloClientOptions["typeDefs"]; // (undocumented) version: string; + // Warning: (ae-unresolved-link) The @link reference could not be resolved: This type of declaration is not supported yet by the resolver + // Warning: (ae-unresolved-link) The @link reference could not be resolved: This type of declaration is not supported yet by the resolver + // Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "@apollo/client" does not have an export "WatchFragmentOptions" + watchFragment(options: WatchFragmentOptions): Observable>; watchQuery(options: WatchQueryOptions): ObservableQuery; writeFragment(options: DataProxy.WriteFragmentOptions): Reference | undefined; writeQuery(options: DataProxy.WriteQueryOptions): Reference | undefined; @@ -523,6 +532,40 @@ export interface DataProxy { writeQuery(options: DataProxy.WriteQueryOptions): Reference | undefined; } +// Warning: (ae-forgotten-export) The symbol "DeepPartialPrimitive" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "DeepPartialMap" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "DeepPartialReadonlyMap" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "DeepPartialSet" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "DeepPartialReadonlySet" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "DeepPartialObject" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type DeepPartial = T extends DeepPartialPrimitive ? T : T extends Map ? DeepPartialMap : T extends ReadonlyMap ? DeepPartialReadonlyMap : T extends Set ? DeepPartialSet : T extends ReadonlySet ? DeepPartialReadonlySet : T extends (...args: any[]) => unknown ? T | undefined : T extends object ? T extends (ReadonlyArray) ? TItem[] extends (T) ? readonly TItem[] extends T ? ReadonlyArray> : Array> : DeepPartialObject : DeepPartialObject : unknown; + +// Warning: (ae-forgotten-export) The symbol "DeepPartial" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type DeepPartialMap = {} & Map, DeepPartial>; + +// @public (undocumented) +type DeepPartialObject = { + [K in keyof T]?: DeepPartial; +}; + +// Warning: (ae-forgotten-export) The symbol "Primitive" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type DeepPartialPrimitive = Primitive | Date | RegExp; + +// @public (undocumented) +type DeepPartialReadonlyMap = {} & ReadonlyMap, DeepPartial>; + +// @public (undocumented) +type DeepPartialReadonlySet = {} & ReadonlySet>; + +// @public (undocumented) +type DeepPartialSet = {} & Set>; + // @public (undocumented) export interface DefaultContext extends Record { } @@ -1636,6 +1679,9 @@ export type PossibleTypesMap = { [supertype: string]: string[]; }; +// @public (undocumented) +type Primitive = null | undefined | string | number | boolean | symbol | bigint; + // @public (undocumented) const print_2: ((ast: ASTNode) => string) & { reset(): void; @@ -2174,6 +2220,32 @@ export interface UriFunction { (operation: Operation): string; } +// @public (undocumented) +interface WatchFragmentOptions { + // @deprecated (undocumented) + canonizeResults?: boolean; + // (undocumented) + fragment: DocumentNode | TypedDocumentNode; + // (undocumented) + fragmentName?: string; + // (undocumented) + from: StoreObject | Reference | string; + // (undocumented) + optimistic?: boolean; + variables?: TVars; +} + +// @public (undocumented) +type WatchFragmentResult = { + data: TData; + complete: true; + missing?: never; +} | { + data: DeepPartial; + complete: false; + missing: MissingTree; +}; + // @public (undocumented) export type WatchQueryFetchPolicy = FetchPolicy | "cache-and-network"; diff --git a/.api-reports/api-report-react.md b/.api-reports/api-report-react.md index 0cdf3ce93bc..cde49cab950 100644 --- a/.api-reports/api-report-react.md +++ b/.api-reports/api-report-react.md @@ -80,6 +80,12 @@ abstract class ApolloCache implements DataProxy { updateQuery(options: Cache_2.UpdateQueryOptions, update: (data: TData | null) => TData | null | void): TData | null; // (undocumented) abstract watch(watch: Cache_2.WatchOptions): () => void; + // Warning: (ae-forgotten-export) The symbol "OperationVariables" needs to be exported by the entry point index.d.ts + // Warning: (ae-forgotten-export) The symbol "WatchFragmentOptions" needs to be exported by the entry point index.d.ts + // Warning: (ae-forgotten-export) The symbol "WatchFragmentResult" needs to be exported by the entry point index.d.ts + // + // (undocumented) + watchFragment(options: WatchFragmentOptions): Observable>; // Warning: (ae-forgotten-export) The symbol "Reference" needs to be exported by the entry point index.d.ts // // (undocumented) @@ -161,7 +167,10 @@ class ApolloClient implements DataProxy { readonly typeDefs: ApolloClientOptions["typeDefs"]; // (undocumented) version: string; - // Warning: (ae-forgotten-export) The symbol "OperationVariables" needs to be exported by the entry point index.d.ts + // Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "@apollo/client" does not have an export "Observable" + // Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "@apollo/client" does not have an export "Observable" + // Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "@apollo/client" does not have an export "WatchFragmentOptions" + watchFragment(options: WatchFragmentOptions): Observable>; // Warning: (ae-forgotten-export) The symbol "WatchQueryOptions" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "ObservableQuery" needs to be exported by the entry point index.d.ts // Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "@apollo/client" does not have an export "ObservableQuery" @@ -2372,6 +2381,32 @@ TVariables variables: TVariables; }; +// @public (undocumented) +interface WatchFragmentOptions { + // @deprecated (undocumented) + canonizeResults?: boolean; + // (undocumented) + fragment: DocumentNode | TypedDocumentNode; + // (undocumented) + fragmentName?: string; + // (undocumented) + from: StoreObject | Reference | string; + // (undocumented) + optimistic?: boolean; + variables?: TVars; +} + +// @public (undocumented) +type WatchFragmentResult = { + data: TData; + complete: true; + missing?: never; +} | { + data: DeepPartial; + complete: false; + missing: MissingTree; +}; + // @public (undocumented) type WatchQueryFetchPolicy = FetchPolicy | "cache-and-network"; diff --git a/.api-reports/api-report-react_components.md b/.api-reports/api-report-react_components.md index a4e212edb9f..04605103ccc 100644 --- a/.api-reports/api-report-react_components.md +++ b/.api-reports/api-report-react_components.md @@ -80,6 +80,12 @@ abstract class ApolloCache implements DataProxy { updateQuery(options: Cache_2.UpdateQueryOptions, update: (data: TData | null) => TData | null | void): TData | null; // (undocumented) abstract watch(watch: Cache_2.WatchOptions): () => void; + // Warning: (ae-forgotten-export) The symbol "OperationVariables" needs to be exported by the entry point index.d.ts + // Warning: (ae-forgotten-export) The symbol "WatchFragmentOptions" needs to be exported by the entry point index.d.ts + // Warning: (ae-forgotten-export) The symbol "WatchFragmentResult" needs to be exported by the entry point index.d.ts + // + // (undocumented) + watchFragment(options: WatchFragmentOptions): Observable>; // Warning: (ae-forgotten-export) The symbol "Reference" needs to be exported by the entry point index.d.ts // // (undocumented) @@ -162,7 +168,10 @@ class ApolloClient implements DataProxy { readonly typeDefs: ApolloClientOptions["typeDefs"]; // (undocumented) version: string; - // Warning: (ae-forgotten-export) The symbol "OperationVariables" needs to be exported by the entry point index.d.ts + // Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "@apollo/client" does not have an export "Observable" + // Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "@apollo/client" does not have an export "Observable" + // Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "@apollo/client" does not have an export "WatchFragmentOptions" + watchFragment(options: WatchFragmentOptions): Observable>; // Warning: (ae-forgotten-export) The symbol "WatchQueryOptions" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "ObservableQuery" needs to be exported by the entry point index.d.ts // Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "@apollo/client" does not have an export "ObservableQuery" @@ -565,6 +574,40 @@ interface DataProxy { writeQuery(options: DataProxy.WriteQueryOptions): Reference | undefined; } +// Warning: (ae-forgotten-export) The symbol "DeepPartialPrimitive" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "DeepPartialMap" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "DeepPartialReadonlyMap" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "DeepPartialSet" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "DeepPartialReadonlySet" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "DeepPartialObject" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type DeepPartial = T extends DeepPartialPrimitive ? T : T extends Map ? DeepPartialMap : T extends ReadonlyMap ? DeepPartialReadonlyMap : T extends Set ? DeepPartialSet : T extends ReadonlySet ? DeepPartialReadonlySet : T extends (...args: any[]) => unknown ? T | undefined : T extends object ? T extends (ReadonlyArray) ? TItem[] extends (T) ? readonly TItem[] extends T ? ReadonlyArray> : Array> : DeepPartialObject : DeepPartialObject : unknown; + +// Warning: (ae-forgotten-export) The symbol "DeepPartial" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type DeepPartialMap = {} & Map, DeepPartial>; + +// @public (undocumented) +type DeepPartialObject = { + [K in keyof T]?: DeepPartial; +}; + +// Warning: (ae-forgotten-export) The symbol "Primitive" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type DeepPartialPrimitive = Primitive | Date | RegExp; + +// @public (undocumented) +type DeepPartialReadonlyMap = {} & ReadonlyMap, DeepPartial>; + +// @public (undocumented) +type DeepPartialReadonlySet = {} & ReadonlySet>; + +// @public (undocumented) +type DeepPartialSet = {} & Set>; + // @public (undocumented) interface DefaultContext extends Record { } @@ -1203,6 +1246,9 @@ type OperationVariables = Record; // @public (undocumented) type Path = ReadonlyArray; +// @public (undocumented) +type Primitive = null | undefined | string | number | boolean | symbol | bigint; + // @public @deprecated (undocumented) export function Query(props: QueryComponentOptions): ReactTypes.JSX.Element | null; @@ -1712,6 +1758,32 @@ interface UriFunction { (operation: Operation): string; } +// @public (undocumented) +interface WatchFragmentOptions { + // @deprecated (undocumented) + canonizeResults?: boolean; + // (undocumented) + fragment: DocumentNode | TypedDocumentNode; + // (undocumented) + fragmentName?: string; + // (undocumented) + from: StoreObject | Reference | string; + // (undocumented) + optimistic?: boolean; + variables?: TVars; +} + +// @public (undocumented) +type WatchFragmentResult = { + data: TData; + complete: true; + missing?: never; +} | { + data: DeepPartial; + complete: false; + missing: MissingTree; +}; + // @public (undocumented) type WatchQueryFetchPolicy = FetchPolicy | "cache-and-network"; diff --git a/.api-reports/api-report-react_context.md b/.api-reports/api-report-react_context.md index 3ec73691a66..9a0ba096caf 100644 --- a/.api-reports/api-report-react_context.md +++ b/.api-reports/api-report-react_context.md @@ -79,6 +79,12 @@ abstract class ApolloCache implements DataProxy { updateQuery(options: Cache_2.UpdateQueryOptions, update: (data: TData | null) => TData | null | void): TData | null; // (undocumented) abstract watch(watch: Cache_2.WatchOptions): () => void; + // Warning: (ae-forgotten-export) The symbol "OperationVariables" needs to be exported by the entry point index.d.ts + // Warning: (ae-forgotten-export) The symbol "WatchFragmentOptions" needs to be exported by the entry point index.d.ts + // Warning: (ae-forgotten-export) The symbol "WatchFragmentResult" needs to be exported by the entry point index.d.ts + // + // (undocumented) + watchFragment(options: WatchFragmentOptions): Observable>; // Warning: (ae-forgotten-export) The symbol "Reference" needs to be exported by the entry point index.d.ts // // (undocumented) @@ -161,7 +167,10 @@ class ApolloClient implements DataProxy { readonly typeDefs: ApolloClientOptions["typeDefs"]; // (undocumented) version: string; - // Warning: (ae-forgotten-export) The symbol "OperationVariables" needs to be exported by the entry point index.d.ts + // Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "@apollo/client" does not have an export "Observable" + // Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "@apollo/client" does not have an export "Observable" + // Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "@apollo/client" does not have an export "WatchFragmentOptions" + watchFragment(options: WatchFragmentOptions): Observable>; // Warning: (ae-forgotten-export) The symbol "WatchQueryOptions" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "ObservableQuery" needs to be exported by the entry point index.d.ts // Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "@apollo/client" does not have an export "ObservableQuery" @@ -563,6 +572,40 @@ interface DataProxy { writeQuery(options: DataProxy.WriteQueryOptions): Reference | undefined; } +// Warning: (ae-forgotten-export) The symbol "DeepPartialPrimitive" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "DeepPartialMap" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "DeepPartialReadonlyMap" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "DeepPartialSet" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "DeepPartialReadonlySet" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "DeepPartialObject" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type DeepPartial = T extends DeepPartialPrimitive ? T : T extends Map ? DeepPartialMap : T extends ReadonlyMap ? DeepPartialReadonlyMap : T extends Set ? DeepPartialSet : T extends ReadonlySet ? DeepPartialReadonlySet : T extends (...args: any[]) => unknown ? T | undefined : T extends object ? T extends (ReadonlyArray) ? TItem[] extends (T) ? readonly TItem[] extends T ? ReadonlyArray> : Array> : DeepPartialObject : DeepPartialObject : unknown; + +// Warning: (ae-forgotten-export) The symbol "DeepPartial" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type DeepPartialMap = {} & Map, DeepPartial>; + +// @public (undocumented) +type DeepPartialObject = { + [K in keyof T]?: DeepPartial; +}; + +// Warning: (ae-forgotten-export) The symbol "Primitive" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type DeepPartialPrimitive = Primitive | Date | RegExp; + +// @public (undocumented) +type DeepPartialReadonlyMap = {} & ReadonlyMap, DeepPartial>; + +// @public (undocumented) +type DeepPartialReadonlySet = {} & ReadonlySet>; + +// @public (undocumented) +type DeepPartialSet = {} & Set>; + // @public (undocumented) interface DefaultContext extends Record { } @@ -1142,6 +1185,9 @@ type OperationVariables = Record; // @public (undocumented) type Path = ReadonlyArray; +// @public (undocumented) +type Primitive = null | undefined | string | number | boolean | symbol | bigint; + // @public (undocumented) interface QueryData { // (undocumented) @@ -1635,6 +1681,32 @@ interface UriFunction { (operation: Operation): string; } +// @public (undocumented) +interface WatchFragmentOptions { + // @deprecated (undocumented) + canonizeResults?: boolean; + // (undocumented) + fragment: DocumentNode | TypedDocumentNode; + // (undocumented) + fragmentName?: string; + // (undocumented) + from: StoreObject | Reference | string; + // (undocumented) + optimistic?: boolean; + variables?: TVars; +} + +// @public (undocumented) +type WatchFragmentResult = { + data: TData; + complete: true; + missing?: never; +} | { + data: DeepPartial; + complete: false; + missing: MissingTree; +}; + // @public (undocumented) type WatchQueryFetchPolicy = FetchPolicy | "cache-and-network"; diff --git a/.api-reports/api-report-react_hoc.md b/.api-reports/api-report-react_hoc.md index 107a19b3bbd..95b584052f0 100644 --- a/.api-reports/api-report-react_hoc.md +++ b/.api-reports/api-report-react_hoc.md @@ -79,6 +79,12 @@ abstract class ApolloCache implements DataProxy { updateQuery(options: Cache_2.UpdateQueryOptions, update: (data: TData | null) => TData | null | void): TData | null; // (undocumented) abstract watch(watch: Cache_2.WatchOptions): () => void; + // Warning: (ae-forgotten-export) The symbol "OperationVariables" needs to be exported by the entry point index.d.ts + // Warning: (ae-forgotten-export) The symbol "WatchFragmentOptions" needs to be exported by the entry point index.d.ts + // Warning: (ae-forgotten-export) The symbol "WatchFragmentResult" needs to be exported by the entry point index.d.ts + // + // (undocumented) + watchFragment(options: WatchFragmentOptions): Observable>; // Warning: (ae-forgotten-export) The symbol "Reference" needs to be exported by the entry point index.d.ts // // (undocumented) @@ -161,7 +167,10 @@ class ApolloClient implements DataProxy { readonly typeDefs: ApolloClientOptions["typeDefs"]; // (undocumented) version: string; - // Warning: (ae-forgotten-export) The symbol "OperationVariables" needs to be exported by the entry point index.d.ts + // Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "@apollo/client" does not have an export "Observable" + // Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "@apollo/client" does not have an export "Observable" + // Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "@apollo/client" does not have an export "WatchFragmentOptions" + watchFragment(options: WatchFragmentOptions): Observable>; // Warning: (ae-forgotten-export) The symbol "WatchQueryOptions" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "ObservableQuery" needs to be exported by the entry point index.d.ts // Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "@apollo/client" does not have an export "ObservableQuery" @@ -561,6 +570,40 @@ interface DataProxy { // @public (undocumented) export type DataValue = QueryControls & Partial; +// Warning: (ae-forgotten-export) The symbol "DeepPartialPrimitive" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "DeepPartialMap" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "DeepPartialReadonlyMap" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "DeepPartialSet" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "DeepPartialReadonlySet" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "DeepPartialObject" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type DeepPartial = T extends DeepPartialPrimitive ? T : T extends Map ? DeepPartialMap : T extends ReadonlyMap ? DeepPartialReadonlyMap : T extends Set ? DeepPartialSet : T extends ReadonlySet ? DeepPartialReadonlySet : T extends (...args: any[]) => unknown ? T | undefined : T extends object ? T extends (ReadonlyArray) ? TItem[] extends (T) ? readonly TItem[] extends T ? ReadonlyArray> : Array> : DeepPartialObject : DeepPartialObject : unknown; + +// Warning: (ae-forgotten-export) The symbol "DeepPartial" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type DeepPartialMap = {} & Map, DeepPartial>; + +// @public (undocumented) +type DeepPartialObject = { + [K in keyof T]?: DeepPartial; +}; + +// Warning: (ae-forgotten-export) The symbol "Primitive" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type DeepPartialPrimitive = Primitive | Date | RegExp; + +// @public (undocumented) +type DeepPartialReadonlyMap = {} & ReadonlyMap, DeepPartial>; + +// @public (undocumented) +type DeepPartialReadonlySet = {} & ReadonlySet>; + +// @public (undocumented) +type DeepPartialSet = {} & Set>; + // @public (undocumented) interface DefaultContext extends Record { } @@ -1189,6 +1232,9 @@ export interface OptionProps; +// @public (undocumented) +type Primitive = null | undefined | string | number | boolean | symbol | bigint; + // @public (undocumented) export interface QueryControls { // (undocumented) @@ -1647,6 +1693,32 @@ interface UriFunction { (operation: Operation): string; } +// @public (undocumented) +interface WatchFragmentOptions { + // @deprecated (undocumented) + canonizeResults?: boolean; + // (undocumented) + fragment: DocumentNode | TypedDocumentNode; + // (undocumented) + fragmentName?: string; + // (undocumented) + from: StoreObject | Reference | string; + // (undocumented) + optimistic?: boolean; + variables?: TVars; +} + +// @public (undocumented) +type WatchFragmentResult = { + data: TData; + complete: true; + missing?: never; +} | { + data: DeepPartial; + complete: false; + missing: MissingTree; +}; + // @public (undocumented) type WatchQueryFetchPolicy = FetchPolicy | "cache-and-network"; diff --git a/.api-reports/api-report-react_hooks.md b/.api-reports/api-report-react_hooks.md index 4abfa6b4bd0..05aa2224c13 100644 --- a/.api-reports/api-report-react_hooks.md +++ b/.api-reports/api-report-react_hooks.md @@ -78,6 +78,12 @@ abstract class ApolloCache implements DataProxy { updateQuery(options: Cache_2.UpdateQueryOptions, update: (data: TData | null) => TData | null | void): TData | null; // (undocumented) abstract watch(watch: Cache_2.WatchOptions): () => void; + // Warning: (ae-forgotten-export) The symbol "OperationVariables" needs to be exported by the entry point index.d.ts + // Warning: (ae-forgotten-export) The symbol "WatchFragmentOptions" needs to be exported by the entry point index.d.ts + // Warning: (ae-forgotten-export) The symbol "WatchFragmentResult" needs to be exported by the entry point index.d.ts + // + // (undocumented) + watchFragment(options: WatchFragmentOptions): Observable>; // Warning: (ae-forgotten-export) The symbol "Reference" needs to be exported by the entry point index.d.ts // // (undocumented) @@ -160,7 +166,10 @@ class ApolloClient implements DataProxy { readonly typeDefs: ApolloClientOptions["typeDefs"]; // (undocumented) version: string; - // Warning: (ae-forgotten-export) The symbol "OperationVariables" needs to be exported by the entry point index.d.ts + // Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "@apollo/client" does not have an export "Observable" + // Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "@apollo/client" does not have an export "Observable" + // Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "@apollo/client" does not have an export "WatchFragmentOptions" + watchFragment(options: WatchFragmentOptions): Observable>; // Warning: (ae-forgotten-export) The symbol "WatchQueryOptions" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "ObservableQuery" needs to be exported by the entry point index.d.ts // Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "@apollo/client" does not have an export "ObservableQuery" @@ -2208,6 +2217,32 @@ export interface UseSuspenseQueryResult; } +// @public (undocumented) +interface WatchFragmentOptions { + // @deprecated (undocumented) + canonizeResults?: boolean; + // (undocumented) + fragment: DocumentNode | TypedDocumentNode; + // (undocumented) + fragmentName?: string; + // (undocumented) + from: StoreObject | Reference | string; + // (undocumented) + optimistic?: boolean; + variables?: TVars; +} + +// @public (undocumented) +type WatchFragmentResult = { + data: TData; + complete: true; + missing?: never; +} | { + data: DeepPartial; + complete: false; + missing: MissingTree; +}; + // @public (undocumented) type WatchQueryFetchPolicy = FetchPolicy | "cache-and-network"; diff --git a/.api-reports/api-report-react_internal.md b/.api-reports/api-report-react_internal.md index 9b76bda9bbc..ba8370d5371 100644 --- a/.api-reports/api-report-react_internal.md +++ b/.api-reports/api-report-react_internal.md @@ -78,6 +78,12 @@ abstract class ApolloCache implements DataProxy { updateQuery(options: Cache_2.UpdateQueryOptions, update: (data: TData | null) => TData | null | void): TData | null; // (undocumented) abstract watch(watch: Cache_2.WatchOptions): () => void; + // Warning: (ae-forgotten-export) The symbol "OperationVariables" needs to be exported by the entry point index.d.ts + // Warning: (ae-forgotten-export) The symbol "WatchFragmentOptions" needs to be exported by the entry point index.d.ts + // Warning: (ae-forgotten-export) The symbol "WatchFragmentResult" needs to be exported by the entry point index.d.ts + // + // (undocumented) + watchFragment(options: WatchFragmentOptions): Observable>; // Warning: (ae-forgotten-export) The symbol "Reference" needs to be exported by the entry point index.d.ts // // (undocumented) @@ -160,7 +166,10 @@ class ApolloClient implements DataProxy { readonly typeDefs: ApolloClientOptions["typeDefs"]; // (undocumented) version: string; - // Warning: (ae-forgotten-export) The symbol "OperationVariables" needs to be exported by the entry point index.d.ts + // Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "@apollo/client" does not have an export "Observable" + // Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "@apollo/client" does not have an export "Observable" + // Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "@apollo/client" does not have an export "WatchFragmentOptions" + watchFragment(options: WatchFragmentOptions): Observable>; // Warning: (ae-forgotten-export) The symbol "WatchQueryOptions" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "ObservableQuery" needs to be exported by the entry point index.d.ts // Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "@apollo/client" does not have an export "ObservableQuery" @@ -2023,6 +2032,32 @@ interface UseSuspenseQueryResult; } +// @public (undocumented) +interface WatchFragmentOptions { + // @deprecated (undocumented) + canonizeResults?: boolean; + // (undocumented) + fragment: DocumentNode | TypedDocumentNode; + // (undocumented) + fragmentName?: string; + // (undocumented) + from: StoreObject | Reference | string; + // (undocumented) + optimistic?: boolean; + variables?: TVars; +} + +// @public (undocumented) +type WatchFragmentResult = { + data: TData; + complete: true; + missing?: never; +} | { + data: DeepPartial; + complete: false; + missing: MissingTree; +}; + // @public (undocumented) type WatchQueryFetchPolicy = FetchPolicy | "cache-and-network"; diff --git a/.api-reports/api-report-react_ssr.md b/.api-reports/api-report-react_ssr.md index 3747959ed85..26da1d70ac7 100644 --- a/.api-reports/api-report-react_ssr.md +++ b/.api-reports/api-report-react_ssr.md @@ -79,6 +79,12 @@ abstract class ApolloCache implements DataProxy { updateQuery(options: Cache_2.UpdateQueryOptions, update: (data: TData | null) => TData | null | void): TData | null; // (undocumented) abstract watch(watch: Cache_2.WatchOptions): () => void; + // Warning: (ae-forgotten-export) The symbol "OperationVariables" needs to be exported by the entry point index.d.ts + // Warning: (ae-forgotten-export) The symbol "WatchFragmentOptions" needs to be exported by the entry point index.d.ts + // Warning: (ae-forgotten-export) The symbol "WatchFragmentResult" needs to be exported by the entry point index.d.ts + // + // (undocumented) + watchFragment(options: WatchFragmentOptions): Observable>; // Warning: (ae-forgotten-export) The symbol "Reference" needs to be exported by the entry point index.d.ts // // (undocumented) @@ -161,7 +167,10 @@ class ApolloClient implements DataProxy { readonly typeDefs: ApolloClientOptions["typeDefs"]; // (undocumented) version: string; - // Warning: (ae-forgotten-export) The symbol "OperationVariables" needs to be exported by the entry point index.d.ts + // Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "@apollo/client" does not have an export "Observable" + // Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "@apollo/client" does not have an export "Observable" + // Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "@apollo/client" does not have an export "WatchFragmentOptions" + watchFragment(options: WatchFragmentOptions): Observable>; // Warning: (ae-forgotten-export) The symbol "WatchQueryOptions" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "ObservableQuery" needs to be exported by the entry point index.d.ts // Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "@apollo/client" does not have an export "ObservableQuery" @@ -532,6 +541,40 @@ interface DataProxy { writeQuery(options: DataProxy.WriteQueryOptions): Reference | undefined; } +// Warning: (ae-forgotten-export) The symbol "DeepPartialPrimitive" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "DeepPartialMap" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "DeepPartialReadonlyMap" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "DeepPartialSet" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "DeepPartialReadonlySet" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "DeepPartialObject" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type DeepPartial = T extends DeepPartialPrimitive ? T : T extends Map ? DeepPartialMap : T extends ReadonlyMap ? DeepPartialReadonlyMap : T extends Set ? DeepPartialSet : T extends ReadonlySet ? DeepPartialReadonlySet : T extends (...args: any[]) => unknown ? T | undefined : T extends object ? T extends (ReadonlyArray) ? TItem[] extends (T) ? readonly TItem[] extends T ? ReadonlyArray> : Array> : DeepPartialObject : DeepPartialObject : unknown; + +// Warning: (ae-forgotten-export) The symbol "DeepPartial" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type DeepPartialMap = {} & Map, DeepPartial>; + +// @public (undocumented) +type DeepPartialObject = { + [K in keyof T]?: DeepPartial; +}; + +// Warning: (ae-forgotten-export) The symbol "Primitive" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type DeepPartialPrimitive = Primitive | Date | RegExp; + +// @public (undocumented) +type DeepPartialReadonlyMap = {} & ReadonlyMap, DeepPartial>; + +// @public (undocumented) +type DeepPartialReadonlySet = {} & ReadonlySet>; + +// @public (undocumented) +type DeepPartialSet = {} & Set>; + // @public (undocumented) interface DefaultContext extends Record { } @@ -1127,6 +1170,9 @@ type OperationVariables = Record; // @public (undocumented) type Path = ReadonlyArray; +// @public (undocumented) +type Primitive = null | undefined | string | number | boolean | symbol | bigint; + // @public (undocumented) interface QueryData { // (undocumented) @@ -1620,6 +1666,32 @@ interface UriFunction { (operation: Operation): string; } +// @public (undocumented) +interface WatchFragmentOptions { + // @deprecated (undocumented) + canonizeResults?: boolean; + // (undocumented) + fragment: DocumentNode | TypedDocumentNode; + // (undocumented) + fragmentName?: string; + // (undocumented) + from: StoreObject | Reference | string; + // (undocumented) + optimistic?: boolean; + variables?: TVars; +} + +// @public (undocumented) +type WatchFragmentResult = { + data: TData; + complete: true; + missing?: never; +} | { + data: DeepPartial; + complete: false; + missing: MissingTree; +}; + // @public (undocumented) type WatchQueryFetchPolicy = FetchPolicy | "cache-and-network"; diff --git a/.api-reports/api-report-testing.md b/.api-reports/api-report-testing.md index 343bb599d38..b185b0a9081 100644 --- a/.api-reports/api-report-testing.md +++ b/.api-reports/api-report-testing.md @@ -79,6 +79,12 @@ abstract class ApolloCache implements DataProxy { updateQuery(options: Cache_2.UpdateQueryOptions, update: (data: TData | null) => TData | null | void): TData | null; // (undocumented) abstract watch(watch: Cache_2.WatchOptions): () => void; + // Warning: (ae-forgotten-export) The symbol "OperationVariables" needs to be exported by the entry point index.d.ts + // Warning: (ae-forgotten-export) The symbol "WatchFragmentOptions" needs to be exported by the entry point index.d.ts + // Warning: (ae-forgotten-export) The symbol "WatchFragmentResult" needs to be exported by the entry point index.d.ts + // + // (undocumented) + watchFragment(options: WatchFragmentOptions): Observable>; // Warning: (ae-forgotten-export) The symbol "Reference" needs to be exported by the entry point index.d.ts // // (undocumented) @@ -161,7 +167,10 @@ class ApolloClient implements DataProxy { readonly typeDefs: ApolloClientOptions["typeDefs"]; // (undocumented) version: string; - // Warning: (ae-forgotten-export) The symbol "OperationVariables" needs to be exported by the entry point index.d.ts + // Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "@apollo/client" does not have an export "Observable" + // Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "@apollo/client" does not have an export "Observable" + // Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "@apollo/client" does not have an export "WatchFragmentOptions" + watchFragment(options: WatchFragmentOptions): Observable>; // Warning: (ae-forgotten-export) The symbol "WatchQueryOptions" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "ObservableQuery" needs to be exported by the entry point index.d.ts // Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "@apollo/client" does not have an export "ObservableQuery" @@ -527,6 +536,40 @@ interface DataProxy { writeQuery(options: DataProxy.WriteQueryOptions): Reference | undefined; } +// Warning: (ae-forgotten-export) The symbol "DeepPartialPrimitive" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "DeepPartialMap" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "DeepPartialReadonlyMap" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "DeepPartialSet" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "DeepPartialReadonlySet" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "DeepPartialObject" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type DeepPartial = T extends DeepPartialPrimitive ? T : T extends Map ? DeepPartialMap : T extends ReadonlyMap ? DeepPartialReadonlyMap : T extends Set ? DeepPartialSet : T extends ReadonlySet ? DeepPartialReadonlySet : T extends (...args: any[]) => unknown ? T | undefined : T extends object ? T extends (ReadonlyArray) ? TItem[] extends (T) ? readonly TItem[] extends T ? ReadonlyArray> : Array> : DeepPartialObject : DeepPartialObject : unknown; + +// Warning: (ae-forgotten-export) The symbol "DeepPartial" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type DeepPartialMap = {} & Map, DeepPartial>; + +// @public (undocumented) +type DeepPartialObject = { + [K in keyof T]?: DeepPartial; +}; + +// Warning: (ae-forgotten-export) The symbol "Primitive" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type DeepPartialPrimitive = Primitive | Date | RegExp; + +// @public (undocumented) +type DeepPartialReadonlyMap = {} & ReadonlyMap, DeepPartial>; + +// @public (undocumented) +type DeepPartialReadonlySet = {} & ReadonlySet>; + +// @public (undocumented) +type DeepPartialSet = {} & Set>; + // @public (undocumented) interface DefaultContext extends Record { } @@ -1234,6 +1277,9 @@ type OperationVariables = Record; // @public (undocumented) type Path = ReadonlyArray; +// @public (undocumented) +type Primitive = null | undefined | string | number | boolean | symbol | bigint; + // @public (undocumented) class QueryInfo { constructor(queryManager: QueryManager, queryId?: string); @@ -1671,6 +1717,32 @@ type VariableMatcher> = (variables: V) => boolean; // @public (undocumented) export function wait(ms: number): Promise; +// @public (undocumented) +interface WatchFragmentOptions { + // @deprecated (undocumented) + canonizeResults?: boolean; + // (undocumented) + fragment: DocumentNode | TypedDocumentNode; + // (undocumented) + fragmentName?: string; + // (undocumented) + from: StoreObject | Reference | string; + // (undocumented) + optimistic?: boolean; + variables?: TVars; +} + +// @public (undocumented) +type WatchFragmentResult = { + data: TData; + complete: true; + missing?: never; +} | { + data: DeepPartial; + complete: false; + missing: MissingTree; +}; + // @public (undocumented) type WatchQueryFetchPolicy = FetchPolicy | "cache-and-network"; diff --git a/.api-reports/api-report-testing_core.md b/.api-reports/api-report-testing_core.md index c8121f60b5b..aca90c131c6 100644 --- a/.api-reports/api-report-testing_core.md +++ b/.api-reports/api-report-testing_core.md @@ -78,6 +78,12 @@ abstract class ApolloCache implements DataProxy { updateQuery(options: Cache_2.UpdateQueryOptions, update: (data: TData | null) => TData | null | void): TData | null; // (undocumented) abstract watch(watch: Cache_2.WatchOptions): () => void; + // Warning: (ae-forgotten-export) The symbol "OperationVariables" needs to be exported by the entry point index.d.ts + // Warning: (ae-forgotten-export) The symbol "WatchFragmentOptions" needs to be exported by the entry point index.d.ts + // Warning: (ae-forgotten-export) The symbol "WatchFragmentResult" needs to be exported by the entry point index.d.ts + // + // (undocumented) + watchFragment(options: WatchFragmentOptions): Observable>; // Warning: (ae-forgotten-export) The symbol "Reference" needs to be exported by the entry point index.d.ts // // (undocumented) @@ -160,7 +166,10 @@ class ApolloClient implements DataProxy { readonly typeDefs: ApolloClientOptions["typeDefs"]; // (undocumented) version: string; - // Warning: (ae-forgotten-export) The symbol "OperationVariables" needs to be exported by the entry point index.d.ts + // Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "@apollo/client" does not have an export "Observable" + // Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "@apollo/client" does not have an export "Observable" + // Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "@apollo/client" does not have an export "WatchFragmentOptions" + watchFragment(options: WatchFragmentOptions): Observable>; // Warning: (ae-forgotten-export) The symbol "WatchQueryOptions" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "ObservableQuery" needs to be exported by the entry point index.d.ts // Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "@apollo/client" does not have an export "ObservableQuery" @@ -526,6 +535,40 @@ interface DataProxy { writeQuery(options: DataProxy.WriteQueryOptions): Reference | undefined; } +// Warning: (ae-forgotten-export) The symbol "DeepPartialPrimitive" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "DeepPartialMap" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "DeepPartialReadonlyMap" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "DeepPartialSet" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "DeepPartialReadonlySet" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "DeepPartialObject" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type DeepPartial = T extends DeepPartialPrimitive ? T : T extends Map ? DeepPartialMap : T extends ReadonlyMap ? DeepPartialReadonlyMap : T extends Set ? DeepPartialSet : T extends ReadonlySet ? DeepPartialReadonlySet : T extends (...args: any[]) => unknown ? T | undefined : T extends object ? T extends (ReadonlyArray) ? TItem[] extends (T) ? readonly TItem[] extends T ? ReadonlyArray> : Array> : DeepPartialObject : DeepPartialObject : unknown; + +// Warning: (ae-forgotten-export) The symbol "DeepPartial" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type DeepPartialMap = {} & Map, DeepPartial>; + +// @public (undocumented) +type DeepPartialObject = { + [K in keyof T]?: DeepPartial; +}; + +// Warning: (ae-forgotten-export) The symbol "Primitive" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type DeepPartialPrimitive = Primitive | Date | RegExp; + +// @public (undocumented) +type DeepPartialReadonlyMap = {} & ReadonlyMap, DeepPartial>; + +// @public (undocumented) +type DeepPartialReadonlySet = {} & ReadonlySet>; + +// @public (undocumented) +type DeepPartialSet = {} & Set>; + // @public (undocumented) interface DefaultContext extends Record { } @@ -1189,6 +1232,9 @@ type OperationVariables = Record; // @public (undocumented) type Path = ReadonlyArray; +// @public (undocumented) +type Primitive = null | undefined | string | number | boolean | symbol | bigint; + // @public (undocumented) class QueryInfo { constructor(queryManager: QueryManager, queryId?: string); @@ -1628,6 +1674,32 @@ type VariableMatcher> = (variables: V) => boolean; // @public (undocumented) export function wait(ms: number): Promise; +// @public (undocumented) +interface WatchFragmentOptions { + // @deprecated (undocumented) + canonizeResults?: boolean; + // (undocumented) + fragment: DocumentNode | TypedDocumentNode; + // (undocumented) + fragmentName?: string; + // (undocumented) + from: StoreObject | Reference | string; + // (undocumented) + optimistic?: boolean; + variables?: TVars; +} + +// @public (undocumented) +type WatchFragmentResult = { + data: TData; + complete: true; + missing?: never; +} | { + data: DeepPartial; + complete: false; + missing: MissingTree; +}; + // @public (undocumented) type WatchQueryFetchPolicy = FetchPolicy | "cache-and-network"; diff --git a/.api-reports/api-report-utilities.md b/.api-reports/api-report-utilities.md index b47dd5550a0..984843a9dcf 100644 --- a/.api-reports/api-report-utilities.md +++ b/.api-reports/api-report-utilities.md @@ -94,6 +94,12 @@ abstract class ApolloCache implements DataProxy { updateQuery(options: Cache_2.UpdateQueryOptions, update: (data: TData | null) => TData | null | void): TData | null; // (undocumented) abstract watch(watch: Cache_2.WatchOptions): () => void; + // Warning: (ae-forgotten-export) The symbol "OperationVariables" needs to be exported by the entry point index.d.ts + // Warning: (ae-forgotten-export) The symbol "WatchFragmentOptions" needs to be exported by the entry point index.d.ts + // Warning: (ae-forgotten-export) The symbol "WatchFragmentResult" needs to be exported by the entry point index.d.ts + // + // (undocumented) + watchFragment(options: WatchFragmentOptions): Observable>; // (undocumented) abstract write(write: Cache_2.WriteOptions): Reference | undefined; // (undocumented) @@ -173,7 +179,10 @@ class ApolloClient implements DataProxy { readonly typeDefs: ApolloClientOptions["typeDefs"]; // (undocumented) version: string; - // Warning: (ae-forgotten-export) The symbol "OperationVariables" needs to be exported by the entry point index.d.ts + // Warning: (ae-unresolved-link) The @link reference could not be resolved: This type of declaration is not supported yet by the resolver + // Warning: (ae-unresolved-link) The @link reference could not be resolved: This type of declaration is not supported yet by the resolver + // Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "@apollo/client" does not have an export "WatchFragmentOptions" + watchFragment(options: WatchFragmentOptions): Observable>; // Warning: (ae-forgotten-export) The symbol "WatchQueryOptions" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "ObservableQuery" needs to be exported by the entry point index.d.ts // Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "@apollo/client" does not have an export "ObservableQuery" @@ -2577,6 +2586,32 @@ export function valueToObjectRepresentation(argObj: any, name: NameNode, value: // @public (undocumented) export type VariableValue = (node: VariableNode) => any; +// @public (undocumented) +interface WatchFragmentOptions { + // @deprecated (undocumented) + canonizeResults?: boolean; + // (undocumented) + fragment: DocumentNode | TypedDocumentNode; + // (undocumented) + fragmentName?: string; + // (undocumented) + from: StoreObject | Reference | string; + // (undocumented) + optimistic?: boolean; + variables?: TVars; +} + +// @public (undocumented) +type WatchFragmentResult = { + data: TData; + complete: true; + missing?: never; +} | { + data: DeepPartial; + complete: false; + missing: MissingTree; +}; + // @public (undocumented) type WatchQueryFetchPolicy = FetchPolicy | "cache-and-network"; diff --git a/.api-reports/api-report.md b/.api-reports/api-report.md index 1d09c28f12b..10370a4d61d 100644 --- a/.api-reports/api-report.md +++ b/.api-reports/api-report.md @@ -81,6 +81,11 @@ export abstract class ApolloCache implements DataProxy { updateQuery(options: Cache_2.UpdateQueryOptions, update: (data: TData | null) => TData | null | void): TData | null; // (undocumented) abstract watch(watch: Cache_2.WatchOptions): () => void; + // Warning: (ae-forgotten-export) The symbol "WatchFragmentOptions" needs to be exported by the entry point index.d.ts + // Warning: (ae-forgotten-export) The symbol "WatchFragmentResult" needs to be exported by the entry point index.d.ts + // + // (undocumented) + watchFragment(options: WatchFragmentOptions): Observable>; // (undocumented) abstract write(write: Cache_2.WriteOptions): Reference | undefined; // (undocumented) @@ -138,6 +143,10 @@ export class ApolloClient implements DataProxy { readonly typeDefs: ApolloClientOptions["typeDefs"]; // (undocumented) version: string; + // Warning: (ae-unresolved-link) The @link reference could not be resolved: This type of declaration is not supported yet by the resolver + // Warning: (ae-unresolved-link) The @link reference could not be resolved: This type of declaration is not supported yet by the resolver + // Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "@apollo/client" does not have an export "WatchFragmentOptions" + watchFragment(options: WatchFragmentOptions): Observable>; watchQuery(options: WatchQueryOptions): ObservableQuery; writeFragment(options: DataProxy.WriteFragmentOptions): Reference | undefined; writeQuery(options: DataProxy.WriteQueryOptions): Reference | undefined; @@ -3022,6 +3031,32 @@ TVariables variables: TVariables; }; +// @public (undocumented) +interface WatchFragmentOptions { + // @deprecated (undocumented) + canonizeResults?: boolean; + // (undocumented) + fragment: DocumentNode | TypedDocumentNode; + // (undocumented) + fragmentName?: string; + // (undocumented) + from: StoreObject | Reference | string; + // (undocumented) + optimistic?: boolean; + variables?: TVars; +} + +// @public (undocumented) +type WatchFragmentResult = { + data: TData; + complete: true; + missing?: never; +} | { + data: DeepPartial; + complete: false; + missing: MissingTree; +}; + // @public (undocumented) export type WatchQueryFetchPolicy = FetchPolicy | "cache-and-network"; diff --git a/.changeset/tasty-pillows-ring.md b/.changeset/tasty-pillows-ring.md new file mode 100644 index 00000000000..5c0f9643bb5 --- /dev/null +++ b/.changeset/tasty-pillows-ring.md @@ -0,0 +1,5 @@ +--- +"@apollo/client": minor +--- + +Add `watchFragment` method to the cache and expose it on ApolloClient, refactor `useFragment` using `watchFragment`. diff --git a/.size-limits.json b/.size-limits.json index cdae2c9cd42..26e6a5c9660 100644 --- a/.size-limits.json +++ b/.size-limits.json @@ -1,4 +1,4 @@ { - "dist/apollo-client.min.cjs": 39247, - "import { ApolloClient, InMemoryCache, HttpLink } from \"dist/index.js\" (production)": 32630 + "dist/apollo-client.min.cjs": 39286, + "import { ApolloClient, InMemoryCache, HttpLink } from \"dist/index.js\" (production)": 32838 } diff --git a/src/__tests__/ApolloClient.ts b/src/__tests__/ApolloClient.ts index 993691abe0c..35511eda9b9 100644 --- a/src/__tests__/ApolloClient.ts +++ b/src/__tests__/ApolloClient.ts @@ -13,7 +13,8 @@ import { Observable } from "../utilities"; import { ApolloLink } from "../link/core"; import { HttpLink } from "../link/http"; import { InMemoryCache } from "../cache"; -import { itAsync } from "../testing"; +import { concatPagination } from "../utilities"; +import { itAsync, wait } from "../testing"; import { spyOnConsole } from "../testing/internal"; import { TypedDocumentNode } from "@graphql-typed-document-node/core"; import { invariant } from "../utilities/globals"; @@ -2174,6 +2175,295 @@ describe("ApolloClient", () => { ); }); + describe.only("watchFragment", () => { + type Item = { + __typename: string; + id: number; + text?: string; + }; + + it.only("if all data is available, `complete` is `true`", async () => { + const cache = new InMemoryCache(); + const client = new ApolloClient({ + cache, + link: ApolloLink.empty(), + }); + const ItemFragment = gql` + fragment ItemFragment on Item { + id + text + } + `; + + cache.writeFragment({ + fragment: ItemFragment, + data: { + __typename: "Item", + id: 5, + text: "Item #5", + }, + }); + + const observable = client.watchFragment({ + fragment: ItemFragment, + from: { __typename: "Item", id: 5 }, + }); + + const handleNext = jest.fn(); + + observable.subscribe(handleNext); + + await wait(0); // need to wait a tick + + expect(handleNext).toHaveBeenCalledTimes(1); + + expect(handleNext).toHaveBeenLastCalledWith({ + data: { + __typename: "Item", + id: 5, + text: "Item #5", + }, + complete: true, + }); + }); + it("if only partial data is available, `complete` is `false`", async () => { + const cache = new InMemoryCache(); + const client = new ApolloClient({ + cache, + link: ApolloLink.empty(), + }); + const ItemFragment = gql` + fragment ItemFragment on Item { + id + text + } + `; + + const observable = client.watchFragment({ + fragment: ItemFragment, + from: { __typename: "Item", id: 5 }, + }); + + const handleNext = jest.fn(); + + observable.subscribe(handleNext); + + { + // we expect a "Missing field 'text' while writing result..." error + // when writing item to the cache, so we'll silence the console.error + using _consoleSpy = spyOnConsole("error"); + cache.writeFragment({ + fragment: ItemFragment, + data: { + __typename: "Item", + id: 5, + }, + }); + } + + expect(handleNext).toHaveBeenCalledTimes(1); + + expect(handleNext).toHaveBeenLastCalledWith({ + data: { + __typename: "Item", + id: 5, + }, + complete: false, + missing: { + text: "Can't find field 'text' on Item:5 object", + }, + }); + }); + it("if no data is written after observable is subscribed to, next is never called", async () => { + const cache = new InMemoryCache(); + const client = new ApolloClient({ + cache, + link: ApolloLink.empty(), + }); + const ItemFragment = gql` + fragment ItemFragment on Item { + id + text + } + `; + + const observable = client.watchFragment({ + fragment: ItemFragment, + from: { __typename: "Item", id: 5 }, + }); + + const handleNext = jest.fn(); + + observable.subscribe(handleNext); + + expect(handleNext).toHaveBeenCalledTimes(0); + }); + // it.only("does not react to updates to @nonreactive fields", async () => { + // const cache = new InMemoryCache(); + // const client = new ApolloClient({ + // cache, + // link: ApolloLink.empty(), + // }); + // const ItemFragment = gql` + // fragment ItemFragment on Item { + // id + // text @nonreactive + // } + // `; + + // const observable = client.watchFragment({ + // fragment: ItemFragment, + // from: { __typename: "Item", id: 5 }, + // }); + + // const handleNext = jest.fn(); + + // observable.subscribe(handleNext); + + // cache.writeFragment({ + // fragment: ItemFragment, + // data: { + // __typename: "Item", + // id: 5, + // text: "Item #5", + // }, + // }); + + // expect(handleNext).toHaveBeenCalledTimes(1); + // expect(handleNext).toHaveBeenLastCalledWith({ + // data: { + // __typename: "Item", + // id: 5, + // text: "Item #5", + // }, + // complete: true, + // }); + // }); + it.each>([ + // This query uses a basic field-level @nonreactive directive. + gql` + query GetItems { + list { + id + text @nonreactive + } + } + `, + // This query uses @nonreactive on an anonymous/inline ...spread directive. + gql` + query GetItems { + list { + id + ... @nonreactive { + text + } + } + } + `, + // This query uses @nonreactive on a ...spread with a type condition. + gql` + query GetItems { + list { + id + ... on Item @nonreactive { + text + } + } + } + `, + // This query uses @nonreactive directive on a named fragment ...spread. + gql` + query GetItems { + list { + id + ...ItemText @nonreactive + } + } + fragment ItemText on Item { + text + } + `, + ])( + "watchQuery can use @nonreactive to avoid rerendering", + async (query) => { + const cache = new InMemoryCache({ + typePolicies: { + Query: { + fields: { + list: concatPagination(), + }, + }, + Item: { + keyFields: ["id"], + // Configuring keyArgs:false for Item.text is one way to prevent field + // keys like text@nonreactive, but it's not the only way. Since + // @nonreactive is now in the KNOWN_DIRECTIVES array defined in + // utilities/graphql/storeUtils.ts, the '@nonreactive' suffix won't be + // automatically appended to field keys by default. + // fields: { + // text: { + // keyArgs: false, + // }, + // }, + }, + }, + }); + + const client = new ApolloClient({ + cache, + link: ApolloLink.empty(), + }); + + const queryObs = client.watchQuery({ + query, + }); + + const handleNext = jest.fn(); + + queryObs.subscribe(handleNext); + + cache.writeQuery({ + query, + data: { + list: [ + { __typename: "Item", id: 1, text: "first" }, + { __typename: "Item", id: 2, text: "second" }, + { __typename: "Item", id: 3, text: "third" }, + ], + }, + }); + + expect(cache.extract()).toEqual({ + ROOT_QUERY: { + __typename: "Query", + list: [ + { __ref: 'Item:{"id":1}' }, + { __ref: 'Item:{"id":2}' }, + { __ref: 'Item:{"id":3}' }, + ], + }, + 'Item:{"id":1}': { + __typename: "Item", + id: 1, + text: "first", + }, + 'Item:{"id":2}': { + __typename: "Item", + id: 2, + text: "second", + }, + 'Item:{"id":3}': { + __typename: "Item", + id: 3, + text: "third", + }, + }); + } + ); + it.todo("always returns partial data"); + it.todo("missing is a tree describing missing fields"); + }); + describe("defaultOptions", () => { it( "should set `defaultOptions` to an empty object if not provided in " + diff --git a/src/cache/core/cache.ts b/src/cache/core/cache.ts index a0fd1778bdc..68b4a67f92c 100644 --- a/src/cache/core/cache.ts +++ b/src/cache/core/cache.ts @@ -1,19 +1,67 @@ import type { DocumentNode } from "graphql"; import { wrap } from "optimism"; -import type { StoreObject, Reference } from "../../utilities/index.js"; +import type { + StoreObject, + Reference, + DeepPartial, +} from "../../utilities/index.js"; import { + Observable, cacheSizes, defaultCacheSizes, getFragmentQueryDocument, + mergeDeepArray, } from "../../utilities/index.js"; import type { DataProxy } from "./types/DataProxy.js"; import type { Cache } from "./types/Cache.js"; import { WeakCache } from "@wry/caches"; import { getApolloCacheMemoryInternals } from "../../utilities/caching/getMemoryInternals.js"; +import type { + OperationVariables, + TypedDocumentNode, +} from "../../core/types.js"; +import { equal } from "@wry/equality"; +import type { MissingTree } from "./types/common.js"; export type Transaction = (c: ApolloCache) => void; +// todo: confirm we can start with this limited set of options +export interface WatchFragmentOptions { + fragment: DocumentNode | TypedDocumentNode; + from: StoreObject | Reference | string; + /** + * Any variables that the GraphQL query may depend on. + */ + variables?: TVars; + fragmentName?: string; + optimistic?: boolean; + /** + * @deprecated + * Using `canonizeResults` can result in memory leaks so we generally do not + * recommend using this option anymore. + * A future version of Apollo Client will contain a similar feature. + * + * Whether to canonize cache results before returning them. Canonization + * takes some extra time, but it speeds up future deep equality comparisons. + * Defaults to false. + */ + canonizeResults?: boolean; +} + +// todo: refactor duplicated type, see UseFragmentResult +export type WatchFragmentResult = + | { + data: TData; + complete: true; + missing?: never; + } + | { + data: DeepPartial; + complete: false; + missing: MissingTree; + }; + export abstract class ApolloCache implements DataProxy { public readonly assumeImmutableResults: boolean = false; @@ -141,6 +189,46 @@ export abstract class ApolloCache implements DataProxy { }); } + public watchFragment( + options: WatchFragmentOptions + ): Observable> { + const { fragment, fragmentName, from, optimistic = true } = options; + + const diffOptions: Cache.DiffOptions = { + returnPartialData: true, + id: typeof from === "string" ? from : this.identify(from), + query: this.getFragmentDoc(fragment, fragmentName), + optimistic, + }; + + // let latestDiff: DataProxy.DiffResult | undefined = undefined; + let latestDiff: DataProxy.DiffResult = this.diff(diffOptions); + + return new Observable((observer) => { + return this.watch({ + ...diffOptions, + immediate: true, // is this necessary? tests pass without it + query: this.getFragmentDoc(fragment, fragmentName), + callback(diff) { + const result = { + data: diff.result as DeepPartial, + complete: !!diff.complete, + } as WatchFragmentResult; + + if (diff.missing) { + result.missing = mergeDeepArray( + diff.missing.map((error) => error.missing) + ); + } + if (!equal(diff, latestDiff)) { + latestDiff = diff; + observer.next(result); + } + }, + }); + }); + } + // Make sure we compute the same (===) fragment query document every // time we receive the same fragment in readFragment. private getFragmentDoc = wrap(getFragmentQueryDocument, { diff --git a/src/core/ApolloClient.ts b/src/core/ApolloClient.ts index e564a249c10..49605a490c7 100644 --- a/src/core/ApolloClient.ts +++ b/src/core/ApolloClient.ts @@ -128,6 +128,7 @@ export interface ApolloClientOptions { // solution is to reexport mergeOptions where it was previously declared (here). import { mergeOptions } from "../utilities/index.js"; import { getApolloClientMemoryInternals } from "../utilities/caching/getMemoryInternals.js"; +import type { WatchFragmentOptions } from "../cache/core/cache.js"; export { mergeOptions }; /** @@ -474,6 +475,29 @@ export class ApolloClient implements DataProxy { return this.cache.readQuery(options, optimistic); } + /** + * Watches the cache store of the fragment according to the options specified + * and returns an {@link Observable}. We can subscribe to this + * {@link Observable} and receive updated results through a GraphQL + * observer when the cache store changes. + * + * You must pass in a GraphQL document with a single fragment or a document + * with multiple fragments that represent what you are reading. If you pass + * in a document with multiple fragments then you must also specify a + * `fragmentName`. + * + * @param options - An object of type {@link WatchFragmentOptions} that allows + * the cache to identify the fragment and optionally specify whether to react + * to optimistic updates. + */ + + public watchFragment< + TFragmentData = unknown, + TVariables = OperationVariables, + >(options: WatchFragmentOptions) { + return this.cache.watchFragment(options); + } + /** * Tries to read some data from the store in the shape of the provided * GraphQL fragment without making a network request. This method will read a diff --git a/src/react/hooks/useFragment.ts b/src/react/hooks/useFragment.ts index 96e2a1c014a..4c39a03db0d 100644 --- a/src/react/hooks/useFragment.ts +++ b/src/react/hooks/useFragment.ts @@ -1,5 +1,4 @@ import * as React from "rehackt"; -import { equal } from "@wry/equality"; import type { DeepPartial } from "../../utilities/index.js"; import { mergeDeepArray } from "../../utilities/index.js"; @@ -84,9 +83,15 @@ function _useFragment( }; }, [options]); + // TODO: use regular useRef here and set the value inside of useMemo const resultRef = useLazyRef>(() => diffToResult(cache.diff(diffOptions)) ); + // explain the timing issue: since next is async, we need to make sure that we + // get the correct diff on next render given new diffOptions + React.useMemo(() => { + resultRef.current = diffToResult(cache.diff(diffOptions)); + }, [diffOptions, cache]); // Used for both getSnapshot and getServerSnapshot const getSnapshot = React.useCallback(() => resultRef.current, []); @@ -95,23 +100,19 @@ function _useFragment( React.useCallback( (forceUpdate) => { let lastTimeout = 0; - const unsubscribe = cache.watch({ - ...diffOptions, - immediate: true, - callback(diff) { - if (!equal(diff.result, resultRef.current.data)) { - resultRef.current = diffToResult(diff); - // If we get another update before we've re-rendered, bail out of - // the update and try again. This ensures that the relative timing - // between useQuery and useFragment stays roughly the same as - // fixed in https://github.com/apollographql/apollo-client/pull/11083 - clearTimeout(lastTimeout); - lastTimeout = setTimeout(forceUpdate) as any; - } + const subscription = cache.watchFragment(options).subscribe({ + next: (result) => { + resultRef.current = result; + // If we get another update before we've re-rendered, bail out of + // the update and try again. This ensures that the relative timing + // between useQuery and useFragment stays roughly the same as + // fixed in https://github.com/apollographql/apollo-client/pull/11083 + clearTimeout(lastTimeout); + lastTimeout = setTimeout(forceUpdate) as any; }, }); return () => { - unsubscribe(); + subscription.unsubscribe(); clearTimeout(lastTimeout); }; },