@apollo/client 3.4.8 → 3.4.9
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.js +58 -54
- package/apollo-client.cjs.js.map +1 -1
- package/apollo-core.cjs.js +49 -45
- package/apollo-core.cjs.js.map +1 -1
- package/apollo-core.cjs.min.js +1 -1
- package/cache/cache.cjs.js +10 -10
- package/cache/cache.cjs.js.map +1 -1
- package/cache/index.d.ts.map +1 -1
- package/cache/index.js +2 -3
- package/cache/index.js.map +1 -1
- package/cache/inmemory/entityStore.js +1 -1
- package/cache/inmemory/policies.js +3 -3
- package/cache/inmemory/readFromStore.js +3 -3
- package/cache/inmemory/writeToStore.js +1 -1
- package/core/ApolloClient.js +2 -2
- package/core/LocalState.js +1 -1
- package/core/ObservableQuery.js +1 -1
- package/core/QueryManager.d.ts.map +1 -1
- package/core/QueryManager.js +9 -9
- package/core/QueryManager.js.map +1 -1
- package/core/core.cjs.js +15 -14
- package/core/core.cjs.js.map +1 -1
- package/core/index.d.ts.map +1 -1
- package/core/index.js +2 -1
- package/core/index.js.map +1 -1
- package/errors/errors.cjs.js +1 -2
- package/errors/errors.cjs.js.map +1 -1
- package/errors/index.d.ts.map +1 -1
- package/errors/index.js +2 -3
- package/errors/index.js.map +1 -1
- package/invariantErrorCodes.js +56 -81
- package/link/core/ApolloLink.js +1 -1
- package/link/core/core.cjs.js +3 -3
- package/link/core/core.cjs.js.map +1 -1
- package/link/core/index.d.ts.map +1 -1
- package/link/core/index.js +2 -3
- package/link/core/index.js.map +1 -1
- package/link/http/checkFetcher.js +1 -1
- package/link/http/http.cjs.js +5 -3
- package/link/http/http.cjs.js.map +1 -1
- package/link/http/index.d.ts.map +1 -1
- package/link/http/index.js +2 -0
- package/link/http/index.js.map +1 -1
- package/link/http/serializeFetchParameter.js +1 -1
- package/link/persisted-queries/index.d.ts.map +1 -1
- package/link/persisted-queries/index.js +4 -2
- package/link/persisted-queries/index.js.map +1 -1
- package/link/persisted-queries/persisted-queries.cjs.js +4 -3
- package/link/persisted-queries/persisted-queries.cjs.js.map +1 -1
- package/link/utils/index.d.ts.map +1 -1
- package/link/utils/index.js +2 -0
- package/link/utils/index.js.map +1 -1
- package/link/utils/utils.cjs.js +3 -1
- package/link/utils/utils.cjs.js.map +1 -1
- package/link/utils/validateOperation.js +1 -1
- package/package.json +5 -5
- package/react/context/ApolloConsumer.js +1 -1
- package/react/context/ApolloProvider.js +1 -1
- package/react/context/context.cjs.js +5 -3
- package/react/context/context.cjs.js.map +1 -1
- package/react/context/index.d.ts.map +1 -1
- package/react/context/index.js +2 -0
- package/react/context/index.js.map +1 -1
- package/react/data/OperationData.js +2 -2
- package/react/data/data.cjs.js +5 -2
- package/react/data/data.cjs.js.map +1 -1
- package/react/data/index.d.ts.map +1 -1
- package/react/data/index.js +2 -0
- package/react/data/index.js.map +1 -1
- package/react/hoc/hoc-utils.js +1 -1
- package/react/hoc/hoc.cjs.js +5 -2
- package/react/hoc/hoc.cjs.js.map +1 -1
- package/react/hoc/index.d.ts.map +1 -1
- package/react/hoc/index.js +2 -0
- package/react/hoc/index.js.map +1 -1
- package/react/hoc/withApollo.js +1 -1
- package/react/hooks/hooks.cjs.js +4 -1
- package/react/hooks/hooks.cjs.js.map +1 -1
- package/react/hooks/index.d.ts.map +1 -1
- package/react/hooks/index.js +2 -0
- package/react/hooks/index.js.map +1 -1
- package/react/hooks/useApolloClient.js +1 -1
- package/react/index.d.ts.map +1 -1
- package/react/index.js +2 -3
- package/react/index.js.map +1 -1
- package/react/parser/index.d.ts.map +1 -1
- package/react/parser/index.js +6 -4
- package/react/parser/index.js.map +1 -1
- package/react/parser/parser.cjs.js +6 -4
- package/react/parser/parser.cjs.js.map +1 -1
- package/react/react.cjs.js +1 -2
- package/react/react.cjs.js.map +1 -1
- package/testing/index.js +2 -3
- package/testing/index.js.map +1 -1
- package/testing/testing.cjs.js +3 -3
- package/testing/testing.cjs.js.map +1 -1
- package/utilities/globals/index.d.ts +1 -0
- package/utilities/globals/index.d.ts.map +1 -1
- package/utilities/globals/index.js +4 -0
- package/utilities/globals/index.js.map +1 -1
- package/utilities/graphql/directives.js +4 -4
- package/utilities/graphql/fragments.js +3 -3
- package/utilities/graphql/getFromAST.js +8 -8
- package/utilities/graphql/storeUtils.js +1 -1
- package/utilities/index.d.ts +2 -2
- package/utilities/index.d.ts.map +1 -1
- package/utilities/index.js +3 -4
- package/utilities/index.js.map +1 -1
- package/utilities/observables/Concast.js +1 -1
- package/utilities/observables/Concast.js.map +1 -1
- package/utilities/testing/mocking/mockLink.js +1 -1
- package/utilities/utilities.cjs.js +22 -18
- package/utilities/utilities.cjs.js.map +1 -1
- package/version.js +1 -1
package/apollo-core.cjs.js
CHANGED
|
@@ -50,6 +50,9 @@ function removeTemporaryGlobals() {
|
|
|
50
50
|
return process$1.remove();
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
function checkDEV() {
|
|
54
|
+
__DEV__ ? tsInvariant.invariant("boolean" === typeof DEV, DEV) : tsInvariant.invariant("boolean" === typeof DEV, 38);
|
|
55
|
+
}
|
|
53
56
|
removeTemporaryGlobals();
|
|
54
57
|
|
|
55
58
|
function shouldInclude(_a, variables) {
|
|
@@ -62,7 +65,7 @@ function shouldInclude(_a, variables) {
|
|
|
62
65
|
var evaledValue = false;
|
|
63
66
|
if (ifArgument.value.kind === 'Variable') {
|
|
64
67
|
evaledValue = variables && variables[ifArgument.value.name.value];
|
|
65
|
-
__DEV__ ? tsInvariant.invariant(evaledValue !== void 0, "Invalid variable referenced in @" + directive.name.value + " directive.") : tsInvariant.invariant(evaledValue !== void 0,
|
|
68
|
+
__DEV__ ? tsInvariant.invariant(evaledValue !== void 0, "Invalid variable referenced in @" + directive.name.value + " directive.") : tsInvariant.invariant(evaledValue !== void 0, 39);
|
|
66
69
|
}
|
|
67
70
|
else {
|
|
68
71
|
evaledValue = ifArgument.value.value;
|
|
@@ -99,13 +102,13 @@ function getInclusionDirectives(directives) {
|
|
|
99
102
|
return;
|
|
100
103
|
var directiveArguments = directive.arguments;
|
|
101
104
|
var directiveName = directive.name.value;
|
|
102
|
-
__DEV__ ? tsInvariant.invariant(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @" + directiveName + " directive.") : tsInvariant.invariant(directiveArguments && directiveArguments.length === 1,
|
|
105
|
+
__DEV__ ? tsInvariant.invariant(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @" + directiveName + " directive.") : tsInvariant.invariant(directiveArguments && directiveArguments.length === 1, 40);
|
|
103
106
|
var ifArgument = directiveArguments[0];
|
|
104
|
-
__DEV__ ? tsInvariant.invariant(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @" + directiveName + " directive.") : tsInvariant.invariant(ifArgument.name && ifArgument.name.value === 'if',
|
|
107
|
+
__DEV__ ? tsInvariant.invariant(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @" + directiveName + " directive.") : tsInvariant.invariant(ifArgument.name && ifArgument.name.value === 'if', 41);
|
|
105
108
|
var ifValue = ifArgument.value;
|
|
106
109
|
__DEV__ ? tsInvariant.invariant(ifValue &&
|
|
107
110
|
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), "Argument for the @" + directiveName + " directive must be a variable or a boolean value.") : tsInvariant.invariant(ifValue &&
|
|
108
|
-
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'),
|
|
111
|
+
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), 42);
|
|
109
112
|
result.push({ directive: directive, ifArgument: ifArgument });
|
|
110
113
|
});
|
|
111
114
|
}
|
|
@@ -118,14 +121,14 @@ function getFragmentQueryDocument(document, fragmentName) {
|
|
|
118
121
|
document.definitions.forEach(function (definition) {
|
|
119
122
|
if (definition.kind === 'OperationDefinition') {
|
|
120
123
|
throw __DEV__ ? new tsInvariant.InvariantError("Found a " + definition.operation + " operation" + (definition.name ? " named '" + definition.name.value + "'" : '') + ". " +
|
|
121
|
-
'No operations are allowed when using a fragment as a query. Only fragments are allowed.') : new tsInvariant.InvariantError(
|
|
124
|
+
'No operations are allowed when using a fragment as a query. Only fragments are allowed.') : new tsInvariant.InvariantError(43);
|
|
122
125
|
}
|
|
123
126
|
if (definition.kind === 'FragmentDefinition') {
|
|
124
127
|
fragments.push(definition);
|
|
125
128
|
}
|
|
126
129
|
});
|
|
127
130
|
if (typeof actualFragmentName === 'undefined') {
|
|
128
|
-
__DEV__ ? tsInvariant.invariant(fragments.length === 1, "Found " + fragments.length + " fragments. `fragmentName` must be provided when there is not exactly 1 fragment.") : tsInvariant.invariant(fragments.length === 1,
|
|
131
|
+
__DEV__ ? tsInvariant.invariant(fragments.length === 1, "Found " + fragments.length + " fragments. `fragmentName` must be provided when there is not exactly 1 fragment.") : tsInvariant.invariant(fragments.length === 1, 44);
|
|
129
132
|
actualFragmentName = fragments[0].name.value;
|
|
130
133
|
}
|
|
131
134
|
var query = tslib.__assign(tslib.__assign({}, document), { definitions: tslib.__spreadArray([
|
|
@@ -162,7 +165,7 @@ function getFragmentFromSelection(selection, fragmentMap) {
|
|
|
162
165
|
return selection;
|
|
163
166
|
case 'FragmentSpread': {
|
|
164
167
|
var fragment = fragmentMap && fragmentMap[selection.name.value];
|
|
165
|
-
__DEV__ ? tsInvariant.invariant(fragment, "No fragment named " + selection.name.value + ".") : tsInvariant.invariant(fragment,
|
|
168
|
+
__DEV__ ? tsInvariant.invariant(fragment, "No fragment named " + selection.name.value + ".") : tsInvariant.invariant(fragment, 45);
|
|
166
169
|
return fragment;
|
|
167
170
|
}
|
|
168
171
|
default:
|
|
@@ -246,7 +249,7 @@ function valueToObjectRepresentation(argObj, name, value, variables) {
|
|
|
246
249
|
else {
|
|
247
250
|
throw __DEV__ ? new tsInvariant.InvariantError("The inline argument \"" + name.value + "\" of kind \"" + value.kind + "\"" +
|
|
248
251
|
'is not supported. Use variables instead of inline arguments to ' +
|
|
249
|
-
'overcome this limitation.') : new tsInvariant.InvariantError(
|
|
252
|
+
'overcome this limitation.') : new tsInvariant.InvariantError(54);
|
|
250
253
|
}
|
|
251
254
|
}
|
|
252
255
|
function storeKeyNameFromField(field, variables) {
|
|
@@ -380,16 +383,16 @@ function isInlineFragment(selection) {
|
|
|
380
383
|
}
|
|
381
384
|
|
|
382
385
|
function checkDocument(doc) {
|
|
383
|
-
__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',
|
|
386
|
+
__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', 46);
|
|
384
387
|
var operations = doc.definitions
|
|
385
388
|
.filter(function (d) { return d.kind !== 'FragmentDefinition'; })
|
|
386
389
|
.map(function (definition) {
|
|
387
390
|
if (definition.kind !== 'OperationDefinition') {
|
|
388
|
-
throw __DEV__ ? new tsInvariant.InvariantError("Schema type definitions not allowed in queries. Found: \"" + definition.kind + "\"") : new tsInvariant.InvariantError(
|
|
391
|
+
throw __DEV__ ? new tsInvariant.InvariantError("Schema type definitions not allowed in queries. Found: \"" + definition.kind + "\"") : new tsInvariant.InvariantError(47);
|
|
389
392
|
}
|
|
390
393
|
return definition;
|
|
391
394
|
});
|
|
392
|
-
__DEV__ ? tsInvariant.invariant(operations.length <= 1, "Ambiguous GraphQL document: contains " + operations.length + " operations") : tsInvariant.invariant(operations.length <= 1,
|
|
395
|
+
__DEV__ ? tsInvariant.invariant(operations.length <= 1, "Ambiguous GraphQL document: contains " + operations.length + " operations") : tsInvariant.invariant(operations.length <= 1, 48);
|
|
393
396
|
return doc;
|
|
394
397
|
}
|
|
395
398
|
function getOperationDefinition(doc) {
|
|
@@ -408,14 +411,14 @@ function getFragmentDefinitions(doc) {
|
|
|
408
411
|
}
|
|
409
412
|
function getQueryDefinition(doc) {
|
|
410
413
|
var queryDef = getOperationDefinition(doc);
|
|
411
|
-
__DEV__ ? tsInvariant.invariant(queryDef && queryDef.operation === 'query', 'Must contain a query definition.') : tsInvariant.invariant(queryDef && queryDef.operation === 'query',
|
|
414
|
+
__DEV__ ? tsInvariant.invariant(queryDef && queryDef.operation === 'query', 'Must contain a query definition.') : tsInvariant.invariant(queryDef && queryDef.operation === 'query', 49);
|
|
412
415
|
return queryDef;
|
|
413
416
|
}
|
|
414
417
|
function getFragmentDefinition(doc) {
|
|
415
|
-
__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',
|
|
416
|
-
__DEV__ ? tsInvariant.invariant(doc.definitions.length <= 1, 'Fragment must have exactly one definition.') : tsInvariant.invariant(doc.definitions.length <= 1,
|
|
418
|
+
__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', 50);
|
|
419
|
+
__DEV__ ? tsInvariant.invariant(doc.definitions.length <= 1, 'Fragment must have exactly one definition.') : tsInvariant.invariant(doc.definitions.length <= 1, 51);
|
|
417
420
|
var fragmentDef = doc.definitions[0];
|
|
418
|
-
__DEV__ ? tsInvariant.invariant(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.') : tsInvariant.invariant(fragmentDef.kind === 'FragmentDefinition',
|
|
421
|
+
__DEV__ ? tsInvariant.invariant(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.') : tsInvariant.invariant(fragmentDef.kind === 'FragmentDefinition', 52);
|
|
419
422
|
return fragmentDef;
|
|
420
423
|
}
|
|
421
424
|
function getMainDefinition(queryDoc) {
|
|
@@ -438,7 +441,7 @@ function getMainDefinition(queryDoc) {
|
|
|
438
441
|
if (fragmentDefinition) {
|
|
439
442
|
return fragmentDefinition;
|
|
440
443
|
}
|
|
441
|
-
throw __DEV__ ? new tsInvariant.InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.') : new tsInvariant.InvariantError(
|
|
444
|
+
throw __DEV__ ? new tsInvariant.InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.') : new tsInvariant.InvariantError(53);
|
|
442
445
|
}
|
|
443
446
|
function getDefaultValues(definition) {
|
|
444
447
|
var defaultValues = Object.create(null);
|
|
@@ -937,7 +940,7 @@ var Concast = (function (_super) {
|
|
|
937
940
|
var sub = _this.sub;
|
|
938
941
|
if (sub !== null) {
|
|
939
942
|
if (sub)
|
|
940
|
-
|
|
943
|
+
setTimeout(function () { return sub.unsubscribe(); });
|
|
941
944
|
_this.sub = null;
|
|
942
945
|
_this.latest = ["error", error];
|
|
943
946
|
_this.reject(error);
|
|
@@ -1086,7 +1089,7 @@ function stringifyForDisplay(value) {
|
|
|
1086
1089
|
}).split(JSON.stringify(undefId)).join("<undefined>");
|
|
1087
1090
|
}
|
|
1088
1091
|
|
|
1089
|
-
|
|
1092
|
+
checkDEV();
|
|
1090
1093
|
|
|
1091
1094
|
function fromError(errorValue) {
|
|
1092
1095
|
return new zenObservableTs.Observable(function (observer) {
|
|
@@ -1143,7 +1146,7 @@ function validateOperation(operation) {
|
|
|
1143
1146
|
for (var _i = 0, _a = Object.keys(operation); _i < _a.length; _i++) {
|
|
1144
1147
|
var key = _a[_i];
|
|
1145
1148
|
if (OPERATION_FIELDS.indexOf(key) < 0) {
|
|
1146
|
-
throw __DEV__ ? new tsInvariant.InvariantError("illegal argument: " + key) : new tsInvariant.InvariantError(
|
|
1149
|
+
throw __DEV__ ? new tsInvariant.InvariantError("illegal argument: " + key) : new tsInvariant.InvariantError(26);
|
|
1147
1150
|
}
|
|
1148
1151
|
}
|
|
1149
1152
|
return operation;
|
|
@@ -1266,7 +1269,7 @@ var ApolloLink = (function () {
|
|
|
1266
1269
|
return ApolloLink.concat(this, next);
|
|
1267
1270
|
};
|
|
1268
1271
|
ApolloLink.prototype.request = function (operation, forward) {
|
|
1269
|
-
throw __DEV__ ? new tsInvariant.InvariantError('request is not implemented') : new tsInvariant.InvariantError(
|
|
1272
|
+
throw __DEV__ ? new tsInvariant.InvariantError('request is not implemented') : new tsInvariant.InvariantError(21);
|
|
1270
1273
|
};
|
|
1271
1274
|
ApolloLink.prototype.onError = function (error, observer) {
|
|
1272
1275
|
if (observer && observer.error) {
|
|
@@ -1292,7 +1295,7 @@ var concat = ApolloLink.concat;
|
|
|
1292
1295
|
|
|
1293
1296
|
var execute = ApolloLink.execute;
|
|
1294
1297
|
|
|
1295
|
-
var version = '3.4.
|
|
1298
|
+
var version = '3.4.9';
|
|
1296
1299
|
|
|
1297
1300
|
var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
|
1298
1301
|
function parseAndCheckHttpResponse(operations) {
|
|
@@ -1332,7 +1335,7 @@ var serializeFetchParameter = function (p, label) {
|
|
|
1332
1335
|
serialized = JSON.stringify(p);
|
|
1333
1336
|
}
|
|
1334
1337
|
catch (e) {
|
|
1335
|
-
var parseError = __DEV__ ? new tsInvariant.InvariantError("Network request failed. " + label + " is not serializable: " + e.message) : new tsInvariant.InvariantError(
|
|
1338
|
+
var parseError = __DEV__ ? new tsInvariant.InvariantError("Network request failed. " + label + " is not serializable: " + e.message) : new tsInvariant.InvariantError(23);
|
|
1336
1339
|
parseError.parseError = e;
|
|
1337
1340
|
throw parseError;
|
|
1338
1341
|
}
|
|
@@ -1392,7 +1395,7 @@ function headersToLowerCase(headers) {
|
|
|
1392
1395
|
|
|
1393
1396
|
var checkFetcher = function (fetcher) {
|
|
1394
1397
|
if (!fetcher && typeof fetch === 'undefined') {
|
|
1395
|
-
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(
|
|
1398
|
+
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(22);
|
|
1396
1399
|
}
|
|
1397
1400
|
};
|
|
1398
1401
|
|
|
@@ -1772,7 +1775,7 @@ var EntityStore = (function () {
|
|
|
1772
1775
|
: newer;
|
|
1773
1776
|
if (!incoming)
|
|
1774
1777
|
return;
|
|
1775
|
-
__DEV__ ? tsInvariant.invariant(typeof dataId === "string", "store.merge expects a string ID") : tsInvariant.invariant(typeof dataId === "string",
|
|
1778
|
+
__DEV__ ? tsInvariant.invariant(typeof dataId === "string", "store.merge expects a string ID") : tsInvariant.invariant(typeof dataId === "string", 1);
|
|
1776
1779
|
var merged = new DeepMerger(storeObjectReconciler).merge(existing, incoming);
|
|
1777
1780
|
this.data[dataId] = merged;
|
|
1778
1781
|
if (merged !== existing) {
|
|
@@ -2363,7 +2366,7 @@ var StoreReader = (function () {
|
|
|
2363
2366
|
!context.store.has(objectOrReference.__ref)) {
|
|
2364
2367
|
return {
|
|
2365
2368
|
result: this.canon.empty,
|
|
2366
|
-
missing: [missingFromInvariant(__DEV__ ? new tsInvariant.InvariantError("Dangling reference to missing " + objectOrReference.__ref + " object") : new tsInvariant.InvariantError(
|
|
2369
|
+
missing: [missingFromInvariant(__DEV__ ? new tsInvariant.InvariantError("Dangling reference to missing " + objectOrReference.__ref + " object") : new tsInvariant.InvariantError(5), context)],
|
|
2367
2370
|
};
|
|
2368
2371
|
}
|
|
2369
2372
|
var variables = context.variables, policies = context.policies, store = context.store;
|
|
@@ -2402,7 +2405,7 @@ var StoreReader = (function () {
|
|
|
2402
2405
|
if (!addTypenameToDocument.added(selection)) {
|
|
2403
2406
|
getMissing().push(missingFromInvariant(__DEV__ ? new tsInvariant.InvariantError("Can't find field '" + selection.name.value + "' on " + (isReference(objectOrReference)
|
|
2404
2407
|
? objectOrReference.__ref + " object"
|
|
2405
|
-
: "object " + JSON.stringify(objectOrReference, null, 2))) : new tsInvariant.InvariantError(
|
|
2408
|
+
: "object " + JSON.stringify(objectOrReference, null, 2))) : new tsInvariant.InvariantError(6), context));
|
|
2406
2409
|
}
|
|
2407
2410
|
}
|
|
2408
2411
|
else if (Array.isArray(fieldValue)) {
|
|
@@ -2499,7 +2502,7 @@ function assertSelectionSetForIdValue(store, field, fieldValue) {
|
|
|
2499
2502
|
var workSet_1 = new Set([fieldValue]);
|
|
2500
2503
|
workSet_1.forEach(function (value) {
|
|
2501
2504
|
if (isNonNullObject(value)) {
|
|
2502
|
-
__DEV__ ? tsInvariant.invariant(!isReference(value), "Missing selection set for object of type " + getTypenameFromStoreObject(store, value) + " returned for query field " + field.name.value) : tsInvariant.invariant(!isReference(value),
|
|
2505
|
+
__DEV__ ? tsInvariant.invariant(!isReference(value), "Missing selection set for object of type " + getTypenameFromStoreObject(store, value) + " returned for query field " + field.name.value) : tsInvariant.invariant(!isReference(value), 7);
|
|
2503
2506
|
Object.values(value).forEach(workSet_1.add, workSet_1);
|
|
2504
2507
|
}
|
|
2505
2508
|
});
|
|
@@ -2538,7 +2541,7 @@ var StoreWriter = (function () {
|
|
|
2538
2541
|
context: context,
|
|
2539
2542
|
});
|
|
2540
2543
|
if (!isReference(ref)) {
|
|
2541
|
-
throw __DEV__ ? new tsInvariant.InvariantError("Could not identify object " + JSON.stringify(result)) : new tsInvariant.InvariantError(
|
|
2544
|
+
throw __DEV__ ? new tsInvariant.InvariantError("Could not identify object " + JSON.stringify(result)) : new tsInvariant.InvariantError(8);
|
|
2542
2545
|
}
|
|
2543
2546
|
context.incomingById.forEach(function (_a, dataId) {
|
|
2544
2547
|
var fields = _a.fields, mergeTree = _a.mergeTree, selections = _a.selections;
|
|
@@ -3035,7 +3038,7 @@ var Policies = (function () {
|
|
|
3035
3038
|
var rootId = "ROOT_" + which.toUpperCase();
|
|
3036
3039
|
var old = this.rootTypenamesById[rootId];
|
|
3037
3040
|
if (typename !== old) {
|
|
3038
|
-
__DEV__ ? tsInvariant.invariant(!old || old === which, "Cannot change root " + which + " __typename more than once") : tsInvariant.invariant(!old || old === which,
|
|
3041
|
+
__DEV__ ? tsInvariant.invariant(!old || old === which, "Cannot change root " + which + " __typename more than once") : tsInvariant.invariant(!old || old === which, 2);
|
|
3039
3042
|
if (old)
|
|
3040
3043
|
delete this.rootIdsByTypename[old];
|
|
3041
3044
|
this.rootIdsByTypename[typename] = rootId;
|
|
@@ -3279,7 +3282,7 @@ function makeFieldFunctionOptions(policies, objectOrReference, fieldSpec, contex
|
|
|
3279
3282
|
function makeMergeObjectsFunction(store) {
|
|
3280
3283
|
return function mergeObjects(existing, incoming) {
|
|
3281
3284
|
if (Array.isArray(existing) || Array.isArray(incoming)) {
|
|
3282
|
-
throw __DEV__ ? new tsInvariant.InvariantError("Cannot automatically merge arrays") : new tsInvariant.InvariantError(
|
|
3285
|
+
throw __DEV__ ? new tsInvariant.InvariantError("Cannot automatically merge arrays") : new tsInvariant.InvariantError(3);
|
|
3283
3286
|
}
|
|
3284
3287
|
if (isNonNullObject(existing) &&
|
|
3285
3288
|
isNonNullObject(incoming)) {
|
|
@@ -3379,7 +3382,7 @@ function computeKeyObject(response, specifier, strict, aliasMap) {
|
|
|
3379
3382
|
keyObj[lastActualKey = s] = response[lastResponseKey = responseName];
|
|
3380
3383
|
}
|
|
3381
3384
|
else {
|
|
3382
|
-
__DEV__ ? tsInvariant.invariant(!strict, "Missing field '" + responseName + "' while computing key fields") : tsInvariant.invariant(!strict,
|
|
3385
|
+
__DEV__ ? tsInvariant.invariant(!strict, "Missing field '" + responseName + "' while computing key fields") : tsInvariant.invariant(!strict, 4);
|
|
3383
3386
|
lastResponseKey = lastActualKey = void 0;
|
|
3384
3387
|
}
|
|
3385
3388
|
}
|
|
@@ -3672,7 +3675,7 @@ var InMemoryCache = (function (_super) {
|
|
|
3672
3675
|
return InMemoryCache;
|
|
3673
3676
|
}(ApolloCache));
|
|
3674
3677
|
|
|
3675
|
-
|
|
3678
|
+
checkDEV();
|
|
3676
3679
|
function isApolloError(err) {
|
|
3677
3680
|
return err.hasOwnProperty('graphQLErrors');
|
|
3678
3681
|
}
|
|
@@ -4014,7 +4017,7 @@ var ObservableQuery = (function (_super) {
|
|
|
4014
4017
|
pollingInfo.interval === pollInterval) {
|
|
4015
4018
|
return;
|
|
4016
4019
|
}
|
|
4017
|
-
__DEV__ ? tsInvariant.invariant(pollInterval, 'Attempted to start a polling query without a polling interval.') : tsInvariant.invariant(pollInterval,
|
|
4020
|
+
__DEV__ ? tsInvariant.invariant(pollInterval, 'Attempted to start a polling query without a polling interval.') : tsInvariant.invariant(pollInterval, 12);
|
|
4018
4021
|
var info = pollingInfo || (this.pollingInfo = {});
|
|
4019
4022
|
info.interval = pollInterval;
|
|
4020
4023
|
var maybeFetch = function () {
|
|
@@ -4311,7 +4314,7 @@ var LocalState = (function () {
|
|
|
4311
4314
|
}
|
|
4312
4315
|
else {
|
|
4313
4316
|
fragment = fragmentMap[selection.name.value];
|
|
4314
|
-
__DEV__ ? tsInvariant.invariant(fragment, "No fragment named " + selection.name.value) : tsInvariant.invariant(fragment,
|
|
4317
|
+
__DEV__ ? tsInvariant.invariant(fragment, "No fragment named " + selection.name.value) : tsInvariant.invariant(fragment, 11);
|
|
4315
4318
|
}
|
|
4316
4319
|
if (fragment && fragment.typeCondition) {
|
|
4317
4320
|
typeCondition = fragment.typeCondition.name.value;
|
|
@@ -4697,7 +4700,7 @@ var QueryManager = (function () {
|
|
|
4697
4700
|
this.queries.forEach(function (_info, queryId) {
|
|
4698
4701
|
_this.stopQueryNoBroadcast(queryId);
|
|
4699
4702
|
});
|
|
4700
|
-
this.cancelPendingFetches(__DEV__ ? new tsInvariant.InvariantError('QueryManager stopped while query was in flight') : new tsInvariant.InvariantError(
|
|
4703
|
+
this.cancelPendingFetches(__DEV__ ? new tsInvariant.InvariantError('QueryManager stopped while query was in flight') : new tsInvariant.InvariantError(13));
|
|
4701
4704
|
};
|
|
4702
4705
|
QueryManager.prototype.cancelPendingFetches = function (error) {
|
|
4703
4706
|
this.fetchCancelFns.forEach(function (cancel) { return cancel(error); });
|
|
@@ -4710,10 +4713,10 @@ var QueryManager = (function () {
|
|
|
4710
4713
|
return tslib.__generator(this, function (_f) {
|
|
4711
4714
|
switch (_f.label) {
|
|
4712
4715
|
case 0:
|
|
4713
|
-
__DEV__ ? tsInvariant.invariant(mutation, 'mutation option is required. You must specify your GraphQL document in the mutation option.') : tsInvariant.invariant(mutation,
|
|
4716
|
+
__DEV__ ? tsInvariant.invariant(mutation, 'mutation option is required. You must specify your GraphQL document in the mutation option.') : tsInvariant.invariant(mutation, 14);
|
|
4714
4717
|
__DEV__ ? tsInvariant.invariant(fetchPolicy === 'network-only' ||
|
|
4715
4718
|
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' ||
|
|
4716
|
-
fetchPolicy === 'no-cache',
|
|
4719
|
+
fetchPolicy === 'no-cache', 15);
|
|
4717
4720
|
mutationId = this.generateMutationId();
|
|
4718
4721
|
mutation = this.transform(mutation).document;
|
|
4719
4722
|
variables = this.getVariables(mutation, variables);
|
|
@@ -4998,10 +5001,10 @@ var QueryManager = (function () {
|
|
|
4998
5001
|
var _this = this;
|
|
4999
5002
|
if (queryId === void 0) { queryId = this.generateQueryId(); }
|
|
5000
5003
|
__DEV__ ? tsInvariant.invariant(options.query, 'query option is required. You must specify your GraphQL document ' +
|
|
5001
|
-
'in the query option.') : tsInvariant.invariant(options.query,
|
|
5002
|
-
__DEV__ ? tsInvariant.invariant(options.query.kind === 'Document', 'You must wrap the query string in a "gql" tag.') : tsInvariant.invariant(options.query.kind === 'Document',
|
|
5003
|
-
__DEV__ ? tsInvariant.invariant(!options.returnPartialData, 'returnPartialData option only supported on watchQuery.') : tsInvariant.invariant(!options.returnPartialData,
|
|
5004
|
-
__DEV__ ? tsInvariant.invariant(!options.pollInterval, 'pollInterval option only supported on watchQuery.') : tsInvariant.invariant(!options.pollInterval,
|
|
5004
|
+
'in the query option.') : tsInvariant.invariant(options.query, 16);
|
|
5005
|
+
__DEV__ ? tsInvariant.invariant(options.query.kind === 'Document', 'You must wrap the query string in a "gql" tag.') : tsInvariant.invariant(options.query.kind === 'Document', 17);
|
|
5006
|
+
__DEV__ ? tsInvariant.invariant(!options.returnPartialData, 'returnPartialData option only supported on watchQuery.') : tsInvariant.invariant(!options.returnPartialData, 18);
|
|
5007
|
+
__DEV__ ? tsInvariant.invariant(!options.pollInterval, 'pollInterval option only supported on watchQuery.') : tsInvariant.invariant(!options.pollInterval, 19);
|
|
5005
5008
|
return this.fetchQuery(queryId, options).finally(function () { return _this.stopQuery(queryId); });
|
|
5006
5009
|
};
|
|
5007
5010
|
QueryManager.prototype.generateQueryId = function () {
|
|
@@ -5023,7 +5026,7 @@ var QueryManager = (function () {
|
|
|
5023
5026
|
queryInfo.stop();
|
|
5024
5027
|
};
|
|
5025
5028
|
QueryManager.prototype.clearStore = function () {
|
|
5026
|
-
this.cancelPendingFetches(__DEV__ ? new tsInvariant.InvariantError('Store reset while query was in flight (not completed in link chain)') : new tsInvariant.InvariantError(
|
|
5029
|
+
this.cancelPendingFetches(__DEV__ ? new tsInvariant.InvariantError('Store reset while query was in flight (not completed in link chain)') : new tsInvariant.InvariantError(20));
|
|
5027
5030
|
this.queries.forEach(function (queryInfo) {
|
|
5028
5031
|
if (queryInfo.observableQuery) {
|
|
5029
5032
|
queryInfo.networkStatus = exports.NetworkStatus.loading;
|
|
@@ -5298,7 +5301,7 @@ var QueryManager = (function () {
|
|
|
5298
5301
|
return _this.fetchQueryByPolicy(queryInfo, normalized, networkStatus);
|
|
5299
5302
|
};
|
|
5300
5303
|
this.fetchCancelFns.set(queryId, function (reason) {
|
|
5301
|
-
|
|
5304
|
+
setTimeout(function () { return concast.cancel(reason); });
|
|
5302
5305
|
});
|
|
5303
5306
|
var concast = new Concast(this.transform(normalized.query).hasClientExports
|
|
5304
5307
|
? this.localState.addExportedVariables(normalized.query, normalized.variables, normalized.context).then(fromVariables)
|
|
@@ -5516,7 +5519,7 @@ var ApolloClient = (function () {
|
|
|
5516
5519
|
if (!cache) {
|
|
5517
5520
|
throw __DEV__ ? new tsInvariant.InvariantError("To initialize Apollo Client, you must specify a 'cache' property " +
|
|
5518
5521
|
"in the options object. \n" +
|
|
5519
|
-
"For more information, please visit: https://go.apollo.dev/c/docs") : new tsInvariant.InvariantError(
|
|
5522
|
+
"For more information, please visit: https://go.apollo.dev/c/docs") : new tsInvariant.InvariantError(9);
|
|
5520
5523
|
}
|
|
5521
5524
|
this.link = link;
|
|
5522
5525
|
this.cache = cache;
|
|
@@ -5612,7 +5615,7 @@ var ApolloClient = (function () {
|
|
|
5612
5615
|
__DEV__ ? tsInvariant.invariant(options.fetchPolicy !== 'cache-and-network', 'The cache-and-network fetchPolicy does not work with client.query, because ' +
|
|
5613
5616
|
'client.query can only return a single result. Please use client.watchQuery ' +
|
|
5614
5617
|
'to receive multiple results from the cache and the network, or consider ' +
|
|
5615
|
-
'using a different fetchPolicy, such as cache-first or network-only.') : tsInvariant.invariant(options.fetchPolicy !== 'cache-and-network',
|
|
5618
|
+
'using a different fetchPolicy, such as cache-first or network-only.') : tsInvariant.invariant(options.fetchPolicy !== 'cache-and-network', 10);
|
|
5616
5619
|
if (this.disableNetworkFetches && options.fetchPolicy === 'network-only') {
|
|
5617
5620
|
options = tslib.__assign(tslib.__assign({}, options), { fetchPolicy: 'cache-first' });
|
|
5618
5621
|
}
|
|
@@ -5723,6 +5726,7 @@ var ApolloClient = (function () {
|
|
|
5723
5726
|
return ApolloClient;
|
|
5724
5727
|
}());
|
|
5725
5728
|
|
|
5729
|
+
checkDEV();
|
|
5726
5730
|
tsInvariant.setVerbosity(DEV ? "log" : "silent");
|
|
5727
5731
|
|
|
5728
5732
|
exports.setLogVerbosity = tsInvariant.setVerbosity;
|