@aws-sdk/client-lex-runtime-service 3.476.0 → 3.478.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.
@@ -1,103 +1,77 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.de_PutSessionCommand = exports.de_PostTextCommand = exports.de_PostContentCommand = exports.de_GetSessionCommand = exports.de_DeleteSessionCommand = exports.se_PutSessionCommand = exports.se_PostTextCommand = exports.se_PostContentCommand = exports.se_GetSessionCommand = exports.se_DeleteSessionCommand = void 0;
4
- const protocol_http_1 = require("@smithy/protocol-http");
4
+ const core_1 = require("@smithy/core");
5
5
  const smithy_client_1 = require("@smithy/smithy-client");
6
6
  const LexRuntimeServiceServiceException_1 = require("../models/LexRuntimeServiceServiceException");
7
7
  const models_0_1 = require("../models/models_0");
8
8
  const se_DeleteSessionCommand = async (input, context) => {
9
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
9
+ const b = (0, core_1.requestBuilder)(input, context);
10
10
  const headers = {};
11
- let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
12
- "/bot/{botName}/alias/{botAlias}/user/{userId}/session";
13
- resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "botName", () => input.botName, "{botName}", false);
14
- resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "botAlias", () => input.botAlias, "{botAlias}", false);
15
- resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "userId", () => input.userId, "{userId}", false);
11
+ b.bp("/bot/{botName}/alias/{botAlias}/user/{userId}/session");
12
+ b.p("botName", () => input.botName, "{botName}", false);
13
+ b.p("botAlias", () => input.botAlias, "{botAlias}", false);
14
+ b.p("userId", () => input.userId, "{userId}", false);
16
15
  let body;
17
- return new protocol_http_1.HttpRequest({
18
- protocol,
19
- hostname,
20
- port,
21
- method: "DELETE",
22
- headers,
23
- path: resolvedPath,
24
- body,
25
- });
16
+ b.m("DELETE").h(headers).b(body);
17
+ return b.build();
26
18
  };
27
19
  exports.se_DeleteSessionCommand = se_DeleteSessionCommand;
28
20
  const se_GetSessionCommand = async (input, context) => {
29
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
21
+ const b = (0, core_1.requestBuilder)(input, context);
30
22
  const headers = {};
31
- let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
32
- "/bot/{botName}/alias/{botAlias}/user/{userId}/session";
33
- resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "botName", () => input.botName, "{botName}", false);
34
- resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "botAlias", () => input.botAlias, "{botAlias}", false);
35
- resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "userId", () => input.userId, "{userId}", false);
23
+ b.bp("/bot/{botName}/alias/{botAlias}/user/{userId}/session");
24
+ b.p("botName", () => input.botName, "{botName}", false);
25
+ b.p("botAlias", () => input.botAlias, "{botAlias}", false);
26
+ b.p("userId", () => input.userId, "{userId}", false);
36
27
  const query = (0, smithy_client_1.map)({
37
- checkpointLabelFilter: [, input.checkpointLabelFilter],
28
+ [_cLF]: [, input[_cLF]],
38
29
  });
39
30
  let body;
40
- return new protocol_http_1.HttpRequest({
41
- protocol,
42
- hostname,
43
- port,
44
- method: "GET",
45
- headers,
46
- path: resolvedPath,
47
- query,
48
- body,
49
- });
31
+ b.m("GET").h(headers).q(query).b(body);
32
+ return b.build();
50
33
  };
51
34
  exports.se_GetSessionCommand = se_GetSessionCommand;
52
35
  const se_PostContentCommand = async (input, context) => {
53
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
36
+ const b = (0, core_1.requestBuilder)(input, context);
54
37
  const headers = (0, smithy_client_1.map)({}, isSerializableHeaderValue, {
55
38
  "x-amz-content-sha256": "UNSIGNED-PAYLOAD",
56
- "content-type": input.contentType || "application/octet-stream",
57
- "x-amz-lex-session-attributes": [
58
- () => isSerializableHeaderValue(input.sessionAttributes),
59
- () => context.base64Encoder(Buffer.from(smithy_client_1.LazyJsonString.fromObject(input.sessionAttributes))),
39
+ [_ct]: input[_cT] || "application/octet-stream",
40
+ [_xalsa]: [
41
+ () => isSerializableHeaderValue(input[_sA]),
42
+ () => context.base64Encoder(Buffer.from(smithy_client_1.LazyJsonString.fromObject(input[_sA]))),
60
43
  ],
61
- "x-amz-lex-request-attributes": [
62
- () => isSerializableHeaderValue(input.requestAttributes),
63
- () => context.base64Encoder(Buffer.from(smithy_client_1.LazyJsonString.fromObject(input.requestAttributes))),
44
+ [_xalra]: [
45
+ () => isSerializableHeaderValue(input[_rA]),
46
+ () => context.base64Encoder(Buffer.from(smithy_client_1.LazyJsonString.fromObject(input[_rA]))),
64
47
  ],
65
- accept: input.accept,
66
- "x-amz-lex-active-contexts": [
67
- () => isSerializableHeaderValue(input.activeContexts),
68
- () => context.base64Encoder(Buffer.from(smithy_client_1.LazyJsonString.fromObject(input.activeContexts))),
48
+ [_a]: input[_a],
49
+ [_xalac]: [
50
+ () => isSerializableHeaderValue(input[_aC]),
51
+ () => context.base64Encoder(Buffer.from(smithy_client_1.LazyJsonString.fromObject(input[_aC]))),
69
52
  ],
70
53
  });
71
- let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
72
- "/bot/{botName}/alias/{botAlias}/user/{userId}/content";
73
- resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "botName", () => input.botName, "{botName}", false);
74
- resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "botAlias", () => input.botAlias, "{botAlias}", false);
75
- resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "userId", () => input.userId, "{userId}", false);
54
+ b.bp("/bot/{botName}/alias/{botAlias}/user/{userId}/content");
55
+ b.p("botName", () => input.botName, "{botName}", false);
56
+ b.p("botAlias", () => input.botAlias, "{botAlias}", false);
57
+ b.p("userId", () => input.userId, "{userId}", false);
76
58
  let body;
77
59
  if (input.inputStream !== undefined) {
78
60
  body = input.inputStream;
79
61
  }
80
- return new protocol_http_1.HttpRequest({
81
- protocol,
82
- hostname,
83
- port,
84
- method: "POST",
85
- headers,
86
- path: resolvedPath,
87
- body,
88
- });
62
+ b.m("POST").h(headers).b(body);
63
+ return b.build();
89
64
  };
90
65
  exports.se_PostContentCommand = se_PostContentCommand;
91
66
  const se_PostTextCommand = async (input, context) => {
92
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
67
+ const b = (0, core_1.requestBuilder)(input, context);
93
68
  const headers = {
94
69
  "content-type": "application/json",
95
70
  };
96
- let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
97
- "/bot/{botName}/alias/{botAlias}/user/{userId}/text";
98
- resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "botName", () => input.botName, "{botName}", false);
99
- resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "botAlias", () => input.botAlias, "{botAlias}", false);
100
- resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "userId", () => input.userId, "{userId}", false);
71
+ b.bp("/bot/{botName}/alias/{botAlias}/user/{userId}/text");
72
+ b.p("botName", () => input.botName, "{botName}", false);
73
+ b.p("botAlias", () => input.botAlias, "{botAlias}", false);
74
+ b.p("userId", () => input.userId, "{userId}", false);
101
75
  let body;
102
76
  body = JSON.stringify((0, smithy_client_1.take)(input, {
103
77
  activeContexts: (_) => (0, smithy_client_1._json)(_),
@@ -105,28 +79,20 @@ const se_PostTextCommand = async (input, context) => {
105
79
  requestAttributes: (_) => (0, smithy_client_1._json)(_),
106
80
  sessionAttributes: (_) => (0, smithy_client_1._json)(_),
107
81
  }));
108
- return new protocol_http_1.HttpRequest({
109
- protocol,
110
- hostname,
111
- port,
112
- method: "POST",
113
- headers,
114
- path: resolvedPath,
115
- body,
116
- });
82
+ b.m("POST").h(headers).b(body);
83
+ return b.build();
117
84
  };
118
85
  exports.se_PostTextCommand = se_PostTextCommand;
119
86
  const se_PutSessionCommand = async (input, context) => {
120
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
87
+ const b = (0, core_1.requestBuilder)(input, context);
121
88
  const headers = (0, smithy_client_1.map)({}, isSerializableHeaderValue, {
122
89
  "content-type": "application/json",
123
- accept: input.accept,
90
+ [_a]: input[_a],
124
91
  });
125
- let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
126
- "/bot/{botName}/alias/{botAlias}/user/{userId}/session";
127
- resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "botName", () => input.botName, "{botName}", false);
128
- resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "botAlias", () => input.botAlias, "{botAlias}", false);
129
- resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "userId", () => input.userId, "{userId}", false);
92
+ b.bp("/bot/{botName}/alias/{botAlias}/user/{userId}/session");
93
+ b.p("botName", () => input.botName, "{botName}", false);
94
+ b.p("botAlias", () => input.botAlias, "{botAlias}", false);
95
+ b.p("userId", () => input.userId, "{userId}", false);
130
96
  let body;
131
97
  body = JSON.stringify((0, smithy_client_1.take)(input, {
132
98
  activeContexts: (_) => (0, smithy_client_1._json)(_),
@@ -134,15 +100,8 @@ const se_PutSessionCommand = async (input, context) => {
134
100
  recentIntentSummaryView: (_) => (0, smithy_client_1._json)(_),
135
101
  sessionAttributes: (_) => (0, smithy_client_1._json)(_),
136
102
  }));
137
- return new protocol_http_1.HttpRequest({
138
- protocol,
139
- hostname,
140
- port,
141
- method: "POST",
142
- headers,
143
- path: resolvedPath,
144
- body,
145
- });
103
+ b.m("POST").h(headers).b(body);
104
+ return b.build();
146
105
  };
147
106
  exports.se_PutSessionCommand = se_PutSessionCommand;
148
107
  const de_DeleteSessionCommand = async (output, context) => {
@@ -247,37 +206,37 @@ const de_PostContentCommand = async (output, context) => {
247
206
  }
248
207
  const contents = (0, smithy_client_1.map)({
249
208
  $metadata: deserializeMetadata(output),
250
- contentType: [, output.headers["content-type"]],
251
- intentName: [, output.headers["x-amz-lex-intent-name"]],
252
- nluIntentConfidence: [
253
- () => void 0 !== output.headers["x-amz-lex-nlu-intent-confidence"],
254
- () => new smithy_client_1.LazyJsonString(Buffer.from(context.base64Decoder(output.headers["x-amz-lex-nlu-intent-confidence"])).toString("utf8")),
209
+ [_cT]: [, output.headers[_ct]],
210
+ [_iN]: [, output.headers[_xalin]],
211
+ [_nIC]: [
212
+ () => void 0 !== output.headers[_xalnic],
213
+ () => new smithy_client_1.LazyJsonString(Buffer.from(context.base64Decoder(output.headers[_xalnic])).toString("utf8")),
255
214
  ],
256
- alternativeIntents: [
257
- () => void 0 !== output.headers["x-amz-lex-alternative-intents"],
258
- () => new smithy_client_1.LazyJsonString(Buffer.from(context.base64Decoder(output.headers["x-amz-lex-alternative-intents"])).toString("utf8")),
215
+ [_aI]: [
216
+ () => void 0 !== output.headers[_xalai],
217
+ () => new smithy_client_1.LazyJsonString(Buffer.from(context.base64Decoder(output.headers[_xalai])).toString("utf8")),
259
218
  ],
260
- slots: [
261
- () => void 0 !== output.headers["x-amz-lex-slots"],
262
- () => new smithy_client_1.LazyJsonString(Buffer.from(context.base64Decoder(output.headers["x-amz-lex-slots"])).toString("utf8")),
219
+ [_s]: [
220
+ () => void 0 !== output.headers[_xals],
221
+ () => new smithy_client_1.LazyJsonString(Buffer.from(context.base64Decoder(output.headers[_xals])).toString("utf8")),
263
222
  ],
264
- sessionAttributes: [
265
- () => void 0 !== output.headers["x-amz-lex-session-attributes"],
266
- () => new smithy_client_1.LazyJsonString(Buffer.from(context.base64Decoder(output.headers["x-amz-lex-session-attributes"])).toString("utf8")),
223
+ [_sA]: [
224
+ () => void 0 !== output.headers[_xalsa],
225
+ () => new smithy_client_1.LazyJsonString(Buffer.from(context.base64Decoder(output.headers[_xalsa])).toString("utf8")),
267
226
  ],
268
- sentimentResponse: [, output.headers["x-amz-lex-sentiment"]],
269
- message: [, output.headers["x-amz-lex-message"]],
270
- encodedMessage: [, output.headers["x-amz-lex-encoded-message"]],
271
- messageFormat: [, output.headers["x-amz-lex-message-format"]],
272
- dialogState: [, output.headers["x-amz-lex-dialog-state"]],
273
- slotToElicit: [, output.headers["x-amz-lex-slot-to-elicit"]],
274
- inputTranscript: [, output.headers["x-amz-lex-input-transcript"]],
275
- encodedInputTranscript: [, output.headers["x-amz-lex-encoded-input-transcript"]],
276
- botVersion: [, output.headers["x-amz-lex-bot-version"]],
277
- sessionId: [, output.headers["x-amz-lex-session-id"]],
278
- activeContexts: [
279
- () => void 0 !== output.headers["x-amz-lex-active-contexts"],
280
- () => new smithy_client_1.LazyJsonString(Buffer.from(context.base64Decoder(output.headers["x-amz-lex-active-contexts"])).toString("utf8")),
227
+ [_sR]: [, output.headers[_xals_]],
228
+ [_m]: [, output.headers[_xalm]],
229
+ [_eM]: [, output.headers[_xalem]],
230
+ [_mF]: [, output.headers[_xalmf]],
231
+ [_dS]: [, output.headers[_xalds]],
232
+ [_sTE]: [, output.headers[_xalste]],
233
+ [_iT]: [, output.headers[_xalit]],
234
+ [_eIT]: [, output.headers[_xaleit]],
235
+ [_bV]: [, output.headers[_xalbv]],
236
+ [_sI]: [, output.headers[_xalsi]],
237
+ [_aC]: [
238
+ () => void 0 !== output.headers[_xalac],
239
+ () => new smithy_client_1.LazyJsonString(Buffer.from(context.base64Decoder(output.headers[_xalac])).toString("utf8")),
281
240
  ],
282
241
  });
283
242
  const data = output.body;
@@ -409,25 +368,25 @@ const de_PutSessionCommand = async (output, context) => {
409
368
  }
410
369
  const contents = (0, smithy_client_1.map)({
411
370
  $metadata: deserializeMetadata(output),
412
- contentType: [, output.headers["content-type"]],
413
- intentName: [, output.headers["x-amz-lex-intent-name"]],
414
- slots: [
415
- () => void 0 !== output.headers["x-amz-lex-slots"],
416
- () => new smithy_client_1.LazyJsonString(Buffer.from(context.base64Decoder(output.headers["x-amz-lex-slots"])).toString("utf8")),
371
+ [_cT]: [, output.headers[_ct]],
372
+ [_iN]: [, output.headers[_xalin]],
373
+ [_s]: [
374
+ () => void 0 !== output.headers[_xals],
375
+ () => new smithy_client_1.LazyJsonString(Buffer.from(context.base64Decoder(output.headers[_xals])).toString("utf8")),
417
376
  ],
418
- sessionAttributes: [
419
- () => void 0 !== output.headers["x-amz-lex-session-attributes"],
420
- () => new smithy_client_1.LazyJsonString(Buffer.from(context.base64Decoder(output.headers["x-amz-lex-session-attributes"])).toString("utf8")),
377
+ [_sA]: [
378
+ () => void 0 !== output.headers[_xalsa],
379
+ () => new smithy_client_1.LazyJsonString(Buffer.from(context.base64Decoder(output.headers[_xalsa])).toString("utf8")),
421
380
  ],
422
- message: [, output.headers["x-amz-lex-message"]],
423
- encodedMessage: [, output.headers["x-amz-lex-encoded-message"]],
424
- messageFormat: [, output.headers["x-amz-lex-message-format"]],
425
- dialogState: [, output.headers["x-amz-lex-dialog-state"]],
426
- slotToElicit: [, output.headers["x-amz-lex-slot-to-elicit"]],
427
- sessionId: [, output.headers["x-amz-lex-session-id"]],
428
- activeContexts: [
429
- () => void 0 !== output.headers["x-amz-lex-active-contexts"],
430
- () => new smithy_client_1.LazyJsonString(Buffer.from(context.base64Decoder(output.headers["x-amz-lex-active-contexts"])).toString("utf8")),
381
+ [_m]: [, output.headers[_xalm]],
382
+ [_eM]: [, output.headers[_xalem]],
383
+ [_mF]: [, output.headers[_xalmf]],
384
+ [_dS]: [, output.headers[_xalds]],
385
+ [_sTE]: [, output.headers[_xalste]],
386
+ [_sI]: [, output.headers[_xalsi]],
387
+ [_aC]: [
388
+ () => void 0 !== output.headers[_xalac],
389
+ () => new smithy_client_1.LazyJsonString(Buffer.from(context.base64Decoder(output.headers[_xalac])).toString("utf8")),
431
390
  ],
432
391
  });
433
392
  const data = output.body;
@@ -544,7 +503,7 @@ const de_InternalFailureExceptionRes = async (parsedOutput, context) => {
544
503
  };
545
504
  const de_LimitExceededExceptionRes = async (parsedOutput, context) => {
546
505
  const contents = (0, smithy_client_1.map)({
547
- retryAfterSeconds: [, parsedOutput.headers["retry-after"]],
506
+ [_rAS]: [, parsedOutput.headers[_ra]],
548
507
  });
549
508
  const data = parsedOutput.body;
550
509
  const doc = (0, smithy_client_1.take)(data, {
@@ -654,6 +613,46 @@ const isSerializableHeaderValue = (value) => value !== undefined &&
654
613
  value !== "" &&
655
614
  (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
656
615
  (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
616
+ const _a = "accept";
617
+ const _aC = "activeContexts";
618
+ const _aI = "alternativeIntents";
619
+ const _bV = "botVersion";
620
+ const _cLF = "checkpointLabelFilter";
621
+ const _cT = "contentType";
622
+ const _ct = "content-type";
623
+ const _dS = "dialogState";
624
+ const _eIT = "encodedInputTranscript";
625
+ const _eM = "encodedMessage";
626
+ const _iN = "intentName";
627
+ const _iT = "inputTranscript";
628
+ const _m = "message";
629
+ const _mF = "messageFormat";
630
+ const _nIC = "nluIntentConfidence";
631
+ const _rA = "requestAttributes";
632
+ const _rAS = "retryAfterSeconds";
633
+ const _ra = "retry-after";
634
+ const _s = "slots";
635
+ const _sA = "sessionAttributes";
636
+ const _sI = "sessionId";
637
+ const _sR = "sentimentResponse";
638
+ const _sTE = "slotToElicit";
639
+ const _xalac = "x-amz-lex-active-contexts";
640
+ const _xalai = "x-amz-lex-alternative-intents";
641
+ const _xalbv = "x-amz-lex-bot-version";
642
+ const _xalds = "x-amz-lex-dialog-state";
643
+ const _xaleit = "x-amz-lex-encoded-input-transcript";
644
+ const _xalem = "x-amz-lex-encoded-message";
645
+ const _xalin = "x-amz-lex-intent-name";
646
+ const _xalit = "x-amz-lex-input-transcript";
647
+ const _xalm = "x-amz-lex-message";
648
+ const _xalmf = "x-amz-lex-message-format";
649
+ const _xalnic = "x-amz-lex-nlu-intent-confidence";
650
+ const _xalra = "x-amz-lex-request-attributes";
651
+ const _xals = "x-amz-lex-slots";
652
+ const _xals_ = "x-amz-lex-sentiment";
653
+ const _xalsa = "x-amz-lex-session-attributes";
654
+ const _xalsi = "x-amz-lex-session-id";
655
+ const _xalste = "x-amz-lex-slot-to-elicit";
657
656
  const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
658
657
  if (encoded.length) {
659
658
  return JSON.parse(encoded);
@@ -1,97 +1,71 @@
1
- import { HttpRequest as __HttpRequest } from "@smithy/protocol-http";
2
- import { _json, collectBody, decorateServiceException as __decorateServiceException, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, LazyJsonString as __LazyJsonString, limitedParseDouble as __limitedParseDouble, map, resolvedPath as __resolvedPath, take, withBaseException, } from "@smithy/smithy-client";
1
+ import { requestBuilder as rb } from "@smithy/core";
2
+ 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
3
  import { LexRuntimeServiceServiceException as __BaseException } from "../models/LexRuntimeServiceServiceException";
4
4
  import { BadGatewayException, BadRequestException, ConflictException, DependencyFailedException, InternalFailureException, LimitExceededException, LoopDetectedException, NotAcceptableException, NotFoundException, RequestTimeoutException, UnsupportedMediaTypeException, } from "../models/models_0";
5
5
  export const se_DeleteSessionCommand = async (input, context) => {
6
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
6
+ const b = rb(input, context);
7
7
  const headers = {};
8
- let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
9
- "/bot/{botName}/alias/{botAlias}/user/{userId}/session";
10
- resolvedPath = __resolvedPath(resolvedPath, input, "botName", () => input.botName, "{botName}", false);
11
- resolvedPath = __resolvedPath(resolvedPath, input, "botAlias", () => input.botAlias, "{botAlias}", false);
12
- resolvedPath = __resolvedPath(resolvedPath, input, "userId", () => input.userId, "{userId}", false);
8
+ b.bp("/bot/{botName}/alias/{botAlias}/user/{userId}/session");
9
+ b.p("botName", () => input.botName, "{botName}", false);
10
+ b.p("botAlias", () => input.botAlias, "{botAlias}", false);
11
+ b.p("userId", () => input.userId, "{userId}", false);
13
12
  let body;
14
- return new __HttpRequest({
15
- protocol,
16
- hostname,
17
- port,
18
- method: "DELETE",
19
- headers,
20
- path: resolvedPath,
21
- body,
22
- });
13
+ b.m("DELETE").h(headers).b(body);
14
+ return b.build();
23
15
  };
24
16
  export const se_GetSessionCommand = async (input, context) => {
25
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
17
+ const b = rb(input, context);
26
18
  const headers = {};
27
- let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
28
- "/bot/{botName}/alias/{botAlias}/user/{userId}/session";
29
- resolvedPath = __resolvedPath(resolvedPath, input, "botName", () => input.botName, "{botName}", false);
30
- resolvedPath = __resolvedPath(resolvedPath, input, "botAlias", () => input.botAlias, "{botAlias}", false);
31
- resolvedPath = __resolvedPath(resolvedPath, input, "userId", () => input.userId, "{userId}", false);
19
+ b.bp("/bot/{botName}/alias/{botAlias}/user/{userId}/session");
20
+ b.p("botName", () => input.botName, "{botName}", false);
21
+ b.p("botAlias", () => input.botAlias, "{botAlias}", false);
22
+ b.p("userId", () => input.userId, "{userId}", false);
32
23
  const query = map({
33
- checkpointLabelFilter: [, input.checkpointLabelFilter],
24
+ [_cLF]: [, input[_cLF]],
34
25
  });
35
26
  let body;
36
- return new __HttpRequest({
37
- protocol,
38
- hostname,
39
- port,
40
- method: "GET",
41
- headers,
42
- path: resolvedPath,
43
- query,
44
- body,
45
- });
27
+ b.m("GET").h(headers).q(query).b(body);
28
+ return b.build();
46
29
  };
47
30
  export const se_PostContentCommand = async (input, context) => {
48
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
31
+ const b = rb(input, context);
49
32
  const headers = map({}, isSerializableHeaderValue, {
50
33
  "x-amz-content-sha256": "UNSIGNED-PAYLOAD",
51
- "content-type": input.contentType || "application/octet-stream",
52
- "x-amz-lex-session-attributes": [
53
- () => isSerializableHeaderValue(input.sessionAttributes),
54
- () => context.base64Encoder(Buffer.from(__LazyJsonString.fromObject(input.sessionAttributes))),
34
+ [_ct]: input[_cT] || "application/octet-stream",
35
+ [_xalsa]: [
36
+ () => isSerializableHeaderValue(input[_sA]),
37
+ () => context.base64Encoder(Buffer.from(__LazyJsonString.fromObject(input[_sA]))),
55
38
  ],
56
- "x-amz-lex-request-attributes": [
57
- () => isSerializableHeaderValue(input.requestAttributes),
58
- () => context.base64Encoder(Buffer.from(__LazyJsonString.fromObject(input.requestAttributes))),
39
+ [_xalra]: [
40
+ () => isSerializableHeaderValue(input[_rA]),
41
+ () => context.base64Encoder(Buffer.from(__LazyJsonString.fromObject(input[_rA]))),
59
42
  ],
60
- accept: input.accept,
61
- "x-amz-lex-active-contexts": [
62
- () => isSerializableHeaderValue(input.activeContexts),
63
- () => context.base64Encoder(Buffer.from(__LazyJsonString.fromObject(input.activeContexts))),
43
+ [_a]: input[_a],
44
+ [_xalac]: [
45
+ () => isSerializableHeaderValue(input[_aC]),
46
+ () => context.base64Encoder(Buffer.from(__LazyJsonString.fromObject(input[_aC]))),
64
47
  ],
65
48
  });
66
- let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
67
- "/bot/{botName}/alias/{botAlias}/user/{userId}/content";
68
- resolvedPath = __resolvedPath(resolvedPath, input, "botName", () => input.botName, "{botName}", false);
69
- resolvedPath = __resolvedPath(resolvedPath, input, "botAlias", () => input.botAlias, "{botAlias}", false);
70
- resolvedPath = __resolvedPath(resolvedPath, input, "userId", () => input.userId, "{userId}", false);
49
+ b.bp("/bot/{botName}/alias/{botAlias}/user/{userId}/content");
50
+ b.p("botName", () => input.botName, "{botName}", false);
51
+ b.p("botAlias", () => input.botAlias, "{botAlias}", false);
52
+ b.p("userId", () => input.userId, "{userId}", false);
71
53
  let body;
72
54
  if (input.inputStream !== undefined) {
73
55
  body = input.inputStream;
74
56
  }
75
- return new __HttpRequest({
76
- protocol,
77
- hostname,
78
- port,
79
- method: "POST",
80
- headers,
81
- path: resolvedPath,
82
- body,
83
- });
57
+ b.m("POST").h(headers).b(body);
58
+ return b.build();
84
59
  };
85
60
  export const se_PostTextCommand = async (input, context) => {
86
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
61
+ const b = rb(input, context);
87
62
  const headers = {
88
63
  "content-type": "application/json",
89
64
  };
90
- let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
91
- "/bot/{botName}/alias/{botAlias}/user/{userId}/text";
92
- resolvedPath = __resolvedPath(resolvedPath, input, "botName", () => input.botName, "{botName}", false);
93
- resolvedPath = __resolvedPath(resolvedPath, input, "botAlias", () => input.botAlias, "{botAlias}", false);
94
- resolvedPath = __resolvedPath(resolvedPath, input, "userId", () => input.userId, "{userId}", false);
65
+ b.bp("/bot/{botName}/alias/{botAlias}/user/{userId}/text");
66
+ b.p("botName", () => input.botName, "{botName}", false);
67
+ b.p("botAlias", () => input.botAlias, "{botAlias}", false);
68
+ b.p("userId", () => input.userId, "{userId}", false);
95
69
  let body;
96
70
  body = JSON.stringify(take(input, {
97
71
  activeContexts: (_) => _json(_),
@@ -99,27 +73,19 @@ export const se_PostTextCommand = async (input, context) => {
99
73
  requestAttributes: (_) => _json(_),
100
74
  sessionAttributes: (_) => _json(_),
101
75
  }));
102
- return new __HttpRequest({
103
- protocol,
104
- hostname,
105
- port,
106
- method: "POST",
107
- headers,
108
- path: resolvedPath,
109
- body,
110
- });
76
+ b.m("POST").h(headers).b(body);
77
+ return b.build();
111
78
  };
112
79
  export const se_PutSessionCommand = async (input, context) => {
113
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
80
+ const b = rb(input, context);
114
81
  const headers = map({}, isSerializableHeaderValue, {
115
82
  "content-type": "application/json",
116
- accept: input.accept,
83
+ [_a]: input[_a],
117
84
  });
118
- let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
119
- "/bot/{botName}/alias/{botAlias}/user/{userId}/session";
120
- resolvedPath = __resolvedPath(resolvedPath, input, "botName", () => input.botName, "{botName}", false);
121
- resolvedPath = __resolvedPath(resolvedPath, input, "botAlias", () => input.botAlias, "{botAlias}", false);
122
- resolvedPath = __resolvedPath(resolvedPath, input, "userId", () => input.userId, "{userId}", false);
85
+ b.bp("/bot/{botName}/alias/{botAlias}/user/{userId}/session");
86
+ b.p("botName", () => input.botName, "{botName}", false);
87
+ b.p("botAlias", () => input.botAlias, "{botAlias}", false);
88
+ b.p("userId", () => input.userId, "{userId}", false);
123
89
  let body;
124
90
  body = JSON.stringify(take(input, {
125
91
  activeContexts: (_) => _json(_),
@@ -127,15 +93,8 @@ export const se_PutSessionCommand = async (input, context) => {
127
93
  recentIntentSummaryView: (_) => _json(_),
128
94
  sessionAttributes: (_) => _json(_),
129
95
  }));
130
- return new __HttpRequest({
131
- protocol,
132
- hostname,
133
- port,
134
- method: "POST",
135
- headers,
136
- path: resolvedPath,
137
- body,
138
- });
96
+ b.m("POST").h(headers).b(body);
97
+ return b.build();
139
98
  };
140
99
  export const de_DeleteSessionCommand = async (output, context) => {
141
100
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -237,37 +196,37 @@ export const de_PostContentCommand = async (output, context) => {
237
196
  }
238
197
  const contents = map({
239
198
  $metadata: deserializeMetadata(output),
240
- contentType: [, output.headers["content-type"]],
241
- intentName: [, output.headers["x-amz-lex-intent-name"]],
242
- nluIntentConfidence: [
243
- () => void 0 !== output.headers["x-amz-lex-nlu-intent-confidence"],
244
- () => new __LazyJsonString(Buffer.from(context.base64Decoder(output.headers["x-amz-lex-nlu-intent-confidence"])).toString("utf8")),
199
+ [_cT]: [, output.headers[_ct]],
200
+ [_iN]: [, output.headers[_xalin]],
201
+ [_nIC]: [
202
+ () => void 0 !== output.headers[_xalnic],
203
+ () => new __LazyJsonString(Buffer.from(context.base64Decoder(output.headers[_xalnic])).toString("utf8")),
245
204
  ],
246
- alternativeIntents: [
247
- () => void 0 !== output.headers["x-amz-lex-alternative-intents"],
248
- () => new __LazyJsonString(Buffer.from(context.base64Decoder(output.headers["x-amz-lex-alternative-intents"])).toString("utf8")),
205
+ [_aI]: [
206
+ () => void 0 !== output.headers[_xalai],
207
+ () => new __LazyJsonString(Buffer.from(context.base64Decoder(output.headers[_xalai])).toString("utf8")),
249
208
  ],
250
- slots: [
251
- () => void 0 !== output.headers["x-amz-lex-slots"],
252
- () => new __LazyJsonString(Buffer.from(context.base64Decoder(output.headers["x-amz-lex-slots"])).toString("utf8")),
209
+ [_s]: [
210
+ () => void 0 !== output.headers[_xals],
211
+ () => new __LazyJsonString(Buffer.from(context.base64Decoder(output.headers[_xals])).toString("utf8")),
253
212
  ],
254
- sessionAttributes: [
255
- () => void 0 !== output.headers["x-amz-lex-session-attributes"],
256
- () => new __LazyJsonString(Buffer.from(context.base64Decoder(output.headers["x-amz-lex-session-attributes"])).toString("utf8")),
213
+ [_sA]: [
214
+ () => void 0 !== output.headers[_xalsa],
215
+ () => new __LazyJsonString(Buffer.from(context.base64Decoder(output.headers[_xalsa])).toString("utf8")),
257
216
  ],
258
- sentimentResponse: [, output.headers["x-amz-lex-sentiment"]],
259
- message: [, output.headers["x-amz-lex-message"]],
260
- encodedMessage: [, output.headers["x-amz-lex-encoded-message"]],
261
- messageFormat: [, output.headers["x-amz-lex-message-format"]],
262
- dialogState: [, output.headers["x-amz-lex-dialog-state"]],
263
- slotToElicit: [, output.headers["x-amz-lex-slot-to-elicit"]],
264
- inputTranscript: [, output.headers["x-amz-lex-input-transcript"]],
265
- encodedInputTranscript: [, output.headers["x-amz-lex-encoded-input-transcript"]],
266
- botVersion: [, output.headers["x-amz-lex-bot-version"]],
267
- sessionId: [, output.headers["x-amz-lex-session-id"]],
268
- activeContexts: [
269
- () => void 0 !== output.headers["x-amz-lex-active-contexts"],
270
- () => new __LazyJsonString(Buffer.from(context.base64Decoder(output.headers["x-amz-lex-active-contexts"])).toString("utf8")),
217
+ [_sR]: [, output.headers[_xals_]],
218
+ [_m]: [, output.headers[_xalm]],
219
+ [_eM]: [, output.headers[_xalem]],
220
+ [_mF]: [, output.headers[_xalmf]],
221
+ [_dS]: [, output.headers[_xalds]],
222
+ [_sTE]: [, output.headers[_xalste]],
223
+ [_iT]: [, output.headers[_xalit]],
224
+ [_eIT]: [, output.headers[_xaleit]],
225
+ [_bV]: [, output.headers[_xalbv]],
226
+ [_sI]: [, output.headers[_xalsi]],
227
+ [_aC]: [
228
+ () => void 0 !== output.headers[_xalac],
229
+ () => new __LazyJsonString(Buffer.from(context.base64Decoder(output.headers[_xalac])).toString("utf8")),
271
230
  ],
272
231
  });
273
232
  const data = output.body;
@@ -397,25 +356,25 @@ export const de_PutSessionCommand = async (output, context) => {
397
356
  }
398
357
  const contents = map({
399
358
  $metadata: deserializeMetadata(output),
400
- contentType: [, output.headers["content-type"]],
401
- intentName: [, output.headers["x-amz-lex-intent-name"]],
402
- slots: [
403
- () => void 0 !== output.headers["x-amz-lex-slots"],
404
- () => new __LazyJsonString(Buffer.from(context.base64Decoder(output.headers["x-amz-lex-slots"])).toString("utf8")),
359
+ [_cT]: [, output.headers[_ct]],
360
+ [_iN]: [, output.headers[_xalin]],
361
+ [_s]: [
362
+ () => void 0 !== output.headers[_xals],
363
+ () => new __LazyJsonString(Buffer.from(context.base64Decoder(output.headers[_xals])).toString("utf8")),
405
364
  ],
406
- sessionAttributes: [
407
- () => void 0 !== output.headers["x-amz-lex-session-attributes"],
408
- () => new __LazyJsonString(Buffer.from(context.base64Decoder(output.headers["x-amz-lex-session-attributes"])).toString("utf8")),
365
+ [_sA]: [
366
+ () => void 0 !== output.headers[_xalsa],
367
+ () => new __LazyJsonString(Buffer.from(context.base64Decoder(output.headers[_xalsa])).toString("utf8")),
409
368
  ],
410
- message: [, output.headers["x-amz-lex-message"]],
411
- encodedMessage: [, output.headers["x-amz-lex-encoded-message"]],
412
- messageFormat: [, output.headers["x-amz-lex-message-format"]],
413
- dialogState: [, output.headers["x-amz-lex-dialog-state"]],
414
- slotToElicit: [, output.headers["x-amz-lex-slot-to-elicit"]],
415
- sessionId: [, output.headers["x-amz-lex-session-id"]],
416
- activeContexts: [
417
- () => void 0 !== output.headers["x-amz-lex-active-contexts"],
418
- () => new __LazyJsonString(Buffer.from(context.base64Decoder(output.headers["x-amz-lex-active-contexts"])).toString("utf8")),
369
+ [_m]: [, output.headers[_xalm]],
370
+ [_eM]: [, output.headers[_xalem]],
371
+ [_mF]: [, output.headers[_xalmf]],
372
+ [_dS]: [, output.headers[_xalds]],
373
+ [_sTE]: [, output.headers[_xalste]],
374
+ [_sI]: [, output.headers[_xalsi]],
375
+ [_aC]: [
376
+ () => void 0 !== output.headers[_xalac],
377
+ () => new __LazyJsonString(Buffer.from(context.base64Decoder(output.headers[_xalac])).toString("utf8")),
419
378
  ],
420
379
  });
421
380
  const data = output.body;
@@ -531,7 +490,7 @@ const de_InternalFailureExceptionRes = async (parsedOutput, context) => {
531
490
  };
532
491
  const de_LimitExceededExceptionRes = async (parsedOutput, context) => {
533
492
  const contents = map({
534
- retryAfterSeconds: [, parsedOutput.headers["retry-after"]],
493
+ [_rAS]: [, parsedOutput.headers[_ra]],
535
494
  });
536
495
  const data = parsedOutput.body;
537
496
  const doc = take(data, {
@@ -641,6 +600,46 @@ const isSerializableHeaderValue = (value) => value !== undefined &&
641
600
  value !== "" &&
642
601
  (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
643
602
  (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
603
+ const _a = "accept";
604
+ const _aC = "activeContexts";
605
+ const _aI = "alternativeIntents";
606
+ const _bV = "botVersion";
607
+ const _cLF = "checkpointLabelFilter";
608
+ const _cT = "contentType";
609
+ const _ct = "content-type";
610
+ const _dS = "dialogState";
611
+ const _eIT = "encodedInputTranscript";
612
+ const _eM = "encodedMessage";
613
+ const _iN = "intentName";
614
+ const _iT = "inputTranscript";
615
+ const _m = "message";
616
+ const _mF = "messageFormat";
617
+ const _nIC = "nluIntentConfidence";
618
+ const _rA = "requestAttributes";
619
+ const _rAS = "retryAfterSeconds";
620
+ const _ra = "retry-after";
621
+ const _s = "slots";
622
+ const _sA = "sessionAttributes";
623
+ const _sI = "sessionId";
624
+ const _sR = "sentimentResponse";
625
+ const _sTE = "slotToElicit";
626
+ const _xalac = "x-amz-lex-active-contexts";
627
+ const _xalai = "x-amz-lex-alternative-intents";
628
+ const _xalbv = "x-amz-lex-bot-version";
629
+ const _xalds = "x-amz-lex-dialog-state";
630
+ const _xaleit = "x-amz-lex-encoded-input-transcript";
631
+ const _xalem = "x-amz-lex-encoded-message";
632
+ const _xalin = "x-amz-lex-intent-name";
633
+ const _xalit = "x-amz-lex-input-transcript";
634
+ const _xalm = "x-amz-lex-message";
635
+ const _xalmf = "x-amz-lex-message-format";
636
+ const _xalnic = "x-amz-lex-nlu-intent-confidence";
637
+ const _xalra = "x-amz-lex-request-attributes";
638
+ const _xals = "x-amz-lex-slots";
639
+ const _xals_ = "x-amz-lex-sentiment";
640
+ const _xalsa = "x-amz-lex-session-attributes";
641
+ const _xalsi = "x-amz-lex-session-id";
642
+ const _xalste = "x-amz-lex-slot-to-elicit";
644
643
  const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
645
644
  if (encoded.length) {
646
645
  return JSON.parse(encoded);
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.476.0",
4
+ "version": "3.478.0",
5
5
  "scripts": {
6
6
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
7
7
  "build:cjs": "tsc -p tsconfig.cjs.json",
@@ -22,20 +22,21 @@
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.476.0",
26
- "@aws-sdk/core": "3.476.0",
27
- "@aws-sdk/credential-provider-node": "3.476.0",
25
+ "@aws-sdk/client-sts": "3.478.0",
26
+ "@aws-sdk/core": "3.477.0",
27
+ "@aws-sdk/credential-provider-node": "3.478.0",
28
28
  "@aws-sdk/middleware-host-header": "3.468.0",
29
29
  "@aws-sdk/middleware-logger": "3.468.0",
30
30
  "@aws-sdk/middleware-recursion-detection": "3.468.0",
31
31
  "@aws-sdk/middleware-signing": "3.468.0",
32
- "@aws-sdk/middleware-user-agent": "3.470.0",
32
+ "@aws-sdk/middleware-user-agent": "3.478.0",
33
33
  "@aws-sdk/region-config-resolver": "3.470.0",
34
34
  "@aws-sdk/types": "3.468.0",
35
- "@aws-sdk/util-endpoints": "3.470.0",
35
+ "@aws-sdk/util-endpoints": "3.478.0",
36
36
  "@aws-sdk/util-user-agent-browser": "3.468.0",
37
37
  "@aws-sdk/util-user-agent-node": "3.470.0",
38
38
  "@smithy/config-resolver": "^2.0.21",
39
+ "@smithy/core": "^1.2.0",
39
40
  "@smithy/fetch-http-handler": "^2.3.1",
40
41
  "@smithy/hash-node": "^2.0.17",
41
42
  "@smithy/invalid-dependency": "^2.0.15",