@apollo/client 3.6.0-beta.2 → 3.6.0-beta.3
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 +70 -59
- 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 +6 -6
- 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/package.json +2 -2
- package/react/hoc/hoc.cjs +5 -5
- 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/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/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
|
@@ -46,7 +46,7 @@ function shouldInclude(_a, variables) {
|
|
|
46
46
|
var evaledValue = false;
|
|
47
47
|
if (ifArgument.value.kind === 'Variable') {
|
|
48
48
|
evaledValue = variables && variables[ifArgument.value.name.value];
|
|
49
|
-
__DEV__ ? tsInvariant.invariant(evaledValue !== void 0, "Invalid variable referenced in @"
|
|
49
|
+
__DEV__ ? tsInvariant.invariant(evaledValue !== void 0, "Invalid variable referenced in @".concat(directive.name.value, " directive.")) : tsInvariant.invariant(evaledValue !== void 0, 37);
|
|
50
50
|
}
|
|
51
51
|
else {
|
|
52
52
|
evaledValue = ifArgument.value.value;
|
|
@@ -83,12 +83,12 @@ function getInclusionDirectives(directives) {
|
|
|
83
83
|
return;
|
|
84
84
|
var directiveArguments = directive.arguments;
|
|
85
85
|
var directiveName = directive.name.value;
|
|
86
|
-
__DEV__ ? tsInvariant.invariant(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @"
|
|
86
|
+
__DEV__ ? tsInvariant.invariant(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @".concat(directiveName, " directive.")) : tsInvariant.invariant(directiveArguments && directiveArguments.length === 1, 38);
|
|
87
87
|
var ifArgument = directiveArguments[0];
|
|
88
|
-
__DEV__ ? tsInvariant.invariant(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @"
|
|
88
|
+
__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);
|
|
89
89
|
var ifValue = ifArgument.value;
|
|
90
90
|
__DEV__ ? tsInvariant.invariant(ifValue &&
|
|
91
|
-
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), "Argument for the @"
|
|
91
|
+
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), "Argument for the @".concat(directiveName, " directive must be a variable or a boolean value.")) : tsInvariant.invariant(ifValue &&
|
|
92
92
|
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), 40);
|
|
93
93
|
result.push({ directive: directive, ifArgument: ifArgument });
|
|
94
94
|
});
|
|
@@ -101,7 +101,7 @@ function getFragmentQueryDocument(document, fragmentName) {
|
|
|
101
101
|
var fragments = [];
|
|
102
102
|
document.definitions.forEach(function (definition) {
|
|
103
103
|
if (definition.kind === 'OperationDefinition') {
|
|
104
|
-
throw __DEV__ ? new tsInvariant.InvariantError("Found a "
|
|
104
|
+
throw __DEV__ ? new tsInvariant.InvariantError("Found a ".concat(definition.operation, " operation").concat(definition.name ? " named '".concat(definition.name.value, "'") : '', ". ") +
|
|
105
105
|
'No operations are allowed when using a fragment as a query. Only fragments are allowed.') : new tsInvariant.InvariantError(41);
|
|
106
106
|
}
|
|
107
107
|
if (definition.kind === 'FragmentDefinition') {
|
|
@@ -109,7 +109,7 @@ function getFragmentQueryDocument(document, fragmentName) {
|
|
|
109
109
|
}
|
|
110
110
|
});
|
|
111
111
|
if (typeof actualFragmentName === 'undefined') {
|
|
112
|
-
__DEV__ ? tsInvariant.invariant(fragments.length === 1, "Found "
|
|
112
|
+
__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);
|
|
113
113
|
actualFragmentName = fragments[0].name.value;
|
|
114
114
|
}
|
|
115
115
|
var query = tslib.__assign(tslib.__assign({}, document), { definitions: tslib.__spreadArray([
|
|
@@ -146,7 +146,7 @@ function getFragmentFromSelection(selection, fragmentMap) {
|
|
|
146
146
|
return selection;
|
|
147
147
|
case 'FragmentSpread': {
|
|
148
148
|
var fragment = fragmentMap && fragmentMap[selection.name.value];
|
|
149
|
-
__DEV__ ? tsInvariant.invariant(fragment, "No fragment named "
|
|
149
|
+
__DEV__ ? tsInvariant.invariant(fragment, "No fragment named ".concat(selection.name.value, ".")) : tsInvariant.invariant(fragment, 43);
|
|
150
150
|
return fragment;
|
|
151
151
|
}
|
|
152
152
|
default:
|
|
@@ -228,7 +228,7 @@ function valueToObjectRepresentation(argObj, name, value, variables) {
|
|
|
228
228
|
argObj[name.value] = null;
|
|
229
229
|
}
|
|
230
230
|
else {
|
|
231
|
-
throw __DEV__ ? new tsInvariant.InvariantError("The inline argument \""
|
|
231
|
+
throw __DEV__ ? new tsInvariant.InvariantError("The inline argument \"".concat(name.value, "\" of kind \"").concat(value.kind, "\"") +
|
|
232
232
|
'is not supported. Use variables instead of inline arguments to ' +
|
|
233
233
|
'overcome this limitation.') : new tsInvariant.InvariantError(52);
|
|
234
234
|
}
|
|
@@ -280,7 +280,7 @@ var getStoreKeyName = Object.assign(function (fieldName, args, directives) {
|
|
|
280
280
|
filterKeys.forEach(function (key) {
|
|
281
281
|
filteredArgs_1[key] = args[key];
|
|
282
282
|
});
|
|
283
|
-
return directives['connection']['key']
|
|
283
|
+
return "".concat(directives['connection']['key'], "(").concat(stringify(filteredArgs_1), ")");
|
|
284
284
|
}
|
|
285
285
|
else {
|
|
286
286
|
return directives['connection']['key'];
|
|
@@ -289,17 +289,17 @@ var getStoreKeyName = Object.assign(function (fieldName, args, directives) {
|
|
|
289
289
|
var completeFieldName = fieldName;
|
|
290
290
|
if (args) {
|
|
291
291
|
var stringifiedArgs = stringify(args);
|
|
292
|
-
completeFieldName += "("
|
|
292
|
+
completeFieldName += "(".concat(stringifiedArgs, ")");
|
|
293
293
|
}
|
|
294
294
|
if (directives) {
|
|
295
295
|
Object.keys(directives).forEach(function (key) {
|
|
296
296
|
if (KNOWN_DIRECTIVES.indexOf(key) !== -1)
|
|
297
297
|
return;
|
|
298
298
|
if (directives[key] && Object.keys(directives[key]).length) {
|
|
299
|
-
completeFieldName += "@"
|
|
299
|
+
completeFieldName += "@".concat(key, "(").concat(stringify(directives[key]), ")");
|
|
300
300
|
}
|
|
301
301
|
else {
|
|
302
|
-
completeFieldName += "@"
|
|
302
|
+
completeFieldName += "@".concat(key);
|
|
303
303
|
}
|
|
304
304
|
});
|
|
305
305
|
}
|
|
@@ -369,11 +369,11 @@ function checkDocument(doc) {
|
|
|
369
369
|
.filter(function (d) { return d.kind !== 'FragmentDefinition'; })
|
|
370
370
|
.map(function (definition) {
|
|
371
371
|
if (definition.kind !== 'OperationDefinition') {
|
|
372
|
-
throw __DEV__ ? new tsInvariant.InvariantError("Schema type definitions not allowed in queries. Found: \""
|
|
372
|
+
throw __DEV__ ? new tsInvariant.InvariantError("Schema type definitions not allowed in queries. Found: \"".concat(definition.kind, "\"")) : new tsInvariant.InvariantError(45);
|
|
373
373
|
}
|
|
374
374
|
return definition;
|
|
375
375
|
});
|
|
376
|
-
__DEV__ ? tsInvariant.invariant(operations.length <= 1, "Ambiguous GraphQL document: contains "
|
|
376
|
+
__DEV__ ? tsInvariant.invariant(operations.length <= 1, "Ambiguous GraphQL document: contains ".concat(operations.length, " operations")) : tsInvariant.invariant(operations.length <= 1, 46);
|
|
377
377
|
return doc;
|
|
378
378
|
}
|
|
379
379
|
function getOperationDefinition(doc) {
|
|
@@ -1078,7 +1078,7 @@ var prefixCounts = new Map();
|
|
|
1078
1078
|
function makeUniqueId(prefix) {
|
|
1079
1079
|
var count = prefixCounts.get(prefix) || 1;
|
|
1080
1080
|
prefixCounts.set(prefix, count + 1);
|
|
1081
|
-
return prefix
|
|
1081
|
+
return "".concat(prefix, ":").concat(count, ":").concat(Math.random().toString(36).slice(2));
|
|
1082
1082
|
}
|
|
1083
1083
|
|
|
1084
1084
|
function stringifyForDisplay(value) {
|
|
@@ -1143,7 +1143,7 @@ function validateOperation(operation) {
|
|
|
1143
1143
|
for (var _i = 0, _a = Object.keys(operation); _i < _a.length; _i++) {
|
|
1144
1144
|
var key = _a[_i];
|
|
1145
1145
|
if (OPERATION_FIELDS.indexOf(key) < 0) {
|
|
1146
|
-
throw __DEV__ ? new tsInvariant.InvariantError("illegal argument: "
|
|
1146
|
+
throw __DEV__ ? new tsInvariant.InvariantError("illegal argument: ".concat(key)) : new tsInvariant.InvariantError(24);
|
|
1147
1147
|
}
|
|
1148
1148
|
}
|
|
1149
1149
|
return operation;
|
|
@@ -1292,7 +1292,7 @@ var concat = ApolloLink.concat;
|
|
|
1292
1292
|
|
|
1293
1293
|
var execute = ApolloLink.execute;
|
|
1294
1294
|
|
|
1295
|
-
var version = '3.6.0-beta.
|
|
1295
|
+
var version = '3.6.0-beta.3';
|
|
1296
1296
|
|
|
1297
1297
|
var hasOwnProperty$2 = Object.prototype.hasOwnProperty;
|
|
1298
1298
|
function parseAndCheckHttpResponse(operations) {
|
|
@@ -1313,14 +1313,14 @@ function parseAndCheckHttpResponse(operations) {
|
|
|
1313
1313
|
})
|
|
1314
1314
|
.then(function (result) {
|
|
1315
1315
|
if (response.status >= 300) {
|
|
1316
|
-
throwServerError(response, result, "Response not successful: Received status code "
|
|
1316
|
+
throwServerError(response, result, "Response not successful: Received status code ".concat(response.status));
|
|
1317
1317
|
}
|
|
1318
1318
|
if (!Array.isArray(result) &&
|
|
1319
1319
|
!hasOwnProperty$2.call(result, 'data') &&
|
|
1320
1320
|
!hasOwnProperty$2.call(result, 'errors')) {
|
|
1321
|
-
throwServerError(response, result, "Server response was missing for query '"
|
|
1321
|
+
throwServerError(response, result, "Server response was missing for query '".concat(Array.isArray(operations)
|
|
1322
1322
|
? operations.map(function (op) { return op.operationName; })
|
|
1323
|
-
: operations.operationName
|
|
1323
|
+
: operations.operationName, "'."));
|
|
1324
1324
|
}
|
|
1325
1325
|
return result;
|
|
1326
1326
|
}); };
|
|
@@ -1332,7 +1332,7 @@ var serializeFetchParameter = function (p, label) {
|
|
|
1332
1332
|
serialized = JSON.stringify(p);
|
|
1333
1333
|
}
|
|
1334
1334
|
catch (e) {
|
|
1335
|
-
var parseError = __DEV__ ? new tsInvariant.InvariantError("Network request failed. "
|
|
1335
|
+
var parseError = __DEV__ ? new tsInvariant.InvariantError("Network request failed. ".concat(label, " is not serializable: ").concat(e.message)) : new tsInvariant.InvariantError(21);
|
|
1336
1336
|
parseError.parseError = e;
|
|
1337
1337
|
throw parseError;
|
|
1338
1338
|
}
|
|
@@ -1356,17 +1356,27 @@ var fallbackHttpConfig = {
|
|
|
1356
1356
|
options: defaultOptions,
|
|
1357
1357
|
};
|
|
1358
1358
|
var defaultPrinter = function (ast, printer) { return printer(ast); };
|
|
1359
|
-
|
|
1359
|
+
function selectHttpOptionsAndBody(operation, fallbackConfig) {
|
|
1360
1360
|
var configs = [];
|
|
1361
|
-
for (var _i =
|
|
1362
|
-
configs[_i -
|
|
1361
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
|
1362
|
+
configs[_i - 2] = arguments[_i];
|
|
1363
1363
|
}
|
|
1364
|
-
|
|
1365
|
-
|
|
1364
|
+
configs.unshift(fallbackConfig);
|
|
1365
|
+
return selectHttpOptionsAndBodyInternal.apply(void 0, tslib.__spreadArray([operation,
|
|
1366
|
+
defaultPrinter], configs, false));
|
|
1367
|
+
}
|
|
1368
|
+
function selectHttpOptionsAndBodyInternal(operation, printer) {
|
|
1369
|
+
var configs = [];
|
|
1370
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
|
1371
|
+
configs[_i - 2] = arguments[_i];
|
|
1372
|
+
}
|
|
1373
|
+
var options = {};
|
|
1374
|
+
var http = {};
|
|
1366
1375
|
configs.forEach(function (config) {
|
|
1367
1376
|
options = tslib.__assign(tslib.__assign(tslib.__assign({}, options), config.options), { headers: tslib.__assign(tslib.__assign({}, options.headers), headersToLowerCase(config.headers)) });
|
|
1368
|
-
if (config.credentials)
|
|
1377
|
+
if (config.credentials) {
|
|
1369
1378
|
options.credentials = config.credentials;
|
|
1379
|
+
}
|
|
1370
1380
|
http = tslib.__assign(tslib.__assign({}, http), config.http);
|
|
1371
1381
|
});
|
|
1372
1382
|
var operationName = operation.operationName, extensions = operation.extensions, variables = operation.variables, query = operation.query;
|
|
@@ -1379,7 +1389,7 @@ var selectHttpOptionsAndBody = function (operation, printer, fallbackConfig) {
|
|
|
1379
1389
|
options: options,
|
|
1380
1390
|
body: body,
|
|
1381
1391
|
};
|
|
1382
|
-
}
|
|
1392
|
+
}
|
|
1383
1393
|
function headersToLowerCase(headers) {
|
|
1384
1394
|
if (headers) {
|
|
1385
1395
|
var normalized_1 = Object.create(null);
|
|
@@ -1422,7 +1432,7 @@ var selectURI = function (operation, fallbackURI) {
|
|
|
1422
1432
|
function rewriteURIForGET(chosenURI, body) {
|
|
1423
1433
|
var queryParams = [];
|
|
1424
1434
|
var addQueryParam = function (key, value) {
|
|
1425
|
-
queryParams.push(key
|
|
1435
|
+
queryParams.push("".concat(key, "=").concat(encodeURIComponent(value)));
|
|
1426
1436
|
};
|
|
1427
1437
|
if ('query' in body) {
|
|
1428
1438
|
addQueryParam('query', body.query);
|
|
@@ -1494,7 +1504,7 @@ var createHttpLink = function (linkOptions) {
|
|
|
1494
1504
|
credentials: context.credentials,
|
|
1495
1505
|
headers: contextHeaders,
|
|
1496
1506
|
};
|
|
1497
|
-
var _b =
|
|
1507
|
+
var _b = selectHttpOptionsAndBodyInternal(operation, print, fallbackHttpConfig, linkConfig, contextConfig), options = _b.options, body = _b.body;
|
|
1498
1508
|
if (body.variables && !includeUnusedVariables) {
|
|
1499
1509
|
var unusedNames_1 = new Set(Object.keys(body.variables));
|
|
1500
1510
|
graphql.visit(operation.query, {
|
|
@@ -1687,7 +1697,7 @@ function defaultDataIdFromObject(_a, context) {
|
|
|
1687
1697
|
if (id === void 0)
|
|
1688
1698
|
id = _id;
|
|
1689
1699
|
if (id !== void 0) {
|
|
1690
|
-
return __typename
|
|
1700
|
+
return "".concat(__typename, ":").concat((typeof id === "number" ||
|
|
1691
1701
|
typeof id === "string") ? id : JSON.stringify(id));
|
|
1692
1702
|
}
|
|
1693
1703
|
}
|
|
@@ -2423,7 +2433,7 @@ var StoreReader = (function () {
|
|
|
2423
2433
|
!context.store.has(objectOrReference.__ref)) {
|
|
2424
2434
|
return {
|
|
2425
2435
|
result: this.canon.empty,
|
|
2426
|
-
missing: "Dangling reference to missing "
|
|
2436
|
+
missing: "Dangling reference to missing ".concat(objectOrReference.__ref, " object"),
|
|
2427
2437
|
};
|
|
2428
2438
|
}
|
|
2429
2439
|
var variables = context.variables, policies = context.policies, store = context.store;
|
|
@@ -2458,7 +2468,7 @@ var StoreReader = (function () {
|
|
|
2458
2468
|
if (fieldValue === void 0) {
|
|
2459
2469
|
if (!addTypenameToDocument.added(selection)) {
|
|
2460
2470
|
missing = context.merge(missing, (_a = {},
|
|
2461
|
-
_a[resultName] = "Can't find field '"
|
|
2471
|
+
_a[resultName] = "Can't find field '".concat(selection.name.value, "' on ").concat(isReference(objectOrReference)
|
|
2462
2472
|
? objectOrReference.__ref + " object"
|
|
2463
2473
|
: "object " + JSON.stringify(objectOrReference, null, 2)),
|
|
2464
2474
|
_a));
|
|
@@ -2568,7 +2578,7 @@ function assertSelectionSetForIdValue(store, field, fieldValue) {
|
|
|
2568
2578
|
var workSet_1 = new Set([fieldValue]);
|
|
2569
2579
|
workSet_1.forEach(function (value) {
|
|
2570
2580
|
if (isNonNullObject(value)) {
|
|
2571
|
-
__DEV__ ? tsInvariant.invariant(!isReference(value), "Missing selection set for object of type "
|
|
2581
|
+
__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);
|
|
2572
2582
|
Object.values(value).forEach(workSet_1.add, workSet_1);
|
|
2573
2583
|
}
|
|
2574
2584
|
});
|
|
@@ -2655,10 +2665,10 @@ function keyFieldsFnFromSpecifier(specifier) {
|
|
|
2655
2665
|
hasOwn.call(object, schemaKeyPath[0])) {
|
|
2656
2666
|
extracted = extractKeyPath(object, schemaKeyPath, extractKey);
|
|
2657
2667
|
}
|
|
2658
|
-
__DEV__ ? tsInvariant.invariant(extracted !== void 0, "Missing field '"
|
|
2668
|
+
__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);
|
|
2659
2669
|
return extracted;
|
|
2660
2670
|
});
|
|
2661
|
-
return context.typename
|
|
2671
|
+
return "".concat(context.typename, ":").concat(JSON.stringify(keyObject));
|
|
2662
2672
|
});
|
|
2663
2673
|
}
|
|
2664
2674
|
function keyArgsFnFromSpecifier(specifier) {
|
|
@@ -2884,7 +2894,7 @@ var Policies = (function () {
|
|
|
2884
2894
|
var rootId = "ROOT_" + which.toUpperCase();
|
|
2885
2895
|
var old = this.rootTypenamesById[rootId];
|
|
2886
2896
|
if (typename !== old) {
|
|
2887
|
-
__DEV__ ? tsInvariant.invariant(!old || old === which, "Cannot change root "
|
|
2897
|
+
__DEV__ ? tsInvariant.invariant(!old || old === which, "Cannot change root ".concat(which, " __typename more than once")) : tsInvariant.invariant(!old || old === which, 3);
|
|
2888
2898
|
if (old)
|
|
2889
2899
|
delete this.rootIdsByTypename[old];
|
|
2890
2900
|
this.rootIdsByTypename[typename] = rootId;
|
|
@@ -2968,7 +2978,7 @@ var Policies = (function () {
|
|
|
2968
2978
|
if (supertypeSet.has(supertype)) {
|
|
2969
2979
|
if (!typenameSupertypeSet.has(supertype)) {
|
|
2970
2980
|
if (checkingFuzzySubtypes) {
|
|
2971
|
-
__DEV__ && tsInvariant.invariant.warn("Inferring subtype "
|
|
2981
|
+
__DEV__ && tsInvariant.invariant.warn("Inferring subtype ".concat(typename, " of supertype ").concat(supertype));
|
|
2972
2982
|
}
|
|
2973
2983
|
typenameSupertypeSet.add(supertype);
|
|
2974
2984
|
}
|
|
@@ -3122,7 +3132,7 @@ function normalizeReadFieldOptions(readFieldArgs, objectOrReference, variables)
|
|
|
3122
3132
|
}
|
|
3123
3133
|
}
|
|
3124
3134
|
if (__DEV__ && options.from === void 0) {
|
|
3125
|
-
__DEV__ && tsInvariant.invariant.warn("Undefined 'from' passed to readField with arguments "
|
|
3135
|
+
__DEV__ && tsInvariant.invariant.warn("Undefined 'from' passed to readField with arguments ".concat(stringifyForDisplay(Array.from(readFieldArgs))));
|
|
3126
3136
|
}
|
|
3127
3137
|
if (void 0 === options.variables) {
|
|
3128
3138
|
options.variables = variables;
|
|
@@ -3162,7 +3172,7 @@ function makeMergeObjectsFunction(store) {
|
|
|
3162
3172
|
}
|
|
3163
3173
|
|
|
3164
3174
|
function getContextFlavor(context, clientOnly, deferred) {
|
|
3165
|
-
var key = ""
|
|
3175
|
+
var key = "".concat(clientOnly).concat(deferred);
|
|
3166
3176
|
var flavored = context.flavors.get(key);
|
|
3167
3177
|
if (!flavored) {
|
|
3168
3178
|
context.flavors.set(key, flavored = (context.clientOnly === clientOnly &&
|
|
@@ -3204,7 +3214,7 @@ var StoreWriter = (function () {
|
|
|
3204
3214
|
context: context,
|
|
3205
3215
|
});
|
|
3206
3216
|
if (!isReference(ref)) {
|
|
3207
|
-
throw __DEV__ ? new tsInvariant.InvariantError("Could not identify object "
|
|
3217
|
+
throw __DEV__ ? new tsInvariant.InvariantError("Could not identify object ".concat(JSON.stringify(result))) : new tsInvariant.InvariantError(6);
|
|
3208
3218
|
}
|
|
3209
3219
|
context.incomingById.forEach(function (_a, dataId) {
|
|
3210
3220
|
var storeObject = _a.storeObject, mergeTree = _a.mergeTree, fieldNodeSet = _a.fieldNodeSet;
|
|
@@ -3309,7 +3319,7 @@ var StoreWriter = (function () {
|
|
|
3309
3319
|
!context.deferred &&
|
|
3310
3320
|
!addTypenameToDocument.added(field) &&
|
|
3311
3321
|
!policies.getReadFunction(typename, field.name.value)) {
|
|
3312
|
-
__DEV__ && tsInvariant.invariant.error(
|
|
3322
|
+
__DEV__ && tsInvariant.invariant.error("Missing field '".concat(resultKeyNameFromField(field), "' while writing result ").concat(JSON.stringify(result, null, 2)).substring(0, 1000));
|
|
3313
3323
|
}
|
|
3314
3324
|
});
|
|
3315
3325
|
try {
|
|
@@ -3531,7 +3541,7 @@ function warnAboutDataLoss(existingRef, incomingObj, storeFieldName, store) {
|
|
|
3531
3541
|
var parentType = store.getFieldValue(existingRef, "__typename") ||
|
|
3532
3542
|
store.getFieldValue(incomingObj, "__typename");
|
|
3533
3543
|
var fieldName = fieldNameFromStoreName(storeFieldName);
|
|
3534
|
-
var typeDotName = parentType
|
|
3544
|
+
var typeDotName = "".concat(parentType, ".").concat(fieldName);
|
|
3535
3545
|
if (warnings.has(typeDotName))
|
|
3536
3546
|
return;
|
|
3537
3547
|
warnings.add(typeDotName);
|
|
@@ -3546,10 +3556,10 @@ function warnAboutDataLoss(existingRef, incomingObj, storeFieldName, store) {
|
|
|
3546
3556
|
}
|
|
3547
3557
|
});
|
|
3548
3558
|
}
|
|
3549
|
-
__DEV__ && tsInvariant.invariant.warn("Cache data may be lost when replacing the "
|
|
3559
|
+
__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
|
|
3550
3560
|
? "either ensure all objects of type " +
|
|
3551
3561
|
childTypenames.join(" and ") + " have an ID or a custom merge function, or "
|
|
3552
|
-
: ""
|
|
3562
|
+
: "", "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"));
|
|
3553
3563
|
}
|
|
3554
3564
|
|
|
3555
3565
|
var InMemoryCache = (function (_super) {
|
|
@@ -3856,11 +3866,11 @@ var generateErrorMessage = function (err) {
|
|
|
3856
3866
|
var errorMessage = error
|
|
3857
3867
|
? error.message
|
|
3858
3868
|
: 'Error message not found.';
|
|
3859
|
-
message += errorMessage
|
|
3869
|
+
message += "".concat(errorMessage, "\n");
|
|
3860
3870
|
});
|
|
3861
3871
|
}
|
|
3862
3872
|
if (err.networkError) {
|
|
3863
|
-
message += err.networkError.message
|
|
3873
|
+
message += "".concat(err.networkError.message, "\n");
|
|
3864
3874
|
}
|
|
3865
3875
|
message = message.replace(/\n$/, '');
|
|
3866
3876
|
return message;
|
|
@@ -4055,7 +4065,7 @@ var ObservableQuery = (function (_super) {
|
|
|
4055
4065
|
var queryDef = getQueryDefinition(this.options.query);
|
|
4056
4066
|
var vars = queryDef.variableDefinitions;
|
|
4057
4067
|
if (!vars || !vars.some(function (v) { return v.variable.name.value === "variables"; })) {
|
|
4058
|
-
__DEV__ && tsInvariant.invariant.warn("Called refetch("
|
|
4068
|
+
__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 })?"));
|
|
4059
4069
|
}
|
|
4060
4070
|
}
|
|
4061
4071
|
if (variables && !equality.equal(this.options.variables, variables)) {
|
|
@@ -4318,7 +4328,7 @@ function defaultSubscriptionObserverErrorCallback(error) {
|
|
|
4318
4328
|
}
|
|
4319
4329
|
function logMissingFieldErrors(missing) {
|
|
4320
4330
|
if (__DEV__ && missing) {
|
|
4321
|
-
__DEV__ && tsInvariant.invariant.debug("Missing cache result fields: "
|
|
4331
|
+
__DEV__ && tsInvariant.invariant.debug("Missing cache result fields: ".concat(JSON.stringify(missing)), missing);
|
|
4322
4332
|
}
|
|
4323
4333
|
}
|
|
4324
4334
|
function applyNextFetchPolicy(options) {
|
|
@@ -4499,7 +4509,7 @@ var LocalState = (function () {
|
|
|
4499
4509
|
}
|
|
4500
4510
|
else {
|
|
4501
4511
|
fragment = fragmentMap[selection.name.value];
|
|
4502
|
-
__DEV__ ? tsInvariant.invariant(fragment, "No fragment named "
|
|
4512
|
+
__DEV__ ? tsInvariant.invariant(fragment, "No fragment named ".concat(selection.name.value)) : tsInvariant.invariant(fragment, 9);
|
|
4503
4513
|
}
|
|
4504
4514
|
if (fragment && fragment.typeCondition) {
|
|
4505
4515
|
typeCondition = fragment.typeCondition.name.value;
|
|
@@ -5290,7 +5300,7 @@ var QueryManager = (function () {
|
|
|
5290
5300
|
if (__DEV__ && queryNamesAndDocs.size) {
|
|
5291
5301
|
queryNamesAndDocs.forEach(function (included, nameOrDoc) {
|
|
5292
5302
|
if (!included) {
|
|
5293
|
-
__DEV__ && tsInvariant.invariant.warn("Unknown query "
|
|
5303
|
+
__DEV__ && tsInvariant.invariant.warn("Unknown query ".concat(typeof nameOrDoc === "string" ? "named " : "").concat(JSON.stringify(nameOrDoc, null, 2), " requested in refetchQueries options.include array"));
|
|
5294
5304
|
}
|
|
5295
5305
|
});
|
|
5296
5306
|
}
|
|
@@ -5881,7 +5891,7 @@ var ApolloClient = (function () {
|
|
|
5881
5891
|
result.queries = queries;
|
|
5882
5892
|
result.results = results;
|
|
5883
5893
|
result.catch(function (error) {
|
|
5884
|
-
__DEV__ && tsInvariant.invariant.debug("In client.refetchQueries, Promise.all promise rejected with error "
|
|
5894
|
+
__DEV__ && tsInvariant.invariant.debug("In client.refetchQueries, Promise.all promise rejected with error ".concat(error));
|
|
5885
5895
|
});
|
|
5886
5896
|
return result;
|
|
5887
5897
|
};
|
|
@@ -5989,7 +5999,7 @@ function parser(document) {
|
|
|
5989
5999
|
if (cached)
|
|
5990
6000
|
return cached;
|
|
5991
6001
|
var variables, type, name;
|
|
5992
|
-
__DEV__ ? tsInvariant.invariant(!!document && !!document.kind, "Argument of "
|
|
6002
|
+
__DEV__ ? tsInvariant.invariant(!!document && !!document.kind, "Argument of ".concat(document, " passed to parser was not a valid GraphQL ") +
|
|
5993
6003
|
"DocumentNode. You may need to use 'graphql-tag' or another method " +
|
|
5994
6004
|
"to convert your operation into a document") : tsInvariant.invariant(!!document && !!document.kind, 30);
|
|
5995
6005
|
var fragments = document.definitions.filter(function (x) { return x.kind === 'FragmentDefinition'; });
|
|
@@ -6007,8 +6017,8 @@ function parser(document) {
|
|
|
6007
6017
|
"You must include a query, subscription or mutation as well") : tsInvariant.invariant(!fragments.length ||
|
|
6008
6018
|
(queries.length || mutations.length || subscriptions.length), 31);
|
|
6009
6019
|
__DEV__ ? tsInvariant.invariant(queries.length + mutations.length + subscriptions.length <= 1, "react-apollo only supports a query, subscription, or a mutation per HOC. " +
|
|
6010
|
-
(document
|
|
6011
|
-
|
|
6020
|
+
"".concat(document, " had ").concat(queries.length, " queries, ").concat(subscriptions.length, " ") +
|
|
6021
|
+
"subscriptions and ".concat(mutations.length, " mutations. ") +
|
|
6012
6022
|
"You can use 'compose' to join multiple operation types to a component") : tsInvariant.invariant(queries.length + mutations.length + subscriptions.length <= 1, 32);
|
|
6013
6023
|
type = queries.length ? exports.DocumentType.Query : exports.DocumentType.Mutation;
|
|
6014
6024
|
if (!queries.length && !mutations.length)
|
|
@@ -6018,8 +6028,8 @@ function parser(document) {
|
|
|
6018
6028
|
: mutations.length
|
|
6019
6029
|
? mutations
|
|
6020
6030
|
: subscriptions;
|
|
6021
|
-
__DEV__ ? tsInvariant.invariant(definitions.length === 1, "react-apollo only supports one definition per HOC. "
|
|
6022
|
-
(definitions.length
|
|
6031
|
+
__DEV__ ? tsInvariant.invariant(definitions.length === 1, "react-apollo only supports one definition per HOC. ".concat(document, " had ") +
|
|
6032
|
+
"".concat(definitions.length, " definitions. ") +
|
|
6023
6033
|
"You can use 'compose' to join multiple operation types to a component") : tsInvariant.invariant(definitions.length === 1, 33);
|
|
6024
6034
|
var definition = definitions[0];
|
|
6025
6035
|
variables = definition.variableDefinitions || [];
|
|
@@ -6037,8 +6047,8 @@ function verifyDocumentType(document, type) {
|
|
|
6037
6047
|
var operation = parser(document);
|
|
6038
6048
|
var requiredOperationName = operationName(type);
|
|
6039
6049
|
var usedOperationName = operationName(operation.type);
|
|
6040
|
-
__DEV__ ? tsInvariant.invariant(operation.type === type, "Running a "
|
|
6041
|
-
(requiredOperationName
|
|
6050
|
+
__DEV__ ? tsInvariant.invariant(operation.type === type, "Running a ".concat(requiredOperationName, " requires a graphql ") +
|
|
6051
|
+
"".concat(requiredOperationName, ", but a ").concat(usedOperationName, " was used instead.")) : tsInvariant.invariant(operation.type === type, 34);
|
|
6042
6052
|
}
|
|
6043
6053
|
|
|
6044
6054
|
function useQuery(query, options) {
|
|
@@ -6519,6 +6529,7 @@ exports.parser = parser;
|
|
|
6519
6529
|
exports.resetApolloContext = getApolloContext;
|
|
6520
6530
|
exports.rewriteURIForGET = rewriteURIForGET;
|
|
6521
6531
|
exports.selectHttpOptionsAndBody = selectHttpOptionsAndBody;
|
|
6532
|
+
exports.selectHttpOptionsAndBodyInternal = selectHttpOptionsAndBodyInternal;
|
|
6522
6533
|
exports.selectURI = selectURI;
|
|
6523
6534
|
exports.serializeFetchParameter = serializeFetchParameter;
|
|
6524
6535
|
exports.split = split;
|