Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a defaultContext property on ApolloClient #11275

Merged
merged 4 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions .api-reports/api-report-core.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ export class ApolloClient<TCacheShape> implements DataProxy {
// (undocumented)
clearStore(): Promise<any[]>;
// (undocumented)
get defaultContext(): Partial<DefaultContext>;
// (undocumented)
defaultOptions: DefaultOptions;
// (undocumented)
disableNetworkFetches: boolean;
Expand Down Expand Up @@ -169,6 +171,7 @@ export type ApolloClientOptions<TCacheShape> = {
connectToDevTools?: boolean;
queryDeduplication?: boolean;
defaultOptions?: DefaultOptions;
defaultContext?: Partial<DefaultContext>;
assumeImmutableResults?: boolean;
resolvers?: Resolvers | Resolvers[];
typeDefs?: string | string[] | DocumentNode | DocumentNode[];
Expand Down Expand Up @@ -1681,7 +1684,7 @@ export type QueryListener = (queryInfo: QueryInfo) => void;

// @public (undocumented)
class QueryManager<TStore> {
constructor({ cache, link, defaultOptions, documentTransform, queryDeduplication, onBroadcast, ssrMode, clientAwareness, localState, assumeImmutableResults, }: {
constructor({ cache, link, defaultOptions, documentTransform, queryDeduplication, onBroadcast, ssrMode, clientAwareness, localState, assumeImmutableResults, defaultContext, }: {
cache: ApolloCache<TStore>;
link: ApolloLink;
defaultOptions?: DefaultOptions;
Expand All @@ -1692,6 +1695,7 @@ class QueryManager<TStore> {
clientAwareness?: Record<string, string>;
localState?: LocalState<TStore>;
assumeImmutableResults?: boolean;
defaultContext?: Partial<DefaultContext>;
});
// (undocumented)
readonly assumeImmutableResults: boolean;
Expand All @@ -1702,6 +1706,8 @@ class QueryManager<TStore> {
// (undocumented)
clearStore(options?: Cache_2.ResetOptions): Promise<void>;
// (undocumented)
readonly defaultContext: Partial<DefaultContext>;
// (undocumented)
defaultOptions: DefaultOptions;
// (undocumented)
readonly documentTransform: DocumentTransform;
Expand Down Expand Up @@ -2192,9 +2198,9 @@ interface WriteContext extends ReadMergeModifyContext {
// src/cache/inmemory/types.ts:126:3 - (ae-forgotten-export) The symbol "KeyFieldsFunction" needs to be exported by the entry point index.d.ts
// src/core/ObservableQuery.ts:112:5 - (ae-forgotten-export) The symbol "QueryManager" needs to be exported by the entry point index.d.ts
// src/core/ObservableQuery.ts:113:5 - (ae-forgotten-export) The symbol "QueryInfo" needs to be exported by the entry point index.d.ts
// src/core/QueryManager.ts:116:5 - (ae-forgotten-export) The symbol "MutationStoreValue" needs to be exported by the entry point index.d.ts
// src/core/QueryManager.ts:149:5 - (ae-forgotten-export) The symbol "LocalState" needs to be exported by the entry point index.d.ts
// src/core/QueryManager.ts:378:7 - (ae-forgotten-export) The symbol "UpdateQueries" needs to be exported by the entry point index.d.ts
// src/core/QueryManager.ts:119:5 - (ae-forgotten-export) The symbol "MutationStoreValue" needs to be exported by the entry point index.d.ts
// src/core/QueryManager.ts:153:5 - (ae-forgotten-export) The symbol "LocalState" needs to be exported by the entry point index.d.ts
// src/core/QueryManager.ts:384:7 - (ae-forgotten-export) The symbol "UpdateQueries" needs to be exported by the entry point index.d.ts
// src/core/watchQueryOptions.ts:191:3 - (ae-forgotten-export) The symbol "UpdateQueryFn" needs to be exported by the entry point index.d.ts
// src/link/http/selectHttpOptionsAndBody.ts:128:32 - (ae-forgotten-export) The symbol "HttpQueryOptions" needs to be exported by the entry point index.d.ts

Expand Down
14 changes: 10 additions & 4 deletions .api-reports/api-report-react.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ class ApolloClient<TCacheShape> implements DataProxy {
// (undocumented)
clearStore(): Promise<any[]>;
// (undocumented)
get defaultContext(): Partial<Context>;
// (undocumented)
defaultOptions: DefaultOptions;
// (undocumented)
disableNetworkFetches: boolean;
Expand Down Expand Up @@ -204,6 +206,7 @@ type ApolloClientOptions<TCacheShape> = {
connectToDevTools?: boolean;
queryDeduplication?: boolean;
defaultOptions?: DefaultOptions;
defaultContext?: Partial<Context>;
assumeImmutableResults?: boolean;
resolvers?: Resolvers | Resolvers[];
typeDefs?: string | string[] | DocumentNode | DocumentNode[];
Expand Down Expand Up @@ -1508,7 +1511,7 @@ type QueryListener = (queryInfo: QueryInfo) => void;

// @public (undocumented)
class QueryManager<TStore> {
constructor({ cache, link, defaultOptions, documentTransform, queryDeduplication, onBroadcast, ssrMode, clientAwareness, localState, assumeImmutableResults, }: {
constructor({ cache, link, defaultOptions, documentTransform, queryDeduplication, onBroadcast, ssrMode, clientAwareness, localState, assumeImmutableResults, defaultContext, }: {
cache: ApolloCache<TStore>;
link: ApolloLink;
defaultOptions?: DefaultOptions;
Expand All @@ -1519,6 +1522,7 @@ class QueryManager<TStore> {
clientAwareness?: Record<string, string>;
localState?: LocalState<TStore>;
assumeImmutableResults?: boolean;
defaultContext?: Partial<Context>;
});
// (undocumented)
readonly assumeImmutableResults: boolean;
Expand All @@ -1528,6 +1532,8 @@ class QueryManager<TStore> {
cache: ApolloCache<TStore>;
// (undocumented)
clearStore(options?: Cache_2.ResetOptions): Promise<void>;
// (undocumented)
readonly defaultContext: Partial<Context>;
// Warning: (ae-forgotten-export) The symbol "DefaultOptions" needs to be exported by the entry point index.d.ts
//
// (undocumented)
Expand Down Expand Up @@ -2208,9 +2214,9 @@ interface WatchQueryOptions<TVariables extends OperationVariables = OperationVar
// src/core/LocalState.ts:46:5 - (ae-forgotten-export) The symbol "FragmentMap" needs to be exported by the entry point index.d.ts
// src/core/ObservableQuery.ts:112:5 - (ae-forgotten-export) The symbol "QueryManager" needs to be exported by the entry point index.d.ts
// src/core/ObservableQuery.ts:113:5 - (ae-forgotten-export) The symbol "QueryInfo" needs to be exported by the entry point index.d.ts
// src/core/QueryManager.ts:116:5 - (ae-forgotten-export) The symbol "MutationStoreValue" needs to be exported by the entry point index.d.ts
// src/core/QueryManager.ts:149:5 - (ae-forgotten-export) The symbol "LocalState" needs to be exported by the entry point index.d.ts
// src/core/QueryManager.ts:378:7 - (ae-forgotten-export) The symbol "UpdateQueries" needs to be exported by the entry point index.d.ts
// src/core/QueryManager.ts:119:5 - (ae-forgotten-export) The symbol "MutationStoreValue" needs to be exported by the entry point index.d.ts
// src/core/QueryManager.ts:153:5 - (ae-forgotten-export) The symbol "LocalState" needs to be exported by the entry point index.d.ts
// src/core/QueryManager.ts:384:7 - (ae-forgotten-export) The symbol "UpdateQueries" needs to be exported by the entry point index.d.ts
// src/core/types.ts:158:3 - (ae-forgotten-export) The symbol "ApolloError" needs to be exported by the entry point index.d.ts
// src/core/types.ts:160:3 - (ae-forgotten-export) The symbol "NetworkStatus" needs to be exported by the entry point index.d.ts
// src/core/types.ts:178:3 - (ae-forgotten-export) The symbol "MutationQueryReducer" needs to be exported by the entry point index.d.ts
Expand Down
14 changes: 10 additions & 4 deletions .api-reports/api-report-react_components.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ class ApolloClient<TCacheShape> implements DataProxy {
// (undocumented)
clearStore(): Promise<any[]>;
// (undocumented)
get defaultContext(): Partial<DefaultContext>;
// (undocumented)
defaultOptions: DefaultOptions;
// (undocumented)
disableNetworkFetches: boolean;
Expand Down Expand Up @@ -203,6 +205,7 @@ type ApolloClientOptions<TCacheShape> = {
connectToDevTools?: boolean;
queryDeduplication?: boolean;
defaultOptions?: DefaultOptions;
defaultContext?: Partial<DefaultContext>;
assumeImmutableResults?: boolean;
resolvers?: Resolvers | Resolvers[];
typeDefs?: string | string[] | DocumentNode | DocumentNode[];
Expand Down Expand Up @@ -1304,7 +1307,7 @@ type QueryListener = (queryInfo: QueryInfo) => void;

// @public (undocumented)
class QueryManager<TStore> {
constructor({ cache, link, defaultOptions, documentTransform, queryDeduplication, onBroadcast, ssrMode, clientAwareness, localState, assumeImmutableResults, }: {
constructor({ cache, link, defaultOptions, documentTransform, queryDeduplication, onBroadcast, ssrMode, clientAwareness, localState, assumeImmutableResults, defaultContext, }: {
cache: ApolloCache<TStore>;
link: ApolloLink;
defaultOptions?: DefaultOptions;
Expand All @@ -1315,6 +1318,7 @@ class QueryManager<TStore> {
clientAwareness?: Record<string, string>;
localState?: LocalState<TStore>;
assumeImmutableResults?: boolean;
defaultContext?: Partial<DefaultContext>;
});
// (undocumented)
readonly assumeImmutableResults: boolean;
Expand All @@ -1324,6 +1328,8 @@ class QueryManager<TStore> {
cache: ApolloCache<TStore>;
// (undocumented)
clearStore(options?: Cache_2.ResetOptions): Promise<void>;
// (undocumented)
readonly defaultContext: Partial<DefaultContext>;
// Warning: (ae-forgotten-export) The symbol "DefaultOptions" needs to be exported by the entry point index.d.ts
//
// (undocumented)
Expand Down Expand Up @@ -1740,9 +1746,9 @@ interface WatchQueryOptions<TVariables extends OperationVariables = OperationVar
// src/core/LocalState.ts:46:5 - (ae-forgotten-export) The symbol "FragmentMap" needs to be exported by the entry point index.d.ts
// src/core/ObservableQuery.ts:112:5 - (ae-forgotten-export) The symbol "QueryManager" needs to be exported by the entry point index.d.ts
// src/core/ObservableQuery.ts:113:5 - (ae-forgotten-export) The symbol "QueryInfo" needs to be exported by the entry point index.d.ts
// src/core/QueryManager.ts:116:5 - (ae-forgotten-export) The symbol "MutationStoreValue" needs to be exported by the entry point index.d.ts
// src/core/QueryManager.ts:149:5 - (ae-forgotten-export) The symbol "LocalState" needs to be exported by the entry point index.d.ts
// src/core/QueryManager.ts:378:7 - (ae-forgotten-export) The symbol "UpdateQueries" needs to be exported by the entry point index.d.ts
// src/core/QueryManager.ts:119:5 - (ae-forgotten-export) The symbol "MutationStoreValue" needs to be exported by the entry point index.d.ts
// src/core/QueryManager.ts:153:5 - (ae-forgotten-export) The symbol "LocalState" needs to be exported by the entry point index.d.ts
// src/core/QueryManager.ts:384:7 - (ae-forgotten-export) The symbol "UpdateQueries" needs to be exported by the entry point index.d.ts
// src/core/types.ts:158:3 - (ae-forgotten-export) The symbol "ApolloError" needs to be exported by the entry point index.d.ts
// src/core/types.ts:160:3 - (ae-forgotten-export) The symbol "NetworkStatus" needs to be exported by the entry point index.d.ts
// src/core/types.ts:178:3 - (ae-forgotten-export) The symbol "MutationQueryReducer" needs to be exported by the entry point index.d.ts
Expand Down
14 changes: 10 additions & 4 deletions .api-reports/api-report-react_context.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ class ApolloClient<TCacheShape> implements DataProxy {
// (undocumented)
clearStore(): Promise<any[]>;
// (undocumented)
get defaultContext(): Partial<DefaultContext>;
// (undocumented)
defaultOptions: DefaultOptions;
// (undocumented)
disableNetworkFetches: boolean;
Expand Down Expand Up @@ -204,6 +206,7 @@ type ApolloClientOptions<TCacheShape> = {
connectToDevTools?: boolean;
queryDeduplication?: boolean;
defaultOptions?: DefaultOptions;
defaultContext?: Partial<DefaultContext>;
assumeImmutableResults?: boolean;
resolvers?: Resolvers | Resolvers[];
typeDefs?: string | string[] | DocumentNode | DocumentNode[];
Expand Down Expand Up @@ -1214,7 +1217,7 @@ type QueryListener = (queryInfo: QueryInfo) => void;

// @public (undocumented)
class QueryManager<TStore> {
constructor({ cache, link, defaultOptions, documentTransform, queryDeduplication, onBroadcast, ssrMode, clientAwareness, localState, assumeImmutableResults, }: {
constructor({ cache, link, defaultOptions, documentTransform, queryDeduplication, onBroadcast, ssrMode, clientAwareness, localState, assumeImmutableResults, defaultContext, }: {
cache: ApolloCache<TStore>;
link: ApolloLink;
defaultOptions?: DefaultOptions;
Expand All @@ -1225,6 +1228,7 @@ class QueryManager<TStore> {
clientAwareness?: Record<string, string>;
localState?: LocalState<TStore>;
assumeImmutableResults?: boolean;
defaultContext?: Partial<DefaultContext>;
});
// (undocumented)
readonly assumeImmutableResults: boolean;
Expand All @@ -1234,6 +1238,8 @@ class QueryManager<TStore> {
cache: ApolloCache<TStore>;
// (undocumented)
clearStore(options?: Cache_2.ResetOptions): Promise<void>;
// (undocumented)
readonly defaultContext: Partial<DefaultContext>;
// Warning: (ae-forgotten-export) The symbol "DefaultOptions" needs to be exported by the entry point index.d.ts
//
// (undocumented)
Expand Down Expand Up @@ -1638,9 +1644,9 @@ interface WatchQueryOptions<TVariables extends OperationVariables = OperationVar
// src/core/LocalState.ts:46:5 - (ae-forgotten-export) The symbol "FragmentMap" needs to be exported by the entry point index.d.ts
// src/core/ObservableQuery.ts:112:5 - (ae-forgotten-export) The symbol "QueryManager" needs to be exported by the entry point index.d.ts
// src/core/ObservableQuery.ts:113:5 - (ae-forgotten-export) The symbol "QueryInfo" needs to be exported by the entry point index.d.ts
// src/core/QueryManager.ts:116:5 - (ae-forgotten-export) The symbol "MutationStoreValue" needs to be exported by the entry point index.d.ts
// src/core/QueryManager.ts:149:5 - (ae-forgotten-export) The symbol "LocalState" needs to be exported by the entry point index.d.ts
// src/core/QueryManager.ts:378:7 - (ae-forgotten-export) The symbol "UpdateQueries" needs to be exported by the entry point index.d.ts
// src/core/QueryManager.ts:119:5 - (ae-forgotten-export) The symbol "MutationStoreValue" needs to be exported by the entry point index.d.ts
// src/core/QueryManager.ts:153:5 - (ae-forgotten-export) The symbol "LocalState" needs to be exported by the entry point index.d.ts
// src/core/QueryManager.ts:384:7 - (ae-forgotten-export) The symbol "UpdateQueries" needs to be exported by the entry point index.d.ts
// src/core/types.ts:158:3 - (ae-forgotten-export) The symbol "ApolloError" needs to be exported by the entry point index.d.ts
// src/core/types.ts:160:3 - (ae-forgotten-export) The symbol "NetworkStatus" needs to be exported by the entry point index.d.ts
// src/core/types.ts:178:3 - (ae-forgotten-export) The symbol "MutationQueryReducer" needs to be exported by the entry point index.d.ts
Expand Down
14 changes: 10 additions & 4 deletions .api-reports/api-report-react_hoc.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ class ApolloClient<TCacheShape> implements DataProxy {
// (undocumented)
clearStore(): Promise<any[]>;
// (undocumented)
get defaultContext(): Partial<DefaultContext>;
// (undocumented)
defaultOptions: DefaultOptions;
// (undocumented)
disableNetworkFetches: boolean;
Expand Down Expand Up @@ -203,6 +205,7 @@ type ApolloClientOptions<TCacheShape> = {
connectToDevTools?: boolean;
queryDeduplication?: boolean;
defaultOptions?: DefaultOptions;
defaultContext?: Partial<DefaultContext>;
assumeImmutableResults?: boolean;
resolvers?: Resolvers | Resolvers[];
typeDefs?: string | string[] | DocumentNode | DocumentNode[];
Expand Down Expand Up @@ -1282,7 +1285,7 @@ type QueryListener = (queryInfo: QueryInfo) => void;

// @public (undocumented)
class QueryManager<TStore> {
constructor({ cache, link, defaultOptions, documentTransform, queryDeduplication, onBroadcast, ssrMode, clientAwareness, localState, assumeImmutableResults, }: {
constructor({ cache, link, defaultOptions, documentTransform, queryDeduplication, onBroadcast, ssrMode, clientAwareness, localState, assumeImmutableResults, defaultContext, }: {
cache: ApolloCache<TStore>;
link: ApolloLink;
defaultOptions?: DefaultOptions;
Expand All @@ -1293,6 +1296,7 @@ class QueryManager<TStore> {
clientAwareness?: Record<string, string>;
localState?: LocalState<TStore>;
assumeImmutableResults?: boolean;
defaultContext?: Partial<DefaultContext>;
});
// (undocumented)
readonly assumeImmutableResults: boolean;
Expand All @@ -1302,6 +1306,8 @@ class QueryManager<TStore> {
cache: ApolloCache<TStore>;
// (undocumented)
clearStore(options?: Cache_2.ResetOptions): Promise<void>;
// (undocumented)
readonly defaultContext: Partial<DefaultContext>;
// Warning: (ae-forgotten-export) The symbol "DefaultOptions" needs to be exported by the entry point index.d.ts
//
// (undocumented)
Expand Down Expand Up @@ -1682,9 +1688,9 @@ export function withSubscription<TProps extends TGraphQLVariables | {} = {}, TDa
// src/core/LocalState.ts:46:5 - (ae-forgotten-export) The symbol "FragmentMap" needs to be exported by the entry point index.d.ts
// src/core/ObservableQuery.ts:112:5 - (ae-forgotten-export) The symbol "QueryManager" needs to be exported by the entry point index.d.ts
// src/core/ObservableQuery.ts:113:5 - (ae-forgotten-export) The symbol "QueryInfo" needs to be exported by the entry point index.d.ts
// src/core/QueryManager.ts:116:5 - (ae-forgotten-export) The symbol "MutationStoreValue" needs to be exported by the entry point index.d.ts
// src/core/QueryManager.ts:149:5 - (ae-forgotten-export) The symbol "LocalState" needs to be exported by the entry point index.d.ts
// src/core/QueryManager.ts:378:7 - (ae-forgotten-export) The symbol "UpdateQueries" needs to be exported by the entry point index.d.ts
// src/core/QueryManager.ts:119:5 - (ae-forgotten-export) The symbol "MutationStoreValue" needs to be exported by the entry point index.d.ts
// src/core/QueryManager.ts:153:5 - (ae-forgotten-export) The symbol "LocalState" needs to be exported by the entry point index.d.ts
// src/core/QueryManager.ts:384:7 - (ae-forgotten-export) The symbol "UpdateQueries" needs to be exported by the entry point index.d.ts
// src/core/types.ts:158:3 - (ae-forgotten-export) The symbol "ApolloError" needs to be exported by the entry point index.d.ts
// src/core/types.ts:160:3 - (ae-forgotten-export) The symbol "NetworkStatus" needs to be exported by the entry point index.d.ts
// src/core/types.ts:178:3 - (ae-forgotten-export) The symbol "MutationQueryReducer" needs to be exported by the entry point index.d.ts
Expand Down
Loading
Loading