@apollo/client 3.12.0-rc.3 → 3.12.0
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/CHANGELOG.md +66 -0
- package/README.md +2 -0
- package/apollo-client.cjs +69 -66
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/cache/cache.cjs +4 -165
- package/cache/cache.cjs.map +1 -1
- package/cache/cache.cjs.native.js +4 -165
- package/cache/core/cache.js +1 -1
- package/cache/core/cache.js.map +1 -1
- package/cache/inmemory/policies.js +1 -1
- package/cache/inmemory/policies.js.map +1 -1
- package/config/jest/setup.js +0 -2
- package/config/jest/setup.js.map +1 -1
- package/core/QueryManager.js +1 -1
- package/core/QueryManager.js.map +1 -1
- package/core/core.cjs +4 -188
- package/core/core.cjs.map +1 -1
- package/core/core.cjs.native.js +4 -188
- package/dev/dev.cjs +37 -37
- package/dev/dev.cjs.map +1 -1
- package/dev/dev.cjs.native.js +37 -37
- package/invariantErrorCodes.js +42 -42
- package/link/core/ApolloLink.js +2 -2
- package/link/core/core.cjs +2 -2
- package/link/core/core.cjs.map +1 -1
- package/link/core/core.cjs.native.js +2 -2
- package/link/http/checkFetcher.js +1 -1
- package/link/http/createHttpLink.js +1 -1
- package/link/http/http.cjs +3 -3
- package/link/http/http.cjs.map +1 -1
- package/link/http/http.cjs.native.js +3 -3
- package/link/http/serializeFetchParameter.js +1 -1
- package/link/persisted-queries/index.js +2 -2
- package/link/persisted-queries/persisted-queries.cjs +2 -2
- package/link/persisted-queries/persisted-queries.cjs.map +1 -1
- package/link/persisted-queries/persisted-queries.cjs.native.js +2 -2
- package/link/utils/toPromise.js +1 -1
- package/link/utils/utils.cjs +2 -2
- package/link/utils/utils.cjs.map +1 -1
- package/link/utils/utils.cjs.native.js +2 -2
- package/link/utils/validateOperation.js +1 -1
- package/masking/__benches__/types.bench.d.ts +2 -0
- package/masking/__benches__/types.bench.js +131 -0
- package/masking/__benches__/types.bench.js.map +1 -0
- package/masking/index.d.ts +3 -0
- package/masking/index.js +3 -1
- package/masking/index.js.map +1 -1
- package/masking/internal/types.d.ts +114 -9
- package/masking/internal/types.js.map +1 -1
- package/masking/maskDefinition.d.ts +14 -0
- package/{core/masking.js → masking/maskDefinition.js} +6 -77
- package/masking/maskDefinition.js.map +1 -0
- package/masking/maskFragment.d.ts +4 -0
- package/masking/maskFragment.js +43 -0
- package/masking/maskFragment.js.map +1 -0
- package/masking/maskOperation.d.ts +4 -0
- package/masking/maskOperation.js +29 -0
- package/masking/maskOperation.js.map +1 -0
- package/masking/masking.cjs +202 -0
- package/masking/masking.cjs.map +1 -1
- package/masking/masking.cjs.native.js +202 -0
- package/masking/types.d.ts +4 -4
- package/masking/types.js.map +1 -1
- package/masking/utils.d.ts +11 -0
- package/masking/utils.js +17 -0
- package/masking/utils.js.map +1 -0
- package/package.json +10 -7
- package/react/hoc/hoc.cjs.map +1 -1
- package/react/hoc/mutation-hoc.js +3 -2
- package/react/hoc/mutation-hoc.js.map +1 -1
- package/react/internal/internal.cjs +1 -1
- package/react/internal/internal.cjs.map +1 -1
- package/react/internal/internal.cjs.native.js +1 -1
- package/testing/internal/disposables/index.d.ts +0 -1
- package/testing/internal/disposables/index.js +0 -1
- package/testing/internal/disposables/index.js.map +1 -1
- package/testing/internal/index.d.ts +4 -1
- package/testing/internal/index.js +4 -1
- package/testing/internal/index.js.map +1 -1
- package/testing/internal/rtl/actAsync.d.ts +2 -0
- package/testing/internal/rtl/actAsync.js +21 -0
- package/testing/internal/rtl/actAsync.js.map +1 -0
- package/testing/internal/rtl/renderAsync.d.ts +9 -0
- package/testing/internal/rtl/renderAsync.js +23 -0
- package/testing/internal/rtl/renderAsync.js.map +1 -0
- package/testing/internal/rtl/renderHookAsync.d.ts +8 -0
- package/testing/internal/rtl/renderHookAsync.js +45 -0
- package/testing/internal/rtl/renderHookAsync.js.map +1 -0
- package/testing/internal/scenarios/index.d.ts +10 -0
- package/testing/internal/scenarios/index.js +9 -2
- package/testing/internal/scenarios/index.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/version.js +1 -1
- package/.changeset/brown-readers-smash.md +0 -5
- package/.changeset/clean-turkeys-kick.md +0 -5
- package/.changeset/cold-apes-bow.md +0 -5
- package/.changeset/early-bobcats-eat.md +0 -5
- package/.changeset/flat-beans-knock.md +0 -15
- package/.changeset/gorgeous-zebras-confess.md +0 -5
- package/.changeset/itchy-penguins-worry.md +0 -5
- package/.changeset/kind-toys-tie.md +0 -5
- package/.changeset/long-zoos-ring.md +0 -5
- package/.changeset/mean-bottles-travel.md +0 -5
- package/.changeset/nasty-camels-pay.md +0 -36
- package/.changeset/nervous-owls-hear.md +0 -5
- package/.changeset/nice-countries-share.md +0 -5
- package/.changeset/perfect-jobs-flow.md +0 -5
- package/.changeset/pre.json +0 -26
- package/.changeset/slimy-points-end.md +0 -5
- package/.changeset/small-bears-confess.md +0 -5
- package/.changeset/wicked-pans-appear.md +0 -5
- package/core/masking.d.ts +0 -10
- package/core/masking.js.map +0 -1
- package/testing/internal/disposables/disableActWarnings.d.ts +0 -9
- package/testing/internal/disposables/disableActWarnings.js +0 -15
- package/testing/internal/disposables/disableActWarnings.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,71 @@
|
|
|
1
1
|
# @apollo/client
|
|
2
2
|
|
|
3
|
+
## 3.12.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
#### Data masking 🎭
|
|
8
|
+
|
|
9
|
+
- [#12042](https://github.com/apollographql/apollo-client/pull/12042) [`1c0ecbf`](https://github.com/apollographql/apollo-client/commit/1c0ecbf3c0454056853dd3dcb493dfd5fa1a96b1) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Introduces data masking in Apollo Client.
|
|
10
|
+
|
|
11
|
+
Data masking enforces that only the fields requested by the query or fragment is available to that component. Data masking is best paired with [colocated fragments](https://www.apollographql.com/docs/react/data/fragments#colocating-fragments).
|
|
12
|
+
|
|
13
|
+
To enable data masking in Apollo Client, set the `dataMasking` option to `true`.
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
new ApolloClient({
|
|
17
|
+
dataMasking: true,
|
|
18
|
+
// ... other options
|
|
19
|
+
});
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
For detailed information on data masking, including how to incrementally adopt it in an existing applications, see the [data masking documentation](https://www.apollographql.com/docs/react/data/fragments#data-masking).
|
|
23
|
+
|
|
24
|
+
- [#12131](https://github.com/apollographql/apollo-client/pull/12131) [`21c3f08`](https://github.com/apollographql/apollo-client/commit/21c3f083013445707b7b50ae6390318bc568d0f5) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Allow `null` as a valid `from` value in `useFragment`.
|
|
25
|
+
|
|
26
|
+
<details open>
|
|
27
|
+
<summary><h3>More Patch Changes</h3></summary>
|
|
28
|
+
|
|
29
|
+
- [#12126](https://github.com/apollographql/apollo-client/pull/12126) [`d10d702`](https://github.com/apollographql/apollo-client/commit/d10d702ee9bd4d1d1dee2551821140f2c49d5c0c) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Maintain the existing document if its unchanged by the codemod and move to more naive whitespace formatting
|
|
30
|
+
|
|
31
|
+
- [#12150](https://github.com/apollographql/apollo-client/pull/12150) [`9ed1e1e`](https://github.com/apollographql/apollo-client/commit/9ed1e1ef02b28445614fed4f5c141a289ac32d66) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix issue when using `Unmasked` with older versions of TypeScript when used with array fields.
|
|
32
|
+
|
|
33
|
+
- [#12116](https://github.com/apollographql/apollo-client/pull/12116) [`8ae6e4e`](https://github.com/apollographql/apollo-client/commit/8ae6e4e5cec296c3910fdffb0ce51a0f5f06c5d3) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Prevent field accessor warnings when using `@unmask(mode: "migrate")` on objects that are passed into `cache.identify`.
|
|
34
|
+
|
|
35
|
+
- [#12120](https://github.com/apollographql/apollo-client/pull/12120) [`6a98e76`](https://github.com/apollographql/apollo-client/commit/6a98e76af5c800a91a748c498611b55c33e02c68) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Provide a codemod that applies `@unmask` to all named fragments for all operations and fragments.
|
|
36
|
+
|
|
37
|
+
Learn how to use the codemod in the [incremental adoption documentation](https://www.apollographql.com/docs/react/data/fragments#incremental-adoption-in-an-existing-application).
|
|
38
|
+
|
|
39
|
+
- [#12134](https://github.com/apollographql/apollo-client/pull/12134) [`cfaf4ef`](https://github.com/apollographql/apollo-client/commit/cfaf4efc6dea56ae46a5b5199d8ed9414b0f17d8) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix issue where data went missing when an unmasked fragment in migrate mode selected fields that the parent did not.
|
|
40
|
+
|
|
41
|
+
- [#12154](https://github.com/apollographql/apollo-client/pull/12154) [`d933def`](https://github.com/apollographql/apollo-client/commit/d933def986d476cd64321059299ab15031297f04) Thanks [@phryneas](https://github.com/phryneas)! - Data masking types: handle overlapping nested array types and fragments on interface types.
|
|
42
|
+
|
|
43
|
+
- [#12139](https://github.com/apollographql/apollo-client/pull/12139) [`5a53e15`](https://github.com/apollographql/apollo-client/commit/5a53e15e713e5eb2ebc9216615ea1a845fad2685) Thanks [@phryneas](https://github.com/phryneas)! - Fix issue where masked data would sometimes get returned when the field was part of a child fragment from a fragment unmasked by the parent query.
|
|
44
|
+
|
|
45
|
+
- [#12123](https://github.com/apollographql/apollo-client/pull/12123) [`8422a30`](https://github.com/apollographql/apollo-client/commit/8422a305eff861fc8f953731e92c860f555bd99a) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Warn when using data masking with "no-cache" operations.
|
|
46
|
+
|
|
47
|
+
- [#12139](https://github.com/apollographql/apollo-client/pull/12139) [`5a53e15`](https://github.com/apollographql/apollo-client/commit/5a53e15e713e5eb2ebc9216615ea1a845fad2685) Thanks [@phryneas](https://github.com/phryneas)! - Fix issue where the warning emitted by `@unmask(mode: "migrate")` would trigger unnecessarily when the fragment was used alongside a masked fragment inside an inline fragment.
|
|
48
|
+
|
|
49
|
+
- [#12114](https://github.com/apollographql/apollo-client/pull/12114) [`1d4ce00`](https://github.com/apollographql/apollo-client/commit/1d4ce0034395147445165022f7d23f42ff638d8a) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix error when combining `@unmask` and `@defer` directives on a fragment spread when data masking is enabled.
|
|
50
|
+
|
|
51
|
+
- [#12130](https://github.com/apollographql/apollo-client/pull/12130) [`1e7d009`](https://github.com/apollographql/apollo-client/commit/1e7d009e4a52949dab0065f3219dfe148837531e) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix error thrown when applying unmask migrate mode warnings on interface types with selection sets that contain inline fragment conditions.
|
|
52
|
+
|
|
53
|
+
- [#12152](https://github.com/apollographql/apollo-client/pull/12152) [`78137ec`](https://github.com/apollographql/apollo-client/commit/78137eccba90b80dd29bd8e1423b49ebe51ef8df) Thanks [@phryneas](https://github.com/phryneas)! - Add a helper that will skip the TS unmasking alorithm when no fragments are present on type level
|
|
54
|
+
|
|
55
|
+
- [#12126](https://github.com/apollographql/apollo-client/pull/12126) [`d10d702`](https://github.com/apollographql/apollo-client/commit/d10d702ee9bd4d1d1dee2551821140f2c49d5c0c) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Ensure documents unchanged by the codemod are left untouched.
|
|
56
|
+
|
|
57
|
+
- [#12133](https://github.com/apollographql/apollo-client/pull/12133) [`a6ece37`](https://github.com/apollographql/apollo-client/commit/a6ece375119ce12c19749471c55b0059843a7217) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Ensure `null` is retained in nullable types when unmasking a type with the `Unmasked` helper type.
|
|
58
|
+
|
|
59
|
+
- [#12139](https://github.com/apollographql/apollo-client/pull/12139) [`5a53e15`](https://github.com/apollographql/apollo-client/commit/5a53e15e713e5eb2ebc9216615ea1a845fad2685) Thanks [@phryneas](https://github.com/phryneas)! - Fix issue that threw errors when masking partial data with `@unmask(mode: "migrate")`.
|
|
60
|
+
|
|
61
|
+
</details>
|
|
62
|
+
|
|
63
|
+
## 3.12.0-rc.4
|
|
64
|
+
|
|
65
|
+
### Patch Changes
|
|
66
|
+
|
|
67
|
+
- [#12154](https://github.com/apollographql/apollo-client/pull/12154) [`d933def`](https://github.com/apollographql/apollo-client/commit/d933def986d476cd64321059299ab15031297f04) Thanks [@phryneas](https://github.com/phryneas)! - Data masking types: handle overlapping nested array types and fragments on interface types.
|
|
68
|
+
|
|
3
69
|
## 3.12.0-rc.3
|
|
4
70
|
|
|
5
71
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -18,6 +18,8 @@ Join 1000+ engineers at GraphQL Summit for talks, workshops, and office hours, O
|
|
|
18
18
|
|
|
19
19
|
Apollo Client is a fully-featured caching GraphQL client with integrations for React, Angular, and more. It allows you to easily build UI components that fetch data via GraphQL.
|
|
20
20
|
|
|
21
|
+
Apollo Client aims to comply with the [Working Draft of the GraphQL specification](https://spec.graphql.org/draft/).
|
|
22
|
+
|
|
21
23
|
| ☑️ Apollo Client User Survey |
|
|
22
24
|
| :----- |
|
|
23
25
|
| What do you like best about Apollo Client? What needs to be improved? Please tell us by taking a [one-minute survey](https://docs.google.com/forms/d/e/1FAIpQLSczNDXfJne3ZUOXjk9Ursm9JYvhTh1_nFTDfdq3XBAFWCzplQ/viewform?usp=pp_url&entry.1170701325=Apollo+Client&entry.204965213=Readme). Your responses will help us understand Apollo Client usage and allow us to serve you better. |
|
package/apollo-client.cjs
CHANGED
|
@@ -31,7 +31,7 @@ function _interopNamespace(e) {
|
|
|
31
31
|
var equal__default = /*#__PURE__*/_interopDefaultLegacy(equal);
|
|
32
32
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
33
33
|
|
|
34
|
-
var version = "3.12.0
|
|
34
|
+
var version = "3.12.0";
|
|
35
35
|
|
|
36
36
|
function maybe(thunk) {
|
|
37
37
|
try {
|
|
@@ -1615,7 +1615,7 @@ function toPromise(observable) {
|
|
|
1615
1615
|
observable.subscribe({
|
|
1616
1616
|
next: function (data) {
|
|
1617
1617
|
if (completed) {
|
|
1618
|
-
globalThis.__DEV__ !== false && invariant.warn(
|
|
1618
|
+
globalThis.__DEV__ !== false && invariant.warn(45);
|
|
1619
1619
|
}
|
|
1620
1620
|
else {
|
|
1621
1621
|
completed = true;
|
|
@@ -1658,7 +1658,7 @@ function validateOperation(operation) {
|
|
|
1658
1658
|
for (var _i = 0, _a = Object.keys(operation); _i < _a.length; _i++) {
|
|
1659
1659
|
var key = _a[_i];
|
|
1660
1660
|
if (OPERATION_FIELDS.indexOf(key) < 0) {
|
|
1661
|
-
throw newInvariantError(
|
|
1661
|
+
throw newInvariantError(46, key);
|
|
1662
1662
|
}
|
|
1663
1663
|
}
|
|
1664
1664
|
return operation;
|
|
@@ -1767,7 +1767,7 @@ var ApolloLink = (function () {
|
|
|
1767
1767
|
ApolloLink.concat = function (first, second) {
|
|
1768
1768
|
var firstLink = toLink(first);
|
|
1769
1769
|
if (isTerminating(firstLink)) {
|
|
1770
|
-
globalThis.__DEV__ !== false && invariant.warn(
|
|
1770
|
+
globalThis.__DEV__ !== false && invariant.warn(38, firstLink);
|
|
1771
1771
|
return firstLink;
|
|
1772
1772
|
}
|
|
1773
1773
|
var nextLink = toLink(second);
|
|
@@ -1793,7 +1793,7 @@ var ApolloLink = (function () {
|
|
|
1793
1793
|
return ApolloLink.concat(this, next);
|
|
1794
1794
|
};
|
|
1795
1795
|
ApolloLink.prototype.request = function (operation, forward) {
|
|
1796
|
-
throw newInvariantError(
|
|
1796
|
+
throw newInvariantError(39);
|
|
1797
1797
|
};
|
|
1798
1798
|
ApolloLink.prototype.onError = function (error, observer) {
|
|
1799
1799
|
if (observer && observer.error) {
|
|
@@ -2175,7 +2175,7 @@ var serializeFetchParameter = function (p, label) {
|
|
|
2175
2175
|
serialized = JSON.stringify(p);
|
|
2176
2176
|
}
|
|
2177
2177
|
catch (e) {
|
|
2178
|
-
var parseError = newInvariantError(
|
|
2178
|
+
var parseError = newInvariantError(42, label, e.message);
|
|
2179
2179
|
parseError.parseError = e;
|
|
2180
2180
|
throw parseError;
|
|
2181
2181
|
}
|
|
@@ -2261,7 +2261,7 @@ function removeDuplicateHeaders(headers, preserveHeaderCase) {
|
|
|
2261
2261
|
|
|
2262
2262
|
var checkFetcher = function (fetcher) {
|
|
2263
2263
|
if (!fetcher && typeof fetch === "undefined") {
|
|
2264
|
-
throw newInvariantError(
|
|
2264
|
+
throw newInvariantError(40);
|
|
2265
2265
|
}
|
|
2266
2266
|
};
|
|
2267
2267
|
|
|
@@ -2395,7 +2395,7 @@ var createHttpLink = function (linkOptions) {
|
|
|
2395
2395
|
options.headers = options.headers || {};
|
|
2396
2396
|
var acceptHeader = "multipart/mixed;";
|
|
2397
2397
|
if (isSubscription && hasDefer) {
|
|
2398
|
-
globalThis.__DEV__ !== false && invariant.warn(
|
|
2398
|
+
globalThis.__DEV__ !== false && invariant.warn(41);
|
|
2399
2399
|
}
|
|
2400
2400
|
if (isSubscription) {
|
|
2401
2401
|
acceptHeader +=
|
|
@@ -2532,59 +2532,14 @@ function directiveIsNonreactive(dir) {
|
|
|
2532
2532
|
var MapImpl = canUseWeakMap ? WeakMap : Map;
|
|
2533
2533
|
var SetImpl = canUseWeakSet ? WeakSet : Set;
|
|
2534
2534
|
var disableWarningsSlot = new optimism.Slot();
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
if (!
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
}
|
|
2541
|
-
return data;
|
|
2542
|
-
}
|
|
2543
|
-
var definition = getOperationDefinition(document);
|
|
2544
|
-
invariant(definition, 38);
|
|
2545
|
-
if (data == null) {
|
|
2546
|
-
return data;
|
|
2547
|
-
}
|
|
2548
|
-
return maskDefinition(data, definition.selectionSet, {
|
|
2549
|
-
operationType: definition.operation,
|
|
2550
|
-
operationName: (_a = definition.name) === null || _a === void 0 ? void 0 : _a.value,
|
|
2551
|
-
fragmentMap: createFragmentMap(getFragmentDefinitions(document)),
|
|
2552
|
-
cache: cache,
|
|
2553
|
-
mutableTargets: new MapImpl(),
|
|
2554
|
-
knownChanged: new SetImpl(),
|
|
2555
|
-
});
|
|
2556
|
-
}
|
|
2557
|
-
function maskFragment(data, document, cache, fragmentName) {
|
|
2558
|
-
if (!cache.fragmentMatches) {
|
|
2559
|
-
if (globalThis.__DEV__ !== false) {
|
|
2560
|
-
warnOnImproperCacheImplementation();
|
|
2561
|
-
}
|
|
2562
|
-
return data;
|
|
2563
|
-
}
|
|
2564
|
-
var fragments = document.definitions.filter(function (node) {
|
|
2565
|
-
return node.kind === graphql.Kind.FRAGMENT_DEFINITION;
|
|
2566
|
-
});
|
|
2567
|
-
if (typeof fragmentName === "undefined") {
|
|
2568
|
-
invariant(fragments.length === 1, 39, fragments.length);
|
|
2569
|
-
fragmentName = fragments[0].name.value;
|
|
2570
|
-
}
|
|
2571
|
-
var fragment = fragments.find(function (fragment) { return fragment.name.value === fragmentName; });
|
|
2572
|
-
invariant(!!fragment, 40, fragmentName);
|
|
2573
|
-
if (data == null) {
|
|
2574
|
-
return data;
|
|
2575
|
-
}
|
|
2576
|
-
if (equal.equal(data, {})) {
|
|
2577
|
-
return data;
|
|
2535
|
+
var issuedWarning = false;
|
|
2536
|
+
function warnOnImproperCacheImplementation() {
|
|
2537
|
+
if (!issuedWarning) {
|
|
2538
|
+
issuedWarning = true;
|
|
2539
|
+
globalThis.__DEV__ !== false && invariant.warn(52);
|
|
2578
2540
|
}
|
|
2579
|
-
return maskDefinition(data, fragment.selectionSet, {
|
|
2580
|
-
operationType: "fragment",
|
|
2581
|
-
operationName: fragment.name.value,
|
|
2582
|
-
fragmentMap: createFragmentMap(getFragmentDefinitions(document)),
|
|
2583
|
-
cache: cache,
|
|
2584
|
-
mutableTargets: new MapImpl(),
|
|
2585
|
-
knownChanged: new SetImpl(),
|
|
2586
|
-
});
|
|
2587
2541
|
}
|
|
2542
|
+
|
|
2588
2543
|
function maskDefinition(data, selectionSet, context) {
|
|
2589
2544
|
return disableWarningsSlot.withValue(true, function () {
|
|
2590
2545
|
var masked = maskSelectionSet(data, selectionSet, context, false);
|
|
@@ -2665,7 +2620,7 @@ function maskSelectionSet(data, selectionSet, context, migration, path) {
|
|
|
2665
2620
|
var fragment = context.fragmentMap[fragmentName] ||
|
|
2666
2621
|
(context.fragmentMap[fragmentName] =
|
|
2667
2622
|
context.cache.lookupFragment(fragmentName));
|
|
2668
|
-
invariant(fragment,
|
|
2623
|
+
invariant(fragment, 47, fragmentName);
|
|
2669
2624
|
var mode = getFragmentMaskMode(selection);
|
|
2670
2625
|
if (mode !== "mask") {
|
|
2671
2626
|
value = maskSelectionSet(data, fragment.selectionSet, context, mode === "migrate", path);
|
|
@@ -2688,7 +2643,7 @@ function getAccessorWarningDescriptor(fieldName, value, path, operationName, ope
|
|
|
2688
2643
|
if (disableWarningsSlot.getValue()) {
|
|
2689
2644
|
return value;
|
|
2690
2645
|
}
|
|
2691
|
-
globalThis.__DEV__ !== false && invariant.warn(
|
|
2646
|
+
globalThis.__DEV__ !== false && invariant.warn(48, operationName ?
|
|
2692
2647
|
"".concat(operationType, " '").concat(operationName, "'")
|
|
2693
2648
|
: "anonymous ".concat(operationType), "".concat(path, ".").concat(fieldName).replace(/^\./, ""));
|
|
2694
2649
|
getValue = function () { return value; };
|
|
@@ -2705,12 +2660,60 @@ function getAccessorWarningDescriptor(fieldName, value, path, operationName, ope
|
|
|
2705
2660
|
configurable: true,
|
|
2706
2661
|
};
|
|
2707
2662
|
}
|
|
2708
|
-
|
|
2709
|
-
function
|
|
2710
|
-
if (!
|
|
2711
|
-
|
|
2712
|
-
|
|
2663
|
+
|
|
2664
|
+
function maskFragment(data, document, cache, fragmentName) {
|
|
2665
|
+
if (!cache.fragmentMatches) {
|
|
2666
|
+
if (globalThis.__DEV__ !== false) {
|
|
2667
|
+
warnOnImproperCacheImplementation();
|
|
2668
|
+
}
|
|
2669
|
+
return data;
|
|
2670
|
+
}
|
|
2671
|
+
var fragments = document.definitions.filter(function (node) {
|
|
2672
|
+
return node.kind === graphql.Kind.FRAGMENT_DEFINITION;
|
|
2673
|
+
});
|
|
2674
|
+
if (typeof fragmentName === "undefined") {
|
|
2675
|
+
invariant(fragments.length === 1, 49, fragments.length);
|
|
2676
|
+
fragmentName = fragments[0].name.value;
|
|
2677
|
+
}
|
|
2678
|
+
var fragment = fragments.find(function (fragment) { return fragment.name.value === fragmentName; });
|
|
2679
|
+
invariant(!!fragment, 50, fragmentName);
|
|
2680
|
+
if (data == null) {
|
|
2681
|
+
return data;
|
|
2682
|
+
}
|
|
2683
|
+
if (equal__default(data, {})) {
|
|
2684
|
+
return data;
|
|
2685
|
+
}
|
|
2686
|
+
return maskDefinition(data, fragment.selectionSet, {
|
|
2687
|
+
operationType: "fragment",
|
|
2688
|
+
operationName: fragment.name.value,
|
|
2689
|
+
fragmentMap: createFragmentMap(getFragmentDefinitions(document)),
|
|
2690
|
+
cache: cache,
|
|
2691
|
+
mutableTargets: new MapImpl(),
|
|
2692
|
+
knownChanged: new SetImpl(),
|
|
2693
|
+
});
|
|
2694
|
+
}
|
|
2695
|
+
|
|
2696
|
+
function maskOperation(data, document, cache) {
|
|
2697
|
+
var _a;
|
|
2698
|
+
if (!cache.fragmentMatches) {
|
|
2699
|
+
if (globalThis.__DEV__ !== false) {
|
|
2700
|
+
warnOnImproperCacheImplementation();
|
|
2701
|
+
}
|
|
2702
|
+
return data;
|
|
2713
2703
|
}
|
|
2704
|
+
var definition = getOperationDefinition(document);
|
|
2705
|
+
invariant(definition, 51);
|
|
2706
|
+
if (data == null) {
|
|
2707
|
+
return data;
|
|
2708
|
+
}
|
|
2709
|
+
return maskDefinition(data, definition.selectionSet, {
|
|
2710
|
+
operationType: definition.operation,
|
|
2711
|
+
operationName: (_a = definition.name) === null || _a === void 0 ? void 0 : _a.value,
|
|
2712
|
+
fragmentMap: createFragmentMap(getFragmentDefinitions(document)),
|
|
2713
|
+
cache: cache,
|
|
2714
|
+
mutableTargets: new MapImpl(),
|
|
2715
|
+
knownChanged: new SetImpl(),
|
|
2716
|
+
});
|
|
2714
2717
|
}
|
|
2715
2718
|
|
|
2716
2719
|
var ApolloCache = (function () {
|