@apollo/client 3.14.0-rc.0 → 3.14.1
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 +44 -0
- package/apollo-client.cjs +85 -77
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/cache/cache.cjs +14 -41
- package/cache/cache.cjs.map +1 -1
- package/cache/cache.cjs.native.js +14 -41
- package/cache/core/cache.js +1 -1
- package/cache/core/cache.js.map +1 -1
- package/cache/inmemory/inMemoryCache.js +1 -1
- package/cache/inmemory/inMemoryCache.js.map +1 -1
- package/core/ApolloClient.js +1 -1
- package/core/ApolloClient.js.map +1 -1
- package/core/ObservableQuery.d.ts +1 -0
- package/core/ObservableQuery.js +10 -6
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryInfo.js +1 -1
- package/core/QueryInfo.js.map +1 -1
- package/core/QueryManager.js +1 -1
- package/core/QueryManager.js.map +1 -1
- package/core/core.cjs +38 -61
- package/core/core.cjs.map +1 -1
- package/core/core.cjs.native.js +38 -61
- package/dev/dev.cjs +49 -53
- package/dev/dev.cjs.map +1 -1
- package/dev/dev.cjs.native.js +49 -53
- package/invariantErrorCodes.js +48 -53
- package/link/core/ApolloLink.js +1 -1
- package/link/core/ApolloLink.js.map +1 -1
- package/link/core/core.cjs +1 -15
- package/link/core/core.cjs.map +1 -1
- package/link/core/core.cjs.native.js +1 -15
- package/package.json +1 -1
- package/react/components/components.cjs +2 -14
- package/react/components/components.cjs.map +1 -1
- package/react/components/components.cjs.native.js +2 -14
- package/react/hoc/graphql.js +1 -1
- package/react/hoc/graphql.js.map +1 -1
- package/react/hoc/hoc.cjs +12 -31
- package/react/hoc/hoc.cjs.map +1 -1
- package/react/hoc/hoc.cjs.native.js +12 -31
- package/react/hoc/mutation-hoc.js +1 -1
- 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/hooks/hooks.cjs +26 -52
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/hooks.cjs.native.js +26 -52
- package/react/hooks/internal/useWarnRemoved.d.ts +1 -1
- package/react/hooks/internal/useWarnRemoved.js +1 -1
- package/react/hooks/internal/useWarnRemoved.js.map +1 -1
- package/react/hooks/internal/useWarnRemovedOption.d.ts +2 -1
- package/react/hooks/internal/useWarnRemovedOption.js +7 -5
- package/react/hooks/internal/useWarnRemovedOption.js.map +1 -1
- package/react/hooks/useApolloClient.js +1 -1
- package/react/hooks/useBackgroundQuery.js +1 -1
- package/react/hooks/useBackgroundQuery.js.map +1 -1
- package/react/hooks/useFragment.js +1 -1
- package/react/hooks/useFragment.js.map +1 -1
- package/react/hooks/useLazyQuery.js +3 -3
- package/react/hooks/useLazyQuery.js.map +1 -1
- package/react/hooks/useLoadableQuery.js +3 -3
- package/react/hooks/useLoadableQuery.js.map +1 -1
- package/react/hooks/useQuery.js +3 -3
- package/react/hooks/useQuery.js.map +1 -1
- package/react/hooks/useSubscription.js +3 -3
- package/react/hooks/useSuspenseQuery.js +3 -3
- package/react/hooks/useSuspenseQuery.js.map +1 -1
- package/react/hooks/useSyncExternalStore.js +1 -1
- package/react/internal/cache/QueryReference.js +2 -2
- package/react/internal/cache/QueryReference.js.map +1 -1
- package/react/internal/internal.cjs +3 -14
- package/react/internal/internal.cjs.map +1 -1
- package/react/internal/internal.cjs.native.js +3 -14
- package/react/parser/index.js +7 -7
- package/react/parser/index.js.map +1 -1
- package/react/parser/parser.cjs +9 -29
- package/react/parser/parser.cjs.map +1 -1
- package/react/parser/parser.cjs.native.js +9 -29
- package/react/query-preloader/createQueryPreloader.js +1 -1
- package/react/query-preloader/createQueryPreloader.js.map +1 -1
- package/react/react.cjs +4 -31
- package/react/react.cjs.map +1 -1
- package/react/react.cjs.native.js +4 -31
- package/testing/core/core.cjs +4 -4
- package/testing/core/core.cjs.map +1 -1
- package/testing/core/core.cjs.native.js +4 -4
- package/testing/core/mocking/mockLink.d.ts +13 -0
- package/testing/core/mocking/mockLink.js +4 -4
- package/testing/core/mocking/mockLink.js.map +1 -1
- package/testing/internal/disposables/index.d.ts +1 -0
- package/testing/internal/disposables/index.js +1 -0
- package/testing/internal/disposables/index.js.map +1 -1
- package/testing/internal/disposables/withMutedDeprecations.d.ts +4 -0
- package/testing/internal/disposables/withMutedDeprecations.js +13 -0
- package/testing/internal/disposables/withMutedDeprecations.js.map +1 -0
- package/testing/react/MockedProvider.js +1 -1
- package/testing/react/MockedProvider.js.map +1 -1
- package/testing/testing.cjs +5 -32
- package/testing/testing.cjs.map +1 -1
- package/testing/testing.cjs.native.js +5 -32
- package/utilities/deprecation/index.d.ts +0 -3
- package/utilities/deprecation/index.js +4 -12
- package/utilities/deprecation/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/utilities/graphql/DocumentTransform.js +1 -1
- package/utilities/graphql/directives.js +7 -7
- package/utilities/graphql/fragments.js +3 -3
- package/utilities/graphql/getFromAST.js +8 -8
- package/utilities/graphql/storeUtils.js +1 -1
- package/utilities/graphql/transform.js +2 -2
- package/utilities/index.d.ts +2 -0
- package/utilities/index.js +1 -0
- package/utilities/index.js.map +1 -1
- package/utilities/utilities.cjs +54 -22
- package/utilities/utilities.cjs.map +1 -1
- package/utilities/utilities.cjs.native.js +54 -22
- package/version.js +1 -1
- package/.changeset/breezy-lions-rule.md +0 -5
- package/.changeset/chilled-cameras-scream.md +0 -5
- package/.changeset/great-jobs-fetch.md +0 -5
- package/.changeset/great-suns-cover.md +0 -5
- package/.changeset/perfect-donuts-roll.md +0 -5
- package/.changeset/popular-waves-drop.md +0 -5
- package/.changeset/pre.json +0 -20
- package/.changeset/shy-boxes-exercise.md +0 -5
- package/.changeset/shy-dragons-tease.md +0 -5
- package/.changeset/smooth-countries-cough.md +0 -5
- package/.changeset/spotty-walls-repair.md +0 -5
- package/.changeset/tidy-bulldogs-exercise.md +0 -5
package/cache/cache.cjs
CHANGED
|
@@ -127,33 +127,6 @@ function directiveIsNonreactive(dir) {
|
|
|
127
127
|
return dir.name.value === "nonreactive";
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
-
var muteAllDeprecations = Symbol.for("apollo.deprecations");
|
|
131
|
-
var global = globals.global;
|
|
132
|
-
var slot = new optimism.Slot();
|
|
133
|
-
function isMuted(name) {
|
|
134
|
-
return global[muteAllDeprecations] || (slot.getValue() || []).includes(name);
|
|
135
|
-
}
|
|
136
|
-
function muteDeprecations(name) {
|
|
137
|
-
var args = [];
|
|
138
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
139
|
-
args[_i - 1] = arguments[_i];
|
|
140
|
-
}
|
|
141
|
-
return slot.withValue.apply(slot, tslib.__spreadArray([Array.isArray(name) ? name : [name]], args, false));
|
|
142
|
-
}
|
|
143
|
-
function warnRemovedOption(options, name, callSite, recommendation) {
|
|
144
|
-
if (recommendation === void 0) { recommendation = "Please remove this option."; }
|
|
145
|
-
warnDeprecated(name, function () {
|
|
146
|
-
if (name in options) {
|
|
147
|
-
globalThis.__DEV__ !== false && globals.invariant.warn(104, callSite, name, recommendation);
|
|
148
|
-
}
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
function warnDeprecated(name, cb) {
|
|
152
|
-
if (!isMuted(name)) {
|
|
153
|
-
cb();
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
|
|
157
130
|
var ApolloCache = (function () {
|
|
158
131
|
function ApolloCache() {
|
|
159
132
|
this.assumeImmutableResults = false;
|
|
@@ -197,9 +170,9 @@ var ApolloCache = (function () {
|
|
|
197
170
|
var _this = this;
|
|
198
171
|
if (optimistic === void 0) { optimistic = !!options.optimistic; }
|
|
199
172
|
if (globalThis.__DEV__ !== false) {
|
|
200
|
-
warnRemovedOption(options, "canonizeResults", "cache.readQuery");
|
|
173
|
+
utilities.warnRemovedOption(options, "canonizeResults", "cache.readQuery");
|
|
201
174
|
}
|
|
202
|
-
return muteDeprecations("canonizeResults", function () {
|
|
175
|
+
return utilities.muteDeprecations("canonizeResults", function () {
|
|
203
176
|
return _this.read(tslib.__assign(tslib.__assign({}, options), { rootId: options.id || "ROOT_QUERY", optimistic: optimistic }));
|
|
204
177
|
});
|
|
205
178
|
};
|
|
@@ -246,9 +219,9 @@ var ApolloCache = (function () {
|
|
|
246
219
|
var _this = this;
|
|
247
220
|
if (optimistic === void 0) { optimistic = !!options.optimistic; }
|
|
248
221
|
if (globalThis.__DEV__ !== false) {
|
|
249
|
-
warnRemovedOption(options, "canonizeResults", "cache.readFragment");
|
|
222
|
+
utilities.warnRemovedOption(options, "canonizeResults", "cache.readFragment");
|
|
250
223
|
}
|
|
251
|
-
return muteDeprecations("canonizeResults", function () {
|
|
224
|
+
return utilities.muteDeprecations("canonizeResults", function () {
|
|
252
225
|
return _this.read(tslib.__assign(tslib.__assign({}, options), { query: _this.getFragmentDoc(options.fragment, options.fragmentName), rootId: options.id, optimistic: optimistic }));
|
|
253
226
|
});
|
|
254
227
|
};
|
|
@@ -269,11 +242,11 @@ var ApolloCache = (function () {
|
|
|
269
242
|
};
|
|
270
243
|
ApolloCache.prototype.updateQuery = function (options, update) {
|
|
271
244
|
if (globalThis.__DEV__ !== false) {
|
|
272
|
-
warnRemovedOption(options, "canonizeResults", "cache.updateQuery");
|
|
245
|
+
utilities.warnRemovedOption(options, "canonizeResults", "cache.updateQuery");
|
|
273
246
|
}
|
|
274
247
|
return this.batch({
|
|
275
248
|
update: function (cache) {
|
|
276
|
-
var value = muteDeprecations("canonizeResults", function () {
|
|
249
|
+
var value = utilities.muteDeprecations("canonizeResults", function () {
|
|
277
250
|
return cache.readQuery(options);
|
|
278
251
|
});
|
|
279
252
|
var data = update(value);
|
|
@@ -286,11 +259,11 @@ var ApolloCache = (function () {
|
|
|
286
259
|
};
|
|
287
260
|
ApolloCache.prototype.updateFragment = function (options, update) {
|
|
288
261
|
if (globalThis.__DEV__ !== false) {
|
|
289
|
-
warnRemovedOption(options, "canonizeResults", "cache.updateFragment");
|
|
262
|
+
utilities.warnRemovedOption(options, "canonizeResults", "cache.updateFragment");
|
|
290
263
|
}
|
|
291
264
|
return this.batch({
|
|
292
265
|
update: function (cache) {
|
|
293
|
-
var value = muteDeprecations("canonizeResults", function () {
|
|
266
|
+
var value = utilities.muteDeprecations("canonizeResults", function () {
|
|
294
267
|
return cache.readFragment(options);
|
|
295
268
|
});
|
|
296
269
|
var data = update(value);
|
|
@@ -2306,8 +2279,8 @@ var InMemoryCache = (function (_super) {
|
|
|
2306
2279
|
_this.makeVar = makeVar;
|
|
2307
2280
|
_this.txCount = 0;
|
|
2308
2281
|
if (globalThis.__DEV__ !== false) {
|
|
2309
|
-
warnRemovedOption(config, "addTypename", "InMemoryCache", "Please remove the `addTypename` option when initializing `InMemoryCache`.");
|
|
2310
|
-
warnRemovedOption(config, "canonizeResults", "InMemoryCache", "Please remove the `canonizeResults` option when initializing `InMemoryCache`.");
|
|
2282
|
+
utilities.warnRemovedOption(config, "addTypename", "InMemoryCache", "Please remove the `addTypename` option when initializing `InMemoryCache`.");
|
|
2283
|
+
utilities.warnRemovedOption(config, "canonizeResults", "InMemoryCache", "Please remove the `canonizeResults` option when initializing `InMemoryCache`.");
|
|
2311
2284
|
}
|
|
2312
2285
|
_this.config = normalizeConfig(config);
|
|
2313
2286
|
_this.addTypename = !!_this.config.addTypename;
|
|
@@ -2373,7 +2346,7 @@ var InMemoryCache = (function (_super) {
|
|
|
2373
2346
|
};
|
|
2374
2347
|
InMemoryCache.prototype.read = function (options) {
|
|
2375
2348
|
if (globalThis.__DEV__ !== false) {
|
|
2376
|
-
warnRemovedOption(options, "canonizeResults", "cache.read");
|
|
2349
|
+
utilities.warnRemovedOption(options, "canonizeResults", "cache.read");
|
|
2377
2350
|
}
|
|
2378
2351
|
var
|
|
2379
2352
|
_a = options.returnPartialData,
|
|
@@ -2419,7 +2392,7 @@ var InMemoryCache = (function (_super) {
|
|
|
2419
2392
|
};
|
|
2420
2393
|
InMemoryCache.prototype.diff = function (options) {
|
|
2421
2394
|
if (globalThis.__DEV__ !== false) {
|
|
2422
|
-
warnRemovedOption(options, "canonizeResults", "cache.diff");
|
|
2395
|
+
utilities.warnRemovedOption(options, "canonizeResults", "cache.diff");
|
|
2423
2396
|
}
|
|
2424
2397
|
return this.storeReader.diffQueryAgainstStore(tslib.__assign(tslib.__assign({}, options), { store: options.optimistic ? this.optimisticData : this.data, rootId: options.id || "ROOT_QUERY", config: this.config }));
|
|
2425
2398
|
};
|
|
@@ -2441,7 +2414,7 @@ var InMemoryCache = (function (_super) {
|
|
|
2441
2414
|
};
|
|
2442
2415
|
InMemoryCache.prototype.gc = function (options) {
|
|
2443
2416
|
if (globalThis.__DEV__ !== false) {
|
|
2444
|
-
warnRemovedOption(options || {}, "resetResultIdentities", "cache.gc", "First ensure all usages of `canonizeResults` are removed, then remove this option.");
|
|
2417
|
+
utilities.warnRemovedOption(options || {}, "resetResultIdentities", "cache.gc", "First ensure all usages of `canonizeResults` are removed, then remove this option.");
|
|
2445
2418
|
}
|
|
2446
2419
|
utilities.canonicalStringify.reset();
|
|
2447
2420
|
utilities.print.reset();
|
|
@@ -2600,7 +2573,7 @@ var InMemoryCache = (function (_super) {
|
|
|
2600
2573
|
InMemoryCache.prototype.broadcastWatch = function (c, options) {
|
|
2601
2574
|
var _this = this;
|
|
2602
2575
|
var lastDiff = c.lastDiff;
|
|
2603
|
-
var diff = muteDeprecations("canonizeResults", function () { return _this.diff(c); });
|
|
2576
|
+
var diff = utilities.muteDeprecations("canonizeResults", function () { return _this.diff(c); });
|
|
2604
2577
|
if (options) {
|
|
2605
2578
|
if (c.optimistic && typeof options.optimistic === "string") {
|
|
2606
2579
|
diff.fromOptimisticTransaction = true;
|