@aws-sdk/client-lex-runtime-service 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
@@ -214,6 +214,7 @@ var import_middleware_serde = require("@smithy/middleware-serde");
214
214
  var import_types = require("@smithy/types");
215
215
 
216
216
  // src/protocols/Aws_restJson1.ts
217
+ var import_core2 = require("@aws-sdk/core");
217
218
 
218
219
 
219
220
 
@@ -636,7 +637,7 @@ var de_DeleteSessionCommand = /* @__PURE__ */ __name(async (output, context) =>
636
637
  const contents = (0, import_smithy_client.map)({
637
638
  $metadata: deserializeMetadata(output)
638
639
  });
639
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
640
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
640
641
  const doc = (0, import_smithy_client.take)(data, {
641
642
  botAlias: import_smithy_client.expectString,
642
643
  botName: import_smithy_client.expectString,
@@ -653,7 +654,7 @@ var de_GetSessionCommand = /* @__PURE__ */ __name(async (output, context) => {
653
654
  const contents = (0, import_smithy_client.map)({
654
655
  $metadata: deserializeMetadata(output)
655
656
  });
656
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
657
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
657
658
  const doc = (0, import_smithy_client.take)(data, {
658
659
  activeContexts: import_smithy_client._json,
659
660
  dialogAction: import_smithy_client._json,
@@ -715,7 +716,7 @@ var de_PostTextCommand = /* @__PURE__ */ __name(async (output, context) => {
715
716
  const contents = (0, import_smithy_client.map)({
716
717
  $metadata: deserializeMetadata(output)
717
718
  });
718
- const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
719
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
719
720
  const doc = (0, import_smithy_client.take)(data, {
720
721
  activeContexts: import_smithy_client._json,
721
722
  alternativeIntents: (_) => de_IntentList(_, context),
@@ -770,9 +771,9 @@ var de_PutSessionCommand = /* @__PURE__ */ __name(async (output, context) => {
770
771
  var de_CommandError = /* @__PURE__ */ __name(async (output, context) => {
771
772
  const parsedOutput = {
772
773
  ...output,
773
- body: await parseErrorBody(output.body, context)
774
+ body: await (0, import_core2.parseJsonErrorBody)(output.body, context)
774
775
  };
775
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
776
+ const errorCode = (0, import_core2.loadRestJsonErrorCode)(output, parsedOutput.body);
776
777
  switch (errorCode) {
777
778
  case "BadRequestException":
778
779
  case "com.amazonaws.lexruntimeservice#BadRequestException":
@@ -986,7 +987,6 @@ var deserializeMetadata = /* @__PURE__ */ __name((output) => ({
986
987
  extendedRequestId: output.headers["x-amz-id-2"],
987
988
  cfId: output.headers["x-amz-cf-id"]
988
989
  }), "deserializeMetadata");
989
- var collectBodyString = /* @__PURE__ */ __name((streamBody, context) => (0, import_smithy_client.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body)), "collectBodyString");
990
990
  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");
991
991
  var _a = "accept";
992
992
  var _aC = "activeContexts";
@@ -1028,46 +1028,6 @@ var _xals_ = "x-amz-lex-sentiment";
1028
1028
  var _xalsa = "x-amz-lex-session-attributes";
1029
1029
  var _xalsi = "x-amz-lex-session-id";
1030
1030
  var _xalste = "x-amz-lex-slot-to-elicit";
1031
- var parseBody = /* @__PURE__ */ __name((streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
1032
- if (encoded.length) {
1033
- return JSON.parse(encoded);
1034
- }
1035
- return {};
1036
- }), "parseBody");
1037
- var parseErrorBody = /* @__PURE__ */ __name(async (errorBody, context) => {
1038
- const value = await parseBody(errorBody, context);
1039
- value.message = value.message ?? value.Message;
1040
- return value;
1041
- }, "parseErrorBody");
1042
- var loadRestJsonErrorCode = /* @__PURE__ */ __name((output, data) => {
1043
- const findKey = /* @__PURE__ */ __name((object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase()), "findKey");
1044
- const sanitizeErrorCode = /* @__PURE__ */ __name((rawValue) => {
1045
- let cleanValue = rawValue;
1046
- if (typeof cleanValue === "number") {
1047
- cleanValue = cleanValue.toString();
1048
- }
1049
- if (cleanValue.indexOf(",") >= 0) {
1050
- cleanValue = cleanValue.split(",")[0];
1051
- }
1052
- if (cleanValue.indexOf(":") >= 0) {
1053
- cleanValue = cleanValue.split(":")[0];
1054
- }
1055
- if (cleanValue.indexOf("#") >= 0) {
1056
- cleanValue = cleanValue.split("#")[1];
1057
- }
1058
- return cleanValue;
1059
- }, "sanitizeErrorCode");
1060
- const headerKey = findKey(output.headers, "x-amzn-errortype");
1061
- if (headerKey !== void 0) {
1062
- return sanitizeErrorCode(output.headers[headerKey]);
1063
- }
1064
- if (data.code !== void 0) {
1065
- return sanitizeErrorCode(data.code);
1066
- }
1067
- if (data["__type"] !== void 0) {
1068
- return sanitizeErrorCode(data["__type"]);
1069
- }
1070
- }, "loadRestJsonErrorCode");
1071
1031
 
1072
1032
  // src/commands/DeleteSessionCommand.ts
1073
1033
  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, LazyJsonString as __LazyJsonString, limitedParseDouble as __limitedParseDouble, map, take, withBaseException, } from "@smithy/smithy-client";
3
4
  import { LexRuntimeServiceServiceException as __BaseException } from "../models/LexRuntimeServiceServiceException";
@@ -501,43 +502,3 @@ const _xals_ = "x-amz-lex-sentiment";
501
502
  const _xalsa = "x-amz-lex-session-attributes";
502
503
  const _xalsi = "x-amz-lex-session-id";
503
504
  const _xalste = "x-amz-lex-slot-to-elicit";
504
- const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
505
- if (encoded.length) {
506
- return JSON.parse(encoded);
507
- }
508
- return {};
509
- });
510
- const parseErrorBody = async (errorBody, context) => {
511
- const value = await parseBody(errorBody, context);
512
- value.message = value.message ?? value.Message;
513
- return value;
514
- };
515
- const loadRestJsonErrorCode = (output, data) => {
516
- const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
517
- const sanitizeErrorCode = (rawValue) => {
518
- let cleanValue = rawValue;
519
- if (typeof cleanValue === "number") {
520
- cleanValue = cleanValue.toString();
521
- }
522
- if (cleanValue.indexOf(",") >= 0) {
523
- cleanValue = cleanValue.split(",")[0];
524
- }
525
- if (cleanValue.indexOf(":") >= 0) {
526
- cleanValue = cleanValue.split(":")[0];
527
- }
528
- if (cleanValue.indexOf("#") >= 0) {
529
- cleanValue = cleanValue.split("#")[1];
530
- }
531
- return cleanValue;
532
- };
533
- const headerKey = findKey(output.headers, "x-amzn-errortype");
534
- if (headerKey !== undefined) {
535
- return sanitizeErrorCode(output.headers[headerKey]);
536
- }
537
- if (data.code !== undefined) {
538
- return sanitizeErrorCode(data.code);
539
- }
540
- if (data["__type"] !== undefined) {
541
- return sanitizeErrorCode(data["__type"]);
542
- }
543
- };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aws-sdk/client-lex-runtime-service",
3
3
  "description": "AWS SDK for JavaScript Lex Runtime Service 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-lex-runtime-service",
@@ -22,40 +22,40 @@
22
22
  "dependencies": {
23
23
  "@aws-crypto/sha256-browser": "3.0.0",
24
24
  "@aws-crypto/sha256-js": "3.0.0",
25
- "@aws-sdk/client-sts": "3.523.0",
26
- "@aws-sdk/core": "3.523.0",
27
- "@aws-sdk/credential-provider-node": "3.523.0",
25
+ "@aws-sdk/client-sts": "3.529.0",
26
+ "@aws-sdk/core": "3.529.0",
27
+ "@aws-sdk/credential-provider-node": "3.529.0",
28
28
  "@aws-sdk/middleware-host-header": "3.523.0",
29
29
  "@aws-sdk/middleware-logger": "3.523.0",
30
30
  "@aws-sdk/middleware-recursion-detection": "3.523.0",
31
- "@aws-sdk/middleware-user-agent": "3.523.0",
32
- "@aws-sdk/region-config-resolver": "3.523.0",
31
+ "@aws-sdk/middleware-user-agent": "3.525.0",
32
+ "@aws-sdk/region-config-resolver": "3.525.0",
33
33
  "@aws-sdk/types": "3.523.0",
34
- "@aws-sdk/util-endpoints": "3.523.0",
34
+ "@aws-sdk/util-endpoints": "3.525.0",
35
35
  "@aws-sdk/util-user-agent-browser": "3.523.0",
36
- "@aws-sdk/util-user-agent-node": "3.523.0",
37
- "@smithy/config-resolver": "^2.1.3",
38
- "@smithy/core": "^1.3.4",
36
+ "@aws-sdk/util-user-agent-node": "3.525.0",
37
+ "@smithy/config-resolver": "^2.1.4",
38
+ "@smithy/core": "^1.3.5",
39
39
  "@smithy/fetch-http-handler": "^2.4.3",
40
40
  "@smithy/hash-node": "^2.1.3",
41
41
  "@smithy/invalid-dependency": "^2.1.3",
42
42
  "@smithy/middleware-content-length": "^2.1.3",
43
- "@smithy/middleware-endpoint": "^2.4.3",
44
- "@smithy/middleware-retry": "^2.1.3",
43
+ "@smithy/middleware-endpoint": "^2.4.4",
44
+ "@smithy/middleware-retry": "^2.1.4",
45
45
  "@smithy/middleware-serde": "^2.1.3",
46
46
  "@smithy/middleware-stack": "^2.1.3",
47
- "@smithy/node-config-provider": "^2.2.3",
47
+ "@smithy/node-config-provider": "^2.2.4",
48
48
  "@smithy/node-http-handler": "^2.4.1",
49
49
  "@smithy/protocol-http": "^3.2.1",
50
- "@smithy/smithy-client": "^2.4.1",
50
+ "@smithy/smithy-client": "^2.4.2",
51
51
  "@smithy/types": "^2.10.1",
52
52
  "@smithy/url-parser": "^2.1.3",
53
53
  "@smithy/util-base64": "^2.1.1",
54
54
  "@smithy/util-body-length-browser": "^2.1.1",
55
55
  "@smithy/util-body-length-node": "^2.2.1",
56
- "@smithy/util-defaults-mode-browser": "^2.1.3",
57
- "@smithy/util-defaults-mode-node": "^2.2.2",
58
- "@smithy/util-endpoints": "^1.1.3",
56
+ "@smithy/util-defaults-mode-browser": "^2.1.4",
57
+ "@smithy/util-defaults-mode-node": "^2.2.3",
58
+ "@smithy/util-endpoints": "^1.1.4",
59
59
  "@smithy/util-middleware": "^2.1.3",
60
60
  "@smithy/util-retry": "^2.1.3",
61
61
  "@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");
@@ -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");