@aws-sdk/client-iot-events-data 3.525.0 → 3.529.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist-cjs/index.js CHANGED
@@ -204,6 +204,7 @@ var import_middleware_serde = require("@smithy/middleware-serde");
204
204
  var import_types = require("@smithy/types");
205
205
 
206
206
  // src/protocols/Aws_restJson1.ts
207
+ var import_core2 = require("@aws-sdk/core");
207
208
 
208
209
 
209
210
 
@@ -523,7 +524,7 @@ var de_BatchAcknowledgeAlarmCommand = /* @__PURE__ */ __name(async (output, cont
523
524
  const contents = (0, import_smithy_client.map)({
524
525
  $metadata: deserializeMetadata(output)
525
526
  });
526
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
527
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
527
528
  const doc = (0, import_smithy_client.take)(data, {
528
529
  errorEntries: import_smithy_client._json
529
530
  });
@@ -537,7 +538,7 @@ var de_BatchDeleteDetectorCommand = /* @__PURE__ */ __name(async (output, contex
537
538
  const contents = (0, import_smithy_client.map)({
538
539
  $metadata: deserializeMetadata(output)
539
540
  });
540
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
541
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
541
542
  const doc = (0, import_smithy_client.take)(data, {
542
543
  batchDeleteDetectorErrorEntries: import_smithy_client._json
543
544
  });
@@ -551,7 +552,7 @@ var de_BatchDisableAlarmCommand = /* @__PURE__ */ __name(async (output, context)
551
552
  const contents = (0, import_smithy_client.map)({
552
553
  $metadata: deserializeMetadata(output)
553
554
  });
554
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
555
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
555
556
  const doc = (0, import_smithy_client.take)(data, {
556
557
  errorEntries: import_smithy_client._json
557
558
  });
@@ -565,7 +566,7 @@ var de_BatchEnableAlarmCommand = /* @__PURE__ */ __name(async (output, context)
565
566
  const contents = (0, import_smithy_client.map)({
566
567
  $metadata: deserializeMetadata(output)
567
568
  });
568
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
569
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
569
570
  const doc = (0, import_smithy_client.take)(data, {
570
571
  errorEntries: import_smithy_client._json
571
572
  });
@@ -579,7 +580,7 @@ var de_BatchPutMessageCommand = /* @__PURE__ */ __name(async (output, context) =
579
580
  const contents = (0, import_smithy_client.map)({
580
581
  $metadata: deserializeMetadata(output)
581
582
  });
582
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
583
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
583
584
  const doc = (0, import_smithy_client.take)(data, {
584
585
  BatchPutMessageErrorEntries: import_smithy_client._json
585
586
  });
@@ -593,7 +594,7 @@ var de_BatchResetAlarmCommand = /* @__PURE__ */ __name(async (output, context) =
593
594
  const contents = (0, import_smithy_client.map)({
594
595
  $metadata: deserializeMetadata(output)
595
596
  });
596
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
597
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
597
598
  const doc = (0, import_smithy_client.take)(data, {
598
599
  errorEntries: import_smithy_client._json
599
600
  });
@@ -607,7 +608,7 @@ var de_BatchSnoozeAlarmCommand = /* @__PURE__ */ __name(async (output, context)
607
608
  const contents = (0, import_smithy_client.map)({
608
609
  $metadata: deserializeMetadata(output)
609
610
  });
610
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
611
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
611
612
  const doc = (0, import_smithy_client.take)(data, {
612
613
  errorEntries: import_smithy_client._json
613
614
  });
@@ -621,7 +622,7 @@ var de_BatchUpdateDetectorCommand = /* @__PURE__ */ __name(async (output, contex
621
622
  const contents = (0, import_smithy_client.map)({
622
623
  $metadata: deserializeMetadata(output)
623
624
  });
624
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
625
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
625
626
  const doc = (0, import_smithy_client.take)(data, {
626
627
  batchUpdateDetectorErrorEntries: import_smithy_client._json
627
628
  });
@@ -635,7 +636,7 @@ var de_DescribeAlarmCommand = /* @__PURE__ */ __name(async (output, context) =>
635
636
  const contents = (0, import_smithy_client.map)({
636
637
  $metadata: deserializeMetadata(output)
637
638
  });
638
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
639
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
639
640
  const doc = (0, import_smithy_client.take)(data, {
640
641
  alarm: (_) => de_Alarm(_, context)
641
642
  });
@@ -649,7 +650,7 @@ var de_DescribeDetectorCommand = /* @__PURE__ */ __name(async (output, context)
649
650
  const contents = (0, import_smithy_client.map)({
650
651
  $metadata: deserializeMetadata(output)
651
652
  });
652
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
653
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
653
654
  const doc = (0, import_smithy_client.take)(data, {
654
655
  detector: (_) => de_Detector(_, context)
655
656
  });
@@ -663,7 +664,7 @@ var de_ListAlarmsCommand = /* @__PURE__ */ __name(async (output, context) => {
663
664
  const contents = (0, import_smithy_client.map)({
664
665
  $metadata: deserializeMetadata(output)
665
666
  });
666
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
667
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
667
668
  const doc = (0, import_smithy_client.take)(data, {
668
669
  alarmSummaries: (_) => de_AlarmSummaries(_, context),
669
670
  nextToken: import_smithy_client.expectString
@@ -678,7 +679,7 @@ var de_ListDetectorsCommand = /* @__PURE__ */ __name(async (output, context) =>
678
679
  const contents = (0, import_smithy_client.map)({
679
680
  $metadata: deserializeMetadata(output)
680
681
  });
681
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
682
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
682
683
  const doc = (0, import_smithy_client.take)(data, {
683
684
  detectorSummaries: (_) => de_DetectorSummaries(_, context),
684
685
  nextToken: import_smithy_client.expectString
@@ -689,9 +690,9 @@ var de_ListDetectorsCommand = /* @__PURE__ */ __name(async (output, context) =>
689
690
  var de_CommandError = /* @__PURE__ */ __name(async (output, context) => {
690
691
  const parsedOutput = {
691
692
  ...output,
692
- body: await parseErrorBody(output.body, context)
693
+ body: await (0, import_core2.parseJsonErrorBody)(output.body, context)
693
694
  };
694
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
695
+ const errorCode = (0, import_core2.loadRestJsonErrorCode)(output, parsedOutput.body);
695
696
  switch (errorCode) {
696
697
  case "InternalFailureException":
697
698
  case "com.amazonaws.ioteventsdata#InternalFailureException":
@@ -874,51 +875,10 @@ var deserializeMetadata = /* @__PURE__ */ __name((output) => ({
874
875
  extendedRequestId: output.headers["x-amz-id-2"],
875
876
  cfId: output.headers["x-amz-cf-id"]
876
877
  }), "deserializeMetadata");
877
- var collectBodyString = /* @__PURE__ */ __name((streamBody, context) => (0, import_smithy_client.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body)), "collectBodyString");
878
878
  var _kV = "keyValue";
879
879
  var _mR = "maxResults";
880
880
  var _nT = "nextToken";
881
881
  var _sN = "stateName";
882
- var parseBody = /* @__PURE__ */ __name((streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
883
- if (encoded.length) {
884
- return JSON.parse(encoded);
885
- }
886
- return {};
887
- }), "parseBody");
888
- var parseErrorBody = /* @__PURE__ */ __name(async (errorBody, context) => {
889
- const value = await parseBody(errorBody, context);
890
- value.message = value.message ?? value.Message;
891
- return value;
892
- }, "parseErrorBody");
893
- var loadRestJsonErrorCode = /* @__PURE__ */ __name((output, data) => {
894
- const findKey = /* @__PURE__ */ __name((object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase()), "findKey");
895
- const sanitizeErrorCode = /* @__PURE__ */ __name((rawValue) => {
896
- let cleanValue = rawValue;
897
- if (typeof cleanValue === "number") {
898
- cleanValue = cleanValue.toString();
899
- }
900
- if (cleanValue.indexOf(",") >= 0) {
901
- cleanValue = cleanValue.split(",")[0];
902
- }
903
- if (cleanValue.indexOf(":") >= 0) {
904
- cleanValue = cleanValue.split(":")[0];
905
- }
906
- if (cleanValue.indexOf("#") >= 0) {
907
- cleanValue = cleanValue.split("#")[1];
908
- }
909
- return cleanValue;
910
- }, "sanitizeErrorCode");
911
- const headerKey = findKey(output.headers, "x-amzn-errortype");
912
- if (headerKey !== void 0) {
913
- return sanitizeErrorCode(output.headers[headerKey]);
914
- }
915
- if (data.code !== void 0) {
916
- return sanitizeErrorCode(data.code);
917
- }
918
- if (data["__type"] !== void 0) {
919
- return sanitizeErrorCode(data["__type"]);
920
- }
921
- }, "loadRestJsonErrorCode");
922
882
 
923
883
  // src/commands/BatchAcknowledgeAlarmCommand.ts
924
884
  var _BatchAcknowledgeAlarmCommand = class _BatchAcknowledgeAlarmCommand extends import_smithy_client.Command.classBuilder().ep({
@@ -1,3 +1,4 @@
1
+ import { loadRestJsonErrorCode, parseJsonBody as parseBody, parseJsonErrorBody as parseErrorBody } from "@aws-sdk/core";
1
2
  import { requestBuilder as rb } from "@smithy/core";
2
3
  import { _json, collectBody, decorateServiceException as __decorateServiceException, expectInt32 as __expectInt32, expectNonNull as __expectNonNull, expectNumber as __expectNumber, expectObject as __expectObject, expectString as __expectString, map, parseEpochTimestamp as __parseEpochTimestamp, take, withBaseException, } from "@smithy/smithy-client";
3
4
  import { IoTEventsDataServiceException as __BaseException } from "../models/IoTEventsDataServiceException";
@@ -533,43 +534,3 @@ const _kV = "keyValue";
533
534
  const _mR = "maxResults";
534
535
  const _nT = "nextToken";
535
536
  const _sN = "stateName";
536
- const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
537
- if (encoded.length) {
538
- return JSON.parse(encoded);
539
- }
540
- return {};
541
- });
542
- const parseErrorBody = async (errorBody, context) => {
543
- const value = await parseBody(errorBody, context);
544
- value.message = value.message ?? value.Message;
545
- return value;
546
- };
547
- const loadRestJsonErrorCode = (output, data) => {
548
- const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
549
- const sanitizeErrorCode = (rawValue) => {
550
- let cleanValue = rawValue;
551
- if (typeof cleanValue === "number") {
552
- cleanValue = cleanValue.toString();
553
- }
554
- if (cleanValue.indexOf(",") >= 0) {
555
- cleanValue = cleanValue.split(",")[0];
556
- }
557
- if (cleanValue.indexOf(":") >= 0) {
558
- cleanValue = cleanValue.split(":")[0];
559
- }
560
- if (cleanValue.indexOf("#") >= 0) {
561
- cleanValue = cleanValue.split("#")[1];
562
- }
563
- return cleanValue;
564
- };
565
- const headerKey = findKey(output.headers, "x-amzn-errortype");
566
- if (headerKey !== undefined) {
567
- return sanitizeErrorCode(output.headers[headerKey]);
568
- }
569
- if (data.code !== undefined) {
570
- return sanitizeErrorCode(data.code);
571
- }
572
- if (data["__type"] !== undefined) {
573
- return sanitizeErrorCode(data["__type"]);
574
- }
575
- };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aws-sdk/client-iot-events-data",
3
3
  "description": "AWS SDK for JavaScript Iot Events Data Client for Node.js, Browser and React Native",
4
- "version": "3.525.0",
4
+ "version": "3.529.1",
5
5
  "scripts": {
6
6
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
7
7
  "build:cjs": "node ../../scripts/compilation/inline client-iot-events-data",
@@ -20,9 +20,9 @@
20
20
  "dependencies": {
21
21
  "@aws-crypto/sha256-browser": "3.0.0",
22
22
  "@aws-crypto/sha256-js": "3.0.0",
23
- "@aws-sdk/client-sts": "3.525.0",
24
- "@aws-sdk/core": "3.525.0",
25
- "@aws-sdk/credential-provider-node": "3.525.0",
23
+ "@aws-sdk/client-sts": "3.529.1",
24
+ "@aws-sdk/core": "3.529.1",
25
+ "@aws-sdk/credential-provider-node": "3.529.1",
26
26
  "@aws-sdk/middleware-host-header": "3.523.0",
27
27
  "@aws-sdk/middleware-logger": "3.523.0",
28
28
  "@aws-sdk/middleware-recursion-detection": "3.523.0",