@apollo/client 3.7.4 → 3.7.6
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/apollo-client.cjs +120 -61
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/cache/core/cache.d.ts +1 -1
- package/cache/core/cache.d.ts.map +1 -1
- package/cache/core/cache.js.map +1 -1
- package/cache/core/types/common.d.ts +7 -7
- package/cache/core/types/common.d.ts.map +1 -1
- package/cache/inmemory/entityStore.d.ts +1 -1
- package/cache/inmemory/entityStore.d.ts.map +1 -1
- package/cache/inmemory/helpers.js.map +1 -1
- package/cache/inmemory/inMemoryCache.d.ts +3 -2
- package/cache/inmemory/inMemoryCache.d.ts.map +1 -1
- package/cache/inmemory/inMemoryCache.js.map +1 -1
- package/cache/inmemory/policies.d.ts +12 -12
- package/cache/inmemory/policies.d.ts.map +1 -1
- package/cache/inmemory/policies.js.map +1 -1
- package/cache/inmemory/reactiveVars.d.ts +1 -1
- package/cache/inmemory/reactiveVars.d.ts.map +1 -1
- package/cache/inmemory/readFromStore.d.ts +2 -2
- package/cache/inmemory/readFromStore.d.ts.map +1 -1
- package/cache/inmemory/types.d.ts +4 -4
- package/cache/inmemory/types.d.ts.map +1 -1
- package/cache/inmemory/writeToStore.d.ts +1 -1
- package/cache/inmemory/writeToStore.d.ts.map +1 -1
- package/cache/inmemory/writeToStore.js.map +1 -1
- package/core/ApolloClient.d.ts +5 -5
- package/core/ApolloClient.d.ts.map +1 -1
- package/core/ApolloClient.js.map +1 -1
- package/core/LocalState.d.ts +9 -6
- package/core/LocalState.d.ts.map +1 -1
- package/core/LocalState.js +61 -14
- package/core/LocalState.js.map +1 -1
- package/core/ObservableQuery.d.ts +5 -5
- package/core/ObservableQuery.d.ts.map +1 -1
- package/core/ObservableQuery.js +1 -1
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryInfo.d.ts +1 -1
- package/core/QueryInfo.d.ts.map +1 -1
- package/core/QueryManager.d.ts +7 -7
- package/core/QueryManager.d.ts.map +1 -1
- package/core/QueryManager.js +17 -9
- package/core/QueryManager.js.map +1 -1
- package/core/core.cjs +79 -24
- package/core/core.cjs.map +1 -1
- package/core/core.cjs.native.js +79 -24
- package/core/types.d.ts +18 -17
- package/core/types.d.ts.map +1 -1
- package/core/types.js +1 -0
- package/core/types.js.map +1 -1
- package/core/watchQueryOptions.d.ts +11 -11
- package/core/watchQueryOptions.d.ts.map +1 -1
- package/core/watchQueryOptions.js.map +1 -1
- package/errors/index.d.ts +2 -2
- package/errors/index.d.ts.map +1 -1
- package/invariantErrorCodes.js +48 -43
- package/link/batch/batch.cjs +5 -3
- package/link/batch/batch.cjs.map +1 -1
- package/link/batch/batch.cjs.native.js +5 -3
- package/link/batch/batching.d.ts +2 -2
- package/link/batch/batching.d.ts.map +1 -1
- package/link/batch/batching.js +5 -3
- package/link/batch/batching.js.map +1 -1
- package/link/context/index.d.ts +2 -1
- package/link/context/index.d.ts.map +1 -1
- package/link/context/index.js.map +1 -1
- package/link/core/ApolloLink.js +1 -1
- package/link/core/core.cjs +1 -1
- package/link/core/core.cjs.map +1 -1
- package/link/core/core.cjs.native.js +1 -1
- package/link/core/types.d.ts +11 -10
- package/link/core/types.d.ts.map +1 -1
- package/link/core/types.js.map +1 -1
- package/link/http/checkFetcher.js +1 -1
- package/link/http/createHttpLink.d.ts.map +1 -1
- package/link/http/createHttpLink.js +1 -0
- package/link/http/createHttpLink.js.map +1 -1
- package/link/http/http.cjs +6 -3
- package/link/http/http.cjs.map +1 -1
- package/link/http/http.cjs.native.js +6 -3
- package/link/http/iterators/async.js.map +1 -1
- package/link/http/iterators/nodeStream.js.map +1 -1
- package/link/http/iterators/promise.js.map +1 -1
- package/link/http/iterators/reader.js.map +1 -1
- package/link/http/parseAndCheckHttpResponse.d.ts +2 -2
- package/link/http/parseAndCheckHttpResponse.d.ts.map +1 -1
- package/link/http/parseAndCheckHttpResponse.js.map +1 -1
- package/link/http/selectHttpOptionsAndBody.d.ts +2 -2
- package/link/http/selectHttpOptionsAndBody.d.ts.map +1 -1
- package/link/http/selectHttpOptionsAndBody.js +3 -1
- package/link/http/selectHttpOptionsAndBody.js.map +1 -1
- package/link/http/serializeFetchParameter.d.ts +1 -1
- package/link/http/serializeFetchParameter.d.ts.map +1 -1
- package/link/http/serializeFetchParameter.js +1 -1
- package/link/persisted-queries/index.d.ts +2 -2
- package/link/persisted-queries/index.d.ts.map +1 -1
- package/link/persisted-queries/index.js +2 -2
- package/link/persisted-queries/persisted-queries.cjs +2 -2
- package/link/persisted-queries/persisted-queries.cjs.map +1 -1
- package/link/persisted-queries/persisted-queries.cjs.native.js +2 -2
- package/link/utils/throwServerError.d.ts +1 -1
- package/link/utils/throwServerError.d.ts.map +1 -1
- package/link/utils/utils.cjs +1 -1
- package/link/utils/utils.cjs.map +1 -1
- package/link/utils/utils.cjs.native.js +1 -1
- package/link/utils/validateOperation.js +1 -1
- package/package.json +15 -15
- package/react/components/Query.d.ts +2 -2
- package/react/components/Query.d.ts.map +1 -1
- package/react/components/Query.js.map +1 -1
- package/react/components/Subscription.d.ts +2 -2
- package/react/components/Subscription.d.ts.map +1 -1
- package/react/components/Subscription.js.map +1 -1
- package/react/components/types.d.ts +2 -2
- package/react/components/types.d.ts.map +1 -1
- package/react/components/types.js.map +1 -1
- package/react/context/ApolloConsumer.js +1 -1
- package/react/context/ApolloProvider.js +1 -1
- package/react/context/context.cjs +2 -2
- package/react/context/context.cjs.map +1 -1
- package/react/context/context.cjs.native.js +2 -2
- package/react/hoc/graphql.d.ts +2 -1
- package/react/hoc/graphql.d.ts.map +1 -1
- package/react/hoc/graphql.js.map +1 -1
- package/react/hoc/hoc-utils.d.ts +1 -1
- package/react/hoc/hoc-utils.d.ts.map +1 -1
- package/react/hoc/hoc-utils.js +1 -1
- package/react/hoc/hoc.cjs +2 -2
- package/react/hoc/hoc.cjs.map +1 -1
- package/react/hoc/hoc.cjs.native.js +2 -2
- package/react/hoc/mutation-hoc.d.ts +2 -2
- package/react/hoc/mutation-hoc.d.ts.map +1 -1
- package/react/hoc/mutation-hoc.js.map +1 -1
- package/react/hoc/query-hoc.d.ts +1 -1
- package/react/hoc/query-hoc.d.ts.map +1 -1
- package/react/hoc/query-hoc.js.map +1 -1
- package/react/hoc/subscription-hoc.d.ts +1 -1
- package/react/hoc/subscription-hoc.d.ts.map +1 -1
- package/react/hoc/subscription-hoc.js.map +1 -1
- package/react/hoc/types.d.ts +6 -6
- package/react/hoc/types.d.ts.map +1 -1
- package/react/hoc/types.js.map +1 -1
- package/react/hoc/withApollo.js +1 -1
- package/react/hooks/hooks.cjs +10 -9
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/hooks.cjs.native.js +10 -9
- package/react/hooks/useApolloClient.js +1 -1
- package/react/hooks/useFragment.d.ts +2 -1
- package/react/hooks/useFragment.d.ts.map +1 -1
- package/react/hooks/useFragment.js +9 -8
- package/react/hooks/useFragment.js.map +1 -1
- package/react/hooks/useLazyQuery.d.ts +1 -1
- package/react/hooks/useLazyQuery.d.ts.map +1 -1
- package/react/hooks/useLazyQuery.js.map +1 -1
- package/react/hooks/useQuery.d.ts +3 -3
- package/react/hooks/useQuery.d.ts.map +1 -1
- package/react/hooks/useQuery.js.map +1 -1
- package/react/hooks/useSubscription.d.ts +1 -1
- package/react/hooks/useSubscription.d.ts.map +1 -1
- package/react/hooks/useSubscription.js.map +1 -1
- package/react/hooks/useSyncExternalStore.d.ts +1 -1
- package/react/hooks/useSyncExternalStore.d.ts.map +1 -1
- package/react/parser/index.js +5 -5
- package/react/parser/parser.cjs +5 -5
- package/react/parser/parser.cjs.map +1 -1
- package/react/parser/parser.cjs.native.js +5 -5
- package/react/ssr/RenderPromises.d.ts +4 -4
- package/react/ssr/RenderPromises.d.ts.map +1 -1
- package/react/ssr/RenderPromises.js.map +1 -1
- package/react/ssr/getDataFromTree.d.ts +1 -1
- package/react/ssr/getDataFromTree.d.ts.map +1 -1
- package/react/types/types.d.ts +17 -17
- package/react/types/types.d.ts.map +1 -1
- package/react/types/types.js.map +1 -1
- package/testing/core/core.cjs +1 -1
- package/testing/core/core.cjs.map +1 -1
- package/testing/core/core.cjs.native.js +1 -1
- package/testing/core/mocking/mockFetch.js.map +1 -1
- package/testing/core/mocking/mockLink.d.ts +1 -1
- package/testing/core/mocking/mockLink.d.ts.map +1 -1
- package/testing/core/mocking/mockLink.js +1 -1
- package/testing/core/observableToPromise.d.ts +2 -2
- package/testing/core/observableToPromise.d.ts.map +1 -1
- package/testing/core/observableToPromise.js.map +1 -1
- package/utilities/common/cloneDeep.js.map +1 -1
- package/utilities/common/errorHandling.d.ts +2 -2
- package/utilities/common/errorHandling.d.ts.map +1 -1
- package/utilities/common/errorHandling.js.map +1 -1
- package/utilities/common/incrementalResult.d.ts +4 -4
- package/utilities/common/incrementalResult.d.ts.map +1 -1
- package/utilities/common/incrementalResult.js.map +1 -1
- package/utilities/common/mergeDeep.d.ts +2 -2
- package/utilities/common/mergeDeep.d.ts.map +1 -1
- package/utilities/common/mergeOptions.d.ts +2 -2
- package/utilities/common/mergeOptions.d.ts.map +1 -1
- package/utilities/common/mergeOptions.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/globals/index.js +1 -1
- package/utilities/graphql/directives.d.ts +2 -2
- package/utilities/graphql/directives.d.ts.map +1 -1
- package/utilities/graphql/directives.js +4 -4
- package/utilities/graphql/directives.js.map +1 -1
- package/utilities/graphql/fragments.d.ts +1 -1
- package/utilities/graphql/fragments.d.ts.map +1 -1
- package/utilities/graphql/fragments.js +3 -3
- package/utilities/graphql/getFromAST.js +8 -8
- package/utilities/graphql/storeUtils.d.ts +3 -3
- package/utilities/graphql/storeUtils.d.ts.map +1 -1
- package/utilities/graphql/storeUtils.js +1 -1
- package/utilities/graphql/storeUtils.js.map +1 -1
- package/utilities/graphql/transform.d.ts +9 -9
- package/utilities/graphql/transform.d.ts.map +1 -1
- package/utilities/graphql/transform.js.map +1 -1
- package/utilities/observables/Concast.d.ts +5 -5
- package/utilities/observables/Concast.d.ts.map +1 -1
- package/utilities/observables/asyncMap.js.map +1 -1
- package/utilities/policies/pagination.d.ts +7 -7
- package/utilities/policies/pagination.d.ts.map +1 -1
- package/utilities/policies/pagination.js.map +1 -1
- package/utilities/types/IsStrictlyAny.d.ts +3 -3
- package/utilities/types/IsStrictlyAny.d.ts.map +1 -1
- package/utilities/utilities.cjs +16 -16
- package/utilities/utilities.cjs.map +1 -1
- package/utilities/utilities.cjs.native.js +16 -16
- package/version.js +1 -1
package/apollo-client.cjs
CHANGED
|
@@ -45,7 +45,7 @@ function shouldInclude(_a, variables) {
|
|
|
45
45
|
var evaledValue = false;
|
|
46
46
|
if (ifArgument.value.kind === 'Variable') {
|
|
47
47
|
evaledValue = variables && variables[ifArgument.value.name.value];
|
|
48
|
-
__DEV__ ? tsInvariant.invariant(evaledValue !== void 0, "Invalid variable referenced in @".concat(directive.name.value, " directive.")) : tsInvariant.invariant(evaledValue !== void 0,
|
|
48
|
+
__DEV__ ? tsInvariant.invariant(evaledValue !== void 0, "Invalid variable referenced in @".concat(directive.name.value, " directive.")) : tsInvariant.invariant(evaledValue !== void 0, 40);
|
|
49
49
|
}
|
|
50
50
|
else {
|
|
51
51
|
evaledValue = ifArgument.value.value;
|
|
@@ -81,13 +81,13 @@ function getInclusionDirectives(directives) {
|
|
|
81
81
|
return;
|
|
82
82
|
var directiveArguments = directive.arguments;
|
|
83
83
|
var directiveName = directive.name.value;
|
|
84
|
-
__DEV__ ? tsInvariant.invariant(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @".concat(directiveName, " directive.")) : tsInvariant.invariant(directiveArguments && directiveArguments.length === 1,
|
|
84
|
+
__DEV__ ? tsInvariant.invariant(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @".concat(directiveName, " directive.")) : tsInvariant.invariant(directiveArguments && directiveArguments.length === 1, 41);
|
|
85
85
|
var ifArgument = directiveArguments[0];
|
|
86
|
-
__DEV__ ? tsInvariant.invariant(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @".concat(directiveName, " directive.")) : tsInvariant.invariant(ifArgument.name && ifArgument.name.value === 'if',
|
|
86
|
+
__DEV__ ? tsInvariant.invariant(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @".concat(directiveName, " directive.")) : tsInvariant.invariant(ifArgument.name && ifArgument.name.value === 'if', 42);
|
|
87
87
|
var ifValue = ifArgument.value;
|
|
88
88
|
__DEV__ ? tsInvariant.invariant(ifValue &&
|
|
89
89
|
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), "Argument for the @".concat(directiveName, " directive must be a variable or a boolean value.")) : tsInvariant.invariant(ifValue &&
|
|
90
|
-
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'),
|
|
90
|
+
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), 43);
|
|
91
91
|
result.push({ directive: directive, ifArgument: ifArgument });
|
|
92
92
|
});
|
|
93
93
|
}
|
|
@@ -100,14 +100,14 @@ function getFragmentQueryDocument(document, fragmentName) {
|
|
|
100
100
|
document.definitions.forEach(function (definition) {
|
|
101
101
|
if (definition.kind === 'OperationDefinition') {
|
|
102
102
|
throw __DEV__ ? new tsInvariant.InvariantError("Found a ".concat(definition.operation, " operation").concat(definition.name ? " named '".concat(definition.name.value, "'") : '', ". ") +
|
|
103
|
-
'No operations are allowed when using a fragment as a query. Only fragments are allowed.') : new tsInvariant.InvariantError(
|
|
103
|
+
'No operations are allowed when using a fragment as a query. Only fragments are allowed.') : new tsInvariant.InvariantError(44);
|
|
104
104
|
}
|
|
105
105
|
if (definition.kind === 'FragmentDefinition') {
|
|
106
106
|
fragments.push(definition);
|
|
107
107
|
}
|
|
108
108
|
});
|
|
109
109
|
if (typeof actualFragmentName === 'undefined') {
|
|
110
|
-
__DEV__ ? tsInvariant.invariant(fragments.length === 1, "Found ".concat(fragments.length, " fragments. `fragmentName` must be provided when there is not exactly 1 fragment.")) : tsInvariant.invariant(fragments.length === 1,
|
|
110
|
+
__DEV__ ? tsInvariant.invariant(fragments.length === 1, "Found ".concat(fragments.length, " fragments. `fragmentName` must be provided when there is not exactly 1 fragment.")) : tsInvariant.invariant(fragments.length === 1, 45);
|
|
111
111
|
actualFragmentName = fragments[0].name.value;
|
|
112
112
|
}
|
|
113
113
|
var query = tslib.__assign(tslib.__assign({}, document), { definitions: tslib.__spreadArray([
|
|
@@ -148,7 +148,7 @@ function getFragmentFromSelection(selection, fragmentMap) {
|
|
|
148
148
|
return fragmentMap(fragmentName);
|
|
149
149
|
}
|
|
150
150
|
var fragment = fragmentMap && fragmentMap[fragmentName];
|
|
151
|
-
__DEV__ ? tsInvariant.invariant(fragment, "No fragment named ".concat(fragmentName)) : tsInvariant.invariant(fragment,
|
|
151
|
+
__DEV__ ? tsInvariant.invariant(fragment, "No fragment named ".concat(fragmentName)) : tsInvariant.invariant(fragment, 46);
|
|
152
152
|
return fragment || null;
|
|
153
153
|
}
|
|
154
154
|
default:
|
|
@@ -232,7 +232,7 @@ function valueToObjectRepresentation(argObj, name, value, variables) {
|
|
|
232
232
|
else {
|
|
233
233
|
throw __DEV__ ? new tsInvariant.InvariantError("The inline argument \"".concat(name.value, "\" of kind \"").concat(value.kind, "\"") +
|
|
234
234
|
'is not supported. Use variables instead of inline arguments to ' +
|
|
235
|
-
'overcome this limitation.') : new tsInvariant.InvariantError(
|
|
235
|
+
'overcome this limitation.') : new tsInvariant.InvariantError(55);
|
|
236
236
|
}
|
|
237
237
|
}
|
|
238
238
|
function storeKeyNameFromField(field, variables) {
|
|
@@ -366,16 +366,16 @@ function isInlineFragment(selection) {
|
|
|
366
366
|
}
|
|
367
367
|
|
|
368
368
|
function checkDocument(doc) {
|
|
369
|
-
__DEV__ ? tsInvariant.invariant(doc && doc.kind === 'Document', "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") : tsInvariant.invariant(doc && doc.kind === 'Document',
|
|
369
|
+
__DEV__ ? tsInvariant.invariant(doc && doc.kind === 'Document', "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") : tsInvariant.invariant(doc && doc.kind === 'Document', 47);
|
|
370
370
|
var operations = doc.definitions
|
|
371
371
|
.filter(function (d) { return d.kind !== 'FragmentDefinition'; })
|
|
372
372
|
.map(function (definition) {
|
|
373
373
|
if (definition.kind !== 'OperationDefinition') {
|
|
374
|
-
throw __DEV__ ? new tsInvariant.InvariantError("Schema type definitions not allowed in queries. Found: \"".concat(definition.kind, "\"")) : new tsInvariant.InvariantError(
|
|
374
|
+
throw __DEV__ ? new tsInvariant.InvariantError("Schema type definitions not allowed in queries. Found: \"".concat(definition.kind, "\"")) : new tsInvariant.InvariantError(48);
|
|
375
375
|
}
|
|
376
376
|
return definition;
|
|
377
377
|
});
|
|
378
|
-
__DEV__ ? tsInvariant.invariant(operations.length <= 1, "Ambiguous GraphQL document: contains ".concat(operations.length, " operations")) : tsInvariant.invariant(operations.length <= 1,
|
|
378
|
+
__DEV__ ? tsInvariant.invariant(operations.length <= 1, "Ambiguous GraphQL document: contains ".concat(operations.length, " operations")) : tsInvariant.invariant(operations.length <= 1, 49);
|
|
379
379
|
return doc;
|
|
380
380
|
}
|
|
381
381
|
function getOperationDefinition(doc) {
|
|
@@ -394,14 +394,14 @@ function getFragmentDefinitions(doc) {
|
|
|
394
394
|
}
|
|
395
395
|
function getQueryDefinition(doc) {
|
|
396
396
|
var queryDef = getOperationDefinition(doc);
|
|
397
|
-
__DEV__ ? tsInvariant.invariant(queryDef && queryDef.operation === 'query', 'Must contain a query definition.') : tsInvariant.invariant(queryDef && queryDef.operation === 'query',
|
|
397
|
+
__DEV__ ? tsInvariant.invariant(queryDef && queryDef.operation === 'query', 'Must contain a query definition.') : tsInvariant.invariant(queryDef && queryDef.operation === 'query', 50);
|
|
398
398
|
return queryDef;
|
|
399
399
|
}
|
|
400
400
|
function getFragmentDefinition(doc) {
|
|
401
|
-
__DEV__ ? tsInvariant.invariant(doc.kind === 'Document', "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") : tsInvariant.invariant(doc.kind === 'Document',
|
|
402
|
-
__DEV__ ? tsInvariant.invariant(doc.definitions.length <= 1, 'Fragment must have exactly one definition.') : tsInvariant.invariant(doc.definitions.length <= 1,
|
|
401
|
+
__DEV__ ? tsInvariant.invariant(doc.kind === 'Document', "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") : tsInvariant.invariant(doc.kind === 'Document', 51);
|
|
402
|
+
__DEV__ ? tsInvariant.invariant(doc.definitions.length <= 1, 'Fragment must have exactly one definition.') : tsInvariant.invariant(doc.definitions.length <= 1, 52);
|
|
403
403
|
var fragmentDef = doc.definitions[0];
|
|
404
|
-
__DEV__ ? tsInvariant.invariant(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.') : tsInvariant.invariant(fragmentDef.kind === 'FragmentDefinition',
|
|
404
|
+
__DEV__ ? tsInvariant.invariant(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.') : tsInvariant.invariant(fragmentDef.kind === 'FragmentDefinition', 53);
|
|
405
405
|
return fragmentDef;
|
|
406
406
|
}
|
|
407
407
|
function getMainDefinition(queryDoc) {
|
|
@@ -424,7 +424,7 @@ function getMainDefinition(queryDoc) {
|
|
|
424
424
|
if (fragmentDefinition) {
|
|
425
425
|
return fragmentDefinition;
|
|
426
426
|
}
|
|
427
|
-
throw __DEV__ ? new tsInvariant.InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.') : new tsInvariant.InvariantError(
|
|
427
|
+
throw __DEV__ ? new tsInvariant.InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.') : new tsInvariant.InvariantError(54);
|
|
428
428
|
}
|
|
429
429
|
function getDefaultValues(definition) {
|
|
430
430
|
var defaultValues = Object.create(null);
|
|
@@ -1196,7 +1196,7 @@ function validateOperation(operation) {
|
|
|
1196
1196
|
for (var _i = 0, _a = Object.keys(operation); _i < _a.length; _i++) {
|
|
1197
1197
|
var key = _a[_i];
|
|
1198
1198
|
if (OPERATION_FIELDS.indexOf(key) < 0) {
|
|
1199
|
-
throw __DEV__ ? new tsInvariant.InvariantError("illegal argument: ".concat(key)) : new tsInvariant.InvariantError(
|
|
1199
|
+
throw __DEV__ ? new tsInvariant.InvariantError("illegal argument: ".concat(key)) : new tsInvariant.InvariantError(27);
|
|
1200
1200
|
}
|
|
1201
1201
|
}
|
|
1202
1202
|
return operation;
|
|
@@ -1319,7 +1319,7 @@ var ApolloLink = (function () {
|
|
|
1319
1319
|
return ApolloLink.concat(this, next);
|
|
1320
1320
|
};
|
|
1321
1321
|
ApolloLink.prototype.request = function (operation, forward) {
|
|
1322
|
-
throw __DEV__ ? new tsInvariant.InvariantError('request is not implemented') : new tsInvariant.InvariantError(
|
|
1322
|
+
throw __DEV__ ? new tsInvariant.InvariantError('request is not implemented') : new tsInvariant.InvariantError(22);
|
|
1323
1323
|
};
|
|
1324
1324
|
ApolloLink.prototype.onError = function (error, observer) {
|
|
1325
1325
|
if (observer && observer.error) {
|
|
@@ -1345,7 +1345,7 @@ var concat = ApolloLink.concat;
|
|
|
1345
1345
|
|
|
1346
1346
|
var execute = ApolloLink.execute;
|
|
1347
1347
|
|
|
1348
|
-
var version = '3.7.
|
|
1348
|
+
var version = '3.7.6';
|
|
1349
1349
|
|
|
1350
1350
|
function isNodeResponse(value) {
|
|
1351
1351
|
return !!value.body;
|
|
@@ -1661,7 +1661,7 @@ var serializeFetchParameter = function (p, label) {
|
|
|
1661
1661
|
serialized = JSON.stringify(p);
|
|
1662
1662
|
}
|
|
1663
1663
|
catch (e) {
|
|
1664
|
-
var parseError = __DEV__ ? new tsInvariant.InvariantError("Network request failed. ".concat(label, " is not serializable: ").concat(e.message)) : new tsInvariant.InvariantError(
|
|
1664
|
+
var parseError = __DEV__ ? new tsInvariant.InvariantError("Network request failed. ".concat(label, " is not serializable: ").concat(e.message)) : new tsInvariant.InvariantError(24);
|
|
1665
1665
|
parseError.parseError = e;
|
|
1666
1666
|
throw parseError;
|
|
1667
1667
|
}
|
|
@@ -1709,7 +1709,9 @@ function selectHttpOptionsAndBodyInternal(operation, printer) {
|
|
|
1709
1709
|
}
|
|
1710
1710
|
http = tslib.__assign(tslib.__assign({}, http), config.http);
|
|
1711
1711
|
});
|
|
1712
|
-
|
|
1712
|
+
if (options.headers) {
|
|
1713
|
+
options.headers = removeDuplicateHeaders(options.headers, http.preserveHeaderCase);
|
|
1714
|
+
}
|
|
1713
1715
|
var operationName = operation.operationName, extensions = operation.extensions, variables = operation.variables, query = operation.query;
|
|
1714
1716
|
var body = { operationName: operationName, variables: variables };
|
|
1715
1717
|
if (http.includeExtensions)
|
|
@@ -1742,7 +1744,7 @@ function removeDuplicateHeaders(headers, preserveHeaderCase) {
|
|
|
1742
1744
|
|
|
1743
1745
|
var checkFetcher = function (fetcher) {
|
|
1744
1746
|
if (!fetcher && typeof fetch === 'undefined') {
|
|
1745
|
-
throw __DEV__ ? new tsInvariant.InvariantError("\n\"fetch\" has not been found globally and no fetcher has been configured. To fix this, install a fetch package (like https://www.npmjs.com/package/cross-fetch), instantiate the fetcher, and pass it into your HttpLink constructor. For example:\n\nimport fetch from 'cross-fetch';\nimport { ApolloClient, HttpLink } from '@apollo/client';\nconst client = new ApolloClient({\n link: new HttpLink({ uri: '/graphql', fetch })\n});\n ") : new tsInvariant.InvariantError(
|
|
1747
|
+
throw __DEV__ ? new tsInvariant.InvariantError("\n\"fetch\" has not been found globally and no fetcher has been configured. To fix this, install a fetch package (like https://www.npmjs.com/package/cross-fetch), instantiate the fetcher, and pass it into your HttpLink constructor. For example:\n\nimport fetch from 'cross-fetch';\nimport { ApolloClient, HttpLink } from '@apollo/client';\nconst client = new ApolloClient({\n link: new HttpLink({ uri: '/graphql', fetch })\n});\n ") : new tsInvariant.InvariantError(23);
|
|
1746
1748
|
}
|
|
1747
1749
|
};
|
|
1748
1750
|
|
|
@@ -1875,6 +1877,7 @@ var createHttpLink = function (linkOptions) {
|
|
|
1875
1877
|
options.method = 'GET';
|
|
1876
1878
|
}
|
|
1877
1879
|
if (hasDirectives(['defer'], operation.query)) {
|
|
1880
|
+
options.headers = options.headers || {};
|
|
1878
1881
|
options.headers.accept = "multipart/mixed; deferSpec=20220824, application/json";
|
|
1879
1882
|
}
|
|
1880
1883
|
if (options.method === 'GET') {
|
|
@@ -4619,7 +4622,7 @@ var ObservableQuery = (function (_super) {
|
|
|
4619
4622
|
pollingInfo.interval === pollInterval) {
|
|
4620
4623
|
return;
|
|
4621
4624
|
}
|
|
4622
|
-
__DEV__ ? tsInvariant.invariant(pollInterval, 'Attempted to start a polling query without a polling interval.') : tsInvariant.invariant(pollInterval,
|
|
4625
|
+
__DEV__ ? tsInvariant.invariant(pollInterval, 'Attempted to start a polling query without a polling interval.') : tsInvariant.invariant(pollInterval, 13);
|
|
4623
4626
|
var info = pollingInfo || (this.pollingInfo = {});
|
|
4624
4627
|
info.interval = pollInterval;
|
|
4625
4628
|
var maybeFetch = function () {
|
|
@@ -4765,6 +4768,7 @@ function logMissingFieldErrors(missing) {
|
|
|
4765
4768
|
var LocalState = (function () {
|
|
4766
4769
|
function LocalState(_a) {
|
|
4767
4770
|
var cache = _a.cache, client = _a.client, resolvers = _a.resolvers, fragmentMatcher = _a.fragmentMatcher;
|
|
4771
|
+
this.selectionsToResolveCache = new WeakMap();
|
|
4768
4772
|
this.cache = cache;
|
|
4769
4773
|
if (client) {
|
|
4770
4774
|
this.client = client;
|
|
@@ -4875,13 +4879,13 @@ var LocalState = (function () {
|
|
|
4875
4879
|
if (fragmentMatcher === void 0) { fragmentMatcher = function () { return true; }; }
|
|
4876
4880
|
if (onlyRunForcedResolvers === void 0) { onlyRunForcedResolvers = false; }
|
|
4877
4881
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
4878
|
-
var mainDefinition, fragments, fragmentMap, definitionOperation, defaultOperationType, _a, cache, client, execContext;
|
|
4882
|
+
var mainDefinition, fragments, fragmentMap, selectionsToResolve, definitionOperation, defaultOperationType, _a, cache, client, execContext, isClientFieldDescendant;
|
|
4879
4883
|
return tslib.__generator(this, function (_b) {
|
|
4880
4884
|
mainDefinition = getMainDefinition(document);
|
|
4881
4885
|
fragments = getFragmentDefinitions(document);
|
|
4882
4886
|
fragmentMap = createFragmentMap(fragments);
|
|
4883
|
-
|
|
4884
|
-
|
|
4887
|
+
selectionsToResolve = this.collectSelectionsToResolve(mainDefinition, fragmentMap);
|
|
4888
|
+
definitionOperation = mainDefinition.operation;
|
|
4885
4889
|
defaultOperationType = definitionOperation
|
|
4886
4890
|
? definitionOperation.charAt(0).toUpperCase() +
|
|
4887
4891
|
definitionOperation.slice(1)
|
|
@@ -4894,16 +4898,18 @@ var LocalState = (function () {
|
|
|
4894
4898
|
fragmentMatcher: fragmentMatcher,
|
|
4895
4899
|
defaultOperationType: defaultOperationType,
|
|
4896
4900
|
exportedVariables: {},
|
|
4901
|
+
selectionsToResolve: selectionsToResolve,
|
|
4897
4902
|
onlyRunForcedResolvers: onlyRunForcedResolvers,
|
|
4898
4903
|
};
|
|
4899
|
-
|
|
4904
|
+
isClientFieldDescendant = false;
|
|
4905
|
+
return [2, this.resolveSelectionSet(mainDefinition.selectionSet, isClientFieldDescendant, rootValue, execContext).then(function (result) { return ({
|
|
4900
4906
|
result: result,
|
|
4901
4907
|
exportedVariables: execContext.exportedVariables,
|
|
4902
4908
|
}); })];
|
|
4903
4909
|
});
|
|
4904
4910
|
});
|
|
4905
4911
|
};
|
|
4906
|
-
LocalState.prototype.resolveSelectionSet = function (selectionSet, rootValue, execContext) {
|
|
4912
|
+
LocalState.prototype.resolveSelectionSet = function (selectionSet, isClientFieldDescendant, rootValue, execContext) {
|
|
4907
4913
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
4908
4914
|
var fragmentMap, context, variables, resultsToMerge, execute;
|
|
4909
4915
|
var _this = this;
|
|
@@ -4913,11 +4919,14 @@ var LocalState = (function () {
|
|
|
4913
4919
|
execute = function (selection) { return tslib.__awaiter(_this, void 0, void 0, function () {
|
|
4914
4920
|
var fragment, typeCondition;
|
|
4915
4921
|
return tslib.__generator(this, function (_a) {
|
|
4922
|
+
if (!isClientFieldDescendant && !execContext.selectionsToResolve.has(selection)) {
|
|
4923
|
+
return [2];
|
|
4924
|
+
}
|
|
4916
4925
|
if (!shouldInclude(selection, variables)) {
|
|
4917
4926
|
return [2];
|
|
4918
4927
|
}
|
|
4919
4928
|
if (isField(selection)) {
|
|
4920
|
-
return [2, this.resolveField(selection, rootValue, execContext).then(function (fieldResult) {
|
|
4929
|
+
return [2, this.resolveField(selection, isClientFieldDescendant, rootValue, execContext).then(function (fieldResult) {
|
|
4921
4930
|
var _a;
|
|
4922
4931
|
if (typeof fieldResult !== 'undefined') {
|
|
4923
4932
|
resultsToMerge.push((_a = {},
|
|
@@ -4936,7 +4945,7 @@ var LocalState = (function () {
|
|
|
4936
4945
|
if (fragment && fragment.typeCondition) {
|
|
4937
4946
|
typeCondition = fragment.typeCondition.name.value;
|
|
4938
4947
|
if (execContext.fragmentMatcher(rootValue, typeCondition, context)) {
|
|
4939
|
-
return [2, this.resolveSelectionSet(fragment.selectionSet, rootValue, execContext).then(function (fragmentResult) {
|
|
4948
|
+
return [2, this.resolveSelectionSet(fragment.selectionSet, isClientFieldDescendant, rootValue, execContext).then(function (fragmentResult) {
|
|
4940
4949
|
resultsToMerge.push(fragmentResult);
|
|
4941
4950
|
})];
|
|
4942
4951
|
}
|
|
@@ -4950,7 +4959,7 @@ var LocalState = (function () {
|
|
|
4950
4959
|
});
|
|
4951
4960
|
});
|
|
4952
4961
|
};
|
|
4953
|
-
LocalState.prototype.resolveField = function (field, rootValue, execContext) {
|
|
4962
|
+
LocalState.prototype.resolveField = function (field, isClientFieldDescendant, rootValue, execContext) {
|
|
4954
4963
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
4955
4964
|
var variables, fieldName, aliasedFieldName, aliasUsed, defaultResult, resultPromise, resolverType, resolverMap, resolve;
|
|
4956
4965
|
var _this = this;
|
|
@@ -4978,6 +4987,7 @@ var LocalState = (function () {
|
|
|
4978
4987
|
}
|
|
4979
4988
|
}
|
|
4980
4989
|
return [2, resultPromise.then(function (result) {
|
|
4990
|
+
var _a, _b;
|
|
4981
4991
|
if (result === void 0) { result = defaultResult; }
|
|
4982
4992
|
if (field.directives) {
|
|
4983
4993
|
field.directives.forEach(function (directive) {
|
|
@@ -4996,30 +5006,70 @@ var LocalState = (function () {
|
|
|
4996
5006
|
if (result == null) {
|
|
4997
5007
|
return result;
|
|
4998
5008
|
}
|
|
5009
|
+
var isClientField = (_b = (_a = field.directives) === null || _a === void 0 ? void 0 : _a.some(function (d) { return d.name.value === 'client'; })) !== null && _b !== void 0 ? _b : false;
|
|
4999
5010
|
if (Array.isArray(result)) {
|
|
5000
|
-
return _this.resolveSubSelectedArray(field, result, execContext);
|
|
5011
|
+
return _this.resolveSubSelectedArray(field, isClientFieldDescendant || isClientField, result, execContext);
|
|
5001
5012
|
}
|
|
5002
5013
|
if (field.selectionSet) {
|
|
5003
|
-
return _this.resolveSelectionSet(field.selectionSet, result, execContext);
|
|
5014
|
+
return _this.resolveSelectionSet(field.selectionSet, isClientFieldDescendant || isClientField, result, execContext);
|
|
5004
5015
|
}
|
|
5005
5016
|
})];
|
|
5006
5017
|
});
|
|
5007
5018
|
});
|
|
5008
5019
|
};
|
|
5009
|
-
LocalState.prototype.resolveSubSelectedArray = function (field, result, execContext) {
|
|
5020
|
+
LocalState.prototype.resolveSubSelectedArray = function (field, isClientFieldDescendant, result, execContext) {
|
|
5010
5021
|
var _this = this;
|
|
5011
5022
|
return Promise.all(result.map(function (item) {
|
|
5012
5023
|
if (item === null) {
|
|
5013
5024
|
return null;
|
|
5014
5025
|
}
|
|
5015
5026
|
if (Array.isArray(item)) {
|
|
5016
|
-
return _this.resolveSubSelectedArray(field, item, execContext);
|
|
5027
|
+
return _this.resolveSubSelectedArray(field, isClientFieldDescendant, item, execContext);
|
|
5017
5028
|
}
|
|
5018
5029
|
if (field.selectionSet) {
|
|
5019
|
-
return _this.resolveSelectionSet(field.selectionSet, item, execContext);
|
|
5030
|
+
return _this.resolveSelectionSet(field.selectionSet, isClientFieldDescendant, item, execContext);
|
|
5020
5031
|
}
|
|
5021
5032
|
}));
|
|
5022
5033
|
};
|
|
5034
|
+
LocalState.prototype.collectSelectionsToResolve = function (mainDefinition, fragmentMap) {
|
|
5035
|
+
var isSingleASTNode = function (node) { return !Array.isArray(node); };
|
|
5036
|
+
var selectionsToResolveCache = this.selectionsToResolveCache;
|
|
5037
|
+
function collectByDefinition(definitionNode) {
|
|
5038
|
+
if (!selectionsToResolveCache.has(definitionNode)) {
|
|
5039
|
+
var matches_1 = new Set();
|
|
5040
|
+
selectionsToResolveCache.set(definitionNode, matches_1);
|
|
5041
|
+
graphql.visit(definitionNode, {
|
|
5042
|
+
Directive: function (node, _, __, ___, ancestors) {
|
|
5043
|
+
if (node.name.value === 'client') {
|
|
5044
|
+
ancestors.forEach(function (node) {
|
|
5045
|
+
if (isSingleASTNode(node) && graphql.isSelectionNode(node)) {
|
|
5046
|
+
matches_1.add(node);
|
|
5047
|
+
}
|
|
5048
|
+
});
|
|
5049
|
+
}
|
|
5050
|
+
},
|
|
5051
|
+
FragmentSpread: function (spread, _, __, ___, ancestors) {
|
|
5052
|
+
var fragment = fragmentMap[spread.name.value];
|
|
5053
|
+
__DEV__ ? tsInvariant.invariant(fragment, "No fragment named ".concat(spread.name.value)) : tsInvariant.invariant(fragment, 12);
|
|
5054
|
+
var fragmentSelections = collectByDefinition(fragment);
|
|
5055
|
+
if (fragmentSelections.size > 0) {
|
|
5056
|
+
ancestors.forEach(function (node) {
|
|
5057
|
+
if (isSingleASTNode(node) && graphql.isSelectionNode(node)) {
|
|
5058
|
+
matches_1.add(node);
|
|
5059
|
+
}
|
|
5060
|
+
});
|
|
5061
|
+
matches_1.add(spread);
|
|
5062
|
+
fragmentSelections.forEach(function (selection) {
|
|
5063
|
+
matches_1.add(selection);
|
|
5064
|
+
});
|
|
5065
|
+
}
|
|
5066
|
+
}
|
|
5067
|
+
});
|
|
5068
|
+
}
|
|
5069
|
+
return selectionsToResolveCache.get(definitionNode);
|
|
5070
|
+
}
|
|
5071
|
+
return collectByDefinition(mainDefinition);
|
|
5072
|
+
};
|
|
5023
5073
|
return LocalState;
|
|
5024
5074
|
}());
|
|
5025
5075
|
|
|
@@ -5330,7 +5380,7 @@ var QueryManager = (function () {
|
|
|
5330
5380
|
this.queries.forEach(function (_info, queryId) {
|
|
5331
5381
|
_this.stopQueryNoBroadcast(queryId);
|
|
5332
5382
|
});
|
|
5333
|
-
this.cancelPendingFetches(__DEV__ ? new tsInvariant.InvariantError('QueryManager stopped while query was in flight') : new tsInvariant.InvariantError(
|
|
5383
|
+
this.cancelPendingFetches(__DEV__ ? new tsInvariant.InvariantError('QueryManager stopped while query was in flight') : new tsInvariant.InvariantError(14));
|
|
5334
5384
|
};
|
|
5335
5385
|
QueryManager.prototype.cancelPendingFetches = function (error) {
|
|
5336
5386
|
this.fetchCancelFns.forEach(function (cancel) { return cancel(error); });
|
|
@@ -5344,10 +5394,10 @@ var QueryManager = (function () {
|
|
|
5344
5394
|
return tslib.__generator(this, function (_j) {
|
|
5345
5395
|
switch (_j.label) {
|
|
5346
5396
|
case 0:
|
|
5347
|
-
__DEV__ ? tsInvariant.invariant(mutation, 'mutation option is required. You must specify your GraphQL document in the mutation option.') : tsInvariant.invariant(mutation,
|
|
5397
|
+
__DEV__ ? tsInvariant.invariant(mutation, 'mutation option is required. You must specify your GraphQL document in the mutation option.') : tsInvariant.invariant(mutation, 15);
|
|
5348
5398
|
__DEV__ ? tsInvariant.invariant(fetchPolicy === 'network-only' ||
|
|
5349
5399
|
fetchPolicy === 'no-cache', "Mutations support only 'network-only' or 'no-cache' fetchPolicy strings. The default `network-only` behavior automatically writes mutation results to the cache. Passing `no-cache` skips the cache write.") : tsInvariant.invariant(fetchPolicy === 'network-only' ||
|
|
5350
|
-
fetchPolicy === 'no-cache',
|
|
5400
|
+
fetchPolicy === 'no-cache', 16);
|
|
5351
5401
|
mutationId = this.generateMutationId();
|
|
5352
5402
|
_h = this.transform(mutation), document = _h.document, hasClientExports = _h.hasClientExports;
|
|
5353
5403
|
mutation = this.cache.transformForLink(document);
|
|
@@ -5464,7 +5514,10 @@ var QueryManager = (function () {
|
|
|
5464
5514
|
optimistic: false,
|
|
5465
5515
|
returnPartialData: true,
|
|
5466
5516
|
});
|
|
5467
|
-
var mergedData =
|
|
5517
|
+
var mergedData = void 0;
|
|
5518
|
+
if (diff.result) {
|
|
5519
|
+
mergedData = mergeIncrementalData(diff.result, result);
|
|
5520
|
+
}
|
|
5468
5521
|
if (typeof mergedData !== 'undefined') {
|
|
5469
5522
|
result.data = mergedData;
|
|
5470
5523
|
cacheWrites.push({
|
|
@@ -5666,10 +5719,10 @@ var QueryManager = (function () {
|
|
|
5666
5719
|
var _this = this;
|
|
5667
5720
|
if (queryId === void 0) { queryId = this.generateQueryId(); }
|
|
5668
5721
|
__DEV__ ? tsInvariant.invariant(options.query, 'query option is required. You must specify your GraphQL document ' +
|
|
5669
|
-
'in the query option.') : tsInvariant.invariant(options.query,
|
|
5670
|
-
__DEV__ ? tsInvariant.invariant(options.query.kind === 'Document', 'You must wrap the query string in a "gql" tag.') : tsInvariant.invariant(options.query.kind === 'Document',
|
|
5671
|
-
__DEV__ ? tsInvariant.invariant(!options.returnPartialData, 'returnPartialData option only supported on watchQuery.') : tsInvariant.invariant(!options.returnPartialData,
|
|
5672
|
-
__DEV__ ? tsInvariant.invariant(!options.pollInterval, 'pollInterval option only supported on watchQuery.') : tsInvariant.invariant(!options.pollInterval,
|
|
5722
|
+
'in the query option.') : tsInvariant.invariant(options.query, 17);
|
|
5723
|
+
__DEV__ ? tsInvariant.invariant(options.query.kind === 'Document', 'You must wrap the query string in a "gql" tag.') : tsInvariant.invariant(options.query.kind === 'Document', 18);
|
|
5724
|
+
__DEV__ ? tsInvariant.invariant(!options.returnPartialData, 'returnPartialData option only supported on watchQuery.') : tsInvariant.invariant(!options.returnPartialData, 19);
|
|
5725
|
+
__DEV__ ? tsInvariant.invariant(!options.pollInterval, 'pollInterval option only supported on watchQuery.') : tsInvariant.invariant(!options.pollInterval, 20);
|
|
5673
5726
|
return this.fetchQuery(queryId, options).finally(function () { return _this.stopQuery(queryId); });
|
|
5674
5727
|
};
|
|
5675
5728
|
QueryManager.prototype.generateQueryId = function () {
|
|
@@ -5694,7 +5747,7 @@ var QueryManager = (function () {
|
|
|
5694
5747
|
if (options === void 0) { options = {
|
|
5695
5748
|
discardWatches: true,
|
|
5696
5749
|
}; }
|
|
5697
|
-
this.cancelPendingFetches(__DEV__ ? new tsInvariant.InvariantError('Store reset while query was in flight (not completed in link chain)') : new tsInvariant.InvariantError(
|
|
5750
|
+
this.cancelPendingFetches(__DEV__ ? new tsInvariant.InvariantError('Store reset while query was in flight (not completed in link chain)') : new tsInvariant.InvariantError(21));
|
|
5698
5751
|
this.queries.forEach(function (queryInfo) {
|
|
5699
5752
|
if (queryInfo.observableQuery) {
|
|
5700
5753
|
queryInfo.networkStatus = exports.NetworkStatus.loading;
|
|
@@ -6082,6 +6135,11 @@ var QueryManager = (function () {
|
|
|
6082
6135
|
onlyRunForcedResolvers: true,
|
|
6083
6136
|
}).then(function (resolved) { return fromData(resolved.data || void 0); });
|
|
6084
6137
|
}
|
|
6138
|
+
if (errorPolicy === 'none' &&
|
|
6139
|
+
networkStatus === exports.NetworkStatus.refetch &&
|
|
6140
|
+
Array.isArray(diff.missing)) {
|
|
6141
|
+
return fromData(void 0);
|
|
6142
|
+
}
|
|
6085
6143
|
return fromData(data);
|
|
6086
6144
|
};
|
|
6087
6145
|
var cacheWriteBehavior = fetchPolicy === "no-cache" ? 0 :
|
|
@@ -6418,7 +6476,7 @@ var ApolloConsumer = function (props) {
|
|
|
6418
6476
|
var ApolloContext = getApolloContext();
|
|
6419
6477
|
return (React__namespace.createElement(ApolloContext.Consumer, null, function (context) {
|
|
6420
6478
|
__DEV__ ? tsInvariant.invariant(context && context.client, 'Could not find "client" in the context of ApolloConsumer. ' +
|
|
6421
|
-
'Wrap the root component in an <ApolloProvider>.') : tsInvariant.invariant(context && context.client,
|
|
6479
|
+
'Wrap the root component in an <ApolloProvider>.') : tsInvariant.invariant(context && context.client, 28);
|
|
6422
6480
|
return props.children(context.client);
|
|
6423
6481
|
}));
|
|
6424
6482
|
};
|
|
@@ -6432,7 +6490,7 @@ var ApolloProvider = function (_a) {
|
|
|
6432
6490
|
context = Object.assign({}, context, { client: client });
|
|
6433
6491
|
}
|
|
6434
6492
|
__DEV__ ? tsInvariant.invariant(context.client, 'ApolloProvider was not passed a client instance. Make ' +
|
|
6435
|
-
'sure you pass in your client via the "client" prop.') : tsInvariant.invariant(context.client,
|
|
6493
|
+
'sure you pass in your client via the "client" prop.') : tsInvariant.invariant(context.client, 29);
|
|
6436
6494
|
return (React__namespace.createElement(ApolloContext.Provider, { value: context }, children));
|
|
6437
6495
|
}));
|
|
6438
6496
|
};
|
|
@@ -6442,7 +6500,7 @@ function useApolloClient(override) {
|
|
|
6442
6500
|
var client = override || context.client;
|
|
6443
6501
|
__DEV__ ? tsInvariant.invariant(!!client, 'Could not find "client" in the context or passed in as an option. ' +
|
|
6444
6502
|
'Wrap the root component in an <ApolloProvider>, or pass an ApolloClient ' +
|
|
6445
|
-
'instance in via options.') : tsInvariant.invariant(!!client,
|
|
6503
|
+
'instance in via options.') : tsInvariant.invariant(!!client, 32);
|
|
6446
6504
|
return client;
|
|
6447
6505
|
}
|
|
6448
6506
|
|
|
@@ -6520,7 +6578,7 @@ function parser(document) {
|
|
|
6520
6578
|
var variables, type, name;
|
|
6521
6579
|
__DEV__ ? tsInvariant.invariant(!!document && !!document.kind, "Argument of ".concat(document, " passed to parser was not a valid GraphQL ") +
|
|
6522
6580
|
"DocumentNode. You may need to use 'graphql-tag' or another method " +
|
|
6523
|
-
"to convert your operation into a document") : tsInvariant.invariant(!!document && !!document.kind,
|
|
6581
|
+
"to convert your operation into a document") : tsInvariant.invariant(!!document && !!document.kind, 33);
|
|
6524
6582
|
var fragments = [];
|
|
6525
6583
|
var queries = [];
|
|
6526
6584
|
var mutations = [];
|
|
@@ -6548,11 +6606,11 @@ function parser(document) {
|
|
|
6548
6606
|
__DEV__ ? tsInvariant.invariant(!fragments.length ||
|
|
6549
6607
|
(queries.length || mutations.length || subscriptions.length), "Passing only a fragment to 'graphql' is not yet supported. " +
|
|
6550
6608
|
"You must include a query, subscription or mutation as well") : tsInvariant.invariant(!fragments.length ||
|
|
6551
|
-
(queries.length || mutations.length || subscriptions.length),
|
|
6609
|
+
(queries.length || mutations.length || subscriptions.length), 34);
|
|
6552
6610
|
__DEV__ ? tsInvariant.invariant(queries.length + mutations.length + subscriptions.length <= 1, "react-apollo only supports a query, subscription, or a mutation per HOC. " +
|
|
6553
6611
|
"".concat(document, " had ").concat(queries.length, " queries, ").concat(subscriptions.length, " ") +
|
|
6554
6612
|
"subscriptions and ".concat(mutations.length, " mutations. ") +
|
|
6555
|
-
"You can use 'compose' to join multiple operation types to a component") : tsInvariant.invariant(queries.length + mutations.length + subscriptions.length <= 1,
|
|
6613
|
+
"You can use 'compose' to join multiple operation types to a component") : tsInvariant.invariant(queries.length + mutations.length + subscriptions.length <= 1, 35);
|
|
6556
6614
|
type = queries.length ? exports.DocumentType.Query : exports.DocumentType.Mutation;
|
|
6557
6615
|
if (!queries.length && !mutations.length)
|
|
6558
6616
|
type = exports.DocumentType.Subscription;
|
|
@@ -6563,7 +6621,7 @@ function parser(document) {
|
|
|
6563
6621
|
: subscriptions;
|
|
6564
6622
|
__DEV__ ? tsInvariant.invariant(definitions.length === 1, "react-apollo only supports one definition per HOC. ".concat(document, " had ") +
|
|
6565
6623
|
"".concat(definitions.length, " definitions. ") +
|
|
6566
|
-
"You can use 'compose' to join multiple operation types to a component") : tsInvariant.invariant(definitions.length === 1,
|
|
6624
|
+
"You can use 'compose' to join multiple operation types to a component") : tsInvariant.invariant(definitions.length === 1, 36);
|
|
6567
6625
|
var definition = definitions[0];
|
|
6568
6626
|
variables = definition.variableDefinitions || [];
|
|
6569
6627
|
if (definition.name && definition.name.kind === 'Name') {
|
|
@@ -6581,7 +6639,7 @@ function verifyDocumentType(document, type) {
|
|
|
6581
6639
|
var requiredOperationName = operationName(type);
|
|
6582
6640
|
var usedOperationName = operationName(operation.type);
|
|
6583
6641
|
__DEV__ ? tsInvariant.invariant(operation.type === type, "Running a ".concat(requiredOperationName, " requires a graphql ") +
|
|
6584
|
-
"".concat(requiredOperationName, ", but a ").concat(usedOperationName, " was used instead.")) : tsInvariant.invariant(operation.type === type,
|
|
6642
|
+
"".concat(requiredOperationName, ", but a ").concat(usedOperationName, " was used instead.")) : tsInvariant.invariant(operation.type === type, 37);
|
|
6585
6643
|
}
|
|
6586
6644
|
|
|
6587
6645
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
@@ -7189,20 +7247,21 @@ function useFragment_experimental(options) {
|
|
|
7189
7247
|
var diffOptions = tslib.__assign(tslib.__assign({}, rest), { id: typeof from === "string" ? from : cache.identify(from), query: cache["getFragmentDoc"](fragment, fragmentName), optimistic: optimistic });
|
|
7190
7248
|
var resultRef = React.useRef();
|
|
7191
7249
|
var latestDiff = cache.diff(diffOptions);
|
|
7250
|
+
var getSnapshot = function () {
|
|
7251
|
+
var latestDiffToResult = diffToResult(latestDiff);
|
|
7252
|
+
return resultRef.current &&
|
|
7253
|
+
equality.equal(resultRef.current.data, latestDiffToResult.data)
|
|
7254
|
+
? resultRef.current
|
|
7255
|
+
: (resultRef.current = latestDiffToResult);
|
|
7256
|
+
};
|
|
7192
7257
|
return useSyncExternalStore(function (forceUpdate) {
|
|
7193
7258
|
return cache.watch(tslib.__assign(tslib.__assign({}, diffOptions), { immediate: true, callback: function (diff) {
|
|
7194
7259
|
if (!equality.equal(diff, latestDiff)) {
|
|
7195
|
-
resultRef.current = diffToResult(latestDiff = diff);
|
|
7260
|
+
resultRef.current = diffToResult((latestDiff = diff));
|
|
7196
7261
|
forceUpdate();
|
|
7197
7262
|
}
|
|
7198
7263
|
} }));
|
|
7199
|
-
},
|
|
7200
|
-
var latestDiffToResult = diffToResult(latestDiff);
|
|
7201
|
-
return resultRef.current &&
|
|
7202
|
-
equality.equal(resultRef.current.data, latestDiffToResult.data)
|
|
7203
|
-
? resultRef.current
|
|
7204
|
-
: (resultRef.current = latestDiffToResult);
|
|
7205
|
-
});
|
|
7264
|
+
}, getSnapshot, getSnapshot);
|
|
7206
7265
|
}
|
|
7207
7266
|
function diffToResult(diff) {
|
|
7208
7267
|
var result = {
|