@aws-amplify/api-rest 2.0.61 → 2.0.62-unstable.2
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 +0 -8
- package/lib/RestAPI.d.ts +108 -0
- package/lib/RestAPI.js +7 -74
- package/lib/RestAPI.js.map +1 -1
- package/lib/RestClient.d.ts +138 -0
- package/lib/RestClient.js +11 -81
- package/lib/RestClient.js.map +1 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.js +4 -16
- package/lib/index.js.map +1 -1
- package/lib/types/index.d.ts +50 -0
- package/lib/types/index.js +2 -12
- package/lib/types/index.js.map +1 -1
- package/lib-esm/RestAPI.js +3 -70
- package/lib-esm/RestAPI.js.map +1 -1
- package/lib-esm/RestClient.js +3 -70
- package/lib-esm/RestClient.js.map +1 -1
- package/lib-esm/index.d.ts +0 -2
- package/lib-esm/index.js +2 -14
- package/lib-esm/index.js.map +1 -1
- package/lib-esm/types/index.js +2 -12
- package/lib-esm/types/index.js.map +1 -1
- package/package.json +13 -9
- package/src/RestAPI.ts +2 -12
- package/src/RestClient.ts +2 -12
- package/src/index.ts +2 -15
- package/src/types/index.ts +2 -12
- package/build.js +0 -5
- package/dist/aws-amplify-api-rest.js +0 -5064
- package/dist/aws-amplify-api-rest.js.map +0 -1
- package/dist/aws-amplify-api-rest.min.js +0 -2
- package/dist/aws-amplify-api-rest.min.js.map +0 -1
- package/index-rn.js +0 -3
- package/index.js +0 -7
- package/webpack.config.dev.js +0 -6
package/CHANGELOG.md
CHANGED
|
@@ -3,14 +3,6 @@
|
|
|
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
|
-
## [2.0.61](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/api-rest@2.0.60...@aws-amplify/api-rest@2.0.61) (2022-11-04)
|
|
7
|
-
|
|
8
|
-
**Note:** Version bump only for package @aws-amplify/api-rest
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
6
|
## [2.0.60](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/api-rest@2.0.59...@aws-amplify/api-rest@2.0.60) (2022-10-27)
|
|
15
7
|
|
|
16
8
|
**Note:** Version bump only for package @aws-amplify/api-rest
|
package/lib/RestAPI.d.ts
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Export Cloud Logic APIs
|
|
3
|
+
*/
|
|
4
|
+
export declare class RestAPIClass {
|
|
5
|
+
/**
|
|
6
|
+
* @private
|
|
7
|
+
*/
|
|
8
|
+
private _options;
|
|
9
|
+
private _api;
|
|
10
|
+
Credentials: import("@aws-amplify/core").CredentialsClass;
|
|
11
|
+
/**
|
|
12
|
+
* Initialize Rest API with AWS configuration
|
|
13
|
+
* @param {Object} options - Configuration object for API
|
|
14
|
+
*/
|
|
15
|
+
constructor(options: any);
|
|
16
|
+
getModuleName(): string;
|
|
17
|
+
/**
|
|
18
|
+
* Configure API part with aws configurations
|
|
19
|
+
* @param {Object} config - Configuration of the API
|
|
20
|
+
* @return {Object} - The current configuration
|
|
21
|
+
*/
|
|
22
|
+
configure(options: any): any;
|
|
23
|
+
/**
|
|
24
|
+
* Create an instance of API for the library
|
|
25
|
+
* @return - A promise of true if Success
|
|
26
|
+
*/
|
|
27
|
+
createInstance(): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Make a GET request
|
|
30
|
+
* @param {string} apiName - The api name of the request
|
|
31
|
+
* @param {string} path - The path of the request
|
|
32
|
+
* @param {json} [init] - Request extra params
|
|
33
|
+
* @return {Promise} - A promise that resolves to an object with response status and JSON data, if successful.
|
|
34
|
+
*/
|
|
35
|
+
get(apiName: any, path: any, init: any): Promise<any>;
|
|
36
|
+
/**
|
|
37
|
+
* Make a POST request
|
|
38
|
+
* @param {string} apiName - The api name of the request
|
|
39
|
+
* @param {string} path - The path of the request
|
|
40
|
+
* @param {json} [init] - Request extra params
|
|
41
|
+
* @return {Promise} - A promise that resolves to an object with response status and JSON data, if successful.
|
|
42
|
+
*/
|
|
43
|
+
post(apiName: any, path: any, init: any): Promise<any>;
|
|
44
|
+
/**
|
|
45
|
+
* Make a PUT request
|
|
46
|
+
* @param {string} apiName - The api name of the request
|
|
47
|
+
* @param {string} path - The path of the request
|
|
48
|
+
* @param {json} [init] - Request extra params
|
|
49
|
+
* @return {Promise} - A promise that resolves to an object with response status and JSON data, if successful.
|
|
50
|
+
*/
|
|
51
|
+
put(apiName: any, path: any, init: any): Promise<any>;
|
|
52
|
+
/**
|
|
53
|
+
* Make a PATCH request
|
|
54
|
+
* @param {string} apiName - The api name of the request
|
|
55
|
+
* @param {string} path - The path of the request
|
|
56
|
+
* @param {json} [init] - Request extra params
|
|
57
|
+
* @return {Promise} - A promise that resolves to an object with response status and JSON data, if successful.
|
|
58
|
+
*/
|
|
59
|
+
patch(apiName: any, path: any, init: any): Promise<any>;
|
|
60
|
+
/**
|
|
61
|
+
* Make a DEL request
|
|
62
|
+
* @param {string} apiName - The api name of the request
|
|
63
|
+
* @param {string} path - The path of the request
|
|
64
|
+
* @param {json} [init] - Request extra params
|
|
65
|
+
* @return {Promise} - A promise that resolves to an object with response status and JSON data, if successful.
|
|
66
|
+
*/
|
|
67
|
+
del(apiName: any, path: any, init: any): Promise<any>;
|
|
68
|
+
/**
|
|
69
|
+
* Make a HEAD request
|
|
70
|
+
* @param {string} apiName - The api name of the request
|
|
71
|
+
* @param {string} path - The path of the request
|
|
72
|
+
* @param {json} [init] - Request extra params
|
|
73
|
+
* @return {Promise} - A promise that resolves to an object with response status and JSON data, if successful.
|
|
74
|
+
*/
|
|
75
|
+
head(apiName: any, path: any, init: any): Promise<any>;
|
|
76
|
+
/**
|
|
77
|
+
* Checks to see if an error thrown is from an api request cancellation
|
|
78
|
+
* @param {any} error - Any error
|
|
79
|
+
* @return {boolean} - A boolean indicating if the error was from an api request cancellation
|
|
80
|
+
*/
|
|
81
|
+
isCancel(error: any): boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Cancels an inflight request
|
|
84
|
+
* @param {any} request - request to cancel
|
|
85
|
+
* @return {boolean} - A boolean indicating if the request was cancelled
|
|
86
|
+
*/
|
|
87
|
+
cancel(request: Promise<any>, message?: string): boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Check if the request has a corresponding cancel token in the WeakMap.
|
|
90
|
+
* @params request - The request promise
|
|
91
|
+
* @return if the request has a corresponding cancel token.
|
|
92
|
+
*/
|
|
93
|
+
hasCancelToken(request: Promise<any>): boolean;
|
|
94
|
+
/**
|
|
95
|
+
* Getting endpoint for API
|
|
96
|
+
* @param {string} apiName - The name of the api
|
|
97
|
+
* @return {string} - The endpoint of the api
|
|
98
|
+
*/
|
|
99
|
+
endpoint(apiName: any): Promise<string>;
|
|
100
|
+
/**
|
|
101
|
+
* Getting endpoint info for API
|
|
102
|
+
* @param {string} apiName - The name of the api
|
|
103
|
+
* @param {string} path - The path of the api that is going to accessed
|
|
104
|
+
* @return {ApiInfo} - The endpoint information for that api-name
|
|
105
|
+
*/
|
|
106
|
+
private getEndpointInfo;
|
|
107
|
+
}
|
|
108
|
+
export declare const RestAPI: RestAPIClass;
|
package/lib/RestAPI.js
CHANGED
|
@@ -1,75 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
-
function step(op) {
|
|
27
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
-
while (_) try {
|
|
29
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
-
switch (op[0]) {
|
|
32
|
-
case 0: case 1: t = op; break;
|
|
33
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
-
default:
|
|
37
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
-
if (t[2]) _.ops.pop();
|
|
42
|
-
_.trys.pop(); continue;
|
|
43
|
-
}
|
|
44
|
-
op = body.call(thisArg, _);
|
|
45
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
50
|
-
var t = {};
|
|
51
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
52
|
-
t[p] = s[p];
|
|
53
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
54
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
55
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
56
|
-
t[p[i]] = s[p[i]];
|
|
57
|
-
}
|
|
58
|
-
return t;
|
|
59
|
-
};
|
|
60
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
|
|
65
|
-
* the License. A copy of the License is located at
|
|
66
|
-
*
|
|
67
|
-
* http://aws.amazon.com/apache2.0/
|
|
68
|
-
*
|
|
69
|
-
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
70
|
-
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
|
|
71
|
-
* and limitations under the License.
|
|
72
|
-
*/
|
|
3
|
+
var tslib_1 = require("tslib");
|
|
4
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
5
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
73
6
|
var RestClient_1 = require("./RestClient");
|
|
74
7
|
var core_1 = require("@aws-amplify/core");
|
|
75
8
|
var logger = new core_1.ConsoleLogger('RestAPI');
|
|
@@ -96,8 +29,8 @@ var RestAPIClass = /** @class */ (function () {
|
|
|
96
29
|
* @return {Object} - The current configuration
|
|
97
30
|
*/
|
|
98
31
|
RestAPIClass.prototype.configure = function (options) {
|
|
99
|
-
var _a = options || {}, _b = _a.API, API = _b === void 0 ? {} : _b, otherOptions = __rest(_a, ["API"]);
|
|
100
|
-
var opt = __assign(__assign({}, otherOptions), API);
|
|
32
|
+
var _a = options || {}, _b = _a.API, API = _b === void 0 ? {} : _b, otherOptions = tslib_1.__rest(_a, ["API"]);
|
|
33
|
+
var opt = tslib_1.__assign(tslib_1.__assign({}, otherOptions), API);
|
|
101
34
|
logger.debug('configure Rest API', { opt: opt });
|
|
102
35
|
if (opt['aws_project_region']) {
|
|
103
36
|
if (opt['aws_cloud_logic_custom']) {
|
|
@@ -297,8 +230,8 @@ var RestAPIClass = /** @class */ (function () {
|
|
|
297
230
|
* @return {string} - The endpoint of the api
|
|
298
231
|
*/
|
|
299
232
|
RestAPIClass.prototype.endpoint = function (apiName) {
|
|
300
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
301
|
-
return __generator(this, function (_a) {
|
|
233
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
234
|
+
return tslib_1.__generator(this, function (_a) {
|
|
302
235
|
return [2 /*return*/, this._api.endpoint(apiName)];
|
|
303
236
|
});
|
|
304
237
|
});
|
package/lib/RestAPI.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RestAPI.js","sourceRoot":"","sources":["../src/RestAPI.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RestAPI.js","sourceRoot":"","sources":["../src/RestAPI.ts"],"names":[],"mappings":";;;AAAA,qEAAqE;AACrE,sCAAsC;AACtC,2CAA0C;AAC1C,0CAI2B;AAG3B,IAAM,MAAM,G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,QAAQ,CAAC,MAAM,KAAK,QAAQ,EAAE;YACpD,QAAQ,CAAC,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;SACvC;QAED,IAAI,OAAO,SAAS,CAAC,OAAO,KAAK,QAAQ,EAAE;YAC1C,QAAQ,CAAC,OAAO,GAAG,SAAS,CAAC,OAAO,IAAI,aAAa,CAAC;SACtD;aAAM;YACN,QAAQ,CAAC,OAAO,GAAG,aAAa,CAAC;SACjC;QAED,IAAI,OAAO,SAAS,CAAC,aAAa,KAAK,UAAU,EAAE;YAClD,QAAQ,CAAC,aAAa,GAAG,SAAS,CAAC,aAAa,CAAC;SACjD;aAAM;YACN,QAAQ,CAAC,aAAa,GAAG,SAAS,CAAC;SACnC;QAED,OAAO,QAAQ,CAAC;IACjB,CAAC;IACF,mBAAC;AAAD,CAAC,AA/TD,IA+TC;AA/TY,oCAAY;AAiUZ,QAAA,OAAO,GAAG,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC;AAC9C,cAAO,CAAC,QAAQ,CAAC,eAAO,CAAC,CAAC"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { apiOptions, ApiInfo } from './types';
|
|
2
|
+
import { CancelTokenSource } from 'axios';
|
|
3
|
+
/**
|
|
4
|
+
* HTTP Client for REST requests. Send and receive JSON data.
|
|
5
|
+
* Sign request with AWS credentials if available
|
|
6
|
+
* Usage:
|
|
7
|
+
<pre>
|
|
8
|
+
const restClient = new RestClient();
|
|
9
|
+
restClient.get('...')
|
|
10
|
+
.then(function(data) {
|
|
11
|
+
console.log(data);
|
|
12
|
+
})
|
|
13
|
+
.catch(err => console.log(err));
|
|
14
|
+
</pre>
|
|
15
|
+
*/
|
|
16
|
+
export declare class RestClient {
|
|
17
|
+
private _options;
|
|
18
|
+
private _region;
|
|
19
|
+
private _service;
|
|
20
|
+
private _custom_header;
|
|
21
|
+
/**
|
|
22
|
+
* This weak map provides functionality to let clients cancel
|
|
23
|
+
* in-flight axios requests. https://github.com/axios/axios#cancellation
|
|
24
|
+
*
|
|
25
|
+
* 1. For every axios request, a unique cancel token is generated and added in the request.
|
|
26
|
+
* 2. Promise for fulfilling the request is then mapped to that unique cancel token.
|
|
27
|
+
* 3. The promise is returned to the client.
|
|
28
|
+
* 4. Clients can either wait for the promise to fulfill or call `API.cancel(promise)` to cancel the request.
|
|
29
|
+
* 5. If `API.cancel(promise)` is called, then the corresponding cancel token is retrieved from the map below.
|
|
30
|
+
* 6. Promise returned to the client will be in rejected state with the error provided during cancel.
|
|
31
|
+
* 7. Clients can check if the error is because of cancelling by calling `API.isCancel(error)`.
|
|
32
|
+
*
|
|
33
|
+
* For more details, see https://github.com/aws-amplify/amplify-js/pull/3769#issuecomment-552660025
|
|
34
|
+
*/
|
|
35
|
+
private _cancelTokenMap;
|
|
36
|
+
Credentials: import("@aws-amplify/core").CredentialsClass;
|
|
37
|
+
/**
|
|
38
|
+
* @param {RestClientOptions} [options] - Instance options
|
|
39
|
+
*/
|
|
40
|
+
constructor(options: apiOptions);
|
|
41
|
+
/**
|
|
42
|
+
* Update AWS credentials
|
|
43
|
+
* @param {AWSCredentials} credentials - AWS credentials
|
|
44
|
+
*
|
|
45
|
+
updateCredentials(credentials: AWSCredentials) {
|
|
46
|
+
this.options.credentials = credentials;
|
|
47
|
+
}
|
|
48
|
+
*/
|
|
49
|
+
/**
|
|
50
|
+
* Basic HTTP request. Customizable
|
|
51
|
+
* @param {string | ApiInfo } urlOrApiInfo - Full request URL or Api information
|
|
52
|
+
* @param {string} method - Request HTTP method
|
|
53
|
+
* @param {json} [init] - Request extra params
|
|
54
|
+
* @return {Promise} - A promise that resolves to an object with response status and JSON data, if successful.
|
|
55
|
+
*/
|
|
56
|
+
ajax(urlOrApiInfo: string | ApiInfo, method: string, init: any): Promise<any>;
|
|
57
|
+
/**
|
|
58
|
+
* GET HTTP request
|
|
59
|
+
* @param {string | ApiInfo } urlOrApiInfo - Full request URL or Api information
|
|
60
|
+
* @param {JSON} init - Request extra params
|
|
61
|
+
* @return {Promise} - A promise that resolves to an object with response status and JSON data, if successful.
|
|
62
|
+
*/
|
|
63
|
+
get(urlOrApiInfo: string | ApiInfo, init: any): Promise<any>;
|
|
64
|
+
/**
|
|
65
|
+
* PUT HTTP request
|
|
66
|
+
* @param {string | ApiInfo } urlOrApiInfo - Full request URL or Api information
|
|
67
|
+
* @param {json} init - Request extra params
|
|
68
|
+
* @return {Promise} - A promise that resolves to an object with response status and JSON data, if successful.
|
|
69
|
+
*/
|
|
70
|
+
put(urlOrApiInfo: string | ApiInfo, init: any): Promise<any>;
|
|
71
|
+
/**
|
|
72
|
+
* PATCH HTTP request
|
|
73
|
+
* @param {string | ApiInfo } urlOrApiInfo - Full request URL or Api information
|
|
74
|
+
* @param {json} init - Request extra params
|
|
75
|
+
* @return {Promise} - A promise that resolves to an object with response status and JSON data, if successful.
|
|
76
|
+
*/
|
|
77
|
+
patch(urlOrApiInfo: string | ApiInfo, init: any): Promise<any>;
|
|
78
|
+
/**
|
|
79
|
+
* POST HTTP request
|
|
80
|
+
* @param {string | ApiInfo } urlOrApiInfo - Full request URL or Api information
|
|
81
|
+
* @param {json} init - Request extra params
|
|
82
|
+
* @return {Promise} - A promise that resolves to an object with response status and JSON data, if successful.
|
|
83
|
+
*/
|
|
84
|
+
post(urlOrApiInfo: string | ApiInfo, init: any): Promise<any>;
|
|
85
|
+
/**
|
|
86
|
+
* DELETE HTTP request
|
|
87
|
+
* @param {string | ApiInfo } urlOrApiInfo - Full request URL or Api information
|
|
88
|
+
* @param {json} init - Request extra params
|
|
89
|
+
* @return {Promise} - A promise that resolves to an object with response status and JSON data, if successful.
|
|
90
|
+
*/
|
|
91
|
+
del(urlOrApiInfo: string | ApiInfo, init: any): Promise<any>;
|
|
92
|
+
/**
|
|
93
|
+
* HEAD HTTP request
|
|
94
|
+
* @param {string | ApiInfo } urlOrApiInfo - Full request URL or Api information
|
|
95
|
+
* @param {json} init - Request extra params
|
|
96
|
+
* @return {Promise} - A promise that resolves to an object with response status and JSON data, if successful.
|
|
97
|
+
*/
|
|
98
|
+
head(urlOrApiInfo: string | ApiInfo, init: any): Promise<any>;
|
|
99
|
+
/**
|
|
100
|
+
* Cancel an inflight API request
|
|
101
|
+
* @param {Promise<any>} request - The request promise to cancel
|
|
102
|
+
* @param {string} [message] - A message to include in the cancelation exception
|
|
103
|
+
*/
|
|
104
|
+
cancel(request: Promise<any>, message?: string): boolean;
|
|
105
|
+
/**
|
|
106
|
+
* Check if the request has a corresponding cancel token in the WeakMap.
|
|
107
|
+
* @params request - The request promise
|
|
108
|
+
* @return if the request has a corresponding cancel token.
|
|
109
|
+
*/
|
|
110
|
+
hasCancelToken(request: Promise<any>): boolean;
|
|
111
|
+
/**
|
|
112
|
+
* Checks to see if an error thrown is from an api request cancellation
|
|
113
|
+
* @param {any} error - Any error
|
|
114
|
+
* @return {boolean} - A boolean indicating if the error was from an api request cancellation
|
|
115
|
+
*/
|
|
116
|
+
isCancel(error: any): boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Retrieves a new and unique cancel token which can be
|
|
119
|
+
* provided in an axios request to be cancelled later.
|
|
120
|
+
*/
|
|
121
|
+
getCancellableToken(): CancelTokenSource;
|
|
122
|
+
/**
|
|
123
|
+
* Updates the weakmap with a response promise and its
|
|
124
|
+
* cancel token such that the cancel token can be easily
|
|
125
|
+
* retrieved (and used for cancelling the request)
|
|
126
|
+
*/
|
|
127
|
+
updateRequestToBeCancellable(promise: Promise<any>, cancelTokenSource: CancelTokenSource): void;
|
|
128
|
+
/**
|
|
129
|
+
* Getting endpoint for API
|
|
130
|
+
* @param {string} apiName - The name of the api
|
|
131
|
+
* @return {string} - The endpoint of the api
|
|
132
|
+
*/
|
|
133
|
+
endpoint(apiName: string): string;
|
|
134
|
+
/** private methods **/
|
|
135
|
+
private _signed;
|
|
136
|
+
private _request;
|
|
137
|
+
private _parseUrl;
|
|
138
|
+
}
|
package/lib/RestClient.js
CHANGED
|
@@ -1,80 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
|
|
6
|
-
* the License. A copy of the License is located at
|
|
7
|
-
*
|
|
8
|
-
* http://aws.amazon.com/apache2.0/
|
|
9
|
-
*
|
|
10
|
-
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
11
|
-
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
|
|
12
|
-
* and limitations under the License.
|
|
13
|
-
*/
|
|
14
|
-
var __assign = (this && this.__assign) || function () {
|
|
15
|
-
__assign = Object.assign || function(t) {
|
|
16
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
17
|
-
s = arguments[i];
|
|
18
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
19
|
-
t[p] = s[p];
|
|
20
|
-
}
|
|
21
|
-
return t;
|
|
22
|
-
};
|
|
23
|
-
return __assign.apply(this, arguments);
|
|
24
|
-
};
|
|
25
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
35
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
36
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
37
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
38
|
-
function step(op) {
|
|
39
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
40
|
-
while (_) try {
|
|
41
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
42
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
43
|
-
switch (op[0]) {
|
|
44
|
-
case 0: case 1: t = op; break;
|
|
45
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
46
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
47
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
48
|
-
default:
|
|
49
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
50
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
51
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
52
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
53
|
-
if (t[2]) _.ops.pop();
|
|
54
|
-
_.trys.pop(); continue;
|
|
55
|
-
}
|
|
56
|
-
op = body.call(thisArg, _);
|
|
57
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
58
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
62
|
-
var t = {};
|
|
63
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
64
|
-
t[p] = s[p];
|
|
65
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
66
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
67
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
68
|
-
t[p[i]] = s[p[i]];
|
|
69
|
-
}
|
|
70
|
-
return t;
|
|
71
|
-
};
|
|
72
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
73
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
74
|
-
};
|
|
2
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
75
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
var tslib_1 = require("tslib");
|
|
76
6
|
var core_1 = require("@aws-amplify/core");
|
|
77
|
-
var axios_1 = __importDefault(require("axios"));
|
|
7
|
+
var axios_1 = tslib_1.__importDefault(require("axios"));
|
|
78
8
|
var url_1 = require("url");
|
|
79
9
|
var logger = new core_1.ConsoleLogger('RestClient');
|
|
80
10
|
/**
|
|
@@ -136,10 +66,10 @@ var RestClient = /** @class */ (function () {
|
|
|
136
66
|
* @return {Promise} - A promise that resolves to an object with response status and JSON data, if successful.
|
|
137
67
|
*/
|
|
138
68
|
RestClient.prototype.ajax = function (urlOrApiInfo, method, init) {
|
|
139
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
69
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
140
70
|
var parsed_url, url, region, service, custom_header, params, libraryHeaders, userAgent, initParams, isAllResponse, custom_header_obj, _a, _b, search, parsedUrl;
|
|
141
71
|
var _this = this;
|
|
142
|
-
return __generator(this, function (_c) {
|
|
72
|
+
return tslib_1.__generator(this, function (_c) {
|
|
143
73
|
switch (_c.label) {
|
|
144
74
|
case 0:
|
|
145
75
|
logger.debug(method, urlOrApiInfo);
|
|
@@ -208,9 +138,9 @@ var RestClient = /** @class */ (function () {
|
|
|
208
138
|
_c.label = 3;
|
|
209
139
|
case 3:
|
|
210
140
|
custom_header_obj = _a;
|
|
211
|
-
params.headers = __assign(__assign(__assign({}, libraryHeaders), custom_header_obj), initParams.headers);
|
|
212
|
-
_b = url_1.parse(url, true, true), search = _b.search, parsedUrl = __rest(_b, ["search"]);
|
|
213
|
-
params.url = url_1.format(__assign(__assign({}, parsedUrl), { query: __assign(__assign({}, parsedUrl.query), (initParams.queryStringParameters || {})) }));
|
|
141
|
+
params.headers = tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, libraryHeaders), custom_header_obj), initParams.headers);
|
|
142
|
+
_b = url_1.parse(url, true, true), search = _b.search, parsedUrl = tslib_1.__rest(_b, ["search"]);
|
|
143
|
+
params.url = url_1.format(tslib_1.__assign(tslib_1.__assign({}, parsedUrl), { query: tslib_1.__assign(tslib_1.__assign({}, parsedUrl.query), (initParams.queryStringParameters || {})) }));
|
|
214
144
|
// Do not sign the request if client has added 'Authorization' header,
|
|
215
145
|
// which means custom authorizer.
|
|
216
146
|
if (typeof params.headers['Authorization'] !== 'undefined') {
|
|
@@ -225,7 +155,7 @@ var RestClient = /** @class */ (function () {
|
|
|
225
155
|
}
|
|
226
156
|
// Signing the request in case there credentials are available
|
|
227
157
|
return [2 /*return*/, this.Credentials.get().then(function (credentials) {
|
|
228
|
-
return _this._signed(__assign({}, params), credentials, isAllResponse, {
|
|
158
|
+
return _this._signed(tslib_1.__assign({}, params), credentials, isAllResponse, {
|
|
229
159
|
region: region,
|
|
230
160
|
service: service,
|
|
231
161
|
}).catch(function (error) {
|
|
@@ -388,7 +318,7 @@ var RestClient = /** @class */ (function () {
|
|
|
388
318
|
/** private methods **/
|
|
389
319
|
RestClient.prototype._signed = function (params, credentials, isAllResponse, _a) {
|
|
390
320
|
var service = _a.service, region = _a.region;
|
|
391
|
-
var signerServiceInfoParams = params.signerServiceInfo, otherParams = __rest(params, ["signerServiceInfo"]);
|
|
321
|
+
var signerServiceInfoParams = params.signerServiceInfo, otherParams = tslib_1.__rest(params, ["signerServiceInfo"]);
|
|
392
322
|
var endpoint_region = region || this._region || this._options.region;
|
|
393
323
|
var endpoint_service = service || this._service || this._options.service;
|
|
394
324
|
var creds = {
|
package/lib/RestClient.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RestClient.js","sourceRoot":"","sources":["../src/RestClient.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"RestClient.js","sourceRoot":"","sources":["../src/RestClient.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;;;AAEtC,0CAM2B;AAG3B,wDAAiD;AACjD,2BAAoC;AAEpC,IAAM,MAAM,GAAG,IAAI,oBAAM,CAAC,YAAY,CAAC,CAAC;AAExC;;;;;;;;;;;;EAYE;AACF;IAwBC;;OAEG;IACH,oBAAY,OAAmB;QAzBvB,YAAO,GAAW,WAAW,CAAC,CAAC,4CAA4C;QAC3E,aAAQ,GAAW,aAAa,CAAC,CAAC,2CAA2C;QAC7E,mBAAc,GAAG,SAAS,CAAC,CAAC,2CAA2C;QAE/E;;;;;;;;;;;;;WAaG;QACK,oBAAe,GAAoC,IAAI,CAAC;QAEhE,gBAAW,GAAG,kBAAW,CAAC;QAMzB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,MAAM,CAAC,KAAK,CAAC,aAAa,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC3C,IAAI,IAAI,CAAC,eAAe,IAAI,IAAI,EAAE;YACjC,IAAI,CAAC,eAAe,GAAG,IAAI,OAAO,EAAE,CAAC;SACrC;IACF,CAAC;IAED;;;;;;;EAOC;IACD;;;;;;OAMG;IACG,yBAAI,GAAV,UAAW,YAA8B,EAAE,MAAc,EAAE,IAAI;;;;;;;wBAC9D,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;wBAI/B,MAAM,GAAW,WAAW,CAAC;wBAC7B,OAAO,GAAW,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AI,CAAC,GAAG,CAAC;SACpC,CAAC;IACH,CAAC;IACF,iBAAC;AAAD,CAAC,AA7YD,IA6YC;AA7YY,gCAAU"}
|
package/lib/index.d.ts
ADDED
package/lib/index.js
CHANGED
|
@@ -1,22 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
|
|
6
|
-
* the License. A copy of the License is located at
|
|
7
|
-
*
|
|
8
|
-
* http://aws.amazon.com/apache2.0/
|
|
9
|
-
*
|
|
10
|
-
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
11
|
-
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
|
|
12
|
-
* and limitations under the License.
|
|
13
|
-
*/
|
|
2
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
14
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
5
|
var RestAPI_1 = require("./RestAPI");
|
|
16
|
-
|
|
17
|
-
exports.
|
|
18
|
-
exports.RestAPIClass = RestAPI_2.RestAPIClass;
|
|
6
|
+
exports.RestAPI = RestAPI_1.RestAPI;
|
|
7
|
+
exports.RestAPIClass = RestAPI_1.RestAPIClass;
|
|
19
8
|
var RestClient_1 = require("./RestClient");
|
|
20
9
|
exports.RestClient = RestClient_1.RestClient;
|
|
21
|
-
exports.default = RestAPI_1.RestAPI;
|
|
22
10
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,qCAAkD;AAAzC,4BAAA,OAAO,CAAA;AAAE,iCAAA,YAAY,CAAA;AAC9B,2CAA0C;AAAjC,kCAAA,UAAU,CAAA"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RestClient instance options
|
|
3
|
+
*/
|
|
4
|
+
export declare class RestClientOptions {
|
|
5
|
+
/** AWS credentials */
|
|
6
|
+
credentials: AWSCredentials;
|
|
7
|
+
/**
|
|
8
|
+
* Lookup key of AWS credentials.
|
|
9
|
+
* If credentials not provided then lookup from sessionStorage.
|
|
10
|
+
* Default 'awsCredentials'
|
|
11
|
+
*/
|
|
12
|
+
credentials_key: string;
|
|
13
|
+
/** Additional headers for all requests send by this client. e.g. user-agent */
|
|
14
|
+
headers: object;
|
|
15
|
+
constructor();
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* AWS credentials needed for RestClient
|
|
19
|
+
*/
|
|
20
|
+
export declare class AWSCredentials {
|
|
21
|
+
/**
|
|
22
|
+
* Secret Access Key
|
|
23
|
+
*
|
|
24
|
+
* [Access Key ID and Secret Access Key]
|
|
25
|
+
* (http://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html#access-keys-and-secret-access-keys)
|
|
26
|
+
*/
|
|
27
|
+
secretAccessKey: string;
|
|
28
|
+
/**
|
|
29
|
+
* Access Key ID
|
|
30
|
+
*
|
|
31
|
+
* [Access Key ID and Secret Access Key]
|
|
32
|
+
* (http://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html#access-keys-and-secret-access-keys)
|
|
33
|
+
*/
|
|
34
|
+
accessKeyId: string;
|
|
35
|
+
/** Access Token of current session */
|
|
36
|
+
sessionToken: string;
|
|
37
|
+
}
|
|
38
|
+
export interface apiOptions {
|
|
39
|
+
headers: object;
|
|
40
|
+
endpoints: object;
|
|
41
|
+
credentials?: object;
|
|
42
|
+
}
|
|
43
|
+
export declare type ApiInfo = {
|
|
44
|
+
endpoint: string;
|
|
45
|
+
region?: string;
|
|
46
|
+
service?: string;
|
|
47
|
+
custom_header?: () => {
|
|
48
|
+
[key: string]: string;
|
|
49
|
+
};
|
|
50
|
+
};
|