@apollo/client 3.8.4 → 3.8.5
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 +55 -76
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/core/ObservableQuery.d.ts.map +1 -1
- package/core/ObservableQuery.js +5 -6
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryInfo.d.ts +0 -2
- package/core/QueryInfo.d.ts.map +1 -1
- package/core/QueryInfo.js +0 -2
- package/core/QueryInfo.js.map +1 -1
- package/core/QueryManager.js +2 -2
- package/core/QueryManager.js.map +1 -1
- package/core/core.cjs +8 -11
- package/core/core.cjs.map +1 -1
- package/core/core.cjs.native.js +8 -11
- package/dev/dev.cjs +28 -19
- package/dev/dev.cjs.map +1 -1
- package/dev/dev.cjs.native.js +28 -19
- package/dev/loadErrorMessageHandler.js +1 -1
- package/dev/loadErrorMessageHandler.js.map +1 -1
- package/package.json +6 -6
- package/react/cache/index.d.ts +0 -4
- package/react/cache/index.d.ts.map +1 -1
- package/react/cache/index.js +0 -14
- package/react/cache/index.js.map +1 -1
- package/react/index.d.ts +0 -1
- package/react/index.d.ts.map +1 -1
- package/react/index.js +0 -1
- package/react/index.js.map +1 -1
- package/react/react.cjs +1 -218
- package/react/react.cjs.map +1 -1
- package/react/react.cjs.native.js +1 -218
- package/react/types/types.d.ts +0 -3
- package/react/types/types.d.ts.map +1 -1
- package/react/types/types.js.map +1 -1
- package/testing/internal/ObservableStream.d.ts +26 -0
- package/testing/internal/ObservableStream.d.ts.map +1 -0
- package/testing/internal/ObservableStream.js +101 -0
- package/testing/internal/ObservableStream.js.map +1 -0
- package/testing/internal/index.d.ts +1 -0
- package/testing/internal/index.d.ts.map +1 -1
- package/testing/internal/index.js +1 -0
- package/testing/internal/index.js.map +1 -1
- package/utilities/globals/globals.cjs +29 -19
- package/utilities/globals/globals.cjs.map +1 -1
- package/utilities/globals/globals.cjs.native.js +29 -19
- package/utilities/globals/invariantWrappers.d.ts.map +1 -1
- package/utilities/globals/invariantWrappers.js +28 -18
- package/utilities/globals/invariantWrappers.js.map +1 -1
- package/utilities/observables/asyncMap.d.ts.map +1 -1
- package/utilities/observables/asyncMap.js +17 -34
- package/utilities/observables/asyncMap.js.map +1 -1
- package/utilities/utilities.cjs +17 -34
- package/utilities/utilities.cjs.map +1 -1
- package/utilities/utilities.cjs.native.js +17 -34
- package/version.js +1 -1
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.8.
|
|
34
|
+
var version = "3.8.5";
|
|
35
35
|
|
|
36
36
|
function maybe(thunk) {
|
|
37
37
|
try {
|
|
@@ -71,11 +71,14 @@ function wrap(fn) {
|
|
|
71
71
|
args[_i - 1] = arguments[_i];
|
|
72
72
|
}
|
|
73
73
|
if (typeof message === "number") {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
74
|
+
var arg0 = message;
|
|
75
|
+
message = getHandledErrorMsg(arg0);
|
|
76
|
+
if (!message) {
|
|
77
|
+
message = getFallbackErrorMsg(arg0, args);
|
|
78
|
+
args = [];
|
|
79
|
+
}
|
|
78
80
|
}
|
|
81
|
+
fn.apply(void 0, [message].concat(args));
|
|
79
82
|
};
|
|
80
83
|
}
|
|
81
84
|
var invariant = Object.assign(function invariant(condition, message) {
|
|
@@ -84,7 +87,7 @@ var invariant = Object.assign(function invariant(condition, message) {
|
|
|
84
87
|
args[_i - 2] = arguments[_i];
|
|
85
88
|
}
|
|
86
89
|
if (!condition) {
|
|
87
|
-
tsInvariant.invariant(condition,
|
|
90
|
+
tsInvariant.invariant(condition, getHandledErrorMsg(message, args) || getFallbackErrorMsg(message, args));
|
|
88
91
|
}
|
|
89
92
|
}, {
|
|
90
93
|
debug: wrap(tsInvariant.invariant.debug),
|
|
@@ -97,23 +100,31 @@ function newInvariantError(message) {
|
|
|
97
100
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
98
101
|
optionalParams[_i - 1] = arguments[_i];
|
|
99
102
|
}
|
|
100
|
-
return new tsInvariant.InvariantError(
|
|
103
|
+
return new tsInvariant.InvariantError(getHandledErrorMsg(message, optionalParams) ||
|
|
104
|
+
getFallbackErrorMsg(message, optionalParams));
|
|
101
105
|
}
|
|
102
106
|
var ApolloErrorMessageHandler = Symbol.for("ApolloErrorMessageHandler_" + version);
|
|
103
|
-
function
|
|
107
|
+
function stringify$1(arg) {
|
|
108
|
+
return typeof arg == "string"
|
|
109
|
+
? arg
|
|
110
|
+
: stringifyForDisplay(arg, 2).slice(0, 1000);
|
|
111
|
+
}
|
|
112
|
+
function getHandledErrorMsg(message, messageArgs) {
|
|
104
113
|
if (messageArgs === void 0) { messageArgs = []; }
|
|
105
114
|
if (!message)
|
|
106
115
|
return;
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
116
|
+
return (global$1[ApolloErrorMessageHandler] &&
|
|
117
|
+
global$1[ApolloErrorMessageHandler](message, messageArgs.map(stringify$1)));
|
|
118
|
+
}
|
|
119
|
+
function getFallbackErrorMsg(message, messageArgs) {
|
|
120
|
+
if (messageArgs === void 0) { messageArgs = []; }
|
|
121
|
+
if (!message)
|
|
122
|
+
return;
|
|
123
|
+
return "An error occurred! For more details, see the full error text at https://go.apollo.dev/c/err#".concat(encodeURIComponent(JSON.stringify({
|
|
124
|
+
version: version,
|
|
125
|
+
message: message,
|
|
126
|
+
args: messageArgs.map(stringify$1),
|
|
127
|
+
})));
|
|
117
128
|
}
|
|
118
129
|
|
|
119
130
|
function shouldInclude(_a, variables) {
|
|
@@ -1092,48 +1103,31 @@ function iterateObserversSafely(observers, method, argument) {
|
|
|
1092
1103
|
|
|
1093
1104
|
function asyncMap(observable, mapFn, catchFn) {
|
|
1094
1105
|
return new zenObservableTs.Observable(function (observer) {
|
|
1095
|
-
var next = observer.next, error = observer.error, complete = observer.complete;
|
|
1096
|
-
var activeCallbackCount = 0;
|
|
1097
|
-
var completed = false;
|
|
1098
1106
|
var promiseQueue = {
|
|
1099
1107
|
then: function (callback) {
|
|
1100
1108
|
return new Promise(function (resolve) { return resolve(callback()); });
|
|
1101
1109
|
},
|
|
1102
1110
|
};
|
|
1103
|
-
function makeCallback(examiner,
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
--activeCallbackCount;
|
|
1118
|
-
throw error;
|
|
1119
|
-
})
|
|
1120
|
-
.catch(function (caught) {
|
|
1121
|
-
error && error.call(observer, caught);
|
|
1122
|
-
});
|
|
1123
|
-
};
|
|
1124
|
-
}
|
|
1125
|
-
else {
|
|
1126
|
-
return function (arg) { return delegate && delegate.call(observer, arg); };
|
|
1127
|
-
}
|
|
1111
|
+
function makeCallback(examiner, key) {
|
|
1112
|
+
return function (arg) {
|
|
1113
|
+
if (examiner) {
|
|
1114
|
+
var both = function () {
|
|
1115
|
+
return observer.closed
|
|
1116
|
+
? 0
|
|
1117
|
+
: examiner(arg);
|
|
1118
|
+
};
|
|
1119
|
+
promiseQueue = promiseQueue.then(both, both).then(function (result) { return observer.next(result); }, function (error) { return observer.error(error); });
|
|
1120
|
+
}
|
|
1121
|
+
else {
|
|
1122
|
+
observer[key](arg);
|
|
1123
|
+
}
|
|
1124
|
+
};
|
|
1128
1125
|
}
|
|
1129
1126
|
var handler = {
|
|
1130
|
-
next: makeCallback(mapFn, next),
|
|
1131
|
-
error: makeCallback(catchFn, error),
|
|
1127
|
+
next: makeCallback(mapFn, "next"),
|
|
1128
|
+
error: makeCallback(catchFn, "error"),
|
|
1132
1129
|
complete: function () {
|
|
1133
|
-
|
|
1134
|
-
if (!activeCallbackCount) {
|
|
1135
|
-
complete && complete.call(observer);
|
|
1136
|
-
}
|
|
1130
|
+
promiseQueue.then(function () { return observer.complete(); });
|
|
1137
1131
|
},
|
|
1138
1132
|
};
|
|
1139
1133
|
var sub = observable.subscribe(handler);
|
|
@@ -5007,9 +5001,9 @@ var ObservableQuery = (function (_super) {
|
|
|
5007
5001
|
}
|
|
5008
5002
|
return options.fetchPolicy;
|
|
5009
5003
|
};
|
|
5010
|
-
ObservableQuery.prototype.fetch = function (options, newNetworkStatus) {
|
|
5004
|
+
ObservableQuery.prototype.fetch = function (options, newNetworkStatus, query) {
|
|
5011
5005
|
this.queryManager.setObservableQuery(this);
|
|
5012
|
-
return this.queryManager["fetchConcastWithInfo"](this.queryId, options, newNetworkStatus);
|
|
5006
|
+
return this.queryManager["fetchConcastWithInfo"](this.queryId, options, newNetworkStatus, query);
|
|
5013
5007
|
};
|
|
5014
5008
|
ObservableQuery.prototype.updatePolling = function () {
|
|
5015
5009
|
var _this = this;
|
|
@@ -5091,15 +5085,14 @@ var ObservableQuery = (function (_super) {
|
|
|
5091
5085
|
}
|
|
5092
5086
|
}
|
|
5093
5087
|
}
|
|
5094
|
-
|
|
5095
|
-
this.waitForOwnResult && (this.waitForOwnResult = skipCacheDataFor(fetchOptions.fetchPolicy));
|
|
5088
|
+
this.waitForOwnResult && (this.waitForOwnResult = skipCacheDataFor(options.fetchPolicy));
|
|
5096
5089
|
var finishWaitingForOwnResult = function () {
|
|
5097
5090
|
if (_this.concast === concast) {
|
|
5098
5091
|
_this.waitForOwnResult = false;
|
|
5099
5092
|
}
|
|
5100
5093
|
};
|
|
5101
|
-
var variables =
|
|
5102
|
-
var _a = this.fetch(
|
|
5094
|
+
var variables = options.variables && tslib.__assign({}, options.variables);
|
|
5095
|
+
var _a = this.fetch(options, newNetworkStatus, query), concast = _a.concast, fromLink = _a.fromLink;
|
|
5103
5096
|
var observer = {
|
|
5104
5097
|
next: function (result) {
|
|
5105
5098
|
finishWaitingForOwnResult();
|
|
@@ -5541,7 +5534,6 @@ var QueryInfo = (function () {
|
|
|
5541
5534
|
this.listeners = new Set();
|
|
5542
5535
|
this.document = null;
|
|
5543
5536
|
this.lastRequestId = 1;
|
|
5544
|
-
this.subscriptions = new Set();
|
|
5545
5537
|
this.stopped = false;
|
|
5546
5538
|
this.dirty = false;
|
|
5547
5539
|
this.observableQuery = null;
|
|
@@ -5676,7 +5668,6 @@ var QueryInfo = (function () {
|
|
|
5676
5668
|
this.reset();
|
|
5677
5669
|
this.cancel();
|
|
5678
5670
|
this.cancel = QueryInfo.prototype.cancel;
|
|
5679
|
-
this.subscriptions.forEach(function (sub) { return sub.unsubscribe(); });
|
|
5680
5671
|
var oq = this.observableQuery;
|
|
5681
5672
|
if (oq)
|
|
5682
5673
|
oq.stopPolling();
|
|
@@ -6455,10 +6446,10 @@ var QueryManager = (function () {
|
|
|
6455
6446
|
throw error;
|
|
6456
6447
|
});
|
|
6457
6448
|
};
|
|
6458
|
-
QueryManager.prototype.fetchConcastWithInfo = function (queryId, options, networkStatus) {
|
|
6449
|
+
QueryManager.prototype.fetchConcastWithInfo = function (queryId, options, networkStatus, query) {
|
|
6459
6450
|
var _this = this;
|
|
6460
6451
|
if (networkStatus === void 0) { networkStatus = exports.NetworkStatus.loading; }
|
|
6461
|
-
|
|
6452
|
+
if (query === void 0) { query = options.query; }
|
|
6462
6453
|
var variables = this.getVariables(query, options.variables);
|
|
6463
6454
|
var queryInfo = this.getQuery(queryId);
|
|
6464
6455
|
var defaults = this.defaultOptions.watchQuery;
|
|
@@ -7998,7 +7989,7 @@ var InternalQueryReference = (function () {
|
|
|
7998
7989
|
return InternalQueryReference;
|
|
7999
7990
|
}());
|
|
8000
7991
|
|
|
8001
|
-
var SuspenseCache
|
|
7992
|
+
var SuspenseCache = (function () {
|
|
8002
7993
|
function SuspenseCache(options) {
|
|
8003
7994
|
if (options === void 0) { options = Object.create(null); }
|
|
8004
7995
|
this.queryRefs = new trie.Trie(canUseWeakMap);
|
|
@@ -8024,22 +8015,11 @@ var suspenseCacheSymbol = Symbol.for("apollo.suspenseCache");
|
|
|
8024
8015
|
function getSuspenseCache(client) {
|
|
8025
8016
|
var _a;
|
|
8026
8017
|
if (!client[suspenseCacheSymbol]) {
|
|
8027
|
-
client[suspenseCacheSymbol] = new SuspenseCache
|
|
8018
|
+
client[suspenseCacheSymbol] = new SuspenseCache((_a = client.defaultOptions.react) === null || _a === void 0 ? void 0 : _a.suspense);
|
|
8028
8019
|
}
|
|
8029
8020
|
return client[suspenseCacheSymbol];
|
|
8030
8021
|
}
|
|
8031
8022
|
|
|
8032
|
-
var SuspenseCache = (function (_super) {
|
|
8033
|
-
tslib.__extends(SuspenseCache, _super);
|
|
8034
|
-
function SuspenseCache() {
|
|
8035
|
-
_super.call(this) || this;
|
|
8036
|
-
throw new Error("It is no longer necessary to create a `SuspenseCache` instance and pass it into the `ApolloProvider`.\n" +
|
|
8037
|
-
"Please remove this code from your application. \n\n" +
|
|
8038
|
-
"This export will be removed with the final 3.8 release.");
|
|
8039
|
-
}
|
|
8040
|
-
return SuspenseCache;
|
|
8041
|
-
}(SuspenseCache$1));
|
|
8042
|
-
|
|
8043
8023
|
var skipToken = Symbol.for("apollo.skipToken");
|
|
8044
8024
|
|
|
8045
8025
|
function useSuspenseQuery(query, options) {
|
|
@@ -8247,7 +8227,6 @@ exports.HttpLink = HttpLink;
|
|
|
8247
8227
|
exports.InMemoryCache = InMemoryCache;
|
|
8248
8228
|
exports.MissingFieldError = MissingFieldError;
|
|
8249
8229
|
exports.ObservableQuery = ObservableQuery;
|
|
8250
|
-
exports.SuspenseCache = SuspenseCache;
|
|
8251
8230
|
exports.checkFetcher = checkFetcher;
|
|
8252
8231
|
exports.concat = concat;
|
|
8253
8232
|
exports.createHttpLink = createHttpLink;
|