@aws-amplify/api 4.0.40-unstable.2 → 4.0.41-unstable.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 +11 -0
- package/dist/aws-amplify-api.js +40 -3
- package/dist/aws-amplify-api.js.map +1 -1
- package/dist/aws-amplify-api.min.js +1 -1
- package/dist/aws-amplify-api.min.js.map +1 -1
- package/lib/API.d.ts +1 -1
- package/lib/API.js +8 -2
- package/lib/API.js.map +1 -1
- package/lib-esm/API.d.ts +1 -1
- package/lib-esm/API.js +8 -2
- package/lib-esm/API.js.map +1 -1
- package/package.json +4 -4
- package/src/API.ts +7 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [4.0.40](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/api@4.0.39...@aws-amplify/api@4.0.40) (2022-05-12)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **@aws-amplify/api:** graphql API.cancel fix ([#9578](https://github.com/aws-amplify/amplify-js/issues/9578)) ([a9ae27f](https://github.com/aws-amplify/amplify-js/commit/a9ae27f65e1a782321c0be87556f92d2ee432352))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [4.0.39](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/api@4.0.38...@aws-amplify/api@4.0.39) (2022-05-03)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @aws-amplify/api
|
package/dist/aws-amplify-api.js
CHANGED
|
@@ -10125,6 +10125,16 @@ function () {
|
|
|
10125
10125
|
GraphQLAPIClass.prototype.cancel = function (request, message) {
|
|
10126
10126
|
return this._api.cancel(request, message);
|
|
10127
10127
|
};
|
|
10128
|
+
/**
|
|
10129
|
+
* Check if the request has a corresponding cancel token in the WeakMap.
|
|
10130
|
+
* @params request - The request promise
|
|
10131
|
+
* @return if the request has a corresponding cancel token.
|
|
10132
|
+
*/
|
|
10133
|
+
|
|
10134
|
+
|
|
10135
|
+
GraphQLAPIClass.prototype.hasCancelToken = function (request) {
|
|
10136
|
+
return this._api.hasCancelToken(request);
|
|
10137
|
+
};
|
|
10128
10138
|
|
|
10129
10139
|
GraphQLAPIClass.prototype._graphqlSubscribe = function (_a, additionalHeaders) {
|
|
10130
10140
|
var query = _a.query,
|
|
@@ -10731,6 +10741,16 @@ function () {
|
|
|
10731
10741
|
RestAPIClass.prototype.cancel = function (request, message) {
|
|
10732
10742
|
return this._api.cancel(request, message);
|
|
10733
10743
|
};
|
|
10744
|
+
/**
|
|
10745
|
+
* Check if the request has a corresponding cancel token in the WeakMap.
|
|
10746
|
+
* @params request - The request promise
|
|
10747
|
+
* @return if the request has a corresponding cancel token.
|
|
10748
|
+
*/
|
|
10749
|
+
|
|
10750
|
+
|
|
10751
|
+
RestAPIClass.prototype.hasCancelToken = function (request) {
|
|
10752
|
+
return this._api.hasCancelToken(request);
|
|
10753
|
+
};
|
|
10734
10754
|
/**
|
|
10735
10755
|
* Getting endpoint for API
|
|
10736
10756
|
* @param {string} apiName - The name of the api
|
|
@@ -11296,9 +11316,20 @@ function () {
|
|
|
11296
11316
|
|
|
11297
11317
|
if (source) {
|
|
11298
11318
|
source.cancel(message);
|
|
11319
|
+
return true;
|
|
11299
11320
|
}
|
|
11300
11321
|
|
|
11301
|
-
return
|
|
11322
|
+
return false;
|
|
11323
|
+
};
|
|
11324
|
+
/**
|
|
11325
|
+
* Check if the request has a corresponding cancel token in the WeakMap.
|
|
11326
|
+
* @params request - The request promise
|
|
11327
|
+
* @return if the request has a corresponding cancel token.
|
|
11328
|
+
*/
|
|
11329
|
+
|
|
11330
|
+
|
|
11331
|
+
RestClient.prototype.hasCancelToken = function (request) {
|
|
11332
|
+
return this._cancelTokenMap.has(request);
|
|
11302
11333
|
};
|
|
11303
11334
|
/**
|
|
11304
11335
|
* Checks to see if an error thrown is from an api request cancellation
|
|
@@ -15340,7 +15371,7 @@ function () {
|
|
|
15340
15371
|
return this._restApi.isCancel(error);
|
|
15341
15372
|
};
|
|
15342
15373
|
/**
|
|
15343
|
-
* Cancels an inflight request
|
|
15374
|
+
* Cancels an inflight request for either a GraphQL request or a Rest API request.
|
|
15344
15375
|
* @param request - request to cancel
|
|
15345
15376
|
* @param [message] - custom error message
|
|
15346
15377
|
* @return If the request was cancelled
|
|
@@ -15348,7 +15379,13 @@ function () {
|
|
|
15348
15379
|
|
|
15349
15380
|
|
|
15350
15381
|
APIClass.prototype.cancel = function (request, message) {
|
|
15351
|
-
|
|
15382
|
+
if (this._restApi.hasCancelToken(request)) {
|
|
15383
|
+
return this._restApi.cancel(request, message);
|
|
15384
|
+
} else if (this._graphqlApi.hasCancelToken(request)) {
|
|
15385
|
+
return this._graphqlApi.cancel(request, message);
|
|
15386
|
+
}
|
|
15387
|
+
|
|
15388
|
+
return false;
|
|
15352
15389
|
};
|
|
15353
15390
|
/**
|
|
15354
15391
|
* Getting endpoint for API
|