@apollo/client 4.2.0-alpha.3 → 4.2.0-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/CHANGELOG.md +179 -0
  2. package/__cjs/cache/core/cache.cjs +1 -1
  3. package/__cjs/cache/inmemory/entityStore.cjs +3 -3
  4. package/__cjs/cache/inmemory/entityStore.cjs.map +1 -1
  5. package/__cjs/cache/inmemory/key-extractor.cjs +1 -1
  6. package/__cjs/cache/inmemory/policies.cjs +4 -4
  7. package/__cjs/cache/inmemory/readFromStore.cjs +2 -2
  8. package/__cjs/cache/inmemory/writeToStore.cjs +4 -4
  9. package/__cjs/core/ApolloClient.cjs +43 -11
  10. package/__cjs/core/ApolloClient.cjs.map +1 -1
  11. package/__cjs/core/ApolloClient.d.cts +28 -1
  12. package/__cjs/core/ObservableQuery.cjs +7 -7
  13. package/__cjs/core/ObservableQuery.cjs.map +1 -1
  14. package/__cjs/core/ObservableQuery.d.cts +20 -1
  15. package/__cjs/core/QueryManager.cjs +12 -12
  16. package/__cjs/core/QueryManager.cjs.map +1 -1
  17. package/__cjs/core/RefetchEventManager.cjs +134 -0
  18. package/__cjs/core/RefetchEventManager.cjs.map +1 -0
  19. package/__cjs/core/RefetchEventManager.d.cts +130 -0
  20. package/__cjs/core/index.cjs +7 -1
  21. package/__cjs/core/index.cjs.map +1 -1
  22. package/__cjs/core/index.d.cts +4 -1
  23. package/__cjs/core/refetchSources/onlineSource.cjs +10 -0
  24. package/__cjs/core/refetchSources/onlineSource.cjs.map +1 -0
  25. package/__cjs/core/refetchSources/onlineSource.d.cts +3 -0
  26. package/__cjs/core/refetchSources/windowFocusSource.cjs +13 -0
  27. package/__cjs/core/refetchSources/windowFocusSource.cjs.map +1 -0
  28. package/__cjs/core/refetchSources/windowFocusSource.d.cts +3 -0
  29. package/__cjs/core/types.d.cts +20 -0
  30. package/__cjs/invariantErrorCodes.cjs +69 -44
  31. package/__cjs/react/hooks/useBackgroundQuery.cjs.map +1 -1
  32. package/__cjs/react/hooks/useBackgroundQuery.d.cts +20 -1
  33. package/__cjs/react/hooks/useLazyQuery.cjs +1 -0
  34. package/__cjs/react/hooks/useLazyQuery.cjs.map +1 -1
  35. package/__cjs/react/hooks/useLazyQuery.d.cts +20 -1
  36. package/__cjs/react/hooks/useLoadableQuery.cjs.map +1 -1
  37. package/__cjs/react/hooks/useLoadableQuery.d.cts +20 -1
  38. package/__cjs/react/hooks/useQuery.cjs.map +1 -1
  39. package/__cjs/react/hooks/useQuery.d.cts +20 -1
  40. package/__cjs/react/hooks/useSuspenseQuery.cjs.map +1 -1
  41. package/__cjs/react/hooks/useSuspenseQuery.d.cts +20 -1
  42. package/__cjs/react/internal/cache/QueryReference.cjs +1 -0
  43. package/__cjs/react/internal/cache/QueryReference.cjs.map +1 -1
  44. package/__cjs/react/internal/cache/QueryReference.d.cts +1 -1
  45. package/__cjs/react/query-preloader/createQueryPreloader.cjs.map +1 -1
  46. package/__cjs/react/query-preloader/createQueryPreloader.d.cts +20 -1
  47. package/__cjs/react/types/types.documentation.d.cts +19 -0
  48. package/__cjs/version.cjs +1 -1
  49. package/cache/core/cache.js +1 -1
  50. package/cache/inmemory/entityStore.js +3 -3
  51. package/cache/inmemory/entityStore.js.map +1 -1
  52. package/cache/inmemory/key-extractor.js +1 -1
  53. package/cache/inmemory/policies.js +4 -4
  54. package/cache/inmemory/readFromStore.js +2 -2
  55. package/cache/inmemory/writeToStore.js +4 -4
  56. package/core/ApolloClient.d.ts +28 -1
  57. package/core/ApolloClient.js +44 -12
  58. package/core/ApolloClient.js.map +1 -1
  59. package/core/ObservableQuery.d.ts +20 -1
  60. package/core/ObservableQuery.js +7 -7
  61. package/core/ObservableQuery.js.map +1 -1
  62. package/core/QueryManager.js +12 -12
  63. package/core/QueryManager.js.map +1 -1
  64. package/core/RefetchEventManager.d.ts +130 -0
  65. package/core/RefetchEventManager.js +126 -0
  66. package/core/RefetchEventManager.js.map +1 -0
  67. package/core/index.d.ts +4 -1
  68. package/core/index.js +3 -0
  69. package/core/index.js.map +1 -1
  70. package/core/refetchSources/onlineSource.d.ts +3 -0
  71. package/core/refetchSources/onlineSource.js +6 -0
  72. package/core/refetchSources/onlineSource.js.map +1 -0
  73. package/core/refetchSources/windowFocusSource.d.ts +3 -0
  74. package/core/refetchSources/windowFocusSource.js +9 -0
  75. package/core/refetchSources/windowFocusSource.js.map +1 -0
  76. package/core/types.d.ts +20 -0
  77. package/core/types.js.map +1 -1
  78. package/invariantErrorCodes.js +69 -44
  79. package/package.json +1 -1
  80. package/react/hooks/useBackgroundQuery.d.ts +20 -1
  81. package/react/hooks/useBackgroundQuery.js.map +1 -1
  82. package/react/hooks/useLazyQuery.d.ts +20 -1
  83. package/react/hooks/useLazyQuery.js +1 -0
  84. package/react/hooks/useLazyQuery.js.map +1 -1
  85. package/react/hooks/useLoadableQuery.d.ts +20 -1
  86. package/react/hooks/useLoadableQuery.js.map +1 -1
  87. package/react/hooks/useQuery.d.ts +20 -1
  88. package/react/hooks/useQuery.js.map +1 -1
  89. package/react/hooks/useSuspenseQuery.d.ts +20 -1
  90. package/react/hooks/useSuspenseQuery.js.map +1 -1
  91. package/react/hooks-compiled/useBackgroundQuery.d.ts +20 -1
  92. package/react/hooks-compiled/useBackgroundQuery.js.map +1 -1
  93. package/react/hooks-compiled/useLazyQuery.d.ts +20 -1
  94. package/react/hooks-compiled/useLazyQuery.js +1 -0
  95. package/react/hooks-compiled/useLazyQuery.js.map +1 -1
  96. package/react/hooks-compiled/useLoadableQuery.d.ts +20 -1
  97. package/react/hooks-compiled/useLoadableQuery.js.map +1 -1
  98. package/react/hooks-compiled/useQuery.d.ts +20 -1
  99. package/react/hooks-compiled/useQuery.js.map +1 -1
  100. package/react/hooks-compiled/useSuspenseQuery.d.ts +20 -1
  101. package/react/hooks-compiled/useSuspenseQuery.js.map +1 -1
  102. package/react/internal/cache/QueryReference.d.ts +1 -1
  103. package/react/internal/cache/QueryReference.js +1 -0
  104. package/react/internal/cache/QueryReference.js.map +1 -1
  105. package/react/query-preloader/createQueryPreloader.d.ts +20 -1
  106. package/react/query-preloader/createQueryPreloader.js.map +1 -1
  107. package/react/types/types.documentation.d.ts +19 -0
  108. package/react/types/types.documentation.js.map +1 -1
  109. package/version.js +1 -1
@@ -0,0 +1,130 @@
1
+ import type { Observable } from "@apollo/client/utilities";
2
+ import type { ApolloClient } from "./ApolloClient.js";
3
+ import type { ObservableQuery } from "./ObservableQuery.js";
4
+ import type { RefetchEvents } from "./types.js";
5
+ export declare namespace RefetchEventManager {
6
+ interface Options {
7
+ /**
8
+ * A mapping of event names to source functions. The source function is
9
+ * called by the refetch event manager to begin listening for events that
10
+ * trigger automatic refetches. Set to `true` if the event is only
11
+ * triggered by calling `emit` and has no automatic detection logic.
12
+ */
13
+ sources?: {
14
+ [Key in keyof RefetchEvents]?: true | RefetchEventManager.EventSource<RefetchEvents[Key]>;
15
+ };
16
+ /**
17
+ * A mapping of event names to handler functions that run
18
+ * `client.refetchQueries`. Provide a handler for an event to customize
19
+ * which queries are refetched when an event is triggered.
20
+ */
21
+ handlers?: {
22
+ [Key in keyof RefetchEvents]?: RefetchEventManager.EventHandler<Key>;
23
+ };
24
+ }
25
+ type EventSource<T> = () => Observable<T>;
26
+ type EventHandler<TSource extends keyof RefetchEvents = keyof RefetchEvents> = (context: RefetchEventManager.RefetchHandlerContext<TSource>) => ApolloClient.RefetchQueriesResult<any> | void;
27
+ type RefetchHandlerContext<TSource extends keyof RefetchEvents = keyof RefetchEvents> = TSource extends keyof RefetchEvents ? {
28
+ /**
29
+ * The `ApolloClient` instance connected to the refetch event manager.
30
+ */
31
+ client: ApolloClient;
32
+ /**
33
+ * Helper function that evaluates the `refetchOn` option to determine if
34
+ * the query should be refetched based on the event that triggered the
35
+ * refetch.
36
+ *
37
+ * @example
38
+ *
39
+ * ```ts
40
+ * new RefetchEventManager({
41
+ * handlers: {
42
+ * customEvent: ({ client, matchesRefetchOn }) => {
43
+ * return client.refetchQueries({
44
+ * include: "all",
45
+ * onQueryUpdated: matchesRefetchOn,
46
+ * });
47
+ * },
48
+ * },
49
+ * });
50
+ * ```
51
+ *
52
+ * @example
53
+ * Combined with custom logic
54
+ *
55
+ * ```ts
56
+ * new RefetchEventManager({
57
+ * handlers: {
58
+ * customEvent: ({ client, matchesRefetchOn }) => {
59
+ * return client.refetchQueries({
60
+ * include: "active",
61
+ * onQueryUpdated: (observableQuery) => {
62
+ * return (
63
+ * matchesRefetchOn(observableQuery) &&
64
+ * someOtherCondition(observableQuery)
65
+ * );
66
+ * },
67
+ * });
68
+ * },
69
+ * },
70
+ * });
71
+ * ```
72
+ */
73
+ matchesRefetchOn: (observableQuery: ObservableQuery<any>) => boolean;
74
+ /**
75
+ * The source name that triggered the refetch.
76
+ */
77
+ source: TSource;
78
+ /**
79
+ * Any data emitted by the source along with the event
80
+ */
81
+ payload: RefetchEvents[TSource];
82
+ } : never;
83
+ }
84
+ export declare class RefetchEventManager {
85
+ private sources;
86
+ private handlers;
87
+ private subscriptions;
88
+ private client;
89
+ constructor(options?: RefetchEventManager.Options);
90
+ /**
91
+ * Connects the client to this refetch event manager. Connecting a client
92
+ * calls each configured source function so they can begin listening for events.
93
+ */
94
+ connect(client: ApolloClient): void;
95
+ /**
96
+ * Disconnects the client from this refetch event manager and calls the cleanup
97
+ * function for each event source.
98
+ */
99
+ disconnect(client?: ApolloClient): void;
100
+ /**
101
+ * Returns whether a source is configured.
102
+ */
103
+ hasSource(source: keyof RefetchEvents): boolean;
104
+ /**
105
+ * Replaces the source for an event. If a source was previously configured
106
+ * for the event, its cleanup function is called before the new source is
107
+ * registered.
108
+ */
109
+ setEventSource<TSource extends keyof RefetchEvents>(name: TSource, source: RefetchEventManager.EventSource<RefetchEvents[TSource]>): void;
110
+ /**
111
+ * Removes the configured source for an event and runs its cleanup function.
112
+ */
113
+ removeEventSource(event: keyof RefetchEvents): void;
114
+ /**
115
+ * Replaces the handler for an event.
116
+ */
117
+ setEventHandler<TSource extends keyof RefetchEvents>(source: TSource, handler: RefetchEventManager.EventHandler<TSource>): void;
118
+ /**
119
+ * Manually triggers a refetch for the provided event.
120
+ *
121
+ * @remarks
122
+ * This method warns and does not refetch if the refetch event manager is not
123
+ * connected to a client or a source is not configured for the event.
124
+ */
125
+ emit<TSource extends keyof RefetchEvents>(source: TSource, ...args: RefetchEvents[TSource] extends void | never ? [] : undefined extends RefetchEvents[TSource] ? [
126
+ payload?: RefetchEvents[TSource]
127
+ ] : [payload: RefetchEvents[TSource]]): void;
128
+ private subscribeToSource;
129
+ }
130
+ //# sourceMappingURL=RefetchEventManager.d.ts.map
@@ -0,0 +1,126 @@
1
+ import { __DEV__ } from "@apollo/client/utilities/environment";
2
+ import { invariant } from "@apollo/client/utilities/invariant";
3
+ const defaultHandler = ({ client, matchesRefetchOn, }) => {
4
+ return client.refetchQueries({
5
+ include: "active",
6
+ onQueryUpdated: matchesRefetchOn,
7
+ });
8
+ };
9
+ export class RefetchEventManager {
10
+ sources;
11
+ handlers;
12
+ subscriptions = new Map();
13
+ client;
14
+ constructor(options = {}) {
15
+ this.sources = options.sources ?? {};
16
+ this.handlers = options.handlers ?? {};
17
+ }
18
+ /**
19
+ * Connects the client to this refetch event manager. Connecting a client
20
+ * calls each configured source function so they can begin listening for events.
21
+ */
22
+ connect(client) {
23
+ if (this.client === client) {
24
+ return;
25
+ }
26
+ if (this.client) {
27
+ if (__DEV__) {
28
+ __DEV__ && invariant.warn(101);
29
+ }
30
+ this.disconnect();
31
+ }
32
+ this.client = client;
33
+ Object.entries(this.sources).forEach(([event, source]) => {
34
+ if (typeof source === "function") {
35
+ this.subscribeToSource(event, source);
36
+ }
37
+ });
38
+ }
39
+ /**
40
+ * Disconnects the client from this refetch event manager and calls the cleanup
41
+ * function for each event source.
42
+ */
43
+ disconnect(client) {
44
+ if (client && this.client !== client) {
45
+ return;
46
+ }
47
+ this.client = undefined;
48
+ this.subscriptions.forEach((subscription) => subscription.unsubscribe());
49
+ this.subscriptions.clear();
50
+ }
51
+ /**
52
+ * Returns whether a source is configured.
53
+ */
54
+ hasSource(source) {
55
+ return Object.hasOwn(this.sources, source);
56
+ }
57
+ /**
58
+ * Replaces the source for an event. If a source was previously configured
59
+ * for the event, its cleanup function is called before the new source is
60
+ * registered.
61
+ */
62
+ setEventSource(name, source) {
63
+ this.sources[name] = source;
64
+ this.subscribeToSource(name, source);
65
+ }
66
+ /**
67
+ * Removes the configured source for an event and runs its cleanup function.
68
+ */
69
+ removeEventSource(event) {
70
+ this.subscriptions.get(event)?.unsubscribe();
71
+ this.subscriptions.delete(event);
72
+ delete this.sources[event];
73
+ }
74
+ /**
75
+ * Replaces the handler for an event.
76
+ */
77
+ setEventHandler(source, handler) {
78
+ this.handlers[source] = handler;
79
+ }
80
+ /**
81
+ * Manually triggers a refetch for the provided event.
82
+ *
83
+ * @remarks
84
+ * This method warns and does not refetch if the refetch event manager is not
85
+ * connected to a client or a source is not configured for the event.
86
+ */
87
+ emit(source, ...args) {
88
+ const [payload] = args;
89
+ if (!this.client) {
90
+ if (__DEV__) {
91
+ __DEV__ && invariant.warn(102, source);
92
+ }
93
+ return;
94
+ }
95
+ if (!this.hasSource(source)) {
96
+ if (__DEV__) {
97
+ __DEV__ && invariant.warn(103, source);
98
+ }
99
+ return;
100
+ }
101
+ const handler = this.handlers[source] ?? defaultHandler;
102
+ function matchesRefetchOn(oq) {
103
+ const ctx = { source, payload };
104
+ const refetchOn = oq.options.refetchOn;
105
+ if (typeof refetchOn === "boolean") {
106
+ return refetchOn;
107
+ }
108
+ if (typeof refetchOn === "function") {
109
+ return refetchOn(ctx);
110
+ }
111
+ if (typeof refetchOn?.[source] === "function") {
112
+ return refetchOn[source](ctx);
113
+ }
114
+ return refetchOn?.[source] !== false;
115
+ }
116
+ handler({ client: this.client, source, payload, matchesRefetchOn });
117
+ }
118
+ subscribeToSource(name, source) {
119
+ this.subscriptions.get(name)?.unsubscribe();
120
+ this.subscriptions.delete(name);
121
+ if (this.client) {
122
+ this.subscriptions.set(name, source().subscribe((value) => this.emit(name, value)));
123
+ }
124
+ }
125
+ }
126
+ //# sourceMappingURL=RefetchEventManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RefetchEventManager.js","sources":["../../src/core/RefetchEventManager.ts"],"sourcesContent":["import type { Subscription } from \"rxjs\";\n\nimport type { Observable } from \"@apollo/client/utilities\";\nimport { __DEV__ } from \"@apollo/client/utilities/environment\";\nimport { invariant } from \"@apollo/client/utilities/invariant\";\n\nimport type { ApolloClient } from \"./ApolloClient.js\";\nimport type { ObservableQuery } from \"./ObservableQuery.js\";\nimport type { RefetchEvents, RefetchOn } from \"./types.js\";\n\nexport declare namespace RefetchEventManager {\n export interface Options {\n /**\n * A mapping of event names to source functions. The source function is\n * called by the refetch event manager to begin listening for events that\n * trigger automatic refetches. Set to `true` if the event is only\n * triggered by calling `emit` and has no automatic detection logic.\n */\n sources?: {\n [Key in keyof RefetchEvents]?:\n | true\n | RefetchEventManager.EventSource<RefetchEvents[Key]>;\n };\n\n /**\n * A mapping of event names to handler functions that run\n * `client.refetchQueries`. Provide a handler for an event to customize\n * which queries are refetched when an event is triggered.\n */\n handlers?: {\n [Key in keyof RefetchEvents]?: RefetchEventManager.EventHandler<Key>;\n };\n }\n\n export type EventSource<T> = () => Observable<T>;\n export type EventHandler<\n TSource extends keyof RefetchEvents = keyof RefetchEvents,\n > = (\n context: RefetchEventManager.RefetchHandlerContext<TSource>\n ) => ApolloClient.RefetchQueriesResult<any> | void;\n\n export type RefetchHandlerContext<\n TSource extends keyof RefetchEvents = keyof RefetchEvents,\n > =\n TSource extends keyof RefetchEvents ?\n {\n /**\n * The `ApolloClient` instance connected to the refetch event manager.\n */\n client: ApolloClient;\n\n /**\n * Helper function that evaluates the `refetchOn` option to determine if\n * the query should be refetched based on the event that triggered the\n * refetch.\n *\n * @example\n *\n * ```ts\n * new RefetchEventManager({\n * handlers: {\n * customEvent: ({ client, matchesRefetchOn }) => {\n * return client.refetchQueries({\n * include: \"all\",\n * onQueryUpdated: matchesRefetchOn,\n * });\n * },\n * },\n * });\n * ```\n *\n * @example\n * Combined with custom logic\n *\n * ```ts\n * new RefetchEventManager({\n * handlers: {\n * customEvent: ({ client, matchesRefetchOn }) => {\n * return client.refetchQueries({\n * include: \"active\",\n * onQueryUpdated: (observableQuery) => {\n * return (\n * matchesRefetchOn(observableQuery) &&\n * someOtherCondition(observableQuery)\n * );\n * },\n * });\n * },\n * },\n * });\n * ```\n */\n matchesRefetchOn: (observableQuery: ObservableQuery<any>) => boolean;\n\n /**\n * The source name that triggered the refetch.\n */\n source: TSource;\n\n /**\n * Any data emitted by the source along with the event\n */\n payload: RefetchEvents[TSource];\n }\n : never;\n}\n\nconst defaultHandler: RefetchEventManager.EventHandler<keyof RefetchEvents> = ({\n client,\n matchesRefetchOn,\n}) => {\n return client.refetchQueries({\n include: \"active\",\n onQueryUpdated: matchesRefetchOn,\n });\n};\n\nexport class RefetchEventManager {\n private sources: Partial<\n Record<keyof RefetchEvents, true | RefetchEventManager.EventSource<any>>\n >;\n private handlers: Partial<\n Record<keyof RefetchEvents, RefetchEventManager.EventHandler<any>>\n >;\n\n private subscriptions: Map<keyof RefetchEvents, Subscription> = new Map();\n\n private client: ApolloClient | undefined;\n\n constructor(options: RefetchEventManager.Options = {}) {\n this.sources = options.sources ?? {};\n this.handlers = options.handlers ?? {};\n }\n\n /**\n * Connects the client to this refetch event manager. Connecting a client\n * calls each configured source function so they can begin listening for events.\n */\n connect(client: ApolloClient) {\n if (this.client === client) {\n return;\n }\n\n if (this.client) {\n if (__DEV__) {\n invariant.warn(\n \"Connected an `ApolloClient` instance to a `RefetchEventManager` that was already connected to a different `ApolloClient`. The previous client has been disconnected and will no longer receive refetch events from this manager.\"\n );\n }\n this.disconnect();\n }\n\n this.client = client;\n\n Object.entries(this.sources).forEach(([event, source]) => {\n if (typeof source === \"function\") {\n this.subscribeToSource(event as keyof RefetchEvents, source);\n }\n });\n }\n\n /**\n * Disconnects the client from this refetch event manager and calls the cleanup\n * function for each event source.\n */\n disconnect(client?: ApolloClient) {\n if (client && this.client !== client) {\n return;\n }\n\n this.client = undefined;\n this.subscriptions.forEach((subscription) => subscription.unsubscribe());\n this.subscriptions.clear();\n }\n\n /**\n * Returns whether a source is configured.\n */\n hasSource(source: keyof RefetchEvents) {\n return Object.hasOwn(this.sources, source);\n }\n\n /**\n * Replaces the source for an event. If a source was previously configured\n * for the event, its cleanup function is called before the new source is\n * registered.\n */\n setEventSource<TSource extends keyof RefetchEvents>(\n name: TSource,\n source: RefetchEventManager.EventSource<RefetchEvents[TSource]>\n ) {\n this.sources[name] = source;\n this.subscribeToSource(name, source);\n }\n\n /**\n * Removes the configured source for an event and runs its cleanup function.\n */\n removeEventSource(event: keyof RefetchEvents) {\n this.subscriptions.get(event)?.unsubscribe();\n this.subscriptions.delete(event);\n delete this.sources[event];\n }\n\n /**\n * Replaces the handler for an event.\n */\n setEventHandler<TSource extends keyof RefetchEvents>(\n source: TSource,\n handler: RefetchEventManager.EventHandler<TSource>\n ) {\n this.handlers[source] = handler;\n }\n\n /**\n * Manually triggers a refetch for the provided event.\n *\n * @remarks\n * This method warns and does not refetch if the refetch event manager is not\n * connected to a client or a source is not configured for the event.\n */\n emit<TSource extends keyof RefetchEvents>(\n source: TSource,\n ...args: RefetchEvents[TSource] extends void | never ? []\n : undefined extends RefetchEvents[TSource] ?\n [payload?: RefetchEvents[TSource]]\n : [payload: RefetchEvents[TSource]]\n ) {\n const [payload] = args;\n\n if (!this.client) {\n if (__DEV__) {\n invariant.warn(\n \"Received '%s' event but an `ApolloClient` instance is not connected to the `RefetchEventManager`. No queries will refetch. Pass the manager to the `refetchEventManager` option on the `ApolloClient` constructor.\",\n source\n );\n }\n\n return;\n }\n\n if (!this.hasSource(source)) {\n if (__DEV__) {\n invariant.warn(\n \"Received '%s' event but no source is configured for it on the `RefetchEventManager`. No queries will refetch. Add the event to the `sources` option or call `setEventSource`.\",\n source\n );\n }\n\n return;\n }\n\n const handler: RefetchEventManager.EventHandler<any> =\n this.handlers[source] ?? defaultHandler;\n\n function matchesRefetchOn(oq: ObservableQuery<any>) {\n const ctx: RefetchOn.Context<any> = { source, payload };\n const refetchOn = oq.options.refetchOn;\n\n if (typeof refetchOn === \"boolean\") {\n return refetchOn;\n }\n\n if (typeof refetchOn === \"function\") {\n return refetchOn(ctx);\n }\n\n if (typeof refetchOn?.[source] === \"function\") {\n return refetchOn[source](ctx as any);\n }\n\n return refetchOn?.[source] !== false;\n }\n\n handler({ client: this.client, source, payload, matchesRefetchOn });\n }\n\n private subscribeToSource<TSource extends keyof RefetchEvents>(\n name: TSource,\n source: RefetchEventManager.EventSource<RefetchEvents[TSource]>\n ) {\n this.subscriptions.get(name)?.unsubscribe();\n this.subscriptions.delete(name);\n\n if (this.client) {\n this.subscriptions.set(\n name,\n source().subscribe((value) => this.emit(name as any, value))\n );\n }\n }\n}\n"],"names":[],"mappings":"AAGA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,EAAE,CAAT,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,EAAwB,CAAxB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA8D;AAC9D,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,EAAE,CAAT,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,EAA0B,CAA1B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA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CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA6C,CAA7C,CAA+C;QAC3C,CAAJ,CAAA,CAAA,CAAQ,CAAC,CAAT,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAsB,CAAC,CAAvB,CAAA,CAAA,CAAA,CAAA,CAA6B,CAAC,CAA9B,CAAA,CAAA,CAAkC,CAAC;QAE/B,CAAJ,EAAA,CAAQ,CAAR,CAAA,CAAA,CAAY,CAAC,CAAb,CAAA,CAAA,CAAA,CAAA,CAAmB,EAAE;YACf,CAAN,CAAA,CAAA,CAAU,CAAC,CAAX,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAwB,CAAC,CAAzB,CAAA,CAA4B,CACpB,CADR,CAAA,CAAA,CACY,EACJ,CAFR,CAAA,CAAA,CAAA,CAAA,CAEc,CAFd,CAEgB,CAAC,CAFjB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAE0B,CAAC,CAAC,CAF5B,CAAA,CAAA,CAAA,CAEiC,EAAE,CAFnC,EAEsC,CAFtC,CAAA,CAAA,CAE0C,CAAC,CAF3C,CAAA,CAAA,CAE+C,CAAC,CAFhD,CAAA,CAAA,CAE2D,EAAE,CAF7D,CAAA,CAAA,CAAA,CAEkE,CAAC,CAAC,CAC7D;QACH;IACF;AACF;"}
package/core/index.d.ts CHANGED
@@ -1,9 +1,12 @@
1
1
  export type { ApolloClientOptions, ApolloQueryResult, DefaultOptions, DevtoolsOptions, MutateResult, MutationOptions, QueryOptions, RefetchQueriesOptions, RefetchQueriesResult, SubscribeToMoreOptions, SubscriptionOptions, WatchQueryOptions, } from "./deprecated.js";
2
2
  export { ApolloClient } from "./ApolloClient.js";
3
3
  export { ObservableQuery } from "./ObservableQuery.js";
4
+ export { RefetchEventManager } from "./RefetchEventManager.js";
5
+ export { onlineSource } from "./refetchSources/onlineSource.js";
6
+ export { windowFocusSource } from "./refetchSources/windowFocusSource.js";
4
7
  export type { ErrorPolicy, FetchPolicy, MutationFetchPolicy, RefetchWritePolicy, SubscribeToMoreFunction, SubscribeToMoreUpdateQueryFn, UpdateQueryMapFn, UpdateQueryOptions, WatchQueryFetchPolicy, } from "./watchQueryOptions.js";
5
8
  export { NetworkStatus } from "./networkStatus.js";
6
- export type { DataState, DataValue, DefaultContext, ErrorLike, GetDataState, InternalRefetchQueriesInclude, InternalRefetchQueriesMap, InternalRefetchQueriesOptions, InternalRefetchQueriesResult, InternalRefetchQueryDescriptor, MutationQueryReducer, MutationQueryReducersMap, MutationUpdaterFunction, NormalizedExecutionResult, OnQueryUpdated, OperationVariables, RefetchQueriesInclude, RefetchQueriesPromiseResults, RefetchQueryDescriptor, SubscriptionObservable, TypedDocumentNode, TypeOverrides, } from "./types.js";
9
+ export type { DataState, DataValue, DefaultContext, ErrorLike, GetDataState, InternalRefetchQueriesInclude, InternalRefetchQueriesMap, InternalRefetchQueriesOptions, InternalRefetchQueriesResult, InternalRefetchQueryDescriptor, MutationQueryReducer, MutationQueryReducersMap, MutationUpdaterFunction, NormalizedExecutionResult, OnQueryUpdated, OperationVariables, RefetchEvents, RefetchOn, RefetchQueriesInclude, RefetchQueriesPromiseResults, RefetchQueryDescriptor, SubscriptionObservable, TypedDocumentNode, TypeOverrides, } from "./types.js";
7
10
  export { CombinedGraphQLErrors, CombinedProtocolErrors, LinkError, LocalStateError, ServerError, ServerParseError, UnconventionalError, } from "@apollo/client/errors";
8
11
  export type { ApolloReducerConfig, Cache, DiffQueryAgainstStoreOptions, FieldFunctionOptions, FieldMergeFunction, FieldPolicy, FieldReadFunction, IdGetter, IdGetterObj, InMemoryCacheConfig, MergeInfo, MergeTree, NormalizedCache, NormalizedCacheObject, OptimisticStoreItem, PossibleTypesMap, ReactiveVar, ReadMergeModifyContext, ReadQueryOptions, StoreValue, Transaction, TypePolicies, TypePolicy, WatchFragmentOptions, WatchFragmentResult, } from "@apollo/client/cache";
9
12
  export { ApolloCache, defaultDataIdFromObject, InMemoryCache, makeVar, MissingFieldError, } from "@apollo/client/cache";
package/core/index.js CHANGED
@@ -1,6 +1,9 @@
1
1
  /* Core */
2
2
  export { ApolloClient } from "./ApolloClient.js";
3
3
  export { ObservableQuery } from "./ObservableQuery.js";
4
+ export { RefetchEventManager } from "./RefetchEventManager.js";
5
+ export { onlineSource } from "./refetchSources/onlineSource.js";
6
+ export { windowFocusSource } from "./refetchSources/windowFocusSource.js";
4
7
  export { NetworkStatus } from "./networkStatus.js";
5
8
  export { CombinedGraphQLErrors, CombinedProtocolErrors, LinkError, LocalStateError, ServerError, ServerParseError, UnconventionalError, } from "@apollo/client/errors";
6
9
  export { ApolloCache, defaultDataIdFromObject, InMemoryCache, makeVar, MissingFieldError, } from "@apollo/client/cache";
package/core/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,UAAU;AAgBV,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAYvD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAyBnD,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,SAAS,EACT,eAAe,EACf,WAAW,EACX,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,uBAAuB,CAAC;AAiC/B,OAAO,EACL,WAAW,EACX,uBAAuB,EACvB,aAAa,EACb,OAAO,EACP,iBAAiB,GAClB,MAAM,sBAAsB,CAAC;AAE9B,UAAU;AAEV,OAAO,EACL,UAAU,EACV,MAAM,EACN,KAAK,EACL,OAAO,EACP,IAAI,EACJ,KAAK,GACN,MAAM,qBAAqB,CAAC;AAU7B,OAAO,EACL,YAAY,EACZ,cAAc,EACd,uBAAuB,EACvB,cAAc,EACd,kBAAkB,EAClB,QAAQ,EACR,yBAAyB,EACzB,gBAAgB,EAChB,wBAAwB;AACxB,uEAAuE;AACvE,gCAAgC,EAChC,SAAS,GACV,MAAM,0BAA0B,CAAC;AAgBlC,OAAO,EACL,iBAAiB;AACjB,2FAA2F;AAC3F,uBAAuB,EACvB,WAAW,EACX,UAAU,GACX,MAAM,0BAA0B,CAAC;AAElC,gBAAgB;AAEhB,yEAAyE;AACzE,yFAAyF;AACzF,6DAA6D;AAC7D,OAAO,EAAE,YAAY,IAAI,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAErF,0DAA0D;AAC1D,qEAAqE;AACrE,sEAAsE;AACtE,yEAAyE;AACzE,yCAAyC;AACzC,wEAAwE;AACxE,6EAA6E;AAC7E,8EAA8E;AAC9E,sEAAsE;AACtE,qEAAqE;AACrE,4EAA4E;AAC5E,6BAA6B;AAC7B,OAAO,EACL,oCAAoC,EACpC,uBAAuB,EACvB,mCAAmC,EACnC,GAAG,EACH,WAAW,GACZ,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC","sourcesContent":["/* Core */\n\nexport type {\n ApolloClientOptions,\n ApolloQueryResult,\n DefaultOptions,\n DevtoolsOptions,\n MutateResult,\n MutationOptions,\n QueryOptions,\n RefetchQueriesOptions,\n RefetchQueriesResult,\n SubscribeToMoreOptions,\n SubscriptionOptions,\n WatchQueryOptions,\n} from \"./deprecated.js\";\nexport { ApolloClient } from \"./ApolloClient.js\";\nexport { ObservableQuery } from \"./ObservableQuery.js\";\nexport type {\n ErrorPolicy,\n FetchPolicy,\n MutationFetchPolicy,\n RefetchWritePolicy,\n SubscribeToMoreFunction,\n SubscribeToMoreUpdateQueryFn,\n UpdateQueryMapFn,\n UpdateQueryOptions,\n WatchQueryFetchPolicy,\n} from \"./watchQueryOptions.js\";\nexport { NetworkStatus } from \"./networkStatus.js\";\nexport type {\n DataState,\n DataValue,\n DefaultContext,\n ErrorLike,\n GetDataState,\n InternalRefetchQueriesInclude,\n InternalRefetchQueriesMap,\n InternalRefetchQueriesOptions,\n InternalRefetchQueriesResult,\n InternalRefetchQueryDescriptor,\n MutationQueryReducer,\n MutationQueryReducersMap,\n MutationUpdaterFunction,\n NormalizedExecutionResult,\n OnQueryUpdated,\n OperationVariables,\n RefetchQueriesInclude,\n RefetchQueriesPromiseResults,\n RefetchQueryDescriptor,\n SubscriptionObservable,\n TypedDocumentNode,\n TypeOverrides,\n} from \"./types.js\";\nexport {\n CombinedGraphQLErrors,\n CombinedProtocolErrors,\n LinkError,\n LocalStateError,\n ServerError,\n ServerParseError,\n UnconventionalError,\n} from \"@apollo/client/errors\";\n/* Cache */\n\nexport type {\n ApolloReducerConfig,\n Cache,\n DiffQueryAgainstStoreOptions,\n FieldFunctionOptions,\n FieldMergeFunction,\n FieldPolicy,\n FieldReadFunction,\n IdGetter,\n IdGetterObj,\n InMemoryCacheConfig,\n MergeInfo,\n MergeTree,\n NormalizedCache,\n NormalizedCacheObject,\n OptimisticStoreItem,\n PossibleTypesMap,\n ReactiveVar,\n ReadMergeModifyContext,\n ReadQueryOptions,\n StoreValue,\n // All the exports (types) from ../cache, minus cacheSlot,\n // which we want to keep semi-private.\n Transaction,\n TypePolicies,\n TypePolicy,\n WatchFragmentOptions,\n WatchFragmentResult,\n} from \"@apollo/client/cache\";\n\nexport {\n ApolloCache,\n defaultDataIdFromObject,\n InMemoryCache,\n makeVar,\n MissingFieldError,\n} from \"@apollo/client/cache\";\n\n/* Link */\n\nexport {\n ApolloLink,\n concat,\n empty,\n execute,\n from,\n split,\n} from \"@apollo/client/link\";\nexport type {\n ApolloPayloadResult,\n DocumentNode,\n FetchResult,\n GraphQLRequest,\n Operation,\n RequestHandler,\n} from \"@apollo/client/link\";\n\nexport {\n checkFetcher,\n createHttpLink,\n createSignalIfSupported,\n defaultPrinter,\n fallbackHttpConfig,\n HttpLink,\n parseAndCheckHttpResponse,\n rewriteURIForGET,\n selectHttpOptionsAndBody,\n // TODO remove: needed by @apollo/client/link/batch-http but not public\n selectHttpOptionsAndBodyInternal,\n selectURI,\n} from \"@apollo/client/link/http\";\n\n/* Masking */\nexport type {\n FragmentType,\n MaybeMasked,\n Unmasked,\n} from \"@apollo/client/masking\";\n\n/* Utilities */\n\nexport type {\n DocumentTransformCacheKey,\n Reference,\n StoreObject,\n} from \"@apollo/client/utilities\";\nexport {\n DocumentTransform,\n /** @deprecated Please import `isNetworkRequestSettled` from `@apollo/client/utilities`. */\n isNetworkRequestSettled,\n isReference,\n Observable,\n} from \"@apollo/client/utilities\";\n\n/* Supporting */\n\n// The verbosity of invariant.{log,warn,error} can be controlled globally\n// by passing \"log\", \"warn\", \"error\", or \"silent\" to setVerbosity (\"log\" is the default).\n// Note that all invariant.* logging is hidden in production.\nexport { setVerbosity as setLogVerbosity } from \"@apollo/client/utilities/invariant\";\n\n// Note that importing `gql` by itself, then destructuring\n// additional properties separately before exporting, is intentional.\n// Due to the way the `graphql-tag` library is setup, certain bundlers\n// can't find the properties added to the exported `gql` function without\n// additional guidance (e.g. Rollup - see\n// https://rollupjs.org/guide/en/#error-name-is-not-exported-by-module).\n// Instead of having people that are using bundlers with `@apollo/client` add\n// extra bundler config to help `graphql-tag` exports be found (which would be\n// awkward since they aren't importing `graphql-tag` themselves), this\n// workaround of pulling the extra properties off the `gql` function,\n// then re-exporting them separately, helps keeps bundlers happy without any\n// additional config changes.\nexport {\n disableExperimentalFragmentVariables,\n disableFragmentWarnings,\n enableExperimentalFragmentVariables,\n gql,\n resetCaches,\n} from \"graphql-tag\";\nexport { build, version } from \"../version.js\";\n\n// internal types\nimport type {\n DefaultOptionsParentObject,\n PossibleDefaultOptions,\n} from \"./defaultOptions.js\";\nimport type { QueryManager } from \"./QueryManager.js\";\nimport type { NextFetchPolicyContext } from \"./watchQueryOptions.js\";\n/** @internal */\nexport declare namespace InternalTypes {\n export type {\n DefaultOptionsParentObject,\n NextFetchPolicyContext,\n PossibleDefaultOptions,\n QueryManager,\n };\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceR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A6E;AAC7E,8EAA8E;AAC9E,sEAAsE;AACtE,qEAAqE;AACrE,4EAA4E;AAC5E,6BAA6B;AAC7B,OAAO,EACL,oCAAoC,EACpC,uBAAuB,EACvB,mCAAmC,EACnC,GAAG,EACH,WAAW,GACZ,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC","sourcesContent":["/* Core */\n\nexport type {\n ApolloClientOptions,\n ApolloQueryResult,\n DefaultOptions,\n DevtoolsOptions,\n MutateResult,\n MutationOptions,\n QueryOptions,\n RefetchQueriesOptions,\n RefetchQueriesResult,\n SubscribeToMoreOptions,\n SubscriptionOptions,\n WatchQueryOptions,\n} from \"./deprecated.js\";\nexport { ApolloClient } from \"./ApolloClient.js\";\nexport { ObservableQuery } from \"./ObservableQuery.js\";\nexport { RefetchEventManager } from \"./RefetchEventManager.js\";\nexport { onlineSource } from \"./refetchSources/onlineSource.js\";\nexport { windowFocusSource } from \"./refetchSources/windowFocusSource.js\";\nexport type {\n ErrorPolicy,\n FetchPolicy,\n MutationFetchPolicy,\n RefetchWritePolicy,\n SubscribeToMoreFunction,\n SubscribeToMoreUpdateQueryFn,\n UpdateQueryMapFn,\n UpdateQueryOptions,\n WatchQueryFetchPolicy,\n} from \"./watchQueryOptions.js\";\nexport { NetworkStatus } from \"./networkStatus.js\";\nexport type {\n DataState,\n DataValue,\n DefaultContext,\n ErrorLike,\n GetDataState,\n InternalRefetchQueriesInclude,\n InternalRefetchQueriesMap,\n InternalRefetchQueriesOptions,\n InternalRefetchQueriesResult,\n InternalRefetchQueryDescriptor,\n MutationQueryReducer,\n MutationQueryReducersMap,\n MutationUpdaterFunction,\n NormalizedExecutionResult,\n OnQueryUpdated,\n OperationVariables,\n RefetchEvents,\n RefetchOn,\n RefetchQueriesInclude,\n RefetchQueriesPromiseResults,\n RefetchQueryDescriptor,\n SubscriptionObservable,\n TypedDocumentNode,\n TypeOverrides,\n} from \"./types.js\";\nexport {\n CombinedGraphQLErrors,\n CombinedProtocolErrors,\n LinkError,\n LocalStateError,\n ServerError,\n ServerParseError,\n UnconventionalError,\n} from \"@apollo/client/errors\";\n/* Cache */\n\nexport type {\n ApolloReducerConfig,\n Cache,\n DiffQueryAgainstStoreOptions,\n FieldFunctionOptions,\n FieldMergeFunction,\n FieldPolicy,\n FieldReadFunction,\n IdGetter,\n IdGetterObj,\n InMemoryCacheConfig,\n MergeInfo,\n MergeTree,\n NormalizedCache,\n NormalizedCacheObject,\n OptimisticStoreItem,\n PossibleTypesMap,\n ReactiveVar,\n ReadMergeModifyContext,\n ReadQueryOptions,\n StoreValue,\n // All the exports (types) from ../cache, minus cacheSlot,\n // which we want to keep semi-private.\n Transaction,\n TypePolicies,\n TypePolicy,\n WatchFragmentOptions,\n WatchFragmentResult,\n} from \"@apollo/client/cache\";\n\nexport {\n ApolloCache,\n defaultDataIdFromObject,\n InMemoryCache,\n makeVar,\n MissingFieldError,\n} from \"@apollo/client/cache\";\n\n/* Link */\n\nexport {\n ApolloLink,\n concat,\n empty,\n execute,\n from,\n split,\n} from \"@apollo/client/link\";\nexport type {\n ApolloPayloadResult,\n DocumentNode,\n FetchResult,\n GraphQLRequest,\n Operation,\n RequestHandler,\n} from \"@apollo/client/link\";\n\nexport {\n checkFetcher,\n createHttpLink,\n createSignalIfSupported,\n defaultPrinter,\n fallbackHttpConfig,\n HttpLink,\n parseAndCheckHttpResponse,\n rewriteURIForGET,\n selectHttpOptionsAndBody,\n // TODO remove: needed by @apollo/client/link/batch-http but not public\n selectHttpOptionsAndBodyInternal,\n selectURI,\n} from \"@apollo/client/link/http\";\n\n/* Masking */\nexport type {\n FragmentType,\n MaybeMasked,\n Unmasked,\n} from \"@apollo/client/masking\";\n\n/* Utilities */\n\nexport type {\n DocumentTransformCacheKey,\n Reference,\n StoreObject,\n} from \"@apollo/client/utilities\";\nexport {\n DocumentTransform,\n /** @deprecated Please import `isNetworkRequestSettled` from `@apollo/client/utilities`. */\n isNetworkRequestSettled,\n isReference,\n Observable,\n} from \"@apollo/client/utilities\";\n\n/* Supporting */\n\n// The verbosity of invariant.{log,warn,error} can be controlled globally\n// by passing \"log\", \"warn\", \"error\", or \"silent\" to setVerbosity (\"log\" is the default).\n// Note that all invariant.* logging is hidden in production.\nexport { setVerbosity as setLogVerbosity } from \"@apollo/client/utilities/invariant\";\n\n// Note that importing `gql` by itself, then destructuring\n// additional properties separately before exporting, is intentional.\n// Due to the way the `graphql-tag` library is setup, certain bundlers\n// can't find the properties added to the exported `gql` function without\n// additional guidance (e.g. Rollup - see\n// https://rollupjs.org/guide/en/#error-name-is-not-exported-by-module).\n// Instead of having people that are using bundlers with `@apollo/client` add\n// extra bundler config to help `graphql-tag` exports be found (which would be\n// awkward since they aren't importing `graphql-tag` themselves), this\n// workaround of pulling the extra properties off the `gql` function,\n// then re-exporting them separately, helps keeps bundlers happy without any\n// additional config changes.\nexport {\n disableExperimentalFragmentVariables,\n disableFragmentWarnings,\n enableExperimentalFragmentVariables,\n gql,\n resetCaches,\n} from \"graphql-tag\";\nexport { build, version } from \"../version.js\";\n\n// internal types\nimport type {\n DefaultOptionsParentObject,\n PossibleDefaultOptions,\n} from \"./defaultOptions.js\";\nimport type { QueryManager } from \"./QueryManager.js\";\nimport type { NextFetchPolicyContext } from \"./watchQueryOptions.js\";\n/** @internal */\nexport declare namespace InternalTypes {\n export type {\n DefaultOptionsParentObject,\n NextFetchPolicyContext,\n PossibleDefaultOptions,\n QueryManager,\n };\n}\n"]}
@@ -0,0 +1,3 @@
1
+ import type { RefetchEventManager } from "../RefetchEventManager.js";
2
+ export declare const onlineSource: RefetchEventManager.EventSource<Event>;
3
+ //# sourceMappingURL=onlineSource.d.ts.map
@@ -0,0 +1,6 @@
1
+ import { EMPTY, fromEvent } from "rxjs";
2
+ import { canUseDOM } from "@apollo/client/utilities/internal";
3
+ export const onlineSource = () => {
4
+ return canUseDOM ? fromEvent(window, "online") : EMPTY;
5
+ };
6
+ //# sourceMappingURL=onlineSource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"onlineSource.js","sourceRoot":"","sources":["../../../src/core/refetchSources/onlineSource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAExC,OAAO,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAI9D,MAAM,CAAC,MAAM,YAAY,GAA2C,GAAG,EAAE;IACvE,OAAO,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AACzD,CAAC,CAAC","sourcesContent":["import { EMPTY, fromEvent } from \"rxjs\";\n\nimport { canUseDOM } from \"@apollo/client/utilities/internal\";\n\nimport type { RefetchEventManager } from \"../RefetchEventManager.js\";\n\nexport const onlineSource: RefetchEventManager.EventSource<Event> = () => {\n return canUseDOM ? fromEvent(window, \"online\") : EMPTY;\n};\n"]}
@@ -0,0 +1,3 @@
1
+ import type { RefetchEventManager } from "../RefetchEventManager.js";
2
+ export declare const windowFocusSource: RefetchEventManager.EventSource<Event>;
3
+ //# sourceMappingURL=windowFocusSource.d.ts.map
@@ -0,0 +1,9 @@
1
+ import { EMPTY, filter, fromEvent } from "rxjs";
2
+ import { canUseDOM } from "@apollo/client/utilities/internal";
3
+ export const windowFocusSource = () => {
4
+ if (!canUseDOM) {
5
+ return EMPTY;
6
+ }
7
+ return fromEvent(window, "visibilitychange").pipe(filter(() => document.visibilityState === "visible"));
8
+ };
9
+ //# sourceMappingURL=windowFocusSource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"windowFocusSource.js","sourceRoot":"","sources":["../../../src/core/refetchSources/windowFocusSource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAEhD,OAAO,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAI9D,MAAM,CAAC,MAAM,iBAAiB,GAA2C,GAAG,EAAE;IAC5E,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,SAAS,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC,IAAI,CAC/C,MAAM,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,eAAe,KAAK,SAAS,CAAC,CACrD,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { EMPTY, filter, fromEvent } from \"rxjs\";\n\nimport { canUseDOM } from \"@apollo/client/utilities/internal\";\n\nimport type { RefetchEventManager } from \"../RefetchEventManager.js\";\n\nexport const windowFocusSource: RefetchEventManager.EventSource<Event> = () => {\n if (!canUseDOM) {\n return EMPTY;\n }\n\n return fromEvent(window, \"visibilitychange\").pipe(\n filter(() => document.visibilityState === \"visible\")\n );\n};\n"]}
package/core/types.d.ts CHANGED
@@ -118,6 +118,26 @@ export interface DefaultContext extends Record<string, any> {
118
118
  queryDeduplication?: boolean;
119
119
  clientAwareness?: ClientAwarenessLink.ClientAwarenessOptions;
120
120
  }
121
+ export interface RefetchEvents {
122
+ windowFocus: Event;
123
+ online: Event;
124
+ }
125
+ export declare namespace RefetchOn {
126
+ type Context<TSource extends keyof RefetchEvents = keyof RefetchEvents> = TSource extends keyof RefetchEvents ? {
127
+ /**
128
+ * The source name that triggered the refetch.
129
+ */
130
+ source: TSource;
131
+ /**
132
+ * Any data emitted by the source along with the event
133
+ */
134
+ payload: RefetchEvents[TSource];
135
+ } : never;
136
+ type Callback<TSource extends keyof RefetchEvents = keyof RefetchEvents> = (context: RefetchOn.Context<TSource>) => boolean;
137
+ type Option = boolean | RefetchOn.Callback<keyof RefetchEvents> | {
138
+ [Key in keyof RefetchEvents]?: boolean | RefetchOn.Callback<Key>;
139
+ };
140
+ }
121
141
  /**
122
142
  * Represents an `Error` type, but used throughout Apollo Client to represent
123
143
  * errors that may otherwise fail `instanceof` checks if they are cross-realm
package/core/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { DocumentNode, FormattedExecutionResult } from \"graphql\";\nimport type {\n NextNotification,\n Observable,\n ObservableNotification,\n} from \"rxjs\";\n\nimport type { ApolloCache } from \"@apollo/client/cache\";\nimport type { Cache } from \"@apollo/client/cache\";\nimport type { ClientAwarenessLink } from \"@apollo/client/link/client-awareness\";\nimport type { Unmasked } from \"@apollo/client/masking\";\nimport type { DeepPartial, HKT } from \"@apollo/client/utilities\";\nimport type {\n ApplyHKTImplementationWithDefault,\n IsAny,\n} from \"@apollo/client/utilities/internal\";\n\nimport type { ApolloClient } from \"./ApolloClient.js\";\nimport type { ObservableQuery } from \"./ObservableQuery.js\";\n\nexport type { TypedDocumentNode } from \"@graphql-typed-document-node/core\";\n\nexport interface TypeOverrides {}\n\ndeclare namespace OverridableTypes {\n export interface Defaults {\n Complete: Complete;\n Streaming: Streaming;\n Partial: Partial;\n }\n\n interface Complete extends HKT {\n arg1: unknown; // TData\n return: this[\"arg1\"];\n }\n\n interface Streaming extends HKT {\n arg1: unknown; // TData\n return: this[\"arg1\"];\n }\n\n interface Partial extends HKT {\n arg1: unknown; // TData\n return: DeepPartial<this[\"arg1\"]>;\n }\n}\n\nexport declare namespace DataValue {\n /**\n * Returns a representation of `TData` in it's \"complete\" state.\n *\n * @defaultValue `TData` if no overrides are provided.\n *\n * @example\n * You can override this type globally - this example shows how to override it\n * with `DeepPartial<TData>`:\n *\n * ```ts\n * import { HKT, DeepPartial } from \"@apollo/client/utilities\";\n *\n * type CompleteOverride<TData> =\n * TData extends { _complete?: infer _Complete } ? _Complete : TData;\n *\n * interface CompleteOverrideHKT extends HKT {\n * return: CompleteOverride<this[\"arg1\"]>;\n * }\n *\n * declare module \"@apollo/client\" {\n * export interface TypeOverrides {\n * Complete: CompleteOverrideHKT;\n * }\n * }\n * ```\n */\n export type Complete<TData> = ApplyHKTImplementationWithDefault<\n TypeOverrides,\n \"Complete\",\n OverridableTypes.Defaults,\n TData\n >;\n\n /**\n * Returns a representation of `TData` while it is streaming.\n *\n * @defaultValue `TData` if no overrides are provided.\n *\n * @example\n * You can override this type globally - this example shows how to override it\n * with `DeepPartial<TData>`:\n *\n * ```ts\n * import { HKT, DeepPartial } from \"@apollo/client/utilities\";\n *\n * type StreamingOverride<TData> = DeepPartial<TData>;\n *\n * interface StreamingOverrideHKT extends HKT {\n * return: StreamingOverride<this[\"arg1\"]>;\n * }\n *\n * declare module \"@apollo/client\" {\n * export interface TypeOverrides {\n * Streaming: StreamingOverrideHKT;\n * }\n * }\n * ```\n */\n export type Streaming<TData> = ApplyHKTImplementationWithDefault<\n TypeOverrides,\n \"Streaming\",\n OverridableTypes.Defaults,\n TData\n >;\n\n /**\n * Returns a representation of `TData` while it is partial.\n *\n * @defaultValue `DeepPartial<TData>` if no overrides are provided.\n *\n * @example\n * You can override this type globally - this example shows how to override it\n * with `DeepPartial<TData>`:\n *\n * ```ts\n * import { HKT, DeepPartial } from \"@apollo/client/utilities\";\n *\n * type PartialOverride<TData> = DeepPartial<Complete<TData>>;\n *\n * interface PartialOverrideHKT extends HKT {\n * return: PartialOverride<this[\"arg1\"]>;\n * }\n *\n * declare module \"@apollo/client\" {\n * export interface TypeOverrides {\n * Partial: PartialOverrideHKT;\n * }\n * }\n * ```\n */\n export type Partial<TData> = ApplyHKTImplementationWithDefault<\n TypeOverrides,\n \"Partial\",\n OverridableTypes.Defaults,\n TData\n >;\n}\n\nexport interface DefaultContext extends Record<string, any> {\n /**\n * Indicates whether `queryDeduplication` was enabled for the request.\n */\n queryDeduplication?: boolean;\n clientAwareness?: ClientAwarenessLink.ClientAwarenessOptions;\n}\n\n/**\n * Represents an `Error` type, but used throughout Apollo Client to represent\n * errors that may otherwise fail `instanceof` checks if they are cross-realm\n * Error instances (see the [`Error.isError` proposal](https://github.com/tc39/proposal-is-error) for more details).\n *\n * Apollo Client uses several types of errors throughout the client which can be\n * narrowed using `instanceof`:\n *\n * - `CombinedGraphQLErrors` - `errors` returned from a GraphQL result\n * - `CombinedProtocolErrors` - Transport-level errors from multipart subscriptions.\n * - `ServerParseError` - A JSON-parse error when parsing the server response.\n * - `ServerError` - A non-200 server response.\n *\n * @example\n *\n * ```ts\n * import { CombinedGraphQLErrors } from \"@apollo/client\";\n *\n * try {\n * await client.query({ query });\n * } catch (error) {\n * // Use `instanceof` to check for more specific types of errors.\n * if (error instanceof CombinedGraphQLErrors) {\n * error.errors.map((graphQLError) => console.log(graphQLError.message));\n * } else {\n * console.error(errors);\n * }\n * }\n * ```\n */\nexport interface ErrorLike {\n message: string;\n name: string;\n stack?: string;\n}\n\nexport type OnQueryUpdated<TResult> = (\n observableQuery: ObservableQuery<any>,\n diff: Cache.DiffResult<any>,\n lastDiff: Cache.DiffResult<any> | undefined\n) => boolean | TResult;\n\nexport type RefetchQueryDescriptor = string | DocumentNode;\nexport type InternalRefetchQueryDescriptor =\n | RefetchQueryDescriptor\n | ApolloClient.QueryOptions;\n\ntype RefetchQueriesIncludeShorthand = \"all\" | \"active\";\n\nexport type RefetchQueriesInclude =\n | RefetchQueryDescriptor[]\n | RefetchQueriesIncludeShorthand;\n\nexport type InternalRefetchQueriesInclude =\n | InternalRefetchQueryDescriptor[]\n | RefetchQueriesIncludeShorthand;\n\n// The client.refetchQueries method returns a thenable (PromiseLike) object\n// whose result is an array of Promise.resolve'd TResult values, where TResult\n// is whatever type the (optional) onQueryUpdated function returns. When no\n// onQueryUpdated function is given, TResult defaults to ApolloQueryResult<any>\n// (thanks to default type parameters for client.refetchQueries).\nexport type RefetchQueriesPromiseResults<TResult> =\n // If onQueryUpdated returns any, all bets are off, so the results array must\n // be a generic any[] array, which is much less confusing than the union type\n // we get if we don't check for any. I hoped `any extends TResult` would do\n // the trick here, instead of IsStrictlyAny, but you can see for yourself what\n // fails in the refetchQueries tests if you try making that simplification.\n IsAny<TResult> extends true ? any[]\n : // If the onQueryUpdated function passed to client.refetchQueries returns true\n // or false, that means either to refetch the query (true) or to skip the\n // query (false). Since refetching produces an ApolloQueryResult<any>, and\n // skipping produces nothing, the fully-resolved array of all results produced\n // will be an ApolloQueryResult<any>[], when TResult extends boolean.\n TResult extends boolean ? ApolloClient.QueryResult<any>[]\n : // If onQueryUpdated returns a PromiseLike<U>, that thenable will be passed as\n // an array element to Promise.all, so we infer/unwrap the array type U here.\n TResult extends PromiseLike<infer U> ? U[]\n : // All other onQueryUpdated results end up in the final Promise.all array as\n // themselves, with their original TResult type. Note that TResult will\n // default to ApolloQueryResult<any> if no onQueryUpdated function is passed\n // to client.refetchQueries.\n TResult[];\n\n// Used by QueryManager[\"refetchQueries\"]\nexport interface InternalRefetchQueriesOptions<\n TCache extends ApolloCache,\n TResult,\n> extends Omit<ApolloClient.RefetchQueriesOptions<TCache, TResult>, \"include\"> {\n // Just like the refetchQueries option for a mutation, an array of strings,\n // DocumentNode objects, and/or QueryOptions objects, or one of the shorthand\n // strings \"all\" or \"active\", to select every (active) query.\n include?: InternalRefetchQueriesInclude;\n // This part of the API is a (useful) implementation detail, but need not be\n // exposed in the public client.refetchQueries API (above).\n removeOptimistic?: string;\n}\n\nexport type InternalRefetchQueriesResult<TResult> =\n // If onQueryUpdated returns a boolean, that's equivalent to refetching the\n // query when the boolean is true and skipping the query when false, so the\n // internal type of refetched results is Promise<ApolloQueryResult<any>>.\n TResult extends boolean ? Promise<ApolloClient.QueryResult<any>>\n : // Otherwise, onQueryUpdated returns whatever it returns. If onQueryUpdated is\n // not provided, TResult defaults to Promise<ApolloQueryResult<any>> (see the\n // generic type parameters of client.refetchQueries).\n TResult;\n\nexport type InternalRefetchQueriesMap<TResult> = Map<\n ObservableQuery<any>,\n InternalRefetchQueriesResult<TResult>\n>;\n\nexport type OperationVariables = Record<string, any>;\n\nexport type DataState<TData> =\n | {\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#data:member} */\n data: DataValue.Complete<TData>;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#dataState:member} */\n dataState: \"complete\";\n }\n | {\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#data:member} */\n data: DataValue.Streaming<TData>;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#dataState:member} */\n dataState: \"streaming\";\n }\n | {\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#data:member} */\n data: DataValue.Partial<TData>;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#dataState:member} */\n dataState: \"partial\";\n }\n | {\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#data:member} */\n data: undefined;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#dataState:member} */\n dataState: \"empty\";\n };\n\nexport type GetDataState<\n TData,\n TState extends DataState<TData>[\"dataState\"],\n> = Extract<DataState<TData>, { dataState: TState }>;\n\n/**\n * Represents a result that might be complete or still streaming and\n * has been normalized into a plain GraphQL result. When the result is\n * still `streaming`, some fields might not yet be available.\n */\nexport type NormalizedExecutionResult<\n TData = Record<string, unknown>,\n TExtensions = Record<string, unknown>,\n> = Omit<FormattedExecutionResult<TData, TExtensions>, \"data\"> &\n GetDataState<TData, \"streaming\" | \"complete\">;\n\n// This is part of the public API, people write these functions in `updateQueries`.\nexport type MutationQueryReducer<T> = (\n previousResult: Record<string, any>,\n options: {\n mutationResult: NormalizedExecutionResult<Unmasked<T>>;\n queryName: string | undefined;\n queryVariables: Record<string, any>;\n }\n) => Record<string, any>;\n\nexport type MutationQueryReducersMap<T = { [key: string]: any }> = {\n [queryName: string]: MutationQueryReducer<T>;\n};\n\nexport type MutationUpdaterFunction<\n TData,\n TVariables extends OperationVariables,\n TCache extends ApolloCache,\n> = (\n cache: TCache,\n result: FormattedExecutionResult<Unmasked<TData>>,\n options: {\n context?: DefaultContext;\n variables?: TVariables;\n }\n) => void;\n\nexport declare namespace QueryNotification {\n type NewNetworkStatus = NextNotification<{\n resetError?: boolean;\n }> & {\n source: \"newNetworkStatus\";\n };\n\n type SetResult<TData> = NextNotification<ObservableQuery.Result<TData>> & {\n source: \"setResult\";\n };\n\n type FromNetwork<TData> = ObservableNotification<\n ObservableQuery.Result<TData>\n > & {\n source: \"network\";\n };\n\n type FromCache<TData> = NextNotification<ObservableQuery.Result<TData>> & {\n source: \"cache\";\n };\n\n type Value<TData> =\n | FromCache<TData>\n | FromNetwork<TData>\n | NewNetworkStatus\n | SetResult<TData>;\n}\n\n/** Observable created by initiating a subscription operation. */\nexport interface SubscriptionObservable<T> extends Observable<T> {\n /**\n * Used to restart the connection to the link chain. Calling this on a\n * deduplicated subscription will restart the connection for all observables\n * that share the request.\n *\n * @example\n *\n * ```ts\n * const observable = client.subscribe({ query: subscription });\n * observable.subscribe((value) => {\n * // ...\n * });\n *\n * observable.restart();\n * ```\n */\n restart: () => void;\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { DocumentNode, FormattedExecutionResult } from \"graphql\";\nimport type {\n NextNotification,\n Observable,\n ObservableNotification,\n} from \"rxjs\";\n\nimport type { ApolloCache } from \"@apollo/client/cache\";\nimport type { Cache } from \"@apollo/client/cache\";\nimport type { ClientAwarenessLink } from \"@apollo/client/link/client-awareness\";\nimport type { Unmasked } from \"@apollo/client/masking\";\nimport type { DeepPartial, HKT } from \"@apollo/client/utilities\";\nimport type {\n ApplyHKTImplementationWithDefault,\n IsAny,\n} from \"@apollo/client/utilities/internal\";\n\nimport type { ApolloClient } from \"./ApolloClient.js\";\nimport type { ObservableQuery } from \"./ObservableQuery.js\";\n\nexport type { TypedDocumentNode } from \"@graphql-typed-document-node/core\";\n\nexport interface TypeOverrides {}\n\ndeclare namespace OverridableTypes {\n export interface Defaults {\n Complete: Complete;\n Streaming: Streaming;\n Partial: Partial;\n }\n\n interface Complete extends HKT {\n arg1: unknown; // TData\n return: this[\"arg1\"];\n }\n\n interface Streaming extends HKT {\n arg1: unknown; // TData\n return: this[\"arg1\"];\n }\n\n interface Partial extends HKT {\n arg1: unknown; // TData\n return: DeepPartial<this[\"arg1\"]>;\n }\n}\n\nexport declare namespace DataValue {\n /**\n * Returns a representation of `TData` in it's \"complete\" state.\n *\n * @defaultValue `TData` if no overrides are provided.\n *\n * @example\n * You can override this type globally - this example shows how to override it\n * with `DeepPartial<TData>`:\n *\n * ```ts\n * import { HKT, DeepPartial } from \"@apollo/client/utilities\";\n *\n * type CompleteOverride<TData> =\n * TData extends { _complete?: infer _Complete } ? _Complete : TData;\n *\n * interface CompleteOverrideHKT extends HKT {\n * return: CompleteOverride<this[\"arg1\"]>;\n * }\n *\n * declare module \"@apollo/client\" {\n * export interface TypeOverrides {\n * Complete: CompleteOverrideHKT;\n * }\n * }\n * ```\n */\n export type Complete<TData> = ApplyHKTImplementationWithDefault<\n TypeOverrides,\n \"Complete\",\n OverridableTypes.Defaults,\n TData\n >;\n\n /**\n * Returns a representation of `TData` while it is streaming.\n *\n * @defaultValue `TData` if no overrides are provided.\n *\n * @example\n * You can override this type globally - this example shows how to override it\n * with `DeepPartial<TData>`:\n *\n * ```ts\n * import { HKT, DeepPartial } from \"@apollo/client/utilities\";\n *\n * type StreamingOverride<TData> = DeepPartial<TData>;\n *\n * interface StreamingOverrideHKT extends HKT {\n * return: StreamingOverride<this[\"arg1\"]>;\n * }\n *\n * declare module \"@apollo/client\" {\n * export interface TypeOverrides {\n * Streaming: StreamingOverrideHKT;\n * }\n * }\n * ```\n */\n export type Streaming<TData> = ApplyHKTImplementationWithDefault<\n TypeOverrides,\n \"Streaming\",\n OverridableTypes.Defaults,\n TData\n >;\n\n /**\n * Returns a representation of `TData` while it is partial.\n *\n * @defaultValue `DeepPartial<TData>` if no overrides are provided.\n *\n * @example\n * You can override this type globally - this example shows how to override it\n * with `DeepPartial<TData>`:\n *\n * ```ts\n * import { HKT, DeepPartial } from \"@apollo/client/utilities\";\n *\n * type PartialOverride<TData> = DeepPartial<Complete<TData>>;\n *\n * interface PartialOverrideHKT extends HKT {\n * return: PartialOverride<this[\"arg1\"]>;\n * }\n *\n * declare module \"@apollo/client\" {\n * export interface TypeOverrides {\n * Partial: PartialOverrideHKT;\n * }\n * }\n * ```\n */\n export type Partial<TData> = ApplyHKTImplementationWithDefault<\n TypeOverrides,\n \"Partial\",\n OverridableTypes.Defaults,\n TData\n >;\n}\n\nexport interface DefaultContext extends Record<string, any> {\n /**\n * Indicates whether `queryDeduplication` was enabled for the request.\n */\n queryDeduplication?: boolean;\n clientAwareness?: ClientAwarenessLink.ClientAwarenessOptions;\n}\n\nexport interface RefetchEvents {\n windowFocus: Event;\n online: Event;\n}\n\nexport declare namespace RefetchOn {\n export type Context<\n TSource extends keyof RefetchEvents = keyof RefetchEvents,\n > =\n TSource extends keyof RefetchEvents ?\n {\n /**\n * The source name that triggered the refetch.\n */\n source: TSource;\n\n /**\n * Any data emitted by the source along with the event\n */\n payload: RefetchEvents[TSource];\n }\n : never;\n\n export type Callback<\n TSource extends keyof RefetchEvents = keyof RefetchEvents,\n > = (context: RefetchOn.Context<TSource>) => boolean;\n\n export type Option =\n | boolean\n | RefetchOn.Callback<keyof RefetchEvents>\n | {\n [Key in keyof RefetchEvents]?: boolean | RefetchOn.Callback<Key>;\n };\n}\n\n/**\n * Represents an `Error` type, but used throughout Apollo Client to represent\n * errors that may otherwise fail `instanceof` checks if they are cross-realm\n * Error instances (see the [`Error.isError` proposal](https://github.com/tc39/proposal-is-error) for more details).\n *\n * Apollo Client uses several types of errors throughout the client which can be\n * narrowed using `instanceof`:\n *\n * - `CombinedGraphQLErrors` - `errors` returned from a GraphQL result\n * - `CombinedProtocolErrors` - Transport-level errors from multipart subscriptions.\n * - `ServerParseError` - A JSON-parse error when parsing the server response.\n * - `ServerError` - A non-200 server response.\n *\n * @example\n *\n * ```ts\n * import { CombinedGraphQLErrors } from \"@apollo/client\";\n *\n * try {\n * await client.query({ query });\n * } catch (error) {\n * // Use `instanceof` to check for more specific types of errors.\n * if (error instanceof CombinedGraphQLErrors) {\n * error.errors.map((graphQLError) => console.log(graphQLError.message));\n * } else {\n * console.error(errors);\n * }\n * }\n * ```\n */\nexport interface ErrorLike {\n message: string;\n name: string;\n stack?: string;\n}\n\nexport type OnQueryUpdated<TResult> = (\n observableQuery: ObservableQuery<any>,\n diff: Cache.DiffResult<any>,\n lastDiff: Cache.DiffResult<any> | undefined\n) => boolean | TResult;\n\nexport type RefetchQueryDescriptor = string | DocumentNode;\nexport type InternalRefetchQueryDescriptor =\n | RefetchQueryDescriptor\n | ApolloClient.QueryOptions;\n\ntype RefetchQueriesIncludeShorthand = \"all\" | \"active\";\n\nexport type RefetchQueriesInclude =\n | RefetchQueryDescriptor[]\n | RefetchQueriesIncludeShorthand;\n\nexport type InternalRefetchQueriesInclude =\n | InternalRefetchQueryDescriptor[]\n | RefetchQueriesIncludeShorthand;\n\n// The client.refetchQueries method returns a thenable (PromiseLike) object\n// whose result is an array of Promise.resolve'd TResult values, where TResult\n// is whatever type the (optional) onQueryUpdated function returns. When no\n// onQueryUpdated function is given, TResult defaults to ApolloQueryResult<any>\n// (thanks to default type parameters for client.refetchQueries).\nexport type RefetchQueriesPromiseResults<TResult> =\n // If onQueryUpdated returns any, all bets are off, so the results array must\n // be a generic any[] array, which is much less confusing than the union type\n // we get if we don't check for any. I hoped `any extends TResult` would do\n // the trick here, instead of IsStrictlyAny, but you can see for yourself what\n // fails in the refetchQueries tests if you try making that simplification.\n IsAny<TResult> extends true ? any[]\n : // If the onQueryUpdated function passed to client.refetchQueries returns true\n // or false, that means either to refetch the query (true) or to skip the\n // query (false). Since refetching produces an ApolloQueryResult<any>, and\n // skipping produces nothing, the fully-resolved array of all results produced\n // will be an ApolloQueryResult<any>[], when TResult extends boolean.\n TResult extends boolean ? ApolloClient.QueryResult<any>[]\n : // If onQueryUpdated returns a PromiseLike<U>, that thenable will be passed as\n // an array element to Promise.all, so we infer/unwrap the array type U here.\n TResult extends PromiseLike<infer U> ? U[]\n : // All other onQueryUpdated results end up in the final Promise.all array as\n // themselves, with their original TResult type. Note that TResult will\n // default to ApolloQueryResult<any> if no onQueryUpdated function is passed\n // to client.refetchQueries.\n TResult[];\n\n// Used by QueryManager[\"refetchQueries\"]\nexport interface InternalRefetchQueriesOptions<\n TCache extends ApolloCache,\n TResult,\n> extends Omit<ApolloClient.RefetchQueriesOptions<TCache, TResult>, \"include\"> {\n // Just like the refetchQueries option for a mutation, an array of strings,\n // DocumentNode objects, and/or QueryOptions objects, or one of the shorthand\n // strings \"all\" or \"active\", to select every (active) query.\n include?: InternalRefetchQueriesInclude;\n // This part of the API is a (useful) implementation detail, but need not be\n // exposed in the public client.refetchQueries API (above).\n removeOptimistic?: string;\n}\n\nexport type InternalRefetchQueriesResult<TResult> =\n // If onQueryUpdated returns a boolean, that's equivalent to refetching the\n // query when the boolean is true and skipping the query when false, so the\n // internal type of refetched results is Promise<ApolloQueryResult<any>>.\n TResult extends boolean ? Promise<ApolloClient.QueryResult<any>>\n : // Otherwise, onQueryUpdated returns whatever it returns. If onQueryUpdated is\n // not provided, TResult defaults to Promise<ApolloQueryResult<any>> (see the\n // generic type parameters of client.refetchQueries).\n TResult;\n\nexport type InternalRefetchQueriesMap<TResult> = Map<\n ObservableQuery<any>,\n InternalRefetchQueriesResult<TResult>\n>;\n\nexport type OperationVariables = Record<string, any>;\n\nexport type DataState<TData> =\n | {\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#data:member} */\n data: DataValue.Complete<TData>;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#dataState:member} */\n dataState: \"complete\";\n }\n | {\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#data:member} */\n data: DataValue.Streaming<TData>;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#dataState:member} */\n dataState: \"streaming\";\n }\n | {\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#data:member} */\n data: DataValue.Partial<TData>;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#dataState:member} */\n dataState: \"partial\";\n }\n | {\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#data:member} */\n data: undefined;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#dataState:member} */\n dataState: \"empty\";\n };\n\nexport type GetDataState<\n TData,\n TState extends DataState<TData>[\"dataState\"],\n> = Extract<DataState<TData>, { dataState: TState }>;\n\n/**\n * Represents a result that might be complete or still streaming and\n * has been normalized into a plain GraphQL result. When the result is\n * still `streaming`, some fields might not yet be available.\n */\nexport type NormalizedExecutionResult<\n TData = Record<string, unknown>,\n TExtensions = Record<string, unknown>,\n> = Omit<FormattedExecutionResult<TData, TExtensions>, \"data\"> &\n GetDataState<TData, \"streaming\" | \"complete\">;\n\n// This is part of the public API, people write these functions in `updateQueries`.\nexport type MutationQueryReducer<T> = (\n previousResult: Record<string, any>,\n options: {\n mutationResult: NormalizedExecutionResult<Unmasked<T>>;\n queryName: string | undefined;\n queryVariables: Record<string, any>;\n }\n) => Record<string, any>;\n\nexport type MutationQueryReducersMap<T = { [key: string]: any }> = {\n [queryName: string]: MutationQueryReducer<T>;\n};\n\nexport type MutationUpdaterFunction<\n TData,\n TVariables extends OperationVariables,\n TCache extends ApolloCache,\n> = (\n cache: TCache,\n result: FormattedExecutionResult<Unmasked<TData>>,\n options: {\n context?: DefaultContext;\n variables?: TVariables;\n }\n) => void;\n\nexport declare namespace QueryNotification {\n type NewNetworkStatus = NextNotification<{\n resetError?: boolean;\n }> & {\n source: \"newNetworkStatus\";\n };\n\n type SetResult<TData> = NextNotification<ObservableQuery.Result<TData>> & {\n source: \"setResult\";\n };\n\n type FromNetwork<TData> = ObservableNotification<\n ObservableQuery.Result<TData>\n > & {\n source: \"network\";\n };\n\n type FromCache<TData> = NextNotification<ObservableQuery.Result<TData>> & {\n source: \"cache\";\n };\n\n type Value<TData> =\n | FromCache<TData>\n | FromNetwork<TData>\n | NewNetworkStatus\n | SetResult<TData>;\n}\n\n/** Observable created by initiating a subscription operation. */\nexport interface SubscriptionObservable<T> extends Observable<T> {\n /**\n * Used to restart the connection to the link chain. Calling this on a\n * deduplicated subscription will restart the connection for all observables\n * that share the request.\n *\n * @example\n *\n * ```ts\n * const observable = client.subscribe({ query: subscription });\n * observable.subscribe((value) => {\n * // ...\n * });\n *\n * observable.restart();\n * ```\n */\n restart: () => void;\n}\n"]}