@aws-sdk/polly-request-presigner 3.181.0 → 3.185.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 +16 -0
- package/dist-es/constants.js +7 -7
- package/dist-es/getSignedUrls.js +49 -58
- package/dist-es/getSynthesizeSpeechUrl.js +5 -13
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
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.185.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.184.0...v3.185.0) (2022-10-05)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @aws-sdk/polly-request-presigner
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [3.183.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.182.0...v3.183.0) (2022-10-03)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @aws-sdk/polly-request-presigner
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
6
22
|
# [3.181.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.180.0...v3.181.0) (2022-09-29)
|
|
7
23
|
|
|
8
24
|
**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 const ALGORITHM_QUERY_PARAM = "X-Amz-Algorithm";
|
|
2
|
+
export const CREDENTIAL_QUERY_PARAM = "X-Amz-Credential";
|
|
3
|
+
export const AMZ_DATE_QUERY_PARAM = "X-Amz-Date";
|
|
4
|
+
export const SIGNED_HEADERS_QUERY_PARAM = "X-Amz-SignedHeaders";
|
|
5
|
+
export const EXPIRES_QUERY_PARAM = "X-Amz-Expires";
|
|
6
|
+
export const HOST_HEADER = "host";
|
|
7
|
+
export const ALGORITHM_IDENTIFIER = "AWS4-HMAC-SHA256";
|
package/dist-es/getSignedUrls.js
CHANGED
|
@@ -1,64 +1,55 @@
|
|
|
1
|
-
import { __assign, __awaiter, __generator } from "tslib";
|
|
2
1
|
import { HttpRequest } from "@aws-sdk/protocol-http";
|
|
3
2
|
import { SignatureV4 } from "@aws-sdk/signature-v4";
|
|
4
3
|
import { formatUrl } from "@aws-sdk/util-format-url";
|
|
5
|
-
export
|
|
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
|
-
|
|
32
|
-
|
|
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
|
-
}
|
|
4
|
+
export const getSignedUrl = async (client, command, options = {}) => {
|
|
5
|
+
const signer = new SignatureV4({
|
|
6
|
+
service: options.service || "polly",
|
|
7
|
+
uriEscapePath: options.uriEscapePath || false,
|
|
8
|
+
...client.config,
|
|
9
|
+
});
|
|
10
|
+
const presignInterceptMiddleware = (next, context) => async (args) => {
|
|
11
|
+
const { request } = args;
|
|
12
|
+
if (!HttpRequest.isInstance(request)) {
|
|
13
|
+
throw new Error("Request to be presigned is not an valid HTTP request.");
|
|
14
|
+
}
|
|
15
|
+
request.method = "GET";
|
|
16
|
+
delete request.headers["amz-sdk-invocation-id"];
|
|
17
|
+
delete request.headers["amz-sdk-request"];
|
|
18
|
+
delete request.headers["content-length"];
|
|
19
|
+
request.body = "";
|
|
20
|
+
request.query = {
|
|
21
|
+
...request.query,
|
|
22
|
+
...args.input,
|
|
23
|
+
};
|
|
24
|
+
const unsignableHeaders = new Set();
|
|
25
|
+
unsignableHeaders.add("content-type");
|
|
26
|
+
const presigned = await signer.presign(request, {
|
|
27
|
+
expiresIn: 3600,
|
|
28
|
+
unsignableHeaders,
|
|
29
|
+
...options,
|
|
30
|
+
signingRegion: options.signingRegion ?? context["signing_region"],
|
|
31
|
+
signingService: options.signingService ?? context["signing_service"],
|
|
62
32
|
});
|
|
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",
|
|
63
45
|
});
|
|
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);
|
|
64
55
|
};
|
|
@@ -1,15 +1,7 @@
|
|
|
1
|
-
import { __awaiter, __generator } from "tslib";
|
|
2
1
|
import { SynthesizeSpeechCommand } from "@aws-sdk/client-polly";
|
|
3
2
|
import { getSignedUrl } from "./getSignedUrls";
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
}); };
|
|
3
|
+
export const getSynthesizeSpeechUrl = async (input) => {
|
|
4
|
+
const command = new SynthesizeSpeechCommand(input.params);
|
|
5
|
+
const options = input.options || {};
|
|
6
|
+
return await getSignedUrl(input.client, command, options);
|
|
7
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/polly-request-presigner",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.185.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.185.0",
|
|
24
|
+
"@aws-sdk/protocol-http": "3.183.0",
|
|
25
|
+
"@aws-sdk/signature-v4": "3.183.0",
|
|
26
|
+
"@aws-sdk/types": "3.183.0",
|
|
27
|
+
"@aws-sdk/util-create-request": "3.183.0",
|
|
28
|
+
"@aws-sdk/util-format-url": "3.183.0",
|
|
29
29
|
"tslib": "^2.3.1"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@aws-sdk/hash-node": "3.
|
|
32
|
+
"@aws-sdk/hash-node": "3.183.0",
|
|
33
33
|
"@tsconfig/recommended": "1.0.1",
|
|
34
34
|
"@types/node": "^12.0.2",
|
|
35
35
|
"concurrently": "7.0.0",
|