@aws-sdk/client-lex-runtime-v2 3.185.0 → 3.188.0

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