@aws-sdk/client-connectparticipant 3.141.0 → 3.142.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [3.142.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.141.0...v3.142.0) (2022-08-02)
7
+
8
+
9
+ ### Features
10
+
11
+ * **codegen:** general data mapping function ([#3830](https://github.com/aws/aws-sdk-js-v3/issues/3830)) ([9417eae](https://github.com/aws/aws-sdk-js-v3/commit/9417eae722806799fb4c15c07921574268c1165c))
12
+
13
+
14
+
15
+
16
+
6
17
  # [3.141.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.140.0...v3.141.0) (2022-08-01)
7
18
 
8
19
 
@@ -9,10 +9,10 @@ const models_0_1 = require("../models/models_0");
9
9
  const serializeAws_restJson1CompleteAttachmentUploadCommand = async (input, context) => {
10
10
  var _a;
11
11
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
12
- const headers = {
12
+ const headers = map({}, isSerializableHeaderValue, {
13
13
  "content-type": "application/json",
14
- ...(isSerializableHeaderValue(input.ConnectionToken) && { "x-amz-bearer": input.ConnectionToken }),
15
- };
14
+ "x-amz-bearer": input.ConnectionToken,
15
+ });
16
16
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/participant/complete-attachment-upload";
17
17
  let body;
18
18
  body = JSON.stringify({
@@ -34,10 +34,10 @@ const serializeAws_restJson1CompleteAttachmentUploadCommand = async (input, cont
34
34
  exports.serializeAws_restJson1CompleteAttachmentUploadCommand = serializeAws_restJson1CompleteAttachmentUploadCommand;
35
35
  const serializeAws_restJson1CreateParticipantConnectionCommand = async (input, context) => {
36
36
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
37
- const headers = {
37
+ const headers = map({}, isSerializableHeaderValue, {
38
38
  "content-type": "application/json",
39
- ...(isSerializableHeaderValue(input.ParticipantToken) && { "x-amz-bearer": input.ParticipantToken }),
40
- };
39
+ "x-amz-bearer": input.ParticipantToken,
40
+ });
41
41
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/participant/connection";
42
42
  let body;
43
43
  body = JSON.stringify({
@@ -58,10 +58,10 @@ exports.serializeAws_restJson1CreateParticipantConnectionCommand = serializeAws_
58
58
  const serializeAws_restJson1DisconnectParticipantCommand = async (input, context) => {
59
59
  var _a;
60
60
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
61
- const headers = {
61
+ const headers = map({}, isSerializableHeaderValue, {
62
62
  "content-type": "application/json",
63
- ...(isSerializableHeaderValue(input.ConnectionToken) && { "x-amz-bearer": input.ConnectionToken }),
64
- };
63
+ "x-amz-bearer": input.ConnectionToken,
64
+ });
65
65
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/participant/disconnect";
66
66
  let body;
67
67
  body = JSON.stringify({
@@ -80,10 +80,10 @@ const serializeAws_restJson1DisconnectParticipantCommand = async (input, context
80
80
  exports.serializeAws_restJson1DisconnectParticipantCommand = serializeAws_restJson1DisconnectParticipantCommand;
81
81
  const serializeAws_restJson1GetAttachmentCommand = async (input, context) => {
82
82
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
83
- const headers = {
83
+ const headers = map({}, isSerializableHeaderValue, {
84
84
  "content-type": "application/json",
85
- ...(isSerializableHeaderValue(input.ConnectionToken) && { "x-amz-bearer": input.ConnectionToken }),
86
- };
85
+ "x-amz-bearer": input.ConnectionToken,
86
+ });
87
87
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/participant/attachment";
88
88
  let body;
89
89
  body = JSON.stringify({
@@ -102,10 +102,10 @@ const serializeAws_restJson1GetAttachmentCommand = async (input, context) => {
102
102
  exports.serializeAws_restJson1GetAttachmentCommand = serializeAws_restJson1GetAttachmentCommand;
103
103
  const serializeAws_restJson1GetTranscriptCommand = async (input, context) => {
104
104
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
105
- const headers = {
105
+ const headers = map({}, isSerializableHeaderValue, {
106
106
  "content-type": "application/json",
107
- ...(isSerializableHeaderValue(input.ConnectionToken) && { "x-amz-bearer": input.ConnectionToken }),
108
- };
107
+ "x-amz-bearer": input.ConnectionToken,
108
+ });
109
109
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/participant/transcript";
110
110
  let body;
111
111
  body = JSON.stringify({
@@ -132,10 +132,10 @@ exports.serializeAws_restJson1GetTranscriptCommand = serializeAws_restJson1GetTr
132
132
  const serializeAws_restJson1SendEventCommand = async (input, context) => {
133
133
  var _a;
134
134
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
135
- const headers = {
135
+ const headers = map({}, isSerializableHeaderValue, {
136
136
  "content-type": "application/json",
137
- ...(isSerializableHeaderValue(input.ConnectionToken) && { "x-amz-bearer": input.ConnectionToken }),
138
- };
137
+ "x-amz-bearer": input.ConnectionToken,
138
+ });
139
139
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/participant/event";
140
140
  let body;
141
141
  body = JSON.stringify({
@@ -157,10 +157,10 @@ exports.serializeAws_restJson1SendEventCommand = serializeAws_restJson1SendEvent
157
157
  const serializeAws_restJson1SendMessageCommand = async (input, context) => {
158
158
  var _a;
159
159
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
160
- const headers = {
160
+ const headers = map({}, isSerializableHeaderValue, {
161
161
  "content-type": "application/json",
162
- ...(isSerializableHeaderValue(input.ConnectionToken) && { "x-amz-bearer": input.ConnectionToken }),
163
- };
162
+ "x-amz-bearer": input.ConnectionToken,
163
+ });
164
164
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/participant/message";
165
165
  let body;
166
166
  body = JSON.stringify({
@@ -182,10 +182,10 @@ exports.serializeAws_restJson1SendMessageCommand = serializeAws_restJson1SendMes
182
182
  const serializeAws_restJson1StartAttachmentUploadCommand = async (input, context) => {
183
183
  var _a;
184
184
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
185
- const headers = {
185
+ const headers = map({}, isSerializableHeaderValue, {
186
186
  "content-type": "application/json",
187
- ...(isSerializableHeaderValue(input.ConnectionToken) && { "x-amz-bearer": input.ConnectionToken }),
188
- };
187
+ "x-amz-bearer": input.ConnectionToken,
188
+ });
189
189
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/participant/start-attachment-upload";
190
190
  let body;
191
191
  body = JSON.stringify({
@@ -209,11 +209,11 @@ const deserializeAws_restJson1CompleteAttachmentUploadCommand = async (output, c
209
209
  if (output.statusCode !== 200 && output.statusCode >= 300) {
210
210
  return deserializeAws_restJson1CompleteAttachmentUploadCommandError(output, context);
211
211
  }
212
- const contents = {
212
+ const contents = map({
213
213
  $metadata: deserializeMetadata(output),
214
- };
214
+ });
215
215
  await collectBody(output.body, context);
216
- return Promise.resolve(contents);
216
+ return contents;
217
217
  };
218
218
  exports.deserializeAws_restJson1CompleteAttachmentUploadCommand = deserializeAws_restJson1CompleteAttachmentUploadCommand;
219
219
  const deserializeAws_restJson1CompleteAttachmentUploadCommandError = async (output, context) => {
@@ -221,7 +221,6 @@ const deserializeAws_restJson1CompleteAttachmentUploadCommandError = async (outp
221
221
  ...output,
222
222
  body: await parseBody(output.body, context),
223
223
  };
224
- let response;
225
224
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
226
225
  switch (errorCode) {
227
226
  case "AccessDeniedException":
@@ -244,33 +243,29 @@ const deserializeAws_restJson1CompleteAttachmentUploadCommandError = async (outp
244
243
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
245
244
  default:
246
245
  const parsedBody = parsedOutput.body;
247
- const $metadata = deserializeMetadata(output);
248
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
249
- response = new ConnectParticipantServiceException_1.ConnectParticipantServiceException({
250
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
251
- $fault: "client",
252
- $metadata,
246
+ (0, smithy_client_1.throwDefaultError)({
247
+ output,
248
+ parsedBody,
249
+ exceptionCtor: ConnectParticipantServiceException_1.ConnectParticipantServiceException,
250
+ errorCode,
253
251
  });
254
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
255
252
  }
256
253
  };
257
254
  const deserializeAws_restJson1CreateParticipantConnectionCommand = async (output, context) => {
258
255
  if (output.statusCode !== 200 && output.statusCode >= 300) {
259
256
  return deserializeAws_restJson1CreateParticipantConnectionCommandError(output, context);
260
257
  }
261
- const contents = {
258
+ const contents = map({
262
259
  $metadata: deserializeMetadata(output),
263
- ConnectionCredentials: undefined,
264
- Websocket: undefined,
265
- };
260
+ });
266
261
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
267
- if (data.ConnectionCredentials !== undefined && data.ConnectionCredentials !== null) {
262
+ if (data.ConnectionCredentials != null) {
268
263
  contents.ConnectionCredentials = deserializeAws_restJson1ConnectionCredentials(data.ConnectionCredentials, context);
269
264
  }
270
- if (data.Websocket !== undefined && data.Websocket !== null) {
265
+ if (data.Websocket != null) {
271
266
  contents.Websocket = deserializeAws_restJson1Websocket(data.Websocket, context);
272
267
  }
273
- return Promise.resolve(contents);
268
+ return contents;
274
269
  };
275
270
  exports.deserializeAws_restJson1CreateParticipantConnectionCommand = deserializeAws_restJson1CreateParticipantConnectionCommand;
276
271
  const deserializeAws_restJson1CreateParticipantConnectionCommandError = async (output, context) => {
@@ -278,7 +273,6 @@ const deserializeAws_restJson1CreateParticipantConnectionCommandError = async (o
278
273
  ...output,
279
274
  body: await parseBody(output.body, context),
280
275
  };
281
- let response;
282
276
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
283
277
  switch (errorCode) {
284
278
  case "AccessDeniedException":
@@ -295,25 +289,23 @@ const deserializeAws_restJson1CreateParticipantConnectionCommandError = async (o
295
289
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
296
290
  default:
297
291
  const parsedBody = parsedOutput.body;
298
- const $metadata = deserializeMetadata(output);
299
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
300
- response = new ConnectParticipantServiceException_1.ConnectParticipantServiceException({
301
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
302
- $fault: "client",
303
- $metadata,
292
+ (0, smithy_client_1.throwDefaultError)({
293
+ output,
294
+ parsedBody,
295
+ exceptionCtor: ConnectParticipantServiceException_1.ConnectParticipantServiceException,
296
+ errorCode,
304
297
  });
305
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
306
298
  }
307
299
  };
308
300
  const deserializeAws_restJson1DisconnectParticipantCommand = async (output, context) => {
309
301
  if (output.statusCode !== 200 && output.statusCode >= 300) {
310
302
  return deserializeAws_restJson1DisconnectParticipantCommandError(output, context);
311
303
  }
312
- const contents = {
304
+ const contents = map({
313
305
  $metadata: deserializeMetadata(output),
314
- };
306
+ });
315
307
  await collectBody(output.body, context);
316
- return Promise.resolve(contents);
308
+ return contents;
317
309
  };
318
310
  exports.deserializeAws_restJson1DisconnectParticipantCommand = deserializeAws_restJson1DisconnectParticipantCommand;
319
311
  const deserializeAws_restJson1DisconnectParticipantCommandError = async (output, context) => {
@@ -321,7 +313,6 @@ const deserializeAws_restJson1DisconnectParticipantCommandError = async (output,
321
313
  ...output,
322
314
  body: await parseBody(output.body, context),
323
315
  };
324
- let response;
325
316
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
326
317
  switch (errorCode) {
327
318
  case "AccessDeniedException":
@@ -338,33 +329,29 @@ const deserializeAws_restJson1DisconnectParticipantCommandError = async (output,
338
329
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
339
330
  default:
340
331
  const parsedBody = parsedOutput.body;
341
- const $metadata = deserializeMetadata(output);
342
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
343
- response = new ConnectParticipantServiceException_1.ConnectParticipantServiceException({
344
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
345
- $fault: "client",
346
- $metadata,
332
+ (0, smithy_client_1.throwDefaultError)({
333
+ output,
334
+ parsedBody,
335
+ exceptionCtor: ConnectParticipantServiceException_1.ConnectParticipantServiceException,
336
+ errorCode,
347
337
  });
348
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
349
338
  }
350
339
  };
351
340
  const deserializeAws_restJson1GetAttachmentCommand = async (output, context) => {
352
341
  if (output.statusCode !== 200 && output.statusCode >= 300) {
353
342
  return deserializeAws_restJson1GetAttachmentCommandError(output, context);
354
343
  }
355
- const contents = {
344
+ const contents = map({
356
345
  $metadata: deserializeMetadata(output),
357
- Url: undefined,
358
- UrlExpiry: undefined,
359
- };
346
+ });
360
347
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
361
- if (data.Url !== undefined && data.Url !== null) {
348
+ if (data.Url != null) {
362
349
  contents.Url = (0, smithy_client_1.expectString)(data.Url);
363
350
  }
364
- if (data.UrlExpiry !== undefined && data.UrlExpiry !== null) {
351
+ if (data.UrlExpiry != null) {
365
352
  contents.UrlExpiry = (0, smithy_client_1.expectString)(data.UrlExpiry);
366
353
  }
367
- return Promise.resolve(contents);
354
+ return contents;
368
355
  };
369
356
  exports.deserializeAws_restJson1GetAttachmentCommand = deserializeAws_restJson1GetAttachmentCommand;
370
357
  const deserializeAws_restJson1GetAttachmentCommandError = async (output, context) => {
@@ -372,7 +359,6 @@ const deserializeAws_restJson1GetAttachmentCommandError = async (output, context
372
359
  ...output,
373
360
  body: await parseBody(output.body, context),
374
361
  };
375
- let response;
376
362
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
377
363
  switch (errorCode) {
378
364
  case "AccessDeniedException":
@@ -389,37 +375,32 @@ const deserializeAws_restJson1GetAttachmentCommandError = async (output, context
389
375
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
390
376
  default:
391
377
  const parsedBody = parsedOutput.body;
392
- const $metadata = deserializeMetadata(output);
393
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
394
- response = new ConnectParticipantServiceException_1.ConnectParticipantServiceException({
395
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
396
- $fault: "client",
397
- $metadata,
378
+ (0, smithy_client_1.throwDefaultError)({
379
+ output,
380
+ parsedBody,
381
+ exceptionCtor: ConnectParticipantServiceException_1.ConnectParticipantServiceException,
382
+ errorCode,
398
383
  });
399
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
400
384
  }
401
385
  };
402
386
  const deserializeAws_restJson1GetTranscriptCommand = async (output, context) => {
403
387
  if (output.statusCode !== 200 && output.statusCode >= 300) {
404
388
  return deserializeAws_restJson1GetTranscriptCommandError(output, context);
405
389
  }
406
- const contents = {
390
+ const contents = map({
407
391
  $metadata: deserializeMetadata(output),
408
- InitialContactId: undefined,
409
- NextToken: undefined,
410
- Transcript: undefined,
411
- };
392
+ });
412
393
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
413
- if (data.InitialContactId !== undefined && data.InitialContactId !== null) {
394
+ if (data.InitialContactId != null) {
414
395
  contents.InitialContactId = (0, smithy_client_1.expectString)(data.InitialContactId);
415
396
  }
416
- if (data.NextToken !== undefined && data.NextToken !== null) {
397
+ if (data.NextToken != null) {
417
398
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
418
399
  }
419
- if (data.Transcript !== undefined && data.Transcript !== null) {
400
+ if (data.Transcript != null) {
420
401
  contents.Transcript = deserializeAws_restJson1Transcript(data.Transcript, context);
421
402
  }
422
- return Promise.resolve(contents);
403
+ return contents;
423
404
  };
424
405
  exports.deserializeAws_restJson1GetTranscriptCommand = deserializeAws_restJson1GetTranscriptCommand;
425
406
  const deserializeAws_restJson1GetTranscriptCommandError = async (output, context) => {
@@ -427,7 +408,6 @@ const deserializeAws_restJson1GetTranscriptCommandError = async (output, context
427
408
  ...output,
428
409
  body: await parseBody(output.body, context),
429
410
  };
430
- let response;
431
411
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
432
412
  switch (errorCode) {
433
413
  case "AccessDeniedException":
@@ -444,33 +424,29 @@ const deserializeAws_restJson1GetTranscriptCommandError = async (output, context
444
424
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
445
425
  default:
446
426
  const parsedBody = parsedOutput.body;
447
- const $metadata = deserializeMetadata(output);
448
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
449
- response = new ConnectParticipantServiceException_1.ConnectParticipantServiceException({
450
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
451
- $fault: "client",
452
- $metadata,
427
+ (0, smithy_client_1.throwDefaultError)({
428
+ output,
429
+ parsedBody,
430
+ exceptionCtor: ConnectParticipantServiceException_1.ConnectParticipantServiceException,
431
+ errorCode,
453
432
  });
454
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
455
433
  }
456
434
  };
457
435
  const deserializeAws_restJson1SendEventCommand = async (output, context) => {
458
436
  if (output.statusCode !== 200 && output.statusCode >= 300) {
459
437
  return deserializeAws_restJson1SendEventCommandError(output, context);
460
438
  }
461
- const contents = {
439
+ const contents = map({
462
440
  $metadata: deserializeMetadata(output),
463
- AbsoluteTime: undefined,
464
- Id: undefined,
465
- };
441
+ });
466
442
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
467
- if (data.AbsoluteTime !== undefined && data.AbsoluteTime !== null) {
443
+ if (data.AbsoluteTime != null) {
468
444
  contents.AbsoluteTime = (0, smithy_client_1.expectString)(data.AbsoluteTime);
469
445
  }
470
- if (data.Id !== undefined && data.Id !== null) {
446
+ if (data.Id != null) {
471
447
  contents.Id = (0, smithy_client_1.expectString)(data.Id);
472
448
  }
473
- return Promise.resolve(contents);
449
+ return contents;
474
450
  };
475
451
  exports.deserializeAws_restJson1SendEventCommand = deserializeAws_restJson1SendEventCommand;
476
452
  const deserializeAws_restJson1SendEventCommandError = async (output, context) => {
@@ -478,7 +454,6 @@ const deserializeAws_restJson1SendEventCommandError = async (output, context) =>
478
454
  ...output,
479
455
  body: await parseBody(output.body, context),
480
456
  };
481
- let response;
482
457
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
483
458
  switch (errorCode) {
484
459
  case "AccessDeniedException":
@@ -495,33 +470,29 @@ const deserializeAws_restJson1SendEventCommandError = async (output, context) =>
495
470
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
496
471
  default:
497
472
  const parsedBody = parsedOutput.body;
498
- const $metadata = deserializeMetadata(output);
499
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
500
- response = new ConnectParticipantServiceException_1.ConnectParticipantServiceException({
501
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
502
- $fault: "client",
503
- $metadata,
473
+ (0, smithy_client_1.throwDefaultError)({
474
+ output,
475
+ parsedBody,
476
+ exceptionCtor: ConnectParticipantServiceException_1.ConnectParticipantServiceException,
477
+ errorCode,
504
478
  });
505
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
506
479
  }
507
480
  };
508
481
  const deserializeAws_restJson1SendMessageCommand = async (output, context) => {
509
482
  if (output.statusCode !== 200 && output.statusCode >= 300) {
510
483
  return deserializeAws_restJson1SendMessageCommandError(output, context);
511
484
  }
512
- const contents = {
485
+ const contents = map({
513
486
  $metadata: deserializeMetadata(output),
514
- AbsoluteTime: undefined,
515
- Id: undefined,
516
- };
487
+ });
517
488
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
518
- if (data.AbsoluteTime !== undefined && data.AbsoluteTime !== null) {
489
+ if (data.AbsoluteTime != null) {
519
490
  contents.AbsoluteTime = (0, smithy_client_1.expectString)(data.AbsoluteTime);
520
491
  }
521
- if (data.Id !== undefined && data.Id !== null) {
492
+ if (data.Id != null) {
522
493
  contents.Id = (0, smithy_client_1.expectString)(data.Id);
523
494
  }
524
- return Promise.resolve(contents);
495
+ return contents;
525
496
  };
526
497
  exports.deserializeAws_restJson1SendMessageCommand = deserializeAws_restJson1SendMessageCommand;
527
498
  const deserializeAws_restJson1SendMessageCommandError = async (output, context) => {
@@ -529,7 +500,6 @@ const deserializeAws_restJson1SendMessageCommandError = async (output, context)
529
500
  ...output,
530
501
  body: await parseBody(output.body, context),
531
502
  };
532
- let response;
533
503
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
534
504
  switch (errorCode) {
535
505
  case "AccessDeniedException":
@@ -546,33 +516,29 @@ const deserializeAws_restJson1SendMessageCommandError = async (output, context)
546
516
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
547
517
  default:
548
518
  const parsedBody = parsedOutput.body;
549
- const $metadata = deserializeMetadata(output);
550
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
551
- response = new ConnectParticipantServiceException_1.ConnectParticipantServiceException({
552
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
553
- $fault: "client",
554
- $metadata,
519
+ (0, smithy_client_1.throwDefaultError)({
520
+ output,
521
+ parsedBody,
522
+ exceptionCtor: ConnectParticipantServiceException_1.ConnectParticipantServiceException,
523
+ errorCode,
555
524
  });
556
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
557
525
  }
558
526
  };
559
527
  const deserializeAws_restJson1StartAttachmentUploadCommand = async (output, context) => {
560
528
  if (output.statusCode !== 200 && output.statusCode >= 300) {
561
529
  return deserializeAws_restJson1StartAttachmentUploadCommandError(output, context);
562
530
  }
563
- const contents = {
531
+ const contents = map({
564
532
  $metadata: deserializeMetadata(output),
565
- AttachmentId: undefined,
566
- UploadMetadata: undefined,
567
- };
533
+ });
568
534
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
569
- if (data.AttachmentId !== undefined && data.AttachmentId !== null) {
535
+ if (data.AttachmentId != null) {
570
536
  contents.AttachmentId = (0, smithy_client_1.expectString)(data.AttachmentId);
571
537
  }
572
- if (data.UploadMetadata !== undefined && data.UploadMetadata !== null) {
538
+ if (data.UploadMetadata != null) {
573
539
  contents.UploadMetadata = deserializeAws_restJson1UploadMetadata(data.UploadMetadata, context);
574
540
  }
575
- return Promise.resolve(contents);
541
+ return contents;
576
542
  };
577
543
  exports.deserializeAws_restJson1StartAttachmentUploadCommand = deserializeAws_restJson1StartAttachmentUploadCommand;
578
544
  const deserializeAws_restJson1StartAttachmentUploadCommandError = async (output, context) => {
@@ -580,7 +546,6 @@ const deserializeAws_restJson1StartAttachmentUploadCommandError = async (output,
580
546
  ...output,
581
547
  body: await parseBody(output.body, context),
582
548
  };
583
- let response;
584
549
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
585
550
  switch (errorCode) {
586
551
  case "AccessDeniedException":
@@ -600,20 +565,19 @@ const deserializeAws_restJson1StartAttachmentUploadCommandError = async (output,
600
565
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
601
566
  default:
602
567
  const parsedBody = parsedOutput.body;
603
- const $metadata = deserializeMetadata(output);
604
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
605
- response = new ConnectParticipantServiceException_1.ConnectParticipantServiceException({
606
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
607
- $fault: "client",
608
- $metadata,
568
+ (0, smithy_client_1.throwDefaultError)({
569
+ output,
570
+ parsedBody,
571
+ exceptionCtor: ConnectParticipantServiceException_1.ConnectParticipantServiceException,
572
+ errorCode,
609
573
  });
610
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
611
574
  }
612
575
  };
576
+ const map = smithy_client_1.map;
613
577
  const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutput, context) => {
614
- const contents = {};
578
+ const contents = map({});
615
579
  const data = parsedOutput.body;
616
- if (data.Message !== undefined && data.Message !== null) {
580
+ if (data.Message != null) {
617
581
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
618
582
  }
619
583
  const exception = new models_0_1.AccessDeniedException({
@@ -623,9 +587,9 @@ const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutpu
623
587
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
624
588
  };
625
589
  const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, context) => {
626
- const contents = {};
590
+ const contents = map({});
627
591
  const data = parsedOutput.body;
628
- if (data.Message !== undefined && data.Message !== null) {
592
+ if (data.Message != null) {
629
593
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
630
594
  }
631
595
  const exception = new models_0_1.ConflictException({
@@ -635,9 +599,9 @@ const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, c
635
599
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
636
600
  };
637
601
  const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOutput, context) => {
638
- const contents = {};
602
+ const contents = map({});
639
603
  const data = parsedOutput.body;
640
- if (data.Message !== undefined && data.Message !== null) {
604
+ if (data.Message != null) {
641
605
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
642
606
  }
643
607
  const exception = new models_0_1.InternalServerException({
@@ -647,9 +611,9 @@ const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOut
647
611
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
648
612
  };
649
613
  const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async (parsedOutput, context) => {
650
- const contents = {};
614
+ const contents = map({});
651
615
  const data = parsedOutput.body;
652
- if (data.Message !== undefined && data.Message !== null) {
616
+ if (data.Message != null) {
653
617
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
654
618
  }
655
619
  const exception = new models_0_1.ServiceQuotaExceededException({
@@ -659,9 +623,9 @@ const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async (par
659
623
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
660
624
  };
661
625
  const deserializeAws_restJson1ThrottlingExceptionResponse = async (parsedOutput, context) => {
662
- const contents = {};
626
+ const contents = map({});
663
627
  const data = parsedOutput.body;
664
- if (data.Message !== undefined && data.Message !== null) {
628
+ if (data.Message != null) {
665
629
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
666
630
  }
667
631
  const exception = new models_0_1.ThrottlingException({
@@ -671,9 +635,9 @@ const deserializeAws_restJson1ThrottlingExceptionResponse = async (parsedOutput,
671
635
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
672
636
  };
673
637
  const deserializeAws_restJson1ValidationExceptionResponse = async (parsedOutput, context) => {
674
- const contents = {};
638
+ const contents = map({});
675
639
  const data = parsedOutput.body;
676
- if (data.Message !== undefined && data.Message !== null) {
640
+ if (data.Message != null) {
677
641
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
678
642
  }
679
643
  const exception = new models_0_1.ValidationException({
@@ -686,9 +650,6 @@ const serializeAws_restJson1AttachmentIdList = (input, context) => {
686
650
  return input
687
651
  .filter((e) => e != null)
688
652
  .map((entry) => {
689
- if (entry === null) {
690
- return null;
691
- }
692
653
  return entry;
693
654
  });
694
655
  };
@@ -696,9 +657,6 @@ const serializeAws_restJson1ConnectionTypeList = (input, context) => {
696
657
  return input
697
658
  .filter((e) => e != null)
698
659
  .map((entry) => {
699
- if (entry === null) {
700
- return null;
701
- }
702
660
  return entry;
703
661
  });
704
662
  };
@@ -1,6 +1,6 @@
1
1
  import { __assign, __awaiter, __generator, __read } from "tslib";
2
2
  import { HttpRequest as __HttpRequest } from "@aws-sdk/protocol-http";
3
- import { decorateServiceException as __decorateServiceException, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, } from "@aws-sdk/smithy-client";
3
+ import { decorateServiceException as __decorateServiceException, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, map as __map, throwDefaultError, } from "@aws-sdk/smithy-client";
4
4
  import { v4 as generateIdempotencyToken } from "uuid";
5
5
  import { ConnectParticipantServiceException as __BaseException } from "../models/ConnectParticipantServiceException";
6
6
  import { AccessDeniedException, ConflictException, InternalServerException, ServiceQuotaExceededException, ThrottlingException, ValidationException, } from "../models/models_0";
@@ -12,7 +12,10 @@ export var serializeAws_restJson1CompleteAttachmentUploadCommand = function (inp
12
12
  case 0: return [4, context.endpoint()];
13
13
  case 1:
14
14
  _a = _d.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
15
- headers = __assign({ "content-type": "application/json" }, (isSerializableHeaderValue(input.ConnectionToken) && { "x-amz-bearer": input.ConnectionToken }));
15
+ headers = map({}, isSerializableHeaderValue, {
16
+ "content-type": "application/json",
17
+ "x-amz-bearer": input.ConnectionToken,
18
+ });
16
19
  resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/participant/complete-attachment-upload";
17
20
  body = JSON.stringify(__assign(__assign({}, (input.AttachmentIds != null && {
18
21
  AttachmentIds: serializeAws_restJson1AttachmentIdList(input.AttachmentIds, context),
@@ -36,7 +39,10 @@ export var serializeAws_restJson1CreateParticipantConnectionCommand = function (
36
39
  case 0: return [4, context.endpoint()];
37
40
  case 1:
38
41
  _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
39
- headers = __assign({ "content-type": "application/json" }, (isSerializableHeaderValue(input.ParticipantToken) && { "x-amz-bearer": input.ParticipantToken }));
42
+ headers = map({}, isSerializableHeaderValue, {
43
+ "content-type": "application/json",
44
+ "x-amz-bearer": input.ParticipantToken,
45
+ });
40
46
  resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/participant/connection";
41
47
  body = JSON.stringify(__assign(__assign({}, (input.ConnectParticipant != null && { ConnectParticipant: input.ConnectParticipant })), (input.Type != null && { Type: serializeAws_restJson1ConnectionTypeList(input.Type, context) })));
42
48
  return [2, new __HttpRequest({
@@ -59,7 +65,10 @@ export var serializeAws_restJson1DisconnectParticipantCommand = function (input,
59
65
  case 0: return [4, context.endpoint()];
60
66
  case 1:
61
67
  _a = _d.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
62
- headers = __assign({ "content-type": "application/json" }, (isSerializableHeaderValue(input.ConnectionToken) && { "x-amz-bearer": input.ConnectionToken }));
68
+ headers = map({}, isSerializableHeaderValue, {
69
+ "content-type": "application/json",
70
+ "x-amz-bearer": input.ConnectionToken,
71
+ });
63
72
  resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/participant/disconnect";
64
73
  body = JSON.stringify({
65
74
  ClientToken: (_c = input.ClientToken) !== null && _c !== void 0 ? _c : generateIdempotencyToken(),
@@ -83,7 +92,10 @@ export var serializeAws_restJson1GetAttachmentCommand = function (input, context
83
92
  case 0: return [4, context.endpoint()];
84
93
  case 1:
85
94
  _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
86
- headers = __assign({ "content-type": "application/json" }, (isSerializableHeaderValue(input.ConnectionToken) && { "x-amz-bearer": input.ConnectionToken }));
95
+ headers = map({}, isSerializableHeaderValue, {
96
+ "content-type": "application/json",
97
+ "x-amz-bearer": input.ConnectionToken,
98
+ });
87
99
  resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/participant/attachment";
88
100
  body = JSON.stringify(__assign({}, (input.AttachmentId != null && { AttachmentId: input.AttachmentId })));
89
101
  return [2, new __HttpRequest({
@@ -105,7 +117,10 @@ export var serializeAws_restJson1GetTranscriptCommand = function (input, context
105
117
  case 0: return [4, context.endpoint()];
106
118
  case 1:
107
119
  _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
108
- headers = __assign({ "content-type": "application/json" }, (isSerializableHeaderValue(input.ConnectionToken) && { "x-amz-bearer": input.ConnectionToken }));
120
+ headers = map({}, isSerializableHeaderValue, {
121
+ "content-type": "application/json",
122
+ "x-amz-bearer": input.ConnectionToken,
123
+ });
109
124
  resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/participant/transcript";
110
125
  body = JSON.stringify(__assign(__assign(__assign(__assign(__assign(__assign({}, (input.ContactId != null && { ContactId: input.ContactId })), (input.MaxResults != null && { MaxResults: input.MaxResults })), (input.NextToken != null && { NextToken: input.NextToken })), (input.ScanDirection != null && { ScanDirection: input.ScanDirection })), (input.SortOrder != null && { SortOrder: input.SortOrder })), (input.StartPosition != null && {
111
126
  StartPosition: serializeAws_restJson1StartPosition(input.StartPosition, context),
@@ -130,7 +145,10 @@ export var serializeAws_restJson1SendEventCommand = function (input, context) {
130
145
  case 0: return [4, context.endpoint()];
131
146
  case 1:
132
147
  _a = _d.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
133
- headers = __assign({ "content-type": "application/json" }, (isSerializableHeaderValue(input.ConnectionToken) && { "x-amz-bearer": input.ConnectionToken }));
148
+ headers = map({}, isSerializableHeaderValue, {
149
+ "content-type": "application/json",
150
+ "x-amz-bearer": input.ConnectionToken,
151
+ });
134
152
  resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/participant/event";
135
153
  body = JSON.stringify(__assign(__assign({ ClientToken: (_c = input.ClientToken) !== null && _c !== void 0 ? _c : generateIdempotencyToken() }, (input.Content != null && { Content: input.Content })), (input.ContentType != null && { ContentType: input.ContentType })));
136
154
  return [2, new __HttpRequest({
@@ -153,7 +171,10 @@ export var serializeAws_restJson1SendMessageCommand = function (input, context)
153
171
  case 0: return [4, context.endpoint()];
154
172
  case 1:
155
173
  _a = _d.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
156
- headers = __assign({ "content-type": "application/json" }, (isSerializableHeaderValue(input.ConnectionToken) && { "x-amz-bearer": input.ConnectionToken }));
174
+ headers = map({}, isSerializableHeaderValue, {
175
+ "content-type": "application/json",
176
+ "x-amz-bearer": input.ConnectionToken,
177
+ });
157
178
  resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/participant/message";
158
179
  body = JSON.stringify(__assign(__assign({ ClientToken: (_c = input.ClientToken) !== null && _c !== void 0 ? _c : generateIdempotencyToken() }, (input.Content != null && { Content: input.Content })), (input.ContentType != null && { ContentType: input.ContentType })));
159
180
  return [2, new __HttpRequest({
@@ -176,7 +197,10 @@ export var serializeAws_restJson1StartAttachmentUploadCommand = function (input,
176
197
  case 0: return [4, context.endpoint()];
177
198
  case 1:
178
199
  _a = _d.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
179
- headers = __assign({ "content-type": "application/json" }, (isSerializableHeaderValue(input.ConnectionToken) && { "x-amz-bearer": input.ConnectionToken }));
200
+ headers = map({}, isSerializableHeaderValue, {
201
+ "content-type": "application/json",
202
+ "x-amz-bearer": input.ConnectionToken,
203
+ });
180
204
  resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/participant/start-attachment-upload";
181
205
  body = JSON.stringify(__assign(__assign(__assign(__assign({}, (input.AttachmentName != null && { AttachmentName: input.AttachmentName })), (input.AttachmentSizeInBytes != null && { AttachmentSizeInBytes: input.AttachmentSizeInBytes })), { ClientToken: (_c = input.ClientToken) !== null && _c !== void 0 ? _c : generateIdempotencyToken() }), (input.ContentType != null && { ContentType: input.ContentType })));
182
206
  return [2, new __HttpRequest({
@@ -199,18 +223,18 @@ export var deserializeAws_restJson1CompleteAttachmentUploadCommand = function (o
199
223
  if (output.statusCode !== 200 && output.statusCode >= 300) {
200
224
  return [2, deserializeAws_restJson1CompleteAttachmentUploadCommandError(output, context)];
201
225
  }
202
- contents = {
226
+ contents = map({
203
227
  $metadata: deserializeMetadata(output),
204
- };
228
+ });
205
229
  return [4, collectBody(output.body, context)];
206
230
  case 1:
207
231
  _a.sent();
208
- return [2, Promise.resolve(contents)];
232
+ return [2, contents];
209
233
  }
210
234
  });
211
235
  }); };
212
236
  var deserializeAws_restJson1CompleteAttachmentUploadCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
213
- var parsedOutput, _a, response, errorCode, _b, parsedBody, $metadata, statusCode;
237
+ var parsedOutput, _a, errorCode, _b, parsedBody;
214
238
  var _c;
215
239
  return __generator(this, function (_d) {
216
240
  switch (_d.label) {
@@ -251,14 +275,14 @@ var deserializeAws_restJson1CompleteAttachmentUploadCommandError = function (out
251
275
  case 13: throw _d.sent();
252
276
  case 14:
253
277
  parsedBody = parsedOutput.body;
254
- $metadata = deserializeMetadata(output);
255
- statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
256
- response = new __BaseException({
257
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
258
- $fault: "client",
259
- $metadata: $metadata,
278
+ throwDefaultError({
279
+ output: output,
280
+ parsedBody: parsedBody,
281
+ exceptionCtor: __BaseException,
282
+ errorCode: errorCode,
260
283
  });
261
- throw __decorateServiceException(response, parsedBody);
284
+ _d.label = 15;
285
+ case 15: return [2];
262
286
  }
263
287
  });
264
288
  }); };
@@ -270,28 +294,26 @@ export var deserializeAws_restJson1CreateParticipantConnectionCommand = function
270
294
  if (output.statusCode !== 200 && output.statusCode >= 300) {
271
295
  return [2, deserializeAws_restJson1CreateParticipantConnectionCommandError(output, context)];
272
296
  }
273
- contents = {
297
+ contents = map({
274
298
  $metadata: deserializeMetadata(output),
275
- ConnectionCredentials: undefined,
276
- Websocket: undefined,
277
- };
299
+ });
278
300
  _a = __expectNonNull;
279
301
  _b = __expectObject;
280
302
  return [4, parseBody(output.body, context)];
281
303
  case 1:
282
304
  data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
283
- if (data.ConnectionCredentials !== undefined && data.ConnectionCredentials !== null) {
305
+ if (data.ConnectionCredentials != null) {
284
306
  contents.ConnectionCredentials = deserializeAws_restJson1ConnectionCredentials(data.ConnectionCredentials, context);
285
307
  }
286
- if (data.Websocket !== undefined && data.Websocket !== null) {
308
+ if (data.Websocket != null) {
287
309
  contents.Websocket = deserializeAws_restJson1Websocket(data.Websocket, context);
288
310
  }
289
- return [2, Promise.resolve(contents)];
311
+ return [2, contents];
290
312
  }
291
313
  });
292
314
  }); };
293
315
  var deserializeAws_restJson1CreateParticipantConnectionCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
294
- var parsedOutput, _a, response, errorCode, _b, parsedBody, $metadata, statusCode;
316
+ var parsedOutput, _a, errorCode, _b, parsedBody;
295
317
  var _c;
296
318
  return __generator(this, function (_d) {
297
319
  switch (_d.label) {
@@ -324,14 +346,14 @@ var deserializeAws_restJson1CreateParticipantConnectionCommandError = function (
324
346
  case 9: throw _d.sent();
325
347
  case 10:
326
348
  parsedBody = parsedOutput.body;
327
- $metadata = deserializeMetadata(output);
328
- statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
329
- response = new __BaseException({
330
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
331
- $fault: "client",
332
- $metadata: $metadata,
349
+ throwDefaultError({
350
+ output: output,
351
+ parsedBody: parsedBody,
352
+ exceptionCtor: __BaseException,
353
+ errorCode: errorCode,
333
354
  });
334
- throw __decorateServiceException(response, parsedBody);
355
+ _d.label = 11;
356
+ case 11: return [2];
335
357
  }
336
358
  });
337
359
  }); };
@@ -343,18 +365,18 @@ export var deserializeAws_restJson1DisconnectParticipantCommand = function (outp
343
365
  if (output.statusCode !== 200 && output.statusCode >= 300) {
344
366
  return [2, deserializeAws_restJson1DisconnectParticipantCommandError(output, context)];
345
367
  }
346
- contents = {
368
+ contents = map({
347
369
  $metadata: deserializeMetadata(output),
348
- };
370
+ });
349
371
  return [4, collectBody(output.body, context)];
350
372
  case 1:
351
373
  _a.sent();
352
- return [2, Promise.resolve(contents)];
374
+ return [2, contents];
353
375
  }
354
376
  });
355
377
  }); };
356
378
  var deserializeAws_restJson1DisconnectParticipantCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
357
- var parsedOutput, _a, response, errorCode, _b, parsedBody, $metadata, statusCode;
379
+ var parsedOutput, _a, errorCode, _b, parsedBody;
358
380
  var _c;
359
381
  return __generator(this, function (_d) {
360
382
  switch (_d.label) {
@@ -387,14 +409,14 @@ var deserializeAws_restJson1DisconnectParticipantCommandError = function (output
387
409
  case 9: throw _d.sent();
388
410
  case 10:
389
411
  parsedBody = parsedOutput.body;
390
- $metadata = deserializeMetadata(output);
391
- statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
392
- response = new __BaseException({
393
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
394
- $fault: "client",
395
- $metadata: $metadata,
412
+ throwDefaultError({
413
+ output: output,
414
+ parsedBody: parsedBody,
415
+ exceptionCtor: __BaseException,
416
+ errorCode: errorCode,
396
417
  });
397
- throw __decorateServiceException(response, parsedBody);
418
+ _d.label = 11;
419
+ case 11: return [2];
398
420
  }
399
421
  });
400
422
  }); };
@@ -406,28 +428,26 @@ export var deserializeAws_restJson1GetAttachmentCommand = function (output, cont
406
428
  if (output.statusCode !== 200 && output.statusCode >= 300) {
407
429
  return [2, deserializeAws_restJson1GetAttachmentCommandError(output, context)];
408
430
  }
409
- contents = {
431
+ contents = map({
410
432
  $metadata: deserializeMetadata(output),
411
- Url: undefined,
412
- UrlExpiry: undefined,
413
- };
433
+ });
414
434
  _a = __expectNonNull;
415
435
  _b = __expectObject;
416
436
  return [4, parseBody(output.body, context)];
417
437
  case 1:
418
438
  data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
419
- if (data.Url !== undefined && data.Url !== null) {
439
+ if (data.Url != null) {
420
440
  contents.Url = __expectString(data.Url);
421
441
  }
422
- if (data.UrlExpiry !== undefined && data.UrlExpiry !== null) {
442
+ if (data.UrlExpiry != null) {
423
443
  contents.UrlExpiry = __expectString(data.UrlExpiry);
424
444
  }
425
- return [2, Promise.resolve(contents)];
445
+ return [2, contents];
426
446
  }
427
447
  });
428
448
  }); };
429
449
  var deserializeAws_restJson1GetAttachmentCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
430
- var parsedOutput, _a, response, errorCode, _b, parsedBody, $metadata, statusCode;
450
+ var parsedOutput, _a, errorCode, _b, parsedBody;
431
451
  var _c;
432
452
  return __generator(this, function (_d) {
433
453
  switch (_d.label) {
@@ -460,14 +480,14 @@ var deserializeAws_restJson1GetAttachmentCommandError = function (output, contex
460
480
  case 9: throw _d.sent();
461
481
  case 10:
462
482
  parsedBody = parsedOutput.body;
463
- $metadata = deserializeMetadata(output);
464
- statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
465
- response = new __BaseException({
466
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
467
- $fault: "client",
468
- $metadata: $metadata,
483
+ throwDefaultError({
484
+ output: output,
485
+ parsedBody: parsedBody,
486
+ exceptionCtor: __BaseException,
487
+ errorCode: errorCode,
469
488
  });
470
- throw __decorateServiceException(response, parsedBody);
489
+ _d.label = 11;
490
+ case 11: return [2];
471
491
  }
472
492
  });
473
493
  }); };
@@ -479,32 +499,29 @@ export var deserializeAws_restJson1GetTranscriptCommand = function (output, cont
479
499
  if (output.statusCode !== 200 && output.statusCode >= 300) {
480
500
  return [2, deserializeAws_restJson1GetTranscriptCommandError(output, context)];
481
501
  }
482
- contents = {
502
+ contents = map({
483
503
  $metadata: deserializeMetadata(output),
484
- InitialContactId: undefined,
485
- NextToken: undefined,
486
- Transcript: undefined,
487
- };
504
+ });
488
505
  _a = __expectNonNull;
489
506
  _b = __expectObject;
490
507
  return [4, parseBody(output.body, context)];
491
508
  case 1:
492
509
  data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
493
- if (data.InitialContactId !== undefined && data.InitialContactId !== null) {
510
+ if (data.InitialContactId != null) {
494
511
  contents.InitialContactId = __expectString(data.InitialContactId);
495
512
  }
496
- if (data.NextToken !== undefined && data.NextToken !== null) {
513
+ if (data.NextToken != null) {
497
514
  contents.NextToken = __expectString(data.NextToken);
498
515
  }
499
- if (data.Transcript !== undefined && data.Transcript !== null) {
516
+ if (data.Transcript != null) {
500
517
  contents.Transcript = deserializeAws_restJson1Transcript(data.Transcript, context);
501
518
  }
502
- return [2, Promise.resolve(contents)];
519
+ return [2, contents];
503
520
  }
504
521
  });
505
522
  }); };
506
523
  var deserializeAws_restJson1GetTranscriptCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
507
- var parsedOutput, _a, response, errorCode, _b, parsedBody, $metadata, statusCode;
524
+ var parsedOutput, _a, errorCode, _b, parsedBody;
508
525
  var _c;
509
526
  return __generator(this, function (_d) {
510
527
  switch (_d.label) {
@@ -537,14 +554,14 @@ var deserializeAws_restJson1GetTranscriptCommandError = function (output, contex
537
554
  case 9: throw _d.sent();
538
555
  case 10:
539
556
  parsedBody = parsedOutput.body;
540
- $metadata = deserializeMetadata(output);
541
- statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
542
- response = new __BaseException({
543
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
544
- $fault: "client",
545
- $metadata: $metadata,
557
+ throwDefaultError({
558
+ output: output,
559
+ parsedBody: parsedBody,
560
+ exceptionCtor: __BaseException,
561
+ errorCode: errorCode,
546
562
  });
547
- throw __decorateServiceException(response, parsedBody);
563
+ _d.label = 11;
564
+ case 11: return [2];
548
565
  }
549
566
  });
550
567
  }); };
@@ -556,28 +573,26 @@ export var deserializeAws_restJson1SendEventCommand = function (output, context)
556
573
  if (output.statusCode !== 200 && output.statusCode >= 300) {
557
574
  return [2, deserializeAws_restJson1SendEventCommandError(output, context)];
558
575
  }
559
- contents = {
576
+ contents = map({
560
577
  $metadata: deserializeMetadata(output),
561
- AbsoluteTime: undefined,
562
- Id: undefined,
563
- };
578
+ });
564
579
  _a = __expectNonNull;
565
580
  _b = __expectObject;
566
581
  return [4, parseBody(output.body, context)];
567
582
  case 1:
568
583
  data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
569
- if (data.AbsoluteTime !== undefined && data.AbsoluteTime !== null) {
584
+ if (data.AbsoluteTime != null) {
570
585
  contents.AbsoluteTime = __expectString(data.AbsoluteTime);
571
586
  }
572
- if (data.Id !== undefined && data.Id !== null) {
587
+ if (data.Id != null) {
573
588
  contents.Id = __expectString(data.Id);
574
589
  }
575
- return [2, Promise.resolve(contents)];
590
+ return [2, contents];
576
591
  }
577
592
  });
578
593
  }); };
579
594
  var deserializeAws_restJson1SendEventCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
580
- var parsedOutput, _a, response, errorCode, _b, parsedBody, $metadata, statusCode;
595
+ var parsedOutput, _a, errorCode, _b, parsedBody;
581
596
  var _c;
582
597
  return __generator(this, function (_d) {
583
598
  switch (_d.label) {
@@ -610,14 +625,14 @@ var deserializeAws_restJson1SendEventCommandError = function (output, context) {
610
625
  case 9: throw _d.sent();
611
626
  case 10:
612
627
  parsedBody = parsedOutput.body;
613
- $metadata = deserializeMetadata(output);
614
- statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
615
- response = new __BaseException({
616
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
617
- $fault: "client",
618
- $metadata: $metadata,
628
+ throwDefaultError({
629
+ output: output,
630
+ parsedBody: parsedBody,
631
+ exceptionCtor: __BaseException,
632
+ errorCode: errorCode,
619
633
  });
620
- throw __decorateServiceException(response, parsedBody);
634
+ _d.label = 11;
635
+ case 11: return [2];
621
636
  }
622
637
  });
623
638
  }); };
@@ -629,28 +644,26 @@ export var deserializeAws_restJson1SendMessageCommand = function (output, contex
629
644
  if (output.statusCode !== 200 && output.statusCode >= 300) {
630
645
  return [2, deserializeAws_restJson1SendMessageCommandError(output, context)];
631
646
  }
632
- contents = {
647
+ contents = map({
633
648
  $metadata: deserializeMetadata(output),
634
- AbsoluteTime: undefined,
635
- Id: undefined,
636
- };
649
+ });
637
650
  _a = __expectNonNull;
638
651
  _b = __expectObject;
639
652
  return [4, parseBody(output.body, context)];
640
653
  case 1:
641
654
  data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
642
- if (data.AbsoluteTime !== undefined && data.AbsoluteTime !== null) {
655
+ if (data.AbsoluteTime != null) {
643
656
  contents.AbsoluteTime = __expectString(data.AbsoluteTime);
644
657
  }
645
- if (data.Id !== undefined && data.Id !== null) {
658
+ if (data.Id != null) {
646
659
  contents.Id = __expectString(data.Id);
647
660
  }
648
- return [2, Promise.resolve(contents)];
661
+ return [2, contents];
649
662
  }
650
663
  });
651
664
  }); };
652
665
  var deserializeAws_restJson1SendMessageCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
653
- var parsedOutput, _a, response, errorCode, _b, parsedBody, $metadata, statusCode;
666
+ var parsedOutput, _a, errorCode, _b, parsedBody;
654
667
  var _c;
655
668
  return __generator(this, function (_d) {
656
669
  switch (_d.label) {
@@ -683,14 +696,14 @@ var deserializeAws_restJson1SendMessageCommandError = function (output, context)
683
696
  case 9: throw _d.sent();
684
697
  case 10:
685
698
  parsedBody = parsedOutput.body;
686
- $metadata = deserializeMetadata(output);
687
- statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
688
- response = new __BaseException({
689
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
690
- $fault: "client",
691
- $metadata: $metadata,
699
+ throwDefaultError({
700
+ output: output,
701
+ parsedBody: parsedBody,
702
+ exceptionCtor: __BaseException,
703
+ errorCode: errorCode,
692
704
  });
693
- throw __decorateServiceException(response, parsedBody);
705
+ _d.label = 11;
706
+ case 11: return [2];
694
707
  }
695
708
  });
696
709
  }); };
@@ -702,28 +715,26 @@ export var deserializeAws_restJson1StartAttachmentUploadCommand = function (outp
702
715
  if (output.statusCode !== 200 && output.statusCode >= 300) {
703
716
  return [2, deserializeAws_restJson1StartAttachmentUploadCommandError(output, context)];
704
717
  }
705
- contents = {
718
+ contents = map({
706
719
  $metadata: deserializeMetadata(output),
707
- AttachmentId: undefined,
708
- UploadMetadata: undefined,
709
- };
720
+ });
710
721
  _a = __expectNonNull;
711
722
  _b = __expectObject;
712
723
  return [4, parseBody(output.body, context)];
713
724
  case 1:
714
725
  data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
715
- if (data.AttachmentId !== undefined && data.AttachmentId !== null) {
726
+ if (data.AttachmentId != null) {
716
727
  contents.AttachmentId = __expectString(data.AttachmentId);
717
728
  }
718
- if (data.UploadMetadata !== undefined && data.UploadMetadata !== null) {
729
+ if (data.UploadMetadata != null) {
719
730
  contents.UploadMetadata = deserializeAws_restJson1UploadMetadata(data.UploadMetadata, context);
720
731
  }
721
- return [2, Promise.resolve(contents)];
732
+ return [2, contents];
722
733
  }
723
734
  });
724
735
  }); };
725
736
  var deserializeAws_restJson1StartAttachmentUploadCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
726
- var parsedOutput, _a, response, errorCode, _b, parsedBody, $metadata, statusCode;
737
+ var parsedOutput, _a, errorCode, _b, parsedBody;
727
738
  var _c;
728
739
  return __generator(this, function (_d) {
729
740
  switch (_d.label) {
@@ -760,23 +771,24 @@ var deserializeAws_restJson1StartAttachmentUploadCommandError = function (output
760
771
  case 11: throw _d.sent();
761
772
  case 12:
762
773
  parsedBody = parsedOutput.body;
763
- $metadata = deserializeMetadata(output);
764
- statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
765
- response = new __BaseException({
766
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
767
- $fault: "client",
768
- $metadata: $metadata,
774
+ throwDefaultError({
775
+ output: output,
776
+ parsedBody: parsedBody,
777
+ exceptionCtor: __BaseException,
778
+ errorCode: errorCode,
769
779
  });
770
- throw __decorateServiceException(response, parsedBody);
780
+ _d.label = 13;
781
+ case 13: return [2];
771
782
  }
772
783
  });
773
784
  }); };
785
+ var map = __map;
774
786
  var deserializeAws_restJson1AccessDeniedExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
775
787
  var contents, data, exception;
776
788
  return __generator(this, function (_a) {
777
- contents = {};
789
+ contents = map({});
778
790
  data = parsedOutput.body;
779
- if (data.Message !== undefined && data.Message !== null) {
791
+ if (data.Message != null) {
780
792
  contents.Message = __expectString(data.Message);
781
793
  }
782
794
  exception = new AccessDeniedException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
@@ -786,9 +798,9 @@ var deserializeAws_restJson1AccessDeniedExceptionResponse = function (parsedOutp
786
798
  var deserializeAws_restJson1ConflictExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
787
799
  var contents, data, exception;
788
800
  return __generator(this, function (_a) {
789
- contents = {};
801
+ contents = map({});
790
802
  data = parsedOutput.body;
791
- if (data.Message !== undefined && data.Message !== null) {
803
+ if (data.Message != null) {
792
804
  contents.Message = __expectString(data.Message);
793
805
  }
794
806
  exception = new ConflictException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
@@ -798,9 +810,9 @@ var deserializeAws_restJson1ConflictExceptionResponse = function (parsedOutput,
798
810
  var deserializeAws_restJson1InternalServerExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
799
811
  var contents, data, exception;
800
812
  return __generator(this, function (_a) {
801
- contents = {};
813
+ contents = map({});
802
814
  data = parsedOutput.body;
803
- if (data.Message !== undefined && data.Message !== null) {
815
+ if (data.Message != null) {
804
816
  contents.Message = __expectString(data.Message);
805
817
  }
806
818
  exception = new InternalServerException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
@@ -810,9 +822,9 @@ var deserializeAws_restJson1InternalServerExceptionResponse = function (parsedOu
810
822
  var deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
811
823
  var contents, data, exception;
812
824
  return __generator(this, function (_a) {
813
- contents = {};
825
+ contents = map({});
814
826
  data = parsedOutput.body;
815
- if (data.Message !== undefined && data.Message !== null) {
827
+ if (data.Message != null) {
816
828
  contents.Message = __expectString(data.Message);
817
829
  }
818
830
  exception = new ServiceQuotaExceededException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
@@ -822,9 +834,9 @@ var deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = function (pa
822
834
  var deserializeAws_restJson1ThrottlingExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
823
835
  var contents, data, exception;
824
836
  return __generator(this, function (_a) {
825
- contents = {};
837
+ contents = map({});
826
838
  data = parsedOutput.body;
827
- if (data.Message !== undefined && data.Message !== null) {
839
+ if (data.Message != null) {
828
840
  contents.Message = __expectString(data.Message);
829
841
  }
830
842
  exception = new ThrottlingException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
@@ -834,9 +846,9 @@ var deserializeAws_restJson1ThrottlingExceptionResponse = function (parsedOutput
834
846
  var deserializeAws_restJson1ValidationExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
835
847
  var contents, data, exception;
836
848
  return __generator(this, function (_a) {
837
- contents = {};
849
+ contents = map({});
838
850
  data = parsedOutput.body;
839
- if (data.Message !== undefined && data.Message !== null) {
851
+ if (data.Message != null) {
840
852
  contents.Message = __expectString(data.Message);
841
853
  }
842
854
  exception = new ValidationException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
@@ -847,9 +859,6 @@ var serializeAws_restJson1AttachmentIdList = function (input, context) {
847
859
  return input
848
860
  .filter(function (e) { return e != null; })
849
861
  .map(function (entry) {
850
- if (entry === null) {
851
- return null;
852
- }
853
862
  return entry;
854
863
  });
855
864
  };
@@ -857,9 +866,6 @@ var serializeAws_restJson1ConnectionTypeList = function (input, context) {
857
866
  return input
858
867
  .filter(function (e) { return e != null; })
859
868
  .map(function (entry) {
860
- if (entry === null) {
861
- return null;
862
- }
863
869
  return entry;
864
870
  });
865
871
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aws-sdk/client-connectparticipant",
3
3
  "description": "AWS SDK for JavaScript Connectparticipant Client for Node.js, Browser and React Native",
4
- "version": "3.141.0",
4
+ "version": "3.142.0",
5
5
  "scripts": {
6
6
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
7
7
  "build:cjs": "tsc -p tsconfig.cjs.json",
@@ -18,9 +18,9 @@
18
18
  "dependencies": {
19
19
  "@aws-crypto/sha256-browser": "2.0.0",
20
20
  "@aws-crypto/sha256-js": "2.0.0",
21
- "@aws-sdk/client-sts": "3.141.0",
21
+ "@aws-sdk/client-sts": "3.142.0",
22
22
  "@aws-sdk/config-resolver": "3.130.0",
23
- "@aws-sdk/credential-provider-node": "3.141.0",
23
+ "@aws-sdk/credential-provider-node": "3.142.0",
24
24
  "@aws-sdk/fetch-http-handler": "3.131.0",
25
25
  "@aws-sdk/hash-node": "3.127.0",
26
26
  "@aws-sdk/invalid-dependency": "3.127.0",
@@ -36,15 +36,15 @@
36
36
  "@aws-sdk/node-config-provider": "3.127.0",
37
37
  "@aws-sdk/node-http-handler": "3.127.0",
38
38
  "@aws-sdk/protocol-http": "3.127.0",
39
- "@aws-sdk/smithy-client": "3.137.0",
39
+ "@aws-sdk/smithy-client": "3.142.0",
40
40
  "@aws-sdk/types": "3.127.0",
41
41
  "@aws-sdk/url-parser": "3.127.0",
42
42
  "@aws-sdk/util-base64-browser": "3.109.0",
43
43
  "@aws-sdk/util-base64-node": "3.55.0",
44
44
  "@aws-sdk/util-body-length-browser": "3.55.0",
45
45
  "@aws-sdk/util-body-length-node": "3.55.0",
46
- "@aws-sdk/util-defaults-mode-browser": "3.137.0",
47
- "@aws-sdk/util-defaults-mode-node": "3.137.0",
46
+ "@aws-sdk/util-defaults-mode-browser": "3.142.0",
47
+ "@aws-sdk/util-defaults-mode-node": "3.142.0",
48
48
  "@aws-sdk/util-user-agent-browser": "3.127.0",
49
49
  "@aws-sdk/util-user-agent-node": "3.127.0",
50
50
  "@aws-sdk/util-utf8-browser": "3.109.0",