@aws-sdk/client-braket 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
@@ -221,6 +221,7 @@ var import_middleware_serde = require("@smithy/middleware-serde");
221
221
  var import_types = require("@smithy/types");
222
222
 
223
223
  // src/protocols/Aws_restJson1.ts
224
+ var import_core2 = require("@aws-sdk/core");
224
225
 
225
226
 
226
227
  var import_uuid = require("uuid");
@@ -730,7 +731,7 @@ var de_CancelJobCommand = /* @__PURE__ */ __name(async (output, context) => {
730
731
  const contents = (0, import_smithy_client.map)({
731
732
  $metadata: deserializeMetadata(output)
732
733
  });
733
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
734
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
734
735
  const doc = (0, import_smithy_client.take)(data, {
735
736
  cancellationStatus: import_smithy_client.expectString,
736
737
  jobArn: import_smithy_client.expectString
@@ -745,7 +746,7 @@ var de_CancelQuantumTaskCommand = /* @__PURE__ */ __name(async (output, context)
745
746
  const contents = (0, import_smithy_client.map)({
746
747
  $metadata: deserializeMetadata(output)
747
748
  });
748
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
749
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
749
750
  const doc = (0, import_smithy_client.take)(data, {
750
751
  cancellationStatus: import_smithy_client.expectString,
751
752
  quantumTaskArn: import_smithy_client.expectString
@@ -760,7 +761,7 @@ var de_CreateJobCommand = /* @__PURE__ */ __name(async (output, context) => {
760
761
  const contents = (0, import_smithy_client.map)({
761
762
  $metadata: deserializeMetadata(output)
762
763
  });
763
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
764
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
764
765
  const doc = (0, import_smithy_client.take)(data, {
765
766
  jobArn: import_smithy_client.expectString
766
767
  });
@@ -774,7 +775,7 @@ var de_CreateQuantumTaskCommand = /* @__PURE__ */ __name(async (output, context)
774
775
  const contents = (0, import_smithy_client.map)({
775
776
  $metadata: deserializeMetadata(output)
776
777
  });
777
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
778
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
778
779
  const doc = (0, import_smithy_client.take)(data, {
779
780
  quantumTaskArn: import_smithy_client.expectString
780
781
  });
@@ -788,7 +789,7 @@ var de_GetDeviceCommand = /* @__PURE__ */ __name(async (output, context) => {
788
789
  const contents = (0, import_smithy_client.map)({
789
790
  $metadata: deserializeMetadata(output)
790
791
  });
791
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
792
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
792
793
  const doc = (0, import_smithy_client.take)(data, {
793
794
  deviceArn: import_smithy_client.expectString,
794
795
  deviceCapabilities: (_) => new import_smithy_client.LazyJsonString(_),
@@ -808,7 +809,7 @@ var de_GetJobCommand = /* @__PURE__ */ __name(async (output, context) => {
808
809
  const contents = (0, import_smithy_client.map)({
809
810
  $metadata: deserializeMetadata(output)
810
811
  });
811
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
812
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
812
813
  const doc = (0, import_smithy_client.take)(data, {
813
814
  algorithmSpecification: import_smithy_client._json,
814
815
  associations: import_smithy_client._json,
@@ -842,7 +843,7 @@ var de_GetQuantumTaskCommand = /* @__PURE__ */ __name(async (output, context) =>
842
843
  const contents = (0, import_smithy_client.map)({
843
844
  $metadata: deserializeMetadata(output)
844
845
  });
845
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
846
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
846
847
  const doc = (0, import_smithy_client.take)(data, {
847
848
  associations: import_smithy_client._json,
848
849
  createdAt: (_) => (0, import_smithy_client.expectNonNull)((0, import_smithy_client.parseRfc3339DateTimeWithOffset)(_)),
@@ -869,7 +870,7 @@ var de_ListTagsForResourceCommand = /* @__PURE__ */ __name(async (output, contex
869
870
  const contents = (0, import_smithy_client.map)({
870
871
  $metadata: deserializeMetadata(output)
871
872
  });
872
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
873
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
873
874
  const doc = (0, import_smithy_client.take)(data, {
874
875
  tags: import_smithy_client._json
875
876
  });
@@ -883,7 +884,7 @@ var de_SearchDevicesCommand = /* @__PURE__ */ __name(async (output, context) =>
883
884
  const contents = (0, import_smithy_client.map)({
884
885
  $metadata: deserializeMetadata(output)
885
886
  });
886
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
887
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
887
888
  const doc = (0, import_smithy_client.take)(data, {
888
889
  devices: import_smithy_client._json,
889
890
  nextToken: import_smithy_client.expectString
@@ -898,7 +899,7 @@ var de_SearchJobsCommand = /* @__PURE__ */ __name(async (output, context) => {
898
899
  const contents = (0, import_smithy_client.map)({
899
900
  $metadata: deserializeMetadata(output)
900
901
  });
901
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
902
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
902
903
  const doc = (0, import_smithy_client.take)(data, {
903
904
  jobs: (_) => de_JobSummaryList(_, context),
904
905
  nextToken: import_smithy_client.expectString
@@ -913,7 +914,7 @@ var de_SearchQuantumTasksCommand = /* @__PURE__ */ __name(async (output, context
913
914
  const contents = (0, import_smithy_client.map)({
914
915
  $metadata: deserializeMetadata(output)
915
916
  });
916
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
917
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
917
918
  const doc = (0, import_smithy_client.take)(data, {
918
919
  nextToken: import_smithy_client.expectString,
919
920
  quantumTasks: (_) => de_QuantumTaskSummaryList(_, context)
@@ -944,9 +945,9 @@ var de_UntagResourceCommand = /* @__PURE__ */ __name(async (output, context) =>
944
945
  var de_CommandError = /* @__PURE__ */ __name(async (output, context) => {
945
946
  const parsedOutput = {
946
947
  ...output,
947
- body: await parseErrorBody(output.body, context)
948
+ body: await (0, import_core2.parseJsonErrorBody)(output.body, context)
948
949
  };
949
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
950
+ const errorCode = (0, import_core2.loadRestJsonErrorCode)(output, parsedOutput.body);
950
951
  switch (errorCode) {
951
952
  case "AccessDeniedException":
952
953
  case "com.amazonaws.braket#AccessDeniedException":
@@ -1158,49 +1159,8 @@ var deserializeMetadata = /* @__PURE__ */ __name((output) => ({
1158
1159
  extendedRequestId: output.headers["x-amz-id-2"],
1159
1160
  cfId: output.headers["x-amz-cf-id"]
1160
1161
  }), "deserializeMetadata");
1161
- var collectBodyString = /* @__PURE__ */ __name((streamBody, context) => (0, import_smithy_client.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body)), "collectBodyString");
1162
1162
  var _aAN = "additionalAttributeNames";
1163
1163
  var _tK = "tagKeys";
1164
- var parseBody = /* @__PURE__ */ __name((streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
1165
- if (encoded.length) {
1166
- return JSON.parse(encoded);
1167
- }
1168
- return {};
1169
- }), "parseBody");
1170
- var parseErrorBody = /* @__PURE__ */ __name(async (errorBody, context) => {
1171
- const value = await parseBody(errorBody, context);
1172
- value.message = value.message ?? value.Message;
1173
- return value;
1174
- }, "parseErrorBody");
1175
- var loadRestJsonErrorCode = /* @__PURE__ */ __name((output, data) => {
1176
- const findKey = /* @__PURE__ */ __name((object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase()), "findKey");
1177
- const sanitizeErrorCode = /* @__PURE__ */ __name((rawValue) => {
1178
- let cleanValue = rawValue;
1179
- if (typeof cleanValue === "number") {
1180
- cleanValue = cleanValue.toString();
1181
- }
1182
- if (cleanValue.indexOf(",") >= 0) {
1183
- cleanValue = cleanValue.split(",")[0];
1184
- }
1185
- if (cleanValue.indexOf(":") >= 0) {
1186
- cleanValue = cleanValue.split(":")[0];
1187
- }
1188
- if (cleanValue.indexOf("#") >= 0) {
1189
- cleanValue = cleanValue.split("#")[1];
1190
- }
1191
- return cleanValue;
1192
- }, "sanitizeErrorCode");
1193
- const headerKey = findKey(output.headers, "x-amzn-errortype");
1194
- if (headerKey !== void 0) {
1195
- return sanitizeErrorCode(output.headers[headerKey]);
1196
- }
1197
- if (data.code !== void 0) {
1198
- return sanitizeErrorCode(data.code);
1199
- }
1200
- if (data["__type"] !== void 0) {
1201
- return sanitizeErrorCode(data["__type"]);
1202
- }
1203
- }, "loadRestJsonErrorCode");
1204
1164
 
1205
1165
  // src/commands/CancelJobCommand.ts
1206
1166
  var _CancelJobCommand = class _CancelJobCommand 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, expectLong as __expectLong, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, LazyJsonString as __LazyJsonString, map, parseRfc3339DateTimeWithOffset as __parseRfc3339DateTimeWithOffset, take, withBaseException, } from "@smithy/smithy-client";
3
4
  import { v4 as generateIdempotencyToken } from "uuid";
@@ -644,43 +645,3 @@ const isSerializableHeaderValue = (value) => value !== undefined &&
644
645
  (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
645
646
  const _aAN = "additionalAttributeNames";
646
647
  const _tK = "tagKeys";
647
- const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
648
- if (encoded.length) {
649
- return JSON.parse(encoded);
650
- }
651
- return {};
652
- });
653
- const parseErrorBody = async (errorBody, context) => {
654
- const value = await parseBody(errorBody, context);
655
- value.message = value.message ?? value.Message;
656
- return value;
657
- };
658
- const loadRestJsonErrorCode = (output, data) => {
659
- const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
660
- const sanitizeErrorCode = (rawValue) => {
661
- let cleanValue = rawValue;
662
- if (typeof cleanValue === "number") {
663
- cleanValue = cleanValue.toString();
664
- }
665
- if (cleanValue.indexOf(",") >= 0) {
666
- cleanValue = cleanValue.split(",")[0];
667
- }
668
- if (cleanValue.indexOf(":") >= 0) {
669
- cleanValue = cleanValue.split(":")[0];
670
- }
671
- if (cleanValue.indexOf("#") >= 0) {
672
- cleanValue = cleanValue.split("#")[1];
673
- }
674
- return cleanValue;
675
- };
676
- const headerKey = findKey(output.headers, "x-amzn-errortype");
677
- if (headerKey !== undefined) {
678
- return sanitizeErrorCode(output.headers[headerKey]);
679
- }
680
- if (data.code !== undefined) {
681
- return sanitizeErrorCode(data.code);
682
- }
683
- if (data["__type"] !== undefined) {
684
- return sanitizeErrorCode(data["__type"]);
685
- }
686
- };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aws-sdk/client-braket",
3
3
  "description": "AWS SDK for JavaScript Braket 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-braket",
@@ -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",