@aws-sdk/client-lex-runtime-v2 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
@@ -173,7 +173,8 @@ var import_middleware_serde = require("@smithy/middleware-serde");
173
173
  var import_types = require("@smithy/types");
174
174
 
175
175
  // src/protocols/Aws_restJson1.ts
176
- var import_core = require("@smithy/core");
176
+ var import_core = require("@aws-sdk/core");
177
+ var import_core2 = require("@smithy/core");
177
178
 
178
179
 
179
180
  // src/models/LexRuntimeV2ServiceException.ts
@@ -560,7 +561,7 @@ var StartConversationResponseFilterSensitiveLog = /* @__PURE__ */ __name((obj) =
560
561
 
561
562
  // src/protocols/Aws_restJson1.ts
562
563
  var se_DeleteSessionCommand = /* @__PURE__ */ __name(async (input, context) => {
563
- const b = (0, import_core.requestBuilder)(input, context);
564
+ const b = (0, import_core2.requestBuilder)(input, context);
564
565
  const headers = {};
565
566
  b.bp("/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}");
566
567
  b.p("botId", () => input.botId, "{botId}", false);
@@ -572,7 +573,7 @@ var se_DeleteSessionCommand = /* @__PURE__ */ __name(async (input, context) => {
572
573
  return b.build();
573
574
  }, "se_DeleteSessionCommand");
574
575
  var se_GetSessionCommand = /* @__PURE__ */ __name(async (input, context) => {
575
- const b = (0, import_core.requestBuilder)(input, context);
576
+ const b = (0, import_core2.requestBuilder)(input, context);
576
577
  const headers = {};
577
578
  b.bp("/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}");
578
579
  b.p("botId", () => input.botId, "{botId}", false);
@@ -584,7 +585,7 @@ var se_GetSessionCommand = /* @__PURE__ */ __name(async (input, context) => {
584
585
  return b.build();
585
586
  }, "se_GetSessionCommand");
586
587
  var se_PutSessionCommand = /* @__PURE__ */ __name(async (input, context) => {
587
- const b = (0, import_core.requestBuilder)(input, context);
588
+ const b = (0, import_core2.requestBuilder)(input, context);
588
589
  const headers = (0, import_smithy_client.map)({}, isSerializableHeaderValue, {
589
590
  "content-type": "application/json",
590
591
  [_r]: input[_rCT]
@@ -606,7 +607,7 @@ var se_PutSessionCommand = /* @__PURE__ */ __name(async (input, context) => {
606
607
  return b.build();
607
608
  }, "se_PutSessionCommand");
608
609
  var se_RecognizeTextCommand = /* @__PURE__ */ __name(async (input, context) => {
609
- const b = (0, import_core.requestBuilder)(input, context);
610
+ const b = (0, import_core2.requestBuilder)(input, context);
610
611
  const headers = {
611
612
  "content-type": "application/json"
612
613
  };
@@ -627,7 +628,7 @@ var se_RecognizeTextCommand = /* @__PURE__ */ __name(async (input, context) => {
627
628
  return b.build();
628
629
  }, "se_RecognizeTextCommand");
629
630
  var se_RecognizeUtteranceCommand = /* @__PURE__ */ __name(async (input, context) => {
630
- const b = (0, import_core.requestBuilder)(input, context);
631
+ const b = (0, import_core2.requestBuilder)(input, context);
631
632
  const headers = (0, import_smithy_client.map)({}, isSerializableHeaderValue, {
632
633
  "x-amz-content-sha256": "UNSIGNED-PAYLOAD",
633
634
  [_ct]: input[_rCTe] || "application/octet-stream",
@@ -648,7 +649,7 @@ var se_RecognizeUtteranceCommand = /* @__PURE__ */ __name(async (input, context)
648
649
  return b.build();
649
650
  }, "se_RecognizeUtteranceCommand");
650
651
  var se_StartConversationCommand = /* @__PURE__ */ __name(async (input, context) => {
651
- const b = (0, import_core.requestBuilder)(input, context);
652
+ const b = (0, import_core2.requestBuilder)(input, context);
652
653
  const headers = (0, import_smithy_client.map)({}, isSerializableHeaderValue, {
653
654
  [_xalcm]: input[_cM]
654
655
  });
@@ -671,7 +672,7 @@ var de_DeleteSessionCommand = /* @__PURE__ */ __name(async (output, context) =>
671
672
  const contents = (0, import_smithy_client.map)({
672
673
  $metadata: deserializeMetadata(output)
673
674
  });
674
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
675
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core.parseJsonBody)(output.body, context)), "body");
675
676
  const doc = (0, import_smithy_client.take)(data, {
676
677
  botAliasId: import_smithy_client.expectString,
677
678
  botId: import_smithy_client.expectString,
@@ -688,7 +689,7 @@ var de_GetSessionCommand = /* @__PURE__ */ __name(async (output, context) => {
688
689
  const contents = (0, import_smithy_client.map)({
689
690
  $metadata: deserializeMetadata(output)
690
691
  });
691
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
692
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core.parseJsonBody)(output.body, context)), "body");
692
693
  const doc = (0, import_smithy_client.take)(data, {
693
694
  interpretations: (_) => de_Interpretations(_, context),
694
695
  messages: import_smithy_client._json,
@@ -722,7 +723,7 @@ var de_RecognizeTextCommand = /* @__PURE__ */ __name(async (output, context) =>
722
723
  const contents = (0, import_smithy_client.map)({
723
724
  $metadata: deserializeMetadata(output)
724
725
  });
725
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
726
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core.parseJsonBody)(output.body, context)), "body");
726
727
  const doc = (0, import_smithy_client.take)(data, {
727
728
  interpretations: (_) => de_Interpretations(_, context),
728
729
  messages: import_smithy_client._json,
@@ -769,9 +770,9 @@ var de_StartConversationCommand = /* @__PURE__ */ __name(async (output, context)
769
770
  var de_CommandError = /* @__PURE__ */ __name(async (output, context) => {
770
771
  const parsedOutput = {
771
772
  ...output,
772
- body: await parseErrorBody(output.body, context)
773
+ body: await (0, import_core.parseJsonErrorBody)(output.body, context)
773
774
  };
774
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
775
+ const errorCode = (0, import_core.loadRestJsonErrorCode)(output, parsedOutput.body);
775
776
  switch (errorCode) {
776
777
  case "AccessDeniedException":
777
778
  case "com.amazonaws.lexruntimev2#AccessDeniedException":
@@ -1076,92 +1077,92 @@ var de_StartConversationResponseEventStream = /* @__PURE__ */ __name((output, co
1076
1077
  var de_AccessDeniedException_event = /* @__PURE__ */ __name(async (output, context) => {
1077
1078
  const parsedOutput = {
1078
1079
  ...output,
1079
- body: await parseBody(output.body, context)
1080
+ body: await (0, import_core.parseJsonBody)(output.body, context)
1080
1081
  };
1081
1082
  return de_AccessDeniedExceptionRes(parsedOutput, context);
1082
1083
  }, "de_AccessDeniedException_event");
1083
1084
  var de_AudioResponseEvent_event = /* @__PURE__ */ __name(async (output, context) => {
1084
1085
  const contents = {};
1085
- const data = await parseBody(output.body, context);
1086
+ const data = await (0, import_core.parseJsonBody)(output.body, context);
1086
1087
  Object.assign(contents, de_AudioResponseEvent(data, context));
1087
1088
  return contents;
1088
1089
  }, "de_AudioResponseEvent_event");
1089
1090
  var de_BadGatewayException_event = /* @__PURE__ */ __name(async (output, context) => {
1090
1091
  const parsedOutput = {
1091
1092
  ...output,
1092
- body: await parseBody(output.body, context)
1093
+ body: await (0, import_core.parseJsonBody)(output.body, context)
1093
1094
  };
1094
1095
  return de_BadGatewayExceptionRes(parsedOutput, context);
1095
1096
  }, "de_BadGatewayException_event");
1096
1097
  var de_ConflictException_event = /* @__PURE__ */ __name(async (output, context) => {
1097
1098
  const parsedOutput = {
1098
1099
  ...output,
1099
- body: await parseBody(output.body, context)
1100
+ body: await (0, import_core.parseJsonBody)(output.body, context)
1100
1101
  };
1101
1102
  return de_ConflictExceptionRes(parsedOutput, context);
1102
1103
  }, "de_ConflictException_event");
1103
1104
  var de_DependencyFailedException_event = /* @__PURE__ */ __name(async (output, context) => {
1104
1105
  const parsedOutput = {
1105
1106
  ...output,
1106
- body: await parseBody(output.body, context)
1107
+ body: await (0, import_core.parseJsonBody)(output.body, context)
1107
1108
  };
1108
1109
  return de_DependencyFailedExceptionRes(parsedOutput, context);
1109
1110
  }, "de_DependencyFailedException_event");
1110
1111
  var de_HeartbeatEvent_event = /* @__PURE__ */ __name(async (output, context) => {
1111
1112
  const contents = {};
1112
- const data = await parseBody(output.body, context);
1113
+ const data = await (0, import_core.parseJsonBody)(output.body, context);
1113
1114
  Object.assign(contents, (0, import_smithy_client._json)(data));
1114
1115
  return contents;
1115
1116
  }, "de_HeartbeatEvent_event");
1116
1117
  var de_IntentResultEvent_event = /* @__PURE__ */ __name(async (output, context) => {
1117
1118
  const contents = {};
1118
- const data = await parseBody(output.body, context);
1119
+ const data = await (0, import_core.parseJsonBody)(output.body, context);
1119
1120
  Object.assign(contents, de_IntentResultEvent(data, context));
1120
1121
  return contents;
1121
1122
  }, "de_IntentResultEvent_event");
1122
1123
  var de_InternalServerException_event = /* @__PURE__ */ __name(async (output, context) => {
1123
1124
  const parsedOutput = {
1124
1125
  ...output,
1125
- body: await parseBody(output.body, context)
1126
+ body: await (0, import_core.parseJsonBody)(output.body, context)
1126
1127
  };
1127
1128
  return de_InternalServerExceptionRes(parsedOutput, context);
1128
1129
  }, "de_InternalServerException_event");
1129
1130
  var de_PlaybackInterruptionEvent_event = /* @__PURE__ */ __name(async (output, context) => {
1130
1131
  const contents = {};
1131
- const data = await parseBody(output.body, context);
1132
+ const data = await (0, import_core.parseJsonBody)(output.body, context);
1132
1133
  Object.assign(contents, (0, import_smithy_client._json)(data));
1133
1134
  return contents;
1134
1135
  }, "de_PlaybackInterruptionEvent_event");
1135
1136
  var de_ResourceNotFoundException_event = /* @__PURE__ */ __name(async (output, context) => {
1136
1137
  const parsedOutput = {
1137
1138
  ...output,
1138
- body: await parseBody(output.body, context)
1139
+ body: await (0, import_core.parseJsonBody)(output.body, context)
1139
1140
  };
1140
1141
  return de_ResourceNotFoundExceptionRes(parsedOutput, context);
1141
1142
  }, "de_ResourceNotFoundException_event");
1142
1143
  var de_TextResponseEvent_event = /* @__PURE__ */ __name(async (output, context) => {
1143
1144
  const contents = {};
1144
- const data = await parseBody(output.body, context);
1145
+ const data = await (0, import_core.parseJsonBody)(output.body, context);
1145
1146
  Object.assign(contents, (0, import_smithy_client._json)(data));
1146
1147
  return contents;
1147
1148
  }, "de_TextResponseEvent_event");
1148
1149
  var de_ThrottlingException_event = /* @__PURE__ */ __name(async (output, context) => {
1149
1150
  const parsedOutput = {
1150
1151
  ...output,
1151
- body: await parseBody(output.body, context)
1152
+ body: await (0, import_core.parseJsonBody)(output.body, context)
1152
1153
  };
1153
1154
  return de_ThrottlingExceptionRes(parsedOutput, context);
1154
1155
  }, "de_ThrottlingException_event");
1155
1156
  var de_TranscriptEvent_event = /* @__PURE__ */ __name(async (output, context) => {
1156
1157
  const contents = {};
1157
- const data = await parseBody(output.body, context);
1158
+ const data = await (0, import_core.parseJsonBody)(output.body, context);
1158
1159
  Object.assign(contents, (0, import_smithy_client._json)(data));
1159
1160
  return contents;
1160
1161
  }, "de_TranscriptEvent_event");
1161
1162
  var de_ValidationException_event = /* @__PURE__ */ __name(async (output, context) => {
1162
1163
  const parsedOutput = {
1163
1164
  ...output,
1164
- body: await parseBody(output.body, context)
1165
+ body: await (0, import_core.parseJsonBody)(output.body, context)
1165
1166
  };
1166
1167
  return de_ValidationExceptionRes(parsedOutput, context);
1167
1168
  }, "de_ValidationException_event");
@@ -1411,7 +1412,6 @@ var deserializeMetadata = /* @__PURE__ */ __name((output) => ({
1411
1412
  extendedRequestId: output.headers["x-amz-id-2"],
1412
1413
  cfId: output.headers["x-amz-cf-id"]
1413
1414
  }), "deserializeMetadata");
1414
- var collectBodyString = /* @__PURE__ */ __name((streamBody, context) => (0, import_smithy_client.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body)), "collectBodyString");
1415
1415
  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");
1416
1416
  var _cM = "conversationMode";
1417
1417
  var _cT = "contentType";
@@ -1437,46 +1437,6 @@ var _xalra = "x-amz-lex-request-attributes";
1437
1437
  var _xalrbm = "x-amz-lex-recognized-bot-member";
1438
1438
  var _xalsi = "x-amz-lex-session-id";
1439
1439
  var _xalss = "x-amz-lex-session-state";
1440
- var parseBody = /* @__PURE__ */ __name((streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
1441
- if (encoded.length) {
1442
- return JSON.parse(encoded);
1443
- }
1444
- return {};
1445
- }), "parseBody");
1446
- var parseErrorBody = /* @__PURE__ */ __name(async (errorBody, context) => {
1447
- const value = await parseBody(errorBody, context);
1448
- value.message = value.message ?? value.Message;
1449
- return value;
1450
- }, "parseErrorBody");
1451
- var loadRestJsonErrorCode = /* @__PURE__ */ __name((output, data) => {
1452
- const findKey = /* @__PURE__ */ __name((object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase()), "findKey");
1453
- const sanitizeErrorCode = /* @__PURE__ */ __name((rawValue) => {
1454
- let cleanValue = rawValue;
1455
- if (typeof cleanValue === "number") {
1456
- cleanValue = cleanValue.toString();
1457
- }
1458
- if (cleanValue.indexOf(",") >= 0) {
1459
- cleanValue = cleanValue.split(",")[0];
1460
- }
1461
- if (cleanValue.indexOf(":") >= 0) {
1462
- cleanValue = cleanValue.split(":")[0];
1463
- }
1464
- if (cleanValue.indexOf("#") >= 0) {
1465
- cleanValue = cleanValue.split("#")[1];
1466
- }
1467
- return cleanValue;
1468
- }, "sanitizeErrorCode");
1469
- const headerKey = findKey(output.headers, "x-amzn-errortype");
1470
- if (headerKey !== void 0) {
1471
- return sanitizeErrorCode(output.headers[headerKey]);
1472
- }
1473
- if (data.code !== void 0) {
1474
- return sanitizeErrorCode(data.code);
1475
- }
1476
- if (data["__type"] !== void 0) {
1477
- return sanitizeErrorCode(data["__type"]);
1478
- }
1479
- }, "loadRestJsonErrorCode");
1480
1440
 
1481
1441
  // src/commands/DeleteSessionCommand.ts
1482
1442
  var _DeleteSessionCommand = class _DeleteSessionCommand 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, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, limitedParseDouble as __limitedParseDouble, map, take, withBaseException, } from "@smithy/smithy-client";
3
4
  import { LexRuntimeV2ServiceException as __BaseException } from "../models/LexRuntimeV2ServiceException";
@@ -874,43 +875,3 @@ const _xalra = "x-amz-lex-request-attributes";
874
875
  const _xalrbm = "x-amz-lex-recognized-bot-member";
875
876
  const _xalsi = "x-amz-lex-session-id";
876
877
  const _xalss = "x-amz-lex-session-state";
877
- const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
878
- if (encoded.length) {
879
- return JSON.parse(encoded);
880
- }
881
- return {};
882
- });
883
- const parseErrorBody = async (errorBody, context) => {
884
- const value = await parseBody(errorBody, context);
885
- value.message = value.message ?? value.Message;
886
- return value;
887
- };
888
- const loadRestJsonErrorCode = (output, data) => {
889
- const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
890
- const sanitizeErrorCode = (rawValue) => {
891
- let cleanValue = rawValue;
892
- if (typeof cleanValue === "number") {
893
- cleanValue = cleanValue.toString();
894
- }
895
- if (cleanValue.indexOf(",") >= 0) {
896
- cleanValue = cleanValue.split(",")[0];
897
- }
898
- if (cleanValue.indexOf(":") >= 0) {
899
- cleanValue = cleanValue.split(":")[0];
900
- }
901
- if (cleanValue.indexOf("#") >= 0) {
902
- cleanValue = cleanValue.split("#")[1];
903
- }
904
- return cleanValue;
905
- };
906
- const headerKey = findKey(output.headers, "x-amzn-errortype");
907
- if (headerKey !== undefined) {
908
- return sanitizeErrorCode(output.headers[headerKey]);
909
- }
910
- if (data.code !== undefined) {
911
- return sanitizeErrorCode(data.code);
912
- }
913
- if (data["__type"] !== undefined) {
914
- return sanitizeErrorCode(data["__type"]);
915
- }
916
- };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aws-sdk/client-lex-runtime-v2",
3
3
  "description": "AWS SDK for JavaScript Lex Runtime V2 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-lex-runtime-v2",
@@ -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/eventstream-handler-node": "3.523.0",
27
27
  "@aws-sdk/middleware-eventstream": "3.523.0",
28
28
  "@aws-sdk/middleware-host-header": "3.523.0",