@aws-sdk/client-transcribe-streaming 3.186.0 → 3.188.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/TranscribeStreaming.js +10 -17
- package/dist-es/TranscribeStreamingClient.js +26 -32
- package/dist-es/commands/StartMedicalStreamTranscriptionCommand.js +21 -28
- package/dist-es/commands/StartStreamTranscriptionCommand.js +21 -28
- package/dist-es/endpoints.js +8 -8
- package/dist-es/models/TranscribeStreamingServiceException.js +5 -10
- package/dist-es/models/models_0.js +127 -91
- package/dist-es/protocols/Aws_restJson1.js +503 -654
- package/dist-es/runtimeConfig.browser.js +28 -12
- package/dist-es/runtimeConfig.js +33 -19
- package/dist-es/runtimeConfig.native.js +10 -5
- package/dist-es/runtimeConfig.shared.js +8 -11
- package/package.json +39 -39
|
@@ -1,598 +1,465 @@
|
|
|
1
|
-
import { __assign, __awaiter, __generator } from "tslib";
|
|
2
1
|
import { HttpRequest as __HttpRequest } from "@aws-sdk/protocol-http";
|
|
3
2
|
import { decorateServiceException as __decorateServiceException, expectBoolean as __expectBoolean, expectString as __expectString, limitedParseDouble as __limitedParseDouble, map as __map, parseBoolean as __parseBoolean, strictParseInt32 as __strictParseInt32, throwDefaultError, } from "@aws-sdk/smithy-client";
|
|
4
3
|
import { AudioStream, BadRequestException, ConflictException, InternalFailureException, LimitExceededException, ServiceUnavailableException, } from "../models/models_0";
|
|
5
4
|
import { TranscribeStreamingServiceException as __BaseException } from "../models/TranscribeStreamingServiceException";
|
|
6
|
-
export
|
|
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
|
-
"x-amzn-transcribe-number-of-channels": [
|
|
33
|
-
function () { return isSerializableHeaderValue(input.NumberOfChannels); },
|
|
34
|
-
function () { return input.NumberOfChannels.toString(); },
|
|
35
|
-
],
|
|
36
|
-
"x-amzn-transcribe-content-identification-type": input.ContentIdentificationType,
|
|
37
|
-
});
|
|
38
|
-
resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/medical-stream-transcription";
|
|
39
|
-
if (input.AudioStream !== undefined) {
|
|
40
|
-
body = serializeAws_restJson1AudioStream(input.AudioStream, context);
|
|
41
|
-
}
|
|
42
|
-
return [2, new __HttpRequest({
|
|
43
|
-
protocol: protocol,
|
|
44
|
-
hostname: hostname,
|
|
45
|
-
port: port,
|
|
46
|
-
method: "POST",
|
|
47
|
-
headers: headers,
|
|
48
|
-
path: resolvedPath,
|
|
49
|
-
body: body,
|
|
50
|
-
})];
|
|
51
|
-
}
|
|
5
|
+
export const serializeAws_restJson1StartMedicalStreamTranscriptionCommand = async (input, context) => {
|
|
6
|
+
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
|
|
7
|
+
const headers = map({}, isSerializableHeaderValue, {
|
|
8
|
+
"x-amzn-transcribe-language-code": input.LanguageCode,
|
|
9
|
+
"x-amzn-transcribe-sample-rate": [
|
|
10
|
+
() => isSerializableHeaderValue(input.MediaSampleRateHertz),
|
|
11
|
+
() => input.MediaSampleRateHertz.toString(),
|
|
12
|
+
],
|
|
13
|
+
"x-amzn-transcribe-media-encoding": input.MediaEncoding,
|
|
14
|
+
"x-amzn-transcribe-vocabulary-name": input.VocabularyName,
|
|
15
|
+
"x-amzn-transcribe-specialty": input.Specialty,
|
|
16
|
+
"x-amzn-transcribe-type": input.Type,
|
|
17
|
+
"x-amzn-transcribe-show-speaker-label": [
|
|
18
|
+
() => isSerializableHeaderValue(input.ShowSpeakerLabel),
|
|
19
|
+
() => input.ShowSpeakerLabel.toString(),
|
|
20
|
+
],
|
|
21
|
+
"x-amzn-transcribe-session-id": input.SessionId,
|
|
22
|
+
"x-amzn-transcribe-enable-channel-identification": [
|
|
23
|
+
() => isSerializableHeaderValue(input.EnableChannelIdentification),
|
|
24
|
+
() => input.EnableChannelIdentification.toString(),
|
|
25
|
+
],
|
|
26
|
+
"x-amzn-transcribe-number-of-channels": [
|
|
27
|
+
() => isSerializableHeaderValue(input.NumberOfChannels),
|
|
28
|
+
() => input.NumberOfChannels.toString(),
|
|
29
|
+
],
|
|
30
|
+
"x-amzn-transcribe-content-identification-type": input.ContentIdentificationType,
|
|
52
31
|
});
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
],
|
|
67
|
-
"x-amzn-transcribe-media-encoding": input.MediaEncoding,
|
|
68
|
-
"x-amzn-transcribe-vocabulary-name": input.VocabularyName,
|
|
69
|
-
"x-amzn-transcribe-session-id": input.SessionId,
|
|
70
|
-
"x-amzn-transcribe-vocabulary-filter-name": input.VocabularyFilterName,
|
|
71
|
-
"x-amzn-transcribe-vocabulary-filter-method": input.VocabularyFilterMethod,
|
|
72
|
-
"x-amzn-transcribe-show-speaker-label": [
|
|
73
|
-
function () { return isSerializableHeaderValue(input.ShowSpeakerLabel); },
|
|
74
|
-
function () { return input.ShowSpeakerLabel.toString(); },
|
|
75
|
-
],
|
|
76
|
-
"x-amzn-transcribe-enable-channel-identification": [
|
|
77
|
-
function () { return isSerializableHeaderValue(input.EnableChannelIdentification); },
|
|
78
|
-
function () { return input.EnableChannelIdentification.toString(); },
|
|
79
|
-
],
|
|
80
|
-
"x-amzn-transcribe-number-of-channels": [
|
|
81
|
-
function () { return isSerializableHeaderValue(input.NumberOfChannels); },
|
|
82
|
-
function () { return input.NumberOfChannels.toString(); },
|
|
83
|
-
],
|
|
84
|
-
"x-amzn-transcribe-enable-partial-results-stabilization": [
|
|
85
|
-
function () { return isSerializableHeaderValue(input.EnablePartialResultsStabilization); },
|
|
86
|
-
function () { return input.EnablePartialResultsStabilization.toString(); },
|
|
87
|
-
],
|
|
88
|
-
"x-amzn-transcribe-partial-results-stability": input.PartialResultsStability,
|
|
89
|
-
"x-amzn-transcribe-content-identification-type": input.ContentIdentificationType,
|
|
90
|
-
"x-amzn-transcribe-content-redaction-type": input.ContentRedactionType,
|
|
91
|
-
"x-amzn-transcribe-pii-entity-types": input.PiiEntityTypes,
|
|
92
|
-
"x-amzn-transcribe-language-model-name": input.LanguageModelName,
|
|
93
|
-
"x-amzn-transcribe-identify-language": [
|
|
94
|
-
function () { return isSerializableHeaderValue(input.IdentifyLanguage); },
|
|
95
|
-
function () { return input.IdentifyLanguage.toString(); },
|
|
96
|
-
],
|
|
97
|
-
"x-amzn-transcribe-language-options": input.LanguageOptions,
|
|
98
|
-
"x-amzn-transcribe-preferred-language": input.PreferredLanguage,
|
|
99
|
-
"x-amzn-transcribe-vocabulary-names": input.VocabularyNames,
|
|
100
|
-
"x-amzn-transcribe-vocabulary-filter-names": input.VocabularyFilterNames,
|
|
101
|
-
});
|
|
102
|
-
resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/stream-transcription";
|
|
103
|
-
if (input.AudioStream !== undefined) {
|
|
104
|
-
body = serializeAws_restJson1AudioStream(input.AudioStream, context);
|
|
105
|
-
}
|
|
106
|
-
return [2, new __HttpRequest({
|
|
107
|
-
protocol: protocol,
|
|
108
|
-
hostname: hostname,
|
|
109
|
-
port: port,
|
|
110
|
-
method: "POST",
|
|
111
|
-
headers: headers,
|
|
112
|
-
path: resolvedPath,
|
|
113
|
-
body: body,
|
|
114
|
-
})];
|
|
115
|
-
}
|
|
32
|
+
const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/medical-stream-transcription";
|
|
33
|
+
let body;
|
|
34
|
+
if (input.AudioStream !== undefined) {
|
|
35
|
+
body = serializeAws_restJson1AudioStream(input.AudioStream, context);
|
|
36
|
+
}
|
|
37
|
+
return new __HttpRequest({
|
|
38
|
+
protocol,
|
|
39
|
+
hostname,
|
|
40
|
+
port,
|
|
41
|
+
method: "POST",
|
|
42
|
+
headers,
|
|
43
|
+
path: resolvedPath,
|
|
44
|
+
body,
|
|
116
45
|
});
|
|
117
|
-
}
|
|
118
|
-
export
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
46
|
+
};
|
|
47
|
+
export const serializeAws_restJson1StartStreamTranscriptionCommand = async (input, context) => {
|
|
48
|
+
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
|
|
49
|
+
const headers = map({}, isSerializableHeaderValue, {
|
|
50
|
+
"x-amzn-transcribe-language-code": input.LanguageCode,
|
|
51
|
+
"x-amzn-transcribe-sample-rate": [
|
|
52
|
+
() => isSerializableHeaderValue(input.MediaSampleRateHertz),
|
|
53
|
+
() => input.MediaSampleRateHertz.toString(),
|
|
54
|
+
],
|
|
55
|
+
"x-amzn-transcribe-media-encoding": input.MediaEncoding,
|
|
56
|
+
"x-amzn-transcribe-vocabulary-name": input.VocabularyName,
|
|
57
|
+
"x-amzn-transcribe-session-id": input.SessionId,
|
|
58
|
+
"x-amzn-transcribe-vocabulary-filter-name": input.VocabularyFilterName,
|
|
59
|
+
"x-amzn-transcribe-vocabulary-filter-method": input.VocabularyFilterMethod,
|
|
60
|
+
"x-amzn-transcribe-show-speaker-label": [
|
|
61
|
+
() => isSerializableHeaderValue(input.ShowSpeakerLabel),
|
|
62
|
+
() => input.ShowSpeakerLabel.toString(),
|
|
63
|
+
],
|
|
64
|
+
"x-amzn-transcribe-enable-channel-identification": [
|
|
65
|
+
() => isSerializableHeaderValue(input.EnableChannelIdentification),
|
|
66
|
+
() => input.EnableChannelIdentification.toString(),
|
|
67
|
+
],
|
|
68
|
+
"x-amzn-transcribe-number-of-channels": [
|
|
69
|
+
() => isSerializableHeaderValue(input.NumberOfChannels),
|
|
70
|
+
() => input.NumberOfChannels.toString(),
|
|
71
|
+
],
|
|
72
|
+
"x-amzn-transcribe-enable-partial-results-stabilization": [
|
|
73
|
+
() => isSerializableHeaderValue(input.EnablePartialResultsStabilization),
|
|
74
|
+
() => input.EnablePartialResultsStabilization.toString(),
|
|
75
|
+
],
|
|
76
|
+
"x-amzn-transcribe-partial-results-stability": input.PartialResultsStability,
|
|
77
|
+
"x-amzn-transcribe-content-identification-type": input.ContentIdentificationType,
|
|
78
|
+
"x-amzn-transcribe-content-redaction-type": input.ContentRedactionType,
|
|
79
|
+
"x-amzn-transcribe-pii-entity-types": input.PiiEntityTypes,
|
|
80
|
+
"x-amzn-transcribe-language-model-name": input.LanguageModelName,
|
|
81
|
+
"x-amzn-transcribe-identify-language": [
|
|
82
|
+
() => isSerializableHeaderValue(input.IdentifyLanguage),
|
|
83
|
+
() => input.IdentifyLanguage.toString(),
|
|
84
|
+
],
|
|
85
|
+
"x-amzn-transcribe-language-options": input.LanguageOptions,
|
|
86
|
+
"x-amzn-transcribe-preferred-language": input.PreferredLanguage,
|
|
87
|
+
"x-amzn-transcribe-vocabulary-names": input.VocabularyNames,
|
|
88
|
+
"x-amzn-transcribe-vocabulary-filter-names": input.VocabularyFilterNames,
|
|
154
89
|
});
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
_b = errorCode;
|
|
169
|
-
switch (_b) {
|
|
170
|
-
case "BadRequestException": return [3, 2];
|
|
171
|
-
case "com.amazonaws.transcribestreaming#BadRequestException": return [3, 2];
|
|
172
|
-
case "ConflictException": return [3, 4];
|
|
173
|
-
case "com.amazonaws.transcribestreaming#ConflictException": return [3, 4];
|
|
174
|
-
case "InternalFailureException": return [3, 6];
|
|
175
|
-
case "com.amazonaws.transcribestreaming#InternalFailureException": return [3, 6];
|
|
176
|
-
case "LimitExceededException": return [3, 8];
|
|
177
|
-
case "com.amazonaws.transcribestreaming#LimitExceededException": return [3, 8];
|
|
178
|
-
case "ServiceUnavailableException": return [3, 10];
|
|
179
|
-
case "com.amazonaws.transcribestreaming#ServiceUnavailableException": return [3, 10];
|
|
180
|
-
}
|
|
181
|
-
return [3, 12];
|
|
182
|
-
case 2: return [4, deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)];
|
|
183
|
-
case 3: throw _d.sent();
|
|
184
|
-
case 4: return [4, deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)];
|
|
185
|
-
case 5: throw _d.sent();
|
|
186
|
-
case 6: return [4, deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)];
|
|
187
|
-
case 7: throw _d.sent();
|
|
188
|
-
case 8: return [4, deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context)];
|
|
189
|
-
case 9: throw _d.sent();
|
|
190
|
-
case 10: return [4, deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context)];
|
|
191
|
-
case 11: throw _d.sent();
|
|
192
|
-
case 12:
|
|
193
|
-
parsedBody = parsedOutput.body;
|
|
194
|
-
throwDefaultError({
|
|
195
|
-
output: output,
|
|
196
|
-
parsedBody: parsedBody,
|
|
197
|
-
exceptionCtor: __BaseException,
|
|
198
|
-
errorCode: errorCode,
|
|
199
|
-
});
|
|
200
|
-
_d.label = 13;
|
|
201
|
-
case 13: return [2];
|
|
202
|
-
}
|
|
90
|
+
const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/stream-transcription";
|
|
91
|
+
let body;
|
|
92
|
+
if (input.AudioStream !== undefined) {
|
|
93
|
+
body = serializeAws_restJson1AudioStream(input.AudioStream, context);
|
|
94
|
+
}
|
|
95
|
+
return new __HttpRequest({
|
|
96
|
+
protocol,
|
|
97
|
+
hostname,
|
|
98
|
+
port,
|
|
99
|
+
method: "POST",
|
|
100
|
+
headers,
|
|
101
|
+
path: resolvedPath,
|
|
102
|
+
body,
|
|
203
103
|
});
|
|
204
|
-
}
|
|
205
|
-
export
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
],
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
],
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
],
|
|
236
|
-
EnablePartialResultsStabilization: [
|
|
237
|
-
function () { return void 0 !== output.headers["x-amzn-transcribe-enable-partial-results-stabilization"]; },
|
|
238
|
-
function () { return __parseBoolean(output.headers["x-amzn-transcribe-enable-partial-results-stabilization"]); },
|
|
239
|
-
],
|
|
240
|
-
PartialResultsStability: [, output.headers["x-amzn-transcribe-partial-results-stability"]],
|
|
241
|
-
ContentIdentificationType: [, output.headers["x-amzn-transcribe-content-identification-type"]],
|
|
242
|
-
ContentRedactionType: [, output.headers["x-amzn-transcribe-content-redaction-type"]],
|
|
243
|
-
PiiEntityTypes: [, output.headers["x-amzn-transcribe-pii-entity-types"]],
|
|
244
|
-
LanguageModelName: [, output.headers["x-amzn-transcribe-language-model-name"]],
|
|
245
|
-
IdentifyLanguage: [
|
|
246
|
-
function () { return void 0 !== output.headers["x-amzn-transcribe-identify-language"]; },
|
|
247
|
-
function () { return __parseBoolean(output.headers["x-amzn-transcribe-identify-language"]); },
|
|
248
|
-
],
|
|
249
|
-
LanguageOptions: [, output.headers["x-amzn-transcribe-language-options"]],
|
|
250
|
-
PreferredLanguage: [, output.headers["x-amzn-transcribe-preferred-language"]],
|
|
251
|
-
VocabularyNames: [, output.headers["x-amzn-transcribe-vocabulary-names"]],
|
|
252
|
-
VocabularyFilterNames: [, output.headers["x-amzn-transcribe-vocabulary-filter-names"]],
|
|
253
|
-
});
|
|
254
|
-
data = output.body;
|
|
255
|
-
contents.TranscriptResultStream = deserializeAws_restJson1TranscriptResultStream(data, context);
|
|
256
|
-
return [2, contents];
|
|
104
|
+
};
|
|
105
|
+
export const deserializeAws_restJson1StartMedicalStreamTranscriptionCommand = async (output, context) => {
|
|
106
|
+
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
107
|
+
return deserializeAws_restJson1StartMedicalStreamTranscriptionCommandError(output, context);
|
|
108
|
+
}
|
|
109
|
+
const contents = map({
|
|
110
|
+
$metadata: deserializeMetadata(output),
|
|
111
|
+
RequestId: [, output.headers["x-amzn-request-id"]],
|
|
112
|
+
LanguageCode: [, output.headers["x-amzn-transcribe-language-code"]],
|
|
113
|
+
MediaSampleRateHertz: [
|
|
114
|
+
() => void 0 !== output.headers["x-amzn-transcribe-sample-rate"],
|
|
115
|
+
() => __strictParseInt32(output.headers["x-amzn-transcribe-sample-rate"]),
|
|
116
|
+
],
|
|
117
|
+
MediaEncoding: [, output.headers["x-amzn-transcribe-media-encoding"]],
|
|
118
|
+
VocabularyName: [, output.headers["x-amzn-transcribe-vocabulary-name"]],
|
|
119
|
+
Specialty: [, output.headers["x-amzn-transcribe-specialty"]],
|
|
120
|
+
Type: [, output.headers["x-amzn-transcribe-type"]],
|
|
121
|
+
ShowSpeakerLabel: [
|
|
122
|
+
() => void 0 !== output.headers["x-amzn-transcribe-show-speaker-label"],
|
|
123
|
+
() => __parseBoolean(output.headers["x-amzn-transcribe-show-speaker-label"]),
|
|
124
|
+
],
|
|
125
|
+
SessionId: [, output.headers["x-amzn-transcribe-session-id"]],
|
|
126
|
+
EnableChannelIdentification: [
|
|
127
|
+
() => void 0 !== output.headers["x-amzn-transcribe-enable-channel-identification"],
|
|
128
|
+
() => __parseBoolean(output.headers["x-amzn-transcribe-enable-channel-identification"]),
|
|
129
|
+
],
|
|
130
|
+
NumberOfChannels: [
|
|
131
|
+
() => void 0 !== output.headers["x-amzn-transcribe-number-of-channels"],
|
|
132
|
+
() => __strictParseInt32(output.headers["x-amzn-transcribe-number-of-channels"]),
|
|
133
|
+
],
|
|
134
|
+
ContentIdentificationType: [, output.headers["x-amzn-transcribe-content-identification-type"]],
|
|
257
135
|
});
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
136
|
+
const data = output.body;
|
|
137
|
+
contents.TranscriptResultStream = deserializeAws_restJson1MedicalTranscriptResultStream(data, context);
|
|
138
|
+
return contents;
|
|
139
|
+
};
|
|
140
|
+
const deserializeAws_restJson1StartMedicalStreamTranscriptionCommandError = async (output, context) => {
|
|
141
|
+
const parsedOutput = {
|
|
142
|
+
...output,
|
|
143
|
+
body: await parseErrorBody(output.body, context),
|
|
144
|
+
};
|
|
145
|
+
const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
146
|
+
switch (errorCode) {
|
|
147
|
+
case "BadRequestException":
|
|
148
|
+
case "com.amazonaws.transcribestreaming#BadRequestException":
|
|
149
|
+
throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
|
|
150
|
+
case "ConflictException":
|
|
151
|
+
case "com.amazonaws.transcribestreaming#ConflictException":
|
|
152
|
+
throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
|
|
153
|
+
case "InternalFailureException":
|
|
154
|
+
case "com.amazonaws.transcribestreaming#InternalFailureException":
|
|
155
|
+
throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
|
|
156
|
+
case "LimitExceededException":
|
|
157
|
+
case "com.amazonaws.transcribestreaming#LimitExceededException":
|
|
158
|
+
throw await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context);
|
|
159
|
+
case "ServiceUnavailableException":
|
|
160
|
+
case "com.amazonaws.transcribestreaming#ServiceUnavailableException":
|
|
161
|
+
throw await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context);
|
|
162
|
+
default:
|
|
163
|
+
const parsedBody = parsedOutput.body;
|
|
164
|
+
throwDefaultError({
|
|
165
|
+
output,
|
|
166
|
+
parsedBody,
|
|
167
|
+
exceptionCtor: __BaseException,
|
|
168
|
+
errorCode,
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
export const deserializeAws_restJson1StartStreamTranscriptionCommand = async (output, context) => {
|
|
173
|
+
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
174
|
+
return deserializeAws_restJson1StartStreamTranscriptionCommandError(output, context);
|
|
175
|
+
}
|
|
176
|
+
const contents = map({
|
|
177
|
+
$metadata: deserializeMetadata(output),
|
|
178
|
+
RequestId: [, output.headers["x-amzn-request-id"]],
|
|
179
|
+
LanguageCode: [, output.headers["x-amzn-transcribe-language-code"]],
|
|
180
|
+
MediaSampleRateHertz: [
|
|
181
|
+
() => void 0 !== output.headers["x-amzn-transcribe-sample-rate"],
|
|
182
|
+
() => __strictParseInt32(output.headers["x-amzn-transcribe-sample-rate"]),
|
|
183
|
+
],
|
|
184
|
+
MediaEncoding: [, output.headers["x-amzn-transcribe-media-encoding"]],
|
|
185
|
+
VocabularyName: [, output.headers["x-amzn-transcribe-vocabulary-name"]],
|
|
186
|
+
SessionId: [, output.headers["x-amzn-transcribe-session-id"]],
|
|
187
|
+
VocabularyFilterName: [, output.headers["x-amzn-transcribe-vocabulary-filter-name"]],
|
|
188
|
+
VocabularyFilterMethod: [, output.headers["x-amzn-transcribe-vocabulary-filter-method"]],
|
|
189
|
+
ShowSpeakerLabel: [
|
|
190
|
+
() => void 0 !== output.headers["x-amzn-transcribe-show-speaker-label"],
|
|
191
|
+
() => __parseBoolean(output.headers["x-amzn-transcribe-show-speaker-label"]),
|
|
192
|
+
],
|
|
193
|
+
EnableChannelIdentification: [
|
|
194
|
+
() => void 0 !== output.headers["x-amzn-transcribe-enable-channel-identification"],
|
|
195
|
+
() => __parseBoolean(output.headers["x-amzn-transcribe-enable-channel-identification"]),
|
|
196
|
+
],
|
|
197
|
+
NumberOfChannels: [
|
|
198
|
+
() => void 0 !== output.headers["x-amzn-transcribe-number-of-channels"],
|
|
199
|
+
() => __strictParseInt32(output.headers["x-amzn-transcribe-number-of-channels"]),
|
|
200
|
+
],
|
|
201
|
+
EnablePartialResultsStabilization: [
|
|
202
|
+
() => void 0 !== output.headers["x-amzn-transcribe-enable-partial-results-stabilization"],
|
|
203
|
+
() => __parseBoolean(output.headers["x-amzn-transcribe-enable-partial-results-stabilization"]),
|
|
204
|
+
],
|
|
205
|
+
PartialResultsStability: [, output.headers["x-amzn-transcribe-partial-results-stability"]],
|
|
206
|
+
ContentIdentificationType: [, output.headers["x-amzn-transcribe-content-identification-type"]],
|
|
207
|
+
ContentRedactionType: [, output.headers["x-amzn-transcribe-content-redaction-type"]],
|
|
208
|
+
PiiEntityTypes: [, output.headers["x-amzn-transcribe-pii-entity-types"]],
|
|
209
|
+
LanguageModelName: [, output.headers["x-amzn-transcribe-language-model-name"]],
|
|
210
|
+
IdentifyLanguage: [
|
|
211
|
+
() => void 0 !== output.headers["x-amzn-transcribe-identify-language"],
|
|
212
|
+
() => __parseBoolean(output.headers["x-amzn-transcribe-identify-language"]),
|
|
213
|
+
],
|
|
214
|
+
LanguageOptions: [, output.headers["x-amzn-transcribe-language-options"]],
|
|
215
|
+
PreferredLanguage: [, output.headers["x-amzn-transcribe-preferred-language"]],
|
|
216
|
+
VocabularyNames: [, output.headers["x-amzn-transcribe-vocabulary-names"]],
|
|
217
|
+
VocabularyFilterNames: [, output.headers["x-amzn-transcribe-vocabulary-filter-names"]],
|
|
306
218
|
});
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
219
|
+
const data = output.body;
|
|
220
|
+
contents.TranscriptResultStream = deserializeAws_restJson1TranscriptResultStream(data, context);
|
|
221
|
+
return contents;
|
|
222
|
+
};
|
|
223
|
+
const deserializeAws_restJson1StartStreamTranscriptionCommandError = async (output, context) => {
|
|
224
|
+
const parsedOutput = {
|
|
225
|
+
...output,
|
|
226
|
+
body: await parseErrorBody(output.body, context),
|
|
227
|
+
};
|
|
228
|
+
const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
229
|
+
switch (errorCode) {
|
|
230
|
+
case "BadRequestException":
|
|
231
|
+
case "com.amazonaws.transcribestreaming#BadRequestException":
|
|
232
|
+
throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
|
|
233
|
+
case "ConflictException":
|
|
234
|
+
case "com.amazonaws.transcribestreaming#ConflictException":
|
|
235
|
+
throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
|
|
236
|
+
case "InternalFailureException":
|
|
237
|
+
case "com.amazonaws.transcribestreaming#InternalFailureException":
|
|
238
|
+
throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
|
|
239
|
+
case "LimitExceededException":
|
|
240
|
+
case "com.amazonaws.transcribestreaming#LimitExceededException":
|
|
241
|
+
throw await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context);
|
|
242
|
+
case "ServiceUnavailableException":
|
|
243
|
+
case "com.amazonaws.transcribestreaming#ServiceUnavailableException":
|
|
244
|
+
throw await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context);
|
|
245
|
+
default:
|
|
246
|
+
const parsedBody = parsedOutput.body;
|
|
247
|
+
throwDefaultError({
|
|
248
|
+
output,
|
|
249
|
+
parsedBody,
|
|
250
|
+
exceptionCtor: __BaseException,
|
|
251
|
+
errorCode,
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
};
|
|
255
|
+
const map = __map;
|
|
256
|
+
const deserializeAws_restJson1BadRequestExceptionResponse = async (parsedOutput, context) => {
|
|
257
|
+
const contents = map({});
|
|
258
|
+
const data = parsedOutput.body;
|
|
259
|
+
if (data.Message != null) {
|
|
260
|
+
contents.Message = __expectString(data.Message);
|
|
261
|
+
}
|
|
262
|
+
const exception = new BadRequestException({
|
|
263
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
264
|
+
...contents,
|
|
319
265
|
});
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
266
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
267
|
+
};
|
|
268
|
+
const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, context) => {
|
|
269
|
+
const contents = map({});
|
|
270
|
+
const data = parsedOutput.body;
|
|
271
|
+
if (data.Message != null) {
|
|
272
|
+
contents.Message = __expectString(data.Message);
|
|
273
|
+
}
|
|
274
|
+
const exception = new ConflictException({
|
|
275
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
276
|
+
...contents,
|
|
331
277
|
});
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
278
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
279
|
+
};
|
|
280
|
+
const deserializeAws_restJson1InternalFailureExceptionResponse = async (parsedOutput, context) => {
|
|
281
|
+
const contents = map({});
|
|
282
|
+
const data = parsedOutput.body;
|
|
283
|
+
if (data.Message != null) {
|
|
284
|
+
contents.Message = __expectString(data.Message);
|
|
285
|
+
}
|
|
286
|
+
const exception = new InternalFailureException({
|
|
287
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
288
|
+
...contents,
|
|
343
289
|
});
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
290
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
291
|
+
};
|
|
292
|
+
const deserializeAws_restJson1LimitExceededExceptionResponse = async (parsedOutput, context) => {
|
|
293
|
+
const contents = map({});
|
|
294
|
+
const data = parsedOutput.body;
|
|
295
|
+
if (data.Message != null) {
|
|
296
|
+
contents.Message = __expectString(data.Message);
|
|
297
|
+
}
|
|
298
|
+
const exception = new LimitExceededException({
|
|
299
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
300
|
+
...contents,
|
|
355
301
|
});
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
302
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
303
|
+
};
|
|
304
|
+
const deserializeAws_restJson1ServiceUnavailableExceptionResponse = async (parsedOutput, context) => {
|
|
305
|
+
const contents = map({});
|
|
306
|
+
const data = parsedOutput.body;
|
|
307
|
+
if (data.Message != null) {
|
|
308
|
+
contents.Message = __expectString(data.Message);
|
|
309
|
+
}
|
|
310
|
+
const exception = new ServiceUnavailableException({
|
|
311
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
312
|
+
...contents,
|
|
313
|
+
});
|
|
314
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
315
|
+
};
|
|
316
|
+
const serializeAws_restJson1AudioStream = (input, context) => {
|
|
317
|
+
const eventMarshallingVisitor = (event) => AudioStream.visit(event, {
|
|
318
|
+
AudioEvent: (value) => serializeAws_restJson1AudioEvent_event(value, context),
|
|
319
|
+
_: (value) => value,
|
|
367
320
|
});
|
|
368
|
-
}); };
|
|
369
|
-
var serializeAws_restJson1AudioStream = function (input, context) {
|
|
370
|
-
var eventMarshallingVisitor = function (event) {
|
|
371
|
-
return AudioStream.visit(event, {
|
|
372
|
-
AudioEvent: function (value) { return serializeAws_restJson1AudioEvent_event(value, context); },
|
|
373
|
-
_: function (value) { return value; },
|
|
374
|
-
});
|
|
375
|
-
};
|
|
376
321
|
return context.eventStreamMarshaller.serialize(input, eventMarshallingVisitor);
|
|
377
322
|
};
|
|
378
|
-
|
|
379
|
-
|
|
323
|
+
const serializeAws_restJson1AudioEvent_event = (input, context) => {
|
|
324
|
+
const headers = {
|
|
380
325
|
":event-type": { type: "string", value: "AudioEvent" },
|
|
381
326
|
":message-type": { type: "string", value: "event" },
|
|
382
327
|
":content-type": { type: "string", value: "application/octet-stream" },
|
|
383
328
|
};
|
|
384
|
-
|
|
329
|
+
let body = new Uint8Array();
|
|
385
330
|
if (input.AudioChunk != null) {
|
|
386
331
|
body = input.AudioChunk;
|
|
387
332
|
}
|
|
388
|
-
return { headers
|
|
389
|
-
};
|
|
390
|
-
|
|
391
|
-
return context.eventStreamMarshaller.deserialize(output,
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
case 9: return [2, (_e.ConflictException = _g.sent(),
|
|
424
|
-
_e)];
|
|
425
|
-
case 10:
|
|
426
|
-
if (!(event["ServiceUnavailableException"] != null)) return [3, 12];
|
|
427
|
-
_f = {};
|
|
428
|
-
return [4, deserializeAws_restJson1ServiceUnavailableException_event(event["ServiceUnavailableException"], context)];
|
|
429
|
-
case 11: return [2, (_f.ServiceUnavailableException = _g.sent(),
|
|
430
|
-
_f)];
|
|
431
|
-
case 12: return [2, { $unknown: output }];
|
|
432
|
-
}
|
|
433
|
-
});
|
|
434
|
-
}); });
|
|
435
|
-
};
|
|
436
|
-
var deserializeAws_restJson1TranscriptResultStream = function (output, context) {
|
|
437
|
-
return context.eventStreamMarshaller.deserialize(output, function (event) { return __awaiter(void 0, void 0, void 0, function () {
|
|
438
|
-
var _a, _b, _c, _d, _e, _f;
|
|
439
|
-
return __generator(this, function (_g) {
|
|
440
|
-
switch (_g.label) {
|
|
441
|
-
case 0:
|
|
442
|
-
if (!(event["TranscriptEvent"] != null)) return [3, 2];
|
|
443
|
-
_a = {};
|
|
444
|
-
return [4, deserializeAws_restJson1TranscriptEvent_event(event["TranscriptEvent"], context)];
|
|
445
|
-
case 1: return [2, (_a.TranscriptEvent = _g.sent(),
|
|
446
|
-
_a)];
|
|
447
|
-
case 2:
|
|
448
|
-
if (!(event["BadRequestException"] != null)) return [3, 4];
|
|
449
|
-
_b = {};
|
|
450
|
-
return [4, deserializeAws_restJson1BadRequestException_event(event["BadRequestException"], context)];
|
|
451
|
-
case 3: return [2, (_b.BadRequestException = _g.sent(),
|
|
452
|
-
_b)];
|
|
453
|
-
case 4:
|
|
454
|
-
if (!(event["LimitExceededException"] != null)) return [3, 6];
|
|
455
|
-
_c = {};
|
|
456
|
-
return [4, deserializeAws_restJson1LimitExceededException_event(event["LimitExceededException"], context)];
|
|
457
|
-
case 5: return [2, (_c.LimitExceededException = _g.sent(),
|
|
458
|
-
_c)];
|
|
459
|
-
case 6:
|
|
460
|
-
if (!(event["InternalFailureException"] != null)) return [3, 8];
|
|
461
|
-
_d = {};
|
|
462
|
-
return [4, deserializeAws_restJson1InternalFailureException_event(event["InternalFailureException"], context)];
|
|
463
|
-
case 7: return [2, (_d.InternalFailureException = _g.sent(),
|
|
464
|
-
_d)];
|
|
465
|
-
case 8:
|
|
466
|
-
if (!(event["ConflictException"] != null)) return [3, 10];
|
|
467
|
-
_e = {};
|
|
468
|
-
return [4, deserializeAws_restJson1ConflictException_event(event["ConflictException"], context)];
|
|
469
|
-
case 9: return [2, (_e.ConflictException = _g.sent(),
|
|
470
|
-
_e)];
|
|
471
|
-
case 10:
|
|
472
|
-
if (!(event["ServiceUnavailableException"] != null)) return [3, 12];
|
|
473
|
-
_f = {};
|
|
474
|
-
return [4, deserializeAws_restJson1ServiceUnavailableException_event(event["ServiceUnavailableException"], context)];
|
|
475
|
-
case 11: return [2, (_f.ServiceUnavailableException = _g.sent(),
|
|
476
|
-
_f)];
|
|
477
|
-
case 12: return [2, { $unknown: output }];
|
|
478
|
-
}
|
|
479
|
-
});
|
|
480
|
-
}); });
|
|
481
|
-
};
|
|
482
|
-
var deserializeAws_restJson1BadRequestException_event = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
483
|
-
var parsedOutput, _a;
|
|
484
|
-
var _b;
|
|
485
|
-
return __generator(this, function (_c) {
|
|
486
|
-
switch (_c.label) {
|
|
487
|
-
case 0:
|
|
488
|
-
_a = [__assign({}, output)];
|
|
489
|
-
_b = {};
|
|
490
|
-
return [4, parseBody(output.body, context)];
|
|
491
|
-
case 1:
|
|
492
|
-
parsedOutput = __assign.apply(void 0, _a.concat([(_b.body = _c.sent(), _b)]));
|
|
493
|
-
return [2, deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)];
|
|
494
|
-
}
|
|
495
|
-
});
|
|
496
|
-
}); };
|
|
497
|
-
var deserializeAws_restJson1ConflictException_event = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
498
|
-
var parsedOutput, _a;
|
|
499
|
-
var _b;
|
|
500
|
-
return __generator(this, function (_c) {
|
|
501
|
-
switch (_c.label) {
|
|
502
|
-
case 0:
|
|
503
|
-
_a = [__assign({}, output)];
|
|
504
|
-
_b = {};
|
|
505
|
-
return [4, parseBody(output.body, context)];
|
|
506
|
-
case 1:
|
|
507
|
-
parsedOutput = __assign.apply(void 0, _a.concat([(_b.body = _c.sent(), _b)]));
|
|
508
|
-
return [2, deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)];
|
|
509
|
-
}
|
|
510
|
-
});
|
|
511
|
-
}); };
|
|
512
|
-
var deserializeAws_restJson1InternalFailureException_event = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
513
|
-
var parsedOutput, _a;
|
|
514
|
-
var _b;
|
|
515
|
-
return __generator(this, function (_c) {
|
|
516
|
-
switch (_c.label) {
|
|
517
|
-
case 0:
|
|
518
|
-
_a = [__assign({}, output)];
|
|
519
|
-
_b = {};
|
|
520
|
-
return [4, parseBody(output.body, context)];
|
|
521
|
-
case 1:
|
|
522
|
-
parsedOutput = __assign.apply(void 0, _a.concat([(_b.body = _c.sent(), _b)]));
|
|
523
|
-
return [2, deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)];
|
|
524
|
-
}
|
|
525
|
-
});
|
|
526
|
-
}); };
|
|
527
|
-
var deserializeAws_restJson1LimitExceededException_event = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
528
|
-
var parsedOutput, _a;
|
|
529
|
-
var _b;
|
|
530
|
-
return __generator(this, function (_c) {
|
|
531
|
-
switch (_c.label) {
|
|
532
|
-
case 0:
|
|
533
|
-
_a = [__assign({}, output)];
|
|
534
|
-
_b = {};
|
|
535
|
-
return [4, parseBody(output.body, context)];
|
|
536
|
-
case 1:
|
|
537
|
-
parsedOutput = __assign.apply(void 0, _a.concat([(_b.body = _c.sent(), _b)]));
|
|
538
|
-
return [2, deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context)];
|
|
539
|
-
}
|
|
540
|
-
});
|
|
541
|
-
}); };
|
|
542
|
-
var deserializeAws_restJson1MedicalTranscriptEvent_event = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
543
|
-
var contents, data;
|
|
544
|
-
return __generator(this, function (_a) {
|
|
545
|
-
switch (_a.label) {
|
|
546
|
-
case 0:
|
|
547
|
-
contents = {};
|
|
548
|
-
return [4, parseBody(output.body, context)];
|
|
549
|
-
case 1:
|
|
550
|
-
data = _a.sent();
|
|
551
|
-
Object.assign(contents, deserializeAws_restJson1MedicalTranscriptEvent(data, context));
|
|
552
|
-
return [2, contents];
|
|
553
|
-
}
|
|
333
|
+
return { headers, body };
|
|
334
|
+
};
|
|
335
|
+
const deserializeAws_restJson1MedicalTranscriptResultStream = (output, context) => {
|
|
336
|
+
return context.eventStreamMarshaller.deserialize(output, async (event) => {
|
|
337
|
+
if (event["TranscriptEvent"] != null) {
|
|
338
|
+
return {
|
|
339
|
+
TranscriptEvent: await deserializeAws_restJson1MedicalTranscriptEvent_event(event["TranscriptEvent"], context),
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
if (event["BadRequestException"] != null) {
|
|
343
|
+
return {
|
|
344
|
+
BadRequestException: await deserializeAws_restJson1BadRequestException_event(event["BadRequestException"], context),
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
if (event["LimitExceededException"] != null) {
|
|
348
|
+
return {
|
|
349
|
+
LimitExceededException: await deserializeAws_restJson1LimitExceededException_event(event["LimitExceededException"], context),
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
if (event["InternalFailureException"] != null) {
|
|
353
|
+
return {
|
|
354
|
+
InternalFailureException: await deserializeAws_restJson1InternalFailureException_event(event["InternalFailureException"], context),
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
if (event["ConflictException"] != null) {
|
|
358
|
+
return {
|
|
359
|
+
ConflictException: await deserializeAws_restJson1ConflictException_event(event["ConflictException"], context),
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
if (event["ServiceUnavailableException"] != null) {
|
|
363
|
+
return {
|
|
364
|
+
ServiceUnavailableException: await deserializeAws_restJson1ServiceUnavailableException_event(event["ServiceUnavailableException"], context),
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
return { $unknown: output };
|
|
554
368
|
});
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
}
|
|
369
|
+
};
|
|
370
|
+
const deserializeAws_restJson1TranscriptResultStream = (output, context) => {
|
|
371
|
+
return context.eventStreamMarshaller.deserialize(output, async (event) => {
|
|
372
|
+
if (event["TranscriptEvent"] != null) {
|
|
373
|
+
return {
|
|
374
|
+
TranscriptEvent: await deserializeAws_restJson1TranscriptEvent_event(event["TranscriptEvent"], context),
|
|
375
|
+
};
|
|
376
|
+
}
|
|
377
|
+
if (event["BadRequestException"] != null) {
|
|
378
|
+
return {
|
|
379
|
+
BadRequestException: await deserializeAws_restJson1BadRequestException_event(event["BadRequestException"], context),
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
if (event["LimitExceededException"] != null) {
|
|
383
|
+
return {
|
|
384
|
+
LimitExceededException: await deserializeAws_restJson1LimitExceededException_event(event["LimitExceededException"], context),
|
|
385
|
+
};
|
|
386
|
+
}
|
|
387
|
+
if (event["InternalFailureException"] != null) {
|
|
388
|
+
return {
|
|
389
|
+
InternalFailureException: await deserializeAws_restJson1InternalFailureException_event(event["InternalFailureException"], context),
|
|
390
|
+
};
|
|
391
|
+
}
|
|
392
|
+
if (event["ConflictException"] != null) {
|
|
393
|
+
return {
|
|
394
|
+
ConflictException: await deserializeAws_restJson1ConflictException_event(event["ConflictException"], context),
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
if (event["ServiceUnavailableException"] != null) {
|
|
398
|
+
return {
|
|
399
|
+
ServiceUnavailableException: await deserializeAws_restJson1ServiceUnavailableException_event(event["ServiceUnavailableException"], context),
|
|
400
|
+
};
|
|
401
|
+
}
|
|
402
|
+
return { $unknown: output };
|
|
583
403
|
});
|
|
584
|
-
}
|
|
585
|
-
|
|
404
|
+
};
|
|
405
|
+
const deserializeAws_restJson1BadRequestException_event = async (output, context) => {
|
|
406
|
+
const parsedOutput = {
|
|
407
|
+
...output,
|
|
408
|
+
body: await parseBody(output.body, context),
|
|
409
|
+
};
|
|
410
|
+
return deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
|
|
411
|
+
};
|
|
412
|
+
const deserializeAws_restJson1ConflictException_event = async (output, context) => {
|
|
413
|
+
const parsedOutput = {
|
|
414
|
+
...output,
|
|
415
|
+
body: await parseBody(output.body, context),
|
|
416
|
+
};
|
|
417
|
+
return deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
|
|
418
|
+
};
|
|
419
|
+
const deserializeAws_restJson1InternalFailureException_event = async (output, context) => {
|
|
420
|
+
const parsedOutput = {
|
|
421
|
+
...output,
|
|
422
|
+
body: await parseBody(output.body, context),
|
|
423
|
+
};
|
|
424
|
+
return deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
|
|
425
|
+
};
|
|
426
|
+
const deserializeAws_restJson1LimitExceededException_event = async (output, context) => {
|
|
427
|
+
const parsedOutput = {
|
|
428
|
+
...output,
|
|
429
|
+
body: await parseBody(output.body, context),
|
|
430
|
+
};
|
|
431
|
+
return deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context);
|
|
432
|
+
};
|
|
433
|
+
const deserializeAws_restJson1MedicalTranscriptEvent_event = async (output, context) => {
|
|
434
|
+
const contents = {};
|
|
435
|
+
const data = await parseBody(output.body, context);
|
|
436
|
+
Object.assign(contents, deserializeAws_restJson1MedicalTranscriptEvent(data, context));
|
|
437
|
+
return contents;
|
|
438
|
+
};
|
|
439
|
+
const deserializeAws_restJson1ServiceUnavailableException_event = async (output, context) => {
|
|
440
|
+
const parsedOutput = {
|
|
441
|
+
...output,
|
|
442
|
+
body: await parseBody(output.body, context),
|
|
443
|
+
};
|
|
444
|
+
return deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context);
|
|
445
|
+
};
|
|
446
|
+
const deserializeAws_restJson1TranscriptEvent_event = async (output, context) => {
|
|
447
|
+
const contents = {};
|
|
448
|
+
const data = await parseBody(output.body, context);
|
|
449
|
+
Object.assign(contents, deserializeAws_restJson1TranscriptEvent(data, context));
|
|
450
|
+
return contents;
|
|
451
|
+
};
|
|
452
|
+
const deserializeAws_restJson1Alternative = (output, context) => {
|
|
586
453
|
return {
|
|
587
454
|
Entities: output.Entities != null ? deserializeAws_restJson1EntityList(output.Entities, context) : undefined,
|
|
588
455
|
Items: output.Items != null ? deserializeAws_restJson1ItemList(output.Items, context) : undefined,
|
|
589
456
|
Transcript: __expectString(output.Transcript),
|
|
590
457
|
};
|
|
591
458
|
};
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
.filter(
|
|
595
|
-
.map(
|
|
459
|
+
const deserializeAws_restJson1AlternativeList = (output, context) => {
|
|
460
|
+
const retVal = (output || [])
|
|
461
|
+
.filter((e) => e != null)
|
|
462
|
+
.map((entry) => {
|
|
596
463
|
if (entry === null) {
|
|
597
464
|
return null;
|
|
598
465
|
}
|
|
@@ -600,7 +467,7 @@ var deserializeAws_restJson1AlternativeList = function (output, context) {
|
|
|
600
467
|
});
|
|
601
468
|
return retVal;
|
|
602
469
|
};
|
|
603
|
-
|
|
470
|
+
const deserializeAws_restJson1Entity = (output, context) => {
|
|
604
471
|
return {
|
|
605
472
|
Category: __expectString(output.Category),
|
|
606
473
|
Confidence: __limitedParseDouble(output.Confidence),
|
|
@@ -610,10 +477,10 @@ var deserializeAws_restJson1Entity = function (output, context) {
|
|
|
610
477
|
Type: __expectString(output.Type),
|
|
611
478
|
};
|
|
612
479
|
};
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
.filter(
|
|
616
|
-
.map(
|
|
480
|
+
const deserializeAws_restJson1EntityList = (output, context) => {
|
|
481
|
+
const retVal = (output || [])
|
|
482
|
+
.filter((e) => e != null)
|
|
483
|
+
.map((entry) => {
|
|
617
484
|
if (entry === null) {
|
|
618
485
|
return null;
|
|
619
486
|
}
|
|
@@ -621,7 +488,7 @@ var deserializeAws_restJson1EntityList = function (output, context) {
|
|
|
621
488
|
});
|
|
622
489
|
return retVal;
|
|
623
490
|
};
|
|
624
|
-
|
|
491
|
+
const deserializeAws_restJson1Item = (output, context) => {
|
|
625
492
|
return {
|
|
626
493
|
Confidence: __limitedParseDouble(output.Confidence),
|
|
627
494
|
Content: __expectString(output.Content),
|
|
@@ -633,10 +500,10 @@ var deserializeAws_restJson1Item = function (output, context) {
|
|
|
633
500
|
VocabularyFilterMatch: __expectBoolean(output.VocabularyFilterMatch),
|
|
634
501
|
};
|
|
635
502
|
};
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
.filter(
|
|
639
|
-
.map(
|
|
503
|
+
const deserializeAws_restJson1ItemList = (output, context) => {
|
|
504
|
+
const retVal = (output || [])
|
|
505
|
+
.filter((e) => e != null)
|
|
506
|
+
.map((entry) => {
|
|
640
507
|
if (entry === null) {
|
|
641
508
|
return null;
|
|
642
509
|
}
|
|
@@ -644,10 +511,10 @@ var deserializeAws_restJson1ItemList = function (output, context) {
|
|
|
644
511
|
});
|
|
645
512
|
return retVal;
|
|
646
513
|
};
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
.filter(
|
|
650
|
-
.map(
|
|
514
|
+
const deserializeAws_restJson1LanguageIdentification = (output, context) => {
|
|
515
|
+
const retVal = (output || [])
|
|
516
|
+
.filter((e) => e != null)
|
|
517
|
+
.map((entry) => {
|
|
651
518
|
if (entry === null) {
|
|
652
519
|
return null;
|
|
653
520
|
}
|
|
@@ -655,23 +522,23 @@ var deserializeAws_restJson1LanguageIdentification = function (output, context)
|
|
|
655
522
|
});
|
|
656
523
|
return retVal;
|
|
657
524
|
};
|
|
658
|
-
|
|
525
|
+
const deserializeAws_restJson1LanguageWithScore = (output, context) => {
|
|
659
526
|
return {
|
|
660
527
|
LanguageCode: __expectString(output.LanguageCode),
|
|
661
528
|
Score: __limitedParseDouble(output.Score),
|
|
662
529
|
};
|
|
663
530
|
};
|
|
664
|
-
|
|
531
|
+
const deserializeAws_restJson1MedicalAlternative = (output, context) => {
|
|
665
532
|
return {
|
|
666
533
|
Entities: output.Entities != null ? deserializeAws_restJson1MedicalEntityList(output.Entities, context) : undefined,
|
|
667
534
|
Items: output.Items != null ? deserializeAws_restJson1MedicalItemList(output.Items, context) : undefined,
|
|
668
535
|
Transcript: __expectString(output.Transcript),
|
|
669
536
|
};
|
|
670
537
|
};
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
.filter(
|
|
674
|
-
.map(
|
|
538
|
+
const deserializeAws_restJson1MedicalAlternativeList = (output, context) => {
|
|
539
|
+
const retVal = (output || [])
|
|
540
|
+
.filter((e) => e != null)
|
|
541
|
+
.map((entry) => {
|
|
675
542
|
if (entry === null) {
|
|
676
543
|
return null;
|
|
677
544
|
}
|
|
@@ -679,7 +546,7 @@ var deserializeAws_restJson1MedicalAlternativeList = function (output, context)
|
|
|
679
546
|
});
|
|
680
547
|
return retVal;
|
|
681
548
|
};
|
|
682
|
-
|
|
549
|
+
const deserializeAws_restJson1MedicalEntity = (output, context) => {
|
|
683
550
|
return {
|
|
684
551
|
Category: __expectString(output.Category),
|
|
685
552
|
Confidence: __limitedParseDouble(output.Confidence),
|
|
@@ -688,10 +555,10 @@ var deserializeAws_restJson1MedicalEntity = function (output, context) {
|
|
|
688
555
|
StartTime: __limitedParseDouble(output.StartTime),
|
|
689
556
|
};
|
|
690
557
|
};
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
.filter(
|
|
694
|
-
.map(
|
|
558
|
+
const deserializeAws_restJson1MedicalEntityList = (output, context) => {
|
|
559
|
+
const retVal = (output || [])
|
|
560
|
+
.filter((e) => e != null)
|
|
561
|
+
.map((entry) => {
|
|
695
562
|
if (entry === null) {
|
|
696
563
|
return null;
|
|
697
564
|
}
|
|
@@ -699,7 +566,7 @@ var deserializeAws_restJson1MedicalEntityList = function (output, context) {
|
|
|
699
566
|
});
|
|
700
567
|
return retVal;
|
|
701
568
|
};
|
|
702
|
-
|
|
569
|
+
const deserializeAws_restJson1MedicalItem = (output, context) => {
|
|
703
570
|
return {
|
|
704
571
|
Confidence: __limitedParseDouble(output.Confidence),
|
|
705
572
|
Content: __expectString(output.Content),
|
|
@@ -709,10 +576,10 @@ var deserializeAws_restJson1MedicalItem = function (output, context) {
|
|
|
709
576
|
Type: __expectString(output.Type),
|
|
710
577
|
};
|
|
711
578
|
};
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
.filter(
|
|
715
|
-
.map(
|
|
579
|
+
const deserializeAws_restJson1MedicalItemList = (output, context) => {
|
|
580
|
+
const retVal = (output || [])
|
|
581
|
+
.filter((e) => e != null)
|
|
582
|
+
.map((entry) => {
|
|
716
583
|
if (entry === null) {
|
|
717
584
|
return null;
|
|
718
585
|
}
|
|
@@ -720,7 +587,7 @@ var deserializeAws_restJson1MedicalItemList = function (output, context) {
|
|
|
720
587
|
});
|
|
721
588
|
return retVal;
|
|
722
589
|
};
|
|
723
|
-
|
|
590
|
+
const deserializeAws_restJson1MedicalResult = (output, context) => {
|
|
724
591
|
return {
|
|
725
592
|
Alternatives: output.Alternatives != null
|
|
726
593
|
? deserializeAws_restJson1MedicalAlternativeList(output.Alternatives, context)
|
|
@@ -732,10 +599,10 @@ var deserializeAws_restJson1MedicalResult = function (output, context) {
|
|
|
732
599
|
StartTime: __limitedParseDouble(output.StartTime),
|
|
733
600
|
};
|
|
734
601
|
};
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
.filter(
|
|
738
|
-
.map(
|
|
602
|
+
const deserializeAws_restJson1MedicalResultList = (output, context) => {
|
|
603
|
+
const retVal = (output || [])
|
|
604
|
+
.filter((e) => e != null)
|
|
605
|
+
.map((entry) => {
|
|
739
606
|
if (entry === null) {
|
|
740
607
|
return null;
|
|
741
608
|
}
|
|
@@ -743,17 +610,17 @@ var deserializeAws_restJson1MedicalResultList = function (output, context) {
|
|
|
743
610
|
});
|
|
744
611
|
return retVal;
|
|
745
612
|
};
|
|
746
|
-
|
|
613
|
+
const deserializeAws_restJson1MedicalTranscript = (output, context) => {
|
|
747
614
|
return {
|
|
748
615
|
Results: output.Results != null ? deserializeAws_restJson1MedicalResultList(output.Results, context) : undefined,
|
|
749
616
|
};
|
|
750
617
|
};
|
|
751
|
-
|
|
618
|
+
const deserializeAws_restJson1MedicalTranscriptEvent = (output, context) => {
|
|
752
619
|
return {
|
|
753
620
|
Transcript: output.Transcript != null ? deserializeAws_restJson1MedicalTranscript(output.Transcript, context) : undefined,
|
|
754
621
|
};
|
|
755
622
|
};
|
|
756
|
-
|
|
623
|
+
const deserializeAws_restJson1Result = (output, context) => {
|
|
757
624
|
return {
|
|
758
625
|
Alternatives: output.Alternatives != null ? deserializeAws_restJson1AlternativeList(output.Alternatives, context) : undefined,
|
|
759
626
|
ChannelId: __expectString(output.ChannelId),
|
|
@@ -767,10 +634,10 @@ var deserializeAws_restJson1Result = function (output, context) {
|
|
|
767
634
|
StartTime: __limitedParseDouble(output.StartTime),
|
|
768
635
|
};
|
|
769
636
|
};
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
.filter(
|
|
773
|
-
.map(
|
|
637
|
+
const deserializeAws_restJson1ResultList = (output, context) => {
|
|
638
|
+
const retVal = (output || [])
|
|
639
|
+
.filter((e) => e != null)
|
|
640
|
+
.map((entry) => {
|
|
774
641
|
if (entry === null) {
|
|
775
642
|
return null;
|
|
776
643
|
}
|
|
@@ -778,67 +645,49 @@ var deserializeAws_restJson1ResultList = function (output, context) {
|
|
|
778
645
|
});
|
|
779
646
|
return retVal;
|
|
780
647
|
};
|
|
781
|
-
|
|
648
|
+
const deserializeAws_restJson1Transcript = (output, context) => {
|
|
782
649
|
return {
|
|
783
650
|
Results: output.Results != null ? deserializeAws_restJson1ResultList(output.Results, context) : undefined,
|
|
784
651
|
};
|
|
785
652
|
};
|
|
786
|
-
|
|
653
|
+
const deserializeAws_restJson1TranscriptEvent = (output, context) => {
|
|
787
654
|
return {
|
|
788
655
|
Transcript: output.Transcript != null ? deserializeAws_restJson1Transcript(output.Transcript, context) : undefined,
|
|
789
656
|
};
|
|
790
657
|
};
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
});
|
|
799
|
-
};
|
|
800
|
-
var collectBody = function (streamBody, context) {
|
|
801
|
-
if (streamBody === void 0) { streamBody = new Uint8Array(); }
|
|
658
|
+
const deserializeMetadata = (output) => ({
|
|
659
|
+
httpStatusCode: output.statusCode,
|
|
660
|
+
requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
|
|
661
|
+
extendedRequestId: output.headers["x-amz-id-2"],
|
|
662
|
+
cfId: output.headers["x-amz-cf-id"],
|
|
663
|
+
});
|
|
664
|
+
const collectBody = (streamBody = new Uint8Array(), context) => {
|
|
802
665
|
if (streamBody instanceof Uint8Array) {
|
|
803
666
|
return Promise.resolve(streamBody);
|
|
804
667
|
}
|
|
805
668
|
return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
|
|
806
669
|
};
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
}
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
return __generator(this, function (_b) {
|
|
829
|
-
switch (_b.label) {
|
|
830
|
-
case 0: return [4, parseBody(errorBody, context)];
|
|
831
|
-
case 1:
|
|
832
|
-
value = _b.sent();
|
|
833
|
-
value.message = (_a = value.message) !== null && _a !== void 0 ? _a : value.Message;
|
|
834
|
-
return [2, value];
|
|
835
|
-
}
|
|
836
|
-
});
|
|
837
|
-
}); };
|
|
838
|
-
var loadRestJsonErrorCode = function (output, data) {
|
|
839
|
-
var findKey = function (object, key) { return Object.keys(object).find(function (k) { return k.toLowerCase() === key.toLowerCase(); }); };
|
|
840
|
-
var sanitizeErrorCode = function (rawValue) {
|
|
841
|
-
var cleanValue = rawValue;
|
|
670
|
+
const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
|
|
671
|
+
const isSerializableHeaderValue = (value) => value !== undefined &&
|
|
672
|
+
value !== null &&
|
|
673
|
+
value !== "" &&
|
|
674
|
+
(!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
|
|
675
|
+
(!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
|
|
676
|
+
const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
|
|
677
|
+
if (encoded.length) {
|
|
678
|
+
return JSON.parse(encoded);
|
|
679
|
+
}
|
|
680
|
+
return {};
|
|
681
|
+
});
|
|
682
|
+
const parseErrorBody = async (errorBody, context) => {
|
|
683
|
+
const value = await parseBody(errorBody, context);
|
|
684
|
+
value.message = value.message ?? value.Message;
|
|
685
|
+
return value;
|
|
686
|
+
};
|
|
687
|
+
const loadRestJsonErrorCode = (output, data) => {
|
|
688
|
+
const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
|
|
689
|
+
const sanitizeErrorCode = (rawValue) => {
|
|
690
|
+
let cleanValue = rawValue;
|
|
842
691
|
if (typeof cleanValue === "number") {
|
|
843
692
|
cleanValue = cleanValue.toString();
|
|
844
693
|
}
|
|
@@ -853,7 +702,7 @@ var loadRestJsonErrorCode = function (output, data) {
|
|
|
853
702
|
}
|
|
854
703
|
return cleanValue;
|
|
855
704
|
};
|
|
856
|
-
|
|
705
|
+
const headerKey = findKey(output.headers, "x-amzn-errortype");
|
|
857
706
|
if (headerKey !== undefined) {
|
|
858
707
|
return sanitizeErrorCode(output.headers[headerKey]);
|
|
859
708
|
}
|