@aws-sdk/client-bedrock 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
@@ -225,6 +225,7 @@ var import_middleware_serde = require("@smithy/middleware-serde");
225
225
  var import_types = require("@smithy/types");
226
226
 
227
227
  // src/protocols/Aws_restJson1.ts
228
+ var import_core2 = require("@aws-sdk/core");
228
229
 
229
230
 
230
231
  var import_uuid = require("uuid");
@@ -748,7 +749,7 @@ var de_CreateModelCustomizationJobCommand = /* @__PURE__ */ __name(async (output
748
749
  const contents = (0, import_smithy_client.map)({
749
750
  $metadata: deserializeMetadata(output)
750
751
  });
751
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
752
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
752
753
  const doc = (0, import_smithy_client.take)(data, {
753
754
  jobArn: import_smithy_client.expectString
754
755
  });
@@ -762,7 +763,7 @@ var de_CreateProvisionedModelThroughputCommand = /* @__PURE__ */ __name(async (o
762
763
  const contents = (0, import_smithy_client.map)({
763
764
  $metadata: deserializeMetadata(output)
764
765
  });
765
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
766
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
766
767
  const doc = (0, import_smithy_client.take)(data, {
767
768
  provisionedModelArn: import_smithy_client.expectString
768
769
  });
@@ -806,7 +807,7 @@ var de_GetCustomModelCommand = /* @__PURE__ */ __name(async (output, context) =>
806
807
  const contents = (0, import_smithy_client.map)({
807
808
  $metadata: deserializeMetadata(output)
808
809
  });
809
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
810
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
810
811
  const doc = (0, import_smithy_client.take)(data, {
811
812
  baseModelArn: import_smithy_client.expectString,
812
813
  creationTime: (_) => (0, import_smithy_client.expectNonNull)((0, import_smithy_client.parseRfc3339DateTimeWithOffset)(_)),
@@ -833,7 +834,7 @@ var de_GetFoundationModelCommand = /* @__PURE__ */ __name(async (output, context
833
834
  const contents = (0, import_smithy_client.map)({
834
835
  $metadata: deserializeMetadata(output)
835
836
  });
836
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
837
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
837
838
  const doc = (0, import_smithy_client.take)(data, {
838
839
  modelDetails: import_smithy_client._json
839
840
  });
@@ -847,7 +848,7 @@ var de_GetModelCustomizationJobCommand = /* @__PURE__ */ __name(async (output, c
847
848
  const contents = (0, import_smithy_client.map)({
848
849
  $metadata: deserializeMetadata(output)
849
850
  });
850
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
851
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
851
852
  const doc = (0, import_smithy_client.take)(data, {
852
853
  baseModelArn: import_smithy_client.expectString,
853
854
  clientRequestToken: import_smithy_client.expectString,
@@ -881,7 +882,7 @@ var de_GetModelInvocationLoggingConfigurationCommand = /* @__PURE__ */ __name(as
881
882
  const contents = (0, import_smithy_client.map)({
882
883
  $metadata: deserializeMetadata(output)
883
884
  });
884
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
885
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
885
886
  const doc = (0, import_smithy_client.take)(data, {
886
887
  loggingConfig: import_smithy_client._json
887
888
  });
@@ -895,7 +896,7 @@ var de_GetProvisionedModelThroughputCommand = /* @__PURE__ */ __name(async (outp
895
896
  const contents = (0, import_smithy_client.map)({
896
897
  $metadata: deserializeMetadata(output)
897
898
  });
898
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
899
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
899
900
  const doc = (0, import_smithy_client.take)(data, {
900
901
  commitmentDuration: import_smithy_client.expectString,
901
902
  commitmentExpirationTime: (_) => (0, import_smithy_client.expectNonNull)((0, import_smithy_client.parseRfc3339DateTimeWithOffset)(_)),
@@ -921,7 +922,7 @@ var de_ListCustomModelsCommand = /* @__PURE__ */ __name(async (output, context)
921
922
  const contents = (0, import_smithy_client.map)({
922
923
  $metadata: deserializeMetadata(output)
923
924
  });
924
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
925
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
925
926
  const doc = (0, import_smithy_client.take)(data, {
926
927
  modelSummaries: (_) => de_CustomModelSummaryList(_, context),
927
928
  nextToken: import_smithy_client.expectString
@@ -936,7 +937,7 @@ var de_ListFoundationModelsCommand = /* @__PURE__ */ __name(async (output, conte
936
937
  const contents = (0, import_smithy_client.map)({
937
938
  $metadata: deserializeMetadata(output)
938
939
  });
939
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
940
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
940
941
  const doc = (0, import_smithy_client.take)(data, {
941
942
  modelSummaries: import_smithy_client._json
942
943
  });
@@ -950,7 +951,7 @@ var de_ListModelCustomizationJobsCommand = /* @__PURE__ */ __name(async (output,
950
951
  const contents = (0, import_smithy_client.map)({
951
952
  $metadata: deserializeMetadata(output)
952
953
  });
953
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
954
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
954
955
  const doc = (0, import_smithy_client.take)(data, {
955
956
  modelCustomizationJobSummaries: (_) => de_ModelCustomizationJobSummaries(_, context),
956
957
  nextToken: import_smithy_client.expectString
@@ -965,7 +966,7 @@ var de_ListProvisionedModelThroughputsCommand = /* @__PURE__ */ __name(async (ou
965
966
  const contents = (0, import_smithy_client.map)({
966
967
  $metadata: deserializeMetadata(output)
967
968
  });
968
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
969
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
969
970
  const doc = (0, import_smithy_client.take)(data, {
970
971
  nextToken: import_smithy_client.expectString,
971
972
  provisionedModelSummaries: (_) => de_ProvisionedModelSummaries(_, context)
@@ -980,7 +981,7 @@ var de_ListTagsForResourceCommand = /* @__PURE__ */ __name(async (output, contex
980
981
  const contents = (0, import_smithy_client.map)({
981
982
  $metadata: deserializeMetadata(output)
982
983
  });
983
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
984
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
984
985
  const doc = (0, import_smithy_client.take)(data, {
985
986
  tags: import_smithy_client._json
986
987
  });
@@ -1040,9 +1041,9 @@ var de_UpdateProvisionedModelThroughputCommand = /* @__PURE__ */ __name(async (o
1040
1041
  var de_CommandError = /* @__PURE__ */ __name(async (output, context) => {
1041
1042
  const parsedOutput = {
1042
1043
  ...output,
1043
- body: await parseErrorBody(output.body, context)
1044
+ body: await (0, import_core2.parseJsonErrorBody)(output.body, context)
1044
1045
  };
1045
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1046
+ const errorCode = (0, import_core2.loadRestJsonErrorCode)(output, parsedOutput.body);
1046
1047
  switch (errorCode) {
1047
1048
  case "AccessDeniedException":
1048
1049
  case "com.amazonaws.bedrock#AccessDeniedException":
@@ -1263,7 +1264,6 @@ var deserializeMetadata = /* @__PURE__ */ __name((output) => ({
1263
1264
  extendedRequestId: output.headers["x-amz-id-2"],
1264
1265
  cfId: output.headers["x-amz-cf-id"]
1265
1266
  }), "deserializeMetadata");
1266
- var collectBodyString = /* @__PURE__ */ __name((streamBody, context) => (0, import_smithy_client.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body)), "collectBodyString");
1267
1267
  var _bCT = "byCustomizationType";
1268
1268
  var _bIT = "byInferenceType";
1269
1269
  var _bMAE = "baseModelArnEquals";
@@ -1279,46 +1279,6 @@ var _nT = "nextToken";
1279
1279
  var _sB = "sortBy";
1280
1280
  var _sE = "statusEquals";
1281
1281
  var _sO = "sortOrder";
1282
- var parseBody = /* @__PURE__ */ __name((streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
1283
- if (encoded.length) {
1284
- return JSON.parse(encoded);
1285
- }
1286
- return {};
1287
- }), "parseBody");
1288
- var parseErrorBody = /* @__PURE__ */ __name(async (errorBody, context) => {
1289
- const value = await parseBody(errorBody, context);
1290
- value.message = value.message ?? value.Message;
1291
- return value;
1292
- }, "parseErrorBody");
1293
- var loadRestJsonErrorCode = /* @__PURE__ */ __name((output, data) => {
1294
- const findKey = /* @__PURE__ */ __name((object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase()), "findKey");
1295
- const sanitizeErrorCode = /* @__PURE__ */ __name((rawValue) => {
1296
- let cleanValue = rawValue;
1297
- if (typeof cleanValue === "number") {
1298
- cleanValue = cleanValue.toString();
1299
- }
1300
- if (cleanValue.indexOf(",") >= 0) {
1301
- cleanValue = cleanValue.split(",")[0];
1302
- }
1303
- if (cleanValue.indexOf(":") >= 0) {
1304
- cleanValue = cleanValue.split(":")[0];
1305
- }
1306
- if (cleanValue.indexOf("#") >= 0) {
1307
- cleanValue = cleanValue.split("#")[1];
1308
- }
1309
- return cleanValue;
1310
- }, "sanitizeErrorCode");
1311
- const headerKey = findKey(output.headers, "x-amzn-errortype");
1312
- if (headerKey !== void 0) {
1313
- return sanitizeErrorCode(output.headers[headerKey]);
1314
- }
1315
- if (data.code !== void 0) {
1316
- return sanitizeErrorCode(data.code);
1317
- }
1318
- if (data["__type"] !== void 0) {
1319
- return sanitizeErrorCode(data["__type"]);
1320
- }
1321
- }, "loadRestJsonErrorCode");
1322
1282
 
1323
1283
  // src/commands/CreateModelCustomizationJobCommand.ts
1324
1284
  var _CreateModelCustomizationJobCommand = class _CreateModelCustomizationJobCommand 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, expectObject as __expectObject, expectString as __expectString, limitedParseFloat32 as __limitedParseFloat32, map, parseRfc3339DateTimeWithOffset as __parseRfc3339DateTimeWithOffset, take, withBaseException, } from "@smithy/smithy-client";
3
4
  import { v4 as generateIdempotencyToken } from "uuid";
@@ -840,43 +841,3 @@ const _nT = "nextToken";
840
841
  const _sB = "sortBy";
841
842
  const _sE = "statusEquals";
842
843
  const _sO = "sortOrder";
843
- const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
844
- if (encoded.length) {
845
- return JSON.parse(encoded);
846
- }
847
- return {};
848
- });
849
- const parseErrorBody = async (errorBody, context) => {
850
- const value = await parseBody(errorBody, context);
851
- value.message = value.message ?? value.Message;
852
- return value;
853
- };
854
- const loadRestJsonErrorCode = (output, data) => {
855
- const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
856
- const sanitizeErrorCode = (rawValue) => {
857
- let cleanValue = rawValue;
858
- if (typeof cleanValue === "number") {
859
- cleanValue = cleanValue.toString();
860
- }
861
- if (cleanValue.indexOf(",") >= 0) {
862
- cleanValue = cleanValue.split(",")[0];
863
- }
864
- if (cleanValue.indexOf(":") >= 0) {
865
- cleanValue = cleanValue.split(":")[0];
866
- }
867
- if (cleanValue.indexOf("#") >= 0) {
868
- cleanValue = cleanValue.split("#")[1];
869
- }
870
- return cleanValue;
871
- };
872
- const headerKey = findKey(output.headers, "x-amzn-errortype");
873
- if (headerKey !== undefined) {
874
- return sanitizeErrorCode(output.headers[headerKey]);
875
- }
876
- if (data.code !== undefined) {
877
- return sanitizeErrorCode(data.code);
878
- }
879
- if (data["__type"] !== undefined) {
880
- return sanitizeErrorCode(data["__type"]);
881
- }
882
- };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aws-sdk/client-bedrock",
3
3
  "description": "AWS SDK for JavaScript Bedrock 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-bedrock",
@@ -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",