@apollo/client 3.11.2 → 3.11.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 (88) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/apollo-client.cjs +109 -87
  3. package/apollo-client.cjs.map +1 -1
  4. package/apollo-client.min.cjs +1 -1
  5. package/cache/core/types/common.d.ts +5 -3
  6. package/cache/core/types/common.js.map +1 -1
  7. package/cache/inmemory/entityStore.js.map +1 -1
  8. package/core/ObservableQuery.d.ts +1 -1
  9. package/core/ObservableQuery.js +79 -43
  10. package/core/ObservableQuery.js.map +1 -1
  11. package/core/QueryManager.js +19 -11
  12. package/core/QueryManager.js.map +1 -1
  13. package/core/core.cjs +65 -43
  14. package/core/core.cjs.map +1 -1
  15. package/core/core.cjs.native.js +65 -43
  16. package/dev/dev.cjs +72 -67
  17. package/dev/dev.cjs.map +1 -1
  18. package/dev/dev.cjs.native.js +72 -67
  19. package/invariantErrorCodes.js +72 -66
  20. package/link/core/ApolloLink.js +2 -2
  21. package/link/core/core.cjs +2 -2
  22. package/link/core/core.cjs.map +1 -1
  23. package/link/core/core.cjs.native.js +2 -2
  24. package/link/http/checkFetcher.js +1 -1
  25. package/link/http/createHttpLink.js +1 -1
  26. package/link/http/http.cjs +3 -3
  27. package/link/http/http.cjs.map +1 -1
  28. package/link/http/http.cjs.native.js +3 -3
  29. package/link/http/serializeFetchParameter.js +1 -1
  30. package/link/persisted-queries/index.js +2 -2
  31. package/link/persisted-queries/persisted-queries.cjs +2 -2
  32. package/link/persisted-queries/persisted-queries.cjs.map +1 -1
  33. package/link/persisted-queries/persisted-queries.cjs.native.js +2 -2
  34. package/link/utils/toPromise.js +1 -1
  35. package/link/utils/utils.cjs +2 -2
  36. package/link/utils/utils.cjs.map +1 -1
  37. package/link/utils/utils.cjs.native.js +2 -2
  38. package/link/utils/validateOperation.js +1 -1
  39. package/package.json +1 -1
  40. package/react/context/ApolloConsumer.js +1 -1
  41. package/react/context/ApolloContext.js +1 -1
  42. package/react/context/ApolloProvider.js +1 -1
  43. package/react/context/context.cjs +3 -3
  44. package/react/context/context.cjs.map +1 -1
  45. package/react/context/context.cjs.native.js +3 -3
  46. package/react/hoc/hoc-utils.js +1 -1
  47. package/react/hoc/hoc.cjs +2 -2
  48. package/react/hoc/hoc.cjs.map +1 -1
  49. package/react/hoc/hoc.cjs.native.js +2 -2
  50. package/react/hoc/withApollo.js +1 -1
  51. package/react/hooks/hooks.cjs +9 -9
  52. package/react/hooks/hooks.cjs.map +1 -1
  53. package/react/hooks/hooks.cjs.native.js +9 -9
  54. package/react/hooks/useApolloClient.js +1 -1
  55. package/react/hooks/useLoadableQuery.js +2 -2
  56. package/react/hooks/useSubscription.js +3 -3
  57. package/react/hooks/useSuspenseQuery.js +2 -2
  58. package/react/hooks/useSyncExternalStore.js +1 -1
  59. package/react/internal/cache/QueryReference.js +1 -1
  60. package/react/internal/internal.cjs +2 -2
  61. package/react/internal/internal.cjs.map +1 -1
  62. package/react/internal/internal.cjs.native.js +2 -2
  63. package/react/parser/index.js +5 -5
  64. package/react/parser/parser.cjs +5 -5
  65. package/react/parser/parser.cjs.map +1 -1
  66. package/react/parser/parser.cjs.native.js +5 -5
  67. package/testing/core/core.cjs +2 -2
  68. package/testing/core/core.cjs.map +1 -1
  69. package/testing/core/core.cjs.native.js +2 -2
  70. package/testing/core/mocking/mockLink.js +2 -2
  71. package/testing/internal/scenarios/index.d.ts +5 -0
  72. package/testing/internal/scenarios/index.js +1 -1
  73. package/testing/internal/scenarios/index.js.map +1 -1
  74. package/utilities/globals/globals.cjs +1 -1
  75. package/utilities/globals/globals.cjs.map +1 -1
  76. package/utilities/globals/globals.cjs.native.js +1 -1
  77. package/utilities/graphql/DocumentTransform.js +1 -1
  78. package/utilities/graphql/directives.js +4 -4
  79. package/utilities/graphql/fragments.js +3 -3
  80. package/utilities/graphql/getFromAST.js +8 -8
  81. package/utilities/graphql/storeUtils.js +1 -1
  82. package/utilities/graphql/transform.js +2 -2
  83. package/utilities/observables/Concast.js +1 -1
  84. package/utilities/observables/Concast.js.map +1 -1
  85. package/utilities/utilities.cjs +20 -20
  86. package/utilities/utilities.cjs.map +1 -1
  87. package/utilities/utilities.cjs.native.js +20 -20
  88. package/version.js +1 -1
@@ -67,85 +67,90 @@ const errorCodes =
67
67
  condition: "fragment",
68
68
  message: "No fragment named %s"
69
69
  },
70
- 22: {
70
+ 21: {
71
+ file: "@apollo/client/core/ObservableQuery.js",
72
+ condition: "updateQuery",
73
+ message: "You must provide an `updateQuery` function when using `fetchMore` with a `no-cache` fetch policy."
74
+ },
75
+ 23: {
71
76
  file: "@apollo/client/core/ObservableQuery.js",
72
77
  condition: "pollInterval",
73
78
  message: "Attempted to start a polling query without a polling interval."
74
79
  },
75
- 25: {
80
+ 26: {
76
81
  file: "@apollo/client/core/QueryManager.js",
77
82
  message: "QueryManager stopped while query was in flight"
78
83
  },
79
- 26: {
84
+ 27: {
80
85
  file: "@apollo/client/core/QueryManager.js",
81
86
  condition: "mutation",
82
87
  message: "mutation option is required. You must specify your GraphQL document in the mutation option."
83
88
  },
84
- 27: {
89
+ 28: {
85
90
  file: "@apollo/client/core/QueryManager.js",
86
91
  condition: "fetchPolicy === \"network-only\" || fetchPolicy === \"no-cache\"",
87
92
  message: "Mutations support only 'network-only' or 'no-cache' fetchPolicy strings. The default `network-only` behavior automatically writes mutation results to the cache. Passing `no-cache` skips the cache write."
88
93
  },
89
- 28: {
94
+ 29: {
90
95
  file: "@apollo/client/core/QueryManager.js",
91
96
  condition: "options.query",
92
97
  message: "query option is required. You must specify your GraphQL document " +
93
98
  "in the query option."
94
99
  },
95
- 29: {
100
+ 30: {
96
101
  file: "@apollo/client/core/QueryManager.js",
97
102
  condition: "options.query.kind === \"Document\"",
98
103
  message: 'You must wrap the query string in a "gql" tag.'
99
104
  },
100
- 30: {
105
+ 31: {
101
106
  file: "@apollo/client/core/QueryManager.js",
102
107
  condition: "!options.returnPartialData",
103
108
  message: "returnPartialData option only supported on watchQuery."
104
109
  },
105
- 31: {
110
+ 32: {
106
111
  file: "@apollo/client/core/QueryManager.js",
107
112
  condition: "!options.pollInterval",
108
113
  message: "pollInterval option only supported on watchQuery."
109
114
  },
110
- 32: {
115
+ 33: {
111
116
  file: "@apollo/client/core/QueryManager.js",
112
117
  message: "Store reset while query was in flight (not completed in link chain)"
113
118
  },
114
- 36: {
119
+ 37: {
115
120
  file: "@apollo/client/link/core/ApolloLink.js",
116
121
  message: "request is not implemented"
117
122
  },
118
- 37: {
123
+ 38: {
119
124
  file: "@apollo/client/link/http/checkFetcher.js",
120
125
  message: "\n\"fetch\" has not been found globally and no fetcher has been configured. To fix this, install a fetch package (like https://www.npmjs.com/package/cross-fetch), instantiate the fetcher, and pass it into your HttpLink constructor. For example:\n\nimport fetch from 'cross-fetch';\nimport { ApolloClient, HttpLink } from '@apollo/client';\nconst client = new ApolloClient({\n link: new HttpLink({ uri: '/graphql', fetch })\n});\n "
121
126
  },
122
- 39: {
127
+ 40: {
123
128
  file: "@apollo/client/link/http/serializeFetchParameter.js",
124
129
  message: "Network request failed. %s is not serializable: %s"
125
130
  },
126
- 40: {
131
+ 41: {
127
132
  file: "@apollo/client/link/persisted-queries/index.js",
128
133
  condition: "options &&\n (typeof options.sha256 === \"function\" ||\n typeof options.generateHash === \"function\")",
129
134
  message: 'Missing/invalid "sha256" or "generateHash" function. Please ' +
130
135
  'configure one using the "createPersistedQueryLink(options)" options ' +
131
136
  "parameter."
132
137
  },
133
- 41: {
138
+ 42: {
134
139
  file: "@apollo/client/link/persisted-queries/index.js",
135
140
  condition: "forward",
136
141
  message: "PersistedQueryLink cannot be the last link in the chain."
137
142
  },
138
- 43: {
143
+ 44: {
139
144
  file: "@apollo/client/link/utils/validateOperation.js",
140
145
  message: "illegal argument: %s"
141
146
  },
142
- 44: {
147
+ 45: {
143
148
  file: "@apollo/client/react/context/ApolloConsumer.js",
144
149
  condition: "context && context.client",
145
150
  message: 'Could not find "client" in the context of ApolloConsumer. ' +
146
151
  "Wrap the root component in an <ApolloProvider>."
147
152
  },
148
- 45: {
153
+ 46: {
149
154
  file: "@apollo/client/react/context/ApolloContext.js",
150
155
  condition: "\"createContext\" in React",
151
156
  message: "Invoking `getApolloContext` in an environment where `React.createContext` is not available.\n" +
@@ -153,70 +158,70 @@ const errorCodes =
153
158
  'Please make sure to add "use client" at the top of your file.\n' +
154
159
  "For more information, see https://nextjs.org/docs/getting-started/react-essentials#client-components"
155
160
  },
156
- 46: {
161
+ 47: {
157
162
  file: "@apollo/client/react/context/ApolloProvider.js",
158
163
  condition: "context.client",
159
164
  message: "ApolloProvider was not passed a client instance. Make " +
160
165
  'sure you pass in your client via the "client" prop.'
161
166
  },
162
- 47: {
167
+ 48: {
163
168
  file: "@apollo/client/react/hoc/hoc-utils.js",
164
169
  condition: "this.withRef",
165
170
  message: "To access the wrapped instance, you need to specify " +
166
171
  "{ withRef: true } in the options"
167
172
  },
168
- 48: {
173
+ 49: {
169
174
  file: "@apollo/client/react/hoc/withApollo.js",
170
175
  condition: "operationOptions.withRef",
171
176
  message: "To access the wrapped instance, you need to specify " +
172
177
  "{ withRef: true } in the options"
173
178
  },
174
- 49: {
179
+ 50: {
175
180
  file: "@apollo/client/react/hooks/useApolloClient.js",
176
181
  condition: "!!client",
177
182
  message: 'Could not find "client" in the context or passed in as an option. ' +
178
183
  "Wrap the root component in an <ApolloProvider>, or pass an ApolloClient " +
179
184
  "instance in via options."
180
185
  },
181
- 50: {
186
+ 51: {
182
187
  file: "@apollo/client/react/hooks/useLoadableQuery.js",
183
188
  condition: "!calledDuringRender()",
184
189
  message: "useLoadableQuery: 'loadQuery' should not be called during render. To start a query during render, use the 'useBackgroundQuery' hook."
185
190
  },
186
- 51: {
191
+ 52: {
187
192
  file: "@apollo/client/react/hooks/useLoadableQuery.js",
188
193
  condition: "internalQueryRef",
189
194
  message: "The query has not been loaded. Please load the query."
190
195
  },
191
- 56: {
196
+ 57: {
192
197
  file: "@apollo/client/react/hooks/useSubscription.js",
193
198
  condition: "!optionsRef.current.skip",
194
199
  message: "A subscription that is skipped cannot be restarted."
195
200
  },
196
- 57: {
201
+ 58: {
197
202
  file: "@apollo/client/react/hooks/useSuspenseQuery.js",
198
203
  condition: "supportedFetchPolicies.includes(fetchPolicy)",
199
204
  message: "The fetch policy `%s` is not supported with suspense."
200
205
  },
201
- 60: {
206
+ 61: {
202
207
  file: "@apollo/client/react/internal/cache/QueryReference.js",
203
208
  condition: "!queryRef || QUERY_REFERENCE_SYMBOL in queryRef",
204
209
  message: "Expected a QueryRef object, but got something else instead."
205
210
  },
206
- 61: {
211
+ 62: {
207
212
  file: "@apollo/client/react/parser/index.js",
208
213
  condition: "!!document && !!document.kind",
209
214
  message: "Argument of %s passed to parser was not a valid GraphQL " +
210
215
  "DocumentNode. You may need to use 'graphql-tag' or another method " +
211
216
  "to convert your operation into a document"
212
217
  },
213
- 62: {
218
+ 63: {
214
219
  file: "@apollo/client/react/parser/index.js",
215
220
  condition: "!fragments.length ||\n queries.length ||\n mutations.length ||\n subscriptions.length",
216
221
  message: "Passing only a fragment to 'graphql' is not yet supported. " +
217
222
  "You must include a query, subscription or mutation as well"
218
223
  },
219
- 63: {
224
+ 64: {
220
225
  file: "@apollo/client/react/parser/index.js",
221
226
  condition: "queries.length + mutations.length + subscriptions.length <= 1",
222
227
  message: "react-apollo only supports a query, subscription, or a mutation per HOC. " +
@@ -224,107 +229,107 @@ const errorCodes =
224
229
  "subscriptions and %s mutations. " +
225
230
  "You can use 'compose' to join multiple operation types to a component"
226
231
  },
227
- 64: {
232
+ 65: {
228
233
  file: "@apollo/client/react/parser/index.js",
229
234
  condition: "definitions.length === 1",
230
235
  message: "react-apollo only supports one definition per HOC. %s had " +
231
236
  "%s definitions. " +
232
237
  "You can use 'compose' to join multiple operation types to a component"
233
238
  },
234
- 65: {
239
+ 66: {
235
240
  file: "@apollo/client/react/parser/index.js",
236
241
  condition: "operation.type === type",
237
242
  message: "Running a %s requires a graphql " + "%s, but a %s was used instead."
238
243
  },
239
- 66: {
244
+ 67: {
240
245
  file: "@apollo/client/testing/core/mocking/mockLink.js",
241
246
  condition: "queryWithoutClientOnlyDirectives",
242
247
  message: "query is required"
243
248
  },
244
- 67: {
249
+ 68: {
245
250
  file: "@apollo/client/testing/core/mocking/mockLink.js",
246
251
  condition: "mockedResponse.maxUsageCount > 0",
247
252
  message: "Mock response maxUsageCount must be greater than 0, %s given"
248
253
  },
249
- 68: {
254
+ 69: {
250
255
  file: "@apollo/client/utilities/graphql/DocumentTransform.js",
251
256
  condition: "Array.isArray(cacheKeys)",
252
257
  message: "`getCacheKey` must return an array or undefined"
253
258
  },
254
- 69: {
259
+ 70: {
255
260
  file: "@apollo/client/utilities/graphql/directives.js",
256
261
  condition: "evaledValue !== void 0",
257
262
  message: "Invalid variable referenced in @%s directive."
258
263
  },
259
- 70: {
264
+ 71: {
260
265
  file: "@apollo/client/utilities/graphql/directives.js",
261
266
  condition: "directiveArguments && directiveArguments.length === 1",
262
267
  message: "Incorrect number of arguments for the @%s directive."
263
268
  },
264
- 71: {
269
+ 72: {
265
270
  file: "@apollo/client/utilities/graphql/directives.js",
266
271
  condition: "ifArgument.name && ifArgument.name.value === \"if\"",
267
272
  message: "Invalid argument for the @%s directive."
268
273
  },
269
- 72: {
274
+ 73: {
270
275
  file: "@apollo/client/utilities/graphql/directives.js",
271
276
  condition: "ifValue &&\n (ifValue.kind === \"Variable\" || ifValue.kind === \"BooleanValue\")",
272
277
  message: "Argument for the @%s directive must be a variable or a boolean value."
273
278
  },
274
- 73: {
279
+ 74: {
275
280
  file: "@apollo/client/utilities/graphql/fragments.js",
276
281
  message: "Found a %s operation%s. " +
277
282
  "No operations are allowed when using a fragment as a query. Only fragments are allowed."
278
283
  },
279
- 74: {
284
+ 75: {
280
285
  file: "@apollo/client/utilities/graphql/fragments.js",
281
286
  condition: "fragments.length === 1",
282
287
  message: "Found %s fragments. `fragmentName` must be provided when there is not exactly 1 fragment."
283
288
  },
284
- 75: {
289
+ 76: {
285
290
  file: "@apollo/client/utilities/graphql/fragments.js",
286
291
  condition: "fragment",
287
292
  message: "No fragment named %s"
288
293
  },
289
- 76: {
294
+ 77: {
290
295
  file: "@apollo/client/utilities/graphql/getFromAST.js",
291
296
  condition: "doc && doc.kind === \"Document\"",
292
297
  message: "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"
293
298
  },
294
- 77: {
299
+ 78: {
295
300
  file: "@apollo/client/utilities/graphql/getFromAST.js",
296
301
  message: "Schema type definitions not allowed in queries. Found: \"%s\""
297
302
  },
298
- 78: {
303
+ 79: {
299
304
  file: "@apollo/client/utilities/graphql/getFromAST.js",
300
305
  condition: "operations.length <= 1",
301
306
  message: "Ambiguous GraphQL document: contains %s operations"
302
307
  },
303
- 79: {
308
+ 80: {
304
309
  file: "@apollo/client/utilities/graphql/getFromAST.js",
305
310
  condition: "queryDef && queryDef.operation === \"query\"",
306
311
  message: "Must contain a query definition."
307
312
  },
308
- 80: {
313
+ 81: {
309
314
  file: "@apollo/client/utilities/graphql/getFromAST.js",
310
315
  condition: "doc.kind === \"Document\"",
311
316
  message: "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"
312
317
  },
313
- 81: {
318
+ 82: {
314
319
  file: "@apollo/client/utilities/graphql/getFromAST.js",
315
320
  condition: "doc.definitions.length <= 1",
316
321
  message: "Fragment must have exactly one definition."
317
322
  },
318
- 82: {
323
+ 83: {
319
324
  file: "@apollo/client/utilities/graphql/getFromAST.js",
320
325
  condition: "fragmentDef.kind === \"FragmentDefinition\"",
321
326
  message: "Must be a fragment definition."
322
327
  },
323
- 83: {
328
+ 84: {
324
329
  file: "@apollo/client/utilities/graphql/getFromAST.js",
325
330
  message: "Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment."
326
331
  },
327
- 84: {
332
+ 85: {
328
333
  file: "@apollo/client/utilities/graphql/storeUtils.js",
329
334
  message: "The inline argument \"%s\" of kind \"%s\"" +
330
335
  "is not supported. Use variables instead of inline arguments to " +
@@ -336,7 +341,7 @@ const devDebug = {
336
341
  file: "@apollo/client/core/ApolloClient.js",
337
342
  message: "In client.refetchQueries, Promise.all promise rejected with error %o"
338
343
  },
339
- 24: {
344
+ 25: {
340
345
  file: "@apollo/client/core/ObservableQuery.js",
341
346
  message: "Missing cache result fields: %o"
342
347
  }
@@ -370,47 +375,47 @@ const devWarn = {
370
375
  file: "@apollo/client/core/ObservableQuery.js",
371
376
  message: "Called refetch(%o) for query %o, which does not declare a $variables variable.\nDid you mean to call refetch(variables) instead of refetch({ variables })?"
372
377
  },
373
- 33: {
378
+ 34: {
374
379
  file: "@apollo/client/core/QueryManager.js",
375
380
  message: "Unknown query named \"%s\" requested in refetchQueries options.include array"
376
381
  },
377
- 34: {
382
+ 35: {
378
383
  file: "@apollo/client/core/QueryManager.js",
379
384
  message: "Unknown query %o requested in refetchQueries options.include array"
380
385
  },
381
- 35: {
386
+ 36: {
382
387
  file: "@apollo/client/link/core/ApolloLink.js",
383
388
  message: "You are calling concat on a terminating link, which will have no effect %o"
384
389
  },
385
- 38: {
390
+ 39: {
386
391
  file: "@apollo/client/link/http/createHttpLink.js",
387
392
  message: "Multipart-subscriptions do not support @defer"
388
393
  },
389
- 42: {
394
+ 43: {
390
395
  file: "@apollo/client/link/utils/toPromise.js",
391
396
  message: "Promise Wrapper does not support multiple results from Observable"
392
397
  },
393
- 52: {
398
+ 53: {
394
399
  file: "@apollo/client/react/hooks/useSubscription.js",
395
400
  message: "'useSubscription' supports only the 'onSubscriptionData' or 'onData' option, but not both. Only the 'onData' option will be used."
396
401
  },
397
- 53: {
402
+ 54: {
398
403
  file: "@apollo/client/react/hooks/useSubscription.js",
399
404
  message: "'onSubscriptionData' is deprecated and will be removed in a future major version. Please use the 'onData' option instead."
400
405
  },
401
- 54: {
406
+ 55: {
402
407
  file: "@apollo/client/react/hooks/useSubscription.js",
403
408
  message: "'useSubscription' supports only the 'onSubscriptionComplete' or 'onComplete' option, but not both. Only the 'onComplete' option will be used."
404
409
  },
405
- 55: {
410
+ 56: {
406
411
  file: "@apollo/client/react/hooks/useSubscription.js",
407
412
  message: "'onSubscriptionComplete' is deprecated and will be removed in a future major version. Please use the 'onComplete' option instead."
408
413
  },
409
- 58: {
414
+ 59: {
410
415
  file: "@apollo/client/react/hooks/useSuspenseQuery.js",
411
416
  message: "Using `returnPartialData` with a `no-cache` fetch policy has no effect. To read partial data from the cache, consider using an alternate fetch policy."
412
417
  },
413
- 86: {
418
+ 87: {
414
419
  file: "@apollo/client/utilities/graphql/transform.js",
415
420
  message: "Removing an @connection directive even though it does not have a key. " +
416
421
  "You may want to use the key parameter to specify a store key."
@@ -421,25 +426,25 @@ const devError = {
421
426
  file: "@apollo/client/cache/inmemory/writeToStore.js",
422
427
  message: "Missing field '%s' while writing result %o"
423
428
  },
424
- 21: {
429
+ 22: {
425
430
  file: "@apollo/client/core/ObservableQuery.js",
426
431
  message: "Unhandled GraphQL subscription error"
427
432
  },
428
- 23: {
433
+ 24: {
429
434
  file: "@apollo/client/core/ObservableQuery.js",
430
435
  message: "Unhandled error"
431
436
  },
432
- 59: {
437
+ 60: {
433
438
  file: "@apollo/client/react/hooks/useSyncExternalStore.js",
434
439
  message: "The result of getSnapshot should be cached to avoid an infinite loop"
435
440
  },
436
- 85: {
441
+ 86: {
437
442
  file: "@apollo/client/utilities/graphql/transform.js",
438
443
  message: "Could not find operation or fragment"
439
444
  }
440
445
  };
441
446
 
442
- var version = "3.11.2";
447
+ var version = "3.11.4";
443
448
 
444
449
  function maybe(thunk) {
445
450
  try {