@aws-amplify/datastore 3.11.0 → 3.11.1-unstable.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.
@@ -58572,6 +58572,16 @@ function () {
58572
58572
  GraphQLAPIClass.prototype.cancel = function (request, message) {
58573
58573
  return this._api.cancel(request, message);
58574
58574
  };
58575
+ /**
58576
+ * Check if the request has a corresponding cancel token in the WeakMap.
58577
+ * @params request - The request promise
58578
+ * @return if the request has a corresponding cancel token.
58579
+ */
58580
+
58581
+
58582
+ GraphQLAPIClass.prototype.hasCancelToken = function (request) {
58583
+ return this._api.hasCancelToken(request);
58584
+ };
58575
58585
 
58576
58586
  GraphQLAPIClass.prototype._graphqlSubscribe = function (_a, additionalHeaders) {
58577
58587
  var query = _a.query,
@@ -59176,6 +59186,16 @@ function () {
59176
59186
  RestAPIClass.prototype.cancel = function (request, message) {
59177
59187
  return this._api.cancel(request, message);
59178
59188
  };
59189
+ /**
59190
+ * Check if the request has a corresponding cancel token in the WeakMap.
59191
+ * @params request - The request promise
59192
+ * @return if the request has a corresponding cancel token.
59193
+ */
59194
+
59195
+
59196
+ RestAPIClass.prototype.hasCancelToken = function (request) {
59197
+ return this._api.hasCancelToken(request);
59198
+ };
59179
59199
  /**
59180
59200
  * Getting endpoint for API
59181
59201
  * @param {string} apiName - The name of the api
@@ -59740,9 +59760,20 @@ function () {
59740
59760
 
59741
59761
  if (source) {
59742
59762
  source.cancel(message);
59763
+ return true;
59743
59764
  }
59744
59765
 
59745
- return true;
59766
+ return false;
59767
+ };
59768
+ /**
59769
+ * Check if the request has a corresponding cancel token in the WeakMap.
59770
+ * @params request - The request promise
59771
+ * @return if the request has a corresponding cancel token.
59772
+ */
59773
+
59774
+
59775
+ RestClient.prototype.hasCancelToken = function (request) {
59776
+ return this._cancelTokenMap.has(request);
59746
59777
  };
59747
59778
  /**
59748
59779
  * Checks to see if an error thrown is from an api request cancellation
@@ -60241,7 +60272,7 @@ function () {
60241
60272
  return this._restApi.isCancel(error);
60242
60273
  };
60243
60274
  /**
60244
- * Cancels an inflight request
60275
+ * Cancels an inflight request for either a GraphQL request or a Rest API request.
60245
60276
  * @param request - request to cancel
60246
60277
  * @param [message] - custom error message
60247
60278
  * @return If the request was cancelled
@@ -60249,7 +60280,13 @@ function () {
60249
60280
 
60250
60281
 
60251
60282
  APIClass.prototype.cancel = function (request, message) {
60252
- return this._restApi.cancel(request, message);
60283
+ if (this._restApi.hasCancelToken(request)) {
60284
+ return this._restApi.cancel(request, message);
60285
+ } else if (this._graphqlApi.hasCancelToken(request)) {
60286
+ return this._graphqlApi.cancel(request, message);
60287
+ }
60288
+
60289
+ return false;
60253
60290
  };
60254
60291
  /**
60255
60292
  * Getting endpoint for API
@@ -71126,7 +71163,7 @@ var getAmplifyUserAgent = function getAmplifyUserAgent() {
71126
71163
  __webpack_require__.r(__webpack_exports__);
71127
71164
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "version", function() { return version; });
71128
71165
  // generated by genversion
71129
- var version = '4.5.2';
71166
+ var version = '4.5.3';
71130
71167
 
71131
71168
  /***/ }),
71132
71169