@aws-sdk/client-bedrock-runtime 3.523.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
@@ -449,6 +449,7 @@ var InvokeModelWithResponseStreamResponseFilterSensitiveLog = /* @__PURE__ */ __
449
449
  }), "InvokeModelWithResponseStreamResponseFilterSensitiveLog");
450
450
 
451
451
  // src/protocols/Aws_restJson1.ts
452
+ var import_core2 = require("@aws-sdk/core");
452
453
 
453
454
 
454
455
  var se_InvokeModelCommand = /* @__PURE__ */ __name(async (input, context) => {
@@ -508,9 +509,9 @@ var de_InvokeModelWithResponseStreamCommand = /* @__PURE__ */ __name(async (outp
508
509
  var de_CommandError = /* @__PURE__ */ __name(async (output, context) => {
509
510
  const parsedOutput = {
510
511
  ...output,
511
- body: await parseErrorBody(output.body, context)
512
+ body: await (0, import_core2.parseJsonErrorBody)(output.body, context)
512
513
  };
513
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
514
+ const errorCode = (0, import_core2.loadRestJsonErrorCode)(output, parsedOutput.body);
514
515
  switch (errorCode) {
515
516
  case "AccessDeniedException":
516
517
  case "com.amazonaws.bedrockruntime#AccessDeniedException":
@@ -727,41 +728,41 @@ var de_ResponseStream = /* @__PURE__ */ __name((output, context) => {
727
728
  var de_InternalServerException_event = /* @__PURE__ */ __name(async (output, context) => {
728
729
  const parsedOutput = {
729
730
  ...output,
730
- body: await parseBody(output.body, context)
731
+ body: await (0, import_core2.parseJsonBody)(output.body, context)
731
732
  };
732
733
  return de_InternalServerExceptionRes(parsedOutput, context);
733
734
  }, "de_InternalServerException_event");
734
735
  var de_ModelStreamErrorException_event = /* @__PURE__ */ __name(async (output, context) => {
735
736
  const parsedOutput = {
736
737
  ...output,
737
- body: await parseBody(output.body, context)
738
+ body: await (0, import_core2.parseJsonBody)(output.body, context)
738
739
  };
739
740
  return de_ModelStreamErrorExceptionRes(parsedOutput, context);
740
741
  }, "de_ModelStreamErrorException_event");
741
742
  var de_ModelTimeoutException_event = /* @__PURE__ */ __name(async (output, context) => {
742
743
  const parsedOutput = {
743
744
  ...output,
744
- body: await parseBody(output.body, context)
745
+ body: await (0, import_core2.parseJsonBody)(output.body, context)
745
746
  };
746
747
  return de_ModelTimeoutExceptionRes(parsedOutput, context);
747
748
  }, "de_ModelTimeoutException_event");
748
749
  var de_PayloadPart_event = /* @__PURE__ */ __name(async (output, context) => {
749
750
  const contents = {};
750
- const data = await parseBody(output.body, context);
751
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
751
752
  Object.assign(contents, de_PayloadPart(data, context));
752
753
  return contents;
753
754
  }, "de_PayloadPart_event");
754
755
  var de_ThrottlingException_event = /* @__PURE__ */ __name(async (output, context) => {
755
756
  const parsedOutput = {
756
757
  ...output,
757
- body: await parseBody(output.body, context)
758
+ body: await (0, import_core2.parseJsonBody)(output.body, context)
758
759
  };
759
760
  return de_ThrottlingExceptionRes(parsedOutput, context);
760
761
  }, "de_ThrottlingException_event");
761
762
  var de_ValidationException_event = /* @__PURE__ */ __name(async (output, context) => {
762
763
  const parsedOutput = {
763
764
  ...output,
764
- body: await parseBody(output.body, context)
765
+ body: await (0, import_core2.parseJsonBody)(output.body, context)
765
766
  };
766
767
  return de_ValidationExceptionRes(parsedOutput, context);
767
768
  }, "de_ValidationException_event");
@@ -776,53 +777,12 @@ var deserializeMetadata = /* @__PURE__ */ __name((output) => ({
776
777
  extendedRequestId: output.headers["x-amz-id-2"],
777
778
  cfId: output.headers["x-amz-cf-id"]
778
779
  }), "deserializeMetadata");
779
- var collectBodyString = /* @__PURE__ */ __name((streamBody, context) => (0, import_smithy_client.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body)), "collectBodyString");
780
780
  var isSerializableHeaderValue = /* @__PURE__ */ __name((value) => value !== void 0 && value !== null && value !== "" && (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) && (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0), "isSerializableHeaderValue");
781
781
  var _a = "accept";
782
782
  var _cT = "contentType";
783
783
  var _ct = "content-type";
784
784
  var _xaba = "x-amzn-bedrock-accept";
785
785
  var _xabct = "x-amzn-bedrock-content-type";
786
- var parseBody = /* @__PURE__ */ __name((streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
787
- if (encoded.length) {
788
- return JSON.parse(encoded);
789
- }
790
- return {};
791
- }), "parseBody");
792
- var parseErrorBody = /* @__PURE__ */ __name(async (errorBody, context) => {
793
- const value = await parseBody(errorBody, context);
794
- value.message = value.message ?? value.Message;
795
- return value;
796
- }, "parseErrorBody");
797
- var loadRestJsonErrorCode = /* @__PURE__ */ __name((output, data) => {
798
- const findKey = /* @__PURE__ */ __name((object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase()), "findKey");
799
- const sanitizeErrorCode = /* @__PURE__ */ __name((rawValue) => {
800
- let cleanValue = rawValue;
801
- if (typeof cleanValue === "number") {
802
- cleanValue = cleanValue.toString();
803
- }
804
- if (cleanValue.indexOf(",") >= 0) {
805
- cleanValue = cleanValue.split(",")[0];
806
- }
807
- if (cleanValue.indexOf(":") >= 0) {
808
- cleanValue = cleanValue.split(":")[0];
809
- }
810
- if (cleanValue.indexOf("#") >= 0) {
811
- cleanValue = cleanValue.split("#")[1];
812
- }
813
- return cleanValue;
814
- }, "sanitizeErrorCode");
815
- const headerKey = findKey(output.headers, "x-amzn-errortype");
816
- if (headerKey !== void 0) {
817
- return sanitizeErrorCode(output.headers[headerKey]);
818
- }
819
- if (data.code !== void 0) {
820
- return sanitizeErrorCode(data.code);
821
- }
822
- if (data["__type"] !== void 0) {
823
- return sanitizeErrorCode(data["__type"]);
824
- }
825
- }, "loadRestJsonErrorCode");
826
786
 
827
787
  // src/commands/InvokeModelCommand.ts
828
788
  var _InvokeModelCommand = class _InvokeModelCommand 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 { collectBody, decorateServiceException as __decorateServiceException, expectInt32 as __expectInt32, expectString as __expectString, map, take, withBaseException, } from "@smithy/smithy-client";
3
4
  import { BedrockRuntimeServiceException as __BaseException } from "../models/BedrockRuntimeServiceException";
@@ -335,43 +336,3 @@ const _cT = "contentType";
335
336
  const _ct = "content-type";
336
337
  const _xaba = "x-amzn-bedrock-accept";
337
338
  const _xabct = "x-amzn-bedrock-content-type";
338
- const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
339
- if (encoded.length) {
340
- return JSON.parse(encoded);
341
- }
342
- return {};
343
- });
344
- const parseErrorBody = async (errorBody, context) => {
345
- const value = await parseBody(errorBody, context);
346
- value.message = value.message ?? value.Message;
347
- return value;
348
- };
349
- const loadRestJsonErrorCode = (output, data) => {
350
- const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
351
- const sanitizeErrorCode = (rawValue) => {
352
- let cleanValue = rawValue;
353
- if (typeof cleanValue === "number") {
354
- cleanValue = cleanValue.toString();
355
- }
356
- if (cleanValue.indexOf(",") >= 0) {
357
- cleanValue = cleanValue.split(",")[0];
358
- }
359
- if (cleanValue.indexOf(":") >= 0) {
360
- cleanValue = cleanValue.split(":")[0];
361
- }
362
- if (cleanValue.indexOf("#") >= 0) {
363
- cleanValue = cleanValue.split("#")[1];
364
- }
365
- return cleanValue;
366
- };
367
- const headerKey = findKey(output.headers, "x-amzn-errortype");
368
- if (headerKey !== undefined) {
369
- return sanitizeErrorCode(output.headers[headerKey]);
370
- }
371
- if (data.code !== undefined) {
372
- return sanitizeErrorCode(data.code);
373
- }
374
- if (data["__type"] !== undefined) {
375
- return sanitizeErrorCode(data["__type"]);
376
- }
377
- };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aws-sdk/client-bedrock-runtime",
3
3
  "description": "AWS SDK for JavaScript Bedrock Runtime Client for Node.js, Browser and React Native",
4
- "version": "3.523.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-runtime",
@@ -20,20 +20,20 @@
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.523.0",
24
- "@aws-sdk/core": "3.523.0",
25
- "@aws-sdk/credential-provider-node": "3.523.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",
29
- "@aws-sdk/middleware-user-agent": "3.523.0",
30
- "@aws-sdk/region-config-resolver": "3.523.0",
29
+ "@aws-sdk/middleware-user-agent": "3.525.0",
30
+ "@aws-sdk/region-config-resolver": "3.525.0",
31
31
  "@aws-sdk/types": "3.523.0",
32
- "@aws-sdk/util-endpoints": "3.523.0",
32
+ "@aws-sdk/util-endpoints": "3.525.0",
33
33
  "@aws-sdk/util-user-agent-browser": "3.523.0",
34
- "@aws-sdk/util-user-agent-node": "3.523.0",
35
- "@smithy/config-resolver": "^2.1.3",
36
- "@smithy/core": "^1.3.4",
34
+ "@aws-sdk/util-user-agent-node": "3.525.0",
35
+ "@smithy/config-resolver": "^2.1.4",
36
+ "@smithy/core": "^1.3.5",
37
37
  "@smithy/eventstream-serde-browser": "^2.1.3",
38
38
  "@smithy/eventstream-serde-config-resolver": "^2.1.3",
39
39
  "@smithy/eventstream-serde-node": "^2.1.3",
@@ -41,22 +41,22 @@
41
41
  "@smithy/hash-node": "^2.1.3",
42
42
  "@smithy/invalid-dependency": "^2.1.3",
43
43
  "@smithy/middleware-content-length": "^2.1.3",
44
- "@smithy/middleware-endpoint": "^2.4.3",
45
- "@smithy/middleware-retry": "^2.1.3",
44
+ "@smithy/middleware-endpoint": "^2.4.4",
45
+ "@smithy/middleware-retry": "^2.1.4",
46
46
  "@smithy/middleware-serde": "^2.1.3",
47
47
  "@smithy/middleware-stack": "^2.1.3",
48
- "@smithy/node-config-provider": "^2.2.3",
48
+ "@smithy/node-config-provider": "^2.2.4",
49
49
  "@smithy/node-http-handler": "^2.4.1",
50
50
  "@smithy/protocol-http": "^3.2.1",
51
- "@smithy/smithy-client": "^2.4.1",
51
+ "@smithy/smithy-client": "^2.4.2",
52
52
  "@smithy/types": "^2.10.1",
53
53
  "@smithy/url-parser": "^2.1.3",
54
54
  "@smithy/util-base64": "^2.1.1",
55
55
  "@smithy/util-body-length-browser": "^2.1.1",
56
56
  "@smithy/util-body-length-node": "^2.2.1",
57
- "@smithy/util-defaults-mode-browser": "^2.1.3",
58
- "@smithy/util-defaults-mode-node": "^2.2.2",
59
- "@smithy/util-endpoints": "^1.1.3",
57
+ "@smithy/util-defaults-mode-browser": "^2.1.4",
58
+ "@smithy/util-defaults-mode-node": "^2.2.3",
59
+ "@smithy/util-endpoints": "^1.1.4",
60
60
  "@smithy/util-middleware": "^2.1.3",
61
61
  "@smithy/util-retry": "^2.1.3",
62
62
  "@smithy/util-stream": "^2.1.3",
@@ -1 +0,0 @@
1
- module.exports = require("./index.js");
@@ -1 +0,0 @@
1
- module.exports = require("./index.js");
@@ -1 +0,0 @@
1
- module.exports = require("../index.js");
@@ -1 +0,0 @@
1
- module.exports = require("../index.js");
@@ -1 +0,0 @@
1
- module.exports = require("../index.js");
@@ -1 +0,0 @@
1
- module.exports = require("../index.js");
@@ -1 +0,0 @@
1
- module.exports = require("../index.js");
@@ -1 +0,0 @@
1
- module.exports = require("./index.js");
@@ -1 +0,0 @@
1
- module.exports = require("../index.js");
@@ -1 +0,0 @@
1
- module.exports = require("../index.js");
@@ -1 +0,0 @@
1
- module.exports = require("../index.js");
@@ -1 +0,0 @@
1
- module.exports = require("../index.js");
@@ -1 +0,0 @@
1
- module.exports = require("./index.js");