UNPKG

19.1 kBJavaScriptView Raw
1export const errorCodes = // This file is used by the error message display website and the
2// @apollo/client/includeErrors entry point.
3// This file is not meant to be imported manually.
4{
5 1: {
6 file: "@apollo/client/cache/inmemory/entityStore.js",
7 condition: "typeof dataId === \"string\"",
8 message: "store.merge expects a string ID"
9 },
10
11 4: {
12 file: "@apollo/client/cache/inmemory/key-extractor.js",
13 condition: "extracted !== void 0",
14 message: "Missing field '%s' while extracting keyFields from %s"
15 },
16
17 5: {
18 file: "@apollo/client/cache/inmemory/policies.js",
19 condition: "!old || old === which",
20 message: "Cannot change root %s __typename more than once"
21 },
22
23 8: {
24 file: "@apollo/client/cache/inmemory/policies.js",
25 message: "Cannot automatically merge arrays"
26 },
27
28 9: {
29 file: "@apollo/client/cache/inmemory/readFromStore.js",
30 message: "No fragment named %s"
31 },
32
33 10: {
34 file: "@apollo/client/cache/inmemory/readFromStore.js",
35 condition: "!isReference(value)",
36 message: "Missing selection set for object of type %s returned for query field %s"
37 },
38
39 11: {
40 file: "@apollo/client/cache/inmemory/writeToStore.js",
41 message: "Could not identify object %s"
42 },
43
44 13: {
45 file: "@apollo/client/cache/inmemory/writeToStore.js",
46 message: "No fragment named %s"
47 },
48
49 15: {
50 file: "@apollo/client/core/ApolloClient.js",
51
52 message: "To initialize Apollo Client, you must specify a 'cache' property " +
53 "in the options object. \n" +
54 "For more information, please visit: https://go.apollo.dev/c/docs"
55 },
56
57 16: {
58 file: "@apollo/client/core/ApolloClient.js",
59 condition: "options.fetchPolicy !== \"cache-and-network\"",
60
61 message: "The cache-and-network fetchPolicy does not work with client.query, because " +
62 "client.query can only return a single result. Please use client.watchQuery " +
63 "to receive multiple results from the cache and the network, or consider " +
64 "using a different fetchPolicy, such as cache-first or network-only."
65 },
66
67 18: {
68 file: "@apollo/client/core/LocalState.js",
69 condition: "fragment",
70 message: "No fragment named %s"
71 },
72
73 19: {
74 file: "@apollo/client/core/LocalState.js",
75 condition: "fragment",
76 message: "No fragment named %s"
77 },
78
79 21: {
80 file: "@apollo/client/core/ObservableQuery.js",
81 condition: "updateQuery",
82 message: "You must provide an `updateQuery` function when using `fetchMore` with a `no-cache` fetch policy."
83 },
84
85 23: {
86 file: "@apollo/client/core/ObservableQuery.js",
87 condition: "pollInterval",
88 message: "Attempted to start a polling query without a polling interval."
89 },
90
91 26: {
92 file: "@apollo/client/core/QueryManager.js",
93 message: "QueryManager stopped while query was in flight"
94 },
95
96 27: {
97 file: "@apollo/client/core/QueryManager.js",
98 condition: "mutation",
99 message: "mutation option is required. You must specify your GraphQL document in the mutation option."
100 },
101
102 28: {
103 file: "@apollo/client/core/QueryManager.js",
104 condition: "fetchPolicy === \"network-only\" || fetchPolicy === \"no-cache\"",
105 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."
106 },
107
108 29: {
109 file: "@apollo/client/core/QueryManager.js",
110 condition: "options.query",
111
112 message: "query option is required. You must specify your GraphQL document " +
113 "in the query option."
114 },
115
116 30: {
117 file: "@apollo/client/core/QueryManager.js",
118 condition: "options.query.kind === \"Document\"",
119 message: 'You must wrap the query string in a "gql" tag.'
120 },
121
122 31: {
123 file: "@apollo/client/core/QueryManager.js",
124 condition: "!options.returnPartialData",
125 message: "returnPartialData option only supported on watchQuery."
126 },
127
128 32: {
129 file: "@apollo/client/core/QueryManager.js",
130 condition: "!options.pollInterval",
131 message: "pollInterval option only supported on watchQuery."
132 },
133
134 33: {
135 file: "@apollo/client/core/QueryManager.js",
136 message: "Store reset while query was in flight (not completed in link chain)"
137 },
138
139 37: {
140 file: "@apollo/client/link/core/ApolloLink.js",
141 message: "request is not implemented"
142 },
143
144 38: {
145 file: "@apollo/client/link/http/checkFetcher.js",
146 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 "
147 },
148
149 40: {
150 file: "@apollo/client/link/http/serializeFetchParameter.js",
151 message: "Network request failed. %s is not serializable: %s"
152 },
153
154 41: {
155 file: "@apollo/client/link/persisted-queries/index.js",
156 condition: "options &&\n (typeof options.sha256 === \"function\" ||\n typeof options.generateHash === \"function\")",
157
158 message: 'Missing/invalid "sha256" or "generateHash" function. Please ' +
159 'configure one using the "createPersistedQueryLink(options)" options ' +
160 "parameter."
161 },
162
163 42: {
164 file: "@apollo/client/link/persisted-queries/index.js",
165 condition: "forward",
166 message: "PersistedQueryLink cannot be the last link in the chain."
167 },
168
169 44: {
170 file: "@apollo/client/link/utils/validateOperation.js",
171 message: "illegal argument: %s"
172 },
173
174 45: {
175 file: "@apollo/client/react/context/ApolloConsumer.js",
176 condition: "context && context.client",
177
178 message: 'Could not find "client" in the context of ApolloConsumer. ' +
179 "Wrap the root component in an <ApolloProvider>."
180 },
181
182 46: {
183 file: "@apollo/client/react/context/ApolloContext.js",
184 condition: "\"createContext\" in React",
185
186 message: "Invoking `getApolloContext` in an environment where `React.createContext` is not available.\n" +
187 "The Apollo Client functionality you are trying to use is only available in React Client Components.\n" +
188 'Please make sure to add "use client" at the top of your file.\n' +
189 // TODO: change to React documentation once React documentation contains information about Client Components
190 "For more information, see https://nextjs.org/docs/getting-started/react-essentials#client-components"
191 },
192
193 47: {
194 file: "@apollo/client/react/context/ApolloProvider.js",
195 condition: "context.client",
196
197 message: "ApolloProvider was not passed a client instance. Make " +
198 'sure you pass in your client via the "client" prop.'
199 },
200
201 48: {
202 file: "@apollo/client/react/hoc/hoc-utils.js",
203 condition: "this.withRef",
204
205 message: "To access the wrapped instance, you need to specify " +
206 "{ withRef: true } in the options"
207 },
208
209 49: {
210 file: "@apollo/client/react/hoc/withApollo.js",
211 condition: "operationOptions.withRef",
212
213 message: "To access the wrapped instance, you need to specify " +
214 "{ withRef: true } in the options"
215 },
216
217 50: {
218 file: "@apollo/client/react/hooks/useApolloClient.js",
219 condition: "!!client",
220
221 message: 'Could not find "client" in the context or passed in as an option. ' +
222 "Wrap the root component in an <ApolloProvider>, or pass an ApolloClient " +
223 "instance in via options."
224 },
225
226 51: {
227 file: "@apollo/client/react/hooks/useLoadableQuery.js",
228 condition: "!calledDuringRender()",
229 message: "useLoadableQuery: 'loadQuery' should not be called during render. To start a query during render, use the 'useBackgroundQuery' hook."
230 },
231
232 52: {
233 file: "@apollo/client/react/hooks/useLoadableQuery.js",
234 condition: "internalQueryRef",
235 message: "The query has not been loaded. Please load the query."
236 },
237
238 57: {
239 file: "@apollo/client/react/hooks/useSubscription.js",
240 condition: "!optionsRef.current.skip",
241 message: "A subscription that is skipped cannot be restarted."
242 },
243
244 58: {
245 file: "@apollo/client/react/hooks/useSuspenseQuery.js",
246 condition: "supportedFetchPolicies.includes(fetchPolicy)",
247 message: "The fetch policy `%s` is not supported with suspense."
248 },
249
250 61: {
251 file: "@apollo/client/react/internal/cache/QueryReference.js",
252 condition: "!queryRef || QUERY_REFERENCE_SYMBOL in queryRef",
253 message: "Expected a QueryRef object, but got something else instead."
254 },
255
256 62: {
257 file: "@apollo/client/react/parser/index.js",
258 condition: "!!document && !!document.kind",
259
260 message: "Argument of %s passed to parser was not a valid GraphQL " +
261 "DocumentNode. You may need to use 'graphql-tag' or another method " +
262 "to convert your operation into a document"
263 },
264
265 63: {
266 file: "@apollo/client/react/parser/index.js",
267 condition: "!fragments.length ||\n queries.length ||\n mutations.length ||\n subscriptions.length",
268
269 message: "Passing only a fragment to 'graphql' is not yet supported. " +
270 "You must include a query, subscription or mutation as well"
271 },
272
273 64: {
274 file: "@apollo/client/react/parser/index.js",
275 condition: "queries.length + mutations.length + subscriptions.length <= 1",
276
277 message: "react-apollo only supports a query, subscription, or a mutation per HOC. " +
278 "%s had %s queries, %s " +
279 "subscriptions and %s mutations. " +
280 "You can use 'compose' to join multiple operation types to a component"
281 },
282
283 65: {
284 file: "@apollo/client/react/parser/index.js",
285 condition: "definitions.length === 1",
286
287 message: "react-apollo only supports one definition per HOC. %s had " +
288 "%s definitions. " +
289 "You can use 'compose' to join multiple operation types to a component"
290 },
291
292 66: {
293 file: "@apollo/client/react/parser/index.js",
294 condition: "operation.type === type",
295 message: "Running a %s requires a graphql " + "%s, but a %s was used instead."
296 },
297
298 67: {
299 file: "@apollo/client/testing/core/mocking/mockLink.js",
300 condition: "queryWithoutClientOnlyDirectives",
301 message: "query is required"
302 },
303
304 68: {
305 file: "@apollo/client/testing/core/mocking/mockLink.js",
306 condition: "mockedResponse.maxUsageCount > 0",
307 message: "Mock response maxUsageCount must be greater than 0, %s given"
308 },
309
310 69: {
311 file: "@apollo/client/utilities/graphql/DocumentTransform.js",
312 condition: "Array.isArray(cacheKeys)",
313 message: "`getCacheKey` must return an array or undefined"
314 },
315
316 70: {
317 file: "@apollo/client/utilities/graphql/directives.js",
318 condition: "evaledValue !== void 0",
319 message: "Invalid variable referenced in @%s directive."
320 },
321
322 71: {
323 file: "@apollo/client/utilities/graphql/directives.js",
324 condition: "directiveArguments && directiveArguments.length === 1",
325 message: "Incorrect number of arguments for the @%s directive."
326 },
327
328 72: {
329 file: "@apollo/client/utilities/graphql/directives.js",
330 condition: "ifArgument.name && ifArgument.name.value === \"if\"",
331 message: "Invalid argument for the @%s directive."
332 },
333
334 73: {
335 file: "@apollo/client/utilities/graphql/directives.js",
336 condition: "ifValue &&\n (ifValue.kind === \"Variable\" || ifValue.kind === \"BooleanValue\")",
337 message: "Argument for the @%s directive must be a variable or a boolean value."
338 },
339
340 74: {
341 file: "@apollo/client/utilities/graphql/fragments.js",
342
343 message: "Found a %s operation%s. " +
344 "No operations are allowed when using a fragment as a query. Only fragments are allowed."
345 },
346
347 75: {
348 file: "@apollo/client/utilities/graphql/fragments.js",
349 condition: "fragments.length === 1",
350 message: "Found %s fragments. `fragmentName` must be provided when there is not exactly 1 fragment."
351 },
352
353 76: {
354 file: "@apollo/client/utilities/graphql/fragments.js",
355 condition: "fragment",
356 message: "No fragment named %s"
357 },
358
359 77: {
360 file: "@apollo/client/utilities/graphql/getFromAST.js",
361 condition: "doc && doc.kind === \"Document\"",
362 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"
363 },
364
365 78: {
366 file: "@apollo/client/utilities/graphql/getFromAST.js",
367 message: "Schema type definitions not allowed in queries. Found: \"%s\""
368 },
369
370 79: {
371 file: "@apollo/client/utilities/graphql/getFromAST.js",
372 condition: "operations.length <= 1",
373 message: "Ambiguous GraphQL document: contains %s operations"
374 },
375
376 80: {
377 file: "@apollo/client/utilities/graphql/getFromAST.js",
378 condition: "queryDef && queryDef.operation === \"query\"",
379 message: "Must contain a query definition."
380 },
381
382 81: {
383 file: "@apollo/client/utilities/graphql/getFromAST.js",
384 condition: "doc.kind === \"Document\"",
385 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"
386 },
387
388 82: {
389 file: "@apollo/client/utilities/graphql/getFromAST.js",
390 condition: "doc.definitions.length <= 1",
391 message: "Fragment must have exactly one definition."
392 },
393
394 83: {
395 file: "@apollo/client/utilities/graphql/getFromAST.js",
396 condition: "fragmentDef.kind === \"FragmentDefinition\"",
397 message: "Must be a fragment definition."
398 },
399
400 84: {
401 file: "@apollo/client/utilities/graphql/getFromAST.js",
402 message: "Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment."
403 },
404
405 85: {
406 file: "@apollo/client/utilities/graphql/storeUtils.js",
407
408 message: "The inline argument \"%s\" of kind \"%s\"" +
409 "is not supported. Use variables instead of inline arguments to " +
410 "overcome this limitation."
411 }
412};
413
414export const devDebug = {
415 17: {
416 file: "@apollo/client/core/ApolloClient.js",
417 message: "In client.refetchQueries, Promise.all promise rejected with error %o"
418 },
419
420 25: {
421 file: "@apollo/client/core/ObservableQuery.js",
422 message: "Missing cache result fields: %o"
423 }
424};
425
426export const devLog = {};
427
428export const devWarn = {
429 2: {
430 file: "@apollo/client/cache/inmemory/entityStore.js",
431
432 message: "cache.modify: You are trying to write a Reference that is not part of the store: %o\n" +
433 "Please make sure to set the `mergeIntoStore` parameter to `true` when creating a Reference that is not part of the store yet:\n" +
434 "`toReference(object, true)`"
435 },
436
437 3: {
438 file: "@apollo/client/cache/inmemory/entityStore.js",
439
440 message: "cache.modify: Writing an array with a mix of both References and Objects will not result in the Objects being normalized correctly.\n" +
441 "Please convert the object instance %o to a Reference before writing it to the cache by calling `toReference(object, true)`."
442 },
443
444 6: {
445 file: "@apollo/client/cache/inmemory/policies.js",
446 message: "Inferring subtype %s of supertype %s"
447 },
448
449 7: {
450 file: "@apollo/client/cache/inmemory/policies.js",
451 message: "Undefined 'from' passed to readField with arguments %s"
452 },
453
454 14: {
455 file: "@apollo/client/cache/inmemory/writeToStore.js",
456 message: "Cache data may be lost when replacing the %s field of a %s object.\n\nThis could cause additional (usually avoidable) network requests to fetch data that were otherwise cached.\n\nTo address this problem (which is not a bug in Apollo Client), %sdefine a custom merge function for the %s field, so InMemoryCache can safely merge these objects:\n\n existing: %o\n incoming: %o\n\nFor more information about these options, please refer to the documentation:\n\n * Ensuring entity objects have IDs: https://go.apollo.dev/c/generating-unique-identifiers\n * Defining custom merge functions: https://go.apollo.dev/c/merging-non-normalized-objects\n"
457 },
458
459 20: {
460 file: "@apollo/client/core/ObservableQuery.js",
461 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 })?"
462 },
463
464 34: {
465 file: "@apollo/client/core/QueryManager.js",
466 message: "Unknown query named \"%s\" requested in refetchQueries options.include array"
467 },
468
469 35: {
470 file: "@apollo/client/core/QueryManager.js",
471 message: "Unknown query %o requested in refetchQueries options.include array"
472 },
473
474 36: {
475 file: "@apollo/client/link/core/ApolloLink.js",
476 message: "You are calling concat on a terminating link, which will have no effect %o"
477 },
478
479 39: {
480 file: "@apollo/client/link/http/createHttpLink.js",
481 message: "Multipart-subscriptions do not support @defer"
482 },
483
484 43: {
485 file: "@apollo/client/link/utils/toPromise.js",
486 message: "Promise Wrapper does not support multiple results from Observable"
487 },
488
489 53: {
490 file: "@apollo/client/react/hooks/useSubscription.js",
491 message: "'useSubscription' supports only the 'onSubscriptionData' or 'onData' option, but not both. Only the 'onData' option will be used."
492 },
493
494 54: {
495 file: "@apollo/client/react/hooks/useSubscription.js",
496 message: "'onSubscriptionData' is deprecated and will be removed in a future major version. Please use the 'onData' option instead."
497 },
498
499 55: {
500 file: "@apollo/client/react/hooks/useSubscription.js",
501 message: "'useSubscription' supports only the 'onSubscriptionComplete' or 'onComplete' option, but not both. Only the 'onComplete' option will be used."
502 },
503
504 56: {
505 file: "@apollo/client/react/hooks/useSubscription.js",
506 message: "'onSubscriptionComplete' is deprecated and will be removed in a future major version. Please use the 'onComplete' option instead."
507 },
508
509 59: {
510 file: "@apollo/client/react/hooks/useSuspenseQuery.js",
511 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."
512 },
513
514 87: {
515 file: "@apollo/client/utilities/graphql/transform.js",
516
517 message: "Removing an @connection directive even though it does not have a key. " +
518 "You may want to use the key parameter to specify a store key."
519 }
520};
521
522export const devError = {
523 12: {
524 file: "@apollo/client/cache/inmemory/writeToStore.js",
525 message: "Missing field '%s' while writing result %o"
526 },
527
528 22: {
529 file: "@apollo/client/core/ObservableQuery.js",
530 message: "Unhandled GraphQL subscription error"
531 },
532
533 24: {
534 file: "@apollo/client/core/ObservableQuery.js",
535 message: "Unhandled error"
536 },
537
538 60: {
539 file: "@apollo/client/react/hooks/useSyncExternalStore.js",
540 message: "The result of getSnapshot should be cached to avoid an infinite loop"
541 },
542
543 86: {
544 file: "@apollo/client/utilities/graphql/transform.js",
545 message: "Could not find operation or fragment"
546 }
547};