@apollo/client 3.7.2 → 3.8.0-alpha.0

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 (106) hide show
  1. package/apollo-client.cjs +250 -30
  2. package/apollo-client.cjs.map +1 -1
  3. package/apollo-client.min.cjs +1 -1
  4. package/config/jest/setup.d.ts +1 -1
  5. package/config/jest/setup.d.ts.map +1 -1
  6. package/config/jest/setup.js +1 -0
  7. package/config/jest/setup.js.map +1 -1
  8. package/core/ObservableQuery.d.ts.map +1 -1
  9. package/core/ObservableQuery.js +3 -2
  10. package/core/ObservableQuery.js.map +1 -1
  11. package/core/QueryInfo.d.ts.map +1 -1
  12. package/core/QueryInfo.js +6 -2
  13. package/core/QueryInfo.js.map +1 -1
  14. package/core/core.cjs +10 -5
  15. package/core/core.cjs.map +1 -1
  16. package/core/core.cjs.native.js +10 -5
  17. package/core/watchQueryOptions.d.ts +1 -0
  18. package/core/watchQueryOptions.d.ts.map +1 -1
  19. package/core/watchQueryOptions.js.map +1 -1
  20. package/invariantErrorCodes.js +35 -23
  21. package/package.json +17 -3
  22. package/react/cache/SuspenseCache.d.ts +18 -0
  23. package/react/cache/SuspenseCache.d.ts.map +1 -0
  24. package/react/cache/SuspenseCache.js +49 -0
  25. package/react/cache/SuspenseCache.js.map +1 -0
  26. package/react/cache/index.d.ts +2 -0
  27. package/react/cache/index.d.ts.map +1 -0
  28. package/react/cache/index.js +2 -0
  29. package/react/cache/index.js.map +1 -0
  30. package/react/context/ApolloContext.d.ts +2 -0
  31. package/react/context/ApolloContext.d.ts.map +1 -1
  32. package/react/context/ApolloContext.js.map +1 -1
  33. package/react/context/ApolloProvider.d.ts +2 -0
  34. package/react/context/ApolloProvider.d.ts.map +1 -1
  35. package/react/context/ApolloProvider.js +4 -1
  36. package/react/context/ApolloProvider.js.map +1 -1
  37. package/react/context/context.cjs +4 -1
  38. package/react/context/context.cjs.map +1 -1
  39. package/react/context/context.cjs.native.js +4 -1
  40. package/react/hooks/compareResults.d.ts +3 -0
  41. package/react/hooks/compareResults.d.ts.map +1 -0
  42. package/react/hooks/compareResults.js +63 -0
  43. package/react/hooks/compareResults.js.map +1 -0
  44. package/react/hooks/hooks.cjs +167 -3
  45. package/react/hooks/hooks.cjs.map +1 -1
  46. package/react/hooks/hooks.cjs.native.js +167 -3
  47. package/react/hooks/index.d.ts +1 -0
  48. package/react/hooks/index.d.ts.map +1 -1
  49. package/react/hooks/index.js +1 -0
  50. package/react/hooks/index.js.map +1 -1
  51. package/react/hooks/internal/index.d.ts +2 -0
  52. package/react/hooks/internal/index.d.ts.map +1 -0
  53. package/react/hooks/internal/index.js +2 -0
  54. package/react/hooks/internal/index.js.map +1 -0
  55. package/react/hooks/internal/useDeepMemo.d.ts +3 -0
  56. package/react/hooks/internal/useDeepMemo.d.ts.map +1 -0
  57. package/react/hooks/internal/useDeepMemo.js +10 -0
  58. package/react/hooks/internal/useDeepMemo.js.map +1 -0
  59. package/react/hooks/useQuery.d.ts.map +1 -1
  60. package/react/hooks/useQuery.js +5 -3
  61. package/react/hooks/useQuery.js.map +1 -1
  62. package/react/hooks/useSuspenseCache.d.ts +2 -0
  63. package/react/hooks/useSuspenseCache.d.ts.map +1 -0
  64. package/react/hooks/useSuspenseCache.js +10 -0
  65. package/react/hooks/useSuspenseCache.js.map +1 -0
  66. package/react/hooks/useSuspenseQuery.d.ts +10 -0
  67. package/react/hooks/useSuspenseQuery.d.ts.map +1 -0
  68. package/react/hooks/useSuspenseQuery.js +157 -0
  69. package/react/hooks/useSuspenseQuery.js.map +1 -0
  70. package/react/index.d.ts +1 -0
  71. package/react/index.d.ts.map +1 -1
  72. package/react/index.js +1 -0
  73. package/react/index.js.map +1 -1
  74. package/react/parser/index.js +5 -5
  75. package/react/parser/parser.cjs +5 -5
  76. package/react/parser/parser.cjs.map +1 -1
  77. package/react/parser/parser.cjs.native.js +5 -5
  78. package/react/react.cjs +49 -2
  79. package/react/react.cjs.map +1 -1
  80. package/react/react.cjs.native.js +49 -2
  81. package/react/types/types.d.ts +9 -1
  82. package/react/types/types.d.ts.map +1 -1
  83. package/react/types/types.js.map +1 -1
  84. package/testing/core/core.cjs +1 -1
  85. package/testing/core/core.cjs.map +1 -1
  86. package/testing/core/core.cjs.native.js +1 -1
  87. package/testing/core/mocking/mockLink.js +1 -1
  88. package/testing/react/MockedProvider.d.ts +3 -0
  89. package/testing/react/MockedProvider.d.ts.map +1 -1
  90. package/testing/react/MockedProvider.js +8 -3
  91. package/testing/react/MockedProvider.js.map +1 -1
  92. package/testing/testing.cjs +54 -3
  93. package/testing/testing.cjs.map +1 -1
  94. package/testing/testing.cjs.native.js +54 -3
  95. package/utilities/globals/globals.cjs +1 -1
  96. package/utilities/globals/globals.cjs.map +1 -1
  97. package/utilities/globals/globals.cjs.native.js +1 -1
  98. package/utilities/globals/index.js +1 -1
  99. package/utilities/graphql/directives.js +4 -4
  100. package/utilities/graphql/fragments.js +3 -3
  101. package/utilities/graphql/getFromAST.js +8 -8
  102. package/utilities/graphql/storeUtils.js +1 -1
  103. package/utilities/utilities.cjs +16 -16
  104. package/utilities/utilities.cjs.map +1 -1
  105. package/utilities/utilities.cjs.native.js +16 -16
  106. package/version.js +1 -1
@@ -15,7 +15,7 @@ var utils = require('../link/utils');
15
15
  var tsInvariant = require('ts-invariant');
16
16
  var graphqlTag = require('graphql-tag');
17
17
 
18
- var version = '3.7.2';
18
+ var version = '3.8.0-alpha.0';
19
19
 
20
20
  function isExecutionPatchIncrementalResult(value) {
21
21
  return !!value.incremental;
@@ -41,13 +41,14 @@ var ObservableQuery = (function (_super) {
41
41
  function ObservableQuery(_a) {
42
42
  var queryManager = _a.queryManager, queryInfo = _a.queryInfo, options = _a.options;
43
43
  var _this = _super.call(this, function (observer) {
44
+ var _a = options.fetchOnFirstSubscribe, fetchOnFirstSubscribe = _a === void 0 ? true : _a;
44
45
  try {
45
46
  var subObserver = observer._subscription._observer;
46
47
  if (subObserver && !subObserver.error) {
47
48
  subObserver.error = defaultSubscriptionObserverErrorCallback;
48
49
  }
49
50
  }
50
- catch (_a) { }
51
+ catch (_b) { }
51
52
  var first = !_this.observers.size;
52
53
  _this.observers.add(observer);
53
54
  var last = _this.last;
@@ -57,7 +58,7 @@ var ObservableQuery = (function (_super) {
57
58
  else if (last && last.result) {
58
59
  observer.next && observer.next(last.result);
59
60
  }
60
- if (first) {
61
+ if (first && fetchOnFirstSubscribe) {
61
62
  _this.reobserve().catch(function () { });
62
63
  }
63
64
  return function () {
@@ -983,13 +984,13 @@ var QueryInfo = (function () {
983
984
  };
984
985
  QueryInfo.prototype.markResult = function (result, document, options, cacheWriteBehavior) {
985
986
  var _this = this;
987
+ var merger = new utilities.DeepMerger();
986
988
  var graphQLErrors = utilities.isNonEmptyArray(result.errors)
987
989
  ? result.errors.slice(0)
988
990
  : [];
989
991
  this.reset();
990
992
  if ('incremental' in result && utilities.isNonEmptyArray(result.incremental)) {
991
993
  var mergedData_1 = this.getDiff().result;
992
- var merger_1 = new utilities.DeepMerger();
993
994
  result.incremental.forEach(function (_a) {
994
995
  var data = _a.data, path = _a.path, errors = _a.errors;
995
996
  for (var i = path.length - 1; i >= 0; --i) {
@@ -1002,10 +1003,14 @@ var QueryInfo = (function () {
1002
1003
  if (errors) {
1003
1004
  graphQLErrors.push.apply(graphQLErrors, errors);
1004
1005
  }
1005
- mergedData_1 = merger_1.merge(mergedData_1, data);
1006
+ mergedData_1 = merger.merge(mergedData_1, data);
1006
1007
  });
1007
1008
  result.data = mergedData_1;
1008
1009
  }
1010
+ else if ('hasNext' in result && result.hasNext) {
1011
+ var diff = this.getDiff();
1012
+ result.data = merger.merge(diff.result, result.data);
1013
+ }
1009
1014
  this.graphQLErrors = graphQLErrors;
1010
1015
  if (options.fetchPolicy === 'no-cache') {
1011
1016
  this.updateLastDiff({ result: result.data, complete: true }, this.getDiffOptions(options.variables));
@@ -26,6 +26,7 @@ export interface WatchQueryOptions<TVariables = OperationVariables, TData = any>
26
26
  nextFetchPolicy?: WatchQueryFetchPolicy | ((this: WatchQueryOptions<TVariables, TData>, currentFetchPolicy: WatchQueryFetchPolicy, context: NextFetchPolicyContext<TData, TVariables>) => WatchQueryFetchPolicy);
27
27
  initialFetchPolicy?: WatchQueryFetchPolicy;
28
28
  refetchWritePolicy?: RefetchWritePolicy;
29
+ fetchOnFirstSubscribe?: boolean;
29
30
  }
30
31
  export interface NextFetchPolicyContext<TData, TVariables> {
31
32
  reason: "after-fetch" | "variables-changed";
@@ -1 +1 @@
1
- {"version":3,"file":"watchQueryOptions.d.ts","sourceRoot":"","sources":["../../src/core/watchQueryOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAEtE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EACL,cAAc,EACd,wBAAwB,EACxB,kBAAkB,EAClB,uBAAuB,EACvB,cAAc,EACd,6BAA6B,EAC9B,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAWpD,oBAAY,WAAW,GACnB,aAAa,GACb,cAAc,GACd,YAAY,GACZ,UAAU,GACV,SAAS,CAAC;AAEd,oBAAY,qBAAqB,GAAG,WAAW,GAAG,mBAAmB,CAAC;AAEtE,oBAAY,mBAAmB,GAAG,OAAO,CACvC,WAAW,EACT,cAAc,GACd,UAAU,CACb,CAAC;AAEF,oBAAY,kBAAkB,GAAG,OAAO,GAAG,WAAW,CAAC;AAQvD,oBAAY,WAAW,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;AAKpD,MAAM,WAAW,YAAY,CAAC,UAAU,GAAG,kBAAkB,EAAE,KAAK,GAAG,GAAG;IAOxE,KAAK,EAAE,YAAY,GAAG,iBAAiB,CAAC,KAAK,EAAE,UAAU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EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IAMtE,cAAc,CAAC,EAAE,cAAc,CAAC,GAAG,CAAC,CAAC;IAKrC,WAAW,CAAC,EAAE,WAAW,CAAC;IAM1B,SAAS,CAAC,EAAE,UAAU,CAAC;IAYtB,OAAO,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED,MAAM,WAAW,eAAe,CAC9B,KAAK,GAAG,GAAG,EACX,UAAU,GAAG,kBAAkB,EAC/B,QAAQ,GAAG,cAAc,EACzB,MAAM,SAAS,WAAW,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC,GAAG,CAAC,CAClD,SAAQ,mBAAmB,CAAC,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,CAAC;IAKhE,QAAQ,EAAE,YAAY,GAAG,iBAAiB,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;IAO9D,WAAW,CAAC,EAAE,mBAAmB,CAAC;IAWlC,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B"}
@@ -1 +1 @@
1
- {"version":3,"file":"watchQueryOptions.js","sourceRoot":"","sources":["../../src/core/watchQueryOptions.ts"],"names":[],"mappings":"","sourcesContent":["import { DocumentNode } from 'graphql';\nimport { TypedDocumentNode } from '@graphql-typed-document-node/core';\n\nimport { FetchResult } from '../link/core';\nimport {\n DefaultContext,\n MutationQueryReducersMap,\n OperationVariables,\n MutationUpdaterFunction,\n OnQueryUpdated,\n InternalRefetchQueriesInclude,\n} from './types';\nimport { ApolloCache } from '../cache';\nimport { ObservableQuery } from './ObservableQuery';\n\n/**\n * fetchPolicy determines where the client may return a result from. The options are:\n * - cache-first (default): return result from cache. Only fetch from network if cached result is not available.\n * - cache-and-network: return result from cache first (if it exists), then return network result once it's available.\n * - cache-only: return result from cache if available, fail otherwise.\n * - no-cache: return result from network, fail if network call doesn't succeed, don't save to cache\n * - network-only: return result from network, fail if network call doesn't succeed, save to cache\n * - standby: only for queries that aren't actively watched, but should be available for refetch and updateQueries.\n */\nexport type FetchPolicy =\n | 'cache-first'\n | 'network-only'\n | 'cache-only'\n | 'no-cache'\n | 'standby';\n\nexport type WatchQueryFetchPolicy = FetchPolicy | 'cache-and-network';\n\nexport type MutationFetchPolicy = Extract<\n FetchPolicy,\n | 'network-only' // default behavior (mutation results written to cache)\n | 'no-cache' // alternate behavior (results not written to cache)\n>;\n\nexport type RefetchWritePolicy = \"merge\" | \"overwrite\";\n\n/**\n * errorPolicy determines the level of events for errors in the execution result. The options are:\n * - none (default): any errors from the request are treated like runtime errors and the observable is stopped (XXX this is default to lower breaking changes going from AC 1.0 => 2.0)\n * - ignore: errors from the request do not stop the observable, but also don't call `next`\n * - all: errors are treated like data and will notify observables\n */\nexport type ErrorPolicy = 'none' | 'ignore' | 'all';\n\n/**\n * Query options.\n */\nexport interface QueryOptions<TVariables = OperationVariables, TData = any> {\n /**\n * A GraphQL document that consists of a single query to be sent down to the\n * server.\n */\n // TODO REFACTOR: rename this to document. Didn't do it yet because it's in a\n // lot of tests.\n query: DocumentNode | TypedDocumentNode<TData, TVariables>;\n\n /**\n * A map going from variable name to variable value, where the variables are used\n * within the GraphQL query.\n */\n variables?: TVariables;\n\n /**\n * Specifies the {@link ErrorPolicy} to be used for this query\n */\n errorPolicy?: ErrorPolicy;\n\n /**\n * Context to be passed to link execution chain\n */\n context?: any;\n\n /**\n * Specifies the {@link FetchPolicy} to be used for this query\n */\n fetchPolicy?: FetchPolicy;\n\n /**\n * The time interval (in milliseconds) on which this query should be\n * refetched from the server.\n */\n pollInterval?: number;\n\n /**\n * Whether or not updates to the network status should trigger next on the observer of this query\n */\n notifyOnNetworkStatusChange?: boolean;\n\n /**\n * Allow returning incomplete data from the cache when a larger query cannot\n * be fully satisfied by the cache, instead of returning nothing.\n */\n returnPartialData?: boolean;\n\n /**\n * If `true`, perform a query `refetch` if the query result is marked as\n * being partial, and the returned data is reset to an empty Object by the\n * Apollo Client `QueryManager` (due to a cache miss).\n */\n partialRefetch?: boolean;\n\n /**\n * Whether to canonize cache results before returning them. Canonization\n * takes some extra time, but it speeds up future deep equality comparisons.\n * Defaults to false.\n */\n canonizeResults?: boolean;\n}\n\n/**\n * Watched query options.\n */\nexport interface WatchQueryOptions<TVariables = OperationVariables, TData = any>\n extends Omit<QueryOptions<TVariables, TData>, 'fetchPolicy'> {\n /**\n * Specifies the {@link FetchPolicy} to be used for this query.\n */\n fetchPolicy?: WatchQueryFetchPolicy;\n\n /**\n * Specifies the {@link FetchPolicy} to be used after this query has completed.\n */\n nextFetchPolicy?: WatchQueryFetchPolicy | ((\n this: WatchQueryOptions<TVariables, TData>,\n currentFetchPolicy: WatchQueryFetchPolicy,\n context: NextFetchPolicyContext<TData, TVariables>,\n ) => WatchQueryFetchPolicy);\n\n /**\n * Defaults to the initial value of options.fetchPolicy, but can be explicitly\n * configured to specify the WatchQueryFetchPolicy to revert back to whenever\n * variables change (unless nextFetchPolicy intervenes).\n */\n initialFetchPolicy?: WatchQueryFetchPolicy;\n\n /**\n * Specifies whether a {@link NetworkStatus.refetch} operation should merge\n * incoming field data with existing data, or overwrite the existing data.\n * Overwriting is probably preferable, but merging is currently the default\n * behavior, for backwards compatibility with Apollo Client 3.x.\n */\n refetchWritePolicy?: RefetchWritePolicy;\n}\n\nexport interface NextFetchPolicyContext<TData, TVariables> {\n reason:\n | \"after-fetch\"\n | \"variables-changed\";\n observable: ObservableQuery<TData, TVariables>;\n options: WatchQueryOptions<TVariables, TData>;\n initialFetchPolicy: WatchQueryFetchPolicy;\n}\n\nexport interface FetchMoreQueryOptions<TVariables, TData = any> {\n query?: DocumentNode | TypedDocumentNode<TData, TVariables>;\n variables?: Partial<TVariables>;\n context?: any;\n}\n\nexport type UpdateQueryFn<\n TData = any,\n TSubscriptionVariables = OperationVariables,\n TSubscriptionData = TData\n> = (\n previousQueryResult: TData,\n options: {\n subscriptionData: { data: TSubscriptionData };\n variables?: TSubscriptionVariables;\n },\n) => TData;\n\nexport type SubscribeToMoreOptions<\n TData = any,\n TSubscriptionVariables = OperationVariables,\n TSubscriptionData = TData\n> = {\n document: DocumentNode | TypedDocumentNode<TSubscriptionData, TSubscriptionVariables>;\n variables?: TSubscriptionVariables;\n updateQuery?: UpdateQueryFn<TData, TSubscriptionVariables, TSubscriptionData>;\n onError?: (error: Error) => void;\n context?: DefaultContext;\n};\n\nexport interface SubscriptionOptions<TVariables = OperationVariables, TData = any> {\n /**\n * A GraphQL document, often created with `gql` from the `graphql-tag`\n * package, that contains a single subscription inside of it.\n */\n query: DocumentNode | TypedDocumentNode<TData, TVariables>;\n\n /**\n * An object that maps from the name of a variable as used in the subscription\n * GraphQL document to that variable's value.\n */\n variables?: TVariables;\n\n /**\n * Specifies the {@link FetchPolicy} to be used for this subscription.\n */\n fetchPolicy?: FetchPolicy;\n\n /**\n * Specifies the {@link ErrorPolicy} to be used for this operation\n */\n errorPolicy?: ErrorPolicy;\n\n /**\n * Context object to be passed through the link execution chain.\n */\n context?: DefaultContext;\n}\n\nexport interface MutationBaseOptions<\n TData = any,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache<any> = ApolloCache<any>,\n> {\n /**\n * An object that represents the result of this mutation that will be\n * optimistically stored before the server has actually returned a result.\n * This is most often used for optimistic UI, where we want to be able to see\n * the result of a mutation immediately, and update the UI later if any errors\n * appear.\n */\n optimisticResponse?: TData | ((vars: TVariables) => TData);\n\n /**\n * A {@link MutationQueryReducersMap}, which is map from query names to\n * mutation query reducers. Briefly, this map defines how to incorporate the\n * results of the mutation into the results of queries that are currently\n * being watched by your application.\n */\n updateQueries?: MutationQueryReducersMap<TData>;\n\n /**\n * A list of query names which will be refetched once this mutation has\n * returned. This is often used if you have a set of queries which may be\n * affected by a mutation and will have to update. Rather than writing a\n * mutation query reducer (i.e. `updateQueries`) for this, you can simply\n * refetch the queries that will be affected and achieve a consistent store\n * once these queries return.\n */\n refetchQueries?:\n | ((result: FetchResult<TData>) => InternalRefetchQueriesInclude)\n | InternalRefetchQueriesInclude;\n\n /**\n * By default, `refetchQueries` does not wait for the refetched queries to\n * be completed, before resolving the mutation `Promise`. This ensures that\n * query refetching does not hold up mutation response handling (query\n * refetching is handled asynchronously). Set `awaitRefetchQueries` to\n * `true` if you would like to wait for the refetched queries to complete,\n * before the mutation can be marked as resolved.\n */\n awaitRefetchQueries?: boolean;\n\n /**\n * A function which provides an {@link ApolloCache} instance, and the result\n * of the mutation, to allow the user to update the store based on the\n * results of the mutation.\n *\n * This function will be called twice over the lifecycle of a mutation. Once\n * at the very beginning if an `optimisticResponse` was provided. The writes\n * created from the optimistic data will be rolled back before the second time\n * this function is called which is when the mutation has successfully\n * resolved. At that point `update` will be called with the *actual* mutation\n * result and those writes will not be rolled back.\n *\n * Note that since this function is intended to be used to update the\n * store, it cannot be used with a `no-cache` fetch policy. If you're\n * interested in performing some action after a mutation has completed,\n * and you don't need to update the store, use the Promise returned from\n * `client.mutate` instead.\n */\n update?: MutationUpdaterFunction<TData, TVariables, TContext, TCache>;\n\n /**\n * A function that will be called for each ObservableQuery affected by\n * this mutation, after the mutation has completed.\n */\n onQueryUpdated?: OnQueryUpdated<any>;\n\n /**\n * Specifies the {@link ErrorPolicy} to be used for this operation\n */\n errorPolicy?: ErrorPolicy;\n\n /**\n * An object that maps from the name of a variable as used in the mutation\n * GraphQL document to that variable's value.\n */\n variables?: TVariables;\n\n /**\n * The context to be passed to the link execution chain. This context will\n * only be used with this mutation. It will not be used with\n * `refetchQueries`. Refetched queries use the context they were\n * initialized with (since the initial context is stored as part of the\n * `ObservableQuery` instance). If a specific context is needed when\n * refetching queries, make sure it is configured (via the\n * [query `context` option](https://www.apollographql.com/docs/react/api/apollo-client#ApolloClient.query))\n * when the query is first initialized/run.\n */\n context?: TContext;\n}\n\nexport interface MutationOptions<\n TData = any,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache<any> = ApolloCache<any>,\n> extends MutationBaseOptions<TData, TVariables, TContext, TCache> {\n /**\n * A GraphQL document, often created with `gql` from the `graphql-tag`\n * package, that contains a single mutation inside of it.\n */\n mutation: DocumentNode | TypedDocumentNode<TData, TVariables>;\n\n /**\n * Specifies the {@link MutationFetchPolicy} to be used for this query.\n * Mutations support only 'network-only' and 'no-cache' fetchPolicy strings.\n * If fetchPolicy is not provided, it defaults to 'network-only'.\n */\n fetchPolicy?: MutationFetchPolicy;\n\n /**\n * To avoid retaining sensitive information from mutation root field\n * arguments, Apollo Client v3.4+ automatically clears any `ROOT_MUTATION`\n * fields from the cache after each mutation finishes. If you need this\n * information to remain in the cache, you can prevent the removal by passing\n * `keepRootFields: true` to the mutation. `ROOT_MUTATION` result data are\n * also passed to the mutation `update` function, so we recommend obtaining\n * the results that way, rather than using this option, if possible.\n */\n keepRootFields?: boolean;\n}\n"]}
1
+ {"version":3,"file":"watchQueryOptions.js","sourceRoot":"","sources":["../../src/core/watchQueryOptions.ts"],"names":[],"mappings":"","sourcesContent":["import { DocumentNode } from 'graphql';\nimport { TypedDocumentNode } from '@graphql-typed-document-node/core';\n\nimport { FetchResult } from '../link/core';\nimport {\n DefaultContext,\n MutationQueryReducersMap,\n OperationVariables,\n MutationUpdaterFunction,\n OnQueryUpdated,\n InternalRefetchQueriesInclude,\n} from './types';\nimport { ApolloCache } from '../cache';\nimport { ObservableQuery } from './ObservableQuery';\n\n/**\n * fetchPolicy determines where the client may return a result from. The options are:\n * - cache-first (default): return result from cache. Only fetch from network if cached result is not available.\n * - cache-and-network: return result from cache first (if it exists), then return network result once it's available.\n * - cache-only: return result from cache if available, fail otherwise.\n * - no-cache: return result from network, fail if network call doesn't succeed, don't save to cache\n * - network-only: return result from network, fail if network call doesn't succeed, save to cache\n * - standby: only for queries that aren't actively watched, but should be available for refetch and updateQueries.\n */\nexport type FetchPolicy =\n | 'cache-first'\n | 'network-only'\n | 'cache-only'\n | 'no-cache'\n | 'standby';\n\nexport type WatchQueryFetchPolicy = FetchPolicy | 'cache-and-network';\n\nexport type MutationFetchPolicy = Extract<\n FetchPolicy,\n | 'network-only' // default behavior (mutation results written to cache)\n | 'no-cache' // alternate behavior (results not written to cache)\n>;\n\nexport type RefetchWritePolicy = \"merge\" | \"overwrite\";\n\n/**\n * errorPolicy determines the level of events for errors in the execution result. The options are:\n * - none (default): any errors from the request are treated like runtime errors and the observable is stopped (XXX this is default to lower breaking changes going from AC 1.0 => 2.0)\n * - ignore: errors from the request do not stop the observable, but also don't call `next`\n * - all: errors are treated like data and will notify observables\n */\nexport type ErrorPolicy = 'none' | 'ignore' | 'all';\n\n/**\n * Query options.\n */\nexport interface QueryOptions<TVariables = OperationVariables, TData = any> {\n /**\n * A GraphQL document that consists of a single query to be sent down to the\n * server.\n */\n // TODO REFACTOR: rename this to document. Didn't do it yet because it's in a\n // lot of tests.\n query: DocumentNode | TypedDocumentNode<TData, TVariables>;\n\n /**\n * A map going from variable name to variable value, where the variables are used\n * within the GraphQL query.\n */\n variables?: TVariables;\n\n /**\n * Specifies the {@link ErrorPolicy} to be used for this query\n */\n errorPolicy?: ErrorPolicy;\n\n /**\n * Context to be passed to link execution chain\n */\n context?: any;\n\n /**\n * Specifies the {@link FetchPolicy} to be used for this query\n */\n fetchPolicy?: FetchPolicy;\n\n /**\n * The time interval (in milliseconds) on which this query should be\n * refetched from the server.\n */\n pollInterval?: number;\n\n /**\n * Whether or not updates to the network status should trigger next on the observer of this query\n */\n notifyOnNetworkStatusChange?: boolean;\n\n /**\n * Allow returning incomplete data from the cache when a larger query cannot\n * be fully satisfied by the cache, instead of returning nothing.\n */\n returnPartialData?: boolean;\n\n /**\n * If `true`, perform a query `refetch` if the query result is marked as\n * being partial, and the returned data is reset to an empty Object by the\n * Apollo Client `QueryManager` (due to a cache miss).\n */\n partialRefetch?: boolean;\n\n /**\n * Whether to canonize cache results before returning them. Canonization\n * takes some extra time, but it speeds up future deep equality comparisons.\n * Defaults to false.\n */\n canonizeResults?: boolean;\n}\n\n/**\n * Watched query options.\n */\nexport interface WatchQueryOptions<TVariables = OperationVariables, TData = any>\n extends Omit<QueryOptions<TVariables, TData>, 'fetchPolicy'> {\n /**\n * Specifies the {@link FetchPolicy} to be used for this query.\n */\n fetchPolicy?: WatchQueryFetchPolicy;\n\n /**\n * Specifies the {@link FetchPolicy} to be used after this query has completed.\n */\n nextFetchPolicy?: WatchQueryFetchPolicy | ((\n this: WatchQueryOptions<TVariables, TData>,\n currentFetchPolicy: WatchQueryFetchPolicy,\n context: NextFetchPolicyContext<TData, TVariables>,\n ) => WatchQueryFetchPolicy);\n\n /**\n * Defaults to the initial value of options.fetchPolicy, but can be explicitly\n * configured to specify the WatchQueryFetchPolicy to revert back to whenever\n * variables change (unless nextFetchPolicy intervenes).\n */\n initialFetchPolicy?: WatchQueryFetchPolicy;\n\n /**\n * Specifies whether a {@link NetworkStatus.refetch} operation should merge\n * incoming field data with existing data, or overwrite the existing data.\n * Overwriting is probably preferable, but merging is currently the default\n * behavior, for backwards compatibility with Apollo Client 3.x.\n */\n refetchWritePolicy?: RefetchWritePolicy;\n\n /**\n * Determines whether the observable should execute a request when the first\n * observer subscribes to it.\n */\n fetchOnFirstSubscribe?: boolean\n}\n\nexport interface NextFetchPolicyContext<TData, TVariables> {\n reason:\n | \"after-fetch\"\n | \"variables-changed\";\n observable: ObservableQuery<TData, TVariables>;\n options: WatchQueryOptions<TVariables, TData>;\n initialFetchPolicy: WatchQueryFetchPolicy;\n}\n\nexport interface FetchMoreQueryOptions<TVariables, TData = any> {\n query?: DocumentNode | TypedDocumentNode<TData, TVariables>;\n variables?: Partial<TVariables>;\n context?: any;\n}\n\nexport type UpdateQueryFn<\n TData = any,\n TSubscriptionVariables = OperationVariables,\n TSubscriptionData = TData\n> = (\n previousQueryResult: TData,\n options: {\n subscriptionData: { data: TSubscriptionData };\n variables?: TSubscriptionVariables;\n },\n) => TData;\n\nexport type SubscribeToMoreOptions<\n TData = any,\n TSubscriptionVariables = OperationVariables,\n TSubscriptionData = TData\n> = {\n document: DocumentNode | TypedDocumentNode<TSubscriptionData, TSubscriptionVariables>;\n variables?: TSubscriptionVariables;\n updateQuery?: UpdateQueryFn<TData, TSubscriptionVariables, TSubscriptionData>;\n onError?: (error: Error) => void;\n context?: DefaultContext;\n};\n\nexport interface SubscriptionOptions<TVariables = OperationVariables, TData = any> {\n /**\n * A GraphQL document, often created with `gql` from the `graphql-tag`\n * package, that contains a single subscription inside of it.\n */\n query: DocumentNode | TypedDocumentNode<TData, TVariables>;\n\n /**\n * An object that maps from the name of a variable as used in the subscription\n * GraphQL document to that variable's value.\n */\n variables?: TVariables;\n\n /**\n * Specifies the {@link FetchPolicy} to be used for this subscription.\n */\n fetchPolicy?: FetchPolicy;\n\n /**\n * Specifies the {@link ErrorPolicy} to be used for this operation\n */\n errorPolicy?: ErrorPolicy;\n\n /**\n * Context object to be passed through the link execution chain.\n */\n context?: DefaultContext;\n}\n\nexport interface MutationBaseOptions<\n TData = any,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache<any> = ApolloCache<any>,\n> {\n /**\n * An object that represents the result of this mutation that will be\n * optimistically stored before the server has actually returned a result.\n * This is most often used for optimistic UI, where we want to be able to see\n * the result of a mutation immediately, and update the UI later if any errors\n * appear.\n */\n optimisticResponse?: TData | ((vars: TVariables) => TData);\n\n /**\n * A {@link MutationQueryReducersMap}, which is map from query names to\n * mutation query reducers. Briefly, this map defines how to incorporate the\n * results of the mutation into the results of queries that are currently\n * being watched by your application.\n */\n updateQueries?: MutationQueryReducersMap<TData>;\n\n /**\n * A list of query names which will be refetched once this mutation has\n * returned. This is often used if you have a set of queries which may be\n * affected by a mutation and will have to update. Rather than writing a\n * mutation query reducer (i.e. `updateQueries`) for this, you can simply\n * refetch the queries that will be affected and achieve a consistent store\n * once these queries return.\n */\n refetchQueries?:\n | ((result: FetchResult<TData>) => InternalRefetchQueriesInclude)\n | InternalRefetchQueriesInclude;\n\n /**\n * By default, `refetchQueries` does not wait for the refetched queries to\n * be completed, before resolving the mutation `Promise`. This ensures that\n * query refetching does not hold up mutation response handling (query\n * refetching is handled asynchronously). Set `awaitRefetchQueries` to\n * `true` if you would like to wait for the refetched queries to complete,\n * before the mutation can be marked as resolved.\n */\n awaitRefetchQueries?: boolean;\n\n /**\n * A function which provides an {@link ApolloCache} instance, and the result\n * of the mutation, to allow the user to update the store based on the\n * results of the mutation.\n *\n * This function will be called twice over the lifecycle of a mutation. Once\n * at the very beginning if an `optimisticResponse` was provided. The writes\n * created from the optimistic data will be rolled back before the second time\n * this function is called which is when the mutation has successfully\n * resolved. At that point `update` will be called with the *actual* mutation\n * result and those writes will not be rolled back.\n *\n * Note that since this function is intended to be used to update the\n * store, it cannot be used with a `no-cache` fetch policy. If you're\n * interested in performing some action after a mutation has completed,\n * and you don't need to update the store, use the Promise returned from\n * `client.mutate` instead.\n */\n update?: MutationUpdaterFunction<TData, TVariables, TContext, TCache>;\n\n /**\n * A function that will be called for each ObservableQuery affected by\n * this mutation, after the mutation has completed.\n */\n onQueryUpdated?: OnQueryUpdated<any>;\n\n /**\n * Specifies the {@link ErrorPolicy} to be used for this operation\n */\n errorPolicy?: ErrorPolicy;\n\n /**\n * An object that maps from the name of a variable as used in the mutation\n * GraphQL document to that variable's value.\n */\n variables?: TVariables;\n\n /**\n * The context to be passed to the link execution chain. This context will\n * only be used with this mutation. It will not be used with\n * `refetchQueries`. Refetched queries use the context they were\n * initialized with (since the initial context is stored as part of the\n * `ObservableQuery` instance). If a specific context is needed when\n * refetching queries, make sure it is configured (via the\n * [query `context` option](https://www.apollographql.com/docs/react/api/apollo-client#ApolloClient.query))\n * when the query is first initialized/run.\n */\n context?: TContext;\n}\n\nexport interface MutationOptions<\n TData = any,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache<any> = ApolloCache<any>,\n> extends MutationBaseOptions<TData, TVariables, TContext, TCache> {\n /**\n * A GraphQL document, often created with `gql` from the `graphql-tag`\n * package, that contains a single mutation inside of it.\n */\n mutation: DocumentNode | TypedDocumentNode<TData, TVariables>;\n\n /**\n * Specifies the {@link MutationFetchPolicy} to be used for this query.\n * Mutations support only 'network-only' and 'no-cache' fetchPolicy strings.\n * If fetchPolicy is not provided, it defaults to 'network-only'.\n */\n fetchPolicy?: MutationFetchPolicy;\n\n /**\n * To avoid retaining sensitive information from mutation root field\n * arguments, Apollo Client v3.4+ automatically clears any `ROOT_MUTATION`\n * fields from the cache after each mutation finishes. If you need this\n * information to remain in the cache, you can prevent the removal by passing\n * `keepRootFields: true` to the mutation. `ROOT_MUTATION` result data are\n * also passed to the mutation `update` function, so we recommend obtaining\n * the results that way, rather than using this option, if possible.\n */\n keepRootFields?: boolean;\n}\n"]}
@@ -5,7 +5,7 @@
5
5
  // consult the @apollo/client/invariantErrorCodes.js file specific to
6
6
  // your @apollo/client version. This file is not meant to be imported.
7
7
  {
8
- "@apollo/client version": "3.7.2",
8
+ "@apollo/client version": "3.8.0-alpha.0",
9
9
 
10
10
  1: {
11
11
  file: "@apollo/client/cache/inmemory/entityStore.js",
@@ -189,6 +189,18 @@
189
189
  },
190
190
 
191
191
  32: {
192
+ file: "@apollo/client/react/hooks/useSuspenseCache.js",
193
+
194
+ node: invariant(suspenseCache, 'Could not find a "suspenseCache" in the context. Wrap the root component ' +
195
+ 'in an <ApolloProvider> and provide a suspenseCache.')
196
+ },
197
+
198
+ 33: {
199
+ file: "@apollo/client/react/hooks/useSuspenseQuery.js",
200
+ node: invariant(SUPPORTED_FETCH_POLICIES.includes(fetchPolicy), "The fetch policy `".concat(fetchPolicy, "` is not supported with suspense."))
201
+ },
202
+
203
+ 34: {
192
204
  file: "@apollo/client/react/parser/index.js",
193
205
 
194
206
  node: invariant(!!document && !!document.kind, "Argument of ".concat(document, " passed to parser was not a valid GraphQL ") +
@@ -196,7 +208,7 @@
196
208
  "to convert your operation into a document")
197
209
  },
198
210
 
199
- 33: {
211
+ 35: {
200
212
  file: "@apollo/client/react/parser/index.js",
201
213
 
202
214
  node: invariant(!fragments.length ||
@@ -204,7 +216,7 @@
204
216
  "You must include a query, subscription or mutation as well")
205
217
  },
206
218
 
207
- 34: {
219
+ 36: {
208
220
  file: "@apollo/client/react/parser/index.js",
209
221
 
210
222
  node: invariant(queries.length + mutations.length + subscriptions.length <= 1, "react-apollo only supports a query, subscription, or a mutation per HOC. " +
@@ -213,7 +225,7 @@
213
225
  "You can use 'compose' to join multiple operation types to a component")
214
226
  },
215
227
 
216
- 35: {
228
+ 37: {
217
229
  file: "@apollo/client/react/parser/index.js",
218
230
 
219
231
  node: invariant(definitions.length === 1, "react-apollo only supports one definition per HOC. ".concat(document, " had ") +
@@ -221,103 +233,103 @@
221
233
  "You can use 'compose' to join multiple operation types to a component")
222
234
  },
223
235
 
224
- 36: {
236
+ 38: {
225
237
  file: "@apollo/client/react/parser/index.js",
226
238
 
227
239
  node: invariant(operation.type === type, "Running a ".concat(requiredOperationName, " requires a graphql ") +
228
240
  "".concat(requiredOperationName, ", but a ").concat(usedOperationName, " was used instead."))
229
241
  },
230
242
 
231
- 37: {
243
+ 39: {
232
244
  file: "@apollo/client/testing/core/mocking/mockLink.js",
233
245
  node: invariant(queryWithoutConnection, "query is required")
234
246
  },
235
247
 
236
- 38: {
248
+ 40: {
237
249
  file: "@apollo/client/utilities/globals/index.js",
238
250
  node: invariant("boolean" === typeof DEV, DEV)
239
251
  },
240
252
 
241
- 39: {
253
+ 41: {
242
254
  file: "@apollo/client/utilities/graphql/directives.js",
243
255
  node: invariant(evaledValue !== void 0, "Invalid variable referenced in @".concat(directive.name.value, " directive."))
244
256
  },
245
257
 
246
- 40: {
258
+ 42: {
247
259
  file: "@apollo/client/utilities/graphql/directives.js",
248
260
  node: invariant(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @".concat(directiveName, " directive."))
249
261
  },
250
262
 
251
- 41: {
263
+ 43: {
252
264
  file: "@apollo/client/utilities/graphql/directives.js",
253
265
  node: invariant(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @".concat(directiveName, " directive."))
254
266
  },
255
267
 
256
- 42: {
268
+ 44: {
257
269
  file: "@apollo/client/utilities/graphql/directives.js",
258
270
 
259
271
  node: invariant(ifValue &&
260
272
  (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), "Argument for the @".concat(directiveName, " directive must be a variable or a boolean value."))
261
273
  },
262
274
 
263
- 43: {
275
+ 45: {
264
276
  file: "@apollo/client/utilities/graphql/fragments.js",
265
277
 
266
278
  node: new InvariantError("Found a ".concat(definition.operation, " operation").concat(definition.name ? " named '".concat(definition.name.value, "'") : '', ". ") +
267
279
  'No operations are allowed when using a fragment as a query. Only fragments are allowed.')
268
280
  },
269
281
 
270
- 44: {
282
+ 46: {
271
283
  file: "@apollo/client/utilities/graphql/fragments.js",
272
284
  node: invariant(fragments.length === 1, "Found ".concat(fragments.length, " fragments. `fragmentName` must be provided when there is not exactly 1 fragment."))
273
285
  },
274
286
 
275
- 45: {
287
+ 47: {
276
288
  file: "@apollo/client/utilities/graphql/fragments.js",
277
289
  node: invariant(fragment, "No fragment named ".concat(fragmentName))
278
290
  },
279
291
 
280
- 46: {
292
+ 48: {
281
293
  file: "@apollo/client/utilities/graphql/getFromAST.js",
282
294
  node: invariant(doc && doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql")
283
295
  },
284
296
 
285
- 47: {
297
+ 49: {
286
298
  file: "@apollo/client/utilities/graphql/getFromAST.js",
287
299
  node: new InvariantError("Schema type definitions not allowed in queries. Found: \"".concat(definition.kind, "\""))
288
300
  },
289
301
 
290
- 48: {
302
+ 50: {
291
303
  file: "@apollo/client/utilities/graphql/getFromAST.js",
292
304
  node: invariant(operations.length <= 1, "Ambiguous GraphQL document: contains ".concat(operations.length, " operations"))
293
305
  },
294
306
 
295
- 49: {
307
+ 51: {
296
308
  file: "@apollo/client/utilities/graphql/getFromAST.js",
297
309
  node: invariant(queryDef && queryDef.operation === 'query', 'Must contain a query definition.')
298
310
  },
299
311
 
300
- 50: {
312
+ 52: {
301
313
  file: "@apollo/client/utilities/graphql/getFromAST.js",
302
314
  node: invariant(doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql")
303
315
  },
304
316
 
305
- 51: {
317
+ 53: {
306
318
  file: "@apollo/client/utilities/graphql/getFromAST.js",
307
319
  node: invariant(doc.definitions.length <= 1, 'Fragment must have exactly one definition.')
308
320
  },
309
321
 
310
- 52: {
322
+ 54: {
311
323
  file: "@apollo/client/utilities/graphql/getFromAST.js",
312
324
  node: invariant(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.')
313
325
  },
314
326
 
315
- 53: {
327
+ 55: {
316
328
  file: "@apollo/client/utilities/graphql/getFromAST.js",
317
329
  node: new InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.')
318
330
  },
319
331
 
320
- 54: {
332
+ 56: {
321
333
  file: "@apollo/client/utilities/graphql/storeUtils.js",
322
334
 
323
335
  node: new InvariantError("The inline argument \"".concat(name.value, "\" of kind \"").concat(value.kind, "\"") +
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apollo/client",
3
- "version": "3.7.2",
3
+ "version": "3.8.0-alpha.0",
4
4
  "description": "A fully-featured caching GraphQL client.",
5
5
  "private": false,
6
6
  "keywords": [
@@ -67,8 +67,11 @@
67
67
  },
68
68
  "devDependencies": {
69
69
  "@babel/parser": "7.20.5",
70
+ "@changesets/changelog-github": "0.4.7",
71
+ "@changesets/cli": "2.25.2",
70
72
  "@graphql-tools/schema": "9.0.10",
71
73
  "@rollup/plugin-node-resolve": "11.2.1",
74
+ "@testing-library/jest-dom": "^5.16.5",
72
75
  "@testing-library/react": "13.4.0",
73
76
  "@testing-library/react-12": "npm:@testing-library/react@^12",
74
77
  "@testing-library/react-hooks": "8.0.1",
@@ -80,7 +83,7 @@
80
83
  "@types/hoist-non-react-statics": "3.3.1",
81
84
  "@types/jest": "29.2.3",
82
85
  "@types/lodash": "4.14.191",
83
- "@types/node": "16.18.4",
86
+ "@types/node": "18.11.11",
84
87
  "@types/node-fetch": "2.6.2",
85
88
  "@types/react": "18.0.26",
86
89
  "@types/react-dom": "18.0.9",
@@ -95,12 +98,15 @@
95
98
  "graphql-ws": "5.11.2",
96
99
  "jest": "29.3.1",
97
100
  "jest-environment-jsdom": "29.3.1",
98
- "jest-junit": "14.0.1",
101
+ "jest-junit": "15.0.0",
99
102
  "lodash": "4.17.21",
103
+ "patch-package": "6.5.0",
104
+ "prettier": "2.7.1",
100
105
  "react": "18.2.0",
101
106
  "react-17": "npm:react@^17",
102
107
  "react-dom": "18.2.0",
103
108
  "react-dom-17": "npm:react-dom@^17",
109
+ "react-error-boundary": "^3.1.4",
104
110
  "recast": "0.21.5",
105
111
  "resolve": "1.22.1",
106
112
  "rimraf": "3.0.2",
@@ -120,5 +126,13 @@
120
126
  "publishConfig": {
121
127
  "access": "public"
122
128
  },
129
+ "prettier": {
130
+ "bracketSpacing": true,
131
+ "printWidth": 80,
132
+ "semi": true,
133
+ "singleQuote": true,
134
+ "tabWidth": 2,
135
+ "trailingComma": "es5"
136
+ },
123
137
  "type": "module"
124
138
  }
@@ -0,0 +1,18 @@
1
+ import { ApolloQueryResult, DocumentNode, ObservableQuery, OperationVariables, TypedDocumentNode } from '../../core';
2
+ interface CacheEntry<TData, TVariables> {
3
+ observable: ObservableQuery<TData, TVariables>;
4
+ fulfilled: boolean;
5
+ promise: Promise<ApolloQueryResult<TData>>;
6
+ }
7
+ export declare class SuspenseCache {
8
+ private queries;
9
+ add<TData = any, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, variables: TVariables | undefined, { promise, observable, }: {
10
+ promise: Promise<any>;
11
+ observable: ObservableQuery<TData, TVariables>;
12
+ }): CacheEntry<TData, TVariables>;
13
+ lookup<TData = any, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, variables: TVariables | undefined): CacheEntry<TData, TVariables> | undefined;
14
+ remove(query: DocumentNode, variables: OperationVariables | undefined): void;
15
+ private getVariablesKey;
16
+ }
17
+ export {};
18
+ //# sourceMappingURL=SuspenseCache.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SuspenseCache.d.ts","sourceRoot":"","sources":["../../../src/react/cache/SuspenseCache.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,YAAY,CAAC;AAGpB,UAAU,UAAU,CAAC,KAAK,EAAE,UAAU;IACpC,UAAU,EAAE,eAAe,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;IAC/C,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC;CAC5C;AAED,qBAAa,aAAa;IACxB,OAAO,CAAC,OAAO,CAGX;IAEJ,GAAG,CAAC,KAAK,GAAG,GAAG,EAAE,UAAU,SAAS,kBAAkB,GAAG,kBAAkB,EACzE,KAAK,EAAE,YAAY,GAAG,iBAAiB,CAAC,KAAK,EAAE,UAAU,CAAC,EAC1D,SAAS,EAAE,UAAU,GAAG,SAAS,EACjC,EACE,OAAO,EACP,UAAU,GACX,EAAE;QAAE,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;QAAC,UAAU,EAAE,eAAe,CAAC,KAAK,EAAE,UAAU,CAAC,CAAA;KAAE;IAyB9E,MAAM,CACJ,KAAK,GAAG,GAAG,EACX,UAAU,SAAS,kBAAkB,GAAG,kBAAkB,EAE1D,KAAK,EAAE,YAAY,GAAG,iBAAiB,CAAC,KAAK,EAAE,UAAU,CAAC,EAC1D,SAAS,EAAE,UAAU,GAAG,SAAS,GAChC,UAAU,CAAC,KAAK,EAAE,UAAU,CAAC,GAAG,SAAS;IAM5C,MAAM,CAAC,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,kBAAkB,GAAG,SAAS;IAmBrE,OAAO,CAAC,eAAe;CAGxB"}
@@ -0,0 +1,49 @@
1
+ import { canonicalStringify } from "../../cache/index.js";
2
+ var SuspenseCache = (function () {
3
+ function SuspenseCache() {
4
+ this.queries = new Map();
5
+ }
6
+ SuspenseCache.prototype.add = function (query, variables, _a) {
7
+ var promise = _a.promise, observable = _a.observable;
8
+ var variablesKey = this.getVariablesKey(variables);
9
+ var map = this.queries.get(query) || new Map();
10
+ var entry = {
11
+ observable: observable,
12
+ fulfilled: false,
13
+ promise: promise
14
+ .catch(function () {
15
+ })
16
+ .finally(function () {
17
+ entry.fulfilled = true;
18
+ }),
19
+ };
20
+ map.set(variablesKey, entry);
21
+ this.queries.set(query, map);
22
+ return entry;
23
+ };
24
+ SuspenseCache.prototype.lookup = function (query, variables) {
25
+ var _a;
26
+ return (_a = this.queries
27
+ .get(query)) === null || _a === void 0 ? void 0 : _a.get(this.getVariablesKey(variables));
28
+ };
29
+ SuspenseCache.prototype.remove = function (query, variables) {
30
+ var map = this.queries.get(query);
31
+ if (!map) {
32
+ return;
33
+ }
34
+ var key = this.getVariablesKey(variables);
35
+ var entry = map.get(key);
36
+ if (entry && !entry.observable.hasObservers()) {
37
+ map.delete(key);
38
+ }
39
+ if (map.size === 0) {
40
+ this.queries.delete(query);
41
+ }
42
+ };
43
+ SuspenseCache.prototype.getVariablesKey = function (variables) {
44
+ return canonicalStringify(variables || Object.create(null));
45
+ };
46
+ return SuspenseCache;
47
+ }());
48
+ export { SuspenseCache };
49
+ //# sourceMappingURL=SuspenseCache.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SuspenseCache.js","sourceRoot":"","sources":["../../../src/react/cache/SuspenseCache.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAQjD;IAAA;QACU,YAAO,GAAG,IAAI,GAAG,EAGtB,CAAC;IAmEN,CAAC;IAjEC,2BAAG,GAAH,UACE,KAA0D,EAC1D,SAAiC,EACjC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,IAAI,GAAG,CAAC,IAAI,KAAK,CAAC,EAAE;YAClB,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;SAC5B;IACH,CAAC;IAEO,uCAAe,GAAvB,UAAwB,SAAyC;QAC/D,OAAO,kBAAkB,CAAC,SAAS,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IAC9D,CAAC;IACH,oBAAC;AAAD,CAAC,AAvED,IAuEC","sourcesContent":["import {\n ApolloQueryResult,\n DocumentNode,\n ObservableQuery,\n OperationVariables,\n TypedDocumentNode,\n} from '../../core';\nimport { canonicalStringify } from '../../cache';\n\ninterface CacheEntry<TData, TVariables> {\n observable: ObservableQuery<TData, TVariables>;\n fulfilled: boolean;\n promise: Promise<ApolloQueryResult<TData>>;\n}\n\nexport class SuspenseCache {\n private queries = new Map<\n DocumentNode,\n Map<string, CacheEntry<unknown, unknown>>\n >();\n\n add<TData = any, TVariables extends OperationVariables = OperationVariables>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n variables: TVariables | undefined,\n {\n promise,\n observable,\n }: { promise: Promise<any>; observable: ObservableQuery<TData, TVariables> }\n ) {\n const variablesKey = this.getVariablesKey(variables);\n const map = this.queries.get(query) || new Map();\n\n const entry: CacheEntry<TData, TVariables> = {\n observable,\n fulfilled: false,\n promise: promise\n .catch(() => {\n // Throw away the error as we only care to track when the promise has\n // been fulfilled\n })\n .finally(() => {\n entry.fulfilled = true;\n }),\n };\n\n map.set(variablesKey, entry);\n\n this.queries.set(query, map);\n\n return entry;\n }\n\n lookup<\n TData = any,\n TVariables extends OperationVariables = OperationVariables\n >(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n variables: TVariables | undefined\n ): CacheEntry<TData, TVariables> | undefined {\n return this.queries\n .get(query)\n ?.get(this.getVariablesKey(variables)) as CacheEntry<TData, TVariables>;\n }\n\n remove(query: DocumentNode, variables: OperationVariables | undefined) {\n const map = this.queries.get(query);\n\n if (!map) {\n return;\n }\n\n const key = this.getVariablesKey(variables);\n const entry = map.get(key);\n\n if (entry && !entry.observable.hasObservers()) {\n map.delete(key);\n }\n\n if (map.size === 0) {\n this.queries.delete(query);\n }\n }\n\n private getVariablesKey(variables: OperationVariables | undefined) {\n return canonicalStringify(variables || Object.create(null));\n }\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export { SuspenseCache } from './SuspenseCache';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/react/cache/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { SuspenseCache } from "./SuspenseCache.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/react/cache/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC","sourcesContent":["export { SuspenseCache } from './SuspenseCache';\n"]}
@@ -1,9 +1,11 @@
1
1
  import * as React from 'react';
2
2
  import { ApolloClient } from '../../core';
3
+ import { SuspenseCache } from '../cache';
3
4
  import type { RenderPromises } from '../ssr';
4
5
  export interface ApolloContextValue {
5
6
  client?: ApolloClient<object>;
6
7
  renderPromises?: RenderPromises;
8
+ suspenseCache?: SuspenseCache;
7
9
  }
8
10
  export declare function getApolloContext(): React.Context<ApolloContextValue>;
9
11
  export { getApolloContext as resetApolloContext };
@@ -1 +1 @@
1
- {"version":3,"file":"ApolloContext.d.ts","sourceRoot":"","sources":["../../../src/react/context/ApolloContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAE7C,MAAM,WAAW,kBAAkB;IACjC,MAAM,CAAC,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;IAC9B,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC;AAUD,wBAAgB,gBAAgB,IAAI,KAAK,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAYpE;AAED,OAAO,EAAE,gBAAgB,IAAI,kBAAkB,EAAE,CAAA"}
1
+ {"version":3,"file":"ApolloContext.d.ts","sourceRoot":"","sources":["../../../src/react/context/ApolloContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAE7C,MAAM,WAAW,kBAAkB;IACjC,MAAM,CAAC,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;IAC9B,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,aAAa,CAAC,EAAE,aAAa,CAAC;CAC/B;AAUD,wBAAgB,gBAAgB,IAAI,KAAK,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAYpE;AAED,OAAO,EAAE,gBAAgB,IAAI,kBAAkB,EAAE,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"ApolloContext.js","sourceRoot":"","sources":["../../../src/react/context/ApolloContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAY/C,IAAM,UAAU,GAAG,YAAY;IAC7B,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,oBAAoB,CAAC;IAClC,CAAC,CAAC,oBAAoB,CAAC;AAEzB,MAAM,UAAU,gBAAgB;IAC9B,IAAI,OAAO,GAAI,KAAK,CAAC,aAAqB,CAAC,UAAU,CAAsC,CAAC;IAC5F,IAAI,CAAC,OAAO,EAAE;QACZ,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,aAAa,EAAE,UAAU,EAAE;YACrD,KAAK,EAAE,OAAO,GAAG,KAAK,CAAC,aAAa,CAAqB,EAAE,CAAC;YAC5D,UAAU,EAAE,KAAK;YACjB,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,IAAI;SACnB,CAAC,CAAC;QACH,OAAO,CAAC,WAAW,GAAG,eAAe,CAAC;KACvC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,OAAO,EAAE,gBAAgB,IAAI,kBAAkB,EAAE,CAAA","sourcesContent":["import * as React from 'react';\nimport { ApolloClient } from '../../core';\nimport { canUseSymbol } from '../../utilities';\nimport type { RenderPromises } from '../ssr';\n\nexport interface ApolloContextValue {\n client?: ApolloClient<object>;\n renderPromises?: RenderPromises;\n}\n\n// To make sure Apollo Client doesn't create more than one React context\n// (which can lead to problems like having an Apollo Client instance added\n// in one context, then attempting to retrieve it from another different\n// context), a single Apollo context is created and tracked in global state.\nconst contextKey = canUseSymbol\n ? Symbol.for('__APOLLO_CONTEXT__')\n : '__APOLLO_CONTEXT__';\n\nexport function getApolloContext(): React.Context<ApolloContextValue> {\n let context = (React.createContext as any)[contextKey] as React.Context<ApolloContextValue>;\n if (!context) {\n Object.defineProperty(React.createContext, contextKey, {\n value: context = React.createContext<ApolloContextValue>({}),\n enumerable: false,\n writable: false,\n configurable: true,\n });\n context.displayName = 'ApolloContext';\n }\n return context;\n}\n\nexport { getApolloContext as resetApolloContext }\n"]}
1
+ {"version":3,"file":"ApolloContext.js","sourceRoot":"","sources":["../../../src/react/context/ApolloContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAc/C,IAAM,UAAU,GAAG,YAAY;IAC7B,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,oBAAoB,CAAC;IAClC,CAAC,CAAC,oBAAoB,CAAC;AAEzB,MAAM,UAAU,gBAAgB;IAC9B,IAAI,OAAO,GAAI,KAAK,CAAC,aAAqB,CAAC,UAAU,CAAsC,CAAC;IAC5F,IAAI,CAAC,OAAO,EAAE;QACZ,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,aAAa,EAAE,UAAU,EAAE;YACrD,KAAK,EAAE,OAAO,GAAG,KAAK,CAAC,aAAa,CAAqB,EAAE,CAAC;YAC5D,UAAU,EAAE,KAAK;YACjB,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,IAAI;SACnB,CAAC,CAAC;QACH,OAAO,CAAC,WAAW,GAAG,eAAe,CAAC;KACvC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,OAAO,EAAE,gBAAgB,IAAI,kBAAkB,EAAE,CAAA","sourcesContent":["import * as React from 'react';\nimport { ApolloClient } from '../../core';\nimport { canUseSymbol } from '../../utilities';\nimport { SuspenseCache } from '../cache';\nimport type { RenderPromises } from '../ssr';\n\nexport interface ApolloContextValue {\n client?: ApolloClient<object>;\n renderPromises?: RenderPromises;\n suspenseCache?: SuspenseCache;\n}\n\n// To make sure Apollo Client doesn't create more than one React context\n// (which can lead to problems like having an Apollo Client instance added\n// in one context, then attempting to retrieve it from another different\n// context), a single Apollo context is created and tracked in global state.\nconst contextKey = canUseSymbol\n ? Symbol.for('__APOLLO_CONTEXT__')\n : '__APOLLO_CONTEXT__';\n\nexport function getApolloContext(): React.Context<ApolloContextValue> {\n let context = (React.createContext as any)[contextKey] as React.Context<ApolloContextValue>;\n if (!context) {\n Object.defineProperty(React.createContext, contextKey, {\n value: context = React.createContext<ApolloContextValue>({}),\n enumerable: false,\n writable: false,\n configurable: true,\n });\n context.displayName = 'ApolloContext';\n }\n return context;\n}\n\nexport { getApolloContext as resetApolloContext }\n"]}
@@ -1,7 +1,9 @@
1
1
  import * as React from 'react';
2
2
  import { ApolloClient } from '../../core';
3
+ import { SuspenseCache } from '../cache';
3
4
  export interface ApolloProviderProps<TCache> {
4
5
  client: ApolloClient<TCache>;
6
+ suspenseCache?: SuspenseCache;
5
7
  children: React.ReactNode | React.ReactNode[] | null;
6
8
  }
7
9
  export declare const ApolloProvider: React.FC<ApolloProviderProps<any>>;
@@ -1 +1 @@
1
- {"version":3,"file":"ApolloProvider.d.ts","sourceRoot":"","sources":["../../../src/react/context/ApolloProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG1C,MAAM,WAAW,mBAAmB,CAAC,MAAM;IACzC,MAAM,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;IAC7B,QAAQ,EAAE,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,EAAE,GAAG,IAAI,CAAC;CACtD;AAED,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAAC,GAAG,CAAC,CA0B7D,CAAC"}
1
+ {"version":3,"file":"ApolloProvider.d.ts","sourceRoot":"","sources":["../../../src/react/context/ApolloProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,WAAW,mBAAmB,CAAC,MAAM;IACzC,MAAM,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;IAC7B,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,QAAQ,EAAE,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,EAAE,GAAG,IAAI,CAAC;CACtD;AAED,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAAC,GAAG,CAAC,CA+B7D,CAAC"}
@@ -2,13 +2,16 @@ import { invariant } from "../../utilities/globals/index.js";
2
2
  import * as React from 'react';
3
3
  import { getApolloContext } from "./ApolloContext.js";
4
4
  export var ApolloProvider = function (_a) {
5
- var client = _a.client, children = _a.children;
5
+ var client = _a.client, suspenseCache = _a.suspenseCache, children = _a.children;
6
6
  var ApolloContext = getApolloContext();
7
7
  return (React.createElement(ApolloContext.Consumer, null, function (context) {
8
8
  if (context === void 0) { context = {}; }
9
9
  if (client && context.client !== client) {
10
10
  context = Object.assign({}, context, { client: client });
11
11
  }
12
+ if (suspenseCache) {
13
+ context = Object.assign({}, context, { suspenseCache: suspenseCache });
14
+ }
12
15
  __DEV__ ? invariant(context.client, 'ApolloProvider was not passed a client instance. Make ' +
13
16
  'sure you pass in your client via the "client" prop.') : invariant(context.client, 28);
14
17
  return (React.createElement(ApolloContext.Provider, { value: context }, children));
@@ -1 +1 @@
1
- {"version":3,"file":"ApolloProvider.js","sourceRoot":"","sources":["../../../src/react/context/ApolloProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAOnD,MAAM,CAAC,IAAM,cAAc,GAAuC,UAAC,EAGlE;QAFC,MAAM,YAAA,EACN,QAAQ,cAAA;IAER,IAAM,aAAa,GAAG,gBAAgB,EAAE,CAAC;IACzC,OAAO,CACL,oBAAC,aAAa,CAAC,QAAQ,QACpB,UAAC,OAAiB;QAAjB,wBAAA,EAAA,YAAiB;QACjB,IAAI,MAAM,IAAI,OAAO,CAAC,MAAM,KAAK,MAAM,EAAE;YACvC,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,MAAM,QAAA,EAAE,CAAC,CAAC;SAClD;QAED,SAAS,CACP,OAAO,CAAC,MAAM,EACd,wDAAwD;YACtD,qDAAqD,CACxD,CAAC;QAEF,OAAO,CACL,oBAAC,aAAa,CAAC,QAAQ,IAAC,KAAK,EAAE,OAAO,IACnC,QAAQ,CACc,CAC1B,CAAC;IACJ,CAAC,CACsB,CAC1B,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { invariant } from '../../utilities/globals';\n\nimport * as React from 'react';\n\nimport { ApolloClient } from '../../core';\nimport { getApolloContext } from './ApolloContext';\n\nexport interface ApolloProviderProps<TCache> {\n client: ApolloClient<TCache>;\n children: React.ReactNode | React.ReactNode[] | null;\n}\n\nexport const ApolloProvider: React.FC<ApolloProviderProps<any>> = ({\n client,\n children\n}) => {\n const ApolloContext = getApolloContext();\n return (\n <ApolloContext.Consumer>\n {(context: any = {}) => {\n if (client && context.client !== client) {\n context = Object.assign({}, context, { client });\n }\n\n invariant(\n context.client,\n 'ApolloProvider was not passed a client instance. Make ' +\n 'sure you pass in your client via the \"client\" prop.'\n );\n\n return (\n <ApolloContext.Provider value={context}>\n {children}\n </ApolloContext.Provider>\n );\n }}\n </ApolloContext.Consumer>\n );\n};\n"]}
1
+ {"version":3,"file":"ApolloProvider.js","sourceRoot":"","sources":["../../../src/react/context/ApolloProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AASnD,MAAM,CAAC,IAAM,cAAc,GAAuC,UAAC,EAIlE;QAHC,MAAM,YAAA,EACN,aAAa,mBAAA,EACb,QAAQ,cAAA;IAER,IAAM,aAAa,GAAG,gBAAgB,EAAE,CAAC;IACzC,OAAO,CACL,oBAAC,aAAa,CAAC,QAAQ,QACpB,UAAC,OAAiB;QAAjB,wBAAA,EAAA,YAAiB;QACjB,IAAI,MAAM,IAAI,OAAO,CAAC,MAAM,KAAK,MAAM,EAAE;YACvC,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,MAAM,QAAA,EAAE,CAAC,CAAC;SAClD;QAED,IAAI,aAAa,EAAE;YACjB,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,aAAa,eAAA,EAAE,CAAC,CAAC;SACzD;QAED,SAAS,CACP,OAAO,CAAC,MAAM,EACd,wDAAwD;YACtD,qDAAqD,CACxD,CAAC;QAEF,OAAO,CACL,oBAAC,aAAa,CAAC,QAAQ,IAAC,KAAK,EAAE,OAAO,IACnC,QAAQ,CACc,CAC1B,CAAC;IACJ,CAAC,CACsB,CAC1B,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { invariant } from '../../utilities/globals';\n\nimport * as React from 'react';\n\nimport { ApolloClient } from '../../core';\nimport { getApolloContext } from './ApolloContext';\nimport { SuspenseCache } from '../cache';\n\nexport interface ApolloProviderProps<TCache> {\n client: ApolloClient<TCache>;\n suspenseCache?: SuspenseCache;\n children: React.ReactNode | React.ReactNode[] | null;\n}\n\nexport const ApolloProvider: React.FC<ApolloProviderProps<any>> = ({\n client,\n suspenseCache,\n children\n}) => {\n const ApolloContext = getApolloContext();\n return (\n <ApolloContext.Consumer>\n {(context: any = {}) => {\n if (client && context.client !== client) {\n context = Object.assign({}, context, { client });\n }\n\n if (suspenseCache) {\n context = Object.assign({}, context, { suspenseCache });\n }\n\n invariant(\n context.client,\n 'ApolloProvider was not passed a client instance. Make ' +\n 'sure you pass in your client via the \"client\" prop.'\n );\n\n return (\n <ApolloContext.Provider value={context}>\n {children}\n </ApolloContext.Provider>\n );\n }}\n </ApolloContext.Consumer>\n );\n};\n"]}
@@ -47,13 +47,16 @@ var ApolloConsumer = function (props) {
47
47
  };
48
48
 
49
49
  var ApolloProvider = function (_a) {
50
- var client = _a.client, children = _a.children;
50
+ var client = _a.client, suspenseCache = _a.suspenseCache, children = _a.children;
51
51
  var ApolloContext = getApolloContext();
52
52
  return (React__namespace.createElement(ApolloContext.Consumer, null, function (context) {
53
53
  if (context === void 0) { context = {}; }
54
54
  if (client && context.client !== client) {
55
55
  context = Object.assign({}, context, { client: client });
56
56
  }
57
+ if (suspenseCache) {
58
+ context = Object.assign({}, context, { suspenseCache: suspenseCache });
59
+ }
57
60
  __DEV__ ? globals.invariant(context.client, 'ApolloProvider was not passed a client instance. Make ' +
58
61
  'sure you pass in your client via the "client" prop.') : globals.invariant(context.client, 28);
59
62
  return (React__namespace.createElement(ApolloContext.Provider, { value: context }, children));
@@ -1 +1 @@
1
- {"version":3,"file":"context.cjs","sources":["ApolloContext.js","ApolloConsumer.js","ApolloProvider.js"],"sourcesContent":["import * as React from 'react';\nimport { canUseSymbol } from '../../utilities';\nvar contextKey = canUseSymbol\n ? Symbol.for('__APOLLO_CONTEXT__')\n : '__APOLLO_CONTEXT__';\nexport function getApolloContext() {\n var context = React.createContext[contextKey];\n if (!context) {\n Object.defineProperty(React.createContext, contextKey, {\n value: context = React.createContext({}),\n enumerable: false,\n writable: false,\n configurable: true,\n });\n context.displayName = 'ApolloContext';\n }\n return context;\n}\nexport { getApolloContext as resetApolloContext };\n//# sourceMappingURL=ApolloContext.js.map","import { invariant } from '../../utilities/globals';\nimport * as React from 'react';\nimport { getApolloContext } from './ApolloContext';\nexport var ApolloConsumer = function (props) {\n var ApolloContext = getApolloContext();\n return (React.createElement(ApolloContext.Consumer, null, function (context) {\n __DEV__ ? invariant(context && context.client, 'Could not find \"client\" in the context of ApolloConsumer. ' +\n 'Wrap the root component in an <ApolloProvider>.') : invariant(context && context.client, 27);\n return props.children(context.client);\n }));\n};\n//# sourceMappingURL=ApolloConsumer.js.map","import { invariant } from '../../utilities/globals';\nimport * as React from 'react';\nimport { getApolloContext } from './ApolloContext';\nexport var ApolloProvider = function (_a) {\n var client = _a.client, children = _a.children;\n var ApolloContext = getApolloContext();\n return (React.createElement(ApolloContext.Consumer, null, function (context) {\n if (context === void 0) { context = {}; }\n if (client && context.client !== client) {\n context = Object.assign({}, context, { client: client });\n }\n __DEV__ ? invariant(context.client, 'ApolloProvider was not passed a client instance. Make ' +\n 'sure you pass in your client via the \"client\" prop.') : invariant(context.client, 28);\n return (React.createElement(ApolloContext.Provider, { value: context }, children));\n }));\n};\n//# sourceMappingURL=ApolloProvider.js.map"],"names":["canUseSymbol","React","invariant"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAEA,IAAI,UAAU,GAAGA,sBAAY;AAC7B,MAAM,MAAM,CAAC,GAAG,CAAC,oBAAoB,CAAC;AACtC,MAAM,oBAAoB,CAAC;AACpB,SAAS,gBAAgB,GAAG;AACnC,IAAI,IAAI,OAAO,GAAGC,gBAAK,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;AAClD,IAAI,IAAI,CAAC,OAAO,EAAE;AAClB,QAAQ,MAAM,CAAC,cAAc,CAACA,gBAAK,CAAC,aAAa,EAAE,UAAU,EAAE;AAC/D,YAAY,KAAK,EAAE,OAAO,GAAGA,gBAAK,CAAC,aAAa,CAAC,EAAE,CAAC;AACpD,YAAY,UAAU,EAAE,KAAK;AAC7B,YAAY,QAAQ,EAAE,KAAK;AAC3B,YAAY,YAAY,EAAE,IAAI;AAC9B,SAAS,CAAC,CAAC;AACX,QAAQ,OAAO,CAAC,WAAW,GAAG,eAAe,CAAC;AAC9C,KAAK;AACL,IAAI,OAAO,OAAO,CAAC;AACnB;;ACdU,IAAC,cAAc,GAAG,UAAU,KAAK,EAAE;AAC7C,IAAI,IAAI,aAAa,GAAG,gBAAgB,EAAE,CAAC;AAC3C,IAAI,QAAQA,gBAAK,CAAC,aAAa,CAAC,aAAa,CAAC,QAAQ,EAAE,IAAI,EAAE,UAAU,OAAO,EAAE;AACjF,QAAQ,OAAO,GAAGC,iBAAS,CAAC,OAAO,IAAI,OAAO,CAAC,MAAM,EAAE,4DAA4D;AACnH,YAAY,iDAAiD,CAAC,GAAGA,iBAAS,CAAC,OAAO,IAAI,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AAC1G,QAAQ,OAAO,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AAC9C,KAAK,CAAC,EAAE;AACR;;ACPU,IAAC,cAAc,GAAG,UAAU,EAAE,EAAE;AAC1C,IAAI,IAAI,MAAM,GAAG,EAAE,CAAC,MAAM,EAAE,QAAQ,GAAG,EAAE,CAAC,QAAQ,CAAC;AACnD,IAAI,IAAI,aAAa,GAAG,gBAAgB,EAAE,CAAC;AAC3C,IAAI,QAAQD,gBAAK,CAAC,aAAa,CAAC,aAAa,CAAC,QAAQ,EAAE,IAAI,EAAE,UAAU,OAAO,EAAE;AACjF,QAAQ,IAAI,OAAO,KAAK,KAAK,CAAC,EAAE,EAAE,OAAO,GAAG,EAAE,CAAC,EAAE;AACjD,QAAQ,IAAI,MAAM,IAAI,OAAO,CAAC,MAAM,KAAK,MAAM,EAAE;AACjD,YAAY,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;AACrE,SAAS;AACT,QAAQ,OAAO,GAAGC,iBAAS,CAAC,OAAO,CAAC,MAAM,EAAE,wDAAwD;AACpG,YAAY,qDAAqD,CAAC,GAAGA,iBAAS,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AACnG,QAAQ,QAAQD,gBAAK,CAAC,aAAa,CAAC,aAAa,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,QAAQ,CAAC,EAAE;AAC3F,KAAK,CAAC,EAAE;AACR;;;;;;;"}
1
+ {"version":3,"file":"context.cjs","sources":["ApolloContext.js","ApolloConsumer.js","ApolloProvider.js"],"sourcesContent":["import * as React from 'react';\nimport { canUseSymbol } from '../../utilities';\nvar contextKey = canUseSymbol\n ? Symbol.for('__APOLLO_CONTEXT__')\n : '__APOLLO_CONTEXT__';\nexport function getApolloContext() {\n var context = React.createContext[contextKey];\n if (!context) {\n Object.defineProperty(React.createContext, contextKey, {\n value: context = React.createContext({}),\n enumerable: false,\n writable: false,\n configurable: true,\n });\n context.displayName = 'ApolloContext';\n }\n return context;\n}\nexport { getApolloContext as resetApolloContext };\n//# sourceMappingURL=ApolloContext.js.map","import { invariant } from '../../utilities/globals';\nimport * as React from 'react';\nimport { getApolloContext } from './ApolloContext';\nexport var ApolloConsumer = function (props) {\n var ApolloContext = getApolloContext();\n return (React.createElement(ApolloContext.Consumer, null, function (context) {\n __DEV__ ? invariant(context && context.client, 'Could not find \"client\" in the context of ApolloConsumer. ' +\n 'Wrap the root component in an <ApolloProvider>.') : invariant(context && context.client, 27);\n return props.children(context.client);\n }));\n};\n//# sourceMappingURL=ApolloConsumer.js.map","import { invariant } from '../../utilities/globals';\nimport * as React from 'react';\nimport { getApolloContext } from './ApolloContext';\nexport var ApolloProvider = function (_a) {\n var client = _a.client, suspenseCache = _a.suspenseCache, children = _a.children;\n var ApolloContext = getApolloContext();\n return (React.createElement(ApolloContext.Consumer, null, function (context) {\n if (context === void 0) { context = {}; }\n if (client && context.client !== client) {\n context = Object.assign({}, context, { client: client });\n }\n if (suspenseCache) {\n context = Object.assign({}, context, { suspenseCache: suspenseCache });\n }\n __DEV__ ? invariant(context.client, 'ApolloProvider was not passed a client instance. Make ' +\n 'sure you pass in your client via the \"client\" prop.') : invariant(context.client, 28);\n return (React.createElement(ApolloContext.Provider, { value: context }, children));\n }));\n};\n//# sourceMappingURL=ApolloProvider.js.map"],"names":["canUseSymbol","React","invariant"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAEA,IAAI,UAAU,GAAGA,sBAAY;AAC7B,MAAM,MAAM,CAAC,GAAG,CAAC,oBAAoB,CAAC;AACtC,MAAM,oBAAoB,CAAC;AACpB,SAAS,gBAAgB,GAAG;AACnC,IAAI,IAAI,OAAO,GAAGC,gBAAK,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;AAClD,IAAI,IAAI,CAAC,OAAO,EAAE;AAClB,QAAQ,MAAM,CAAC,cAAc,CAACA,gBAAK,CAAC,aAAa,EAAE,UAAU,EAAE;AAC/D,YAAY,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