@aws-sdk/client-connectparticipant 3.312.0 → 3.315.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,16 +8,16 @@ const ConnectParticipantServiceException_1 = require("../models/ConnectParticipa
8
8
  const models_0_1 = require("../models/models_0");
9
9
  const se_CompleteAttachmentUploadCommand = async (input, context) => {
10
10
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
11
- const headers = map({}, isSerializableHeaderValue, {
11
+ const headers = (0, smithy_client_1.map)({}, isSerializableHeaderValue, {
12
12
  "content-type": "application/json",
13
13
  "x-amz-bearer": input.ConnectionToken,
14
14
  });
15
15
  const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/participant/complete-attachment-upload";
16
16
  let body;
17
- body = JSON.stringify({
18
- ...(input.AttachmentIds != null && { AttachmentIds: se_AttachmentIdList(input.AttachmentIds, context) }),
19
- ClientToken: input.ClientToken ?? (0, uuid_1.v4)(),
20
- });
17
+ body = JSON.stringify((0, smithy_client_1.take)(input, {
18
+ AttachmentIds: (_) => (0, smithy_client_1._json)(_),
19
+ ClientToken: (_) => _ ?? (0, uuid_1.v4)(),
20
+ }));
21
21
  return new protocol_http_1.HttpRequest({
22
22
  protocol,
23
23
  hostname,
@@ -31,16 +31,16 @@ const se_CompleteAttachmentUploadCommand = async (input, context) => {
31
31
  exports.se_CompleteAttachmentUploadCommand = se_CompleteAttachmentUploadCommand;
32
32
  const se_CreateParticipantConnectionCommand = async (input, context) => {
33
33
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
34
- const headers = map({}, isSerializableHeaderValue, {
34
+ const headers = (0, smithy_client_1.map)({}, isSerializableHeaderValue, {
35
35
  "content-type": "application/json",
36
36
  "x-amz-bearer": input.ParticipantToken,
37
37
  });
38
38
  const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/participant/connection";
39
39
  let body;
40
- body = JSON.stringify({
41
- ...(input.ConnectParticipant != null && { ConnectParticipant: input.ConnectParticipant }),
42
- ...(input.Type != null && { Type: se_ConnectionTypeList(input.Type, context) }),
43
- });
40
+ body = JSON.stringify((0, smithy_client_1.take)(input, {
41
+ ConnectParticipant: [],
42
+ Type: (_) => (0, smithy_client_1._json)(_),
43
+ }));
44
44
  return new protocol_http_1.HttpRequest({
45
45
  protocol,
46
46
  hostname,
@@ -54,15 +54,15 @@ const se_CreateParticipantConnectionCommand = async (input, context) => {
54
54
  exports.se_CreateParticipantConnectionCommand = se_CreateParticipantConnectionCommand;
55
55
  const se_DisconnectParticipantCommand = async (input, context) => {
56
56
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
57
- const headers = map({}, isSerializableHeaderValue, {
57
+ const headers = (0, smithy_client_1.map)({}, isSerializableHeaderValue, {
58
58
  "content-type": "application/json",
59
59
  "x-amz-bearer": input.ConnectionToken,
60
60
  });
61
61
  const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/participant/disconnect";
62
62
  let body;
63
- body = JSON.stringify({
64
- ClientToken: input.ClientToken ?? (0, uuid_1.v4)(),
65
- });
63
+ body = JSON.stringify((0, smithy_client_1.take)(input, {
64
+ ClientToken: (_) => _ ?? (0, uuid_1.v4)(),
65
+ }));
66
66
  return new protocol_http_1.HttpRequest({
67
67
  protocol,
68
68
  hostname,
@@ -76,15 +76,15 @@ const se_DisconnectParticipantCommand = async (input, context) => {
76
76
  exports.se_DisconnectParticipantCommand = se_DisconnectParticipantCommand;
77
77
  const se_GetAttachmentCommand = async (input, context) => {
78
78
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
79
- const headers = map({}, isSerializableHeaderValue, {
79
+ const headers = (0, smithy_client_1.map)({}, isSerializableHeaderValue, {
80
80
  "content-type": "application/json",
81
81
  "x-amz-bearer": input.ConnectionToken,
82
82
  });
83
83
  const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/participant/attachment";
84
84
  let body;
85
- body = JSON.stringify({
86
- ...(input.AttachmentId != null && { AttachmentId: input.AttachmentId }),
87
- });
85
+ body = JSON.stringify((0, smithy_client_1.take)(input, {
86
+ AttachmentId: [],
87
+ }));
88
88
  return new protocol_http_1.HttpRequest({
89
89
  protocol,
90
90
  hostname,
@@ -98,20 +98,20 @@ const se_GetAttachmentCommand = async (input, context) => {
98
98
  exports.se_GetAttachmentCommand = se_GetAttachmentCommand;
99
99
  const se_GetTranscriptCommand = async (input, context) => {
100
100
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
101
- const headers = map({}, isSerializableHeaderValue, {
101
+ const headers = (0, smithy_client_1.map)({}, isSerializableHeaderValue, {
102
102
  "content-type": "application/json",
103
103
  "x-amz-bearer": input.ConnectionToken,
104
104
  });
105
105
  const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/participant/transcript";
106
106
  let body;
107
- body = JSON.stringify({
108
- ...(input.ContactId != null && { ContactId: input.ContactId }),
109
- ...(input.MaxResults != null && { MaxResults: input.MaxResults }),
110
- ...(input.NextToken != null && { NextToken: input.NextToken }),
111
- ...(input.ScanDirection != null && { ScanDirection: input.ScanDirection }),
112
- ...(input.SortOrder != null && { SortOrder: input.SortOrder }),
113
- ...(input.StartPosition != null && { StartPosition: se_StartPosition(input.StartPosition, context) }),
114
- });
107
+ body = JSON.stringify((0, smithy_client_1.take)(input, {
108
+ ContactId: [],
109
+ MaxResults: [],
110
+ NextToken: [],
111
+ ScanDirection: [],
112
+ SortOrder: [],
113
+ StartPosition: (_) => (0, smithy_client_1._json)(_),
114
+ }));
115
115
  return new protocol_http_1.HttpRequest({
116
116
  protocol,
117
117
  hostname,
@@ -125,17 +125,17 @@ const se_GetTranscriptCommand = async (input, context) => {
125
125
  exports.se_GetTranscriptCommand = se_GetTranscriptCommand;
126
126
  const se_SendEventCommand = async (input, context) => {
127
127
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
128
- const headers = map({}, isSerializableHeaderValue, {
128
+ const headers = (0, smithy_client_1.map)({}, isSerializableHeaderValue, {
129
129
  "content-type": "application/json",
130
130
  "x-amz-bearer": input.ConnectionToken,
131
131
  });
132
132
  const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/participant/event";
133
133
  let body;
134
- body = JSON.stringify({
135
- ClientToken: input.ClientToken ?? (0, uuid_1.v4)(),
136
- ...(input.Content != null && { Content: input.Content }),
137
- ...(input.ContentType != null && { ContentType: input.ContentType }),
138
- });
134
+ body = JSON.stringify((0, smithy_client_1.take)(input, {
135
+ ClientToken: (_) => _ ?? (0, uuid_1.v4)(),
136
+ Content: [],
137
+ ContentType: [],
138
+ }));
139
139
  return new protocol_http_1.HttpRequest({
140
140
  protocol,
141
141
  hostname,
@@ -149,17 +149,17 @@ const se_SendEventCommand = async (input, context) => {
149
149
  exports.se_SendEventCommand = se_SendEventCommand;
150
150
  const se_SendMessageCommand = async (input, context) => {
151
151
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
152
- const headers = map({}, isSerializableHeaderValue, {
152
+ const headers = (0, smithy_client_1.map)({}, isSerializableHeaderValue, {
153
153
  "content-type": "application/json",
154
154
  "x-amz-bearer": input.ConnectionToken,
155
155
  });
156
156
  const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/participant/message";
157
157
  let body;
158
- body = JSON.stringify({
159
- ClientToken: input.ClientToken ?? (0, uuid_1.v4)(),
160
- ...(input.Content != null && { Content: input.Content }),
161
- ...(input.ContentType != null && { ContentType: input.ContentType }),
162
- });
158
+ body = JSON.stringify((0, smithy_client_1.take)(input, {
159
+ ClientToken: (_) => _ ?? (0, uuid_1.v4)(),
160
+ Content: [],
161
+ ContentType: [],
162
+ }));
163
163
  return new protocol_http_1.HttpRequest({
164
164
  protocol,
165
165
  hostname,
@@ -173,18 +173,18 @@ const se_SendMessageCommand = async (input, context) => {
173
173
  exports.se_SendMessageCommand = se_SendMessageCommand;
174
174
  const se_StartAttachmentUploadCommand = async (input, context) => {
175
175
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
176
- const headers = map({}, isSerializableHeaderValue, {
176
+ const headers = (0, smithy_client_1.map)({}, isSerializableHeaderValue, {
177
177
  "content-type": "application/json",
178
178
  "x-amz-bearer": input.ConnectionToken,
179
179
  });
180
180
  const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/participant/start-attachment-upload";
181
181
  let body;
182
- body = JSON.stringify({
183
- ...(input.AttachmentName != null && { AttachmentName: input.AttachmentName }),
184
- ...(input.AttachmentSizeInBytes != null && { AttachmentSizeInBytes: input.AttachmentSizeInBytes }),
185
- ClientToken: input.ClientToken ?? (0, uuid_1.v4)(),
186
- ...(input.ContentType != null && { ContentType: input.ContentType }),
187
- });
182
+ body = JSON.stringify((0, smithy_client_1.take)(input, {
183
+ AttachmentName: [],
184
+ AttachmentSizeInBytes: [],
185
+ ClientToken: (_) => _ ?? (0, uuid_1.v4)(),
186
+ ContentType: [],
187
+ }));
188
188
  return new protocol_http_1.HttpRequest({
189
189
  protocol,
190
190
  hostname,
@@ -200,7 +200,7 @@ const de_CompleteAttachmentUploadCommand = async (output, context) => {
200
200
  if (output.statusCode !== 200 && output.statusCode >= 300) {
201
201
  return de_CompleteAttachmentUploadCommandError(output, context);
202
202
  }
203
- const contents = map({
203
+ const contents = (0, smithy_client_1.map)({
204
204
  $metadata: deserializeMetadata(output),
205
205
  });
206
206
  await collectBody(output.body, context);
@@ -234,10 +234,9 @@ const de_CompleteAttachmentUploadCommandError = async (output, context) => {
234
234
  throw await de_ValidationExceptionRes(parsedOutput, context);
235
235
  default:
236
236
  const parsedBody = parsedOutput.body;
237
- (0, smithy_client_1.throwDefaultError)({
237
+ return throwDefaultError({
238
238
  output,
239
239
  parsedBody,
240
- exceptionCtor: ConnectParticipantServiceException_1.ConnectParticipantServiceException,
241
240
  errorCode,
242
241
  });
243
242
  }
@@ -246,16 +245,15 @@ const de_CreateParticipantConnectionCommand = async (output, context) => {
246
245
  if (output.statusCode !== 200 && output.statusCode >= 300) {
247
246
  return de_CreateParticipantConnectionCommandError(output, context);
248
247
  }
249
- const contents = map({
248
+ const contents = (0, smithy_client_1.map)({
250
249
  $metadata: deserializeMetadata(output),
251
250
  });
252
251
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
253
- if (data.ConnectionCredentials != null) {
254
- contents.ConnectionCredentials = de_ConnectionCredentials(data.ConnectionCredentials, context);
255
- }
256
- if (data.Websocket != null) {
257
- contents.Websocket = de_Websocket(data.Websocket, context);
258
- }
252
+ const doc = (0, smithy_client_1.take)(data, {
253
+ ConnectionCredentials: smithy_client_1._json,
254
+ Websocket: smithy_client_1._json,
255
+ });
256
+ Object.assign(contents, doc);
259
257
  return contents;
260
258
  };
261
259
  exports.de_CreateParticipantConnectionCommand = de_CreateParticipantConnectionCommand;
@@ -280,10 +278,9 @@ const de_CreateParticipantConnectionCommandError = async (output, context) => {
280
278
  throw await de_ValidationExceptionRes(parsedOutput, context);
281
279
  default:
282
280
  const parsedBody = parsedOutput.body;
283
- (0, smithy_client_1.throwDefaultError)({
281
+ return throwDefaultError({
284
282
  output,
285
283
  parsedBody,
286
- exceptionCtor: ConnectParticipantServiceException_1.ConnectParticipantServiceException,
287
284
  errorCode,
288
285
  });
289
286
  }
@@ -292,7 +289,7 @@ const de_DisconnectParticipantCommand = async (output, context) => {
292
289
  if (output.statusCode !== 200 && output.statusCode >= 300) {
293
290
  return de_DisconnectParticipantCommandError(output, context);
294
291
  }
295
- const contents = map({
292
+ const contents = (0, smithy_client_1.map)({
296
293
  $metadata: deserializeMetadata(output),
297
294
  });
298
295
  await collectBody(output.body, context);
@@ -320,10 +317,9 @@ const de_DisconnectParticipantCommandError = async (output, context) => {
320
317
  throw await de_ValidationExceptionRes(parsedOutput, context);
321
318
  default:
322
319
  const parsedBody = parsedOutput.body;
323
- (0, smithy_client_1.throwDefaultError)({
320
+ return throwDefaultError({
324
321
  output,
325
322
  parsedBody,
326
- exceptionCtor: ConnectParticipantServiceException_1.ConnectParticipantServiceException,
327
323
  errorCode,
328
324
  });
329
325
  }
@@ -332,16 +328,15 @@ const de_GetAttachmentCommand = async (output, context) => {
332
328
  if (output.statusCode !== 200 && output.statusCode >= 300) {
333
329
  return de_GetAttachmentCommandError(output, context);
334
330
  }
335
- const contents = map({
331
+ const contents = (0, smithy_client_1.map)({
336
332
  $metadata: deserializeMetadata(output),
337
333
  });
338
334
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
339
- if (data.Url != null) {
340
- contents.Url = (0, smithy_client_1.expectString)(data.Url);
341
- }
342
- if (data.UrlExpiry != null) {
343
- contents.UrlExpiry = (0, smithy_client_1.expectString)(data.UrlExpiry);
344
- }
335
+ const doc = (0, smithy_client_1.take)(data, {
336
+ Url: smithy_client_1.expectString,
337
+ UrlExpiry: smithy_client_1.expectString,
338
+ });
339
+ Object.assign(contents, doc);
345
340
  return contents;
346
341
  };
347
342
  exports.de_GetAttachmentCommand = de_GetAttachmentCommand;
@@ -366,10 +361,9 @@ const de_GetAttachmentCommandError = async (output, context) => {
366
361
  throw await de_ValidationExceptionRes(parsedOutput, context);
367
362
  default:
368
363
  const parsedBody = parsedOutput.body;
369
- (0, smithy_client_1.throwDefaultError)({
364
+ return throwDefaultError({
370
365
  output,
371
366
  parsedBody,
372
- exceptionCtor: ConnectParticipantServiceException_1.ConnectParticipantServiceException,
373
367
  errorCode,
374
368
  });
375
369
  }
@@ -378,19 +372,16 @@ const de_GetTranscriptCommand = async (output, context) => {
378
372
  if (output.statusCode !== 200 && output.statusCode >= 300) {
379
373
  return de_GetTranscriptCommandError(output, context);
380
374
  }
381
- const contents = map({
375
+ const contents = (0, smithy_client_1.map)({
382
376
  $metadata: deserializeMetadata(output),
383
377
  });
384
378
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
385
- if (data.InitialContactId != null) {
386
- contents.InitialContactId = (0, smithy_client_1.expectString)(data.InitialContactId);
387
- }
388
- if (data.NextToken != null) {
389
- contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
390
- }
391
- if (data.Transcript != null) {
392
- contents.Transcript = de_Transcript(data.Transcript, context);
393
- }
379
+ const doc = (0, smithy_client_1.take)(data, {
380
+ InitialContactId: smithy_client_1.expectString,
381
+ NextToken: smithy_client_1.expectString,
382
+ Transcript: smithy_client_1._json,
383
+ });
384
+ Object.assign(contents, doc);
394
385
  return contents;
395
386
  };
396
387
  exports.de_GetTranscriptCommand = de_GetTranscriptCommand;
@@ -415,10 +406,9 @@ const de_GetTranscriptCommandError = async (output, context) => {
415
406
  throw await de_ValidationExceptionRes(parsedOutput, context);
416
407
  default:
417
408
  const parsedBody = parsedOutput.body;
418
- (0, smithy_client_1.throwDefaultError)({
409
+ return throwDefaultError({
419
410
  output,
420
411
  parsedBody,
421
- exceptionCtor: ConnectParticipantServiceException_1.ConnectParticipantServiceException,
422
412
  errorCode,
423
413
  });
424
414
  }
@@ -427,16 +417,15 @@ const de_SendEventCommand = async (output, context) => {
427
417
  if (output.statusCode !== 200 && output.statusCode >= 300) {
428
418
  return de_SendEventCommandError(output, context);
429
419
  }
430
- const contents = map({
420
+ const contents = (0, smithy_client_1.map)({
431
421
  $metadata: deserializeMetadata(output),
432
422
  });
433
423
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
434
- if (data.AbsoluteTime != null) {
435
- contents.AbsoluteTime = (0, smithy_client_1.expectString)(data.AbsoluteTime);
436
- }
437
- if (data.Id != null) {
438
- contents.Id = (0, smithy_client_1.expectString)(data.Id);
439
- }
424
+ const doc = (0, smithy_client_1.take)(data, {
425
+ AbsoluteTime: smithy_client_1.expectString,
426
+ Id: smithy_client_1.expectString,
427
+ });
428
+ Object.assign(contents, doc);
440
429
  return contents;
441
430
  };
442
431
  exports.de_SendEventCommand = de_SendEventCommand;
@@ -461,10 +450,9 @@ const de_SendEventCommandError = async (output, context) => {
461
450
  throw await de_ValidationExceptionRes(parsedOutput, context);
462
451
  default:
463
452
  const parsedBody = parsedOutput.body;
464
- (0, smithy_client_1.throwDefaultError)({
453
+ return throwDefaultError({
465
454
  output,
466
455
  parsedBody,
467
- exceptionCtor: ConnectParticipantServiceException_1.ConnectParticipantServiceException,
468
456
  errorCode,
469
457
  });
470
458
  }
@@ -473,16 +461,15 @@ const de_SendMessageCommand = async (output, context) => {
473
461
  if (output.statusCode !== 200 && output.statusCode >= 300) {
474
462
  return de_SendMessageCommandError(output, context);
475
463
  }
476
- const contents = map({
464
+ const contents = (0, smithy_client_1.map)({
477
465
  $metadata: deserializeMetadata(output),
478
466
  });
479
467
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
480
- if (data.AbsoluteTime != null) {
481
- contents.AbsoluteTime = (0, smithy_client_1.expectString)(data.AbsoluteTime);
482
- }
483
- if (data.Id != null) {
484
- contents.Id = (0, smithy_client_1.expectString)(data.Id);
485
- }
468
+ const doc = (0, smithy_client_1.take)(data, {
469
+ AbsoluteTime: smithy_client_1.expectString,
470
+ Id: smithy_client_1.expectString,
471
+ });
472
+ Object.assign(contents, doc);
486
473
  return contents;
487
474
  };
488
475
  exports.de_SendMessageCommand = de_SendMessageCommand;
@@ -507,10 +494,9 @@ const de_SendMessageCommandError = async (output, context) => {
507
494
  throw await de_ValidationExceptionRes(parsedOutput, context);
508
495
  default:
509
496
  const parsedBody = parsedOutput.body;
510
- (0, smithy_client_1.throwDefaultError)({
497
+ return throwDefaultError({
511
498
  output,
512
499
  parsedBody,
513
- exceptionCtor: ConnectParticipantServiceException_1.ConnectParticipantServiceException,
514
500
  errorCode,
515
501
  });
516
502
  }
@@ -519,16 +505,15 @@ const de_StartAttachmentUploadCommand = async (output, context) => {
519
505
  if (output.statusCode !== 200 && output.statusCode >= 300) {
520
506
  return de_StartAttachmentUploadCommandError(output, context);
521
507
  }
522
- const contents = map({
508
+ const contents = (0, smithy_client_1.map)({
523
509
  $metadata: deserializeMetadata(output),
524
510
  });
525
511
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
526
- if (data.AttachmentId != null) {
527
- contents.AttachmentId = (0, smithy_client_1.expectString)(data.AttachmentId);
528
- }
529
- if (data.UploadMetadata != null) {
530
- contents.UploadMetadata = de_UploadMetadata(data.UploadMetadata, context);
531
- }
512
+ const doc = (0, smithy_client_1.take)(data, {
513
+ AttachmentId: smithy_client_1.expectString,
514
+ UploadMetadata: smithy_client_1._json,
515
+ });
516
+ Object.assign(contents, doc);
532
517
  return contents;
533
518
  };
534
519
  exports.de_StartAttachmentUploadCommand = de_StartAttachmentUploadCommand;
@@ -556,21 +541,21 @@ const de_StartAttachmentUploadCommandError = async (output, context) => {
556
541
  throw await de_ValidationExceptionRes(parsedOutput, context);
557
542
  default:
558
543
  const parsedBody = parsedOutput.body;
559
- (0, smithy_client_1.throwDefaultError)({
544
+ return throwDefaultError({
560
545
  output,
561
546
  parsedBody,
562
- exceptionCtor: ConnectParticipantServiceException_1.ConnectParticipantServiceException,
563
547
  errorCode,
564
548
  });
565
549
  }
566
550
  };
567
- const map = smithy_client_1.map;
551
+ const throwDefaultError = (0, smithy_client_1.withBaseException)(ConnectParticipantServiceException_1.ConnectParticipantServiceException);
568
552
  const de_AccessDeniedExceptionRes = async (parsedOutput, context) => {
569
- const contents = map({});
553
+ const contents = (0, smithy_client_1.map)({});
570
554
  const data = parsedOutput.body;
571
- if (data.Message != null) {
572
- contents.Message = (0, smithy_client_1.expectString)(data.Message);
573
- }
555
+ const doc = (0, smithy_client_1.take)(data, {
556
+ Message: smithy_client_1.expectString,
557
+ });
558
+ Object.assign(contents, doc);
574
559
  const exception = new models_0_1.AccessDeniedException({
575
560
  $metadata: deserializeMetadata(parsedOutput),
576
561
  ...contents,
@@ -578,11 +563,12 @@ const de_AccessDeniedExceptionRes = async (parsedOutput, context) => {
578
563
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
579
564
  };
580
565
  const de_ConflictExceptionRes = async (parsedOutput, context) => {
581
- const contents = map({});
566
+ const contents = (0, smithy_client_1.map)({});
582
567
  const data = parsedOutput.body;
583
- if (data.Message != null) {
584
- contents.Message = (0, smithy_client_1.expectString)(data.Message);
585
- }
568
+ const doc = (0, smithy_client_1.take)(data, {
569
+ Message: smithy_client_1.expectString,
570
+ });
571
+ Object.assign(contents, doc);
586
572
  const exception = new models_0_1.ConflictException({
587
573
  $metadata: deserializeMetadata(parsedOutput),
588
574
  ...contents,
@@ -590,11 +576,12 @@ const de_ConflictExceptionRes = async (parsedOutput, context) => {
590
576
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
591
577
  };
592
578
  const de_InternalServerExceptionRes = async (parsedOutput, context) => {
593
- const contents = map({});
579
+ const contents = (0, smithy_client_1.map)({});
594
580
  const data = parsedOutput.body;
595
- if (data.Message != null) {
596
- contents.Message = (0, smithy_client_1.expectString)(data.Message);
597
- }
581
+ const doc = (0, smithy_client_1.take)(data, {
582
+ Message: smithy_client_1.expectString,
583
+ });
584
+ Object.assign(contents, doc);
598
585
  const exception = new models_0_1.InternalServerException({
599
586
  $metadata: deserializeMetadata(parsedOutput),
600
587
  ...contents,
@@ -602,11 +589,12 @@ const de_InternalServerExceptionRes = async (parsedOutput, context) => {
602
589
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
603
590
  };
604
591
  const de_ServiceQuotaExceededExceptionRes = async (parsedOutput, context) => {
605
- const contents = map({});
592
+ const contents = (0, smithy_client_1.map)({});
606
593
  const data = parsedOutput.body;
607
- if (data.Message != null) {
608
- contents.Message = (0, smithy_client_1.expectString)(data.Message);
609
- }
594
+ const doc = (0, smithy_client_1.take)(data, {
595
+ Message: smithy_client_1.expectString,
596
+ });
597
+ Object.assign(contents, doc);
610
598
  const exception = new models_0_1.ServiceQuotaExceededException({
611
599
  $metadata: deserializeMetadata(parsedOutput),
612
600
  ...contents,
@@ -614,11 +602,12 @@ const de_ServiceQuotaExceededExceptionRes = async (parsedOutput, context) => {
614
602
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
615
603
  };
616
604
  const de_ThrottlingExceptionRes = async (parsedOutput, context) => {
617
- const contents = map({});
605
+ const contents = (0, smithy_client_1.map)({});
618
606
  const data = parsedOutput.body;
619
- if (data.Message != null) {
620
- contents.Message = (0, smithy_client_1.expectString)(data.Message);
621
- }
607
+ const doc = (0, smithy_client_1.take)(data, {
608
+ Message: smithy_client_1.expectString,
609
+ });
610
+ Object.assign(contents, doc);
622
611
  const exception = new models_0_1.ThrottlingException({
623
612
  $metadata: deserializeMetadata(parsedOutput),
624
613
  ...contents,
@@ -626,136 +615,18 @@ const de_ThrottlingExceptionRes = async (parsedOutput, context) => {
626
615
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
627
616
  };
628
617
  const de_ValidationExceptionRes = async (parsedOutput, context) => {
629
- const contents = map({});
618
+ const contents = (0, smithy_client_1.map)({});
630
619
  const data = parsedOutput.body;
631
- if (data.Message != null) {
632
- contents.Message = (0, smithy_client_1.expectString)(data.Message);
633
- }
620
+ const doc = (0, smithy_client_1.take)(data, {
621
+ Message: smithy_client_1.expectString,
622
+ });
623
+ Object.assign(contents, doc);
634
624
  const exception = new models_0_1.ValidationException({
635
625
  $metadata: deserializeMetadata(parsedOutput),
636
626
  ...contents,
637
627
  });
638
628
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
639
629
  };
640
- const se_AttachmentIdList = (input, context) => {
641
- return input
642
- .filter((e) => e != null)
643
- .map((entry) => {
644
- return entry;
645
- });
646
- };
647
- const se_ConnectionTypeList = (input, context) => {
648
- return input
649
- .filter((e) => e != null)
650
- .map((entry) => {
651
- return entry;
652
- });
653
- };
654
- const se_StartPosition = (input, context) => {
655
- return {
656
- ...(input.AbsoluteTime != null && { AbsoluteTime: input.AbsoluteTime }),
657
- ...(input.Id != null && { Id: input.Id }),
658
- ...(input.MostRecent != null && { MostRecent: input.MostRecent }),
659
- };
660
- };
661
- const de_AttachmentItem = (output, context) => {
662
- return {
663
- AttachmentId: (0, smithy_client_1.expectString)(output.AttachmentId),
664
- AttachmentName: (0, smithy_client_1.expectString)(output.AttachmentName),
665
- ContentType: (0, smithy_client_1.expectString)(output.ContentType),
666
- Status: (0, smithy_client_1.expectString)(output.Status),
667
- };
668
- };
669
- const de_Attachments = (output, context) => {
670
- const retVal = (output || [])
671
- .filter((e) => e != null)
672
- .map((entry) => {
673
- if (entry === null) {
674
- return null;
675
- }
676
- return de_AttachmentItem(entry, context);
677
- });
678
- return retVal;
679
- };
680
- const de_ConnectionCredentials = (output, context) => {
681
- return {
682
- ConnectionToken: (0, smithy_client_1.expectString)(output.ConnectionToken),
683
- Expiry: (0, smithy_client_1.expectString)(output.Expiry),
684
- };
685
- };
686
- const de_Item = (output, context) => {
687
- return {
688
- AbsoluteTime: (0, smithy_client_1.expectString)(output.AbsoluteTime),
689
- Attachments: output.Attachments != null ? de_Attachments(output.Attachments, context) : undefined,
690
- ContactId: (0, smithy_client_1.expectString)(output.ContactId),
691
- Content: (0, smithy_client_1.expectString)(output.Content),
692
- ContentType: (0, smithy_client_1.expectString)(output.ContentType),
693
- DisplayName: (0, smithy_client_1.expectString)(output.DisplayName),
694
- Id: (0, smithy_client_1.expectString)(output.Id),
695
- MessageMetadata: output.MessageMetadata != null ? de_MessageMetadata(output.MessageMetadata, context) : undefined,
696
- ParticipantId: (0, smithy_client_1.expectString)(output.ParticipantId),
697
- ParticipantRole: (0, smithy_client_1.expectString)(output.ParticipantRole),
698
- RelatedContactId: (0, smithy_client_1.expectString)(output.RelatedContactId),
699
- Type: (0, smithy_client_1.expectString)(output.Type),
700
- };
701
- };
702
- const de_MessageMetadata = (output, context) => {
703
- return {
704
- MessageId: (0, smithy_client_1.expectString)(output.MessageId),
705
- Receipts: output.Receipts != null ? de_Receipts(output.Receipts, context) : undefined,
706
- };
707
- };
708
- const de_Receipt = (output, context) => {
709
- return {
710
- DeliveredTimestamp: (0, smithy_client_1.expectString)(output.DeliveredTimestamp),
711
- ReadTimestamp: (0, smithy_client_1.expectString)(output.ReadTimestamp),
712
- RecipientParticipantId: (0, smithy_client_1.expectString)(output.RecipientParticipantId),
713
- };
714
- };
715
- const de_Receipts = (output, context) => {
716
- const retVal = (output || [])
717
- .filter((e) => e != null)
718
- .map((entry) => {
719
- if (entry === null) {
720
- return null;
721
- }
722
- return de_Receipt(entry, context);
723
- });
724
- return retVal;
725
- };
726
- const de_Transcript = (output, context) => {
727
- const retVal = (output || [])
728
- .filter((e) => e != null)
729
- .map((entry) => {
730
- if (entry === null) {
731
- return null;
732
- }
733
- return de_Item(entry, context);
734
- });
735
- return retVal;
736
- };
737
- const de_UploadMetadata = (output, context) => {
738
- return {
739
- HeadersToInclude: output.HeadersToInclude != null ? de_UploadMetadataSignedHeaders(output.HeadersToInclude, context) : undefined,
740
- Url: (0, smithy_client_1.expectString)(output.Url),
741
- UrlExpiry: (0, smithy_client_1.expectString)(output.UrlExpiry),
742
- };
743
- };
744
- const de_UploadMetadataSignedHeaders = (output, context) => {
745
- return Object.entries(output).reduce((acc, [key, value]) => {
746
- if (value === null) {
747
- return acc;
748
- }
749
- acc[key] = (0, smithy_client_1.expectString)(value);
750
- return acc;
751
- }, {});
752
- };
753
- const de_Websocket = (output, context) => {
754
- return {
755
- ConnectionExpiry: (0, smithy_client_1.expectString)(output.ConnectionExpiry),
756
- Url: (0, smithy_client_1.expectString)(output.Url),
757
- };
758
- };
759
630
  const deserializeMetadata = (output) => ({
760
631
  httpStatusCode: output.statusCode,
761
632
  requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
@@ -1,5 +1,5 @@
1
1
  import { HttpRequest as __HttpRequest } from "@aws-sdk/protocol-http";
2
- import { decorateServiceException as __decorateServiceException, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, map as __map, throwDefaultError, } from "@aws-sdk/smithy-client";
2
+ import { _json, decorateServiceException as __decorateServiceException, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, map, take, withBaseException, } from "@aws-sdk/smithy-client";
3
3
  import { v4 as generateIdempotencyToken } from "uuid";
4
4
  import { ConnectParticipantServiceException as __BaseException } from "../models/ConnectParticipantServiceException";
5
5
  import { AccessDeniedException, ConflictException, InternalServerException, ServiceQuotaExceededException, ThrottlingException, ValidationException, } from "../models/models_0";
@@ -11,10 +11,10 @@ export const se_CompleteAttachmentUploadCommand = async (input, context) => {
11
11
  });
12
12
  const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/participant/complete-attachment-upload";
13
13
  let body;
14
- body = JSON.stringify({
15
- ...(input.AttachmentIds != null && { AttachmentIds: se_AttachmentIdList(input.AttachmentIds, context) }),
16
- ClientToken: input.ClientToken ?? generateIdempotencyToken(),
17
- });
14
+ body = JSON.stringify(take(input, {
15
+ AttachmentIds: (_) => _json(_),
16
+ ClientToken: (_) => _ ?? generateIdempotencyToken(),
17
+ }));
18
18
  return new __HttpRequest({
19
19
  protocol,
20
20
  hostname,
@@ -33,10 +33,10 @@ export const se_CreateParticipantConnectionCommand = async (input, context) => {
33
33
  });
34
34
  const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/participant/connection";
35
35
  let body;
36
- body = JSON.stringify({
37
- ...(input.ConnectParticipant != null && { ConnectParticipant: input.ConnectParticipant }),
38
- ...(input.Type != null && { Type: se_ConnectionTypeList(input.Type, context) }),
39
- });
36
+ body = JSON.stringify(take(input, {
37
+ ConnectParticipant: [],
38
+ Type: (_) => _json(_),
39
+ }));
40
40
  return new __HttpRequest({
41
41
  protocol,
42
42
  hostname,
@@ -55,9 +55,9 @@ export const se_DisconnectParticipantCommand = async (input, context) => {
55
55
  });
56
56
  const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/participant/disconnect";
57
57
  let body;
58
- body = JSON.stringify({
59
- ClientToken: input.ClientToken ?? generateIdempotencyToken(),
60
- });
58
+ body = JSON.stringify(take(input, {
59
+ ClientToken: (_) => _ ?? generateIdempotencyToken(),
60
+ }));
61
61
  return new __HttpRequest({
62
62
  protocol,
63
63
  hostname,
@@ -76,9 +76,9 @@ export const se_GetAttachmentCommand = async (input, context) => {
76
76
  });
77
77
  const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/participant/attachment";
78
78
  let body;
79
- body = JSON.stringify({
80
- ...(input.AttachmentId != null && { AttachmentId: input.AttachmentId }),
81
- });
79
+ body = JSON.stringify(take(input, {
80
+ AttachmentId: [],
81
+ }));
82
82
  return new __HttpRequest({
83
83
  protocol,
84
84
  hostname,
@@ -97,14 +97,14 @@ export const se_GetTranscriptCommand = async (input, context) => {
97
97
  });
98
98
  const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/participant/transcript";
99
99
  let body;
100
- body = JSON.stringify({
101
- ...(input.ContactId != null && { ContactId: input.ContactId }),
102
- ...(input.MaxResults != null && { MaxResults: input.MaxResults }),
103
- ...(input.NextToken != null && { NextToken: input.NextToken }),
104
- ...(input.ScanDirection != null && { ScanDirection: input.ScanDirection }),
105
- ...(input.SortOrder != null && { SortOrder: input.SortOrder }),
106
- ...(input.StartPosition != null && { StartPosition: se_StartPosition(input.StartPosition, context) }),
107
- });
100
+ body = JSON.stringify(take(input, {
101
+ ContactId: [],
102
+ MaxResults: [],
103
+ NextToken: [],
104
+ ScanDirection: [],
105
+ SortOrder: [],
106
+ StartPosition: (_) => _json(_),
107
+ }));
108
108
  return new __HttpRequest({
109
109
  protocol,
110
110
  hostname,
@@ -123,11 +123,11 @@ export const se_SendEventCommand = async (input, context) => {
123
123
  });
124
124
  const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/participant/event";
125
125
  let body;
126
- body = JSON.stringify({
127
- ClientToken: input.ClientToken ?? generateIdempotencyToken(),
128
- ...(input.Content != null && { Content: input.Content }),
129
- ...(input.ContentType != null && { ContentType: input.ContentType }),
130
- });
126
+ body = JSON.stringify(take(input, {
127
+ ClientToken: (_) => _ ?? generateIdempotencyToken(),
128
+ Content: [],
129
+ ContentType: [],
130
+ }));
131
131
  return new __HttpRequest({
132
132
  protocol,
133
133
  hostname,
@@ -146,11 +146,11 @@ export const se_SendMessageCommand = async (input, context) => {
146
146
  });
147
147
  const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/participant/message";
148
148
  let body;
149
- body = JSON.stringify({
150
- ClientToken: input.ClientToken ?? generateIdempotencyToken(),
151
- ...(input.Content != null && { Content: input.Content }),
152
- ...(input.ContentType != null && { ContentType: input.ContentType }),
153
- });
149
+ body = JSON.stringify(take(input, {
150
+ ClientToken: (_) => _ ?? generateIdempotencyToken(),
151
+ Content: [],
152
+ ContentType: [],
153
+ }));
154
154
  return new __HttpRequest({
155
155
  protocol,
156
156
  hostname,
@@ -169,12 +169,12 @@ export const se_StartAttachmentUploadCommand = async (input, context) => {
169
169
  });
170
170
  const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/participant/start-attachment-upload";
171
171
  let body;
172
- body = JSON.stringify({
173
- ...(input.AttachmentName != null && { AttachmentName: input.AttachmentName }),
174
- ...(input.AttachmentSizeInBytes != null && { AttachmentSizeInBytes: input.AttachmentSizeInBytes }),
175
- ClientToken: input.ClientToken ?? generateIdempotencyToken(),
176
- ...(input.ContentType != null && { ContentType: input.ContentType }),
177
- });
172
+ body = JSON.stringify(take(input, {
173
+ AttachmentName: [],
174
+ AttachmentSizeInBytes: [],
175
+ ClientToken: (_) => _ ?? generateIdempotencyToken(),
176
+ ContentType: [],
177
+ }));
178
178
  return new __HttpRequest({
179
179
  protocol,
180
180
  hostname,
@@ -222,10 +222,9 @@ const de_CompleteAttachmentUploadCommandError = async (output, context) => {
222
222
  throw await de_ValidationExceptionRes(parsedOutput, context);
223
223
  default:
224
224
  const parsedBody = parsedOutput.body;
225
- throwDefaultError({
225
+ return throwDefaultError({
226
226
  output,
227
227
  parsedBody,
228
- exceptionCtor: __BaseException,
229
228
  errorCode,
230
229
  });
231
230
  }
@@ -238,12 +237,11 @@ export const de_CreateParticipantConnectionCommand = async (output, context) =>
238
237
  $metadata: deserializeMetadata(output),
239
238
  });
240
239
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
241
- if (data.ConnectionCredentials != null) {
242
- contents.ConnectionCredentials = de_ConnectionCredentials(data.ConnectionCredentials, context);
243
- }
244
- if (data.Websocket != null) {
245
- contents.Websocket = de_Websocket(data.Websocket, context);
246
- }
240
+ const doc = take(data, {
241
+ ConnectionCredentials: _json,
242
+ Websocket: _json,
243
+ });
244
+ Object.assign(contents, doc);
247
245
  return contents;
248
246
  };
249
247
  const de_CreateParticipantConnectionCommandError = async (output, context) => {
@@ -267,10 +265,9 @@ const de_CreateParticipantConnectionCommandError = async (output, context) => {
267
265
  throw await de_ValidationExceptionRes(parsedOutput, context);
268
266
  default:
269
267
  const parsedBody = parsedOutput.body;
270
- throwDefaultError({
268
+ return throwDefaultError({
271
269
  output,
272
270
  parsedBody,
273
- exceptionCtor: __BaseException,
274
271
  errorCode,
275
272
  });
276
273
  }
@@ -306,10 +303,9 @@ const de_DisconnectParticipantCommandError = async (output, context) => {
306
303
  throw await de_ValidationExceptionRes(parsedOutput, context);
307
304
  default:
308
305
  const parsedBody = parsedOutput.body;
309
- throwDefaultError({
306
+ return throwDefaultError({
310
307
  output,
311
308
  parsedBody,
312
- exceptionCtor: __BaseException,
313
309
  errorCode,
314
310
  });
315
311
  }
@@ -322,12 +318,11 @@ export const de_GetAttachmentCommand = async (output, context) => {
322
318
  $metadata: deserializeMetadata(output),
323
319
  });
324
320
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
325
- if (data.Url != null) {
326
- contents.Url = __expectString(data.Url);
327
- }
328
- if (data.UrlExpiry != null) {
329
- contents.UrlExpiry = __expectString(data.UrlExpiry);
330
- }
321
+ const doc = take(data, {
322
+ Url: __expectString,
323
+ UrlExpiry: __expectString,
324
+ });
325
+ Object.assign(contents, doc);
331
326
  return contents;
332
327
  };
333
328
  const de_GetAttachmentCommandError = async (output, context) => {
@@ -351,10 +346,9 @@ const de_GetAttachmentCommandError = async (output, context) => {
351
346
  throw await de_ValidationExceptionRes(parsedOutput, context);
352
347
  default:
353
348
  const parsedBody = parsedOutput.body;
354
- throwDefaultError({
349
+ return throwDefaultError({
355
350
  output,
356
351
  parsedBody,
357
- exceptionCtor: __BaseException,
358
352
  errorCode,
359
353
  });
360
354
  }
@@ -367,15 +361,12 @@ export const de_GetTranscriptCommand = async (output, context) => {
367
361
  $metadata: deserializeMetadata(output),
368
362
  });
369
363
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
370
- if (data.InitialContactId != null) {
371
- contents.InitialContactId = __expectString(data.InitialContactId);
372
- }
373
- if (data.NextToken != null) {
374
- contents.NextToken = __expectString(data.NextToken);
375
- }
376
- if (data.Transcript != null) {
377
- contents.Transcript = de_Transcript(data.Transcript, context);
378
- }
364
+ const doc = take(data, {
365
+ InitialContactId: __expectString,
366
+ NextToken: __expectString,
367
+ Transcript: _json,
368
+ });
369
+ Object.assign(contents, doc);
379
370
  return contents;
380
371
  };
381
372
  const de_GetTranscriptCommandError = async (output, context) => {
@@ -399,10 +390,9 @@ const de_GetTranscriptCommandError = async (output, context) => {
399
390
  throw await de_ValidationExceptionRes(parsedOutput, context);
400
391
  default:
401
392
  const parsedBody = parsedOutput.body;
402
- throwDefaultError({
393
+ return throwDefaultError({
403
394
  output,
404
395
  parsedBody,
405
- exceptionCtor: __BaseException,
406
396
  errorCode,
407
397
  });
408
398
  }
@@ -415,12 +405,11 @@ export const de_SendEventCommand = async (output, context) => {
415
405
  $metadata: deserializeMetadata(output),
416
406
  });
417
407
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
418
- if (data.AbsoluteTime != null) {
419
- contents.AbsoluteTime = __expectString(data.AbsoluteTime);
420
- }
421
- if (data.Id != null) {
422
- contents.Id = __expectString(data.Id);
423
- }
408
+ const doc = take(data, {
409
+ AbsoluteTime: __expectString,
410
+ Id: __expectString,
411
+ });
412
+ Object.assign(contents, doc);
424
413
  return contents;
425
414
  };
426
415
  const de_SendEventCommandError = async (output, context) => {
@@ -444,10 +433,9 @@ const de_SendEventCommandError = async (output, context) => {
444
433
  throw await de_ValidationExceptionRes(parsedOutput, context);
445
434
  default:
446
435
  const parsedBody = parsedOutput.body;
447
- throwDefaultError({
436
+ return throwDefaultError({
448
437
  output,
449
438
  parsedBody,
450
- exceptionCtor: __BaseException,
451
439
  errorCode,
452
440
  });
453
441
  }
@@ -460,12 +448,11 @@ export const de_SendMessageCommand = async (output, context) => {
460
448
  $metadata: deserializeMetadata(output),
461
449
  });
462
450
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
463
- if (data.AbsoluteTime != null) {
464
- contents.AbsoluteTime = __expectString(data.AbsoluteTime);
465
- }
466
- if (data.Id != null) {
467
- contents.Id = __expectString(data.Id);
468
- }
451
+ const doc = take(data, {
452
+ AbsoluteTime: __expectString,
453
+ Id: __expectString,
454
+ });
455
+ Object.assign(contents, doc);
469
456
  return contents;
470
457
  };
471
458
  const de_SendMessageCommandError = async (output, context) => {
@@ -489,10 +476,9 @@ const de_SendMessageCommandError = async (output, context) => {
489
476
  throw await de_ValidationExceptionRes(parsedOutput, context);
490
477
  default:
491
478
  const parsedBody = parsedOutput.body;
492
- throwDefaultError({
479
+ return throwDefaultError({
493
480
  output,
494
481
  parsedBody,
495
- exceptionCtor: __BaseException,
496
482
  errorCode,
497
483
  });
498
484
  }
@@ -505,12 +491,11 @@ export const de_StartAttachmentUploadCommand = async (output, context) => {
505
491
  $metadata: deserializeMetadata(output),
506
492
  });
507
493
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
508
- if (data.AttachmentId != null) {
509
- contents.AttachmentId = __expectString(data.AttachmentId);
510
- }
511
- if (data.UploadMetadata != null) {
512
- contents.UploadMetadata = de_UploadMetadata(data.UploadMetadata, context);
513
- }
494
+ const doc = take(data, {
495
+ AttachmentId: __expectString,
496
+ UploadMetadata: _json,
497
+ });
498
+ Object.assign(contents, doc);
514
499
  return contents;
515
500
  };
516
501
  const de_StartAttachmentUploadCommandError = async (output, context) => {
@@ -537,21 +522,21 @@ const de_StartAttachmentUploadCommandError = async (output, context) => {
537
522
  throw await de_ValidationExceptionRes(parsedOutput, context);
538
523
  default:
539
524
  const parsedBody = parsedOutput.body;
540
- throwDefaultError({
525
+ return throwDefaultError({
541
526
  output,
542
527
  parsedBody,
543
- exceptionCtor: __BaseException,
544
528
  errorCode,
545
529
  });
546
530
  }
547
531
  };
548
- const map = __map;
532
+ const throwDefaultError = withBaseException(__BaseException);
549
533
  const de_AccessDeniedExceptionRes = async (parsedOutput, context) => {
550
534
  const contents = map({});
551
535
  const data = parsedOutput.body;
552
- if (data.Message != null) {
553
- contents.Message = __expectString(data.Message);
554
- }
536
+ const doc = take(data, {
537
+ Message: __expectString,
538
+ });
539
+ Object.assign(contents, doc);
555
540
  const exception = new AccessDeniedException({
556
541
  $metadata: deserializeMetadata(parsedOutput),
557
542
  ...contents,
@@ -561,9 +546,10 @@ const de_AccessDeniedExceptionRes = async (parsedOutput, context) => {
561
546
  const de_ConflictExceptionRes = async (parsedOutput, context) => {
562
547
  const contents = map({});
563
548
  const data = parsedOutput.body;
564
- if (data.Message != null) {
565
- contents.Message = __expectString(data.Message);
566
- }
549
+ const doc = take(data, {
550
+ Message: __expectString,
551
+ });
552
+ Object.assign(contents, doc);
567
553
  const exception = new ConflictException({
568
554
  $metadata: deserializeMetadata(parsedOutput),
569
555
  ...contents,
@@ -573,9 +559,10 @@ const de_ConflictExceptionRes = async (parsedOutput, context) => {
573
559
  const de_InternalServerExceptionRes = async (parsedOutput, context) => {
574
560
  const contents = map({});
575
561
  const data = parsedOutput.body;
576
- if (data.Message != null) {
577
- contents.Message = __expectString(data.Message);
578
- }
562
+ const doc = take(data, {
563
+ Message: __expectString,
564
+ });
565
+ Object.assign(contents, doc);
579
566
  const exception = new InternalServerException({
580
567
  $metadata: deserializeMetadata(parsedOutput),
581
568
  ...contents,
@@ -585,9 +572,10 @@ const de_InternalServerExceptionRes = async (parsedOutput, context) => {
585
572
  const de_ServiceQuotaExceededExceptionRes = async (parsedOutput, context) => {
586
573
  const contents = map({});
587
574
  const data = parsedOutput.body;
588
- if (data.Message != null) {
589
- contents.Message = __expectString(data.Message);
590
- }
575
+ const doc = take(data, {
576
+ Message: __expectString,
577
+ });
578
+ Object.assign(contents, doc);
591
579
  const exception = new ServiceQuotaExceededException({
592
580
  $metadata: deserializeMetadata(parsedOutput),
593
581
  ...contents,
@@ -597,9 +585,10 @@ const de_ServiceQuotaExceededExceptionRes = async (parsedOutput, context) => {
597
585
  const de_ThrottlingExceptionRes = async (parsedOutput, context) => {
598
586
  const contents = map({});
599
587
  const data = parsedOutput.body;
600
- if (data.Message != null) {
601
- contents.Message = __expectString(data.Message);
602
- }
588
+ const doc = take(data, {
589
+ Message: __expectString,
590
+ });
591
+ Object.assign(contents, doc);
603
592
  const exception = new ThrottlingException({
604
593
  $metadata: deserializeMetadata(parsedOutput),
605
594
  ...contents,
@@ -609,134 +598,16 @@ const de_ThrottlingExceptionRes = async (parsedOutput, context) => {
609
598
  const de_ValidationExceptionRes = async (parsedOutput, context) => {
610
599
  const contents = map({});
611
600
  const data = parsedOutput.body;
612
- if (data.Message != null) {
613
- contents.Message = __expectString(data.Message);
614
- }
601
+ const doc = take(data, {
602
+ Message: __expectString,
603
+ });
604
+ Object.assign(contents, doc);
615
605
  const exception = new ValidationException({
616
606
  $metadata: deserializeMetadata(parsedOutput),
617
607
  ...contents,
618
608
  });
619
609
  return __decorateServiceException(exception, parsedOutput.body);
620
610
  };
621
- const se_AttachmentIdList = (input, context) => {
622
- return input
623
- .filter((e) => e != null)
624
- .map((entry) => {
625
- return entry;
626
- });
627
- };
628
- const se_ConnectionTypeList = (input, context) => {
629
- return input
630
- .filter((e) => e != null)
631
- .map((entry) => {
632
- return entry;
633
- });
634
- };
635
- const se_StartPosition = (input, context) => {
636
- return {
637
- ...(input.AbsoluteTime != null && { AbsoluteTime: input.AbsoluteTime }),
638
- ...(input.Id != null && { Id: input.Id }),
639
- ...(input.MostRecent != null && { MostRecent: input.MostRecent }),
640
- };
641
- };
642
- const de_AttachmentItem = (output, context) => {
643
- return {
644
- AttachmentId: __expectString(output.AttachmentId),
645
- AttachmentName: __expectString(output.AttachmentName),
646
- ContentType: __expectString(output.ContentType),
647
- Status: __expectString(output.Status),
648
- };
649
- };
650
- const de_Attachments = (output, context) => {
651
- const retVal = (output || [])
652
- .filter((e) => e != null)
653
- .map((entry) => {
654
- if (entry === null) {
655
- return null;
656
- }
657
- return de_AttachmentItem(entry, context);
658
- });
659
- return retVal;
660
- };
661
- const de_ConnectionCredentials = (output, context) => {
662
- return {
663
- ConnectionToken: __expectString(output.ConnectionToken),
664
- Expiry: __expectString(output.Expiry),
665
- };
666
- };
667
- const de_Item = (output, context) => {
668
- return {
669
- AbsoluteTime: __expectString(output.AbsoluteTime),
670
- Attachments: output.Attachments != null ? de_Attachments(output.Attachments, context) : undefined,
671
- ContactId: __expectString(output.ContactId),
672
- Content: __expectString(output.Content),
673
- ContentType: __expectString(output.ContentType),
674
- DisplayName: __expectString(output.DisplayName),
675
- Id: __expectString(output.Id),
676
- MessageMetadata: output.MessageMetadata != null ? de_MessageMetadata(output.MessageMetadata, context) : undefined,
677
- ParticipantId: __expectString(output.ParticipantId),
678
- ParticipantRole: __expectString(output.ParticipantRole),
679
- RelatedContactId: __expectString(output.RelatedContactId),
680
- Type: __expectString(output.Type),
681
- };
682
- };
683
- const de_MessageMetadata = (output, context) => {
684
- return {
685
- MessageId: __expectString(output.MessageId),
686
- Receipts: output.Receipts != null ? de_Receipts(output.Receipts, context) : undefined,
687
- };
688
- };
689
- const de_Receipt = (output, context) => {
690
- return {
691
- DeliveredTimestamp: __expectString(output.DeliveredTimestamp),
692
- ReadTimestamp: __expectString(output.ReadTimestamp),
693
- RecipientParticipantId: __expectString(output.RecipientParticipantId),
694
- };
695
- };
696
- const de_Receipts = (output, context) => {
697
- const retVal = (output || [])
698
- .filter((e) => e != null)
699
- .map((entry) => {
700
- if (entry === null) {
701
- return null;
702
- }
703
- return de_Receipt(entry, context);
704
- });
705
- return retVal;
706
- };
707
- const de_Transcript = (output, context) => {
708
- const retVal = (output || [])
709
- .filter((e) => e != null)
710
- .map((entry) => {
711
- if (entry === null) {
712
- return null;
713
- }
714
- return de_Item(entry, context);
715
- });
716
- return retVal;
717
- };
718
- const de_UploadMetadata = (output, context) => {
719
- return {
720
- HeadersToInclude: output.HeadersToInclude != null ? de_UploadMetadataSignedHeaders(output.HeadersToInclude, context) : undefined,
721
- Url: __expectString(output.Url),
722
- UrlExpiry: __expectString(output.UrlExpiry),
723
- };
724
- };
725
- const de_UploadMetadataSignedHeaders = (output, context) => {
726
- return Object.entries(output).reduce((acc, [key, value]) => {
727
- if (value === null) {
728
- return acc;
729
- }
730
- acc[key] = __expectString(value);
731
- return acc;
732
- }, {});
733
- };
734
- const de_Websocket = (output, context) => {
735
- return {
736
- ConnectionExpiry: __expectString(output.ConnectionExpiry),
737
- Url: __expectString(output.Url),
738
- };
739
- };
740
611
  const deserializeMetadata = (output) => ({
741
612
  httpStatusCode: output.statusCode,
742
613
  requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
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.312.0",
4
+ "version": "3.315.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",
@@ -21,9 +21,9 @@
21
21
  "dependencies": {
22
22
  "@aws-crypto/sha256-browser": "3.0.0",
23
23
  "@aws-crypto/sha256-js": "3.0.0",
24
- "@aws-sdk/client-sts": "3.312.0",
24
+ "@aws-sdk/client-sts": "3.315.0",
25
25
  "@aws-sdk/config-resolver": "3.310.0",
26
- "@aws-sdk/credential-provider-node": "3.310.0",
26
+ "@aws-sdk/credential-provider-node": "3.315.0",
27
27
  "@aws-sdk/fetch-http-handler": "3.310.0",
28
28
  "@aws-sdk/hash-node": "3.310.0",
29
29
  "@aws-sdk/invalid-dependency": "3.310.0",
@@ -40,14 +40,14 @@
40
40
  "@aws-sdk/node-config-provider": "3.310.0",
41
41
  "@aws-sdk/node-http-handler": "3.310.0",
42
42
  "@aws-sdk/protocol-http": "3.310.0",
43
- "@aws-sdk/smithy-client": "3.310.0",
43
+ "@aws-sdk/smithy-client": "3.315.0",
44
44
  "@aws-sdk/types": "3.310.0",
45
45
  "@aws-sdk/url-parser": "3.310.0",
46
46
  "@aws-sdk/util-base64": "3.310.0",
47
47
  "@aws-sdk/util-body-length-browser": "3.310.0",
48
48
  "@aws-sdk/util-body-length-node": "3.310.0",
49
- "@aws-sdk/util-defaults-mode-browser": "3.310.0",
50
- "@aws-sdk/util-defaults-mode-node": "3.310.0",
49
+ "@aws-sdk/util-defaults-mode-browser": "3.315.0",
50
+ "@aws-sdk/util-defaults-mode-node": "3.315.0",
51
51
  "@aws-sdk/util-endpoints": "3.310.0",
52
52
  "@aws-sdk/util-retry": "3.310.0",
53
53
  "@aws-sdk/util-user-agent-browser": "3.310.0",