UNPKG

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