@apollo/client 4.0.0-alpha.22 → 4.0.0-alpha.23
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 +238 -2
- package/__cjs/cache/core/cache.cjs +1 -1
- package/__cjs/cache/inmemory/entityStore.cjs +3 -3
- package/__cjs/cache/inmemory/key-extractor.cjs +1 -1
- package/__cjs/cache/inmemory/key-extractor.cjs.map +1 -1
- package/__cjs/cache/inmemory/policies.cjs +4 -4
- package/__cjs/cache/inmemory/policies.cjs.map +1 -1
- package/__cjs/cache/inmemory/readFromStore.cjs +2 -2
- package/__cjs/cache/inmemory/writeToStore.cjs +4 -4
- package/__cjs/core/ApolloClient.cjs +15 -13
- package/__cjs/core/ApolloClient.cjs.map +1 -1
- package/__cjs/core/ApolloClient.d.cts +8 -3
- package/__cjs/core/ObservableQuery.cjs +52 -48
- package/__cjs/core/ObservableQuery.cjs.map +1 -1
- package/__cjs/core/ObservableQuery.d.cts +48 -14
- package/__cjs/core/QueryInfo.cjs +146 -168
- package/__cjs/core/QueryInfo.cjs.map +1 -1
- package/__cjs/core/QueryInfo.d.cts +14 -11
- package/__cjs/core/QueryManager.cjs +121 -111
- package/__cjs/core/QueryManager.cjs.map +1 -1
- package/__cjs/core/QueryManager.d.cts +4 -0
- package/__cjs/core/index.cjs +2 -1
- package/__cjs/core/index.cjs.map +1 -1
- package/__cjs/core/index.d.cts +4 -4
- package/__cjs/core/types.d.cts +68 -15
- package/__cjs/core/watchQueryOptions.d.cts +2 -24
- package/__cjs/dev/setErrorMessageHandler.cjs.map +1 -1
- package/__cjs/errors/CombinedGraphQLErrors.cjs +6 -3
- package/__cjs/errors/CombinedGraphQLErrors.cjs.map +1 -1
- package/__cjs/errors/CombinedGraphQLErrors.d.cts +7 -2
- package/__cjs/errors/index.cjs +1 -1
- package/__cjs/errors/index.cjs.map +1 -1
- package/__cjs/errors/index.d.cts +1 -3
- package/__cjs/incremental/handlers/defer20220824.cjs +102 -0
- package/__cjs/incremental/handlers/defer20220824.cjs.map +1 -0
- package/__cjs/incremental/handlers/defer20220824.d.cts +55 -0
- package/__cjs/incremental/handlers/notImplemented.cjs +19 -0
- package/__cjs/incremental/handlers/notImplemented.cjs.map +1 -0
- package/__cjs/incremental/handlers/notImplemented.d.cts +9 -0
- package/__cjs/incremental/index.cjs +9 -0
- package/__cjs/incremental/index.cjs.map +1 -0
- package/__cjs/incremental/index.d.cts +4 -0
- package/__cjs/incremental/types.cjs +3 -0
- package/__cjs/incremental/types.cjs.map +1 -0
- package/__cjs/incremental/types.d.cts +24 -0
- package/__cjs/invariantErrorCodes.cjs +62 -45
- package/__cjs/link/context/index.cjs +36 -25
- package/__cjs/link/context/index.cjs.map +1 -1
- package/__cjs/link/context/index.d.cts +8 -1
- package/__cjs/link/core/types.d.cts +4 -32
- package/__cjs/link/error/index.cjs +68 -65
- package/__cjs/link/error/index.cjs.map +1 -1
- package/__cjs/link/error/index.d.cts +15 -14
- package/__cjs/link/http/BaseHttpLink.cjs +0 -6
- package/__cjs/link/http/BaseHttpLink.cjs.map +1 -1
- package/__cjs/link/http/HttpLink.cjs +4 -0
- package/__cjs/link/http/HttpLink.cjs.map +1 -1
- package/__cjs/link/http/HttpLink.d.cts +4 -0
- package/__cjs/link/http/parseAndCheckHttpResponse.cjs +45 -57
- package/__cjs/link/http/parseAndCheckHttpResponse.cjs.map +1 -1
- package/__cjs/link/index.cjs.map +1 -1
- package/__cjs/link/index.d.cts +1 -1
- package/__cjs/link/persisted-queries/index.cjs +158 -142
- package/__cjs/link/persisted-queries/index.cjs.map +1 -1
- package/__cjs/link/persisted-queries/index.d.cts +19 -19
- package/__cjs/link/remove-typename/index.cjs +2 -1
- package/__cjs/link/remove-typename/index.cjs.map +1 -1
- package/__cjs/link/remove-typename/index.d.cts +1 -1
- package/__cjs/link/remove-typename/removeTypenameFromVariables.cjs +34 -23
- package/__cjs/link/remove-typename/removeTypenameFromVariables.cjs.map +1 -1
- package/__cjs/link/remove-typename/removeTypenameFromVariables.d.cts +8 -9
- package/__cjs/local-state/LocalState.cjs.map +1 -1
- package/__cjs/local-state/LocalState.d.cts +3 -4
- package/__cjs/masking/types.d.cts +6 -5
- package/__cjs/react/hooks/useBackgroundQuery.cjs +1 -0
- package/__cjs/react/hooks/useBackgroundQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useFragment.cjs +1 -0
- package/__cjs/react/hooks/useFragment.cjs.map +1 -1
- package/__cjs/react/hooks/useLazyQuery.cjs +2 -2
- package/__cjs/react/hooks/useLazyQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useLazyQuery.d.cts +2 -7
- package/__cjs/react/hooks/useLoadableQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useMutation.cjs.map +1 -1
- package/__cjs/react/hooks/useMutation.d.cts +2 -2
- package/__cjs/react/hooks/useQuery.cjs +23 -21
- package/__cjs/react/hooks/useQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useQuery.d.cts +3 -8
- package/__cjs/react/hooks/useQueryRefHandlers.cjs +1 -0
- package/__cjs/react/hooks/useQueryRefHandlers.cjs.map +1 -1
- package/__cjs/react/hooks/useReadQuery.cjs +1 -0
- package/__cjs/react/hooks/useReadQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useSuspenseFragment.cjs +1 -0
- package/__cjs/react/hooks/useSuspenseFragment.cjs.map +1 -1
- package/__cjs/react/hooks/useSuspenseQuery.cjs +1 -0
- package/__cjs/react/hooks/useSuspenseQuery.cjs.map +1 -1
- package/__cjs/react/internal/cache/QueryReference.cjs +4 -4
- package/__cjs/react/internal/cache/QueryReference.cjs.map +1 -1
- package/__cjs/react/internal/cache/QueryReference.d.cts +2 -3
- package/__cjs/react/internal/types.d.cts +2 -7
- package/__cjs/utilities/graphql/isFormattedExecutionResult.cjs +9 -0
- package/__cjs/utilities/graphql/isFormattedExecutionResult.cjs.map +1 -0
- package/__cjs/utilities/graphql/isFormattedExecutionResult.d.cts +3 -0
- package/__cjs/utilities/index.cjs +3 -1
- package/__cjs/utilities/index.cjs.map +1 -1
- package/__cjs/utilities/index.d.cts +1 -0
- package/__cjs/utilities/internal/getGraphQLErrorsFromResult.cjs +1 -12
- package/__cjs/utilities/internal/getGraphQLErrorsFromResult.cjs.map +1 -1
- package/__cjs/utilities/internal/getGraphQLErrorsFromResult.d.cts +4 -2
- package/__cjs/utilities/internal/graphQLResultHasError.cjs +1 -4
- package/__cjs/utilities/internal/graphQLResultHasError.cjs.map +1 -1
- package/__cjs/utilities/internal/graphQLResultHasError.d.cts +2 -2
- package/__cjs/utilities/internal/index.cjs +2 -10
- package/__cjs/utilities/internal/index.cjs.map +1 -1
- package/__cjs/utilities/internal/index.d.cts +0 -4
- package/__cjs/version.cjs +3 -2
- package/__cjs/version.cjs.map +1 -1
- package/__cjs/version.d.cts +1 -0
- package/cache/core/cache.js +1 -1
- package/cache/inmemory/entityStore.js +3 -3
- package/cache/inmemory/key-extractor.js +1 -1
- package/cache/inmemory/key-extractor.js.map +1 -1
- package/cache/inmemory/policies.js +4 -4
- package/cache/inmemory/policies.js.map +1 -1
- package/cache/inmemory/readFromStore.js +2 -2
- package/cache/inmemory/writeToStore.js +4 -4
- package/core/ApolloClient.d.ts +8 -3
- package/core/ApolloClient.js +15 -13
- package/core/ApolloClient.js.map +1 -1
- package/core/ObservableQuery.d.ts +48 -14
- package/core/ObservableQuery.js +53 -49
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryInfo.d.ts +14 -11
- package/core/QueryInfo.js +147 -169
- package/core/QueryInfo.js.map +1 -1
- package/core/QueryManager.d.ts +4 -0
- package/core/QueryManager.js +123 -113
- package/core/QueryManager.js.map +1 -1
- package/core/index.d.ts +4 -4
- package/core/index.js +1 -1
- package/core/index.js.map +1 -1
- package/core/types.d.ts +68 -15
- package/core/watchQueryOptions.d.ts +2 -24
- package/dev/setErrorMessageHandler.js.map +1 -1
- package/errors/CombinedGraphQLErrors.d.ts +7 -2
- package/errors/CombinedGraphQLErrors.js +6 -3
- package/errors/CombinedGraphQLErrors.js.map +1 -1
- package/errors/index.d.ts +1 -3
- package/errors/index.js +1 -1
- package/errors/index.js.map +1 -1
- package/incremental/handlers/defer20220824.d.ts +55 -0
- package/incremental/handlers/defer20220824.js +97 -0
- package/incremental/handlers/defer20220824.js.map +1 -0
- package/incremental/handlers/notImplemented.d.ts +9 -0
- package/incremental/handlers/notImplemented.js +15 -0
- package/incremental/handlers/notImplemented.js.map +1 -0
- package/incremental/index.d.ts +4 -0
- package/incremental/index.js +3 -0
- package/incremental/index.js.map +1 -0
- package/incremental/types.d.ts +24 -0
- package/incremental/types.js +2 -0
- package/incremental/types.js.map +1 -0
- package/invariantErrorCodes.js +63 -49
- package/legacyEntryPoints/incremental/incremental.cjs +1 -0
- package/legacyEntryPoints/incremental/incremental.d.cts +1 -0
- package/legacyEntryPoints/incremental/index.d.ts +1 -0
- package/legacyEntryPoints/incremental/index.js +1 -0
- package/link/context/index.d.ts +8 -1
- package/link/context/index.js +34 -25
- package/link/context/index.js.map +1 -1
- package/link/core/types.d.ts +4 -32
- package/link/error/index.d.ts +15 -14
- package/link/error/index.js +68 -65
- package/link/error/index.js.map +1 -1
- package/link/http/BaseHttpLink.js +1 -7
- package/link/http/BaseHttpLink.js.map +1 -1
- package/link/http/HttpLink.d.ts +4 -0
- package/link/http/HttpLink.js +4 -0
- package/link/http/HttpLink.js.map +1 -1
- package/link/http/parseAndCheckHttpResponse.js +45 -57
- package/link/http/parseAndCheckHttpResponse.js.map +1 -1
- package/link/index.d.ts +1 -1
- package/link/index.js.map +1 -1
- package/link/persisted-queries/index.d.ts +19 -19
- package/link/persisted-queries/index.js +156 -141
- package/link/persisted-queries/index.js.map +1 -1
- package/link/remove-typename/index.d.ts +1 -1
- package/link/remove-typename/index.js +1 -1
- package/link/remove-typename/index.js.map +1 -1
- package/link/remove-typename/removeTypenameFromVariables.d.ts +8 -9
- package/link/remove-typename/removeTypenameFromVariables.js +32 -22
- package/link/remove-typename/removeTypenameFromVariables.js.map +1 -1
- package/local-state/LocalState.d.ts +3 -4
- package/local-state/LocalState.js.map +1 -1
- package/masking/types.d.ts +6 -5
- package/package.json +9 -2
- package/react/hooks/useApolloClient.js +14 -1
- package/react/hooks/useApolloClient.js.map +1 -1
- package/react/hooks/useBackgroundQuery.js +7 -6
- package/react/hooks/useBackgroundQuery.js.map +1 -1
- package/react/hooks/useFragment.js +12 -11
- package/react/hooks/useFragment.js.map +1 -1
- package/react/hooks/useLazyQuery.d.ts +2 -7
- package/react/hooks/useLazyQuery.js +15 -15
- package/react/hooks/useLazyQuery.js.map +1 -1
- package/react/hooks/useLoadableQuery.js +229 -69
- package/react/hooks/useLoadableQuery.js.map +1 -1
- package/react/hooks/useMutation.d.ts +2 -2
- package/react/hooks/useMutation.js +191 -81
- package/react/hooks/useMutation.js.map +1 -1
- package/react/hooks/useQuery.d.ts +3 -8
- package/react/hooks/useQuery.js +243 -70
- package/react/hooks/useQuery.js.map +1 -1
- package/react/hooks/useQueryRefHandlers.js +64 -23
- package/react/hooks/useQueryRefHandlers.js.map +1 -1
- package/react/hooks/useReadQuery.js +3 -2
- package/react/hooks/useReadQuery.js.map +1 -1
- package/react/hooks/useSubscription.js +4 -4
- package/react/hooks/useSubscription.js.map +1 -1
- package/react/hooks/useSuspenseFragment.js +1 -0
- package/react/hooks/useSuspenseFragment.js.map +1 -1
- package/react/hooks/useSuspenseQuery.js +59 -33
- package/react/hooks/useSuspenseQuery.js.map +1 -1
- package/react/internal/cache/QueryReference.d.ts +2 -3
- package/react/internal/cache/QueryReference.js +4 -4
- package/react/internal/cache/QueryReference.js.map +1 -1
- package/react/internal/types.d.ts +2 -7
- package/utilities/graphql/isFormattedExecutionResult.d.ts +3 -0
- package/utilities/graphql/isFormattedExecutionResult.js +6 -0
- package/utilities/graphql/isFormattedExecutionResult.js.map +1 -0
- package/utilities/index.d.ts +1 -0
- package/utilities/index.js +1 -0
- package/utilities/index.js.map +1 -1
- package/utilities/internal/getGraphQLErrorsFromResult.d.ts +4 -2
- package/utilities/internal/getGraphQLErrorsFromResult.js +1 -12
- package/utilities/internal/getGraphQLErrorsFromResult.js.map +1 -1
- package/utilities/internal/graphQLResultHasError.d.ts +2 -2
- package/utilities/internal/graphQLResultHasError.js +1 -4
- package/utilities/internal/graphQLResultHasError.js.map +1 -1
- package/utilities/internal/index.d.ts +0 -4
- package/utilities/internal/index.js +0 -4
- package/utilities/internal/index.js.map +1 -1
- package/version.d.ts +1 -0
- package/version.js +2 -1
- package/version.js.map +1 -1
- package/__cjs/utilities/internal/isExecutionPatchIncrementalResult.cjs +0 -12
- package/__cjs/utilities/internal/isExecutionPatchIncrementalResult.cjs.map +0 -1
- package/__cjs/utilities/internal/isExecutionPatchIncrementalResult.d.cts +0 -8
- package/__cjs/utilities/internal/isExecutionPatchIninitialResult.cjs +0 -12
- package/__cjs/utilities/internal/isExecutionPatchIninitialResult.cjs.map +0 -1
- package/__cjs/utilities/internal/isExecutionPatchIninitialResult.d.cts +0 -8
- package/__cjs/utilities/internal/isExecutionPatchResult.cjs +0 -15
- package/__cjs/utilities/internal/isExecutionPatchResult.cjs.map +0 -1
- package/__cjs/utilities/internal/isExecutionPatchResult.d.cts +0 -8
- package/__cjs/utilities/internal/mergeIncrementalData.cjs +0 -30
- package/__cjs/utilities/internal/mergeIncrementalData.cjs.map +0 -1
- package/__cjs/utilities/internal/mergeIncrementalData.d.cts +0 -8
- package/utilities/internal/isExecutionPatchIncrementalResult.d.ts +0 -8
- package/utilities/internal/isExecutionPatchIncrementalResult.js +0 -9
- package/utilities/internal/isExecutionPatchIncrementalResult.js.map +0 -1
- package/utilities/internal/isExecutionPatchIninitialResult.d.ts +0 -8
- package/utilities/internal/isExecutionPatchIninitialResult.js +0 -9
- package/utilities/internal/isExecutionPatchIninitialResult.js.map +0 -1
- package/utilities/internal/isExecutionPatchResult.d.ts +0 -8
- package/utilities/internal/isExecutionPatchResult.js +0 -12
- package/utilities/internal/isExecutionPatchResult.js.map +0 -1
- package/utilities/internal/mergeIncrementalData.d.ts +0 -8
- package/utilities/internal/mergeIncrementalData.js +0 -27
- package/utilities/internal/mergeIncrementalData.js.map +0 -1
|
@@ -352,6 +352,12 @@ const client = new ApolloClient({
|
|
|
352
352
|
},
|
|
353
353
|
|
|
354
354
|
66: {
|
|
355
|
+
file: "@apollo/client/__cjs/incremental/handlers/notImplemented.cjs",
|
|
356
|
+
condition: "!(0, internal_1.hasDirectives)([\"defer\"], request.query)",
|
|
357
|
+
message: "`@defer` is not supported without specifying an incremental handler. Please pass a handler as the `incrementalHandler` option to the `ApolloClient` constructor."
|
|
358
|
+
},
|
|
359
|
+
|
|
360
|
+
67: {
|
|
355
361
|
file: "@apollo/client/__cjs/core/ApolloClient.cjs",
|
|
356
362
|
condition: "options.cache",
|
|
357
363
|
|
|
@@ -360,7 +366,7 @@ const client = new ApolloClient({
|
|
|
360
366
|
"For more information, please visit: https://go.apollo.dev/c/docs"
|
|
361
367
|
},
|
|
362
368
|
|
|
363
|
-
|
|
369
|
+
68: {
|
|
364
370
|
file: "@apollo/client/__cjs/core/ApolloClient.cjs",
|
|
365
371
|
condition: "options.link",
|
|
366
372
|
|
|
@@ -369,7 +375,7 @@ const client = new ApolloClient({
|
|
|
369
375
|
"For more information, please visit: https://go.apollo.dev/c/docs"
|
|
370
376
|
},
|
|
371
377
|
|
|
372
|
-
|
|
378
|
+
69: {
|
|
373
379
|
file: "@apollo/client/__cjs/core/ApolloClient.cjs",
|
|
374
380
|
condition: "options.fetchPolicy !== \"cache-and-network\"",
|
|
375
381
|
|
|
@@ -379,7 +385,7 @@ const client = new ApolloClient({
|
|
|
379
385
|
"using a different fetchPolicy, such as cache-first or network-only."
|
|
380
386
|
},
|
|
381
387
|
|
|
382
|
-
|
|
388
|
+
70: {
|
|
383
389
|
file: "@apollo/client/__cjs/core/ApolloClient.cjs",
|
|
384
390
|
condition: "options.fetchPolicy !== \"standby\"",
|
|
385
391
|
|
|
@@ -388,7 +394,7 @@ const client = new ApolloClient({
|
|
|
388
394
|
"as cache-first or network-only."
|
|
389
395
|
},
|
|
390
396
|
|
|
391
|
-
|
|
397
|
+
71: {
|
|
392
398
|
file: "@apollo/client/__cjs/core/ApolloClient.cjs",
|
|
393
399
|
condition: "options.query",
|
|
394
400
|
|
|
@@ -396,152 +402,158 @@ const client = new ApolloClient({
|
|
|
396
402
|
"in the query option."
|
|
397
403
|
},
|
|
398
404
|
|
|
399
|
-
|
|
405
|
+
72: {
|
|
400
406
|
file: "@apollo/client/__cjs/core/ApolloClient.cjs",
|
|
401
407
|
condition: "options.query.kind === \"Document\"",
|
|
402
408
|
message: 'You must wrap the query string in a "gql" tag.'
|
|
403
409
|
},
|
|
404
410
|
|
|
405
|
-
|
|
411
|
+
73: {
|
|
406
412
|
file: "@apollo/client/__cjs/core/ApolloClient.cjs",
|
|
407
413
|
condition: "!options.returnPartialData",
|
|
408
414
|
message: "returnPartialData option only supported on watchQuery."
|
|
409
415
|
},
|
|
410
416
|
|
|
411
|
-
|
|
417
|
+
74: {
|
|
412
418
|
file: "@apollo/client/__cjs/core/ApolloClient.cjs",
|
|
413
419
|
condition: "!options.pollInterval",
|
|
414
420
|
message: "pollInterval option only supported on watchQuery."
|
|
415
421
|
},
|
|
416
422
|
|
|
417
|
-
|
|
423
|
+
75: {
|
|
418
424
|
file: "@apollo/client/__cjs/core/ApolloClient.cjs",
|
|
419
425
|
condition: "!options.notifyOnNetworkStatusChange",
|
|
420
426
|
message: "notifyOnNetworkStatusChange option only supported on watchQuery."
|
|
421
427
|
},
|
|
422
428
|
|
|
423
|
-
|
|
429
|
+
76: {
|
|
424
430
|
file: "@apollo/client/__cjs/core/ApolloClient.cjs",
|
|
425
431
|
condition: "optionsWithDefaults.mutation",
|
|
426
432
|
message: "The `mutation` option is required. Please provide a GraphQL document in the `mutation` option."
|
|
427
433
|
},
|
|
428
434
|
|
|
429
|
-
|
|
435
|
+
77: {
|
|
430
436
|
file: "@apollo/client/__cjs/core/ApolloClient.cjs",
|
|
431
437
|
condition: "optionsWithDefaults.fetchPolicy === \"network-only\" ||\n optionsWithDefaults.fetchPolicy === \"no-cache\"",
|
|
432
438
|
message: "Mutations only support 'network-only' or 'no-cache' fetch policies. The default 'network-only' behavior automatically writes mutation results to the cache. Passing 'no-cache' skips the cache write."
|
|
433
439
|
},
|
|
434
440
|
|
|
435
|
-
|
|
441
|
+
80: {
|
|
436
442
|
file: "@apollo/client/__cjs/core/ObservableQuery.cjs",
|
|
437
|
-
condition: "
|
|
438
|
-
message: "
|
|
443
|
+
condition: "this.options.fetchPolicy !== \"cache-only\"",
|
|
444
|
+
message: "Cannot execute `fetchMore` for 'cache-only' query '%s'. Please use a different fetch policy."
|
|
439
445
|
},
|
|
440
446
|
|
|
441
447
|
81: {
|
|
442
448
|
file: "@apollo/client/__cjs/core/ObservableQuery.cjs",
|
|
443
|
-
condition: "
|
|
444
|
-
message: "
|
|
449
|
+
condition: "updateQuery",
|
|
450
|
+
message: "You must provide an `updateQuery` function when using `fetchMore` with a `no-cache` fetch policy."
|
|
445
451
|
},
|
|
446
452
|
|
|
447
|
-
|
|
453
|
+
85: {
|
|
448
454
|
file: "@apollo/client/__cjs/core/QueryManager.cjs",
|
|
449
455
|
message: "QueryManager stopped while query was in flight"
|
|
450
456
|
},
|
|
451
457
|
|
|
452
|
-
|
|
458
|
+
86: {
|
|
453
459
|
file: "@apollo/client/__cjs/core/QueryManager.cjs",
|
|
454
460
|
condition: "this.localState",
|
|
455
461
|
message: "Mutation '%s' contains `@client` fields with variables provided by `@export` but local state has not been configured."
|
|
456
462
|
},
|
|
457
463
|
|
|
458
|
-
|
|
464
|
+
87: {
|
|
459
465
|
file: "@apollo/client/__cjs/core/QueryManager.cjs",
|
|
460
466
|
message: "Store reset while query was in flight (not completed in link chain)"
|
|
461
467
|
},
|
|
462
468
|
|
|
463
|
-
|
|
469
|
+
90: {
|
|
464
470
|
file: "@apollo/client/__cjs/core/QueryManager.cjs",
|
|
465
471
|
condition: "!this.getDocumentInfo(query).hasClientExports || this.localState",
|
|
466
472
|
message: "Subscription '%s' contains `@client` fields with variables provided by `@export` but local state has not been configured."
|
|
467
473
|
},
|
|
468
474
|
|
|
469
|
-
|
|
475
|
+
91: {
|
|
470
476
|
file: "@apollo/client/__cjs/core/QueryManager.cjs",
|
|
471
477
|
condition: "this.localState",
|
|
472
478
|
message: "%s '%s' contains `@client` fields but local state has not been configured."
|
|
473
479
|
},
|
|
474
480
|
|
|
475
|
-
|
|
481
|
+
92: {
|
|
482
|
+
file: "@apollo/client/__cjs/core/QueryManager.cjs",
|
|
483
|
+
condition: "!hasIncrementalDirective",
|
|
484
|
+
message: "%s '%s' contains `@client` and `@defer` directives. These cannot be used together."
|
|
485
|
+
},
|
|
486
|
+
|
|
487
|
+
93: {
|
|
476
488
|
file: "@apollo/client/__cjs/core/QueryManager.cjs",
|
|
477
489
|
condition: "this.localState",
|
|
478
490
|
message: "Query '%s' contains `@client` fields with variables provided by `@export` but local state has not been configured."
|
|
479
491
|
},
|
|
480
492
|
|
|
481
|
-
|
|
493
|
+
95: {
|
|
482
494
|
file: "@apollo/client/__cjs/core/QueryManager.cjs",
|
|
483
495
|
condition: "this.localState",
|
|
484
496
|
message: "Query '%s' contains `@client` fields but local state has not been configured."
|
|
485
497
|
},
|
|
486
498
|
|
|
487
|
-
|
|
499
|
+
96: {
|
|
488
500
|
file: "@apollo/client/__cjs/core/QueryManager.cjs",
|
|
489
501
|
condition: "didEmitValue",
|
|
490
502
|
message: "The link chain completed without emitting a value. This is likely unintentional and should be updated to emit a value before completing."
|
|
491
503
|
},
|
|
492
504
|
|
|
493
|
-
|
|
505
|
+
97: {
|
|
494
506
|
file: "@apollo/client/__cjs/cache/inmemory/entityStore.cjs",
|
|
495
507
|
condition: "typeof dataId === \"string\"",
|
|
496
508
|
message: "store.merge expects a string ID"
|
|
497
509
|
},
|
|
498
510
|
|
|
499
|
-
|
|
511
|
+
100: {
|
|
500
512
|
file: "@apollo/client/__cjs/cache/inmemory/key-extractor.cjs",
|
|
501
513
|
condition: "extracted !== void 0",
|
|
502
514
|
message: `Missing field '%s' while extracting keyFields from %s`
|
|
503
515
|
},
|
|
504
516
|
|
|
505
|
-
|
|
517
|
+
101: {
|
|
506
518
|
file: "@apollo/client/__cjs/cache/inmemory/policies.cjs",
|
|
507
519
|
condition: "!old || old === which",
|
|
508
520
|
message: `Cannot change root %s __typename more than once`
|
|
509
521
|
},
|
|
510
522
|
|
|
511
|
-
|
|
523
|
+
104: {
|
|
512
524
|
file: "@apollo/client/__cjs/cache/inmemory/policies.cjs",
|
|
513
525
|
message: "Cannot automatically merge arrays"
|
|
514
526
|
},
|
|
515
527
|
|
|
516
|
-
|
|
528
|
+
105: {
|
|
517
529
|
file: "@apollo/client/__cjs/cache/inmemory/readFromStore.cjs",
|
|
518
530
|
message: `No fragment named %s`
|
|
519
531
|
},
|
|
520
532
|
|
|
521
|
-
|
|
533
|
+
106: {
|
|
522
534
|
file: "@apollo/client/__cjs/cache/inmemory/readFromStore.cjs",
|
|
523
535
|
condition: "!(0, utilities_1.isReference)(value)",
|
|
524
536
|
message: `Missing selection set for object of type %s returned for query field %s`
|
|
525
537
|
},
|
|
526
538
|
|
|
527
|
-
|
|
539
|
+
107: {
|
|
528
540
|
file: "@apollo/client/__cjs/cache/inmemory/writeToStore.cjs",
|
|
529
541
|
message: `Could not identify object %s`
|
|
530
542
|
},
|
|
531
543
|
|
|
532
|
-
|
|
544
|
+
109: {
|
|
533
545
|
file: "@apollo/client/__cjs/cache/inmemory/writeToStore.cjs",
|
|
534
546
|
message: `No fragment named %s`
|
|
535
547
|
}
|
|
536
548
|
};
|
|
537
549
|
|
|
538
550
|
export const devDebug = {
|
|
539
|
-
|
|
551
|
+
78: {
|
|
540
552
|
file: "@apollo/client/__cjs/core/ApolloClient.cjs",
|
|
541
553
|
message: `In client.refetchQueries, Promise.all promise rejected with error %o`
|
|
542
554
|
},
|
|
543
555
|
|
|
544
|
-
|
|
556
|
+
84: {
|
|
545
557
|
file: "@apollo/client/__cjs/core/ObservableQuery.cjs",
|
|
546
558
|
message: `Missing cache result fields: %o`
|
|
547
559
|
}
|
|
@@ -600,29 +612,34 @@ export const devWarn = {
|
|
|
600
612
|
message: `You are calling concat on a terminating link, which will have no effect %o`
|
|
601
613
|
},
|
|
602
614
|
|
|
603
|
-
|
|
615
|
+
79: {
|
|
604
616
|
file: "@apollo/client/__cjs/core/ObservableQuery.cjs",
|
|
605
617
|
|
|
606
618
|
message: `Called refetch(%o) for query %o, which does not declare a $variables variable.
|
|
607
619
|
Did you mean to call refetch(variables) instead of refetch({ variables })?`
|
|
608
620
|
},
|
|
609
621
|
|
|
610
|
-
|
|
622
|
+
83: {
|
|
623
|
+
file: "@apollo/client/__cjs/core/ObservableQuery.cjs",
|
|
624
|
+
message: "Cannot poll on 'cache-only' query '%s' and as such, polling is disabled. Please use a different fetch policy."
|
|
625
|
+
},
|
|
626
|
+
|
|
627
|
+
88: {
|
|
611
628
|
file: "@apollo/client/__cjs/core/QueryManager.cjs",
|
|
612
629
|
message: `Unknown query named "%s" requested in refetchQueries options.include array`
|
|
613
630
|
},
|
|
614
631
|
|
|
615
|
-
|
|
632
|
+
89: {
|
|
616
633
|
file: "@apollo/client/__cjs/core/QueryManager.cjs",
|
|
617
634
|
message: `Unknown anonymous query requested in refetchQueries options.include array`
|
|
618
635
|
},
|
|
619
636
|
|
|
620
|
-
|
|
637
|
+
94: {
|
|
621
638
|
file: "@apollo/client/__cjs/core/QueryManager.cjs",
|
|
622
639
|
message: '[%s]: Fragments masked by data masking are inaccessible when using fetch policy "no-cache". Please add `@unmask` to each fragment spread to access the data.'
|
|
623
640
|
},
|
|
624
641
|
|
|
625
|
-
|
|
642
|
+
98: {
|
|
626
643
|
file: "@apollo/client/__cjs/cache/inmemory/entityStore.cjs",
|
|
627
644
|
|
|
628
645
|
message: "cache.modify: You are trying to write a Reference that is not part of the store: %o\n" +
|
|
@@ -630,24 +647,24 @@ Did you mean to call refetch(variables) instead of refetch({ variables })?`
|
|
|
630
647
|
"`toReference(object, true)`"
|
|
631
648
|
},
|
|
632
649
|
|
|
633
|
-
|
|
650
|
+
99: {
|
|
634
651
|
file: "@apollo/client/__cjs/cache/inmemory/entityStore.cjs",
|
|
635
652
|
|
|
636
653
|
message: "cache.modify: Writing an array with a mix of both References and Objects will not result in the Objects being normalized correctly.\n" +
|
|
637
654
|
"Please convert the object instance %o to a Reference before writing it to the cache by calling `toReference(object, true)`."
|
|
638
655
|
},
|
|
639
656
|
|
|
640
|
-
|
|
657
|
+
102: {
|
|
641
658
|
file: "@apollo/client/__cjs/cache/inmemory/policies.cjs",
|
|
642
659
|
message: `Inferring subtype %s of supertype %s`
|
|
643
660
|
},
|
|
644
661
|
|
|
645
|
-
|
|
662
|
+
103: {
|
|
646
663
|
file: "@apollo/client/__cjs/cache/inmemory/policies.cjs",
|
|
647
664
|
message: `Undefined 'from' passed to readField with arguments %s`
|
|
648
665
|
},
|
|
649
666
|
|
|
650
|
-
|
|
667
|
+
110: {
|
|
651
668
|
file: "@apollo/client/__cjs/cache/inmemory/writeToStore.cjs",
|
|
652
669
|
|
|
653
670
|
message: `Cache data may be lost when replacing the %s field of a %s object.
|
|
@@ -666,7 +683,7 @@ For more information about these options, please refer to the documentation:
|
|
|
666
683
|
`
|
|
667
684
|
},
|
|
668
685
|
|
|
669
|
-
|
|
686
|
+
111: {
|
|
670
687
|
file: "@apollo/client/__cjs/cache/core/cache.cjs",
|
|
671
688
|
message: "Could not identify object passed to `from` for '%s' fragment, either because the object is non-normalized or the key fields are missing. If you are masking this object, please ensure the key fields are requested by the parent object."
|
|
672
689
|
}
|
|
@@ -683,12 +700,12 @@ export const devError = {
|
|
|
683
700
|
message: "The result of getSnapshot should be cached to avoid an infinite loop"
|
|
684
701
|
},
|
|
685
702
|
|
|
686
|
-
|
|
703
|
+
82: {
|
|
687
704
|
file: "@apollo/client/__cjs/core/ObservableQuery.cjs",
|
|
688
705
|
message: "Unhandled GraphQL subscription error"
|
|
689
706
|
},
|
|
690
707
|
|
|
691
|
-
|
|
708
|
+
108: {
|
|
692
709
|
file: "@apollo/client/__cjs/cache/inmemory/writeToStore.cjs",
|
|
693
710
|
message: `Missing field '%s' while writing result %o`
|
|
694
711
|
}
|
|
@@ -1,34 +1,45 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SetContextLink = void 0;
|
|
3
4
|
exports.setContext = setContext;
|
|
4
5
|
const rxjs_1 = require("rxjs");
|
|
5
6
|
const link_1 = require("@apollo/client/link");
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated
|
|
9
|
+
* Use `SetContextLink` from `@apollo/client/link/context` instead.
|
|
10
|
+
*/
|
|
6
11
|
function setContext(setter) {
|
|
7
|
-
return new
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
12
|
+
return new SetContextLink(setter);
|
|
13
|
+
}
|
|
14
|
+
class SetContextLink extends link_1.ApolloLink {
|
|
15
|
+
constructor(setter) {
|
|
16
|
+
super((operation, forward) => {
|
|
17
|
+
const { ...request } = operation;
|
|
18
|
+
return new rxjs_1.Observable((observer) => {
|
|
19
|
+
let handle;
|
|
20
|
+
let closed = false;
|
|
21
|
+
Promise.resolve(request)
|
|
22
|
+
.then((req) => setter(req, operation.getContext()))
|
|
23
|
+
.then(operation.setContext)
|
|
24
|
+
.then(() => {
|
|
25
|
+
// if the observer is already closed, no need to subscribe.
|
|
26
|
+
if (closed)
|
|
27
|
+
return;
|
|
28
|
+
handle = forward(operation).subscribe({
|
|
29
|
+
next: observer.next.bind(observer),
|
|
30
|
+
error: observer.error.bind(observer),
|
|
31
|
+
complete: observer.complete.bind(observer),
|
|
32
|
+
});
|
|
33
|
+
})
|
|
34
|
+
.catch(observer.error.bind(observer));
|
|
35
|
+
return () => {
|
|
36
|
+
closed = true;
|
|
37
|
+
if (handle)
|
|
38
|
+
handle.unsubscribe();
|
|
39
|
+
};
|
|
40
|
+
});
|
|
31
41
|
});
|
|
32
|
-
}
|
|
42
|
+
}
|
|
33
43
|
}
|
|
44
|
+
exports.SetContextLink = SetContextLink;
|
|
34
45
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../../src/link/context/index.ts"],"sourcesContent":["import type { Subscription } from \"rxjs\";\nimport { Observable } from \"rxjs\";\n\nimport type { GraphQLRequest, OperationContext } from \"@apollo/client/link\";\nimport { ApolloLink } from \"@apollo/client/link\";\n\nexport type ContextSetter = (\n operation: GraphQLRequest,\n prevContext: OperationContext\n) => Promise<Partial<OperationContext>> | Partial<OperationContext>;\n\nexport function setContext(setter: ContextSetter)
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../../src/link/context/index.ts"],"sourcesContent":["import type { Subscription } from \"rxjs\";\nimport { Observable } from \"rxjs\";\n\nimport type { GraphQLRequest, OperationContext } from \"@apollo/client/link\";\nimport { ApolloLink } from \"@apollo/client/link\";\n\nexport type ContextSetter = (\n operation: GraphQLRequest,\n prevContext: OperationContext\n) => Promise<Partial<OperationContext>> | Partial<OperationContext>;\n\n/**\n * @deprecated\n * Use `SetContextLink` from `@apollo/client/link/context` instead.\n */\nexport function setContext(setter: ContextSetter) {\n return new SetContextLink(setter);\n}\nexport class SetContextLink extends ApolloLink {\n constructor(setter: ContextSetter) {\n super((operation, forward) => {\n const { ...request } = operation;\n\n return new Observable((observer) => {\n let handle: Subscription;\n let closed = false;\n Promise.resolve(request)\n .then((req) => setter(req, operation.getContext()))\n .then(operation.setContext)\n .then(() => {\n // if the observer is already closed, no need to subscribe.\n if (closed) return;\n handle = forward(operation).subscribe({\n next: observer.next.bind(observer),\n error: observer.error.bind(observer),\n complete: observer.complete.bind(observer),\n });\n })\n .catch(observer.error.bind(observer));\n\n return () => {\n closed = true;\n if (handle) handle.unsubscribe();\n };\n });\n });\n }\n}\n"],"names":[],"mappings":";;;AAeA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAdA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAGA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAOA,CAAA,CAAA;;;CAGA,CAAA;AACA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAgB,CAAhB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA0B,CAAC,CAA3B,CAAA,CAAA,CAAA,CAAA,CAAgD,EAAhD;IACE,CAAF,CAAA,CAAA,CAAA,CAAA,EAAS,CAAT,CAAA,EAAa,CAAb,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA2B,CAAC,CAA5B,CAAA,CAAA,CAAA,CAAA,CAAkC,CAAC;AACnC;AACA,CAAA,CAAA,CAAA,CAAA,EAAa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,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAwC,CAAxC,CAA0C;gBAClC,CAAC;YACH,CAAC,CAAC;QACJ,CAAC,CAAC;IACJ;AACF;AA7BA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;"}
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import type { GraphQLRequest, OperationContext } from "@apollo/client/link";
|
|
2
2
|
import { ApolloLink } from "@apollo/client/link";
|
|
3
3
|
export type ContextSetter = (operation: GraphQLRequest, prevContext: OperationContext) => Promise<Partial<OperationContext>> | Partial<OperationContext>;
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated
|
|
6
|
+
* Use `SetContextLink` from `@apollo/client/link/context` instead.
|
|
7
|
+
*/
|
|
8
|
+
export declare function setContext(setter: ContextSetter): SetContextLink;
|
|
9
|
+
export declare class SetContextLink extends ApolloLink {
|
|
10
|
+
constructor(setter: ContextSetter);
|
|
11
|
+
}
|
|
5
12
|
//# sourceMappingURL=index.d.cts.map
|
|
@@ -1,36 +1,12 @@
|
|
|
1
|
-
import type { GraphQLFormattedError } from "graphql";
|
|
1
|
+
import type { FormattedExecutionResult, GraphQLFormattedError } from "graphql";
|
|
2
2
|
import type { DocumentNode } from "graphql";
|
|
3
3
|
import type { Observable } from "rxjs";
|
|
4
4
|
import type { ApolloClient, DefaultContext } from "@apollo/client";
|
|
5
5
|
export type { DocumentNode };
|
|
6
|
-
export type Path = ReadonlyArray<string | number>;
|
|
7
|
-
interface ExecutionPatchResultBase {
|
|
8
|
-
hasNext?: boolean;
|
|
9
|
-
}
|
|
10
|
-
export interface ExecutionPatchInitialResult<TData = Record<string, any>, TExtensions = Record<string, any>> extends ExecutionPatchResultBase {
|
|
11
|
-
data: TData | null | undefined;
|
|
12
|
-
incremental?: never;
|
|
13
|
-
errors?: ReadonlyArray<GraphQLFormattedError>;
|
|
14
|
-
extensions?: TExtensions;
|
|
15
|
-
}
|
|
16
|
-
export interface IncrementalPayload<TData, TExtensions> {
|
|
17
|
-
data: TData | null;
|
|
18
|
-
label?: string;
|
|
19
|
-
path: Path;
|
|
20
|
-
errors?: ReadonlyArray<GraphQLFormattedError>;
|
|
21
|
-
extensions?: TExtensions;
|
|
22
|
-
}
|
|
23
|
-
export interface ExecutionPatchIncrementalResult<TData = Record<string, any>, TExtensions = Record<string, any>> extends ExecutionPatchResultBase {
|
|
24
|
-
incremental?: IncrementalPayload<TData, TExtensions>[];
|
|
25
|
-
data?: never;
|
|
26
|
-
errors?: never;
|
|
27
|
-
extensions?: never;
|
|
28
|
-
}
|
|
29
6
|
export interface ApolloPayloadResult<TData = Record<string, any>, TExtensions = Record<string, any>> {
|
|
30
|
-
payload:
|
|
7
|
+
payload: FormattedExecutionResult<TData, TExtensions> | null;
|
|
31
8
|
errors?: ReadonlyArray<GraphQLFormattedError>;
|
|
32
9
|
}
|
|
33
|
-
export type ExecutionPatchResult<TData = Record<string, any>, TExtensions = Record<string, any>> = ExecutionPatchInitialResult<TData, TExtensions> | ExecutionPatchIncrementalResult<TData, TExtensions>;
|
|
34
10
|
export interface GraphQLRequest<TVariables = Record<string, any>> {
|
|
35
11
|
query: DocumentNode;
|
|
36
12
|
variables?: TVariables;
|
|
@@ -55,13 +31,9 @@ export interface ExecuteContext {
|
|
|
55
31
|
}
|
|
56
32
|
export interface OperationContext extends DefaultContext {
|
|
57
33
|
}
|
|
58
|
-
export
|
|
59
|
-
|
|
60
|
-
context?: DefaultContext;
|
|
61
|
-
errors?: ReadonlyArray<GraphQLFormattedError>;
|
|
62
|
-
extensions?: TExtensions;
|
|
34
|
+
export type FetchResult<TData = Record<string, any>, TExtensions = Record<string, any>> = FormattedExecutionResult<TData, TExtensions> | AdditionalFetchResultTypes<TData, TExtensions>[keyof AdditionalFetchResultTypes<TData, TExtensions>];
|
|
35
|
+
export interface AdditionalFetchResultTypes<TData = Record<string, any>, TExtensions = Record<string, any>> {
|
|
63
36
|
}
|
|
64
|
-
export type FetchResult<TData = Record<string, any>, TExtensions = Record<string, any>> = SingleExecutionResult<TData, TExtensions> | ExecutionPatchResult<TData, TExtensions>;
|
|
65
37
|
export type NextLink = (operation: Operation) => Observable<FetchResult>;
|
|
66
38
|
export type RequestHandler = (operation: Operation, forward: NextLink) => Observable<FetchResult> | null;
|
|
67
39
|
//# sourceMappingURL=types.d.cts.map
|
|
@@ -5,77 +5,80 @@ exports.onError = onError;
|
|
|
5
5
|
const rxjs_1 = require("rxjs");
|
|
6
6
|
const errors_1 = require("@apollo/client/errors");
|
|
7
7
|
const link_1 = require("@apollo/client/link");
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated
|
|
10
|
+
* Use `ErrorLink` from `@apollo/client/link/error` instead.
|
|
11
|
+
*/
|
|
8
12
|
function onError(errorHandler) {
|
|
9
|
-
return new
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
sub
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
13
|
+
return new ErrorLink(errorHandler);
|
|
14
|
+
}
|
|
15
|
+
class ErrorLink extends link_1.ApolloLink {
|
|
16
|
+
constructor(errorHandler) {
|
|
17
|
+
super((operation, forward) => {
|
|
18
|
+
return new rxjs_1.Observable((observer) => {
|
|
19
|
+
let sub;
|
|
20
|
+
let retriedSub;
|
|
21
|
+
let retriedResult;
|
|
22
|
+
try {
|
|
23
|
+
sub = forward(operation).subscribe({
|
|
24
|
+
next: (result) => {
|
|
25
|
+
const handler = operation.client["queryManager"].incrementalHandler;
|
|
26
|
+
const errors = handler.isIncrementalResult(result) ?
|
|
27
|
+
handler.extractErrors(result)
|
|
28
|
+
: result.errors;
|
|
29
|
+
if (errors) {
|
|
30
|
+
retriedResult = errorHandler({
|
|
31
|
+
error: new errors_1.CombinedGraphQLErrors(result, errors),
|
|
32
|
+
result,
|
|
33
|
+
operation,
|
|
34
|
+
forward,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
else if ((0, errors_1.graphQLResultHasProtocolErrors)(result)) {
|
|
38
|
+
retriedResult = errorHandler({
|
|
39
|
+
error: result.extensions[errors_1.PROTOCOL_ERRORS_SYMBOL],
|
|
40
|
+
result,
|
|
41
|
+
operation,
|
|
42
|
+
forward,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
retriedSub = retriedResult?.subscribe(observer);
|
|
46
|
+
if (!retriedSub) {
|
|
47
|
+
observer.next(result);
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
error: (error) => {
|
|
26
51
|
retriedResult = errorHandler({
|
|
27
|
-
error: result.extensions[errors_1.PROTOCOL_ERRORS_SYMBOL],
|
|
28
|
-
response: result,
|
|
29
52
|
operation,
|
|
53
|
+
error: (0, errors_1.toErrorLike)(error),
|
|
30
54
|
forward,
|
|
31
55
|
});
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
catch (e) {
|
|
59
|
-
errorHandler({ error: (0, errors_1.toErrorLike)(e), operation, forward });
|
|
60
|
-
observer.error(e);
|
|
61
|
-
}
|
|
62
|
-
return () => {
|
|
63
|
-
if (sub)
|
|
64
|
-
sub.unsubscribe();
|
|
65
|
-
if (retriedSub)
|
|
66
|
-
retriedSub.unsubscribe();
|
|
67
|
-
};
|
|
56
|
+
retriedSub = retriedResult?.subscribe(observer);
|
|
57
|
+
if (!retriedSub) {
|
|
58
|
+
observer.error(error);
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
complete: () => {
|
|
62
|
+
// disable the previous sub from calling complete on observable
|
|
63
|
+
// if retry is in flight.
|
|
64
|
+
if (!retriedResult) {
|
|
65
|
+
observer.complete();
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
catch (e) {
|
|
71
|
+
errorHandler({ error: (0, errors_1.toErrorLike)(e), operation, forward });
|
|
72
|
+
observer.error(e);
|
|
73
|
+
}
|
|
74
|
+
return () => {
|
|
75
|
+
if (sub)
|
|
76
|
+
sub.unsubscribe();
|
|
77
|
+
if (retriedSub)
|
|
78
|
+
retriedSub.unsubscribe();
|
|
79
|
+
};
|
|
80
|
+
});
|
|
68
81
|
});
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
class ErrorLink extends link_1.ApolloLink {
|
|
72
|
-
link;
|
|
73
|
-
constructor(errorHandler) {
|
|
74
|
-
super();
|
|
75
|
-
this.link = onError(errorHandler);
|
|
76
|
-
}
|
|
77
|
-
request(operation, forward) {
|
|
78
|
-
return this.link.request(operation, forward);
|
|
79
82
|
}
|
|
80
83
|
}
|
|
81
84
|
exports.ErrorLink = ErrorLink;
|