@aws-sdk/middleware-sdk-transcribe-streaming 3.901.0 → 3.914.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/index.js +51 -88
- package/package.json +7 -7
package/dist-cjs/index.js
CHANGED
|
@@ -1,99 +1,62 @@
|
|
|
1
|
-
|
|
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);
|
|
1
|
+
'use strict';
|
|
20
2
|
|
|
21
|
-
|
|
22
|
-
var
|
|
23
|
-
__export(index_exports, {
|
|
24
|
-
eventStreamPayloadHandler: () => eventStreamPayloadHandler,
|
|
25
|
-
getTranscribeStreamingPlugin: () => getTranscribeStreamingPlugin,
|
|
26
|
-
injectResponseValuesMiddleware: () => injectResponseValuesMiddleware,
|
|
27
|
-
injectResponseValuesMiddlewareOptions: () => injectResponseValuesMiddlewareOptions,
|
|
28
|
-
websocketPortMiddleware: () => websocketPortMiddleware,
|
|
29
|
-
websocketPortMiddlewareOptions: () => websocketPortMiddlewareOptions
|
|
30
|
-
});
|
|
31
|
-
module.exports = __toCommonJS(index_exports);
|
|
3
|
+
var uuid = require('@smithy/uuid');
|
|
4
|
+
var protocolHttp = require('@smithy/protocol-http');
|
|
32
5
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
handle: /* @__PURE__ */ __name((next, args) => next(args), "handle")
|
|
6
|
+
const eventStreamPayloadHandler = {
|
|
7
|
+
handle: (next, args) => next(args),
|
|
36
8
|
};
|
|
37
9
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
output[key] = requestParams[key];
|
|
10
|
+
const injectResponseValuesMiddleware = (config) => (next) => async (args) => {
|
|
11
|
+
if (args.input.SessionId === undefined && isWebSocket(config)) {
|
|
12
|
+
args.input.SessionId = uuid.v4();
|
|
13
|
+
}
|
|
14
|
+
const requestParams = {
|
|
15
|
+
...args.input,
|
|
16
|
+
};
|
|
17
|
+
const response = await next(args);
|
|
18
|
+
const output = response.output;
|
|
19
|
+
for (const key of Object.keys(output)) {
|
|
20
|
+
if (output[key] === undefined && requestParams[key]) {
|
|
21
|
+
output[key] = requestParams[key];
|
|
22
|
+
}
|
|
52
23
|
}
|
|
53
|
-
|
|
54
|
-
return response;
|
|
55
|
-
}, "injectResponseValuesMiddleware");
|
|
56
|
-
var isWebSocket = /* @__PURE__ */ __name((config) => config.requestHandler.metadata?.handlerProtocol?.includes("websocket"), "isWebSocket");
|
|
57
|
-
var injectResponseValuesMiddlewareOptions = {
|
|
58
|
-
step: "initialize",
|
|
59
|
-
name: "injectResponseValuesMiddleware",
|
|
60
|
-
tags: ["WEBSOCKET", "EVENT_STREAM"],
|
|
61
|
-
override: true
|
|
24
|
+
return response;
|
|
62
25
|
};
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
request.hostname = `${request.hostname}:8443`;
|
|
70
|
-
request.headers.host = request.hostname;
|
|
71
|
-
}
|
|
72
|
-
return next(args);
|
|
73
|
-
}, "websocketPortMiddleware");
|
|
74
|
-
var websocketPortMiddlewareOptions = {
|
|
75
|
-
name: "websocketPortMiddleware",
|
|
76
|
-
tags: ["WEBSOCKET", "EVENT_STREAM", "PORT"],
|
|
77
|
-
relation: "after",
|
|
78
|
-
toMiddleware: "eventStreamHeaderMiddleware",
|
|
79
|
-
override: true
|
|
26
|
+
const isWebSocket = (config) => config.requestHandler.metadata?.handlerProtocol?.includes("websocket");
|
|
27
|
+
const injectResponseValuesMiddlewareOptions = {
|
|
28
|
+
step: "initialize",
|
|
29
|
+
name: "injectResponseValuesMiddleware",
|
|
30
|
+
tags: ["WEBSOCKET", "EVENT_STREAM"],
|
|
31
|
+
override: true,
|
|
80
32
|
};
|
|
81
33
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
34
|
+
const websocketPortMiddleware = (options) => (next) => (args) => {
|
|
35
|
+
const { request } = args;
|
|
36
|
+
if (protocolHttp.HttpRequest.isInstance(request) && options.requestHandler.metadata?.handlerProtocol?.includes("websocket")) {
|
|
37
|
+
request.hostname = `${request.hostname}:8443`;
|
|
38
|
+
request.headers.host = request.hostname;
|
|
39
|
+
}
|
|
40
|
+
return next(args);
|
|
41
|
+
};
|
|
42
|
+
const websocketPortMiddlewareOptions = {
|
|
43
|
+
name: "websocketPortMiddleware",
|
|
44
|
+
tags: ["WEBSOCKET", "EVENT_STREAM", "PORT"],
|
|
45
|
+
relation: "after",
|
|
46
|
+
toMiddleware: "eventStreamHeaderMiddleware",
|
|
47
|
+
override: true,
|
|
48
|
+
};
|
|
90
49
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
websocketPortMiddleware,
|
|
97
|
-
websocketPortMiddlewareOptions
|
|
50
|
+
const getTranscribeStreamingPlugin = (config) => ({
|
|
51
|
+
applyToStack: (clientStack) => {
|
|
52
|
+
clientStack.addRelativeTo(websocketPortMiddleware(config), websocketPortMiddlewareOptions);
|
|
53
|
+
clientStack.add(injectResponseValuesMiddleware(config), injectResponseValuesMiddlewareOptions);
|
|
54
|
+
},
|
|
98
55
|
});
|
|
99
56
|
|
|
57
|
+
exports.eventStreamPayloadHandler = eventStreamPayloadHandler;
|
|
58
|
+
exports.getTranscribeStreamingPlugin = getTranscribeStreamingPlugin;
|
|
59
|
+
exports.injectResponseValuesMiddleware = injectResponseValuesMiddleware;
|
|
60
|
+
exports.injectResponseValuesMiddlewareOptions = injectResponseValuesMiddlewareOptions;
|
|
61
|
+
exports.websocketPortMiddleware = websocketPortMiddleware;
|
|
62
|
+
exports.websocketPortMiddlewareOptions = websocketPortMiddlewareOptions;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/middleware-sdk-transcribe-streaming",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.914.0",
|
|
4
4
|
"main": "./dist-cjs/index.js",
|
|
5
5
|
"module": "./dist-es/index.js",
|
|
6
6
|
"types": "./dist-types/index.d.ts",
|
|
@@ -24,12 +24,12 @@
|
|
|
24
24
|
},
|
|
25
25
|
"license": "Apache-2.0",
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@aws-sdk/types": "3.
|
|
28
|
-
"@aws-sdk/util-format-url": "3.
|
|
29
|
-
"@smithy/eventstream-serde-browser": "^4.2.
|
|
30
|
-
"@smithy/protocol-http": "^5.3.
|
|
31
|
-
"@smithy/signature-v4": "^5.3.
|
|
32
|
-
"@smithy/types": "^4.
|
|
27
|
+
"@aws-sdk/types": "3.914.0",
|
|
28
|
+
"@aws-sdk/util-format-url": "3.914.0",
|
|
29
|
+
"@smithy/eventstream-serde-browser": "^4.2.3",
|
|
30
|
+
"@smithy/protocol-http": "^5.3.3",
|
|
31
|
+
"@smithy/signature-v4": "^5.3.3",
|
|
32
|
+
"@smithy/types": "^4.8.0",
|
|
33
33
|
"@smithy/uuid": "^1.1.0",
|
|
34
34
|
"tslib": "^2.6.2"
|
|
35
35
|
},
|