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