@aws-sdk/client-dynamodb-streams 3.183.0 → 3.186.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,284 +1,356 @@
1
+ import { __assign, __awaiter, __generator, __read } from "tslib";
1
2
  import { HttpRequest as __HttpRequest } from "@aws-sdk/protocol-http";
2
3
  import { decorateServiceException as __decorateServiceException, expectBoolean as __expectBoolean, expectLong as __expectLong, expectNonNull as __expectNonNull, expectNumber as __expectNumber, expectString as __expectString, expectUnion as __expectUnion, parseEpochTimestamp as __parseEpochTimestamp, throwDefaultError, } from "@aws-sdk/smithy-client";
3
4
  import { DynamoDBStreamsServiceException as __BaseException } from "../models/DynamoDBStreamsServiceException";
4
5
  import { ExpiredIteratorException, InternalServerError, LimitExceededException, ResourceNotFoundException, TrimmedDataAccessException, } from "../models/models_0";
5
- export const serializeAws_json1_0DescribeStreamCommand = async (input, context) => {
6
- const headers = {
7
- "content-type": "application/x-amz-json-1.0",
8
- "x-amz-target": "DynamoDBStreams_20120810.DescribeStream",
9
- };
10
- let body;
11
- body = JSON.stringify(serializeAws_json1_0DescribeStreamInput(input, context));
12
- return buildHttpRpcRequest(context, headers, "/", undefined, body);
13
- };
14
- export const serializeAws_json1_0GetRecordsCommand = async (input, context) => {
15
- const headers = {
16
- "content-type": "application/x-amz-json-1.0",
17
- "x-amz-target": "DynamoDBStreams_20120810.GetRecords",
18
- };
19
- let body;
20
- body = JSON.stringify(serializeAws_json1_0GetRecordsInput(input, context));
21
- return buildHttpRpcRequest(context, headers, "/", undefined, body);
22
- };
23
- export const serializeAws_json1_0GetShardIteratorCommand = async (input, context) => {
24
- const headers = {
25
- "content-type": "application/x-amz-json-1.0",
26
- "x-amz-target": "DynamoDBStreams_20120810.GetShardIterator",
27
- };
28
- let body;
29
- body = JSON.stringify(serializeAws_json1_0GetShardIteratorInput(input, context));
30
- return buildHttpRpcRequest(context, headers, "/", undefined, body);
31
- };
32
- export const serializeAws_json1_0ListStreamsCommand = async (input, context) => {
33
- const headers = {
34
- "content-type": "application/x-amz-json-1.0",
35
- "x-amz-target": "DynamoDBStreams_20120810.ListStreams",
36
- };
37
- let body;
38
- body = JSON.stringify(serializeAws_json1_0ListStreamsInput(input, context));
39
- return buildHttpRpcRequest(context, headers, "/", undefined, body);
40
- };
41
- export const deserializeAws_json1_0DescribeStreamCommand = async (output, context) => {
42
- if (output.statusCode >= 300) {
43
- return deserializeAws_json1_0DescribeStreamCommandError(output, context);
44
- }
45
- const data = await parseBody(output.body, context);
46
- let contents = {};
47
- contents = deserializeAws_json1_0DescribeStreamOutput(data, context);
48
- const response = {
49
- $metadata: deserializeMetadata(output),
50
- ...contents,
51
- };
52
- return Promise.resolve(response);
53
- };
54
- const deserializeAws_json1_0DescribeStreamCommandError = async (output, context) => {
55
- const parsedOutput = {
56
- ...output,
57
- body: await parseErrorBody(output.body, context),
58
- };
59
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
60
- switch (errorCode) {
61
- case "InternalServerError":
62
- case "com.amazonaws.dynamodbstreams#InternalServerError":
63
- throw await deserializeAws_json1_0InternalServerErrorResponse(parsedOutput, context);
64
- case "ResourceNotFoundException":
65
- case "com.amazonaws.dynamodbstreams#ResourceNotFoundException":
66
- throw await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context);
67
- default:
68
- const parsedBody = parsedOutput.body;
69
- throwDefaultError({
70
- output,
71
- parsedBody,
72
- exceptionCtor: __BaseException,
73
- errorCode,
74
- });
75
- }
76
- };
77
- export const deserializeAws_json1_0GetRecordsCommand = async (output, context) => {
78
- if (output.statusCode >= 300) {
79
- return deserializeAws_json1_0GetRecordsCommandError(output, context);
80
- }
81
- const data = await parseBody(output.body, context);
82
- let contents = {};
83
- contents = deserializeAws_json1_0GetRecordsOutput(data, context);
84
- const response = {
85
- $metadata: deserializeMetadata(output),
86
- ...contents,
87
- };
88
- return Promise.resolve(response);
89
- };
90
- const deserializeAws_json1_0GetRecordsCommandError = async (output, context) => {
91
- const parsedOutput = {
92
- ...output,
93
- body: await parseErrorBody(output.body, context),
94
- };
95
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
96
- switch (errorCode) {
97
- case "ExpiredIteratorException":
98
- case "com.amazonaws.dynamodbstreams#ExpiredIteratorException":
99
- throw await deserializeAws_json1_0ExpiredIteratorExceptionResponse(parsedOutput, context);
100
- case "InternalServerError":
101
- case "com.amazonaws.dynamodbstreams#InternalServerError":
102
- throw await deserializeAws_json1_0InternalServerErrorResponse(parsedOutput, context);
103
- case "LimitExceededException":
104
- case "com.amazonaws.dynamodbstreams#LimitExceededException":
105
- throw await deserializeAws_json1_0LimitExceededExceptionResponse(parsedOutput, context);
106
- case "ResourceNotFoundException":
107
- case "com.amazonaws.dynamodbstreams#ResourceNotFoundException":
108
- throw await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context);
109
- case "TrimmedDataAccessException":
110
- case "com.amazonaws.dynamodbstreams#TrimmedDataAccessException":
111
- throw await deserializeAws_json1_0TrimmedDataAccessExceptionResponse(parsedOutput, context);
112
- default:
113
- const parsedBody = parsedOutput.body;
114
- throwDefaultError({
115
- output,
116
- parsedBody,
117
- exceptionCtor: __BaseException,
118
- errorCode,
119
- });
120
- }
121
- };
122
- export const deserializeAws_json1_0GetShardIteratorCommand = async (output, context) => {
123
- if (output.statusCode >= 300) {
124
- return deserializeAws_json1_0GetShardIteratorCommandError(output, context);
125
- }
126
- const data = await parseBody(output.body, context);
127
- let contents = {};
128
- contents = deserializeAws_json1_0GetShardIteratorOutput(data, context);
129
- const response = {
130
- $metadata: deserializeMetadata(output),
131
- ...contents,
132
- };
133
- return Promise.resolve(response);
134
- };
135
- const deserializeAws_json1_0GetShardIteratorCommandError = async (output, context) => {
136
- const parsedOutput = {
137
- ...output,
138
- body: await parseErrorBody(output.body, context),
139
- };
140
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
141
- switch (errorCode) {
142
- case "InternalServerError":
143
- case "com.amazonaws.dynamodbstreams#InternalServerError":
144
- throw await deserializeAws_json1_0InternalServerErrorResponse(parsedOutput, context);
145
- case "ResourceNotFoundException":
146
- case "com.amazonaws.dynamodbstreams#ResourceNotFoundException":
147
- throw await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context);
148
- case "TrimmedDataAccessException":
149
- case "com.amazonaws.dynamodbstreams#TrimmedDataAccessException":
150
- throw await deserializeAws_json1_0TrimmedDataAccessExceptionResponse(parsedOutput, context);
151
- default:
152
- const parsedBody = parsedOutput.body;
153
- throwDefaultError({
154
- output,
155
- parsedBody,
156
- exceptionCtor: __BaseException,
157
- errorCode,
158
- });
159
- }
160
- };
161
- export const deserializeAws_json1_0ListStreamsCommand = async (output, context) => {
162
- if (output.statusCode >= 300) {
163
- return deserializeAws_json1_0ListStreamsCommandError(output, context);
164
- }
165
- const data = await parseBody(output.body, context);
166
- let contents = {};
167
- contents = deserializeAws_json1_0ListStreamsOutput(data, context);
168
- const response = {
169
- $metadata: deserializeMetadata(output),
170
- ...contents,
171
- };
172
- return Promise.resolve(response);
173
- };
174
- const deserializeAws_json1_0ListStreamsCommandError = async (output, context) => {
175
- const parsedOutput = {
176
- ...output,
177
- body: await parseErrorBody(output.body, context),
178
- };
179
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
180
- switch (errorCode) {
181
- case "InternalServerError":
182
- case "com.amazonaws.dynamodbstreams#InternalServerError":
183
- throw await deserializeAws_json1_0InternalServerErrorResponse(parsedOutput, context);
184
- case "ResourceNotFoundException":
185
- case "com.amazonaws.dynamodbstreams#ResourceNotFoundException":
186
- throw await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context);
187
- default:
188
- const parsedBody = parsedOutput.body;
189
- throwDefaultError({
190
- output,
191
- parsedBody,
192
- exceptionCtor: __BaseException,
193
- errorCode,
194
- });
195
- }
196
- };
197
- const deserializeAws_json1_0ExpiredIteratorExceptionResponse = async (parsedOutput, context) => {
198
- const body = parsedOutput.body;
199
- const deserialized = deserializeAws_json1_0ExpiredIteratorException(body, context);
200
- const exception = new ExpiredIteratorException({
201
- $metadata: deserializeMetadata(parsedOutput),
202
- ...deserialized,
6
+ export var serializeAws_json1_0DescribeStreamCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
7
+ var headers, body;
8
+ return __generator(this, function (_a) {
9
+ headers = {
10
+ "content-type": "application/x-amz-json-1.0",
11
+ "x-amz-target": "DynamoDBStreams_20120810.DescribeStream",
12
+ };
13
+ body = JSON.stringify(serializeAws_json1_0DescribeStreamInput(input, context));
14
+ return [2, buildHttpRpcRequest(context, headers, "/", undefined, body)];
203
15
  });
204
- return __decorateServiceException(exception, body);
205
- };
206
- const deserializeAws_json1_0InternalServerErrorResponse = async (parsedOutput, context) => {
207
- const body = parsedOutput.body;
208
- const deserialized = deserializeAws_json1_0InternalServerError(body, context);
209
- const exception = new InternalServerError({
210
- $metadata: deserializeMetadata(parsedOutput),
211
- ...deserialized,
16
+ }); };
17
+ export var serializeAws_json1_0GetRecordsCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
18
+ var headers, body;
19
+ return __generator(this, function (_a) {
20
+ headers = {
21
+ "content-type": "application/x-amz-json-1.0",
22
+ "x-amz-target": "DynamoDBStreams_20120810.GetRecords",
23
+ };
24
+ body = JSON.stringify(serializeAws_json1_0GetRecordsInput(input, context));
25
+ return [2, buildHttpRpcRequest(context, headers, "/", undefined, body)];
212
26
  });
213
- return __decorateServiceException(exception, body);
214
- };
215
- const deserializeAws_json1_0LimitExceededExceptionResponse = async (parsedOutput, context) => {
216
- const body = parsedOutput.body;
217
- const deserialized = deserializeAws_json1_0LimitExceededException(body, context);
218
- const exception = new LimitExceededException({
219
- $metadata: deserializeMetadata(parsedOutput),
220
- ...deserialized,
27
+ }); };
28
+ export var serializeAws_json1_0GetShardIteratorCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
29
+ var headers, body;
30
+ return __generator(this, function (_a) {
31
+ headers = {
32
+ "content-type": "application/x-amz-json-1.0",
33
+ "x-amz-target": "DynamoDBStreams_20120810.GetShardIterator",
34
+ };
35
+ body = JSON.stringify(serializeAws_json1_0GetShardIteratorInput(input, context));
36
+ return [2, buildHttpRpcRequest(context, headers, "/", undefined, body)];
221
37
  });
222
- return __decorateServiceException(exception, body);
223
- };
224
- const deserializeAws_json1_0ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
225
- const body = parsedOutput.body;
226
- const deserialized = deserializeAws_json1_0ResourceNotFoundException(body, context);
227
- const exception = new ResourceNotFoundException({
228
- $metadata: deserializeMetadata(parsedOutput),
229
- ...deserialized,
38
+ }); };
39
+ export var serializeAws_json1_0ListStreamsCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
40
+ var headers, body;
41
+ return __generator(this, function (_a) {
42
+ headers = {
43
+ "content-type": "application/x-amz-json-1.0",
44
+ "x-amz-target": "DynamoDBStreams_20120810.ListStreams",
45
+ };
46
+ body = JSON.stringify(serializeAws_json1_0ListStreamsInput(input, context));
47
+ return [2, buildHttpRpcRequest(context, headers, "/", undefined, body)];
230
48
  });
231
- return __decorateServiceException(exception, body);
232
- };
233
- const deserializeAws_json1_0TrimmedDataAccessExceptionResponse = async (parsedOutput, context) => {
234
- const body = parsedOutput.body;
235
- const deserialized = deserializeAws_json1_0TrimmedDataAccessException(body, context);
236
- const exception = new TrimmedDataAccessException({
237
- $metadata: deserializeMetadata(parsedOutput),
238
- ...deserialized,
49
+ }); };
50
+ export var deserializeAws_json1_0DescribeStreamCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
51
+ var data, contents, response;
52
+ return __generator(this, function (_a) {
53
+ switch (_a.label) {
54
+ case 0:
55
+ if (output.statusCode >= 300) {
56
+ return [2, deserializeAws_json1_0DescribeStreamCommandError(output, context)];
57
+ }
58
+ return [4, parseBody(output.body, context)];
59
+ case 1:
60
+ data = _a.sent();
61
+ contents = {};
62
+ contents = deserializeAws_json1_0DescribeStreamOutput(data, context);
63
+ response = __assign({ $metadata: deserializeMetadata(output) }, contents);
64
+ return [2, Promise.resolve(response)];
65
+ }
239
66
  });
240
- return __decorateServiceException(exception, body);
241
- };
242
- const serializeAws_json1_0DescribeStreamInput = (input, context) => {
243
- return {
244
- ...(input.ExclusiveStartShardId != null && { ExclusiveStartShardId: input.ExclusiveStartShardId }),
245
- ...(input.Limit != null && { Limit: input.Limit }),
246
- ...(input.StreamArn != null && { StreamArn: input.StreamArn }),
247
- };
67
+ }); };
68
+ var deserializeAws_json1_0DescribeStreamCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
69
+ var parsedOutput, _a, errorCode, _b, parsedBody;
70
+ var _c;
71
+ return __generator(this, function (_d) {
72
+ switch (_d.label) {
73
+ case 0:
74
+ _a = [__assign({}, output)];
75
+ _c = {};
76
+ return [4, parseErrorBody(output.body, context)];
77
+ case 1:
78
+ parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
79
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
80
+ _b = errorCode;
81
+ switch (_b) {
82
+ case "InternalServerError": return [3, 2];
83
+ case "com.amazonaws.dynamodbstreams#InternalServerError": return [3, 2];
84
+ case "ResourceNotFoundException": return [3, 4];
85
+ case "com.amazonaws.dynamodbstreams#ResourceNotFoundException": return [3, 4];
86
+ }
87
+ return [3, 6];
88
+ case 2: return [4, deserializeAws_json1_0InternalServerErrorResponse(parsedOutput, context)];
89
+ case 3: throw _d.sent();
90
+ case 4: return [4, deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context)];
91
+ case 5: throw _d.sent();
92
+ case 6:
93
+ parsedBody = parsedOutput.body;
94
+ throwDefaultError({
95
+ output: output,
96
+ parsedBody: parsedBody,
97
+ exceptionCtor: __BaseException,
98
+ errorCode: errorCode,
99
+ });
100
+ _d.label = 7;
101
+ case 7: return [2];
102
+ }
103
+ });
104
+ }); };
105
+ export var deserializeAws_json1_0GetRecordsCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
106
+ var data, contents, response;
107
+ return __generator(this, function (_a) {
108
+ switch (_a.label) {
109
+ case 0:
110
+ if (output.statusCode >= 300) {
111
+ return [2, deserializeAws_json1_0GetRecordsCommandError(output, context)];
112
+ }
113
+ return [4, parseBody(output.body, context)];
114
+ case 1:
115
+ data = _a.sent();
116
+ contents = {};
117
+ contents = deserializeAws_json1_0GetRecordsOutput(data, context);
118
+ response = __assign({ $metadata: deserializeMetadata(output) }, contents);
119
+ return [2, Promise.resolve(response)];
120
+ }
121
+ });
122
+ }); };
123
+ var deserializeAws_json1_0GetRecordsCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
124
+ var parsedOutput, _a, errorCode, _b, parsedBody;
125
+ var _c;
126
+ return __generator(this, function (_d) {
127
+ switch (_d.label) {
128
+ case 0:
129
+ _a = [__assign({}, output)];
130
+ _c = {};
131
+ return [4, parseErrorBody(output.body, context)];
132
+ case 1:
133
+ parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
134
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
135
+ _b = errorCode;
136
+ switch (_b) {
137
+ case "ExpiredIteratorException": return [3, 2];
138
+ case "com.amazonaws.dynamodbstreams#ExpiredIteratorException": return [3, 2];
139
+ case "InternalServerError": return [3, 4];
140
+ case "com.amazonaws.dynamodbstreams#InternalServerError": return [3, 4];
141
+ case "LimitExceededException": return [3, 6];
142
+ case "com.amazonaws.dynamodbstreams#LimitExceededException": return [3, 6];
143
+ case "ResourceNotFoundException": return [3, 8];
144
+ case "com.amazonaws.dynamodbstreams#ResourceNotFoundException": return [3, 8];
145
+ case "TrimmedDataAccessException": return [3, 10];
146
+ case "com.amazonaws.dynamodbstreams#TrimmedDataAccessException": return [3, 10];
147
+ }
148
+ return [3, 12];
149
+ case 2: return [4, deserializeAws_json1_0ExpiredIteratorExceptionResponse(parsedOutput, context)];
150
+ case 3: throw _d.sent();
151
+ case 4: return [4, deserializeAws_json1_0InternalServerErrorResponse(parsedOutput, context)];
152
+ case 5: throw _d.sent();
153
+ case 6: return [4, deserializeAws_json1_0LimitExceededExceptionResponse(parsedOutput, context)];
154
+ case 7: throw _d.sent();
155
+ case 8: return [4, deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context)];
156
+ case 9: throw _d.sent();
157
+ case 10: return [4, deserializeAws_json1_0TrimmedDataAccessExceptionResponse(parsedOutput, context)];
158
+ case 11: throw _d.sent();
159
+ case 12:
160
+ parsedBody = parsedOutput.body;
161
+ throwDefaultError({
162
+ output: output,
163
+ parsedBody: parsedBody,
164
+ exceptionCtor: __BaseException,
165
+ errorCode: errorCode,
166
+ });
167
+ _d.label = 13;
168
+ case 13: return [2];
169
+ }
170
+ });
171
+ }); };
172
+ export var deserializeAws_json1_0GetShardIteratorCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
173
+ var data, contents, response;
174
+ return __generator(this, function (_a) {
175
+ switch (_a.label) {
176
+ case 0:
177
+ if (output.statusCode >= 300) {
178
+ return [2, deserializeAws_json1_0GetShardIteratorCommandError(output, context)];
179
+ }
180
+ return [4, parseBody(output.body, context)];
181
+ case 1:
182
+ data = _a.sent();
183
+ contents = {};
184
+ contents = deserializeAws_json1_0GetShardIteratorOutput(data, context);
185
+ response = __assign({ $metadata: deserializeMetadata(output) }, contents);
186
+ return [2, Promise.resolve(response)];
187
+ }
188
+ });
189
+ }); };
190
+ var deserializeAws_json1_0GetShardIteratorCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
191
+ var parsedOutput, _a, errorCode, _b, parsedBody;
192
+ var _c;
193
+ return __generator(this, function (_d) {
194
+ switch (_d.label) {
195
+ case 0:
196
+ _a = [__assign({}, output)];
197
+ _c = {};
198
+ return [4, parseErrorBody(output.body, context)];
199
+ case 1:
200
+ parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
201
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
202
+ _b = errorCode;
203
+ switch (_b) {
204
+ case "InternalServerError": return [3, 2];
205
+ case "com.amazonaws.dynamodbstreams#InternalServerError": return [3, 2];
206
+ case "ResourceNotFoundException": return [3, 4];
207
+ case "com.amazonaws.dynamodbstreams#ResourceNotFoundException": return [3, 4];
208
+ case "TrimmedDataAccessException": return [3, 6];
209
+ case "com.amazonaws.dynamodbstreams#TrimmedDataAccessException": return [3, 6];
210
+ }
211
+ return [3, 8];
212
+ case 2: return [4, deserializeAws_json1_0InternalServerErrorResponse(parsedOutput, context)];
213
+ case 3: throw _d.sent();
214
+ case 4: return [4, deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context)];
215
+ case 5: throw _d.sent();
216
+ case 6: return [4, deserializeAws_json1_0TrimmedDataAccessExceptionResponse(parsedOutput, context)];
217
+ case 7: throw _d.sent();
218
+ case 8:
219
+ parsedBody = parsedOutput.body;
220
+ throwDefaultError({
221
+ output: output,
222
+ parsedBody: parsedBody,
223
+ exceptionCtor: __BaseException,
224
+ errorCode: errorCode,
225
+ });
226
+ _d.label = 9;
227
+ case 9: return [2];
228
+ }
229
+ });
230
+ }); };
231
+ export var deserializeAws_json1_0ListStreamsCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
232
+ var data, contents, response;
233
+ return __generator(this, function (_a) {
234
+ switch (_a.label) {
235
+ case 0:
236
+ if (output.statusCode >= 300) {
237
+ return [2, deserializeAws_json1_0ListStreamsCommandError(output, context)];
238
+ }
239
+ return [4, parseBody(output.body, context)];
240
+ case 1:
241
+ data = _a.sent();
242
+ contents = {};
243
+ contents = deserializeAws_json1_0ListStreamsOutput(data, context);
244
+ response = __assign({ $metadata: deserializeMetadata(output) }, contents);
245
+ return [2, Promise.resolve(response)];
246
+ }
247
+ });
248
+ }); };
249
+ var deserializeAws_json1_0ListStreamsCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
250
+ var parsedOutput, _a, errorCode, _b, parsedBody;
251
+ var _c;
252
+ return __generator(this, function (_d) {
253
+ switch (_d.label) {
254
+ case 0:
255
+ _a = [__assign({}, output)];
256
+ _c = {};
257
+ return [4, parseErrorBody(output.body, context)];
258
+ case 1:
259
+ parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
260
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
261
+ _b = errorCode;
262
+ switch (_b) {
263
+ case "InternalServerError": return [3, 2];
264
+ case "com.amazonaws.dynamodbstreams#InternalServerError": return [3, 2];
265
+ case "ResourceNotFoundException": return [3, 4];
266
+ case "com.amazonaws.dynamodbstreams#ResourceNotFoundException": return [3, 4];
267
+ }
268
+ return [3, 6];
269
+ case 2: return [4, deserializeAws_json1_0InternalServerErrorResponse(parsedOutput, context)];
270
+ case 3: throw _d.sent();
271
+ case 4: return [4, deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context)];
272
+ case 5: throw _d.sent();
273
+ case 6:
274
+ parsedBody = parsedOutput.body;
275
+ throwDefaultError({
276
+ output: output,
277
+ parsedBody: parsedBody,
278
+ exceptionCtor: __BaseException,
279
+ errorCode: errorCode,
280
+ });
281
+ _d.label = 7;
282
+ case 7: return [2];
283
+ }
284
+ });
285
+ }); };
286
+ var deserializeAws_json1_0ExpiredIteratorExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
287
+ var body, deserialized, exception;
288
+ return __generator(this, function (_a) {
289
+ body = parsedOutput.body;
290
+ deserialized = deserializeAws_json1_0ExpiredIteratorException(body, context);
291
+ exception = new ExpiredIteratorException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, deserialized));
292
+ return [2, __decorateServiceException(exception, body)];
293
+ });
294
+ }); };
295
+ var deserializeAws_json1_0InternalServerErrorResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
296
+ var body, deserialized, exception;
297
+ return __generator(this, function (_a) {
298
+ body = parsedOutput.body;
299
+ deserialized = deserializeAws_json1_0InternalServerError(body, context);
300
+ exception = new InternalServerError(__assign({ $metadata: deserializeMetadata(parsedOutput) }, deserialized));
301
+ return [2, __decorateServiceException(exception, body)];
302
+ });
303
+ }); };
304
+ var deserializeAws_json1_0LimitExceededExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
305
+ var body, deserialized, exception;
306
+ return __generator(this, function (_a) {
307
+ body = parsedOutput.body;
308
+ deserialized = deserializeAws_json1_0LimitExceededException(body, context);
309
+ exception = new LimitExceededException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, deserialized));
310
+ return [2, __decorateServiceException(exception, body)];
311
+ });
312
+ }); };
313
+ var deserializeAws_json1_0ResourceNotFoundExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
314
+ var body, deserialized, exception;
315
+ return __generator(this, function (_a) {
316
+ body = parsedOutput.body;
317
+ deserialized = deserializeAws_json1_0ResourceNotFoundException(body, context);
318
+ exception = new ResourceNotFoundException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, deserialized));
319
+ return [2, __decorateServiceException(exception, body)];
320
+ });
321
+ }); };
322
+ var deserializeAws_json1_0TrimmedDataAccessExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
323
+ var body, deserialized, exception;
324
+ return __generator(this, function (_a) {
325
+ body = parsedOutput.body;
326
+ deserialized = deserializeAws_json1_0TrimmedDataAccessException(body, context);
327
+ exception = new TrimmedDataAccessException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, deserialized));
328
+ return [2, __decorateServiceException(exception, body)];
329
+ });
330
+ }); };
331
+ var serializeAws_json1_0DescribeStreamInput = function (input, context) {
332
+ return __assign(__assign(__assign({}, (input.ExclusiveStartShardId != null && { ExclusiveStartShardId: input.ExclusiveStartShardId })), (input.Limit != null && { Limit: input.Limit })), (input.StreamArn != null && { StreamArn: input.StreamArn }));
248
333
  };
249
- const serializeAws_json1_0GetRecordsInput = (input, context) => {
250
- return {
251
- ...(input.Limit != null && { Limit: input.Limit }),
252
- ...(input.ShardIterator != null && { ShardIterator: input.ShardIterator }),
253
- };
334
+ var serializeAws_json1_0GetRecordsInput = function (input, context) {
335
+ return __assign(__assign({}, (input.Limit != null && { Limit: input.Limit })), (input.ShardIterator != null && { ShardIterator: input.ShardIterator }));
254
336
  };
255
- const serializeAws_json1_0GetShardIteratorInput = (input, context) => {
256
- return {
257
- ...(input.SequenceNumber != null && { SequenceNumber: input.SequenceNumber }),
258
- ...(input.ShardId != null && { ShardId: input.ShardId }),
259
- ...(input.ShardIteratorType != null && { ShardIteratorType: input.ShardIteratorType }),
260
- ...(input.StreamArn != null && { StreamArn: input.StreamArn }),
261
- };
337
+ var serializeAws_json1_0GetShardIteratorInput = function (input, context) {
338
+ return __assign(__assign(__assign(__assign({}, (input.SequenceNumber != null && { SequenceNumber: input.SequenceNumber })), (input.ShardId != null && { ShardId: input.ShardId })), (input.ShardIteratorType != null && { ShardIteratorType: input.ShardIteratorType })), (input.StreamArn != null && { StreamArn: input.StreamArn }));
262
339
  };
263
- const serializeAws_json1_0ListStreamsInput = (input, context) => {
264
- return {
265
- ...(input.ExclusiveStartStreamArn != null && { ExclusiveStartStreamArn: input.ExclusiveStartStreamArn }),
266
- ...(input.Limit != null && { Limit: input.Limit }),
267
- ...(input.TableName != null && { TableName: input.TableName }),
268
- };
340
+ var serializeAws_json1_0ListStreamsInput = function (input, context) {
341
+ return __assign(__assign(__assign({}, (input.ExclusiveStartStreamArn != null && { ExclusiveStartStreamArn: input.ExclusiveStartStreamArn })), (input.Limit != null && { Limit: input.Limit })), (input.TableName != null && { TableName: input.TableName }));
269
342
  };
270
- const deserializeAws_json1_0AttributeMap = (output, context) => {
271
- return Object.entries(output).reduce((acc, [key, value]) => {
343
+ var deserializeAws_json1_0AttributeMap = function (output, context) {
344
+ return Object.entries(output).reduce(function (acc, _a) {
345
+ var _b;
346
+ var _c = __read(_a, 2), key = _c[0], value = _c[1];
272
347
  if (value === null) {
273
348
  return acc;
274
349
  }
275
- return {
276
- ...acc,
277
- [key]: deserializeAws_json1_0AttributeValue(__expectUnion(value), context),
278
- };
350
+ return __assign(__assign({}, acc), (_b = {}, _b[key] = deserializeAws_json1_0AttributeValue(__expectUnion(value), context), _b));
279
351
  }, {});
280
352
  };
281
- const deserializeAws_json1_0AttributeValue = (output, context) => {
353
+ var deserializeAws_json1_0AttributeValue = function (output, context) {
282
354
  if (output.B != null) {
283
355
  return {
284
356
  B: context.base64Decoder(output.B),
@@ -323,10 +395,10 @@ const deserializeAws_json1_0AttributeValue = (output, context) => {
323
395
  }
324
396
  return { $unknown: Object.entries(output)[0] };
325
397
  };
326
- const deserializeAws_json1_0BinarySetAttributeValue = (output, context) => {
327
- const retVal = (output || [])
328
- .filter((e) => e != null)
329
- .map((entry) => {
398
+ var deserializeAws_json1_0BinarySetAttributeValue = function (output, context) {
399
+ var retVal = (output || [])
400
+ .filter(function (e) { return e != null; })
401
+ .map(function (entry) {
330
402
  if (entry === null) {
331
403
  return null;
332
404
  }
@@ -334,44 +406,44 @@ const deserializeAws_json1_0BinarySetAttributeValue = (output, context) => {
334
406
  });
335
407
  return retVal;
336
408
  };
337
- const deserializeAws_json1_0DescribeStreamOutput = (output, context) => {
409
+ var deserializeAws_json1_0DescribeStreamOutput = function (output, context) {
338
410
  return {
339
411
  StreamDescription: output.StreamDescription != null
340
412
  ? deserializeAws_json1_0StreamDescription(output.StreamDescription, context)
341
413
  : undefined,
342
414
  };
343
415
  };
344
- const deserializeAws_json1_0ExpiredIteratorException = (output, context) => {
416
+ var deserializeAws_json1_0ExpiredIteratorException = function (output, context) {
345
417
  return {
346
418
  message: __expectString(output.message),
347
419
  };
348
420
  };
349
- const deserializeAws_json1_0GetRecordsOutput = (output, context) => {
421
+ var deserializeAws_json1_0GetRecordsOutput = function (output, context) {
350
422
  return {
351
423
  NextShardIterator: __expectString(output.NextShardIterator),
352
424
  Records: output.Records != null ? deserializeAws_json1_0RecordList(output.Records, context) : undefined,
353
425
  };
354
426
  };
355
- const deserializeAws_json1_0GetShardIteratorOutput = (output, context) => {
427
+ var deserializeAws_json1_0GetShardIteratorOutput = function (output, context) {
356
428
  return {
357
429
  ShardIterator: __expectString(output.ShardIterator),
358
430
  };
359
431
  };
360
- const deserializeAws_json1_0Identity = (output, context) => {
432
+ var deserializeAws_json1_0Identity = function (output, context) {
361
433
  return {
362
434
  PrincipalId: __expectString(output.PrincipalId),
363
435
  Type: __expectString(output.Type),
364
436
  };
365
437
  };
366
- const deserializeAws_json1_0InternalServerError = (output, context) => {
438
+ var deserializeAws_json1_0InternalServerError = function (output, context) {
367
439
  return {
368
440
  message: __expectString(output.message),
369
441
  };
370
442
  };
371
- const deserializeAws_json1_0KeySchema = (output, context) => {
372
- const retVal = (output || [])
373
- .filter((e) => e != null)
374
- .map((entry) => {
443
+ var deserializeAws_json1_0KeySchema = function (output, context) {
444
+ var retVal = (output || [])
445
+ .filter(function (e) { return e != null; })
446
+ .map(function (entry) {
375
447
  if (entry === null) {
376
448
  return null;
377
449
  }
@@ -379,21 +451,21 @@ const deserializeAws_json1_0KeySchema = (output, context) => {
379
451
  });
380
452
  return retVal;
381
453
  };
382
- const deserializeAws_json1_0KeySchemaElement = (output, context) => {
454
+ var deserializeAws_json1_0KeySchemaElement = function (output, context) {
383
455
  return {
384
456
  AttributeName: __expectString(output.AttributeName),
385
457
  KeyType: __expectString(output.KeyType),
386
458
  };
387
459
  };
388
- const deserializeAws_json1_0LimitExceededException = (output, context) => {
460
+ var deserializeAws_json1_0LimitExceededException = function (output, context) {
389
461
  return {
390
462
  message: __expectString(output.message),
391
463
  };
392
464
  };
393
- const deserializeAws_json1_0ListAttributeValue = (output, context) => {
394
- const retVal = (output || [])
395
- .filter((e) => e != null)
396
- .map((entry) => {
465
+ var deserializeAws_json1_0ListAttributeValue = function (output, context) {
466
+ var retVal = (output || [])
467
+ .filter(function (e) { return e != null; })
468
+ .map(function (entry) {
397
469
  if (entry === null) {
398
470
  return null;
399
471
  }
@@ -401,27 +473,26 @@ const deserializeAws_json1_0ListAttributeValue = (output, context) => {
401
473
  });
402
474
  return retVal;
403
475
  };
404
- const deserializeAws_json1_0ListStreamsOutput = (output, context) => {
476
+ var deserializeAws_json1_0ListStreamsOutput = function (output, context) {
405
477
  return {
406
478
  LastEvaluatedStreamArn: __expectString(output.LastEvaluatedStreamArn),
407
479
  Streams: output.Streams != null ? deserializeAws_json1_0StreamList(output.Streams, context) : undefined,
408
480
  };
409
481
  };
410
- const deserializeAws_json1_0MapAttributeValue = (output, context) => {
411
- return Object.entries(output).reduce((acc, [key, value]) => {
482
+ var deserializeAws_json1_0MapAttributeValue = function (output, context) {
483
+ return Object.entries(output).reduce(function (acc, _a) {
484
+ var _b;
485
+ var _c = __read(_a, 2), key = _c[0], value = _c[1];
412
486
  if (value === null) {
413
487
  return acc;
414
488
  }
415
- return {
416
- ...acc,
417
- [key]: deserializeAws_json1_0AttributeValue(__expectUnion(value), context),
418
- };
489
+ return __assign(__assign({}, acc), (_b = {}, _b[key] = deserializeAws_json1_0AttributeValue(__expectUnion(value), context), _b));
419
490
  }, {});
420
491
  };
421
- const deserializeAws_json1_0NumberSetAttributeValue = (output, context) => {
422
- const retVal = (output || [])
423
- .filter((e) => e != null)
424
- .map((entry) => {
492
+ var deserializeAws_json1_0NumberSetAttributeValue = function (output, context) {
493
+ var retVal = (output || [])
494
+ .filter(function (e) { return e != null; })
495
+ .map(function (entry) {
425
496
  if (entry === null) {
426
497
  return null;
427
498
  }
@@ -429,7 +500,7 @@ const deserializeAws_json1_0NumberSetAttributeValue = (output, context) => {
429
500
  });
430
501
  return retVal;
431
502
  };
432
- const deserializeAws_json1_0_Record = (output, context) => {
503
+ var deserializeAws_json1_0_Record = function (output, context) {
433
504
  return {
434
505
  awsRegion: __expectString(output.awsRegion),
435
506
  dynamodb: output.dynamodb != null ? deserializeAws_json1_0StreamRecord(output.dynamodb, context) : undefined,
@@ -440,10 +511,10 @@ const deserializeAws_json1_0_Record = (output, context) => {
440
511
  userIdentity: output.userIdentity != null ? deserializeAws_json1_0Identity(output.userIdentity, context) : undefined,
441
512
  };
442
513
  };
443
- const deserializeAws_json1_0RecordList = (output, context) => {
444
- const retVal = (output || [])
445
- .filter((e) => e != null)
446
- .map((entry) => {
514
+ var deserializeAws_json1_0RecordList = function (output, context) {
515
+ var retVal = (output || [])
516
+ .filter(function (e) { return e != null; })
517
+ .map(function (entry) {
447
518
  if (entry === null) {
448
519
  return null;
449
520
  }
@@ -451,18 +522,18 @@ const deserializeAws_json1_0RecordList = (output, context) => {
451
522
  });
452
523
  return retVal;
453
524
  };
454
- const deserializeAws_json1_0ResourceNotFoundException = (output, context) => {
525
+ var deserializeAws_json1_0ResourceNotFoundException = function (output, context) {
455
526
  return {
456
527
  message: __expectString(output.message),
457
528
  };
458
529
  };
459
- const deserializeAws_json1_0SequenceNumberRange = (output, context) => {
530
+ var deserializeAws_json1_0SequenceNumberRange = function (output, context) {
460
531
  return {
461
532
  EndingSequenceNumber: __expectString(output.EndingSequenceNumber),
462
533
  StartingSequenceNumber: __expectString(output.StartingSequenceNumber),
463
534
  };
464
535
  };
465
- const deserializeAws_json1_0Shard = (output, context) => {
536
+ var deserializeAws_json1_0Shard = function (output, context) {
466
537
  return {
467
538
  ParentShardId: __expectString(output.ParentShardId),
468
539
  SequenceNumberRange: output.SequenceNumberRange != null
@@ -471,10 +542,10 @@ const deserializeAws_json1_0Shard = (output, context) => {
471
542
  ShardId: __expectString(output.ShardId),
472
543
  };
473
544
  };
474
- const deserializeAws_json1_0ShardDescriptionList = (output, context) => {
475
- const retVal = (output || [])
476
- .filter((e) => e != null)
477
- .map((entry) => {
545
+ var deserializeAws_json1_0ShardDescriptionList = function (output, context) {
546
+ var retVal = (output || [])
547
+ .filter(function (e) { return e != null; })
548
+ .map(function (entry) {
478
549
  if (entry === null) {
479
550
  return null;
480
551
  }
@@ -482,14 +553,14 @@ const deserializeAws_json1_0ShardDescriptionList = (output, context) => {
482
553
  });
483
554
  return retVal;
484
555
  };
485
- const deserializeAws_json1_0_Stream = (output, context) => {
556
+ var deserializeAws_json1_0_Stream = function (output, context) {
486
557
  return {
487
558
  StreamArn: __expectString(output.StreamArn),
488
559
  StreamLabel: __expectString(output.StreamLabel),
489
560
  TableName: __expectString(output.TableName),
490
561
  };
491
562
  };
492
- const deserializeAws_json1_0StreamDescription = (output, context) => {
563
+ var deserializeAws_json1_0StreamDescription = function (output, context) {
493
564
  return {
494
565
  CreationRequestDateTime: output.CreationRequestDateTime != null
495
566
  ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.CreationRequestDateTime)))
@@ -504,10 +575,10 @@ const deserializeAws_json1_0StreamDescription = (output, context) => {
504
575
  TableName: __expectString(output.TableName),
505
576
  };
506
577
  };
507
- const deserializeAws_json1_0StreamList = (output, context) => {
508
- const retVal = (output || [])
509
- .filter((e) => e != null)
510
- .map((entry) => {
578
+ var deserializeAws_json1_0StreamList = function (output, context) {
579
+ var retVal = (output || [])
580
+ .filter(function (e) { return e != null; })
581
+ .map(function (entry) {
511
582
  if (entry === null) {
512
583
  return null;
513
584
  }
@@ -515,7 +586,7 @@ const deserializeAws_json1_0StreamList = (output, context) => {
515
586
  });
516
587
  return retVal;
517
588
  };
518
- const deserializeAws_json1_0StreamRecord = (output, context) => {
589
+ var deserializeAws_json1_0StreamRecord = function (output, context) {
519
590
  return {
520
591
  ApproximateCreationDateTime: output.ApproximateCreationDateTime != null
521
592
  ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.ApproximateCreationDateTime)))
@@ -528,10 +599,10 @@ const deserializeAws_json1_0StreamRecord = (output, context) => {
528
599
  StreamViewType: __expectString(output.StreamViewType),
529
600
  };
530
601
  };
531
- const deserializeAws_json1_0StringSetAttributeValue = (output, context) => {
532
- const retVal = (output || [])
533
- .filter((e) => e != null)
534
- .map((entry) => {
602
+ var deserializeAws_json1_0StringSetAttributeValue = function (output, context) {
603
+ var retVal = (output || [])
604
+ .filter(function (e) { return e != null; })
605
+ .map(function (entry) {
535
606
  if (entry === null) {
536
607
  return null;
537
608
  }
@@ -539,57 +610,80 @@ const deserializeAws_json1_0StringSetAttributeValue = (output, context) => {
539
610
  });
540
611
  return retVal;
541
612
  };
542
- const deserializeAws_json1_0TrimmedDataAccessException = (output, context) => {
613
+ var deserializeAws_json1_0TrimmedDataAccessException = function (output, context) {
543
614
  return {
544
615
  message: __expectString(output.message),
545
616
  };
546
617
  };
547
- const deserializeMetadata = (output) => ({
548
- httpStatusCode: output.statusCode,
549
- requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"],
550
- extendedRequestId: output.headers["x-amz-id-2"],
551
- cfId: output.headers["x-amz-cf-id"],
552
- });
553
- const collectBody = (streamBody = new Uint8Array(), context) => {
618
+ var deserializeMetadata = function (output) {
619
+ var _a, _b;
620
+ return ({
621
+ httpStatusCode: output.statusCode,
622
+ 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"],
623
+ extendedRequestId: output.headers["x-amz-id-2"],
624
+ cfId: output.headers["x-amz-cf-id"],
625
+ });
626
+ };
627
+ var collectBody = function (streamBody, context) {
628
+ if (streamBody === void 0) { streamBody = new Uint8Array(); }
554
629
  if (streamBody instanceof Uint8Array) {
555
630
  return Promise.resolve(streamBody);
556
631
  }
557
632
  return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
558
633
  };
559
- const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
560
- const buildHttpRpcRequest = async (context, headers, path, resolvedHostname, body) => {
561
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
562
- const contents = {
563
- protocol,
564
- hostname,
565
- port,
566
- method: "POST",
567
- path: basePath.endsWith("/") ? basePath.slice(0, -1) + path : basePath + path,
568
- headers,
569
- };
570
- if (resolvedHostname !== undefined) {
571
- contents.hostname = resolvedHostname;
572
- }
573
- if (body !== undefined) {
574
- contents.body = body;
575
- }
576
- return new __HttpRequest(contents);
634
+ var collectBodyString = function (streamBody, context) {
635
+ return collectBody(streamBody, context).then(function (body) { return context.utf8Encoder(body); });
636
+ };
637
+ var buildHttpRpcRequest = function (context, headers, path, resolvedHostname, body) { return __awaiter(void 0, void 0, void 0, function () {
638
+ var _a, hostname, _b, protocol, port, basePath, contents;
639
+ return __generator(this, function (_c) {
640
+ switch (_c.label) {
641
+ case 0: return [4, context.endpoint()];
642
+ case 1:
643
+ _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
644
+ contents = {
645
+ protocol: protocol,
646
+ hostname: hostname,
647
+ port: port,
648
+ method: "POST",
649
+ path: basePath.endsWith("/") ? basePath.slice(0, -1) + path : basePath + path,
650
+ headers: headers,
651
+ };
652
+ if (resolvedHostname !== undefined) {
653
+ contents.hostname = resolvedHostname;
654
+ }
655
+ if (body !== undefined) {
656
+ contents.body = body;
657
+ }
658
+ return [2, new __HttpRequest(contents)];
659
+ }
660
+ });
661
+ }); };
662
+ var parseBody = function (streamBody, context) {
663
+ return collectBodyString(streamBody, context).then(function (encoded) {
664
+ if (encoded.length) {
665
+ return JSON.parse(encoded);
666
+ }
667
+ return {};
668
+ });
577
669
  };
578
- const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
579
- if (encoded.length) {
580
- return JSON.parse(encoded);
581
- }
582
- return {};
583
- });
584
- const parseErrorBody = async (errorBody, context) => {
585
- const value = await parseBody(errorBody, context);
586
- value.message = value.message ?? value.Message;
587
- return value;
588
- };
589
- const loadRestJsonErrorCode = (output, data) => {
590
- const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
591
- const sanitizeErrorCode = (rawValue) => {
592
- let cleanValue = rawValue;
670
+ var parseErrorBody = function (errorBody, context) { return __awaiter(void 0, void 0, void 0, function () {
671
+ var value;
672
+ var _a;
673
+ return __generator(this, function (_b) {
674
+ switch (_b.label) {
675
+ case 0: return [4, parseBody(errorBody, context)];
676
+ case 1:
677
+ value = _b.sent();
678
+ value.message = (_a = value.message) !== null && _a !== void 0 ? _a : value.Message;
679
+ return [2, value];
680
+ }
681
+ });
682
+ }); };
683
+ var loadRestJsonErrorCode = function (output, data) {
684
+ var findKey = function (object, key) { return Object.keys(object).find(function (k) { return k.toLowerCase() === key.toLowerCase(); }); };
685
+ var sanitizeErrorCode = function (rawValue) {
686
+ var cleanValue = rawValue;
593
687
  if (typeof cleanValue === "number") {
594
688
  cleanValue = cleanValue.toString();
595
689
  }
@@ -604,7 +698,7 @@ const loadRestJsonErrorCode = (output, data) => {
604
698
  }
605
699
  return cleanValue;
606
700
  };
607
- const headerKey = findKey(output.headers, "x-amzn-errortype");
701
+ var headerKey = findKey(output.headers, "x-amzn-errortype");
608
702
  if (headerKey !== undefined) {
609
703
  return sanitizeErrorCode(output.headers[headerKey]);
610
704
  }