@apollo/client 3.14.0-alpha.0 → 3.14.0-rc.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/.changeset/breezy-lions-rule.md +5 -0
- package/.changeset/great-jobs-fetch.md +5 -0
- package/.changeset/pre.json +6 -2
- package/.changeset/shy-boxes-exercise.md +5 -0
- package/.changeset/tidy-bulldogs-exercise.md +5 -0
- package/CHANGELOG.md +16 -0
- package/README.md +2 -2
- package/apollo-client.cjs +187 -119
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/cache/cache.cjs +7 -2
- package/cache/cache.cjs.map +1 -1
- package/cache/cache.cjs.native.js +7 -2
- package/cache/inmemory/inMemoryCache.d.ts +8 -0
- package/cache/inmemory/inMemoryCache.js +3 -0
- package/cache/inmemory/inMemoryCache.js.map +1 -1
- package/core/ApolloClient.d.ts +9 -9
- package/core/ApolloClient.js +6 -1
- package/core/ApolloClient.js.map +1 -1
- package/core/LocalState.js +2 -2
- package/core/ObservableQuery.d.ts +51 -6
- package/core/ObservableQuery.js +89 -13
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryInfo.js +6 -3
- package/core/QueryInfo.js.map +1 -1
- package/core/QueryManager.js +14 -12
- package/core/QueryManager.js.map +1 -1
- package/core/core.cjs +85 -33
- package/core/core.cjs.map +1 -1
- package/core/core.cjs.native.js +85 -33
- package/core/types.d.ts +177 -3
- package/core/types.js.map +1 -1
- package/core/watchQueryOptions.d.ts +10 -2
- package/core/watchQueryOptions.js.map +1 -1
- package/dev/dev.cjs +149 -97
- package/dev/dev.cjs.map +1 -1
- package/dev/dev.cjs.native.js +149 -97
- package/errors/errors.cjs.map +1 -1
- package/errors/index.d.ts +19 -0
- package/errors/index.js +19 -0
- package/errors/index.js.map +1 -1
- package/invariantErrorCodes.js +161 -96
- package/link/batch-http/batch-http.cjs +9 -0
- package/link/batch-http/batch-http.cjs.map +1 -1
- package/link/batch-http/batch-http.cjs.native.js +9 -0
- package/link/batch-http/batchHttpLink.js +9 -0
- package/link/batch-http/batchHttpLink.js.map +1 -1
- package/link/core/ApolloLink.d.ts +8 -0
- package/link/core/ApolloLink.js +19 -2
- package/link/core/ApolloLink.js.map +1 -1
- package/link/core/core.cjs +24 -2
- package/link/core/core.cjs.map +1 -1
- package/link/core/core.cjs.native.js +24 -2
- package/link/core/types.d.ts +20 -0
- package/link/core/types.js.map +1 -1
- package/link/error/index.d.ts +48 -0
- package/link/error/index.js.map +1 -1
- package/link/http/checkFetcher.js +1 -1
- package/link/http/createHttpLink.js +4 -1
- package/link/http/createHttpLink.js.map +1 -1
- package/link/http/http.cjs +6 -3
- package/link/http/http.cjs.map +1 -1
- package/link/http/http.cjs.native.js +6 -3
- package/link/http/serializeFetchParameter.js +1 -1
- package/link/persisted-queries/index.d.ts +38 -0
- package/link/persisted-queries/index.js +2 -2
- package/link/persisted-queries/index.js.map +1 -1
- 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/fromError.d.ts +16 -0
- package/link/utils/fromError.js +16 -0
- package/link/utils/fromError.js.map +1 -1
- package/link/utils/fromPromise.d.ts +16 -0
- package/link/utils/fromPromise.js +16 -0
- package/link/utils/fromPromise.js.map +1 -1
- package/link/utils/throwServerError.d.ts +30 -0
- package/link/utils/throwServerError.js +17 -0
- package/link/utils/throwServerError.js.map +1 -1
- package/link/utils/toPromise.d.ts +16 -0
- package/link/utils/toPromise.js +17 -1
- package/link/utils/toPromise.js.map +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/maskDefinition.js +2 -2
- package/masking/maskFragment.js +2 -2
- package/masking/maskOperation.js +1 -1
- package/masking/masking.cjs +6 -6
- package/masking/masking.cjs.map +1 -1
- package/masking/masking.cjs.native.js +6 -6
- package/masking/utils.js +1 -1
- package/masking/utils.js.map +1 -1
- package/package.json +1 -1
- package/react/components/Mutation.js +1 -1
- package/react/components/Query.js +1 -1
- package/react/components/Subscription.js +1 -1
- package/react/components/components.cjs +6 -4
- package/react/components/components.cjs.map +1 -1
- package/react/components/components.cjs.native.js +6 -4
- package/react/context/ApolloConsumer.js +1 -1
- package/react/context/ApolloContext.js +2 -2
- package/react/context/ApolloProvider.js +1 -1
- package/react/context/context.cjs +4 -4
- package/react/context/context.cjs.map +1 -1
- package/react/context/context.cjs.native.js +4 -4
- package/react/hoc/graphql.js +1 -1
- package/react/hoc/hoc-utils.js +1 -1
- package/react/hoc/hoc.cjs +9 -7
- package/react/hoc/hoc.cjs.map +1 -1
- package/react/hoc/hoc.cjs.native.js +9 -7
- package/react/hoc/mutation-hoc.js +1 -1
- package/react/hoc/query-hoc.js +1 -1
- package/react/hoc/subscription-hoc.js +1 -1
- package/react/hoc/withApollo.js +1 -1
- package/react/hooks/hooks.cjs +18 -16
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/hooks.cjs.native.js +18 -16
- package/react/hooks/internal/useWarnRemoved.d.ts +2 -1
- package/react/hooks/internal/useWarnRemoved.js.map +1 -1
- package/react/hooks/internal/useWarnRemovedOption.js +1 -1
- package/react/hooks/useApolloClient.js +1 -1
- package/react/hooks/useLazyQuery.js +2 -2
- package/react/hooks/useLoadableQuery.js +2 -2
- package/react/hooks/useQuery.js +1 -1
- package/react/hooks/useSubscription.js +3 -3
- package/react/hooks/useSuspenseQuery.js +2 -2
- package/react/hooks/useSyncExternalStore.js +1 -1
- package/react/internal/cache/QueryReference.d.ts +1 -0
- package/react/internal/cache/QueryReference.js +5 -2
- package/react/internal/cache/QueryReference.js.map +1 -1
- package/react/internal/internal.cjs +16 -3
- package/react/internal/internal.cjs.map +1 -1
- package/react/internal/internal.cjs.native.js +16 -3
- package/react/parser/index.js +6 -6
- package/react/parser/parser.cjs +9 -7
- package/react/parser/parser.cjs.map +1 -1
- package/react/parser/parser.cjs.native.js +9 -7
- package/react/react.cjs +4 -2
- package/react/react.cjs.map +1 -1
- package/react/react.cjs.native.js +4 -2
- package/react/types/types.d.ts +40 -0
- package/react/types/types.documentation.d.ts +1 -1
- package/react/types/types.documentation.js.map +1 -1
- package/react/types/types.js.map +1 -1
- package/testing/core/core.cjs +17 -3
- package/testing/core/core.cjs.map +1 -1
- package/testing/core/core.cjs.native.js +17 -3
- package/testing/core/itAsync.d.ts +5 -0
- package/testing/core/itAsync.js +5 -0
- package/testing/core/itAsync.js.map +1 -1
- package/testing/core/mocking/mockClient.d.ts +4 -0
- package/testing/core/mocking/mockClient.js +4 -0
- package/testing/core/mocking/mockClient.js.map +1 -1
- package/testing/core/mocking/mockLink.d.ts +10 -0
- package/testing/core/mocking/mockLink.js +23 -4
- package/testing/core/mocking/mockLink.js.map +1 -1
- package/testing/core/mocking/mockSubscriptionLink.d.ts +4 -0
- package/testing/core/mocking/mockSubscriptionLink.js +4 -0
- package/testing/core/mocking/mockSubscriptionLink.js.map +1 -1
- package/testing/core/subscribeAndCount.d.ts +4 -0
- package/testing/core/subscribeAndCount.js +4 -0
- package/testing/core/subscribeAndCount.js.map +1 -1
- package/testing/experimental/createSchemaFetch.d.ts +1 -1
- package/testing/experimental/createSchemaFetch.js +1 -1
- package/testing/experimental/createSchemaFetch.js.map +1 -1
- package/testing/experimental/createTestSchema.d.ts +1 -1
- package/testing/experimental/createTestSchema.js +1 -1
- package/testing/experimental/createTestSchema.js.map +1 -1
- package/testing/experimental/experimental.cjs.map +1 -1
- package/testing/testing.cjs +4 -2
- package/testing/testing.cjs.map +1 -1
- package/testing/testing.cjs.native.js +4 -2
- package/utilities/deprecation/index.d.ts +83 -3
- package/utilities/deprecation/index.js +15 -3
- 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/observables/asyncMap.d.ts +13 -0
- package/utilities/observables/asyncMap.js +13 -0
- package/utilities/observables/asyncMap.js.map +1 -1
- package/utilities/observables/iteration.d.ts +4 -0
- package/utilities/observables/iteration.js +4 -0
- package/utilities/observables/iteration.js.map +1 -1
- package/utilities/subscriptions/urql/index.d.ts +5 -0
- package/utilities/subscriptions/urql/index.js +5 -0
- package/utilities/subscriptions/urql/index.js.map +1 -1
- package/utilities/subscriptions/urql/urql.cjs.map +1 -1
- package/utilities/utilities.cjs +22 -22
- package/utilities/utilities.cjs.map +1 -1
- package/utilities/utilities.cjs.native.js +22 -22
- package/version.js +1 -1
package/core/core.cjs
CHANGED
|
@@ -22,7 +22,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
22
22
|
|
|
23
23
|
var equal__default = /*#__PURE__*/_interopDefaultLegacy(equal);
|
|
24
24
|
|
|
25
|
-
var version = "3.14.0-
|
|
25
|
+
var version = "3.14.0-rc.0";
|
|
26
26
|
|
|
27
27
|
function isNonNullObject(obj) {
|
|
28
28
|
return obj !== null && typeof obj === "object";
|
|
@@ -195,9 +195,11 @@ function directiveIsNonreactive(dir) {
|
|
|
195
195
|
return dir.name.value === "nonreactive";
|
|
196
196
|
}
|
|
197
197
|
|
|
198
|
+
var muteAllDeprecations = Symbol.for("apollo.deprecations");
|
|
199
|
+
var global = globals.global;
|
|
198
200
|
var slot = new optimism.Slot();
|
|
199
201
|
function isMuted(name) {
|
|
200
|
-
return (slot.getValue() || []).includes(name);
|
|
202
|
+
return global[muteAllDeprecations] || (slot.getValue() || []).includes(name);
|
|
201
203
|
}
|
|
202
204
|
function muteDeprecations(name) {
|
|
203
205
|
var args = [];
|
|
@@ -210,7 +212,7 @@ function warnRemovedOption(options, name, callSite, recommendation) {
|
|
|
210
212
|
if (recommendation === void 0) { recommendation = "Please remove this option."; }
|
|
211
213
|
warnDeprecated(name, function () {
|
|
212
214
|
if (name in options) {
|
|
213
|
-
globalThis.__DEV__ !== false && globals.invariant.warn(
|
|
215
|
+
globalThis.__DEV__ !== false && globals.invariant.warn(104, callSite, name, recommendation);
|
|
214
216
|
}
|
|
215
217
|
});
|
|
216
218
|
}
|
|
@@ -294,6 +296,11 @@ var ObservableQuery = (function (_super) {
|
|
|
294
296
|
});
|
|
295
297
|
ObservableQuery.prototype.result = function () {
|
|
296
298
|
var _this = this;
|
|
299
|
+
if (globalThis.__DEV__ !== false) {
|
|
300
|
+
warnDeprecated("observableQuery.result", function () {
|
|
301
|
+
globalThis.__DEV__ !== false && globals.invariant.warn(23);
|
|
302
|
+
});
|
|
303
|
+
}
|
|
297
304
|
return new Promise(function (resolve, reject) {
|
|
298
305
|
var observer = {
|
|
299
306
|
next: function (result) {
|
|
@@ -315,8 +322,11 @@ var ObservableQuery = (function (_super) {
|
|
|
315
322
|
this.queryInfo.resetDiff();
|
|
316
323
|
};
|
|
317
324
|
ObservableQuery.prototype.getCurrentFullResult = function (saveAsLastResult) {
|
|
325
|
+
var _this = this;
|
|
318
326
|
if (saveAsLastResult === void 0) { saveAsLastResult = true; }
|
|
319
|
-
var lastResult =
|
|
327
|
+
var lastResult = muteDeprecations("getLastResult", function () {
|
|
328
|
+
return _this.getLastResult(true);
|
|
329
|
+
});
|
|
320
330
|
var networkStatus = this.queryInfo.networkStatus ||
|
|
321
331
|
(lastResult && lastResult.networkStatus) ||
|
|
322
332
|
exports.NetworkStatus.ready;
|
|
@@ -391,16 +401,34 @@ var ObservableQuery = (function (_super) {
|
|
|
391
401
|
}
|
|
392
402
|
};
|
|
393
403
|
ObservableQuery.prototype.getLastResult = function (variablesMustMatch) {
|
|
404
|
+
if (globalThis.__DEV__ !== false) {
|
|
405
|
+
warnDeprecated("getLastResult", function () {
|
|
406
|
+
globalThis.__DEV__ !== false && globals.invariant.warn(24);
|
|
407
|
+
});
|
|
408
|
+
}
|
|
394
409
|
return this.getLast("result", variablesMustMatch);
|
|
395
410
|
};
|
|
396
411
|
ObservableQuery.prototype.getLastError = function (variablesMustMatch) {
|
|
412
|
+
if (globalThis.__DEV__ !== false) {
|
|
413
|
+
warnDeprecated("getLastError", function () {
|
|
414
|
+
globalThis.__DEV__ !== false && globals.invariant.warn(25);
|
|
415
|
+
});
|
|
416
|
+
}
|
|
397
417
|
return this.getLast("error", variablesMustMatch);
|
|
398
418
|
};
|
|
399
419
|
ObservableQuery.prototype.resetLastResults = function () {
|
|
420
|
+
if (globalThis.__DEV__ !== false) {
|
|
421
|
+
warnDeprecated("resetLastResults", function () {
|
|
422
|
+
globalThis.__DEV__ !== false && globals.invariant.warn(26);
|
|
423
|
+
});
|
|
424
|
+
}
|
|
400
425
|
delete this.last;
|
|
401
426
|
this.isTornDown = false;
|
|
402
427
|
};
|
|
403
428
|
ObservableQuery.prototype.resetQueryStoreErrors = function () {
|
|
429
|
+
if (globalThis.__DEV__ !== false) {
|
|
430
|
+
globalThis.__DEV__ !== false && globals.invariant.warn(27);
|
|
431
|
+
}
|
|
404
432
|
this.queryManager.resetErrors(this.queryId);
|
|
405
433
|
};
|
|
406
434
|
ObservableQuery.prototype.refetch = function (variables) {
|
|
@@ -420,7 +448,7 @@ var ObservableQuery = (function (_super) {
|
|
|
420
448
|
var vars = queryDef.variableDefinitions;
|
|
421
449
|
if (!vars || !vars.some(function (v) { return v.variable.name.value === "variables"; })) {
|
|
422
450
|
globalThis.__DEV__ !== false && globals.invariant.warn(
|
|
423
|
-
|
|
451
|
+
28,
|
|
424
452
|
variables,
|
|
425
453
|
((_a = queryDef.name) === null || _a === void 0 ? void 0 : _a.value) || queryDef
|
|
426
454
|
);
|
|
@@ -452,7 +480,7 @@ var ObservableQuery = (function (_super) {
|
|
|
452
480
|
var updateQuery = fetchMoreOptions === null || fetchMoreOptions === void 0 ? void 0 : fetchMoreOptions.updateQuery;
|
|
453
481
|
var isCached = this.options.fetchPolicy !== "no-cache";
|
|
454
482
|
if (!isCached) {
|
|
455
|
-
globals.invariant(updateQuery,
|
|
483
|
+
globals.invariant(updateQuery, 29);
|
|
456
484
|
}
|
|
457
485
|
return this.queryManager
|
|
458
486
|
.fetchQuery(qid, combinedOptions, exports.NetworkStatus.fetchMore)
|
|
@@ -529,7 +557,7 @@ var ObservableQuery = (function (_super) {
|
|
|
529
557
|
options.onError(err);
|
|
530
558
|
return;
|
|
531
559
|
}
|
|
532
|
-
globalThis.__DEV__ !== false && globals.invariant.error(
|
|
560
|
+
globalThis.__DEV__ !== false && globals.invariant.error(30, err);
|
|
533
561
|
},
|
|
534
562
|
});
|
|
535
563
|
this.subscriptions.add(subscription);
|
|
@@ -542,6 +570,9 @@ var ObservableQuery = (function (_super) {
|
|
|
542
570
|
ObservableQuery.prototype.setOptions = function (newOptions) {
|
|
543
571
|
if (globalThis.__DEV__ !== false) {
|
|
544
572
|
warnRemovedOption(newOptions, "canonizeResults", "setOptions");
|
|
573
|
+
warnDeprecated("setOptions", function () {
|
|
574
|
+
globalThis.__DEV__ !== false && globals.invariant.warn(31);
|
|
575
|
+
});
|
|
545
576
|
}
|
|
546
577
|
return this.reobserve(newOptions);
|
|
547
578
|
};
|
|
@@ -550,8 +581,11 @@ var ObservableQuery = (function (_super) {
|
|
|
550
581
|
assign(this.options, mergedOptions);
|
|
551
582
|
};
|
|
552
583
|
ObservableQuery.prototype.setVariables = function (variables) {
|
|
584
|
+
var _this = this;
|
|
553
585
|
if (equal.equal(this.variables, variables)) {
|
|
554
|
-
return this.observers.size ?
|
|
586
|
+
return this.observers.size ?
|
|
587
|
+
muteDeprecations("observableQuery.result", function () { return _this.result(); })
|
|
588
|
+
: Promise.resolve();
|
|
555
589
|
}
|
|
556
590
|
this.options.variables = variables;
|
|
557
591
|
if (!this.observers.size) {
|
|
@@ -635,7 +669,7 @@ var ObservableQuery = (function (_super) {
|
|
|
635
669
|
if (pollingInfo && pollingInfo.interval === pollInterval) {
|
|
636
670
|
return;
|
|
637
671
|
}
|
|
638
|
-
globals.invariant(pollInterval,
|
|
672
|
+
globals.invariant(pollInterval, 32);
|
|
639
673
|
var info = pollingInfo || (this.pollingInfo = {});
|
|
640
674
|
info.interval = pollInterval;
|
|
641
675
|
var maybeFetch = function () {
|
|
@@ -664,8 +698,11 @@ var ObservableQuery = (function (_super) {
|
|
|
664
698
|
poll();
|
|
665
699
|
};
|
|
666
700
|
ObservableQuery.prototype.updateLastResult = function (newResult, variables) {
|
|
701
|
+
var _this = this;
|
|
667
702
|
if (variables === void 0) { variables = this.variables; }
|
|
668
|
-
var error =
|
|
703
|
+
var error = muteDeprecations("getLastError", function () {
|
|
704
|
+
return _this.getLastError();
|
|
705
|
+
});
|
|
669
706
|
if (error && this.last && !equal.equal(variables, this.last.variables)) {
|
|
670
707
|
error = void 0;
|
|
671
708
|
}
|
|
@@ -741,12 +778,13 @@ var ObservableQuery = (function (_super) {
|
|
|
741
778
|
return utilities.preventUnhandledRejection(this.reobserveAsConcast(newOptions, newNetworkStatus).promise.then(this.maskResult));
|
|
742
779
|
};
|
|
743
780
|
ObservableQuery.prototype.resubscribeAfterError = function () {
|
|
781
|
+
var _this = this;
|
|
744
782
|
var args = [];
|
|
745
783
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
746
784
|
args[_i] = arguments[_i];
|
|
747
785
|
}
|
|
748
786
|
var last = this.last;
|
|
749
|
-
|
|
787
|
+
muteDeprecations("resetLastResults", function () { return _this.resetLastResults(); });
|
|
750
788
|
var subscription = this.subscribe.apply(this, args);
|
|
751
789
|
this.last = last;
|
|
752
790
|
return subscription;
|
|
@@ -756,7 +794,10 @@ var ObservableQuery = (function (_super) {
|
|
|
756
794
|
this.getCurrentFullResult(false), this.variables);
|
|
757
795
|
};
|
|
758
796
|
ObservableQuery.prototype.reportResult = function (result, variables) {
|
|
759
|
-
var
|
|
797
|
+
var _this = this;
|
|
798
|
+
var lastError = muteDeprecations("getLastError", function () {
|
|
799
|
+
return _this.getLastError();
|
|
800
|
+
});
|
|
760
801
|
var isDifferent = this.isDifferentFromLastResult(result, variables);
|
|
761
802
|
if (lastError || !result.partial || this.options.returnPartialData) {
|
|
762
803
|
this.updateLastResult(result, variables);
|
|
@@ -766,7 +807,8 @@ var ObservableQuery = (function (_super) {
|
|
|
766
807
|
}
|
|
767
808
|
};
|
|
768
809
|
ObservableQuery.prototype.reportError = function (error, variables) {
|
|
769
|
-
var
|
|
810
|
+
var _this = this;
|
|
811
|
+
var errorResult = tslib.__assign(tslib.__assign({}, muteDeprecations("getLastResult", function () { return _this.getLastResult(); })), { error: error, errors: error.graphQLErrors, networkStatus: exports.NetworkStatus.error, loading: false });
|
|
770
812
|
this.updateLastResult(errorResult, variables);
|
|
771
813
|
utilities.iterateObserversSafely(this.observers, "error", (this.last.error = error));
|
|
772
814
|
};
|
|
@@ -856,11 +898,11 @@ var ObservableQuery = (function (_super) {
|
|
|
856
898
|
}(utilities.Observable));
|
|
857
899
|
utilities.fixObservableSubclass(ObservableQuery);
|
|
858
900
|
function defaultSubscriptionObserverErrorCallback(error) {
|
|
859
|
-
globalThis.__DEV__ !== false && globals.invariant.error(
|
|
901
|
+
globalThis.__DEV__ !== false && globals.invariant.error(33, error.message, error.stack);
|
|
860
902
|
}
|
|
861
903
|
function logMissingFieldErrors(missing) {
|
|
862
904
|
if (globalThis.__DEV__ !== false && missing) {
|
|
863
|
-
globalThis.__DEV__ !== false && globals.invariant.debug(
|
|
905
|
+
globalThis.__DEV__ !== false && globals.invariant.debug(34, missing);
|
|
864
906
|
}
|
|
865
907
|
}
|
|
866
908
|
function skipCacheDataFor(fetchPolicy ) {
|
|
@@ -963,14 +1005,17 @@ var QueryInfo = (function () {
|
|
|
963
1005
|
};
|
|
964
1006
|
};
|
|
965
1007
|
QueryInfo.prototype.setDiff = function (diff) {
|
|
966
|
-
var
|
|
1008
|
+
var _this = this;
|
|
1009
|
+
var _a;
|
|
967
1010
|
var oldDiff = this.lastDiff && this.lastDiff.diff;
|
|
968
|
-
if (diff &&
|
|
1011
|
+
if (diff &&
|
|
1012
|
+
!diff.complete &&
|
|
1013
|
+
muteDeprecations("getLastError", function () { var _a; return (_a = _this.observableQuery) === null || _a === void 0 ? void 0 : _a.getLastError(); })) {
|
|
969
1014
|
return;
|
|
970
1015
|
}
|
|
971
1016
|
this.updateLastDiff(diff);
|
|
972
1017
|
if (!equal.equal(oldDiff && oldDiff.result, diff && diff.result)) {
|
|
973
|
-
(
|
|
1018
|
+
(_a = this.observableQuery) === null || _a === void 0 ? void 0 : _a["scheduleNotify"]();
|
|
974
1019
|
}
|
|
975
1020
|
};
|
|
976
1021
|
QueryInfo.prototype.setObservableQuery = function (oq) {
|
|
@@ -1150,7 +1195,7 @@ var QueryManager = (function () {
|
|
|
1150
1195
|
this.queries.forEach(function (_info, queryId) {
|
|
1151
1196
|
_this.stopQueryNoBroadcast(queryId);
|
|
1152
1197
|
});
|
|
1153
|
-
this.cancelPendingFetches(globals.newInvariantError(
|
|
1198
|
+
this.cancelPendingFetches(globals.newInvariantError(35));
|
|
1154
1199
|
};
|
|
1155
1200
|
QueryManager.prototype.cancelPendingFetches = function (error) {
|
|
1156
1201
|
this.fetchCancelFns.forEach(function (cancel) { return cancel(error); });
|
|
@@ -1164,8 +1209,8 @@ var QueryManager = (function () {
|
|
|
1164
1209
|
return tslib.__generator(this, function (_j) {
|
|
1165
1210
|
switch (_j.label) {
|
|
1166
1211
|
case 0:
|
|
1167
|
-
globals.invariant(mutation,
|
|
1168
|
-
globals.invariant(fetchPolicy === "network-only" || fetchPolicy === "no-cache",
|
|
1212
|
+
globals.invariant(mutation, 36);
|
|
1213
|
+
globals.invariant(fetchPolicy === "network-only" || fetchPolicy === "no-cache", 37);
|
|
1169
1214
|
mutationId = this.generateMutationId();
|
|
1170
1215
|
mutation = this.cache.transformForLink(this.transform(mutation));
|
|
1171
1216
|
hasClientExports = this.getDocumentInfo(mutation).hasClientExports;
|
|
@@ -1495,10 +1540,10 @@ var QueryManager = (function () {
|
|
|
1495
1540
|
QueryManager.prototype.query = function (options, queryId) {
|
|
1496
1541
|
var _this = this;
|
|
1497
1542
|
if (queryId === void 0) { queryId = this.generateQueryId(); }
|
|
1498
|
-
globals.invariant(options.query,
|
|
1499
|
-
globals.invariant(options.query.kind === "Document",
|
|
1500
|
-
globals.invariant(!options.returnPartialData,
|
|
1501
|
-
globals.invariant(!options.pollInterval,
|
|
1543
|
+
globals.invariant(options.query, 38);
|
|
1544
|
+
globals.invariant(options.query.kind === "Document", 39);
|
|
1545
|
+
globals.invariant(!options.returnPartialData, 40);
|
|
1546
|
+
globals.invariant(!options.pollInterval, 41);
|
|
1502
1547
|
var query = this.transform(options.query);
|
|
1503
1548
|
return this.fetchQuery(queryId, tslib.__assign(tslib.__assign({}, options), { query: query }))
|
|
1504
1549
|
.then(function (result) {
|
|
@@ -1533,7 +1578,7 @@ var QueryManager = (function () {
|
|
|
1533
1578
|
if (options === void 0) { options = {
|
|
1534
1579
|
discardWatches: true,
|
|
1535
1580
|
}; }
|
|
1536
|
-
this.cancelPendingFetches(globals.newInvariantError(
|
|
1581
|
+
this.cancelPendingFetches(globals.newInvariantError(42));
|
|
1537
1582
|
this.queries.forEach(function (queryInfo) {
|
|
1538
1583
|
if (queryInfo.observableQuery) {
|
|
1539
1584
|
queryInfo.networkStatus = exports.NetworkStatus.loading;
|
|
@@ -1615,10 +1660,10 @@ var QueryManager = (function () {
|
|
|
1615
1660
|
if (!included) {
|
|
1616
1661
|
var queryName = queryNames.get(nameOrQueryString);
|
|
1617
1662
|
if (queryName) {
|
|
1618
|
-
globalThis.__DEV__ !== false && globals.invariant.warn(
|
|
1663
|
+
globalThis.__DEV__ !== false && globals.invariant.warn(43, queryName);
|
|
1619
1664
|
}
|
|
1620
1665
|
else {
|
|
1621
|
-
globalThis.__DEV__ !== false && globals.invariant.warn(
|
|
1666
|
+
globalThis.__DEV__ !== false && globals.invariant.warn(44);
|
|
1622
1667
|
}
|
|
1623
1668
|
}
|
|
1624
1669
|
});
|
|
@@ -1631,7 +1676,9 @@ var QueryManager = (function () {
|
|
|
1631
1676
|
var observableQueryPromises = [];
|
|
1632
1677
|
this.getObservableQueries(includeStandby ? "all" : "active").forEach(function (observableQuery, queryId) {
|
|
1633
1678
|
var fetchPolicy = observableQuery.options.fetchPolicy;
|
|
1634
|
-
|
|
1679
|
+
muteDeprecations("resetLastResults", function () {
|
|
1680
|
+
return observableQuery.resetLastResults();
|
|
1681
|
+
});
|
|
1635
1682
|
if (includeStandby ||
|
|
1636
1683
|
(fetchPolicy !== "standby" && fetchPolicy !== "cache-only")) {
|
|
1637
1684
|
observableQueryPromises.push(observableQuery.refetch());
|
|
@@ -1944,7 +1991,7 @@ var QueryManager = (function () {
|
|
|
1944
1991
|
!this.noCacheWarningsByQueryId.has(operationId)) {
|
|
1945
1992
|
this.noCacheWarningsByQueryId.add(operationId);
|
|
1946
1993
|
globalThis.__DEV__ !== false && globals.invariant.warn(
|
|
1947
|
-
|
|
1994
|
+
45,
|
|
1948
1995
|
(_c = utilities.getOperationName(document)) !== null && _c !== void 0 ? _c : "Unnamed ".concat(operationType !== null && operationType !== void 0 ? operationType : "operation")
|
|
1949
1996
|
);
|
|
1950
1997
|
}
|
|
@@ -2259,7 +2306,7 @@ var LocalState = (function () {
|
|
|
2259
2306
|
}
|
|
2260
2307
|
else {
|
|
2261
2308
|
fragment = fragmentMap[selection.name.value];
|
|
2262
|
-
globals.invariant(fragment,
|
|
2309
|
+
globals.invariant(fragment, 21, selection.name.value);
|
|
2263
2310
|
}
|
|
2264
2311
|
if (fragment && fragment.typeCondition) {
|
|
2265
2312
|
typeCondition = fragment.typeCondition.name.value;
|
|
@@ -2373,7 +2420,7 @@ var LocalState = (function () {
|
|
|
2373
2420
|
},
|
|
2374
2421
|
FragmentSpread: function (spread, _, __, ___, ancestors) {
|
|
2375
2422
|
var fragment = fragmentMap[spread.name.value];
|
|
2376
|
-
globals.invariant(fragment,
|
|
2423
|
+
globals.invariant(fragment, 22, spread.name.value);
|
|
2377
2424
|
var fragmentSelections = collectByDefinition(fragment);
|
|
2378
2425
|
if (fragmentSelections.size > 0) {
|
|
2379
2426
|
ancestors.forEach(function (node) {
|
|
@@ -2626,6 +2673,7 @@ var ApolloClient = (function () {
|
|
|
2626
2673
|
}
|
|
2627
2674
|
if (globalThis.__DEV__ !== false) {
|
|
2628
2675
|
warnRemovedOption(options, "canonizeResults", "client.watchQuery");
|
|
2676
|
+
warnRemovedOption(options, "partialRefetch", "client.watchQuery");
|
|
2629
2677
|
}
|
|
2630
2678
|
return this.queryManager.watchQuery(options);
|
|
2631
2679
|
};
|
|
@@ -2639,6 +2687,10 @@ var ApolloClient = (function () {
|
|
|
2639
2687
|
}
|
|
2640
2688
|
if (globalThis.__DEV__ !== false) {
|
|
2641
2689
|
warnRemovedOption(options, "canonizeResults", "client.query");
|
|
2690
|
+
warnRemovedOption(options, "notifyOnNetworkStatusChange", "client.query", "This option does not affect `client.query` and can be safely removed.");
|
|
2691
|
+
if (options.fetchPolicy === "standby") {
|
|
2692
|
+
globalThis.__DEV__ !== false && globals.invariant.warn(19);
|
|
2693
|
+
}
|
|
2642
2694
|
}
|
|
2643
2695
|
return this.queryManager.query(options);
|
|
2644
2696
|
};
|
|
@@ -2742,7 +2794,7 @@ var ApolloClient = (function () {
|
|
|
2742
2794
|
result.queries = queries;
|
|
2743
2795
|
result.results = results;
|
|
2744
2796
|
result.catch(function (error) {
|
|
2745
|
-
globalThis.__DEV__ !== false && globals.invariant.debug(
|
|
2797
|
+
globalThis.__DEV__ !== false && globals.invariant.debug(20, error);
|
|
2746
2798
|
});
|
|
2747
2799
|
return result;
|
|
2748
2800
|
};
|