@aws-sdk/client-snow-device-management 3.525.0 → 3.529.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist-cjs/index.js CHANGED
@@ -212,6 +212,7 @@ var import_middleware_serde = require("@smithy/middleware-serde");
212
212
  var import_types = require("@smithy/types");
213
213
 
214
214
  // src/protocols/Aws_restJson1.ts
215
+ var import_core2 = require("@aws-sdk/core");
215
216
 
216
217
 
217
218
  var import_uuid = require("uuid");
@@ -566,7 +567,7 @@ var de_CancelTaskCommand = /* @__PURE__ */ __name(async (output, context) => {
566
567
  const contents = (0, import_smithy_client.map)({
567
568
  $metadata: deserializeMetadata(output)
568
569
  });
569
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
570
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
570
571
  const doc = (0, import_smithy_client.take)(data, {
571
572
  taskId: import_smithy_client.expectString
572
573
  });
@@ -580,7 +581,7 @@ var de_CreateTaskCommand = /* @__PURE__ */ __name(async (output, context) => {
580
581
  const contents = (0, import_smithy_client.map)({
581
582
  $metadata: deserializeMetadata(output)
582
583
  });
583
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
584
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
584
585
  const doc = (0, import_smithy_client.take)(data, {
585
586
  taskArn: import_smithy_client.expectString,
586
587
  taskId: import_smithy_client.expectString
@@ -595,7 +596,7 @@ var de_DescribeDeviceCommand = /* @__PURE__ */ __name(async (output, context) =>
595
596
  const contents = (0, import_smithy_client.map)({
596
597
  $metadata: deserializeMetadata(output)
597
598
  });
598
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
599
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
599
600
  const doc = (0, import_smithy_client.take)(data, {
600
601
  associatedWithJob: import_smithy_client.expectString,
601
602
  deviceCapacities: import_smithy_client._json,
@@ -619,7 +620,7 @@ var de_DescribeDeviceEc2InstancesCommand = /* @__PURE__ */ __name(async (output,
619
620
  const contents = (0, import_smithy_client.map)({
620
621
  $metadata: deserializeMetadata(output)
621
622
  });
622
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
623
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
623
624
  const doc = (0, import_smithy_client.take)(data, {
624
625
  instances: (_) => de_InstanceSummaryList(_, context)
625
626
  });
@@ -633,7 +634,7 @@ var de_DescribeExecutionCommand = /* @__PURE__ */ __name(async (output, context)
633
634
  const contents = (0, import_smithy_client.map)({
634
635
  $metadata: deserializeMetadata(output)
635
636
  });
636
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
637
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
637
638
  const doc = (0, import_smithy_client.take)(data, {
638
639
  executionId: import_smithy_client.expectString,
639
640
  lastUpdatedAt: (_) => (0, import_smithy_client.expectNonNull)((0, import_smithy_client.parseEpochTimestamp)((0, import_smithy_client.expectNumber)(_))),
@@ -652,7 +653,7 @@ var de_DescribeTaskCommand = /* @__PURE__ */ __name(async (output, context) => {
652
653
  const contents = (0, import_smithy_client.map)({
653
654
  $metadata: deserializeMetadata(output)
654
655
  });
655
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
656
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
656
657
  const doc = (0, import_smithy_client.take)(data, {
657
658
  completedAt: (_) => (0, import_smithy_client.expectNonNull)((0, import_smithy_client.parseEpochTimestamp)((0, import_smithy_client.expectNumber)(_))),
658
659
  createdAt: (_) => (0, import_smithy_client.expectNonNull)((0, import_smithy_client.parseEpochTimestamp)((0, import_smithy_client.expectNumber)(_))),
@@ -674,7 +675,7 @@ var de_ListDeviceResourcesCommand = /* @__PURE__ */ __name(async (output, contex
674
675
  const contents = (0, import_smithy_client.map)({
675
676
  $metadata: deserializeMetadata(output)
676
677
  });
677
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
678
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
678
679
  const doc = (0, import_smithy_client.take)(data, {
679
680
  nextToken: import_smithy_client.expectString,
680
681
  resources: import_smithy_client._json
@@ -689,7 +690,7 @@ var de_ListDevicesCommand = /* @__PURE__ */ __name(async (output, context) => {
689
690
  const contents = (0, import_smithy_client.map)({
690
691
  $metadata: deserializeMetadata(output)
691
692
  });
692
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
693
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
693
694
  const doc = (0, import_smithy_client.take)(data, {
694
695
  devices: import_smithy_client._json,
695
696
  nextToken: import_smithy_client.expectString
@@ -704,7 +705,7 @@ var de_ListExecutionsCommand = /* @__PURE__ */ __name(async (output, context) =>
704
705
  const contents = (0, import_smithy_client.map)({
705
706
  $metadata: deserializeMetadata(output)
706
707
  });
707
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
708
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
708
709
  const doc = (0, import_smithy_client.take)(data, {
709
710
  executions: import_smithy_client._json,
710
711
  nextToken: import_smithy_client.expectString
@@ -719,7 +720,7 @@ var de_ListTagsForResourceCommand = /* @__PURE__ */ __name(async (output, contex
719
720
  const contents = (0, import_smithy_client.map)({
720
721
  $metadata: deserializeMetadata(output)
721
722
  });
722
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
723
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
723
724
  const doc = (0, import_smithy_client.take)(data, {
724
725
  tags: import_smithy_client._json
725
726
  });
@@ -733,7 +734,7 @@ var de_ListTasksCommand = /* @__PURE__ */ __name(async (output, context) => {
733
734
  const contents = (0, import_smithy_client.map)({
734
735
  $metadata: deserializeMetadata(output)
735
736
  });
736
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
737
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
737
738
  const doc = (0, import_smithy_client.take)(data, {
738
739
  nextToken: import_smithy_client.expectString,
739
740
  tasks: import_smithy_client._json
@@ -764,9 +765,9 @@ var de_UntagResourceCommand = /* @__PURE__ */ __name(async (output, context) =>
764
765
  var de_CommandError = /* @__PURE__ */ __name(async (output, context) => {
765
766
  const parsedOutput = {
766
767
  ...output,
767
- body: await parseErrorBody(output.body, context)
768
+ body: await (0, import_core2.parseJsonErrorBody)(output.body, context)
768
769
  };
769
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
770
+ const errorCode = (0, import_core2.loadRestJsonErrorCode)(output, parsedOutput.body);
770
771
  switch (errorCode) {
771
772
  case "AccessDeniedException":
772
773
  case "com.amazonaws.snowdevicemanagement#AccessDeniedException":
@@ -929,7 +930,6 @@ var deserializeMetadata = /* @__PURE__ */ __name((output) => ({
929
930
  extendedRequestId: output.headers["x-amz-id-2"],
930
931
  cfId: output.headers["x-amz-cf-id"]
931
932
  }), "deserializeMetadata");
932
- var collectBodyString = /* @__PURE__ */ __name((streamBody, context) => (0, import_smithy_client.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body)), "collectBodyString");
933
933
  var _jI = "jobId";
934
934
  var _mR = "maxResults";
935
935
  var _nT = "nextToken";
@@ -937,46 +937,6 @@ var _s = "state";
937
937
  var _t = "type";
938
938
  var _tI = "taskId";
939
939
  var _tK = "tagKeys";
940
- var parseBody = /* @__PURE__ */ __name((streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
941
- if (encoded.length) {
942
- return JSON.parse(encoded);
943
- }
944
- return {};
945
- }), "parseBody");
946
- var parseErrorBody = /* @__PURE__ */ __name(async (errorBody, context) => {
947
- const value = await parseBody(errorBody, context);
948
- value.message = value.message ?? value.Message;
949
- return value;
950
- }, "parseErrorBody");
951
- var loadRestJsonErrorCode = /* @__PURE__ */ __name((output, data) => {
952
- const findKey = /* @__PURE__ */ __name((object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase()), "findKey");
953
- const sanitizeErrorCode = /* @__PURE__ */ __name((rawValue) => {
954
- let cleanValue = rawValue;
955
- if (typeof cleanValue === "number") {
956
- cleanValue = cleanValue.toString();
957
- }
958
- if (cleanValue.indexOf(",") >= 0) {
959
- cleanValue = cleanValue.split(",")[0];
960
- }
961
- if (cleanValue.indexOf(":") >= 0) {
962
- cleanValue = cleanValue.split(":")[0];
963
- }
964
- if (cleanValue.indexOf("#") >= 0) {
965
- cleanValue = cleanValue.split("#")[1];
966
- }
967
- return cleanValue;
968
- }, "sanitizeErrorCode");
969
- const headerKey = findKey(output.headers, "x-amzn-errortype");
970
- if (headerKey !== void 0) {
971
- return sanitizeErrorCode(output.headers[headerKey]);
972
- }
973
- if (data.code !== void 0) {
974
- return sanitizeErrorCode(data.code);
975
- }
976
- if (data["__type"] !== void 0) {
977
- return sanitizeErrorCode(data["__type"]);
978
- }
979
- }, "loadRestJsonErrorCode");
980
940
 
981
941
  // src/commands/CancelTaskCommand.ts
982
942
  var _CancelTaskCommand = class _CancelTaskCommand 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, expectBoolean as __expectBoolean, 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 { v4 as generateIdempotencyToken } from "uuid";
@@ -550,43 +551,3 @@ const _s = "state";
550
551
  const _t = "type";
551
552
  const _tI = "taskId";
552
553
  const _tK = "tagKeys";
553
- const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
554
- if (encoded.length) {
555
- return JSON.parse(encoded);
556
- }
557
- return {};
558
- });
559
- const parseErrorBody = async (errorBody, context) => {
560
- const value = await parseBody(errorBody, context);
561
- value.message = value.message ?? value.Message;
562
- return value;
563
- };
564
- const loadRestJsonErrorCode = (output, data) => {
565
- const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
566
- const sanitizeErrorCode = (rawValue) => {
567
- let cleanValue = rawValue;
568
- if (typeof cleanValue === "number") {
569
- cleanValue = cleanValue.toString();
570
- }
571
- if (cleanValue.indexOf(",") >= 0) {
572
- cleanValue = cleanValue.split(",")[0];
573
- }
574
- if (cleanValue.indexOf(":") >= 0) {
575
- cleanValue = cleanValue.split(":")[0];
576
- }
577
- if (cleanValue.indexOf("#") >= 0) {
578
- cleanValue = cleanValue.split("#")[1];
579
- }
580
- return cleanValue;
581
- };
582
- const headerKey = findKey(output.headers, "x-amzn-errortype");
583
- if (headerKey !== undefined) {
584
- return sanitizeErrorCode(output.headers[headerKey]);
585
- }
586
- if (data.code !== undefined) {
587
- return sanitizeErrorCode(data.code);
588
- }
589
- if (data["__type"] !== undefined) {
590
- return sanitizeErrorCode(data["__type"]);
591
- }
592
- };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aws-sdk/client-snow-device-management",
3
3
  "description": "AWS SDK for JavaScript Snow Device Management Client for Node.js, Browser and React Native",
4
- "version": "3.525.0",
4
+ "version": "3.529.0",
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-snow-device-management",
@@ -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.0",
24
+ "@aws-sdk/core": "3.529.0",
25
+ "@aws-sdk/credential-provider-node": "3.529.0",
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",