diff --git a/.api-reports/api-report-core.api.md b/.api-reports/api-report-core.api.md index 6014990bc2d..ec76c2d00a6 100644 --- a/.api-reports/api-report-core.api.md +++ b/.api-reports/api-report-core.api.md @@ -117,7 +117,7 @@ export class ApolloClient implements DataProxy { getResolvers(): Resolvers; // (undocumented) link: ApolloLink; - mutate = DefaultContext, TCache extends ApolloCache = ApolloCache>(options: MutationOptions): Promise>; + mutate, TCache extends ApolloCache = ApolloCache>(options: MutationOptions): Promise>; onClearStore(cb: () => Promise): () => void; onResetStore(cb: () => Promise): () => void; query(options: QueryOptions): Promise>; @@ -133,7 +133,7 @@ export class ApolloClient implements DataProxy { setLocalStateFragmentMatcher(fragmentMatcher: FragmentMatcher): void; setResolvers(resolvers: Resolvers | Resolvers[]): void; stop(): void; - subscribe(options: SubscriptionOptions): Observable>; + subscribe>(options: SubscriptionOptions): Observable>; // (undocumented) readonly typeDefs: ApolloClientOptions["typeDefs"]; // (undocumented) @@ -153,7 +153,7 @@ export interface ApolloClientOptions { // (undocumented) credentials?: string; // (undocumented) - defaultContext?: Partial; + defaultContext?: DefaultContext; defaultOptions?: DefaultOptions; devtools?: DevtoolsOptions; // (undocumented) @@ -565,7 +565,7 @@ type DeepPartialReadonlySet = {} & ReadonlySet>; type DeepPartialSet = {} & Set>; // @public (undocumented) -export interface DefaultContext extends Record { +export interface DefaultContext extends OperationContext { } // Warning: (ae-forgotten-export) The symbol "KeyFieldsContext" needs to be exported by the entry point index.d.ts @@ -812,9 +812,9 @@ export interface FetchMoreOptions } // @public (undocumented) -export interface FetchMoreQueryOptions { +export interface FetchMoreQueryOptions> { // (undocumented) - context?: DefaultContext; + context?: TContext; query?: DocumentNode | TypedDocumentNode; variables?: Partial; } @@ -823,7 +823,7 @@ export interface FetchMoreQueryOptions { export type FetchPolicy = "cache-first" | "network-only" | "cache-only" | "no-cache" | "standby"; // @public (undocumented) -export type FetchResult, TContext = Record, TExtensions = Record> = SingleExecutionResult | ExecutionPatchResult; +export type FetchResult, TContext extends OperationContext = DefaultContext, TExtensions = Record> = SingleExecutionResult | ExecutionPatchResult; // @public (undocumented) export interface FieldFunctionOptions, TVars = Record> { @@ -992,9 +992,9 @@ const getInMemoryCacheMemoryInternals: (() => { export { gql } // @public (undocumented) -export interface GraphQLRequest> { +export interface GraphQLRequest, TContext extends OperationContext = Partial> { // (undocumented) - context?: DefaultContext; + context?: TContext; // (undocumented) extensions?: Record; // (undocumented) @@ -1386,7 +1386,7 @@ type Modifiers = Record> = Partia }>; // @public (undocumented) -interface MutationBaseOptions = ApolloCache> { +interface MutationBaseOptions, TCache extends ApolloCache = ApolloCache> { awaitRefetchQueries?: boolean; context?: TContext; errorPolicy?: ErrorPolicy; @@ -1407,7 +1407,7 @@ export type MutationFetchPolicy = Extract = ApolloCache> extends MutationSharedOptions { +export interface MutationOptions, TCache extends ApolloCache = ApolloCache> extends MutationSharedOptions { mutation: DocumentNode | TypedDocumentNode; } @@ -1428,7 +1428,7 @@ export type MutationQueryReducersMap = ApolloCache> extends MutationBaseOptions { +interface MutationSharedOptions, TCache extends ApolloCache = ApolloCache> extends MutationBaseOptions { fetchPolicy?: MutationFetchPolicy; keepRootFields?: boolean; } @@ -1618,6 +1618,9 @@ export interface Operation { variables: Record; } +// @public (undocumented) +export type OperationContext = Record; + // @public (undocumented) export type OperationVariables = Record; @@ -1629,7 +1632,7 @@ export type OptimisticStoreItem = { }; // @public (undocumented) -type OptionsUnion = WatchQueryOptions | QueryOptions | MutationOptions; +type OptionsUnion> = WatchQueryOptions | QueryOptions | MutationOptions; // @public (undocumented) export function parseAndCheckHttpResponse(operations: Operation | Operation[]): (response: Response) => Promise; @@ -1838,7 +1841,7 @@ class QueryManager { keepRootFields?: boolean; }, cache?: ApolloCache): Promise>; // (undocumented) - mutate, TCache extends ApolloCache>({ mutation, variables, optimisticResponse, updateQueries, refetchQueries, awaitRefetchQueries, update: updateWithProxyFn, onQueryUpdated, fetchPolicy, errorPolicy, keepRootFields, context, }: MutationOptions): Promise>; + mutate>({ mutation, variables, optimisticResponse, updateQueries, refetchQueries, awaitRefetchQueries, update: updateWithProxyFn, onQueryUpdated, fetchPolicy, errorPolicy, keepRootFields, context, }: MutationOptions): Promise>; // (undocumented) mutationStore?: { [mutationId: string]: MutationStoreValue; @@ -1858,7 +1861,7 @@ class QueryManager { // (undocumented) readonly ssrMode: boolean; // (undocumented) - startGraphQLSubscription({ query, fetchPolicy, errorPolicy, variables, context, extensions, }: SubscriptionOptions): Observable>; + startGraphQLSubscription>({ query, fetchPolicy, errorPolicy, variables, context, extensions, }: SubscriptionOptions): Observable>; stop(): void; // (undocumented) stopQuery(queryId: string): void; @@ -1897,10 +1900,10 @@ interface QueryManagerOptions { } // @public -interface QueryOptions { +interface QueryOptions> { // @deprecated canonizeResults?: boolean; - context?: DefaultContext; + context?: TContext; errorPolicy?: ErrorPolicy; fetchPolicy?: FetchPolicy; notifyOnNetworkStatusChange?: boolean; @@ -2082,10 +2085,10 @@ export type ServerParseError = Error & { export { setLogVerbosity } // @public (undocumented) -interface SharedWatchQueryOptions { +interface SharedWatchQueryOptions> { // @deprecated canonizeResults?: boolean; - context?: DefaultContext; + context?: TContext; errorPolicy?: ErrorPolicy; fetchPolicy?: WatchQueryFetchPolicy; initialFetchPolicy?: WatchQueryFetchPolicy; @@ -2102,7 +2105,7 @@ interface SharedWatchQueryOptions } // @public (undocumented) -export interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> { +export interface SingleExecutionResult, TContext extends OperationContext = DefaultContext, TExtensions = Record> { // (undocumented) context?: TContext; // (undocumented) @@ -2150,17 +2153,17 @@ class Stump extends Layer { } // @public (undocumented) -export type SubscribeToMoreOptions = { +export type SubscribeToMoreOptions> = { document: DocumentNode | TypedDocumentNode; variables?: TSubscriptionVariables; updateQuery?: UpdateQueryFn; onError?: (error: Error) => void; - context?: DefaultContext; + context?: TContext; }; // @public (undocumented) -export interface SubscriptionOptions { - context?: DefaultContext; +export interface SubscriptionOptions> { + context?: TContext; errorPolicy?: ErrorPolicy; extensions?: Record; fetchPolicy?: FetchPolicy; @@ -2319,9 +2322,9 @@ 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:138:5 - (ae-forgotten-export) The symbol "MutationStoreValue" needs to be exported by the entry point index.d.ts -// src/core/QueryManager.ts:382: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/core/QueryManager.ts:139:5 - (ae-forgotten-export) The symbol "MutationStoreValue" needs to be exported by the entry point index.d.ts +// src/core/QueryManager.ts:383:7 - (ae-forgotten-export) The symbol "UpdateQueries" needs to be exported by the entry point index.d.ts +// src/core/watchQueryOptions.ts:287: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 // (No @packageDocumentation comment for this package) diff --git a/.api-reports/api-report-errors.api.md b/.api-reports/api-report-errors.api.md index 96c8bafc999..b35ece172f5 100644 --- a/.api-reports/api-report-errors.api.md +++ b/.api-reports/api-report-errors.api.md @@ -56,8 +56,10 @@ export interface ApolloErrorOptions { }>; } +// Warning: (ae-forgotten-export) The symbol "OperationContext" needs to be exported by the entry point index.d.ts +// // @public (undocumented) -interface DefaultContext extends Record { +interface DefaultContext extends OperationContext { } // Warning: (ae-forgotten-export) The symbol "ExecutionPatchResultBase" needs to be exported by the entry point index.d.ts @@ -100,11 +102,12 @@ interface ExecutionPatchResultBase { hasNext?: boolean; } +// Warning: (ae-forgotten-export) The symbol "DefaultContext" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "SingleExecutionResult" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "ExecutionPatchResult" needs to be exported by the entry point index.d.ts // // @public (undocumented) -type FetchResult, TContext = Record, TExtensions = Record> = SingleExecutionResult | ExecutionPatchResult; +type FetchResult, TContext extends OperationContext = DefaultContext, TExtensions = Record> = SingleExecutionResult | ExecutionPatchResult; // Warning: (ae-forgotten-export) The symbol "FetchResult" needs to be exported by the entry point index.d.ts // @@ -143,6 +146,9 @@ export function isApolloError(err: Error): err is ApolloError; // @public (undocumented) export type NetworkError = Error | ServerParseError | ServerError | null; +// @public (undocumented) +type OperationContext = Record; + // @public (undocumented) type Path = ReadonlyArray; @@ -163,10 +169,8 @@ type ServerParseError = Error & { bodyText: string; }; -// Warning: (ae-forgotten-export) The symbol "DefaultContext" needs to be exported by the entry point index.d.ts -// // @public (undocumented) -interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> { +interface SingleExecutionResult, TContext extends OperationContext = DefaultContext, TExtensions = Record> { // (undocumented) context?: TContext; // (undocumented) diff --git a/.api-reports/api-report-link_batch-http.api.md b/.api-reports/api-report-link_batch-http.api.md index f212ce55c05..d1fcbe24882 100644 --- a/.api-reports/api-report-link_batch-http.api.md +++ b/.api-reports/api-report-link_batch-http.api.md @@ -91,8 +91,10 @@ class BatchLink extends ApolloLink { request(operation: Operation, forward?: NextLink): Observable | null; } +// Warning: (ae-forgotten-export) The symbol "OperationContext" needs to be exported by the entry point index.d.ts +// // @public (undocumented) -interface DefaultContext extends Record { +interface DefaultContext extends OperationContext { } // Warning: (ae-forgotten-export) The symbol "ExecutionPatchResultBase" needs to be exported by the entry point index.d.ts @@ -135,18 +137,17 @@ interface ExecutionPatchResultBase { hasNext?: boolean; } +// Warning: (ae-forgotten-export) The symbol "DefaultContext" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "SingleExecutionResult" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "ExecutionPatchResult" needs to be exported by the entry point index.d.ts // // @public (undocumented) -type FetchResult, TContext = Record, TExtensions = Record> = SingleExecutionResult | ExecutionPatchResult; +type FetchResult, TContext extends OperationContext = DefaultContext, TExtensions = Record> = SingleExecutionResult | ExecutionPatchResult; // @public (undocumented) -interface GraphQLRequest> { - // Warning: (ae-forgotten-export) The symbol "DefaultContext" needs to be exported by the entry point index.d.ts - // +interface GraphQLRequest, TContext extends OperationContext = Partial> { // (undocumented) - context?: DefaultContext; + context?: TContext; // (undocumented) extensions?: Record; // (undocumented) @@ -211,6 +212,9 @@ interface Operation { variables: Record; } +// @public (undocumented) +type OperationContext = Record; + // @public (undocumented) type Path = ReadonlyArray; @@ -231,7 +235,7 @@ interface Printer { type RequestHandler = (operation: Operation, forward: NextLink) => Observable | null; // @public (undocumented) -interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> { +interface SingleExecutionResult, TContext extends OperationContext = DefaultContext, TExtensions = Record> { // (undocumented) context?: TContext; // (undocumented) diff --git a/.api-reports/api-report-link_batch.api.md b/.api-reports/api-report-link_batch.api.md index f7e4426ef61..2fd29f858dc 100644 --- a/.api-reports/api-report-link_batch.api.md +++ b/.api-reports/api-report-link_batch.api.md @@ -81,8 +81,10 @@ export class BatchLink extends ApolloLink { request(operation: Operation, forward?: NextLink): Observable | null; } +// Warning: (ae-forgotten-export) The symbol "OperationContext" needs to be exported by the entry point index.d.ts +// // @public (undocumented) -interface DefaultContext extends Record { +interface DefaultContext extends OperationContext { } // Warning: (ae-forgotten-export) The symbol "ExecutionPatchResultBase" needs to be exported by the entry point index.d.ts @@ -125,18 +127,17 @@ interface ExecutionPatchResultBase { hasNext?: boolean; } +// Warning: (ae-forgotten-export) The symbol "DefaultContext" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "SingleExecutionResult" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "ExecutionPatchResult" needs to be exported by the entry point index.d.ts // // @public (undocumented) -type FetchResult, TContext = Record, TExtensions = Record> = SingleExecutionResult | ExecutionPatchResult; +type FetchResult, TContext extends OperationContext = DefaultContext, TExtensions = Record> = SingleExecutionResult | ExecutionPatchResult; // @public (undocumented) -interface GraphQLRequest> { - // Warning: (ae-forgotten-export) The symbol "DefaultContext" needs to be exported by the entry point index.d.ts - // +interface GraphQLRequest, TContext extends OperationContext = Partial> { // (undocumented) - context?: DefaultContext; + context?: TContext; // (undocumented) extensions?: Record; // (undocumented) @@ -200,6 +201,9 @@ export class OperationBatcher { enqueueRequest(request: BatchableRequest): Observable; } +// @public (undocumented) +type OperationContext = Record; + // @public (undocumented) type Path = ReadonlyArray; @@ -207,7 +211,7 @@ type Path = ReadonlyArray; type RequestHandler = (operation: Operation, forward: NextLink) => Observable | null; // @public (undocumented) -interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> { +interface SingleExecutionResult, TContext extends OperationContext = DefaultContext, TExtensions = Record> { // (undocumented) context?: TContext; // (undocumented) diff --git a/.api-reports/api-report-link_context.api.md b/.api-reports/api-report-link_context.api.md index cbf51621b32..43078323e2f 100644 --- a/.api-reports/api-report-link_context.api.md +++ b/.api-reports/api-report-link_context.api.md @@ -49,13 +49,14 @@ class ApolloLink { split(test: (op: Operation) => boolean, left: ApolloLink | RequestHandler, right?: ApolloLink | RequestHandler): ApolloLink; } +// Warning: (ae-forgotten-export) The symbol "OperationContext" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "DefaultContext" needs to be exported by the entry point index.d.ts // // @public (undocumented) -export type ContextSetter = (operation: GraphQLRequest, prevContext: DefaultContext) => Promise | DefaultContext; +export type ContextSetter> = (operation: GraphQLRequest, prevContext: DefaultContext) => Promise> | Partial; // @public (undocumented) -interface DefaultContext extends Record { +interface DefaultContext extends OperationContext { } // Warning: (ae-forgotten-export) The symbol "ExecutionPatchResultBase" needs to be exported by the entry point index.d.ts @@ -102,12 +103,12 @@ interface ExecutionPatchResultBase { // Warning: (ae-forgotten-export) The symbol "ExecutionPatchResult" needs to be exported by the entry point index.d.ts // // @public (undocumented) -type FetchResult, TContext = Record, TExtensions = Record> = SingleExecutionResult | ExecutionPatchResult; +type FetchResult, TContext extends OperationContext = DefaultContext, TExtensions = Record> = SingleExecutionResult | ExecutionPatchResult; // @public (undocumented) -interface GraphQLRequest> { +interface GraphQLRequest, TContext extends OperationContext = Partial> { // (undocumented) - context?: DefaultContext; + context?: TContext; // (undocumented) extensions?: Record; // (undocumented) @@ -156,6 +157,9 @@ interface Operation { variables: Record; } +// @public (undocumented) +type OperationContext = Record; + // @public (undocumented) type Path = ReadonlyArray; @@ -165,10 +169,10 @@ type RequestHandler = (operation: Operation, forward: NextLink) => Observable>(setter: ContextSetter): ApolloLink; // @public (undocumented) -interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> { +interface SingleExecutionResult, TContext extends OperationContext = DefaultContext, TExtensions = Record> { // (undocumented) context?: TContext; // (undocumented) diff --git a/.api-reports/api-report-link_core.api.md b/.api-reports/api-report-link_core.api.md index 32f6e56f608..73fdcfbfbd8 100644 --- a/.api-reports/api-report-link_core.api.md +++ b/.api-reports/api-report-link_core.api.md @@ -51,8 +51,10 @@ export interface ApolloPayloadResult, TExtensions = // @public (undocumented) export const concat: typeof ApolloLink.concat; +// Warning: (ae-forgotten-export) The symbol "OperationContext" needs to be exported by the entry point index.d.ts +// // @public (undocumented) -interface DefaultContext extends Record { +interface DefaultContext extends OperationContext { } export { DocumentNode } @@ -98,18 +100,18 @@ interface ExecutionPatchResultBase { hasNext?: boolean; } +// Warning: (ae-forgotten-export) The symbol "DefaultContext" needs to be exported by the entry point index.d.ts +// // @public (undocumented) -export type FetchResult, TContext = Record, TExtensions = Record> = SingleExecutionResult | ExecutionPatchResult; +export type FetchResult, TContext extends OperationContext = DefaultContext, TExtensions = Record> = SingleExecutionResult | ExecutionPatchResult; // @public (undocumented) export const from: typeof ApolloLink.from; // @public (undocumented) -export interface GraphQLRequest> { - // Warning: (ae-forgotten-export) The symbol "DefaultContext" needs to be exported by the entry point index.d.ts - // +export interface GraphQLRequest, TContext extends OperationContext = Partial> { // (undocumented) - context?: DefaultContext; + context?: TContext; // (undocumented) extensions?: Record; // (undocumented) @@ -156,6 +158,9 @@ export interface Operation { variables: Record; } +// @public (undocumented) +type OperationContext = Record; + // @public (undocumented) export type Path = ReadonlyArray; @@ -163,7 +168,7 @@ export type Path = ReadonlyArray; export type RequestHandler = (operation: Operation, forward: NextLink) => Observable | null; // @public (undocumented) -export interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> { +export interface SingleExecutionResult, TContext extends OperationContext = DefaultContext, TExtensions = Record> { // (undocumented) context?: TContext; // (undocumented) diff --git a/.api-reports/api-report-link_error.api.md b/.api-reports/api-report-link_error.api.md index 92cbae62eb5..83d84c3d16a 100644 --- a/.api-reports/api-report-link_error.api.md +++ b/.api-reports/api-report-link_error.api.md @@ -50,8 +50,10 @@ class ApolloLink { split(test: (op: Operation) => boolean, left: ApolloLink | RequestHandler, right?: ApolloLink | RequestHandler): ApolloLink; } +// Warning: (ae-forgotten-export) The symbol "OperationContext" needs to be exported by the entry point index.d.ts +// // @public (undocumented) -interface DefaultContext extends Record { +interface DefaultContext extends OperationContext { } export interface ErrorHandler { @@ -132,18 +134,17 @@ interface ExecutionPatchResultBase { hasNext?: boolean; } +// Warning: (ae-forgotten-export) The symbol "DefaultContext" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "SingleExecutionResult" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "ExecutionPatchResult" needs to be exported by the entry point index.d.ts // // @public (undocumented) -type FetchResult, TContext = Record, TExtensions = Record> = SingleExecutionResult | ExecutionPatchResult; +type FetchResult, TContext extends OperationContext = DefaultContext, TExtensions = Record> = SingleExecutionResult | ExecutionPatchResult; // @public (undocumented) -interface GraphQLRequest> { - // Warning: (ae-forgotten-export) The symbol "DefaultContext" needs to be exported by the entry point index.d.ts - // +interface GraphQLRequest, TContext extends OperationContext = Partial> { // (undocumented) - context?: DefaultContext; + context?: TContext; // (undocumented) extensions?: Record; // (undocumented) @@ -201,6 +202,9 @@ interface Operation { variables: Record; } +// @public (undocumented) +type OperationContext = Record; + // @public (undocumented) type Path = ReadonlyArray; @@ -222,7 +226,7 @@ type ServerParseError = Error & { }; // @public (undocumented) -interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> { +interface SingleExecutionResult, TContext extends OperationContext = DefaultContext, TExtensions = Record> { // (undocumented) context?: TContext; // (undocumented) diff --git a/.api-reports/api-report-link_http.api.md b/.api-reports/api-report-link_http.api.md index dd7cf6778c2..8ab1ab729f2 100644 --- a/.api-reports/api-report-link_http.api.md +++ b/.api-reports/api-report-link_http.api.md @@ -85,8 +85,10 @@ export const createSignalIfSupported: () => { signal: AbortSignal; }; +// Warning: (ae-forgotten-export) The symbol "OperationContext" needs to be exported by the entry point index.d.ts +// // @public (undocumented) -interface DefaultContext extends Record { +interface DefaultContext extends OperationContext { } // Warning: (ae-forgotten-export) The symbol "Printer" needs to be exported by the entry point index.d.ts @@ -146,18 +148,17 @@ export const fallbackHttpConfig: { }; }; +// Warning: (ae-forgotten-export) The symbol "DefaultContext" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "SingleExecutionResult" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "ExecutionPatchResult" needs to be exported by the entry point index.d.ts // // @public (undocumented) -type FetchResult, TContext = Record, TExtensions = Record> = SingleExecutionResult | ExecutionPatchResult; +type FetchResult, TContext extends OperationContext = DefaultContext, TExtensions = Record> = SingleExecutionResult | ExecutionPatchResult; // @public (undocumented) -interface GraphQLRequest> { - // Warning: (ae-forgotten-export) The symbol "DefaultContext" needs to be exported by the entry point index.d.ts - // +interface GraphQLRequest, TContext extends OperationContext = Partial> { // (undocumented) - context?: DefaultContext; + context?: TContext; // (undocumented) extensions?: Record; // (undocumented) @@ -249,6 +250,9 @@ interface Operation { variables: Record; } +// @public (undocumented) +type OperationContext = Record; + // @public (undocumented) export function parseAndCheckHttpResponse(operations: Operation | Operation[]): (response: Response) => Promise; @@ -310,7 +314,7 @@ export type ServerParseError = Error & { }; // @public (undocumented) -interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> { +interface SingleExecutionResult, TContext extends OperationContext = DefaultContext, TExtensions = Record> { // (undocumented) context?: TContext; // (undocumented) diff --git a/.api-reports/api-report-link_persisted-queries.api.md b/.api-reports/api-report-link_persisted-queries.api.md index 0e4fa0e4639..de90ce04bcf 100644 --- a/.api-reports/api-report-link_persisted-queries.api.md +++ b/.api-reports/api-report-link_persisted-queries.api.md @@ -75,8 +75,10 @@ export const createPersistedQueryLink: (options: PersistedQueryLink.Options) => getMemoryInternals?: undefined; }); +// Warning: (ae-forgotten-export) The symbol "OperationContext" needs to be exported by the entry point index.d.ts +// // @public (undocumented) -interface DefaultContext extends Record { +interface DefaultContext extends OperationContext { } // @public (undocumented) @@ -143,21 +145,20 @@ interface ExecutionPatchResultBase { hasNext?: boolean; } +// Warning: (ae-forgotten-export) The symbol "DefaultContext" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "SingleExecutionResult" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "ExecutionPatchResult" needs to be exported by the entry point index.d.ts // // @public (undocumented) -type FetchResult, TContext = Record, TExtensions = Record> = SingleExecutionResult | ExecutionPatchResult; +type FetchResult, TContext extends OperationContext = DefaultContext, TExtensions = Record> = SingleExecutionResult | ExecutionPatchResult; // @public (undocumented) type GenerateHashFunction = (document: DocumentNode) => string | PromiseLike; // @public (undocumented) -interface GraphQLRequest> { - // Warning: (ae-forgotten-export) The symbol "DefaultContext" needs to be exported by the entry point index.d.ts - // +interface GraphQLRequest, TContext extends OperationContext = Partial> { // (undocumented) - context?: DefaultContext; + context?: TContext; // (undocumented) extensions?: Record; // (undocumented) @@ -212,6 +213,9 @@ interface Operation { variables: Record; } +// @public (undocumented) +type OperationContext = Record; + // @public (undocumented) type Path = ReadonlyArray; @@ -263,7 +267,7 @@ type ServerParseError = Error & { type SHA256Function = (...args: any[]) => string | PromiseLike; // @public (undocumented) -interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> { +interface SingleExecutionResult, TContext extends OperationContext = DefaultContext, TExtensions = Record> { // (undocumented) context?: TContext; // (undocumented) diff --git a/.api-reports/api-report-link_remove-typename.api.md b/.api-reports/api-report-link_remove-typename.api.md index 7d088615a2b..0a96303504a 100644 --- a/.api-reports/api-report-link_remove-typename.api.md +++ b/.api-reports/api-report-link_remove-typename.api.md @@ -49,8 +49,10 @@ class ApolloLink { split(test: (op: Operation) => boolean, left: ApolloLink | RequestHandler, right?: ApolloLink | RequestHandler): ApolloLink; } +// Warning: (ae-forgotten-export) The symbol "OperationContext" needs to be exported by the entry point index.d.ts +// // @public (undocumented) -interface DefaultContext extends Record { +interface DefaultContext extends OperationContext { } // Warning: (ae-forgotten-export) The symbol "ExecutionPatchResultBase" needs to be exported by the entry point index.d.ts @@ -93,18 +95,17 @@ interface ExecutionPatchResultBase { hasNext?: boolean; } +// Warning: (ae-forgotten-export) The symbol "DefaultContext" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "SingleExecutionResult" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "ExecutionPatchResult" needs to be exported by the entry point index.d.ts // // @public (undocumented) -type FetchResult, TContext = Record, TExtensions = Record> = SingleExecutionResult | ExecutionPatchResult; +type FetchResult, TContext extends OperationContext = DefaultContext, TExtensions = Record> = SingleExecutionResult | ExecutionPatchResult; // @public (undocumented) -interface GraphQLRequest> { - // Warning: (ae-forgotten-export) The symbol "DefaultContext" needs to be exported by the entry point index.d.ts - // +interface GraphQLRequest, TContext extends OperationContext = Partial> { // (undocumented) - context?: DefaultContext; + context?: TContext; // (undocumented) extensions?: Record; // (undocumented) @@ -162,6 +163,9 @@ interface Operation { variables: Record; } +// @public (undocumented) +type OperationContext = Record; + // @public (undocumented) type Path = ReadonlyArray; @@ -190,7 +194,7 @@ export interface RemoveTypenameFromVariablesOptions { type RequestHandler = (operation: Operation, forward: NextLink) => Observable | null; // @public (undocumented) -interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> { +interface SingleExecutionResult, TContext extends OperationContext = DefaultContext, TExtensions = Record> { // (undocumented) context?: TContext; // (undocumented) diff --git a/.api-reports/api-report-link_retry.api.md b/.api-reports/api-report-link_retry.api.md index 843ff5f1654..7bf78db9e5f 100644 --- a/.api-reports/api-report-link_retry.api.md +++ b/.api-reports/api-report-link_retry.api.md @@ -49,8 +49,10 @@ class ApolloLink { split(test: (op: Operation) => boolean, left: ApolloLink | RequestHandler, right?: ApolloLink | RequestHandler): ApolloLink; } +// Warning: (ae-forgotten-export) The symbol "OperationContext" needs to be exported by the entry point index.d.ts +// // @public (undocumented) -interface DefaultContext extends Record { +interface DefaultContext extends OperationContext { } // @public @@ -106,18 +108,17 @@ interface ExecutionPatchResultBase { hasNext?: boolean; } +// Warning: (ae-forgotten-export) The symbol "DefaultContext" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "SingleExecutionResult" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "ExecutionPatchResult" needs to be exported by the entry point index.d.ts // // @public (undocumented) -type FetchResult, TContext = Record, TExtensions = Record> = SingleExecutionResult | ExecutionPatchResult; +type FetchResult, TContext extends OperationContext = DefaultContext, TExtensions = Record> = SingleExecutionResult | ExecutionPatchResult; // @public (undocumented) -interface GraphQLRequest> { - // Warning: (ae-forgotten-export) The symbol "DefaultContext" needs to be exported by the entry point index.d.ts - // +interface GraphQLRequest, TContext extends OperationContext = Partial> { // (undocumented) - context?: DefaultContext; + context?: TContext; // (undocumented) extensions?: Record; // (undocumented) @@ -166,6 +167,9 @@ interface Operation { variables: Record; } +// @public (undocumented) +type OperationContext = Record; + // @public (undocumented) type Path = ReadonlyArray; @@ -207,7 +211,7 @@ export class RetryLink extends ApolloLink { } // @public (undocumented) -interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> { +interface SingleExecutionResult, TContext extends OperationContext = DefaultContext, TExtensions = Record> { // (undocumented) context?: TContext; // (undocumented) diff --git a/.api-reports/api-report-link_schema.api.md b/.api-reports/api-report-link_schema.api.md index 817398b7594..94184287023 100644 --- a/.api-reports/api-report-link_schema.api.md +++ b/.api-reports/api-report-link_schema.api.md @@ -50,8 +50,10 @@ class ApolloLink { split(test: (op: Operation) => boolean, left: ApolloLink | RequestHandler, right?: ApolloLink | RequestHandler): ApolloLink; } +// Warning: (ae-forgotten-export) The symbol "OperationContext" needs to be exported by the entry point index.d.ts +// // @public (undocumented) -interface DefaultContext extends Record { +interface DefaultContext extends OperationContext { } // Warning: (ae-forgotten-export) The symbol "ExecutionPatchResultBase" needs to be exported by the entry point index.d.ts @@ -94,18 +96,17 @@ interface ExecutionPatchResultBase { hasNext?: boolean; } +// Warning: (ae-forgotten-export) The symbol "DefaultContext" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "SingleExecutionResult" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "ExecutionPatchResult" needs to be exported by the entry point index.d.ts // // @public (undocumented) -type FetchResult, TContext = Record, TExtensions = Record> = SingleExecutionResult | ExecutionPatchResult; +type FetchResult, TContext extends OperationContext = DefaultContext, TExtensions = Record> = SingleExecutionResult | ExecutionPatchResult; // @public (undocumented) -interface GraphQLRequest> { - // Warning: (ae-forgotten-export) The symbol "DefaultContext" needs to be exported by the entry point index.d.ts - // +interface GraphQLRequest, TContext extends OperationContext = Partial> { // (undocumented) - context?: DefaultContext; + context?: TContext; // (undocumented) extensions?: Record; // (undocumented) @@ -154,6 +155,9 @@ interface Operation { variables: Record; } +// @public (undocumented) +type OperationContext = Record; + // @public (undocumented) type Path = ReadonlyArray; @@ -193,7 +197,7 @@ export class SchemaLink extends ApolloLink { } // @public (undocumented) -interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> { +interface SingleExecutionResult, TContext extends OperationContext = DefaultContext, TExtensions = Record> { // (undocumented) context?: TContext; // (undocumented) diff --git a/.api-reports/api-report-link_subscriptions.api.md b/.api-reports/api-report-link_subscriptions.api.md index b7fcb443f86..b4f11331072 100644 --- a/.api-reports/api-report-link_subscriptions.api.md +++ b/.api-reports/api-report-link_subscriptions.api.md @@ -50,8 +50,10 @@ class ApolloLink { split(test: (op: Operation) => boolean, left: ApolloLink | RequestHandler, right?: ApolloLink | RequestHandler): ApolloLink; } +// Warning: (ae-forgotten-export) The symbol "OperationContext" needs to be exported by the entry point index.d.ts +// // @public (undocumented) -interface DefaultContext extends Record { +interface DefaultContext extends OperationContext { } // Warning: (ae-forgotten-export) The symbol "ExecutionPatchResultBase" needs to be exported by the entry point index.d.ts @@ -94,18 +96,17 @@ interface ExecutionPatchResultBase { hasNext?: boolean; } +// Warning: (ae-forgotten-export) The symbol "DefaultContext" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "SingleExecutionResult" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "ExecutionPatchResult" needs to be exported by the entry point index.d.ts // // @public (undocumented) -type FetchResult, TContext = Record, TExtensions = Record> = SingleExecutionResult | ExecutionPatchResult; +type FetchResult, TContext extends OperationContext = DefaultContext, TExtensions = Record> = SingleExecutionResult | ExecutionPatchResult; // @public (undocumented) -interface GraphQLRequest> { - // Warning: (ae-forgotten-export) The symbol "DefaultContext" needs to be exported by the entry point index.d.ts - // +interface GraphQLRequest, TContext extends OperationContext = Partial> { // (undocumented) - context?: DefaultContext; + context?: TContext; // (undocumented) extensions?: Record; // (undocumented) @@ -165,6 +166,9 @@ interface Operation { variables: Record; } +// @public (undocumented) +type OperationContext = Record; + // @public (undocumented) type Path = ReadonlyArray; @@ -172,7 +176,7 @@ type Path = ReadonlyArray; type RequestHandler = (operation: Operation, forward: NextLink) => Observable | null; // @public (undocumented) -interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> { +interface SingleExecutionResult, TContext extends OperationContext = DefaultContext, TExtensions = Record> { // (undocumented) context?: TContext; // (undocumented) diff --git a/.api-reports/api-report-link_utils.api.md b/.api-reports/api-report-link_utils.api.md index edce7cda76d..33842b9872d 100644 --- a/.api-reports/api-report-link_utils.api.md +++ b/.api-reports/api-report-link_utils.api.md @@ -13,8 +13,10 @@ import { Observable } from 'zen-observable-ts'; // @public (undocumented) export function createOperation(starting: any, operation: GraphQLRequest): Operation; +// Warning: (ae-forgotten-export) The symbol "OperationContext" needs to be exported by the entry point index.d.ts +// // @public (undocumented) -interface DefaultContext extends Record { +interface DefaultContext extends OperationContext { } // @public (undocumented) @@ -28,12 +30,12 @@ export function fromError(errorValue: any): Observable; // @public (undocumented) export function fromPromise(promise: Promise): Observable; +// Warning: (ae-forgotten-export) The symbol "DefaultContext" needs to be exported by the entry point index.d.ts +// // @public (undocumented) -interface GraphQLRequest> { - // Warning: (ae-forgotten-export) The symbol "DefaultContext" needs to be exported by the entry point index.d.ts - // +interface GraphQLRequest, TContext extends OperationContext = Partial> { // (undocumented) - context?: DefaultContext; + context?: TContext; // (undocumented) extensions?: Record; // (undocumented) @@ -63,6 +65,9 @@ interface Operation { variables: Record; } +// @public (undocumented) +type OperationContext = Record; + // @public (undocumented) export type ServerError = Error & { response: Response; diff --git a/.api-reports/api-report-link_ws.api.md b/.api-reports/api-report-link_ws.api.md index ec666d00c71..96eb059a92c 100644 --- a/.api-reports/api-report-link_ws.api.md +++ b/.api-reports/api-report-link_ws.api.md @@ -51,8 +51,10 @@ class ApolloLink { split(test: (op: Operation) => boolean, left: ApolloLink | RequestHandler, right?: ApolloLink | RequestHandler): ApolloLink; } +// Warning: (ae-forgotten-export) The symbol "OperationContext" needs to be exported by the entry point index.d.ts +// // @public (undocumented) -interface DefaultContext extends Record { +interface DefaultContext extends OperationContext { } // Warning: (ae-forgotten-export) The symbol "ExecutionPatchResultBase" needs to be exported by the entry point index.d.ts @@ -95,18 +97,17 @@ interface ExecutionPatchResultBase { hasNext?: boolean; } +// Warning: (ae-forgotten-export) The symbol "DefaultContext" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "SingleExecutionResult" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "ExecutionPatchResult" needs to be exported by the entry point index.d.ts // // @public (undocumented) -type FetchResult, TContext = Record, TExtensions = Record> = SingleExecutionResult | ExecutionPatchResult; +type FetchResult, TContext extends OperationContext = DefaultContext, TExtensions = Record> = SingleExecutionResult | ExecutionPatchResult; // @public (undocumented) -interface GraphQLRequest> { - // Warning: (ae-forgotten-export) The symbol "DefaultContext" needs to be exported by the entry point index.d.ts - // +interface GraphQLRequest, TContext extends OperationContext = Partial> { // (undocumented) - context?: DefaultContext; + context?: TContext; // (undocumented) extensions?: Record; // (undocumented) @@ -155,6 +156,9 @@ interface Operation { variables: Record; } +// @public (undocumented) +type OperationContext = Record; + // @public (undocumented) type Path = ReadonlyArray; @@ -162,7 +166,7 @@ type Path = ReadonlyArray; type RequestHandler = (operation: Operation, forward: NextLink) => Observable | null; // @public (undocumented) -interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> { +interface SingleExecutionResult, TContext extends OperationContext = DefaultContext, TExtensions = Record> { // (undocumented) context?: TContext; // (undocumented) diff --git a/.api-reports/api-report-react.api.md b/.api-reports/api-report-react.api.md index dabdf2dbd1d..c0b63815e44 100644 --- a/.api-reports/api-report-react.api.md +++ b/.api-reports/api-report-react.api.md @@ -134,7 +134,7 @@ class ApolloClient implements DataProxy { link: ApolloLink; // Warning: (ae-forgotten-export) The symbol "MutationOptions" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "FetchResult" needs to be exported by the entry point index.d.ts - mutate = Context, TCache extends ApolloCache = ApolloCache>(options: MutationOptions): Promise>; + mutate, TCache extends ApolloCache = ApolloCache>(options: MutationOptions): Promise>; onClearStore(cb: () => Promise): () => void; onResetStore(cb: () => Promise): () => void; // Warning: (ae-forgotten-export) The symbol "QueryOptions" needs to be exported by the entry point index.d.ts @@ -156,7 +156,7 @@ class ApolloClient implements DataProxy { setResolvers(resolvers: Resolvers | Resolvers[]): void; stop(): void; // Warning: (ae-forgotten-export) The symbol "SubscriptionOptions" needs to be exported by the entry point index.d.ts - subscribe(options: SubscriptionOptions): Observable>; + subscribe>(options: SubscriptionOptions): Observable>; // Warning: (ae-forgotten-export) The symbol "ApolloClientOptions" needs to be exported by the entry point index.d.ts // // (undocumented) @@ -180,7 +180,7 @@ interface ApolloClientOptions { // (undocumented) credentials?: string; // (undocumented) - defaultContext?: Partial; + defaultContext?: Context; defaultOptions?: DefaultOptions; devtools?: DevtoolsOptions; // (undocumented) @@ -369,7 +369,7 @@ type BackgroundQueryHookOptionsNoInfer = ApolloCache> extends MutationSharedOptions { +export interface BaseMutationOptions, TCache extends ApolloCache = ApolloCache> extends MutationSharedOptions { client?: ApolloClient; ignoreResults?: boolean; notifyOnNetworkStatusChange?: boolean; @@ -380,16 +380,16 @@ export interface BaseMutationOptions extends SharedWatchQueryOptions { +export interface BaseQueryOptions> extends SharedWatchQueryOptions { client?: ApolloClient; - context?: Context; + context?: TContext; ssr?: boolean; } // @public (undocumented) -export interface BaseSubscriptionOptions { +export interface BaseSubscriptionOptions> { client?: ApolloClient; - context?: Context; + context?: TContext; // Warning: (ae-forgotten-export) The symbol "ErrorPolicy" needs to be exported by the entry point index.d.ts errorPolicy?: ErrorPolicy; extensions?: Record; @@ -550,7 +550,7 @@ class Concast extends Observable { type ConcastSourcesIterable = Iterable>; // @public (undocumented) -export interface Context extends Record { +export interface Context extends OperationContext { } // @public @@ -789,9 +789,9 @@ type FetchMoreFunction = (fetchMor }) => Promise>; // @public (undocumented) -interface FetchMoreQueryOptions { +interface FetchMoreQueryOptions> { // (undocumented) - context?: Context; + context?: TContext; query?: DocumentNode | TypedDocumentNode; variables?: Partial; } @@ -803,7 +803,7 @@ type FetchPolicy = "cache-first" | "network-only" | "cache-only" | "no-cache" | // Warning: (ae-forgotten-export) The symbol "ExecutionPatchResult" needs to be exported by the entry point index.d.ts // // @public (undocumented) -type FetchResult, TContext = Record, TExtensions = Record> = SingleExecutionResult | ExecutionPatchResult; +type FetchResult, TContext extends OperationContext = Context, TExtensions = Record> = SingleExecutionResult | ExecutionPatchResult; // @public (undocumented) interface FieldSpecifier { @@ -874,9 +874,9 @@ const getApolloClientMemoryInternals: (() => { export function getApolloContext(): ReactTypes.Context; // @public (undocumented) -interface GraphQLRequest> { +interface GraphQLRequest, TContext extends OperationContext = Partial> { // (undocumented) - context?: Context; + context?: TContext; // (undocumented) extensions?: Record; // (undocumented) @@ -1003,7 +1003,7 @@ export interface LoadableQueryHookOptions { // @deprecated canonizeResults?: boolean; client?: ApolloClient; - context?: Context; + context?: Partial; errorPolicy?: ErrorPolicy; fetchPolicy?: LoadableQueryHookFetchPolicy; queryKey?: string | number | any[]; @@ -1113,7 +1113,7 @@ type Modifiers = Record> = Partia }>; // @public (undocumented) -interface MutationBaseOptions = ApolloCache> { +interface MutationBaseOptions, TCache extends ApolloCache = ApolloCache> { awaitRefetchQueries?: boolean; context?: TContext; errorPolicy?: ErrorPolicy; @@ -1132,7 +1132,7 @@ interface MutationBaseOptions = ApolloCache> extends BaseMutationOptions { +export interface MutationDataOptions, TCache extends ApolloCache = ApolloCache> extends BaseMutationOptions { // (undocumented) mutation: DocumentNode | TypedDocumentNode; } @@ -1141,19 +1141,19 @@ export interface MutationDataOptions; // @public (undocumented) -export type MutationFunction = ApolloCache> = (options?: MutationFunctionOptions) => Promise>; +export type MutationFunction, TCache extends ApolloCache = ApolloCache> = (options?: MutationFunctionOptions) => Promise>; // @public (undocumented) -export interface MutationFunctionOptions = ApolloCache> extends BaseMutationOptions { +export interface MutationFunctionOptions, TCache extends ApolloCache = ApolloCache> extends BaseMutationOptions { mutation?: DocumentNode | TypedDocumentNode; } // @public (undocumented) -export interface MutationHookOptions = ApolloCache> extends BaseMutationOptions { +export interface MutationHookOptions, TCache extends ApolloCache = ApolloCache> extends BaseMutationOptions { } // @public (undocumented) -interface MutationOptions = ApolloCache> extends MutationSharedOptions { +interface MutationOptions, TCache extends ApolloCache = ApolloCache> extends MutationSharedOptions { mutation: DocumentNode | TypedDocumentNode; } @@ -1184,7 +1184,7 @@ export interface MutationResult { // Warning: (ae-forgotten-export) The symbol "MutationBaseOptions" needs to be exported by the entry point index.d.ts // // @public (undocumented) -interface MutationSharedOptions = ApolloCache> extends MutationBaseOptions { +interface MutationSharedOptions, TCache extends ApolloCache = ApolloCache> extends MutationBaseOptions { // Warning: (ae-forgotten-export) The symbol "MutationFetchPolicy" needs to be exported by the entry point index.d.ts fetchPolicy?: MutationFetchPolicy; keepRootFields?: boolean; @@ -1203,7 +1203,7 @@ interface MutationStoreValue { } // @public (undocumented) -export type MutationTuple = ApolloCache> = [ +export type MutationTuple, TCache extends ApolloCache = ApolloCache> = [ mutate: (options?: MutationFunctionOptions) => Promise>, result: MutationResult ]; @@ -1371,6 +1371,9 @@ interface Operation { variables: Record; } +// @public (undocumented) +export type OperationContext = Record; + // @public (undocumented) export function operationName(type: DocumentType_2): string; @@ -1417,9 +1420,9 @@ export interface PreloadQueryFunction { // Warning: (ae-forgotten-export) The symbol "VariablesOption" needs to be exported by the entry point index.d.ts // // @public (undocumented) -export type PreloadQueryOptions = { +export type PreloadQueryOptions> = { canonizeResults?: boolean; - context?: Context; + context?: TContext; errorPolicy?: ErrorPolicy; fetchPolicy?: PreloadQueryFetchPolicy; returnPartialData?: boolean; @@ -1529,8 +1532,8 @@ class QueryInfo { } // @public @deprecated (undocumented) -export interface QueryLazyOptions { - context?: Context; +export interface QueryLazyOptions> { + context?: TContext; variables?: TVariables; } @@ -1617,7 +1620,7 @@ class QueryManager { keepRootFields?: boolean; }, cache?: ApolloCache): Promise>; // (undocumented) - mutate, TCache extends ApolloCache>({ mutation, variables, optimisticResponse, updateQueries, refetchQueries, awaitRefetchQueries, update: updateWithProxyFn, onQueryUpdated, fetchPolicy, errorPolicy, keepRootFields, context, }: MutationOptions): Promise>; + mutate>({ mutation, variables, optimisticResponse, updateQueries, refetchQueries, awaitRefetchQueries, update: updateWithProxyFn, onQueryUpdated, fetchPolicy, errorPolicy, keepRootFields, context, }: MutationOptions): Promise>; // (undocumented) mutationStore?: { [mutationId: string]: MutationStoreValue; @@ -1640,7 +1643,7 @@ class QueryManager { // (undocumented) readonly ssrMode: boolean; // (undocumented) - startGraphQLSubscription({ query, fetchPolicy, errorPolicy, variables, context, extensions, }: SubscriptionOptions): Observable>; + startGraphQLSubscription>({ query, fetchPolicy, errorPolicy, variables, context, extensions, }: SubscriptionOptions): Observable>; stop(): void; // (undocumented) stopQuery(queryId: string): void; @@ -1679,10 +1682,10 @@ interface QueryManagerOptions { } // @public -interface QueryOptions { +interface QueryOptions> { // @deprecated canonizeResults?: boolean; - context?: Context; + context?: TContext; errorPolicy?: ErrorPolicy; fetchPolicy?: FetchPolicy; notifyOnNetworkStatusChange?: boolean; @@ -1874,10 +1877,10 @@ type ServerParseError = Error & { }; // @public (undocumented) -interface SharedWatchQueryOptions { +interface SharedWatchQueryOptions> { // @deprecated canonizeResults?: boolean; - context?: Context; + context?: TContext; errorPolicy?: ErrorPolicy; fetchPolicy?: WatchQueryFetchPolicy; initialFetchPolicy?: WatchQueryFetchPolicy; @@ -1894,7 +1897,7 @@ interface SharedWatchQueryOptions } // @public (undocumented) -interface SingleExecutionResult, TContext = Context, TExtensions = Record> { +interface SingleExecutionResult, TContext extends OperationContext = Context, TExtensions = Record> { // (undocumented) context?: TContext; // (undocumented) @@ -1939,12 +1942,12 @@ type StoreValue = number | string | string[] | Reference | Reference[] | null | type SubscribeToMoreFunction = ObservableQueryFields["subscribeToMore"]; // @public (undocumented) -type SubscribeToMoreOptions = { +type SubscribeToMoreOptions> = { document: DocumentNode | TypedDocumentNode; variables?: TSubscriptionVariables; updateQuery?: UpdateQueryFn; onError?: (error: Error) => void; - context?: Context; + context?: TContext; }; // @public (undocumented) @@ -1968,8 +1971,8 @@ export interface SubscriptionHookOptions { - context?: Context; +interface SubscriptionOptions> { + context?: TContext; errorPolicy?: ErrorPolicy; extensions?: Record; fetchPolicy?: FetchPolicy; @@ -1990,11 +1993,11 @@ export interface SubscriptionResult { export type SuspenseQueryHookFetchPolicy = Extract; // @public (undocumented) -export interface SuspenseQueryHookOptions { +export interface SuspenseQueryHookOptions> { // @deprecated canonizeResults?: boolean; client?: ApolloClient; - context?: Context; + context?: TContext; errorPolicy?: ErrorPolicy; fetchPolicy?: SuspenseQueryHookFetchPolicy; queryKey?: string | number | any[]; @@ -2196,7 +2199,7 @@ handlers: { ]; // @public -export function useMutation = ApolloCache>(mutation: DocumentNode | TypedDocumentNode, options?: MutationHookOptions, NoInfer_2, TContext, TCache>): MutationTuple; +export function useMutation, TCache extends ApolloCache = ApolloCache>(mutation: DocumentNode | TypedDocumentNode, options?: MutationHookOptions, NoInfer_2, TContext, TCache>): MutationTuple; // @public export function useQuery(query: DocumentNode | TypedDocumentNode, options?: QueryHookOptions, NoInfer_2>): QueryResult; @@ -2344,11 +2347,11 @@ interface WatchQueryOptions implements DataProxy { // // (undocumented) link: ApolloLink; + // Warning: (ae-forgotten-export) The symbol "OperationContext" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "DefaultContext" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "MutationOptions" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "FetchResult" needs to be exported by the entry point index.d.ts - mutate = DefaultContext, TCache extends ApolloCache = ApolloCache>(options: MutationOptions): Promise>; + mutate, TCache extends ApolloCache = ApolloCache>(options: MutationOptions): Promise>; onClearStore(cb: () => Promise): () => void; onResetStore(cb: () => Promise): () => void; // Warning: (ae-forgotten-export) The symbol "QueryOptions" needs to be exported by the entry point index.d.ts @@ -157,7 +158,7 @@ class ApolloClient implements DataProxy { setResolvers(resolvers: Resolvers | Resolvers[]): void; stop(): void; // Warning: (ae-forgotten-export) The symbol "SubscriptionOptions" needs to be exported by the entry point index.d.ts - subscribe(options: SubscriptionOptions): Observable>; + subscribe>(options: SubscriptionOptions): Observable>; // Warning: (ae-forgotten-export) The symbol "ApolloClientOptions" needs to be exported by the entry point index.d.ts // // (undocumented) @@ -181,7 +182,7 @@ interface ApolloClientOptions { // (undocumented) credentials?: string; // (undocumented) - defaultContext?: Partial; + defaultContext?: DefaultContext; defaultOptions?: DefaultOptions; devtools?: DevtoolsOptions; // (undocumented) @@ -316,7 +317,7 @@ type AsStoreObject = ApolloCache> extends MutationSharedOptions { +interface BaseMutationOptions, TCache extends ApolloCache = ApolloCache> extends MutationSharedOptions { // Warning: (ae-forgotten-export) The symbol "ApolloClient" needs to be exported by the entry point index.d.ts client?: ApolloClient; ignoreResults?: boolean; @@ -328,16 +329,16 @@ interface BaseMutationOptions extends SharedWatchQueryOptions { +interface BaseQueryOptions> extends SharedWatchQueryOptions { client?: ApolloClient; - context?: DefaultContext; + context?: TContext; ssr?: boolean; } // @public (undocumented) -interface BaseSubscriptionOptions { +interface BaseSubscriptionOptions> { client?: ApolloClient; - context?: DefaultContext; + context?: TContext; // Warning: (ae-forgotten-export) The symbol "ErrorPolicy" needs to be exported by the entry point index.d.ts errorPolicy?: ErrorPolicy; extensions?: Record; @@ -606,7 +607,7 @@ type DeepPartialReadonlySet = {} & ReadonlySet>; type DeepPartialSet = {} & Set>; // @public (undocumented) -interface DefaultContext extends Record { +interface DefaultContext extends OperationContext { } // @public (undocumented) @@ -711,9 +712,9 @@ interface ExecutionPatchResultBase { } // @public (undocumented) -interface FetchMoreQueryOptions { +interface FetchMoreQueryOptions> { // (undocumented) - context?: DefaultContext; + context?: TContext; query?: DocumentNode | TypedDocumentNode; variables?: Partial; } @@ -725,7 +726,7 @@ type FetchPolicy = "cache-first" | "network-only" | "cache-only" | "no-cache" | // Warning: (ae-forgotten-export) The symbol "ExecutionPatchResult" needs to be exported by the entry point index.d.ts // // @public (undocumented) -type FetchResult, TContext = Record, TExtensions = Record> = SingleExecutionResult | ExecutionPatchResult; +type FetchResult, TContext extends OperationContext = DefaultContext, TExtensions = Record> = SingleExecutionResult | ExecutionPatchResult; // @public (undocumented) interface FieldSpecifier { @@ -793,9 +794,9 @@ const getApolloClientMemoryInternals: (() => { }) | undefined; // @public (undocumented) -interface GraphQLRequest> { +interface GraphQLRequest, TContext extends OperationContext = Partial> { // (undocumented) - context?: DefaultContext; + context?: TContext; // (undocumented) extensions?: Record; // (undocumented) @@ -979,7 +980,7 @@ export function Mutation(props: Mu // @public (undocumented) export namespace Mutation { var // (undocumented) - propTypes: PropTypes.InferProps>>; + propTypes: PropTypes.InferProps, ApolloCache>>; } // @public (undocumented) @@ -989,7 +990,7 @@ export interface Mutation { } // @public (undocumented) -interface MutationBaseOptions = ApolloCache> { +interface MutationBaseOptions, TCache extends ApolloCache = ApolloCache> { awaitRefetchQueries?: boolean; context?: TContext; errorPolicy?: ErrorPolicy; @@ -1010,7 +1011,7 @@ interface MutationBaseOptions = ApolloCache> extends BaseMutationOptions { +export interface MutationComponentOptions, TCache extends ApolloCache = ApolloCache> extends BaseMutationOptions { // Warning: (ae-forgotten-export) The symbol "MutationFunction" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "MutationResult" needs to be exported by the entry point index.d.ts // @@ -1026,15 +1027,15 @@ type MutationFetchPolicy = Extract; // Warning: (ae-forgotten-export) The symbol "MutationFunctionOptions" needs to be exported by the entry point index.d.ts // // @public (undocumented) -type MutationFunction = ApolloCache> = (options?: MutationFunctionOptions) => Promise>; +type MutationFunction, TCache extends ApolloCache = ApolloCache> = (options?: MutationFunctionOptions) => Promise>; // @public (undocumented) -interface MutationFunctionOptions = ApolloCache> extends BaseMutationOptions { +interface MutationFunctionOptions, TCache extends ApolloCache = ApolloCache> extends BaseMutationOptions { mutation?: DocumentNode | TypedDocumentNode; } // @public (undocumented) -interface MutationOptions = ApolloCache> extends MutationSharedOptions { +interface MutationOptions, TCache extends ApolloCache = ApolloCache> extends MutationSharedOptions { mutation: DocumentNode | TypedDocumentNode; } @@ -1065,7 +1066,7 @@ interface MutationResult { // Warning: (ae-forgotten-export) The symbol "MutationBaseOptions" needs to be exported by the entry point index.d.ts // // @public (undocumented) -interface MutationSharedOptions = ApolloCache> extends MutationBaseOptions { +interface MutationSharedOptions, TCache extends ApolloCache = ApolloCache> extends MutationBaseOptions { // Warning: (ae-forgotten-export) The symbol "MutationFetchPolicy" needs to be exported by the entry point index.d.ts fetchPolicy?: MutationFetchPolicy; keepRootFields?: boolean; @@ -1242,6 +1243,9 @@ interface Operation { variables: Record; } +// @public (undocumented) +type OperationContext = Record; + // @public (undocumented) type OperationVariables = Record; @@ -1431,7 +1435,7 @@ class QueryManager { keepRootFields?: boolean; }, cache?: ApolloCache): Promise>; // (undocumented) - mutate, TCache extends ApolloCache>({ mutation, variables, optimisticResponse, updateQueries, refetchQueries, awaitRefetchQueries, update: updateWithProxyFn, onQueryUpdated, fetchPolicy, errorPolicy, keepRootFields, context, }: MutationOptions): Promise>; + mutate>({ mutation, variables, optimisticResponse, updateQueries, refetchQueries, awaitRefetchQueries, update: updateWithProxyFn, onQueryUpdated, fetchPolicy, errorPolicy, keepRootFields, context, }: MutationOptions): Promise>; // (undocumented) mutationStore?: { [mutationId: string]: MutationStoreValue; @@ -1454,7 +1458,7 @@ class QueryManager { // (undocumented) readonly ssrMode: boolean; // (undocumented) - startGraphQLSubscription({ query, fetchPolicy, errorPolicy, variables, context, extensions, }: SubscriptionOptions): Observable>; + startGraphQLSubscription>({ query, fetchPolicy, errorPolicy, variables, context, extensions, }: SubscriptionOptions): Observable>; stop(): void; // (undocumented) stopQuery(queryId: string): void; @@ -1493,10 +1497,10 @@ interface QueryManagerOptions { } // @public -interface QueryOptions { +interface QueryOptions> { // @deprecated canonizeResults?: boolean; - context?: DefaultContext; + context?: TContext; errorPolicy?: ErrorPolicy; fetchPolicy?: FetchPolicy; notifyOnNetworkStatusChange?: boolean; @@ -1626,10 +1630,10 @@ type ServerParseError = Error & { }; // @public (undocumented) -interface SharedWatchQueryOptions { +interface SharedWatchQueryOptions> { // @deprecated canonizeResults?: boolean; - context?: DefaultContext; + context?: TContext; errorPolicy?: ErrorPolicy; fetchPolicy?: WatchQueryFetchPolicy; initialFetchPolicy?: WatchQueryFetchPolicy; @@ -1647,7 +1651,7 @@ interface SharedWatchQueryOptions } // @public (undocumented) -interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> { +interface SingleExecutionResult, TContext extends OperationContext = DefaultContext, TExtensions = Record> { // (undocumented) context?: TContext; // (undocumented) @@ -1683,12 +1687,12 @@ Item type StoreValue = number | string | string[] | Reference | Reference[] | null | undefined | void | Object; // @public (undocumented) -type SubscribeToMoreOptions = { +type SubscribeToMoreOptions> = { document: DocumentNode | TypedDocumentNode; variables?: TSubscriptionVariables; updateQuery?: UpdateQueryFn; onError?: (error: Error) => void; - context?: DefaultContext; + context?: TContext; }; // @public @deprecated (undocumented) @@ -1716,8 +1720,8 @@ export interface SubscriptionComponentOptions { - context?: DefaultContext; +interface SubscriptionOptions> { + context?: TContext; errorPolicy?: ErrorPolicy; extensions?: Record; fetchPolicy?: FetchPolicy; @@ -1823,11 +1827,11 @@ interface WatchQueryOptions implements DataProxy { // // (undocumented) link: ApolloLink; + // Warning: (ae-forgotten-export) The symbol "OperationContext" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "DefaultContext" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "MutationOptions" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "FetchResult" needs to be exported by the entry point index.d.ts - mutate = DefaultContext, TCache extends ApolloCache = ApolloCache>(options: MutationOptions): Promise>; + mutate, TCache extends ApolloCache = ApolloCache>(options: MutationOptions): Promise>; onClearStore(cb: () => Promise): () => void; onResetStore(cb: () => Promise): () => void; // Warning: (ae-forgotten-export) The symbol "QueryOptions" needs to be exported by the entry point index.d.ts @@ -156,7 +157,7 @@ class ApolloClient implements DataProxy { setResolvers(resolvers: Resolvers | Resolvers[]): void; stop(): void; // Warning: (ae-forgotten-export) The symbol "SubscriptionOptions" needs to be exported by the entry point index.d.ts - subscribe(options: SubscriptionOptions): Observable>; + subscribe>(options: SubscriptionOptions): Observable>; // Warning: (ae-forgotten-export) The symbol "ApolloClientOptions" needs to be exported by the entry point index.d.ts // // (undocumented) @@ -180,7 +181,7 @@ interface ApolloClientOptions { // (undocumented) credentials?: string; // (undocumented) - defaultContext?: Partial; + defaultContext?: DefaultContext; defaultOptions?: DefaultOptions; devtools?: DevtoolsOptions; // (undocumented) @@ -347,9 +348,9 @@ type AsStoreObject extends SharedWatchQueryOptions { +interface BaseQueryOptions> extends SharedWatchQueryOptions { client?: ApolloClient; - context?: DefaultContext; + context?: TContext; ssr?: boolean; } @@ -600,7 +601,7 @@ type DeepPartialReadonlySet = {} & ReadonlySet>; type DeepPartialSet = {} & Set>; // @public (undocumented) -interface DefaultContext extends Record { +interface DefaultContext extends OperationContext { } // @public (undocumented) @@ -705,9 +706,9 @@ interface ExecutionPatchResultBase { } // @public (undocumented) -interface FetchMoreQueryOptions { +interface FetchMoreQueryOptions> { // (undocumented) - context?: DefaultContext; + context?: TContext; query?: DocumentNode | TypedDocumentNode; variables?: Partial; } @@ -719,7 +720,7 @@ type FetchPolicy = "cache-first" | "network-only" | "cache-only" | "no-cache" | // Warning: (ae-forgotten-export) The symbol "ExecutionPatchResult" needs to be exported by the entry point index.d.ts // // @public (undocumented) -type FetchResult, TContext = Record, TExtensions = Record> = SingleExecutionResult | ExecutionPatchResult; +type FetchResult, TContext extends OperationContext = DefaultContext, TExtensions = Record> = SingleExecutionResult | ExecutionPatchResult; // @public (undocumented) interface FieldSpecifier { @@ -790,9 +791,9 @@ const getApolloClientMemoryInternals: (() => { export function getApolloContext(): ReactTypes.Context; // @public (undocumented) -interface GraphQLRequest> { +interface GraphQLRequest, TContext extends OperationContext = Partial> { // (undocumented) - context?: DefaultContext; + context?: TContext; // (undocumented) extensions?: Record; // (undocumented) @@ -971,7 +972,7 @@ type Modifiers = Record> = Partia }>; // @public (undocumented) -interface MutationBaseOptions = ApolloCache> { +interface MutationBaseOptions, TCache extends ApolloCache = ApolloCache> { awaitRefetchQueries?: boolean; context?: TContext; // Warning: (ae-forgotten-export) The symbol "ErrorPolicy" needs to be exported by the entry point index.d.ts @@ -998,7 +999,7 @@ type MutationFetchPolicy = Extract; // Warning: (ae-forgotten-export) The symbol "MutationSharedOptions" needs to be exported by the entry point index.d.ts // // @public (undocumented) -interface MutationOptions = ApolloCache> extends MutationSharedOptions { +interface MutationOptions, TCache extends ApolloCache = ApolloCache> extends MutationSharedOptions { mutation: DocumentNode | TypedDocumentNode; } @@ -1019,7 +1020,7 @@ type MutationQueryReducersMap = ApolloCache> extends MutationBaseOptions { +interface MutationSharedOptions, TCache extends ApolloCache = ApolloCache> extends MutationBaseOptions { // Warning: (ae-forgotten-export) The symbol "MutationFetchPolicy" needs to be exported by the entry point index.d.ts fetchPolicy?: MutationFetchPolicy; keepRootFields?: boolean; @@ -1178,6 +1179,9 @@ interface Operation { variables: Record; } +// @public (undocumented) +type OperationContext = Record; + // @public (undocumented) type OperationVariables = Record; @@ -1359,7 +1363,7 @@ class QueryManager { keepRootFields?: boolean; }, cache?: ApolloCache): Promise>; // (undocumented) - mutate, TCache extends ApolloCache>({ mutation, variables, optimisticResponse, updateQueries, refetchQueries, awaitRefetchQueries, update: updateWithProxyFn, onQueryUpdated, fetchPolicy, errorPolicy, keepRootFields, context, }: MutationOptions): Promise>; + mutate>({ mutation, variables, optimisticResponse, updateQueries, refetchQueries, awaitRefetchQueries, update: updateWithProxyFn, onQueryUpdated, fetchPolicy, errorPolicy, keepRootFields, context, }: MutationOptions): Promise>; // (undocumented) mutationStore?: { [mutationId: string]: MutationStoreValue; @@ -1382,7 +1386,7 @@ class QueryManager { // (undocumented) readonly ssrMode: boolean; // (undocumented) - startGraphQLSubscription({ query, fetchPolicy, errorPolicy, variables, context, extensions, }: SubscriptionOptions): Observable>; + startGraphQLSubscription>({ query, fetchPolicy, errorPolicy, variables, context, extensions, }: SubscriptionOptions): Observable>; stop(): void; // (undocumented) stopQuery(queryId: string): void; @@ -1421,10 +1425,10 @@ interface QueryManagerOptions { } // @public -interface QueryOptions { +interface QueryOptions> { // @deprecated canonizeResults?: boolean; - context?: DefaultContext; + context?: TContext; errorPolicy?: ErrorPolicy; fetchPolicy?: FetchPolicy; notifyOnNetworkStatusChange?: boolean; @@ -1579,10 +1583,10 @@ type ServerParseError = Error & { }; // @public (undocumented) -interface SharedWatchQueryOptions { +interface SharedWatchQueryOptions> { // @deprecated canonizeResults?: boolean; - context?: DefaultContext; + context?: TContext; errorPolicy?: ErrorPolicy; fetchPolicy?: WatchQueryFetchPolicy; initialFetchPolicy?: WatchQueryFetchPolicy; @@ -1600,7 +1604,7 @@ interface SharedWatchQueryOptions } // @public (undocumented) -interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> { +interface SingleExecutionResult, TContext extends OperationContext = DefaultContext, TExtensions = Record> { // (undocumented) context?: TContext; // (undocumented) @@ -1636,17 +1640,17 @@ Item type StoreValue = number | string | string[] | Reference | Reference[] | null | undefined | void | Object; // @public (undocumented) -type SubscribeToMoreOptions = { +type SubscribeToMoreOptions> = { document: DocumentNode | TypedDocumentNode; variables?: TSubscriptionVariables; updateQuery?: UpdateQueryFn; onError?: (error: Error) => void; - context?: DefaultContext; + context?: TContext; }; // @public (undocumented) -interface SubscriptionOptions { - context?: DefaultContext; +interface SubscriptionOptions> { + context?: TContext; errorPolicy?: ErrorPolicy; extensions?: Record; fetchPolicy?: FetchPolicy; @@ -1743,11 +1747,11 @@ interface WatchQueryOptions implements DataProxy { // // (undocumented) link: ApolloLink; + // Warning: (ae-forgotten-export) The symbol "OperationContext" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "DefaultContext" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "MutationOptions" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "FetchResult" needs to be exported by the entry point index.d.ts - mutate = DefaultContext, TCache extends ApolloCache = ApolloCache>(options: MutationOptions): Promise>; + mutate, TCache extends ApolloCache = ApolloCache>(options: MutationOptions): Promise>; onClearStore(cb: () => Promise): () => void; onResetStore(cb: () => Promise): () => void; // Warning: (ae-forgotten-export) The symbol "QueryOptions" needs to be exported by the entry point index.d.ts @@ -156,7 +157,7 @@ class ApolloClient implements DataProxy { setResolvers(resolvers: Resolvers | Resolvers[]): void; stop(): void; // Warning: (ae-forgotten-export) The symbol "SubscriptionOptions" needs to be exported by the entry point index.d.ts - subscribe(options: SubscriptionOptions): Observable>; + subscribe>(options: SubscriptionOptions): Observable>; // Warning: (ae-forgotten-export) The symbol "ApolloClientOptions" needs to be exported by the entry point index.d.ts // // (undocumented) @@ -180,7 +181,7 @@ interface ApolloClientOptions { // (undocumented) credentials?: string; // (undocumented) - defaultContext?: Partial; + defaultContext?: DefaultContext; defaultOptions?: DefaultOptions; devtools?: DevtoolsOptions; // (undocumented) @@ -315,7 +316,7 @@ type AsStoreObject = ApolloCache> extends MutationSharedOptions { +interface BaseMutationOptions, TCache extends ApolloCache = ApolloCache> extends MutationSharedOptions { // Warning: (ae-forgotten-export) The symbol "ApolloClient" needs to be exported by the entry point index.d.ts client?: ApolloClient; ignoreResults?: boolean; @@ -327,9 +328,9 @@ interface BaseMutationOptions extends SharedWatchQueryOptions { +interface BaseQueryOptions> extends SharedWatchQueryOptions { client?: ApolloClient; - context?: DefaultContext; + context?: TContext; ssr?: boolean; } @@ -598,7 +599,7 @@ type DeepPartialReadonlySet = {} & ReadonlySet>; type DeepPartialSet = {} & Set>; // @public (undocumented) -interface DefaultContext extends Record { +interface DefaultContext extends OperationContext { } // @public (undocumented) @@ -712,9 +713,9 @@ interface FetchMoreOptions { } // @public (undocumented) -interface FetchMoreQueryOptions { +interface FetchMoreQueryOptions> { // (undocumented) - context?: DefaultContext; + context?: TContext; query?: DocumentNode | TypedDocumentNode; variables?: Partial; } @@ -726,7 +727,7 @@ type FetchPolicy = "cache-first" | "network-only" | "cache-only" | "no-cache" | // Warning: (ae-forgotten-export) The symbol "ExecutionPatchResult" needs to be exported by the entry point index.d.ts // // @public (undocumented) -type FetchResult, TContext = Record, TExtensions = Record> = SingleExecutionResult | ExecutionPatchResult; +type FetchResult, TContext extends OperationContext = DefaultContext, TExtensions = Record> = SingleExecutionResult | ExecutionPatchResult; // @public (undocumented) interface FieldSpecifier { @@ -797,9 +798,9 @@ const getApolloClientMemoryInternals: (() => { export function graphql> & Partial>>(document: DocumentNode, operationOptions?: OperationOption): (WrappedComponent: ReactTypes.ComponentType) => ReactTypes.ComponentClass; // @public (undocumented) -interface GraphQLRequest> { +interface GraphQLRequest, TContext extends OperationContext = Partial> { // (undocumented) - context?: DefaultContext; + context?: TContext; // (undocumented) extensions?: Record; // (undocumented) @@ -990,7 +991,7 @@ export interface MutateProps = ApolloCache> { +interface MutationBaseOptions, TCache extends ApolloCache = ApolloCache> { awaitRefetchQueries?: boolean; context?: TContext; // Warning: (ae-forgotten-export) The symbol "ErrorPolicy" needs to be exported by the entry point index.d.ts @@ -1017,17 +1018,17 @@ type MutationFetchPolicy = Extract; // Warning: (ae-forgotten-export) The symbol "MutationFunctionOptions" needs to be exported by the entry point index.d.ts // // @public (undocumented) -type MutationFunction = ApolloCache> = (options?: MutationFunctionOptions) => Promise>; +type MutationFunction, TCache extends ApolloCache = ApolloCache> = (options?: MutationFunctionOptions) => Promise>; // Warning: (ae-forgotten-export) The symbol "BaseMutationOptions" needs to be exported by the entry point index.d.ts // // @public (undocumented) -interface MutationFunctionOptions = ApolloCache> extends BaseMutationOptions { +interface MutationFunctionOptions, TCache extends ApolloCache = ApolloCache> extends BaseMutationOptions { mutation?: DocumentNode | TypedDocumentNode; } // @public (undocumented) -interface MutationOptions = ApolloCache> extends MutationSharedOptions { +interface MutationOptions, TCache extends ApolloCache = ApolloCache> extends MutationSharedOptions { mutation: DocumentNode | TypedDocumentNode; } @@ -1058,7 +1059,7 @@ interface MutationResult { // Warning: (ae-forgotten-export) The symbol "MutationBaseOptions" needs to be exported by the entry point index.d.ts // // @public (undocumented) -interface MutationSharedOptions = ApolloCache> extends MutationBaseOptions { +interface MutationSharedOptions, TCache extends ApolloCache = ApolloCache> extends MutationBaseOptions { // Warning: (ae-forgotten-export) The symbol "MutationFetchPolicy" needs to be exported by the entry point index.d.ts fetchPolicy?: MutationFetchPolicy; keepRootFields?: boolean; @@ -1200,7 +1201,10 @@ interface Operation { } // @public (undocumented) -export interface OperationOption, TContext = DefaultContext, TCache extends ApolloCache = ApolloCache> { +type OperationContext = Record; + +// @public (undocumented) +export interface OperationOption, TContext extends OperationContext = Partial, TCache extends ApolloCache = ApolloCache> { // (undocumented) alias?: string; // (undocumented) @@ -1404,7 +1408,7 @@ class QueryManager { keepRootFields?: boolean; }, cache?: ApolloCache): Promise>; // (undocumented) - mutate, TCache extends ApolloCache>({ mutation, variables, optimisticResponse, updateQueries, refetchQueries, awaitRefetchQueries, update: updateWithProxyFn, onQueryUpdated, fetchPolicy, errorPolicy, keepRootFields, context, }: MutationOptions): Promise>; + mutate>({ mutation, variables, optimisticResponse, updateQueries, refetchQueries, awaitRefetchQueries, update: updateWithProxyFn, onQueryUpdated, fetchPolicy, errorPolicy, keepRootFields, context, }: MutationOptions): Promise>; // (undocumented) mutationStore?: { [mutationId: string]: MutationStoreValue; @@ -1427,7 +1431,7 @@ class QueryManager { // (undocumented) readonly ssrMode: boolean; // (undocumented) - startGraphQLSubscription({ query, fetchPolicy, errorPolicy, variables, context, extensions, }: SubscriptionOptions): Observable>; + startGraphQLSubscription>({ query, fetchPolicy, errorPolicy, variables, context, extensions, }: SubscriptionOptions): Observable>; stop(): void; // (undocumented) stopQuery(queryId: string): void; @@ -1466,10 +1470,10 @@ interface QueryManagerOptions { } // @public -interface QueryOptions { +interface QueryOptions> { // @deprecated canonizeResults?: boolean; - context?: DefaultContext; + context?: TContext; errorPolicy?: ErrorPolicy; fetchPolicy?: FetchPolicy; notifyOnNetworkStatusChange?: boolean; @@ -1583,10 +1587,10 @@ type ServerParseError = Error & { }; // @public (undocumented) -interface SharedWatchQueryOptions { +interface SharedWatchQueryOptions> { // @deprecated canonizeResults?: boolean; - context?: DefaultContext; + context?: TContext; errorPolicy?: ErrorPolicy; fetchPolicy?: WatchQueryFetchPolicy; initialFetchPolicy?: WatchQueryFetchPolicy; @@ -1604,7 +1608,7 @@ interface SharedWatchQueryOptions } // @public (undocumented) -interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> { +interface SingleExecutionResult, TContext extends OperationContext = DefaultContext, TExtensions = Record> { // (undocumented) context?: TContext; // (undocumented) @@ -1640,17 +1644,17 @@ Item type StoreValue = number | string | string[] | Reference | Reference[] | null | undefined | void | Object; // @public (undocumented) -type SubscribeToMoreOptions = { +type SubscribeToMoreOptions> = { document: DocumentNode | TypedDocumentNode; variables?: TSubscriptionVariables; updateQuery?: UpdateQueryFn; onError?: (error: Error) => void; - context?: DefaultContext; + context?: TContext; }; // @public (undocumented) -interface SubscriptionOptions { - context?: DefaultContext; +interface SubscriptionOptions> { + context?: TContext; errorPolicy?: ErrorPolicy; extensions?: Record; fetchPolicy?: FetchPolicy; @@ -1770,11 +1774,11 @@ export function withSubscription implements DataProxy { // // (undocumented) link: ApolloLink; + // Warning: (ae-forgotten-export) The symbol "OperationContext" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "DefaultContext" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "MutationOptions" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "FetchResult" needs to be exported by the entry point index.d.ts - mutate = DefaultContext, TCache extends ApolloCache = ApolloCache>(options: MutationOptions): Promise>; + mutate, TCache extends ApolloCache = ApolloCache>(options: MutationOptions): Promise>; onClearStore(cb: () => Promise): () => void; onResetStore(cb: () => Promise): () => void; // Warning: (ae-forgotten-export) The symbol "QueryOptions" needs to be exported by the entry point index.d.ts @@ -155,7 +156,7 @@ class ApolloClient implements DataProxy { setResolvers(resolvers: Resolvers | Resolvers[]): void; stop(): void; // Warning: (ae-forgotten-export) The symbol "SubscriptionOptions" needs to be exported by the entry point index.d.ts - subscribe(options: SubscriptionOptions): Observable>; + subscribe>(options: SubscriptionOptions): Observable>; // Warning: (ae-forgotten-export) The symbol "ApolloClientOptions" needs to be exported by the entry point index.d.ts // // (undocumented) @@ -179,7 +180,7 @@ interface ApolloClientOptions { // (undocumented) credentials?: string; // (undocumented) - defaultContext?: Partial; + defaultContext?: DefaultContext; defaultOptions?: DefaultOptions; devtools?: DevtoolsOptions; // (undocumented) @@ -339,7 +340,7 @@ type BackgroundQueryHookOptionsNoInfer = ApolloCache> extends MutationSharedOptions { +interface BaseMutationOptions, TCache extends ApolloCache = ApolloCache> extends MutationSharedOptions { // Warning: (ae-forgotten-export) The symbol "ApolloClient" needs to be exported by the entry point index.d.ts client?: ApolloClient; ignoreResults?: boolean; @@ -351,16 +352,16 @@ interface BaseMutationOptions extends SharedWatchQueryOptions { +interface BaseQueryOptions> extends SharedWatchQueryOptions { client?: ApolloClient; - context?: DefaultContext; + context?: TContext; ssr?: boolean; } // @public (undocumented) -interface BaseSubscriptionOptions { +interface BaseSubscriptionOptions> { client?: ApolloClient; - context?: DefaultContext; + context?: TContext; // Warning: (ae-forgotten-export) The symbol "ErrorPolicy" needs to be exported by the entry point index.d.ts errorPolicy?: ErrorPolicy; extensions?: Record; @@ -629,7 +630,7 @@ type DeepPartialReadonlySet = {} & ReadonlySet>; type DeepPartialSet = {} & Set>; // @public (undocumented) -interface DefaultContext extends Record { +interface DefaultContext extends OperationContext { } // @public (undocumented) @@ -744,9 +745,9 @@ type FetchMoreFunction = (fetchMor }) => Promise>; // @public (undocumented) -interface FetchMoreQueryOptions { +interface FetchMoreQueryOptions> { // (undocumented) - context?: DefaultContext; + context?: TContext; query?: DocumentNode | TypedDocumentNode; variables?: Partial; } @@ -758,7 +759,7 @@ type FetchPolicy = "cache-first" | "network-only" | "cache-only" | "no-cache" | // Warning: (ae-forgotten-export) The symbol "ExecutionPatchResult" needs to be exported by the entry point index.d.ts // // @public (undocumented) -type FetchResult, TContext = Record, TExtensions = Record> = SingleExecutionResult | ExecutionPatchResult; +type FetchResult, TContext extends OperationContext = DefaultContext, TExtensions = Record> = SingleExecutionResult | ExecutionPatchResult; // @public (undocumented) interface FieldSpecifier { @@ -826,9 +827,9 @@ const getApolloClientMemoryInternals: (() => { }) | undefined; // @public (undocumented) -interface GraphQLRequest> { +interface GraphQLRequest, TContext extends OperationContext = Partial> { // (undocumented) - context?: DefaultContext; + context?: TContext; // (undocumented) extensions?: Record; // (undocumented) @@ -951,7 +952,7 @@ interface LoadableQueryHookOptions { // @deprecated canonizeResults?: boolean; client?: ApolloClient; - context?: DefaultContext; + context?: Partial; errorPolicy?: ErrorPolicy; // Warning: (ae-forgotten-export) The symbol "LoadableQueryHookFetchPolicy" needs to be exported by the entry point index.d.ts fetchPolicy?: LoadableQueryHookFetchPolicy; @@ -1062,7 +1063,7 @@ type Modifiers = Record> = Partia }>; // @public (undocumented) -interface MutationBaseOptions = ApolloCache> { +interface MutationBaseOptions, TCache extends ApolloCache = ApolloCache> { awaitRefetchQueries?: boolean; context?: TContext; errorPolicy?: ErrorPolicy; @@ -1086,16 +1087,16 @@ type MutationFetchPolicy = Extract; // Warning: (ae-forgotten-export) The symbol "BaseMutationOptions" needs to be exported by the entry point index.d.ts // // @public (undocumented) -interface MutationFunctionOptions = ApolloCache> extends BaseMutationOptions { +interface MutationFunctionOptions, TCache extends ApolloCache = ApolloCache> extends BaseMutationOptions { mutation?: DocumentNode | TypedDocumentNode; } // @public (undocumented) -interface MutationHookOptions = ApolloCache> extends BaseMutationOptions { +interface MutationHookOptions, TCache extends ApolloCache = ApolloCache> extends BaseMutationOptions { } // @public (undocumented) -interface MutationOptions = ApolloCache> extends MutationSharedOptions { +interface MutationOptions, TCache extends ApolloCache = ApolloCache> extends MutationSharedOptions { mutation: DocumentNode | TypedDocumentNode; } @@ -1126,7 +1127,7 @@ interface MutationResult { // Warning: (ae-forgotten-export) The symbol "MutationBaseOptions" needs to be exported by the entry point index.d.ts // // @public (undocumented) -interface MutationSharedOptions = ApolloCache> extends MutationBaseOptions { +interface MutationSharedOptions, TCache extends ApolloCache = ApolloCache> extends MutationBaseOptions { // Warning: (ae-forgotten-export) The symbol "MutationFetchPolicy" needs to be exported by the entry point index.d.ts fetchPolicy?: MutationFetchPolicy; keepRootFields?: boolean; @@ -1148,7 +1149,7 @@ interface MutationStoreValue { // Warning: (ae-forgotten-export) The symbol "MutationResult" needs to be exported by the entry point index.d.ts // // @public (undocumented) -type MutationTuple = ApolloCache> = [ +type MutationTuple, TCache extends ApolloCache = ApolloCache> = [ mutate: (options?: MutationFunctionOptions) => Promise>, result: MutationResult ]; @@ -1317,6 +1318,9 @@ interface Operation { variables: Record; } +// @public (undocumented) +type OperationContext = Record; + // @public (undocumented) type OperationVariables = Record; @@ -1486,7 +1490,7 @@ class QueryManager { keepRootFields?: boolean; }, cache?: ApolloCache): Promise>; // (undocumented) - mutate, TCache extends ApolloCache>({ mutation, variables, optimisticResponse, updateQueries, refetchQueries, awaitRefetchQueries, update: updateWithProxyFn, onQueryUpdated, fetchPolicy, errorPolicy, keepRootFields, context, }: MutationOptions): Promise>; + mutate>({ mutation, variables, optimisticResponse, updateQueries, refetchQueries, awaitRefetchQueries, update: updateWithProxyFn, onQueryUpdated, fetchPolicy, errorPolicy, keepRootFields, context, }: MutationOptions): Promise>; // (undocumented) mutationStore?: { [mutationId: string]: MutationStoreValue; @@ -1509,7 +1513,7 @@ class QueryManager { // (undocumented) readonly ssrMode: boolean; // (undocumented) - startGraphQLSubscription({ query, fetchPolicy, errorPolicy, variables, context, extensions, }: SubscriptionOptions): Observable>; + startGraphQLSubscription>({ query, fetchPolicy, errorPolicy, variables, context, extensions, }: SubscriptionOptions): Observable>; stop(): void; // (undocumented) stopQuery(queryId: string): void; @@ -1548,10 +1552,10 @@ interface QueryManagerOptions { } // @public -interface QueryOptions { +interface QueryOptions> { // @deprecated canonizeResults?: boolean; - context?: DefaultContext; + context?: TContext; errorPolicy?: ErrorPolicy; fetchPolicy?: FetchPolicy; notifyOnNetworkStatusChange?: boolean; @@ -1710,10 +1714,10 @@ type ServerParseError = Error & { }; // @public (undocumented) -interface SharedWatchQueryOptions { +interface SharedWatchQueryOptions> { // @deprecated canonizeResults?: boolean; - context?: DefaultContext; + context?: TContext; errorPolicy?: ErrorPolicy; fetchPolicy?: WatchQueryFetchPolicy; initialFetchPolicy?: WatchQueryFetchPolicy; @@ -1730,7 +1734,7 @@ interface SharedWatchQueryOptions } // @public (undocumented) -interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> { +interface SingleExecutionResult, TContext extends OperationContext = DefaultContext, TExtensions = Record> { // (undocumented) context?: TContext; // (undocumented) @@ -1775,12 +1779,12 @@ type StoreValue = number | string | string[] | Reference | Reference[] | null | type SubscribeToMoreFunction = ObservableQueryFields["subscribeToMore"]; // @public (undocumented) -type SubscribeToMoreOptions = { +type SubscribeToMoreOptions> = { document: DocumentNode | TypedDocumentNode; variables?: TSubscriptionVariables; updateQuery?: UpdateQueryFn; onError?: (error: Error) => void; - context?: DefaultContext; + context?: TContext; }; // Warning: (ae-forgotten-export) The symbol "BaseSubscriptionOptions" needs to be exported by the entry point index.d.ts @@ -1790,8 +1794,8 @@ interface SubscriptionHookOptions { - context?: DefaultContext; +interface SubscriptionOptions> { + context?: TContext; errorPolicy?: ErrorPolicy; extensions?: Record; fetchPolicy?: FetchPolicy; @@ -1812,11 +1816,11 @@ interface SubscriptionResult { type SuspenseQueryHookFetchPolicy = Extract; // @public (undocumented) -interface SuspenseQueryHookOptions { +interface SuspenseQueryHookOptions> { // @deprecated canonizeResults?: boolean; client?: ApolloClient; - context?: DefaultContext; + context?: TContext; errorPolicy?: ErrorPolicy; // Warning: (ae-forgotten-export) The symbol "SuspenseQueryHookFetchPolicy" needs to be exported by the entry point index.d.ts fetchPolicy?: SuspenseQueryHookFetchPolicy; @@ -2027,7 +2031,7 @@ handlers: { // Warning: (ae-forgotten-export) The symbol "MutationTuple" needs to be exported by the entry point index.d.ts // // @public -export function useMutation = ApolloCache>(mutation: DocumentNode | TypedDocumentNode, options?: MutationHookOptions, NoInfer_2, TContext, TCache>): MutationTuple; +export function useMutation, TCache extends ApolloCache = ApolloCache>(mutation: DocumentNode | TypedDocumentNode, options?: MutationHookOptions, NoInfer_2, TContext, TCache>): MutationTuple; // @public export function useQuery(query: DocumentNode | TypedDocumentNode, options?: QueryHookOptions, NoInfer_2>): QueryResult; @@ -2168,11 +2172,11 @@ interface WatchQueryOptions implements DataProxy { // // (undocumented) link: ApolloLink; + // Warning: (ae-forgotten-export) The symbol "OperationContext" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "DefaultContext" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "MutationOptions" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "FetchResult" needs to be exported by the entry point index.d.ts - mutate = DefaultContext, TCache extends ApolloCache = ApolloCache>(options: MutationOptions): Promise>; + mutate, TCache extends ApolloCache = ApolloCache>(options: MutationOptions): Promise>; onClearStore(cb: () => Promise): () => void; onResetStore(cb: () => Promise): () => void; // Warning: (ae-forgotten-export) The symbol "QueryOptions" needs to be exported by the entry point index.d.ts @@ -155,7 +156,7 @@ class ApolloClient implements DataProxy { setResolvers(resolvers: Resolvers | Resolvers[]): void; stop(): void; // Warning: (ae-forgotten-export) The symbol "SubscriptionOptions" needs to be exported by the entry point index.d.ts - subscribe(options: SubscriptionOptions): Observable>; + subscribe>(options: SubscriptionOptions): Observable>; // Warning: (ae-forgotten-export) The symbol "ApolloClientOptions" needs to be exported by the entry point index.d.ts // // (undocumented) @@ -179,7 +180,7 @@ interface ApolloClientOptions { // (undocumented) credentials?: string; // (undocumented) - defaultContext?: Partial; + defaultContext?: DefaultContext; defaultOptions?: DefaultOptions; devtools?: DevtoolsOptions; // (undocumented) @@ -347,10 +348,10 @@ type BackgroundQueryHookOptionsNoInfer extends SharedWatchQueryOptions { +interface BaseQueryOptions> extends SharedWatchQueryOptions { // Warning: (ae-forgotten-export) The symbol "ApolloClient" needs to be exported by the entry point index.d.ts client?: ApolloClient; - context?: DefaultContext; + context?: TContext; ssr?: boolean; } @@ -613,7 +614,7 @@ type DeepPartialReadonlySet = {} & ReadonlySet>; type DeepPartialSet = {} & Set>; // @public (undocumented) -interface DefaultContext extends Record { +interface DefaultContext extends OperationContext { } // @public (undocumented) @@ -731,9 +732,9 @@ type FetchMoreFunction = (fetchMor type FetchMoreOptions = Parameters["fetchMore"]>[0]; // @public (undocumented) -interface FetchMoreQueryOptions { +interface FetchMoreQueryOptions> { // (undocumented) - context?: DefaultContext; + context?: TContext; query?: DocumentNode | TypedDocumentNode; variables?: Partial; } @@ -745,7 +746,7 @@ type FetchPolicy = "cache-first" | "network-only" | "cache-only" | "no-cache" | // Warning: (ae-forgotten-export) The symbol "ExecutionPatchResult" needs to be exported by the entry point index.d.ts // // @public (undocumented) -type FetchResult, TContext = Record, TExtensions = Record> = SingleExecutionResult | ExecutionPatchResult; +type FetchResult, TContext extends OperationContext = DefaultContext, TExtensions = Record> = SingleExecutionResult | ExecutionPatchResult; // @public (undocumented) interface FieldSpecifier { @@ -833,9 +834,9 @@ export function getSuspenseCache(client: ApolloClient & { export function getWrappedPromise(queryRef: WrappedQueryRef): QueryRefPromise; // @public (undocumented) -interface GraphQLRequest> { +interface GraphQLRequest, TContext extends OperationContext = Partial> { // (undocumented) - context?: DefaultContext; + context?: TContext; // (undocumented) extensions?: Record; // (undocumented) @@ -1072,7 +1073,7 @@ type Modifiers = Record> = Partia }>; // @public (undocumented) -interface MutationBaseOptions = ApolloCache> { +interface MutationBaseOptions, TCache extends ApolloCache = ApolloCache> { awaitRefetchQueries?: boolean; context?: TContext; // Warning: (ae-forgotten-export) The symbol "ErrorPolicy" needs to be exported by the entry point index.d.ts @@ -1099,7 +1100,7 @@ type MutationFetchPolicy = Extract; // Warning: (ae-forgotten-export) The symbol "MutationSharedOptions" needs to be exported by the entry point index.d.ts // // @public (undocumented) -interface MutationOptions = ApolloCache> extends MutationSharedOptions { +interface MutationOptions, TCache extends ApolloCache = ApolloCache> extends MutationSharedOptions { mutation: DocumentNode | TypedDocumentNode; } @@ -1120,7 +1121,7 @@ type MutationQueryReducersMap = ApolloCache> extends MutationBaseOptions { +interface MutationSharedOptions, TCache extends ApolloCache = ApolloCache> extends MutationBaseOptions { // Warning: (ae-forgotten-export) The symbol "MutationFetchPolicy" needs to be exported by the entry point index.d.ts fetchPolicy?: MutationFetchPolicy; keepRootFields?: boolean; @@ -1292,6 +1293,9 @@ interface Operation { variables: Record; } +// @public (undocumented) +type OperationContext = Record; + // @public (undocumented) type OperationVariables = Record; @@ -1333,9 +1337,9 @@ interface PreloadQueryFunction { // Warning: (ae-forgotten-export) The symbol "VariablesOption" needs to be exported by the entry point index.d.ts // // @public (undocumented) -type PreloadQueryOptions = { +type PreloadQueryOptions> = { canonizeResults?: boolean; - context?: DefaultContext; + context?: TContext; errorPolicy?: ErrorPolicy; fetchPolicy?: PreloadQueryFetchPolicy; returnPartialData?: boolean; @@ -1537,7 +1541,7 @@ class QueryManager { keepRootFields?: boolean; }, cache?: ApolloCache): Promise>; // (undocumented) - mutate, TCache extends ApolloCache>({ mutation, variables, optimisticResponse, updateQueries, refetchQueries, awaitRefetchQueries, update: updateWithProxyFn, onQueryUpdated, fetchPolicy, errorPolicy, keepRootFields, context, }: MutationOptions): Promise>; + mutate>({ mutation, variables, optimisticResponse, updateQueries, refetchQueries, awaitRefetchQueries, update: updateWithProxyFn, onQueryUpdated, fetchPolicy, errorPolicy, keepRootFields, context, }: MutationOptions): Promise>; // (undocumented) mutationStore?: { [mutationId: string]: MutationStoreValue; @@ -1560,7 +1564,7 @@ class QueryManager { // (undocumented) readonly ssrMode: boolean; // (undocumented) - startGraphQLSubscription({ query, fetchPolicy, errorPolicy, variables, context, extensions, }: SubscriptionOptions): Observable>; + startGraphQLSubscription>({ query, fetchPolicy, errorPolicy, variables, context, extensions, }: SubscriptionOptions): Observable>; stop(): void; // (undocumented) stopQuery(queryId: string): void; @@ -1599,10 +1603,10 @@ interface QueryManagerOptions { } // @public -interface QueryOptions { +interface QueryOptions> { // @deprecated canonizeResults?: boolean; - context?: DefaultContext; + context?: TContext; errorPolicy?: ErrorPolicy; fetchPolicy?: FetchPolicy; notifyOnNetworkStatusChange?: boolean; @@ -1760,10 +1764,10 @@ type ServerParseError = Error & { }; // @public (undocumented) -interface SharedWatchQueryOptions { +interface SharedWatchQueryOptions> { // @deprecated canonizeResults?: boolean; - context?: DefaultContext; + context?: TContext; errorPolicy?: ErrorPolicy; fetchPolicy?: WatchQueryFetchPolicy; initialFetchPolicy?: WatchQueryFetchPolicy; @@ -1780,7 +1784,7 @@ interface SharedWatchQueryOptions } // @public (undocumented) -interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> { +interface SingleExecutionResult, TContext extends OperationContext = DefaultContext, TExtensions = Record> { // (undocumented) context?: TContext; // (undocumented) @@ -1825,17 +1829,17 @@ type StoreValue = number | string | string[] | Reference | Reference[] | null | type SubscribeToMoreFunction = ObservableQueryFields["subscribeToMore"]; // @public (undocumented) -type SubscribeToMoreOptions = { +type SubscribeToMoreOptions> = { document: DocumentNode | TypedDocumentNode; variables?: TSubscriptionVariables; updateQuery?: UpdateQueryFn; onError?: (error: Error) => void; - context?: DefaultContext; + context?: TContext; }; // @public (undocumented) -interface SubscriptionOptions { - context?: DefaultContext; +interface SubscriptionOptions> { + context?: TContext; errorPolicy?: ErrorPolicy; extensions?: Record; fetchPolicy?: FetchPolicy; @@ -1864,11 +1868,11 @@ const suspenseCacheSymbol: unique symbol; type SuspenseQueryHookFetchPolicy = Extract; // @public (undocumented) -interface SuspenseQueryHookOptions { +interface SuspenseQueryHookOptions> { // @deprecated canonizeResults?: boolean; client?: ApolloClient; - context?: DefaultContext; + context?: TContext; errorPolicy?: ErrorPolicy; // Warning: (ae-forgotten-export) The symbol "SuspenseQueryHookFetchPolicy" needs to be exported by the entry point index.d.ts fetchPolicy?: SuspenseQueryHookFetchPolicy; @@ -2231,16 +2235,16 @@ export function wrapQueryRef(inter // 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:138:5 - (ae-forgotten-export) The symbol "MutationStoreValue" needs to be exported by the entry point index.d.ts -// src/core/QueryManager.ts:382: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 +// src/core/QueryManager.ts:139:5 - (ae-forgotten-export) The symbol "MutationStoreValue" needs to be exported by the entry point index.d.ts +// src/core/QueryManager.ts:383:7 - (ae-forgotten-export) The symbol "UpdateQueries" needs to be exported by the entry point index.d.ts +// src/core/types.ts:176:3 - (ae-forgotten-export) The symbol "MutationQueryReducer" needs to be exported by the entry point index.d.ts +// src/core/types.ts:205:5 - (ae-forgotten-export) The symbol "Resolver" needs to be exported by the entry point index.d.ts +// src/core/watchQueryOptions.ts:287:2 - (ae-forgotten-export) The symbol "UpdateQueryFn" needs to be exported by the entry point index.d.ts // src/react/hooks/useBackgroundQuery.ts:38:3 - (ae-forgotten-export) The symbol "SubscribeToMoreFunction" needs to be exported by the entry point index.d.ts // src/react/hooks/useBackgroundQuery.ts:54:3 - (ae-forgotten-export) The symbol "FetchMoreFunction" needs to be exported by the entry point index.d.ts // src/react/hooks/useBackgroundQuery.ts:78:4 - (ae-forgotten-export) The symbol "RefetchFunction" needs to be exported by the entry point index.d.ts -// src/react/query-preloader/createQueryPreloader.ts:145:3 - (ae-forgotten-export) The symbol "PreloadQueryFetchPolicy" needs to be exported by the entry point index.d.ts -// src/react/query-preloader/createQueryPreloader.ts:167:5 - (ae-forgotten-export) The symbol "RefetchWritePolicy" needs to be exported by the entry point index.d.ts +// src/react/query-preloader/createQueryPreloader.ts:147:3 - (ae-forgotten-export) The symbol "PreloadQueryFetchPolicy" needs to be exported by the entry point index.d.ts +// src/react/query-preloader/createQueryPreloader.ts:169:5 - (ae-forgotten-export) The symbol "RefetchWritePolicy" needs to be exported by the entry point index.d.ts // (No @packageDocumentation comment for this package) diff --git a/.api-reports/api-report-react_ssr.api.md b/.api-reports/api-report-react_ssr.api.md index 69841fbd241..ec830814f91 100644 --- a/.api-reports/api-report-react_ssr.api.md +++ b/.api-reports/api-report-react_ssr.api.md @@ -131,10 +131,11 @@ class ApolloClient implements DataProxy { // // (undocumented) link: ApolloLink; + // Warning: (ae-forgotten-export) The symbol "OperationContext" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "DefaultContext" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "MutationOptions" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "FetchResult" needs to be exported by the entry point index.d.ts - mutate = DefaultContext, TCache extends ApolloCache = ApolloCache>(options: MutationOptions): Promise>; + mutate, TCache extends ApolloCache = ApolloCache>(options: MutationOptions): Promise>; onClearStore(cb: () => Promise): () => void; onResetStore(cb: () => Promise): () => void; // Warning: (ae-forgotten-export) The symbol "QueryOptions" needs to be exported by the entry point index.d.ts @@ -156,7 +157,7 @@ class ApolloClient implements DataProxy { setResolvers(resolvers: Resolvers | Resolvers[]): void; stop(): void; // Warning: (ae-forgotten-export) The symbol "SubscriptionOptions" needs to be exported by the entry point index.d.ts - subscribe(options: SubscriptionOptions): Observable>; + subscribe>(options: SubscriptionOptions): Observable>; // Warning: (ae-forgotten-export) The symbol "ApolloClientOptions" needs to be exported by the entry point index.d.ts // // (undocumented) @@ -180,7 +181,7 @@ interface ApolloClientOptions { // (undocumented) credentials?: string; // (undocumented) - defaultContext?: Partial; + defaultContext?: DefaultContext; defaultOptions?: DefaultOptions; devtools?: DevtoolsOptions; // (undocumented) @@ -315,10 +316,10 @@ type AsStoreObject extends SharedWatchQueryOptions { +interface BaseQueryOptions> extends SharedWatchQueryOptions { // Warning: (ae-forgotten-export) The symbol "ApolloClient" needs to be exported by the entry point index.d.ts client?: ApolloClient; - context?: DefaultContext; + context?: TContext; ssr?: boolean; } @@ -569,7 +570,7 @@ type DeepPartialReadonlySet = {} & ReadonlySet>; type DeepPartialSet = {} & Set>; // @public (undocumented) -interface DefaultContext extends Record { +interface DefaultContext extends OperationContext { } // @public (undocumented) @@ -674,9 +675,9 @@ interface ExecutionPatchResultBase { } // @public (undocumented) -interface FetchMoreQueryOptions { +interface FetchMoreQueryOptions> { // (undocumented) - context?: DefaultContext; + context?: TContext; query?: DocumentNode | TypedDocumentNode; variables?: Partial; } @@ -688,7 +689,7 @@ type FetchPolicy = "cache-first" | "network-only" | "cache-only" | "no-cache" | // Warning: (ae-forgotten-export) The symbol "ExecutionPatchResult" needs to be exported by the entry point index.d.ts // // @public (undocumented) -type FetchResult, TContext = Record, TExtensions = Record> = SingleExecutionResult | ExecutionPatchResult; +type FetchResult, TContext extends OperationContext = DefaultContext, TExtensions = Record> = SingleExecutionResult | ExecutionPatchResult; // @public (undocumented) interface FieldSpecifier { @@ -775,9 +776,9 @@ type GetMarkupFromTreeOptions = { }; // @public (undocumented) -interface GraphQLRequest> { +interface GraphQLRequest, TContext extends OperationContext = Partial> { // (undocumented) - context?: DefaultContext; + context?: TContext; // (undocumented) extensions?: Record; // (undocumented) @@ -956,7 +957,7 @@ type Modifiers = Record> = Partia }>; // @public (undocumented) -interface MutationBaseOptions = ApolloCache> { +interface MutationBaseOptions, TCache extends ApolloCache = ApolloCache> { awaitRefetchQueries?: boolean; context?: TContext; // Warning: (ae-forgotten-export) The symbol "ErrorPolicy" needs to be exported by the entry point index.d.ts @@ -983,7 +984,7 @@ type MutationFetchPolicy = Extract; // Warning: (ae-forgotten-export) The symbol "MutationSharedOptions" needs to be exported by the entry point index.d.ts // // @public (undocumented) -interface MutationOptions = ApolloCache> extends MutationSharedOptions { +interface MutationOptions, TCache extends ApolloCache = ApolloCache> extends MutationSharedOptions { mutation: DocumentNode | TypedDocumentNode; } @@ -1004,7 +1005,7 @@ type MutationQueryReducersMap = ApolloCache> extends MutationBaseOptions { +interface MutationSharedOptions, TCache extends ApolloCache = ApolloCache> extends MutationBaseOptions { // Warning: (ae-forgotten-export) The symbol "MutationFetchPolicy" needs to be exported by the entry point index.d.ts fetchPolicy?: MutationFetchPolicy; keepRootFields?: boolean; @@ -1163,6 +1164,9 @@ interface Operation { variables: Record; } +// @public (undocumented) +type OperationContext = Record; + // @public (undocumented) type OperationVariables = Record; @@ -1344,7 +1348,7 @@ class QueryManager { keepRootFields?: boolean; }, cache?: ApolloCache): Promise>; // (undocumented) - mutate, TCache extends ApolloCache>({ mutation, variables, optimisticResponse, updateQueries, refetchQueries, awaitRefetchQueries, update: updateWithProxyFn, onQueryUpdated, fetchPolicy, errorPolicy, keepRootFields, context, }: MutationOptions): Promise>; + mutate>({ mutation, variables, optimisticResponse, updateQueries, refetchQueries, awaitRefetchQueries, update: updateWithProxyFn, onQueryUpdated, fetchPolicy, errorPolicy, keepRootFields, context, }: MutationOptions): Promise>; // (undocumented) mutationStore?: { [mutationId: string]: MutationStoreValue; @@ -1367,7 +1371,7 @@ class QueryManager { // (undocumented) readonly ssrMode: boolean; // (undocumented) - startGraphQLSubscription({ query, fetchPolicy, errorPolicy, variables, context, extensions, }: SubscriptionOptions): Observable>; + startGraphQLSubscription>({ query, fetchPolicy, errorPolicy, variables, context, extensions, }: SubscriptionOptions): Observable>; stop(): void; // (undocumented) stopQuery(queryId: string): void; @@ -1406,10 +1410,10 @@ interface QueryManagerOptions { } // @public -interface QueryOptions { +interface QueryOptions> { // @deprecated canonizeResults?: boolean; - context?: DefaultContext; + context?: TContext; errorPolicy?: ErrorPolicy; fetchPolicy?: FetchPolicy; notifyOnNetworkStatusChange?: boolean; @@ -1564,10 +1568,10 @@ type ServerParseError = Error & { }; // @public (undocumented) -interface SharedWatchQueryOptions { +interface SharedWatchQueryOptions> { // @deprecated canonizeResults?: boolean; - context?: DefaultContext; + context?: TContext; errorPolicy?: ErrorPolicy; fetchPolicy?: WatchQueryFetchPolicy; initialFetchPolicy?: WatchQueryFetchPolicy; @@ -1585,7 +1589,7 @@ interface SharedWatchQueryOptions } // @public (undocumented) -interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> { +interface SingleExecutionResult, TContext extends OperationContext = DefaultContext, TExtensions = Record> { // (undocumented) context?: TContext; // (undocumented) @@ -1621,17 +1625,17 @@ Item type StoreValue = number | string | string[] | Reference | Reference[] | null | undefined | void | Object; // @public (undocumented) -type SubscribeToMoreOptions = { +type SubscribeToMoreOptions> = { document: DocumentNode | TypedDocumentNode; variables?: TSubscriptionVariables; updateQuery?: UpdateQueryFn; onError?: (error: Error) => void; - context?: DefaultContext; + context?: TContext; }; // @public (undocumented) -interface SubscriptionOptions { - context?: DefaultContext; +interface SubscriptionOptions> { + context?: TContext; errorPolicy?: ErrorPolicy; extensions?: Record; fetchPolicy?: FetchPolicy; @@ -1728,11 +1732,11 @@ interface WatchQueryOptions implements DataProxy { // // (undocumented) link: ApolloLink; + // Warning: (ae-forgotten-export) The symbol "OperationContext" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "DefaultContext" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "MutationOptions" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "FetchResult" needs to be exported by the entry point index.d.ts - mutate = DefaultContext, TCache extends ApolloCache = ApolloCache>(options: MutationOptions): Promise>; + mutate, TCache extends ApolloCache = ApolloCache>(options: MutationOptions): Promise>; onClearStore(cb: () => Promise): () => void; onResetStore(cb: () => Promise): () => void; // Warning: (ae-forgotten-export) The symbol "QueryOptions" needs to be exported by the entry point index.d.ts @@ -156,7 +157,7 @@ class ApolloClient implements DataProxy { setResolvers(resolvers: Resolvers | Resolvers[]): void; stop(): void; // Warning: (ae-forgotten-export) The symbol "SubscriptionOptions" needs to be exported by the entry point index.d.ts - subscribe(options: SubscriptionOptions): Observable>; + subscribe>(options: SubscriptionOptions): Observable>; // Warning: (ae-forgotten-export) The symbol "ApolloClientOptions" needs to be exported by the entry point index.d.ts // // (undocumented) @@ -180,7 +181,7 @@ interface ApolloClientOptions { // (undocumented) credentials?: string; // (undocumented) - defaultContext?: Partial; + defaultContext?: DefaultContext; defaultOptions?: DefaultOptions; devtools?: DevtoolsOptions; // (undocumented) @@ -570,7 +571,7 @@ type DeepPartialReadonlySet = {} & ReadonlySet>; type DeepPartialSet = {} & Set>; // @public (undocumented) -interface DefaultContext extends Record { +interface DefaultContext extends OperationContext { } // @public (undocumented) @@ -675,9 +676,9 @@ interface ExecutionPatchResultBase { } // @public (undocumented) -interface FetchMoreQueryOptions { +interface FetchMoreQueryOptions> { // (undocumented) - context?: DefaultContext; + context?: TContext; query?: DocumentNode | TypedDocumentNode; variables?: Partial; } @@ -689,7 +690,7 @@ type FetchPolicy = "cache-first" | "network-only" | "cache-only" | "no-cache" | // Warning: (ae-forgotten-export) The symbol "ExecutionPatchResult" needs to be exported by the entry point index.d.ts // // @public (undocumented) -type FetchResult, TContext = Record, TExtensions = Record> = SingleExecutionResult | ExecutionPatchResult; +type FetchResult, TContext extends OperationContext = DefaultContext, TExtensions = Record> = SingleExecutionResult | ExecutionPatchResult; // @public (undocumented) interface FieldSpecifier { @@ -757,9 +758,9 @@ const getApolloClientMemoryInternals: (() => { }) | undefined; // @public (undocumented) -interface GraphQLRequest> { +interface GraphQLRequest, TContext extends OperationContext = Partial> { // (undocumented) - context?: DefaultContext; + context?: TContext; // (undocumented) extensions?: Record; // (undocumented) @@ -1077,7 +1078,7 @@ type Modifiers = Record> = Partia }>; // @public (undocumented) -interface MutationBaseOptions = ApolloCache> { +interface MutationBaseOptions, TCache extends ApolloCache = ApolloCache> { awaitRefetchQueries?: boolean; context?: TContext; // Warning: (ae-forgotten-export) The symbol "ErrorPolicy" needs to be exported by the entry point index.d.ts @@ -1104,7 +1105,7 @@ type MutationFetchPolicy = Extract; // Warning: (ae-forgotten-export) The symbol "MutationSharedOptions" needs to be exported by the entry point index.d.ts // // @public (undocumented) -interface MutationOptions = ApolloCache> extends MutationSharedOptions { +interface MutationOptions, TCache extends ApolloCache = ApolloCache> extends MutationSharedOptions { mutation: DocumentNode | TypedDocumentNode; } @@ -1125,7 +1126,7 @@ type MutationQueryReducersMap = ApolloCache> extends MutationBaseOptions { +interface MutationSharedOptions, TCache extends ApolloCache = ApolloCache> extends MutationBaseOptions { // Warning: (ae-forgotten-export) The symbol "MutationFetchPolicy" needs to be exported by the entry point index.d.ts fetchPolicy?: MutationFetchPolicy; keepRootFields?: boolean; @@ -1276,6 +1277,9 @@ interface Operation { variables: Record; } +// @public (undocumented) +type OperationContext = Record; + // @public (undocumented) type OperationVariables = Record; @@ -1425,7 +1429,7 @@ class QueryManager { keepRootFields?: boolean; }, cache?: ApolloCache): Promise>; // (undocumented) - mutate, TCache extends ApolloCache>({ mutation, variables, optimisticResponse, updateQueries, refetchQueries, awaitRefetchQueries, update: updateWithProxyFn, onQueryUpdated, fetchPolicy, errorPolicy, keepRootFields, context, }: MutationOptions): Promise>; + mutate>({ mutation, variables, optimisticResponse, updateQueries, refetchQueries, awaitRefetchQueries, update: updateWithProxyFn, onQueryUpdated, fetchPolicy, errorPolicy, keepRootFields, context, }: MutationOptions): Promise>; // (undocumented) mutationStore?: { [mutationId: string]: MutationStoreValue; @@ -1448,7 +1452,7 @@ class QueryManager { // (undocumented) readonly ssrMode: boolean; // (undocumented) - startGraphQLSubscription({ query, fetchPolicy, errorPolicy, variables, context, extensions, }: SubscriptionOptions): Observable>; + startGraphQLSubscription>({ query, fetchPolicy, errorPolicy, variables, context, extensions, }: SubscriptionOptions): Observable>; stop(): void; // (undocumented) stopQuery(queryId: string): void; @@ -1487,10 +1491,10 @@ interface QueryManagerOptions { } // @public -interface QueryOptions { +interface QueryOptions> { // @deprecated canonizeResults?: boolean; - context?: DefaultContext; + context?: TContext; errorPolicy?: ErrorPolicy; fetchPolicy?: FetchPolicy; notifyOnNetworkStatusChange?: boolean; @@ -1609,10 +1613,10 @@ type ServerParseError = Error & { }; // @public (undocumented) -interface SharedWatchQueryOptions { +interface SharedWatchQueryOptions> { // @deprecated canonizeResults?: boolean; - context?: DefaultContext; + context?: TContext; errorPolicy?: ErrorPolicy; fetchPolicy?: WatchQueryFetchPolicy; initialFetchPolicy?: WatchQueryFetchPolicy; @@ -1630,7 +1634,7 @@ interface SharedWatchQueryOptions } // @public (undocumented) -interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> { +interface SingleExecutionResult, TContext extends OperationContext = DefaultContext, TExtensions = Record> { // (undocumented) context?: TContext; // (undocumented) @@ -1669,17 +1673,17 @@ type StoreValue = number | string | string[] | Reference | Reference[] | null | export function subscribeAndCount(reject: (reason: any) => any, observable: Observable, cb: (handleCount: number, result: TResult) => any): Subscription; // @public (undocumented) -type SubscribeToMoreOptions = { +type SubscribeToMoreOptions> = { document: DocumentNode | TypedDocumentNode; variables?: TSubscriptionVariables; updateQuery?: UpdateQueryFn; onError?: (error: Error) => void; - context?: DefaultContext; + context?: TContext; }; // @public (undocumented) -interface SubscriptionOptions { - context?: DefaultContext; +interface SubscriptionOptions> { + context?: TContext; errorPolicy?: ErrorPolicy; extensions?: Record; fetchPolicy?: FetchPolicy; @@ -1796,11 +1800,11 @@ export function withWarningSpy(it: (...args: TArgs // 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:138:5 - (ae-forgotten-export) The symbol "MutationStoreValue" needs to be exported by the entry point index.d.ts -// src/core/QueryManager.ts:382: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 +// src/core/QueryManager.ts:139:5 - (ae-forgotten-export) The symbol "MutationStoreValue" needs to be exported by the entry point index.d.ts +// src/core/QueryManager.ts:383:7 - (ae-forgotten-export) The symbol "UpdateQueries" needs to be exported by the entry point index.d.ts +// src/core/types.ts:176:3 - (ae-forgotten-export) The symbol "MutationQueryReducer" needs to be exported by the entry point index.d.ts +// src/core/types.ts:205:5 - (ae-forgotten-export) The symbol "Resolver" needs to be exported by the entry point index.d.ts +// src/core/watchQueryOptions.ts:287:2 - (ae-forgotten-export) The symbol "UpdateQueryFn" needs to be exported by the entry point index.d.ts // (No @packageDocumentation comment for this package) diff --git a/.api-reports/api-report-testing_core.api.md b/.api-reports/api-report-testing_core.api.md index 36c9b9abc92..503fd2e7b46 100644 --- a/.api-reports/api-report-testing_core.api.md +++ b/.api-reports/api-report-testing_core.api.md @@ -130,10 +130,11 @@ class ApolloClient implements DataProxy { // // (undocumented) link: ApolloLink; + // Warning: (ae-forgotten-export) The symbol "OperationContext" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "DefaultContext" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "MutationOptions" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "FetchResult" needs to be exported by the entry point index.d.ts - mutate = DefaultContext, TCache extends ApolloCache = ApolloCache>(options: MutationOptions): Promise>; + mutate, TCache extends ApolloCache = ApolloCache>(options: MutationOptions): Promise>; onClearStore(cb: () => Promise): () => void; onResetStore(cb: () => Promise): () => void; // Warning: (ae-forgotten-export) The symbol "QueryOptions" needs to be exported by the entry point index.d.ts @@ -155,7 +156,7 @@ class ApolloClient implements DataProxy { setResolvers(resolvers: Resolvers | Resolvers[]): void; stop(): void; // Warning: (ae-forgotten-export) The symbol "SubscriptionOptions" needs to be exported by the entry point index.d.ts - subscribe(options: SubscriptionOptions): Observable>; + subscribe>(options: SubscriptionOptions): Observable>; // Warning: (ae-forgotten-export) The symbol "ApolloClientOptions" needs to be exported by the entry point index.d.ts // // (undocumented) @@ -179,7 +180,7 @@ interface ApolloClientOptions { // (undocumented) credentials?: string; // (undocumented) - defaultContext?: Partial; + defaultContext?: DefaultContext; defaultOptions?: DefaultOptions; devtools?: DevtoolsOptions; // (undocumented) @@ -569,7 +570,7 @@ type DeepPartialReadonlySet = {} & ReadonlySet>; type DeepPartialSet = {} & Set>; // @public (undocumented) -interface DefaultContext extends Record { +interface DefaultContext extends OperationContext { } // @public (undocumented) @@ -674,9 +675,9 @@ interface ExecutionPatchResultBase { } // @public (undocumented) -interface FetchMoreQueryOptions { +interface FetchMoreQueryOptions> { // (undocumented) - context?: DefaultContext; + context?: TContext; query?: DocumentNode | TypedDocumentNode; variables?: Partial; } @@ -688,7 +689,7 @@ type FetchPolicy = "cache-first" | "network-only" | "cache-only" | "no-cache" | // Warning: (ae-forgotten-export) The symbol "ExecutionPatchResult" needs to be exported by the entry point index.d.ts // // @public (undocumented) -type FetchResult, TContext = Record, TExtensions = Record> = SingleExecutionResult | ExecutionPatchResult; +type FetchResult, TContext extends OperationContext = DefaultContext, TExtensions = Record> = SingleExecutionResult | ExecutionPatchResult; // @public (undocumented) interface FieldSpecifier { @@ -756,9 +757,9 @@ const getApolloClientMemoryInternals: (() => { }) | undefined; // @public (undocumented) -interface GraphQLRequest> { +interface GraphQLRequest, TContext extends OperationContext = Partial> { // (undocumented) - context?: DefaultContext; + context?: TContext; // (undocumented) extensions?: Record; // (undocumented) @@ -1032,7 +1033,7 @@ type Modifiers = Record> = Partia }>; // @public (undocumented) -interface MutationBaseOptions = ApolloCache> { +interface MutationBaseOptions, TCache extends ApolloCache = ApolloCache> { awaitRefetchQueries?: boolean; context?: TContext; // Warning: (ae-forgotten-export) The symbol "ErrorPolicy" needs to be exported by the entry point index.d.ts @@ -1059,7 +1060,7 @@ type MutationFetchPolicy = Extract; // Warning: (ae-forgotten-export) The symbol "MutationSharedOptions" needs to be exported by the entry point index.d.ts // // @public (undocumented) -interface MutationOptions = ApolloCache> extends MutationSharedOptions { +interface MutationOptions, TCache extends ApolloCache = ApolloCache> extends MutationSharedOptions { mutation: DocumentNode | TypedDocumentNode; } @@ -1080,7 +1081,7 @@ type MutationQueryReducersMap = ApolloCache> extends MutationBaseOptions { +interface MutationSharedOptions, TCache extends ApolloCache = ApolloCache> extends MutationBaseOptions { // Warning: (ae-forgotten-export) The symbol "MutationFetchPolicy" needs to be exported by the entry point index.d.ts fetchPolicy?: MutationFetchPolicy; keepRootFields?: boolean; @@ -1231,6 +1232,9 @@ interface Operation { variables: Record; } +// @public (undocumented) +type OperationContext = Record; + // @public (undocumented) type OperationVariables = Record; @@ -1382,7 +1386,7 @@ class QueryManager { keepRootFields?: boolean; }, cache?: ApolloCache): Promise>; // (undocumented) - mutate, TCache extends ApolloCache>({ mutation, variables, optimisticResponse, updateQueries, refetchQueries, awaitRefetchQueries, update: updateWithProxyFn, onQueryUpdated, fetchPolicy, errorPolicy, keepRootFields, context, }: MutationOptions): Promise>; + mutate>({ mutation, variables, optimisticResponse, updateQueries, refetchQueries, awaitRefetchQueries, update: updateWithProxyFn, onQueryUpdated, fetchPolicy, errorPolicy, keepRootFields, context, }: MutationOptions): Promise>; // (undocumented) mutationStore?: { [mutationId: string]: MutationStoreValue; @@ -1405,7 +1409,7 @@ class QueryManager { // (undocumented) readonly ssrMode: boolean; // (undocumented) - startGraphQLSubscription({ query, fetchPolicy, errorPolicy, variables, context, extensions, }: SubscriptionOptions): Observable>; + startGraphQLSubscription>({ query, fetchPolicy, errorPolicy, variables, context, extensions, }: SubscriptionOptions): Observable>; stop(): void; // (undocumented) stopQuery(queryId: string): void; @@ -1444,10 +1448,10 @@ interface QueryManagerOptions { } // @public -interface QueryOptions { +interface QueryOptions> { // @deprecated canonizeResults?: boolean; - context?: DefaultContext; + context?: TContext; errorPolicy?: ErrorPolicy; fetchPolicy?: FetchPolicy; notifyOnNetworkStatusChange?: boolean; @@ -1566,10 +1570,10 @@ type ServerParseError = Error & { }; // @public (undocumented) -interface SharedWatchQueryOptions { +interface SharedWatchQueryOptions> { // @deprecated canonizeResults?: boolean; - context?: DefaultContext; + context?: TContext; errorPolicy?: ErrorPolicy; fetchPolicy?: WatchQueryFetchPolicy; initialFetchPolicy?: WatchQueryFetchPolicy; @@ -1587,7 +1591,7 @@ interface SharedWatchQueryOptions } // @public (undocumented) -interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> { +interface SingleExecutionResult, TContext extends OperationContext = DefaultContext, TExtensions = Record> { // (undocumented) context?: TContext; // (undocumented) @@ -1626,17 +1630,17 @@ type StoreValue = number | string | string[] | Reference | Reference[] | null | export function subscribeAndCount(reject: (reason: any) => any, observable: Observable, cb: (handleCount: number, result: TResult) => any): Subscription; // @public (undocumented) -type SubscribeToMoreOptions = { +type SubscribeToMoreOptions> = { document: DocumentNode | TypedDocumentNode; variables?: TSubscriptionVariables; updateQuery?: UpdateQueryFn; onError?: (error: Error) => void; - context?: DefaultContext; + context?: TContext; }; // @public (undocumented) -interface SubscriptionOptions { - context?: DefaultContext; +interface SubscriptionOptions> { + context?: TContext; errorPolicy?: ErrorPolicy; extensions?: Record; fetchPolicy?: FetchPolicy; @@ -1753,11 +1757,11 @@ export function withWarningSpy(it: (...args: TArgs // 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:138:5 - (ae-forgotten-export) The symbol "MutationStoreValue" needs to be exported by the entry point index.d.ts -// src/core/QueryManager.ts:382: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 +// src/core/QueryManager.ts:139:5 - (ae-forgotten-export) The symbol "MutationStoreValue" needs to be exported by the entry point index.d.ts +// src/core/QueryManager.ts:383:7 - (ae-forgotten-export) The symbol "UpdateQueries" needs to be exported by the entry point index.d.ts +// src/core/types.ts:176:3 - (ae-forgotten-export) The symbol "MutationQueryReducer" needs to be exported by the entry point index.d.ts +// src/core/types.ts:205:5 - (ae-forgotten-export) The symbol "Resolver" needs to be exported by the entry point index.d.ts +// src/core/watchQueryOptions.ts:287:2 - (ae-forgotten-export) The symbol "UpdateQueryFn" needs to be exported by the entry point index.d.ts // (No @packageDocumentation comment for this package) diff --git a/.api-reports/api-report-testing_experimental.api.md b/.api-reports/api-report-testing_experimental.api.md index 330f543fc64..2f555040c6a 100644 --- a/.api-reports/api-report-testing_experimental.api.md +++ b/.api-reports/api-report-testing_experimental.api.md @@ -79,7 +79,7 @@ interface TestSchemaOptions { // Warnings were encountered during analysis: // // 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/types.ts:203:5 - (ae-forgotten-export) The symbol "Resolver" needs to be exported by the entry point index.d.ts +// src/core/types.ts:205:5 - (ae-forgotten-export) The symbol "Resolver" needs to be exported by the entry point index.d.ts // src/testing/experimental/createTestSchema.ts:10:23 - (ae-forgotten-export) The symbol "Resolvers" needs to be exported by the entry point index.d.ts // (No @packageDocumentation comment for this package) diff --git a/.api-reports/api-report-utilities.api.md b/.api-reports/api-report-utilities.api.md index 8a2ff540cb5..b679b35eb4a 100644 --- a/.api-reports/api-report-utilities.api.md +++ b/.api-reports/api-report-utilities.api.md @@ -143,10 +143,11 @@ class ApolloClient implements DataProxy { // // (undocumented) link: ApolloLink; + // Warning: (ae-forgotten-export) The symbol "OperationContext" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "DefaultContext" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "MutationOptions" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "FetchResult" needs to be exported by the entry point index.d.ts - mutate = DefaultContext, TCache extends ApolloCache = ApolloCache>(options: MutationOptions): Promise>; + mutate, TCache extends ApolloCache = ApolloCache>(options: MutationOptions): Promise>; onClearStore(cb: () => Promise): () => void; onResetStore(cb: () => Promise): () => void; // Warning: (ae-forgotten-export) The symbol "QueryOptions" needs to be exported by the entry point index.d.ts @@ -168,7 +169,7 @@ class ApolloClient implements DataProxy { setResolvers(resolvers: Resolvers | Resolvers[]): void; stop(): void; // Warning: (ae-forgotten-export) The symbol "SubscriptionOptions" needs to be exported by the entry point index.d.ts - subscribe(options: SubscriptionOptions): Observable>; + subscribe>(options: SubscriptionOptions): Observable>; // Warning: (ae-forgotten-export) The symbol "ApolloClientOptions" needs to be exported by the entry point index.d.ts // // (undocumented) @@ -192,7 +193,7 @@ interface ApolloClientOptions { // (undocumented) credentials?: string; // (undocumented) - defaultContext?: Partial; + defaultContext?: DefaultContext; defaultOptions?: DefaultOptions; devtools?: DevtoolsOptions; // (undocumented) @@ -758,7 +759,7 @@ export const enum defaultCacheSizes { } // @public (undocumented) -interface DefaultContext extends Record { +interface DefaultContext extends OperationContext { } // @public (undocumented) @@ -981,9 +982,9 @@ interface ExecutionPatchResultBase { } // @public (undocumented) -interface FetchMoreQueryOptions { +interface FetchMoreQueryOptions> { // (undocumented) - context?: DefaultContext; + context?: TContext; query?: DocumentNode | TypedDocumentNode; variables?: Partial; } @@ -992,7 +993,7 @@ interface FetchMoreQueryOptions { type FetchPolicy = "cache-first" | "network-only" | "cache-only" | "no-cache" | "standby"; // @public (undocumented) -type FetchResult, TContext = Record, TExtensions = Record> = SingleExecutionResult | ExecutionPatchResult; +type FetchResult, TContext extends OperationContext = DefaultContext, TExtensions = Record> = SingleExecutionResult | ExecutionPatchResult; // @public (undocumented) interface FieldFunctionOptions, TVars = Record> { @@ -1219,9 +1220,9 @@ export const getStoreKeyName: ((fieldName: string, args?: Record | export function getTypenameFromResult(result: Record, selectionSet: SelectionSetNode, fragmentMap?: FragmentMap): string | undefined; // @public (undocumented) -interface GraphQLRequest> { +interface GraphQLRequest, TContext extends OperationContext = Partial> { // (undocumented) - context?: DefaultContext; + context?: TContext; // (undocumented) extensions?: Record; // (undocumented) @@ -1680,7 +1681,7 @@ type Modifiers = Record> = Partia }>; // @public (undocumented) -interface MutationBaseOptions = ApolloCache> { +interface MutationBaseOptions, TCache extends ApolloCache = ApolloCache> { awaitRefetchQueries?: boolean; context?: TContext; // Warning: (ae-forgotten-export) The symbol "ErrorPolicy" needs to be exported by the entry point index.d.ts @@ -1707,7 +1708,7 @@ type MutationFetchPolicy = Extract; // Warning: (ae-forgotten-export) The symbol "MutationSharedOptions" needs to be exported by the entry point index.d.ts // // @public (undocumented) -interface MutationOptions = ApolloCache> extends MutationSharedOptions { +interface MutationOptions, TCache extends ApolloCache = ApolloCache> extends MutationSharedOptions { mutation: DocumentNode | TypedDocumentNode; } @@ -1728,7 +1729,7 @@ type MutationQueryReducersMap = ApolloCache> extends MutationBaseOptions { +interface MutationSharedOptions, TCache extends ApolloCache = ApolloCache> extends MutationBaseOptions { // Warning: (ae-forgotten-export) The symbol "MutationFetchPolicy" needs to be exported by the entry point index.d.ts fetchPolicy?: MutationFetchPolicy; keepRootFields?: boolean; @@ -1927,11 +1928,14 @@ interface Operation { variables: Record; } +// @public (undocumented) +type OperationContext = Record; + // @public (undocumented) type OperationVariables = Record; // @public (undocumented) -type OptionsUnion = WatchQueryOptions | QueryOptions | MutationOptions; +type OptionsUnion> = WatchQueryOptions | QueryOptions | MutationOptions; // @public (undocumented) type Path = ReadonlyArray; @@ -2146,7 +2150,7 @@ class QueryManager { keepRootFields?: boolean; }, cache?: ApolloCache): Promise>; // (undocumented) - mutate, TCache extends ApolloCache>({ mutation, variables, optimisticResponse, updateQueries, refetchQueries, awaitRefetchQueries, update: updateWithProxyFn, onQueryUpdated, fetchPolicy, errorPolicy, keepRootFields, context, }: MutationOptions): Promise>; + mutate>({ mutation, variables, optimisticResponse, updateQueries, refetchQueries, awaitRefetchQueries, update: updateWithProxyFn, onQueryUpdated, fetchPolicy, errorPolicy, keepRootFields, context, }: MutationOptions): Promise>; // (undocumented) mutationStore?: { [mutationId: string]: MutationStoreValue; @@ -2169,7 +2173,7 @@ class QueryManager { // (undocumented) readonly ssrMode: boolean; // (undocumented) - startGraphQLSubscription({ query, fetchPolicy, errorPolicy, variables, context, extensions, }: SubscriptionOptions): Observable>; + startGraphQLSubscription>({ query, fetchPolicy, errorPolicy, variables, context, extensions, }: SubscriptionOptions): Observable>; stop(): void; // (undocumented) stopQuery(queryId: string): void; @@ -2208,10 +2212,10 @@ interface QueryManagerOptions { } // @public -interface QueryOptions { +interface QueryOptions> { // @deprecated canonizeResults?: boolean; - context?: DefaultContext; + context?: TContext; errorPolicy?: ErrorPolicy; fetchPolicy?: FetchPolicy; notifyOnNetworkStatusChange?: boolean; @@ -2407,10 +2411,10 @@ type ServerParseError = Error & { }; // @public (undocumented) -interface SharedWatchQueryOptions { +interface SharedWatchQueryOptions> { // @deprecated canonizeResults?: boolean; - context?: DefaultContext; + context?: TContext; errorPolicy?: ErrorPolicy; fetchPolicy?: WatchQueryFetchPolicy; initialFetchPolicy?: WatchQueryFetchPolicy; @@ -2431,7 +2435,7 @@ interface SharedWatchQueryOptions export function shouldInclude({ directives }: SelectionNode, variables?: Record): boolean; // @public (undocumented) -interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> { +interface SingleExecutionResult, TContext extends OperationContext = DefaultContext, TExtensions = Record> { // (undocumented) context?: TContext; // (undocumented) @@ -2486,17 +2490,17 @@ class Stump extends Layer { } // @public (undocumented) -type SubscribeToMoreOptions = { +type SubscribeToMoreOptions> = { document: DocumentNode | TypedDocumentNode; variables?: TSubscriptionVariables; updateQuery?: UpdateQueryFn; onError?: (error: Error) => void; - context?: DefaultContext; + context?: TContext; }; // @public (undocumented) -interface SubscriptionOptions { - context?: DefaultContext; +interface SubscriptionOptions> { + context?: TContext; errorPolicy?: ErrorPolicy; extensions?: Record; fetchPolicy?: FetchPolicy; @@ -2684,11 +2688,11 @@ interface WriteContext extends ReadMergeModifyContext { // src/core/LocalState.ts:71:3 - (ae-forgotten-export) The symbol "ApolloClient" 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:138:5 - (ae-forgotten-export) The symbol "MutationStoreValue" needs to be exported by the entry point index.d.ts -// src/core/QueryManager.ts:382: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 +// src/core/QueryManager.ts:139:5 - (ae-forgotten-export) The symbol "MutationStoreValue" needs to be exported by the entry point index.d.ts +// src/core/QueryManager.ts:383:7 - (ae-forgotten-export) The symbol "UpdateQueries" needs to be exported by the entry point index.d.ts +// src/core/types.ts:176:3 - (ae-forgotten-export) The symbol "MutationQueryReducer" needs to be exported by the entry point index.d.ts +// src/core/types.ts:205:5 - (ae-forgotten-export) The symbol "Resolver" needs to be exported by the entry point index.d.ts +// src/core/watchQueryOptions.ts:287:2 - (ae-forgotten-export) The symbol "UpdateQueryFn" needs to be exported by the entry point index.d.ts // src/utilities/graphql/storeUtils.ts:226:12 - (ae-forgotten-export) The symbol "storeKeyNameStringify" needs to be exported by the entry point index.d.ts // src/utilities/policies/pagination.ts:76:3 - (ae-forgotten-export) The symbol "TRelayEdge" needs to be exported by the entry point index.d.ts // src/utilities/policies/pagination.ts:77:3 - (ae-forgotten-export) The symbol "TRelayPageInfo" needs to be exported by the entry point index.d.ts diff --git a/.api-reports/api-report.api.md b/.api-reports/api-report.api.md index 20848b2c922..ed4697fc999 100644 --- a/.api-reports/api-report.api.md +++ b/.api-reports/api-report.api.md @@ -119,7 +119,7 @@ export class ApolloClient implements DataProxy { getResolvers(): Resolvers; // (undocumented) link: ApolloLink; - mutate = DefaultContext, TCache extends ApolloCache = ApolloCache>(options: MutationOptions): Promise>; + mutate, TCache extends ApolloCache = ApolloCache>(options: MutationOptions): Promise>; onClearStore(cb: () => Promise): () => void; onResetStore(cb: () => Promise): () => void; query(options: QueryOptions): Promise>; @@ -135,7 +135,7 @@ export class ApolloClient implements DataProxy { setLocalStateFragmentMatcher(fragmentMatcher: FragmentMatcher): void; setResolvers(resolvers: Resolvers | Resolvers[]): void; stop(): void; - subscribe(options: SubscriptionOptions): Observable>; + subscribe>(options: SubscriptionOptions): Observable>; // (undocumented) readonly typeDefs: ApolloClientOptions["typeDefs"]; // (undocumented) @@ -155,7 +155,7 @@ export interface ApolloClientOptions { // (undocumented) credentials?: string; // (undocumented) - defaultContext?: Partial; + defaultContext?: DefaultContext; defaultOptions?: DefaultOptions; devtools?: DevtoolsOptions; // (undocumented) @@ -341,7 +341,7 @@ type BackgroundQueryHookOptionsNoInfer = ApolloCache> extends MutationSharedOptions { +export interface BaseMutationOptions, TCache extends ApolloCache = ApolloCache> extends MutationSharedOptions { client?: ApolloClient; ignoreResults?: boolean; notifyOnNetworkStatusChange?: boolean; @@ -352,16 +352,16 @@ export interface BaseMutationOptions extends SharedWatchQueryOptions { +export interface BaseQueryOptions> extends SharedWatchQueryOptions { client?: ApolloClient; - context?: DefaultContext; + context?: TContext; ssr?: boolean; } // @public (undocumented) -export interface BaseSubscriptionOptions { +export interface BaseSubscriptionOptions> { client?: ApolloClient; - context?: DefaultContext; + context?: TContext; errorPolicy?: ErrorPolicy; extensions?: Record; fetchPolicy?: FetchPolicy; @@ -665,7 +665,7 @@ type DeepPartialReadonlySet = {} & ReadonlySet>; type DeepPartialSet = {} & Set>; // @public (undocumented) -interface DefaultContext extends Record { +interface DefaultContext extends OperationContext { } export { DefaultContext as Context } export { DefaultContext } @@ -933,9 +933,9 @@ export interface FetchMoreOptions } // @public (undocumented) -export interface FetchMoreQueryOptions { +export interface FetchMoreQueryOptions> { // (undocumented) - context?: DefaultContext; + context?: TContext; query?: DocumentNode | TypedDocumentNode; variables?: Partial; } @@ -944,7 +944,7 @@ export interface FetchMoreQueryOptions { export type FetchPolicy = "cache-first" | "network-only" | "cache-only" | "no-cache" | "standby"; // @public (undocumented) -export type FetchResult, TContext = Record, TExtensions = Record> = SingleExecutionResult | ExecutionPatchResult; +export type FetchResult, TContext extends OperationContext = DefaultContext, TExtensions = Record> = SingleExecutionResult | ExecutionPatchResult; // @public (undocumented) export interface FieldFunctionOptions, TVars = Record> { @@ -1116,9 +1116,9 @@ const getInMemoryCacheMemoryInternals: (() => { export { gql } // @public (undocumented) -export interface GraphQLRequest> { +export interface GraphQLRequest, TContext extends OperationContext = Partial> { // (undocumented) - context?: DefaultContext; + context?: TContext; // (undocumented) extensions?: Record; // (undocumented) @@ -1421,7 +1421,7 @@ export interface LoadableQueryHookOptions { // @deprecated canonizeResults?: boolean; client?: ApolloClient; - context?: DefaultContext; + context?: Partial; errorPolicy?: ErrorPolicy; fetchPolicy?: LoadableQueryHookFetchPolicy; queryKey?: string | number | any[]; @@ -1567,7 +1567,7 @@ type Modifiers = Record> = Partia }>; // @public (undocumented) -interface MutationBaseOptions = ApolloCache> { +interface MutationBaseOptions, TCache extends ApolloCache = ApolloCache> { awaitRefetchQueries?: boolean; context?: TContext; errorPolicy?: ErrorPolicy; @@ -1583,7 +1583,7 @@ interface MutationBaseOptions = ApolloCache> extends BaseMutationOptions { +export interface MutationDataOptions, TCache extends ApolloCache = ApolloCache> extends BaseMutationOptions { // (undocumented) mutation: DocumentNode | TypedDocumentNode; } @@ -1592,19 +1592,19 @@ export interface MutationDataOptions; // @public (undocumented) -export type MutationFunction = ApolloCache> = (options?: MutationFunctionOptions) => Promise>; +export type MutationFunction, TCache extends ApolloCache = ApolloCache> = (options?: MutationFunctionOptions) => Promise>; // @public (undocumented) -export interface MutationFunctionOptions = ApolloCache> extends BaseMutationOptions { +export interface MutationFunctionOptions, TCache extends ApolloCache = ApolloCache> extends BaseMutationOptions { mutation?: DocumentNode | TypedDocumentNode; } // @public (undocumented) -export interface MutationHookOptions = ApolloCache> extends BaseMutationOptions { +export interface MutationHookOptions, TCache extends ApolloCache = ApolloCache> extends BaseMutationOptions { } // @public (undocumented) -export interface MutationOptions = ApolloCache> extends MutationSharedOptions { +export interface MutationOptions, TCache extends ApolloCache = ApolloCache> extends MutationSharedOptions { mutation: DocumentNode | TypedDocumentNode; } @@ -1635,7 +1635,7 @@ export interface MutationResult { // Warning: (ae-forgotten-export) The symbol "MutationBaseOptions" needs to be exported by the entry point index.d.ts // // @public (undocumented) -interface MutationSharedOptions = ApolloCache> extends MutationBaseOptions { +interface MutationSharedOptions, TCache extends ApolloCache = ApolloCache> extends MutationBaseOptions { fetchPolicy?: MutationFetchPolicy; keepRootFields?: boolean; } @@ -1653,7 +1653,7 @@ interface MutationStoreValue { } // @public (undocumented) -export type MutationTuple = ApolloCache> = [ +export type MutationTuple, TCache extends ApolloCache = ApolloCache> = [ mutate: (options?: MutationFunctionOptions) => Promise>, result: MutationResult ]; @@ -1874,6 +1874,9 @@ export interface Operation { variables: Record; } +// @public (undocumented) +export type OperationContext = Record; + // @public (undocumented) export function operationName(type: DocumentType_2): string; @@ -1888,7 +1891,7 @@ export type OptimisticStoreItem = { }; // @public (undocumented) -type OptionsUnion = WatchQueryOptions | QueryOptions | MutationOptions; +type OptionsUnion> = WatchQueryOptions | QueryOptions | MutationOptions; // @public (undocumented) export function parseAndCheckHttpResponse(operations: Operation | Operation[]): (response: Response) => Promise; @@ -1980,9 +1983,9 @@ export interface PreloadQueryFunction { // Warning: (ae-forgotten-export) The symbol "VariablesOption" needs to be exported by the entry point index.d.ts // // @public (undocumented) -export type PreloadQueryOptions = { +export type PreloadQueryOptions> = { canonizeResults?: boolean; - context?: DefaultContext; + context?: TContext; errorPolicy?: ErrorPolicy; fetchPolicy?: PreloadQueryFetchPolicy; returnPartialData?: boolean; @@ -2103,8 +2106,8 @@ class QueryInfo { } // @public @deprecated (undocumented) -export interface QueryLazyOptions { - context?: DefaultContext; +export interface QueryLazyOptions> { + context?: TContext; variables?: TVariables; } @@ -2189,7 +2192,7 @@ class QueryManager { keepRootFields?: boolean; }, cache?: ApolloCache): Promise>; // (undocumented) - mutate, TCache extends ApolloCache>({ mutation, variables, optimisticResponse, updateQueries, refetchQueries, awaitRefetchQueries, update: updateWithProxyFn, onQueryUpdated, fetchPolicy, errorPolicy, keepRootFields, context, }: MutationOptions): Promise>; + mutate>({ mutation, variables, optimisticResponse, updateQueries, refetchQueries, awaitRefetchQueries, update: updateWithProxyFn, onQueryUpdated, fetchPolicy, errorPolicy, keepRootFields, context, }: MutationOptions): Promise>; // (undocumented) mutationStore?: { [mutationId: string]: MutationStoreValue; @@ -2209,7 +2212,7 @@ class QueryManager { // (undocumented) readonly ssrMode: boolean; // (undocumented) - startGraphQLSubscription({ query, fetchPolicy, errorPolicy, variables, context, extensions, }: SubscriptionOptions): Observable>; + startGraphQLSubscription>({ query, fetchPolicy, errorPolicy, variables, context, extensions, }: SubscriptionOptions): Observable>; stop(): void; // (undocumented) stopQuery(queryId: string): void; @@ -2248,10 +2251,10 @@ interface QueryManagerOptions { } // @public -interface QueryOptions { +interface QueryOptions> { // @deprecated canonizeResults?: boolean; - context?: DefaultContext; + context?: TContext; errorPolicy?: ErrorPolicy; fetchPolicy?: FetchPolicy; notifyOnNetworkStatusChange?: boolean; @@ -2494,10 +2497,10 @@ export type ServerParseError = Error & { export { setLogVerbosity } // @public (undocumented) -interface SharedWatchQueryOptions { +interface SharedWatchQueryOptions> { // @deprecated canonizeResults?: boolean; - context?: DefaultContext; + context?: TContext; errorPolicy?: ErrorPolicy; fetchPolicy?: WatchQueryFetchPolicy; initialFetchPolicy?: WatchQueryFetchPolicy; @@ -2514,7 +2517,7 @@ interface SharedWatchQueryOptions } // @public (undocumented) -export interface SingleExecutionResult, TContext = DefaultContext, TExtensions = Record> { +export interface SingleExecutionResult, TContext extends OperationContext = DefaultContext, TExtensions = Record> { // (undocumented) context?: TContext; // (undocumented) @@ -2571,12 +2574,12 @@ class Stump extends Layer { type SubscribeToMoreFunction = ObservableQueryFields["subscribeToMore"]; // @public (undocumented) -export type SubscribeToMoreOptions = { +export type SubscribeToMoreOptions> = { document: DocumentNode | TypedDocumentNode; variables?: TSubscriptionVariables; updateQuery?: UpdateQueryFn; onError?: (error: Error) => void; - context?: DefaultContext; + context?: TContext; }; // @public (undocumented) @@ -2600,8 +2603,8 @@ export interface SubscriptionHookOptions { - context?: DefaultContext; +export interface SubscriptionOptions> { + context?: TContext; errorPolicy?: ErrorPolicy; extensions?: Record; fetchPolicy?: FetchPolicy; @@ -2622,11 +2625,11 @@ export interface SubscriptionResult { export type SuspenseQueryHookFetchPolicy = Extract; // @public (undocumented) -export interface SuspenseQueryHookOptions { +export interface SuspenseQueryHookOptions> { // @deprecated canonizeResults?: boolean; client?: ApolloClient; - context?: DefaultContext; + context?: TContext; errorPolicy?: ErrorPolicy; fetchPolicy?: SuspenseQueryHookFetchPolicy; queryKey?: string | number | any[]; @@ -2859,7 +2862,7 @@ handlers: { ]; // @public -export function useMutation = ApolloCache>(mutation: DocumentNode | TypedDocumentNode, options?: MutationHookOptions, NoInfer_2, TContext, TCache>): MutationTuple; +export function useMutation, TCache extends ApolloCache = ApolloCache>(mutation: DocumentNode | TypedDocumentNode, options?: MutationHookOptions, NoInfer_2, TContext, TCache>): MutationTuple; // @public export function useQuery(query: DocumentNode | TypedDocumentNode, options?: QueryHookOptions, NoInfer_2>): QueryResult; @@ -3034,9 +3037,9 @@ 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:138:5 - (ae-forgotten-export) The symbol "MutationStoreValue" needs to be exported by the entry point index.d.ts -// src/core/QueryManager.ts:382: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/core/QueryManager.ts:139:5 - (ae-forgotten-export) The symbol "MutationStoreValue" needs to be exported by the entry point index.d.ts +// src/core/QueryManager.ts:383:7 - (ae-forgotten-export) The symbol "UpdateQueries" needs to be exported by the entry point index.d.ts +// src/core/watchQueryOptions.ts:287: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 // src/react/hooks/useBackgroundQuery.ts:38:3 - (ae-forgotten-export) The symbol "SubscribeToMoreFunction" needs to be exported by the entry point index.d.ts // src/react/hooks/useBackgroundQuery.ts:54:3 - (ae-forgotten-export) The symbol "FetchMoreFunction" needs to be exported by the entry point index.d.ts diff --git a/.changeset/twenty-icons-worry.md b/.changeset/twenty-icons-worry.md new file mode 100644 index 00000000000..bc3f7da68e3 --- /dev/null +++ b/.changeset/twenty-icons-worry.md @@ -0,0 +1,5 @@ +--- +"@apollo/client": patch +--- + +Update and align `Context` types across operations and links diff --git a/src/core/ApolloClient.ts b/src/core/ApolloClient.ts index 7dce981b88d..0f2b465ac63 100644 --- a/src/core/ApolloClient.ts +++ b/src/core/ApolloClient.ts @@ -22,6 +22,7 @@ import type { RefetchQueriesResult, InternalRefetchQueriesResult, RefetchQueriesInclude, + OperationContext, } from "./types.js"; import type { @@ -116,7 +117,7 @@ export interface ApolloClientOptions { * See this [example object](https://www.apollographql.com/docs/react/api/core/ApolloClient#example-defaultoptions-object). */ defaultOptions?: DefaultOptions; - defaultContext?: Partial; + defaultContext?: DefaultContext; /** * If `true`, Apollo Client will assume results read from the cache are never mutated by application code, which enables substantial performance optimizations. * @@ -474,7 +475,7 @@ export class ApolloClient implements DataProxy { public mutate< TData = any, TVariables extends OperationVariables = OperationVariables, - TContext extends Record = DefaultContext, + TContext extends OperationContext = Partial, TCache extends ApolloCache = ApolloCache, >( options: MutationOptions @@ -494,8 +495,13 @@ export class ApolloClient implements DataProxy { public subscribe< T = any, TVariables extends OperationVariables = OperationVariables, - >(options: SubscriptionOptions): Observable> { - return this.queryManager.startGraphQLSubscription(options); + TContext extends OperationContext = Partial, + >( + options: SubscriptionOptions + ): Observable> { + return this.queryManager.startGraphQLSubscription( + options + ); } /** diff --git a/src/core/QueryManager.ts b/src/core/QueryManager.ts index ea91c0abdea..11b9af08d56 100644 --- a/src/core/QueryManager.ts +++ b/src/core/QueryManager.ts @@ -63,6 +63,7 @@ import type { InternalRefetchQueriesResult, InternalRefetchQueriesMap, DefaultContext, + OperationContext, } from "./types.js"; import type { LocalState } from "./LocalState.js"; @@ -203,7 +204,7 @@ export class QueryManager { public async mutate< TData, TVariables extends OperationVariables, - TContext extends Record, + TContext extends OperationContext, TCache extends ApolloCache, >({ mutation, @@ -967,18 +968,22 @@ export class QueryManager { this.getQuery(observableQuery.queryId).setObservableQuery(observableQuery); } - public startGraphQLSubscription({ + public startGraphQLSubscription< + T = any, + TVariables extends OperationVariables = OperationVariables, + TContext extends OperationContext = Partial, + >({ query, fetchPolicy, errorPolicy = "none", variables, - context = {}, + context = {} as TContext, extensions = {}, - }: SubscriptionOptions): Observable> { + }: SubscriptionOptions): Observable> { query = this.transform(query); - variables = this.getVariables(query, variables); + variables = this.getVariables(query, variables) as TVariables; - const makeObservable = (variables: OperationVariables) => + const makeObservable = (variables: TVariables) => this.getObservableFromLink(query, context, variables, extensions).map( (result) => { if (fetchPolicy !== "no-cache") { diff --git a/src/core/types.ts b/src/core/types.ts index fefe245b04c..6432adb9dd7 100644 --- a/src/core/types.ts +++ b/src/core/types.ts @@ -17,7 +17,9 @@ export type MethodKeys = { [P in keyof T]: T[P] extends Function ? P : never; }[keyof T]; -export interface DefaultContext extends Record {} +export type OperationContext = Record; + +export interface DefaultContext extends OperationContext {} export type QueryListener = (queryInfo: QueryInfo) => void; diff --git a/src/core/watchQueryOptions.ts b/src/core/watchQueryOptions.ts index 0627f04ebc5..9a95f8b860c 100644 --- a/src/core/watchQueryOptions.ts +++ b/src/core/watchQueryOptions.ts @@ -9,6 +9,7 @@ import type { MutationUpdaterFunction, OnQueryUpdated, InternalRefetchQueriesInclude, + OperationContext, } from "./types.js"; import type { ApolloCache } from "../cache/index.js"; import type { ObservableQuery } from "./ObservableQuery.js"; @@ -51,7 +52,11 @@ export type ErrorPolicy = "none" | "ignore" | "all"; /** * Query options. */ -export interface QueryOptions { +export interface QueryOptions< + TVariables = OperationVariables, + TData = any, + TContext extends OperationContext = Partial, +> { /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#query:member} */ query: DocumentNode | TypedDocumentNode; @@ -62,7 +67,7 @@ export interface QueryOptions { errorPolicy?: ErrorPolicy; /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#context:member} */ - context?: DefaultContext; + context?: TContext; /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#fetchPolicy:member} */ fetchPolicy?: FetchPolicy; @@ -97,6 +102,7 @@ export interface WatchQueryOptions< export interface SharedWatchQueryOptions< TVariables extends OperationVariables, TData, + TContext extends OperationContext = Partial, > { /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#fetchPolicy:member} */ fetchPolicy?: WatchQueryFetchPolicy; @@ -123,7 +129,7 @@ export interface SharedWatchQueryOptions< errorPolicy?: ErrorPolicy; /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#context:member} */ - context?: DefaultContext; + context?: TContext; /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#pollInterval:member} */ pollInterval?: number; @@ -154,12 +160,16 @@ export interface NextFetchPolicyContext< initialFetchPolicy: WatchQueryFetchPolicy; } -export interface FetchMoreQueryOptions { +export interface FetchMoreQueryOptions< + TVariables, + TData = any, + TContext extends OperationContext = Partial, +> { /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#query:member} */ query?: DocumentNode | TypedDocumentNode; /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#variables:member} */ variables?: Partial; - context?: DefaultContext; + context?: TContext; } export type UpdateQueryFn< @@ -178,6 +188,7 @@ export type SubscribeToMoreOptions< TData = any, TSubscriptionVariables = OperationVariables, TSubscriptionData = TData, + TContext extends OperationContext = Partial, > = { document: | DocumentNode @@ -185,12 +196,13 @@ export type SubscribeToMoreOptions< variables?: TSubscriptionVariables; updateQuery?: UpdateQueryFn; onError?: (error: Error) => void; - context?: DefaultContext; + context?: TContext; }; export interface SubscriptionOptions< TVariables = OperationVariables, TData = any, + TContext extends OperationContext = Partial, > { /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#query:member} */ query: DocumentNode | TypedDocumentNode; @@ -205,7 +217,7 @@ export interface SubscriptionOptions< errorPolicy?: ErrorPolicy; /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#context:member} */ - context?: DefaultContext; + context?: TContext; /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#extensions:member} */ extensions?: Record; @@ -214,7 +226,7 @@ export interface SubscriptionOptions< export interface MutationBaseOptions< TData = any, TVariables = OperationVariables, - TContext = DefaultContext, + TContext extends OperationContext = Partial, TCache extends ApolloCache = ApolloCache, > { /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#optimisticResponse:member} */ @@ -255,7 +267,7 @@ export interface MutationBaseOptions< export interface MutationOptions< TData = any, TVariables = OperationVariables, - TContext = DefaultContext, + TContext extends OperationContext = Partial, TCache extends ApolloCache = ApolloCache, > extends MutationSharedOptions { /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#mutation:member} */ @@ -264,7 +276,7 @@ export interface MutationOptions< export interface MutationSharedOptions< TData = any, TVariables = OperationVariables, - TContext = DefaultContext, + TContext extends OperationContext = Partial, TCache extends ApolloCache = ApolloCache, > extends MutationBaseOptions { /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#fetchPolicy:member} */ diff --git a/src/link/context/index.ts b/src/link/context/index.ts index 33ad65036ac..75eccaf5c5b 100644 --- a/src/link/context/index.ts +++ b/src/link/context/index.ts @@ -2,14 +2,18 @@ import type { Operation, GraphQLRequest, NextLink } from "../core/index.js"; import { ApolloLink } from "../core/index.js"; import type { ObservableSubscription } from "../../utilities/index.js"; import { Observable } from "../../utilities/index.js"; -import type { DefaultContext } from "../../core/index.js"; +import type { DefaultContext, OperationContext } from "../../core/index.js"; -export type ContextSetter = ( +export type ContextSetter< + TContext extends OperationContext = Partial, +> = ( operation: GraphQLRequest, prevContext: DefaultContext -) => Promise | DefaultContext; +) => Promise> | Partial; -export function setContext(setter: ContextSetter): ApolloLink { +export function setContext< + TContext extends OperationContext = Partial, +>(setter: ContextSetter): ApolloLink { return new ApolloLink((operation: Operation, forward: NextLink) => { const { ...request } = operation; diff --git a/src/link/core/types.ts b/src/link/core/types.ts index c596ecac0c2..a97183ada36 100644 --- a/src/link/core/types.ts +++ b/src/link/core/types.ts @@ -1,6 +1,6 @@ import type { GraphQLFormattedError } from "graphql"; import type { DocumentNode } from "graphql"; -import type { DefaultContext } from "../../core/index.js"; +import type { OperationContext, DefaultContext } from "../../core/index.js"; export type { DocumentNode }; import type { Observable } from "../../utilities/index.js"; @@ -63,11 +63,14 @@ export type ExecutionPatchResult< | ExecutionPatchInitialResult | ExecutionPatchIncrementalResult; -export interface GraphQLRequest> { +export interface GraphQLRequest< + TVariables = Record, + TContext extends OperationContext = Partial, +> { query: DocumentNode; variables?: TVariables; operationName?: string; - context?: DefaultContext; + context?: TContext; extensions?: Record; } @@ -89,7 +92,7 @@ export interface Operation { export interface SingleExecutionResult< TData = Record, - TContext = DefaultContext, + TContext extends OperationContext = DefaultContext, TExtensions = Record, > { // data might be undefined if errorPolicy was set to 'ignore' @@ -101,7 +104,7 @@ export interface SingleExecutionResult< export type FetchResult< TData = Record, - TContext = Record, + TContext extends OperationContext = DefaultContext, TExtensions = Record, > = | SingleExecutionResult diff --git a/src/react/components/types.ts b/src/react/components/types.ts index a742b905ac6..30d35182f48 100644 --- a/src/react/components/types.ts +++ b/src/react/components/types.ts @@ -5,6 +5,7 @@ import type * as ReactTypes from "react"; import type { OperationVariables, + OperationContext, DefaultContext, ApolloCache, } from "../../core/index.js"; @@ -31,7 +32,7 @@ export interface QueryComponentOptions< export interface MutationComponentOptions< TData = any, TVariables = OperationVariables, - TContext = DefaultContext, + TContext extends OperationContext = Partial, TCache extends ApolloCache = ApolloCache, > extends BaseMutationOptions { mutation: DocumentNode | TypedDocumentNode; diff --git a/src/react/hoc/types.ts b/src/react/hoc/types.ts index 0d67f4c1ca0..c118fedd770 100644 --- a/src/react/hoc/types.ts +++ b/src/react/hoc/types.ts @@ -8,6 +8,7 @@ import type { FetchMoreQueryOptions, SubscribeToMoreOptions, DefaultContext, + OperationContext, } from "../../core/index.js"; import type { MutationFunction, @@ -90,7 +91,7 @@ export interface OperationOption< TData, TGraphQLVariables extends OperationVariables = OperationVariables, TChildProps = ChildProps, - TContext = DefaultContext, + TContext extends OperationContext = Partial, TCache extends ApolloCache = ApolloCache, > { options?: diff --git a/src/react/hooks/useMutation.ts b/src/react/hooks/useMutation.ts index ea0f47ddc6c..9d8b63da197 100644 --- a/src/react/hooks/useMutation.ts +++ b/src/react/hooks/useMutation.ts @@ -13,6 +13,7 @@ import type { ApolloCache, DefaultContext, MutationOptions, + OperationContext, OperationVariables, } from "../../core/index.js"; import { mergeOptions } from "../../utilities/index.js"; @@ -72,7 +73,7 @@ import { useIsomorphicLayoutEffect } from "./internal/useIsomorphicLayoutEffect. export function useMutation< TData = any, TVariables = OperationVariables, - TContext = DefaultContext, + TContext extends OperationContext = Partial, TCache extends ApolloCache = ApolloCache, >( mutation: DocumentNode | TypedDocumentNode, diff --git a/src/react/hooks/useSubscription.ts b/src/react/hooks/useSubscription.ts index cf6c31ebabe..234c53e39da 100644 --- a/src/react/hooks/useSubscription.ts +++ b/src/react/hooks/useSubscription.ts @@ -16,6 +16,7 @@ import type { ErrorPolicy, FetchPolicy, FetchResult, + OperationContext, OperationVariables, } from "../../core/index.js"; import { ApolloError, Observable } from "../../core/index.js"; @@ -319,13 +320,14 @@ export function useSubscription< function createSubscription< TData = any, TVariables extends OperationVariables = OperationVariables, + TContext extends OperationContext = Partial, >( client: ApolloClient, query: TypedDocumentNode, variables: TVariables | undefined, fetchPolicy: FetchPolicy | undefined, errorPolicy: ErrorPolicy | undefined, - context: DefaultContext | undefined, + context: TContext | undefined, extensions: Record | undefined ) { const options = { diff --git a/src/react/query-preloader/createQueryPreloader.ts b/src/react/query-preloader/createQueryPreloader.ts index 6389992519c..f80142452c8 100644 --- a/src/react/query-preloader/createQueryPreloader.ts +++ b/src/react/query-preloader/createQueryPreloader.ts @@ -3,6 +3,7 @@ import type { DefaultContext, DocumentNode, ErrorPolicy, + OperationContext, OperationVariables, RefetchWritePolicy, TypedDocumentNode, @@ -41,11 +42,12 @@ export type PreloadQueryFetchPolicy = Extract< export type PreloadQueryOptions< TVariables extends OperationVariables = OperationVariables, + TContext extends OperationContext = Partial, > = { /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#canonizeResults:member} */ canonizeResults?: boolean; /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#context:member} */ - context?: DefaultContext; + context?: TContext; /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#errorPolicy:member} */ errorPolicy?: ErrorPolicy; /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#fetchPolicy:member} */ diff --git a/src/react/types/types.ts b/src/react/types/types.ts index 239f96fc133..38be18ed602 100644 --- a/src/react/types/types.ts +++ b/src/react/types/types.ts @@ -24,6 +24,7 @@ import type { FetchMoreQueryOptions, ErrorPolicy, RefetchWritePolicy, + OperationContext, } from "../../core/index.js"; import type { MutationSharedOptions, @@ -40,7 +41,7 @@ export type { /* Common types */ -export type { DefaultContext as Context } from "../../core/index.js"; +export type { DefaultContext as Context, OperationContext }; export type CommonOptions = TOptions & { client?: ApolloClient; @@ -51,13 +52,14 @@ export type CommonOptions = TOptions & { export interface BaseQueryOptions< TVariables extends OperationVariables = OperationVariables, TData = any, -> extends SharedWatchQueryOptions { + TContext extends OperationContext = Partial, +> extends SharedWatchQueryOptions { /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#ssr:member} */ ssr?: boolean; /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#client:member} */ client?: ApolloClient; /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#context:member} */ - context?: DefaultContext; + context?: TContext; } export interface QueryFunctionOptions< @@ -202,11 +204,12 @@ export type SuspenseQueryHookFetchPolicy = Extract< export interface SuspenseQueryHookOptions< TData = unknown, TVariables extends OperationVariables = OperationVariables, + TContext extends OperationContext = Partial, > { /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#client:member} */ client?: ApolloClient; /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#context:member} */ - context?: DefaultContext; + context?: TContext; /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#variables:member} */ variables?: TVariables; /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#errorPolicy:member} */ @@ -280,7 +283,7 @@ export interface LoadableQueryHookOptions { /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#client:member} */ client?: ApolloClient; /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#context:member} */ - context?: DefaultContext; + context?: Partial; /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#errorPolicy:member} */ errorPolicy?: ErrorPolicy; /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#fetchPolicy:member} */ @@ -296,11 +299,14 @@ export interface LoadableQueryHookOptions { /** * @deprecated This type will be removed in the next major version of Apollo Client */ -export interface QueryLazyOptions { +export interface QueryLazyOptions< + TVariables, + TContext extends OperationContext = Partial, +> { /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#variables:member} */ variables?: TVariables; /** {@inheritDoc @apollo/client!QueryOptionsDocumentation#context:member} */ - context?: DefaultContext; + context?: TContext; } /** @@ -343,7 +349,7 @@ export type RefetchQueriesFunction = ( export interface BaseMutationOptions< TData = any, TVariables = OperationVariables, - TContext = DefaultContext, + TContext extends OperationContext = Partial, TCache extends ApolloCache = ApolloCache, > extends MutationSharedOptions { /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#client:member} */ @@ -361,7 +367,7 @@ export interface BaseMutationOptions< export interface MutationFunctionOptions< TData = any, TVariables = OperationVariables, - TContext = DefaultContext, + TContext extends OperationContext = Partial, TCache extends ApolloCache = ApolloCache, > extends BaseMutationOptions { /** {@inheritDoc @apollo/client!MutationOptionsDocumentation#mutation:member} */ @@ -386,7 +392,7 @@ export interface MutationResult { export declare type MutationFunction< TData = any, TVariables = OperationVariables, - TContext = DefaultContext, + TContext extends OperationContext = Partial, TCache extends ApolloCache = ApolloCache, > = ( options?: MutationFunctionOptions @@ -395,14 +401,14 @@ export declare type MutationFunction< export interface MutationHookOptions< TData = any, TVariables = OperationVariables, - TContext = DefaultContext, + TContext extends OperationContext = Partial, TCache extends ApolloCache = ApolloCache, > extends BaseMutationOptions {} export interface MutationDataOptions< TData = any, TVariables = OperationVariables, - TContext = DefaultContext, + TContext extends OperationContext = Partial, TCache extends ApolloCache = ApolloCache, > extends BaseMutationOptions { mutation: DocumentNode | TypedDocumentNode; @@ -411,7 +417,7 @@ export interface MutationDataOptions< export type MutationTuple< TData, TVariables, - TContext = DefaultContext, + TContext extends OperationContext = Partial, TCache extends ApolloCache = ApolloCache, > = [ mutate: ( @@ -437,6 +443,7 @@ export interface OnSubscriptionDataOptions { export interface BaseSubscriptionOptions< TData = any, TVariables extends OperationVariables = OperationVariables, + TContext extends OperationContext = Partial, > { /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#variables:member} */ variables?: TVariables; @@ -453,7 +460,7 @@ export interface BaseSubscriptionOptions< /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#skip:member} */ skip?: boolean; /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#context:member} */ - context?: DefaultContext; + context?: TContext; /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#extensions:member} */ extensions?: Record; /** {@inheritDoc @apollo/client!SubscriptionOptionsDocumentation#onComplete:member} */ diff --git a/src/utilities/common/mergeOptions.ts b/src/utilities/common/mergeOptions.ts index fe4eb954bbf..1aeb4e43798 100644 --- a/src/utilities/common/mergeOptions.ts +++ b/src/utilities/common/mergeOptions.ts @@ -3,11 +3,17 @@ import type { WatchQueryOptions, MutationOptions, OperationVariables, + OperationContext, + DefaultContext, } from "../../core/index.js"; import { compact } from "./compact.js"; -type OptionsUnion = +type OptionsUnion< + TData, + TVariables extends OperationVariables, + TContext extends OperationContext = Partial, +> = | WatchQueryOptions | QueryOptions | MutationOptions;