@aws-sdk/client-iot-data-plane 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.
@@ -10,7 +10,7 @@ const se_DeleteThingShadowCommand = async (input, context) => {
10
10
  const headers = {};
11
11
  let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/things/{thingName}/shadow";
12
12
  resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "thingName", () => input.thingName, "{thingName}", false);
13
- const query = map({
13
+ const query = (0, smithy_client_1.map)({
14
14
  name: [, input.shadowName],
15
15
  });
16
16
  let body;
@@ -48,7 +48,7 @@ const se_GetThingShadowCommand = async (input, context) => {
48
48
  const headers = {};
49
49
  let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/things/{thingName}/shadow";
50
50
  resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "thingName", () => input.thingName, "{thingName}", false);
51
- const query = map({
51
+ const query = (0, smithy_client_1.map)({
52
52
  name: [, input.shadowName],
53
53
  });
54
54
  let body;
@@ -70,7 +70,7 @@ const se_ListNamedShadowsForThingCommand = async (input, context) => {
70
70
  let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
71
71
  "/api/things/shadow/ListNamedShadowsForThing/{thingName}";
72
72
  resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "thingName", () => input.thingName, "{thingName}", false);
73
- const query = map({
73
+ const query = (0, smithy_client_1.map)({
74
74
  nextToken: [, input.nextToken],
75
75
  pageSize: [() => input.pageSize !== void 0, () => input.pageSize.toString()],
76
76
  });
@@ -91,7 +91,7 @@ const se_ListRetainedMessagesCommand = async (input, context) => {
91
91
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
92
92
  const headers = {};
93
93
  const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/retainedMessage";
94
- const query = map({
94
+ const query = (0, smithy_client_1.map)({
95
95
  nextToken: [, input.nextToken],
96
96
  maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
97
97
  });
@@ -110,7 +110,7 @@ const se_ListRetainedMessagesCommand = async (input, context) => {
110
110
  exports.se_ListRetainedMessagesCommand = se_ListRetainedMessagesCommand;
111
111
  const se_PublishCommand = async (input, context) => {
112
112
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
113
- const headers = map({}, isSerializableHeaderValue, {
113
+ const headers = (0, smithy_client_1.map)({}, isSerializableHeaderValue, {
114
114
  "content-type": "application/octet-stream",
115
115
  "x-amz-mqtt5-user-properties": [
116
116
  () => isSerializableHeaderValue(input.userProperties),
@@ -121,7 +121,7 @@ const se_PublishCommand = async (input, context) => {
121
121
  });
122
122
  let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/topics/{topic}";
123
123
  resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "topic", () => input.topic, "{topic}", false);
124
- const query = map({
124
+ const query = (0, smithy_client_1.map)({
125
125
  qos: [() => input.qos !== void 0, () => input.qos.toString()],
126
126
  retain: [() => input.retain !== void 0, () => input.retain.toString()],
127
127
  contentType: [, input.contentType],
@@ -151,7 +151,7 @@ const se_UpdateThingShadowCommand = async (input, context) => {
151
151
  };
152
152
  let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/things/{thingName}/shadow";
153
153
  resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "thingName", () => input.thingName, "{thingName}", false);
154
- const query = map({
154
+ const query = (0, smithy_client_1.map)({
155
155
  name: [, input.shadowName],
156
156
  });
157
157
  let body;
@@ -174,7 +174,7 @@ const de_DeleteThingShadowCommand = async (output, context) => {
174
174
  if (output.statusCode !== 200 && output.statusCode >= 300) {
175
175
  return de_DeleteThingShadowCommandError(output, context);
176
176
  }
177
- const contents = map({
177
+ const contents = (0, smithy_client_1.map)({
178
178
  $metadata: deserializeMetadata(output),
179
179
  });
180
180
  const data = await collectBody(output.body, context);
@@ -215,10 +215,9 @@ const de_DeleteThingShadowCommandError = async (output, context) => {
215
215
  throw await de_UnsupportedDocumentEncodingExceptionRes(parsedOutput, context);
216
216
  default:
217
217
  const parsedBody = parsedOutput.body;
218
- (0, smithy_client_1.throwDefaultError)({
218
+ return throwDefaultError({
219
219
  output,
220
220
  parsedBody,
221
- exceptionCtor: IoTDataPlaneServiceException_1.IoTDataPlaneServiceException,
222
221
  errorCode,
223
222
  });
224
223
  }
@@ -227,25 +226,18 @@ const de_GetRetainedMessageCommand = async (output, context) => {
227
226
  if (output.statusCode !== 200 && output.statusCode >= 300) {
228
227
  return de_GetRetainedMessageCommandError(output, context);
229
228
  }
230
- const contents = map({
229
+ const contents = (0, smithy_client_1.map)({
231
230
  $metadata: deserializeMetadata(output),
232
231
  });
233
232
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
234
- if (data.lastModifiedTime != null) {
235
- contents.lastModifiedTime = (0, smithy_client_1.expectLong)(data.lastModifiedTime);
236
- }
237
- if (data.payload != null) {
238
- contents.payload = context.base64Decoder(data.payload);
239
- }
240
- if (data.qos != null) {
241
- contents.qos = (0, smithy_client_1.expectInt32)(data.qos);
242
- }
243
- if (data.topic != null) {
244
- contents.topic = (0, smithy_client_1.expectString)(data.topic);
245
- }
246
- if (data.userProperties != null) {
247
- contents.userProperties = context.base64Decoder(data.userProperties);
248
- }
233
+ const doc = (0, smithy_client_1.take)(data, {
234
+ lastModifiedTime: smithy_client_1.expectLong,
235
+ payload: context.base64Decoder,
236
+ qos: smithy_client_1.expectInt32,
237
+ topic: smithy_client_1.expectString,
238
+ userProperties: context.base64Decoder,
239
+ });
240
+ Object.assign(contents, doc);
249
241
  return contents;
250
242
  };
251
243
  exports.de_GetRetainedMessageCommand = de_GetRetainedMessageCommand;
@@ -279,10 +271,9 @@ const de_GetRetainedMessageCommandError = async (output, context) => {
279
271
  throw await de_UnauthorizedExceptionRes(parsedOutput, context);
280
272
  default:
281
273
  const parsedBody = parsedOutput.body;
282
- (0, smithy_client_1.throwDefaultError)({
274
+ return throwDefaultError({
283
275
  output,
284
276
  parsedBody,
285
- exceptionCtor: IoTDataPlaneServiceException_1.IoTDataPlaneServiceException,
286
277
  errorCode,
287
278
  });
288
279
  }
@@ -291,7 +282,7 @@ const de_GetThingShadowCommand = async (output, context) => {
291
282
  if (output.statusCode !== 200 && output.statusCode >= 300) {
292
283
  return de_GetThingShadowCommandError(output, context);
293
284
  }
294
- const contents = map({
285
+ const contents = (0, smithy_client_1.map)({
295
286
  $metadata: deserializeMetadata(output),
296
287
  });
297
288
  const data = await collectBody(output.body, context);
@@ -332,10 +323,9 @@ const de_GetThingShadowCommandError = async (output, context) => {
332
323
  throw await de_UnsupportedDocumentEncodingExceptionRes(parsedOutput, context);
333
324
  default:
334
325
  const parsedBody = parsedOutput.body;
335
- (0, smithy_client_1.throwDefaultError)({
326
+ return throwDefaultError({
336
327
  output,
337
328
  parsedBody,
338
- exceptionCtor: IoTDataPlaneServiceException_1.IoTDataPlaneServiceException,
339
329
  errorCode,
340
330
  });
341
331
  }
@@ -344,19 +334,16 @@ const de_ListNamedShadowsForThingCommand = async (output, context) => {
344
334
  if (output.statusCode !== 200 && output.statusCode >= 300) {
345
335
  return de_ListNamedShadowsForThingCommandError(output, context);
346
336
  }
347
- const contents = map({
337
+ const contents = (0, smithy_client_1.map)({
348
338
  $metadata: deserializeMetadata(output),
349
339
  });
350
340
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
351
- if (data.nextToken != null) {
352
- contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
353
- }
354
- if (data.results != null) {
355
- contents.results = de_NamedShadowList(data.results, context);
356
- }
357
- if (data.timestamp != null) {
358
- contents.timestamp = (0, smithy_client_1.expectLong)(data.timestamp);
359
- }
341
+ const doc = (0, smithy_client_1.take)(data, {
342
+ nextToken: smithy_client_1.expectString,
343
+ results: smithy_client_1._json,
344
+ timestamp: smithy_client_1.expectLong,
345
+ });
346
+ Object.assign(contents, doc);
360
347
  return contents;
361
348
  };
362
349
  exports.de_ListNamedShadowsForThingCommand = de_ListNamedShadowsForThingCommand;
@@ -390,10 +377,9 @@ const de_ListNamedShadowsForThingCommandError = async (output, context) => {
390
377
  throw await de_UnauthorizedExceptionRes(parsedOutput, context);
391
378
  default:
392
379
  const parsedBody = parsedOutput.body;
393
- (0, smithy_client_1.throwDefaultError)({
380
+ return throwDefaultError({
394
381
  output,
395
382
  parsedBody,
396
- exceptionCtor: IoTDataPlaneServiceException_1.IoTDataPlaneServiceException,
397
383
  errorCode,
398
384
  });
399
385
  }
@@ -402,16 +388,15 @@ const de_ListRetainedMessagesCommand = async (output, context) => {
402
388
  if (output.statusCode !== 200 && output.statusCode >= 300) {
403
389
  return de_ListRetainedMessagesCommandError(output, context);
404
390
  }
405
- const contents = map({
391
+ const contents = (0, smithy_client_1.map)({
406
392
  $metadata: deserializeMetadata(output),
407
393
  });
408
394
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
409
- if (data.nextToken != null) {
410
- contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
411
- }
412
- if (data.retainedTopics != null) {
413
- contents.retainedTopics = de_RetainedMessageList(data.retainedTopics, context);
414
- }
395
+ const doc = (0, smithy_client_1.take)(data, {
396
+ nextToken: smithy_client_1.expectString,
397
+ retainedTopics: smithy_client_1._json,
398
+ });
399
+ Object.assign(contents, doc);
415
400
  return contents;
416
401
  };
417
402
  exports.de_ListRetainedMessagesCommand = de_ListRetainedMessagesCommand;
@@ -442,10 +427,9 @@ const de_ListRetainedMessagesCommandError = async (output, context) => {
442
427
  throw await de_UnauthorizedExceptionRes(parsedOutput, context);
443
428
  default:
444
429
  const parsedBody = parsedOutput.body;
445
- (0, smithy_client_1.throwDefaultError)({
430
+ return throwDefaultError({
446
431
  output,
447
432
  parsedBody,
448
- exceptionCtor: IoTDataPlaneServiceException_1.IoTDataPlaneServiceException,
449
433
  errorCode,
450
434
  });
451
435
  }
@@ -454,7 +438,7 @@ const de_PublishCommand = async (output, context) => {
454
438
  if (output.statusCode !== 200 && output.statusCode >= 300) {
455
439
  return de_PublishCommandError(output, context);
456
440
  }
457
- const contents = map({
441
+ const contents = (0, smithy_client_1.map)({
458
442
  $metadata: deserializeMetadata(output),
459
443
  });
460
444
  await collectBody(output.body, context);
@@ -485,10 +469,9 @@ const de_PublishCommandError = async (output, context) => {
485
469
  throw await de_UnauthorizedExceptionRes(parsedOutput, context);
486
470
  default:
487
471
  const parsedBody = parsedOutput.body;
488
- (0, smithy_client_1.throwDefaultError)({
472
+ return throwDefaultError({
489
473
  output,
490
474
  parsedBody,
491
- exceptionCtor: IoTDataPlaneServiceException_1.IoTDataPlaneServiceException,
492
475
  errorCode,
493
476
  });
494
477
  }
@@ -497,7 +480,7 @@ const de_UpdateThingShadowCommand = async (output, context) => {
497
480
  if (output.statusCode !== 200 && output.statusCode >= 300) {
498
481
  return de_UpdateThingShadowCommandError(output, context);
499
482
  }
500
- const contents = map({
483
+ const contents = (0, smithy_client_1.map)({
501
484
  $metadata: deserializeMetadata(output),
502
485
  });
503
486
  const data = await collectBody(output.body, context);
@@ -541,21 +524,21 @@ const de_UpdateThingShadowCommandError = async (output, context) => {
541
524
  throw await de_UnsupportedDocumentEncodingExceptionRes(parsedOutput, context);
542
525
  default:
543
526
  const parsedBody = parsedOutput.body;
544
- (0, smithy_client_1.throwDefaultError)({
527
+ return throwDefaultError({
545
528
  output,
546
529
  parsedBody,
547
- exceptionCtor: IoTDataPlaneServiceException_1.IoTDataPlaneServiceException,
548
530
  errorCode,
549
531
  });
550
532
  }
551
533
  };
552
- const map = smithy_client_1.map;
534
+ const throwDefaultError = (0, smithy_client_1.withBaseException)(IoTDataPlaneServiceException_1.IoTDataPlaneServiceException);
553
535
  const de_ConflictExceptionRes = async (parsedOutput, context) => {
554
- const contents = map({});
536
+ const contents = (0, smithy_client_1.map)({});
555
537
  const data = parsedOutput.body;
556
- if (data.message != null) {
557
- contents.message = (0, smithy_client_1.expectString)(data.message);
558
- }
538
+ const doc = (0, smithy_client_1.take)(data, {
539
+ message: smithy_client_1.expectString,
540
+ });
541
+ Object.assign(contents, doc);
559
542
  const exception = new models_0_1.ConflictException({
560
543
  $metadata: deserializeMetadata(parsedOutput),
561
544
  ...contents,
@@ -563,11 +546,12 @@ const de_ConflictExceptionRes = async (parsedOutput, context) => {
563
546
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
564
547
  };
565
548
  const de_InternalFailureExceptionRes = async (parsedOutput, context) => {
566
- const contents = map({});
549
+ const contents = (0, smithy_client_1.map)({});
567
550
  const data = parsedOutput.body;
568
- if (data.message != null) {
569
- contents.message = (0, smithy_client_1.expectString)(data.message);
570
- }
551
+ const doc = (0, smithy_client_1.take)(data, {
552
+ message: smithy_client_1.expectString,
553
+ });
554
+ Object.assign(contents, doc);
571
555
  const exception = new models_0_1.InternalFailureException({
572
556
  $metadata: deserializeMetadata(parsedOutput),
573
557
  ...contents,
@@ -575,11 +559,12 @@ const de_InternalFailureExceptionRes = async (parsedOutput, context) => {
575
559
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
576
560
  };
577
561
  const de_InvalidRequestExceptionRes = async (parsedOutput, context) => {
578
- const contents = map({});
562
+ const contents = (0, smithy_client_1.map)({});
579
563
  const data = parsedOutput.body;
580
- if (data.message != null) {
581
- contents.message = (0, smithy_client_1.expectString)(data.message);
582
- }
564
+ const doc = (0, smithy_client_1.take)(data, {
565
+ message: smithy_client_1.expectString,
566
+ });
567
+ Object.assign(contents, doc);
583
568
  const exception = new models_0_1.InvalidRequestException({
584
569
  $metadata: deserializeMetadata(parsedOutput),
585
570
  ...contents,
@@ -587,11 +572,12 @@ const de_InvalidRequestExceptionRes = async (parsedOutput, context) => {
587
572
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
588
573
  };
589
574
  const de_MethodNotAllowedExceptionRes = async (parsedOutput, context) => {
590
- const contents = map({});
575
+ const contents = (0, smithy_client_1.map)({});
591
576
  const data = parsedOutput.body;
592
- if (data.message != null) {
593
- contents.message = (0, smithy_client_1.expectString)(data.message);
594
- }
577
+ const doc = (0, smithy_client_1.take)(data, {
578
+ message: smithy_client_1.expectString,
579
+ });
580
+ Object.assign(contents, doc);
595
581
  const exception = new models_0_1.MethodNotAllowedException({
596
582
  $metadata: deserializeMetadata(parsedOutput),
597
583
  ...contents,
@@ -599,11 +585,12 @@ const de_MethodNotAllowedExceptionRes = async (parsedOutput, context) => {
599
585
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
600
586
  };
601
587
  const de_RequestEntityTooLargeExceptionRes = async (parsedOutput, context) => {
602
- const contents = map({});
588
+ const contents = (0, smithy_client_1.map)({});
603
589
  const data = parsedOutput.body;
604
- if (data.message != null) {
605
- contents.message = (0, smithy_client_1.expectString)(data.message);
606
- }
590
+ const doc = (0, smithy_client_1.take)(data, {
591
+ message: smithy_client_1.expectString,
592
+ });
593
+ Object.assign(contents, doc);
607
594
  const exception = new models_0_1.RequestEntityTooLargeException({
608
595
  $metadata: deserializeMetadata(parsedOutput),
609
596
  ...contents,
@@ -611,11 +598,12 @@ const de_RequestEntityTooLargeExceptionRes = async (parsedOutput, context) => {
611
598
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
612
599
  };
613
600
  const de_ResourceNotFoundExceptionRes = async (parsedOutput, context) => {
614
- const contents = map({});
601
+ const contents = (0, smithy_client_1.map)({});
615
602
  const data = parsedOutput.body;
616
- if (data.message != null) {
617
- contents.message = (0, smithy_client_1.expectString)(data.message);
618
- }
603
+ const doc = (0, smithy_client_1.take)(data, {
604
+ message: smithy_client_1.expectString,
605
+ });
606
+ Object.assign(contents, doc);
619
607
  const exception = new models_0_1.ResourceNotFoundException({
620
608
  $metadata: deserializeMetadata(parsedOutput),
621
609
  ...contents,
@@ -623,11 +611,12 @@ const de_ResourceNotFoundExceptionRes = async (parsedOutput, context) => {
623
611
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
624
612
  };
625
613
  const de_ServiceUnavailableExceptionRes = async (parsedOutput, context) => {
626
- const contents = map({});
614
+ const contents = (0, smithy_client_1.map)({});
627
615
  const data = parsedOutput.body;
628
- if (data.message != null) {
629
- contents.message = (0, smithy_client_1.expectString)(data.message);
630
- }
616
+ const doc = (0, smithy_client_1.take)(data, {
617
+ message: smithy_client_1.expectString,
618
+ });
619
+ Object.assign(contents, doc);
631
620
  const exception = new models_0_1.ServiceUnavailableException({
632
621
  $metadata: deserializeMetadata(parsedOutput),
633
622
  ...contents,
@@ -635,11 +624,12 @@ const de_ServiceUnavailableExceptionRes = async (parsedOutput, context) => {
635
624
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
636
625
  };
637
626
  const de_ThrottlingExceptionRes = async (parsedOutput, context) => {
638
- const contents = map({});
627
+ const contents = (0, smithy_client_1.map)({});
639
628
  const data = parsedOutput.body;
640
- if (data.message != null) {
641
- contents.message = (0, smithy_client_1.expectString)(data.message);
642
- }
629
+ const doc = (0, smithy_client_1.take)(data, {
630
+ message: smithy_client_1.expectString,
631
+ });
632
+ Object.assign(contents, doc);
643
633
  const exception = new models_0_1.ThrottlingException({
644
634
  $metadata: deserializeMetadata(parsedOutput),
645
635
  ...contents,
@@ -647,11 +637,12 @@ const de_ThrottlingExceptionRes = async (parsedOutput, context) => {
647
637
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
648
638
  };
649
639
  const de_UnauthorizedExceptionRes = async (parsedOutput, context) => {
650
- const contents = map({});
640
+ const contents = (0, smithy_client_1.map)({});
651
641
  const data = parsedOutput.body;
652
- if (data.message != null) {
653
- contents.message = (0, smithy_client_1.expectString)(data.message);
654
- }
642
+ const doc = (0, smithy_client_1.take)(data, {
643
+ message: smithy_client_1.expectString,
644
+ });
645
+ Object.assign(contents, doc);
655
646
  const exception = new models_0_1.UnauthorizedException({
656
647
  $metadata: deserializeMetadata(parsedOutput),
657
648
  ...contents,
@@ -659,47 +650,18 @@ const de_UnauthorizedExceptionRes = async (parsedOutput, context) => {
659
650
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
660
651
  };
661
652
  const de_UnsupportedDocumentEncodingExceptionRes = async (parsedOutput, context) => {
662
- const contents = map({});
653
+ const contents = (0, smithy_client_1.map)({});
663
654
  const data = parsedOutput.body;
664
- if (data.message != null) {
665
- contents.message = (0, smithy_client_1.expectString)(data.message);
666
- }
655
+ const doc = (0, smithy_client_1.take)(data, {
656
+ message: smithy_client_1.expectString,
657
+ });
658
+ Object.assign(contents, doc);
667
659
  const exception = new models_0_1.UnsupportedDocumentEncodingException({
668
660
  $metadata: deserializeMetadata(parsedOutput),
669
661
  ...contents,
670
662
  });
671
663
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
672
664
  };
673
- const de_NamedShadowList = (output, context) => {
674
- const retVal = (output || [])
675
- .filter((e) => e != null)
676
- .map((entry) => {
677
- if (entry === null) {
678
- return null;
679
- }
680
- return (0, smithy_client_1.expectString)(entry);
681
- });
682
- return retVal;
683
- };
684
- const de_RetainedMessageList = (output, context) => {
685
- const retVal = (output || [])
686
- .filter((e) => e != null)
687
- .map((entry) => {
688
- if (entry === null) {
689
- return null;
690
- }
691
- return de_RetainedMessageSummary(entry, context);
692
- });
693
- return retVal;
694
- };
695
- const de_RetainedMessageSummary = (output, context) => {
696
- return {
697
- lastModifiedTime: (0, smithy_client_1.expectLong)(output.lastModifiedTime),
698
- payloadSize: (0, smithy_client_1.expectLong)(output.payloadSize),
699
- qos: (0, smithy_client_1.expectInt32)(output.qos),
700
- topic: (0, smithy_client_1.expectString)(output.topic),
701
- };
702
- };
703
665
  const deserializeMetadata = (output) => ({
704
666
  httpStatusCode: output.statusCode,
705
667
  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, expectInt32 as __expectInt32, expectLong as __expectLong, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, LazyJsonString as __LazyJsonString, map as __map, resolvedPath as __resolvedPath, throwDefaultError, } from "@aws-sdk/smithy-client";
2
+ import { _json, decorateServiceException as __decorateServiceException, expectInt32 as __expectInt32, expectLong as __expectLong, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, LazyJsonString as __LazyJsonString, map, resolvedPath as __resolvedPath, take, withBaseException, } from "@aws-sdk/smithy-client";
3
3
  import { IoTDataPlaneServiceException as __BaseException } from "../models/IoTDataPlaneServiceException";
4
4
  import { ConflictException, InternalFailureException, InvalidRequestException, MethodNotAllowedException, RequestEntityTooLargeException, ResourceNotFoundException, ServiceUnavailableException, ThrottlingException, UnauthorizedException, UnsupportedDocumentEncodingException, } from "../models/models_0";
5
5
  export const se_DeleteThingShadowCommand = async (input, context) => {
@@ -204,10 +204,9 @@ const de_DeleteThingShadowCommandError = async (output, context) => {
204
204
  throw await de_UnsupportedDocumentEncodingExceptionRes(parsedOutput, context);
205
205
  default:
206
206
  const parsedBody = parsedOutput.body;
207
- throwDefaultError({
207
+ return throwDefaultError({
208
208
  output,
209
209
  parsedBody,
210
- exceptionCtor: __BaseException,
211
210
  errorCode,
212
211
  });
213
212
  }
@@ -220,21 +219,14 @@ export const de_GetRetainedMessageCommand = async (output, context) => {
220
219
  $metadata: deserializeMetadata(output),
221
220
  });
222
221
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
223
- if (data.lastModifiedTime != null) {
224
- contents.lastModifiedTime = __expectLong(data.lastModifiedTime);
225
- }
226
- if (data.payload != null) {
227
- contents.payload = context.base64Decoder(data.payload);
228
- }
229
- if (data.qos != null) {
230
- contents.qos = __expectInt32(data.qos);
231
- }
232
- if (data.topic != null) {
233
- contents.topic = __expectString(data.topic);
234
- }
235
- if (data.userProperties != null) {
236
- contents.userProperties = context.base64Decoder(data.userProperties);
237
- }
222
+ const doc = take(data, {
223
+ lastModifiedTime: __expectLong,
224
+ payload: context.base64Decoder,
225
+ qos: __expectInt32,
226
+ topic: __expectString,
227
+ userProperties: context.base64Decoder,
228
+ });
229
+ Object.assign(contents, doc);
238
230
  return contents;
239
231
  };
240
232
  const de_GetRetainedMessageCommandError = async (output, context) => {
@@ -267,10 +259,9 @@ const de_GetRetainedMessageCommandError = async (output, context) => {
267
259
  throw await de_UnauthorizedExceptionRes(parsedOutput, context);
268
260
  default:
269
261
  const parsedBody = parsedOutput.body;
270
- throwDefaultError({
262
+ return throwDefaultError({
271
263
  output,
272
264
  parsedBody,
273
- exceptionCtor: __BaseException,
274
265
  errorCode,
275
266
  });
276
267
  }
@@ -319,10 +310,9 @@ const de_GetThingShadowCommandError = async (output, context) => {
319
310
  throw await de_UnsupportedDocumentEncodingExceptionRes(parsedOutput, context);
320
311
  default:
321
312
  const parsedBody = parsedOutput.body;
322
- throwDefaultError({
313
+ return throwDefaultError({
323
314
  output,
324
315
  parsedBody,
325
- exceptionCtor: __BaseException,
326
316
  errorCode,
327
317
  });
328
318
  }
@@ -335,15 +325,12 @@ export const de_ListNamedShadowsForThingCommand = async (output, context) => {
335
325
  $metadata: deserializeMetadata(output),
336
326
  });
337
327
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
338
- if (data.nextToken != null) {
339
- contents.nextToken = __expectString(data.nextToken);
340
- }
341
- if (data.results != null) {
342
- contents.results = de_NamedShadowList(data.results, context);
343
- }
344
- if (data.timestamp != null) {
345
- contents.timestamp = __expectLong(data.timestamp);
346
- }
328
+ const doc = take(data, {
329
+ nextToken: __expectString,
330
+ results: _json,
331
+ timestamp: __expectLong,
332
+ });
333
+ Object.assign(contents, doc);
347
334
  return contents;
348
335
  };
349
336
  const de_ListNamedShadowsForThingCommandError = async (output, context) => {
@@ -376,10 +363,9 @@ const de_ListNamedShadowsForThingCommandError = async (output, context) => {
376
363
  throw await de_UnauthorizedExceptionRes(parsedOutput, context);
377
364
  default:
378
365
  const parsedBody = parsedOutput.body;
379
- throwDefaultError({
366
+ return throwDefaultError({
380
367
  output,
381
368
  parsedBody,
382
- exceptionCtor: __BaseException,
383
369
  errorCode,
384
370
  });
385
371
  }
@@ -392,12 +378,11 @@ export const de_ListRetainedMessagesCommand = async (output, context) => {
392
378
  $metadata: deserializeMetadata(output),
393
379
  });
394
380
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
395
- if (data.nextToken != null) {
396
- contents.nextToken = __expectString(data.nextToken);
397
- }
398
- if (data.retainedTopics != null) {
399
- contents.retainedTopics = de_RetainedMessageList(data.retainedTopics, context);
400
- }
381
+ const doc = take(data, {
382
+ nextToken: __expectString,
383
+ retainedTopics: _json,
384
+ });
385
+ Object.assign(contents, doc);
401
386
  return contents;
402
387
  };
403
388
  const de_ListRetainedMessagesCommandError = async (output, context) => {
@@ -427,10 +412,9 @@ const de_ListRetainedMessagesCommandError = async (output, context) => {
427
412
  throw await de_UnauthorizedExceptionRes(parsedOutput, context);
428
413
  default:
429
414
  const parsedBody = parsedOutput.body;
430
- throwDefaultError({
415
+ return throwDefaultError({
431
416
  output,
432
417
  parsedBody,
433
- exceptionCtor: __BaseException,
434
418
  errorCode,
435
419
  });
436
420
  }
@@ -469,10 +453,9 @@ const de_PublishCommandError = async (output, context) => {
469
453
  throw await de_UnauthorizedExceptionRes(parsedOutput, context);
470
454
  default:
471
455
  const parsedBody = parsedOutput.body;
472
- throwDefaultError({
456
+ return throwDefaultError({
473
457
  output,
474
458
  parsedBody,
475
- exceptionCtor: __BaseException,
476
459
  errorCode,
477
460
  });
478
461
  }
@@ -524,21 +507,21 @@ const de_UpdateThingShadowCommandError = async (output, context) => {
524
507
  throw await de_UnsupportedDocumentEncodingExceptionRes(parsedOutput, context);
525
508
  default:
526
509
  const parsedBody = parsedOutput.body;
527
- throwDefaultError({
510
+ return throwDefaultError({
528
511
  output,
529
512
  parsedBody,
530
- exceptionCtor: __BaseException,
531
513
  errorCode,
532
514
  });
533
515
  }
534
516
  };
535
- const map = __map;
517
+ const throwDefaultError = withBaseException(__BaseException);
536
518
  const de_ConflictExceptionRes = async (parsedOutput, context) => {
537
519
  const contents = map({});
538
520
  const data = parsedOutput.body;
539
- if (data.message != null) {
540
- contents.message = __expectString(data.message);
541
- }
521
+ const doc = take(data, {
522
+ message: __expectString,
523
+ });
524
+ Object.assign(contents, doc);
542
525
  const exception = new ConflictException({
543
526
  $metadata: deserializeMetadata(parsedOutput),
544
527
  ...contents,
@@ -548,9 +531,10 @@ const de_ConflictExceptionRes = async (parsedOutput, context) => {
548
531
  const de_InternalFailureExceptionRes = async (parsedOutput, context) => {
549
532
  const contents = map({});
550
533
  const data = parsedOutput.body;
551
- if (data.message != null) {
552
- contents.message = __expectString(data.message);
553
- }
534
+ const doc = take(data, {
535
+ message: __expectString,
536
+ });
537
+ Object.assign(contents, doc);
554
538
  const exception = new InternalFailureException({
555
539
  $metadata: deserializeMetadata(parsedOutput),
556
540
  ...contents,
@@ -560,9 +544,10 @@ const de_InternalFailureExceptionRes = async (parsedOutput, context) => {
560
544
  const de_InvalidRequestExceptionRes = async (parsedOutput, context) => {
561
545
  const contents = map({});
562
546
  const data = parsedOutput.body;
563
- if (data.message != null) {
564
- contents.message = __expectString(data.message);
565
- }
547
+ const doc = take(data, {
548
+ message: __expectString,
549
+ });
550
+ Object.assign(contents, doc);
566
551
  const exception = new InvalidRequestException({
567
552
  $metadata: deserializeMetadata(parsedOutput),
568
553
  ...contents,
@@ -572,9 +557,10 @@ const de_InvalidRequestExceptionRes = async (parsedOutput, context) => {
572
557
  const de_MethodNotAllowedExceptionRes = async (parsedOutput, context) => {
573
558
  const contents = map({});
574
559
  const data = parsedOutput.body;
575
- if (data.message != null) {
576
- contents.message = __expectString(data.message);
577
- }
560
+ const doc = take(data, {
561
+ message: __expectString,
562
+ });
563
+ Object.assign(contents, doc);
578
564
  const exception = new MethodNotAllowedException({
579
565
  $metadata: deserializeMetadata(parsedOutput),
580
566
  ...contents,
@@ -584,9 +570,10 @@ const de_MethodNotAllowedExceptionRes = async (parsedOutput, context) => {
584
570
  const de_RequestEntityTooLargeExceptionRes = async (parsedOutput, context) => {
585
571
  const contents = map({});
586
572
  const data = parsedOutput.body;
587
- if (data.message != null) {
588
- contents.message = __expectString(data.message);
589
- }
573
+ const doc = take(data, {
574
+ message: __expectString,
575
+ });
576
+ Object.assign(contents, doc);
590
577
  const exception = new RequestEntityTooLargeException({
591
578
  $metadata: deserializeMetadata(parsedOutput),
592
579
  ...contents,
@@ -596,9 +583,10 @@ const de_RequestEntityTooLargeExceptionRes = async (parsedOutput, context) => {
596
583
  const de_ResourceNotFoundExceptionRes = async (parsedOutput, context) => {
597
584
  const contents = map({});
598
585
  const data = parsedOutput.body;
599
- if (data.message != null) {
600
- contents.message = __expectString(data.message);
601
- }
586
+ const doc = take(data, {
587
+ message: __expectString,
588
+ });
589
+ Object.assign(contents, doc);
602
590
  const exception = new ResourceNotFoundException({
603
591
  $metadata: deserializeMetadata(parsedOutput),
604
592
  ...contents,
@@ -608,9 +596,10 @@ const de_ResourceNotFoundExceptionRes = async (parsedOutput, context) => {
608
596
  const de_ServiceUnavailableExceptionRes = async (parsedOutput, context) => {
609
597
  const contents = map({});
610
598
  const data = parsedOutput.body;
611
- if (data.message != null) {
612
- contents.message = __expectString(data.message);
613
- }
599
+ const doc = take(data, {
600
+ message: __expectString,
601
+ });
602
+ Object.assign(contents, doc);
614
603
  const exception = new ServiceUnavailableException({
615
604
  $metadata: deserializeMetadata(parsedOutput),
616
605
  ...contents,
@@ -620,9 +609,10 @@ const de_ServiceUnavailableExceptionRes = async (parsedOutput, context) => {
620
609
  const de_ThrottlingExceptionRes = async (parsedOutput, context) => {
621
610
  const contents = map({});
622
611
  const data = parsedOutput.body;
623
- if (data.message != null) {
624
- contents.message = __expectString(data.message);
625
- }
612
+ const doc = take(data, {
613
+ message: __expectString,
614
+ });
615
+ Object.assign(contents, doc);
626
616
  const exception = new ThrottlingException({
627
617
  $metadata: deserializeMetadata(parsedOutput),
628
618
  ...contents,
@@ -632,9 +622,10 @@ const de_ThrottlingExceptionRes = async (parsedOutput, context) => {
632
622
  const de_UnauthorizedExceptionRes = async (parsedOutput, context) => {
633
623
  const contents = map({});
634
624
  const data = parsedOutput.body;
635
- if (data.message != null) {
636
- contents.message = __expectString(data.message);
637
- }
625
+ const doc = take(data, {
626
+ message: __expectString,
627
+ });
628
+ Object.assign(contents, doc);
638
629
  const exception = new UnauthorizedException({
639
630
  $metadata: deserializeMetadata(parsedOutput),
640
631
  ...contents,
@@ -644,45 +635,16 @@ const de_UnauthorizedExceptionRes = async (parsedOutput, context) => {
644
635
  const de_UnsupportedDocumentEncodingExceptionRes = async (parsedOutput, context) => {
645
636
  const contents = map({});
646
637
  const data = parsedOutput.body;
647
- if (data.message != null) {
648
- contents.message = __expectString(data.message);
649
- }
638
+ const doc = take(data, {
639
+ message: __expectString,
640
+ });
641
+ Object.assign(contents, doc);
650
642
  const exception = new UnsupportedDocumentEncodingException({
651
643
  $metadata: deserializeMetadata(parsedOutput),
652
644
  ...contents,
653
645
  });
654
646
  return __decorateServiceException(exception, parsedOutput.body);
655
647
  };
656
- const de_NamedShadowList = (output, context) => {
657
- const retVal = (output || [])
658
- .filter((e) => e != null)
659
- .map((entry) => {
660
- if (entry === null) {
661
- return null;
662
- }
663
- return __expectString(entry);
664
- });
665
- return retVal;
666
- };
667
- const de_RetainedMessageList = (output, context) => {
668
- const retVal = (output || [])
669
- .filter((e) => e != null)
670
- .map((entry) => {
671
- if (entry === null) {
672
- return null;
673
- }
674
- return de_RetainedMessageSummary(entry, context);
675
- });
676
- return retVal;
677
- };
678
- const de_RetainedMessageSummary = (output, context) => {
679
- return {
680
- lastModifiedTime: __expectLong(output.lastModifiedTime),
681
- payloadSize: __expectLong(output.payloadSize),
682
- qos: __expectInt32(output.qos),
683
- topic: __expectString(output.topic),
684
- };
685
- };
686
648
  const deserializeMetadata = (output) => ({
687
649
  httpStatusCode: output.statusCode,
688
650
  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-iot-data-plane",
3
3
  "description": "AWS SDK for JavaScript Iot Data Plane 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",