@apollo/client 3.14.0 → 3.14.1
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.
- package/CHANGELOG.md +10 -0
- package/apollo-client.cjs +76 -72
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/cache/cache.cjs +14 -41
- package/cache/cache.cjs.map +1 -1
- package/cache/cache.cjs.native.js +14 -41
- package/cache/core/cache.js +1 -1
- package/cache/core/cache.js.map +1 -1
- package/cache/inmemory/inMemoryCache.js +1 -1
- package/cache/inmemory/inMemoryCache.js.map +1 -1
- package/core/ApolloClient.js +1 -1
- package/core/ApolloClient.js.map +1 -1
- package/core/ObservableQuery.js +1 -1
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryInfo.js +1 -1
- package/core/QueryInfo.js.map +1 -1
- package/core/QueryManager.js +1 -1
- package/core/QueryManager.js.map +1 -1
- package/core/core.cjs +29 -56
- package/core/core.cjs.map +1 -1
- package/core/core.cjs.native.js +29 -56
- package/dev/dev.cjs +49 -53
- package/dev/dev.cjs.map +1 -1
- package/dev/dev.cjs.native.js +49 -53
- package/invariantErrorCodes.js +48 -53
- package/link/core/ApolloLink.js +1 -1
- package/link/core/ApolloLink.js.map +1 -1
- package/link/core/core.cjs +1 -15
- package/link/core/core.cjs.map +1 -1
- package/link/core/core.cjs.native.js +1 -15
- package/package.json +1 -1
- package/react/components/components.cjs +2 -14
- package/react/components/components.cjs.map +1 -1
- package/react/components/components.cjs.native.js +2 -14
- package/react/hoc/graphql.js +1 -1
- package/react/hoc/graphql.js.map +1 -1
- package/react/hoc/hoc.cjs +12 -31
- package/react/hoc/hoc.cjs.map +1 -1
- package/react/hoc/hoc.cjs.native.js +12 -31
- package/react/hoc/mutation-hoc.js +1 -1
- package/react/hoc/mutation-hoc.js.map +1 -1
- package/react/hoc/query-hoc.js +1 -1
- package/react/hoc/query-hoc.js.map +1 -1
- package/react/hoc/subscription-hoc.js +1 -1
- package/react/hoc/subscription-hoc.js.map +1 -1
- package/react/hooks/hooks.cjs +26 -52
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/hooks.cjs.native.js +26 -52
- package/react/hooks/internal/useWarnRemoved.d.ts +1 -1
- package/react/hooks/internal/useWarnRemoved.js +1 -1
- package/react/hooks/internal/useWarnRemoved.js.map +1 -1
- package/react/hooks/internal/useWarnRemovedOption.d.ts +2 -1
- package/react/hooks/internal/useWarnRemovedOption.js +7 -5
- package/react/hooks/internal/useWarnRemovedOption.js.map +1 -1
- package/react/hooks/useApolloClient.js +1 -1
- package/react/hooks/useBackgroundQuery.js +1 -1
- package/react/hooks/useBackgroundQuery.js.map +1 -1
- package/react/hooks/useFragment.js +1 -1
- package/react/hooks/useFragment.js.map +1 -1
- package/react/hooks/useLazyQuery.js +3 -3
- package/react/hooks/useLazyQuery.js.map +1 -1
- package/react/hooks/useLoadableQuery.js +3 -3
- package/react/hooks/useLoadableQuery.js.map +1 -1
- package/react/hooks/useQuery.js +3 -3
- package/react/hooks/useQuery.js.map +1 -1
- package/react/hooks/useSubscription.js +3 -3
- package/react/hooks/useSuspenseQuery.js +3 -3
- package/react/hooks/useSuspenseQuery.js.map +1 -1
- package/react/hooks/useSyncExternalStore.js +1 -1
- package/react/internal/cache/QueryReference.js +2 -2
- package/react/internal/cache/QueryReference.js.map +1 -1
- package/react/internal/internal.cjs +3 -14
- package/react/internal/internal.cjs.map +1 -1
- package/react/internal/internal.cjs.native.js +3 -14
- package/react/parser/index.js +7 -7
- package/react/parser/index.js.map +1 -1
- package/react/parser/parser.cjs +9 -29
- package/react/parser/parser.cjs.map +1 -1
- package/react/parser/parser.cjs.native.js +9 -29
- package/react/query-preloader/createQueryPreloader.js +1 -1
- package/react/query-preloader/createQueryPreloader.js.map +1 -1
- package/react/react.cjs +4 -31
- package/react/react.cjs.map +1 -1
- package/react/react.cjs.native.js +4 -31
- package/testing/core/core.cjs +4 -4
- package/testing/core/core.cjs.map +1 -1
- package/testing/core/core.cjs.native.js +4 -4
- package/testing/core/mocking/mockLink.d.ts +13 -0
- package/testing/core/mocking/mockLink.js +4 -4
- package/testing/core/mocking/mockLink.js.map +1 -1
- package/testing/internal/disposables/index.d.ts +1 -0
- package/testing/internal/disposables/index.js +1 -0
- package/testing/internal/disposables/index.js.map +1 -1
- package/testing/internal/disposables/withMutedDeprecations.d.ts +4 -0
- package/testing/internal/disposables/withMutedDeprecations.js +13 -0
- package/testing/internal/disposables/withMutedDeprecations.js.map +1 -0
- package/testing/react/MockedProvider.js +1 -1
- package/testing/react/MockedProvider.js.map +1 -1
- package/testing/testing.cjs +5 -32
- package/testing/testing.cjs.map +1 -1
- package/testing/testing.cjs.native.js +5 -32
- package/utilities/deprecation/index.d.ts +0 -3
- package/utilities/deprecation/index.js +4 -12
- package/utilities/deprecation/index.js.map +1 -1
- package/utilities/globals/globals.cjs +1 -1
- package/utilities/globals/globals.cjs.map +1 -1
- package/utilities/globals/globals.cjs.native.js +1 -1
- package/utilities/graphql/DocumentTransform.js +1 -1
- package/utilities/graphql/directives.js +7 -7
- package/utilities/graphql/fragments.js +3 -3
- package/utilities/graphql/getFromAST.js +8 -8
- package/utilities/graphql/storeUtils.js +1 -1
- package/utilities/graphql/transform.js +2 -2
- package/utilities/index.d.ts +2 -0
- package/utilities/index.js +1 -0
- package/utilities/index.js.map +1 -1
- package/utilities/utilities.cjs +54 -22
- package/utilities/utilities.cjs.map +1 -1
- package/utilities/utilities.cjs.native.js +54 -22
- package/version.js +1 -1
package/invariantErrorCodes.js
CHANGED
|
@@ -238,7 +238,7 @@ export const errorCodes = // This file is used by the error message display webs
|
|
|
238
238
|
"{ withRef: true } in the options"
|
|
239
239
|
},
|
|
240
240
|
|
|
241
|
-
|
|
241
|
+
78: {
|
|
242
242
|
file: "@apollo/client/react/hooks/useApolloClient.js",
|
|
243
243
|
condition: "!!client",
|
|
244
244
|
|
|
@@ -247,37 +247,37 @@ export const errorCodes = // This file is used by the error message display webs
|
|
|
247
247
|
"instance in via options."
|
|
248
248
|
},
|
|
249
249
|
|
|
250
|
-
|
|
250
|
+
81: {
|
|
251
251
|
file: "@apollo/client/react/hooks/useLoadableQuery.js",
|
|
252
252
|
condition: "!calledDuringRender()",
|
|
253
253
|
message: "useLoadableQuery: 'loadQuery' should not be called during render. To start a query during render, use the 'useBackgroundQuery' hook."
|
|
254
254
|
},
|
|
255
255
|
|
|
256
|
-
|
|
256
|
+
82: {
|
|
257
257
|
file: "@apollo/client/react/hooks/useLoadableQuery.js",
|
|
258
258
|
condition: "internalQueryRef",
|
|
259
259
|
message: "The query has not been loaded. Please load the query."
|
|
260
260
|
},
|
|
261
261
|
|
|
262
|
-
|
|
262
|
+
88: {
|
|
263
263
|
file: "@apollo/client/react/hooks/useSubscription.js",
|
|
264
264
|
condition: "!optionsRef.current.skip",
|
|
265
265
|
message: "A subscription that is skipped cannot be restarted."
|
|
266
266
|
},
|
|
267
267
|
|
|
268
|
-
|
|
268
|
+
89: {
|
|
269
269
|
file: "@apollo/client/react/hooks/useSuspenseQuery.js",
|
|
270
270
|
condition: "supportedFetchPolicies.includes(fetchPolicy)",
|
|
271
271
|
message: "The fetch policy `%s` is not supported with suspense."
|
|
272
272
|
},
|
|
273
273
|
|
|
274
|
-
|
|
274
|
+
92: {
|
|
275
275
|
file: "@apollo/client/react/internal/cache/QueryReference.js",
|
|
276
276
|
condition: "!queryRef || QUERY_REFERENCE_SYMBOL in queryRef",
|
|
277
277
|
message: "Expected a QueryRef object, but got something else instead."
|
|
278
278
|
},
|
|
279
279
|
|
|
280
|
-
|
|
280
|
+
94: {
|
|
281
281
|
file: "@apollo/client/react/parser/index.js",
|
|
282
282
|
condition: "!!document && !!document.kind",
|
|
283
283
|
|
|
@@ -286,7 +286,7 @@ export const errorCodes = // This file is used by the error message display webs
|
|
|
286
286
|
"to convert your operation into a document"
|
|
287
287
|
},
|
|
288
288
|
|
|
289
|
-
|
|
289
|
+
95: {
|
|
290
290
|
file: "@apollo/client/react/parser/index.js",
|
|
291
291
|
condition: "!fragments.length ||\n queries.length ||\n mutations.length ||\n subscriptions.length",
|
|
292
292
|
|
|
@@ -294,7 +294,7 @@ export const errorCodes = // This file is used by the error message display webs
|
|
|
294
294
|
"You must include a query, subscription or mutation as well"
|
|
295
295
|
},
|
|
296
296
|
|
|
297
|
-
|
|
297
|
+
96: {
|
|
298
298
|
file: "@apollo/client/react/parser/index.js",
|
|
299
299
|
condition: "queries.length + mutations.length + subscriptions.length <= 1",
|
|
300
300
|
|
|
@@ -304,7 +304,7 @@ export const errorCodes = // This file is used by the error message display webs
|
|
|
304
304
|
"You can use 'compose' to join multiple operation types to a component"
|
|
305
305
|
},
|
|
306
306
|
|
|
307
|
-
|
|
307
|
+
97: {
|
|
308
308
|
file: "@apollo/client/react/parser/index.js",
|
|
309
309
|
condition: "definitions.length === 1",
|
|
310
310
|
|
|
@@ -313,120 +313,120 @@ export const errorCodes = // This file is used by the error message display webs
|
|
|
313
313
|
"You can use 'compose' to join multiple operation types to a component"
|
|
314
314
|
},
|
|
315
315
|
|
|
316
|
-
|
|
316
|
+
98: {
|
|
317
317
|
file: "@apollo/client/react/parser/index.js",
|
|
318
318
|
condition: "operation.type === type",
|
|
319
319
|
message: "Running a %s requires a graphql " + "%s, but a %s was used instead."
|
|
320
320
|
},
|
|
321
321
|
|
|
322
|
-
|
|
322
|
+
101: {
|
|
323
323
|
file: "@apollo/client/testing/core/mocking/mockLink.js",
|
|
324
324
|
condition: "queryWithoutClientOnlyDirectives",
|
|
325
325
|
message: "query is required"
|
|
326
326
|
},
|
|
327
327
|
|
|
328
|
-
|
|
328
|
+
102: {
|
|
329
329
|
file: "@apollo/client/testing/core/mocking/mockLink.js",
|
|
330
330
|
condition: "mockedResponse.maxUsageCount > 0",
|
|
331
331
|
message: "Mock response maxUsageCount must be greater than 0, %s given"
|
|
332
332
|
},
|
|
333
333
|
|
|
334
|
-
|
|
334
|
+
104: {
|
|
335
335
|
file: "@apollo/client/utilities/graphql/DocumentTransform.js",
|
|
336
336
|
condition: "Array.isArray(cacheKeys)",
|
|
337
337
|
message: "`getCacheKey` must return an array or undefined"
|
|
338
338
|
},
|
|
339
339
|
|
|
340
|
-
|
|
340
|
+
105: {
|
|
341
341
|
file: "@apollo/client/utilities/graphql/directives.js",
|
|
342
342
|
condition: "evaledValue !== void 0",
|
|
343
343
|
message: "Invalid variable referenced in @%s directive."
|
|
344
344
|
},
|
|
345
345
|
|
|
346
|
-
|
|
346
|
+
106: {
|
|
347
347
|
file: "@apollo/client/utilities/graphql/directives.js",
|
|
348
348
|
condition: "directiveArguments && directiveArguments.length === 1",
|
|
349
349
|
message: "Incorrect number of arguments for the @%s directive."
|
|
350
350
|
},
|
|
351
351
|
|
|
352
|
-
|
|
352
|
+
107: {
|
|
353
353
|
file: "@apollo/client/utilities/graphql/directives.js",
|
|
354
354
|
condition: "ifArgument.name && ifArgument.name.value === \"if\"",
|
|
355
355
|
message: "Invalid argument for the @%s directive."
|
|
356
356
|
},
|
|
357
357
|
|
|
358
|
-
|
|
358
|
+
108: {
|
|
359
359
|
file: "@apollo/client/utilities/graphql/directives.js",
|
|
360
360
|
condition: "ifValue &&\n (ifValue.kind === \"Variable\" || ifValue.kind === \"BooleanValue\")",
|
|
361
361
|
message: "Argument for the @%s directive must be a variable or a boolean value."
|
|
362
362
|
},
|
|
363
363
|
|
|
364
|
-
|
|
364
|
+
112: {
|
|
365
365
|
file: "@apollo/client/utilities/graphql/fragments.js",
|
|
366
366
|
|
|
367
367
|
message: "Found a %s operation%s. " +
|
|
368
368
|
"No operations are allowed when using a fragment as a query. Only fragments are allowed."
|
|
369
369
|
},
|
|
370
370
|
|
|
371
|
-
|
|
371
|
+
113: {
|
|
372
372
|
file: "@apollo/client/utilities/graphql/fragments.js",
|
|
373
373
|
condition: "fragments.length === 1",
|
|
374
374
|
message: "Found %s fragments. `fragmentName` must be provided when there is not exactly 1 fragment."
|
|
375
375
|
},
|
|
376
376
|
|
|
377
|
-
|
|
377
|
+
114: {
|
|
378
378
|
file: "@apollo/client/utilities/graphql/fragments.js",
|
|
379
379
|
condition: "fragment",
|
|
380
380
|
message: "No fragment named %s"
|
|
381
381
|
},
|
|
382
382
|
|
|
383
|
-
|
|
383
|
+
115: {
|
|
384
384
|
file: "@apollo/client/utilities/graphql/getFromAST.js",
|
|
385
385
|
condition: "doc && doc.kind === \"Document\"",
|
|
386
386
|
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"
|
|
387
387
|
},
|
|
388
388
|
|
|
389
|
-
|
|
389
|
+
116: {
|
|
390
390
|
file: "@apollo/client/utilities/graphql/getFromAST.js",
|
|
391
391
|
message: "Schema type definitions not allowed in queries. Found: \"%s\""
|
|
392
392
|
},
|
|
393
393
|
|
|
394
|
-
|
|
394
|
+
117: {
|
|
395
395
|
file: "@apollo/client/utilities/graphql/getFromAST.js",
|
|
396
396
|
condition: "operations.length <= 1",
|
|
397
397
|
message: "Ambiguous GraphQL document: contains %s operations"
|
|
398
398
|
},
|
|
399
399
|
|
|
400
|
-
|
|
400
|
+
118: {
|
|
401
401
|
file: "@apollo/client/utilities/graphql/getFromAST.js",
|
|
402
402
|
condition: "queryDef && queryDef.operation === \"query\"",
|
|
403
403
|
message: "Must contain a query definition."
|
|
404
404
|
},
|
|
405
405
|
|
|
406
|
-
|
|
406
|
+
119: {
|
|
407
407
|
file: "@apollo/client/utilities/graphql/getFromAST.js",
|
|
408
408
|
condition: "doc.kind === \"Document\"",
|
|
409
409
|
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"
|
|
410
410
|
},
|
|
411
411
|
|
|
412
|
-
|
|
412
|
+
120: {
|
|
413
413
|
file: "@apollo/client/utilities/graphql/getFromAST.js",
|
|
414
414
|
condition: "doc.definitions.length <= 1",
|
|
415
415
|
message: "Fragment must have exactly one definition."
|
|
416
416
|
},
|
|
417
417
|
|
|
418
|
-
|
|
418
|
+
121: {
|
|
419
419
|
file: "@apollo/client/utilities/graphql/getFromAST.js",
|
|
420
420
|
condition: "fragmentDef.kind === \"FragmentDefinition\"",
|
|
421
421
|
message: "Must be a fragment definition."
|
|
422
422
|
},
|
|
423
423
|
|
|
424
|
-
|
|
424
|
+
122: {
|
|
425
425
|
file: "@apollo/client/utilities/graphql/getFromAST.js",
|
|
426
426
|
message: "Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment."
|
|
427
427
|
},
|
|
428
428
|
|
|
429
|
-
|
|
429
|
+
123: {
|
|
430
430
|
file: "@apollo/client/utilities/graphql/storeUtils.js",
|
|
431
431
|
|
|
432
432
|
message: "The inline argument \"%s\" of kind \"%s\"" +
|
|
@@ -630,87 +630,82 @@ export const devWarn = {
|
|
|
630
630
|
message: "[withSubscription]: The `withSubscription` higher order component is deprecated and will be removed in Apollo Client 4.0. Please switch to an available React hook such as `useSubscription`."
|
|
631
631
|
},
|
|
632
632
|
|
|
633
|
-
|
|
634
|
-
file: "@apollo/client/react/hooks/internal/useWarnRemovedOption.js",
|
|
635
|
-
message: "[%s]: `%s` is a deprecated hook option and will be removed in Apollo Client 4.0. %s"
|
|
636
|
-
},
|
|
637
|
-
|
|
638
|
-
80: {
|
|
633
|
+
79: {
|
|
639
634
|
file: "@apollo/client/react/hooks/useLazyQuery.js",
|
|
640
635
|
message: "[useLazyQuery]: `reobserve` is deprecated and will removed in Apollo Client 4.0. Please change options by rerendering `useLazyQuery` with new options."
|
|
641
636
|
},
|
|
642
637
|
|
|
643
|
-
|
|
638
|
+
80: {
|
|
644
639
|
file: "@apollo/client/react/hooks/useLazyQuery.js",
|
|
645
640
|
message: "[useLazyQuery]: Calling `execute` in render will throw in Apollo Client 4.0. Either switch to `useQuery` to run the query during render or move the `execute` call inside of `useEffect`."
|
|
646
641
|
},
|
|
647
642
|
|
|
648
|
-
|
|
643
|
+
83: {
|
|
649
644
|
file: "@apollo/client/react/hooks/useQuery.js",
|
|
650
645
|
message: "[useQuery]: `reobserve` is deprecated and will removed in Apollo Client 4.0. Please change options by rerendering `useQuery` with new options."
|
|
651
646
|
},
|
|
652
647
|
|
|
653
|
-
|
|
648
|
+
84: {
|
|
654
649
|
file: "@apollo/client/react/hooks/useSubscription.js",
|
|
655
650
|
message: "'useSubscription' supports only the 'onSubscriptionData' or 'onData' option, but not both. Only the 'onData' option will be used."
|
|
656
651
|
},
|
|
657
652
|
|
|
658
|
-
|
|
653
|
+
85: {
|
|
659
654
|
file: "@apollo/client/react/hooks/useSubscription.js",
|
|
660
655
|
message: "[useSubscription]: `onSubscriptionData` is deprecated and will be removed in Apollo Client 4.0. Please use the 'onData' option instead."
|
|
661
656
|
},
|
|
662
657
|
|
|
663
|
-
|
|
658
|
+
86: {
|
|
664
659
|
file: "@apollo/client/react/hooks/useSubscription.js",
|
|
665
660
|
message: "'useSubscription' supports only the 'onSubscriptionComplete' or 'onComplete' option, but not both. Only the 'onComplete' option will be used."
|
|
666
661
|
},
|
|
667
662
|
|
|
668
|
-
|
|
663
|
+
87: {
|
|
669
664
|
file: "@apollo/client/react/hooks/useSubscription.js",
|
|
670
665
|
message: "[useSubscription]: `onSubscriptionComplete` is deprecated and will be removed in Apollo Client 4.0. Please use the 'onComplete' option instead."
|
|
671
666
|
},
|
|
672
667
|
|
|
673
|
-
|
|
668
|
+
90: {
|
|
674
669
|
file: "@apollo/client/react/hooks/useSuspenseQuery.js",
|
|
675
670
|
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."
|
|
676
671
|
},
|
|
677
672
|
|
|
678
|
-
|
|
673
|
+
93: {
|
|
679
674
|
file: "@apollo/client/react/parser/index.js",
|
|
680
675
|
message: "[parser]: `parser` is deprecated and will be removed in Apollo Client 4.0. Please remove all usages of `parser`."
|
|
681
676
|
},
|
|
682
677
|
|
|
683
|
-
|
|
678
|
+
99: {
|
|
684
679
|
file: "@apollo/client/testing/core/mocking/mockLink.js",
|
|
685
680
|
message: "[MockLink]: `newData` is deprecated and will be removed in Apollo Client 4.0. Please use the `result` option with a callback function and set the `maxUsageCount` option to `Number.POSITIVE_INFINITY`.\n\nFound `newData` on response:\n%o"
|
|
686
681
|
},
|
|
687
682
|
|
|
688
|
-
|
|
683
|
+
100: {
|
|
689
684
|
file: "@apollo/client/testing/core/mocking/mockLink.js",
|
|
690
685
|
message: "[MockLink]: Apollo Client 4.0 will throw when mocking client-only query '%s'. Please ensure the query has at least 1 non-client field."
|
|
691
686
|
},
|
|
692
687
|
|
|
693
|
-
|
|
688
|
+
103: {
|
|
694
689
|
file: "@apollo/client/utilities/deprecation/index.js",
|
|
695
690
|
message: "[%s]: `%s` is deprecated and will be removed in Apollo Client 4.0. %s"
|
|
696
691
|
},
|
|
697
692
|
|
|
698
|
-
|
|
693
|
+
109: {
|
|
699
694
|
file: "@apollo/client/utilities/graphql/directives.js",
|
|
700
695
|
message: "@unmask 'mode' argument does not support variables."
|
|
701
696
|
},
|
|
702
697
|
|
|
703
|
-
|
|
698
|
+
110: {
|
|
704
699
|
file: "@apollo/client/utilities/graphql/directives.js",
|
|
705
700
|
message: "@unmask 'mode' argument must be of type string."
|
|
706
701
|
},
|
|
707
702
|
|
|
708
|
-
|
|
703
|
+
111: {
|
|
709
704
|
file: "@apollo/client/utilities/graphql/directives.js",
|
|
710
705
|
message: "@unmask 'mode' argument does not recognize value '%s'."
|
|
711
706
|
},
|
|
712
707
|
|
|
713
|
-
|
|
708
|
+
125: {
|
|
714
709
|
file: "@apollo/client/utilities/graphql/transform.js",
|
|
715
710
|
|
|
716
711
|
message: "Removing an @connection directive even though it does not have a key. " +
|
|
@@ -734,12 +729,12 @@ export const devError = {
|
|
|
734
729
|
message: "Unhandled error"
|
|
735
730
|
},
|
|
736
731
|
|
|
737
|
-
|
|
732
|
+
91: {
|
|
738
733
|
file: "@apollo/client/react/hooks/useSyncExternalStore.js",
|
|
739
734
|
message: "The result of getSnapshot should be cached to avoid an infinite loop"
|
|
740
735
|
},
|
|
741
736
|
|
|
742
|
-
|
|
737
|
+
124: {
|
|
743
738
|
file: "@apollo/client/utilities/graphql/transform.js",
|
|
744
739
|
message: "Could not find operation or fragment"
|
|
745
740
|
}
|
package/link/core/ApolloLink.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { newInvariantError, invariant } from "../../utilities/globals/index.js";
|
|
2
2
|
import { Observable } from "../../utilities/index.js";
|
|
3
3
|
import { validateOperation, createOperation, transformOperation, } from "../utils/index.js";
|
|
4
|
-
import { warnDeprecated } from "../../utilities/
|
|
4
|
+
import { warnDeprecated } from "../../utilities/index.js";
|
|
5
5
|
function passthrough(op, forward) {
|
|
6
6
|
return (forward ? forward(op) : Observable.of());
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApolloLink.js","sourceRoot":"","sources":["../../../src/link/core/ApolloLink.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAGhF,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAQtD,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,kBAAkB,GACnB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAEtE,SAAS,WAAW,CAAC,EAAa,EAAE,OAAiB;IACnD,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,EAAE,EAAE,CAA4B,CAAC;AAC9E,CAAC;AAED,SAAS,MAAM,CAAC,OAAoC;IAClD,OAAO,OAAO,OAAO,KAAK,UAAU,CAAC,CAAC,CAAC,IAAI,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;AAC3E,CAAC;AAED,SAAS,aAAa,CAAC,IAAgB;IACrC,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC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CAAC;YACtB,oEAAoE;YACpE,oEAAoE;YACpE,kEAAkE;YAClE,kEAAkE;YAClE,8DAA8D;YAC9D,+BAA+B;YAC/B,OAAO,KAAK,CAAC;QACf,CAAC;QACD,iDAAiD;QACjD,MAAM,KAAK,CAAC;IACd,CAAC;IAED;;;OAGG;IACI,+BAAU,GAAjB,UAAkB,EAAyB;QACzC,IAAI,OAAO,EAAE,CAAC;YACZ,SAAS,CAAC,IAAI,CACZ,kHAAkH,CACnH,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;QAClB,OAAO,IAAI,CAAC;IACd,CAAC;IAkBH,iBAAC;AAAD,CAAC,AAxKD,IAwKC","sourcesContent":["import { newInvariantError, invariant } from \"../../utilities/globals/index.js\";\n\nimport type { Observer } from \"../../utilities/index.js\";\nimport { Observable } from \"../../utilities/index.js\";\nimport type {\n NextLink,\n Operation,\n RequestHandler,\n FetchResult,\n GraphQLRequest,\n} from \"./types.js\";\nimport {\n validateOperation,\n createOperation,\n transformOperation,\n} from \"../utils/index.js\";\nimport { warnDeprecated } from \"../../utilities/deprecation/index.js\";\n\nfunction passthrough(op: Operation, forward: NextLink) {\n return (forward ? forward(op) : Observable.of()) as Observable<FetchResult>;\n}\n\nfunction toLink(handler: RequestHandler | ApolloLink) {\n return typeof handler === \"function\" ? new ApolloLink(handler) : handler;\n}\n\nfunction isTerminating(link: ApolloLink): boolean {\n return link.request.length <= 1;\n}\n\nexport class ApolloLink {\n public static empty(): ApolloLink {\n return new ApolloLink(() => Observable.of());\n }\n\n public static from(links: (ApolloLink | RequestHandler)[]): ApolloLink {\n if (links.length === 0) return ApolloLink.empty();\n return links.map(toLink).reduce((x, y) => x.concat(y)) as ApolloLink;\n }\n\n public static split(\n test: (op: Operation) => boolean,\n left: ApolloLink | RequestHandler,\n right?: ApolloLink | RequestHandler\n ): ApolloLink {\n const leftLink = toLink(left);\n const rightLink = toLink(right || new ApolloLink(passthrough));\n\n let ret: ApolloLink;\n if (isTerminating(leftLink) && isTerminating(rightLink)) {\n ret = new ApolloLink((operation) => {\n return test(operation) ?\n leftLink.request(operation) || Observable.of()\n : rightLink.request(operation) || Observable.of();\n });\n } else {\n ret = new ApolloLink((operation, forward) => {\n return test(operation) ?\n leftLink.request(operation, forward) || Observable.of()\n : rightLink.request(operation, forward) || Observable.of();\n });\n }\n return Object.assign(ret, { left: leftLink, right: rightLink });\n }\n\n public static execute(\n link: ApolloLink,\n operation: GraphQLRequest\n ): Observable<FetchResult> {\n return (\n link.request(\n createOperation(\n operation.context,\n transformOperation(validateOperation(operation))\n )\n ) || Observable.of()\n );\n }\n\n public static concat(\n first: ApolloLink | RequestHandler,\n second: ApolloLink | RequestHandler\n ) {\n const firstLink = toLink(first);\n if (isTerminating(firstLink)) {\n invariant.warn(\n `You are calling concat on a terminating link, which will have no effect %o`,\n firstLink\n );\n return firstLink;\n }\n const nextLink = toLink(second);\n\n let ret: ApolloLink;\n if (isTerminating(nextLink)) {\n ret = new ApolloLink(\n (operation) =>\n firstLink.request(\n operation,\n (op) => nextLink.request(op) || Observable.of()\n ) || Observable.of()\n );\n } else {\n ret = new ApolloLink((operation, forward) => {\n return (\n firstLink.request(operation, (op) => {\n return nextLink.request(op, forward) || Observable.of();\n }) || Observable.of()\n );\n });\n }\n return Object.assign(ret, { left: firstLink, right: nextLink });\n }\n\n constructor(request?: RequestHandler) {\n if (request) this.request = request;\n }\n\n public split(\n test: (op: Operation) => boolean,\n left: ApolloLink | RequestHandler,\n right?: ApolloLink | RequestHandler\n ): ApolloLink {\n return this.concat(\n ApolloLink.split(test, left, right || new ApolloLink(passthrough))\n );\n }\n\n public concat(next: ApolloLink | RequestHandler): ApolloLink {\n return ApolloLink.concat(this, next);\n }\n\n public request(\n operation: Operation,\n forward?: NextLink\n ): Observable<FetchResult> | null {\n throw newInvariantError(\"request is not implemented\");\n }\n\n /**\n * @deprecated `onError` will be removed with Apollo Client 4.0. Please\n * discontinue using this method.\n */\n protected onError(\n error: any,\n observer?: Observer<FetchResult>\n ): false | void {\n if (__DEV__) {\n warnDeprecated(\"onError\", () => {\n invariant.warn(\n \"[ApolloLink] `onError` is deprecated and will be removed with Apollo Client 4.0. Please discontinue using it.\"\n );\n });\n }\n if (observer && observer.error) {\n observer.error(error);\n // Returning false indicates that observer.error does not need to be\n // called again, since it was already called (on the previous line).\n // Calling observer.error again would not cause any real problems,\n // since only the first call matters, but custom onError functions\n // might have other reasons for wanting to prevent the default\n // behavior by returning false.\n return false;\n }\n // Throw errors will be passed to observer.error.\n throw error;\n }\n\n /**\n * @deprecated `setOnError` will be removed with Apollo Client 4.0. Please\n * discontinue using this method.\n */\n public setOnError(fn: ApolloLink[\"onError\"]): this {\n if (__DEV__) {\n invariant.warn(\n \"[ApolloLink] `setOnError` is deprecated and will be removed with Apollo Client 4.0. Please discontinue using it.\"\n );\n }\n this.onError = fn;\n return this;\n }\n\n /**\n * @internal\n * Used to iterate through all links that are concatenations or `split` links.\n */\n readonly left?: ApolloLink;\n /**\n * @internal\n * Used to iterate through all links that are concatenations or `split` links.\n */\n readonly right?: ApolloLink;\n\n /**\n * @internal\n * Can be provided by a link that has an internal cache to report it's memory details.\n */\n getMemoryInternals?: () => unknown;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ApolloLink.js","sourceRoot":"","sources":["../../../src/link/core/ApolloLink.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAGhF,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAQtD,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,kBAAkB,GACnB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,SAAS,WAAW,CAAC,EAAa,EAAE,OAAiB;IACnD,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,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4BAAO,GAAjB,UACE,KAAU,EACV,QAAgC;QAEhC,IAAI,OAAO,EAAE,CAAC;YACZ,cAAc,CAAC,SAAS,EAAE;gBACxB,SAAS,CAAC,IAAI,CACZ,+GAA+G,CAChH,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC;QACD,IAAI,QAAQ,IAAI,QAAQ,CAAC,KAAK,EAAE,CAAC;YAC/B,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACtB,oEAAoE;YACpE,oEAAoE;YACpE,kEAAkE;YAClE,kEAAkE;YAClE,8DAA8D;YAC9D,+BAA+B;YAC/B,OAAO,KAAK,CAAC;QACf,CAAC;QACD,iDAAiD;QACjD,MAAM,KAAK,CAAC;IACd,CAAC;IAED;;;OAGG;IACI,+BAAU,GAAjB,UAAkB,EAAyB;QACzC,IAAI,OAAO,EAAE,CAAC;YACZ,SAAS,CAAC,IAAI,CACZ,kHAAkH,CACnH,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;QAClB,OAAO,IAAI,CAAC;IACd,CAAC;IAkBH,iBAAC;AAAD,CAAC,AAxKD,IAwKC","sourcesContent":["import { newInvariantError, invariant } from \"../../utilities/globals/index.js\";\n\nimport type { Observer } from \"../../utilities/index.js\";\nimport { Observable } from \"../../utilities/index.js\";\nimport type {\n NextLink,\n Operation,\n RequestHandler,\n FetchResult,\n GraphQLRequest,\n} from \"./types.js\";\nimport {\n validateOperation,\n createOperation,\n transformOperation,\n} from \"../utils/index.js\";\nimport { warnDeprecated } from \"../../utilities/index.js\";\n\nfunction passthrough(op: Operation, forward: NextLink) {\n return (forward ? forward(op) : Observable.of()) as Observable<FetchResult>;\n}\n\nfunction toLink(handler: RequestHandler | ApolloLink) {\n return typeof handler === \"function\" ? new ApolloLink(handler) : handler;\n}\n\nfunction isTerminating(link: ApolloLink): boolean {\n return link.request.length <= 1;\n}\n\nexport class ApolloLink {\n public static empty(): ApolloLink {\n return new ApolloLink(() => Observable.of());\n }\n\n public static from(links: (ApolloLink | RequestHandler)[]): ApolloLink {\n if (links.length === 0) return ApolloLink.empty();\n return links.map(toLink).reduce((x, y) => x.concat(y)) as ApolloLink;\n }\n\n public static split(\n test: (op: Operation) => boolean,\n left: ApolloLink | RequestHandler,\n right?: ApolloLink | RequestHandler\n ): ApolloLink {\n const leftLink = toLink(left);\n const rightLink = toLink(right || new ApolloLink(passthrough));\n\n let ret: ApolloLink;\n if (isTerminating(leftLink) && isTerminating(rightLink)) {\n ret = new ApolloLink((operation) => {\n return test(operation) ?\n leftLink.request(operation) || Observable.of()\n : rightLink.request(operation) || Observable.of();\n });\n } else {\n ret = new ApolloLink((operation, forward) => {\n return test(operation) ?\n leftLink.request(operation, forward) || Observable.of()\n : rightLink.request(operation, forward) || Observable.of();\n });\n }\n return Object.assign(ret, { left: leftLink, right: rightLink });\n }\n\n public static execute(\n link: ApolloLink,\n operation: GraphQLRequest\n ): Observable<FetchResult> {\n return (\n link.request(\n createOperation(\n operation.context,\n transformOperation(validateOperation(operation))\n )\n ) || Observable.of()\n );\n }\n\n public static concat(\n first: ApolloLink | RequestHandler,\n second: ApolloLink | RequestHandler\n ) {\n const firstLink = toLink(first);\n if (isTerminating(firstLink)) {\n invariant.warn(\n `You are calling concat on a terminating link, which will have no effect %o`,\n firstLink\n );\n return firstLink;\n }\n const nextLink = toLink(second);\n\n let ret: ApolloLink;\n if (isTerminating(nextLink)) {\n ret = new ApolloLink(\n (operation) =>\n firstLink.request(\n operation,\n (op) => nextLink.request(op) || Observable.of()\n ) || Observable.of()\n );\n } else {\n ret = new ApolloLink((operation, forward) => {\n return (\n firstLink.request(operation, (op) => {\n return nextLink.request(op, forward) || Observable.of();\n }) || Observable.of()\n );\n });\n }\n return Object.assign(ret, { left: firstLink, right: nextLink });\n }\n\n constructor(request?: RequestHandler) {\n if (request) this.request = request;\n }\n\n public split(\n test: (op: Operation) => boolean,\n left: ApolloLink | RequestHandler,\n right?: ApolloLink | RequestHandler\n ): ApolloLink {\n return this.concat(\n ApolloLink.split(test, left, right || new ApolloLink(passthrough))\n );\n }\n\n public concat(next: ApolloLink | RequestHandler): ApolloLink {\n return ApolloLink.concat(this, next);\n }\n\n public request(\n operation: Operation,\n forward?: NextLink\n ): Observable<FetchResult> | null {\n throw newInvariantError(\"request is not implemented\");\n }\n\n /**\n * @deprecated `onError` will be removed with Apollo Client 4.0. Please\n * discontinue using this method.\n */\n protected onError(\n error: any,\n observer?: Observer<FetchResult>\n ): false | void {\n if (__DEV__) {\n warnDeprecated(\"onError\", () => {\n invariant.warn(\n \"[ApolloLink] `onError` is deprecated and will be removed with Apollo Client 4.0. Please discontinue using it.\"\n );\n });\n }\n if (observer && observer.error) {\n observer.error(error);\n // Returning false indicates that observer.error does not need to be\n // called again, since it was already called (on the previous line).\n // Calling observer.error again would not cause any real problems,\n // since only the first call matters, but custom onError functions\n // might have other reasons for wanting to prevent the default\n // behavior by returning false.\n return false;\n }\n // Throw errors will be passed to observer.error.\n throw error;\n }\n\n /**\n * @deprecated `setOnError` will be removed with Apollo Client 4.0. Please\n * discontinue using this method.\n */\n public setOnError(fn: ApolloLink[\"onError\"]): this {\n if (__DEV__) {\n invariant.warn(\n \"[ApolloLink] `setOnError` is deprecated and will be removed with Apollo Client 4.0. Please discontinue using it.\"\n );\n }\n this.onError = fn;\n return this;\n }\n\n /**\n * @internal\n * Used to iterate through all links that are concatenations or `split` links.\n */\n readonly left?: ApolloLink;\n /**\n * @internal\n * Used to iterate through all links that are concatenations or `split` links.\n */\n readonly right?: ApolloLink;\n\n /**\n * @internal\n * Can be provided by a link that has an internal cache to report it's memory details.\n */\n getMemoryInternals?: () => unknown;\n}\n"]}
|
package/link/core/core.cjs
CHANGED
|
@@ -5,20 +5,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var globals = require('../../utilities/globals');
|
|
6
6
|
var utilities = require('../../utilities');
|
|
7
7
|
var utils = require('../utils');
|
|
8
|
-
require('tslib');
|
|
9
|
-
var optimism = require('optimism');
|
|
10
|
-
|
|
11
|
-
var muteAllDeprecations = Symbol.for("apollo.deprecations");
|
|
12
|
-
var global = globals.global;
|
|
13
|
-
var slot = new optimism.Slot();
|
|
14
|
-
function isMuted(name) {
|
|
15
|
-
return global[muteAllDeprecations] || (slot.getValue() || []).includes(name);
|
|
16
|
-
}
|
|
17
|
-
function warnDeprecated(name, cb) {
|
|
18
|
-
if (!isMuted(name)) {
|
|
19
|
-
cb();
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
8
|
|
|
23
9
|
function passthrough(op, forward) {
|
|
24
10
|
return (forward ? forward(op) : utilities.Observable.of());
|
|
@@ -98,7 +84,7 @@ var ApolloLink = (function () {
|
|
|
98
84
|
};
|
|
99
85
|
ApolloLink.prototype.onError = function (error, observer) {
|
|
100
86
|
if (globalThis.__DEV__ !== false) {
|
|
101
|
-
warnDeprecated("onError", function () {
|
|
87
|
+
utilities.warnDeprecated("onError", function () {
|
|
102
88
|
globalThis.__DEV__ !== false && globals.invariant.warn(49);
|
|
103
89
|
});
|
|
104
90
|
}
|
package/link/core/core.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.cjs","sources":["../../utilities/deprecation/index.js","ApolloLink.js","empty.js","from.js","split.js","concat.js","execute.js"],"sourcesContent":["import { __spreadArray } from \"tslib\";\nimport { Slot } from \"optimism\";\nimport { invariant, global as untypedGlobal } from \"../globals/index.js\";\nvar muteAllDeprecations = Symbol.for(\"apollo.deprecations\");\nvar global = untypedGlobal;\nvar slot = new Slot();\nfunction isMuted(name) {\n return global[muteAllDeprecations] || (slot.getValue() || []).includes(name);\n}\nexport function muteDeprecations(name) {\n var args = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n return slot.withValue.apply(slot, __spreadArray([Array.isArray(name) ? name : [name]], args, false));\n}\nexport function warnRemovedOption(options, name, callSite, recommendation) {\n if (recommendation === void 0) { recommendation = \"Please remove this option.\"; }\n warnDeprecated(name, function () {\n if (name in options) {\n globalThis.__DEV__ !== false && invariant.warn(104, callSite, name, recommendation);\n }\n });\n}\nexport function warnDeprecated(name, cb) {\n if (!isMuted(name)) {\n cb();\n }\n}\nexport function withDisabledDeprecations() {\n var _a;\n var prev = global[muteAllDeprecations];\n global[muteAllDeprecations] = true;\n return _a = {},\n _a[Symbol.dispose] = function () {\n global[muteAllDeprecations] = prev;\n },\n _a;\n}\n//# sourceMappingURL=index.js.map","import { newInvariantError, invariant } from \"../../utilities/globals/index.js\";\nimport { Observable } from \"../../utilities/index.js\";\nimport { validateOperation, createOperation, transformOperation, } from \"../utils/index.js\";\nimport { warnDeprecated } from \"../../utilities/deprecation/index.js\";\nfunction passthrough(op, forward) {\n return (forward ? forward(op) : Observable.of());\n}\nfunction toLink(handler) {\n return typeof handler === \"function\" ? new ApolloLink(handler) : handler;\n}\nfunction isTerminating(link) {\n return link.request.length <= 1;\n}\nvar ApolloLink = /** @class */ (function () {\n function ApolloLink(request) {\n if (request)\n this.request = request;\n }\n ApolloLink.empty = function () {\n return new ApolloLink(function () { return Observable.of(); });\n };\n ApolloLink.from = function (links) {\n if (links.length === 0)\n return ApolloLink.empty();\n return links.map(toLink).reduce(function (x, y) { return x.concat(y); });\n };\n ApolloLink.split = function (test, left, right) {\n var leftLink = toLink(left);\n var rightLink = toLink(right || new ApolloLink(passthrough));\n var ret;\n if (isTerminating(leftLink) && isTerminating(rightLink)) {\n ret = new ApolloLink(function (operation) {\n return test(operation) ?\n leftLink.request(operation) || Observable.of()\n : rightLink.request(operation) || Observable.of();\n });\n }\n else {\n ret = new ApolloLink(function (operation, forward) {\n return test(operation) ?\n leftLink.request(operation, forward) || Observable.of()\n : rightLink.request(operation, forward) || Observable.of();\n });\n }\n return Object.assign(ret, { left: leftLink, right: rightLink });\n };\n ApolloLink.execute = function (link, operation) {\n return (link.request(createOperation(operation.context, transformOperation(validateOperation(operation)))) || Observable.of());\n };\n ApolloLink.concat = function (first, second) {\n var firstLink = toLink(first);\n if (isTerminating(firstLink)) {\n globalThis.__DEV__ !== false && invariant.warn(47, firstLink);\n return firstLink;\n }\n var nextLink = toLink(second);\n var ret;\n if (isTerminating(nextLink)) {\n ret = new ApolloLink(function (operation) {\n return firstLink.request(operation, function (op) { return nextLink.request(op) || Observable.of(); }) || Observable.of();\n });\n }\n else {\n ret = new ApolloLink(function (operation, forward) {\n return (firstLink.request(operation, function (op) {\n return nextLink.request(op, forward) || Observable.of();\n }) || Observable.of());\n });\n }\n return Object.assign(ret, { left: firstLink, right: nextLink });\n };\n ApolloLink.prototype.split = function (test, left, right) {\n return this.concat(ApolloLink.split(test, left, right || new ApolloLink(passthrough)));\n };\n ApolloLink.prototype.concat = function (next) {\n return ApolloLink.concat(this, next);\n };\n ApolloLink.prototype.request = function (operation, forward) {\n throw newInvariantError(48);\n };\n /**\n * @deprecated `onError` will be removed with Apollo Client 4.0. Please\n * discontinue using this method.\n */\n ApolloLink.prototype.onError = function (error, observer) {\n if (globalThis.__DEV__ !== false) {\n warnDeprecated(\"onError\", function () {\n globalThis.__DEV__ !== false && invariant.warn(49);\n });\n }\n if (observer && observer.error) {\n observer.error(error);\n // Returning false indicates that observer.error does not need to be\n // called again, since it was already called (on the previous line).\n // Calling observer.error again would not cause any real problems,\n // since only the first call matters, but custom onError functions\n // might have other reasons for wanting to prevent the default\n // behavior by returning false.\n return false;\n }\n // Throw errors will be passed to observer.error.\n throw error;\n };\n /**\n * @deprecated `setOnError` will be removed with Apollo Client 4.0. Please\n * discontinue using this method.\n */\n ApolloLink.prototype.setOnError = function (fn) {\n if (globalThis.__DEV__ !== false) {\n globalThis.__DEV__ !== false && invariant.warn(50);\n }\n this.onError = fn;\n return this;\n };\n return ApolloLink;\n}());\nexport { ApolloLink };\n//# sourceMappingURL=ApolloLink.js.map","import { ApolloLink } from \"./ApolloLink.js\";\nexport var empty = ApolloLink.empty;\n//# sourceMappingURL=empty.js.map","import { ApolloLink } from \"./ApolloLink.js\";\nexport var from = ApolloLink.from;\n//# sourceMappingURL=from.js.map","import { ApolloLink } from \"./ApolloLink.js\";\nexport var split = ApolloLink.split;\n//# sourceMappingURL=split.js.map","import { ApolloLink } from \"./ApolloLink.js\";\nexport var concat = ApolloLink.concat;\n//# sourceMappingURL=concat.js.map","import { ApolloLink } from \"./ApolloLink.js\";\nexport var execute = ApolloLink.execute;\n//# sourceMappingURL=execute.js.map"],"names":["untypedGlobal","Slot","Observable","createOperation","transformOperation","validateOperation","invariant","newInvariantError"],"mappings":";;;;;;;;;;AAGA,IAAI,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;AAC5D,IAAI,MAAM,GAAGA,cAAa,CAAC;AAC3B,IAAI,IAAI,GAAG,IAAIC,aAAI,EAAE,CAAC;AACtB,SAAS,OAAO,CAAC,IAAI,EAAE;AACvB,IAAI,OAAO,MAAM,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,EAAE,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;AACjF,CAAC;AAgBM,SAAS,cAAc,CAAC,IAAI,EAAE,EAAE,EAAE;AACzC,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;AACxB,QAAQ,EAAE,EAAE,CAAC;AACb,KAAK;AACL;;ACxBA,SAAS,WAAW,CAAC,EAAE,EAAE,OAAO,EAAE;AAClC,IAAI,QAAQ,OAAO,GAAG,OAAO,CAAC,EAAE,CAAC,GAAGC,oBAAU,CAAC,EAAE,EAAE,EAAE;AACrD,CAAC;AACD,SAAS,MAAM,CAAC,OAAO,EAAE;AACzB,IAAI,OAAO,OAAO,OAAO,KAAK,UAAU,GAAG,IAAI,UAAU,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;AAC7E,CAAC;AACD,SAAS,aAAa,CAAC,IAAI,EAAE;AAC7B,IAAI,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,CAAC;AACpC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,GAAG,UAAU,CAAC;;ACApB,IAAC,MAAM,GAAG,UAAU,CAAC;;ACArB,IAAC,OAAO,GAAG,UAAU,CAAC;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"core.cjs","sources":["ApolloLink.js","empty.js","from.js","split.js","concat.js","execute.js"],"sourcesContent":["import { newInvariantError, invariant } from \"../../utilities/globals/index.js\";\nimport { Observable } from \"../../utilities/index.js\";\nimport { validateOperation, createOperation, transformOperation, } from \"../utils/index.js\";\nimport { warnDeprecated } from \"../../utilities/index.js\";\nfunction passthrough(op, forward) {\n return (forward ? forward(op) : Observable.of());\n}\nfunction toLink(handler) {\n return typeof handler === \"function\" ? new ApolloLink(handler) : handler;\n}\nfunction isTerminating(link) {\n return link.request.length <= 1;\n}\nvar ApolloLink = /** @class */ (function () {\n function ApolloLink(request) {\n if (request)\n this.request = request;\n }\n ApolloLink.empty = function () {\n return new ApolloLink(function () { return Observable.of(); });\n };\n ApolloLink.from = function (links) {\n if (links.length === 0)\n return ApolloLink.empty();\n return links.map(toLink).reduce(function (x, y) { return x.concat(y); });\n };\n ApolloLink.split = function (test, left, right) {\n var leftLink = toLink(left);\n var rightLink = toLink(right || new ApolloLink(passthrough));\n var ret;\n if (isTerminating(leftLink) && isTerminating(rightLink)) {\n ret = new ApolloLink(function (operation) {\n return test(operation) ?\n leftLink.request(operation) || Observable.of()\n : rightLink.request(operation) || Observable.of();\n });\n }\n else {\n ret = new ApolloLink(function (operation, forward) {\n return test(operation) ?\n leftLink.request(operation, forward) || Observable.of()\n : rightLink.request(operation, forward) || Observable.of();\n });\n }\n return Object.assign(ret, { left: leftLink, right: rightLink });\n };\n ApolloLink.execute = function (link, operation) {\n return (link.request(createOperation(operation.context, transformOperation(validateOperation(operation)))) || Observable.of());\n };\n ApolloLink.concat = function (first, second) {\n var firstLink = toLink(first);\n if (isTerminating(firstLink)) {\n globalThis.__DEV__ !== false && invariant.warn(47, firstLink);\n return firstLink;\n }\n var nextLink = toLink(second);\n var ret;\n if (isTerminating(nextLink)) {\n ret = new ApolloLink(function (operation) {\n return firstLink.request(operation, function (op) { return nextLink.request(op) || Observable.of(); }) || Observable.of();\n });\n }\n else {\n ret = new ApolloLink(function (operation, forward) {\n return (firstLink.request(operation, function (op) {\n return nextLink.request(op, forward) || Observable.of();\n }) || Observable.of());\n });\n }\n return Object.assign(ret, { left: firstLink, right: nextLink });\n };\n ApolloLink.prototype.split = function (test, left, right) {\n return this.concat(ApolloLink.split(test, left, right || new ApolloLink(passthrough)));\n };\n ApolloLink.prototype.concat = function (next) {\n return ApolloLink.concat(this, next);\n };\n ApolloLink.prototype.request = function (operation, forward) {\n throw newInvariantError(48);\n };\n /**\n * @deprecated `onError` will be removed with Apollo Client 4.0. Please\n * discontinue using this method.\n */\n ApolloLink.prototype.onError = function (error, observer) {\n if (globalThis.__DEV__ !== false) {\n warnDeprecated(\"onError\", function () {\n globalThis.__DEV__ !== false && invariant.warn(49);\n });\n }\n if (observer && observer.error) {\n observer.error(error);\n // Returning false indicates that observer.error does not need to be\n // called again, since it was already called (on the previous line).\n // Calling observer.error again would not cause any real problems,\n // since only the first call matters, but custom onError functions\n // might have other reasons for wanting to prevent the default\n // behavior by returning false.\n return false;\n }\n // Throw errors will be passed to observer.error.\n throw error;\n };\n /**\n * @deprecated `setOnError` will be removed with Apollo Client 4.0. Please\n * discontinue using this method.\n */\n ApolloLink.prototype.setOnError = function (fn) {\n if (globalThis.__DEV__ !== false) {\n globalThis.__DEV__ !== false && invariant.warn(50);\n }\n this.onError = fn;\n return this;\n };\n return ApolloLink;\n}());\nexport { ApolloLink };\n//# sourceMappingURL=ApolloLink.js.map","import { ApolloLink } from \"./ApolloLink.js\";\nexport var empty = ApolloLink.empty;\n//# sourceMappingURL=empty.js.map","import { ApolloLink } from \"./ApolloLink.js\";\nexport var from = ApolloLink.from;\n//# sourceMappingURL=from.js.map","import { ApolloLink } from \"./ApolloLink.js\";\nexport var split = ApolloLink.split;\n//# sourceMappingURL=split.js.map","import { ApolloLink } from \"./ApolloLink.js\";\nexport var concat = ApolloLink.concat;\n//# sourceMappingURL=concat.js.map","import { ApolloLink } from \"./ApolloLink.js\";\nexport var execute = ApolloLink.execute;\n//# sourceMappingURL=execute.js.map"],"names":["Observable","createOperation","transformOperation","validateOperation","invariant","newInvariantError","warnDeprecated"],"mappings":";;;;;;;;AAIA,SAAS,WAAW,CAAC,EAAE,EAAE,OAAO,EAAE;AAClC,IAAI,QAAQ,OAAO,GAAG,OAAO,CAAC,EAAE,CAAC,GAAGA,oBAAU,CAAC,EAAE,EAAE,EAAE;AACrD,CAAC;AACD,SAAS,MAAM,CAAC,OAAO,EAAE;AACzB,IAAI,OAAO,OAAO,OAAO,KAAK,UAAU,GAAG,IAAI,UAAU,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;AAC7E,CAAC;AACD,SAAS,aAAa,CAAC,IAAI,EAAE;AAC7B,IAAI,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,CAAC;AACpC,CAAC;AACE,IAAC,UAAU,KAAkB,YAAY;AAC5C,IAAI,SAAS,UAAU,CAAC,OAAO,EAAE;AACjC,QAAQ,IAAI,OAAO;AACnB,YAAY,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;AACnC,KAAK;AACL,IAAI,UAAU,CAAC,KAAK,GAAG,YAAY;AACnC,QAAQ,OAAO,IAAI,UAAU,CAAC,YAAY,EAAE,OAAOA,oBAAU,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC;AACvE,KAAK,CAAC;AACN,IAAI,UAAU,CAAC,IAAI,GAAG,UAAU,KAAK,EAAE;AACvC,QAAQ,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;AAC9B,YAAY,OAAO,UAAU,CAAC,KAAK,EAAE,CAAC;AACtC,QAAQ,OAAO,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC,MAAM,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AAE;AACxC,YAAY,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAOlC,YAAY,OAAO,KAAK,CAAC;AACzB,SAAS;AAET,QAAQ,MAAM,KAAK,CAAC;AACpB,KAAK,CAAC;AAKN,IAAI,UAAU,CAAC,SAAS,CAAC,UAAU,GAAG,UAAU,EAAE,EAAE;AACpD,QAAQ,IAAI,UAAU,CAAC,OAAO,KAAK,KAAK,EAAE;AAC1C,YAAY,UAAU,CAAC,OAAO,KAAK,KAAK,IAAIA,iBAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC/D,SAAS;AACT,QAAQ,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;AAC1B,QAAQ,OAAO,IAAI,CAAC;AACpB,KAAK,CAAC;AACN,IAAI,OAAO,UAAU,CAAC;AACtB,CAAC,EAAE;;AClHO,IAAC,KAAK,GAAG,UAAU,CAAC;;ACApB,IAAC,IAAI,GAAG,UAAU,CAAC;;ACAnB,IAAC,KAAK,GAAG,UAAU,CAAC;;ACApB,IAAC,MAAM,GAAG,UAAU,CAAC;;ACArB,IAAC,OAAO,GAAG,UAAU,CAAC;;;;;;;;;"}
|
|
@@ -5,20 +5,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var globals = require('../../utilities/globals');
|
|
6
6
|
var utilities = require('../../utilities');
|
|
7
7
|
var utils = require('../utils');
|
|
8
|
-
require('tslib');
|
|
9
|
-
var optimism = require('optimism');
|
|
10
|
-
|
|
11
|
-
var muteAllDeprecations = Symbol.for("apollo.deprecations");
|
|
12
|
-
var global = globals.global;
|
|
13
|
-
var slot = new optimism.Slot();
|
|
14
|
-
function isMuted(name) {
|
|
15
|
-
return global[muteAllDeprecations] || (slot.getValue() || []).includes(name);
|
|
16
|
-
}
|
|
17
|
-
function warnDeprecated(name, cb) {
|
|
18
|
-
if (!isMuted(name)) {
|
|
19
|
-
cb();
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
8
|
|
|
23
9
|
function passthrough(op, forward) {
|
|
24
10
|
return (forward ? forward(op) : utilities.Observable.of());
|
|
@@ -98,7 +84,7 @@ var ApolloLink = (function () {
|
|
|
98
84
|
};
|
|
99
85
|
ApolloLink.prototype.onError = function (error, observer) {
|
|
100
86
|
if (globalThis.__DEV__ !== false) {
|
|
101
|
-
warnDeprecated("onError", function () {
|
|
87
|
+
utilities.warnDeprecated("onError", function () {
|
|
102
88
|
globalThis.__DEV__ !== false && globals.invariant.warn(49);
|
|
103
89
|
});
|
|
104
90
|
}
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@ var PropTypes = require('prop-types');
|
|
|
7
7
|
var hooks = require('../hooks');
|
|
8
8
|
var globals = require('../../utilities/globals');
|
|
9
9
|
var React = require('rehackt');
|
|
10
|
-
var
|
|
10
|
+
var utilities = require('../../utilities');
|
|
11
11
|
|
|
12
12
|
function _interopNamespace(e) {
|
|
13
13
|
if (e && e.__esModule) return e;
|
|
@@ -24,24 +24,12 @@ function _interopNamespace(e) {
|
|
|
24
24
|
var PropTypes__namespace = /*#__PURE__*/_interopNamespace(PropTypes);
|
|
25
25
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
26
26
|
|
|
27
|
-
var muteAllDeprecations = Symbol.for("apollo.deprecations");
|
|
28
|
-
var global = globals.global;
|
|
29
|
-
var slot = new optimism.Slot();
|
|
30
|
-
function isMuted(name) {
|
|
31
|
-
return global[muteAllDeprecations] || (slot.getValue() || []).includes(name);
|
|
32
|
-
}
|
|
33
|
-
function warnDeprecated(name, cb) {
|
|
34
|
-
if (!isMuted(name)) {
|
|
35
|
-
cb();
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
27
|
function useWarnRemoved(name, cb) {
|
|
40
28
|
"use no memo";
|
|
41
29
|
var didWarn = React__namespace.useRef(false);
|
|
42
30
|
if (globalThis.__DEV__ !== false) {
|
|
43
31
|
if (!didWarn.current) {
|
|
44
|
-
warnDeprecated(name, cb);
|
|
32
|
+
utilities.warnDeprecated(name, cb);
|
|
45
33
|
}
|
|
46
34
|
didWarn.current = true;
|
|
47
35
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components.cjs","sources":["
|
|
1
|
+
{"version":3,"file":"components.cjs","sources":["../hooks/internal/useWarnRemoved.js","Query.js","Mutation.js","Subscription.js"],"sourcesContent":["import * as React from \"rehackt\";\nimport { warnDeprecated } from \"../../../utilities/index.js\";\nexport function useWarnRemoved(name, cb) {\n \"use no memo\";\n var didWarn = React.useRef(false);\n if (globalThis.__DEV__ !== false) {\n if (!didWarn.current) {\n warnDeprecated(name, cb);\n }\n // eslint-disable-next-line react-compiler/react-compiler\n didWarn.current = true;\n }\n}\n//# sourceMappingURL=useWarnRemoved.js.map","import { __rest } from \"tslib\";\nimport * as PropTypes from \"prop-types\";\nimport { useQuery } from \"../hooks/index.js\";\nimport { invariant } from \"../../utilities/globals/index.js\";\nimport { useWarnRemoved } from \"../hooks/internal/index.js\";\n/**\n * @deprecated\n * Official support for React Apollo render prop components ended in March 2020.\n * This library is still included in the `@apollo/client` package,\n * but it no longer receives feature updates or bug fixes.\n */\nexport function Query(props) {\n useWarnRemoved(\"<Query />\", function () {\n globalThis.__DEV__ !== false && invariant.warn(66);\n });\n var children = props.children, query = props.query, options = __rest(props, [\"children\", \"query\"]);\n var result = useQuery(query, options);\n return result ? children(result) : null;\n}\nQuery.propTypes = {\n client: PropTypes.object,\n children: PropTypes.func.isRequired,\n fetchPolicy: PropTypes.string,\n notifyOnNetworkStatusChange: PropTypes.bool,\n onCompleted: PropTypes.func,\n onError: PropTypes.func,\n pollInterval: PropTypes.number,\n query: PropTypes.object.isRequired,\n variables: PropTypes.object,\n ssr: PropTypes.bool,\n partialRefetch: PropTypes.bool,\n returnPartialData: PropTypes.bool,\n};\n//# sourceMappingURL=Query.js.map","import * as PropTypes from \"prop-types\";\nimport { useMutation } from \"../hooks/index.js\";\nimport { useWarnRemoved } from \"../hooks/internal/index.js\";\nimport { invariant } from \"../../utilities/globals/index.js\";\n/**\n * @deprecated\n * Official support for React Apollo render prop components ended in March 2020.\n * This library is still included in the `@apollo/client` package,\n * but it no longer receives feature updates or bug fixes.\n */\nexport function Mutation(props) {\n useWarnRemoved(\"<Mutation />\", function () {\n globalThis.__DEV__ !== false && invariant.warn(65);\n });\n var _a = useMutation(props.mutation, props), runMutation = _a[0], result = _a[1];\n return props.children ? props.children(runMutation, result) : null;\n}\nMutation.propTypes = {\n mutation: PropTypes.object.isRequired,\n variables: PropTypes.object,\n optimisticResponse: PropTypes.oneOfType([PropTypes.object, PropTypes.func]),\n refetchQueries: PropTypes.oneOfType([\n PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.object])),\n PropTypes.func,\n ]),\n awaitRefetchQueries: PropTypes.bool,\n update: PropTypes.func,\n children: PropTypes.func.isRequired,\n onCompleted: PropTypes.func,\n onError: PropTypes.func,\n fetchPolicy: PropTypes.string,\n};\n//# sourceMappingURL=Mutation.js.map","import * as PropTypes from \"prop-types\";\nimport { useSubscription } from \"../hooks/index.js\";\nimport { useWarnRemoved } from \"../hooks/internal/index.js\";\nimport { invariant } from \"../../utilities/globals/index.js\";\n/**\n * @deprecated\n * Official support for React Apollo render prop components ended in March 2020.\n * This library is still included in the `@apollo/client` package,\n * but it no longer receives feature updates or bug fixes.\n */\nexport function Subscription(props) {\n useWarnRemoved(\"<Subscription />\", function () {\n globalThis.__DEV__ !== false && invariant.warn(67);\n });\n var result = useSubscription(props.subscription, props);\n return props.children && result ? props.children(result) : null;\n}\nSubscription.propTypes = {\n subscription: PropTypes.object.isRequired,\n variables: PropTypes.object,\n children: PropTypes.func,\n onSubscriptionData: PropTypes.func,\n onData: PropTypes.func,\n onSubscriptionComplete: PropTypes.func,\n onComplete: PropTypes.func,\n shouldResubscribe: PropTypes.oneOfType([PropTypes.func, PropTypes.bool]),\n};\n//# sourceMappingURL=Subscription.js.map"],"names":["React","warnDeprecated","invariant","__rest","useQuery","PropT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AACA,oBAAS,CAAC,IAAI,EAAEA,oBAAS,CAAC,IAAI,CAAC,CAAC;AAC5E,CAAC;;;;;;"}
|
|
@@ -7,7 +7,7 @@ var PropTypes = require('prop-types');
|
|
|
7
7
|
var hooks = require('../hooks');
|
|
8
8
|
var globals = require('../../utilities/globals');
|
|
9
9
|
var React = require('rehackt');
|
|
10
|
-
var
|
|
10
|
+
var utilities = require('../../utilities');
|
|
11
11
|
|
|
12
12
|
function _interopNamespace(e) {
|
|
13
13
|
if (e && e.__esModule) return e;
|
|
@@ -24,24 +24,12 @@ function _interopNamespace(e) {
|
|
|
24
24
|
var PropTypes__namespace = /*#__PURE__*/_interopNamespace(PropTypes);
|
|
25
25
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
26
26
|
|
|
27
|
-
var muteAllDeprecations = Symbol.for("apollo.deprecations");
|
|
28
|
-
var global = globals.global;
|
|
29
|
-
var slot = new optimism.Slot();
|
|
30
|
-
function isMuted(name) {
|
|
31
|
-
return global[muteAllDeprecations] || (slot.getValue() || []).includes(name);
|
|
32
|
-
}
|
|
33
|
-
function warnDeprecated(name, cb) {
|
|
34
|
-
if (!isMuted(name)) {
|
|
35
|
-
cb();
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
27
|
function useWarnRemoved(name, cb) {
|
|
40
28
|
"use no memo";
|
|
41
29
|
var didWarn = React__namespace.useRef(false);
|
|
42
30
|
if (globalThis.__DEV__ !== false) {
|
|
43
31
|
if (!didWarn.current) {
|
|
44
|
-
warnDeprecated(name, cb);
|
|
32
|
+
utilities.warnDeprecated(name, cb);
|
|
45
33
|
}
|
|
46
34
|
didWarn.current = true;
|
|
47
35
|
}
|