@aws-sdk/client-polly 3.489.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.
Files changed (34) hide show
  1. package/dist-cjs/Polly.js +1 -29
  2. package/dist-cjs/PollyClient.js +1 -56
  3. package/dist-cjs/auth/httpAuthExtensionConfiguration.js +1 -43
  4. package/dist-cjs/auth/httpAuthSchemeProvider.js +1 -1
  5. package/dist-cjs/commands/DeleteLexiconCommand.js +1 -28
  6. package/dist-cjs/commands/DescribeVoicesCommand.js +1 -28
  7. package/dist-cjs/commands/GetLexiconCommand.js +1 -29
  8. package/dist-cjs/commands/GetSpeechSynthesisTaskCommand.js +1 -28
  9. package/dist-cjs/commands/ListLexiconsCommand.js +1 -28
  10. package/dist-cjs/commands/ListSpeechSynthesisTasksCommand.js +1 -28
  11. package/dist-cjs/commands/PutLexiconCommand.js +1 -29
  12. package/dist-cjs/commands/StartSpeechSynthesisTaskCommand.js +1 -28
  13. package/dist-cjs/commands/SynthesizeSpeechCommand.js +1 -29
  14. package/dist-cjs/commands/index.js +1 -12
  15. package/dist-cjs/endpoint/EndpointParameters.js +1 -18
  16. package/dist-cjs/extensionConfiguration.js +1 -2
  17. package/dist-cjs/index.js +1910 -11
  18. package/dist-cjs/models/PollyServiceException.js +1 -12
  19. package/dist-cjs/models/index.js +1 -4
  20. package/dist-cjs/models/models_0.js +1 -466
  21. package/dist-cjs/pagination/Interfaces.js +1 -2
  22. package/dist-cjs/pagination/ListSpeechSynthesisTasksPaginator.js +1 -7
  23. package/dist-cjs/pagination/index.js +1 -5
  24. package/dist-cjs/protocols/Aws_restJson1.js +1 -925
  25. package/dist-cjs/runtimeConfig.shared.js +1 -1
  26. package/dist-cjs/runtimeExtensions.js +1 -25
  27. package/dist-es/PollyClient.js +8 -8
  28. package/dist-es/auth/httpAuthSchemeProvider.js +2 -2
  29. package/dist-es/runtimeConfig.shared.js +2 -2
  30. package/dist-types/PollyClient.d.ts +2 -2
  31. package/dist-types/auth/httpAuthSchemeProvider.d.ts +4 -4
  32. package/dist-types/ts3.4/PollyClient.d.ts +2 -2
  33. package/dist-types/ts3.4/auth/httpAuthSchemeProvider.d.ts +6 -6
  34. package/package.json +41 -41
@@ -1,925 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.de_SynthesizeSpeechCommand = exports.de_StartSpeechSynthesisTaskCommand = exports.de_PutLexiconCommand = exports.de_ListSpeechSynthesisTasksCommand = exports.de_ListLexiconsCommand = exports.de_GetSpeechSynthesisTaskCommand = exports.de_GetLexiconCommand = exports.de_DescribeVoicesCommand = exports.de_DeleteLexiconCommand = exports.se_SynthesizeSpeechCommand = exports.se_StartSpeechSynthesisTaskCommand = exports.se_PutLexiconCommand = exports.se_ListSpeechSynthesisTasksCommand = exports.se_ListLexiconsCommand = exports.se_GetSpeechSynthesisTaskCommand = exports.se_GetLexiconCommand = exports.se_DescribeVoicesCommand = exports.se_DeleteLexiconCommand = 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 PollyServiceException_1 = require("../models/PollyServiceException");
8
- const se_DeleteLexiconCommand = async (input, context) => {
9
- const b = (0, core_1.requestBuilder)(input, context);
10
- const headers = {};
11
- b.bp("/v1/lexicons/{Name}");
12
- b.p("Name", () => input.Name, "{Name}", false);
13
- let body;
14
- b.m("DELETE").h(headers).b(body);
15
- return b.build();
16
- };
17
- exports.se_DeleteLexiconCommand = se_DeleteLexiconCommand;
18
- const se_DescribeVoicesCommand = async (input, context) => {
19
- const b = (0, core_1.requestBuilder)(input, context);
20
- const headers = {};
21
- b.bp("/v1/voices");
22
- const query = (0, smithy_client_1.map)({
23
- [_E]: [, input[_E]],
24
- [_LC]: [, input[_LC]],
25
- [_IALC]: [() => input.IncludeAdditionalLanguageCodes !== void 0, () => input[_IALC].toString()],
26
- [_NT]: [, input[_NT]],
27
- });
28
- let body;
29
- b.m("GET").h(headers).q(query).b(body);
30
- return b.build();
31
- };
32
- exports.se_DescribeVoicesCommand = se_DescribeVoicesCommand;
33
- const se_GetLexiconCommand = async (input, context) => {
34
- const b = (0, core_1.requestBuilder)(input, context);
35
- const headers = {};
36
- b.bp("/v1/lexicons/{Name}");
37
- b.p("Name", () => input.Name, "{Name}", false);
38
- let body;
39
- b.m("GET").h(headers).b(body);
40
- return b.build();
41
- };
42
- exports.se_GetLexiconCommand = se_GetLexiconCommand;
43
- const se_GetSpeechSynthesisTaskCommand = async (input, context) => {
44
- const b = (0, core_1.requestBuilder)(input, context);
45
- const headers = {};
46
- b.bp("/v1/synthesisTasks/{TaskId}");
47
- b.p("TaskId", () => input.TaskId, "{TaskId}", false);
48
- let body;
49
- b.m("GET").h(headers).b(body);
50
- return b.build();
51
- };
52
- exports.se_GetSpeechSynthesisTaskCommand = se_GetSpeechSynthesisTaskCommand;
53
- const se_ListLexiconsCommand = async (input, context) => {
54
- const b = (0, core_1.requestBuilder)(input, context);
55
- const headers = {};
56
- b.bp("/v1/lexicons");
57
- const query = (0, smithy_client_1.map)({
58
- [_NT]: [, input[_NT]],
59
- });
60
- let body;
61
- b.m("GET").h(headers).q(query).b(body);
62
- return b.build();
63
- };
64
- exports.se_ListLexiconsCommand = se_ListLexiconsCommand;
65
- const se_ListSpeechSynthesisTasksCommand = async (input, context) => {
66
- const b = (0, core_1.requestBuilder)(input, context);
67
- const headers = {};
68
- b.bp("/v1/synthesisTasks");
69
- const query = (0, smithy_client_1.map)({
70
- [_MR]: [() => input.MaxResults !== void 0, () => input[_MR].toString()],
71
- [_NT]: [, input[_NT]],
72
- [_S]: [, input[_S]],
73
- });
74
- let body;
75
- b.m("GET").h(headers).q(query).b(body);
76
- return b.build();
77
- };
78
- exports.se_ListSpeechSynthesisTasksCommand = se_ListSpeechSynthesisTasksCommand;
79
- const se_PutLexiconCommand = async (input, context) => {
80
- const b = (0, core_1.requestBuilder)(input, context);
81
- const headers = {
82
- "content-type": "application/json",
83
- };
84
- b.bp("/v1/lexicons/{Name}");
85
- b.p("Name", () => input.Name, "{Name}", false);
86
- let body;
87
- body = JSON.stringify((0, smithy_client_1.take)(input, {
88
- Content: [],
89
- }));
90
- b.m("PUT").h(headers).b(body);
91
- return b.build();
92
- };
93
- exports.se_PutLexiconCommand = se_PutLexiconCommand;
94
- const se_StartSpeechSynthesisTaskCommand = async (input, context) => {
95
- const b = (0, core_1.requestBuilder)(input, context);
96
- const headers = {
97
- "content-type": "application/json",
98
- };
99
- b.bp("/v1/synthesisTasks");
100
- let body;
101
- body = JSON.stringify((0, smithy_client_1.take)(input, {
102
- Engine: [],
103
- LanguageCode: [],
104
- LexiconNames: (_) => (0, smithy_client_1._json)(_),
105
- OutputFormat: [],
106
- OutputS3BucketName: [],
107
- OutputS3KeyPrefix: [],
108
- SampleRate: [],
109
- SnsTopicArn: [],
110
- SpeechMarkTypes: (_) => (0, smithy_client_1._json)(_),
111
- Text: [],
112
- TextType: [],
113
- VoiceId: [],
114
- }));
115
- b.m("POST").h(headers).b(body);
116
- return b.build();
117
- };
118
- exports.se_StartSpeechSynthesisTaskCommand = se_StartSpeechSynthesisTaskCommand;
119
- const se_SynthesizeSpeechCommand = async (input, context) => {
120
- const b = (0, core_1.requestBuilder)(input, context);
121
- const headers = {
122
- "content-type": "application/json",
123
- };
124
- b.bp("/v1/speech");
125
- let body;
126
- body = JSON.stringify((0, smithy_client_1.take)(input, {
127
- Engine: [],
128
- LanguageCode: [],
129
- LexiconNames: (_) => (0, smithy_client_1._json)(_),
130
- OutputFormat: [],
131
- SampleRate: [],
132
- SpeechMarkTypes: (_) => (0, smithy_client_1._json)(_),
133
- Text: [],
134
- TextType: [],
135
- VoiceId: [],
136
- }));
137
- b.m("POST").h(headers).b(body);
138
- return b.build();
139
- };
140
- exports.se_SynthesizeSpeechCommand = se_SynthesizeSpeechCommand;
141
- const de_DeleteLexiconCommand = async (output, context) => {
142
- if (output.statusCode !== 200 && output.statusCode >= 300) {
143
- return de_DeleteLexiconCommandError(output, context);
144
- }
145
- const contents = (0, smithy_client_1.map)({
146
- $metadata: deserializeMetadata(output),
147
- });
148
- await (0, smithy_client_1.collectBody)(output.body, context);
149
- return contents;
150
- };
151
- exports.de_DeleteLexiconCommand = de_DeleteLexiconCommand;
152
- const de_DeleteLexiconCommandError = async (output, context) => {
153
- const parsedOutput = {
154
- ...output,
155
- body: await parseErrorBody(output.body, context),
156
- };
157
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
158
- switch (errorCode) {
159
- case "LexiconNotFoundException":
160
- case "com.amazonaws.polly#LexiconNotFoundException":
161
- throw await de_LexiconNotFoundExceptionRes(parsedOutput, context);
162
- case "ServiceFailureException":
163
- case "com.amazonaws.polly#ServiceFailureException":
164
- throw await de_ServiceFailureExceptionRes(parsedOutput, context);
165
- default:
166
- const parsedBody = parsedOutput.body;
167
- return throwDefaultError({
168
- output,
169
- parsedBody,
170
- errorCode,
171
- });
172
- }
173
- };
174
- const de_DescribeVoicesCommand = async (output, context) => {
175
- if (output.statusCode !== 200 && output.statusCode >= 300) {
176
- return de_DescribeVoicesCommandError(output, context);
177
- }
178
- const contents = (0, smithy_client_1.map)({
179
- $metadata: deserializeMetadata(output),
180
- });
181
- const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
182
- const doc = (0, smithy_client_1.take)(data, {
183
- NextToken: smithy_client_1.expectString,
184
- Voices: smithy_client_1._json,
185
- });
186
- Object.assign(contents, doc);
187
- return contents;
188
- };
189
- exports.de_DescribeVoicesCommand = de_DescribeVoicesCommand;
190
- const de_DescribeVoicesCommandError = async (output, context) => {
191
- const parsedOutput = {
192
- ...output,
193
- body: await parseErrorBody(output.body, context),
194
- };
195
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
196
- switch (errorCode) {
197
- case "InvalidNextTokenException":
198
- case "com.amazonaws.polly#InvalidNextTokenException":
199
- throw await de_InvalidNextTokenExceptionRes(parsedOutput, context);
200
- case "ServiceFailureException":
201
- case "com.amazonaws.polly#ServiceFailureException":
202
- throw await de_ServiceFailureExceptionRes(parsedOutput, context);
203
- default:
204
- const parsedBody = parsedOutput.body;
205
- return throwDefaultError({
206
- output,
207
- parsedBody,
208
- errorCode,
209
- });
210
- }
211
- };
212
- const de_GetLexiconCommand = async (output, context) => {
213
- if (output.statusCode !== 200 && output.statusCode >= 300) {
214
- return de_GetLexiconCommandError(output, context);
215
- }
216
- const contents = (0, smithy_client_1.map)({
217
- $metadata: deserializeMetadata(output),
218
- });
219
- const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
220
- const doc = (0, smithy_client_1.take)(data, {
221
- Lexicon: smithy_client_1._json,
222
- LexiconAttributes: (_) => de_LexiconAttributes(_, context),
223
- });
224
- Object.assign(contents, doc);
225
- return contents;
226
- };
227
- exports.de_GetLexiconCommand = de_GetLexiconCommand;
228
- const de_GetLexiconCommandError = async (output, context) => {
229
- const parsedOutput = {
230
- ...output,
231
- body: await parseErrorBody(output.body, context),
232
- };
233
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
234
- switch (errorCode) {
235
- case "LexiconNotFoundException":
236
- case "com.amazonaws.polly#LexiconNotFoundException":
237
- throw await de_LexiconNotFoundExceptionRes(parsedOutput, context);
238
- case "ServiceFailureException":
239
- case "com.amazonaws.polly#ServiceFailureException":
240
- throw await de_ServiceFailureExceptionRes(parsedOutput, context);
241
- default:
242
- const parsedBody = parsedOutput.body;
243
- return throwDefaultError({
244
- output,
245
- parsedBody,
246
- errorCode,
247
- });
248
- }
249
- };
250
- const de_GetSpeechSynthesisTaskCommand = async (output, context) => {
251
- if (output.statusCode !== 200 && output.statusCode >= 300) {
252
- return de_GetSpeechSynthesisTaskCommandError(output, context);
253
- }
254
- const contents = (0, smithy_client_1.map)({
255
- $metadata: deserializeMetadata(output),
256
- });
257
- const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
258
- const doc = (0, smithy_client_1.take)(data, {
259
- SynthesisTask: (_) => de_SynthesisTask(_, context),
260
- });
261
- Object.assign(contents, doc);
262
- return contents;
263
- };
264
- exports.de_GetSpeechSynthesisTaskCommand = de_GetSpeechSynthesisTaskCommand;
265
- const de_GetSpeechSynthesisTaskCommandError = async (output, context) => {
266
- const parsedOutput = {
267
- ...output,
268
- body: await parseErrorBody(output.body, context),
269
- };
270
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
271
- switch (errorCode) {
272
- case "InvalidTaskIdException":
273
- case "com.amazonaws.polly#InvalidTaskIdException":
274
- throw await de_InvalidTaskIdExceptionRes(parsedOutput, context);
275
- case "ServiceFailureException":
276
- case "com.amazonaws.polly#ServiceFailureException":
277
- throw await de_ServiceFailureExceptionRes(parsedOutput, context);
278
- case "SynthesisTaskNotFoundException":
279
- case "com.amazonaws.polly#SynthesisTaskNotFoundException":
280
- throw await de_SynthesisTaskNotFoundExceptionRes(parsedOutput, context);
281
- default:
282
- const parsedBody = parsedOutput.body;
283
- return throwDefaultError({
284
- output,
285
- parsedBody,
286
- errorCode,
287
- });
288
- }
289
- };
290
- const de_ListLexiconsCommand = async (output, context) => {
291
- if (output.statusCode !== 200 && output.statusCode >= 300) {
292
- return de_ListLexiconsCommandError(output, context);
293
- }
294
- const contents = (0, smithy_client_1.map)({
295
- $metadata: deserializeMetadata(output),
296
- });
297
- const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
298
- const doc = (0, smithy_client_1.take)(data, {
299
- Lexicons: (_) => de_LexiconDescriptionList(_, context),
300
- NextToken: smithy_client_1.expectString,
301
- });
302
- Object.assign(contents, doc);
303
- return contents;
304
- };
305
- exports.de_ListLexiconsCommand = de_ListLexiconsCommand;
306
- const de_ListLexiconsCommandError = async (output, context) => {
307
- const parsedOutput = {
308
- ...output,
309
- body: await parseErrorBody(output.body, context),
310
- };
311
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
312
- switch (errorCode) {
313
- case "InvalidNextTokenException":
314
- case "com.amazonaws.polly#InvalidNextTokenException":
315
- throw await de_InvalidNextTokenExceptionRes(parsedOutput, context);
316
- case "ServiceFailureException":
317
- case "com.amazonaws.polly#ServiceFailureException":
318
- throw await de_ServiceFailureExceptionRes(parsedOutput, context);
319
- default:
320
- const parsedBody = parsedOutput.body;
321
- return throwDefaultError({
322
- output,
323
- parsedBody,
324
- errorCode,
325
- });
326
- }
327
- };
328
- const de_ListSpeechSynthesisTasksCommand = async (output, context) => {
329
- if (output.statusCode !== 200 && output.statusCode >= 300) {
330
- return de_ListSpeechSynthesisTasksCommandError(output, context);
331
- }
332
- const contents = (0, smithy_client_1.map)({
333
- $metadata: deserializeMetadata(output),
334
- });
335
- const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
336
- const doc = (0, smithy_client_1.take)(data, {
337
- NextToken: smithy_client_1.expectString,
338
- SynthesisTasks: (_) => de_SynthesisTasks(_, context),
339
- });
340
- Object.assign(contents, doc);
341
- return contents;
342
- };
343
- exports.de_ListSpeechSynthesisTasksCommand = de_ListSpeechSynthesisTasksCommand;
344
- const de_ListSpeechSynthesisTasksCommandError = async (output, context) => {
345
- const parsedOutput = {
346
- ...output,
347
- body: await parseErrorBody(output.body, context),
348
- };
349
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
350
- switch (errorCode) {
351
- case "InvalidNextTokenException":
352
- case "com.amazonaws.polly#InvalidNextTokenException":
353
- throw await de_InvalidNextTokenExceptionRes(parsedOutput, context);
354
- case "ServiceFailureException":
355
- case "com.amazonaws.polly#ServiceFailureException":
356
- throw await de_ServiceFailureExceptionRes(parsedOutput, context);
357
- default:
358
- const parsedBody = parsedOutput.body;
359
- return throwDefaultError({
360
- output,
361
- parsedBody,
362
- errorCode,
363
- });
364
- }
365
- };
366
- const de_PutLexiconCommand = async (output, context) => {
367
- if (output.statusCode !== 200 && output.statusCode >= 300) {
368
- return de_PutLexiconCommandError(output, context);
369
- }
370
- const contents = (0, smithy_client_1.map)({
371
- $metadata: deserializeMetadata(output),
372
- });
373
- await (0, smithy_client_1.collectBody)(output.body, context);
374
- return contents;
375
- };
376
- exports.de_PutLexiconCommand = de_PutLexiconCommand;
377
- const de_PutLexiconCommandError = async (output, context) => {
378
- const parsedOutput = {
379
- ...output,
380
- body: await parseErrorBody(output.body, context),
381
- };
382
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
383
- switch (errorCode) {
384
- case "InvalidLexiconException":
385
- case "com.amazonaws.polly#InvalidLexiconException":
386
- throw await de_InvalidLexiconExceptionRes(parsedOutput, context);
387
- case "LexiconSizeExceededException":
388
- case "com.amazonaws.polly#LexiconSizeExceededException":
389
- throw await de_LexiconSizeExceededExceptionRes(parsedOutput, context);
390
- case "MaxLexemeLengthExceededException":
391
- case "com.amazonaws.polly#MaxLexemeLengthExceededException":
392
- throw await de_MaxLexemeLengthExceededExceptionRes(parsedOutput, context);
393
- case "MaxLexiconsNumberExceededException":
394
- case "com.amazonaws.polly#MaxLexiconsNumberExceededException":
395
- throw await de_MaxLexiconsNumberExceededExceptionRes(parsedOutput, context);
396
- case "ServiceFailureException":
397
- case "com.amazonaws.polly#ServiceFailureException":
398
- throw await de_ServiceFailureExceptionRes(parsedOutput, context);
399
- case "UnsupportedPlsAlphabetException":
400
- case "com.amazonaws.polly#UnsupportedPlsAlphabetException":
401
- throw await de_UnsupportedPlsAlphabetExceptionRes(parsedOutput, context);
402
- case "UnsupportedPlsLanguageException":
403
- case "com.amazonaws.polly#UnsupportedPlsLanguageException":
404
- throw await de_UnsupportedPlsLanguageExceptionRes(parsedOutput, context);
405
- default:
406
- const parsedBody = parsedOutput.body;
407
- return throwDefaultError({
408
- output,
409
- parsedBody,
410
- errorCode,
411
- });
412
- }
413
- };
414
- const de_StartSpeechSynthesisTaskCommand = async (output, context) => {
415
- if (output.statusCode !== 200 && output.statusCode >= 300) {
416
- return de_StartSpeechSynthesisTaskCommandError(output, context);
417
- }
418
- const contents = (0, smithy_client_1.map)({
419
- $metadata: deserializeMetadata(output),
420
- });
421
- const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
422
- const doc = (0, smithy_client_1.take)(data, {
423
- SynthesisTask: (_) => de_SynthesisTask(_, context),
424
- });
425
- Object.assign(contents, doc);
426
- return contents;
427
- };
428
- exports.de_StartSpeechSynthesisTaskCommand = de_StartSpeechSynthesisTaskCommand;
429
- const de_StartSpeechSynthesisTaskCommandError = async (output, context) => {
430
- const parsedOutput = {
431
- ...output,
432
- body: await parseErrorBody(output.body, context),
433
- };
434
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
435
- switch (errorCode) {
436
- case "EngineNotSupportedException":
437
- case "com.amazonaws.polly#EngineNotSupportedException":
438
- throw await de_EngineNotSupportedExceptionRes(parsedOutput, context);
439
- case "InvalidS3BucketException":
440
- case "com.amazonaws.polly#InvalidS3BucketException":
441
- throw await de_InvalidS3BucketExceptionRes(parsedOutput, context);
442
- case "InvalidS3KeyException":
443
- case "com.amazonaws.polly#InvalidS3KeyException":
444
- throw await de_InvalidS3KeyExceptionRes(parsedOutput, context);
445
- case "InvalidSampleRateException":
446
- case "com.amazonaws.polly#InvalidSampleRateException":
447
- throw await de_InvalidSampleRateExceptionRes(parsedOutput, context);
448
- case "InvalidSnsTopicArnException":
449
- case "com.amazonaws.polly#InvalidSnsTopicArnException":
450
- throw await de_InvalidSnsTopicArnExceptionRes(parsedOutput, context);
451
- case "InvalidSsmlException":
452
- case "com.amazonaws.polly#InvalidSsmlException":
453
- throw await de_InvalidSsmlExceptionRes(parsedOutput, context);
454
- case "LanguageNotSupportedException":
455
- case "com.amazonaws.polly#LanguageNotSupportedException":
456
- throw await de_LanguageNotSupportedExceptionRes(parsedOutput, context);
457
- case "LexiconNotFoundException":
458
- case "com.amazonaws.polly#LexiconNotFoundException":
459
- throw await de_LexiconNotFoundExceptionRes(parsedOutput, context);
460
- case "MarksNotSupportedForFormatException":
461
- case "com.amazonaws.polly#MarksNotSupportedForFormatException":
462
- throw await de_MarksNotSupportedForFormatExceptionRes(parsedOutput, context);
463
- case "ServiceFailureException":
464
- case "com.amazonaws.polly#ServiceFailureException":
465
- throw await de_ServiceFailureExceptionRes(parsedOutput, context);
466
- case "SsmlMarksNotSupportedForTextTypeException":
467
- case "com.amazonaws.polly#SsmlMarksNotSupportedForTextTypeException":
468
- throw await de_SsmlMarksNotSupportedForTextTypeExceptionRes(parsedOutput, context);
469
- case "TextLengthExceededException":
470
- case "com.amazonaws.polly#TextLengthExceededException":
471
- throw await de_TextLengthExceededExceptionRes(parsedOutput, context);
472
- default:
473
- const parsedBody = parsedOutput.body;
474
- return throwDefaultError({
475
- output,
476
- parsedBody,
477
- errorCode,
478
- });
479
- }
480
- };
481
- const de_SynthesizeSpeechCommand = async (output, context) => {
482
- if (output.statusCode !== 200 && output.statusCode >= 300) {
483
- return de_SynthesizeSpeechCommandError(output, context);
484
- }
485
- const contents = (0, smithy_client_1.map)({
486
- $metadata: deserializeMetadata(output),
487
- [_CT]: [, output.headers[_ct]],
488
- [_RC]: [() => void 0 !== output.headers[_xar], () => (0, smithy_client_1.strictParseInt32)(output.headers[_xar])],
489
- });
490
- const data = output.body;
491
- context.sdkStreamMixin(data);
492
- contents.AudioStream = data;
493
- return contents;
494
- };
495
- exports.de_SynthesizeSpeechCommand = de_SynthesizeSpeechCommand;
496
- const de_SynthesizeSpeechCommandError = async (output, context) => {
497
- const parsedOutput = {
498
- ...output,
499
- body: await parseErrorBody(output.body, context),
500
- };
501
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
502
- switch (errorCode) {
503
- case "EngineNotSupportedException":
504
- case "com.amazonaws.polly#EngineNotSupportedException":
505
- throw await de_EngineNotSupportedExceptionRes(parsedOutput, context);
506
- case "InvalidSampleRateException":
507
- case "com.amazonaws.polly#InvalidSampleRateException":
508
- throw await de_InvalidSampleRateExceptionRes(parsedOutput, context);
509
- case "InvalidSsmlException":
510
- case "com.amazonaws.polly#InvalidSsmlException":
511
- throw await de_InvalidSsmlExceptionRes(parsedOutput, context);
512
- case "LanguageNotSupportedException":
513
- case "com.amazonaws.polly#LanguageNotSupportedException":
514
- throw await de_LanguageNotSupportedExceptionRes(parsedOutput, context);
515
- case "LexiconNotFoundException":
516
- case "com.amazonaws.polly#LexiconNotFoundException":
517
- throw await de_LexiconNotFoundExceptionRes(parsedOutput, context);
518
- case "MarksNotSupportedForFormatException":
519
- case "com.amazonaws.polly#MarksNotSupportedForFormatException":
520
- throw await de_MarksNotSupportedForFormatExceptionRes(parsedOutput, context);
521
- case "ServiceFailureException":
522
- case "com.amazonaws.polly#ServiceFailureException":
523
- throw await de_ServiceFailureExceptionRes(parsedOutput, context);
524
- case "SsmlMarksNotSupportedForTextTypeException":
525
- case "com.amazonaws.polly#SsmlMarksNotSupportedForTextTypeException":
526
- throw await de_SsmlMarksNotSupportedForTextTypeExceptionRes(parsedOutput, context);
527
- case "TextLengthExceededException":
528
- case "com.amazonaws.polly#TextLengthExceededException":
529
- throw await de_TextLengthExceededExceptionRes(parsedOutput, context);
530
- default:
531
- const parsedBody = parsedOutput.body;
532
- return throwDefaultError({
533
- output,
534
- parsedBody,
535
- errorCode,
536
- });
537
- }
538
- };
539
- const throwDefaultError = (0, smithy_client_1.withBaseException)(PollyServiceException_1.PollyServiceException);
540
- const de_EngineNotSupportedExceptionRes = async (parsedOutput, context) => {
541
- const contents = (0, smithy_client_1.map)({});
542
- const data = parsedOutput.body;
543
- const doc = (0, smithy_client_1.take)(data, {
544
- message: smithy_client_1.expectString,
545
- });
546
- Object.assign(contents, doc);
547
- const exception = new models_0_1.EngineNotSupportedException({
548
- $metadata: deserializeMetadata(parsedOutput),
549
- ...contents,
550
- });
551
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
552
- };
553
- const de_InvalidLexiconExceptionRes = async (parsedOutput, context) => {
554
- const contents = (0, smithy_client_1.map)({});
555
- const data = parsedOutput.body;
556
- const doc = (0, smithy_client_1.take)(data, {
557
- message: smithy_client_1.expectString,
558
- });
559
- Object.assign(contents, doc);
560
- const exception = new models_0_1.InvalidLexiconException({
561
- $metadata: deserializeMetadata(parsedOutput),
562
- ...contents,
563
- });
564
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
565
- };
566
- const de_InvalidNextTokenExceptionRes = async (parsedOutput, context) => {
567
- const contents = (0, smithy_client_1.map)({});
568
- const data = parsedOutput.body;
569
- const doc = (0, smithy_client_1.take)(data, {
570
- message: smithy_client_1.expectString,
571
- });
572
- Object.assign(contents, doc);
573
- const exception = new models_0_1.InvalidNextTokenException({
574
- $metadata: deserializeMetadata(parsedOutput),
575
- ...contents,
576
- });
577
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
578
- };
579
- const de_InvalidS3BucketExceptionRes = async (parsedOutput, context) => {
580
- const contents = (0, smithy_client_1.map)({});
581
- const data = parsedOutput.body;
582
- const doc = (0, smithy_client_1.take)(data, {
583
- message: smithy_client_1.expectString,
584
- });
585
- Object.assign(contents, doc);
586
- const exception = new models_0_1.InvalidS3BucketException({
587
- $metadata: deserializeMetadata(parsedOutput),
588
- ...contents,
589
- });
590
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
591
- };
592
- const de_InvalidS3KeyExceptionRes = async (parsedOutput, context) => {
593
- const contents = (0, smithy_client_1.map)({});
594
- const data = parsedOutput.body;
595
- const doc = (0, smithy_client_1.take)(data, {
596
- message: smithy_client_1.expectString,
597
- });
598
- Object.assign(contents, doc);
599
- const exception = new models_0_1.InvalidS3KeyException({
600
- $metadata: deserializeMetadata(parsedOutput),
601
- ...contents,
602
- });
603
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
604
- };
605
- const de_InvalidSampleRateExceptionRes = async (parsedOutput, context) => {
606
- const contents = (0, smithy_client_1.map)({});
607
- const data = parsedOutput.body;
608
- const doc = (0, smithy_client_1.take)(data, {
609
- message: smithy_client_1.expectString,
610
- });
611
- Object.assign(contents, doc);
612
- const exception = new models_0_1.InvalidSampleRateException({
613
- $metadata: deserializeMetadata(parsedOutput),
614
- ...contents,
615
- });
616
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
617
- };
618
- const de_InvalidSnsTopicArnExceptionRes = async (parsedOutput, context) => {
619
- const contents = (0, smithy_client_1.map)({});
620
- const data = parsedOutput.body;
621
- const doc = (0, smithy_client_1.take)(data, {
622
- message: smithy_client_1.expectString,
623
- });
624
- Object.assign(contents, doc);
625
- const exception = new models_0_1.InvalidSnsTopicArnException({
626
- $metadata: deserializeMetadata(parsedOutput),
627
- ...contents,
628
- });
629
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
630
- };
631
- const de_InvalidSsmlExceptionRes = async (parsedOutput, context) => {
632
- const contents = (0, smithy_client_1.map)({});
633
- const data = parsedOutput.body;
634
- const doc = (0, smithy_client_1.take)(data, {
635
- message: smithy_client_1.expectString,
636
- });
637
- Object.assign(contents, doc);
638
- const exception = new models_0_1.InvalidSsmlException({
639
- $metadata: deserializeMetadata(parsedOutput),
640
- ...contents,
641
- });
642
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
643
- };
644
- const de_InvalidTaskIdExceptionRes = async (parsedOutput, context) => {
645
- const contents = (0, smithy_client_1.map)({});
646
- const data = parsedOutput.body;
647
- const doc = (0, smithy_client_1.take)(data, {
648
- message: smithy_client_1.expectString,
649
- });
650
- Object.assign(contents, doc);
651
- const exception = new models_0_1.InvalidTaskIdException({
652
- $metadata: deserializeMetadata(parsedOutput),
653
- ...contents,
654
- });
655
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
656
- };
657
- const de_LanguageNotSupportedExceptionRes = async (parsedOutput, context) => {
658
- const contents = (0, smithy_client_1.map)({});
659
- const data = parsedOutput.body;
660
- const doc = (0, smithy_client_1.take)(data, {
661
- message: smithy_client_1.expectString,
662
- });
663
- Object.assign(contents, doc);
664
- const exception = new models_0_1.LanguageNotSupportedException({
665
- $metadata: deserializeMetadata(parsedOutput),
666
- ...contents,
667
- });
668
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
669
- };
670
- const de_LexiconNotFoundExceptionRes = async (parsedOutput, context) => {
671
- const contents = (0, smithy_client_1.map)({});
672
- const data = parsedOutput.body;
673
- const doc = (0, smithy_client_1.take)(data, {
674
- message: smithy_client_1.expectString,
675
- });
676
- Object.assign(contents, doc);
677
- const exception = new models_0_1.LexiconNotFoundException({
678
- $metadata: deserializeMetadata(parsedOutput),
679
- ...contents,
680
- });
681
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
682
- };
683
- const de_LexiconSizeExceededExceptionRes = async (parsedOutput, context) => {
684
- const contents = (0, smithy_client_1.map)({});
685
- const data = parsedOutput.body;
686
- const doc = (0, smithy_client_1.take)(data, {
687
- message: smithy_client_1.expectString,
688
- });
689
- Object.assign(contents, doc);
690
- const exception = new models_0_1.LexiconSizeExceededException({
691
- $metadata: deserializeMetadata(parsedOutput),
692
- ...contents,
693
- });
694
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
695
- };
696
- const de_MarksNotSupportedForFormatExceptionRes = async (parsedOutput, context) => {
697
- const contents = (0, smithy_client_1.map)({});
698
- const data = parsedOutput.body;
699
- const doc = (0, smithy_client_1.take)(data, {
700
- message: smithy_client_1.expectString,
701
- });
702
- Object.assign(contents, doc);
703
- const exception = new models_0_1.MarksNotSupportedForFormatException({
704
- $metadata: deserializeMetadata(parsedOutput),
705
- ...contents,
706
- });
707
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
708
- };
709
- const de_MaxLexemeLengthExceededExceptionRes = async (parsedOutput, context) => {
710
- const contents = (0, smithy_client_1.map)({});
711
- const data = parsedOutput.body;
712
- const doc = (0, smithy_client_1.take)(data, {
713
- message: smithy_client_1.expectString,
714
- });
715
- Object.assign(contents, doc);
716
- const exception = new models_0_1.MaxLexemeLengthExceededException({
717
- $metadata: deserializeMetadata(parsedOutput),
718
- ...contents,
719
- });
720
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
721
- };
722
- const de_MaxLexiconsNumberExceededExceptionRes = async (parsedOutput, context) => {
723
- const contents = (0, smithy_client_1.map)({});
724
- const data = parsedOutput.body;
725
- const doc = (0, smithy_client_1.take)(data, {
726
- message: smithy_client_1.expectString,
727
- });
728
- Object.assign(contents, doc);
729
- const exception = new models_0_1.MaxLexiconsNumberExceededException({
730
- $metadata: deserializeMetadata(parsedOutput),
731
- ...contents,
732
- });
733
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
734
- };
735
- const de_ServiceFailureExceptionRes = async (parsedOutput, context) => {
736
- const contents = (0, smithy_client_1.map)({});
737
- const data = parsedOutput.body;
738
- const doc = (0, smithy_client_1.take)(data, {
739
- message: smithy_client_1.expectString,
740
- });
741
- Object.assign(contents, doc);
742
- const exception = new models_0_1.ServiceFailureException({
743
- $metadata: deserializeMetadata(parsedOutput),
744
- ...contents,
745
- });
746
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
747
- };
748
- const de_SsmlMarksNotSupportedForTextTypeExceptionRes = async (parsedOutput, context) => {
749
- const contents = (0, smithy_client_1.map)({});
750
- const data = parsedOutput.body;
751
- const doc = (0, smithy_client_1.take)(data, {
752
- message: smithy_client_1.expectString,
753
- });
754
- Object.assign(contents, doc);
755
- const exception = new models_0_1.SsmlMarksNotSupportedForTextTypeException({
756
- $metadata: deserializeMetadata(parsedOutput),
757
- ...contents,
758
- });
759
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
760
- };
761
- const de_SynthesisTaskNotFoundExceptionRes = async (parsedOutput, context) => {
762
- const contents = (0, smithy_client_1.map)({});
763
- const data = parsedOutput.body;
764
- const doc = (0, smithy_client_1.take)(data, {
765
- message: smithy_client_1.expectString,
766
- });
767
- Object.assign(contents, doc);
768
- const exception = new models_0_1.SynthesisTaskNotFoundException({
769
- $metadata: deserializeMetadata(parsedOutput),
770
- ...contents,
771
- });
772
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
773
- };
774
- const de_TextLengthExceededExceptionRes = async (parsedOutput, context) => {
775
- const contents = (0, smithy_client_1.map)({});
776
- const data = parsedOutput.body;
777
- const doc = (0, smithy_client_1.take)(data, {
778
- message: smithy_client_1.expectString,
779
- });
780
- Object.assign(contents, doc);
781
- const exception = new models_0_1.TextLengthExceededException({
782
- $metadata: deserializeMetadata(parsedOutput),
783
- ...contents,
784
- });
785
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
786
- };
787
- const de_UnsupportedPlsAlphabetExceptionRes = async (parsedOutput, context) => {
788
- const contents = (0, smithy_client_1.map)({});
789
- const data = parsedOutput.body;
790
- const doc = (0, smithy_client_1.take)(data, {
791
- message: smithy_client_1.expectString,
792
- });
793
- Object.assign(contents, doc);
794
- const exception = new models_0_1.UnsupportedPlsAlphabetException({
795
- $metadata: deserializeMetadata(parsedOutput),
796
- ...contents,
797
- });
798
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
799
- };
800
- const de_UnsupportedPlsLanguageExceptionRes = async (parsedOutput, context) => {
801
- const contents = (0, smithy_client_1.map)({});
802
- const data = parsedOutput.body;
803
- const doc = (0, smithy_client_1.take)(data, {
804
- message: smithy_client_1.expectString,
805
- });
806
- Object.assign(contents, doc);
807
- const exception = new models_0_1.UnsupportedPlsLanguageException({
808
- $metadata: deserializeMetadata(parsedOutput),
809
- ...contents,
810
- });
811
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
812
- };
813
- const de_LexiconAttributes = (output, context) => {
814
- return (0, smithy_client_1.take)(output, {
815
- Alphabet: smithy_client_1.expectString,
816
- LanguageCode: smithy_client_1.expectString,
817
- LastModified: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))),
818
- LexemesCount: smithy_client_1.expectInt32,
819
- LexiconArn: smithy_client_1.expectString,
820
- Size: smithy_client_1.expectInt32,
821
- });
822
- };
823
- const de_LexiconDescription = (output, context) => {
824
- return (0, smithy_client_1.take)(output, {
825
- Attributes: (_) => de_LexiconAttributes(_, context),
826
- Name: smithy_client_1.expectString,
827
- });
828
- };
829
- const de_LexiconDescriptionList = (output, context) => {
830
- const retVal = (output || [])
831
- .filter((e) => e != null)
832
- .map((entry) => {
833
- return de_LexiconDescription(entry, context);
834
- });
835
- return retVal;
836
- };
837
- const de_SynthesisTask = (output, context) => {
838
- return (0, smithy_client_1.take)(output, {
839
- CreationTime: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))),
840
- Engine: smithy_client_1.expectString,
841
- LanguageCode: smithy_client_1.expectString,
842
- LexiconNames: smithy_client_1._json,
843
- OutputFormat: smithy_client_1.expectString,
844
- OutputUri: smithy_client_1.expectString,
845
- RequestCharacters: smithy_client_1.expectInt32,
846
- SampleRate: smithy_client_1.expectString,
847
- SnsTopicArn: smithy_client_1.expectString,
848
- SpeechMarkTypes: smithy_client_1._json,
849
- TaskId: smithy_client_1.expectString,
850
- TaskStatus: smithy_client_1.expectString,
851
- TaskStatusReason: smithy_client_1.expectString,
852
- TextType: smithy_client_1.expectString,
853
- VoiceId: smithy_client_1.expectString,
854
- });
855
- };
856
- const de_SynthesisTasks = (output, context) => {
857
- const retVal = (output || [])
858
- .filter((e) => e != null)
859
- .map((entry) => {
860
- return de_SynthesisTask(entry, context);
861
- });
862
- return retVal;
863
- };
864
- const deserializeMetadata = (output) => ({
865
- httpStatusCode: output.statusCode,
866
- requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
867
- extendedRequestId: output.headers["x-amz-id-2"],
868
- cfId: output.headers["x-amz-cf-id"],
869
- });
870
- const collectBodyString = (streamBody, context) => (0, smithy_client_1.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body));
871
- const isSerializableHeaderValue = (value) => value !== undefined &&
872
- value !== null &&
873
- value !== "" &&
874
- (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
875
- (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
876
- const _CT = "ContentType";
877
- const _E = "Engine";
878
- const _IALC = "IncludeAdditionalLanguageCodes";
879
- const _LC = "LanguageCode";
880
- const _MR = "MaxResults";
881
- const _NT = "NextToken";
882
- const _RC = "RequestCharacters";
883
- const _S = "Status";
884
- const _ct = "content-type";
885
- const _xar = "x-amzn-requestcharacters";
886
- const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
887
- if (encoded.length) {
888
- return JSON.parse(encoded);
889
- }
890
- return {};
891
- });
892
- const parseErrorBody = async (errorBody, context) => {
893
- const value = await parseBody(errorBody, context);
894
- value.message = value.message ?? value.Message;
895
- return value;
896
- };
897
- const loadRestJsonErrorCode = (output, data) => {
898
- const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
899
- const sanitizeErrorCode = (rawValue) => {
900
- let cleanValue = rawValue;
901
- if (typeof cleanValue === "number") {
902
- cleanValue = cleanValue.toString();
903
- }
904
- if (cleanValue.indexOf(",") >= 0) {
905
- cleanValue = cleanValue.split(",")[0];
906
- }
907
- if (cleanValue.indexOf(":") >= 0) {
908
- cleanValue = cleanValue.split(":")[0];
909
- }
910
- if (cleanValue.indexOf("#") >= 0) {
911
- cleanValue = cleanValue.split("#")[1];
912
- }
913
- return cleanValue;
914
- };
915
- const headerKey = findKey(output.headers, "x-amzn-errortype");
916
- if (headerKey !== undefined) {
917
- return sanitizeErrorCode(output.headers[headerKey]);
918
- }
919
- if (data.code !== undefined) {
920
- return sanitizeErrorCode(data.code);
921
- }
922
- if (data["__type"] !== undefined) {
923
- return sanitizeErrorCode(data["__type"]);
924
- }
925
- };
1
+ module.exports = require("../index.js");