@aws-sdk/polly-request-presigner 3.489.0 → 3.495.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/dist-cjs/constants.js +1 -10
- package/dist-cjs/getSignedUrls.js +1 -60
- package/dist-cjs/getSynthesizeSpeechUrl.js +1 -11
- package/dist-cjs/index.js +96 -4
- package/package.json +8 -8
package/dist-cjs/constants.js
CHANGED
|
@@ -1,10 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ALGORITHM_IDENTIFIER = exports.HOST_HEADER = exports.EXPIRES_QUERY_PARAM = exports.SIGNED_HEADERS_QUERY_PARAM = exports.AMZ_DATE_QUERY_PARAM = exports.CREDENTIAL_QUERY_PARAM = exports.ALGORITHM_QUERY_PARAM = void 0;
|
|
4
|
-
exports.ALGORITHM_QUERY_PARAM = "X-Amz-Algorithm";
|
|
5
|
-
exports.CREDENTIAL_QUERY_PARAM = "X-Amz-Credential";
|
|
6
|
-
exports.AMZ_DATE_QUERY_PARAM = "X-Amz-Date";
|
|
7
|
-
exports.SIGNED_HEADERS_QUERY_PARAM = "X-Amz-SignedHeaders";
|
|
8
|
-
exports.EXPIRES_QUERY_PARAM = "X-Amz-Expires";
|
|
9
|
-
exports.HOST_HEADER = "host";
|
|
10
|
-
exports.ALGORITHM_IDENTIFIER = "AWS4-HMAC-SHA256";
|
|
1
|
+
module.exports = require("./index.js");
|
|
@@ -1,60 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getSignedUrl = void 0;
|
|
4
|
-
const util_format_url_1 = require("@aws-sdk/util-format-url");
|
|
5
|
-
const protocol_http_1 = require("@smithy/protocol-http");
|
|
6
|
-
const signature_v4_1 = require("@smithy/signature-v4");
|
|
7
|
-
const getSignedUrl = async (client, command, options = {}) => {
|
|
8
|
-
const signer = new signature_v4_1.SignatureV4({
|
|
9
|
-
service: options.service || "polly",
|
|
10
|
-
uriEscapePath: options.uriEscapePath || false,
|
|
11
|
-
...client.config,
|
|
12
|
-
});
|
|
13
|
-
const presignInterceptMiddleware = (next, context) => async (args) => {
|
|
14
|
-
var _a, _b;
|
|
15
|
-
const { request } = args;
|
|
16
|
-
if (!protocol_http_1.HttpRequest.isInstance(request)) {
|
|
17
|
-
throw new Error("Request to be presigned is not an valid HTTP request.");
|
|
18
|
-
}
|
|
19
|
-
request.method = "GET";
|
|
20
|
-
delete request.headers["amz-sdk-invocation-id"];
|
|
21
|
-
delete request.headers["amz-sdk-request"];
|
|
22
|
-
delete request.headers["content-length"];
|
|
23
|
-
request.body = "";
|
|
24
|
-
request.query = {
|
|
25
|
-
...request.query,
|
|
26
|
-
...args.input,
|
|
27
|
-
};
|
|
28
|
-
const unsignableHeaders = new Set();
|
|
29
|
-
unsignableHeaders.add("content-type");
|
|
30
|
-
const presigned = await signer.presign(request, {
|
|
31
|
-
expiresIn: 3600,
|
|
32
|
-
unsignableHeaders,
|
|
33
|
-
...options,
|
|
34
|
-
signingRegion: (_a = options.signingRegion) !== null && _a !== void 0 ? _a : context["signing_region"],
|
|
35
|
-
signingService: (_b = options.signingService) !== null && _b !== void 0 ? _b : context["signing_service"],
|
|
36
|
-
});
|
|
37
|
-
return {
|
|
38
|
-
response: {},
|
|
39
|
-
output: {
|
|
40
|
-
$metadata: { httpStatusCode: 200 },
|
|
41
|
-
presigned,
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
};
|
|
45
|
-
client.middlewareStack.addRelativeTo(presignInterceptMiddleware, {
|
|
46
|
-
name: "presignInterceptMiddleware",
|
|
47
|
-
relation: "before",
|
|
48
|
-
toMiddleware: "awsAuthMiddleware",
|
|
49
|
-
});
|
|
50
|
-
let presigned;
|
|
51
|
-
try {
|
|
52
|
-
const output = await client.send(command);
|
|
53
|
-
presigned = output.presigned;
|
|
54
|
-
}
|
|
55
|
-
finally {
|
|
56
|
-
client.middlewareStack.remove("presignInterceptMiddleware");
|
|
57
|
-
}
|
|
58
|
-
return (0, util_format_url_1.formatUrl)(presigned);
|
|
59
|
-
};
|
|
60
|
-
exports.getSignedUrl = getSignedUrl;
|
|
1
|
+
module.exports = require("./index.js");
|
|
@@ -1,11 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getSynthesizeSpeechUrl = void 0;
|
|
4
|
-
const client_polly_1 = require("@aws-sdk/client-polly");
|
|
5
|
-
const getSignedUrls_1 = require("./getSignedUrls");
|
|
6
|
-
const getSynthesizeSpeechUrl = async (input) => {
|
|
7
|
-
const command = new client_polly_1.SynthesizeSpeechCommand(input.params);
|
|
8
|
-
const options = input.options || {};
|
|
9
|
-
return await (0, getSignedUrls_1.getSignedUrl)(input.client, command, options);
|
|
10
|
-
};
|
|
11
|
-
exports.getSynthesizeSpeechUrl = getSynthesizeSpeechUrl;
|
|
1
|
+
module.exports = require("./index.js");
|
package/dist-cjs/index.js
CHANGED
|
@@ -1,4 +1,96 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var src_exports = {};
|
|
22
|
+
__export(src_exports, {
|
|
23
|
+
getSynthesizeSpeechUrl: () => getSynthesizeSpeechUrl
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(src_exports);
|
|
26
|
+
|
|
27
|
+
// src/getSynthesizeSpeechUrl.ts
|
|
28
|
+
var import_client_polly = require("@aws-sdk/client-polly");
|
|
29
|
+
|
|
30
|
+
// src/getSignedUrls.ts
|
|
31
|
+
var import_util_format_url = require("@aws-sdk/util-format-url");
|
|
32
|
+
var import_protocol_http = require("@smithy/protocol-http");
|
|
33
|
+
var import_signature_v4 = require("@smithy/signature-v4");
|
|
34
|
+
var getSignedUrl = /* @__PURE__ */ __name(async (client, command, options = {}) => {
|
|
35
|
+
const signer = new import_signature_v4.SignatureV4({
|
|
36
|
+
service: options.service || "polly",
|
|
37
|
+
uriEscapePath: options.uriEscapePath || false,
|
|
38
|
+
...client.config
|
|
39
|
+
});
|
|
40
|
+
const presignInterceptMiddleware = /* @__PURE__ */ __name((next, context) => async (args) => {
|
|
41
|
+
const { request } = args;
|
|
42
|
+
if (!import_protocol_http.HttpRequest.isInstance(request)) {
|
|
43
|
+
throw new Error("Request to be presigned is not an valid HTTP request.");
|
|
44
|
+
}
|
|
45
|
+
request.method = "GET";
|
|
46
|
+
delete request.headers["amz-sdk-invocation-id"];
|
|
47
|
+
delete request.headers["amz-sdk-request"];
|
|
48
|
+
delete request.headers["content-length"];
|
|
49
|
+
request.body = "";
|
|
50
|
+
request.query = {
|
|
51
|
+
...request.query,
|
|
52
|
+
...args.input
|
|
53
|
+
};
|
|
54
|
+
const unsignableHeaders = /* @__PURE__ */ new Set();
|
|
55
|
+
unsignableHeaders.add("content-type");
|
|
56
|
+
const presigned2 = await signer.presign(request, {
|
|
57
|
+
expiresIn: 3600,
|
|
58
|
+
unsignableHeaders,
|
|
59
|
+
...options,
|
|
60
|
+
signingRegion: options.signingRegion ?? context["signing_region"],
|
|
61
|
+
signingService: options.signingService ?? context["signing_service"]
|
|
62
|
+
});
|
|
63
|
+
return {
|
|
64
|
+
// Intercept the middleware stack by returning fake response
|
|
65
|
+
response: {},
|
|
66
|
+
output: {
|
|
67
|
+
$metadata: { httpStatusCode: 200 },
|
|
68
|
+
presigned: presigned2
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
}, "presignInterceptMiddleware");
|
|
72
|
+
client.middlewareStack.addRelativeTo(presignInterceptMiddleware, {
|
|
73
|
+
name: "presignInterceptMiddleware",
|
|
74
|
+
relation: "before",
|
|
75
|
+
toMiddleware: "awsAuthMiddleware"
|
|
76
|
+
});
|
|
77
|
+
let presigned;
|
|
78
|
+
try {
|
|
79
|
+
const output = await client.send(command);
|
|
80
|
+
presigned = output.presigned;
|
|
81
|
+
} finally {
|
|
82
|
+
client.middlewareStack.remove("presignInterceptMiddleware");
|
|
83
|
+
}
|
|
84
|
+
return (0, import_util_format_url.formatUrl)(presigned);
|
|
85
|
+
}, "getSignedUrl");
|
|
86
|
+
|
|
87
|
+
// src/getSynthesizeSpeechUrl.ts
|
|
88
|
+
var getSynthesizeSpeechUrl = /* @__PURE__ */ __name(async (input) => {
|
|
89
|
+
const command = new import_client_polly.SynthesizeSpeechCommand(input.params);
|
|
90
|
+
const options = input.options || {};
|
|
91
|
+
return await getSignedUrl(input.client, command, options);
|
|
92
|
+
}, "getSynthesizeSpeechUrl");
|
|
93
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
94
|
+
0 && (module.exports = {
|
|
95
|
+
getSynthesizeSpeechUrl
|
|
96
|
+
});
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/polly-request-presigner",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.495.0",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
|
|
6
|
-
"build:cjs": "
|
|
6
|
+
"build:cjs": "node ../../scripts/compilation/inline polly-request-presigner",
|
|
7
7
|
"build:es": "tsc -p tsconfig.es.json",
|
|
8
8
|
"build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build",
|
|
9
9
|
"build:types": "tsc -p tsconfig.types.json",
|
|
@@ -21,12 +21,12 @@
|
|
|
21
21
|
},
|
|
22
22
|
"license": "Apache-2.0",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@aws-sdk/client-polly": "3.
|
|
25
|
-
"@aws-sdk/types": "3.
|
|
26
|
-
"@aws-sdk/util-format-url": "3.
|
|
27
|
-
"@smithy/protocol-http": "^3.0
|
|
28
|
-
"@smithy/signature-v4": "^2.
|
|
29
|
-
"@smithy/types": "^2.
|
|
24
|
+
"@aws-sdk/client-polly": "3.495.0",
|
|
25
|
+
"@aws-sdk/types": "3.495.0",
|
|
26
|
+
"@aws-sdk/util-format-url": "3.495.0",
|
|
27
|
+
"@smithy/protocol-http": "^3.1.0",
|
|
28
|
+
"@smithy/signature-v4": "^2.1.0",
|
|
29
|
+
"@smithy/types": "^2.9.0",
|
|
30
30
|
"tslib": "^2.5.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|