@aws-sdk/client-lex-runtime-v2 3.181.0 → 3.183.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,1335 +1,1110 @@
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, limitedParseDouble as __limitedParseDouble, map as __map, resolvedPath as __resolvedPath, throwDefaultError, } from "@aws-sdk/smithy-client";
4
3
  import { LexRuntimeV2ServiceException as __BaseException } from "../models/LexRuntimeV2ServiceException";
5
4
  import { AccessDeniedException, BadGatewayException, ConflictException, DependencyFailedException, InternalServerException, ResourceNotFoundException, StartConversationRequestEventStream, ThrottlingException, ValidationException, } 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
- "/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}";
16
- resolvedPath = __resolvedPath(resolvedPath, input, "botId", function () { return input.botId; }, "{botId}", false);
17
- resolvedPath = __resolvedPath(resolvedPath, input, "botAliasId", function () { return input.botAliasId; }, "{botAliasId}", false);
18
- resolvedPath = __resolvedPath(resolvedPath, input, "localeId", function () { return input.localeId; }, "{localeId}", false);
19
- resolvedPath = __resolvedPath(resolvedPath, input, "sessionId", function () { return input.sessionId; }, "{sessionId}", false);
20
- return [2, new __HttpRequest({
21
- protocol: protocol,
22
- hostname: hostname,
23
- port: port,
24
- method: "DELETE",
25
- headers: headers,
26
- path: resolvedPath,
27
- body: body,
28
- })];
29
- }
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
+ "/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}";
10
+ resolvedPath = __resolvedPath(resolvedPath, input, "botId", () => input.botId, "{botId}", false);
11
+ resolvedPath = __resolvedPath(resolvedPath, input, "botAliasId", () => input.botAliasId, "{botAliasId}", false);
12
+ resolvedPath = __resolvedPath(resolvedPath, input, "localeId", () => input.localeId, "{localeId}", false);
13
+ resolvedPath = __resolvedPath(resolvedPath, input, "sessionId", () => input.sessionId, "{sessionId}", false);
14
+ let body;
15
+ return new __HttpRequest({
16
+ protocol,
17
+ hostname,
18
+ port,
19
+ method: "DELETE",
20
+ headers,
21
+ path: resolvedPath,
22
+ body,
30
23
  });
31
- }); };
32
- export var serializeAws_restJson1GetSessionCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
33
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
34
- return __generator(this, function (_c) {
35
- switch (_c.label) {
36
- case 0: return [4, context.endpoint()];
37
- case 1:
38
- _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
39
- headers = {};
40
- resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") +
41
- "/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}";
42
- resolvedPath = __resolvedPath(resolvedPath, input, "botId", function () { return input.botId; }, "{botId}", false);
43
- resolvedPath = __resolvedPath(resolvedPath, input, "botAliasId", function () { return input.botAliasId; }, "{botAliasId}", false);
44
- resolvedPath = __resolvedPath(resolvedPath, input, "localeId", function () { return input.localeId; }, "{localeId}", false);
45
- resolvedPath = __resolvedPath(resolvedPath, input, "sessionId", function () { return input.sessionId; }, "{sessionId}", false);
46
- return [2, new __HttpRequest({
47
- protocol: protocol,
48
- hostname: hostname,
49
- port: port,
50
- method: "GET",
51
- headers: headers,
52
- path: resolvedPath,
53
- body: body,
54
- })];
55
- }
24
+ };
25
+ export const serializeAws_restJson1GetSessionCommand = async (input, context) => {
26
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
27
+ const headers = {};
28
+ let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
29
+ "/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}";
30
+ resolvedPath = __resolvedPath(resolvedPath, input, "botId", () => input.botId, "{botId}", false);
31
+ resolvedPath = __resolvedPath(resolvedPath, input, "botAliasId", () => input.botAliasId, "{botAliasId}", false);
32
+ resolvedPath = __resolvedPath(resolvedPath, input, "localeId", () => input.localeId, "{localeId}", false);
33
+ resolvedPath = __resolvedPath(resolvedPath, input, "sessionId", () => input.sessionId, "{sessionId}", false);
34
+ let body;
35
+ return new __HttpRequest({
36
+ protocol,
37
+ hostname,
38
+ port,
39
+ method: "GET",
40
+ headers,
41
+ path: resolvedPath,
42
+ body,
56
43
  });
57
- }); };
58
- export var serializeAws_restJson1PutSessionCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
59
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
60
- return __generator(this, function (_c) {
61
- switch (_c.label) {
62
- case 0: return [4, context.endpoint()];
63
- case 1:
64
- _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
65
- headers = map({}, isSerializableHeaderValue, {
66
- "content-type": "application/json",
67
- responsecontenttype: input.responseContentType,
68
- });
69
- resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") +
70
- "/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}";
71
- resolvedPath = __resolvedPath(resolvedPath, input, "botId", function () { return input.botId; }, "{botId}", false);
72
- resolvedPath = __resolvedPath(resolvedPath, input, "botAliasId", function () { return input.botAliasId; }, "{botAliasId}", false);
73
- resolvedPath = __resolvedPath(resolvedPath, input, "localeId", function () { return input.localeId; }, "{localeId}", false);
74
- resolvedPath = __resolvedPath(resolvedPath, input, "sessionId", function () { return input.sessionId; }, "{sessionId}", false);
75
- body = JSON.stringify(__assign(__assign(__assign({}, (input.messages != null && { messages: serializeAws_restJson1Messages(input.messages, context) })), (input.requestAttributes != null && {
76
- requestAttributes: serializeAws_restJson1StringMap(input.requestAttributes, context),
77
- })), (input.sessionState != null && {
78
- sessionState: serializeAws_restJson1SessionState(input.sessionState, context),
79
- })));
80
- return [2, new __HttpRequest({
81
- protocol: protocol,
82
- hostname: hostname,
83
- port: port,
84
- method: "POST",
85
- headers: headers,
86
- path: resolvedPath,
87
- body: body,
88
- })];
89
- }
44
+ };
45
+ export const serializeAws_restJson1PutSessionCommand = async (input, context) => {
46
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
47
+ const headers = map({}, isSerializableHeaderValue, {
48
+ "content-type": "application/json",
49
+ responsecontenttype: input.responseContentType,
90
50
  });
91
- }); };
92
- export var serializeAws_restJson1RecognizeTextCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
93
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
94
- return __generator(this, function (_c) {
95
- switch (_c.label) {
96
- case 0: return [4, context.endpoint()];
97
- case 1:
98
- _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
99
- headers = {
100
- "content-type": "application/json",
101
- };
102
- resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") +
103
- "/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}/text";
104
- resolvedPath = __resolvedPath(resolvedPath, input, "botId", function () { return input.botId; }, "{botId}", false);
105
- resolvedPath = __resolvedPath(resolvedPath, input, "botAliasId", function () { return input.botAliasId; }, "{botAliasId}", false);
106
- resolvedPath = __resolvedPath(resolvedPath, input, "localeId", function () { return input.localeId; }, "{localeId}", false);
107
- resolvedPath = __resolvedPath(resolvedPath, input, "sessionId", function () { return input.sessionId; }, "{sessionId}", false);
108
- body = JSON.stringify(__assign(__assign(__assign({}, (input.requestAttributes != null && {
109
- requestAttributes: serializeAws_restJson1StringMap(input.requestAttributes, context),
110
- })), (input.sessionState != null && {
111
- sessionState: serializeAws_restJson1SessionState(input.sessionState, context),
112
- })), (input.text != null && { text: input.text })));
113
- return [2, new __HttpRequest({
114
- protocol: protocol,
115
- hostname: hostname,
116
- port: port,
117
- method: "POST",
118
- headers: headers,
119
- path: resolvedPath,
120
- body: body,
121
- })];
122
- }
51
+ let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
52
+ "/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}";
53
+ resolvedPath = __resolvedPath(resolvedPath, input, "botId", () => input.botId, "{botId}", false);
54
+ resolvedPath = __resolvedPath(resolvedPath, input, "botAliasId", () => input.botAliasId, "{botAliasId}", false);
55
+ resolvedPath = __resolvedPath(resolvedPath, input, "localeId", () => input.localeId, "{localeId}", false);
56
+ resolvedPath = __resolvedPath(resolvedPath, input, "sessionId", () => input.sessionId, "{sessionId}", false);
57
+ let body;
58
+ body = JSON.stringify({
59
+ ...(input.messages != null && { messages: serializeAws_restJson1Messages(input.messages, context) }),
60
+ ...(input.requestAttributes != null && {
61
+ requestAttributes: serializeAws_restJson1StringMap(input.requestAttributes, context),
62
+ }),
63
+ ...(input.sessionState != null && {
64
+ sessionState: serializeAws_restJson1SessionState(input.sessionState, context),
65
+ }),
123
66
  });
124
- }); };
125
- export var serializeAws_restJson1RecognizeUtteranceCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
126
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
127
- return __generator(this, function (_c) {
128
- switch (_c.label) {
129
- case 0: return [4, context.endpoint()];
130
- case 1:
131
- _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
132
- headers = map({}, isSerializableHeaderValue, {
133
- "x-amz-content-sha256": "UNSIGNED-PAYLOAD",
134
- "content-type": input.requestContentType || "application/octet-stream",
135
- "x-amz-lex-session-state": input.sessionState,
136
- "x-amz-lex-request-attributes": input.requestAttributes,
137
- "response-content-type": input.responseContentType,
138
- });
139
- resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") +
140
- "/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}/utterance";
141
- resolvedPath = __resolvedPath(resolvedPath, input, "botId", function () { return input.botId; }, "{botId}", false);
142
- resolvedPath = __resolvedPath(resolvedPath, input, "botAliasId", function () { return input.botAliasId; }, "{botAliasId}", false);
143
- resolvedPath = __resolvedPath(resolvedPath, input, "localeId", function () { return input.localeId; }, "{localeId}", false);
144
- resolvedPath = __resolvedPath(resolvedPath, input, "sessionId", function () { return input.sessionId; }, "{sessionId}", false);
145
- if (input.inputStream !== undefined) {
146
- body = input.inputStream;
147
- }
148
- return [2, new __HttpRequest({
149
- protocol: protocol,
150
- hostname: hostname,
151
- port: port,
152
- method: "POST",
153
- headers: headers,
154
- path: resolvedPath,
155
- body: body,
156
- })];
157
- }
67
+ return new __HttpRequest({
68
+ protocol,
69
+ hostname,
70
+ port,
71
+ method: "POST",
72
+ headers,
73
+ path: resolvedPath,
74
+ body,
158
75
  });
159
- }); };
160
- export var serializeAws_restJson1StartConversationCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
161
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
162
- return __generator(this, function (_c) {
163
- switch (_c.label) {
164
- case 0: return [4, context.endpoint()];
165
- case 1:
166
- _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
167
- headers = map({}, isSerializableHeaderValue, {
168
- "x-amz-lex-conversation-mode": input.conversationMode,
169
- });
170
- resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") +
171
- "/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}/conversation";
172
- resolvedPath = __resolvedPath(resolvedPath, input, "botId", function () { return input.botId; }, "{botId}", false);
173
- resolvedPath = __resolvedPath(resolvedPath, input, "botAliasId", function () { return input.botAliasId; }, "{botAliasId}", false);
174
- resolvedPath = __resolvedPath(resolvedPath, input, "localeId", function () { return input.localeId; }, "{localeId}", false);
175
- resolvedPath = __resolvedPath(resolvedPath, input, "sessionId", function () { return input.sessionId; }, "{sessionId}", false);
176
- if (input.requestEventStream !== undefined) {
177
- body = serializeAws_restJson1StartConversationRequestEventStream(input.requestEventStream, context);
178
- }
179
- return [2, new __HttpRequest({
180
- protocol: protocol,
181
- hostname: hostname,
182
- port: port,
183
- method: "POST",
184
- headers: headers,
185
- path: resolvedPath,
186
- body: body,
187
- })];
188
- }
76
+ };
77
+ export const serializeAws_restJson1RecognizeTextCommand = async (input, context) => {
78
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
79
+ const headers = {
80
+ "content-type": "application/json",
81
+ };
82
+ let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
83
+ "/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}/text";
84
+ resolvedPath = __resolvedPath(resolvedPath, input, "botId", () => input.botId, "{botId}", false);
85
+ resolvedPath = __resolvedPath(resolvedPath, input, "botAliasId", () => input.botAliasId, "{botAliasId}", false);
86
+ resolvedPath = __resolvedPath(resolvedPath, input, "localeId", () => input.localeId, "{localeId}", false);
87
+ resolvedPath = __resolvedPath(resolvedPath, input, "sessionId", () => input.sessionId, "{sessionId}", false);
88
+ let body;
89
+ body = JSON.stringify({
90
+ ...(input.requestAttributes != null && {
91
+ requestAttributes: serializeAws_restJson1StringMap(input.requestAttributes, context),
92
+ }),
93
+ ...(input.sessionState != null && {
94
+ sessionState: serializeAws_restJson1SessionState(input.sessionState, context),
95
+ }),
96
+ ...(input.text != null && { text: input.text }),
189
97
  });
190
- }); };
191
- export var deserializeAws_restJson1DeleteSessionCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
192
- var contents, data, _a, _b;
193
- return __generator(this, function (_c) {
194
- switch (_c.label) {
195
- case 0:
196
- if (output.statusCode !== 200 && output.statusCode >= 300) {
197
- return [2, deserializeAws_restJson1DeleteSessionCommandError(output, context)];
198
- }
199
- contents = map({
200
- $metadata: deserializeMetadata(output),
201
- });
202
- _a = __expectNonNull;
203
- _b = __expectObject;
204
- return [4, parseBody(output.body, context)];
205
- case 1:
206
- data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
207
- if (data.botAliasId != null) {
208
- contents.botAliasId = __expectString(data.botAliasId);
209
- }
210
- if (data.botId != null) {
211
- contents.botId = __expectString(data.botId);
212
- }
213
- if (data.localeId != null) {
214
- contents.localeId = __expectString(data.localeId);
215
- }
216
- if (data.sessionId != null) {
217
- contents.sessionId = __expectString(data.sessionId);
218
- }
219
- return [2, contents];
220
- }
98
+ return new __HttpRequest({
99
+ protocol,
100
+ hostname,
101
+ port,
102
+ method: "POST",
103
+ headers,
104
+ path: resolvedPath,
105
+ body,
221
106
  });
222
- }); };
223
- var deserializeAws_restJson1DeleteSessionCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
224
- var parsedOutput, _a, errorCode, _b, parsedBody;
225
- var _c;
226
- return __generator(this, function (_d) {
227
- switch (_d.label) {
228
- case 0:
229
- _a = [__assign({}, output)];
230
- _c = {};
231
- return [4, parseErrorBody(output.body, context)];
232
- case 1:
233
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
234
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
235
- _b = errorCode;
236
- switch (_b) {
237
- case "AccessDeniedException": return [3, 2];
238
- case "com.amazonaws.lexruntimev2#AccessDeniedException": return [3, 2];
239
- case "ConflictException": return [3, 4];
240
- case "com.amazonaws.lexruntimev2#ConflictException": return [3, 4];
241
- case "InternalServerException": return [3, 6];
242
- case "com.amazonaws.lexruntimev2#InternalServerException": return [3, 6];
243
- case "ResourceNotFoundException": return [3, 8];
244
- case "com.amazonaws.lexruntimev2#ResourceNotFoundException": return [3, 8];
245
- case "ThrottlingException": return [3, 10];
246
- case "com.amazonaws.lexruntimev2#ThrottlingException": return [3, 10];
247
- case "ValidationException": return [3, 12];
248
- case "com.amazonaws.lexruntimev2#ValidationException": return [3, 12];
249
- }
250
- return [3, 14];
251
- case 2: return [4, deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)];
252
- case 3: throw _d.sent();
253
- case 4: return [4, deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)];
254
- case 5: throw _d.sent();
255
- case 6: return [4, deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)];
256
- case 7: throw _d.sent();
257
- case 8: return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
258
- case 9: throw _d.sent();
259
- case 10: return [4, deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)];
260
- case 11: throw _d.sent();
261
- case 12: return [4, deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)];
262
- case 13: throw _d.sent();
263
- case 14:
264
- parsedBody = parsedOutput.body;
265
- throwDefaultError({
266
- output: output,
267
- parsedBody: parsedBody,
268
- exceptionCtor: __BaseException,
269
- errorCode: errorCode,
270
- });
271
- _d.label = 15;
272
- case 15: return [2];
273
- }
107
+ };
108
+ export const serializeAws_restJson1RecognizeUtteranceCommand = async (input, context) => {
109
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
110
+ const headers = map({}, isSerializableHeaderValue, {
111
+ "x-amz-content-sha256": "UNSIGNED-PAYLOAD",
112
+ "content-type": input.requestContentType || "application/octet-stream",
113
+ "x-amz-lex-session-state": input.sessionState,
114
+ "x-amz-lex-request-attributes": input.requestAttributes,
115
+ "response-content-type": input.responseContentType,
274
116
  });
275
- }); };
276
- export var deserializeAws_restJson1GetSessionCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
277
- var contents, data, _a, _b;
278
- return __generator(this, function (_c) {
279
- switch (_c.label) {
280
- case 0:
281
- if (output.statusCode !== 200 && output.statusCode >= 300) {
282
- return [2, deserializeAws_restJson1GetSessionCommandError(output, context)];
283
- }
284
- contents = map({
285
- $metadata: deserializeMetadata(output),
286
- });
287
- _a = __expectNonNull;
288
- _b = __expectObject;
289
- return [4, parseBody(output.body, context)];
290
- case 1:
291
- data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
292
- if (data.interpretations != null) {
293
- contents.interpretations = deserializeAws_restJson1Interpretations(data.interpretations, context);
294
- }
295
- if (data.messages != null) {
296
- contents.messages = deserializeAws_restJson1Messages(data.messages, context);
297
- }
298
- if (data.sessionId != null) {
299
- contents.sessionId = __expectString(data.sessionId);
300
- }
301
- if (data.sessionState != null) {
302
- contents.sessionState = deserializeAws_restJson1SessionState(data.sessionState, context);
303
- }
304
- return [2, contents];
305
- }
117
+ let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
118
+ "/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}/utterance";
119
+ resolvedPath = __resolvedPath(resolvedPath, input, "botId", () => input.botId, "{botId}", false);
120
+ resolvedPath = __resolvedPath(resolvedPath, input, "botAliasId", () => input.botAliasId, "{botAliasId}", false);
121
+ resolvedPath = __resolvedPath(resolvedPath, input, "localeId", () => input.localeId, "{localeId}", false);
122
+ resolvedPath = __resolvedPath(resolvedPath, input, "sessionId", () => input.sessionId, "{sessionId}", false);
123
+ let body;
124
+ if (input.inputStream !== undefined) {
125
+ body = input.inputStream;
126
+ }
127
+ return new __HttpRequest({
128
+ protocol,
129
+ hostname,
130
+ port,
131
+ method: "POST",
132
+ headers,
133
+ path: resolvedPath,
134
+ body,
306
135
  });
307
- }); };
308
- var deserializeAws_restJson1GetSessionCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
309
- var parsedOutput, _a, errorCode, _b, parsedBody;
310
- var _c;
311
- return __generator(this, function (_d) {
312
- switch (_d.label) {
313
- case 0:
314
- _a = [__assign({}, output)];
315
- _c = {};
316
- return [4, parseErrorBody(output.body, context)];
317
- case 1:
318
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
319
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
320
- _b = errorCode;
321
- switch (_b) {
322
- case "AccessDeniedException": return [3, 2];
323
- case "com.amazonaws.lexruntimev2#AccessDeniedException": return [3, 2];
324
- case "InternalServerException": return [3, 4];
325
- case "com.amazonaws.lexruntimev2#InternalServerException": return [3, 4];
326
- case "ResourceNotFoundException": return [3, 6];
327
- case "com.amazonaws.lexruntimev2#ResourceNotFoundException": return [3, 6];
328
- case "ThrottlingException": return [3, 8];
329
- case "com.amazonaws.lexruntimev2#ThrottlingException": return [3, 8];
330
- case "ValidationException": return [3, 10];
331
- case "com.amazonaws.lexruntimev2#ValidationException": return [3, 10];
332
- }
333
- return [3, 12];
334
- case 2: return [4, deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)];
335
- case 3: throw _d.sent();
336
- case 4: return [4, deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)];
337
- case 5: throw _d.sent();
338
- case 6: return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
339
- case 7: throw _d.sent();
340
- case 8: return [4, deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)];
341
- case 9: throw _d.sent();
342
- case 10: return [4, deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)];
343
- case 11: throw _d.sent();
344
- case 12:
345
- parsedBody = parsedOutput.body;
346
- throwDefaultError({
347
- output: output,
348
- parsedBody: parsedBody,
349
- exceptionCtor: __BaseException,
350
- errorCode: errorCode,
351
- });
352
- _d.label = 13;
353
- case 13: return [2];
354
- }
136
+ };
137
+ export const serializeAws_restJson1StartConversationCommand = async (input, context) => {
138
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
139
+ const headers = map({}, isSerializableHeaderValue, {
140
+ "x-amz-lex-conversation-mode": input.conversationMode,
355
141
  });
356
- }); };
357
- export var deserializeAws_restJson1PutSessionCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
358
- var contents, data;
359
- return __generator(this, function (_a) {
360
- if (output.statusCode !== 200 && output.statusCode >= 300) {
361
- return [2, deserializeAws_restJson1PutSessionCommandError(output, context)];
362
- }
363
- contents = map({
364
- $metadata: deserializeMetadata(output),
365
- contentType: [, output.headers["content-type"]],
366
- messages: [, output.headers["x-amz-lex-messages"]],
367
- sessionState: [, output.headers["x-amz-lex-session-state"]],
368
- requestAttributes: [, output.headers["x-amz-lex-request-attributes"]],
369
- sessionId: [, output.headers["x-amz-lex-session-id"]],
370
- });
371
- data = output.body;
372
- contents.audioStream = data;
373
- return [2, contents];
142
+ let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
143
+ "/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}/conversation";
144
+ resolvedPath = __resolvedPath(resolvedPath, input, "botId", () => input.botId, "{botId}", false);
145
+ resolvedPath = __resolvedPath(resolvedPath, input, "botAliasId", () => input.botAliasId, "{botAliasId}", false);
146
+ resolvedPath = __resolvedPath(resolvedPath, input, "localeId", () => input.localeId, "{localeId}", false);
147
+ resolvedPath = __resolvedPath(resolvedPath, input, "sessionId", () => input.sessionId, "{sessionId}", false);
148
+ let body;
149
+ if (input.requestEventStream !== undefined) {
150
+ body = serializeAws_restJson1StartConversationRequestEventStream(input.requestEventStream, context);
151
+ }
152
+ return new __HttpRequest({
153
+ protocol,
154
+ hostname,
155
+ port,
156
+ method: "POST",
157
+ headers,
158
+ path: resolvedPath,
159
+ body,
374
160
  });
375
- }); };
376
- var deserializeAws_restJson1PutSessionCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
377
- var parsedOutput, _a, errorCode, _b, parsedBody;
378
- var _c;
379
- return __generator(this, function (_d) {
380
- switch (_d.label) {
381
- case 0:
382
- _a = [__assign({}, output)];
383
- _c = {};
384
- return [4, parseErrorBody(output.body, context)];
385
- case 1:
386
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
387
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
388
- _b = errorCode;
389
- switch (_b) {
390
- case "AccessDeniedException": return [3, 2];
391
- case "com.amazonaws.lexruntimev2#AccessDeniedException": return [3, 2];
392
- case "BadGatewayException": return [3, 4];
393
- case "com.amazonaws.lexruntimev2#BadGatewayException": return [3, 4];
394
- case "ConflictException": return [3, 6];
395
- case "com.amazonaws.lexruntimev2#ConflictException": return [3, 6];
396
- case "DependencyFailedException": return [3, 8];
397
- case "com.amazonaws.lexruntimev2#DependencyFailedException": return [3, 8];
398
- case "InternalServerException": return [3, 10];
399
- case "com.amazonaws.lexruntimev2#InternalServerException": return [3, 10];
400
- case "ResourceNotFoundException": return [3, 12];
401
- case "com.amazonaws.lexruntimev2#ResourceNotFoundException": return [3, 12];
402
- case "ThrottlingException": return [3, 14];
403
- case "com.amazonaws.lexruntimev2#ThrottlingException": return [3, 14];
404
- case "ValidationException": return [3, 16];
405
- case "com.amazonaws.lexruntimev2#ValidationException": return [3, 16];
406
- }
407
- return [3, 18];
408
- case 2: return [4, deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)];
409
- case 3: throw _d.sent();
410
- case 4: return [4, deserializeAws_restJson1BadGatewayExceptionResponse(parsedOutput, context)];
411
- case 5: throw _d.sent();
412
- case 6: return [4, deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)];
413
- case 7: throw _d.sent();
414
- case 8: return [4, deserializeAws_restJson1DependencyFailedExceptionResponse(parsedOutput, context)];
415
- case 9: throw _d.sent();
416
- case 10: return [4, deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)];
417
- case 11: throw _d.sent();
418
- case 12: return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
419
- case 13: throw _d.sent();
420
- case 14: return [4, deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)];
421
- case 15: throw _d.sent();
422
- case 16: return [4, deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)];
423
- case 17: throw _d.sent();
424
- case 18:
425
- parsedBody = parsedOutput.body;
426
- throwDefaultError({
427
- output: output,
428
- parsedBody: parsedBody,
429
- exceptionCtor: __BaseException,
430
- errorCode: errorCode,
431
- });
432
- _d.label = 19;
433
- case 19: return [2];
434
- }
161
+ };
162
+ export const deserializeAws_restJson1DeleteSessionCommand = async (output, context) => {
163
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
164
+ return deserializeAws_restJson1DeleteSessionCommandError(output, context);
165
+ }
166
+ const contents = map({
167
+ $metadata: deserializeMetadata(output),
435
168
  });
436
- }); };
437
- export var deserializeAws_restJson1RecognizeTextCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
438
- var contents, data, _a, _b;
439
- return __generator(this, function (_c) {
440
- switch (_c.label) {
441
- case 0:
442
- if (output.statusCode !== 200 && output.statusCode >= 300) {
443
- return [2, deserializeAws_restJson1RecognizeTextCommandError(output, context)];
444
- }
445
- contents = map({
446
- $metadata: deserializeMetadata(output),
447
- });
448
- _a = __expectNonNull;
449
- _b = __expectObject;
450
- return [4, parseBody(output.body, context)];
451
- case 1:
452
- data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
453
- if (data.interpretations != null) {
454
- contents.interpretations = deserializeAws_restJson1Interpretations(data.interpretations, context);
455
- }
456
- if (data.messages != null) {
457
- contents.messages = deserializeAws_restJson1Messages(data.messages, context);
458
- }
459
- if (data.requestAttributes != null) {
460
- contents.requestAttributes = deserializeAws_restJson1StringMap(data.requestAttributes, context);
461
- }
462
- if (data.sessionId != null) {
463
- contents.sessionId = __expectString(data.sessionId);
464
- }
465
- if (data.sessionState != null) {
466
- contents.sessionState = deserializeAws_restJson1SessionState(data.sessionState, context);
467
- }
468
- return [2, contents];
469
- }
169
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
170
+ if (data.botAliasId != null) {
171
+ contents.botAliasId = __expectString(data.botAliasId);
172
+ }
173
+ if (data.botId != null) {
174
+ contents.botId = __expectString(data.botId);
175
+ }
176
+ if (data.localeId != null) {
177
+ contents.localeId = __expectString(data.localeId);
178
+ }
179
+ if (data.sessionId != null) {
180
+ contents.sessionId = __expectString(data.sessionId);
181
+ }
182
+ return contents;
183
+ };
184
+ const deserializeAws_restJson1DeleteSessionCommandError = async (output, context) => {
185
+ const parsedOutput = {
186
+ ...output,
187
+ body: await parseErrorBody(output.body, context),
188
+ };
189
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
190
+ switch (errorCode) {
191
+ case "AccessDeniedException":
192
+ case "com.amazonaws.lexruntimev2#AccessDeniedException":
193
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
194
+ case "ConflictException":
195
+ case "com.amazonaws.lexruntimev2#ConflictException":
196
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
197
+ case "InternalServerException":
198
+ case "com.amazonaws.lexruntimev2#InternalServerException":
199
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
200
+ case "ResourceNotFoundException":
201
+ case "com.amazonaws.lexruntimev2#ResourceNotFoundException":
202
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
203
+ case "ThrottlingException":
204
+ case "com.amazonaws.lexruntimev2#ThrottlingException":
205
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
206
+ case "ValidationException":
207
+ case "com.amazonaws.lexruntimev2#ValidationException":
208
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
209
+ default:
210
+ const parsedBody = parsedOutput.body;
211
+ throwDefaultError({
212
+ output,
213
+ parsedBody,
214
+ exceptionCtor: __BaseException,
215
+ errorCode,
216
+ });
217
+ }
218
+ };
219
+ export const deserializeAws_restJson1GetSessionCommand = async (output, context) => {
220
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
221
+ return deserializeAws_restJson1GetSessionCommandError(output, context);
222
+ }
223
+ const contents = map({
224
+ $metadata: deserializeMetadata(output),
470
225
  });
471
- }); };
472
- var deserializeAws_restJson1RecognizeTextCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
473
- var parsedOutput, _a, errorCode, _b, parsedBody;
474
- var _c;
475
- return __generator(this, function (_d) {
476
- switch (_d.label) {
477
- case 0:
478
- _a = [__assign({}, output)];
479
- _c = {};
480
- return [4, parseErrorBody(output.body, context)];
481
- case 1:
482
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
483
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
484
- _b = errorCode;
485
- switch (_b) {
486
- case "AccessDeniedException": return [3, 2];
487
- case "com.amazonaws.lexruntimev2#AccessDeniedException": return [3, 2];
488
- case "BadGatewayException": return [3, 4];
489
- case "com.amazonaws.lexruntimev2#BadGatewayException": return [3, 4];
490
- case "ConflictException": return [3, 6];
491
- case "com.amazonaws.lexruntimev2#ConflictException": return [3, 6];
492
- case "DependencyFailedException": return [3, 8];
493
- case "com.amazonaws.lexruntimev2#DependencyFailedException": return [3, 8];
494
- case "InternalServerException": return [3, 10];
495
- case "com.amazonaws.lexruntimev2#InternalServerException": return [3, 10];
496
- case "ResourceNotFoundException": return [3, 12];
497
- case "com.amazonaws.lexruntimev2#ResourceNotFoundException": return [3, 12];
498
- case "ThrottlingException": return [3, 14];
499
- case "com.amazonaws.lexruntimev2#ThrottlingException": return [3, 14];
500
- case "ValidationException": return [3, 16];
501
- case "com.amazonaws.lexruntimev2#ValidationException": return [3, 16];
502
- }
503
- return [3, 18];
504
- case 2: return [4, deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)];
505
- case 3: throw _d.sent();
506
- case 4: return [4, deserializeAws_restJson1BadGatewayExceptionResponse(parsedOutput, context)];
507
- case 5: throw _d.sent();
508
- case 6: return [4, deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)];
509
- case 7: throw _d.sent();
510
- case 8: return [4, deserializeAws_restJson1DependencyFailedExceptionResponse(parsedOutput, context)];
511
- case 9: throw _d.sent();
512
- case 10: return [4, deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)];
513
- case 11: throw _d.sent();
514
- case 12: return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
515
- case 13: throw _d.sent();
516
- case 14: return [4, deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)];
517
- case 15: throw _d.sent();
518
- case 16: return [4, deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)];
519
- case 17: throw _d.sent();
520
- case 18:
521
- parsedBody = parsedOutput.body;
522
- throwDefaultError({
523
- output: output,
524
- parsedBody: parsedBody,
525
- exceptionCtor: __BaseException,
526
- errorCode: errorCode,
527
- });
528
- _d.label = 19;
529
- case 19: return [2];
530
- }
226
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
227
+ if (data.interpretations != null) {
228
+ contents.interpretations = deserializeAws_restJson1Interpretations(data.interpretations, context);
229
+ }
230
+ if (data.messages != null) {
231
+ contents.messages = deserializeAws_restJson1Messages(data.messages, context);
232
+ }
233
+ if (data.sessionId != null) {
234
+ contents.sessionId = __expectString(data.sessionId);
235
+ }
236
+ if (data.sessionState != null) {
237
+ contents.sessionState = deserializeAws_restJson1SessionState(data.sessionState, context);
238
+ }
239
+ return contents;
240
+ };
241
+ const deserializeAws_restJson1GetSessionCommandError = async (output, context) => {
242
+ const parsedOutput = {
243
+ ...output,
244
+ body: await parseErrorBody(output.body, context),
245
+ };
246
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
247
+ switch (errorCode) {
248
+ case "AccessDeniedException":
249
+ case "com.amazonaws.lexruntimev2#AccessDeniedException":
250
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
251
+ case "InternalServerException":
252
+ case "com.amazonaws.lexruntimev2#InternalServerException":
253
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
254
+ case "ResourceNotFoundException":
255
+ case "com.amazonaws.lexruntimev2#ResourceNotFoundException":
256
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
257
+ case "ThrottlingException":
258
+ case "com.amazonaws.lexruntimev2#ThrottlingException":
259
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
260
+ case "ValidationException":
261
+ case "com.amazonaws.lexruntimev2#ValidationException":
262
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
263
+ default:
264
+ const parsedBody = parsedOutput.body;
265
+ throwDefaultError({
266
+ output,
267
+ parsedBody,
268
+ exceptionCtor: __BaseException,
269
+ errorCode,
270
+ });
271
+ }
272
+ };
273
+ export const deserializeAws_restJson1PutSessionCommand = async (output, context) => {
274
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
275
+ return deserializeAws_restJson1PutSessionCommandError(output, context);
276
+ }
277
+ const contents = map({
278
+ $metadata: deserializeMetadata(output),
279
+ contentType: [, output.headers["content-type"]],
280
+ messages: [, output.headers["x-amz-lex-messages"]],
281
+ sessionState: [, output.headers["x-amz-lex-session-state"]],
282
+ requestAttributes: [, output.headers["x-amz-lex-request-attributes"]],
283
+ sessionId: [, output.headers["x-amz-lex-session-id"]],
531
284
  });
532
- }); };
533
- export var deserializeAws_restJson1RecognizeUtteranceCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
534
- var contents, data;
535
- return __generator(this, function (_a) {
536
- if (output.statusCode !== 200 && output.statusCode >= 300) {
537
- return [2, deserializeAws_restJson1RecognizeUtteranceCommandError(output, context)];
538
- }
539
- contents = map({
540
- $metadata: deserializeMetadata(output),
541
- inputMode: [, output.headers["x-amz-lex-input-mode"]],
542
- contentType: [, output.headers["content-type"]],
543
- messages: [, output.headers["x-amz-lex-messages"]],
544
- interpretations: [, output.headers["x-amz-lex-interpretations"]],
545
- sessionState: [, output.headers["x-amz-lex-session-state"]],
546
- requestAttributes: [, output.headers["x-amz-lex-request-attributes"]],
547
- sessionId: [, output.headers["x-amz-lex-session-id"]],
548
- inputTranscript: [, output.headers["x-amz-lex-input-transcript"]],
549
- });
550
- data = output.body;
551
- contents.audioStream = data;
552
- return [2, contents];
285
+ const data = output.body;
286
+ contents.audioStream = data;
287
+ return contents;
288
+ };
289
+ const deserializeAws_restJson1PutSessionCommandError = async (output, context) => {
290
+ const parsedOutput = {
291
+ ...output,
292
+ body: await parseErrorBody(output.body, context),
293
+ };
294
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
295
+ switch (errorCode) {
296
+ case "AccessDeniedException":
297
+ case "com.amazonaws.lexruntimev2#AccessDeniedException":
298
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
299
+ case "BadGatewayException":
300
+ case "com.amazonaws.lexruntimev2#BadGatewayException":
301
+ throw await deserializeAws_restJson1BadGatewayExceptionResponse(parsedOutput, context);
302
+ case "ConflictException":
303
+ case "com.amazonaws.lexruntimev2#ConflictException":
304
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
305
+ case "DependencyFailedException":
306
+ case "com.amazonaws.lexruntimev2#DependencyFailedException":
307
+ throw await deserializeAws_restJson1DependencyFailedExceptionResponse(parsedOutput, context);
308
+ case "InternalServerException":
309
+ case "com.amazonaws.lexruntimev2#InternalServerException":
310
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
311
+ case "ResourceNotFoundException":
312
+ case "com.amazonaws.lexruntimev2#ResourceNotFoundException":
313
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
314
+ case "ThrottlingException":
315
+ case "com.amazonaws.lexruntimev2#ThrottlingException":
316
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
317
+ case "ValidationException":
318
+ case "com.amazonaws.lexruntimev2#ValidationException":
319
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
320
+ default:
321
+ const parsedBody = parsedOutput.body;
322
+ throwDefaultError({
323
+ output,
324
+ parsedBody,
325
+ exceptionCtor: __BaseException,
326
+ errorCode,
327
+ });
328
+ }
329
+ };
330
+ export const deserializeAws_restJson1RecognizeTextCommand = async (output, context) => {
331
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
332
+ return deserializeAws_restJson1RecognizeTextCommandError(output, context);
333
+ }
334
+ const contents = map({
335
+ $metadata: deserializeMetadata(output),
553
336
  });
554
- }); };
555
- var deserializeAws_restJson1RecognizeUtteranceCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
556
- var parsedOutput, _a, errorCode, _b, parsedBody;
557
- var _c;
558
- return __generator(this, function (_d) {
559
- switch (_d.label) {
560
- case 0:
561
- _a = [__assign({}, output)];
562
- _c = {};
563
- return [4, parseErrorBody(output.body, context)];
564
- case 1:
565
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
566
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
567
- _b = errorCode;
568
- switch (_b) {
569
- case "AccessDeniedException": return [3, 2];
570
- case "com.amazonaws.lexruntimev2#AccessDeniedException": return [3, 2];
571
- case "BadGatewayException": return [3, 4];
572
- case "com.amazonaws.lexruntimev2#BadGatewayException": return [3, 4];
573
- case "ConflictException": return [3, 6];
574
- case "com.amazonaws.lexruntimev2#ConflictException": return [3, 6];
575
- case "DependencyFailedException": return [3, 8];
576
- case "com.amazonaws.lexruntimev2#DependencyFailedException": return [3, 8];
577
- case "InternalServerException": return [3, 10];
578
- case "com.amazonaws.lexruntimev2#InternalServerException": return [3, 10];
579
- case "ResourceNotFoundException": return [3, 12];
580
- case "com.amazonaws.lexruntimev2#ResourceNotFoundException": return [3, 12];
581
- case "ThrottlingException": return [3, 14];
582
- case "com.amazonaws.lexruntimev2#ThrottlingException": return [3, 14];
583
- case "ValidationException": return [3, 16];
584
- case "com.amazonaws.lexruntimev2#ValidationException": return [3, 16];
585
- }
586
- return [3, 18];
587
- case 2: return [4, deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)];
588
- case 3: throw _d.sent();
589
- case 4: return [4, deserializeAws_restJson1BadGatewayExceptionResponse(parsedOutput, context)];
590
- case 5: throw _d.sent();
591
- case 6: return [4, deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)];
592
- case 7: throw _d.sent();
593
- case 8: return [4, deserializeAws_restJson1DependencyFailedExceptionResponse(parsedOutput, context)];
594
- case 9: throw _d.sent();
595
- case 10: return [4, deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)];
596
- case 11: throw _d.sent();
597
- case 12: return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
598
- case 13: throw _d.sent();
599
- case 14: return [4, deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)];
600
- case 15: throw _d.sent();
601
- case 16: return [4, deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)];
602
- case 17: throw _d.sent();
603
- case 18:
604
- parsedBody = parsedOutput.body;
605
- throwDefaultError({
606
- output: output,
607
- parsedBody: parsedBody,
608
- exceptionCtor: __BaseException,
609
- errorCode: errorCode,
610
- });
611
- _d.label = 19;
612
- case 19: return [2];
613
- }
337
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
338
+ if (data.interpretations != null) {
339
+ contents.interpretations = deserializeAws_restJson1Interpretations(data.interpretations, context);
340
+ }
341
+ if (data.messages != null) {
342
+ contents.messages = deserializeAws_restJson1Messages(data.messages, context);
343
+ }
344
+ if (data.requestAttributes != null) {
345
+ contents.requestAttributes = deserializeAws_restJson1StringMap(data.requestAttributes, context);
346
+ }
347
+ if (data.sessionId != null) {
348
+ contents.sessionId = __expectString(data.sessionId);
349
+ }
350
+ if (data.sessionState != null) {
351
+ contents.sessionState = deserializeAws_restJson1SessionState(data.sessionState, context);
352
+ }
353
+ return contents;
354
+ };
355
+ const deserializeAws_restJson1RecognizeTextCommandError = async (output, context) => {
356
+ const parsedOutput = {
357
+ ...output,
358
+ body: await parseErrorBody(output.body, context),
359
+ };
360
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
361
+ switch (errorCode) {
362
+ case "AccessDeniedException":
363
+ case "com.amazonaws.lexruntimev2#AccessDeniedException":
364
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
365
+ case "BadGatewayException":
366
+ case "com.amazonaws.lexruntimev2#BadGatewayException":
367
+ throw await deserializeAws_restJson1BadGatewayExceptionResponse(parsedOutput, context);
368
+ case "ConflictException":
369
+ case "com.amazonaws.lexruntimev2#ConflictException":
370
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
371
+ case "DependencyFailedException":
372
+ case "com.amazonaws.lexruntimev2#DependencyFailedException":
373
+ throw await deserializeAws_restJson1DependencyFailedExceptionResponse(parsedOutput, context);
374
+ case "InternalServerException":
375
+ case "com.amazonaws.lexruntimev2#InternalServerException":
376
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
377
+ case "ResourceNotFoundException":
378
+ case "com.amazonaws.lexruntimev2#ResourceNotFoundException":
379
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
380
+ case "ThrottlingException":
381
+ case "com.amazonaws.lexruntimev2#ThrottlingException":
382
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
383
+ case "ValidationException":
384
+ case "com.amazonaws.lexruntimev2#ValidationException":
385
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
386
+ default:
387
+ const parsedBody = parsedOutput.body;
388
+ throwDefaultError({
389
+ output,
390
+ parsedBody,
391
+ exceptionCtor: __BaseException,
392
+ errorCode,
393
+ });
394
+ }
395
+ };
396
+ export const deserializeAws_restJson1RecognizeUtteranceCommand = async (output, context) => {
397
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
398
+ return deserializeAws_restJson1RecognizeUtteranceCommandError(output, context);
399
+ }
400
+ const contents = map({
401
+ $metadata: deserializeMetadata(output),
402
+ inputMode: [, output.headers["x-amz-lex-input-mode"]],
403
+ contentType: [, output.headers["content-type"]],
404
+ messages: [, output.headers["x-amz-lex-messages"]],
405
+ interpretations: [, output.headers["x-amz-lex-interpretations"]],
406
+ sessionState: [, output.headers["x-amz-lex-session-state"]],
407
+ requestAttributes: [, output.headers["x-amz-lex-request-attributes"]],
408
+ sessionId: [, output.headers["x-amz-lex-session-id"]],
409
+ inputTranscript: [, output.headers["x-amz-lex-input-transcript"]],
614
410
  });
615
- }); };
616
- export var deserializeAws_restJson1StartConversationCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
617
- var contents, data;
618
- return __generator(this, function (_a) {
619
- if (output.statusCode !== 200 && output.statusCode >= 300) {
620
- return [2, deserializeAws_restJson1StartConversationCommandError(output, context)];
621
- }
622
- contents = map({
623
- $metadata: deserializeMetadata(output),
624
- });
625
- data = output.body;
626
- contents.responseEventStream = deserializeAws_restJson1StartConversationResponseEventStream(data, context);
627
- return [2, contents];
411
+ const data = output.body;
412
+ contents.audioStream = data;
413
+ return contents;
414
+ };
415
+ const deserializeAws_restJson1RecognizeUtteranceCommandError = async (output, context) => {
416
+ const parsedOutput = {
417
+ ...output,
418
+ body: await parseErrorBody(output.body, context),
419
+ };
420
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
421
+ switch (errorCode) {
422
+ case "AccessDeniedException":
423
+ case "com.amazonaws.lexruntimev2#AccessDeniedException":
424
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
425
+ case "BadGatewayException":
426
+ case "com.amazonaws.lexruntimev2#BadGatewayException":
427
+ throw await deserializeAws_restJson1BadGatewayExceptionResponse(parsedOutput, context);
428
+ case "ConflictException":
429
+ case "com.amazonaws.lexruntimev2#ConflictException":
430
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
431
+ case "DependencyFailedException":
432
+ case "com.amazonaws.lexruntimev2#DependencyFailedException":
433
+ throw await deserializeAws_restJson1DependencyFailedExceptionResponse(parsedOutput, context);
434
+ case "InternalServerException":
435
+ case "com.amazonaws.lexruntimev2#InternalServerException":
436
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
437
+ case "ResourceNotFoundException":
438
+ case "com.amazonaws.lexruntimev2#ResourceNotFoundException":
439
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
440
+ case "ThrottlingException":
441
+ case "com.amazonaws.lexruntimev2#ThrottlingException":
442
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
443
+ case "ValidationException":
444
+ case "com.amazonaws.lexruntimev2#ValidationException":
445
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
446
+ default:
447
+ const parsedBody = parsedOutput.body;
448
+ throwDefaultError({
449
+ output,
450
+ parsedBody,
451
+ exceptionCtor: __BaseException,
452
+ errorCode,
453
+ });
454
+ }
455
+ };
456
+ export const deserializeAws_restJson1StartConversationCommand = async (output, context) => {
457
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
458
+ return deserializeAws_restJson1StartConversationCommandError(output, context);
459
+ }
460
+ const contents = map({
461
+ $metadata: deserializeMetadata(output),
628
462
  });
629
- }); };
630
- var deserializeAws_restJson1StartConversationCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
631
- var parsedOutput, _a, errorCode, _b, parsedBody;
632
- var _c;
633
- return __generator(this, function (_d) {
634
- switch (_d.label) {
635
- case 0:
636
- _a = [__assign({}, output)];
637
- _c = {};
638
- return [4, parseErrorBody(output.body, context)];
639
- case 1:
640
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
641
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
642
- _b = errorCode;
643
- switch (_b) {
644
- case "AccessDeniedException": return [3, 2];
645
- case "com.amazonaws.lexruntimev2#AccessDeniedException": return [3, 2];
646
- case "InternalServerException": return [3, 4];
647
- case "com.amazonaws.lexruntimev2#InternalServerException": return [3, 4];
648
- case "ThrottlingException": return [3, 6];
649
- case "com.amazonaws.lexruntimev2#ThrottlingException": return [3, 6];
650
- case "ValidationException": return [3, 8];
651
- case "com.amazonaws.lexruntimev2#ValidationException": return [3, 8];
652
- }
653
- return [3, 10];
654
- case 2: return [4, deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)];
655
- case 3: throw _d.sent();
656
- case 4: return [4, deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)];
657
- case 5: throw _d.sent();
658
- case 6: return [4, deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)];
659
- case 7: throw _d.sent();
660
- case 8: return [4, deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)];
661
- case 9: throw _d.sent();
662
- case 10:
663
- parsedBody = parsedOutput.body;
664
- throwDefaultError({
665
- output: output,
666
- parsedBody: parsedBody,
667
- exceptionCtor: __BaseException,
668
- errorCode: errorCode,
669
- });
670
- _d.label = 11;
671
- case 11: return [2];
672
- }
463
+ const data = output.body;
464
+ contents.responseEventStream = deserializeAws_restJson1StartConversationResponseEventStream(data, context);
465
+ return contents;
466
+ };
467
+ const deserializeAws_restJson1StartConversationCommandError = async (output, context) => {
468
+ const parsedOutput = {
469
+ ...output,
470
+ body: await parseErrorBody(output.body, context),
471
+ };
472
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
473
+ switch (errorCode) {
474
+ case "AccessDeniedException":
475
+ case "com.amazonaws.lexruntimev2#AccessDeniedException":
476
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
477
+ case "InternalServerException":
478
+ case "com.amazonaws.lexruntimev2#InternalServerException":
479
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
480
+ case "ThrottlingException":
481
+ case "com.amazonaws.lexruntimev2#ThrottlingException":
482
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
483
+ case "ValidationException":
484
+ case "com.amazonaws.lexruntimev2#ValidationException":
485
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
486
+ default:
487
+ const parsedBody = parsedOutput.body;
488
+ throwDefaultError({
489
+ output,
490
+ parsedBody,
491
+ exceptionCtor: __BaseException,
492
+ errorCode,
493
+ });
494
+ }
495
+ };
496
+ const map = __map;
497
+ const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutput, context) => {
498
+ const contents = map({});
499
+ const data = parsedOutput.body;
500
+ if (data.message != null) {
501
+ contents.message = __expectString(data.message);
502
+ }
503
+ const exception = new AccessDeniedException({
504
+ $metadata: deserializeMetadata(parsedOutput),
505
+ ...contents,
673
506
  });
674
- }); };
675
- var map = __map;
676
- var deserializeAws_restJson1AccessDeniedExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
677
- var contents, data, exception;
678
- return __generator(this, function (_a) {
679
- contents = map({});
680
- data = parsedOutput.body;
681
- if (data.message != null) {
682
- contents.message = __expectString(data.message);
683
- }
684
- exception = new AccessDeniedException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
685
- return [2, __decorateServiceException(exception, parsedOutput.body)];
507
+ return __decorateServiceException(exception, parsedOutput.body);
508
+ };
509
+ const deserializeAws_restJson1BadGatewayExceptionResponse = async (parsedOutput, context) => {
510
+ const contents = map({});
511
+ const data = parsedOutput.body;
512
+ if (data.message != null) {
513
+ contents.message = __expectString(data.message);
514
+ }
515
+ const exception = new BadGatewayException({
516
+ $metadata: deserializeMetadata(parsedOutput),
517
+ ...contents,
686
518
  });
687
- }); };
688
- var deserializeAws_restJson1BadGatewayExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
689
- var contents, data, exception;
690
- return __generator(this, function (_a) {
691
- contents = map({});
692
- data = parsedOutput.body;
693
- if (data.message != null) {
694
- contents.message = __expectString(data.message);
695
- }
696
- exception = new BadGatewayException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
697
- return [2, __decorateServiceException(exception, parsedOutput.body)];
519
+ return __decorateServiceException(exception, parsedOutput.body);
520
+ };
521
+ const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, context) => {
522
+ const contents = map({});
523
+ const data = parsedOutput.body;
524
+ if (data.message != null) {
525
+ contents.message = __expectString(data.message);
526
+ }
527
+ const exception = new ConflictException({
528
+ $metadata: deserializeMetadata(parsedOutput),
529
+ ...contents,
698
530
  });
699
- }); };
700
- var deserializeAws_restJson1ConflictExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
701
- var contents, data, exception;
702
- return __generator(this, function (_a) {
703
- contents = map({});
704
- data = parsedOutput.body;
705
- if (data.message != null) {
706
- contents.message = __expectString(data.message);
707
- }
708
- exception = new ConflictException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
709
- return [2, __decorateServiceException(exception, parsedOutput.body)];
531
+ return __decorateServiceException(exception, parsedOutput.body);
532
+ };
533
+ const deserializeAws_restJson1DependencyFailedExceptionResponse = async (parsedOutput, context) => {
534
+ const contents = map({});
535
+ const data = parsedOutput.body;
536
+ if (data.message != null) {
537
+ contents.message = __expectString(data.message);
538
+ }
539
+ const exception = new DependencyFailedException({
540
+ $metadata: deserializeMetadata(parsedOutput),
541
+ ...contents,
710
542
  });
711
- }); };
712
- var deserializeAws_restJson1DependencyFailedExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
713
- var contents, data, exception;
714
- return __generator(this, function (_a) {
715
- contents = map({});
716
- data = parsedOutput.body;
717
- if (data.message != null) {
718
- contents.message = __expectString(data.message);
719
- }
720
- exception = new DependencyFailedException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
721
- return [2, __decorateServiceException(exception, parsedOutput.body)];
543
+ return __decorateServiceException(exception, parsedOutput.body);
544
+ };
545
+ const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOutput, context) => {
546
+ const contents = map({});
547
+ const data = parsedOutput.body;
548
+ if (data.message != null) {
549
+ contents.message = __expectString(data.message);
550
+ }
551
+ const exception = new InternalServerException({
552
+ $metadata: deserializeMetadata(parsedOutput),
553
+ ...contents,
722
554
  });
723
- }); };
724
- var deserializeAws_restJson1InternalServerExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
725
- var contents, data, exception;
726
- return __generator(this, function (_a) {
727
- contents = map({});
728
- data = parsedOutput.body;
729
- if (data.message != null) {
730
- contents.message = __expectString(data.message);
731
- }
732
- exception = new InternalServerException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
733
- return [2, __decorateServiceException(exception, parsedOutput.body)];
555
+ return __decorateServiceException(exception, parsedOutput.body);
556
+ };
557
+ const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
558
+ const contents = map({});
559
+ const data = parsedOutput.body;
560
+ if (data.message != null) {
561
+ contents.message = __expectString(data.message);
562
+ }
563
+ const exception = new ResourceNotFoundException({
564
+ $metadata: deserializeMetadata(parsedOutput),
565
+ ...contents,
734
566
  });
735
- }); };
736
- var deserializeAws_restJson1ResourceNotFoundExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
737
- var contents, data, exception;
738
- return __generator(this, function (_a) {
739
- contents = map({});
740
- data = parsedOutput.body;
741
- if (data.message != null) {
742
- contents.message = __expectString(data.message);
743
- }
744
- exception = new ResourceNotFoundException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
745
- return [2, __decorateServiceException(exception, parsedOutput.body)];
567
+ return __decorateServiceException(exception, parsedOutput.body);
568
+ };
569
+ const deserializeAws_restJson1ThrottlingExceptionResponse = async (parsedOutput, context) => {
570
+ const contents = map({});
571
+ const data = parsedOutput.body;
572
+ if (data.message != null) {
573
+ contents.message = __expectString(data.message);
574
+ }
575
+ const exception = new ThrottlingException({
576
+ $metadata: deserializeMetadata(parsedOutput),
577
+ ...contents,
746
578
  });
747
- }); };
748
- var deserializeAws_restJson1ThrottlingExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
749
- var contents, data, exception;
750
- return __generator(this, function (_a) {
751
- contents = map({});
752
- data = parsedOutput.body;
753
- if (data.message != null) {
754
- contents.message = __expectString(data.message);
755
- }
756
- exception = new ThrottlingException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
757
- return [2, __decorateServiceException(exception, parsedOutput.body)];
579
+ return __decorateServiceException(exception, parsedOutput.body);
580
+ };
581
+ const deserializeAws_restJson1ValidationExceptionResponse = async (parsedOutput, context) => {
582
+ const contents = map({});
583
+ const data = parsedOutput.body;
584
+ if (data.message != null) {
585
+ contents.message = __expectString(data.message);
586
+ }
587
+ const exception = new ValidationException({
588
+ $metadata: deserializeMetadata(parsedOutput),
589
+ ...contents,
758
590
  });
759
- }); };
760
- var deserializeAws_restJson1ValidationExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
761
- var contents, data, exception;
762
- return __generator(this, function (_a) {
763
- contents = map({});
764
- data = parsedOutput.body;
765
- if (data.message != null) {
766
- contents.message = __expectString(data.message);
767
- }
768
- exception = new ValidationException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
769
- return [2, __decorateServiceException(exception, parsedOutput.body)];
591
+ return __decorateServiceException(exception, parsedOutput.body);
592
+ };
593
+ const serializeAws_restJson1StartConversationRequestEventStream = (input, context) => {
594
+ const eventMarshallingVisitor = (event) => StartConversationRequestEventStream.visit(event, {
595
+ ConfigurationEvent: (value) => serializeAws_restJson1ConfigurationEvent_event(value, context),
596
+ AudioInputEvent: (value) => serializeAws_restJson1AudioInputEvent_event(value, context),
597
+ DTMFInputEvent: (value) => serializeAws_restJson1DTMFInputEvent_event(value, context),
598
+ TextInputEvent: (value) => serializeAws_restJson1TextInputEvent_event(value, context),
599
+ PlaybackCompletionEvent: (value) => serializeAws_restJson1PlaybackCompletionEvent_event(value, context),
600
+ DisconnectionEvent: (value) => serializeAws_restJson1DisconnectionEvent_event(value, context),
601
+ _: (value) => value,
770
602
  });
771
- }); };
772
- var serializeAws_restJson1StartConversationRequestEventStream = function (input, context) {
773
- var eventMarshallingVisitor = function (event) {
774
- return StartConversationRequestEventStream.visit(event, {
775
- ConfigurationEvent: function (value) { return serializeAws_restJson1ConfigurationEvent_event(value, context); },
776
- AudioInputEvent: function (value) { return serializeAws_restJson1AudioInputEvent_event(value, context); },
777
- DTMFInputEvent: function (value) { return serializeAws_restJson1DTMFInputEvent_event(value, context); },
778
- TextInputEvent: function (value) { return serializeAws_restJson1TextInputEvent_event(value, context); },
779
- PlaybackCompletionEvent: function (value) { return serializeAws_restJson1PlaybackCompletionEvent_event(value, context); },
780
- DisconnectionEvent: function (value) { return serializeAws_restJson1DisconnectionEvent_event(value, context); },
781
- _: function (value) { return value; },
782
- });
783
- };
784
603
  return context.eventStreamMarshaller.serialize(input, eventMarshallingVisitor);
785
604
  };
786
- var serializeAws_restJson1AudioInputEvent_event = function (input, context) {
787
- var headers = {
605
+ const serializeAws_restJson1AudioInputEvent_event = (input, context) => {
606
+ const headers = {
788
607
  ":event-type": { type: "string", value: "AudioInputEvent" },
789
608
  ":message-type": { type: "string", value: "event" },
790
609
  ":content-type": { type: "string", value: "application/json" },
791
610
  };
792
- var body = new Uint8Array();
611
+ let body = new Uint8Array();
793
612
  body = serializeAws_restJson1AudioInputEvent(input, context);
794
613
  body = context.utf8Decoder(JSON.stringify(body));
795
- return { headers: headers, body: body };
614
+ return { headers, body };
796
615
  };
797
- var serializeAws_restJson1ConfigurationEvent_event = function (input, context) {
798
- var headers = {
616
+ const serializeAws_restJson1ConfigurationEvent_event = (input, context) => {
617
+ const headers = {
799
618
  ":event-type": { type: "string", value: "ConfigurationEvent" },
800
619
  ":message-type": { type: "string", value: "event" },
801
620
  ":content-type": { type: "string", value: "application/json" },
802
621
  };
803
- var body = new Uint8Array();
622
+ let body = new Uint8Array();
804
623
  body = serializeAws_restJson1ConfigurationEvent(input, context);
805
624
  body = context.utf8Decoder(JSON.stringify(body));
806
- return { headers: headers, body: body };
625
+ return { headers, body };
807
626
  };
808
- var serializeAws_restJson1DisconnectionEvent_event = function (input, context) {
809
- var headers = {
627
+ const serializeAws_restJson1DisconnectionEvent_event = (input, context) => {
628
+ const headers = {
810
629
  ":event-type": { type: "string", value: "DisconnectionEvent" },
811
630
  ":message-type": { type: "string", value: "event" },
812
631
  ":content-type": { type: "string", value: "application/json" },
813
632
  };
814
- var body = new Uint8Array();
633
+ let body = new Uint8Array();
815
634
  body = serializeAws_restJson1DisconnectionEvent(input, context);
816
635
  body = context.utf8Decoder(JSON.stringify(body));
817
- return { headers: headers, body: body };
636
+ return { headers, body };
818
637
  };
819
- var serializeAws_restJson1DTMFInputEvent_event = function (input, context) {
820
- var headers = {
638
+ const serializeAws_restJson1DTMFInputEvent_event = (input, context) => {
639
+ const headers = {
821
640
  ":event-type": { type: "string", value: "DTMFInputEvent" },
822
641
  ":message-type": { type: "string", value: "event" },
823
642
  ":content-type": { type: "string", value: "application/json" },
824
643
  };
825
- var body = new Uint8Array();
644
+ let body = new Uint8Array();
826
645
  body = serializeAws_restJson1DTMFInputEvent(input, context);
827
646
  body = context.utf8Decoder(JSON.stringify(body));
828
- return { headers: headers, body: body };
647
+ return { headers, body };
829
648
  };
830
- var serializeAws_restJson1PlaybackCompletionEvent_event = function (input, context) {
831
- var headers = {
649
+ const serializeAws_restJson1PlaybackCompletionEvent_event = (input, context) => {
650
+ const headers = {
832
651
  ":event-type": { type: "string", value: "PlaybackCompletionEvent" },
833
652
  ":message-type": { type: "string", value: "event" },
834
653
  ":content-type": { type: "string", value: "application/json" },
835
654
  };
836
- var body = new Uint8Array();
655
+ let body = new Uint8Array();
837
656
  body = serializeAws_restJson1PlaybackCompletionEvent(input, context);
838
657
  body = context.utf8Decoder(JSON.stringify(body));
839
- return { headers: headers, body: body };
658
+ return { headers, body };
840
659
  };
841
- var serializeAws_restJson1TextInputEvent_event = function (input, context) {
842
- var headers = {
660
+ const serializeAws_restJson1TextInputEvent_event = (input, context) => {
661
+ const headers = {
843
662
  ":event-type": { type: "string", value: "TextInputEvent" },
844
663
  ":message-type": { type: "string", value: "event" },
845
664
  ":content-type": { type: "string", value: "application/json" },
846
665
  };
847
- var body = new Uint8Array();
666
+ let body = new Uint8Array();
848
667
  body = serializeAws_restJson1TextInputEvent(input, context);
849
668
  body = context.utf8Decoder(JSON.stringify(body));
850
- return { headers: headers, body: body };
851
- };
852
- var deserializeAws_restJson1StartConversationResponseEventStream = function (output, context) {
853
- return context.eventStreamMarshaller.deserialize(output, function (event) { return __awaiter(void 0, void 0, void 0, function () {
854
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
855
- return __generator(this, function (_q) {
856
- switch (_q.label) {
857
- case 0:
858
- if (!(event["PlaybackInterruptionEvent"] != null)) return [3, 2];
859
- _a = {};
860
- return [4, deserializeAws_restJson1PlaybackInterruptionEvent_event(event["PlaybackInterruptionEvent"], context)];
861
- case 1: return [2, (_a.PlaybackInterruptionEvent = _q.sent(),
862
- _a)];
863
- case 2:
864
- if (!(event["TranscriptEvent"] != null)) return [3, 4];
865
- _b = {};
866
- return [4, deserializeAws_restJson1TranscriptEvent_event(event["TranscriptEvent"], context)];
867
- case 3: return [2, (_b.TranscriptEvent = _q.sent(),
868
- _b)];
869
- case 4:
870
- if (!(event["IntentResultEvent"] != null)) return [3, 6];
871
- _c = {};
872
- return [4, deserializeAws_restJson1IntentResultEvent_event(event["IntentResultEvent"], context)];
873
- case 5: return [2, (_c.IntentResultEvent = _q.sent(),
874
- _c)];
875
- case 6:
876
- if (!(event["TextResponseEvent"] != null)) return [3, 8];
877
- _d = {};
878
- return [4, deserializeAws_restJson1TextResponseEvent_event(event["TextResponseEvent"], context)];
879
- case 7: return [2, (_d.TextResponseEvent = _q.sent(),
880
- _d)];
881
- case 8:
882
- if (!(event["AudioResponseEvent"] != null)) return [3, 10];
883
- _e = {};
884
- return [4, deserializeAws_restJson1AudioResponseEvent_event(event["AudioResponseEvent"], context)];
885
- case 9: return [2, (_e.AudioResponseEvent = _q.sent(),
886
- _e)];
887
- case 10:
888
- if (!(event["HeartbeatEvent"] != null)) return [3, 12];
889
- _f = {};
890
- return [4, deserializeAws_restJson1HeartbeatEvent_event(event["HeartbeatEvent"], context)];
891
- case 11: return [2, (_f.HeartbeatEvent = _q.sent(),
892
- _f)];
893
- case 12:
894
- if (!(event["AccessDeniedException"] != null)) return [3, 14];
895
- _g = {};
896
- return [4, deserializeAws_restJson1AccessDeniedException_event(event["AccessDeniedException"], context)];
897
- case 13: return [2, (_g.AccessDeniedException = _q.sent(),
898
- _g)];
899
- case 14:
900
- if (!(event["ResourceNotFoundException"] != null)) return [3, 16];
901
- _h = {};
902
- return [4, deserializeAws_restJson1ResourceNotFoundException_event(event["ResourceNotFoundException"], context)];
903
- case 15: return [2, (_h.ResourceNotFoundException = _q.sent(),
904
- _h)];
905
- case 16:
906
- if (!(event["ValidationException"] != null)) return [3, 18];
907
- _j = {};
908
- return [4, deserializeAws_restJson1ValidationException_event(event["ValidationException"], context)];
909
- case 17: return [2, (_j.ValidationException = _q.sent(),
910
- _j)];
911
- case 18:
912
- if (!(event["ThrottlingException"] != null)) return [3, 20];
913
- _k = {};
914
- return [4, deserializeAws_restJson1ThrottlingException_event(event["ThrottlingException"], context)];
915
- case 19: return [2, (_k.ThrottlingException = _q.sent(),
916
- _k)];
917
- case 20:
918
- if (!(event["InternalServerException"] != null)) return [3, 22];
919
- _l = {};
920
- return [4, deserializeAws_restJson1InternalServerException_event(event["InternalServerException"], context)];
921
- case 21: return [2, (_l.InternalServerException = _q.sent(),
922
- _l)];
923
- case 22:
924
- if (!(event["ConflictException"] != null)) return [3, 24];
925
- _m = {};
926
- return [4, deserializeAws_restJson1ConflictException_event(event["ConflictException"], context)];
927
- case 23: return [2, (_m.ConflictException = _q.sent(),
928
- _m)];
929
- case 24:
930
- if (!(event["DependencyFailedException"] != null)) return [3, 26];
931
- _o = {};
932
- return [4, deserializeAws_restJson1DependencyFailedException_event(event["DependencyFailedException"], context)];
933
- case 25: return [2, (_o.DependencyFailedException = _q.sent(),
934
- _o)];
935
- case 26:
936
- if (!(event["BadGatewayException"] != null)) return [3, 28];
937
- _p = {};
938
- return [4, deserializeAws_restJson1BadGatewayException_event(event["BadGatewayException"], context)];
939
- case 27: return [2, (_p.BadGatewayException = _q.sent(),
940
- _p)];
941
- case 28: return [2, { $unknown: output }];
942
- }
943
- });
944
- }); });
945
- };
946
- var deserializeAws_restJson1AccessDeniedException_event = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
947
- var parsedOutput, _a;
948
- var _b;
949
- return __generator(this, function (_c) {
950
- switch (_c.label) {
951
- case 0:
952
- _a = [__assign({}, output)];
953
- _b = {};
954
- return [4, parseBody(output.body, context)];
955
- case 1:
956
- parsedOutput = __assign.apply(void 0, _a.concat([(_b.body = _c.sent(), _b)]));
957
- return [2, deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)];
669
+ return { headers, body };
670
+ };
671
+ const deserializeAws_restJson1StartConversationResponseEventStream = (output, context) => {
672
+ return context.eventStreamMarshaller.deserialize(output, async (event) => {
673
+ if (event["PlaybackInterruptionEvent"] != null) {
674
+ return {
675
+ PlaybackInterruptionEvent: await deserializeAws_restJson1PlaybackInterruptionEvent_event(event["PlaybackInterruptionEvent"], context),
676
+ };
958
677
  }
959
- });
960
- }); };
961
- var deserializeAws_restJson1AudioResponseEvent_event = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
962
- var contents, data;
963
- return __generator(this, function (_a) {
964
- switch (_a.label) {
965
- case 0:
966
- contents = {};
967
- return [4, parseBody(output.body, context)];
968
- case 1:
969
- data = _a.sent();
970
- Object.assign(contents, deserializeAws_restJson1AudioResponseEvent(data, context));
971
- return [2, contents];
678
+ if (event["TranscriptEvent"] != null) {
679
+ return {
680
+ TranscriptEvent: await deserializeAws_restJson1TranscriptEvent_event(event["TranscriptEvent"], context),
681
+ };
972
682
  }
973
- });
974
- }); };
975
- var deserializeAws_restJson1BadGatewayException_event = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
976
- var parsedOutput, _a;
977
- var _b;
978
- return __generator(this, function (_c) {
979
- switch (_c.label) {
980
- case 0:
981
- _a = [__assign({}, output)];
982
- _b = {};
983
- return [4, parseBody(output.body, context)];
984
- case 1:
985
- parsedOutput = __assign.apply(void 0, _a.concat([(_b.body = _c.sent(), _b)]));
986
- return [2, deserializeAws_restJson1BadGatewayExceptionResponse(parsedOutput, context)];
683
+ if (event["IntentResultEvent"] != null) {
684
+ return {
685
+ IntentResultEvent: await deserializeAws_restJson1IntentResultEvent_event(event["IntentResultEvent"], context),
686
+ };
987
687
  }
988
- });
989
- }); };
990
- var deserializeAws_restJson1ConflictException_event = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
991
- var parsedOutput, _a;
992
- var _b;
993
- return __generator(this, function (_c) {
994
- switch (_c.label) {
995
- case 0:
996
- _a = [__assign({}, output)];
997
- _b = {};
998
- return [4, parseBody(output.body, context)];
999
- case 1:
1000
- parsedOutput = __assign.apply(void 0, _a.concat([(_b.body = _c.sent(), _b)]));
1001
- return [2, deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)];
688
+ if (event["TextResponseEvent"] != null) {
689
+ return {
690
+ TextResponseEvent: await deserializeAws_restJson1TextResponseEvent_event(event["TextResponseEvent"], context),
691
+ };
1002
692
  }
1003
- });
1004
- }); };
1005
- var deserializeAws_restJson1DependencyFailedException_event = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1006
- var parsedOutput, _a;
1007
- var _b;
1008
- return __generator(this, function (_c) {
1009
- switch (_c.label) {
1010
- case 0:
1011
- _a = [__assign({}, output)];
1012
- _b = {};
1013
- return [4, parseBody(output.body, context)];
1014
- case 1:
1015
- parsedOutput = __assign.apply(void 0, _a.concat([(_b.body = _c.sent(), _b)]));
1016
- return [2, deserializeAws_restJson1DependencyFailedExceptionResponse(parsedOutput, context)];
693
+ if (event["AudioResponseEvent"] != null) {
694
+ return {
695
+ AudioResponseEvent: await deserializeAws_restJson1AudioResponseEvent_event(event["AudioResponseEvent"], context),
696
+ };
1017
697
  }
1018
- });
1019
- }); };
1020
- var deserializeAws_restJson1HeartbeatEvent_event = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1021
- var contents, data;
1022
- return __generator(this, function (_a) {
1023
- switch (_a.label) {
1024
- case 0:
1025
- contents = {};
1026
- return [4, parseBody(output.body, context)];
1027
- case 1:
1028
- data = _a.sent();
1029
- Object.assign(contents, deserializeAws_restJson1HeartbeatEvent(data, context));
1030
- return [2, contents];
698
+ if (event["HeartbeatEvent"] != null) {
699
+ return {
700
+ HeartbeatEvent: await deserializeAws_restJson1HeartbeatEvent_event(event["HeartbeatEvent"], context),
701
+ };
1031
702
  }
1032
- });
1033
- }); };
1034
- var deserializeAws_restJson1IntentResultEvent_event = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1035
- var contents, data;
1036
- return __generator(this, function (_a) {
1037
- switch (_a.label) {
1038
- case 0:
1039
- contents = {};
1040
- return [4, parseBody(output.body, context)];
1041
- case 1:
1042
- data = _a.sent();
1043
- Object.assign(contents, deserializeAws_restJson1IntentResultEvent(data, context));
1044
- return [2, contents];
703
+ if (event["AccessDeniedException"] != null) {
704
+ return {
705
+ AccessDeniedException: await deserializeAws_restJson1AccessDeniedException_event(event["AccessDeniedException"], context),
706
+ };
1045
707
  }
1046
- });
1047
- }); };
1048
- var deserializeAws_restJson1InternalServerException_event = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1049
- var parsedOutput, _a;
1050
- var _b;
1051
- return __generator(this, function (_c) {
1052
- switch (_c.label) {
1053
- case 0:
1054
- _a = [__assign({}, output)];
1055
- _b = {};
1056
- return [4, parseBody(output.body, context)];
1057
- case 1:
1058
- parsedOutput = __assign.apply(void 0, _a.concat([(_b.body = _c.sent(), _b)]));
1059
- return [2, deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)];
708
+ if (event["ResourceNotFoundException"] != null) {
709
+ return {
710
+ ResourceNotFoundException: await deserializeAws_restJson1ResourceNotFoundException_event(event["ResourceNotFoundException"], context),
711
+ };
1060
712
  }
1061
- });
1062
- }); };
1063
- var deserializeAws_restJson1PlaybackInterruptionEvent_event = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1064
- var contents, data;
1065
- return __generator(this, function (_a) {
1066
- switch (_a.label) {
1067
- case 0:
1068
- contents = {};
1069
- return [4, parseBody(output.body, context)];
1070
- case 1:
1071
- data = _a.sent();
1072
- Object.assign(contents, deserializeAws_restJson1PlaybackInterruptionEvent(data, context));
1073
- return [2, contents];
713
+ if (event["ValidationException"] != null) {
714
+ return {
715
+ ValidationException: await deserializeAws_restJson1ValidationException_event(event["ValidationException"], context),
716
+ };
1074
717
  }
1075
- });
1076
- }); };
1077
- var deserializeAws_restJson1ResourceNotFoundException_event = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1078
- var parsedOutput, _a;
1079
- var _b;
1080
- return __generator(this, function (_c) {
1081
- switch (_c.label) {
1082
- case 0:
1083
- _a = [__assign({}, output)];
1084
- _b = {};
1085
- return [4, parseBody(output.body, context)];
1086
- case 1:
1087
- parsedOutput = __assign.apply(void 0, _a.concat([(_b.body = _c.sent(), _b)]));
1088
- return [2, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
718
+ if (event["ThrottlingException"] != null) {
719
+ return {
720
+ ThrottlingException: await deserializeAws_restJson1ThrottlingException_event(event["ThrottlingException"], context),
721
+ };
1089
722
  }
1090
- });
1091
- }); };
1092
- var deserializeAws_restJson1TextResponseEvent_event = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1093
- var contents, data;
1094
- return __generator(this, function (_a) {
1095
- switch (_a.label) {
1096
- case 0:
1097
- contents = {};
1098
- return [4, parseBody(output.body, context)];
1099
- case 1:
1100
- data = _a.sent();
1101
- Object.assign(contents, deserializeAws_restJson1TextResponseEvent(data, context));
1102
- return [2, contents];
723
+ if (event["InternalServerException"] != null) {
724
+ return {
725
+ InternalServerException: await deserializeAws_restJson1InternalServerException_event(event["InternalServerException"], context),
726
+ };
1103
727
  }
1104
- });
1105
- }); };
1106
- var deserializeAws_restJson1ThrottlingException_event = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1107
- var parsedOutput, _a;
1108
- var _b;
1109
- return __generator(this, function (_c) {
1110
- switch (_c.label) {
1111
- case 0:
1112
- _a = [__assign({}, output)];
1113
- _b = {};
1114
- return [4, parseBody(output.body, context)];
1115
- case 1:
1116
- parsedOutput = __assign.apply(void 0, _a.concat([(_b.body = _c.sent(), _b)]));
1117
- return [2, deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)];
728
+ if (event["ConflictException"] != null) {
729
+ return {
730
+ ConflictException: await deserializeAws_restJson1ConflictException_event(event["ConflictException"], context),
731
+ };
1118
732
  }
1119
- });
1120
- }); };
1121
- var deserializeAws_restJson1TranscriptEvent_event = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1122
- var contents, data;
1123
- return __generator(this, function (_a) {
1124
- switch (_a.label) {
1125
- case 0:
1126
- contents = {};
1127
- return [4, parseBody(output.body, context)];
1128
- case 1:
1129
- data = _a.sent();
1130
- Object.assign(contents, deserializeAws_restJson1TranscriptEvent(data, context));
1131
- return [2, contents];
733
+ if (event["DependencyFailedException"] != null) {
734
+ return {
735
+ DependencyFailedException: await deserializeAws_restJson1DependencyFailedException_event(event["DependencyFailedException"], context),
736
+ };
1132
737
  }
1133
- });
1134
- }); };
1135
- var deserializeAws_restJson1ValidationException_event = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1136
- var parsedOutput, _a;
1137
- var _b;
1138
- return __generator(this, function (_c) {
1139
- switch (_c.label) {
1140
- case 0:
1141
- _a = [__assign({}, output)];
1142
- _b = {};
1143
- return [4, parseBody(output.body, context)];
1144
- case 1:
1145
- parsedOutput = __assign.apply(void 0, _a.concat([(_b.body = _c.sent(), _b)]));
1146
- return [2, deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)];
738
+ if (event["BadGatewayException"] != null) {
739
+ return {
740
+ BadGatewayException: await deserializeAws_restJson1BadGatewayException_event(event["BadGatewayException"], context),
741
+ };
1147
742
  }
743
+ return { $unknown: output };
1148
744
  });
1149
- }); };
1150
- var serializeAws_restJson1ActiveContext = function (input, context) {
1151
- return __assign(__assign(__assign({}, (input.contextAttributes != null && {
1152
- contextAttributes: serializeAws_restJson1ActiveContextParametersMap(input.contextAttributes, context),
1153
- })), (input.name != null && { name: input.name })), (input.timeToLive != null && {
1154
- timeToLive: serializeAws_restJson1ActiveContextTimeToLive(input.timeToLive, context),
1155
- }));
1156
- };
1157
- var serializeAws_restJson1ActiveContextParametersMap = function (input, context) {
1158
- return Object.entries(input).reduce(function (acc, _a) {
1159
- var _b;
1160
- var _c = __read(_a, 2), key = _c[0], value = _c[1];
745
+ };
746
+ const deserializeAws_restJson1AccessDeniedException_event = async (output, context) => {
747
+ const parsedOutput = {
748
+ ...output,
749
+ body: await parseBody(output.body, context),
750
+ };
751
+ return deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
752
+ };
753
+ const deserializeAws_restJson1AudioResponseEvent_event = async (output, context) => {
754
+ const contents = {};
755
+ const data = await parseBody(output.body, context);
756
+ Object.assign(contents, deserializeAws_restJson1AudioResponseEvent(data, context));
757
+ return contents;
758
+ };
759
+ const deserializeAws_restJson1BadGatewayException_event = async (output, context) => {
760
+ const parsedOutput = {
761
+ ...output,
762
+ body: await parseBody(output.body, context),
763
+ };
764
+ return deserializeAws_restJson1BadGatewayExceptionResponse(parsedOutput, context);
765
+ };
766
+ const deserializeAws_restJson1ConflictException_event = async (output, context) => {
767
+ const parsedOutput = {
768
+ ...output,
769
+ body: await parseBody(output.body, context),
770
+ };
771
+ return deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
772
+ };
773
+ const deserializeAws_restJson1DependencyFailedException_event = async (output, context) => {
774
+ const parsedOutput = {
775
+ ...output,
776
+ body: await parseBody(output.body, context),
777
+ };
778
+ return deserializeAws_restJson1DependencyFailedExceptionResponse(parsedOutput, context);
779
+ };
780
+ const deserializeAws_restJson1HeartbeatEvent_event = async (output, context) => {
781
+ const contents = {};
782
+ const data = await parseBody(output.body, context);
783
+ Object.assign(contents, deserializeAws_restJson1HeartbeatEvent(data, context));
784
+ return contents;
785
+ };
786
+ const deserializeAws_restJson1IntentResultEvent_event = async (output, context) => {
787
+ const contents = {};
788
+ const data = await parseBody(output.body, context);
789
+ Object.assign(contents, deserializeAws_restJson1IntentResultEvent(data, context));
790
+ return contents;
791
+ };
792
+ const deserializeAws_restJson1InternalServerException_event = async (output, context) => {
793
+ const parsedOutput = {
794
+ ...output,
795
+ body: await parseBody(output.body, context),
796
+ };
797
+ return deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
798
+ };
799
+ const deserializeAws_restJson1PlaybackInterruptionEvent_event = async (output, context) => {
800
+ const contents = {};
801
+ const data = await parseBody(output.body, context);
802
+ Object.assign(contents, deserializeAws_restJson1PlaybackInterruptionEvent(data, context));
803
+ return contents;
804
+ };
805
+ const deserializeAws_restJson1ResourceNotFoundException_event = async (output, context) => {
806
+ const parsedOutput = {
807
+ ...output,
808
+ body: await parseBody(output.body, context),
809
+ };
810
+ return deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
811
+ };
812
+ const deserializeAws_restJson1TextResponseEvent_event = async (output, context) => {
813
+ const contents = {};
814
+ const data = await parseBody(output.body, context);
815
+ Object.assign(contents, deserializeAws_restJson1TextResponseEvent(data, context));
816
+ return contents;
817
+ };
818
+ const deserializeAws_restJson1ThrottlingException_event = async (output, context) => {
819
+ const parsedOutput = {
820
+ ...output,
821
+ body: await parseBody(output.body, context),
822
+ };
823
+ return deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
824
+ };
825
+ const deserializeAws_restJson1TranscriptEvent_event = async (output, context) => {
826
+ const contents = {};
827
+ const data = await parseBody(output.body, context);
828
+ Object.assign(contents, deserializeAws_restJson1TranscriptEvent(data, context));
829
+ return contents;
830
+ };
831
+ const deserializeAws_restJson1ValidationException_event = async (output, context) => {
832
+ const parsedOutput = {
833
+ ...output,
834
+ body: await parseBody(output.body, context),
835
+ };
836
+ return deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
837
+ };
838
+ const serializeAws_restJson1ActiveContext = (input, context) => {
839
+ return {
840
+ ...(input.contextAttributes != null && {
841
+ contextAttributes: serializeAws_restJson1ActiveContextParametersMap(input.contextAttributes, context),
842
+ }),
843
+ ...(input.name != null && { name: input.name }),
844
+ ...(input.timeToLive != null && {
845
+ timeToLive: serializeAws_restJson1ActiveContextTimeToLive(input.timeToLive, context),
846
+ }),
847
+ };
848
+ };
849
+ const serializeAws_restJson1ActiveContextParametersMap = (input, context) => {
850
+ return Object.entries(input).reduce((acc, [key, value]) => {
1161
851
  if (value === null) {
1162
852
  return acc;
1163
853
  }
1164
- return __assign(__assign({}, acc), (_b = {}, _b[key] = value, _b));
854
+ return {
855
+ ...acc,
856
+ [key]: value,
857
+ };
1165
858
  }, {});
1166
859
  };
1167
- var serializeAws_restJson1ActiveContextsList = function (input, context) {
860
+ const serializeAws_restJson1ActiveContextsList = (input, context) => {
1168
861
  return input
1169
- .filter(function (e) { return e != null; })
1170
- .map(function (entry) {
862
+ .filter((e) => e != null)
863
+ .map((entry) => {
1171
864
  return serializeAws_restJson1ActiveContext(entry, context);
1172
865
  });
1173
866
  };
1174
- var serializeAws_restJson1ActiveContextTimeToLive = function (input, context) {
1175
- return __assign(__assign({}, (input.timeToLiveInSeconds != null && { timeToLiveInSeconds: input.timeToLiveInSeconds })), (input.turnsToLive != null && { turnsToLive: input.turnsToLive }));
867
+ const serializeAws_restJson1ActiveContextTimeToLive = (input, context) => {
868
+ return {
869
+ ...(input.timeToLiveInSeconds != null && { timeToLiveInSeconds: input.timeToLiveInSeconds }),
870
+ ...(input.turnsToLive != null && { turnsToLive: input.turnsToLive }),
871
+ };
1176
872
  };
1177
- var serializeAws_restJson1AudioInputEvent = function (input, context) {
1178
- return __assign(__assign(__assign(__assign({}, (input.audioChunk != null && { audioChunk: context.base64Encoder(input.audioChunk) })), (input.clientTimestampMillis != null && { clientTimestampMillis: input.clientTimestampMillis })), (input.contentType != null && { contentType: input.contentType })), (input.eventId != null && { eventId: input.eventId }));
873
+ const serializeAws_restJson1AudioInputEvent = (input, context) => {
874
+ return {
875
+ ...(input.audioChunk != null && { audioChunk: context.base64Encoder(input.audioChunk) }),
876
+ ...(input.clientTimestampMillis != null && { clientTimestampMillis: input.clientTimestampMillis }),
877
+ ...(input.contentType != null && { contentType: input.contentType }),
878
+ ...(input.eventId != null && { eventId: input.eventId }),
879
+ };
1179
880
  };
1180
- var serializeAws_restJson1Button = function (input, context) {
1181
- return __assign(__assign({}, (input.text != null && { text: input.text })), (input.value != null && { value: input.value }));
881
+ const serializeAws_restJson1Button = (input, context) => {
882
+ return {
883
+ ...(input.text != null && { text: input.text }),
884
+ ...(input.value != null && { value: input.value }),
885
+ };
1182
886
  };
1183
- var serializeAws_restJson1ButtonsList = function (input, context) {
887
+ const serializeAws_restJson1ButtonsList = (input, context) => {
1184
888
  return input
1185
- .filter(function (e) { return e != null; })
1186
- .map(function (entry) {
889
+ .filter((e) => e != null)
890
+ .map((entry) => {
1187
891
  return serializeAws_restJson1Button(entry, context);
1188
892
  });
1189
893
  };
1190
- var serializeAws_restJson1ConfigurationEvent = function (input, context) {
1191
- return __assign(__assign(__assign(__assign(__assign(__assign(__assign({}, (input.clientTimestampMillis != null && { clientTimestampMillis: input.clientTimestampMillis })), (input.disablePlayback != null && { disablePlayback: input.disablePlayback })), (input.eventId != null && { eventId: input.eventId })), (input.requestAttributes != null && {
1192
- requestAttributes: serializeAws_restJson1StringMap(input.requestAttributes, context),
1193
- })), (input.responseContentType != null && { responseContentType: input.responseContentType })), (input.sessionState != null && {
1194
- sessionState: serializeAws_restJson1SessionState(input.sessionState, context),
1195
- })), (input.welcomeMessages != null && {
1196
- welcomeMessages: serializeAws_restJson1Messages(input.welcomeMessages, context),
1197
- }));
894
+ const serializeAws_restJson1ConfigurationEvent = (input, context) => {
895
+ return {
896
+ ...(input.clientTimestampMillis != null && { clientTimestampMillis: input.clientTimestampMillis }),
897
+ ...(input.disablePlayback != null && { disablePlayback: input.disablePlayback }),
898
+ ...(input.eventId != null && { eventId: input.eventId }),
899
+ ...(input.requestAttributes != null && {
900
+ requestAttributes: serializeAws_restJson1StringMap(input.requestAttributes, context),
901
+ }),
902
+ ...(input.responseContentType != null && { responseContentType: input.responseContentType }),
903
+ ...(input.sessionState != null && {
904
+ sessionState: serializeAws_restJson1SessionState(input.sessionState, context),
905
+ }),
906
+ ...(input.welcomeMessages != null && {
907
+ welcomeMessages: serializeAws_restJson1Messages(input.welcomeMessages, context),
908
+ }),
909
+ };
1198
910
  };
1199
- var serializeAws_restJson1DialogAction = function (input, context) {
1200
- return __assign(__assign(__assign(__assign({}, (input.slotElicitationStyle != null && { slotElicitationStyle: input.slotElicitationStyle })), (input.slotToElicit != null && { slotToElicit: input.slotToElicit })), (input.subSlotToElicit != null && {
1201
- subSlotToElicit: serializeAws_restJson1ElicitSubSlot(input.subSlotToElicit, context),
1202
- })), (input.type != null && { type: input.type }));
911
+ const serializeAws_restJson1DialogAction = (input, context) => {
912
+ return {
913
+ ...(input.slotElicitationStyle != null && { slotElicitationStyle: input.slotElicitationStyle }),
914
+ ...(input.slotToElicit != null && { slotToElicit: input.slotToElicit }),
915
+ ...(input.subSlotToElicit != null && {
916
+ subSlotToElicit: serializeAws_restJson1ElicitSubSlot(input.subSlotToElicit, context),
917
+ }),
918
+ ...(input.type != null && { type: input.type }),
919
+ };
1203
920
  };
1204
- var serializeAws_restJson1DisconnectionEvent = function (input, context) {
1205
- return __assign(__assign({}, (input.clientTimestampMillis != null && { clientTimestampMillis: input.clientTimestampMillis })), (input.eventId != null && { eventId: input.eventId }));
921
+ const serializeAws_restJson1DisconnectionEvent = (input, context) => {
922
+ return {
923
+ ...(input.clientTimestampMillis != null && { clientTimestampMillis: input.clientTimestampMillis }),
924
+ ...(input.eventId != null && { eventId: input.eventId }),
925
+ };
1206
926
  };
1207
- var serializeAws_restJson1DTMFInputEvent = function (input, context) {
1208
- return __assign(__assign(__assign({}, (input.clientTimestampMillis != null && { clientTimestampMillis: input.clientTimestampMillis })), (input.eventId != null && { eventId: input.eventId })), (input.inputCharacter != null && { inputCharacter: input.inputCharacter }));
927
+ const serializeAws_restJson1DTMFInputEvent = (input, context) => {
928
+ return {
929
+ ...(input.clientTimestampMillis != null && { clientTimestampMillis: input.clientTimestampMillis }),
930
+ ...(input.eventId != null && { eventId: input.eventId }),
931
+ ...(input.inputCharacter != null && { inputCharacter: input.inputCharacter }),
932
+ };
1209
933
  };
1210
- var serializeAws_restJson1ElicitSubSlot = function (input, context) {
1211
- return __assign(__assign({}, (input.name != null && { name: input.name })), (input.subSlotToElicit != null && {
1212
- subSlotToElicit: serializeAws_restJson1ElicitSubSlot(input.subSlotToElicit, context),
1213
- }));
934
+ const serializeAws_restJson1ElicitSubSlot = (input, context) => {
935
+ return {
936
+ ...(input.name != null && { name: input.name }),
937
+ ...(input.subSlotToElicit != null && {
938
+ subSlotToElicit: serializeAws_restJson1ElicitSubSlot(input.subSlotToElicit, context),
939
+ }),
940
+ };
1214
941
  };
1215
- var serializeAws_restJson1ImageResponseCard = function (input, context) {
1216
- return __assign(__assign(__assign(__assign({}, (input.buttons != null && { buttons: serializeAws_restJson1ButtonsList(input.buttons, context) })), (input.imageUrl != null && { imageUrl: input.imageUrl })), (input.subtitle != null && { subtitle: input.subtitle })), (input.title != null && { title: input.title }));
942
+ const serializeAws_restJson1ImageResponseCard = (input, context) => {
943
+ return {
944
+ ...(input.buttons != null && { buttons: serializeAws_restJson1ButtonsList(input.buttons, context) }),
945
+ ...(input.imageUrl != null && { imageUrl: input.imageUrl }),
946
+ ...(input.subtitle != null && { subtitle: input.subtitle }),
947
+ ...(input.title != null && { title: input.title }),
948
+ };
1217
949
  };
1218
- var serializeAws_restJson1Intent = function (input, context) {
1219
- return __assign(__assign(__assign(__assign({}, (input.confirmationState != null && { confirmationState: input.confirmationState })), (input.name != null && { name: input.name })), (input.slots != null && { slots: serializeAws_restJson1Slots(input.slots, context) })), (input.state != null && { state: input.state }));
950
+ const serializeAws_restJson1Intent = (input, context) => {
951
+ return {
952
+ ...(input.confirmationState != null && { confirmationState: input.confirmationState }),
953
+ ...(input.name != null && { name: input.name }),
954
+ ...(input.slots != null && { slots: serializeAws_restJson1Slots(input.slots, context) }),
955
+ ...(input.state != null && { state: input.state }),
956
+ };
1220
957
  };
1221
- var serializeAws_restJson1Message = function (input, context) {
1222
- return __assign(__assign(__assign({}, (input.content != null && { content: input.content })), (input.contentType != null && { contentType: input.contentType })), (input.imageResponseCard != null && {
1223
- imageResponseCard: serializeAws_restJson1ImageResponseCard(input.imageResponseCard, context),
1224
- }));
958
+ const serializeAws_restJson1Message = (input, context) => {
959
+ return {
960
+ ...(input.content != null && { content: input.content }),
961
+ ...(input.contentType != null && { contentType: input.contentType }),
962
+ ...(input.imageResponseCard != null && {
963
+ imageResponseCard: serializeAws_restJson1ImageResponseCard(input.imageResponseCard, context),
964
+ }),
965
+ };
1225
966
  };
1226
- var serializeAws_restJson1Messages = function (input, context) {
967
+ const serializeAws_restJson1Messages = (input, context) => {
1227
968
  return input
1228
- .filter(function (e) { return e != null; })
1229
- .map(function (entry) {
969
+ .filter((e) => e != null)
970
+ .map((entry) => {
1230
971
  return serializeAws_restJson1Message(entry, context);
1231
972
  });
1232
973
  };
1233
- var serializeAws_restJson1PlaybackCompletionEvent = function (input, context) {
1234
- return __assign(__assign({}, (input.clientTimestampMillis != null && { clientTimestampMillis: input.clientTimestampMillis })), (input.eventId != null && { eventId: input.eventId }));
974
+ const serializeAws_restJson1PlaybackCompletionEvent = (input, context) => {
975
+ return {
976
+ ...(input.clientTimestampMillis != null && { clientTimestampMillis: input.clientTimestampMillis }),
977
+ ...(input.eventId != null && { eventId: input.eventId }),
978
+ };
1235
979
  };
1236
- var serializeAws_restJson1RuntimeHintDetails = function (input, context) {
1237
- return __assign(__assign({}, (input.runtimeHintValues != null && {
1238
- runtimeHintValues: serializeAws_restJson1RuntimeHintValuesList(input.runtimeHintValues, context),
1239
- })), (input.subSlotHints != null && {
1240
- subSlotHints: serializeAws_restJson1SlotHintsSlotMap(input.subSlotHints, context),
1241
- }));
980
+ const serializeAws_restJson1RuntimeHintDetails = (input, context) => {
981
+ return {
982
+ ...(input.runtimeHintValues != null && {
983
+ runtimeHintValues: serializeAws_restJson1RuntimeHintValuesList(input.runtimeHintValues, context),
984
+ }),
985
+ ...(input.subSlotHints != null && {
986
+ subSlotHints: serializeAws_restJson1SlotHintsSlotMap(input.subSlotHints, context),
987
+ }),
988
+ };
1242
989
  };
1243
- var serializeAws_restJson1RuntimeHints = function (input, context) {
1244
- return __assign({}, (input.slotHints != null && { slotHints: serializeAws_restJson1SlotHintsIntentMap(input.slotHints, context) }));
990
+ const serializeAws_restJson1RuntimeHints = (input, context) => {
991
+ return {
992
+ ...(input.slotHints != null && { slotHints: serializeAws_restJson1SlotHintsIntentMap(input.slotHints, context) }),
993
+ };
1245
994
  };
1246
- var serializeAws_restJson1RuntimeHintValue = function (input, context) {
1247
- return __assign({}, (input.phrase != null && { phrase: input.phrase }));
995
+ const serializeAws_restJson1RuntimeHintValue = (input, context) => {
996
+ return {
997
+ ...(input.phrase != null && { phrase: input.phrase }),
998
+ };
1248
999
  };
1249
- var serializeAws_restJson1RuntimeHintValuesList = function (input, context) {
1000
+ const serializeAws_restJson1RuntimeHintValuesList = (input, context) => {
1250
1001
  return input
1251
- .filter(function (e) { return e != null; })
1252
- .map(function (entry) {
1002
+ .filter((e) => e != null)
1003
+ .map((entry) => {
1253
1004
  return serializeAws_restJson1RuntimeHintValue(entry, context);
1254
1005
  });
1255
1006
  };
1256
- var serializeAws_restJson1SessionState = function (input, context) {
1257
- return __assign(__assign(__assign(__assign(__assign(__assign({}, (input.activeContexts != null && {
1258
- activeContexts: serializeAws_restJson1ActiveContextsList(input.activeContexts, context),
1259
- })), (input.dialogAction != null && {
1260
- dialogAction: serializeAws_restJson1DialogAction(input.dialogAction, context),
1261
- })), (input.intent != null && { intent: serializeAws_restJson1Intent(input.intent, context) })), (input.originatingRequestId != null && { originatingRequestId: input.originatingRequestId })), (input.runtimeHints != null && {
1262
- runtimeHints: serializeAws_restJson1RuntimeHints(input.runtimeHints, context),
1263
- })), (input.sessionAttributes != null && {
1264
- sessionAttributes: serializeAws_restJson1StringMap(input.sessionAttributes, context),
1265
- }));
1266
- };
1267
- var serializeAws_restJson1Slot = function (input, context) {
1268
- return __assign(__assign(__assign(__assign({}, (input.shape != null && { shape: input.shape })), (input.subSlots != null && { subSlots: serializeAws_restJson1Slots(input.subSlots, context) })), (input.value != null && { value: serializeAws_restJson1Value(input.value, context) })), (input.values != null && { values: serializeAws_restJson1Values(input.values, context) }));
1269
- };
1270
- var serializeAws_restJson1SlotHintsIntentMap = function (input, context) {
1271
- return Object.entries(input).reduce(function (acc, _a) {
1272
- var _b;
1273
- var _c = __read(_a, 2), key = _c[0], value = _c[1];
1007
+ const serializeAws_restJson1SessionState = (input, context) => {
1008
+ return {
1009
+ ...(input.activeContexts != null && {
1010
+ activeContexts: serializeAws_restJson1ActiveContextsList(input.activeContexts, context),
1011
+ }),
1012
+ ...(input.dialogAction != null && {
1013
+ dialogAction: serializeAws_restJson1DialogAction(input.dialogAction, context),
1014
+ }),
1015
+ ...(input.intent != null && { intent: serializeAws_restJson1Intent(input.intent, context) }),
1016
+ ...(input.originatingRequestId != null && { originatingRequestId: input.originatingRequestId }),
1017
+ ...(input.runtimeHints != null && {
1018
+ runtimeHints: serializeAws_restJson1RuntimeHints(input.runtimeHints, context),
1019
+ }),
1020
+ ...(input.sessionAttributes != null && {
1021
+ sessionAttributes: serializeAws_restJson1StringMap(input.sessionAttributes, context),
1022
+ }),
1023
+ };
1024
+ };
1025
+ const serializeAws_restJson1Slot = (input, context) => {
1026
+ return {
1027
+ ...(input.shape != null && { shape: input.shape }),
1028
+ ...(input.subSlots != null && { subSlots: serializeAws_restJson1Slots(input.subSlots, context) }),
1029
+ ...(input.value != null && { value: serializeAws_restJson1Value(input.value, context) }),
1030
+ ...(input.values != null && { values: serializeAws_restJson1Values(input.values, context) }),
1031
+ };
1032
+ };
1033
+ const serializeAws_restJson1SlotHintsIntentMap = (input, context) => {
1034
+ return Object.entries(input).reduce((acc, [key, value]) => {
1274
1035
  if (value === null) {
1275
1036
  return acc;
1276
1037
  }
1277
- return __assign(__assign({}, acc), (_b = {}, _b[key] = serializeAws_restJson1SlotHintsSlotMap(value, context), _b));
1038
+ return {
1039
+ ...acc,
1040
+ [key]: serializeAws_restJson1SlotHintsSlotMap(value, context),
1041
+ };
1278
1042
  }, {});
1279
1043
  };
1280
- var serializeAws_restJson1SlotHintsSlotMap = function (input, context) {
1281
- return Object.entries(input).reduce(function (acc, _a) {
1282
- var _b;
1283
- var _c = __read(_a, 2), key = _c[0], value = _c[1];
1044
+ const serializeAws_restJson1SlotHintsSlotMap = (input, context) => {
1045
+ return Object.entries(input).reduce((acc, [key, value]) => {
1284
1046
  if (value === null) {
1285
1047
  return acc;
1286
1048
  }
1287
- return __assign(__assign({}, acc), (_b = {}, _b[key] = serializeAws_restJson1RuntimeHintDetails(value, context), _b));
1049
+ return {
1050
+ ...acc,
1051
+ [key]: serializeAws_restJson1RuntimeHintDetails(value, context),
1052
+ };
1288
1053
  }, {});
1289
1054
  };
1290
- var serializeAws_restJson1Slots = function (input, context) {
1291
- return Object.entries(input).reduce(function (acc, _a) {
1292
- var _b;
1293
- var _c = __read(_a, 2), key = _c[0], value = _c[1];
1055
+ const serializeAws_restJson1Slots = (input, context) => {
1056
+ return Object.entries(input).reduce((acc, [key, value]) => {
1294
1057
  if (value === null) {
1295
1058
  return acc;
1296
1059
  }
1297
- return __assign(__assign({}, acc), (_b = {}, _b[key] = serializeAws_restJson1Slot(value, context), _b));
1060
+ return {
1061
+ ...acc,
1062
+ [key]: serializeAws_restJson1Slot(value, context),
1063
+ };
1298
1064
  }, {});
1299
1065
  };
1300
- var serializeAws_restJson1StringList = function (input, context) {
1066
+ const serializeAws_restJson1StringList = (input, context) => {
1301
1067
  return input
1302
- .filter(function (e) { return e != null; })
1303
- .map(function (entry) {
1068
+ .filter((e) => e != null)
1069
+ .map((entry) => {
1304
1070
  return entry;
1305
1071
  });
1306
1072
  };
1307
- var serializeAws_restJson1StringMap = function (input, context) {
1308
- return Object.entries(input).reduce(function (acc, _a) {
1309
- var _b;
1310
- var _c = __read(_a, 2), key = _c[0], value = _c[1];
1073
+ const serializeAws_restJson1StringMap = (input, context) => {
1074
+ return Object.entries(input).reduce((acc, [key, value]) => {
1311
1075
  if (value === null) {
1312
1076
  return acc;
1313
1077
  }
1314
- return __assign(__assign({}, acc), (_b = {}, _b[key] = value, _b));
1078
+ return {
1079
+ ...acc,
1080
+ [key]: value,
1081
+ };
1315
1082
  }, {});
1316
1083
  };
1317
- var serializeAws_restJson1TextInputEvent = function (input, context) {
1318
- return __assign(__assign(__assign({}, (input.clientTimestampMillis != null && { clientTimestampMillis: input.clientTimestampMillis })), (input.eventId != null && { eventId: input.eventId })), (input.text != null && { text: input.text }));
1084
+ const serializeAws_restJson1TextInputEvent = (input, context) => {
1085
+ return {
1086
+ ...(input.clientTimestampMillis != null && { clientTimestampMillis: input.clientTimestampMillis }),
1087
+ ...(input.eventId != null && { eventId: input.eventId }),
1088
+ ...(input.text != null && { text: input.text }),
1089
+ };
1319
1090
  };
1320
- var serializeAws_restJson1Value = function (input, context) {
1321
- return __assign(__assign(__assign({}, (input.interpretedValue != null && { interpretedValue: input.interpretedValue })), (input.originalValue != null && { originalValue: input.originalValue })), (input.resolvedValues != null && {
1322
- resolvedValues: serializeAws_restJson1StringList(input.resolvedValues, context),
1323
- }));
1091
+ const serializeAws_restJson1Value = (input, context) => {
1092
+ return {
1093
+ ...(input.interpretedValue != null && { interpretedValue: input.interpretedValue }),
1094
+ ...(input.originalValue != null && { originalValue: input.originalValue }),
1095
+ ...(input.resolvedValues != null && {
1096
+ resolvedValues: serializeAws_restJson1StringList(input.resolvedValues, context),
1097
+ }),
1098
+ };
1324
1099
  };
1325
- var serializeAws_restJson1Values = function (input, context) {
1100
+ const serializeAws_restJson1Values = (input, context) => {
1326
1101
  return input
1327
- .filter(function (e) { return e != null; })
1328
- .map(function (entry) {
1102
+ .filter((e) => e != null)
1103
+ .map((entry) => {
1329
1104
  return serializeAws_restJson1Slot(entry, context);
1330
1105
  });
1331
1106
  };
1332
- var deserializeAws_restJson1ActiveContext = function (output, context) {
1107
+ const deserializeAws_restJson1ActiveContext = (output, context) => {
1333
1108
  return {
1334
1109
  contextAttributes: output.contextAttributes != null
1335
1110
  ? deserializeAws_restJson1ActiveContextParametersMap(output.contextAttributes, context)
@@ -1340,20 +1115,21 @@ var deserializeAws_restJson1ActiveContext = function (output, context) {
1340
1115
  : undefined,
1341
1116
  };
1342
1117
  };
1343
- var deserializeAws_restJson1ActiveContextParametersMap = function (output, context) {
1344
- return Object.entries(output).reduce(function (acc, _a) {
1345
- var _b;
1346
- var _c = __read(_a, 2), key = _c[0], value = _c[1];
1118
+ const deserializeAws_restJson1ActiveContextParametersMap = (output, context) => {
1119
+ return Object.entries(output).reduce((acc, [key, value]) => {
1347
1120
  if (value === null) {
1348
1121
  return acc;
1349
1122
  }
1350
- return __assign(__assign({}, acc), (_b = {}, _b[key] = __expectString(value), _b));
1123
+ return {
1124
+ ...acc,
1125
+ [key]: __expectString(value),
1126
+ };
1351
1127
  }, {});
1352
1128
  };
1353
- var deserializeAws_restJson1ActiveContextsList = function (output, context) {
1354
- var retVal = (output || [])
1355
- .filter(function (e) { return e != null; })
1356
- .map(function (entry) {
1129
+ const deserializeAws_restJson1ActiveContextsList = (output, context) => {
1130
+ const retVal = (output || [])
1131
+ .filter((e) => e != null)
1132
+ .map((entry) => {
1357
1133
  if (entry === null) {
1358
1134
  return null;
1359
1135
  }
@@ -1361,29 +1137,29 @@ var deserializeAws_restJson1ActiveContextsList = function (output, context) {
1361
1137
  });
1362
1138
  return retVal;
1363
1139
  };
1364
- var deserializeAws_restJson1ActiveContextTimeToLive = function (output, context) {
1140
+ const deserializeAws_restJson1ActiveContextTimeToLive = (output, context) => {
1365
1141
  return {
1366
1142
  timeToLiveInSeconds: __expectInt32(output.timeToLiveInSeconds),
1367
1143
  turnsToLive: __expectInt32(output.turnsToLive),
1368
1144
  };
1369
1145
  };
1370
- var deserializeAws_restJson1AudioResponseEvent = function (output, context) {
1146
+ const deserializeAws_restJson1AudioResponseEvent = (output, context) => {
1371
1147
  return {
1372
1148
  audioChunk: output.audioChunk != null ? context.base64Decoder(output.audioChunk) : undefined,
1373
1149
  contentType: __expectString(output.contentType),
1374
1150
  eventId: __expectString(output.eventId),
1375
1151
  };
1376
1152
  };
1377
- var deserializeAws_restJson1Button = function (output, context) {
1153
+ const deserializeAws_restJson1Button = (output, context) => {
1378
1154
  return {
1379
1155
  text: __expectString(output.text),
1380
1156
  value: __expectString(output.value),
1381
1157
  };
1382
1158
  };
1383
- var deserializeAws_restJson1ButtonsList = function (output, context) {
1384
- var retVal = (output || [])
1385
- .filter(function (e) { return e != null; })
1386
- .map(function (entry) {
1159
+ const deserializeAws_restJson1ButtonsList = (output, context) => {
1160
+ const retVal = (output || [])
1161
+ .filter((e) => e != null)
1162
+ .map((entry) => {
1387
1163
  if (entry === null) {
1388
1164
  return null;
1389
1165
  }
@@ -1391,12 +1167,12 @@ var deserializeAws_restJson1ButtonsList = function (output, context) {
1391
1167
  });
1392
1168
  return retVal;
1393
1169
  };
1394
- var deserializeAws_restJson1ConfidenceScore = function (output, context) {
1170
+ const deserializeAws_restJson1ConfidenceScore = (output, context) => {
1395
1171
  return {
1396
1172
  score: __limitedParseDouble(output.score),
1397
1173
  };
1398
1174
  };
1399
- var deserializeAws_restJson1DialogAction = function (output, context) {
1175
+ const deserializeAws_restJson1DialogAction = (output, context) => {
1400
1176
  return {
1401
1177
  slotElicitationStyle: __expectString(output.slotElicitationStyle),
1402
1178
  slotToElicit: __expectString(output.slotToElicit),
@@ -1406,7 +1182,7 @@ var deserializeAws_restJson1DialogAction = function (output, context) {
1406
1182
  type: __expectString(output.type),
1407
1183
  };
1408
1184
  };
1409
- var deserializeAws_restJson1ElicitSubSlot = function (output, context) {
1185
+ const deserializeAws_restJson1ElicitSubSlot = (output, context) => {
1410
1186
  return {
1411
1187
  name: __expectString(output.name),
1412
1188
  subSlotToElicit: output.subSlotToElicit != null
@@ -1414,12 +1190,12 @@ var deserializeAws_restJson1ElicitSubSlot = function (output, context) {
1414
1190
  : undefined,
1415
1191
  };
1416
1192
  };
1417
- var deserializeAws_restJson1HeartbeatEvent = function (output, context) {
1193
+ const deserializeAws_restJson1HeartbeatEvent = (output, context) => {
1418
1194
  return {
1419
1195
  eventId: __expectString(output.eventId),
1420
1196
  };
1421
1197
  };
1422
- var deserializeAws_restJson1ImageResponseCard = function (output, context) {
1198
+ const deserializeAws_restJson1ImageResponseCard = (output, context) => {
1423
1199
  return {
1424
1200
  buttons: output.buttons != null ? deserializeAws_restJson1ButtonsList(output.buttons, context) : undefined,
1425
1201
  imageUrl: __expectString(output.imageUrl),
@@ -1427,7 +1203,7 @@ var deserializeAws_restJson1ImageResponseCard = function (output, context) {
1427
1203
  title: __expectString(output.title),
1428
1204
  };
1429
1205
  };
1430
- var deserializeAws_restJson1Intent = function (output, context) {
1206
+ const deserializeAws_restJson1Intent = (output, context) => {
1431
1207
  return {
1432
1208
  confirmationState: __expectString(output.confirmationState),
1433
1209
  name: __expectString(output.name),
@@ -1435,7 +1211,7 @@ var deserializeAws_restJson1Intent = function (output, context) {
1435
1211
  state: __expectString(output.state),
1436
1212
  };
1437
1213
  };
1438
- var deserializeAws_restJson1IntentResultEvent = function (output, context) {
1214
+ const deserializeAws_restJson1IntentResultEvent = (output, context) => {
1439
1215
  return {
1440
1216
  eventId: __expectString(output.eventId),
1441
1217
  inputMode: __expectString(output.inputMode),
@@ -1449,7 +1225,7 @@ var deserializeAws_restJson1IntentResultEvent = function (output, context) {
1449
1225
  sessionState: output.sessionState != null ? deserializeAws_restJson1SessionState(output.sessionState, context) : undefined,
1450
1226
  };
1451
1227
  };
1452
- var deserializeAws_restJson1Interpretation = function (output, context) {
1228
+ const deserializeAws_restJson1Interpretation = (output, context) => {
1453
1229
  return {
1454
1230
  intent: output.intent != null ? deserializeAws_restJson1Intent(output.intent, context) : undefined,
1455
1231
  nluConfidence: output.nluConfidence != null ? deserializeAws_restJson1ConfidenceScore(output.nluConfidence, context) : undefined,
@@ -1458,10 +1234,10 @@ var deserializeAws_restJson1Interpretation = function (output, context) {
1458
1234
  : undefined,
1459
1235
  };
1460
1236
  };
1461
- var deserializeAws_restJson1Interpretations = function (output, context) {
1462
- var retVal = (output || [])
1463
- .filter(function (e) { return e != null; })
1464
- .map(function (entry) {
1237
+ const deserializeAws_restJson1Interpretations = (output, context) => {
1238
+ const retVal = (output || [])
1239
+ .filter((e) => e != null)
1240
+ .map((entry) => {
1465
1241
  if (entry === null) {
1466
1242
  return null;
1467
1243
  }
@@ -1469,7 +1245,7 @@ var deserializeAws_restJson1Interpretations = function (output, context) {
1469
1245
  });
1470
1246
  return retVal;
1471
1247
  };
1472
- var deserializeAws_restJson1Message = function (output, context) {
1248
+ const deserializeAws_restJson1Message = (output, context) => {
1473
1249
  return {
1474
1250
  content: __expectString(output.content),
1475
1251
  contentType: __expectString(output.contentType),
@@ -1478,10 +1254,10 @@ var deserializeAws_restJson1Message = function (output, context) {
1478
1254
  : undefined,
1479
1255
  };
1480
1256
  };
1481
- var deserializeAws_restJson1Messages = function (output, context) {
1482
- var retVal = (output || [])
1483
- .filter(function (e) { return e != null; })
1484
- .map(function (entry) {
1257
+ const deserializeAws_restJson1Messages = (output, context) => {
1258
+ const retVal = (output || [])
1259
+ .filter((e) => e != null)
1260
+ .map((entry) => {
1485
1261
  if (entry === null) {
1486
1262
  return null;
1487
1263
  }
@@ -1489,14 +1265,14 @@ var deserializeAws_restJson1Messages = function (output, context) {
1489
1265
  });
1490
1266
  return retVal;
1491
1267
  };
1492
- var deserializeAws_restJson1PlaybackInterruptionEvent = function (output, context) {
1268
+ const deserializeAws_restJson1PlaybackInterruptionEvent = (output, context) => {
1493
1269
  return {
1494
1270
  causedByEventId: __expectString(output.causedByEventId),
1495
1271
  eventId: __expectString(output.eventId),
1496
1272
  eventReason: __expectString(output.eventReason),
1497
1273
  };
1498
1274
  };
1499
- var deserializeAws_restJson1RuntimeHintDetails = function (output, context) {
1275
+ const deserializeAws_restJson1RuntimeHintDetails = (output, context) => {
1500
1276
  return {
1501
1277
  runtimeHintValues: output.runtimeHintValues != null
1502
1278
  ? deserializeAws_restJson1RuntimeHintValuesList(output.runtimeHintValues, context)
@@ -1504,20 +1280,20 @@ var deserializeAws_restJson1RuntimeHintDetails = function (output, context) {
1504
1280
  subSlotHints: output.subSlotHints != null ? deserializeAws_restJson1SlotHintsSlotMap(output.subSlotHints, context) : undefined,
1505
1281
  };
1506
1282
  };
1507
- var deserializeAws_restJson1RuntimeHints = function (output, context) {
1283
+ const deserializeAws_restJson1RuntimeHints = (output, context) => {
1508
1284
  return {
1509
1285
  slotHints: output.slotHints != null ? deserializeAws_restJson1SlotHintsIntentMap(output.slotHints, context) : undefined,
1510
1286
  };
1511
1287
  };
1512
- var deserializeAws_restJson1RuntimeHintValue = function (output, context) {
1288
+ const deserializeAws_restJson1RuntimeHintValue = (output, context) => {
1513
1289
  return {
1514
1290
  phrase: __expectString(output.phrase),
1515
1291
  };
1516
1292
  };
1517
- var deserializeAws_restJson1RuntimeHintValuesList = function (output, context) {
1518
- var retVal = (output || [])
1519
- .filter(function (e) { return e != null; })
1520
- .map(function (entry) {
1293
+ const deserializeAws_restJson1RuntimeHintValuesList = (output, context) => {
1294
+ const retVal = (output || [])
1295
+ .filter((e) => e != null)
1296
+ .map((entry) => {
1521
1297
  if (entry === null) {
1522
1298
  return null;
1523
1299
  }
@@ -1525,7 +1301,7 @@ var deserializeAws_restJson1RuntimeHintValuesList = function (output, context) {
1525
1301
  });
1526
1302
  return retVal;
1527
1303
  };
1528
- var deserializeAws_restJson1SentimentResponse = function (output, context) {
1304
+ const deserializeAws_restJson1SentimentResponse = (output, context) => {
1529
1305
  return {
1530
1306
  sentiment: __expectString(output.sentiment),
1531
1307
  sentimentScore: output.sentimentScore != null
@@ -1533,7 +1309,7 @@ var deserializeAws_restJson1SentimentResponse = function (output, context) {
1533
1309
  : undefined,
1534
1310
  };
1535
1311
  };
1536
- var deserializeAws_restJson1SentimentScore = function (output, context) {
1312
+ const deserializeAws_restJson1SentimentScore = (output, context) => {
1537
1313
  return {
1538
1314
  mixed: __limitedParseDouble(output.mixed),
1539
1315
  negative: __limitedParseDouble(output.negative),
@@ -1541,7 +1317,7 @@ var deserializeAws_restJson1SentimentScore = function (output, context) {
1541
1317
  positive: __limitedParseDouble(output.positive),
1542
1318
  };
1543
1319
  };
1544
- var deserializeAws_restJson1SessionState = function (output, context) {
1320
+ const deserializeAws_restJson1SessionState = (output, context) => {
1545
1321
  return {
1546
1322
  activeContexts: output.activeContexts != null
1547
1323
  ? deserializeAws_restJson1ActiveContextsList(output.activeContexts, context)
@@ -1555,7 +1331,7 @@ var deserializeAws_restJson1SessionState = function (output, context) {
1555
1331
  : undefined,
1556
1332
  };
1557
1333
  };
1558
- var deserializeAws_restJson1Slot = function (output, context) {
1334
+ const deserializeAws_restJson1Slot = (output, context) => {
1559
1335
  return {
1560
1336
  shape: __expectString(output.shape),
1561
1337
  subSlots: output.subSlots != null ? deserializeAws_restJson1Slots(output.subSlots, context) : undefined,
@@ -1563,40 +1339,43 @@ var deserializeAws_restJson1Slot = function (output, context) {
1563
1339
  values: output.values != null ? deserializeAws_restJson1Values(output.values, context) : undefined,
1564
1340
  };
1565
1341
  };
1566
- var deserializeAws_restJson1SlotHintsIntentMap = function (output, context) {
1567
- return Object.entries(output).reduce(function (acc, _a) {
1568
- var _b;
1569
- var _c = __read(_a, 2), key = _c[0], value = _c[1];
1342
+ const deserializeAws_restJson1SlotHintsIntentMap = (output, context) => {
1343
+ return Object.entries(output).reduce((acc, [key, value]) => {
1570
1344
  if (value === null) {
1571
1345
  return acc;
1572
1346
  }
1573
- return __assign(__assign({}, acc), (_b = {}, _b[key] = deserializeAws_restJson1SlotHintsSlotMap(value, context), _b));
1347
+ return {
1348
+ ...acc,
1349
+ [key]: deserializeAws_restJson1SlotHintsSlotMap(value, context),
1350
+ };
1574
1351
  }, {});
1575
1352
  };
1576
- var deserializeAws_restJson1SlotHintsSlotMap = function (output, context) {
1577
- return Object.entries(output).reduce(function (acc, _a) {
1578
- var _b;
1579
- var _c = __read(_a, 2), key = _c[0], value = _c[1];
1353
+ const deserializeAws_restJson1SlotHintsSlotMap = (output, context) => {
1354
+ return Object.entries(output).reduce((acc, [key, value]) => {
1580
1355
  if (value === null) {
1581
1356
  return acc;
1582
1357
  }
1583
- return __assign(__assign({}, acc), (_b = {}, _b[key] = deserializeAws_restJson1RuntimeHintDetails(value, context), _b));
1358
+ return {
1359
+ ...acc,
1360
+ [key]: deserializeAws_restJson1RuntimeHintDetails(value, context),
1361
+ };
1584
1362
  }, {});
1585
1363
  };
1586
- var deserializeAws_restJson1Slots = function (output, context) {
1587
- return Object.entries(output).reduce(function (acc, _a) {
1588
- var _b;
1589
- var _c = __read(_a, 2), key = _c[0], value = _c[1];
1364
+ const deserializeAws_restJson1Slots = (output, context) => {
1365
+ return Object.entries(output).reduce((acc, [key, value]) => {
1590
1366
  if (value === null) {
1591
1367
  return acc;
1592
1368
  }
1593
- return __assign(__assign({}, acc), (_b = {}, _b[key] = deserializeAws_restJson1Slot(value, context), _b));
1369
+ return {
1370
+ ...acc,
1371
+ [key]: deserializeAws_restJson1Slot(value, context),
1372
+ };
1594
1373
  }, {});
1595
1374
  };
1596
- var deserializeAws_restJson1StringList = function (output, context) {
1597
- var retVal = (output || [])
1598
- .filter(function (e) { return e != null; })
1599
- .map(function (entry) {
1375
+ const deserializeAws_restJson1StringList = (output, context) => {
1376
+ const retVal = (output || [])
1377
+ .filter((e) => e != null)
1378
+ .map((entry) => {
1600
1379
  if (entry === null) {
1601
1380
  return null;
1602
1381
  }
@@ -1604,39 +1383,40 @@ var deserializeAws_restJson1StringList = function (output, context) {
1604
1383
  });
1605
1384
  return retVal;
1606
1385
  };
1607
- var deserializeAws_restJson1StringMap = function (output, context) {
1608
- return Object.entries(output).reduce(function (acc, _a) {
1609
- var _b;
1610
- var _c = __read(_a, 2), key = _c[0], value = _c[1];
1386
+ const deserializeAws_restJson1StringMap = (output, context) => {
1387
+ return Object.entries(output).reduce((acc, [key, value]) => {
1611
1388
  if (value === null) {
1612
1389
  return acc;
1613
1390
  }
1614
- return __assign(__assign({}, acc), (_b = {}, _b[key] = __expectString(value), _b));
1391
+ return {
1392
+ ...acc,
1393
+ [key]: __expectString(value),
1394
+ };
1615
1395
  }, {});
1616
1396
  };
1617
- var deserializeAws_restJson1TextResponseEvent = function (output, context) {
1397
+ const deserializeAws_restJson1TextResponseEvent = (output, context) => {
1618
1398
  return {
1619
1399
  eventId: __expectString(output.eventId),
1620
1400
  messages: output.messages != null ? deserializeAws_restJson1Messages(output.messages, context) : undefined,
1621
1401
  };
1622
1402
  };
1623
- var deserializeAws_restJson1TranscriptEvent = function (output, context) {
1403
+ const deserializeAws_restJson1TranscriptEvent = (output, context) => {
1624
1404
  return {
1625
1405
  eventId: __expectString(output.eventId),
1626
1406
  transcript: __expectString(output.transcript),
1627
1407
  };
1628
1408
  };
1629
- var deserializeAws_restJson1Value = function (output, context) {
1409
+ const deserializeAws_restJson1Value = (output, context) => {
1630
1410
  return {
1631
1411
  interpretedValue: __expectString(output.interpretedValue),
1632
1412
  originalValue: __expectString(output.originalValue),
1633
1413
  resolvedValues: output.resolvedValues != null ? deserializeAws_restJson1StringList(output.resolvedValues, context) : undefined,
1634
1414
  };
1635
1415
  };
1636
- var deserializeAws_restJson1Values = function (output, context) {
1637
- var retVal = (output || [])
1638
- .filter(function (e) { return e != null; })
1639
- .map(function (entry) {
1416
+ const deserializeAws_restJson1Values = (output, context) => {
1417
+ const retVal = (output || [])
1418
+ .filter((e) => e != null)
1419
+ .map((entry) => {
1640
1420
  if (entry === null) {
1641
1421
  return null;
1642
1422
  }
@@ -1644,57 +1424,39 @@ var deserializeAws_restJson1Values = function (output, context) {
1644
1424
  });
1645
1425
  return retVal;
1646
1426
  };
1647
- var deserializeMetadata = function (output) {
1648
- var _a;
1649
- return ({
1650
- httpStatusCode: output.statusCode,
1651
- requestId: (_a = output.headers["x-amzn-requestid"]) !== null && _a !== void 0 ? _a : output.headers["x-amzn-request-id"],
1652
- extendedRequestId: output.headers["x-amz-id-2"],
1653
- cfId: output.headers["x-amz-cf-id"],
1654
- });
1655
- };
1656
- var collectBody = function (streamBody, context) {
1657
- if (streamBody === void 0) { streamBody = new Uint8Array(); }
1427
+ const deserializeMetadata = (output) => ({
1428
+ httpStatusCode: output.statusCode,
1429
+ requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"],
1430
+ extendedRequestId: output.headers["x-amz-id-2"],
1431
+ cfId: output.headers["x-amz-cf-id"],
1432
+ });
1433
+ const collectBody = (streamBody = new Uint8Array(), context) => {
1658
1434
  if (streamBody instanceof Uint8Array) {
1659
1435
  return Promise.resolve(streamBody);
1660
1436
  }
1661
1437
  return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
1662
1438
  };
1663
- var collectBodyString = function (streamBody, context) {
1664
- return collectBody(streamBody, context).then(function (body) { return context.utf8Encoder(body); });
1665
- };
1666
- var isSerializableHeaderValue = function (value) {
1667
- return value !== undefined &&
1668
- value !== null &&
1669
- value !== "" &&
1670
- (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
1671
- (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
1672
- };
1673
- var parseBody = function (streamBody, context) {
1674
- return collectBodyString(streamBody, context).then(function (encoded) {
1675
- if (encoded.length) {
1676
- return JSON.parse(encoded);
1677
- }
1678
- return {};
1679
- });
1680
- };
1681
- var parseErrorBody = function (errorBody, context) { return __awaiter(void 0, void 0, void 0, function () {
1682
- var value;
1683
- var _a;
1684
- return __generator(this, function (_b) {
1685
- switch (_b.label) {
1686
- case 0: return [4, parseBody(errorBody, context)];
1687
- case 1:
1688
- value = _b.sent();
1689
- value.message = (_a = value.message) !== null && _a !== void 0 ? _a : value.Message;
1690
- return [2, value];
1691
- }
1692
- });
1693
- }); };
1694
- var loadRestJsonErrorCode = function (output, data) {
1695
- var findKey = function (object, key) { return Object.keys(object).find(function (k) { return k.toLowerCase() === key.toLowerCase(); }); };
1696
- var sanitizeErrorCode = function (rawValue) {
1697
- var cleanValue = rawValue;
1439
+ const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
1440
+ const isSerializableHeaderValue = (value) => value !== undefined &&
1441
+ value !== null &&
1442
+ value !== "" &&
1443
+ (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
1444
+ (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
1445
+ const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
1446
+ if (encoded.length) {
1447
+ return JSON.parse(encoded);
1448
+ }
1449
+ return {};
1450
+ });
1451
+ const parseErrorBody = async (errorBody, context) => {
1452
+ const value = await parseBody(errorBody, context);
1453
+ value.message = value.message ?? value.Message;
1454
+ return value;
1455
+ };
1456
+ const loadRestJsonErrorCode = (output, data) => {
1457
+ const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
1458
+ const sanitizeErrorCode = (rawValue) => {
1459
+ let cleanValue = rawValue;
1698
1460
  if (typeof cleanValue === "number") {
1699
1461
  cleanValue = cleanValue.toString();
1700
1462
  }
@@ -1709,7 +1471,7 @@ var loadRestJsonErrorCode = function (output, data) {
1709
1471
  }
1710
1472
  return cleanValue;
1711
1473
  };
1712
- var headerKey = findKey(output.headers, "x-amzn-errortype");
1474
+ const headerKey = findKey(output.headers, "x-amzn-errortype");
1713
1475
  if (headerKey !== undefined) {
1714
1476
  return sanitizeErrorCode(output.headers[headerKey]);
1715
1477
  }