@aws-sdk/client-dynamodb-streams 3.186.0 → 3.190.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,356 +1,284 @@
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, 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";
4
3
  import { DynamoDBStreamsServiceException as __BaseException } from "../models/DynamoDBStreamsServiceException";
5
4
  import { ExpiredIteratorException, InternalServerError, LimitExceededException, ResourceNotFoundException, TrimmedDataAccessException, } from "../models/models_0";
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)];
15
- });
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)];
26
- });
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)];
37
- });
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)];
48
- });
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
- }
66
- });
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)];
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,
293
203
  });
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)];
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,
302
212
  });
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)];
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,
311
221
  });
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)];
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,
320
230
  });
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)];
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,
329
239
  });
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 }));
240
+ return __decorateServiceException(exception, body);
333
241
  };
334
- var serializeAws_json1_0GetRecordsInput = function (input, context) {
335
- return __assign(__assign({}, (input.Limit != null && { Limit: input.Limit })), (input.ShardIterator != null && { ShardIterator: input.ShardIterator }));
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
+ };
336
248
  };
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 }));
249
+ const serializeAws_json1_0GetRecordsInput = (input, context) => {
250
+ return {
251
+ ...(input.Limit != null && { Limit: input.Limit }),
252
+ ...(input.ShardIterator != null && { ShardIterator: input.ShardIterator }),
253
+ };
339
254
  };
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 }));
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
+ };
342
262
  };
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];
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
+ };
269
+ };
270
+ const deserializeAws_json1_0AttributeMap = (output, context) => {
271
+ return Object.entries(output).reduce((acc, [key, value]) => {
347
272
  if (value === null) {
348
273
  return acc;
349
274
  }
350
- return __assign(__assign({}, acc), (_b = {}, _b[key] = deserializeAws_json1_0AttributeValue(__expectUnion(value), context), _b));
275
+ return {
276
+ ...acc,
277
+ [key]: deserializeAws_json1_0AttributeValue(__expectUnion(value), context),
278
+ };
351
279
  }, {});
352
280
  };
353
- var deserializeAws_json1_0AttributeValue = function (output, context) {
281
+ const deserializeAws_json1_0AttributeValue = (output, context) => {
354
282
  if (output.B != null) {
355
283
  return {
356
284
  B: context.base64Decoder(output.B),
@@ -395,10 +323,10 @@ var deserializeAws_json1_0AttributeValue = function (output, context) {
395
323
  }
396
324
  return { $unknown: Object.entries(output)[0] };
397
325
  };
398
- var deserializeAws_json1_0BinarySetAttributeValue = function (output, context) {
399
- var retVal = (output || [])
400
- .filter(function (e) { return e != null; })
401
- .map(function (entry) {
326
+ const deserializeAws_json1_0BinarySetAttributeValue = (output, context) => {
327
+ const retVal = (output || [])
328
+ .filter((e) => e != null)
329
+ .map((entry) => {
402
330
  if (entry === null) {
403
331
  return null;
404
332
  }
@@ -406,44 +334,44 @@ var deserializeAws_json1_0BinarySetAttributeValue = function (output, context) {
406
334
  });
407
335
  return retVal;
408
336
  };
409
- var deserializeAws_json1_0DescribeStreamOutput = function (output, context) {
337
+ const deserializeAws_json1_0DescribeStreamOutput = (output, context) => {
410
338
  return {
411
339
  StreamDescription: output.StreamDescription != null
412
340
  ? deserializeAws_json1_0StreamDescription(output.StreamDescription, context)
413
341
  : undefined,
414
342
  };
415
343
  };
416
- var deserializeAws_json1_0ExpiredIteratorException = function (output, context) {
344
+ const deserializeAws_json1_0ExpiredIteratorException = (output, context) => {
417
345
  return {
418
346
  message: __expectString(output.message),
419
347
  };
420
348
  };
421
- var deserializeAws_json1_0GetRecordsOutput = function (output, context) {
349
+ const deserializeAws_json1_0GetRecordsOutput = (output, context) => {
422
350
  return {
423
351
  NextShardIterator: __expectString(output.NextShardIterator),
424
352
  Records: output.Records != null ? deserializeAws_json1_0RecordList(output.Records, context) : undefined,
425
353
  };
426
354
  };
427
- var deserializeAws_json1_0GetShardIteratorOutput = function (output, context) {
355
+ const deserializeAws_json1_0GetShardIteratorOutput = (output, context) => {
428
356
  return {
429
357
  ShardIterator: __expectString(output.ShardIterator),
430
358
  };
431
359
  };
432
- var deserializeAws_json1_0Identity = function (output, context) {
360
+ const deserializeAws_json1_0Identity = (output, context) => {
433
361
  return {
434
362
  PrincipalId: __expectString(output.PrincipalId),
435
363
  Type: __expectString(output.Type),
436
364
  };
437
365
  };
438
- var deserializeAws_json1_0InternalServerError = function (output, context) {
366
+ const deserializeAws_json1_0InternalServerError = (output, context) => {
439
367
  return {
440
368
  message: __expectString(output.message),
441
369
  };
442
370
  };
443
- var deserializeAws_json1_0KeySchema = function (output, context) {
444
- var retVal = (output || [])
445
- .filter(function (e) { return e != null; })
446
- .map(function (entry) {
371
+ const deserializeAws_json1_0KeySchema = (output, context) => {
372
+ const retVal = (output || [])
373
+ .filter((e) => e != null)
374
+ .map((entry) => {
447
375
  if (entry === null) {
448
376
  return null;
449
377
  }
@@ -451,21 +379,21 @@ var deserializeAws_json1_0KeySchema = function (output, context) {
451
379
  });
452
380
  return retVal;
453
381
  };
454
- var deserializeAws_json1_0KeySchemaElement = function (output, context) {
382
+ const deserializeAws_json1_0KeySchemaElement = (output, context) => {
455
383
  return {
456
384
  AttributeName: __expectString(output.AttributeName),
457
385
  KeyType: __expectString(output.KeyType),
458
386
  };
459
387
  };
460
- var deserializeAws_json1_0LimitExceededException = function (output, context) {
388
+ const deserializeAws_json1_0LimitExceededException = (output, context) => {
461
389
  return {
462
390
  message: __expectString(output.message),
463
391
  };
464
392
  };
465
- var deserializeAws_json1_0ListAttributeValue = function (output, context) {
466
- var retVal = (output || [])
467
- .filter(function (e) { return e != null; })
468
- .map(function (entry) {
393
+ const deserializeAws_json1_0ListAttributeValue = (output, context) => {
394
+ const retVal = (output || [])
395
+ .filter((e) => e != null)
396
+ .map((entry) => {
469
397
  if (entry === null) {
470
398
  return null;
471
399
  }
@@ -473,26 +401,27 @@ var deserializeAws_json1_0ListAttributeValue = function (output, context) {
473
401
  });
474
402
  return retVal;
475
403
  };
476
- var deserializeAws_json1_0ListStreamsOutput = function (output, context) {
404
+ const deserializeAws_json1_0ListStreamsOutput = (output, context) => {
477
405
  return {
478
406
  LastEvaluatedStreamArn: __expectString(output.LastEvaluatedStreamArn),
479
407
  Streams: output.Streams != null ? deserializeAws_json1_0StreamList(output.Streams, context) : undefined,
480
408
  };
481
409
  };
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];
410
+ const deserializeAws_json1_0MapAttributeValue = (output, context) => {
411
+ return Object.entries(output).reduce((acc, [key, value]) => {
486
412
  if (value === null) {
487
413
  return acc;
488
414
  }
489
- return __assign(__assign({}, acc), (_b = {}, _b[key] = deserializeAws_json1_0AttributeValue(__expectUnion(value), context), _b));
415
+ return {
416
+ ...acc,
417
+ [key]: deserializeAws_json1_0AttributeValue(__expectUnion(value), context),
418
+ };
490
419
  }, {});
491
420
  };
492
- var deserializeAws_json1_0NumberSetAttributeValue = function (output, context) {
493
- var retVal = (output || [])
494
- .filter(function (e) { return e != null; })
495
- .map(function (entry) {
421
+ const deserializeAws_json1_0NumberSetAttributeValue = (output, context) => {
422
+ const retVal = (output || [])
423
+ .filter((e) => e != null)
424
+ .map((entry) => {
496
425
  if (entry === null) {
497
426
  return null;
498
427
  }
@@ -500,7 +429,7 @@ var deserializeAws_json1_0NumberSetAttributeValue = function (output, context) {
500
429
  });
501
430
  return retVal;
502
431
  };
503
- var deserializeAws_json1_0_Record = function (output, context) {
432
+ const deserializeAws_json1_0_Record = (output, context) => {
504
433
  return {
505
434
  awsRegion: __expectString(output.awsRegion),
506
435
  dynamodb: output.dynamodb != null ? deserializeAws_json1_0StreamRecord(output.dynamodb, context) : undefined,
@@ -511,10 +440,10 @@ var deserializeAws_json1_0_Record = function (output, context) {
511
440
  userIdentity: output.userIdentity != null ? deserializeAws_json1_0Identity(output.userIdentity, context) : undefined,
512
441
  };
513
442
  };
514
- var deserializeAws_json1_0RecordList = function (output, context) {
515
- var retVal = (output || [])
516
- .filter(function (e) { return e != null; })
517
- .map(function (entry) {
443
+ const deserializeAws_json1_0RecordList = (output, context) => {
444
+ const retVal = (output || [])
445
+ .filter((e) => e != null)
446
+ .map((entry) => {
518
447
  if (entry === null) {
519
448
  return null;
520
449
  }
@@ -522,18 +451,18 @@ var deserializeAws_json1_0RecordList = function (output, context) {
522
451
  });
523
452
  return retVal;
524
453
  };
525
- var deserializeAws_json1_0ResourceNotFoundException = function (output, context) {
454
+ const deserializeAws_json1_0ResourceNotFoundException = (output, context) => {
526
455
  return {
527
456
  message: __expectString(output.message),
528
457
  };
529
458
  };
530
- var deserializeAws_json1_0SequenceNumberRange = function (output, context) {
459
+ const deserializeAws_json1_0SequenceNumberRange = (output, context) => {
531
460
  return {
532
461
  EndingSequenceNumber: __expectString(output.EndingSequenceNumber),
533
462
  StartingSequenceNumber: __expectString(output.StartingSequenceNumber),
534
463
  };
535
464
  };
536
- var deserializeAws_json1_0Shard = function (output, context) {
465
+ const deserializeAws_json1_0Shard = (output, context) => {
537
466
  return {
538
467
  ParentShardId: __expectString(output.ParentShardId),
539
468
  SequenceNumberRange: output.SequenceNumberRange != null
@@ -542,10 +471,10 @@ var deserializeAws_json1_0Shard = function (output, context) {
542
471
  ShardId: __expectString(output.ShardId),
543
472
  };
544
473
  };
545
- var deserializeAws_json1_0ShardDescriptionList = function (output, context) {
546
- var retVal = (output || [])
547
- .filter(function (e) { return e != null; })
548
- .map(function (entry) {
474
+ const deserializeAws_json1_0ShardDescriptionList = (output, context) => {
475
+ const retVal = (output || [])
476
+ .filter((e) => e != null)
477
+ .map((entry) => {
549
478
  if (entry === null) {
550
479
  return null;
551
480
  }
@@ -553,14 +482,14 @@ var deserializeAws_json1_0ShardDescriptionList = function (output, context) {
553
482
  });
554
483
  return retVal;
555
484
  };
556
- var deserializeAws_json1_0_Stream = function (output, context) {
485
+ const deserializeAws_json1_0_Stream = (output, context) => {
557
486
  return {
558
487
  StreamArn: __expectString(output.StreamArn),
559
488
  StreamLabel: __expectString(output.StreamLabel),
560
489
  TableName: __expectString(output.TableName),
561
490
  };
562
491
  };
563
- var deserializeAws_json1_0StreamDescription = function (output, context) {
492
+ const deserializeAws_json1_0StreamDescription = (output, context) => {
564
493
  return {
565
494
  CreationRequestDateTime: output.CreationRequestDateTime != null
566
495
  ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.CreationRequestDateTime)))
@@ -575,10 +504,10 @@ var deserializeAws_json1_0StreamDescription = function (output, context) {
575
504
  TableName: __expectString(output.TableName),
576
505
  };
577
506
  };
578
- var deserializeAws_json1_0StreamList = function (output, context) {
579
- var retVal = (output || [])
580
- .filter(function (e) { return e != null; })
581
- .map(function (entry) {
507
+ const deserializeAws_json1_0StreamList = (output, context) => {
508
+ const retVal = (output || [])
509
+ .filter((e) => e != null)
510
+ .map((entry) => {
582
511
  if (entry === null) {
583
512
  return null;
584
513
  }
@@ -586,7 +515,7 @@ var deserializeAws_json1_0StreamList = function (output, context) {
586
515
  });
587
516
  return retVal;
588
517
  };
589
- var deserializeAws_json1_0StreamRecord = function (output, context) {
518
+ const deserializeAws_json1_0StreamRecord = (output, context) => {
590
519
  return {
591
520
  ApproximateCreationDateTime: output.ApproximateCreationDateTime != null
592
521
  ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.ApproximateCreationDateTime)))
@@ -599,10 +528,10 @@ var deserializeAws_json1_0StreamRecord = function (output, context) {
599
528
  StreamViewType: __expectString(output.StreamViewType),
600
529
  };
601
530
  };
602
- var deserializeAws_json1_0StringSetAttributeValue = function (output, context) {
603
- var retVal = (output || [])
604
- .filter(function (e) { return e != null; })
605
- .map(function (entry) {
531
+ const deserializeAws_json1_0StringSetAttributeValue = (output, context) => {
532
+ const retVal = (output || [])
533
+ .filter((e) => e != null)
534
+ .map((entry) => {
606
535
  if (entry === null) {
607
536
  return null;
608
537
  }
@@ -610,80 +539,57 @@ var deserializeAws_json1_0StringSetAttributeValue = function (output, context) {
610
539
  });
611
540
  return retVal;
612
541
  };
613
- var deserializeAws_json1_0TrimmedDataAccessException = function (output, context) {
542
+ const deserializeAws_json1_0TrimmedDataAccessException = (output, context) => {
614
543
  return {
615
544
  message: __expectString(output.message),
616
545
  };
617
546
  };
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(); }
547
+ const deserializeMetadata = (output) => ({
548
+ httpStatusCode: output.statusCode,
549
+ requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-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) => {
629
554
  if (streamBody instanceof Uint8Array) {
630
555
  return Promise.resolve(streamBody);
631
556
  }
632
557
  return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
633
558
  };
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
- });
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);
669
577
  };
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;
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;
687
593
  if (typeof cleanValue === "number") {
688
594
  cleanValue = cleanValue.toString();
689
595
  }
@@ -698,7 +604,7 @@ var loadRestJsonErrorCode = function (output, data) {
698
604
  }
699
605
  return cleanValue;
700
606
  };
701
- var headerKey = findKey(output.headers, "x-amzn-errortype");
607
+ const headerKey = findKey(output.headers, "x-amzn-errortype");
702
608
  if (headerKey !== undefined) {
703
609
  return sanitizeErrorCode(output.headers[headerKey]);
704
610
  }