@apollo/client 3.8.0-beta.2 → 3.8.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 +32 -19
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/cache/cache.cjs.map +1 -1
- package/cache/core/cache.d.ts +1 -1
- package/cache/core/cache.d.ts.map +1 -1
- package/cache/core/cache.js.map +1 -1
- package/cache/core/types/Cache.d.ts +3 -3
- package/cache/core/types/Cache.d.ts.map +1 -1
- package/cache/core/types/Cache.js +1 -0
- package/cache/core/types/Cache.js.map +1 -1
- package/cache/core/types/common.d.ts +17 -6
- package/cache/core/types/common.d.ts.map +1 -1
- package/cache/core/types/common.js.map +1 -1
- package/cache/inmemory/entityStore.d.ts +1 -1
- package/cache/inmemory/entityStore.d.ts.map +1 -1
- package/cache/inmemory/entityStore.js.map +1 -1
- package/cache/inmemory/inMemoryCache.d.ts +1 -1
- package/cache/inmemory/inMemoryCache.d.ts.map +1 -1
- package/cache/inmemory/inMemoryCache.js.map +1 -1
- package/cache/inmemory/types.d.ts +2 -2
- package/cache/inmemory/types.d.ts.map +1 -1
- package/cache/inmemory/types.js.map +1 -1
- package/core/QueryManager.d.ts.map +1 -1
- package/core/QueryManager.js +5 -3
- package/core/QueryManager.js.map +1 -1
- package/core/core.cjs +5 -4
- package/core/core.cjs.map +1 -1
- package/core/core.cjs.native.js +5 -4
- package/dev/dev.cjs +1 -1
- package/dev/dev.cjs.map +1 -1
- package/dev/dev.cjs.native.js +1 -1
- package/link/batch-http/batch-http.cjs +5 -4
- package/link/batch-http/batch-http.cjs.map +1 -1
- package/link/batch-http/batch-http.cjs.native.js +5 -4
- package/link/batch-http/batchHttpLink.d.ts.map +1 -1
- package/link/batch-http/batchHttpLink.js +1 -1
- package/link/batch-http/batchHttpLink.js.map +1 -1
- package/link/http/createHttpLink.js +1 -1
- package/link/http/createHttpLink.js.map +1 -1
- package/link/http/http.cjs +2 -3
- package/link/http/http.cjs.map +1 -1
- package/link/http/http.cjs.native.js +2 -3
- package/link/http/selectHttpOptionsAndBody.d.ts +1 -1
- package/link/http/selectHttpOptionsAndBody.d.ts.map +1 -1
- package/link/http/selectHttpOptionsAndBody.js +1 -1
- package/link/http/selectHttpOptionsAndBody.js.map +1 -1
- package/link/persisted-queries/index.js +1 -1
- package/link/persisted-queries/index.js.map +1 -1
- package/link/persisted-queries/persisted-queries.cjs +2 -3
- package/link/persisted-queries/persisted-queries.cjs.map +1 -1
- package/link/persisted-queries/persisted-queries.cjs.native.js +2 -3
- package/link/subscriptions/index.js +1 -1
- package/link/subscriptions/index.js.map +1 -1
- package/link/subscriptions/subscriptions.cjs +2 -3
- package/link/subscriptions/subscriptions.cjs.map +1 -1
- package/link/subscriptions/subscriptions.cjs.native.js +2 -3
- package/link/utils/filterOperationVariables.d.ts +2 -2
- package/link/utils/filterOperationVariables.d.ts.map +1 -1
- package/link/utils/filterOperationVariables.js +5 -4
- package/link/utils/filterOperationVariables.js.map +1 -1
- package/link/utils/utils.cjs +4 -3
- package/link/utils/utils.cjs.map +1 -1
- package/link/utils/utils.cjs.native.js +4 -3
- package/package.json +1 -1
- package/react/cache/SuspenseCache.d.ts +0 -1
- package/react/cache/SuspenseCache.d.ts.map +1 -1
- package/react/cache/SuspenseCache.js +10 -10
- package/react/cache/SuspenseCache.js.map +1 -1
- package/react/hooks/useBackgroundQuery.d.ts +14 -5
- package/react/hooks/useBackgroundQuery.d.ts.map +1 -1
- package/react/hooks/useBackgroundQuery.js.map +1 -1
- package/react/hooks/useSuspenseQuery.d.ts +0 -1
- package/react/hooks/useSuspenseQuery.d.ts.map +1 -1
- package/react/hooks/useSuspenseQuery.js.map +1 -1
- package/react/react.cjs +10 -10
- package/react/react.cjs.map +1 -1
- package/react/react.cjs.native.js +10 -10
- 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/core.cjs +2 -3
- package/testing/core/core.cjs.map +1 -1
- package/testing/core/core.cjs.native.js +2 -3
- package/testing/core/mocking/mockLink.d.ts.map +1 -1
- package/testing/core/mocking/mockLink.js +1 -2
- package/testing/core/mocking/mockLink.js.map +1 -1
- package/testing/matchers/index.js +2 -0
- package/testing/matchers/index.js.map +1 -1
- package/testing/matchers/toHaveSuspenseCacheEntryUsing.d.ts +12 -0
- package/testing/matchers/toHaveSuspenseCacheEntryUsing.d.ts.map +1 -0
- package/testing/matchers/toHaveSuspenseCacheEntryUsing.js +18 -0
- package/testing/matchers/toHaveSuspenseCacheEntryUsing.js.map +1 -0
- package/testing/matchers/toMatchDocument.d.ts.map +1 -1
- package/testing/matchers/toMatchDocument.js +1 -2
- package/testing/matchers/toMatchDocument.js.map +1 -1
- package/utilities/globals/globals.cjs +1 -1
- package/utilities/globals/globals.cjs.map +1 -1
- package/utilities/globals/globals.cjs.native.js +1 -1
- package/utilities/graphql/print.d.ts +3 -0
- package/utilities/graphql/print.d.ts.map +1 -0
- package/utilities/graphql/print.js +13 -0
- package/utilities/graphql/print.js.map +1 -0
- package/utilities/index.d.ts +1 -0
- package/utilities/index.d.ts.map +1 -1
- package/utilities/index.js +1 -0
- package/utilities/index.js.map +1 -1
- package/utilities/utilities.cjs +12 -0
- package/utilities/utilities.cjs.map +1 -1
- package/utilities/utilities.cjs.native.js +12 -0
- package/version.js +1 -1
package/apollo-client.cjs
CHANGED
|
@@ -33,7 +33,7 @@ var equal__default = /*#__PURE__*/_interopDefaultLegacy(equal);
|
|
|
33
33
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
34
34
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
35
35
|
|
|
36
|
-
var version = '3.8.0-beta.
|
|
36
|
+
var version = '3.8.0-beta.3';
|
|
37
37
|
|
|
38
38
|
function maybe(thunk) {
|
|
39
39
|
try {
|
|
@@ -614,6 +614,17 @@ var DocumentTransform = (function () {
|
|
|
614
614
|
return DocumentTransform;
|
|
615
615
|
}());
|
|
616
616
|
|
|
617
|
+
var printCache = canUseWeakMap ? new WeakMap() : undefined;
|
|
618
|
+
var print = function (ast) {
|
|
619
|
+
var result;
|
|
620
|
+
result = printCache === null || printCache === void 0 ? void 0 : printCache.get(ast);
|
|
621
|
+
if (!result) {
|
|
622
|
+
result = graphql.print(ast);
|
|
623
|
+
printCache === null || printCache === void 0 ? void 0 : printCache.set(ast, result);
|
|
624
|
+
}
|
|
625
|
+
return result;
|
|
626
|
+
};
|
|
627
|
+
|
|
617
628
|
var isArray = Array.isArray;
|
|
618
629
|
function isNonEmptyArray(value) {
|
|
619
630
|
return Array.isArray(value) && value.length > 0;
|
|
@@ -1453,12 +1464,13 @@ function transformOperation(operation) {
|
|
|
1453
1464
|
return transformedOperation;
|
|
1454
1465
|
}
|
|
1455
1466
|
|
|
1456
|
-
function filterOperationVariables(variables,
|
|
1467
|
+
function filterOperationVariables(variables, query) {
|
|
1457
1468
|
var result = tslib.__assign({}, variables);
|
|
1458
1469
|
var unusedNames = new Set(Object.keys(variables));
|
|
1459
|
-
graphql.visit(
|
|
1470
|
+
graphql.visit(query, {
|
|
1460
1471
|
Variable: function (node, _key, parent) {
|
|
1461
|
-
if (parent &&
|
|
1472
|
+
if (parent &&
|
|
1473
|
+
parent.kind !== 'VariableDefinition') {
|
|
1462
1474
|
unusedNames.delete(node.name.value);
|
|
1463
1475
|
}
|
|
1464
1476
|
},
|
|
@@ -1970,7 +1982,7 @@ function selectHttpOptionsAndBodyInternal(operation, printer) {
|
|
|
1970
1982
|
if (http.includeExtensions)
|
|
1971
1983
|
body.extensions = extensions;
|
|
1972
1984
|
if (http.includeQuery)
|
|
1973
|
-
body.query = printer(query,
|
|
1985
|
+
body.query = printer(query, print);
|
|
1974
1986
|
return {
|
|
1975
1987
|
options: options,
|
|
1976
1988
|
body: body,
|
|
@@ -2107,7 +2119,7 @@ var createHttpLink = function (linkOptions) {
|
|
|
2107
2119
|
}
|
|
2108
2120
|
var _b = selectHttpOptionsAndBodyInternal(operation, print, fallbackHttpConfig, linkConfig, contextConfig), options = _b.options, body = _b.body;
|
|
2109
2121
|
if (body.variables && !includeUnusedVariables) {
|
|
2110
|
-
body.variables = filterOperationVariables(body.variables, operation);
|
|
2122
|
+
body.variables = filterOperationVariables(body.variables, operation.query);
|
|
2111
2123
|
}
|
|
2112
2124
|
var controller;
|
|
2113
2125
|
if (!options.signal) {
|
|
@@ -6263,8 +6275,9 @@ var QueryManager = (function () {
|
|
|
6263
6275
|
};
|
|
6264
6276
|
context = operation.context;
|
|
6265
6277
|
if (deduplication) {
|
|
6266
|
-
var
|
|
6267
|
-
inFlightLinkObservables_1.
|
|
6278
|
+
var printedServerQuery_1 = print(serverQuery);
|
|
6279
|
+
var byVariables_1 = inFlightLinkObservables_1.get(printedServerQuery_1) || new Map();
|
|
6280
|
+
inFlightLinkObservables_1.set(printedServerQuery_1, byVariables_1);
|
|
6268
6281
|
var varJson_1 = canonicalStringify(variables);
|
|
6269
6282
|
observable = byVariables_1.get(varJson_1);
|
|
6270
6283
|
if (!observable) {
|
|
@@ -6275,7 +6288,7 @@ var QueryManager = (function () {
|
|
|
6275
6288
|
concast.beforeNext(function () {
|
|
6276
6289
|
if (byVariables_1.delete(varJson_1) &&
|
|
6277
6290
|
byVariables_1.size < 1) {
|
|
6278
|
-
inFlightLinkObservables_1.delete(
|
|
6291
|
+
inFlightLinkObservables_1.delete(printedServerQuery_1);
|
|
6279
6292
|
}
|
|
6280
6293
|
});
|
|
6281
6294
|
}
|
|
@@ -7913,21 +7926,21 @@ var QueryReference = (function () {
|
|
|
7913
7926
|
var SuspenseCache = (function () {
|
|
7914
7927
|
function SuspenseCache(options) {
|
|
7915
7928
|
if (options === void 0) { options = Object.create(null); }
|
|
7916
|
-
this.
|
|
7917
|
-
this.queryRefs = new Map();
|
|
7929
|
+
this.queryRefs = new trie.Trie(canUseWeakMap);
|
|
7918
7930
|
this.options = options;
|
|
7919
7931
|
}
|
|
7920
7932
|
SuspenseCache.prototype.getQueryRef = function (cacheKey, createObservable) {
|
|
7921
|
-
var
|
|
7922
|
-
|
|
7923
|
-
|
|
7924
|
-
|
|
7925
|
-
key: stableCacheKey,
|
|
7933
|
+
var ref = this.queryRefs.lookupArray(cacheKey);
|
|
7934
|
+
if (!ref.current) {
|
|
7935
|
+
ref.current = new QueryReference(createObservable(), {
|
|
7936
|
+
key: cacheKey,
|
|
7926
7937
|
autoDisposeTimeoutMs: this.options.autoDisposeTimeoutMs,
|
|
7927
|
-
onDispose: function () {
|
|
7928
|
-
|
|
7938
|
+
onDispose: function () {
|
|
7939
|
+
delete ref.current;
|
|
7940
|
+
},
|
|
7941
|
+
});
|
|
7929
7942
|
}
|
|
7930
|
-
return
|
|
7943
|
+
return ref.current;
|
|
7931
7944
|
};
|
|
7932
7945
|
return SuspenseCache;
|
|
7933
7946
|
}());
|