@aws-sdk/client-lex-runtime-service 3.186.0 → 3.188.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.
Files changed (34) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist-cjs/protocols/Aws_restJson1.js +2 -0
  3. package/dist-cjs/runtimeConfig.browser.js +9 -7
  4. package/dist-cjs/runtimeConfig.js +9 -7
  5. package/dist-es/LexRuntimeService.js +22 -29
  6. package/dist-es/LexRuntimeServiceClient.js +22 -28
  7. package/dist-es/commands/DeleteSessionCommand.js +21 -28
  8. package/dist-es/commands/GetSessionCommand.js +21 -28
  9. package/dist-es/commands/PostContentCommand.js +21 -28
  10. package/dist-es/commands/PostTextCommand.js +21 -28
  11. package/dist-es/commands/PutSessionCommand.js +21 -28
  12. package/dist-es/endpoints.js +8 -8
  13. package/dist-es/models/LexRuntimeServiceServiceException.js +5 -10
  14. package/dist-es/models/models_0.js +223 -152
  15. package/dist-es/protocols/Aws_restJson1.js +755 -913
  16. package/dist-es/runtimeConfig.browser.js +28 -12
  17. package/dist-es/runtimeConfig.js +32 -12
  18. package/dist-es/runtimeConfig.native.js +8 -5
  19. package/dist-es/runtimeConfig.shared.js +8 -11
  20. package/dist-types/LexRuntimeServiceClient.d.ts +6 -1
  21. package/dist-types/commands/PostContentCommand.d.ts +2 -2
  22. package/dist-types/commands/PutSessionCommand.d.ts +2 -2
  23. package/dist-types/protocols/Aws_restJson1.d.ts +3 -3
  24. package/dist-types/runtimeConfig.browser.d.ts +1 -0
  25. package/dist-types/runtimeConfig.d.ts +1 -0
  26. package/dist-types/runtimeConfig.native.d.ts +1 -0
  27. package/dist-types/ts3.4/LexRuntimeServiceClient.d.ts +2 -0
  28. package/dist-types/ts3.4/commands/PostContentCommand.d.ts +2 -1
  29. package/dist-types/ts3.4/commands/PutSessionCommand.d.ts +2 -1
  30. package/dist-types/ts3.4/protocols/Aws_restJson1.d.ts +6 -3
  31. package/dist-types/ts3.4/runtimeConfig.browser.d.ts +1 -0
  32. package/dist-types/ts3.4/runtimeConfig.d.ts +1 -0
  33. package/dist-types/ts3.4/runtimeConfig.native.d.ts +1 -0
  34. package/package.json +35 -33
@@ -1,877 +1,735 @@
1
- import { __assign, __awaiter, __generator, __read } from "tslib";
2
1
  import { HttpRequest as __HttpRequest } from "@aws-sdk/protocol-http";
3
2
  import { decorateServiceException as __decorateServiceException, expectInt32 as __expectInt32, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, LazyJsonString as __LazyJsonString, limitedParseDouble as __limitedParseDouble, map as __map, resolvedPath as __resolvedPath, throwDefaultError, } from "@aws-sdk/smithy-client";
4
3
  import { LexRuntimeServiceServiceException as __BaseException } from "../models/LexRuntimeServiceServiceException";
5
4
  import { BadGatewayException, BadRequestException, ConflictException, DependencyFailedException, InternalFailureException, LimitExceededException, LoopDetectedException, NotAcceptableException, NotFoundException, RequestTimeoutException, UnsupportedMediaTypeException, } from "../models/models_0";
6
- export var serializeAws_restJson1DeleteSessionCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
7
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
8
- return __generator(this, function (_c) {
9
- switch (_c.label) {
10
- case 0: return [4, context.endpoint()];
11
- case 1:
12
- _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
13
- headers = {};
14
- resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") +
15
- "/bot/{botName}/alias/{botAlias}/user/{userId}/session";
16
- resolvedPath = __resolvedPath(resolvedPath, input, "botName", function () { return input.botName; }, "{botName}", false);
17
- resolvedPath = __resolvedPath(resolvedPath, input, "botAlias", function () { return input.botAlias; }, "{botAlias}", false);
18
- resolvedPath = __resolvedPath(resolvedPath, input, "userId", function () { return input.userId; }, "{userId}", false);
19
- return [2, new __HttpRequest({
20
- protocol: protocol,
21
- hostname: hostname,
22
- port: port,
23
- method: "DELETE",
24
- headers: headers,
25
- path: resolvedPath,
26
- body: body,
27
- })];
28
- }
29
- });
30
- }); };
31
- export var serializeAws_restJson1GetSessionCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
32
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, query, body;
33
- return __generator(this, function (_c) {
34
- switch (_c.label) {
35
- case 0: return [4, context.endpoint()];
36
- case 1:
37
- _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
38
- headers = {};
39
- resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") +
40
- "/bot/{botName}/alias/{botAlias}/user/{userId}/session";
41
- resolvedPath = __resolvedPath(resolvedPath, input, "botName", function () { return input.botName; }, "{botName}", false);
42
- resolvedPath = __resolvedPath(resolvedPath, input, "botAlias", function () { return input.botAlias; }, "{botAlias}", false);
43
- resolvedPath = __resolvedPath(resolvedPath, input, "userId", function () { return input.userId; }, "{userId}", false);
44
- query = map({
45
- checkpointLabelFilter: [, input.checkpointLabelFilter],
46
- });
47
- return [2, new __HttpRequest({
48
- protocol: protocol,
49
- hostname: hostname,
50
- port: port,
51
- method: "GET",
52
- headers: headers,
53
- path: resolvedPath,
54
- query: query,
55
- body: body,
56
- })];
57
- }
58
- });
59
- }); };
60
- export var serializeAws_restJson1PostContentCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
61
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
62
- return __generator(this, function (_c) {
63
- switch (_c.label) {
64
- case 0: return [4, context.endpoint()];
65
- case 1:
66
- _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
67
- headers = map({}, isSerializableHeaderValue, {
68
- "x-amz-content-sha256": "UNSIGNED-PAYLOAD",
69
- "content-type": input.contentType || "application/octet-stream",
70
- "x-amz-lex-session-attributes": [
71
- function () { return isSerializableHeaderValue(input.sessionAttributes); },
72
- function () { return context.base64Encoder(Buffer.from(__LazyJsonString.fromObject(input.sessionAttributes))); },
73
- ],
74
- "x-amz-lex-request-attributes": [
75
- function () { return isSerializableHeaderValue(input.requestAttributes); },
76
- function () { return context.base64Encoder(Buffer.from(__LazyJsonString.fromObject(input.requestAttributes))); },
77
- ],
78
- accept: input.accept,
79
- "x-amz-lex-active-contexts": [
80
- function () { return isSerializableHeaderValue(input.activeContexts); },
81
- function () { return context.base64Encoder(Buffer.from(__LazyJsonString.fromObject(input.activeContexts))); },
82
- ],
83
- });
84
- resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") +
85
- "/bot/{botName}/alias/{botAlias}/user/{userId}/content";
86
- resolvedPath = __resolvedPath(resolvedPath, input, "botName", function () { return input.botName; }, "{botName}", false);
87
- resolvedPath = __resolvedPath(resolvedPath, input, "botAlias", function () { return input.botAlias; }, "{botAlias}", false);
88
- resolvedPath = __resolvedPath(resolvedPath, input, "userId", function () { return input.userId; }, "{userId}", false);
89
- if (input.inputStream !== undefined) {
90
- body = input.inputStream;
91
- }
92
- return [2, new __HttpRequest({
93
- protocol: protocol,
94
- hostname: hostname,
95
- port: port,
96
- method: "POST",
97
- headers: headers,
98
- path: resolvedPath,
99
- body: body,
100
- })];
101
- }
102
- });
103
- }); };
104
- export var serializeAws_restJson1PostTextCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
105
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
106
- return __generator(this, function (_c) {
107
- switch (_c.label) {
108
- case 0: return [4, context.endpoint()];
109
- case 1:
110
- _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
111
- headers = {
112
- "content-type": "application/json",
113
- };
114
- resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") +
115
- "/bot/{botName}/alias/{botAlias}/user/{userId}/text";
116
- resolvedPath = __resolvedPath(resolvedPath, input, "botName", function () { return input.botName; }, "{botName}", false);
117
- resolvedPath = __resolvedPath(resolvedPath, input, "botAlias", function () { return input.botAlias; }, "{botAlias}", false);
118
- resolvedPath = __resolvedPath(resolvedPath, input, "userId", function () { return input.userId; }, "{userId}", false);
119
- body = JSON.stringify(__assign(__assign(__assign(__assign({}, (input.activeContexts != null && {
120
- activeContexts: serializeAws_restJson1ActiveContextsList(input.activeContexts, context),
121
- })), (input.inputText != null && { inputText: input.inputText })), (input.requestAttributes != null && {
122
- requestAttributes: serializeAws_restJson1StringMap(input.requestAttributes, context),
123
- })), (input.sessionAttributes != null && {
124
- sessionAttributes: serializeAws_restJson1StringMap(input.sessionAttributes, context),
125
- })));
126
- return [2, new __HttpRequest({
127
- protocol: protocol,
128
- hostname: hostname,
129
- port: port,
130
- method: "POST",
131
- headers: headers,
132
- path: resolvedPath,
133
- body: body,
134
- })];
135
- }
136
- });
137
- }); };
138
- export var serializeAws_restJson1PutSessionCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
139
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
140
- return __generator(this, function (_c) {
141
- switch (_c.label) {
142
- case 0: return [4, context.endpoint()];
143
- case 1:
144
- _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
145
- headers = map({}, isSerializableHeaderValue, {
146
- "content-type": "application/json",
147
- accept: input.accept,
148
- });
149
- resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") +
150
- "/bot/{botName}/alias/{botAlias}/user/{userId}/session";
151
- resolvedPath = __resolvedPath(resolvedPath, input, "botName", function () { return input.botName; }, "{botName}", false);
152
- resolvedPath = __resolvedPath(resolvedPath, input, "botAlias", function () { return input.botAlias; }, "{botAlias}", false);
153
- resolvedPath = __resolvedPath(resolvedPath, input, "userId", function () { return input.userId; }, "{userId}", false);
154
- body = JSON.stringify(__assign(__assign(__assign(__assign({}, (input.activeContexts != null && {
155
- activeContexts: serializeAws_restJson1ActiveContextsList(input.activeContexts, context),
156
- })), (input.dialogAction != null && {
157
- dialogAction: serializeAws_restJson1DialogAction(input.dialogAction, context),
158
- })), (input.recentIntentSummaryView != null && {
159
- recentIntentSummaryView: serializeAws_restJson1IntentSummaryList(input.recentIntentSummaryView, context),
160
- })), (input.sessionAttributes != null && {
161
- sessionAttributes: serializeAws_restJson1StringMap(input.sessionAttributes, context),
162
- })));
163
- return [2, new __HttpRequest({
164
- protocol: protocol,
165
- hostname: hostname,
166
- port: port,
167
- method: "POST",
168
- headers: headers,
169
- path: resolvedPath,
170
- body: body,
171
- })];
172
- }
173
- });
174
- }); };
175
- export var deserializeAws_restJson1DeleteSessionCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
176
- var contents, data, _a, _b;
177
- return __generator(this, function (_c) {
178
- switch (_c.label) {
179
- case 0:
180
- if (output.statusCode !== 200 && output.statusCode >= 300) {
181
- return [2, deserializeAws_restJson1DeleteSessionCommandError(output, context)];
182
- }
183
- contents = map({
184
- $metadata: deserializeMetadata(output),
185
- });
186
- _a = __expectNonNull;
187
- _b = __expectObject;
188
- return [4, parseBody(output.body, context)];
189
- case 1:
190
- data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
191
- if (data.botAlias != null) {
192
- contents.botAlias = __expectString(data.botAlias);
193
- }
194
- if (data.botName != null) {
195
- contents.botName = __expectString(data.botName);
196
- }
197
- if (data.sessionId != null) {
198
- contents.sessionId = __expectString(data.sessionId);
199
- }
200
- if (data.userId != null) {
201
- contents.userId = __expectString(data.userId);
202
- }
203
- return [2, contents];
204
- }
205
- });
206
- }); };
207
- var deserializeAws_restJson1DeleteSessionCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
208
- var parsedOutput, _a, errorCode, _b, parsedBody;
209
- var _c;
210
- return __generator(this, function (_d) {
211
- switch (_d.label) {
212
- case 0:
213
- _a = [__assign({}, output)];
214
- _c = {};
215
- return [4, parseErrorBody(output.body, context)];
216
- case 1:
217
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
218
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
219
- _b = errorCode;
220
- switch (_b) {
221
- case "BadRequestException": return [3, 2];
222
- case "com.amazonaws.lexruntimeservice#BadRequestException": return [3, 2];
223
- case "ConflictException": return [3, 4];
224
- case "com.amazonaws.lexruntimeservice#ConflictException": return [3, 4];
225
- case "InternalFailureException": return [3, 6];
226
- case "com.amazonaws.lexruntimeservice#InternalFailureException": return [3, 6];
227
- case "LimitExceededException": return [3, 8];
228
- case "com.amazonaws.lexruntimeservice#LimitExceededException": return [3, 8];
229
- case "NotFoundException": return [3, 10];
230
- case "com.amazonaws.lexruntimeservice#NotFoundException": return [3, 10];
231
- }
232
- return [3, 12];
233
- case 2: return [4, deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)];
234
- case 3: throw _d.sent();
235
- case 4: return [4, deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)];
236
- case 5: throw _d.sent();
237
- case 6: return [4, deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)];
238
- case 7: throw _d.sent();
239
- case 8: return [4, deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context)];
240
- case 9: throw _d.sent();
241
- case 10: return [4, deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)];
242
- case 11: throw _d.sent();
243
- case 12:
244
- parsedBody = parsedOutput.body;
245
- throwDefaultError({
246
- output: output,
247
- parsedBody: parsedBody,
248
- exceptionCtor: __BaseException,
249
- errorCode: errorCode,
250
- });
251
- _d.label = 13;
252
- case 13: return [2];
253
- }
5
+ export const serializeAws_restJson1DeleteSessionCommand = async (input, context) => {
6
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
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);
13
+ let body;
14
+ return new __HttpRequest({
15
+ protocol,
16
+ hostname,
17
+ port,
18
+ method: "DELETE",
19
+ headers,
20
+ path: resolvedPath,
21
+ body,
254
22
  });
255
- }); };
256
- export var deserializeAws_restJson1GetSessionCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
257
- var contents, data, _a, _b;
258
- return __generator(this, function (_c) {
259
- switch (_c.label) {
260
- case 0:
261
- if (output.statusCode !== 200 && output.statusCode >= 300) {
262
- return [2, deserializeAws_restJson1GetSessionCommandError(output, context)];
263
- }
264
- contents = map({
265
- $metadata: deserializeMetadata(output),
266
- });
267
- _a = __expectNonNull;
268
- _b = __expectObject;
269
- return [4, parseBody(output.body, context)];
270
- case 1:
271
- data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
272
- if (data.activeContexts != null) {
273
- contents.activeContexts = deserializeAws_restJson1ActiveContextsList(data.activeContexts, context);
274
- }
275
- if (data.dialogAction != null) {
276
- contents.dialogAction = deserializeAws_restJson1DialogAction(data.dialogAction, context);
277
- }
278
- if (data.recentIntentSummaryView != null) {
279
- contents.recentIntentSummaryView = deserializeAws_restJson1IntentSummaryList(data.recentIntentSummaryView, context);
280
- }
281
- if (data.sessionAttributes != null) {
282
- contents.sessionAttributes = deserializeAws_restJson1StringMap(data.sessionAttributes, context);
283
- }
284
- if (data.sessionId != null) {
285
- contents.sessionId = __expectString(data.sessionId);
286
- }
287
- return [2, contents];
288
- }
23
+ };
24
+ export const serializeAws_restJson1GetSessionCommand = async (input, context) => {
25
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
26
+ 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);
32
+ const query = map({
33
+ checkpointLabelFilter: [, input.checkpointLabelFilter],
34
+ });
35
+ let body;
36
+ return new __HttpRequest({
37
+ protocol,
38
+ hostname,
39
+ port,
40
+ method: "GET",
41
+ headers,
42
+ path: resolvedPath,
43
+ query,
44
+ body,
289
45
  });
290
- }); };
291
- var deserializeAws_restJson1GetSessionCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
292
- var parsedOutput, _a, errorCode, _b, parsedBody;
293
- var _c;
294
- return __generator(this, function (_d) {
295
- switch (_d.label) {
296
- case 0:
297
- _a = [__assign({}, output)];
298
- _c = {};
299
- return [4, parseErrorBody(output.body, context)];
300
- case 1:
301
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
302
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
303
- _b = errorCode;
304
- switch (_b) {
305
- case "BadRequestException": return [3, 2];
306
- case "com.amazonaws.lexruntimeservice#BadRequestException": return [3, 2];
307
- case "InternalFailureException": return [3, 4];
308
- case "com.amazonaws.lexruntimeservice#InternalFailureException": return [3, 4];
309
- case "LimitExceededException": return [3, 6];
310
- case "com.amazonaws.lexruntimeservice#LimitExceededException": return [3, 6];
311
- case "NotFoundException": return [3, 8];
312
- case "com.amazonaws.lexruntimeservice#NotFoundException": return [3, 8];
313
- }
314
- return [3, 10];
315
- case 2: return [4, deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)];
316
- case 3: throw _d.sent();
317
- case 4: return [4, deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)];
318
- case 5: throw _d.sent();
319
- case 6: return [4, deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context)];
320
- case 7: throw _d.sent();
321
- case 8: return [4, deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)];
322
- case 9: throw _d.sent();
323
- case 10:
324
- parsedBody = parsedOutput.body;
325
- throwDefaultError({
326
- output: output,
327
- parsedBody: parsedBody,
328
- exceptionCtor: __BaseException,
329
- errorCode: errorCode,
330
- });
331
- _d.label = 11;
332
- case 11: return [2];
333
- }
46
+ };
47
+ export const serializeAws_restJson1PostContentCommand = async (input, context) => {
48
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
49
+ const headers = map({}, isSerializableHeaderValue, {
50
+ "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))),
55
+ ],
56
+ "x-amz-lex-request-attributes": [
57
+ () => isSerializableHeaderValue(input.requestAttributes),
58
+ () => context.base64Encoder(Buffer.from(__LazyJsonString.fromObject(input.requestAttributes))),
59
+ ],
60
+ accept: input.accept,
61
+ "x-amz-lex-active-contexts": [
62
+ () => isSerializableHeaderValue(input.activeContexts),
63
+ () => context.base64Encoder(Buffer.from(__LazyJsonString.fromObject(input.activeContexts))),
64
+ ],
65
+ });
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);
71
+ let body;
72
+ if (input.inputStream !== undefined) {
73
+ body = input.inputStream;
74
+ }
75
+ return new __HttpRequest({
76
+ protocol,
77
+ hostname,
78
+ port,
79
+ method: "POST",
80
+ headers,
81
+ path: resolvedPath,
82
+ body,
334
83
  });
335
- }); };
336
- export var deserializeAws_restJson1PostContentCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
337
- var contents, data;
338
- return __generator(this, function (_a) {
339
- if (output.statusCode !== 200 && output.statusCode >= 300) {
340
- return [2, deserializeAws_restJson1PostContentCommandError(output, context)];
341
- }
342
- contents = map({
343
- $metadata: deserializeMetadata(output),
344
- contentType: [, output.headers["content-type"]],
345
- intentName: [, output.headers["x-amz-lex-intent-name"]],
346
- nluIntentConfidence: [
347
- function () { return void 0 !== output.headers["x-amz-lex-nlu-intent-confidence"]; },
348
- function () {
349
- return new __LazyJsonString(Buffer.from(context.base64Decoder(output.headers["x-amz-lex-nlu-intent-confidence"])).toString("utf8"));
350
- },
351
- ],
352
- alternativeIntents: [
353
- function () { return void 0 !== output.headers["x-amz-lex-alternative-intents"]; },
354
- function () {
355
- return new __LazyJsonString(Buffer.from(context.base64Decoder(output.headers["x-amz-lex-alternative-intents"])).toString("utf8"));
356
- },
357
- ],
358
- slots: [
359
- function () { return void 0 !== output.headers["x-amz-lex-slots"]; },
360
- function () {
361
- return new __LazyJsonString(Buffer.from(context.base64Decoder(output.headers["x-amz-lex-slots"])).toString("utf8"));
362
- },
363
- ],
364
- sessionAttributes: [
365
- function () { return void 0 !== output.headers["x-amz-lex-session-attributes"]; },
366
- function () {
367
- return new __LazyJsonString(Buffer.from(context.base64Decoder(output.headers["x-amz-lex-session-attributes"])).toString("utf8"));
368
- },
369
- ],
370
- sentimentResponse: [, output.headers["x-amz-lex-sentiment"]],
371
- message: [, output.headers["x-amz-lex-message"]],
372
- encodedMessage: [, output.headers["x-amz-lex-encoded-message"]],
373
- messageFormat: [, output.headers["x-amz-lex-message-format"]],
374
- dialogState: [, output.headers["x-amz-lex-dialog-state"]],
375
- slotToElicit: [, output.headers["x-amz-lex-slot-to-elicit"]],
376
- inputTranscript: [, output.headers["x-amz-lex-input-transcript"]],
377
- encodedInputTranscript: [, output.headers["x-amz-lex-encoded-input-transcript"]],
378
- botVersion: [, output.headers["x-amz-lex-bot-version"]],
379
- sessionId: [, output.headers["x-amz-lex-session-id"]],
380
- activeContexts: [
381
- function () { return void 0 !== output.headers["x-amz-lex-active-contexts"]; },
382
- function () {
383
- return new __LazyJsonString(Buffer.from(context.base64Decoder(output.headers["x-amz-lex-active-contexts"])).toString("utf8"));
384
- },
385
- ],
386
- });
387
- data = output.body;
388
- contents.audioStream = data;
389
- return [2, contents];
84
+ };
85
+ export const serializeAws_restJson1PostTextCommand = async (input, context) => {
86
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
87
+ const headers = {
88
+ "content-type": "application/json",
89
+ };
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);
95
+ let body;
96
+ body = JSON.stringify({
97
+ ...(input.activeContexts != null && {
98
+ activeContexts: serializeAws_restJson1ActiveContextsList(input.activeContexts, context),
99
+ }),
100
+ ...(input.inputText != null && { inputText: input.inputText }),
101
+ ...(input.requestAttributes != null && {
102
+ requestAttributes: serializeAws_restJson1StringMap(input.requestAttributes, context),
103
+ }),
104
+ ...(input.sessionAttributes != null && {
105
+ sessionAttributes: serializeAws_restJson1StringMap(input.sessionAttributes, context),
106
+ }),
107
+ });
108
+ return new __HttpRequest({
109
+ protocol,
110
+ hostname,
111
+ port,
112
+ method: "POST",
113
+ headers,
114
+ path: resolvedPath,
115
+ body,
390
116
  });
391
- }); };
392
- var deserializeAws_restJson1PostContentCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
393
- var parsedOutput, _a, errorCode, _b, parsedBody;
394
- var _c;
395
- return __generator(this, function (_d) {
396
- switch (_d.label) {
397
- case 0:
398
- _a = [__assign({}, output)];
399
- _c = {};
400
- return [4, parseErrorBody(output.body, context)];
401
- case 1:
402
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
403
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
404
- _b = errorCode;
405
- switch (_b) {
406
- case "BadGatewayException": return [3, 2];
407
- case "com.amazonaws.lexruntimeservice#BadGatewayException": return [3, 2];
408
- case "BadRequestException": return [3, 4];
409
- case "com.amazonaws.lexruntimeservice#BadRequestException": return [3, 4];
410
- case "ConflictException": return [3, 6];
411
- case "com.amazonaws.lexruntimeservice#ConflictException": return [3, 6];
412
- case "DependencyFailedException": return [3, 8];
413
- case "com.amazonaws.lexruntimeservice#DependencyFailedException": return [3, 8];
414
- case "InternalFailureException": return [3, 10];
415
- case "com.amazonaws.lexruntimeservice#InternalFailureException": return [3, 10];
416
- case "LimitExceededException": return [3, 12];
417
- case "com.amazonaws.lexruntimeservice#LimitExceededException": return [3, 12];
418
- case "LoopDetectedException": return [3, 14];
419
- case "com.amazonaws.lexruntimeservice#LoopDetectedException": return [3, 14];
420
- case "NotAcceptableException": return [3, 16];
421
- case "com.amazonaws.lexruntimeservice#NotAcceptableException": return [3, 16];
422
- case "NotFoundException": return [3, 18];
423
- case "com.amazonaws.lexruntimeservice#NotFoundException": return [3, 18];
424
- case "RequestTimeoutException": return [3, 20];
425
- case "com.amazonaws.lexruntimeservice#RequestTimeoutException": return [3, 20];
426
- case "UnsupportedMediaTypeException": return [3, 22];
427
- case "com.amazonaws.lexruntimeservice#UnsupportedMediaTypeException": return [3, 22];
428
- }
429
- return [3, 24];
430
- case 2: return [4, deserializeAws_restJson1BadGatewayExceptionResponse(parsedOutput, context)];
431
- case 3: throw _d.sent();
432
- case 4: return [4, deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)];
433
- case 5: throw _d.sent();
434
- case 6: return [4, deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)];
435
- case 7: throw _d.sent();
436
- case 8: return [4, deserializeAws_restJson1DependencyFailedExceptionResponse(parsedOutput, context)];
437
- case 9: throw _d.sent();
438
- case 10: return [4, deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)];
439
- case 11: throw _d.sent();
440
- case 12: return [4, deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context)];
441
- case 13: throw _d.sent();
442
- case 14: return [4, deserializeAws_restJson1LoopDetectedExceptionResponse(parsedOutput, context)];
443
- case 15: throw _d.sent();
444
- case 16: return [4, deserializeAws_restJson1NotAcceptableExceptionResponse(parsedOutput, context)];
445
- case 17: throw _d.sent();
446
- case 18: return [4, deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)];
447
- case 19: throw _d.sent();
448
- case 20: return [4, deserializeAws_restJson1RequestTimeoutExceptionResponse(parsedOutput, context)];
449
- case 21: throw _d.sent();
450
- case 22: return [4, deserializeAws_restJson1UnsupportedMediaTypeExceptionResponse(parsedOutput, context)];
451
- case 23: throw _d.sent();
452
- case 24:
453
- parsedBody = parsedOutput.body;
454
- throwDefaultError({
455
- output: output,
456
- parsedBody: parsedBody,
457
- exceptionCtor: __BaseException,
458
- errorCode: errorCode,
459
- });
460
- _d.label = 25;
461
- case 25: return [2];
462
- }
117
+ };
118
+ export const serializeAws_restJson1PutSessionCommand = async (input, context) => {
119
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
120
+ const headers = map({}, isSerializableHeaderValue, {
121
+ "content-type": "application/json",
122
+ accept: input.accept,
123
+ });
124
+ let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
125
+ "/bot/{botName}/alias/{botAlias}/user/{userId}/session";
126
+ resolvedPath = __resolvedPath(resolvedPath, input, "botName", () => input.botName, "{botName}", false);
127
+ resolvedPath = __resolvedPath(resolvedPath, input, "botAlias", () => input.botAlias, "{botAlias}", false);
128
+ resolvedPath = __resolvedPath(resolvedPath, input, "userId", () => input.userId, "{userId}", false);
129
+ let body;
130
+ body = JSON.stringify({
131
+ ...(input.activeContexts != null && {
132
+ activeContexts: serializeAws_restJson1ActiveContextsList(input.activeContexts, context),
133
+ }),
134
+ ...(input.dialogAction != null && {
135
+ dialogAction: serializeAws_restJson1DialogAction(input.dialogAction, context),
136
+ }),
137
+ ...(input.recentIntentSummaryView != null && {
138
+ recentIntentSummaryView: serializeAws_restJson1IntentSummaryList(input.recentIntentSummaryView, context),
139
+ }),
140
+ ...(input.sessionAttributes != null && {
141
+ sessionAttributes: serializeAws_restJson1StringMap(input.sessionAttributes, context),
142
+ }),
143
+ });
144
+ return new __HttpRequest({
145
+ protocol,
146
+ hostname,
147
+ port,
148
+ method: "POST",
149
+ headers,
150
+ path: resolvedPath,
151
+ body,
463
152
  });
464
- }); };
465
- export var deserializeAws_restJson1PostTextCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
466
- var contents, data, _a, _b;
467
- return __generator(this, function (_c) {
468
- switch (_c.label) {
469
- case 0:
470
- if (output.statusCode !== 200 && output.statusCode >= 300) {
471
- return [2, deserializeAws_restJson1PostTextCommandError(output, context)];
472
- }
473
- contents = map({
474
- $metadata: deserializeMetadata(output),
475
- });
476
- _a = __expectNonNull;
477
- _b = __expectObject;
478
- return [4, parseBody(output.body, context)];
479
- case 1:
480
- data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
481
- if (data.activeContexts != null) {
482
- contents.activeContexts = deserializeAws_restJson1ActiveContextsList(data.activeContexts, context);
483
- }
484
- if (data.alternativeIntents != null) {
485
- contents.alternativeIntents = deserializeAws_restJson1IntentList(data.alternativeIntents, context);
486
- }
487
- if (data.botVersion != null) {
488
- contents.botVersion = __expectString(data.botVersion);
489
- }
490
- if (data.dialogState != null) {
491
- contents.dialogState = __expectString(data.dialogState);
492
- }
493
- if (data.intentName != null) {
494
- contents.intentName = __expectString(data.intentName);
495
- }
496
- if (data.message != null) {
497
- contents.message = __expectString(data.message);
498
- }
499
- if (data.messageFormat != null) {
500
- contents.messageFormat = __expectString(data.messageFormat);
501
- }
502
- if (data.nluIntentConfidence != null) {
503
- contents.nluIntentConfidence = deserializeAws_restJson1IntentConfidence(data.nluIntentConfidence, context);
504
- }
505
- if (data.responseCard != null) {
506
- contents.responseCard = deserializeAws_restJson1ResponseCard(data.responseCard, context);
507
- }
508
- if (data.sentimentResponse != null) {
509
- contents.sentimentResponse = deserializeAws_restJson1SentimentResponse(data.sentimentResponse, context);
510
- }
511
- if (data.sessionAttributes != null) {
512
- contents.sessionAttributes = deserializeAws_restJson1StringMap(data.sessionAttributes, context);
513
- }
514
- if (data.sessionId != null) {
515
- contents.sessionId = __expectString(data.sessionId);
516
- }
517
- if (data.slotToElicit != null) {
518
- contents.slotToElicit = __expectString(data.slotToElicit);
519
- }
520
- if (data.slots != null) {
521
- contents.slots = deserializeAws_restJson1StringMap(data.slots, context);
522
- }
523
- return [2, contents];
524
- }
153
+ };
154
+ export const deserializeAws_restJson1DeleteSessionCommand = async (output, context) => {
155
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
156
+ return deserializeAws_restJson1DeleteSessionCommandError(output, context);
157
+ }
158
+ const contents = map({
159
+ $metadata: deserializeMetadata(output),
525
160
  });
526
- }); };
527
- var deserializeAws_restJson1PostTextCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
528
- var parsedOutput, _a, errorCode, _b, parsedBody;
529
- var _c;
530
- return __generator(this, function (_d) {
531
- switch (_d.label) {
532
- case 0:
533
- _a = [__assign({}, output)];
534
- _c = {};
535
- return [4, parseErrorBody(output.body, context)];
536
- case 1:
537
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
538
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
539
- _b = errorCode;
540
- switch (_b) {
541
- case "BadGatewayException": return [3, 2];
542
- case "com.amazonaws.lexruntimeservice#BadGatewayException": return [3, 2];
543
- case "BadRequestException": return [3, 4];
544
- case "com.amazonaws.lexruntimeservice#BadRequestException": return [3, 4];
545
- case "ConflictException": return [3, 6];
546
- case "com.amazonaws.lexruntimeservice#ConflictException": return [3, 6];
547
- case "DependencyFailedException": return [3, 8];
548
- case "com.amazonaws.lexruntimeservice#DependencyFailedException": return [3, 8];
549
- case "InternalFailureException": return [3, 10];
550
- case "com.amazonaws.lexruntimeservice#InternalFailureException": return [3, 10];
551
- case "LimitExceededException": return [3, 12];
552
- case "com.amazonaws.lexruntimeservice#LimitExceededException": return [3, 12];
553
- case "LoopDetectedException": return [3, 14];
554
- case "com.amazonaws.lexruntimeservice#LoopDetectedException": return [3, 14];
555
- case "NotFoundException": return [3, 16];
556
- case "com.amazonaws.lexruntimeservice#NotFoundException": return [3, 16];
557
- }
558
- return [3, 18];
559
- case 2: return [4, deserializeAws_restJson1BadGatewayExceptionResponse(parsedOutput, context)];
560
- case 3: throw _d.sent();
561
- case 4: return [4, deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)];
562
- case 5: throw _d.sent();
563
- case 6: return [4, deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)];
564
- case 7: throw _d.sent();
565
- case 8: return [4, deserializeAws_restJson1DependencyFailedExceptionResponse(parsedOutput, context)];
566
- case 9: throw _d.sent();
567
- case 10: return [4, deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)];
568
- case 11: throw _d.sent();
569
- case 12: return [4, deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context)];
570
- case 13: throw _d.sent();
571
- case 14: return [4, deserializeAws_restJson1LoopDetectedExceptionResponse(parsedOutput, context)];
572
- case 15: throw _d.sent();
573
- case 16: return [4, deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)];
574
- case 17: throw _d.sent();
575
- case 18:
576
- parsedBody = parsedOutput.body;
577
- throwDefaultError({
578
- output: output,
579
- parsedBody: parsedBody,
580
- exceptionCtor: __BaseException,
581
- errorCode: errorCode,
582
- });
583
- _d.label = 19;
584
- case 19: return [2];
585
- }
161
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
162
+ if (data.botAlias != null) {
163
+ contents.botAlias = __expectString(data.botAlias);
164
+ }
165
+ if (data.botName != null) {
166
+ contents.botName = __expectString(data.botName);
167
+ }
168
+ if (data.sessionId != null) {
169
+ contents.sessionId = __expectString(data.sessionId);
170
+ }
171
+ if (data.userId != null) {
172
+ contents.userId = __expectString(data.userId);
173
+ }
174
+ return contents;
175
+ };
176
+ const deserializeAws_restJson1DeleteSessionCommandError = async (output, context) => {
177
+ const parsedOutput = {
178
+ ...output,
179
+ body: await parseErrorBody(output.body, context),
180
+ };
181
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
182
+ switch (errorCode) {
183
+ case "BadRequestException":
184
+ case "com.amazonaws.lexruntimeservice#BadRequestException":
185
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
186
+ case "ConflictException":
187
+ case "com.amazonaws.lexruntimeservice#ConflictException":
188
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
189
+ case "InternalFailureException":
190
+ case "com.amazonaws.lexruntimeservice#InternalFailureException":
191
+ throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
192
+ case "LimitExceededException":
193
+ case "com.amazonaws.lexruntimeservice#LimitExceededException":
194
+ throw await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context);
195
+ case "NotFoundException":
196
+ case "com.amazonaws.lexruntimeservice#NotFoundException":
197
+ throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
198
+ default:
199
+ const parsedBody = parsedOutput.body;
200
+ throwDefaultError({
201
+ output,
202
+ parsedBody,
203
+ exceptionCtor: __BaseException,
204
+ errorCode,
205
+ });
206
+ }
207
+ };
208
+ export const deserializeAws_restJson1GetSessionCommand = async (output, context) => {
209
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
210
+ return deserializeAws_restJson1GetSessionCommandError(output, context);
211
+ }
212
+ const contents = map({
213
+ $metadata: deserializeMetadata(output),
586
214
  });
587
- }); };
588
- export var deserializeAws_restJson1PutSessionCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
589
- var contents, data;
590
- return __generator(this, function (_a) {
591
- if (output.statusCode !== 200 && output.statusCode >= 300) {
592
- return [2, deserializeAws_restJson1PutSessionCommandError(output, context)];
593
- }
594
- contents = map({
595
- $metadata: deserializeMetadata(output),
596
- contentType: [, output.headers["content-type"]],
597
- intentName: [, output.headers["x-amz-lex-intent-name"]],
598
- slots: [
599
- function () { return void 0 !== output.headers["x-amz-lex-slots"]; },
600
- function () {
601
- return new __LazyJsonString(Buffer.from(context.base64Decoder(output.headers["x-amz-lex-slots"])).toString("utf8"));
602
- },
603
- ],
604
- sessionAttributes: [
605
- function () { return void 0 !== output.headers["x-amz-lex-session-attributes"]; },
606
- function () {
607
- return new __LazyJsonString(Buffer.from(context.base64Decoder(output.headers["x-amz-lex-session-attributes"])).toString("utf8"));
608
- },
609
- ],
610
- message: [, output.headers["x-amz-lex-message"]],
611
- encodedMessage: [, output.headers["x-amz-lex-encoded-message"]],
612
- messageFormat: [, output.headers["x-amz-lex-message-format"]],
613
- dialogState: [, output.headers["x-amz-lex-dialog-state"]],
614
- slotToElicit: [, output.headers["x-amz-lex-slot-to-elicit"]],
615
- sessionId: [, output.headers["x-amz-lex-session-id"]],
616
- activeContexts: [
617
- function () { return void 0 !== output.headers["x-amz-lex-active-contexts"]; },
618
- function () {
619
- return new __LazyJsonString(Buffer.from(context.base64Decoder(output.headers["x-amz-lex-active-contexts"])).toString("utf8"));
620
- },
621
- ],
622
- });
623
- data = output.body;
624
- contents.audioStream = data;
625
- return [2, contents];
215
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
216
+ if (data.activeContexts != null) {
217
+ contents.activeContexts = deserializeAws_restJson1ActiveContextsList(data.activeContexts, context);
218
+ }
219
+ if (data.dialogAction != null) {
220
+ contents.dialogAction = deserializeAws_restJson1DialogAction(data.dialogAction, context);
221
+ }
222
+ if (data.recentIntentSummaryView != null) {
223
+ contents.recentIntentSummaryView = deserializeAws_restJson1IntentSummaryList(data.recentIntentSummaryView, context);
224
+ }
225
+ if (data.sessionAttributes != null) {
226
+ contents.sessionAttributes = deserializeAws_restJson1StringMap(data.sessionAttributes, context);
227
+ }
228
+ if (data.sessionId != null) {
229
+ contents.sessionId = __expectString(data.sessionId);
230
+ }
231
+ return contents;
232
+ };
233
+ const deserializeAws_restJson1GetSessionCommandError = async (output, context) => {
234
+ const parsedOutput = {
235
+ ...output,
236
+ body: await parseErrorBody(output.body, context),
237
+ };
238
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
239
+ switch (errorCode) {
240
+ case "BadRequestException":
241
+ case "com.amazonaws.lexruntimeservice#BadRequestException":
242
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
243
+ case "InternalFailureException":
244
+ case "com.amazonaws.lexruntimeservice#InternalFailureException":
245
+ throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
246
+ case "LimitExceededException":
247
+ case "com.amazonaws.lexruntimeservice#LimitExceededException":
248
+ throw await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context);
249
+ case "NotFoundException":
250
+ case "com.amazonaws.lexruntimeservice#NotFoundException":
251
+ throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
252
+ default:
253
+ const parsedBody = parsedOutput.body;
254
+ throwDefaultError({
255
+ output,
256
+ parsedBody,
257
+ exceptionCtor: __BaseException,
258
+ errorCode,
259
+ });
260
+ }
261
+ };
262
+ export const deserializeAws_restJson1PostContentCommand = async (output, context) => {
263
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
264
+ return deserializeAws_restJson1PostContentCommandError(output, context);
265
+ }
266
+ const contents = map({
267
+ $metadata: deserializeMetadata(output),
268
+ contentType: [, output.headers["content-type"]],
269
+ intentName: [, output.headers["x-amz-lex-intent-name"]],
270
+ nluIntentConfidence: [
271
+ () => void 0 !== output.headers["x-amz-lex-nlu-intent-confidence"],
272
+ () => new __LazyJsonString(Buffer.from(context.base64Decoder(output.headers["x-amz-lex-nlu-intent-confidence"])).toString("utf8")),
273
+ ],
274
+ alternativeIntents: [
275
+ () => void 0 !== output.headers["x-amz-lex-alternative-intents"],
276
+ () => new __LazyJsonString(Buffer.from(context.base64Decoder(output.headers["x-amz-lex-alternative-intents"])).toString("utf8")),
277
+ ],
278
+ slots: [
279
+ () => void 0 !== output.headers["x-amz-lex-slots"],
280
+ () => new __LazyJsonString(Buffer.from(context.base64Decoder(output.headers["x-amz-lex-slots"])).toString("utf8")),
281
+ ],
282
+ sessionAttributes: [
283
+ () => void 0 !== output.headers["x-amz-lex-session-attributes"],
284
+ () => new __LazyJsonString(Buffer.from(context.base64Decoder(output.headers["x-amz-lex-session-attributes"])).toString("utf8")),
285
+ ],
286
+ sentimentResponse: [, output.headers["x-amz-lex-sentiment"]],
287
+ message: [, output.headers["x-amz-lex-message"]],
288
+ encodedMessage: [, output.headers["x-amz-lex-encoded-message"]],
289
+ messageFormat: [, output.headers["x-amz-lex-message-format"]],
290
+ dialogState: [, output.headers["x-amz-lex-dialog-state"]],
291
+ slotToElicit: [, output.headers["x-amz-lex-slot-to-elicit"]],
292
+ inputTranscript: [, output.headers["x-amz-lex-input-transcript"]],
293
+ encodedInputTranscript: [, output.headers["x-amz-lex-encoded-input-transcript"]],
294
+ botVersion: [, output.headers["x-amz-lex-bot-version"]],
295
+ sessionId: [, output.headers["x-amz-lex-session-id"]],
296
+ activeContexts: [
297
+ () => void 0 !== output.headers["x-amz-lex-active-contexts"],
298
+ () => new __LazyJsonString(Buffer.from(context.base64Decoder(output.headers["x-amz-lex-active-contexts"])).toString("utf8")),
299
+ ],
300
+ });
301
+ const data = output.body;
302
+ context.sdkStreamMixin(data);
303
+ contents.audioStream = data;
304
+ return contents;
305
+ };
306
+ const deserializeAws_restJson1PostContentCommandError = async (output, context) => {
307
+ const parsedOutput = {
308
+ ...output,
309
+ body: await parseErrorBody(output.body, context),
310
+ };
311
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
312
+ switch (errorCode) {
313
+ case "BadGatewayException":
314
+ case "com.amazonaws.lexruntimeservice#BadGatewayException":
315
+ throw await deserializeAws_restJson1BadGatewayExceptionResponse(parsedOutput, context);
316
+ case "BadRequestException":
317
+ case "com.amazonaws.lexruntimeservice#BadRequestException":
318
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
319
+ case "ConflictException":
320
+ case "com.amazonaws.lexruntimeservice#ConflictException":
321
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
322
+ case "DependencyFailedException":
323
+ case "com.amazonaws.lexruntimeservice#DependencyFailedException":
324
+ throw await deserializeAws_restJson1DependencyFailedExceptionResponse(parsedOutput, context);
325
+ case "InternalFailureException":
326
+ case "com.amazonaws.lexruntimeservice#InternalFailureException":
327
+ throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
328
+ case "LimitExceededException":
329
+ case "com.amazonaws.lexruntimeservice#LimitExceededException":
330
+ throw await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context);
331
+ case "LoopDetectedException":
332
+ case "com.amazonaws.lexruntimeservice#LoopDetectedException":
333
+ throw await deserializeAws_restJson1LoopDetectedExceptionResponse(parsedOutput, context);
334
+ case "NotAcceptableException":
335
+ case "com.amazonaws.lexruntimeservice#NotAcceptableException":
336
+ throw await deserializeAws_restJson1NotAcceptableExceptionResponse(parsedOutput, context);
337
+ case "NotFoundException":
338
+ case "com.amazonaws.lexruntimeservice#NotFoundException":
339
+ throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
340
+ case "RequestTimeoutException":
341
+ case "com.amazonaws.lexruntimeservice#RequestTimeoutException":
342
+ throw await deserializeAws_restJson1RequestTimeoutExceptionResponse(parsedOutput, context);
343
+ case "UnsupportedMediaTypeException":
344
+ case "com.amazonaws.lexruntimeservice#UnsupportedMediaTypeException":
345
+ throw await deserializeAws_restJson1UnsupportedMediaTypeExceptionResponse(parsedOutput, context);
346
+ default:
347
+ const parsedBody = parsedOutput.body;
348
+ throwDefaultError({
349
+ output,
350
+ parsedBody,
351
+ exceptionCtor: __BaseException,
352
+ errorCode,
353
+ });
354
+ }
355
+ };
356
+ export const deserializeAws_restJson1PostTextCommand = async (output, context) => {
357
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
358
+ return deserializeAws_restJson1PostTextCommandError(output, context);
359
+ }
360
+ const contents = map({
361
+ $metadata: deserializeMetadata(output),
626
362
  });
627
- }); };
628
- var deserializeAws_restJson1PutSessionCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
629
- var parsedOutput, _a, errorCode, _b, parsedBody;
630
- var _c;
631
- return __generator(this, function (_d) {
632
- switch (_d.label) {
633
- case 0:
634
- _a = [__assign({}, output)];
635
- _c = {};
636
- return [4, parseErrorBody(output.body, context)];
637
- case 1:
638
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
639
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
640
- _b = errorCode;
641
- switch (_b) {
642
- case "BadGatewayException": return [3, 2];
643
- case "com.amazonaws.lexruntimeservice#BadGatewayException": return [3, 2];
644
- case "BadRequestException": return [3, 4];
645
- case "com.amazonaws.lexruntimeservice#BadRequestException": return [3, 4];
646
- case "ConflictException": return [3, 6];
647
- case "com.amazonaws.lexruntimeservice#ConflictException": return [3, 6];
648
- case "DependencyFailedException": return [3, 8];
649
- case "com.amazonaws.lexruntimeservice#DependencyFailedException": return [3, 8];
650
- case "InternalFailureException": return [3, 10];
651
- case "com.amazonaws.lexruntimeservice#InternalFailureException": return [3, 10];
652
- case "LimitExceededException": return [3, 12];
653
- case "com.amazonaws.lexruntimeservice#LimitExceededException": return [3, 12];
654
- case "NotAcceptableException": return [3, 14];
655
- case "com.amazonaws.lexruntimeservice#NotAcceptableException": return [3, 14];
656
- case "NotFoundException": return [3, 16];
657
- case "com.amazonaws.lexruntimeservice#NotFoundException": return [3, 16];
658
- }
659
- return [3, 18];
660
- case 2: return [4, deserializeAws_restJson1BadGatewayExceptionResponse(parsedOutput, context)];
661
- case 3: throw _d.sent();
662
- case 4: return [4, deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)];
663
- case 5: throw _d.sent();
664
- case 6: return [4, deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)];
665
- case 7: throw _d.sent();
666
- case 8: return [4, deserializeAws_restJson1DependencyFailedExceptionResponse(parsedOutput, context)];
667
- case 9: throw _d.sent();
668
- case 10: return [4, deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)];
669
- case 11: throw _d.sent();
670
- case 12: return [4, deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context)];
671
- case 13: throw _d.sent();
672
- case 14: return [4, deserializeAws_restJson1NotAcceptableExceptionResponse(parsedOutput, context)];
673
- case 15: throw _d.sent();
674
- case 16: return [4, deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)];
675
- case 17: throw _d.sent();
676
- case 18:
677
- parsedBody = parsedOutput.body;
678
- throwDefaultError({
679
- output: output,
680
- parsedBody: parsedBody,
681
- exceptionCtor: __BaseException,
682
- errorCode: errorCode,
683
- });
684
- _d.label = 19;
685
- case 19: return [2];
686
- }
363
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
364
+ if (data.activeContexts != null) {
365
+ contents.activeContexts = deserializeAws_restJson1ActiveContextsList(data.activeContexts, context);
366
+ }
367
+ if (data.alternativeIntents != null) {
368
+ contents.alternativeIntents = deserializeAws_restJson1IntentList(data.alternativeIntents, context);
369
+ }
370
+ if (data.botVersion != null) {
371
+ contents.botVersion = __expectString(data.botVersion);
372
+ }
373
+ if (data.dialogState != null) {
374
+ contents.dialogState = __expectString(data.dialogState);
375
+ }
376
+ if (data.intentName != null) {
377
+ contents.intentName = __expectString(data.intentName);
378
+ }
379
+ if (data.message != null) {
380
+ contents.message = __expectString(data.message);
381
+ }
382
+ if (data.messageFormat != null) {
383
+ contents.messageFormat = __expectString(data.messageFormat);
384
+ }
385
+ if (data.nluIntentConfidence != null) {
386
+ contents.nluIntentConfidence = deserializeAws_restJson1IntentConfidence(data.nluIntentConfidence, context);
387
+ }
388
+ if (data.responseCard != null) {
389
+ contents.responseCard = deserializeAws_restJson1ResponseCard(data.responseCard, context);
390
+ }
391
+ if (data.sentimentResponse != null) {
392
+ contents.sentimentResponse = deserializeAws_restJson1SentimentResponse(data.sentimentResponse, context);
393
+ }
394
+ if (data.sessionAttributes != null) {
395
+ contents.sessionAttributes = deserializeAws_restJson1StringMap(data.sessionAttributes, context);
396
+ }
397
+ if (data.sessionId != null) {
398
+ contents.sessionId = __expectString(data.sessionId);
399
+ }
400
+ if (data.slotToElicit != null) {
401
+ contents.slotToElicit = __expectString(data.slotToElicit);
402
+ }
403
+ if (data.slots != null) {
404
+ contents.slots = deserializeAws_restJson1StringMap(data.slots, context);
405
+ }
406
+ return contents;
407
+ };
408
+ const deserializeAws_restJson1PostTextCommandError = async (output, context) => {
409
+ const parsedOutput = {
410
+ ...output,
411
+ body: await parseErrorBody(output.body, context),
412
+ };
413
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
414
+ switch (errorCode) {
415
+ case "BadGatewayException":
416
+ case "com.amazonaws.lexruntimeservice#BadGatewayException":
417
+ throw await deserializeAws_restJson1BadGatewayExceptionResponse(parsedOutput, context);
418
+ case "BadRequestException":
419
+ case "com.amazonaws.lexruntimeservice#BadRequestException":
420
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
421
+ case "ConflictException":
422
+ case "com.amazonaws.lexruntimeservice#ConflictException":
423
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
424
+ case "DependencyFailedException":
425
+ case "com.amazonaws.lexruntimeservice#DependencyFailedException":
426
+ throw await deserializeAws_restJson1DependencyFailedExceptionResponse(parsedOutput, context);
427
+ case "InternalFailureException":
428
+ case "com.amazonaws.lexruntimeservice#InternalFailureException":
429
+ throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
430
+ case "LimitExceededException":
431
+ case "com.amazonaws.lexruntimeservice#LimitExceededException":
432
+ throw await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context);
433
+ case "LoopDetectedException":
434
+ case "com.amazonaws.lexruntimeservice#LoopDetectedException":
435
+ throw await deserializeAws_restJson1LoopDetectedExceptionResponse(parsedOutput, context);
436
+ case "NotFoundException":
437
+ case "com.amazonaws.lexruntimeservice#NotFoundException":
438
+ throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
439
+ default:
440
+ const parsedBody = parsedOutput.body;
441
+ throwDefaultError({
442
+ output,
443
+ parsedBody,
444
+ exceptionCtor: __BaseException,
445
+ errorCode,
446
+ });
447
+ }
448
+ };
449
+ export const deserializeAws_restJson1PutSessionCommand = async (output, context) => {
450
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
451
+ return deserializeAws_restJson1PutSessionCommandError(output, context);
452
+ }
453
+ const contents = map({
454
+ $metadata: deserializeMetadata(output),
455
+ contentType: [, output.headers["content-type"]],
456
+ intentName: [, output.headers["x-amz-lex-intent-name"]],
457
+ slots: [
458
+ () => void 0 !== output.headers["x-amz-lex-slots"],
459
+ () => new __LazyJsonString(Buffer.from(context.base64Decoder(output.headers["x-amz-lex-slots"])).toString("utf8")),
460
+ ],
461
+ sessionAttributes: [
462
+ () => void 0 !== output.headers["x-amz-lex-session-attributes"],
463
+ () => new __LazyJsonString(Buffer.from(context.base64Decoder(output.headers["x-amz-lex-session-attributes"])).toString("utf8")),
464
+ ],
465
+ message: [, output.headers["x-amz-lex-message"]],
466
+ encodedMessage: [, output.headers["x-amz-lex-encoded-message"]],
467
+ messageFormat: [, output.headers["x-amz-lex-message-format"]],
468
+ dialogState: [, output.headers["x-amz-lex-dialog-state"]],
469
+ slotToElicit: [, output.headers["x-amz-lex-slot-to-elicit"]],
470
+ sessionId: [, output.headers["x-amz-lex-session-id"]],
471
+ activeContexts: [
472
+ () => void 0 !== output.headers["x-amz-lex-active-contexts"],
473
+ () => new __LazyJsonString(Buffer.from(context.base64Decoder(output.headers["x-amz-lex-active-contexts"])).toString("utf8")),
474
+ ],
475
+ });
476
+ const data = output.body;
477
+ context.sdkStreamMixin(data);
478
+ contents.audioStream = data;
479
+ return contents;
480
+ };
481
+ const deserializeAws_restJson1PutSessionCommandError = async (output, context) => {
482
+ const parsedOutput = {
483
+ ...output,
484
+ body: await parseErrorBody(output.body, context),
485
+ };
486
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
487
+ switch (errorCode) {
488
+ case "BadGatewayException":
489
+ case "com.amazonaws.lexruntimeservice#BadGatewayException":
490
+ throw await deserializeAws_restJson1BadGatewayExceptionResponse(parsedOutput, context);
491
+ case "BadRequestException":
492
+ case "com.amazonaws.lexruntimeservice#BadRequestException":
493
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
494
+ case "ConflictException":
495
+ case "com.amazonaws.lexruntimeservice#ConflictException":
496
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
497
+ case "DependencyFailedException":
498
+ case "com.amazonaws.lexruntimeservice#DependencyFailedException":
499
+ throw await deserializeAws_restJson1DependencyFailedExceptionResponse(parsedOutput, context);
500
+ case "InternalFailureException":
501
+ case "com.amazonaws.lexruntimeservice#InternalFailureException":
502
+ throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
503
+ case "LimitExceededException":
504
+ case "com.amazonaws.lexruntimeservice#LimitExceededException":
505
+ throw await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context);
506
+ case "NotAcceptableException":
507
+ case "com.amazonaws.lexruntimeservice#NotAcceptableException":
508
+ throw await deserializeAws_restJson1NotAcceptableExceptionResponse(parsedOutput, context);
509
+ case "NotFoundException":
510
+ case "com.amazonaws.lexruntimeservice#NotFoundException":
511
+ throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
512
+ default:
513
+ const parsedBody = parsedOutput.body;
514
+ throwDefaultError({
515
+ output,
516
+ parsedBody,
517
+ exceptionCtor: __BaseException,
518
+ errorCode,
519
+ });
520
+ }
521
+ };
522
+ const map = __map;
523
+ const deserializeAws_restJson1BadGatewayExceptionResponse = async (parsedOutput, context) => {
524
+ const contents = map({});
525
+ const data = parsedOutput.body;
526
+ if (data.Message != null) {
527
+ contents.Message = __expectString(data.Message);
528
+ }
529
+ const exception = new BadGatewayException({
530
+ $metadata: deserializeMetadata(parsedOutput),
531
+ ...contents,
687
532
  });
688
- }); };
689
- var map = __map;
690
- var deserializeAws_restJson1BadGatewayExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
691
- var contents, data, exception;
692
- return __generator(this, function (_a) {
693
- contents = map({});
694
- data = parsedOutput.body;
695
- if (data.Message != null) {
696
- contents.Message = __expectString(data.Message);
697
- }
698
- exception = new BadGatewayException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
699
- return [2, __decorateServiceException(exception, parsedOutput.body)];
533
+ return __decorateServiceException(exception, parsedOutput.body);
534
+ };
535
+ const deserializeAws_restJson1BadRequestExceptionResponse = async (parsedOutput, context) => {
536
+ const contents = map({});
537
+ const data = parsedOutput.body;
538
+ if (data.message != null) {
539
+ contents.message = __expectString(data.message);
540
+ }
541
+ const exception = new BadRequestException({
542
+ $metadata: deserializeMetadata(parsedOutput),
543
+ ...contents,
700
544
  });
701
- }); };
702
- var deserializeAws_restJson1BadRequestExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
703
- var contents, data, exception;
704
- return __generator(this, function (_a) {
705
- contents = map({});
706
- data = parsedOutput.body;
707
- if (data.message != null) {
708
- contents.message = __expectString(data.message);
709
- }
710
- exception = new BadRequestException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
711
- return [2, __decorateServiceException(exception, parsedOutput.body)];
545
+ return __decorateServiceException(exception, parsedOutput.body);
546
+ };
547
+ const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, context) => {
548
+ const contents = map({});
549
+ const data = parsedOutput.body;
550
+ if (data.message != null) {
551
+ contents.message = __expectString(data.message);
552
+ }
553
+ const exception = new ConflictException({
554
+ $metadata: deserializeMetadata(parsedOutput),
555
+ ...contents,
712
556
  });
713
- }); };
714
- var deserializeAws_restJson1ConflictExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
715
- var contents, data, exception;
716
- return __generator(this, function (_a) {
717
- contents = map({});
718
- data = parsedOutput.body;
719
- if (data.message != null) {
720
- contents.message = __expectString(data.message);
721
- }
722
- exception = new ConflictException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
723
- return [2, __decorateServiceException(exception, parsedOutput.body)];
557
+ return __decorateServiceException(exception, parsedOutput.body);
558
+ };
559
+ const deserializeAws_restJson1DependencyFailedExceptionResponse = async (parsedOutput, context) => {
560
+ const contents = map({});
561
+ const data = parsedOutput.body;
562
+ if (data.Message != null) {
563
+ contents.Message = __expectString(data.Message);
564
+ }
565
+ const exception = new DependencyFailedException({
566
+ $metadata: deserializeMetadata(parsedOutput),
567
+ ...contents,
724
568
  });
725
- }); };
726
- var deserializeAws_restJson1DependencyFailedExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
727
- var contents, data, exception;
728
- return __generator(this, function (_a) {
729
- contents = map({});
730
- data = parsedOutput.body;
731
- if (data.Message != null) {
732
- contents.Message = __expectString(data.Message);
733
- }
734
- exception = new DependencyFailedException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
735
- return [2, __decorateServiceException(exception, parsedOutput.body)];
569
+ return __decorateServiceException(exception, parsedOutput.body);
570
+ };
571
+ const deserializeAws_restJson1InternalFailureExceptionResponse = async (parsedOutput, context) => {
572
+ const contents = map({});
573
+ const data = parsedOutput.body;
574
+ if (data.message != null) {
575
+ contents.message = __expectString(data.message);
576
+ }
577
+ const exception = new InternalFailureException({
578
+ $metadata: deserializeMetadata(parsedOutput),
579
+ ...contents,
736
580
  });
737
- }); };
738
- var deserializeAws_restJson1InternalFailureExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
739
- var contents, data, exception;
740
- return __generator(this, function (_a) {
741
- contents = map({});
742
- data = parsedOutput.body;
743
- if (data.message != null) {
744
- contents.message = __expectString(data.message);
745
- }
746
- exception = new InternalFailureException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
747
- return [2, __decorateServiceException(exception, parsedOutput.body)];
581
+ return __decorateServiceException(exception, parsedOutput.body);
582
+ };
583
+ const deserializeAws_restJson1LimitExceededExceptionResponse = async (parsedOutput, context) => {
584
+ const contents = map({
585
+ retryAfterSeconds: [, parsedOutput.headers["retry-after"]],
748
586
  });
749
- }); };
750
- var deserializeAws_restJson1LimitExceededExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
751
- var contents, data, exception;
752
- return __generator(this, function (_a) {
753
- contents = map({
754
- retryAfterSeconds: [, parsedOutput.headers["retry-after"]],
755
- });
756
- data = parsedOutput.body;
757
- if (data.message != null) {
758
- contents.message = __expectString(data.message);
759
- }
760
- exception = new LimitExceededException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
761
- return [2, __decorateServiceException(exception, parsedOutput.body)];
587
+ const data = parsedOutput.body;
588
+ if (data.message != null) {
589
+ contents.message = __expectString(data.message);
590
+ }
591
+ const exception = new LimitExceededException({
592
+ $metadata: deserializeMetadata(parsedOutput),
593
+ ...contents,
762
594
  });
763
- }); };
764
- var deserializeAws_restJson1LoopDetectedExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
765
- var contents, data, exception;
766
- return __generator(this, function (_a) {
767
- contents = map({});
768
- data = parsedOutput.body;
769
- if (data.Message != null) {
770
- contents.Message = __expectString(data.Message);
771
- }
772
- exception = new LoopDetectedException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
773
- return [2, __decorateServiceException(exception, parsedOutput.body)];
595
+ return __decorateServiceException(exception, parsedOutput.body);
596
+ };
597
+ const deserializeAws_restJson1LoopDetectedExceptionResponse = async (parsedOutput, context) => {
598
+ const contents = map({});
599
+ const data = parsedOutput.body;
600
+ if (data.Message != null) {
601
+ contents.Message = __expectString(data.Message);
602
+ }
603
+ const exception = new LoopDetectedException({
604
+ $metadata: deserializeMetadata(parsedOutput),
605
+ ...contents,
774
606
  });
775
- }); };
776
- var deserializeAws_restJson1NotAcceptableExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
777
- var contents, data, exception;
778
- return __generator(this, function (_a) {
779
- contents = map({});
780
- data = parsedOutput.body;
781
- if (data.message != null) {
782
- contents.message = __expectString(data.message);
783
- }
784
- exception = new NotAcceptableException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
785
- return [2, __decorateServiceException(exception, parsedOutput.body)];
607
+ return __decorateServiceException(exception, parsedOutput.body);
608
+ };
609
+ const deserializeAws_restJson1NotAcceptableExceptionResponse = async (parsedOutput, context) => {
610
+ const contents = map({});
611
+ const data = parsedOutput.body;
612
+ if (data.message != null) {
613
+ contents.message = __expectString(data.message);
614
+ }
615
+ const exception = new NotAcceptableException({
616
+ $metadata: deserializeMetadata(parsedOutput),
617
+ ...contents,
786
618
  });
787
- }); };
788
- var deserializeAws_restJson1NotFoundExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
789
- var contents, data, exception;
790
- return __generator(this, function (_a) {
791
- contents = map({});
792
- data = parsedOutput.body;
793
- if (data.message != null) {
794
- contents.message = __expectString(data.message);
795
- }
796
- exception = new NotFoundException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
797
- return [2, __decorateServiceException(exception, parsedOutput.body)];
619
+ return __decorateServiceException(exception, parsedOutput.body);
620
+ };
621
+ const deserializeAws_restJson1NotFoundExceptionResponse = async (parsedOutput, context) => {
622
+ const contents = map({});
623
+ const data = parsedOutput.body;
624
+ if (data.message != null) {
625
+ contents.message = __expectString(data.message);
626
+ }
627
+ const exception = new NotFoundException({
628
+ $metadata: deserializeMetadata(parsedOutput),
629
+ ...contents,
798
630
  });
799
- }); };
800
- var deserializeAws_restJson1RequestTimeoutExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
801
- var contents, data, exception;
802
- return __generator(this, function (_a) {
803
- contents = map({});
804
- data = parsedOutput.body;
805
- if (data.message != null) {
806
- contents.message = __expectString(data.message);
807
- }
808
- exception = new RequestTimeoutException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
809
- return [2, __decorateServiceException(exception, parsedOutput.body)];
631
+ return __decorateServiceException(exception, parsedOutput.body);
632
+ };
633
+ const deserializeAws_restJson1RequestTimeoutExceptionResponse = async (parsedOutput, context) => {
634
+ const contents = map({});
635
+ const data = parsedOutput.body;
636
+ if (data.message != null) {
637
+ contents.message = __expectString(data.message);
638
+ }
639
+ const exception = new RequestTimeoutException({
640
+ $metadata: deserializeMetadata(parsedOutput),
641
+ ...contents,
810
642
  });
811
- }); };
812
- var deserializeAws_restJson1UnsupportedMediaTypeExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
813
- var contents, data, exception;
814
- return __generator(this, function (_a) {
815
- contents = map({});
816
- data = parsedOutput.body;
817
- if (data.message != null) {
818
- contents.message = __expectString(data.message);
819
- }
820
- exception = new UnsupportedMediaTypeException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
821
- return [2, __decorateServiceException(exception, parsedOutput.body)];
643
+ return __decorateServiceException(exception, parsedOutput.body);
644
+ };
645
+ const deserializeAws_restJson1UnsupportedMediaTypeExceptionResponse = async (parsedOutput, context) => {
646
+ const contents = map({});
647
+ const data = parsedOutput.body;
648
+ if (data.message != null) {
649
+ contents.message = __expectString(data.message);
650
+ }
651
+ const exception = new UnsupportedMediaTypeException({
652
+ $metadata: deserializeMetadata(parsedOutput),
653
+ ...contents,
822
654
  });
823
- }); };
824
- var serializeAws_restJson1ActiveContext = function (input, context) {
825
- return __assign(__assign(__assign({}, (input.name != null && { name: input.name })), (input.parameters != null && {
826
- parameters: serializeAws_restJson1ActiveContextParametersMap(input.parameters, context),
827
- })), (input.timeToLive != null && {
828
- timeToLive: serializeAws_restJson1ActiveContextTimeToLive(input.timeToLive, context),
829
- }));
655
+ return __decorateServiceException(exception, parsedOutput.body);
656
+ };
657
+ const serializeAws_restJson1ActiveContext = (input, context) => {
658
+ return {
659
+ ...(input.name != null && { name: input.name }),
660
+ ...(input.parameters != null && {
661
+ parameters: serializeAws_restJson1ActiveContextParametersMap(input.parameters, context),
662
+ }),
663
+ ...(input.timeToLive != null && {
664
+ timeToLive: serializeAws_restJson1ActiveContextTimeToLive(input.timeToLive, context),
665
+ }),
666
+ };
830
667
  };
831
- var serializeAws_restJson1ActiveContextParametersMap = function (input, context) {
832
- return Object.entries(input).reduce(function (acc, _a) {
833
- var _b;
834
- var _c = __read(_a, 2), key = _c[0], value = _c[1];
668
+ const serializeAws_restJson1ActiveContextParametersMap = (input, context) => {
669
+ return Object.entries(input).reduce((acc, [key, value]) => {
835
670
  if (value === null) {
836
671
  return acc;
837
672
  }
838
- return __assign(__assign({}, acc), (_b = {}, _b[key] = value, _b));
673
+ return {
674
+ ...acc,
675
+ [key]: value,
676
+ };
839
677
  }, {});
840
678
  };
841
- var serializeAws_restJson1ActiveContextsList = function (input, context) {
679
+ const serializeAws_restJson1ActiveContextsList = (input, context) => {
842
680
  return input
843
- .filter(function (e) { return e != null; })
844
- .map(function (entry) {
681
+ .filter((e) => e != null)
682
+ .map((entry) => {
845
683
  return serializeAws_restJson1ActiveContext(entry, context);
846
684
  });
847
685
  };
848
- var serializeAws_restJson1ActiveContextTimeToLive = function (input, context) {
849
- return __assign(__assign({}, (input.timeToLiveInSeconds != null && { timeToLiveInSeconds: input.timeToLiveInSeconds })), (input.turnsToLive != null && { turnsToLive: input.turnsToLive }));
686
+ const serializeAws_restJson1ActiveContextTimeToLive = (input, context) => {
687
+ return {
688
+ ...(input.timeToLiveInSeconds != null && { timeToLiveInSeconds: input.timeToLiveInSeconds }),
689
+ ...(input.turnsToLive != null && { turnsToLive: input.turnsToLive }),
690
+ };
850
691
  };
851
- var serializeAws_restJson1DialogAction = function (input, context) {
852
- return __assign(__assign(__assign(__assign(__assign(__assign(__assign({}, (input.fulfillmentState != null && { fulfillmentState: input.fulfillmentState })), (input.intentName != null && { intentName: input.intentName })), (input.message != null && { message: input.message })), (input.messageFormat != null && { messageFormat: input.messageFormat })), (input.slotToElicit != null && { slotToElicit: input.slotToElicit })), (input.slots != null && { slots: serializeAws_restJson1StringMap(input.slots, context) })), (input.type != null && { type: input.type }));
692
+ const serializeAws_restJson1DialogAction = (input, context) => {
693
+ return {
694
+ ...(input.fulfillmentState != null && { fulfillmentState: input.fulfillmentState }),
695
+ ...(input.intentName != null && { intentName: input.intentName }),
696
+ ...(input.message != null && { message: input.message }),
697
+ ...(input.messageFormat != null && { messageFormat: input.messageFormat }),
698
+ ...(input.slotToElicit != null && { slotToElicit: input.slotToElicit }),
699
+ ...(input.slots != null && { slots: serializeAws_restJson1StringMap(input.slots, context) }),
700
+ ...(input.type != null && { type: input.type }),
701
+ };
853
702
  };
854
- var serializeAws_restJson1IntentSummary = function (input, context) {
855
- return __assign(__assign(__assign(__assign(__assign(__assign(__assign({}, (input.checkpointLabel != null && { checkpointLabel: input.checkpointLabel })), (input.confirmationStatus != null && { confirmationStatus: input.confirmationStatus })), (input.dialogActionType != null && { dialogActionType: input.dialogActionType })), (input.fulfillmentState != null && { fulfillmentState: input.fulfillmentState })), (input.intentName != null && { intentName: input.intentName })), (input.slotToElicit != null && { slotToElicit: input.slotToElicit })), (input.slots != null && { slots: serializeAws_restJson1StringMap(input.slots, context) }));
703
+ const serializeAws_restJson1IntentSummary = (input, context) => {
704
+ return {
705
+ ...(input.checkpointLabel != null && { checkpointLabel: input.checkpointLabel }),
706
+ ...(input.confirmationStatus != null && { confirmationStatus: input.confirmationStatus }),
707
+ ...(input.dialogActionType != null && { dialogActionType: input.dialogActionType }),
708
+ ...(input.fulfillmentState != null && { fulfillmentState: input.fulfillmentState }),
709
+ ...(input.intentName != null && { intentName: input.intentName }),
710
+ ...(input.slotToElicit != null && { slotToElicit: input.slotToElicit }),
711
+ ...(input.slots != null && { slots: serializeAws_restJson1StringMap(input.slots, context) }),
712
+ };
856
713
  };
857
- var serializeAws_restJson1IntentSummaryList = function (input, context) {
714
+ const serializeAws_restJson1IntentSummaryList = (input, context) => {
858
715
  return input
859
- .filter(function (e) { return e != null; })
860
- .map(function (entry) {
716
+ .filter((e) => e != null)
717
+ .map((entry) => {
861
718
  return serializeAws_restJson1IntentSummary(entry, context);
862
719
  });
863
720
  };
864
- var serializeAws_restJson1StringMap = function (input, context) {
865
- return Object.entries(input).reduce(function (acc, _a) {
866
- var _b;
867
- var _c = __read(_a, 2), key = _c[0], value = _c[1];
721
+ const serializeAws_restJson1StringMap = (input, context) => {
722
+ return Object.entries(input).reduce((acc, [key, value]) => {
868
723
  if (value === null) {
869
724
  return acc;
870
725
  }
871
- return __assign(__assign({}, acc), (_b = {}, _b[key] = value, _b));
726
+ return {
727
+ ...acc,
728
+ [key]: value,
729
+ };
872
730
  }, {});
873
731
  };
874
- var deserializeAws_restJson1ActiveContext = function (output, context) {
732
+ const deserializeAws_restJson1ActiveContext = (output, context) => {
875
733
  return {
876
734
  name: __expectString(output.name),
877
735
  parameters: output.parameters != null
@@ -882,20 +740,21 @@ var deserializeAws_restJson1ActiveContext = function (output, context) {
882
740
  : undefined,
883
741
  };
884
742
  };
885
- var deserializeAws_restJson1ActiveContextParametersMap = function (output, context) {
886
- return Object.entries(output).reduce(function (acc, _a) {
887
- var _b;
888
- var _c = __read(_a, 2), key = _c[0], value = _c[1];
743
+ const deserializeAws_restJson1ActiveContextParametersMap = (output, context) => {
744
+ return Object.entries(output).reduce((acc, [key, value]) => {
889
745
  if (value === null) {
890
746
  return acc;
891
747
  }
892
- return __assign(__assign({}, acc), (_b = {}, _b[key] = __expectString(value), _b));
748
+ return {
749
+ ...acc,
750
+ [key]: __expectString(value),
751
+ };
893
752
  }, {});
894
753
  };
895
- var deserializeAws_restJson1ActiveContextsList = function (output, context) {
896
- var retVal = (output || [])
897
- .filter(function (e) { return e != null; })
898
- .map(function (entry) {
754
+ const deserializeAws_restJson1ActiveContextsList = (output, context) => {
755
+ const retVal = (output || [])
756
+ .filter((e) => e != null)
757
+ .map((entry) => {
899
758
  if (entry === null) {
900
759
  return null;
901
760
  }
@@ -903,19 +762,19 @@ var deserializeAws_restJson1ActiveContextsList = function (output, context) {
903
762
  });
904
763
  return retVal;
905
764
  };
906
- var deserializeAws_restJson1ActiveContextTimeToLive = function (output, context) {
765
+ const deserializeAws_restJson1ActiveContextTimeToLive = (output, context) => {
907
766
  return {
908
767
  timeToLiveInSeconds: __expectInt32(output.timeToLiveInSeconds),
909
768
  turnsToLive: __expectInt32(output.turnsToLive),
910
769
  };
911
770
  };
912
- var deserializeAws_restJson1Button = function (output, context) {
771
+ const deserializeAws_restJson1Button = (output, context) => {
913
772
  return {
914
773
  text: __expectString(output.text),
915
774
  value: __expectString(output.value),
916
775
  };
917
776
  };
918
- var deserializeAws_restJson1DialogAction = function (output, context) {
777
+ const deserializeAws_restJson1DialogAction = (output, context) => {
919
778
  return {
920
779
  fulfillmentState: __expectString(output.fulfillmentState),
921
780
  intentName: __expectString(output.intentName),
@@ -926,7 +785,7 @@ var deserializeAws_restJson1DialogAction = function (output, context) {
926
785
  type: __expectString(output.type),
927
786
  };
928
787
  };
929
- var deserializeAws_restJson1GenericAttachment = function (output, context) {
788
+ const deserializeAws_restJson1GenericAttachment = (output, context) => {
930
789
  return {
931
790
  attachmentLinkUrl: __expectString(output.attachmentLinkUrl),
932
791
  buttons: output.buttons != null ? deserializeAws_restJson1listOfButtons(output.buttons, context) : undefined,
@@ -935,10 +794,10 @@ var deserializeAws_restJson1GenericAttachment = function (output, context) {
935
794
  title: __expectString(output.title),
936
795
  };
937
796
  };
938
- var deserializeAws_restJson1genericAttachmentList = function (output, context) {
939
- var retVal = (output || [])
940
- .filter(function (e) { return e != null; })
941
- .map(function (entry) {
797
+ const deserializeAws_restJson1genericAttachmentList = (output, context) => {
798
+ const retVal = (output || [])
799
+ .filter((e) => e != null)
800
+ .map((entry) => {
942
801
  if (entry === null) {
943
802
  return null;
944
803
  }
@@ -946,15 +805,15 @@ var deserializeAws_restJson1genericAttachmentList = function (output, context) {
946
805
  });
947
806
  return retVal;
948
807
  };
949
- var deserializeAws_restJson1IntentConfidence = function (output, context) {
808
+ const deserializeAws_restJson1IntentConfidence = (output, context) => {
950
809
  return {
951
810
  score: __limitedParseDouble(output.score),
952
811
  };
953
812
  };
954
- var deserializeAws_restJson1IntentList = function (output, context) {
955
- var retVal = (output || [])
956
- .filter(function (e) { return e != null; })
957
- .map(function (entry) {
813
+ const deserializeAws_restJson1IntentList = (output, context) => {
814
+ const retVal = (output || [])
815
+ .filter((e) => e != null)
816
+ .map((entry) => {
958
817
  if (entry === null) {
959
818
  return null;
960
819
  }
@@ -962,7 +821,7 @@ var deserializeAws_restJson1IntentList = function (output, context) {
962
821
  });
963
822
  return retVal;
964
823
  };
965
- var deserializeAws_restJson1IntentSummary = function (output, context) {
824
+ const deserializeAws_restJson1IntentSummary = (output, context) => {
966
825
  return {
967
826
  checkpointLabel: __expectString(output.checkpointLabel),
968
827
  confirmationStatus: __expectString(output.confirmationStatus),
@@ -973,10 +832,10 @@ var deserializeAws_restJson1IntentSummary = function (output, context) {
973
832
  slots: output.slots != null ? deserializeAws_restJson1StringMap(output.slots, context) : undefined,
974
833
  };
975
834
  };
976
- var deserializeAws_restJson1IntentSummaryList = function (output, context) {
977
- var retVal = (output || [])
978
- .filter(function (e) { return e != null; })
979
- .map(function (entry) {
835
+ const deserializeAws_restJson1IntentSummaryList = (output, context) => {
836
+ const retVal = (output || [])
837
+ .filter((e) => e != null)
838
+ .map((entry) => {
980
839
  if (entry === null) {
981
840
  return null;
982
841
  }
@@ -984,10 +843,10 @@ var deserializeAws_restJson1IntentSummaryList = function (output, context) {
984
843
  });
985
844
  return retVal;
986
845
  };
987
- var deserializeAws_restJson1listOfButtons = function (output, context) {
988
- var retVal = (output || [])
989
- .filter(function (e) { return e != null; })
990
- .map(function (entry) {
846
+ const deserializeAws_restJson1listOfButtons = (output, context) => {
847
+ const retVal = (output || [])
848
+ .filter((e) => e != null)
849
+ .map((entry) => {
991
850
  if (entry === null) {
992
851
  return null;
993
852
  }
@@ -995,7 +854,7 @@ var deserializeAws_restJson1listOfButtons = function (output, context) {
995
854
  });
996
855
  return retVal;
997
856
  };
998
- var deserializeAws_restJson1PredictedIntent = function (output, context) {
857
+ const deserializeAws_restJson1PredictedIntent = (output, context) => {
999
858
  return {
1000
859
  intentName: __expectString(output.intentName),
1001
860
  nluIntentConfidence: output.nluIntentConfidence != null
@@ -1004,7 +863,7 @@ var deserializeAws_restJson1PredictedIntent = function (output, context) {
1004
863
  slots: output.slots != null ? deserializeAws_restJson1StringMap(output.slots, context) : undefined,
1005
864
  };
1006
865
  };
1007
- var deserializeAws_restJson1ResponseCard = function (output, context) {
866
+ const deserializeAws_restJson1ResponseCard = (output, context) => {
1008
867
  return {
1009
868
  contentType: __expectString(output.contentType),
1010
869
  genericAttachments: output.genericAttachments != null
@@ -1013,73 +872,56 @@ var deserializeAws_restJson1ResponseCard = function (output, context) {
1013
872
  version: __expectString(output.version),
1014
873
  };
1015
874
  };
1016
- var deserializeAws_restJson1SentimentResponse = function (output, context) {
875
+ const deserializeAws_restJson1SentimentResponse = (output, context) => {
1017
876
  return {
1018
877
  sentimentLabel: __expectString(output.sentimentLabel),
1019
878
  sentimentScore: __expectString(output.sentimentScore),
1020
879
  };
1021
880
  };
1022
- var deserializeAws_restJson1StringMap = function (output, context) {
1023
- return Object.entries(output).reduce(function (acc, _a) {
1024
- var _b;
1025
- var _c = __read(_a, 2), key = _c[0], value = _c[1];
881
+ const deserializeAws_restJson1StringMap = (output, context) => {
882
+ return Object.entries(output).reduce((acc, [key, value]) => {
1026
883
  if (value === null) {
1027
884
  return acc;
1028
885
  }
1029
- return __assign(__assign({}, acc), (_b = {}, _b[key] = __expectString(value), _b));
886
+ return {
887
+ ...acc,
888
+ [key]: __expectString(value),
889
+ };
1030
890
  }, {});
1031
891
  };
1032
- var deserializeMetadata = function (output) {
1033
- var _a, _b;
1034
- return ({
1035
- httpStatusCode: output.statusCode,
1036
- requestId: (_b = (_a = output.headers["x-amzn-requestid"]) !== null && _a !== void 0 ? _a : output.headers["x-amzn-request-id"]) !== null && _b !== void 0 ? _b : output.headers["x-amz-request-id"],
1037
- extendedRequestId: output.headers["x-amz-id-2"],
1038
- cfId: output.headers["x-amz-cf-id"],
1039
- });
1040
- };
1041
- var collectBody = function (streamBody, context) {
1042
- if (streamBody === void 0) { streamBody = new Uint8Array(); }
892
+ const deserializeMetadata = (output) => ({
893
+ httpStatusCode: output.statusCode,
894
+ requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
895
+ extendedRequestId: output.headers["x-amz-id-2"],
896
+ cfId: output.headers["x-amz-cf-id"],
897
+ });
898
+ const collectBody = (streamBody = new Uint8Array(), context) => {
1043
899
  if (streamBody instanceof Uint8Array) {
1044
900
  return Promise.resolve(streamBody);
1045
901
  }
1046
902
  return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
1047
903
  };
1048
- var collectBodyString = function (streamBody, context) {
1049
- return collectBody(streamBody, context).then(function (body) { return context.utf8Encoder(body); });
1050
- };
1051
- var isSerializableHeaderValue = function (value) {
1052
- return value !== undefined &&
1053
- value !== null &&
1054
- value !== "" &&
1055
- (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
1056
- (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
1057
- };
1058
- var parseBody = function (streamBody, context) {
1059
- return collectBodyString(streamBody, context).then(function (encoded) {
1060
- if (encoded.length) {
1061
- return JSON.parse(encoded);
1062
- }
1063
- return {};
1064
- });
904
+ const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
905
+ const isSerializableHeaderValue = (value) => value !== undefined &&
906
+ value !== null &&
907
+ value !== "" &&
908
+ (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
909
+ (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
910
+ const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
911
+ if (encoded.length) {
912
+ return JSON.parse(encoded);
913
+ }
914
+ return {};
915
+ });
916
+ const parseErrorBody = async (errorBody, context) => {
917
+ const value = await parseBody(errorBody, context);
918
+ value.message = value.message ?? value.Message;
919
+ return value;
1065
920
  };
1066
- var parseErrorBody = function (errorBody, context) { return __awaiter(void 0, void 0, void 0, function () {
1067
- var value;
1068
- var _a;
1069
- return __generator(this, function (_b) {
1070
- switch (_b.label) {
1071
- case 0: return [4, parseBody(errorBody, context)];
1072
- case 1:
1073
- value = _b.sent();
1074
- value.message = (_a = value.message) !== null && _a !== void 0 ? _a : value.Message;
1075
- return [2, value];
1076
- }
1077
- });
1078
- }); };
1079
- var loadRestJsonErrorCode = function (output, data) {
1080
- var findKey = function (object, key) { return Object.keys(object).find(function (k) { return k.toLowerCase() === key.toLowerCase(); }); };
1081
- var sanitizeErrorCode = function (rawValue) {
1082
- var cleanValue = rawValue;
921
+ const loadRestJsonErrorCode = (output, data) => {
922
+ const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
923
+ const sanitizeErrorCode = (rawValue) => {
924
+ let cleanValue = rawValue;
1083
925
  if (typeof cleanValue === "number") {
1084
926
  cleanValue = cleanValue.toString();
1085
927
  }
@@ -1094,7 +936,7 @@ var loadRestJsonErrorCode = function (output, data) {
1094
936
  }
1095
937
  return cleanValue;
1096
938
  };
1097
- var headerKey = findKey(output.headers, "x-amzn-errortype");
939
+ const headerKey = findKey(output.headers, "x-amzn-errortype");
1098
940
  if (headerKey !== undefined) {
1099
941
  return sanitizeErrorCode(output.headers[headerKey]);
1100
942
  }