@aws-sdk/polly-request-presigner 3.185.0 → 3.186.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/CHANGELOG.md +8 -0
- package/dist-es/constants.js +7 -7
- package/dist-es/getSignedUrls.js +58 -49
- package/dist-es/getSynthesizeSpeechUrl.js +13 -5
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
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
|
+
# [3.186.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.185.0...v3.186.0) (2022-10-06)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @aws-sdk/polly-request-presigner
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
# [3.185.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.184.0...v3.185.0) (2022-10-05)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @aws-sdk/polly-request-presigner
|
package/dist-es/constants.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
1
|
+
export var ALGORITHM_QUERY_PARAM = "X-Amz-Algorithm";
|
|
2
|
+
export var CREDENTIAL_QUERY_PARAM = "X-Amz-Credential";
|
|
3
|
+
export var AMZ_DATE_QUERY_PARAM = "X-Amz-Date";
|
|
4
|
+
export var SIGNED_HEADERS_QUERY_PARAM = "X-Amz-SignedHeaders";
|
|
5
|
+
export var EXPIRES_QUERY_PARAM = "X-Amz-Expires";
|
|
6
|
+
export var HOST_HEADER = "host";
|
|
7
|
+
export var ALGORITHM_IDENTIFIER = "AWS4-HMAC-SHA256";
|
package/dist-es/getSignedUrls.js
CHANGED
|
@@ -1,55 +1,64 @@
|
|
|
1
|
+
import { __assign, __awaiter, __generator } from "tslib";
|
|
1
2
|
import { HttpRequest } from "@aws-sdk/protocol-http";
|
|
2
3
|
import { SignatureV4 } from "@aws-sdk/signature-v4";
|
|
3
4
|
import { formatUrl } from "@aws-sdk/util-format-url";
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
5
|
+
export var getSignedUrl = function (client, command, options) {
|
|
6
|
+
if (options === void 0) { options = {}; }
|
|
7
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
8
|
+
var signer, presignInterceptMiddleware, presigned, output;
|
|
9
|
+
return __generator(this, function (_a) {
|
|
10
|
+
switch (_a.label) {
|
|
11
|
+
case 0:
|
|
12
|
+
signer = new SignatureV4(__assign({ service: options.service || "polly", uriEscapePath: options.uriEscapePath || false }, client.config));
|
|
13
|
+
presignInterceptMiddleware = function (next, context) { return function (args) { return __awaiter(void 0, void 0, void 0, function () {
|
|
14
|
+
var request, unsignableHeaders, presigned;
|
|
15
|
+
var _a, _b;
|
|
16
|
+
return __generator(this, function (_c) {
|
|
17
|
+
switch (_c.label) {
|
|
18
|
+
case 0:
|
|
19
|
+
request = args.request;
|
|
20
|
+
if (!HttpRequest.isInstance(request)) {
|
|
21
|
+
throw new Error("Request to be presigned is not an valid HTTP request.");
|
|
22
|
+
}
|
|
23
|
+
request.method = "GET";
|
|
24
|
+
delete request.headers["amz-sdk-invocation-id"];
|
|
25
|
+
delete request.headers["amz-sdk-request"];
|
|
26
|
+
delete request.headers["content-length"];
|
|
27
|
+
request.body = "";
|
|
28
|
+
request.query = __assign(__assign({}, request.query), args.input);
|
|
29
|
+
unsignableHeaders = new Set();
|
|
30
|
+
unsignableHeaders.add("content-type");
|
|
31
|
+
return [4, signer.presign(request, __assign(__assign({ expiresIn: 3600, unsignableHeaders: unsignableHeaders }, options), { signingRegion: (_a = options.signingRegion) !== null && _a !== void 0 ? _a : context["signing_region"], signingService: (_b = options.signingService) !== null && _b !== void 0 ? _b : context["signing_service"] }))];
|
|
32
|
+
case 1:
|
|
33
|
+
presigned = _c.sent();
|
|
34
|
+
return [2, {
|
|
35
|
+
response: {},
|
|
36
|
+
output: {
|
|
37
|
+
$metadata: { httpStatusCode: 200 },
|
|
38
|
+
presigned: presigned,
|
|
39
|
+
},
|
|
40
|
+
}];
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}); }; };
|
|
44
|
+
client.middlewareStack.addRelativeTo(presignInterceptMiddleware, {
|
|
45
|
+
name: "presignInterceptMiddleware",
|
|
46
|
+
relation: "before",
|
|
47
|
+
toMiddleware: "awsAuthMiddleware",
|
|
48
|
+
});
|
|
49
|
+
_a.label = 1;
|
|
50
|
+
case 1:
|
|
51
|
+
_a.trys.push([1, , 3, 4]);
|
|
52
|
+
return [4, client.send(command)];
|
|
53
|
+
case 2:
|
|
54
|
+
output = _a.sent();
|
|
55
|
+
presigned = output.presigned;
|
|
56
|
+
return [3, 4];
|
|
57
|
+
case 3:
|
|
58
|
+
client.middlewareStack.remove("presignInterceptMiddleware");
|
|
59
|
+
return [7];
|
|
60
|
+
case 4: return [2, formatUrl(presigned)];
|
|
61
|
+
}
|
|
32
62
|
});
|
|
33
|
-
return {
|
|
34
|
-
response: {},
|
|
35
|
-
output: {
|
|
36
|
-
$metadata: { httpStatusCode: 200 },
|
|
37
|
-
presigned,
|
|
38
|
-
},
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
client.middlewareStack.addRelativeTo(presignInterceptMiddleware, {
|
|
42
|
-
name: "presignInterceptMiddleware",
|
|
43
|
-
relation: "before",
|
|
44
|
-
toMiddleware: "awsAuthMiddleware",
|
|
45
63
|
});
|
|
46
|
-
let presigned;
|
|
47
|
-
try {
|
|
48
|
-
const output = await client.send(command);
|
|
49
|
-
presigned = output.presigned;
|
|
50
|
-
}
|
|
51
|
-
finally {
|
|
52
|
-
client.middlewareStack.remove("presignInterceptMiddleware");
|
|
53
|
-
}
|
|
54
|
-
return formatUrl(presigned);
|
|
55
64
|
};
|
|
@@ -1,7 +1,15 @@
|
|
|
1
|
+
import { __awaiter, __generator } from "tslib";
|
|
1
2
|
import { SynthesizeSpeechCommand } from "@aws-sdk/client-polly";
|
|
2
3
|
import { getSignedUrl } from "./getSignedUrls";
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
export var getSynthesizeSpeechUrl = function (input) { return __awaiter(void 0, void 0, void 0, function () {
|
|
5
|
+
var command, options;
|
|
6
|
+
return __generator(this, function (_a) {
|
|
7
|
+
switch (_a.label) {
|
|
8
|
+
case 0:
|
|
9
|
+
command = new SynthesizeSpeechCommand(input.params);
|
|
10
|
+
options = input.options || {};
|
|
11
|
+
return [4, getSignedUrl(input.client, command, options)];
|
|
12
|
+
case 1: return [2, _a.sent()];
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
}); };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/polly-request-presigner",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.186.0",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
|
|
6
6
|
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
@@ -20,16 +20,16 @@
|
|
|
20
20
|
},
|
|
21
21
|
"license": "Apache-2.0",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@aws-sdk/client-polly": "3.
|
|
24
|
-
"@aws-sdk/protocol-http": "3.
|
|
25
|
-
"@aws-sdk/signature-v4": "3.
|
|
26
|
-
"@aws-sdk/types": "3.
|
|
27
|
-
"@aws-sdk/util-create-request": "3.
|
|
28
|
-
"@aws-sdk/util-format-url": "3.
|
|
23
|
+
"@aws-sdk/client-polly": "3.186.0",
|
|
24
|
+
"@aws-sdk/protocol-http": "3.186.0",
|
|
25
|
+
"@aws-sdk/signature-v4": "3.186.0",
|
|
26
|
+
"@aws-sdk/types": "3.186.0",
|
|
27
|
+
"@aws-sdk/util-create-request": "3.186.0",
|
|
28
|
+
"@aws-sdk/util-format-url": "3.186.0",
|
|
29
29
|
"tslib": "^2.3.1"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@aws-sdk/hash-node": "3.
|
|
32
|
+
"@aws-sdk/hash-node": "3.186.0",
|
|
33
33
|
"@tsconfig/recommended": "1.0.1",
|
|
34
34
|
"@types/node": "^12.0.2",
|
|
35
35
|
"concurrently": "7.0.0",
|