@aws-sdk/client-cognito-sync 3.312.0 → 3.316.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.
@@ -1,5 +1,5 @@
1
1
  import { HttpRequest as __HttpRequest } from "@aws-sdk/protocol-http";
2
- import { decorateServiceException as __decorateServiceException, expectBoolean as __expectBoolean, expectInt32 as __expectInt32, expectLong as __expectLong, expectNonNull as __expectNonNull, expectNumber as __expectNumber, expectObject as __expectObject, expectString as __expectString, map as __map, parseEpochTimestamp as __parseEpochTimestamp, resolvedPath as __resolvedPath, throwDefaultError, } from "@aws-sdk/smithy-client";
2
+ import { _json, decorateServiceException as __decorateServiceException, expectBoolean as __expectBoolean, expectInt32 as __expectInt32, expectLong as __expectLong, expectNonNull as __expectNonNull, expectNumber as __expectNumber, expectObject as __expectObject, expectString as __expectString, map, parseEpochTimestamp as __parseEpochTimestamp, resolvedPath as __resolvedPath, take, withBaseException, } from "@aws-sdk/smithy-client";
3
3
  import { CognitoSyncServiceException as __BaseException } from "../models/CognitoSyncServiceException";
4
4
  import { AlreadyStreamedException, ConcurrentModificationException, DuplicateRequestException, InternalErrorException, InvalidConfigurationException, InvalidLambdaFunctionOutputException, InvalidParameterException, LambdaThrottledException, LimitExceededException, NotAuthorizedException, ResourceConflictException, ResourceNotFoundException, TooManyRequestsException, } from "../models/models_0";
5
5
  export const se_BulkPublishCommand = async (input, context) => {
@@ -220,10 +220,10 @@ export const se_RegisterDeviceCommand = async (input, context) => {
220
220
  resolvedPath = __resolvedPath(resolvedPath, input, "IdentityPoolId", () => input.IdentityPoolId, "{IdentityPoolId}", false);
221
221
  resolvedPath = __resolvedPath(resolvedPath, input, "IdentityId", () => input.IdentityId, "{IdentityId}", false);
222
222
  let body;
223
- body = JSON.stringify({
224
- ...(input.Platform != null && { Platform: input.Platform }),
225
- ...(input.Token != null && { Token: input.Token }),
226
- });
223
+ body = JSON.stringify(take(input, {
224
+ Platform: [],
225
+ Token: [],
226
+ }));
227
227
  return new __HttpRequest({
228
228
  protocol,
229
229
  hostname,
@@ -242,9 +242,9 @@ export const se_SetCognitoEventsCommand = async (input, context) => {
242
242
  let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/identitypools/{IdentityPoolId}/events";
243
243
  resolvedPath = __resolvedPath(resolvedPath, input, "IdentityPoolId", () => input.IdentityPoolId, "{IdentityPoolId}", false);
244
244
  let body;
245
- body = JSON.stringify({
246
- ...(input.Events != null && { Events: se_Events(input.Events, context) }),
247
- });
245
+ body = JSON.stringify(take(input, {
246
+ Events: (_) => _json(_),
247
+ }));
248
248
  return new __HttpRequest({
249
249
  protocol,
250
250
  hostname,
@@ -264,10 +264,10 @@ export const se_SetIdentityPoolConfigurationCommand = async (input, context) =>
264
264
  "/identitypools/{IdentityPoolId}/configuration";
265
265
  resolvedPath = __resolvedPath(resolvedPath, input, "IdentityPoolId", () => input.IdentityPoolId, "{IdentityPoolId}", false);
266
266
  let body;
267
- body = JSON.stringify({
268
- ...(input.CognitoStreams != null && { CognitoStreams: se_CognitoStreams(input.CognitoStreams, context) }),
269
- ...(input.PushSync != null && { PushSync: se_PushSync(input.PushSync, context) }),
270
- });
267
+ body = JSON.stringify(take(input, {
268
+ CognitoStreams: (_) => _json(_),
269
+ PushSync: (_) => _json(_),
270
+ }));
271
271
  return new __HttpRequest({
272
272
  protocol,
273
273
  hostname,
@@ -330,11 +330,11 @@ export const se_UpdateRecordsCommand = async (input, context) => {
330
330
  resolvedPath = __resolvedPath(resolvedPath, input, "IdentityId", () => input.IdentityId, "{IdentityId}", false);
331
331
  resolvedPath = __resolvedPath(resolvedPath, input, "DatasetName", () => input.DatasetName, "{DatasetName}", false);
332
332
  let body;
333
- body = JSON.stringify({
334
- ...(input.DeviceId != null && { DeviceId: input.DeviceId }),
335
- ...(input.RecordPatches != null && { RecordPatches: se_RecordPatchList(input.RecordPatches, context) }),
336
- ...(input.SyncSessionToken != null && { SyncSessionToken: input.SyncSessionToken }),
337
- });
333
+ body = JSON.stringify(take(input, {
334
+ DeviceId: [],
335
+ RecordPatches: (_) => se_RecordPatchList(_, context),
336
+ SyncSessionToken: [],
337
+ }));
338
338
  return new __HttpRequest({
339
339
  protocol,
340
340
  hostname,
@@ -353,9 +353,10 @@ export const de_BulkPublishCommand = async (output, context) => {
353
353
  $metadata: deserializeMetadata(output),
354
354
  });
355
355
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
356
- if (data.IdentityPoolId != null) {
357
- contents.IdentityPoolId = __expectString(data.IdentityPoolId);
358
- }
356
+ const doc = take(data, {
357
+ IdentityPoolId: __expectString,
358
+ });
359
+ Object.assign(contents, doc);
359
360
  return contents;
360
361
  };
361
362
  const de_BulkPublishCommandError = async (output, context) => {
@@ -385,10 +386,9 @@ const de_BulkPublishCommandError = async (output, context) => {
385
386
  throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
386
387
  default:
387
388
  const parsedBody = parsedOutput.body;
388
- throwDefaultError({
389
+ return throwDefaultError({
389
390
  output,
390
391
  parsedBody,
391
- exceptionCtor: __BaseException,
392
392
  errorCode,
393
393
  });
394
394
  }
@@ -401,9 +401,10 @@ export const de_DeleteDatasetCommand = async (output, context) => {
401
401
  $metadata: deserializeMetadata(output),
402
402
  });
403
403
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
404
- if (data.Dataset != null) {
405
- contents.Dataset = de_Dataset(data.Dataset, context);
406
- }
404
+ const doc = take(data, {
405
+ Dataset: (_) => de_Dataset(_, context),
406
+ });
407
+ Object.assign(contents, doc);
407
408
  return contents;
408
409
  };
409
410
  const de_DeleteDatasetCommandError = async (output, context) => {
@@ -433,10 +434,9 @@ const de_DeleteDatasetCommandError = async (output, context) => {
433
434
  throw await de_TooManyRequestsExceptionRes(parsedOutput, context);
434
435
  default:
435
436
  const parsedBody = parsedOutput.body;
436
- throwDefaultError({
437
+ return throwDefaultError({
437
438
  output,
438
439
  parsedBody,
439
- exceptionCtor: __BaseException,
440
440
  errorCode,
441
441
  });
442
442
  }
@@ -449,9 +449,10 @@ export const de_DescribeDatasetCommand = async (output, context) => {
449
449
  $metadata: deserializeMetadata(output),
450
450
  });
451
451
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
452
- if (data.Dataset != null) {
453
- contents.Dataset = de_Dataset(data.Dataset, context);
454
- }
452
+ const doc = take(data, {
453
+ Dataset: (_) => de_Dataset(_, context),
454
+ });
455
+ Object.assign(contents, doc);
455
456
  return contents;
456
457
  };
457
458
  const de_DescribeDatasetCommandError = async (output, context) => {
@@ -478,10 +479,9 @@ const de_DescribeDatasetCommandError = async (output, context) => {
478
479
  throw await de_TooManyRequestsExceptionRes(parsedOutput, context);
479
480
  default:
480
481
  const parsedBody = parsedOutput.body;
481
- throwDefaultError({
482
+ return throwDefaultError({
482
483
  output,
483
484
  parsedBody,
484
- exceptionCtor: __BaseException,
485
485
  errorCode,
486
486
  });
487
487
  }
@@ -494,9 +494,10 @@ export const de_DescribeIdentityPoolUsageCommand = async (output, context) => {
494
494
  $metadata: deserializeMetadata(output),
495
495
  });
496
496
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
497
- if (data.IdentityPoolUsage != null) {
498
- contents.IdentityPoolUsage = de_IdentityPoolUsage(data.IdentityPoolUsage, context);
499
- }
497
+ const doc = take(data, {
498
+ IdentityPoolUsage: (_) => de_IdentityPoolUsage(_, context),
499
+ });
500
+ Object.assign(contents, doc);
500
501
  return contents;
501
502
  };
502
503
  const de_DescribeIdentityPoolUsageCommandError = async (output, context) => {
@@ -523,10 +524,9 @@ const de_DescribeIdentityPoolUsageCommandError = async (output, context) => {
523
524
  throw await de_TooManyRequestsExceptionRes(parsedOutput, context);
524
525
  default:
525
526
  const parsedBody = parsedOutput.body;
526
- throwDefaultError({
527
+ return throwDefaultError({
527
528
  output,
528
529
  parsedBody,
529
- exceptionCtor: __BaseException,
530
530
  errorCode,
531
531
  });
532
532
  }
@@ -539,9 +539,10 @@ export const de_DescribeIdentityUsageCommand = async (output, context) => {
539
539
  $metadata: deserializeMetadata(output),
540
540
  });
541
541
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
542
- if (data.IdentityUsage != null) {
543
- contents.IdentityUsage = de_IdentityUsage(data.IdentityUsage, context);
544
- }
542
+ const doc = take(data, {
543
+ IdentityUsage: (_) => de_IdentityUsage(_, context),
544
+ });
545
+ Object.assign(contents, doc);
545
546
  return contents;
546
547
  };
547
548
  const de_DescribeIdentityUsageCommandError = async (output, context) => {
@@ -568,10 +569,9 @@ const de_DescribeIdentityUsageCommandError = async (output, context) => {
568
569
  throw await de_TooManyRequestsExceptionRes(parsedOutput, context);
569
570
  default:
570
571
  const parsedBody = parsedOutput.body;
571
- throwDefaultError({
572
+ return throwDefaultError({
572
573
  output,
573
574
  parsedBody,
574
- exceptionCtor: __BaseException,
575
575
  errorCode,
576
576
  });
577
577
  }
@@ -584,21 +584,14 @@ export const de_GetBulkPublishDetailsCommand = async (output, context) => {
584
584
  $metadata: deserializeMetadata(output),
585
585
  });
586
586
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
587
- if (data.BulkPublishCompleteTime != null) {
588
- contents.BulkPublishCompleteTime = __expectNonNull(__parseEpochTimestamp(__expectNumber(data.BulkPublishCompleteTime)));
589
- }
590
- if (data.BulkPublishStartTime != null) {
591
- contents.BulkPublishStartTime = __expectNonNull(__parseEpochTimestamp(__expectNumber(data.BulkPublishStartTime)));
592
- }
593
- if (data.BulkPublishStatus != null) {
594
- contents.BulkPublishStatus = __expectString(data.BulkPublishStatus);
595
- }
596
- if (data.FailureMessage != null) {
597
- contents.FailureMessage = __expectString(data.FailureMessage);
598
- }
599
- if (data.IdentityPoolId != null) {
600
- contents.IdentityPoolId = __expectString(data.IdentityPoolId);
601
- }
587
+ const doc = take(data, {
588
+ BulkPublishCompleteTime: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
589
+ BulkPublishStartTime: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
590
+ BulkPublishStatus: __expectString,
591
+ FailureMessage: __expectString,
592
+ IdentityPoolId: __expectString,
593
+ });
594
+ Object.assign(contents, doc);
602
595
  return contents;
603
596
  };
604
597
  const de_GetBulkPublishDetailsCommandError = async (output, context) => {
@@ -622,10 +615,9 @@ const de_GetBulkPublishDetailsCommandError = async (output, context) => {
622
615
  throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
623
616
  default:
624
617
  const parsedBody = parsedOutput.body;
625
- throwDefaultError({
618
+ return throwDefaultError({
626
619
  output,
627
620
  parsedBody,
628
- exceptionCtor: __BaseException,
629
621
  errorCode,
630
622
  });
631
623
  }
@@ -638,9 +630,10 @@ export const de_GetCognitoEventsCommand = async (output, context) => {
638
630
  $metadata: deserializeMetadata(output),
639
631
  });
640
632
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
641
- if (data.Events != null) {
642
- contents.Events = de_Events(data.Events, context);
643
- }
633
+ const doc = take(data, {
634
+ Events: _json,
635
+ });
636
+ Object.assign(contents, doc);
644
637
  return contents;
645
638
  };
646
639
  const de_GetCognitoEventsCommandError = async (output, context) => {
@@ -667,10 +660,9 @@ const de_GetCognitoEventsCommandError = async (output, context) => {
667
660
  throw await de_TooManyRequestsExceptionRes(parsedOutput, context);
668
661
  default:
669
662
  const parsedBody = parsedOutput.body;
670
- throwDefaultError({
663
+ return throwDefaultError({
671
664
  output,
672
665
  parsedBody,
673
- exceptionCtor: __BaseException,
674
666
  errorCode,
675
667
  });
676
668
  }
@@ -683,15 +675,12 @@ export const de_GetIdentityPoolConfigurationCommand = async (output, context) =>
683
675
  $metadata: deserializeMetadata(output),
684
676
  });
685
677
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
686
- if (data.CognitoStreams != null) {
687
- contents.CognitoStreams = de_CognitoStreams(data.CognitoStreams, context);
688
- }
689
- if (data.IdentityPoolId != null) {
690
- contents.IdentityPoolId = __expectString(data.IdentityPoolId);
691
- }
692
- if (data.PushSync != null) {
693
- contents.PushSync = de_PushSync(data.PushSync, context);
694
- }
678
+ const doc = take(data, {
679
+ CognitoStreams: _json,
680
+ IdentityPoolId: __expectString,
681
+ PushSync: _json,
682
+ });
683
+ Object.assign(contents, doc);
695
684
  return contents;
696
685
  };
697
686
  const de_GetIdentityPoolConfigurationCommandError = async (output, context) => {
@@ -718,10 +707,9 @@ const de_GetIdentityPoolConfigurationCommandError = async (output, context) => {
718
707
  throw await de_TooManyRequestsExceptionRes(parsedOutput, context);
719
708
  default:
720
709
  const parsedBody = parsedOutput.body;
721
- throwDefaultError({
710
+ return throwDefaultError({
722
711
  output,
723
712
  parsedBody,
724
- exceptionCtor: __BaseException,
725
713
  errorCode,
726
714
  });
727
715
  }
@@ -734,15 +722,12 @@ export const de_ListDatasetsCommand = async (output, context) => {
734
722
  $metadata: deserializeMetadata(output),
735
723
  });
736
724
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
737
- if (data.Count != null) {
738
- contents.Count = __expectInt32(data.Count);
739
- }
740
- if (data.Datasets != null) {
741
- contents.Datasets = de_DatasetList(data.Datasets, context);
742
- }
743
- if (data.NextToken != null) {
744
- contents.NextToken = __expectString(data.NextToken);
745
- }
725
+ const doc = take(data, {
726
+ Count: __expectInt32,
727
+ Datasets: (_) => de_DatasetList(_, context),
728
+ NextToken: __expectString,
729
+ });
730
+ Object.assign(contents, doc);
746
731
  return contents;
747
732
  };
748
733
  const de_ListDatasetsCommandError = async (output, context) => {
@@ -766,10 +751,9 @@ const de_ListDatasetsCommandError = async (output, context) => {
766
751
  throw await de_TooManyRequestsExceptionRes(parsedOutput, context);
767
752
  default:
768
753
  const parsedBody = parsedOutput.body;
769
- throwDefaultError({
754
+ return throwDefaultError({
770
755
  output,
771
756
  parsedBody,
772
- exceptionCtor: __BaseException,
773
757
  errorCode,
774
758
  });
775
759
  }
@@ -782,18 +766,13 @@ export const de_ListIdentityPoolUsageCommand = async (output, context) => {
782
766
  $metadata: deserializeMetadata(output),
783
767
  });
784
768
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
785
- if (data.Count != null) {
786
- contents.Count = __expectInt32(data.Count);
787
- }
788
- if (data.IdentityPoolUsages != null) {
789
- contents.IdentityPoolUsages = de_IdentityPoolUsageList(data.IdentityPoolUsages, context);
790
- }
791
- if (data.MaxResults != null) {
792
- contents.MaxResults = __expectInt32(data.MaxResults);
793
- }
794
- if (data.NextToken != null) {
795
- contents.NextToken = __expectString(data.NextToken);
796
- }
769
+ const doc = take(data, {
770
+ Count: __expectInt32,
771
+ IdentityPoolUsages: (_) => de_IdentityPoolUsageList(_, context),
772
+ MaxResults: __expectInt32,
773
+ NextToken: __expectString,
774
+ });
775
+ Object.assign(contents, doc);
797
776
  return contents;
798
777
  };
799
778
  const de_ListIdentityPoolUsageCommandError = async (output, context) => {
@@ -817,10 +796,9 @@ const de_ListIdentityPoolUsageCommandError = async (output, context) => {
817
796
  throw await de_TooManyRequestsExceptionRes(parsedOutput, context);
818
797
  default:
819
798
  const parsedBody = parsedOutput.body;
820
- throwDefaultError({
799
+ return throwDefaultError({
821
800
  output,
822
801
  parsedBody,
823
- exceptionCtor: __BaseException,
824
802
  errorCode,
825
803
  });
826
804
  }
@@ -833,33 +811,18 @@ export const de_ListRecordsCommand = async (output, context) => {
833
811
  $metadata: deserializeMetadata(output),
834
812
  });
835
813
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
836
- if (data.Count != null) {
837
- contents.Count = __expectInt32(data.Count);
838
- }
839
- if (data.DatasetDeletedAfterRequestedSyncCount != null) {
840
- contents.DatasetDeletedAfterRequestedSyncCount = __expectBoolean(data.DatasetDeletedAfterRequestedSyncCount);
841
- }
842
- if (data.DatasetExists != null) {
843
- contents.DatasetExists = __expectBoolean(data.DatasetExists);
844
- }
845
- if (data.DatasetSyncCount != null) {
846
- contents.DatasetSyncCount = __expectLong(data.DatasetSyncCount);
847
- }
848
- if (data.LastModifiedBy != null) {
849
- contents.LastModifiedBy = __expectString(data.LastModifiedBy);
850
- }
851
- if (data.MergedDatasetNames != null) {
852
- contents.MergedDatasetNames = de_MergedDatasetNameList(data.MergedDatasetNames, context);
853
- }
854
- if (data.NextToken != null) {
855
- contents.NextToken = __expectString(data.NextToken);
856
- }
857
- if (data.Records != null) {
858
- contents.Records = de_RecordList(data.Records, context);
859
- }
860
- if (data.SyncSessionToken != null) {
861
- contents.SyncSessionToken = __expectString(data.SyncSessionToken);
862
- }
814
+ const doc = take(data, {
815
+ Count: __expectInt32,
816
+ DatasetDeletedAfterRequestedSyncCount: __expectBoolean,
817
+ DatasetExists: __expectBoolean,
818
+ DatasetSyncCount: __expectLong,
819
+ LastModifiedBy: __expectString,
820
+ MergedDatasetNames: _json,
821
+ NextToken: __expectString,
822
+ Records: (_) => de_RecordList(_, context),
823
+ SyncSessionToken: __expectString,
824
+ });
825
+ Object.assign(contents, doc);
863
826
  return contents;
864
827
  };
865
828
  const de_ListRecordsCommandError = async (output, context) => {
@@ -883,10 +846,9 @@ const de_ListRecordsCommandError = async (output, context) => {
883
846
  throw await de_TooManyRequestsExceptionRes(parsedOutput, context);
884
847
  default:
885
848
  const parsedBody = parsedOutput.body;
886
- throwDefaultError({
849
+ return throwDefaultError({
887
850
  output,
888
851
  parsedBody,
889
- exceptionCtor: __BaseException,
890
852
  errorCode,
891
853
  });
892
854
  }
@@ -899,9 +861,10 @@ export const de_RegisterDeviceCommand = async (output, context) => {
899
861
  $metadata: deserializeMetadata(output),
900
862
  });
901
863
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
902
- if (data.DeviceId != null) {
903
- contents.DeviceId = __expectString(data.DeviceId);
904
- }
864
+ const doc = take(data, {
865
+ DeviceId: __expectString,
866
+ });
867
+ Object.assign(contents, doc);
905
868
  return contents;
906
869
  };
907
870
  const de_RegisterDeviceCommandError = async (output, context) => {
@@ -931,10 +894,9 @@ const de_RegisterDeviceCommandError = async (output, context) => {
931
894
  throw await de_TooManyRequestsExceptionRes(parsedOutput, context);
932
895
  default:
933
896
  const parsedBody = parsedOutput.body;
934
- throwDefaultError({
897
+ return throwDefaultError({
935
898
  output,
936
899
  parsedBody,
937
- exceptionCtor: __BaseException,
938
900
  errorCode,
939
901
  });
940
902
  }
@@ -973,10 +935,9 @@ const de_SetCognitoEventsCommandError = async (output, context) => {
973
935
  throw await de_TooManyRequestsExceptionRes(parsedOutput, context);
974
936
  default:
975
937
  const parsedBody = parsedOutput.body;
976
- throwDefaultError({
938
+ return throwDefaultError({
977
939
  output,
978
940
  parsedBody,
979
- exceptionCtor: __BaseException,
980
941
  errorCode,
981
942
  });
982
943
  }
@@ -989,15 +950,12 @@ export const de_SetIdentityPoolConfigurationCommand = async (output, context) =>
989
950
  $metadata: deserializeMetadata(output),
990
951
  });
991
952
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
992
- if (data.CognitoStreams != null) {
993
- contents.CognitoStreams = de_CognitoStreams(data.CognitoStreams, context);
994
- }
995
- if (data.IdentityPoolId != null) {
996
- contents.IdentityPoolId = __expectString(data.IdentityPoolId);
997
- }
998
- if (data.PushSync != null) {
999
- contents.PushSync = de_PushSync(data.PushSync, context);
1000
- }
953
+ const doc = take(data, {
954
+ CognitoStreams: _json,
955
+ IdentityPoolId: __expectString,
956
+ PushSync: _json,
957
+ });
958
+ Object.assign(contents, doc);
1001
959
  return contents;
1002
960
  };
1003
961
  const de_SetIdentityPoolConfigurationCommandError = async (output, context) => {
@@ -1027,10 +985,9 @@ const de_SetIdentityPoolConfigurationCommandError = async (output, context) => {
1027
985
  throw await de_TooManyRequestsExceptionRes(parsedOutput, context);
1028
986
  default:
1029
987
  const parsedBody = parsedOutput.body;
1030
- throwDefaultError({
988
+ return throwDefaultError({
1031
989
  output,
1032
990
  parsedBody,
1033
- exceptionCtor: __BaseException,
1034
991
  errorCode,
1035
992
  });
1036
993
  }
@@ -1072,10 +1029,9 @@ const de_SubscribeToDatasetCommandError = async (output, context) => {
1072
1029
  throw await de_TooManyRequestsExceptionRes(parsedOutput, context);
1073
1030
  default:
1074
1031
  const parsedBody = parsedOutput.body;
1075
- throwDefaultError({
1032
+ return throwDefaultError({
1076
1033
  output,
1077
1034
  parsedBody,
1078
- exceptionCtor: __BaseException,
1079
1035
  errorCode,
1080
1036
  });
1081
1037
  }
@@ -1117,10 +1073,9 @@ const de_UnsubscribeFromDatasetCommandError = async (output, context) => {
1117
1073
  throw await de_TooManyRequestsExceptionRes(parsedOutput, context);
1118
1074
  default:
1119
1075
  const parsedBody = parsedOutput.body;
1120
- throwDefaultError({
1076
+ return throwDefaultError({
1121
1077
  output,
1122
1078
  parsedBody,
1123
- exceptionCtor: __BaseException,
1124
1079
  errorCode,
1125
1080
  });
1126
1081
  }
@@ -1133,9 +1088,10 @@ export const de_UpdateRecordsCommand = async (output, context) => {
1133
1088
  $metadata: deserializeMetadata(output),
1134
1089
  });
1135
1090
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
1136
- if (data.Records != null) {
1137
- contents.Records = de_RecordList(data.Records, context);
1138
- }
1091
+ const doc = take(data, {
1092
+ Records: (_) => de_RecordList(_, context),
1093
+ });
1094
+ Object.assign(contents, doc);
1139
1095
  return contents;
1140
1096
  };
1141
1097
  const de_UpdateRecordsCommandError = async (output, context) => {
@@ -1174,21 +1130,21 @@ const de_UpdateRecordsCommandError = async (output, context) => {
1174
1130
  throw await de_TooManyRequestsExceptionRes(parsedOutput, context);
1175
1131
  default:
1176
1132
  const parsedBody = parsedOutput.body;
1177
- throwDefaultError({
1133
+ return throwDefaultError({
1178
1134
  output,
1179
1135
  parsedBody,
1180
- exceptionCtor: __BaseException,
1181
1136
  errorCode,
1182
1137
  });
1183
1138
  }
1184
1139
  };
1185
- const map = __map;
1140
+ const throwDefaultError = withBaseException(__BaseException);
1186
1141
  const de_AlreadyStreamedExceptionRes = async (parsedOutput, context) => {
1187
1142
  const contents = map({});
1188
1143
  const data = parsedOutput.body;
1189
- if (data.message != null) {
1190
- contents.message = __expectString(data.message);
1191
- }
1144
+ const doc = take(data, {
1145
+ message: __expectString,
1146
+ });
1147
+ Object.assign(contents, doc);
1192
1148
  const exception = new AlreadyStreamedException({
1193
1149
  $metadata: deserializeMetadata(parsedOutput),
1194
1150
  ...contents,
@@ -1198,9 +1154,10 @@ const de_AlreadyStreamedExceptionRes = async (parsedOutput, context) => {
1198
1154
  const de_ConcurrentModificationExceptionRes = async (parsedOutput, context) => {
1199
1155
  const contents = map({});
1200
1156
  const data = parsedOutput.body;
1201
- if (data.message != null) {
1202
- contents.message = __expectString(data.message);
1203
- }
1157
+ const doc = take(data, {
1158
+ message: __expectString,
1159
+ });
1160
+ Object.assign(contents, doc);
1204
1161
  const exception = new ConcurrentModificationException({
1205
1162
  $metadata: deserializeMetadata(parsedOutput),
1206
1163
  ...contents,
@@ -1210,9 +1167,10 @@ const de_ConcurrentModificationExceptionRes = async (parsedOutput, context) => {
1210
1167
  const de_DuplicateRequestExceptionRes = async (parsedOutput, context) => {
1211
1168
  const contents = map({});
1212
1169
  const data = parsedOutput.body;
1213
- if (data.message != null) {
1214
- contents.message = __expectString(data.message);
1215
- }
1170
+ const doc = take(data, {
1171
+ message: __expectString,
1172
+ });
1173
+ Object.assign(contents, doc);
1216
1174
  const exception = new DuplicateRequestException({
1217
1175
  $metadata: deserializeMetadata(parsedOutput),
1218
1176
  ...contents,
@@ -1222,9 +1180,10 @@ const de_DuplicateRequestExceptionRes = async (parsedOutput, context) => {
1222
1180
  const de_InternalErrorExceptionRes = async (parsedOutput, context) => {
1223
1181
  const contents = map({});
1224
1182
  const data = parsedOutput.body;
1225
- if (data.message != null) {
1226
- contents.message = __expectString(data.message);
1227
- }
1183
+ const doc = take(data, {
1184
+ message: __expectString,
1185
+ });
1186
+ Object.assign(contents, doc);
1228
1187
  const exception = new InternalErrorException({
1229
1188
  $metadata: deserializeMetadata(parsedOutput),
1230
1189
  ...contents,
@@ -1234,9 +1193,10 @@ const de_InternalErrorExceptionRes = async (parsedOutput, context) => {
1234
1193
  const de_InvalidConfigurationExceptionRes = async (parsedOutput, context) => {
1235
1194
  const contents = map({});
1236
1195
  const data = parsedOutput.body;
1237
- if (data.message != null) {
1238
- contents.message = __expectString(data.message);
1239
- }
1196
+ const doc = take(data, {
1197
+ message: __expectString,
1198
+ });
1199
+ Object.assign(contents, doc);
1240
1200
  const exception = new InvalidConfigurationException({
1241
1201
  $metadata: deserializeMetadata(parsedOutput),
1242
1202
  ...contents,
@@ -1246,9 +1206,10 @@ const de_InvalidConfigurationExceptionRes = async (parsedOutput, context) => {
1246
1206
  const de_InvalidLambdaFunctionOutputExceptionRes = async (parsedOutput, context) => {
1247
1207
  const contents = map({});
1248
1208
  const data = parsedOutput.body;
1249
- if (data.message != null) {
1250
- contents.message = __expectString(data.message);
1251
- }
1209
+ const doc = take(data, {
1210
+ message: __expectString,
1211
+ });
1212
+ Object.assign(contents, doc);
1252
1213
  const exception = new InvalidLambdaFunctionOutputException({
1253
1214
  $metadata: deserializeMetadata(parsedOutput),
1254
1215
  ...contents,
@@ -1258,9 +1219,10 @@ const de_InvalidLambdaFunctionOutputExceptionRes = async (parsedOutput, context)
1258
1219
  const de_InvalidParameterExceptionRes = async (parsedOutput, context) => {
1259
1220
  const contents = map({});
1260
1221
  const data = parsedOutput.body;
1261
- if (data.message != null) {
1262
- contents.message = __expectString(data.message);
1263
- }
1222
+ const doc = take(data, {
1223
+ message: __expectString,
1224
+ });
1225
+ Object.assign(contents, doc);
1264
1226
  const exception = new InvalidParameterException({
1265
1227
  $metadata: deserializeMetadata(parsedOutput),
1266
1228
  ...contents,
@@ -1270,9 +1232,10 @@ const de_InvalidParameterExceptionRes = async (parsedOutput, context) => {
1270
1232
  const de_LambdaThrottledExceptionRes = async (parsedOutput, context) => {
1271
1233
  const contents = map({});
1272
1234
  const data = parsedOutput.body;
1273
- if (data.message != null) {
1274
- contents.message = __expectString(data.message);
1275
- }
1235
+ const doc = take(data, {
1236
+ message: __expectString,
1237
+ });
1238
+ Object.assign(contents, doc);
1276
1239
  const exception = new LambdaThrottledException({
1277
1240
  $metadata: deserializeMetadata(parsedOutput),
1278
1241
  ...contents,
@@ -1282,9 +1245,10 @@ const de_LambdaThrottledExceptionRes = async (parsedOutput, context) => {
1282
1245
  const de_LimitExceededExceptionRes = async (parsedOutput, context) => {
1283
1246
  const contents = map({});
1284
1247
  const data = parsedOutput.body;
1285
- if (data.message != null) {
1286
- contents.message = __expectString(data.message);
1287
- }
1248
+ const doc = take(data, {
1249
+ message: __expectString,
1250
+ });
1251
+ Object.assign(contents, doc);
1288
1252
  const exception = new LimitExceededException({
1289
1253
  $metadata: deserializeMetadata(parsedOutput),
1290
1254
  ...contents,
@@ -1294,9 +1258,10 @@ const de_LimitExceededExceptionRes = async (parsedOutput, context) => {
1294
1258
  const de_NotAuthorizedExceptionRes = async (parsedOutput, context) => {
1295
1259
  const contents = map({});
1296
1260
  const data = parsedOutput.body;
1297
- if (data.message != null) {
1298
- contents.message = __expectString(data.message);
1299
- }
1261
+ const doc = take(data, {
1262
+ message: __expectString,
1263
+ });
1264
+ Object.assign(contents, doc);
1300
1265
  const exception = new NotAuthorizedException({
1301
1266
  $metadata: deserializeMetadata(parsedOutput),
1302
1267
  ...contents,
@@ -1306,9 +1271,10 @@ const de_NotAuthorizedExceptionRes = async (parsedOutput, context) => {
1306
1271
  const de_ResourceConflictExceptionRes = async (parsedOutput, context) => {
1307
1272
  const contents = map({});
1308
1273
  const data = parsedOutput.body;
1309
- if (data.message != null) {
1310
- contents.message = __expectString(data.message);
1311
- }
1274
+ const doc = take(data, {
1275
+ message: __expectString,
1276
+ });
1277
+ Object.assign(contents, doc);
1312
1278
  const exception = new ResourceConflictException({
1313
1279
  $metadata: deserializeMetadata(parsedOutput),
1314
1280
  ...contents,
@@ -1318,9 +1284,10 @@ const de_ResourceConflictExceptionRes = async (parsedOutput, context) => {
1318
1284
  const de_ResourceNotFoundExceptionRes = async (parsedOutput, context) => {
1319
1285
  const contents = map({});
1320
1286
  const data = parsedOutput.body;
1321
- if (data.message != null) {
1322
- contents.message = __expectString(data.message);
1323
- }
1287
+ const doc = take(data, {
1288
+ message: __expectString,
1289
+ });
1290
+ Object.assign(contents, doc);
1324
1291
  const exception = new ResourceNotFoundException({
1325
1292
  $metadata: deserializeMetadata(parsedOutput),
1326
1293
  ...contents,
@@ -1330,54 +1297,24 @@ const de_ResourceNotFoundExceptionRes = async (parsedOutput, context) => {
1330
1297
  const de_TooManyRequestsExceptionRes = async (parsedOutput, context) => {
1331
1298
  const contents = map({});
1332
1299
  const data = parsedOutput.body;
1333
- if (data.message != null) {
1334
- contents.message = __expectString(data.message);
1335
- }
1300
+ const doc = take(data, {
1301
+ message: __expectString,
1302
+ });
1303
+ Object.assign(contents, doc);
1336
1304
  const exception = new TooManyRequestsException({
1337
1305
  $metadata: deserializeMetadata(parsedOutput),
1338
1306
  ...contents,
1339
1307
  });
1340
1308
  return __decorateServiceException(exception, parsedOutput.body);
1341
1309
  };
1342
- const se_ApplicationArnList = (input, context) => {
1343
- return input
1344
- .filter((e) => e != null)
1345
- .map((entry) => {
1346
- return entry;
1347
- });
1348
- };
1349
- const se_CognitoStreams = (input, context) => {
1350
- return {
1351
- ...(input.RoleArn != null && { RoleArn: input.RoleArn }),
1352
- ...(input.StreamName != null && { StreamName: input.StreamName }),
1353
- ...(input.StreamingStatus != null && { StreamingStatus: input.StreamingStatus }),
1354
- };
1355
- };
1356
- const se_Events = (input, context) => {
1357
- return Object.entries(input).reduce((acc, [key, value]) => {
1358
- if (value === null) {
1359
- return acc;
1360
- }
1361
- acc[key] = value;
1362
- return acc;
1363
- }, {});
1364
- };
1365
- const se_PushSync = (input, context) => {
1366
- return {
1367
- ...(input.ApplicationArns != null && { ApplicationArns: se_ApplicationArnList(input.ApplicationArns, context) }),
1368
- ...(input.RoleArn != null && { RoleArn: input.RoleArn }),
1369
- };
1370
- };
1371
1310
  const se_RecordPatch = (input, context) => {
1372
- return {
1373
- ...(input.DeviceLastModifiedDate != null && {
1374
- DeviceLastModifiedDate: Math.round(input.DeviceLastModifiedDate.getTime() / 1000),
1375
- }),
1376
- ...(input.Key != null && { Key: input.Key }),
1377
- ...(input.Op != null && { Op: input.Op }),
1378
- ...(input.SyncCount != null && { SyncCount: input.SyncCount }),
1379
- ...(input.Value != null && { Value: input.Value }),
1380
- };
1311
+ return take(input, {
1312
+ DeviceLastModifiedDate: (_) => Math.round(_.getTime() / 1000),
1313
+ Key: [],
1314
+ Op: [],
1315
+ SyncCount: [],
1316
+ Value: [],
1317
+ });
1381
1318
  };
1382
1319
  const se_RecordPatchList = (input, context) => {
1383
1320
  return input
@@ -1386,129 +1323,64 @@ const se_RecordPatchList = (input, context) => {
1386
1323
  return se_RecordPatch(entry, context);
1387
1324
  });
1388
1325
  };
1389
- const de_ApplicationArnList = (output, context) => {
1390
- const retVal = (output || [])
1391
- .filter((e) => e != null)
1392
- .map((entry) => {
1393
- if (entry === null) {
1394
- return null;
1395
- }
1396
- return __expectString(entry);
1397
- });
1398
- return retVal;
1399
- };
1400
- const de_CognitoStreams = (output, context) => {
1401
- return {
1402
- RoleArn: __expectString(output.RoleArn),
1403
- StreamName: __expectString(output.StreamName),
1404
- StreamingStatus: __expectString(output.StreamingStatus),
1405
- };
1406
- };
1407
1326
  const de_Dataset = (output, context) => {
1408
- return {
1409
- CreationDate: output.CreationDate != null
1410
- ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.CreationDate)))
1411
- : undefined,
1412
- DataStorage: __expectLong(output.DataStorage),
1413
- DatasetName: __expectString(output.DatasetName),
1414
- IdentityId: __expectString(output.IdentityId),
1415
- LastModifiedBy: __expectString(output.LastModifiedBy),
1416
- LastModifiedDate: output.LastModifiedDate != null
1417
- ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.LastModifiedDate)))
1418
- : undefined,
1419
- NumRecords: __expectLong(output.NumRecords),
1420
- };
1327
+ return take(output, {
1328
+ CreationDate: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
1329
+ DataStorage: __expectLong,
1330
+ DatasetName: __expectString,
1331
+ IdentityId: __expectString,
1332
+ LastModifiedBy: __expectString,
1333
+ LastModifiedDate: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
1334
+ NumRecords: __expectLong,
1335
+ });
1421
1336
  };
1422
1337
  const de_DatasetList = (output, context) => {
1423
1338
  const retVal = (output || [])
1424
1339
  .filter((e) => e != null)
1425
1340
  .map((entry) => {
1426
- if (entry === null) {
1427
- return null;
1428
- }
1429
1341
  return de_Dataset(entry, context);
1430
1342
  });
1431
1343
  return retVal;
1432
1344
  };
1433
- const de_Events = (output, context) => {
1434
- return Object.entries(output).reduce((acc, [key, value]) => {
1435
- if (value === null) {
1436
- return acc;
1437
- }
1438
- acc[key] = __expectString(value);
1439
- return acc;
1440
- }, {});
1441
- };
1442
1345
  const de_IdentityPoolUsage = (output, context) => {
1443
- return {
1444
- DataStorage: __expectLong(output.DataStorage),
1445
- IdentityPoolId: __expectString(output.IdentityPoolId),
1446
- LastModifiedDate: output.LastModifiedDate != null
1447
- ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.LastModifiedDate)))
1448
- : undefined,
1449
- SyncSessionsCount: __expectLong(output.SyncSessionsCount),
1450
- };
1346
+ return take(output, {
1347
+ DataStorage: __expectLong,
1348
+ IdentityPoolId: __expectString,
1349
+ LastModifiedDate: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
1350
+ SyncSessionsCount: __expectLong,
1351
+ });
1451
1352
  };
1452
1353
  const de_IdentityPoolUsageList = (output, context) => {
1453
1354
  const retVal = (output || [])
1454
1355
  .filter((e) => e != null)
1455
1356
  .map((entry) => {
1456
- if (entry === null) {
1457
- return null;
1458
- }
1459
1357
  return de_IdentityPoolUsage(entry, context);
1460
1358
  });
1461
1359
  return retVal;
1462
1360
  };
1463
1361
  const de_IdentityUsage = (output, context) => {
1464
- return {
1465
- DataStorage: __expectLong(output.DataStorage),
1466
- DatasetCount: __expectInt32(output.DatasetCount),
1467
- IdentityId: __expectString(output.IdentityId),
1468
- IdentityPoolId: __expectString(output.IdentityPoolId),
1469
- LastModifiedDate: output.LastModifiedDate != null
1470
- ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.LastModifiedDate)))
1471
- : undefined,
1472
- };
1473
- };
1474
- const de_MergedDatasetNameList = (output, context) => {
1475
- const retVal = (output || [])
1476
- .filter((e) => e != null)
1477
- .map((entry) => {
1478
- if (entry === null) {
1479
- return null;
1480
- }
1481
- return __expectString(entry);
1362
+ return take(output, {
1363
+ DataStorage: __expectLong,
1364
+ DatasetCount: __expectInt32,
1365
+ IdentityId: __expectString,
1366
+ IdentityPoolId: __expectString,
1367
+ LastModifiedDate: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
1482
1368
  });
1483
- return retVal;
1484
- };
1485
- const de_PushSync = (output, context) => {
1486
- return {
1487
- ApplicationArns: output.ApplicationArns != null ? de_ApplicationArnList(output.ApplicationArns, context) : undefined,
1488
- RoleArn: __expectString(output.RoleArn),
1489
- };
1490
1369
  };
1491
1370
  const de__Record = (output, context) => {
1492
- return {
1493
- DeviceLastModifiedDate: output.DeviceLastModifiedDate != null
1494
- ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.DeviceLastModifiedDate)))
1495
- : undefined,
1496
- Key: __expectString(output.Key),
1497
- LastModifiedBy: __expectString(output.LastModifiedBy),
1498
- LastModifiedDate: output.LastModifiedDate != null
1499
- ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.LastModifiedDate)))
1500
- : undefined,
1501
- SyncCount: __expectLong(output.SyncCount),
1502
- Value: __expectString(output.Value),
1503
- };
1371
+ return take(output, {
1372
+ DeviceLastModifiedDate: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
1373
+ Key: __expectString,
1374
+ LastModifiedBy: __expectString,
1375
+ LastModifiedDate: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
1376
+ SyncCount: __expectLong,
1377
+ Value: __expectString,
1378
+ });
1504
1379
  };
1505
1380
  const de_RecordList = (output, context) => {
1506
1381
  const retVal = (output || [])
1507
1382
  .filter((e) => e != null)
1508
1383
  .map((entry) => {
1509
- if (entry === null) {
1510
- return null;
1511
- }
1512
1384
  return de__Record(entry, context);
1513
1385
  });
1514
1386
  return retVal;