@aws-sdk/client-transcribe-streaming 3.181.0 → 3.183.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.
@@ -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 var serializeAws_restJson1StartMedicalStreamTranscriptionCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
7
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
8
- return __generator(this, function (_c) {
9
- switch (_c.label) {
10
- case 0: return [4, context.endpoint()];
11
- case 1:
12
- _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
13
- headers = map({}, isSerializableHeaderValue, {
14
- "x-amzn-transcribe-language-code": input.LanguageCode,
15
- "x-amzn-transcribe-sample-rate": [
16
- function () { return isSerializableHeaderValue(input.MediaSampleRateHertz); },
17
- function () { return input.MediaSampleRateHertz.toString(); },
18
- ],
19
- "x-amzn-transcribe-media-encoding": input.MediaEncoding,
20
- "x-amzn-transcribe-vocabulary-name": input.VocabularyName,
21
- "x-amzn-transcribe-specialty": input.Specialty,
22
- "x-amzn-transcribe-type": input.Type,
23
- "x-amzn-transcribe-show-speaker-label": [
24
- function () { return isSerializableHeaderValue(input.ShowSpeakerLabel); },
25
- function () { return input.ShowSpeakerLabel.toString(); },
26
- ],
27
- "x-amzn-transcribe-session-id": input.SessionId,
28
- "x-amzn-transcribe-enable-channel-identification": [
29
- function () { return isSerializableHeaderValue(input.EnableChannelIdentification); },
30
- function () { return input.EnableChannelIdentification.toString(); },
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
- export var serializeAws_restJson1StartStreamTranscriptionCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
55
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
56
- return __generator(this, function (_c) {
57
- switch (_c.label) {
58
- case 0: return [4, context.endpoint()];
59
- case 1:
60
- _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
61
- headers = map({}, isSerializableHeaderValue, {
62
- "x-amzn-transcribe-language-code": input.LanguageCode,
63
- "x-amzn-transcribe-sample-rate": [
64
- function () { return isSerializableHeaderValue(input.MediaSampleRateHertz); },
65
- function () { return input.MediaSampleRateHertz.toString(); },
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 var deserializeAws_restJson1StartMedicalStreamTranscriptionCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
119
- var contents, data;
120
- return __generator(this, function (_a) {
121
- if (output.statusCode !== 200 && output.statusCode >= 300) {
122
- return [2, deserializeAws_restJson1StartMedicalStreamTranscriptionCommandError(output, context)];
123
- }
124
- contents = map({
125
- $metadata: deserializeMetadata(output),
126
- RequestId: [, output.headers["x-amzn-request-id"]],
127
- LanguageCode: [, output.headers["x-amzn-transcribe-language-code"]],
128
- MediaSampleRateHertz: [
129
- function () { return void 0 !== output.headers["x-amzn-transcribe-sample-rate"]; },
130
- function () { return __strictParseInt32(output.headers["x-amzn-transcribe-sample-rate"]); },
131
- ],
132
- MediaEncoding: [, output.headers["x-amzn-transcribe-media-encoding"]],
133
- VocabularyName: [, output.headers["x-amzn-transcribe-vocabulary-name"]],
134
- Specialty: [, output.headers["x-amzn-transcribe-specialty"]],
135
- Type: [, output.headers["x-amzn-transcribe-type"]],
136
- ShowSpeakerLabel: [
137
- function () { return void 0 !== output.headers["x-amzn-transcribe-show-speaker-label"]; },
138
- function () { return __parseBoolean(output.headers["x-amzn-transcribe-show-speaker-label"]); },
139
- ],
140
- SessionId: [, output.headers["x-amzn-transcribe-session-id"]],
141
- EnableChannelIdentification: [
142
- function () { return void 0 !== output.headers["x-amzn-transcribe-enable-channel-identification"]; },
143
- function () { return __parseBoolean(output.headers["x-amzn-transcribe-enable-channel-identification"]); },
144
- ],
145
- NumberOfChannels: [
146
- function () { return void 0 !== output.headers["x-amzn-transcribe-number-of-channels"]; },
147
- function () { return __strictParseInt32(output.headers["x-amzn-transcribe-number-of-channels"]); },
148
- ],
149
- ContentIdentificationType: [, output.headers["x-amzn-transcribe-content-identification-type"]],
150
- });
151
- data = output.body;
152
- contents.TranscriptResultStream = deserializeAws_restJson1MedicalTranscriptResultStream(data, context);
153
- return [2, contents];
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
- var deserializeAws_restJson1StartMedicalStreamTranscriptionCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
157
- var parsedOutput, _a, errorCode, _b, parsedBody;
158
- var _c;
159
- return __generator(this, function (_d) {
160
- switch (_d.label) {
161
- case 0:
162
- _a = [__assign({}, output)];
163
- _c = {};
164
- return [4, parseErrorBody(output.body, context)];
165
- case 1:
166
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
167
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
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 var deserializeAws_restJson1StartStreamTranscriptionCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
206
- var contents, data;
207
- return __generator(this, function (_a) {
208
- if (output.statusCode !== 200 && output.statusCode >= 300) {
209
- return [2, deserializeAws_restJson1StartStreamTranscriptionCommandError(output, context)];
210
- }
211
- contents = map({
212
- $metadata: deserializeMetadata(output),
213
- RequestId: [, output.headers["x-amzn-request-id"]],
214
- LanguageCode: [, output.headers["x-amzn-transcribe-language-code"]],
215
- MediaSampleRateHertz: [
216
- function () { return void 0 !== output.headers["x-amzn-transcribe-sample-rate"]; },
217
- function () { return __strictParseInt32(output.headers["x-amzn-transcribe-sample-rate"]); },
218
- ],
219
- MediaEncoding: [, output.headers["x-amzn-transcribe-media-encoding"]],
220
- VocabularyName: [, output.headers["x-amzn-transcribe-vocabulary-name"]],
221
- SessionId: [, output.headers["x-amzn-transcribe-session-id"]],
222
- VocabularyFilterName: [, output.headers["x-amzn-transcribe-vocabulary-filter-name"]],
223
- VocabularyFilterMethod: [, output.headers["x-amzn-transcribe-vocabulary-filter-method"]],
224
- ShowSpeakerLabel: [
225
- function () { return void 0 !== output.headers["x-amzn-transcribe-show-speaker-label"]; },
226
- function () { return __parseBoolean(output.headers["x-amzn-transcribe-show-speaker-label"]); },
227
- ],
228
- EnableChannelIdentification: [
229
- function () { return void 0 !== output.headers["x-amzn-transcribe-enable-channel-identification"]; },
230
- function () { return __parseBoolean(output.headers["x-amzn-transcribe-enable-channel-identification"]); },
231
- ],
232
- NumberOfChannels: [
233
- function () { return void 0 !== output.headers["x-amzn-transcribe-number-of-channels"]; },
234
- function () { return __strictParseInt32(output.headers["x-amzn-transcribe-number-of-channels"]); },
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
- var deserializeAws_restJson1StartStreamTranscriptionCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
260
- var parsedOutput, _a, errorCode, _b, parsedBody;
261
- var _c;
262
- return __generator(this, function (_d) {
263
- switch (_d.label) {
264
- case 0:
265
- _a = [__assign({}, output)];
266
- _c = {};
267
- return [4, parseErrorBody(output.body, context)];
268
- case 1:
269
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
270
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
271
- _b = errorCode;
272
- switch (_b) {
273
- case "BadRequestException": return [3, 2];
274
- case "com.amazonaws.transcribestreaming#BadRequestException": return [3, 2];
275
- case "ConflictException": return [3, 4];
276
- case "com.amazonaws.transcribestreaming#ConflictException": return [3, 4];
277
- case "InternalFailureException": return [3, 6];
278
- case "com.amazonaws.transcribestreaming#InternalFailureException": return [3, 6];
279
- case "LimitExceededException": return [3, 8];
280
- case "com.amazonaws.transcribestreaming#LimitExceededException": return [3, 8];
281
- case "ServiceUnavailableException": return [3, 10];
282
- case "com.amazonaws.transcribestreaming#ServiceUnavailableException": return [3, 10];
283
- }
284
- return [3, 12];
285
- case 2: return [4, deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)];
286
- case 3: throw _d.sent();
287
- case 4: return [4, deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)];
288
- case 5: throw _d.sent();
289
- case 6: return [4, deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)];
290
- case 7: throw _d.sent();
291
- case 8: return [4, deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context)];
292
- case 9: throw _d.sent();
293
- case 10: return [4, deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context)];
294
- case 11: throw _d.sent();
295
- case 12:
296
- parsedBody = parsedOutput.body;
297
- throwDefaultError({
298
- output: output,
299
- parsedBody: parsedBody,
300
- exceptionCtor: __BaseException,
301
- errorCode: errorCode,
302
- });
303
- _d.label = 13;
304
- case 13: return [2];
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
- var map = __map;
309
- var deserializeAws_restJson1BadRequestExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
310
- var contents, data, exception;
311
- return __generator(this, function (_a) {
312
- contents = map({});
313
- data = parsedOutput.body;
314
- if (data.Message != null) {
315
- contents.Message = __expectString(data.Message);
316
- }
317
- exception = new BadRequestException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
318
- return [2, __decorateServiceException(exception, parsedOutput.body)];
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
- var deserializeAws_restJson1ConflictExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
322
- var contents, data, exception;
323
- return __generator(this, function (_a) {
324
- contents = map({});
325
- data = parsedOutput.body;
326
- if (data.Message != null) {
327
- contents.Message = __expectString(data.Message);
328
- }
329
- exception = new ConflictException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
330
- return [2, __decorateServiceException(exception, parsedOutput.body)];
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
- var deserializeAws_restJson1InternalFailureExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
334
- var contents, data, exception;
335
- return __generator(this, function (_a) {
336
- contents = map({});
337
- data = parsedOutput.body;
338
- if (data.Message != null) {
339
- contents.Message = __expectString(data.Message);
340
- }
341
- exception = new InternalFailureException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
342
- return [2, __decorateServiceException(exception, parsedOutput.body)];
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
- var deserializeAws_restJson1LimitExceededExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
346
- var contents, data, exception;
347
- return __generator(this, function (_a) {
348
- contents = map({});
349
- data = parsedOutput.body;
350
- if (data.Message != null) {
351
- contents.Message = __expectString(data.Message);
352
- }
353
- exception = new LimitExceededException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
354
- return [2, __decorateServiceException(exception, parsedOutput.body)];
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
- var deserializeAws_restJson1ServiceUnavailableExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
358
- var contents, data, exception;
359
- return __generator(this, function (_a) {
360
- contents = map({});
361
- data = parsedOutput.body;
362
- if (data.Message != null) {
363
- contents.Message = __expectString(data.Message);
364
- }
365
- exception = new ServiceUnavailableException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
366
- return [2, __decorateServiceException(exception, parsedOutput.body)];
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
- var serializeAws_restJson1AudioEvent_event = function (input, context) {
379
- var headers = {
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
- var body = new Uint8Array();
329
+ let body = new Uint8Array();
385
330
  if (input.AudioChunk != null) {
386
331
  body = input.AudioChunk;
387
332
  }
388
- return { headers: headers, body: body };
389
- };
390
- var deserializeAws_restJson1MedicalTranscriptResultStream = function (output, context) {
391
- return context.eventStreamMarshaller.deserialize(output, function (event) { return __awaiter(void 0, void 0, void 0, function () {
392
- var _a, _b, _c, _d, _e, _f;
393
- return __generator(this, function (_g) {
394
- switch (_g.label) {
395
- case 0:
396
- if (!(event["TranscriptEvent"] != null)) return [3, 2];
397
- _a = {};
398
- return [4, deserializeAws_restJson1MedicalTranscriptEvent_event(event["TranscriptEvent"], context)];
399
- case 1: return [2, (_a.TranscriptEvent = _g.sent(),
400
- _a)];
401
- case 2:
402
- if (!(event["BadRequestException"] != null)) return [3, 4];
403
- _b = {};
404
- return [4, deserializeAws_restJson1BadRequestException_event(event["BadRequestException"], context)];
405
- case 3: return [2, (_b.BadRequestException = _g.sent(),
406
- _b)];
407
- case 4:
408
- if (!(event["LimitExceededException"] != null)) return [3, 6];
409
- _c = {};
410
- return [4, deserializeAws_restJson1LimitExceededException_event(event["LimitExceededException"], context)];
411
- case 5: return [2, (_c.LimitExceededException = _g.sent(),
412
- _c)];
413
- case 6:
414
- if (!(event["InternalFailureException"] != null)) return [3, 8];
415
- _d = {};
416
- return [4, deserializeAws_restJson1InternalFailureException_event(event["InternalFailureException"], context)];
417
- case 7: return [2, (_d.InternalFailureException = _g.sent(),
418
- _d)];
419
- case 8:
420
- if (!(event["ConflictException"] != null)) return [3, 10];
421
- _e = {};
422
- return [4, deserializeAws_restJson1ConflictException_event(event["ConflictException"], context)];
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
- var deserializeAws_restJson1ServiceUnavailableException_event = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
557
- var parsedOutput, _a;
558
- var _b;
559
- return __generator(this, function (_c) {
560
- switch (_c.label) {
561
- case 0:
562
- _a = [__assign({}, output)];
563
- _b = {};
564
- return [4, parseBody(output.body, context)];
565
- case 1:
566
- parsedOutput = __assign.apply(void 0, _a.concat([(_b.body = _c.sent(), _b)]));
567
- return [2, deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context)];
568
- }
569
- });
570
- }); };
571
- var deserializeAws_restJson1TranscriptEvent_event = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
572
- var contents, data;
573
- return __generator(this, function (_a) {
574
- switch (_a.label) {
575
- case 0:
576
- contents = {};
577
- return [4, parseBody(output.body, context)];
578
- case 1:
579
- data = _a.sent();
580
- Object.assign(contents, deserializeAws_restJson1TranscriptEvent(data, context));
581
- return [2, contents];
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
- var deserializeAws_restJson1Alternative = function (output, context) {
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
- var deserializeAws_restJson1AlternativeList = function (output, context) {
593
- var retVal = (output || [])
594
- .filter(function (e) { return e != null; })
595
- .map(function (entry) {
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
- var deserializeAws_restJson1Entity = function (output, context) {
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
- var deserializeAws_restJson1EntityList = function (output, context) {
614
- var retVal = (output || [])
615
- .filter(function (e) { return e != null; })
616
- .map(function (entry) {
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
- var deserializeAws_restJson1Item = function (output, context) {
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
- var deserializeAws_restJson1ItemList = function (output, context) {
637
- var retVal = (output || [])
638
- .filter(function (e) { return e != null; })
639
- .map(function (entry) {
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
- var deserializeAws_restJson1LanguageIdentification = function (output, context) {
648
- var retVal = (output || [])
649
- .filter(function (e) { return e != null; })
650
- .map(function (entry) {
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
- var deserializeAws_restJson1LanguageWithScore = function (output, context) {
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
- var deserializeAws_restJson1MedicalAlternative = function (output, context) {
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
- var deserializeAws_restJson1MedicalAlternativeList = function (output, context) {
672
- var retVal = (output || [])
673
- .filter(function (e) { return e != null; })
674
- .map(function (entry) {
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
- var deserializeAws_restJson1MedicalEntity = function (output, context) {
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
- var deserializeAws_restJson1MedicalEntityList = function (output, context) {
692
- var retVal = (output || [])
693
- .filter(function (e) { return e != null; })
694
- .map(function (entry) {
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
- var deserializeAws_restJson1MedicalItem = function (output, context) {
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
- var deserializeAws_restJson1MedicalItemList = function (output, context) {
713
- var retVal = (output || [])
714
- .filter(function (e) { return e != null; })
715
- .map(function (entry) {
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
- var deserializeAws_restJson1MedicalResult = function (output, context) {
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
- var deserializeAws_restJson1MedicalResultList = function (output, context) {
736
- var retVal = (output || [])
737
- .filter(function (e) { return e != null; })
738
- .map(function (entry) {
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
- var deserializeAws_restJson1MedicalTranscript = function (output, context) {
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
- var deserializeAws_restJson1MedicalTranscriptEvent = function (output, context) {
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
- var deserializeAws_restJson1Result = function (output, context) {
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
- var deserializeAws_restJson1ResultList = function (output, context) {
771
- var retVal = (output || [])
772
- .filter(function (e) { return e != null; })
773
- .map(function (entry) {
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
- var deserializeAws_restJson1Transcript = function (output, context) {
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
- var deserializeAws_restJson1TranscriptEvent = function (output, context) {
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
- var deserializeMetadata = function (output) {
792
- var _a;
793
- return ({
794
- httpStatusCode: output.statusCode,
795
- requestId: (_a = output.headers["x-amzn-requestid"]) !== null && _a !== void 0 ? _a : output.headers["x-amzn-request-id"],
796
- extendedRequestId: output.headers["x-amz-id-2"],
797
- cfId: output.headers["x-amz-cf-id"],
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"],
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
- var collectBodyString = function (streamBody, context) {
808
- return collectBody(streamBody, context).then(function (body) { return context.utf8Encoder(body); });
809
- };
810
- var isSerializableHeaderValue = function (value) {
811
- return value !== undefined &&
812
- value !== null &&
813
- value !== "" &&
814
- (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
815
- (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
816
- };
817
- var parseBody = function (streamBody, context) {
818
- return collectBodyString(streamBody, context).then(function (encoded) {
819
- if (encoded.length) {
820
- return JSON.parse(encoded);
821
- }
822
- return {};
823
- });
824
- };
825
- var parseErrorBody = function (errorBody, context) { return __awaiter(void 0, void 0, void 0, function () {
826
- var value;
827
- var _a;
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
- var headerKey = findKey(output.headers, "x-amzn-errortype");
705
+ const headerKey = findKey(output.headers, "x-amzn-errortype");
857
706
  if (headerKey !== undefined) {
858
707
  return sanitizeErrorCode(output.headers[headerKey]);
859
708
  }