@aws-sdk/client-bedrock-agent-runtime 3.524.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
@@ -837,7 +837,7 @@ var de_RetrieveCommand = /* @__PURE__ */ __name(async (output, context) => {
837
837
  const contents = (0, import_smithy_client.map)({
838
838
  $metadata: deserializeMetadata(output)
839
839
  });
840
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
840
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
841
841
  const doc = (0, import_smithy_client.take)(data, {
842
842
  nextToken: import_smithy_client.expectString,
843
843
  retrievalResults: (_) => de_KnowledgeBaseRetrievalResults(_, context)
@@ -852,7 +852,7 @@ var de_RetrieveAndGenerateCommand = /* @__PURE__ */ __name(async (output, contex
852
852
  const contents = (0, import_smithy_client.map)({
853
853
  $metadata: deserializeMetadata(output)
854
854
  });
855
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
855
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
856
856
  const doc = (0, import_smithy_client.take)(data, {
857
857
  citations: import_smithy_client._json,
858
858
  output: import_smithy_client._json,
@@ -864,9 +864,9 @@ var de_RetrieveAndGenerateCommand = /* @__PURE__ */ __name(async (output, contex
864
864
  var de_CommandError = /* @__PURE__ */ __name(async (output, context) => {
865
865
  const parsedOutput = {
866
866
  ...output,
867
- body: await parseErrorBody(output.body, context)
867
+ body: await (0, import_core2.parseJsonErrorBody)(output.body, context)
868
868
  };
869
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
869
+ const errorCode = (0, import_core2.loadRestJsonErrorCode)(output, parsedOutput.body);
870
870
  switch (errorCode) {
871
871
  case "AccessDeniedException":
872
872
  case "com.amazonaws.bedrockagentruntime#AccessDeniedException":
@@ -1096,75 +1096,75 @@ var de_ResponseStream = /* @__PURE__ */ __name((output, context) => {
1096
1096
  var de_AccessDeniedException_event = /* @__PURE__ */ __name(async (output, context) => {
1097
1097
  const parsedOutput = {
1098
1098
  ...output,
1099
- body: await parseBody(output.body, context)
1099
+ body: await (0, import_core2.parseJsonBody)(output.body, context)
1100
1100
  };
1101
1101
  return de_AccessDeniedExceptionRes(parsedOutput, context);
1102
1102
  }, "de_AccessDeniedException_event");
1103
1103
  var de_BadGatewayException_event = /* @__PURE__ */ __name(async (output, context) => {
1104
1104
  const parsedOutput = {
1105
1105
  ...output,
1106
- body: await parseBody(output.body, context)
1106
+ body: await (0, import_core2.parseJsonBody)(output.body, context)
1107
1107
  };
1108
1108
  return de_BadGatewayExceptionRes(parsedOutput, context);
1109
1109
  }, "de_BadGatewayException_event");
1110
1110
  var de_ConflictException_event = /* @__PURE__ */ __name(async (output, context) => {
1111
1111
  const parsedOutput = {
1112
1112
  ...output,
1113
- body: await parseBody(output.body, context)
1113
+ body: await (0, import_core2.parseJsonBody)(output.body, context)
1114
1114
  };
1115
1115
  return de_ConflictExceptionRes(parsedOutput, context);
1116
1116
  }, "de_ConflictException_event");
1117
1117
  var de_DependencyFailedException_event = /* @__PURE__ */ __name(async (output, context) => {
1118
1118
  const parsedOutput = {
1119
1119
  ...output,
1120
- body: await parseBody(output.body, context)
1120
+ body: await (0, import_core2.parseJsonBody)(output.body, context)
1121
1121
  };
1122
1122
  return de_DependencyFailedExceptionRes(parsedOutput, context);
1123
1123
  }, "de_DependencyFailedException_event");
1124
1124
  var de_InternalServerException_event = /* @__PURE__ */ __name(async (output, context) => {
1125
1125
  const parsedOutput = {
1126
1126
  ...output,
1127
- body: await parseBody(output.body, context)
1127
+ body: await (0, import_core2.parseJsonBody)(output.body, context)
1128
1128
  };
1129
1129
  return de_InternalServerExceptionRes(parsedOutput, context);
1130
1130
  }, "de_InternalServerException_event");
1131
1131
  var de_PayloadPart_event = /* @__PURE__ */ __name(async (output, context) => {
1132
1132
  const contents = {};
1133
- const data = await parseBody(output.body, context);
1133
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
1134
1134
  Object.assign(contents, de_PayloadPart(data, context));
1135
1135
  return contents;
1136
1136
  }, "de_PayloadPart_event");
1137
1137
  var de_ResourceNotFoundException_event = /* @__PURE__ */ __name(async (output, context) => {
1138
1138
  const parsedOutput = {
1139
1139
  ...output,
1140
- body: await parseBody(output.body, context)
1140
+ body: await (0, import_core2.parseJsonBody)(output.body, context)
1141
1141
  };
1142
1142
  return de_ResourceNotFoundExceptionRes(parsedOutput, context);
1143
1143
  }, "de_ResourceNotFoundException_event");
1144
1144
  var de_ServiceQuotaExceededException_event = /* @__PURE__ */ __name(async (output, context) => {
1145
1145
  const parsedOutput = {
1146
1146
  ...output,
1147
- body: await parseBody(output.body, context)
1147
+ body: await (0, import_core2.parseJsonBody)(output.body, context)
1148
1148
  };
1149
1149
  return de_ServiceQuotaExceededExceptionRes(parsedOutput, context);
1150
1150
  }, "de_ServiceQuotaExceededException_event");
1151
1151
  var de_ThrottlingException_event = /* @__PURE__ */ __name(async (output, context) => {
1152
1152
  const parsedOutput = {
1153
1153
  ...output,
1154
- body: await parseBody(output.body, context)
1154
+ body: await (0, import_core2.parseJsonBody)(output.body, context)
1155
1155
  };
1156
1156
  return de_ThrottlingExceptionRes(parsedOutput, context);
1157
1157
  }, "de_ThrottlingException_event");
1158
1158
  var de_TracePart_event = /* @__PURE__ */ __name(async (output, context) => {
1159
1159
  const contents = {};
1160
- const data = await parseBody(output.body, context);
1160
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
1161
1161
  Object.assign(contents, de_TracePart(data, context));
1162
1162
  return contents;
1163
1163
  }, "de_TracePart_event");
1164
1164
  var de_ValidationException_event = /* @__PURE__ */ __name(async (output, context) => {
1165
1165
  const parsedOutput = {
1166
1166
  ...output,
1167
- body: await parseBody(output.body, context)
1167
+ body: await (0, import_core2.parseJsonBody)(output.body, context)
1168
1168
  };
1169
1169
  return de_ValidationExceptionRes(parsedOutput, context);
1170
1170
  }, "de_ValidationException_event");
@@ -1293,51 +1293,10 @@ var deserializeMetadata = /* @__PURE__ */ __name((output) => ({
1293
1293
  extendedRequestId: output.headers["x-amz-id-2"],
1294
1294
  cfId: output.headers["x-amz-cf-id"]
1295
1295
  }), "deserializeMetadata");
1296
- var collectBodyString = /* @__PURE__ */ __name((streamBody, context) => (0, import_smithy_client.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body)), "collectBodyString");
1297
1296
  var _cT = "contentType";
1298
1297
  var _sI = "sessionId";
1299
1298
  var _xabact = "x-amzn-bedrock-agent-content-type";
1300
1299
  var _xabasi = "x-amz-bedrock-agent-session-id";
1301
- var parseBody = /* @__PURE__ */ __name((streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
1302
- if (encoded.length) {
1303
- return JSON.parse(encoded);
1304
- }
1305
- return {};
1306
- }), "parseBody");
1307
- var parseErrorBody = /* @__PURE__ */ __name(async (errorBody, context) => {
1308
- const value = await parseBody(errorBody, context);
1309
- value.message = value.message ?? value.Message;
1310
- return value;
1311
- }, "parseErrorBody");
1312
- var loadRestJsonErrorCode = /* @__PURE__ */ __name((output, data) => {
1313
- const findKey = /* @__PURE__ */ __name((object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase()), "findKey");
1314
- const sanitizeErrorCode = /* @__PURE__ */ __name((rawValue) => {
1315
- let cleanValue = rawValue;
1316
- if (typeof cleanValue === "number") {
1317
- cleanValue = cleanValue.toString();
1318
- }
1319
- if (cleanValue.indexOf(",") >= 0) {
1320
- cleanValue = cleanValue.split(",")[0];
1321
- }
1322
- if (cleanValue.indexOf(":") >= 0) {
1323
- cleanValue = cleanValue.split(":")[0];
1324
- }
1325
- if (cleanValue.indexOf("#") >= 0) {
1326
- cleanValue = cleanValue.split("#")[1];
1327
- }
1328
- return cleanValue;
1329
- }, "sanitizeErrorCode");
1330
- const headerKey = findKey(output.headers, "x-amzn-errortype");
1331
- if (headerKey !== void 0) {
1332
- return sanitizeErrorCode(output.headers[headerKey]);
1333
- }
1334
- if (data.code !== void 0) {
1335
- return sanitizeErrorCode(data.code);
1336
- }
1337
- if (data["__type"] !== void 0) {
1338
- return sanitizeErrorCode(data["__type"]);
1339
- }
1340
- }, "loadRestJsonErrorCode");
1341
1300
 
1342
1301
  // src/commands/InvokeAgentCommand.ts
1343
1302
  var _InvokeAgentCommand = class _InvokeAgentCommand extends import_smithy_client.Command.classBuilder().ep({
@@ -1,4 +1,4 @@
1
- import { awsExpectUnion as __expectUnion } from "@aws-sdk/core";
1
+ import { awsExpectUnion as __expectUnion, loadRestJsonErrorCode, parseJsonBody as parseBody, parseJsonErrorBody as parseErrorBody, } from "@aws-sdk/core";
2
2
  import { requestBuilder as rb } from "@smithy/core";
3
3
  import { _json, collectBody, decorateServiceException as __decorateServiceException, expectInt32 as __expectInt32, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, limitedParseDouble as __limitedParseDouble, limitedParseFloat32 as __limitedParseFloat32, map, take, withBaseException, } from "@smithy/smithy-client";
4
4
  import { BedrockAgentRuntimeServiceException as __BaseException } from "../models/BedrockAgentRuntimeServiceException";
@@ -533,43 +533,3 @@ const _cT = "contentType";
533
533
  const _sI = "sessionId";
534
534
  const _xabact = "x-amzn-bedrock-agent-content-type";
535
535
  const _xabasi = "x-amz-bedrock-agent-session-id";
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-bedrock-agent-runtime",
3
3
  "description": "AWS SDK for JavaScript Bedrock Agent Runtime Client for Node.js, Browser and React Native",
4
- "version": "3.524.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-agent-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-utf8": "^2.1.1",
@@ -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");
@@ -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");