@aws-sdk/client-transcribe-streaming 3.490.0 → 3.495.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,864 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.de_StartStreamTranscriptionCommand = exports.de_StartMedicalStreamTranscriptionCommand = exports.de_StartCallAnalyticsStreamTranscriptionCommand = exports.se_StartStreamTranscriptionCommand = exports.se_StartMedicalStreamTranscriptionCommand = exports.se_StartCallAnalyticsStreamTranscriptionCommand = void 0;
4
- const core_1 = require("@smithy/core");
5
- const smithy_client_1 = require("@smithy/smithy-client");
6
- const models_0_1 = require("../models/models_0");
7
- const TranscribeStreamingServiceException_1 = require("../models/TranscribeStreamingServiceException");
8
- const se_StartCallAnalyticsStreamTranscriptionCommand = async (input, context) => {
9
- const b = (0, core_1.requestBuilder)(input, context);
10
- const headers = (0, smithy_client_1.map)({}, isSerializableHeaderValue, {
11
- [_xatlc]: input[_LC],
12
- [_xatsr]: [() => isSerializableHeaderValue(input[_MSRH]), () => input[_MSRH].toString()],
13
- [_xatme]: input[_ME],
14
- [_xatvn]: input[_VN],
15
- [_xatsi]: input[_SI],
16
- [_xatvfn]: input[_VFN],
17
- [_xatvfm]: input[_VFM],
18
- [_xatlmn]: input[_LMN],
19
- [_xateprs]: [() => isSerializableHeaderValue(input[_EPRS]), () => input[_EPRS].toString()],
20
- [_xatprs]: input[_PRS],
21
- [_xatcit]: input[_CIT],
22
- [_xatcrt]: input[_CRT],
23
- [_xatpet]: input[_PET],
24
- });
25
- b.bp("/call-analytics-stream-transcription");
26
- let body;
27
- if (input.AudioStream !== undefined) {
28
- body = se_AudioStream(input.AudioStream, context);
29
- }
30
- b.m("POST").h(headers).b(body);
31
- return b.build();
32
- };
33
- exports.se_StartCallAnalyticsStreamTranscriptionCommand = se_StartCallAnalyticsStreamTranscriptionCommand;
34
- const se_StartMedicalStreamTranscriptionCommand = async (input, context) => {
35
- const b = (0, core_1.requestBuilder)(input, context);
36
- const headers = (0, smithy_client_1.map)({}, isSerializableHeaderValue, {
37
- [_xatlc]: input[_LC],
38
- [_xatsr]: [() => isSerializableHeaderValue(input[_MSRH]), () => input[_MSRH].toString()],
39
- [_xatme]: input[_ME],
40
- [_xatvn]: input[_VN],
41
- [_xats]: input[_S],
42
- [_xatt]: input[_T],
43
- [_xatssl]: [() => isSerializableHeaderValue(input[_SSL]), () => input[_SSL].toString()],
44
- [_xatsi]: input[_SI],
45
- [_xateci]: [() => isSerializableHeaderValue(input[_ECI]), () => input[_ECI].toString()],
46
- [_xatnoc]: [() => isSerializableHeaderValue(input[_NOC]), () => input[_NOC].toString()],
47
- [_xatcit]: input[_CIT],
48
- });
49
- b.bp("/medical-stream-transcription");
50
- let body;
51
- if (input.AudioStream !== undefined) {
52
- body = se_AudioStream(input.AudioStream, context);
53
- }
54
- b.m("POST").h(headers).b(body);
55
- return b.build();
56
- };
57
- exports.se_StartMedicalStreamTranscriptionCommand = se_StartMedicalStreamTranscriptionCommand;
58
- const se_StartStreamTranscriptionCommand = async (input, context) => {
59
- const b = (0, core_1.requestBuilder)(input, context);
60
- const headers = (0, smithy_client_1.map)({}, isSerializableHeaderValue, {
61
- [_xatlc]: input[_LC],
62
- [_xatsr]: [() => isSerializableHeaderValue(input[_MSRH]), () => input[_MSRH].toString()],
63
- [_xatme]: input[_ME],
64
- [_xatvn]: input[_VN],
65
- [_xatsi]: input[_SI],
66
- [_xatvfn]: input[_VFN],
67
- [_xatvfm]: input[_VFM],
68
- [_xatssl]: [() => isSerializableHeaderValue(input[_SSL]), () => input[_SSL].toString()],
69
- [_xateci]: [() => isSerializableHeaderValue(input[_ECI]), () => input[_ECI].toString()],
70
- [_xatnoc]: [() => isSerializableHeaderValue(input[_NOC]), () => input[_NOC].toString()],
71
- [_xateprs]: [() => isSerializableHeaderValue(input[_EPRS]), () => input[_EPRS].toString()],
72
- [_xatprs]: input[_PRS],
73
- [_xatcit]: input[_CIT],
74
- [_xatcrt]: input[_CRT],
75
- [_xatpet]: input[_PET],
76
- [_xatlmn]: input[_LMN],
77
- [_xatil]: [() => isSerializableHeaderValue(input[_IL]), () => input[_IL].toString()],
78
- [_xatlo]: input[_LO],
79
- [_xatpl]: input[_PL],
80
- [_xatiml]: [() => isSerializableHeaderValue(input[_IML]), () => input[_IML].toString()],
81
- [_xatvn_]: input[_VNo],
82
- [_xatvfn_]: input[_VFNo],
83
- });
84
- b.bp("/stream-transcription");
85
- let body;
86
- if (input.AudioStream !== undefined) {
87
- body = se_AudioStream(input.AudioStream, context);
88
- }
89
- b.m("POST").h(headers).b(body);
90
- return b.build();
91
- };
92
- exports.se_StartStreamTranscriptionCommand = se_StartStreamTranscriptionCommand;
93
- const de_StartCallAnalyticsStreamTranscriptionCommand = async (output, context) => {
94
- if (output.statusCode !== 200 && output.statusCode >= 300) {
95
- return de_StartCallAnalyticsStreamTranscriptionCommandError(output, context);
96
- }
97
- const contents = (0, smithy_client_1.map)({
98
- $metadata: deserializeMetadata(output),
99
- [_RI]: [, output.headers[_xari]],
100
- [_LC]: [, output.headers[_xatlc]],
101
- [_MSRH]: [() => void 0 !== output.headers[_xatsr], () => (0, smithy_client_1.strictParseInt32)(output.headers[_xatsr])],
102
- [_ME]: [, output.headers[_xatme]],
103
- [_VN]: [, output.headers[_xatvn]],
104
- [_SI]: [, output.headers[_xatsi]],
105
- [_VFN]: [, output.headers[_xatvfn]],
106
- [_VFM]: [, output.headers[_xatvfm]],
107
- [_LMN]: [, output.headers[_xatlmn]],
108
- [_EPRS]: [() => void 0 !== output.headers[_xateprs], () => (0, smithy_client_1.parseBoolean)(output.headers[_xateprs])],
109
- [_PRS]: [, output.headers[_xatprs]],
110
- [_CIT]: [, output.headers[_xatcit]],
111
- [_CRT]: [, output.headers[_xatcrt]],
112
- [_PET]: [, output.headers[_xatpet]],
113
- });
114
- const data = output.body;
115
- contents.CallAnalyticsTranscriptResultStream = de_CallAnalyticsTranscriptResultStream(data, context);
116
- return contents;
117
- };
118
- exports.de_StartCallAnalyticsStreamTranscriptionCommand = de_StartCallAnalyticsStreamTranscriptionCommand;
119
- const de_StartCallAnalyticsStreamTranscriptionCommandError = async (output, context) => {
120
- const parsedOutput = {
121
- ...output,
122
- body: await parseErrorBody(output.body, context),
123
- };
124
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
125
- switch (errorCode) {
126
- case "BadRequestException":
127
- case "com.amazonaws.transcribestreaming#BadRequestException":
128
- throw await de_BadRequestExceptionRes(parsedOutput, context);
129
- case "ConflictException":
130
- case "com.amazonaws.transcribestreaming#ConflictException":
131
- throw await de_ConflictExceptionRes(parsedOutput, context);
132
- case "InternalFailureException":
133
- case "com.amazonaws.transcribestreaming#InternalFailureException":
134
- throw await de_InternalFailureExceptionRes(parsedOutput, context);
135
- case "LimitExceededException":
136
- case "com.amazonaws.transcribestreaming#LimitExceededException":
137
- throw await de_LimitExceededExceptionRes(parsedOutput, context);
138
- case "ServiceUnavailableException":
139
- case "com.amazonaws.transcribestreaming#ServiceUnavailableException":
140
- throw await de_ServiceUnavailableExceptionRes(parsedOutput, context);
141
- default:
142
- const parsedBody = parsedOutput.body;
143
- return throwDefaultError({
144
- output,
145
- parsedBody,
146
- errorCode,
147
- });
148
- }
149
- };
150
- const de_StartMedicalStreamTranscriptionCommand = async (output, context) => {
151
- if (output.statusCode !== 200 && output.statusCode >= 300) {
152
- return de_StartMedicalStreamTranscriptionCommandError(output, context);
153
- }
154
- const contents = (0, smithy_client_1.map)({
155
- $metadata: deserializeMetadata(output),
156
- [_RI]: [, output.headers[_xari]],
157
- [_LC]: [, output.headers[_xatlc]],
158
- [_MSRH]: [() => void 0 !== output.headers[_xatsr], () => (0, smithy_client_1.strictParseInt32)(output.headers[_xatsr])],
159
- [_ME]: [, output.headers[_xatme]],
160
- [_VN]: [, output.headers[_xatvn]],
161
- [_S]: [, output.headers[_xats]],
162
- [_T]: [, output.headers[_xatt]],
163
- [_SSL]: [() => void 0 !== output.headers[_xatssl], () => (0, smithy_client_1.parseBoolean)(output.headers[_xatssl])],
164
- [_SI]: [, output.headers[_xatsi]],
165
- [_ECI]: [() => void 0 !== output.headers[_xateci], () => (0, smithy_client_1.parseBoolean)(output.headers[_xateci])],
166
- [_NOC]: [() => void 0 !== output.headers[_xatnoc], () => (0, smithy_client_1.strictParseInt32)(output.headers[_xatnoc])],
167
- [_CIT]: [, output.headers[_xatcit]],
168
- });
169
- const data = output.body;
170
- contents.TranscriptResultStream = de_MedicalTranscriptResultStream(data, context);
171
- return contents;
172
- };
173
- exports.de_StartMedicalStreamTranscriptionCommand = de_StartMedicalStreamTranscriptionCommand;
174
- const de_StartMedicalStreamTranscriptionCommandError = async (output, context) => {
175
- const parsedOutput = {
176
- ...output,
177
- body: await parseErrorBody(output.body, context),
178
- };
179
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
180
- switch (errorCode) {
181
- case "BadRequestException":
182
- case "com.amazonaws.transcribestreaming#BadRequestException":
183
- throw await de_BadRequestExceptionRes(parsedOutput, context);
184
- case "ConflictException":
185
- case "com.amazonaws.transcribestreaming#ConflictException":
186
- throw await de_ConflictExceptionRes(parsedOutput, context);
187
- case "InternalFailureException":
188
- case "com.amazonaws.transcribestreaming#InternalFailureException":
189
- throw await de_InternalFailureExceptionRes(parsedOutput, context);
190
- case "LimitExceededException":
191
- case "com.amazonaws.transcribestreaming#LimitExceededException":
192
- throw await de_LimitExceededExceptionRes(parsedOutput, context);
193
- case "ServiceUnavailableException":
194
- case "com.amazonaws.transcribestreaming#ServiceUnavailableException":
195
- throw await de_ServiceUnavailableExceptionRes(parsedOutput, context);
196
- default:
197
- const parsedBody = parsedOutput.body;
198
- return throwDefaultError({
199
- output,
200
- parsedBody,
201
- errorCode,
202
- });
203
- }
204
- };
205
- const de_StartStreamTranscriptionCommand = async (output, context) => {
206
- if (output.statusCode !== 200 && output.statusCode >= 300) {
207
- return de_StartStreamTranscriptionCommandError(output, context);
208
- }
209
- const contents = (0, smithy_client_1.map)({
210
- $metadata: deserializeMetadata(output),
211
- [_RI]: [, output.headers[_xari]],
212
- [_LC]: [, output.headers[_xatlc]],
213
- [_MSRH]: [() => void 0 !== output.headers[_xatsr], () => (0, smithy_client_1.strictParseInt32)(output.headers[_xatsr])],
214
- [_ME]: [, output.headers[_xatme]],
215
- [_VN]: [, output.headers[_xatvn]],
216
- [_SI]: [, output.headers[_xatsi]],
217
- [_VFN]: [, output.headers[_xatvfn]],
218
- [_VFM]: [, output.headers[_xatvfm]],
219
- [_SSL]: [() => void 0 !== output.headers[_xatssl], () => (0, smithy_client_1.parseBoolean)(output.headers[_xatssl])],
220
- [_ECI]: [() => void 0 !== output.headers[_xateci], () => (0, smithy_client_1.parseBoolean)(output.headers[_xateci])],
221
- [_NOC]: [() => void 0 !== output.headers[_xatnoc], () => (0, smithy_client_1.strictParseInt32)(output.headers[_xatnoc])],
222
- [_EPRS]: [() => void 0 !== output.headers[_xateprs], () => (0, smithy_client_1.parseBoolean)(output.headers[_xateprs])],
223
- [_PRS]: [, output.headers[_xatprs]],
224
- [_CIT]: [, output.headers[_xatcit]],
225
- [_CRT]: [, output.headers[_xatcrt]],
226
- [_PET]: [, output.headers[_xatpet]],
227
- [_LMN]: [, output.headers[_xatlmn]],
228
- [_IL]: [() => void 0 !== output.headers[_xatil], () => (0, smithy_client_1.parseBoolean)(output.headers[_xatil])],
229
- [_LO]: [, output.headers[_xatlo]],
230
- [_PL]: [, output.headers[_xatpl]],
231
- [_IML]: [() => void 0 !== output.headers[_xatiml], () => (0, smithy_client_1.parseBoolean)(output.headers[_xatiml])],
232
- [_VNo]: [, output.headers[_xatvn_]],
233
- [_VFNo]: [, output.headers[_xatvfn_]],
234
- });
235
- const data = output.body;
236
- contents.TranscriptResultStream = de_TranscriptResultStream(data, context);
237
- return contents;
238
- };
239
- exports.de_StartStreamTranscriptionCommand = de_StartStreamTranscriptionCommand;
240
- const de_StartStreamTranscriptionCommandError = async (output, context) => {
241
- const parsedOutput = {
242
- ...output,
243
- body: await parseErrorBody(output.body, context),
244
- };
245
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
246
- switch (errorCode) {
247
- case "BadRequestException":
248
- case "com.amazonaws.transcribestreaming#BadRequestException":
249
- throw await de_BadRequestExceptionRes(parsedOutput, context);
250
- case "ConflictException":
251
- case "com.amazonaws.transcribestreaming#ConflictException":
252
- throw await de_ConflictExceptionRes(parsedOutput, context);
253
- case "InternalFailureException":
254
- case "com.amazonaws.transcribestreaming#InternalFailureException":
255
- throw await de_InternalFailureExceptionRes(parsedOutput, context);
256
- case "LimitExceededException":
257
- case "com.amazonaws.transcribestreaming#LimitExceededException":
258
- throw await de_LimitExceededExceptionRes(parsedOutput, context);
259
- case "ServiceUnavailableException":
260
- case "com.amazonaws.transcribestreaming#ServiceUnavailableException":
261
- throw await de_ServiceUnavailableExceptionRes(parsedOutput, context);
262
- default:
263
- const parsedBody = parsedOutput.body;
264
- return throwDefaultError({
265
- output,
266
- parsedBody,
267
- errorCode,
268
- });
269
- }
270
- };
271
- const throwDefaultError = (0, smithy_client_1.withBaseException)(TranscribeStreamingServiceException_1.TranscribeStreamingServiceException);
272
- const de_BadRequestExceptionRes = async (parsedOutput, context) => {
273
- const contents = (0, smithy_client_1.map)({});
274
- const data = parsedOutput.body;
275
- const doc = (0, smithy_client_1.take)(data, {
276
- Message: smithy_client_1.expectString,
277
- });
278
- Object.assign(contents, doc);
279
- const exception = new models_0_1.BadRequestException({
280
- $metadata: deserializeMetadata(parsedOutput),
281
- ...contents,
282
- });
283
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
284
- };
285
- const de_ConflictExceptionRes = async (parsedOutput, context) => {
286
- const contents = (0, smithy_client_1.map)({});
287
- const data = parsedOutput.body;
288
- const doc = (0, smithy_client_1.take)(data, {
289
- Message: smithy_client_1.expectString,
290
- });
291
- Object.assign(contents, doc);
292
- const exception = new models_0_1.ConflictException({
293
- $metadata: deserializeMetadata(parsedOutput),
294
- ...contents,
295
- });
296
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
297
- };
298
- const de_InternalFailureExceptionRes = async (parsedOutput, context) => {
299
- const contents = (0, smithy_client_1.map)({});
300
- const data = parsedOutput.body;
301
- const doc = (0, smithy_client_1.take)(data, {
302
- Message: smithy_client_1.expectString,
303
- });
304
- Object.assign(contents, doc);
305
- const exception = new models_0_1.InternalFailureException({
306
- $metadata: deserializeMetadata(parsedOutput),
307
- ...contents,
308
- });
309
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
310
- };
311
- const de_LimitExceededExceptionRes = async (parsedOutput, context) => {
312
- const contents = (0, smithy_client_1.map)({});
313
- const data = parsedOutput.body;
314
- const doc = (0, smithy_client_1.take)(data, {
315
- Message: smithy_client_1.expectString,
316
- });
317
- Object.assign(contents, doc);
318
- const exception = new models_0_1.LimitExceededException({
319
- $metadata: deserializeMetadata(parsedOutput),
320
- ...contents,
321
- });
322
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
323
- };
324
- const de_ServiceUnavailableExceptionRes = async (parsedOutput, context) => {
325
- const contents = (0, smithy_client_1.map)({});
326
- const data = parsedOutput.body;
327
- const doc = (0, smithy_client_1.take)(data, {
328
- Message: smithy_client_1.expectString,
329
- });
330
- Object.assign(contents, doc);
331
- const exception = new models_0_1.ServiceUnavailableException({
332
- $metadata: deserializeMetadata(parsedOutput),
333
- ...contents,
334
- });
335
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
336
- };
337
- const se_AudioStream = (input, context) => {
338
- const eventMarshallingVisitor = (event) => models_0_1.AudioStream.visit(event, {
339
- AudioEvent: (value) => se_AudioEvent_event(value, context),
340
- ConfigurationEvent: (value) => se_ConfigurationEvent_event(value, context),
341
- _: (value) => value,
342
- });
343
- return context.eventStreamMarshaller.serialize(input, eventMarshallingVisitor);
344
- };
345
- const se_AudioEvent_event = (input, context) => {
346
- const headers = {
347
- ":event-type": { type: "string", value: "AudioEvent" },
348
- ":message-type": { type: "string", value: "event" },
349
- ":content-type": { type: "string", value: "application/octet-stream" },
350
- };
351
- let body = new Uint8Array();
352
- if (input.AudioChunk != null) {
353
- body = input.AudioChunk;
354
- }
355
- return { headers, body };
356
- };
357
- const se_ConfigurationEvent_event = (input, context) => {
358
- const headers = {
359
- ":event-type": { type: "string", value: "ConfigurationEvent" },
360
- ":message-type": { type: "string", value: "event" },
361
- ":content-type": { type: "string", value: "application/json" },
362
- };
363
- let body = new Uint8Array();
364
- body = (0, smithy_client_1._json)(input);
365
- body = context.utf8Decoder(JSON.stringify(body));
366
- return { headers, body };
367
- };
368
- const de_CallAnalyticsTranscriptResultStream = (output, context) => {
369
- return context.eventStreamMarshaller.deserialize(output, async (event) => {
370
- if (event["UtteranceEvent"] != null) {
371
- return {
372
- UtteranceEvent: await de_UtteranceEvent_event(event["UtteranceEvent"], context),
373
- };
374
- }
375
- if (event["CategoryEvent"] != null) {
376
- return {
377
- CategoryEvent: await de_CategoryEvent_event(event["CategoryEvent"], context),
378
- };
379
- }
380
- if (event["BadRequestException"] != null) {
381
- return {
382
- BadRequestException: await de_BadRequestException_event(event["BadRequestException"], context),
383
- };
384
- }
385
- if (event["LimitExceededException"] != null) {
386
- return {
387
- LimitExceededException: await de_LimitExceededException_event(event["LimitExceededException"], context),
388
- };
389
- }
390
- if (event["InternalFailureException"] != null) {
391
- return {
392
- InternalFailureException: await de_InternalFailureException_event(event["InternalFailureException"], context),
393
- };
394
- }
395
- if (event["ConflictException"] != null) {
396
- return {
397
- ConflictException: await de_ConflictException_event(event["ConflictException"], context),
398
- };
399
- }
400
- if (event["ServiceUnavailableException"] != null) {
401
- return {
402
- ServiceUnavailableException: await de_ServiceUnavailableException_event(event["ServiceUnavailableException"], context),
403
- };
404
- }
405
- return { $unknown: output };
406
- });
407
- };
408
- const de_MedicalTranscriptResultStream = (output, context) => {
409
- return context.eventStreamMarshaller.deserialize(output, async (event) => {
410
- if (event["TranscriptEvent"] != null) {
411
- return {
412
- TranscriptEvent: await de_MedicalTranscriptEvent_event(event["TranscriptEvent"], context),
413
- };
414
- }
415
- if (event["BadRequestException"] != null) {
416
- return {
417
- BadRequestException: await de_BadRequestException_event(event["BadRequestException"], context),
418
- };
419
- }
420
- if (event["LimitExceededException"] != null) {
421
- return {
422
- LimitExceededException: await de_LimitExceededException_event(event["LimitExceededException"], context),
423
- };
424
- }
425
- if (event["InternalFailureException"] != null) {
426
- return {
427
- InternalFailureException: await de_InternalFailureException_event(event["InternalFailureException"], context),
428
- };
429
- }
430
- if (event["ConflictException"] != null) {
431
- return {
432
- ConflictException: await de_ConflictException_event(event["ConflictException"], context),
433
- };
434
- }
435
- if (event["ServiceUnavailableException"] != null) {
436
- return {
437
- ServiceUnavailableException: await de_ServiceUnavailableException_event(event["ServiceUnavailableException"], context),
438
- };
439
- }
440
- return { $unknown: output };
441
- });
442
- };
443
- const de_TranscriptResultStream = (output, context) => {
444
- return context.eventStreamMarshaller.deserialize(output, async (event) => {
445
- if (event["TranscriptEvent"] != null) {
446
- return {
447
- TranscriptEvent: await de_TranscriptEvent_event(event["TranscriptEvent"], context),
448
- };
449
- }
450
- if (event["BadRequestException"] != null) {
451
- return {
452
- BadRequestException: await de_BadRequestException_event(event["BadRequestException"], context),
453
- };
454
- }
455
- if (event["LimitExceededException"] != null) {
456
- return {
457
- LimitExceededException: await de_LimitExceededException_event(event["LimitExceededException"], context),
458
- };
459
- }
460
- if (event["InternalFailureException"] != null) {
461
- return {
462
- InternalFailureException: await de_InternalFailureException_event(event["InternalFailureException"], context),
463
- };
464
- }
465
- if (event["ConflictException"] != null) {
466
- return {
467
- ConflictException: await de_ConflictException_event(event["ConflictException"], context),
468
- };
469
- }
470
- if (event["ServiceUnavailableException"] != null) {
471
- return {
472
- ServiceUnavailableException: await de_ServiceUnavailableException_event(event["ServiceUnavailableException"], context),
473
- };
474
- }
475
- return { $unknown: output };
476
- });
477
- };
478
- const de_BadRequestException_event = async (output, context) => {
479
- const parsedOutput = {
480
- ...output,
481
- body: await parseBody(output.body, context),
482
- };
483
- return de_BadRequestExceptionRes(parsedOutput, context);
484
- };
485
- const de_CategoryEvent_event = async (output, context) => {
486
- const contents = {};
487
- const data = await parseBody(output.body, context);
488
- Object.assign(contents, (0, smithy_client_1._json)(data));
489
- return contents;
490
- };
491
- const de_ConflictException_event = async (output, context) => {
492
- const parsedOutput = {
493
- ...output,
494
- body: await parseBody(output.body, context),
495
- };
496
- return de_ConflictExceptionRes(parsedOutput, context);
497
- };
498
- const de_InternalFailureException_event = async (output, context) => {
499
- const parsedOutput = {
500
- ...output,
501
- body: await parseBody(output.body, context),
502
- };
503
- return de_InternalFailureExceptionRes(parsedOutput, context);
504
- };
505
- const de_LimitExceededException_event = async (output, context) => {
506
- const parsedOutput = {
507
- ...output,
508
- body: await parseBody(output.body, context),
509
- };
510
- return de_LimitExceededExceptionRes(parsedOutput, context);
511
- };
512
- const de_MedicalTranscriptEvent_event = async (output, context) => {
513
- const contents = {};
514
- const data = await parseBody(output.body, context);
515
- Object.assign(contents, de_MedicalTranscriptEvent(data, context));
516
- return contents;
517
- };
518
- const de_ServiceUnavailableException_event = async (output, context) => {
519
- const parsedOutput = {
520
- ...output,
521
- body: await parseBody(output.body, context),
522
- };
523
- return de_ServiceUnavailableExceptionRes(parsedOutput, context);
524
- };
525
- const de_TranscriptEvent_event = async (output, context) => {
526
- const contents = {};
527
- const data = await parseBody(output.body, context);
528
- Object.assign(contents, de_TranscriptEvent(data, context));
529
- return contents;
530
- };
531
- const de_UtteranceEvent_event = async (output, context) => {
532
- const contents = {};
533
- const data = await parseBody(output.body, context);
534
- Object.assign(contents, de_UtteranceEvent(data, context));
535
- return contents;
536
- };
537
- const de_Alternative = (output, context) => {
538
- return (0, smithy_client_1.take)(output, {
539
- Entities: (_) => de_EntityList(_, context),
540
- Items: (_) => de_ItemList(_, context),
541
- Transcript: smithy_client_1.expectString,
542
- });
543
- };
544
- const de_AlternativeList = (output, context) => {
545
- const retVal = (output || [])
546
- .filter((e) => e != null)
547
- .map((entry) => {
548
- return de_Alternative(entry, context);
549
- });
550
- return retVal;
551
- };
552
- const de_CallAnalyticsEntity = (output, context) => {
553
- return (0, smithy_client_1.take)(output, {
554
- BeginOffsetMillis: smithy_client_1.expectLong,
555
- Category: smithy_client_1.expectString,
556
- Confidence: smithy_client_1.limitedParseDouble,
557
- Content: smithy_client_1.expectString,
558
- EndOffsetMillis: smithy_client_1.expectLong,
559
- Type: smithy_client_1.expectString,
560
- });
561
- };
562
- const de_CallAnalyticsEntityList = (output, context) => {
563
- const retVal = (output || [])
564
- .filter((e) => e != null)
565
- .map((entry) => {
566
- return de_CallAnalyticsEntity(entry, context);
567
- });
568
- return retVal;
569
- };
570
- const de_CallAnalyticsItem = (output, context) => {
571
- return (0, smithy_client_1.take)(output, {
572
- BeginOffsetMillis: smithy_client_1.expectLong,
573
- Confidence: smithy_client_1.limitedParseDouble,
574
- Content: smithy_client_1.expectString,
575
- EndOffsetMillis: smithy_client_1.expectLong,
576
- Stable: smithy_client_1.expectBoolean,
577
- Type: smithy_client_1.expectString,
578
- VocabularyFilterMatch: smithy_client_1.expectBoolean,
579
- });
580
- };
581
- const de_CallAnalyticsItemList = (output, context) => {
582
- const retVal = (output || [])
583
- .filter((e) => e != null)
584
- .map((entry) => {
585
- return de_CallAnalyticsItem(entry, context);
586
- });
587
- return retVal;
588
- };
589
- const de_Entity = (output, context) => {
590
- return (0, smithy_client_1.take)(output, {
591
- Category: smithy_client_1.expectString,
592
- Confidence: smithy_client_1.limitedParseDouble,
593
- Content: smithy_client_1.expectString,
594
- EndTime: smithy_client_1.limitedParseDouble,
595
- StartTime: smithy_client_1.limitedParseDouble,
596
- Type: smithy_client_1.expectString,
597
- });
598
- };
599
- const de_EntityList = (output, context) => {
600
- const retVal = (output || [])
601
- .filter((e) => e != null)
602
- .map((entry) => {
603
- return de_Entity(entry, context);
604
- });
605
- return retVal;
606
- };
607
- const de_Item = (output, context) => {
608
- return (0, smithy_client_1.take)(output, {
609
- Confidence: smithy_client_1.limitedParseDouble,
610
- Content: smithy_client_1.expectString,
611
- EndTime: smithy_client_1.limitedParseDouble,
612
- Speaker: smithy_client_1.expectString,
613
- Stable: smithy_client_1.expectBoolean,
614
- StartTime: smithy_client_1.limitedParseDouble,
615
- Type: smithy_client_1.expectString,
616
- VocabularyFilterMatch: smithy_client_1.expectBoolean,
617
- });
618
- };
619
- const de_ItemList = (output, context) => {
620
- const retVal = (output || [])
621
- .filter((e) => e != null)
622
- .map((entry) => {
623
- return de_Item(entry, context);
624
- });
625
- return retVal;
626
- };
627
- const de_LanguageIdentification = (output, context) => {
628
- const retVal = (output || [])
629
- .filter((e) => e != null)
630
- .map((entry) => {
631
- return de_LanguageWithScore(entry, context);
632
- });
633
- return retVal;
634
- };
635
- const de_LanguageWithScore = (output, context) => {
636
- return (0, smithy_client_1.take)(output, {
637
- LanguageCode: smithy_client_1.expectString,
638
- Score: smithy_client_1.limitedParseDouble,
639
- });
640
- };
641
- const de_MedicalAlternative = (output, context) => {
642
- return (0, smithy_client_1.take)(output, {
643
- Entities: (_) => de_MedicalEntityList(_, context),
644
- Items: (_) => de_MedicalItemList(_, context),
645
- Transcript: smithy_client_1.expectString,
646
- });
647
- };
648
- const de_MedicalAlternativeList = (output, context) => {
649
- const retVal = (output || [])
650
- .filter((e) => e != null)
651
- .map((entry) => {
652
- return de_MedicalAlternative(entry, context);
653
- });
654
- return retVal;
655
- };
656
- const de_MedicalEntity = (output, context) => {
657
- return (0, smithy_client_1.take)(output, {
658
- Category: smithy_client_1.expectString,
659
- Confidence: smithy_client_1.limitedParseDouble,
660
- Content: smithy_client_1.expectString,
661
- EndTime: smithy_client_1.limitedParseDouble,
662
- StartTime: smithy_client_1.limitedParseDouble,
663
- });
664
- };
665
- const de_MedicalEntityList = (output, context) => {
666
- const retVal = (output || [])
667
- .filter((e) => e != null)
668
- .map((entry) => {
669
- return de_MedicalEntity(entry, context);
670
- });
671
- return retVal;
672
- };
673
- const de_MedicalItem = (output, context) => {
674
- return (0, smithy_client_1.take)(output, {
675
- Confidence: smithy_client_1.limitedParseDouble,
676
- Content: smithy_client_1.expectString,
677
- EndTime: smithy_client_1.limitedParseDouble,
678
- Speaker: smithy_client_1.expectString,
679
- StartTime: smithy_client_1.limitedParseDouble,
680
- Type: smithy_client_1.expectString,
681
- });
682
- };
683
- const de_MedicalItemList = (output, context) => {
684
- const retVal = (output || [])
685
- .filter((e) => e != null)
686
- .map((entry) => {
687
- return de_MedicalItem(entry, context);
688
- });
689
- return retVal;
690
- };
691
- const de_MedicalResult = (output, context) => {
692
- return (0, smithy_client_1.take)(output, {
693
- Alternatives: (_) => de_MedicalAlternativeList(_, context),
694
- ChannelId: smithy_client_1.expectString,
695
- EndTime: smithy_client_1.limitedParseDouble,
696
- IsPartial: smithy_client_1.expectBoolean,
697
- ResultId: smithy_client_1.expectString,
698
- StartTime: smithy_client_1.limitedParseDouble,
699
- });
700
- };
701
- const de_MedicalResultList = (output, context) => {
702
- const retVal = (output || [])
703
- .filter((e) => e != null)
704
- .map((entry) => {
705
- return de_MedicalResult(entry, context);
706
- });
707
- return retVal;
708
- };
709
- const de_MedicalTranscript = (output, context) => {
710
- return (0, smithy_client_1.take)(output, {
711
- Results: (_) => de_MedicalResultList(_, context),
712
- });
713
- };
714
- const de_MedicalTranscriptEvent = (output, context) => {
715
- return (0, smithy_client_1.take)(output, {
716
- Transcript: (_) => de_MedicalTranscript(_, context),
717
- });
718
- };
719
- const de_Result = (output, context) => {
720
- return (0, smithy_client_1.take)(output, {
721
- Alternatives: (_) => de_AlternativeList(_, context),
722
- ChannelId: smithy_client_1.expectString,
723
- EndTime: smithy_client_1.limitedParseDouble,
724
- IsPartial: smithy_client_1.expectBoolean,
725
- LanguageCode: smithy_client_1.expectString,
726
- LanguageIdentification: (_) => de_LanguageIdentification(_, context),
727
- ResultId: smithy_client_1.expectString,
728
- StartTime: smithy_client_1.limitedParseDouble,
729
- });
730
- };
731
- const de_ResultList = (output, context) => {
732
- const retVal = (output || [])
733
- .filter((e) => e != null)
734
- .map((entry) => {
735
- return de_Result(entry, context);
736
- });
737
- return retVal;
738
- };
739
- const de_Transcript = (output, context) => {
740
- return (0, smithy_client_1.take)(output, {
741
- Results: (_) => de_ResultList(_, context),
742
- });
743
- };
744
- const de_TranscriptEvent = (output, context) => {
745
- return (0, smithy_client_1.take)(output, {
746
- Transcript: (_) => de_Transcript(_, context),
747
- });
748
- };
749
- const de_UtteranceEvent = (output, context) => {
750
- return (0, smithy_client_1.take)(output, {
751
- BeginOffsetMillis: smithy_client_1.expectLong,
752
- EndOffsetMillis: smithy_client_1.expectLong,
753
- Entities: (_) => de_CallAnalyticsEntityList(_, context),
754
- IsPartial: smithy_client_1.expectBoolean,
755
- IssuesDetected: smithy_client_1._json,
756
- Items: (_) => de_CallAnalyticsItemList(_, context),
757
- ParticipantRole: smithy_client_1.expectString,
758
- Sentiment: smithy_client_1.expectString,
759
- Transcript: smithy_client_1.expectString,
760
- UtteranceId: smithy_client_1.expectString,
761
- });
762
- };
763
- const deserializeMetadata = (output) => ({
764
- httpStatusCode: output.statusCode,
765
- requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
766
- extendedRequestId: output.headers["x-amz-id-2"],
767
- cfId: output.headers["x-amz-cf-id"],
768
- });
769
- const collectBodyString = (streamBody, context) => (0, smithy_client_1.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body));
770
- const isSerializableHeaderValue = (value) => value !== undefined &&
771
- value !== null &&
772
- value !== "" &&
773
- (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
774
- (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
775
- const _CIT = "ContentIdentificationType";
776
- const _CRT = "ContentRedactionType";
777
- const _ECI = "EnableChannelIdentification";
778
- const _EPRS = "EnablePartialResultsStabilization";
779
- const _IL = "IdentifyLanguage";
780
- const _IML = "IdentifyMultipleLanguages";
781
- const _LC = "LanguageCode";
782
- const _LMN = "LanguageModelName";
783
- const _LO = "LanguageOptions";
784
- const _ME = "MediaEncoding";
785
- const _MSRH = "MediaSampleRateHertz";
786
- const _NOC = "NumberOfChannels";
787
- const _PET = "PiiEntityTypes";
788
- const _PL = "PreferredLanguage";
789
- const _PRS = "PartialResultsStability";
790
- const _RI = "RequestId";
791
- const _S = "Specialty";
792
- const _SI = "SessionId";
793
- const _SSL = "ShowSpeakerLabel";
794
- const _T = "Type";
795
- const _VFM = "VocabularyFilterMethod";
796
- const _VFN = "VocabularyFilterName";
797
- const _VFNo = "VocabularyFilterNames";
798
- const _VN = "VocabularyName";
799
- const _VNo = "VocabularyNames";
800
- const _xari = "x-amzn-request-id";
801
- const _xatcit = "x-amzn-transcribe-content-identification-type";
802
- const _xatcrt = "x-amzn-transcribe-content-redaction-type";
803
- const _xateci = "x-amzn-transcribe-enable-channel-identification";
804
- const _xateprs = "x-amzn-transcribe-enable-partial-results-stabilization";
805
- const _xatil = "x-amzn-transcribe-identify-language";
806
- const _xatiml = "x-amzn-transcribe-identify-multiple-languages";
807
- const _xatlc = "x-amzn-transcribe-language-code";
808
- const _xatlmn = "x-amzn-transcribe-language-model-name";
809
- const _xatlo = "x-amzn-transcribe-language-options";
810
- const _xatme = "x-amzn-transcribe-media-encoding";
811
- const _xatnoc = "x-amzn-transcribe-number-of-channels";
812
- const _xatpet = "x-amzn-transcribe-pii-entity-types";
813
- const _xatpl = "x-amzn-transcribe-preferred-language";
814
- const _xatprs = "x-amzn-transcribe-partial-results-stability";
815
- const _xats = "x-amzn-transcribe-specialty";
816
- const _xatsi = "x-amzn-transcribe-session-id";
817
- const _xatsr = "x-amzn-transcribe-sample-rate";
818
- const _xatssl = "x-amzn-transcribe-show-speaker-label";
819
- const _xatt = "x-amzn-transcribe-type";
820
- const _xatvfm = "x-amzn-transcribe-vocabulary-filter-method";
821
- const _xatvfn = "x-amzn-transcribe-vocabulary-filter-name";
822
- const _xatvfn_ = "x-amzn-transcribe-vocabulary-filter-names";
823
- const _xatvn = "x-amzn-transcribe-vocabulary-name";
824
- const _xatvn_ = "x-amzn-transcribe-vocabulary-names";
825
- const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
826
- if (encoded.length) {
827
- return JSON.parse(encoded);
828
- }
829
- return {};
830
- });
831
- const parseErrorBody = async (errorBody, context) => {
832
- const value = await parseBody(errorBody, context);
833
- value.message = value.message ?? value.Message;
834
- return value;
835
- };
836
- const loadRestJsonErrorCode = (output, data) => {
837
- const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
838
- const sanitizeErrorCode = (rawValue) => {
839
- let cleanValue = rawValue;
840
- if (typeof cleanValue === "number") {
841
- cleanValue = cleanValue.toString();
842
- }
843
- if (cleanValue.indexOf(",") >= 0) {
844
- cleanValue = cleanValue.split(",")[0];
845
- }
846
- if (cleanValue.indexOf(":") >= 0) {
847
- cleanValue = cleanValue.split(":")[0];
848
- }
849
- if (cleanValue.indexOf("#") >= 0) {
850
- cleanValue = cleanValue.split("#")[1];
851
- }
852
- return cleanValue;
853
- };
854
- const headerKey = findKey(output.headers, "x-amzn-errortype");
855
- if (headerKey !== undefined) {
856
- return sanitizeErrorCode(output.headers[headerKey]);
857
- }
858
- if (data.code !== undefined) {
859
- return sanitizeErrorCode(data.code);
860
- }
861
- if (data["__type"] !== undefined) {
862
- return sanitizeErrorCode(data["__type"]);
863
- }
864
- };
1
+ module.exports = require("../index.js");