@apollo/client 3.8.0-alpha.11 → 3.8.0-alpha.12
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 +452 -281
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/core/ApolloClient.d.ts.map +1 -1
- package/core/ApolloClient.js.map +1 -1
- package/core/ObservableQuery.d.ts +2 -1
- package/core/ObservableQuery.d.ts.map +1 -1
- package/core/ObservableQuery.js +30 -19
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryManager.d.ts +2 -0
- package/core/QueryManager.d.ts.map +1 -1
- package/core/QueryManager.js +60 -48
- package/core/QueryManager.js.map +1 -1
- package/core/core.cjs +175 -82
- package/core/core.cjs.map +1 -1
- package/core/core.cjs.native.js +175 -82
- package/core/equalByQuery.d.ts +4 -0
- package/core/equalByQuery.d.ts.map +1 -0
- package/{react/hooks/compareResults.js → core/equalByQuery.js} +14 -10
- package/core/equalByQuery.js.map +1 -0
- package/core/index.d.ts +1 -1
- package/core/index.d.ts.map +1 -1
- package/core/index.js +1 -1
- package/core/index.js.map +1 -1
- package/errors/errors.cjs +17 -17
- package/errors/errors.cjs.map +1 -1
- package/errors/errors.cjs.native.js +17 -17
- package/errors/index.d.ts +24 -8
- package/errors/index.d.ts.map +1 -1
- package/errors/index.js +17 -19
- package/errors/index.js.map +1 -1
- package/invariantErrorCodes.js +1 -1
- package/link/batch-http/batch-http.cjs +23 -2
- package/link/batch-http/batch-http.cjs.map +1 -1
- package/link/batch-http/batch-http.cjs.native.js +23 -2
- package/link/batch-http/batchHttpLink.d.ts.map +1 -1
- package/link/batch-http/batchHttpLink.js +7 -2
- package/link/batch-http/batchHttpLink.js.map +1 -1
- package/link/core/types.d.ts +4 -0
- package/link/core/types.d.ts.map +1 -1
- package/link/core/types.js.map +1 -1
- package/link/http/createHttpLink.d.ts.map +1 -1
- package/link/http/createHttpLink.js +21 -20
- package/link/http/createHttpLink.js.map +1 -1
- package/link/http/http.cjs +59 -30
- package/link/http/http.cjs.map +1 -1
- package/link/http/http.cjs.native.js +59 -30
- package/link/http/parseAndCheckHttpResponse.d.ts.map +1 -1
- package/link/http/parseAndCheckHttpResponse.js +34 -14
- package/link/http/parseAndCheckHttpResponse.js.map +1 -1
- package/link/http/selectHttpOptionsAndBody.d.ts.map +1 -1
- package/link/http/selectHttpOptionsAndBody.js +2 -1
- package/link/http/selectHttpOptionsAndBody.js.map +1 -1
- package/link/subscriptions/index.d.ts.map +1 -1
- package/link/subscriptions/index.js +10 -5
- package/link/subscriptions/index.js.map +1 -1
- package/link/subscriptions/subscriptions.cjs +9 -4
- package/link/subscriptions/subscriptions.cjs.map +1 -1
- package/link/subscriptions/subscriptions.cjs.native.js +9 -4
- package/link/utils/filterOperationVariables.d.ts +5 -0
- package/link/utils/filterOperationVariables.d.ts.map +1 -0
- package/link/utils/filterOperationVariables.js +18 -0
- package/link/utils/filterOperationVariables.js.map +1 -0
- package/link/utils/index.d.ts +1 -0
- package/link/utils/index.d.ts.map +1 -1
- package/link/utils/index.js +1 -0
- package/link/utils/index.js.map +1 -1
- package/link/utils/utils.cjs +18 -0
- package/link/utils/utils.cjs.map +1 -1
- package/link/utils/utils.cjs.native.js +18 -0
- package/package.json +17 -17
- package/react/cache/QuerySubscription.js +1 -1
- package/react/cache/QuerySubscription.js.map +1 -1
- package/react/cache/SuspenseCache.d.ts +3 -2
- package/react/cache/SuspenseCache.d.ts.map +1 -1
- package/react/cache/SuspenseCache.js +6 -7
- package/react/cache/SuspenseCache.js.map +1 -1
- package/react/hooks/hooks.cjs +61 -84
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/hooks.cjs.native.js +61 -84
- package/react/hooks/internal/__use.d.ts +3 -1
- package/react/hooks/internal/__use.d.ts.map +1 -1
- package/react/hooks/internal/__use.js +16 -12
- package/react/hooks/internal/__use.js.map +1 -1
- package/react/hooks/useLazyQuery.d.ts.map +1 -1
- package/react/hooks/useLazyQuery.js +13 -22
- package/react/hooks/useLazyQuery.js.map +1 -1
- package/react/hooks/useQuery.d.ts +3 -3
- package/react/hooks/useQuery.d.ts.map +1 -1
- package/react/hooks/useQuery.js +26 -25
- package/react/hooks/useQuery.js.map +1 -1
- package/react/hooks/useSuspenseQuery.d.ts.map +1 -1
- package/react/hooks/useSuspenseQuery.js +6 -2
- package/react/hooks/useSuspenseQuery.js.map +1 -1
- package/react/index.d.ts +1 -1
- package/react/index.d.ts.map +1 -1
- package/react/index.js +1 -1
- package/react/index.js.map +1 -1
- package/react/react.cjs +7 -22
- package/react/react.cjs.map +1 -1
- package/react/react.cjs.native.js +7 -22
- package/react/types/types.d.ts +1 -0
- package/react/types/types.d.ts.map +1 -1
- package/react/types/types.js.map +1 -1
- package/testing/core/mocking/mockSubscriptionLink.d.ts +1 -1
- package/testing/react/MockedProvider.d.ts +1 -1
- package/testing/react/MockedProvider.d.ts.map +1 -1
- package/testing/react/MockedProvider.js +7 -6
- package/testing/react/MockedProvider.js.map +1 -1
- package/testing/testing.cjs +8 -124
- package/testing/testing.cjs.map +1 -1
- package/testing/testing.cjs.native.js +8 -124
- package/utilities/common/incrementalResult.d.ts +2 -1
- package/utilities/common/incrementalResult.d.ts.map +1 -1
- package/utilities/common/incrementalResult.js +4 -0
- package/utilities/common/incrementalResult.js.map +1 -1
- package/utilities/common/mergeOptions.d.ts +1 -1
- package/utilities/common/mergeOptions.d.ts.map +1 -1
- package/utilities/common/mergeOptions.js.map +1 -1
- package/utilities/common/objects.d.ts +1 -0
- package/utilities/common/objects.d.ts.map +1 -1
- package/utilities/common/objects.js +6 -0
- package/utilities/common/objects.js.map +1 -1
- package/utilities/common/omitDeep.d.ts +3 -0
- package/utilities/common/omitDeep.d.ts.map +1 -0
- package/utilities/common/omitDeep.js +42 -0
- package/utilities/common/omitDeep.js.map +1 -0
- package/utilities/common/stripTypename.d.ts +2 -0
- package/utilities/common/stripTypename.d.ts.map +1 -0
- package/utilities/common/stripTypename.js +5 -0
- package/utilities/common/stripTypename.js.map +1 -0
- package/utilities/graphql/storeUtils.d.ts.map +1 -1
- package/utilities/graphql/storeUtils.js +1 -0
- package/utilities/graphql/storeUtils.js.map +1 -1
- package/utilities/graphql/transform.d.ts.map +1 -1
- package/utilities/graphql/transform.js +26 -16
- package/utilities/graphql/transform.js.map +1 -1
- package/utilities/index.d.ts +4 -0
- package/utilities/index.d.ts.map +1 -1
- package/utilities/index.js +3 -0
- package/utilities/index.js.map +1 -1
- package/utilities/types/DeepOmit.d.ts +9 -0
- package/utilities/types/DeepOmit.d.ts.map +1 -0
- package/utilities/types/DeepOmit.js +2 -0
- package/utilities/types/DeepOmit.js.map +1 -0
- package/utilities/utilities.cjs +111 -15
- package/utilities/utilities.cjs.map +1 -1
- package/utilities/utilities.cjs.native.js +111 -15
- package/version.js +1 -1
- package/react/hooks/compareResults.d.ts +0 -3
- package/react/hooks/compareResults.d.ts.map +0 -1
- package/react/hooks/compareResults.js.map +0 -1
package/utilities/utilities.cjs
CHANGED
|
@@ -143,6 +143,12 @@ function getFragmentFromSelection(selection, fragmentMap) {
|
|
|
143
143
|
function isNonNullObject(obj) {
|
|
144
144
|
return obj !== null && typeof obj === 'object';
|
|
145
145
|
}
|
|
146
|
+
function isPlainObject(obj) {
|
|
147
|
+
return (obj !== null &&
|
|
148
|
+
typeof obj === 'object' &&
|
|
149
|
+
(Object.getPrototypeOf(obj) === Object.prototype ||
|
|
150
|
+
Object.getPrototypeOf(obj) === null));
|
|
151
|
+
}
|
|
146
152
|
|
|
147
153
|
function makeReference(id) {
|
|
148
154
|
return { __ref: String(id) };
|
|
@@ -250,6 +256,7 @@ var KNOWN_DIRECTIVES = [
|
|
|
250
256
|
'client',
|
|
251
257
|
'rest',
|
|
252
258
|
'export',
|
|
259
|
+
'nonreactive',
|
|
253
260
|
];
|
|
254
261
|
var getStoreKeyName = Object.assign(function (fieldName, args, directives) {
|
|
255
262
|
if (args &&
|
|
@@ -448,19 +455,30 @@ function nullIfDocIsEmpty(doc) {
|
|
|
448
455
|
? null
|
|
449
456
|
: doc;
|
|
450
457
|
}
|
|
451
|
-
function getDirectiveMatcher(
|
|
452
|
-
var
|
|
453
|
-
var tests =
|
|
454
|
-
|
|
455
|
-
if (directive
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
458
|
+
function getDirectiveMatcher(configs) {
|
|
459
|
+
var names = new Map();
|
|
460
|
+
var tests = new Map();
|
|
461
|
+
configs.forEach(function (directive) {
|
|
462
|
+
if (directive) {
|
|
463
|
+
if (directive.name) {
|
|
464
|
+
names.set(directive.name, directive);
|
|
465
|
+
}
|
|
466
|
+
else if (directive.test) {
|
|
467
|
+
tests.set(directive.test, directive);
|
|
468
|
+
}
|
|
460
469
|
}
|
|
461
470
|
});
|
|
462
|
-
return function (directive) {
|
|
463
|
-
|
|
471
|
+
return function (directive) {
|
|
472
|
+
var config = names.get(directive.name.value);
|
|
473
|
+
if (!config && tests.size) {
|
|
474
|
+
tests.forEach(function (testConfig, test) {
|
|
475
|
+
if (test(directive)) {
|
|
476
|
+
config = testConfig;
|
|
477
|
+
}
|
|
478
|
+
});
|
|
479
|
+
}
|
|
480
|
+
return config;
|
|
481
|
+
};
|
|
464
482
|
}
|
|
465
483
|
function makeInUseGetterFunction(defaultKey) {
|
|
466
484
|
var map = new Map();
|
|
@@ -477,6 +495,7 @@ function makeInUseGetterFunction(defaultKey) {
|
|
|
477
495
|
};
|
|
478
496
|
}
|
|
479
497
|
function removeDirectivesFromDocument(directives, doc) {
|
|
498
|
+
checkDocument(doc);
|
|
480
499
|
var getInUseByOperationName = makeInUseGetterFunction("");
|
|
481
500
|
var getInUseByFragmentName = makeInUseGetterFunction("");
|
|
482
501
|
var getInUse = function (ancestors) {
|
|
@@ -500,10 +519,8 @@ function removeDirectivesFromDocument(directives, doc) {
|
|
|
500
519
|
}
|
|
501
520
|
}
|
|
502
521
|
var directiveMatcher = getDirectiveMatcher(directives);
|
|
503
|
-
var
|
|
504
|
-
|
|
505
|
-
nodeDirectives &&
|
|
506
|
-
nodeDirectives.some(directiveMatcher)); };
|
|
522
|
+
var shouldRemoveField = function (nodeDirectives) { return (isNonEmptyArray(nodeDirectives) &&
|
|
523
|
+
nodeDirectives.map(directiveMatcher).some(function (config) { return config && config.remove; })); };
|
|
507
524
|
var originalFragmentDefsByPath = new Map();
|
|
508
525
|
var firstVisitMadeChanges = false;
|
|
509
526
|
var fieldOrInlineFragmentVisitor = {
|
|
@@ -984,6 +1001,31 @@ function makeEmptyData() {
|
|
|
984
1001
|
};
|
|
985
1002
|
}
|
|
986
1003
|
|
|
1004
|
+
function isStatefulPromise(promise) {
|
|
1005
|
+
return 'status' in promise;
|
|
1006
|
+
}
|
|
1007
|
+
function wrapPromiseWithState(promise) {
|
|
1008
|
+
if (isStatefulPromise(promise)) {
|
|
1009
|
+
return promise;
|
|
1010
|
+
}
|
|
1011
|
+
var pendingPromise = promise;
|
|
1012
|
+
pendingPromise.status = 'pending';
|
|
1013
|
+
pendingPromise.then(function (value) {
|
|
1014
|
+
if (pendingPromise.status === 'pending') {
|
|
1015
|
+
var fulfilledPromise = pendingPromise;
|
|
1016
|
+
fulfilledPromise.status = 'fulfilled';
|
|
1017
|
+
fulfilledPromise.value = value;
|
|
1018
|
+
}
|
|
1019
|
+
}, function (reason) {
|
|
1020
|
+
if (pendingPromise.status === 'pending') {
|
|
1021
|
+
var rejectedPromise = pendingPromise;
|
|
1022
|
+
rejectedPromise.status = 'rejected';
|
|
1023
|
+
rejectedPromise.reason = reason;
|
|
1024
|
+
}
|
|
1025
|
+
});
|
|
1026
|
+
return promise;
|
|
1027
|
+
}
|
|
1028
|
+
|
|
987
1029
|
var toString = Object.prototype.toString;
|
|
988
1030
|
function cloneDeep(value) {
|
|
989
1031
|
return cloneDeepHelper(value);
|
|
@@ -1266,6 +1308,9 @@ function isExecutionPatchResult(value) {
|
|
|
1266
1308
|
return (isExecutionPatchIncrementalResult(value) ||
|
|
1267
1309
|
isExecutionPatchInitialResult(value));
|
|
1268
1310
|
}
|
|
1311
|
+
function isApolloPayloadResult(value) {
|
|
1312
|
+
return isNonNullObject(value) && "payload" in value;
|
|
1313
|
+
}
|
|
1269
1314
|
function mergeIncrementalData(prevResult, result) {
|
|
1270
1315
|
var mergedData = prevResult;
|
|
1271
1316
|
var merger = new DeepMerger();
|
|
@@ -1364,6 +1409,51 @@ function isNodeReadableStream(value) {
|
|
|
1364
1409
|
return !!value.pipe;
|
|
1365
1410
|
}
|
|
1366
1411
|
|
|
1412
|
+
function omitDeep(value, key) {
|
|
1413
|
+
return __omitDeep(value, key);
|
|
1414
|
+
}
|
|
1415
|
+
function __omitDeep(value, key, known) {
|
|
1416
|
+
if (known === void 0) { known = new Map(); }
|
|
1417
|
+
if (known.has(value)) {
|
|
1418
|
+
return known.get(value);
|
|
1419
|
+
}
|
|
1420
|
+
var modified = false;
|
|
1421
|
+
if (Array.isArray(value)) {
|
|
1422
|
+
var array_1 = [];
|
|
1423
|
+
known.set(value, array_1);
|
|
1424
|
+
value.forEach(function (value, index) {
|
|
1425
|
+
var result = __omitDeep(value, key, known);
|
|
1426
|
+
modified || (modified = result !== value);
|
|
1427
|
+
array_1[index] = result;
|
|
1428
|
+
});
|
|
1429
|
+
if (modified) {
|
|
1430
|
+
return array_1;
|
|
1431
|
+
}
|
|
1432
|
+
}
|
|
1433
|
+
else if (isPlainObject(value)) {
|
|
1434
|
+
var obj_1 = Object.create(Object.getPrototypeOf(value));
|
|
1435
|
+
known.set(value, obj_1);
|
|
1436
|
+
Object.keys(value).forEach(function (k) {
|
|
1437
|
+
if (k === key) {
|
|
1438
|
+
modified = true;
|
|
1439
|
+
}
|
|
1440
|
+
else {
|
|
1441
|
+
var result = __omitDeep(value[k], key, known);
|
|
1442
|
+
modified || (modified = result !== value[k]);
|
|
1443
|
+
obj_1[k] = result;
|
|
1444
|
+
}
|
|
1445
|
+
});
|
|
1446
|
+
if (modified) {
|
|
1447
|
+
return obj_1;
|
|
1448
|
+
}
|
|
1449
|
+
}
|
|
1450
|
+
return value;
|
|
1451
|
+
}
|
|
1452
|
+
|
|
1453
|
+
function stripTypename(value) {
|
|
1454
|
+
return omitDeep(value, '__typename');
|
|
1455
|
+
}
|
|
1456
|
+
|
|
1367
1457
|
exports.DEV = globals.DEV;
|
|
1368
1458
|
exports.maybe = globals.maybe;
|
|
1369
1459
|
exports.Observable = zenObservableTs.Observable;
|
|
@@ -1404,6 +1494,7 @@ exports.hasAllDirectives = hasAllDirectives;
|
|
|
1404
1494
|
exports.hasAnyDirectives = hasAnyDirectives;
|
|
1405
1495
|
exports.hasClientExports = hasClientExports;
|
|
1406
1496
|
exports.hasDirectives = hasDirectives;
|
|
1497
|
+
exports.isApolloPayloadResult = isApolloPayloadResult;
|
|
1407
1498
|
exports.isArray = isArray;
|
|
1408
1499
|
exports.isAsyncIterableIterator = isAsyncIterableIterator;
|
|
1409
1500
|
exports.isBlob = isBlob;
|
|
@@ -1417,8 +1508,10 @@ exports.isNodeReadableStream = isNodeReadableStream;
|
|
|
1417
1508
|
exports.isNodeResponse = isNodeResponse;
|
|
1418
1509
|
exports.isNonEmptyArray = isNonEmptyArray;
|
|
1419
1510
|
exports.isNonNullObject = isNonNullObject;
|
|
1511
|
+
exports.isPlainObject = isPlainObject;
|
|
1420
1512
|
exports.isReadableStream = isReadableStream;
|
|
1421
1513
|
exports.isReference = isReference;
|
|
1514
|
+
exports.isStatefulPromise = isStatefulPromise;
|
|
1422
1515
|
exports.isStreamableBlob = isStreamableBlob;
|
|
1423
1516
|
exports.iterateObserversSafely = iterateObserversSafely;
|
|
1424
1517
|
exports.makeReference = makeReference;
|
|
@@ -1429,6 +1522,7 @@ exports.mergeDeepArray = mergeDeepArray;
|
|
|
1429
1522
|
exports.mergeIncrementalData = mergeIncrementalData;
|
|
1430
1523
|
exports.mergeOptions = mergeOptions;
|
|
1431
1524
|
exports.offsetLimitPagination = offsetLimitPagination;
|
|
1525
|
+
exports.omitDeep = omitDeep;
|
|
1432
1526
|
exports.relayStylePagination = relayStylePagination;
|
|
1433
1527
|
exports.removeArgumentsFromDocument = removeArgumentsFromDocument;
|
|
1434
1528
|
exports.removeClientSetsFromDocument = removeClientSetsFromDocument;
|
|
@@ -1439,5 +1533,7 @@ exports.resultKeyNameFromField = resultKeyNameFromField;
|
|
|
1439
1533
|
exports.shouldInclude = shouldInclude;
|
|
1440
1534
|
exports.storeKeyNameFromField = storeKeyNameFromField;
|
|
1441
1535
|
exports.stringifyForDisplay = stringifyForDisplay;
|
|
1536
|
+
exports.stripTypename = stripTypename;
|
|
1442
1537
|
exports.valueToObjectRepresentation = valueToObjectRepresentation;
|
|
1538
|
+
exports.wrapPromiseWithState = wrapPromiseWithState;
|
|
1443
1539
|
//# sourceMappingURL=utilities.cjs.map
|