@apollo/client 3.5.4 → 3.5.5
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 +73 -62
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/cache/cache.cjs +15 -15
- package/cache/cache.cjs.map +1 -1
- package/cache/inmemory/helpers.js +1 -1
- package/cache/inmemory/helpers.js.map +1 -1
- package/cache/inmemory/key-extractor.js +2 -2
- package/cache/inmemory/key-extractor.js.map +1 -1
- package/cache/inmemory/policies.js +3 -3
- package/cache/inmemory/policies.js.map +1 -1
- package/cache/inmemory/readFromStore.js +3 -3
- package/cache/inmemory/readFromStore.js.map +1 -1
- package/cache/inmemory/writeToStore.js +6 -6
- package/cache/inmemory/writeToStore.js.map +1 -1
- package/core/ApolloClient.js +1 -1
- package/core/ApolloClient.js.map +1 -1
- package/core/LocalState.js +1 -1
- package/core/LocalState.js.map +1 -1
- package/core/ObservableQuery.js +2 -2
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryManager.js +1 -1
- package/core/QueryManager.js.map +1 -1
- package/core/core.cjs +10 -10
- package/core/core.cjs.map +1 -1
- package/errors/errors.cjs +2 -2
- package/errors/errors.cjs.map +1 -1
- package/errors/index.js +2 -2
- package/errors/index.js.map +1 -1
- package/invariantErrorCodes.js +25 -25
- package/link/batch/batch.cjs +1 -1
- package/link/batch/batch.cjs.map +1 -1
- package/link/batch/batching.js +1 -1
- package/link/batch/batching.js.map +1 -1
- package/link/batch-http/batch-http.cjs +1 -1
- package/link/batch-http/batch-http.cjs.map +1 -1
- package/link/batch-http/batchHttpLink.js +2 -2
- package/link/batch-http/batchHttpLink.js.map +1 -1
- package/link/http/createHttpLink.js +2 -2
- package/link/http/createHttpLink.js.map +1 -1
- package/link/http/http.cjs +24 -13
- package/link/http/http.cjs.map +1 -1
- package/link/http/index.d.ts +1 -1
- package/link/http/index.d.ts.map +1 -1
- package/link/http/index.js +1 -1
- package/link/http/index.js.map +1 -1
- package/link/http/parseAndCheckHttpResponse.js +3 -3
- package/link/http/parseAndCheckHttpResponse.js.map +1 -1
- package/link/http/rewriteURIForGET.js +1 -1
- package/link/http/rewriteURIForGET.js.map +1 -1
- package/link/http/selectHttpOptionsAndBody.d.ts +5 -1
- package/link/http/selectHttpOptionsAndBody.d.ts.map +1 -1
- package/link/http/selectHttpOptionsAndBody.js +19 -8
- package/link/http/selectHttpOptionsAndBody.js.map +1 -1
- package/link/http/serializeFetchParameter.js +1 -1
- package/link/http/serializeFetchParameter.js.map +1 -1
- package/link/utils/utils.cjs +1 -1
- package/link/utils/utils.cjs.map +1 -1
- package/link/utils/validateOperation.js +1 -1
- package/link/utils/validateOperation.js.map +1 -1
- package/main.cjs +4 -4
- package/package.json +9 -9
- package/react/components/components.cjs +3 -3
- package/react/context/context.cjs +3 -3
- package/react/hoc/hoc.cjs +9 -9
- package/react/hoc/hoc.cjs.map +1 -1
- package/react/hoc/mutation-hoc.js +2 -2
- package/react/hoc/mutation-hoc.js.map +1 -1
- package/react/hoc/query-hoc.js +1 -1
- package/react/hoc/query-hoc.js.map +1 -1
- package/react/hoc/subscription-hoc.js +1 -1
- package/react/hoc/subscription-hoc.js.map +1 -1
- package/react/hoc/withApollo.js +1 -1
- package/react/hoc/withApollo.js.map +1 -1
- package/react/parser/index.js +7 -7
- package/react/parser/index.js.map +1 -1
- package/react/parser/parser.cjs +7 -7
- package/react/parser/parser.cjs.map +1 -1
- package/react/react.cjs +2 -2
- package/react/ssr/ssr.cjs +3 -3
- package/testing/core/core.cjs +2 -2
- package/testing/core/core.cjs.map +1 -1
- package/testing/core/mocking/mockFetch.js +1 -1
- package/testing/core/mocking/mockFetch.js.map +1 -1
- package/testing/core/mocking/mockLink.js +2 -2
- package/testing/core/mocking/mockLink.js.map +1 -1
- package/testing/core/observableToPromise.js +1 -1
- package/testing/core/observableToPromise.js.map +1 -1
- package/testing/testing.cjs +5 -5
- package/utilities/common/makeUniqueId.js +1 -1
- package/utilities/common/makeUniqueId.js.map +1 -1
- package/utilities/graphql/directives.js +4 -4
- package/utilities/graphql/directives.js.map +1 -1
- package/utilities/graphql/fragments.js +3 -3
- package/utilities/graphql/fragments.js.map +1 -1
- package/utilities/graphql/getFromAST.js +2 -2
- package/utilities/graphql/getFromAST.js.map +1 -1
- package/utilities/graphql/storeUtils.js +5 -5
- package/utilities/graphql/storeUtils.js.map +1 -1
- package/utilities/utilities.cjs +15 -15
- package/utilities/utilities.cjs.map +1 -1
- package/version.js +1 -1
package/apollo-client.cjs
CHANGED
|
@@ -18,11 +18,11 @@ function _interopNamespace(e) {
|
|
|
18
18
|
if (e && e.__esModule) return e;
|
|
19
19
|
var n = Object.create(null);
|
|
20
20
|
if (e) {
|
|
21
|
-
|
|
21
|
+
for (var k in e) {
|
|
22
22
|
n[k] = e[k];
|
|
23
|
-
}
|
|
23
|
+
}
|
|
24
24
|
}
|
|
25
|
-
n[
|
|
25
|
+
n["default"] = e;
|
|
26
26
|
return Object.freeze(n);
|
|
27
27
|
}
|
|
28
28
|
|
|
@@ -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 @"
|
|
48
|
+
__DEV__ ? tsInvariant.invariant(evaledValue !== void 0, "Invalid variable referenced in @".concat(directive.name.value, " directive.")) : tsInvariant.invariant(evaledValue !== void 0, 37);
|
|
49
49
|
}
|
|
50
50
|
else {
|
|
51
51
|
evaledValue = ifArgument.value.value;
|
|
@@ -82,12 +82,12 @@ function getInclusionDirectives(directives) {
|
|
|
82
82
|
return;
|
|
83
83
|
var directiveArguments = directive.arguments;
|
|
84
84
|
var directiveName = directive.name.value;
|
|
85
|
-
__DEV__ ? tsInvariant.invariant(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @"
|
|
85
|
+
__DEV__ ? tsInvariant.invariant(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @".concat(directiveName, " directive.")) : tsInvariant.invariant(directiveArguments && directiveArguments.length === 1, 38);
|
|
86
86
|
var ifArgument = directiveArguments[0];
|
|
87
|
-
__DEV__ ? tsInvariant.invariant(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @"
|
|
87
|
+
__DEV__ ? tsInvariant.invariant(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @".concat(directiveName, " directive.")) : tsInvariant.invariant(ifArgument.name && ifArgument.name.value === 'if', 39);
|
|
88
88
|
var ifValue = ifArgument.value;
|
|
89
89
|
__DEV__ ? tsInvariant.invariant(ifValue &&
|
|
90
|
-
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), "Argument for the @"
|
|
90
|
+
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), "Argument for the @".concat(directiveName, " directive must be a variable or a boolean value.")) : tsInvariant.invariant(ifValue &&
|
|
91
91
|
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), 40);
|
|
92
92
|
result.push({ directive: directive, ifArgument: ifArgument });
|
|
93
93
|
});
|
|
@@ -100,7 +100,7 @@ function getFragmentQueryDocument(document, fragmentName) {
|
|
|
100
100
|
var fragments = [];
|
|
101
101
|
document.definitions.forEach(function (definition) {
|
|
102
102
|
if (definition.kind === 'OperationDefinition') {
|
|
103
|
-
throw __DEV__ ? new tsInvariant.InvariantError("Found a "
|
|
103
|
+
throw __DEV__ ? new tsInvariant.InvariantError("Found a ".concat(definition.operation, " operation").concat(definition.name ? " named '".concat(definition.name.value, "'") : '', ". ") +
|
|
104
104
|
'No operations are allowed when using a fragment as a query. Only fragments are allowed.') : new tsInvariant.InvariantError(41);
|
|
105
105
|
}
|
|
106
106
|
if (definition.kind === 'FragmentDefinition') {
|
|
@@ -108,7 +108,7 @@ function getFragmentQueryDocument(document, fragmentName) {
|
|
|
108
108
|
}
|
|
109
109
|
});
|
|
110
110
|
if (typeof actualFragmentName === 'undefined') {
|
|
111
|
-
__DEV__ ? tsInvariant.invariant(fragments.length === 1, "Found "
|
|
111
|
+
__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, 42);
|
|
112
112
|
actualFragmentName = fragments[0].name.value;
|
|
113
113
|
}
|
|
114
114
|
var query = tslib.__assign(tslib.__assign({}, document), { definitions: tslib.__spreadArray([
|
|
@@ -145,7 +145,7 @@ function getFragmentFromSelection(selection, fragmentMap) {
|
|
|
145
145
|
return selection;
|
|
146
146
|
case 'FragmentSpread': {
|
|
147
147
|
var fragment = fragmentMap && fragmentMap[selection.name.value];
|
|
148
|
-
__DEV__ ? tsInvariant.invariant(fragment, "No fragment named "
|
|
148
|
+
__DEV__ ? tsInvariant.invariant(fragment, "No fragment named ".concat(selection.name.value, ".")) : tsInvariant.invariant(fragment, 43);
|
|
149
149
|
return fragment;
|
|
150
150
|
}
|
|
151
151
|
default:
|
|
@@ -227,7 +227,7 @@ function valueToObjectRepresentation(argObj, name, value, variables) {
|
|
|
227
227
|
argObj[name.value] = null;
|
|
228
228
|
}
|
|
229
229
|
else {
|
|
230
|
-
throw __DEV__ ? new tsInvariant.InvariantError("The inline argument \""
|
|
230
|
+
throw __DEV__ ? new tsInvariant.InvariantError("The inline argument \"".concat(name.value, "\" of kind \"").concat(value.kind, "\"") +
|
|
231
231
|
'is not supported. Use variables instead of inline arguments to ' +
|
|
232
232
|
'overcome this limitation.') : new tsInvariant.InvariantError(52);
|
|
233
233
|
}
|
|
@@ -279,7 +279,7 @@ var getStoreKeyName = Object.assign(function (fieldName, args, directives) {
|
|
|
279
279
|
filterKeys.forEach(function (key) {
|
|
280
280
|
filteredArgs_1[key] = args[key];
|
|
281
281
|
});
|
|
282
|
-
return directives['connection']['key']
|
|
282
|
+
return "".concat(directives['connection']['key'], "(").concat(stringify(filteredArgs_1), ")");
|
|
283
283
|
}
|
|
284
284
|
else {
|
|
285
285
|
return directives['connection']['key'];
|
|
@@ -288,17 +288,17 @@ var getStoreKeyName = Object.assign(function (fieldName, args, directives) {
|
|
|
288
288
|
var completeFieldName = fieldName;
|
|
289
289
|
if (args) {
|
|
290
290
|
var stringifiedArgs = stringify(args);
|
|
291
|
-
completeFieldName += "("
|
|
291
|
+
completeFieldName += "(".concat(stringifiedArgs, ")");
|
|
292
292
|
}
|
|
293
293
|
if (directives) {
|
|
294
294
|
Object.keys(directives).forEach(function (key) {
|
|
295
295
|
if (KNOWN_DIRECTIVES.indexOf(key) !== -1)
|
|
296
296
|
return;
|
|
297
297
|
if (directives[key] && Object.keys(directives[key]).length) {
|
|
298
|
-
completeFieldName += "@"
|
|
298
|
+
completeFieldName += "@".concat(key, "(").concat(stringify(directives[key]), ")");
|
|
299
299
|
}
|
|
300
300
|
else {
|
|
301
|
-
completeFieldName += "@"
|
|
301
|
+
completeFieldName += "@".concat(key);
|
|
302
302
|
}
|
|
303
303
|
});
|
|
304
304
|
}
|
|
@@ -368,11 +368,11 @@ function checkDocument(doc) {
|
|
|
368
368
|
.filter(function (d) { return d.kind !== 'FragmentDefinition'; })
|
|
369
369
|
.map(function (definition) {
|
|
370
370
|
if (definition.kind !== 'OperationDefinition') {
|
|
371
|
-
throw __DEV__ ? new tsInvariant.InvariantError("Schema type definitions not allowed in queries. Found: \""
|
|
371
|
+
throw __DEV__ ? new tsInvariant.InvariantError("Schema type definitions not allowed in queries. Found: \"".concat(definition.kind, "\"")) : new tsInvariant.InvariantError(45);
|
|
372
372
|
}
|
|
373
373
|
return definition;
|
|
374
374
|
});
|
|
375
|
-
__DEV__ ? tsInvariant.invariant(operations.length <= 1, "Ambiguous GraphQL document: contains "
|
|
375
|
+
__DEV__ ? tsInvariant.invariant(operations.length <= 1, "Ambiguous GraphQL document: contains ".concat(operations.length, " operations")) : tsInvariant.invariant(operations.length <= 1, 46);
|
|
376
376
|
return doc;
|
|
377
377
|
}
|
|
378
378
|
function getOperationDefinition(doc) {
|
|
@@ -1077,7 +1077,7 @@ var prefixCounts = new Map();
|
|
|
1077
1077
|
function makeUniqueId(prefix) {
|
|
1078
1078
|
var count = prefixCounts.get(prefix) || 1;
|
|
1079
1079
|
prefixCounts.set(prefix, count + 1);
|
|
1080
|
-
return prefix
|
|
1080
|
+
return "".concat(prefix, ":").concat(count, ":").concat(Math.random().toString(36).slice(2));
|
|
1081
1081
|
}
|
|
1082
1082
|
|
|
1083
1083
|
function stringifyForDisplay(value) {
|
|
@@ -1142,7 +1142,7 @@ function validateOperation(operation) {
|
|
|
1142
1142
|
for (var _i = 0, _a = Object.keys(operation); _i < _a.length; _i++) {
|
|
1143
1143
|
var key = _a[_i];
|
|
1144
1144
|
if (OPERATION_FIELDS.indexOf(key) < 0) {
|
|
1145
|
-
throw __DEV__ ? new tsInvariant.InvariantError("illegal argument: "
|
|
1145
|
+
throw __DEV__ ? new tsInvariant.InvariantError("illegal argument: ".concat(key)) : new tsInvariant.InvariantError(24);
|
|
1146
1146
|
}
|
|
1147
1147
|
}
|
|
1148
1148
|
return operation;
|
|
@@ -1291,7 +1291,7 @@ var concat = ApolloLink.concat;
|
|
|
1291
1291
|
|
|
1292
1292
|
var execute = ApolloLink.execute;
|
|
1293
1293
|
|
|
1294
|
-
var version = '3.5.
|
|
1294
|
+
var version = '3.5.5';
|
|
1295
1295
|
|
|
1296
1296
|
var hasOwnProperty$2 = Object.prototype.hasOwnProperty;
|
|
1297
1297
|
function parseAndCheckHttpResponse(operations) {
|
|
@@ -1312,14 +1312,14 @@ function parseAndCheckHttpResponse(operations) {
|
|
|
1312
1312
|
})
|
|
1313
1313
|
.then(function (result) {
|
|
1314
1314
|
if (response.status >= 300) {
|
|
1315
|
-
throwServerError(response, result, "Response not successful: Received status code "
|
|
1315
|
+
throwServerError(response, result, "Response not successful: Received status code ".concat(response.status));
|
|
1316
1316
|
}
|
|
1317
1317
|
if (!Array.isArray(result) &&
|
|
1318
1318
|
!hasOwnProperty$2.call(result, 'data') &&
|
|
1319
1319
|
!hasOwnProperty$2.call(result, 'errors')) {
|
|
1320
|
-
throwServerError(response, result, "Server response was missing for query '"
|
|
1320
|
+
throwServerError(response, result, "Server response was missing for query '".concat(Array.isArray(operations)
|
|
1321
1321
|
? operations.map(function (op) { return op.operationName; })
|
|
1322
|
-
: operations.operationName
|
|
1322
|
+
: operations.operationName, "'."));
|
|
1323
1323
|
}
|
|
1324
1324
|
return result;
|
|
1325
1325
|
}); };
|
|
@@ -1331,7 +1331,7 @@ var serializeFetchParameter = function (p, label) {
|
|
|
1331
1331
|
serialized = JSON.stringify(p);
|
|
1332
1332
|
}
|
|
1333
1333
|
catch (e) {
|
|
1334
|
-
var parseError = __DEV__ ? new tsInvariant.InvariantError("Network request failed. "
|
|
1334
|
+
var parseError = __DEV__ ? new tsInvariant.InvariantError("Network request failed. ".concat(label, " is not serializable: ").concat(e.message)) : new tsInvariant.InvariantError(21);
|
|
1335
1335
|
parseError.parseError = e;
|
|
1336
1336
|
throw parseError;
|
|
1337
1337
|
}
|
|
@@ -1355,17 +1355,27 @@ var fallbackHttpConfig = {
|
|
|
1355
1355
|
options: defaultOptions,
|
|
1356
1356
|
};
|
|
1357
1357
|
var defaultPrinter = function (ast, printer) { return printer(ast); };
|
|
1358
|
-
|
|
1358
|
+
function selectHttpOptionsAndBody(operation, fallbackConfig) {
|
|
1359
|
+
var configs = [];
|
|
1360
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
|
1361
|
+
configs[_i - 2] = arguments[_i];
|
|
1362
|
+
}
|
|
1363
|
+
configs.unshift(fallbackConfig);
|
|
1364
|
+
return selectHttpOptionsAndBodyInternal.apply(void 0, tslib.__spreadArray([operation,
|
|
1365
|
+
defaultPrinter], configs, false));
|
|
1366
|
+
}
|
|
1367
|
+
function selectHttpOptionsAndBodyInternal(operation, printer) {
|
|
1359
1368
|
var configs = [];
|
|
1360
|
-
for (var _i =
|
|
1361
|
-
configs[_i -
|
|
1369
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
|
1370
|
+
configs[_i - 2] = arguments[_i];
|
|
1362
1371
|
}
|
|
1363
|
-
var options =
|
|
1364
|
-
var http =
|
|
1372
|
+
var options = {};
|
|
1373
|
+
var http = {};
|
|
1365
1374
|
configs.forEach(function (config) {
|
|
1366
1375
|
options = tslib.__assign(tslib.__assign(tslib.__assign({}, options), config.options), { headers: tslib.__assign(tslib.__assign({}, options.headers), headersToLowerCase(config.headers)) });
|
|
1367
|
-
if (config.credentials)
|
|
1376
|
+
if (config.credentials) {
|
|
1368
1377
|
options.credentials = config.credentials;
|
|
1378
|
+
}
|
|
1369
1379
|
http = tslib.__assign(tslib.__assign({}, http), config.http);
|
|
1370
1380
|
});
|
|
1371
1381
|
var operationName = operation.operationName, extensions = operation.extensions, variables = operation.variables, query = operation.query;
|
|
@@ -1378,7 +1388,7 @@ var selectHttpOptionsAndBody = function (operation, printer, fallbackConfig) {
|
|
|
1378
1388
|
options: options,
|
|
1379
1389
|
body: body,
|
|
1380
1390
|
};
|
|
1381
|
-
}
|
|
1391
|
+
}
|
|
1382
1392
|
function headersToLowerCase(headers) {
|
|
1383
1393
|
if (headers) {
|
|
1384
1394
|
var normalized_1 = Object.create(null);
|
|
@@ -1421,7 +1431,7 @@ var selectURI = function (operation, fallbackURI) {
|
|
|
1421
1431
|
function rewriteURIForGET(chosenURI, body) {
|
|
1422
1432
|
var queryParams = [];
|
|
1423
1433
|
var addQueryParam = function (key, value) {
|
|
1424
|
-
queryParams.push(key
|
|
1434
|
+
queryParams.push("".concat(key, "=").concat(encodeURIComponent(value)));
|
|
1425
1435
|
};
|
|
1426
1436
|
if ('query' in body) {
|
|
1427
1437
|
addQueryParam('query', body.query);
|
|
@@ -1493,7 +1503,7 @@ var createHttpLink = function (linkOptions) {
|
|
|
1493
1503
|
credentials: context.credentials,
|
|
1494
1504
|
headers: contextHeaders,
|
|
1495
1505
|
};
|
|
1496
|
-
var _b =
|
|
1506
|
+
var _b = selectHttpOptionsAndBodyInternal(operation, print, fallbackHttpConfig, linkConfig, contextConfig), options = _b.options, body = _b.body;
|
|
1497
1507
|
if (body.variables && !includeUnusedVariables) {
|
|
1498
1508
|
var unusedNames_1 = new Set(Object.keys(body.variables));
|
|
1499
1509
|
graphql.visit(operation.query, {
|
|
@@ -1686,7 +1696,7 @@ function defaultDataIdFromObject(_a, context) {
|
|
|
1686
1696
|
if (id === void 0)
|
|
1687
1697
|
id = _id;
|
|
1688
1698
|
if (id !== void 0) {
|
|
1689
|
-
return __typename
|
|
1699
|
+
return "".concat(__typename, ":").concat((typeof id === "number" ||
|
|
1690
1700
|
typeof id === "string") ? id : JSON.stringify(id));
|
|
1691
1701
|
}
|
|
1692
1702
|
}
|
|
@@ -2422,7 +2432,7 @@ var StoreReader = (function () {
|
|
|
2422
2432
|
!context.store.has(objectOrReference.__ref)) {
|
|
2423
2433
|
return {
|
|
2424
2434
|
result: this.canon.empty,
|
|
2425
|
-
missing: "Dangling reference to missing "
|
|
2435
|
+
missing: "Dangling reference to missing ".concat(objectOrReference.__ref, " object"),
|
|
2426
2436
|
};
|
|
2427
2437
|
}
|
|
2428
2438
|
var variables = context.variables, policies = context.policies, store = context.store;
|
|
@@ -2457,7 +2467,7 @@ var StoreReader = (function () {
|
|
|
2457
2467
|
if (fieldValue === void 0) {
|
|
2458
2468
|
if (!addTypenameToDocument.added(selection)) {
|
|
2459
2469
|
missing = context.merge(missing, (_a = {},
|
|
2460
|
-
_a[resultName] = "Can't find field '"
|
|
2470
|
+
_a[resultName] = "Can't find field '".concat(selection.name.value, "' on ").concat(isReference(objectOrReference)
|
|
2461
2471
|
? objectOrReference.__ref + " object"
|
|
2462
2472
|
: "object " + JSON.stringify(objectOrReference, null, 2)),
|
|
2463
2473
|
_a));
|
|
@@ -2567,7 +2577,7 @@ function assertSelectionSetForIdValue(store, field, fieldValue) {
|
|
|
2567
2577
|
var workSet_1 = new Set([fieldValue]);
|
|
2568
2578
|
workSet_1.forEach(function (value) {
|
|
2569
2579
|
if (isNonNullObject(value)) {
|
|
2570
|
-
__DEV__ ? tsInvariant.invariant(!isReference(value), "Missing selection set for object of type "
|
|
2580
|
+
__DEV__ ? tsInvariant.invariant(!isReference(value), "Missing selection set for object of type ".concat(getTypenameFromStoreObject(store, value), " returned for query field ").concat(field.name.value)) : tsInvariant.invariant(!isReference(value), 5);
|
|
2571
2581
|
Object.values(value).forEach(workSet_1.add, workSet_1);
|
|
2572
2582
|
}
|
|
2573
2583
|
});
|
|
@@ -2654,10 +2664,10 @@ function keyFieldsFnFromSpecifier(specifier) {
|
|
|
2654
2664
|
hasOwn.call(object, schemaKeyPath[0])) {
|
|
2655
2665
|
extracted = extractKeyPath(object, schemaKeyPath, extractKey);
|
|
2656
2666
|
}
|
|
2657
|
-
__DEV__ ? tsInvariant.invariant(extracted !== void 0, "Missing field '"
|
|
2667
|
+
__DEV__ ? tsInvariant.invariant(extracted !== void 0, "Missing field '".concat(schemaKeyPath.join('.'), "' while extracting keyFields from ").concat(JSON.stringify(object))) : tsInvariant.invariant(extracted !== void 0, 2);
|
|
2658
2668
|
return extracted;
|
|
2659
2669
|
});
|
|
2660
|
-
return context.typename
|
|
2670
|
+
return "".concat(context.typename, ":").concat(JSON.stringify(keyObject));
|
|
2661
2671
|
});
|
|
2662
2672
|
}
|
|
2663
2673
|
function keyArgsFnFromSpecifier(specifier) {
|
|
@@ -2883,7 +2893,7 @@ var Policies = (function () {
|
|
|
2883
2893
|
var rootId = "ROOT_" + which.toUpperCase();
|
|
2884
2894
|
var old = this.rootTypenamesById[rootId];
|
|
2885
2895
|
if (typename !== old) {
|
|
2886
|
-
__DEV__ ? tsInvariant.invariant(!old || old === which, "Cannot change root "
|
|
2896
|
+
__DEV__ ? tsInvariant.invariant(!old || old === which, "Cannot change root ".concat(which, " __typename more than once")) : tsInvariant.invariant(!old || old === which, 3);
|
|
2887
2897
|
if (old)
|
|
2888
2898
|
delete this.rootIdsByTypename[old];
|
|
2889
2899
|
this.rootIdsByTypename[typename] = rootId;
|
|
@@ -2967,7 +2977,7 @@ var Policies = (function () {
|
|
|
2967
2977
|
if (supertypeSet.has(supertype)) {
|
|
2968
2978
|
if (!typenameSupertypeSet.has(supertype)) {
|
|
2969
2979
|
if (checkingFuzzySubtypes) {
|
|
2970
|
-
__DEV__ && tsInvariant.invariant.warn("Inferring subtype "
|
|
2980
|
+
__DEV__ && tsInvariant.invariant.warn("Inferring subtype ".concat(typename, " of supertype ").concat(supertype));
|
|
2971
2981
|
}
|
|
2972
2982
|
typenameSupertypeSet.add(supertype);
|
|
2973
2983
|
}
|
|
@@ -3121,7 +3131,7 @@ function normalizeReadFieldOptions(readFieldArgs, objectOrReference, variables)
|
|
|
3121
3131
|
}
|
|
3122
3132
|
}
|
|
3123
3133
|
if (__DEV__ && options.from === void 0) {
|
|
3124
|
-
__DEV__ && tsInvariant.invariant.warn("Undefined 'from' passed to readField with arguments "
|
|
3134
|
+
__DEV__ && tsInvariant.invariant.warn("Undefined 'from' passed to readField with arguments ".concat(stringifyForDisplay(Array.from(readFieldArgs))));
|
|
3125
3135
|
}
|
|
3126
3136
|
if (void 0 === options.variables) {
|
|
3127
3137
|
options.variables = variables;
|
|
@@ -3161,7 +3171,7 @@ function makeMergeObjectsFunction(store) {
|
|
|
3161
3171
|
}
|
|
3162
3172
|
|
|
3163
3173
|
function getContextFlavor(context, clientOnly, deferred) {
|
|
3164
|
-
var key = ""
|
|
3174
|
+
var key = "".concat(clientOnly).concat(deferred);
|
|
3165
3175
|
var flavored = context.flavors.get(key);
|
|
3166
3176
|
if (!flavored) {
|
|
3167
3177
|
context.flavors.set(key, flavored = (context.clientOnly === clientOnly &&
|
|
@@ -3203,7 +3213,7 @@ var StoreWriter = (function () {
|
|
|
3203
3213
|
context: context,
|
|
3204
3214
|
});
|
|
3205
3215
|
if (!isReference(ref)) {
|
|
3206
|
-
throw __DEV__ ? new tsInvariant.InvariantError("Could not identify object "
|
|
3216
|
+
throw __DEV__ ? new tsInvariant.InvariantError("Could not identify object ".concat(JSON.stringify(result))) : new tsInvariant.InvariantError(6);
|
|
3207
3217
|
}
|
|
3208
3218
|
context.incomingById.forEach(function (_a, dataId) {
|
|
3209
3219
|
var storeObject = _a.storeObject, mergeTree = _a.mergeTree, fieldNodeSet = _a.fieldNodeSet;
|
|
@@ -3308,7 +3318,7 @@ var StoreWriter = (function () {
|
|
|
3308
3318
|
!context.deferred &&
|
|
3309
3319
|
!addTypenameToDocument.added(field) &&
|
|
3310
3320
|
!policies.getReadFunction(typename, field.name.value)) {
|
|
3311
|
-
__DEV__ && tsInvariant.invariant.error(
|
|
3321
|
+
__DEV__ && tsInvariant.invariant.error("Missing field '".concat(resultKeyNameFromField(field), "' while writing result ").concat(JSON.stringify(result, null, 2)).substring(0, 1000));
|
|
3312
3322
|
}
|
|
3313
3323
|
});
|
|
3314
3324
|
try {
|
|
@@ -3530,7 +3540,7 @@ function warnAboutDataLoss(existingRef, incomingObj, storeFieldName, store) {
|
|
|
3530
3540
|
var parentType = store.getFieldValue(existingRef, "__typename") ||
|
|
3531
3541
|
store.getFieldValue(incomingObj, "__typename");
|
|
3532
3542
|
var fieldName = fieldNameFromStoreName(storeFieldName);
|
|
3533
|
-
var typeDotName = parentType
|
|
3543
|
+
var typeDotName = "".concat(parentType, ".").concat(fieldName);
|
|
3534
3544
|
if (warnings.has(typeDotName))
|
|
3535
3545
|
return;
|
|
3536
3546
|
warnings.add(typeDotName);
|
|
@@ -3545,10 +3555,10 @@ function warnAboutDataLoss(existingRef, incomingObj, storeFieldName, store) {
|
|
|
3545
3555
|
}
|
|
3546
3556
|
});
|
|
3547
3557
|
}
|
|
3548
|
-
__DEV__ && tsInvariant.invariant.warn("Cache data may be lost when replacing the "
|
|
3558
|
+
__DEV__ && tsInvariant.invariant.warn("Cache data may be lost when replacing the ".concat(fieldName, " field of a ").concat(parentType, " object.\n\nTo address this problem (which is not a bug in Apollo Client), ").concat(childTypenames.length
|
|
3549
3559
|
? "either ensure all objects of type " +
|
|
3550
3560
|
childTypenames.join(" and ") + " have an ID or a custom merge function, or "
|
|
3551
|
-
: ""
|
|
3561
|
+
: "", "define a custom merge function for the ").concat(typeDotName, " field, so InMemoryCache can safely merge these objects:\n\n existing: ").concat(JSON.stringify(existing).slice(0, 1000), "\n incoming: ").concat(JSON.stringify(incoming).slice(0, 1000), "\n\nFor more information about these options, please refer to the documentation:\n\n * Ensuring entity objects have IDs: https://go.apollo.dev/c/generating-unique-identifiers\n * Defining custom merge functions: https://go.apollo.dev/c/merging-non-normalized-objects\n"));
|
|
3552
3562
|
}
|
|
3553
3563
|
|
|
3554
3564
|
var InMemoryCache = (function (_super) {
|
|
@@ -3855,11 +3865,11 @@ var generateErrorMessage = function (err) {
|
|
|
3855
3865
|
var errorMessage = error
|
|
3856
3866
|
? error.message
|
|
3857
3867
|
: 'Error message not found.';
|
|
3858
|
-
message += errorMessage
|
|
3868
|
+
message += "".concat(errorMessage, "\n");
|
|
3859
3869
|
});
|
|
3860
3870
|
}
|
|
3861
3871
|
if (err.networkError) {
|
|
3862
|
-
message += err.networkError.message
|
|
3872
|
+
message += "".concat(err.networkError.message, "\n");
|
|
3863
3873
|
}
|
|
3864
3874
|
message = message.replace(/\n$/, '');
|
|
3865
3875
|
return message;
|
|
@@ -4054,7 +4064,7 @@ var ObservableQuery = (function (_super) {
|
|
|
4054
4064
|
var queryDef = getQueryDefinition(this.options.query);
|
|
4055
4065
|
var vars = queryDef.variableDefinitions;
|
|
4056
4066
|
if (!vars || !vars.some(function (v) { return v.variable.name.value === "variables"; })) {
|
|
4057
|
-
__DEV__ && tsInvariant.invariant.warn("Called refetch("
|
|
4067
|
+
__DEV__ && tsInvariant.invariant.warn("Called refetch(".concat(JSON.stringify(variables), ") for query ").concat(((_a = queryDef.name) === null || _a === void 0 ? void 0 : _a.value) || JSON.stringify(queryDef), ", which does not declare a $variables variable.\nDid you mean to call refetch(variables) instead of refetch({ variables })?"));
|
|
4058
4068
|
}
|
|
4059
4069
|
}
|
|
4060
4070
|
if (variables && !equality.equal(this.options.variables, variables)) {
|
|
@@ -4317,7 +4327,7 @@ function defaultSubscriptionObserverErrorCallback(error) {
|
|
|
4317
4327
|
}
|
|
4318
4328
|
function logMissingFieldErrors(missing) {
|
|
4319
4329
|
if (__DEV__ && missing) {
|
|
4320
|
-
__DEV__ && tsInvariant.invariant.debug("Missing cache result fields: "
|
|
4330
|
+
__DEV__ && tsInvariant.invariant.debug("Missing cache result fields: ".concat(JSON.stringify(missing)), missing);
|
|
4321
4331
|
}
|
|
4322
4332
|
}
|
|
4323
4333
|
function applyNextFetchPolicy(options) {
|
|
@@ -4498,7 +4508,7 @@ var LocalState = (function () {
|
|
|
4498
4508
|
}
|
|
4499
4509
|
else {
|
|
4500
4510
|
fragment = fragmentMap[selection.name.value];
|
|
4501
|
-
__DEV__ ? tsInvariant.invariant(fragment, "No fragment named "
|
|
4511
|
+
__DEV__ ? tsInvariant.invariant(fragment, "No fragment named ".concat(selection.name.value)) : tsInvariant.invariant(fragment, 9);
|
|
4502
4512
|
}
|
|
4503
4513
|
if (fragment && fragment.typeCondition) {
|
|
4504
4514
|
typeCondition = fragment.typeCondition.name.value;
|
|
@@ -5289,7 +5299,7 @@ var QueryManager = (function () {
|
|
|
5289
5299
|
if (__DEV__ && queryNamesAndDocs.size) {
|
|
5290
5300
|
queryNamesAndDocs.forEach(function (included, nameOrDoc) {
|
|
5291
5301
|
if (!included) {
|
|
5292
|
-
__DEV__ && tsInvariant.invariant.warn("Unknown query "
|
|
5302
|
+
__DEV__ && tsInvariant.invariant.warn("Unknown query ".concat(typeof nameOrDoc === "string" ? "named " : "").concat(JSON.stringify(nameOrDoc, null, 2), " requested in refetchQueries options.include array"));
|
|
5293
5303
|
}
|
|
5294
5304
|
});
|
|
5295
5305
|
}
|
|
@@ -5880,7 +5890,7 @@ var ApolloClient = (function () {
|
|
|
5880
5890
|
result.queries = queries;
|
|
5881
5891
|
result.results = results;
|
|
5882
5892
|
result.catch(function (error) {
|
|
5883
|
-
__DEV__ && tsInvariant.invariant.debug("In client.refetchQueries, Promise.all promise rejected with error "
|
|
5893
|
+
__DEV__ && tsInvariant.invariant.debug("In client.refetchQueries, Promise.all promise rejected with error ".concat(error));
|
|
5884
5894
|
});
|
|
5885
5895
|
return result;
|
|
5886
5896
|
};
|
|
@@ -5988,7 +5998,7 @@ function parser(document) {
|
|
|
5988
5998
|
if (cached)
|
|
5989
5999
|
return cached;
|
|
5990
6000
|
var variables, type, name;
|
|
5991
|
-
__DEV__ ? tsInvariant.invariant(!!document && !!document.kind, "Argument of "
|
|
6001
|
+
__DEV__ ? tsInvariant.invariant(!!document && !!document.kind, "Argument of ".concat(document, " passed to parser was not a valid GraphQL ") +
|
|
5992
6002
|
"DocumentNode. You may need to use 'graphql-tag' or another method " +
|
|
5993
6003
|
"to convert your operation into a document") : tsInvariant.invariant(!!document && !!document.kind, 30);
|
|
5994
6004
|
var fragments = document.definitions.filter(function (x) { return x.kind === 'FragmentDefinition'; });
|
|
@@ -6006,8 +6016,8 @@ function parser(document) {
|
|
|
6006
6016
|
"You must include a query, subscription or mutation as well") : tsInvariant.invariant(!fragments.length ||
|
|
6007
6017
|
(queries.length || mutations.length || subscriptions.length), 31);
|
|
6008
6018
|
__DEV__ ? tsInvariant.invariant(queries.length + mutations.length + subscriptions.length <= 1, "react-apollo only supports a query, subscription, or a mutation per HOC. " +
|
|
6009
|
-
(document
|
|
6010
|
-
|
|
6019
|
+
"".concat(document, " had ").concat(queries.length, " queries, ").concat(subscriptions.length, " ") +
|
|
6020
|
+
"subscriptions and ".concat(mutations.length, " mutations. ") +
|
|
6011
6021
|
"You can use 'compose' to join multiple operation types to a component") : tsInvariant.invariant(queries.length + mutations.length + subscriptions.length <= 1, 32);
|
|
6012
6022
|
type = queries.length ? exports.DocumentType.Query : exports.DocumentType.Mutation;
|
|
6013
6023
|
if (!queries.length && !mutations.length)
|
|
@@ -6017,8 +6027,8 @@ function parser(document) {
|
|
|
6017
6027
|
: mutations.length
|
|
6018
6028
|
? mutations
|
|
6019
6029
|
: subscriptions;
|
|
6020
|
-
__DEV__ ? tsInvariant.invariant(definitions.length === 1, "react-apollo only supports one definition per HOC. "
|
|
6021
|
-
(definitions.length
|
|
6030
|
+
__DEV__ ? tsInvariant.invariant(definitions.length === 1, "react-apollo only supports one definition per HOC. ".concat(document, " had ") +
|
|
6031
|
+
"".concat(definitions.length, " definitions. ") +
|
|
6022
6032
|
"You can use 'compose' to join multiple operation types to a component") : tsInvariant.invariant(definitions.length === 1, 33);
|
|
6023
6033
|
var definition = definitions[0];
|
|
6024
6034
|
variables = definition.variableDefinitions || [];
|
|
@@ -6036,8 +6046,8 @@ function verifyDocumentType(document, type) {
|
|
|
6036
6046
|
var operation = parser(document);
|
|
6037
6047
|
var requiredOperationName = operationName(type);
|
|
6038
6048
|
var usedOperationName = operationName(operation.type);
|
|
6039
|
-
__DEV__ ? tsInvariant.invariant(operation.type === type, "Running a "
|
|
6040
|
-
(requiredOperationName
|
|
6049
|
+
__DEV__ ? tsInvariant.invariant(operation.type === type, "Running a ".concat(requiredOperationName, " requires a graphql ") +
|
|
6050
|
+
"".concat(requiredOperationName, ", but a ").concat(usedOperationName, " was used instead.")) : tsInvariant.invariant(operation.type === type, 34);
|
|
6041
6051
|
}
|
|
6042
6052
|
|
|
6043
6053
|
function useQuery(query, options) {
|
|
@@ -6560,6 +6570,7 @@ exports.parser = parser;
|
|
|
6560
6570
|
exports.resetApolloContext = getApolloContext;
|
|
6561
6571
|
exports.rewriteURIForGET = rewriteURIForGET;
|
|
6562
6572
|
exports.selectHttpOptionsAndBody = selectHttpOptionsAndBody;
|
|
6573
|
+
exports.selectHttpOptionsAndBodyInternal = selectHttpOptionsAndBodyInternal;
|
|
6563
6574
|
exports.selectURI = selectURI;
|
|
6564
6575
|
exports.serializeFetchParameter = serializeFetchParameter;
|
|
6565
6576
|
exports.split = split;
|