@aws-sdk/client-polly 3.312.0 → 3.315.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.
@@ -26,7 +26,7 @@ const se_DescribeVoicesCommand = async (input, context) => {
26
26
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
27
27
  const headers = {};
28
28
  const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/voices";
29
- const query = map({
29
+ const query = (0, smithy_client_1.map)({
30
30
  Engine: [, input.Engine],
31
31
  LanguageCode: [, input.LanguageCode],
32
32
  IncludeAdditionalLanguageCodes: [
@@ -86,7 +86,7 @@ const se_ListLexiconsCommand = async (input, context) => {
86
86
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
87
87
  const headers = {};
88
88
  const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/lexicons";
89
- const query = map({
89
+ const query = (0, smithy_client_1.map)({
90
90
  NextToken: [, input.NextToken],
91
91
  });
92
92
  let body;
@@ -106,7 +106,7 @@ const se_ListSpeechSynthesisTasksCommand = async (input, context) => {
106
106
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
107
107
  const headers = {};
108
108
  const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/synthesisTasks";
109
- const query = map({
109
+ const query = (0, smithy_client_1.map)({
110
110
  MaxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
111
111
  NextToken: [, input.NextToken],
112
112
  Status: [, input.Status],
@@ -132,9 +132,9 @@ const se_PutLexiconCommand = async (input, context) => {
132
132
  let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/lexicons/{Name}";
133
133
  resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "Name", () => input.Name, "{Name}", false);
134
134
  let body;
135
- body = JSON.stringify({
136
- ...(input.Content != null && { Content: input.Content }),
137
- });
135
+ body = JSON.stringify((0, smithy_client_1.take)(input, {
136
+ Content: [],
137
+ }));
138
138
  return new protocol_http_1.HttpRequest({
139
139
  protocol,
140
140
  hostname,
@@ -153,20 +153,20 @@ const se_StartSpeechSynthesisTaskCommand = async (input, context) => {
153
153
  };
154
154
  const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/synthesisTasks";
155
155
  let body;
156
- body = JSON.stringify({
157
- ...(input.Engine != null && { Engine: input.Engine }),
158
- ...(input.LanguageCode != null && { LanguageCode: input.LanguageCode }),
159
- ...(input.LexiconNames != null && { LexiconNames: se_LexiconNameList(input.LexiconNames, context) }),
160
- ...(input.OutputFormat != null && { OutputFormat: input.OutputFormat }),
161
- ...(input.OutputS3BucketName != null && { OutputS3BucketName: input.OutputS3BucketName }),
162
- ...(input.OutputS3KeyPrefix != null && { OutputS3KeyPrefix: input.OutputS3KeyPrefix }),
163
- ...(input.SampleRate != null && { SampleRate: input.SampleRate }),
164
- ...(input.SnsTopicArn != null && { SnsTopicArn: input.SnsTopicArn }),
165
- ...(input.SpeechMarkTypes != null && { SpeechMarkTypes: se_SpeechMarkTypeList(input.SpeechMarkTypes, context) }),
166
- ...(input.Text != null && { Text: input.Text }),
167
- ...(input.TextType != null && { TextType: input.TextType }),
168
- ...(input.VoiceId != null && { VoiceId: input.VoiceId }),
169
- });
156
+ body = JSON.stringify((0, smithy_client_1.take)(input, {
157
+ Engine: [],
158
+ LanguageCode: [],
159
+ LexiconNames: (_) => (0, smithy_client_1._json)(_),
160
+ OutputFormat: [],
161
+ OutputS3BucketName: [],
162
+ OutputS3KeyPrefix: [],
163
+ SampleRate: [],
164
+ SnsTopicArn: [],
165
+ SpeechMarkTypes: (_) => (0, smithy_client_1._json)(_),
166
+ Text: [],
167
+ TextType: [],
168
+ VoiceId: [],
169
+ }));
170
170
  return new protocol_http_1.HttpRequest({
171
171
  protocol,
172
172
  hostname,
@@ -185,17 +185,17 @@ const se_SynthesizeSpeechCommand = async (input, context) => {
185
185
  };
186
186
  const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/speech";
187
187
  let body;
188
- body = JSON.stringify({
189
- ...(input.Engine != null && { Engine: input.Engine }),
190
- ...(input.LanguageCode != null && { LanguageCode: input.LanguageCode }),
191
- ...(input.LexiconNames != null && { LexiconNames: se_LexiconNameList(input.LexiconNames, context) }),
192
- ...(input.OutputFormat != null && { OutputFormat: input.OutputFormat }),
193
- ...(input.SampleRate != null && { SampleRate: input.SampleRate }),
194
- ...(input.SpeechMarkTypes != null && { SpeechMarkTypes: se_SpeechMarkTypeList(input.SpeechMarkTypes, context) }),
195
- ...(input.Text != null && { Text: input.Text }),
196
- ...(input.TextType != null && { TextType: input.TextType }),
197
- ...(input.VoiceId != null && { VoiceId: input.VoiceId }),
198
- });
188
+ body = JSON.stringify((0, smithy_client_1.take)(input, {
189
+ Engine: [],
190
+ LanguageCode: [],
191
+ LexiconNames: (_) => (0, smithy_client_1._json)(_),
192
+ OutputFormat: [],
193
+ SampleRate: [],
194
+ SpeechMarkTypes: (_) => (0, smithy_client_1._json)(_),
195
+ Text: [],
196
+ TextType: [],
197
+ VoiceId: [],
198
+ }));
199
199
  return new protocol_http_1.HttpRequest({
200
200
  protocol,
201
201
  hostname,
@@ -211,7 +211,7 @@ const de_DeleteLexiconCommand = async (output, context) => {
211
211
  if (output.statusCode !== 200 && output.statusCode >= 300) {
212
212
  return de_DeleteLexiconCommandError(output, context);
213
213
  }
214
- const contents = map({
214
+ const contents = (0, smithy_client_1.map)({
215
215
  $metadata: deserializeMetadata(output),
216
216
  });
217
217
  await collectBody(output.body, context);
@@ -233,10 +233,9 @@ const de_DeleteLexiconCommandError = async (output, context) => {
233
233
  throw await de_ServiceFailureExceptionRes(parsedOutput, context);
234
234
  default:
235
235
  const parsedBody = parsedOutput.body;
236
- (0, smithy_client_1.throwDefaultError)({
236
+ return throwDefaultError({
237
237
  output,
238
238
  parsedBody,
239
- exceptionCtor: PollyServiceException_1.PollyServiceException,
240
239
  errorCode,
241
240
  });
242
241
  }
@@ -245,16 +244,15 @@ const de_DescribeVoicesCommand = async (output, context) => {
245
244
  if (output.statusCode !== 200 && output.statusCode >= 300) {
246
245
  return de_DescribeVoicesCommandError(output, context);
247
246
  }
248
- const contents = map({
247
+ const contents = (0, smithy_client_1.map)({
249
248
  $metadata: deserializeMetadata(output),
250
249
  });
251
250
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
252
- if (data.NextToken != null) {
253
- contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
254
- }
255
- if (data.Voices != null) {
256
- contents.Voices = de_VoiceList(data.Voices, context);
257
- }
251
+ const doc = (0, smithy_client_1.take)(data, {
252
+ NextToken: smithy_client_1.expectString,
253
+ Voices: smithy_client_1._json,
254
+ });
255
+ Object.assign(contents, doc);
258
256
  return contents;
259
257
  };
260
258
  exports.de_DescribeVoicesCommand = de_DescribeVoicesCommand;
@@ -273,10 +271,9 @@ const de_DescribeVoicesCommandError = async (output, context) => {
273
271
  throw await de_ServiceFailureExceptionRes(parsedOutput, context);
274
272
  default:
275
273
  const parsedBody = parsedOutput.body;
276
- (0, smithy_client_1.throwDefaultError)({
274
+ return throwDefaultError({
277
275
  output,
278
276
  parsedBody,
279
- exceptionCtor: PollyServiceException_1.PollyServiceException,
280
277
  errorCode,
281
278
  });
282
279
  }
@@ -285,16 +282,15 @@ const de_GetLexiconCommand = async (output, context) => {
285
282
  if (output.statusCode !== 200 && output.statusCode >= 300) {
286
283
  return de_GetLexiconCommandError(output, context);
287
284
  }
288
- const contents = map({
285
+ const contents = (0, smithy_client_1.map)({
289
286
  $metadata: deserializeMetadata(output),
290
287
  });
291
288
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
292
- if (data.Lexicon != null) {
293
- contents.Lexicon = de_Lexicon(data.Lexicon, context);
294
- }
295
- if (data.LexiconAttributes != null) {
296
- contents.LexiconAttributes = de_LexiconAttributes(data.LexiconAttributes, context);
297
- }
289
+ const doc = (0, smithy_client_1.take)(data, {
290
+ Lexicon: smithy_client_1._json,
291
+ LexiconAttributes: (_) => de_LexiconAttributes(_, context),
292
+ });
293
+ Object.assign(contents, doc);
298
294
  return contents;
299
295
  };
300
296
  exports.de_GetLexiconCommand = de_GetLexiconCommand;
@@ -313,10 +309,9 @@ const de_GetLexiconCommandError = async (output, context) => {
313
309
  throw await de_ServiceFailureExceptionRes(parsedOutput, context);
314
310
  default:
315
311
  const parsedBody = parsedOutput.body;
316
- (0, smithy_client_1.throwDefaultError)({
312
+ return throwDefaultError({
317
313
  output,
318
314
  parsedBody,
319
- exceptionCtor: PollyServiceException_1.PollyServiceException,
320
315
  errorCode,
321
316
  });
322
317
  }
@@ -325,13 +320,14 @@ const de_GetSpeechSynthesisTaskCommand = async (output, context) => {
325
320
  if (output.statusCode !== 200 && output.statusCode >= 300) {
326
321
  return de_GetSpeechSynthesisTaskCommandError(output, context);
327
322
  }
328
- const contents = map({
323
+ const contents = (0, smithy_client_1.map)({
329
324
  $metadata: deserializeMetadata(output),
330
325
  });
331
326
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
332
- if (data.SynthesisTask != null) {
333
- contents.SynthesisTask = de_SynthesisTask(data.SynthesisTask, context);
334
- }
327
+ const doc = (0, smithy_client_1.take)(data, {
328
+ SynthesisTask: (_) => de_SynthesisTask(_, context),
329
+ });
330
+ Object.assign(contents, doc);
335
331
  return contents;
336
332
  };
337
333
  exports.de_GetSpeechSynthesisTaskCommand = de_GetSpeechSynthesisTaskCommand;
@@ -353,10 +349,9 @@ const de_GetSpeechSynthesisTaskCommandError = async (output, context) => {
353
349
  throw await de_SynthesisTaskNotFoundExceptionRes(parsedOutput, context);
354
350
  default:
355
351
  const parsedBody = parsedOutput.body;
356
- (0, smithy_client_1.throwDefaultError)({
352
+ return throwDefaultError({
357
353
  output,
358
354
  parsedBody,
359
- exceptionCtor: PollyServiceException_1.PollyServiceException,
360
355
  errorCode,
361
356
  });
362
357
  }
@@ -365,16 +360,15 @@ const de_ListLexiconsCommand = async (output, context) => {
365
360
  if (output.statusCode !== 200 && output.statusCode >= 300) {
366
361
  return de_ListLexiconsCommandError(output, context);
367
362
  }
368
- const contents = map({
363
+ const contents = (0, smithy_client_1.map)({
369
364
  $metadata: deserializeMetadata(output),
370
365
  });
371
366
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
372
- if (data.Lexicons != null) {
373
- contents.Lexicons = de_LexiconDescriptionList(data.Lexicons, context);
374
- }
375
- if (data.NextToken != null) {
376
- contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
377
- }
367
+ const doc = (0, smithy_client_1.take)(data, {
368
+ Lexicons: (_) => de_LexiconDescriptionList(_, context),
369
+ NextToken: smithy_client_1.expectString,
370
+ });
371
+ Object.assign(contents, doc);
378
372
  return contents;
379
373
  };
380
374
  exports.de_ListLexiconsCommand = de_ListLexiconsCommand;
@@ -393,10 +387,9 @@ const de_ListLexiconsCommandError = async (output, context) => {
393
387
  throw await de_ServiceFailureExceptionRes(parsedOutput, context);
394
388
  default:
395
389
  const parsedBody = parsedOutput.body;
396
- (0, smithy_client_1.throwDefaultError)({
390
+ return throwDefaultError({
397
391
  output,
398
392
  parsedBody,
399
- exceptionCtor: PollyServiceException_1.PollyServiceException,
400
393
  errorCode,
401
394
  });
402
395
  }
@@ -405,16 +398,15 @@ const de_ListSpeechSynthesisTasksCommand = async (output, context) => {
405
398
  if (output.statusCode !== 200 && output.statusCode >= 300) {
406
399
  return de_ListSpeechSynthesisTasksCommandError(output, context);
407
400
  }
408
- const contents = map({
401
+ const contents = (0, smithy_client_1.map)({
409
402
  $metadata: deserializeMetadata(output),
410
403
  });
411
404
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
412
- if (data.NextToken != null) {
413
- contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
414
- }
415
- if (data.SynthesisTasks != null) {
416
- contents.SynthesisTasks = de_SynthesisTasks(data.SynthesisTasks, context);
417
- }
405
+ const doc = (0, smithy_client_1.take)(data, {
406
+ NextToken: smithy_client_1.expectString,
407
+ SynthesisTasks: (_) => de_SynthesisTasks(_, context),
408
+ });
409
+ Object.assign(contents, doc);
418
410
  return contents;
419
411
  };
420
412
  exports.de_ListSpeechSynthesisTasksCommand = de_ListSpeechSynthesisTasksCommand;
@@ -433,10 +425,9 @@ const de_ListSpeechSynthesisTasksCommandError = async (output, context) => {
433
425
  throw await de_ServiceFailureExceptionRes(parsedOutput, context);
434
426
  default:
435
427
  const parsedBody = parsedOutput.body;
436
- (0, smithy_client_1.throwDefaultError)({
428
+ return throwDefaultError({
437
429
  output,
438
430
  parsedBody,
439
- exceptionCtor: PollyServiceException_1.PollyServiceException,
440
431
  errorCode,
441
432
  });
442
433
  }
@@ -445,7 +436,7 @@ const de_PutLexiconCommand = async (output, context) => {
445
436
  if (output.statusCode !== 200 && output.statusCode >= 300) {
446
437
  return de_PutLexiconCommandError(output, context);
447
438
  }
448
- const contents = map({
439
+ const contents = (0, smithy_client_1.map)({
449
440
  $metadata: deserializeMetadata(output),
450
441
  });
451
442
  await collectBody(output.body, context);
@@ -482,10 +473,9 @@ const de_PutLexiconCommandError = async (output, context) => {
482
473
  throw await de_UnsupportedPlsLanguageExceptionRes(parsedOutput, context);
483
474
  default:
484
475
  const parsedBody = parsedOutput.body;
485
- (0, smithy_client_1.throwDefaultError)({
476
+ return throwDefaultError({
486
477
  output,
487
478
  parsedBody,
488
- exceptionCtor: PollyServiceException_1.PollyServiceException,
489
479
  errorCode,
490
480
  });
491
481
  }
@@ -494,13 +484,14 @@ const de_StartSpeechSynthesisTaskCommand = async (output, context) => {
494
484
  if (output.statusCode !== 200 && output.statusCode >= 300) {
495
485
  return de_StartSpeechSynthesisTaskCommandError(output, context);
496
486
  }
497
- const contents = map({
487
+ const contents = (0, smithy_client_1.map)({
498
488
  $metadata: deserializeMetadata(output),
499
489
  });
500
490
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
501
- if (data.SynthesisTask != null) {
502
- contents.SynthesisTask = de_SynthesisTask(data.SynthesisTask, context);
503
- }
491
+ const doc = (0, smithy_client_1.take)(data, {
492
+ SynthesisTask: (_) => de_SynthesisTask(_, context),
493
+ });
494
+ Object.assign(contents, doc);
504
495
  return contents;
505
496
  };
506
497
  exports.de_StartSpeechSynthesisTaskCommand = de_StartSpeechSynthesisTaskCommand;
@@ -549,10 +540,9 @@ const de_StartSpeechSynthesisTaskCommandError = async (output, context) => {
549
540
  throw await de_TextLengthExceededExceptionRes(parsedOutput, context);
550
541
  default:
551
542
  const parsedBody = parsedOutput.body;
552
- (0, smithy_client_1.throwDefaultError)({
543
+ return throwDefaultError({
553
544
  output,
554
545
  parsedBody,
555
- exceptionCtor: PollyServiceException_1.PollyServiceException,
556
546
  errorCode,
557
547
  });
558
548
  }
@@ -561,7 +551,7 @@ const de_SynthesizeSpeechCommand = async (output, context) => {
561
551
  if (output.statusCode !== 200 && output.statusCode >= 300) {
562
552
  return de_SynthesizeSpeechCommandError(output, context);
563
553
  }
564
- const contents = map({
554
+ const contents = (0, smithy_client_1.map)({
565
555
  $metadata: deserializeMetadata(output),
566
556
  ContentType: [, output.headers["content-type"]],
567
557
  RequestCharacters: [
@@ -611,21 +601,21 @@ const de_SynthesizeSpeechCommandError = async (output, context) => {
611
601
  throw await de_TextLengthExceededExceptionRes(parsedOutput, context);
612
602
  default:
613
603
  const parsedBody = parsedOutput.body;
614
- (0, smithy_client_1.throwDefaultError)({
604
+ return throwDefaultError({
615
605
  output,
616
606
  parsedBody,
617
- exceptionCtor: PollyServiceException_1.PollyServiceException,
618
607
  errorCode,
619
608
  });
620
609
  }
621
610
  };
622
- const map = smithy_client_1.map;
611
+ const throwDefaultError = (0, smithy_client_1.withBaseException)(PollyServiceException_1.PollyServiceException);
623
612
  const de_EngineNotSupportedExceptionRes = async (parsedOutput, context) => {
624
- const contents = map({});
613
+ const contents = (0, smithy_client_1.map)({});
625
614
  const data = parsedOutput.body;
626
- if (data.message != null) {
627
- contents.message = (0, smithy_client_1.expectString)(data.message);
628
- }
615
+ const doc = (0, smithy_client_1.take)(data, {
616
+ message: smithy_client_1.expectString,
617
+ });
618
+ Object.assign(contents, doc);
629
619
  const exception = new models_0_1.EngineNotSupportedException({
630
620
  $metadata: deserializeMetadata(parsedOutput),
631
621
  ...contents,
@@ -633,11 +623,12 @@ const de_EngineNotSupportedExceptionRes = async (parsedOutput, context) => {
633
623
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
634
624
  };
635
625
  const de_InvalidLexiconExceptionRes = async (parsedOutput, context) => {
636
- const contents = map({});
626
+ const contents = (0, smithy_client_1.map)({});
637
627
  const data = parsedOutput.body;
638
- if (data.message != null) {
639
- contents.message = (0, smithy_client_1.expectString)(data.message);
640
- }
628
+ const doc = (0, smithy_client_1.take)(data, {
629
+ message: smithy_client_1.expectString,
630
+ });
631
+ Object.assign(contents, doc);
641
632
  const exception = new models_0_1.InvalidLexiconException({
642
633
  $metadata: deserializeMetadata(parsedOutput),
643
634
  ...contents,
@@ -645,11 +636,12 @@ const de_InvalidLexiconExceptionRes = async (parsedOutput, context) => {
645
636
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
646
637
  };
647
638
  const de_InvalidNextTokenExceptionRes = async (parsedOutput, context) => {
648
- const contents = map({});
639
+ const contents = (0, smithy_client_1.map)({});
649
640
  const data = parsedOutput.body;
650
- if (data.message != null) {
651
- contents.message = (0, smithy_client_1.expectString)(data.message);
652
- }
641
+ const doc = (0, smithy_client_1.take)(data, {
642
+ message: smithy_client_1.expectString,
643
+ });
644
+ Object.assign(contents, doc);
653
645
  const exception = new models_0_1.InvalidNextTokenException({
654
646
  $metadata: deserializeMetadata(parsedOutput),
655
647
  ...contents,
@@ -657,11 +649,12 @@ const de_InvalidNextTokenExceptionRes = async (parsedOutput, context) => {
657
649
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
658
650
  };
659
651
  const de_InvalidS3BucketExceptionRes = async (parsedOutput, context) => {
660
- const contents = map({});
652
+ const contents = (0, smithy_client_1.map)({});
661
653
  const data = parsedOutput.body;
662
- if (data.message != null) {
663
- contents.message = (0, smithy_client_1.expectString)(data.message);
664
- }
654
+ const doc = (0, smithy_client_1.take)(data, {
655
+ message: smithy_client_1.expectString,
656
+ });
657
+ Object.assign(contents, doc);
665
658
  const exception = new models_0_1.InvalidS3BucketException({
666
659
  $metadata: deserializeMetadata(parsedOutput),
667
660
  ...contents,
@@ -669,11 +662,12 @@ const de_InvalidS3BucketExceptionRes = async (parsedOutput, context) => {
669
662
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
670
663
  };
671
664
  const de_InvalidS3KeyExceptionRes = async (parsedOutput, context) => {
672
- const contents = map({});
665
+ const contents = (0, smithy_client_1.map)({});
673
666
  const data = parsedOutput.body;
674
- if (data.message != null) {
675
- contents.message = (0, smithy_client_1.expectString)(data.message);
676
- }
667
+ const doc = (0, smithy_client_1.take)(data, {
668
+ message: smithy_client_1.expectString,
669
+ });
670
+ Object.assign(contents, doc);
677
671
  const exception = new models_0_1.InvalidS3KeyException({
678
672
  $metadata: deserializeMetadata(parsedOutput),
679
673
  ...contents,
@@ -681,11 +675,12 @@ const de_InvalidS3KeyExceptionRes = async (parsedOutput, context) => {
681
675
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
682
676
  };
683
677
  const de_InvalidSampleRateExceptionRes = async (parsedOutput, context) => {
684
- const contents = map({});
678
+ const contents = (0, smithy_client_1.map)({});
685
679
  const data = parsedOutput.body;
686
- if (data.message != null) {
687
- contents.message = (0, smithy_client_1.expectString)(data.message);
688
- }
680
+ const doc = (0, smithy_client_1.take)(data, {
681
+ message: smithy_client_1.expectString,
682
+ });
683
+ Object.assign(contents, doc);
689
684
  const exception = new models_0_1.InvalidSampleRateException({
690
685
  $metadata: deserializeMetadata(parsedOutput),
691
686
  ...contents,
@@ -693,11 +688,12 @@ const de_InvalidSampleRateExceptionRes = async (parsedOutput, context) => {
693
688
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
694
689
  };
695
690
  const de_InvalidSnsTopicArnExceptionRes = async (parsedOutput, context) => {
696
- const contents = map({});
691
+ const contents = (0, smithy_client_1.map)({});
697
692
  const data = parsedOutput.body;
698
- if (data.message != null) {
699
- contents.message = (0, smithy_client_1.expectString)(data.message);
700
- }
693
+ const doc = (0, smithy_client_1.take)(data, {
694
+ message: smithy_client_1.expectString,
695
+ });
696
+ Object.assign(contents, doc);
701
697
  const exception = new models_0_1.InvalidSnsTopicArnException({
702
698
  $metadata: deserializeMetadata(parsedOutput),
703
699
  ...contents,
@@ -705,11 +701,12 @@ const de_InvalidSnsTopicArnExceptionRes = async (parsedOutput, context) => {
705
701
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
706
702
  };
707
703
  const de_InvalidSsmlExceptionRes = async (parsedOutput, context) => {
708
- const contents = map({});
704
+ const contents = (0, smithy_client_1.map)({});
709
705
  const data = parsedOutput.body;
710
- if (data.message != null) {
711
- contents.message = (0, smithy_client_1.expectString)(data.message);
712
- }
706
+ const doc = (0, smithy_client_1.take)(data, {
707
+ message: smithy_client_1.expectString,
708
+ });
709
+ Object.assign(contents, doc);
713
710
  const exception = new models_0_1.InvalidSsmlException({
714
711
  $metadata: deserializeMetadata(parsedOutput),
715
712
  ...contents,
@@ -717,11 +714,12 @@ const de_InvalidSsmlExceptionRes = async (parsedOutput, context) => {
717
714
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
718
715
  };
719
716
  const de_InvalidTaskIdExceptionRes = async (parsedOutput, context) => {
720
- const contents = map({});
717
+ const contents = (0, smithy_client_1.map)({});
721
718
  const data = parsedOutput.body;
722
- if (data.message != null) {
723
- contents.message = (0, smithy_client_1.expectString)(data.message);
724
- }
719
+ const doc = (0, smithy_client_1.take)(data, {
720
+ message: smithy_client_1.expectString,
721
+ });
722
+ Object.assign(contents, doc);
725
723
  const exception = new models_0_1.InvalidTaskIdException({
726
724
  $metadata: deserializeMetadata(parsedOutput),
727
725
  ...contents,
@@ -729,11 +727,12 @@ const de_InvalidTaskIdExceptionRes = async (parsedOutput, context) => {
729
727
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
730
728
  };
731
729
  const de_LanguageNotSupportedExceptionRes = async (parsedOutput, context) => {
732
- const contents = map({});
730
+ const contents = (0, smithy_client_1.map)({});
733
731
  const data = parsedOutput.body;
734
- if (data.message != null) {
735
- contents.message = (0, smithy_client_1.expectString)(data.message);
736
- }
732
+ const doc = (0, smithy_client_1.take)(data, {
733
+ message: smithy_client_1.expectString,
734
+ });
735
+ Object.assign(contents, doc);
737
736
  const exception = new models_0_1.LanguageNotSupportedException({
738
737
  $metadata: deserializeMetadata(parsedOutput),
739
738
  ...contents,
@@ -741,11 +740,12 @@ const de_LanguageNotSupportedExceptionRes = async (parsedOutput, context) => {
741
740
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
742
741
  };
743
742
  const de_LexiconNotFoundExceptionRes = async (parsedOutput, context) => {
744
- const contents = map({});
743
+ const contents = (0, smithy_client_1.map)({});
745
744
  const data = parsedOutput.body;
746
- if (data.message != null) {
747
- contents.message = (0, smithy_client_1.expectString)(data.message);
748
- }
745
+ const doc = (0, smithy_client_1.take)(data, {
746
+ message: smithy_client_1.expectString,
747
+ });
748
+ Object.assign(contents, doc);
749
749
  const exception = new models_0_1.LexiconNotFoundException({
750
750
  $metadata: deserializeMetadata(parsedOutput),
751
751
  ...contents,
@@ -753,11 +753,12 @@ const de_LexiconNotFoundExceptionRes = async (parsedOutput, context) => {
753
753
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
754
754
  };
755
755
  const de_LexiconSizeExceededExceptionRes = async (parsedOutput, context) => {
756
- const contents = map({});
756
+ const contents = (0, smithy_client_1.map)({});
757
757
  const data = parsedOutput.body;
758
- if (data.message != null) {
759
- contents.message = (0, smithy_client_1.expectString)(data.message);
760
- }
758
+ const doc = (0, smithy_client_1.take)(data, {
759
+ message: smithy_client_1.expectString,
760
+ });
761
+ Object.assign(contents, doc);
761
762
  const exception = new models_0_1.LexiconSizeExceededException({
762
763
  $metadata: deserializeMetadata(parsedOutput),
763
764
  ...contents,
@@ -765,11 +766,12 @@ const de_LexiconSizeExceededExceptionRes = async (parsedOutput, context) => {
765
766
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
766
767
  };
767
768
  const de_MarksNotSupportedForFormatExceptionRes = async (parsedOutput, context) => {
768
- const contents = map({});
769
+ const contents = (0, smithy_client_1.map)({});
769
770
  const data = parsedOutput.body;
770
- if (data.message != null) {
771
- contents.message = (0, smithy_client_1.expectString)(data.message);
772
- }
771
+ const doc = (0, smithy_client_1.take)(data, {
772
+ message: smithy_client_1.expectString,
773
+ });
774
+ Object.assign(contents, doc);
773
775
  const exception = new models_0_1.MarksNotSupportedForFormatException({
774
776
  $metadata: deserializeMetadata(parsedOutput),
775
777
  ...contents,
@@ -777,11 +779,12 @@ const de_MarksNotSupportedForFormatExceptionRes = async (parsedOutput, context)
777
779
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
778
780
  };
779
781
  const de_MaxLexemeLengthExceededExceptionRes = async (parsedOutput, context) => {
780
- const contents = map({});
782
+ const contents = (0, smithy_client_1.map)({});
781
783
  const data = parsedOutput.body;
782
- if (data.message != null) {
783
- contents.message = (0, smithy_client_1.expectString)(data.message);
784
- }
784
+ const doc = (0, smithy_client_1.take)(data, {
785
+ message: smithy_client_1.expectString,
786
+ });
787
+ Object.assign(contents, doc);
785
788
  const exception = new models_0_1.MaxLexemeLengthExceededException({
786
789
  $metadata: deserializeMetadata(parsedOutput),
787
790
  ...contents,
@@ -789,11 +792,12 @@ const de_MaxLexemeLengthExceededExceptionRes = async (parsedOutput, context) =>
789
792
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
790
793
  };
791
794
  const de_MaxLexiconsNumberExceededExceptionRes = async (parsedOutput, context) => {
792
- const contents = map({});
795
+ const contents = (0, smithy_client_1.map)({});
793
796
  const data = parsedOutput.body;
794
- if (data.message != null) {
795
- contents.message = (0, smithy_client_1.expectString)(data.message);
796
- }
797
+ const doc = (0, smithy_client_1.take)(data, {
798
+ message: smithy_client_1.expectString,
799
+ });
800
+ Object.assign(contents, doc);
797
801
  const exception = new models_0_1.MaxLexiconsNumberExceededException({
798
802
  $metadata: deserializeMetadata(parsedOutput),
799
803
  ...contents,
@@ -801,11 +805,12 @@ const de_MaxLexiconsNumberExceededExceptionRes = async (parsedOutput, context) =
801
805
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
802
806
  };
803
807
  const de_ServiceFailureExceptionRes = async (parsedOutput, context) => {
804
- const contents = map({});
808
+ const contents = (0, smithy_client_1.map)({});
805
809
  const data = parsedOutput.body;
806
- if (data.message != null) {
807
- contents.message = (0, smithy_client_1.expectString)(data.message);
808
- }
810
+ const doc = (0, smithy_client_1.take)(data, {
811
+ message: smithy_client_1.expectString,
812
+ });
813
+ Object.assign(contents, doc);
809
814
  const exception = new models_0_1.ServiceFailureException({
810
815
  $metadata: deserializeMetadata(parsedOutput),
811
816
  ...contents,
@@ -813,11 +818,12 @@ const de_ServiceFailureExceptionRes = async (parsedOutput, context) => {
813
818
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
814
819
  };
815
820
  const de_SsmlMarksNotSupportedForTextTypeExceptionRes = async (parsedOutput, context) => {
816
- const contents = map({});
821
+ const contents = (0, smithy_client_1.map)({});
817
822
  const data = parsedOutput.body;
818
- if (data.message != null) {
819
- contents.message = (0, smithy_client_1.expectString)(data.message);
820
- }
823
+ const doc = (0, smithy_client_1.take)(data, {
824
+ message: smithy_client_1.expectString,
825
+ });
826
+ Object.assign(contents, doc);
821
827
  const exception = new models_0_1.SsmlMarksNotSupportedForTextTypeException({
822
828
  $metadata: deserializeMetadata(parsedOutput),
823
829
  ...contents,
@@ -825,11 +831,12 @@ const de_SsmlMarksNotSupportedForTextTypeExceptionRes = async (parsedOutput, con
825
831
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
826
832
  };
827
833
  const de_SynthesisTaskNotFoundExceptionRes = async (parsedOutput, context) => {
828
- const contents = map({});
834
+ const contents = (0, smithy_client_1.map)({});
829
835
  const data = parsedOutput.body;
830
- if (data.message != null) {
831
- contents.message = (0, smithy_client_1.expectString)(data.message);
832
- }
836
+ const doc = (0, smithy_client_1.take)(data, {
837
+ message: smithy_client_1.expectString,
838
+ });
839
+ Object.assign(contents, doc);
833
840
  const exception = new models_0_1.SynthesisTaskNotFoundException({
834
841
  $metadata: deserializeMetadata(parsedOutput),
835
842
  ...contents,
@@ -837,11 +844,12 @@ const de_SynthesisTaskNotFoundExceptionRes = async (parsedOutput, context) => {
837
844
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
838
845
  };
839
846
  const de_TextLengthExceededExceptionRes = async (parsedOutput, context) => {
840
- const contents = map({});
847
+ const contents = (0, smithy_client_1.map)({});
841
848
  const data = parsedOutput.body;
842
- if (data.message != null) {
843
- contents.message = (0, smithy_client_1.expectString)(data.message);
844
- }
849
+ const doc = (0, smithy_client_1.take)(data, {
850
+ message: smithy_client_1.expectString,
851
+ });
852
+ Object.assign(contents, doc);
845
853
  const exception = new models_0_1.TextLengthExceededException({
846
854
  $metadata: deserializeMetadata(parsedOutput),
847
855
  ...contents,
@@ -849,11 +857,12 @@ const de_TextLengthExceededExceptionRes = async (parsedOutput, context) => {
849
857
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
850
858
  };
851
859
  const de_UnsupportedPlsAlphabetExceptionRes = async (parsedOutput, context) => {
852
- const contents = map({});
860
+ const contents = (0, smithy_client_1.map)({});
853
861
  const data = parsedOutput.body;
854
- if (data.message != null) {
855
- contents.message = (0, smithy_client_1.expectString)(data.message);
856
- }
862
+ const doc = (0, smithy_client_1.take)(data, {
863
+ message: smithy_client_1.expectString,
864
+ });
865
+ Object.assign(contents, doc);
857
866
  const exception = new models_0_1.UnsupportedPlsAlphabetException({
858
867
  $metadata: deserializeMetadata(parsedOutput),
859
868
  ...contents,
@@ -861,164 +870,69 @@ const de_UnsupportedPlsAlphabetExceptionRes = async (parsedOutput, context) => {
861
870
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
862
871
  };
863
872
  const de_UnsupportedPlsLanguageExceptionRes = async (parsedOutput, context) => {
864
- const contents = map({});
873
+ const contents = (0, smithy_client_1.map)({});
865
874
  const data = parsedOutput.body;
866
- if (data.message != null) {
867
- contents.message = (0, smithy_client_1.expectString)(data.message);
868
- }
875
+ const doc = (0, smithy_client_1.take)(data, {
876
+ message: smithy_client_1.expectString,
877
+ });
878
+ Object.assign(contents, doc);
869
879
  const exception = new models_0_1.UnsupportedPlsLanguageException({
870
880
  $metadata: deserializeMetadata(parsedOutput),
871
881
  ...contents,
872
882
  });
873
883
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
874
884
  };
875
- const se_LexiconNameList = (input, context) => {
876
- return input
877
- .filter((e) => e != null)
878
- .map((entry) => {
879
- return entry;
880
- });
881
- };
882
- const se_SpeechMarkTypeList = (input, context) => {
883
- return input
884
- .filter((e) => e != null)
885
- .map((entry) => {
886
- return entry;
887
- });
888
- };
889
- const de_EngineList = (output, context) => {
890
- const retVal = (output || [])
891
- .filter((e) => e != null)
892
- .map((entry) => {
893
- if (entry === null) {
894
- return null;
895
- }
896
- return (0, smithy_client_1.expectString)(entry);
897
- });
898
- return retVal;
899
- };
900
- const de_LanguageCodeList = (output, context) => {
901
- const retVal = (output || [])
902
- .filter((e) => e != null)
903
- .map((entry) => {
904
- if (entry === null) {
905
- return null;
906
- }
907
- return (0, smithy_client_1.expectString)(entry);
908
- });
909
- return retVal;
910
- };
911
- const de_Lexicon = (output, context) => {
912
- return {
913
- Content: (0, smithy_client_1.expectString)(output.Content),
914
- Name: (0, smithy_client_1.expectString)(output.Name),
915
- };
916
- };
917
885
  const de_LexiconAttributes = (output, context) => {
918
- return {
919
- Alphabet: (0, smithy_client_1.expectString)(output.Alphabet),
920
- LanguageCode: (0, smithy_client_1.expectString)(output.LanguageCode),
921
- LastModified: output.LastModified != null
922
- ? (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(output.LastModified)))
923
- : undefined,
924
- LexemesCount: (0, smithy_client_1.expectInt32)(output.LexemesCount),
925
- LexiconArn: (0, smithy_client_1.expectString)(output.LexiconArn),
926
- Size: (0, smithy_client_1.expectInt32)(output.Size),
927
- };
886
+ return (0, smithy_client_1.take)(output, {
887
+ Alphabet: smithy_client_1.expectString,
888
+ LanguageCode: smithy_client_1.expectString,
889
+ LastModified: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))),
890
+ LexemesCount: smithy_client_1.expectInt32,
891
+ LexiconArn: smithy_client_1.expectString,
892
+ Size: smithy_client_1.expectInt32,
893
+ });
928
894
  };
929
895
  const de_LexiconDescription = (output, context) => {
930
- return {
931
- Attributes: output.Attributes != null ? de_LexiconAttributes(output.Attributes, context) : undefined,
932
- Name: (0, smithy_client_1.expectString)(output.Name),
933
- };
896
+ return (0, smithy_client_1.take)(output, {
897
+ Attributes: (_) => de_LexiconAttributes(_, context),
898
+ Name: smithy_client_1.expectString,
899
+ });
934
900
  };
935
901
  const de_LexiconDescriptionList = (output, context) => {
936
902
  const retVal = (output || [])
937
903
  .filter((e) => e != null)
938
904
  .map((entry) => {
939
- if (entry === null) {
940
- return null;
941
- }
942
905
  return de_LexiconDescription(entry, context);
943
906
  });
944
907
  return retVal;
945
908
  };
946
- const de_LexiconNameList = (output, context) => {
947
- const retVal = (output || [])
948
- .filter((e) => e != null)
949
- .map((entry) => {
950
- if (entry === null) {
951
- return null;
952
- }
953
- return (0, smithy_client_1.expectString)(entry);
954
- });
955
- return retVal;
956
- };
957
- const de_SpeechMarkTypeList = (output, context) => {
958
- const retVal = (output || [])
959
- .filter((e) => e != null)
960
- .map((entry) => {
961
- if (entry === null) {
962
- return null;
963
- }
964
- return (0, smithy_client_1.expectString)(entry);
965
- });
966
- return retVal;
967
- };
968
909
  const de_SynthesisTask = (output, context) => {
969
- return {
970
- CreationTime: output.CreationTime != null
971
- ? (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(output.CreationTime)))
972
- : undefined,
973
- Engine: (0, smithy_client_1.expectString)(output.Engine),
974
- LanguageCode: (0, smithy_client_1.expectString)(output.LanguageCode),
975
- LexiconNames: output.LexiconNames != null ? de_LexiconNameList(output.LexiconNames, context) : undefined,
976
- OutputFormat: (0, smithy_client_1.expectString)(output.OutputFormat),
977
- OutputUri: (0, smithy_client_1.expectString)(output.OutputUri),
978
- RequestCharacters: (0, smithy_client_1.expectInt32)(output.RequestCharacters),
979
- SampleRate: (0, smithy_client_1.expectString)(output.SampleRate),
980
- SnsTopicArn: (0, smithy_client_1.expectString)(output.SnsTopicArn),
981
- SpeechMarkTypes: output.SpeechMarkTypes != null ? de_SpeechMarkTypeList(output.SpeechMarkTypes, context) : undefined,
982
- TaskId: (0, smithy_client_1.expectString)(output.TaskId),
983
- TaskStatus: (0, smithy_client_1.expectString)(output.TaskStatus),
984
- TaskStatusReason: (0, smithy_client_1.expectString)(output.TaskStatusReason),
985
- TextType: (0, smithy_client_1.expectString)(output.TextType),
986
- VoiceId: (0, smithy_client_1.expectString)(output.VoiceId),
987
- };
910
+ return (0, smithy_client_1.take)(output, {
911
+ CreationTime: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))),
912
+ Engine: smithy_client_1.expectString,
913
+ LanguageCode: smithy_client_1.expectString,
914
+ LexiconNames: smithy_client_1._json,
915
+ OutputFormat: smithy_client_1.expectString,
916
+ OutputUri: smithy_client_1.expectString,
917
+ RequestCharacters: smithy_client_1.expectInt32,
918
+ SampleRate: smithy_client_1.expectString,
919
+ SnsTopicArn: smithy_client_1.expectString,
920
+ SpeechMarkTypes: smithy_client_1._json,
921
+ TaskId: smithy_client_1.expectString,
922
+ TaskStatus: smithy_client_1.expectString,
923
+ TaskStatusReason: smithy_client_1.expectString,
924
+ TextType: smithy_client_1.expectString,
925
+ VoiceId: smithy_client_1.expectString,
926
+ });
988
927
  };
989
928
  const de_SynthesisTasks = (output, context) => {
990
929
  const retVal = (output || [])
991
930
  .filter((e) => e != null)
992
931
  .map((entry) => {
993
- if (entry === null) {
994
- return null;
995
- }
996
932
  return de_SynthesisTask(entry, context);
997
933
  });
998
934
  return retVal;
999
935
  };
1000
- const de_Voice = (output, context) => {
1001
- return {
1002
- AdditionalLanguageCodes: output.AdditionalLanguageCodes != null ? de_LanguageCodeList(output.AdditionalLanguageCodes, context) : undefined,
1003
- Gender: (0, smithy_client_1.expectString)(output.Gender),
1004
- Id: (0, smithy_client_1.expectString)(output.Id),
1005
- LanguageCode: (0, smithy_client_1.expectString)(output.LanguageCode),
1006
- LanguageName: (0, smithy_client_1.expectString)(output.LanguageName),
1007
- Name: (0, smithy_client_1.expectString)(output.Name),
1008
- SupportedEngines: output.SupportedEngines != null ? de_EngineList(output.SupportedEngines, context) : undefined,
1009
- };
1010
- };
1011
- const de_VoiceList = (output, context) => {
1012
- const retVal = (output || [])
1013
- .filter((e) => e != null)
1014
- .map((entry) => {
1015
- if (entry === null) {
1016
- return null;
1017
- }
1018
- return de_Voice(entry, context);
1019
- });
1020
- return retVal;
1021
- };
1022
936
  const deserializeMetadata = (output) => ({
1023
937
  httpStatusCode: output.statusCode,
1024
938
  requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],