@aws-sdk/client-dynamodb-streams 3.32.0 → 3.36.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/{dist/cjs → dist-cjs}/DynamoDBStreams.js +1 -2
  3. package/{dist/cjs → dist-cjs}/DynamoDBStreamsClient.js +8 -9
  4. package/{dist/cjs → dist-cjs}/commands/DescribeStreamCommand.js +2 -3
  5. package/{dist/cjs → dist-cjs}/commands/GetRecordsCommand.js +2 -3
  6. package/{dist/cjs → dist-cjs}/commands/GetShardIteratorCommand.js +2 -3
  7. package/{dist/cjs → dist-cjs}/commands/ListStreamsCommand.js +2 -3
  8. package/{dist/cjs → dist-cjs}/endpoints.js +0 -1
  9. package/{dist/cjs → dist-cjs}/index.js +0 -1
  10. package/{dist/cjs → dist-cjs}/models/index.js +0 -1
  11. package/{dist/cjs → dist-cjs}/models/models_0.js +0 -1
  12. package/{dist/cjs → dist-cjs}/protocols/Aws_json1_0.js +0 -1
  13. package/{dist/cjs → dist-cjs}/runtimeConfig.browser.js +2 -2
  14. package/{dist/cjs → dist-cjs}/runtimeConfig.js +2 -2
  15. package/{dist/cjs → dist-cjs}/runtimeConfig.native.js +0 -1
  16. package/{dist/cjs → dist-cjs}/runtimeConfig.shared.js +1 -2
  17. package/{dist/es → dist-es}/DynamoDBStreams.js +2 -11
  18. package/{dist/es → dist-es}/DynamoDBStreamsClient.js +2 -16
  19. package/dist-es/commands/DescribeStreamCommand.js +39 -0
  20. package/dist-es/commands/GetRecordsCommand.js +39 -0
  21. package/{dist/es → dist-es}/commands/GetShardIteratorCommand.js +4 -37
  22. package/{dist/es → dist-es}/commands/ListStreamsCommand.js +4 -35
  23. package/{dist/es → dist-es}/endpoints.js +1 -2
  24. package/{dist/types/index.d.ts → dist-es/index.js} +0 -0
  25. package/{dist/types/models/index.d.ts → dist-es/models/index.js} +0 -0
  26. package/{dist/es → dist-es}/models/models_0.js +0 -67
  27. package/{dist/es → dist-es}/protocols/Aws_json1_0.js +83 -89
  28. package/{dist/es → dist-es}/runtimeConfig.browser.js +1 -5
  29. package/{dist/es → dist-es}/runtimeConfig.js +1 -5
  30. package/{dist/es → dist-es}/runtimeConfig.native.js +0 -4
  31. package/{dist/es → dist-es}/runtimeConfig.shared.js +1 -5
  32. package/{dist/types → dist-types}/DynamoDBStreams.d.ts +2 -2
  33. package/{dist/types → dist-types}/DynamoDBStreamsClient.d.ts +5 -5
  34. package/{dist/types → dist-types}/commands/DescribeStreamCommand.d.ts +2 -2
  35. package/{dist/types → dist-types}/commands/GetRecordsCommand.d.ts +2 -2
  36. package/{dist/types → dist-types}/commands/GetShardIteratorCommand.d.ts +2 -2
  37. package/{dist/types → dist-types}/commands/ListStreamsCommand.d.ts +2 -2
  38. package/{dist/types → dist-types}/endpoints.d.ts +0 -0
  39. package/{index.ts → dist-types/index.d.ts} +0 -0
  40. package/{models/index.ts → dist-types/models/index.d.ts} +0 -0
  41. package/{dist/types → dist-types}/models/models_0.d.ts +0 -0
  42. package/{dist/types → dist-types}/protocols/Aws_json1_0.d.ts +2 -2
  43. package/{dist/types/ts3.4 → dist-types}/runtimeConfig.browser.d.ts +37 -36
  44. package/{dist/types/ts3.4 → dist-types}/runtimeConfig.d.ts +37 -36
  45. package/{dist/types/ts3.4 → dist-types}/runtimeConfig.native.d.ts +36 -35
  46. package/{dist/types → dist-types}/runtimeConfig.shared.d.ts +0 -0
  47. package/{dist/types → dist-types}/ts3.4/DynamoDBStreams.d.ts +2 -2
  48. package/{dist/types → dist-types}/ts3.4/DynamoDBStreamsClient.d.ts +5 -5
  49. package/{dist/types → dist-types}/ts3.4/commands/DescribeStreamCommand.d.ts +2 -2
  50. package/{dist/types → dist-types}/ts3.4/commands/GetRecordsCommand.d.ts +2 -2
  51. package/{dist/types → dist-types}/ts3.4/commands/GetShardIteratorCommand.d.ts +2 -2
  52. package/{dist/types → dist-types}/ts3.4/commands/ListStreamsCommand.d.ts +2 -2
  53. package/{dist/types → dist-types}/ts3.4/endpoints.d.ts +0 -0
  54. package/{dist/types → dist-types}/ts3.4/index.d.ts +0 -0
  55. package/{dist/types → dist-types}/ts3.4/models/index.d.ts +0 -0
  56. package/{dist/types → dist-types}/ts3.4/models/models_0.d.ts +0 -0
  57. package/{dist/types → dist-types}/ts3.4/protocols/Aws_json1_0.d.ts +2 -2
  58. package/{dist/types → dist-types/ts3.4}/runtimeConfig.browser.d.ts +37 -36
  59. package/{dist/types → dist-types/ts3.4}/runtimeConfig.d.ts +37 -36
  60. package/{dist/types → dist-types/ts3.4}/runtimeConfig.native.d.ts +36 -35
  61. package/{dist/types → dist-types}/ts3.4/runtimeConfig.shared.d.ts +0 -0
  62. package/package.json +52 -49
  63. package/DynamoDBStreams.ts +0 -170
  64. package/DynamoDBStreamsClient.ts +0 -252
  65. package/commands/DescribeStreamCommand.ts +0 -102
  66. package/commands/GetRecordsCommand.ts +0 -104
  67. package/commands/GetShardIteratorCommand.ts +0 -101
  68. package/commands/ListStreamsCommand.ts +0 -99
  69. package/dist/cjs/DynamoDBStreams.js.map +0 -1
  70. package/dist/cjs/DynamoDBStreamsClient.js.map +0 -1
  71. package/dist/cjs/commands/DescribeStreamCommand.js.map +0 -1
  72. package/dist/cjs/commands/GetRecordsCommand.js.map +0 -1
  73. package/dist/cjs/commands/GetShardIteratorCommand.js.map +0 -1
  74. package/dist/cjs/commands/ListStreamsCommand.js.map +0 -1
  75. package/dist/cjs/endpoints.js.map +0 -1
  76. package/dist/cjs/index.js.map +0 -1
  77. package/dist/cjs/models/index.js.map +0 -1
  78. package/dist/cjs/models/models_0.js.map +0 -1
  79. package/dist/cjs/package.json +0 -91
  80. package/dist/cjs/protocols/Aws_json1_0.js.map +0 -1
  81. package/dist/cjs/runtimeConfig.browser.js.map +0 -1
  82. package/dist/cjs/runtimeConfig.js.map +0 -1
  83. package/dist/cjs/runtimeConfig.native.js.map +0 -1
  84. package/dist/cjs/runtimeConfig.shared.js.map +0 -1
  85. package/dist/es/DynamoDBStreams.js.map +0 -1
  86. package/dist/es/DynamoDBStreamsClient.js.map +0 -1
  87. package/dist/es/commands/DescribeStreamCommand.js +0 -73
  88. package/dist/es/commands/DescribeStreamCommand.js.map +0 -1
  89. package/dist/es/commands/GetRecordsCommand.js +0 -75
  90. package/dist/es/commands/GetRecordsCommand.js.map +0 -1
  91. package/dist/es/commands/GetShardIteratorCommand.js.map +0 -1
  92. package/dist/es/commands/ListStreamsCommand.js.map +0 -1
  93. package/dist/es/endpoints.js.map +0 -1
  94. package/dist/es/index.js +0 -8
  95. package/dist/es/index.js.map +0 -1
  96. package/dist/es/models/index.js +0 -2
  97. package/dist/es/models/index.js.map +0 -1
  98. package/dist/es/models/models_0.js.map +0 -1
  99. package/dist/es/package.json +0 -91
  100. package/dist/es/protocols/Aws_json1_0.js.map +0 -1
  101. package/dist/es/runtimeConfig.browser.js.map +0 -1
  102. package/dist/es/runtimeConfig.js.map +0 -1
  103. package/dist/es/runtimeConfig.native.js.map +0 -1
  104. package/dist/es/runtimeConfig.shared.js.map +0 -1
  105. package/endpoints.ts +0 -96
  106. package/jest.config.js +0 -4
  107. package/models/models_0.ts +0 -1132
  108. package/protocols/Aws_json1_0.ts +0 -917
  109. package/runtimeConfig.browser.ts +0 -40
  110. package/runtimeConfig.native.ts +0 -16
  111. package/runtimeConfig.shared.ts +0 -16
  112. package/runtimeConfig.ts +0 -45
  113. package/tsconfig.es.json +0 -12
  114. package/tsconfig.json +0 -32
@@ -1,917 +0,0 @@
1
- import { DescribeStreamCommandInput, DescribeStreamCommandOutput } from "../commands/DescribeStreamCommand";
2
- import { GetRecordsCommandInput, GetRecordsCommandOutput } from "../commands/GetRecordsCommand";
3
- import { GetShardIteratorCommandInput, GetShardIteratorCommandOutput } from "../commands/GetShardIteratorCommand";
4
- import { ListStreamsCommandInput, ListStreamsCommandOutput } from "../commands/ListStreamsCommand";
5
- import {
6
- AttributeValue,
7
- DescribeStreamInput,
8
- DescribeStreamOutput,
9
- ExpiredIteratorException,
10
- GetRecordsInput,
11
- GetRecordsOutput,
12
- GetShardIteratorInput,
13
- GetShardIteratorOutput,
14
- Identity,
15
- InternalServerError,
16
- KeySchemaElement,
17
- LimitExceededException,
18
- ListStreamsInput,
19
- ListStreamsOutput,
20
- ResourceNotFoundException,
21
- SequenceNumberRange,
22
- Shard,
23
- StreamDescription,
24
- StreamRecord,
25
- TrimmedDataAccessException,
26
- _Record,
27
- _Stream,
28
- } from "../models/models_0";
29
- import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
30
- import {
31
- expectBoolean as __expectBoolean,
32
- expectLong as __expectLong,
33
- expectNonNull as __expectNonNull,
34
- expectNumber as __expectNumber,
35
- expectString as __expectString,
36
- expectUnion as __expectUnion,
37
- parseEpochTimestamp as __parseEpochTimestamp,
38
- } from "@aws-sdk/smithy-client";
39
- import {
40
- Endpoint as __Endpoint,
41
- HeaderBag as __HeaderBag,
42
- MetadataBearer as __MetadataBearer,
43
- ResponseMetadata as __ResponseMetadata,
44
- SerdeContext as __SerdeContext,
45
- SmithyException as __SmithyException,
46
- } from "@aws-sdk/types";
47
-
48
- export const serializeAws_json1_0DescribeStreamCommand = async (
49
- input: DescribeStreamCommandInput,
50
- context: __SerdeContext
51
- ): Promise<__HttpRequest> => {
52
- const headers: __HeaderBag = {
53
- "content-type": "application/x-amz-json-1.0",
54
- "x-amz-target": "DynamoDBStreams_20120810.DescribeStream",
55
- };
56
- let body: any;
57
- body = JSON.stringify(serializeAws_json1_0DescribeStreamInput(input, context));
58
- return buildHttpRpcRequest(context, headers, "/", undefined, body);
59
- };
60
-
61
- export const serializeAws_json1_0GetRecordsCommand = async (
62
- input: GetRecordsCommandInput,
63
- context: __SerdeContext
64
- ): Promise<__HttpRequest> => {
65
- const headers: __HeaderBag = {
66
- "content-type": "application/x-amz-json-1.0",
67
- "x-amz-target": "DynamoDBStreams_20120810.GetRecords",
68
- };
69
- let body: any;
70
- body = JSON.stringify(serializeAws_json1_0GetRecordsInput(input, context));
71
- return buildHttpRpcRequest(context, headers, "/", undefined, body);
72
- };
73
-
74
- export const serializeAws_json1_0GetShardIteratorCommand = async (
75
- input: GetShardIteratorCommandInput,
76
- context: __SerdeContext
77
- ): Promise<__HttpRequest> => {
78
- const headers: __HeaderBag = {
79
- "content-type": "application/x-amz-json-1.0",
80
- "x-amz-target": "DynamoDBStreams_20120810.GetShardIterator",
81
- };
82
- let body: any;
83
- body = JSON.stringify(serializeAws_json1_0GetShardIteratorInput(input, context));
84
- return buildHttpRpcRequest(context, headers, "/", undefined, body);
85
- };
86
-
87
- export const serializeAws_json1_0ListStreamsCommand = async (
88
- input: ListStreamsCommandInput,
89
- context: __SerdeContext
90
- ): Promise<__HttpRequest> => {
91
- const headers: __HeaderBag = {
92
- "content-type": "application/x-amz-json-1.0",
93
- "x-amz-target": "DynamoDBStreams_20120810.ListStreams",
94
- };
95
- let body: any;
96
- body = JSON.stringify(serializeAws_json1_0ListStreamsInput(input, context));
97
- return buildHttpRpcRequest(context, headers, "/", undefined, body);
98
- };
99
-
100
- export const deserializeAws_json1_0DescribeStreamCommand = async (
101
- output: __HttpResponse,
102
- context: __SerdeContext
103
- ): Promise<DescribeStreamCommandOutput> => {
104
- if (output.statusCode >= 300) {
105
- return deserializeAws_json1_0DescribeStreamCommandError(output, context);
106
- }
107
- const data: any = await parseBody(output.body, context);
108
- let contents: any = {};
109
- contents = deserializeAws_json1_0DescribeStreamOutput(data, context);
110
- const response: DescribeStreamCommandOutput = {
111
- $metadata: deserializeMetadata(output),
112
- ...contents,
113
- };
114
- return Promise.resolve(response);
115
- };
116
-
117
- const deserializeAws_json1_0DescribeStreamCommandError = async (
118
- output: __HttpResponse,
119
- context: __SerdeContext
120
- ): Promise<DescribeStreamCommandOutput> => {
121
- const parsedOutput: any = {
122
- ...output,
123
- body: await parseBody(output.body, context),
124
- };
125
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
126
- let errorCode: string = "UnknownError";
127
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
128
- switch (errorCode) {
129
- case "InternalServerError":
130
- case "com.amazonaws.dynamodbstreams#InternalServerError":
131
- response = {
132
- ...(await deserializeAws_json1_0InternalServerErrorResponse(parsedOutput, context)),
133
- name: errorCode,
134
- $metadata: deserializeMetadata(output),
135
- };
136
- break;
137
- case "ResourceNotFoundException":
138
- case "com.amazonaws.dynamodbstreams#ResourceNotFoundException":
139
- response = {
140
- ...(await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context)),
141
- name: errorCode,
142
- $metadata: deserializeMetadata(output),
143
- };
144
- break;
145
- default:
146
- const parsedBody = parsedOutput.body;
147
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
148
- response = {
149
- ...parsedBody,
150
- name: `${errorCode}`,
151
- message: parsedBody.message || parsedBody.Message || errorCode,
152
- $fault: "client",
153
- $metadata: deserializeMetadata(output),
154
- } as any;
155
- }
156
- const message = response.message || response.Message || errorCode;
157
- response.message = message;
158
- delete response.Message;
159
- return Promise.reject(Object.assign(new Error(message), response));
160
- };
161
-
162
- export const deserializeAws_json1_0GetRecordsCommand = async (
163
- output: __HttpResponse,
164
- context: __SerdeContext
165
- ): Promise<GetRecordsCommandOutput> => {
166
- if (output.statusCode >= 300) {
167
- return deserializeAws_json1_0GetRecordsCommandError(output, context);
168
- }
169
- const data: any = await parseBody(output.body, context);
170
- let contents: any = {};
171
- contents = deserializeAws_json1_0GetRecordsOutput(data, context);
172
- const response: GetRecordsCommandOutput = {
173
- $metadata: deserializeMetadata(output),
174
- ...contents,
175
- };
176
- return Promise.resolve(response);
177
- };
178
-
179
- const deserializeAws_json1_0GetRecordsCommandError = async (
180
- output: __HttpResponse,
181
- context: __SerdeContext
182
- ): Promise<GetRecordsCommandOutput> => {
183
- const parsedOutput: any = {
184
- ...output,
185
- body: await parseBody(output.body, context),
186
- };
187
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
188
- let errorCode: string = "UnknownError";
189
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
190
- switch (errorCode) {
191
- case "ExpiredIteratorException":
192
- case "com.amazonaws.dynamodbstreams#ExpiredIteratorException":
193
- response = {
194
- ...(await deserializeAws_json1_0ExpiredIteratorExceptionResponse(parsedOutput, context)),
195
- name: errorCode,
196
- $metadata: deserializeMetadata(output),
197
- };
198
- break;
199
- case "InternalServerError":
200
- case "com.amazonaws.dynamodbstreams#InternalServerError":
201
- response = {
202
- ...(await deserializeAws_json1_0InternalServerErrorResponse(parsedOutput, context)),
203
- name: errorCode,
204
- $metadata: deserializeMetadata(output),
205
- };
206
- break;
207
- case "LimitExceededException":
208
- case "com.amazonaws.dynamodbstreams#LimitExceededException":
209
- response = {
210
- ...(await deserializeAws_json1_0LimitExceededExceptionResponse(parsedOutput, context)),
211
- name: errorCode,
212
- $metadata: deserializeMetadata(output),
213
- };
214
- break;
215
- case "ResourceNotFoundException":
216
- case "com.amazonaws.dynamodbstreams#ResourceNotFoundException":
217
- response = {
218
- ...(await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context)),
219
- name: errorCode,
220
- $metadata: deserializeMetadata(output),
221
- };
222
- break;
223
- case "TrimmedDataAccessException":
224
- case "com.amazonaws.dynamodbstreams#TrimmedDataAccessException":
225
- response = {
226
- ...(await deserializeAws_json1_0TrimmedDataAccessExceptionResponse(parsedOutput, context)),
227
- name: errorCode,
228
- $metadata: deserializeMetadata(output),
229
- };
230
- break;
231
- default:
232
- const parsedBody = parsedOutput.body;
233
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
234
- response = {
235
- ...parsedBody,
236
- name: `${errorCode}`,
237
- message: parsedBody.message || parsedBody.Message || errorCode,
238
- $fault: "client",
239
- $metadata: deserializeMetadata(output),
240
- } as any;
241
- }
242
- const message = response.message || response.Message || errorCode;
243
- response.message = message;
244
- delete response.Message;
245
- return Promise.reject(Object.assign(new Error(message), response));
246
- };
247
-
248
- export const deserializeAws_json1_0GetShardIteratorCommand = async (
249
- output: __HttpResponse,
250
- context: __SerdeContext
251
- ): Promise<GetShardIteratorCommandOutput> => {
252
- if (output.statusCode >= 300) {
253
- return deserializeAws_json1_0GetShardIteratorCommandError(output, context);
254
- }
255
- const data: any = await parseBody(output.body, context);
256
- let contents: any = {};
257
- contents = deserializeAws_json1_0GetShardIteratorOutput(data, context);
258
- const response: GetShardIteratorCommandOutput = {
259
- $metadata: deserializeMetadata(output),
260
- ...contents,
261
- };
262
- return Promise.resolve(response);
263
- };
264
-
265
- const deserializeAws_json1_0GetShardIteratorCommandError = async (
266
- output: __HttpResponse,
267
- context: __SerdeContext
268
- ): Promise<GetShardIteratorCommandOutput> => {
269
- const parsedOutput: any = {
270
- ...output,
271
- body: await parseBody(output.body, context),
272
- };
273
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
274
- let errorCode: string = "UnknownError";
275
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
276
- switch (errorCode) {
277
- case "InternalServerError":
278
- case "com.amazonaws.dynamodbstreams#InternalServerError":
279
- response = {
280
- ...(await deserializeAws_json1_0InternalServerErrorResponse(parsedOutput, context)),
281
- name: errorCode,
282
- $metadata: deserializeMetadata(output),
283
- };
284
- break;
285
- case "ResourceNotFoundException":
286
- case "com.amazonaws.dynamodbstreams#ResourceNotFoundException":
287
- response = {
288
- ...(await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context)),
289
- name: errorCode,
290
- $metadata: deserializeMetadata(output),
291
- };
292
- break;
293
- case "TrimmedDataAccessException":
294
- case "com.amazonaws.dynamodbstreams#TrimmedDataAccessException":
295
- response = {
296
- ...(await deserializeAws_json1_0TrimmedDataAccessExceptionResponse(parsedOutput, context)),
297
- name: errorCode,
298
- $metadata: deserializeMetadata(output),
299
- };
300
- break;
301
- default:
302
- const parsedBody = parsedOutput.body;
303
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
304
- response = {
305
- ...parsedBody,
306
- name: `${errorCode}`,
307
- message: parsedBody.message || parsedBody.Message || errorCode,
308
- $fault: "client",
309
- $metadata: deserializeMetadata(output),
310
- } as any;
311
- }
312
- const message = response.message || response.Message || errorCode;
313
- response.message = message;
314
- delete response.Message;
315
- return Promise.reject(Object.assign(new Error(message), response));
316
- };
317
-
318
- export const deserializeAws_json1_0ListStreamsCommand = async (
319
- output: __HttpResponse,
320
- context: __SerdeContext
321
- ): Promise<ListStreamsCommandOutput> => {
322
- if (output.statusCode >= 300) {
323
- return deserializeAws_json1_0ListStreamsCommandError(output, context);
324
- }
325
- const data: any = await parseBody(output.body, context);
326
- let contents: any = {};
327
- contents = deserializeAws_json1_0ListStreamsOutput(data, context);
328
- const response: ListStreamsCommandOutput = {
329
- $metadata: deserializeMetadata(output),
330
- ...contents,
331
- };
332
- return Promise.resolve(response);
333
- };
334
-
335
- const deserializeAws_json1_0ListStreamsCommandError = async (
336
- output: __HttpResponse,
337
- context: __SerdeContext
338
- ): Promise<ListStreamsCommandOutput> => {
339
- const parsedOutput: any = {
340
- ...output,
341
- body: await parseBody(output.body, context),
342
- };
343
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
344
- let errorCode: string = "UnknownError";
345
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
346
- switch (errorCode) {
347
- case "InternalServerError":
348
- case "com.amazonaws.dynamodbstreams#InternalServerError":
349
- response = {
350
- ...(await deserializeAws_json1_0InternalServerErrorResponse(parsedOutput, context)),
351
- name: errorCode,
352
- $metadata: deserializeMetadata(output),
353
- };
354
- break;
355
- case "ResourceNotFoundException":
356
- case "com.amazonaws.dynamodbstreams#ResourceNotFoundException":
357
- response = {
358
- ...(await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context)),
359
- name: errorCode,
360
- $metadata: deserializeMetadata(output),
361
- };
362
- break;
363
- default:
364
- const parsedBody = parsedOutput.body;
365
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
366
- response = {
367
- ...parsedBody,
368
- name: `${errorCode}`,
369
- message: parsedBody.message || parsedBody.Message || errorCode,
370
- $fault: "client",
371
- $metadata: deserializeMetadata(output),
372
- } as any;
373
- }
374
- const message = response.message || response.Message || errorCode;
375
- response.message = message;
376
- delete response.Message;
377
- return Promise.reject(Object.assign(new Error(message), response));
378
- };
379
-
380
- const deserializeAws_json1_0ExpiredIteratorExceptionResponse = async (
381
- parsedOutput: any,
382
- context: __SerdeContext
383
- ): Promise<ExpiredIteratorException> => {
384
- const body = parsedOutput.body;
385
- const deserialized: any = deserializeAws_json1_0ExpiredIteratorException(body, context);
386
- const contents: ExpiredIteratorException = {
387
- name: "ExpiredIteratorException",
388
- $fault: "client",
389
- $metadata: deserializeMetadata(parsedOutput),
390
- ...deserialized,
391
- };
392
- return contents;
393
- };
394
-
395
- const deserializeAws_json1_0InternalServerErrorResponse = async (
396
- parsedOutput: any,
397
- context: __SerdeContext
398
- ): Promise<InternalServerError> => {
399
- const body = parsedOutput.body;
400
- const deserialized: any = deserializeAws_json1_0InternalServerError(body, context);
401
- const contents: InternalServerError = {
402
- name: "InternalServerError",
403
- $fault: "server",
404
- $metadata: deserializeMetadata(parsedOutput),
405
- ...deserialized,
406
- };
407
- return contents;
408
- };
409
-
410
- const deserializeAws_json1_0LimitExceededExceptionResponse = async (
411
- parsedOutput: any,
412
- context: __SerdeContext
413
- ): Promise<LimitExceededException> => {
414
- const body = parsedOutput.body;
415
- const deserialized: any = deserializeAws_json1_0LimitExceededException(body, context);
416
- const contents: LimitExceededException = {
417
- name: "LimitExceededException",
418
- $fault: "client",
419
- $metadata: deserializeMetadata(parsedOutput),
420
- ...deserialized,
421
- };
422
- return contents;
423
- };
424
-
425
- const deserializeAws_json1_0ResourceNotFoundExceptionResponse = async (
426
- parsedOutput: any,
427
- context: __SerdeContext
428
- ): Promise<ResourceNotFoundException> => {
429
- const body = parsedOutput.body;
430
- const deserialized: any = deserializeAws_json1_0ResourceNotFoundException(body, context);
431
- const contents: ResourceNotFoundException = {
432
- name: "ResourceNotFoundException",
433
- $fault: "client",
434
- $metadata: deserializeMetadata(parsedOutput),
435
- ...deserialized,
436
- };
437
- return contents;
438
- };
439
-
440
- const deserializeAws_json1_0TrimmedDataAccessExceptionResponse = async (
441
- parsedOutput: any,
442
- context: __SerdeContext
443
- ): Promise<TrimmedDataAccessException> => {
444
- const body = parsedOutput.body;
445
- const deserialized: any = deserializeAws_json1_0TrimmedDataAccessException(body, context);
446
- const contents: TrimmedDataAccessException = {
447
- name: "TrimmedDataAccessException",
448
- $fault: "client",
449
- $metadata: deserializeMetadata(parsedOutput),
450
- ...deserialized,
451
- };
452
- return contents;
453
- };
454
-
455
- const serializeAws_json1_0DescribeStreamInput = (input: DescribeStreamInput, context: __SerdeContext): any => {
456
- return {
457
- ...(input.ExclusiveStartShardId !== undefined &&
458
- input.ExclusiveStartShardId !== null && { ExclusiveStartShardId: input.ExclusiveStartShardId }),
459
- ...(input.Limit !== undefined && input.Limit !== null && { Limit: input.Limit }),
460
- ...(input.StreamArn !== undefined && input.StreamArn !== null && { StreamArn: input.StreamArn }),
461
- };
462
- };
463
-
464
- const serializeAws_json1_0GetRecordsInput = (input: GetRecordsInput, context: __SerdeContext): any => {
465
- return {
466
- ...(input.Limit !== undefined && input.Limit !== null && { Limit: input.Limit }),
467
- ...(input.ShardIterator !== undefined && input.ShardIterator !== null && { ShardIterator: input.ShardIterator }),
468
- };
469
- };
470
-
471
- const serializeAws_json1_0GetShardIteratorInput = (input: GetShardIteratorInput, context: __SerdeContext): any => {
472
- return {
473
- ...(input.SequenceNumber !== undefined &&
474
- input.SequenceNumber !== null && { SequenceNumber: input.SequenceNumber }),
475
- ...(input.ShardId !== undefined && input.ShardId !== null && { ShardId: input.ShardId }),
476
- ...(input.ShardIteratorType !== undefined &&
477
- input.ShardIteratorType !== null && { ShardIteratorType: input.ShardIteratorType }),
478
- ...(input.StreamArn !== undefined && input.StreamArn !== null && { StreamArn: input.StreamArn }),
479
- };
480
- };
481
-
482
- const serializeAws_json1_0ListStreamsInput = (input: ListStreamsInput, context: __SerdeContext): any => {
483
- return {
484
- ...(input.ExclusiveStartStreamArn !== undefined &&
485
- input.ExclusiveStartStreamArn !== null && { ExclusiveStartStreamArn: input.ExclusiveStartStreamArn }),
486
- ...(input.Limit !== undefined && input.Limit !== null && { Limit: input.Limit }),
487
- ...(input.TableName !== undefined && input.TableName !== null && { TableName: input.TableName }),
488
- };
489
- };
490
-
491
- const deserializeAws_json1_0AttributeMap = (
492
- output: any,
493
- context: __SerdeContext
494
- ): { [key: string]: AttributeValue } => {
495
- return Object.entries(output).reduce((acc: { [key: string]: AttributeValue }, [key, value]: [string, any]) => {
496
- if (value === null) {
497
- return acc;
498
- }
499
- return {
500
- ...acc,
501
- [key]: deserializeAws_json1_0AttributeValue(__expectUnion(value), context),
502
- };
503
- }, {});
504
- };
505
-
506
- const deserializeAws_json1_0AttributeValue = (output: any, context: __SerdeContext): AttributeValue => {
507
- if (output.B !== undefined && output.B !== null) {
508
- return {
509
- B: context.base64Decoder(output.B),
510
- };
511
- }
512
- if (__expectBoolean(output.BOOL) !== undefined) {
513
- return { BOOL: __expectBoolean(output.BOOL) as any };
514
- }
515
- if (output.BS !== undefined && output.BS !== null) {
516
- return {
517
- BS: deserializeAws_json1_0BinarySetAttributeValue(output.BS, context),
518
- };
519
- }
520
- if (output.L !== undefined && output.L !== null) {
521
- return {
522
- L: deserializeAws_json1_0ListAttributeValue(output.L, context),
523
- };
524
- }
525
- if (output.M !== undefined && output.M !== null) {
526
- return {
527
- M: deserializeAws_json1_0MapAttributeValue(output.M, context),
528
- };
529
- }
530
- if (__expectString(output.N) !== undefined) {
531
- return { N: __expectString(output.N) as any };
532
- }
533
- if (output.NS !== undefined && output.NS !== null) {
534
- return {
535
- NS: deserializeAws_json1_0NumberSetAttributeValue(output.NS, context),
536
- };
537
- }
538
- if (__expectBoolean(output.NULL) !== undefined) {
539
- return { NULL: __expectBoolean(output.NULL) as any };
540
- }
541
- if (__expectString(output.S) !== undefined) {
542
- return { S: __expectString(output.S) as any };
543
- }
544
- if (output.SS !== undefined && output.SS !== null) {
545
- return {
546
- SS: deserializeAws_json1_0StringSetAttributeValue(output.SS, context),
547
- };
548
- }
549
- return { $unknown: Object.entries(output)[0] };
550
- };
551
-
552
- const deserializeAws_json1_0BinarySetAttributeValue = (output: any, context: __SerdeContext): Uint8Array[] => {
553
- return (output || [])
554
- .filter((e: any) => e != null)
555
- .map((entry: any) => {
556
- if (entry === null) {
557
- return null as any;
558
- }
559
- return context.base64Decoder(entry);
560
- });
561
- };
562
-
563
- const deserializeAws_json1_0DescribeStreamOutput = (output: any, context: __SerdeContext): DescribeStreamOutput => {
564
- return {
565
- StreamDescription:
566
- output.StreamDescription !== undefined && output.StreamDescription !== null
567
- ? deserializeAws_json1_0StreamDescription(output.StreamDescription, context)
568
- : undefined,
569
- } as any;
570
- };
571
-
572
- const deserializeAws_json1_0ExpiredIteratorException = (
573
- output: any,
574
- context: __SerdeContext
575
- ): ExpiredIteratorException => {
576
- return {
577
- message: __expectString(output.message),
578
- } as any;
579
- };
580
-
581
- const deserializeAws_json1_0GetRecordsOutput = (output: any, context: __SerdeContext): GetRecordsOutput => {
582
- return {
583
- NextShardIterator: __expectString(output.NextShardIterator),
584
- Records:
585
- output.Records !== undefined && output.Records !== null
586
- ? deserializeAws_json1_0RecordList(output.Records, context)
587
- : undefined,
588
- } as any;
589
- };
590
-
591
- const deserializeAws_json1_0GetShardIteratorOutput = (output: any, context: __SerdeContext): GetShardIteratorOutput => {
592
- return {
593
- ShardIterator: __expectString(output.ShardIterator),
594
- } as any;
595
- };
596
-
597
- const deserializeAws_json1_0Identity = (output: any, context: __SerdeContext): Identity => {
598
- return {
599
- PrincipalId: __expectString(output.PrincipalId),
600
- Type: __expectString(output.Type),
601
- } as any;
602
- };
603
-
604
- const deserializeAws_json1_0InternalServerError = (output: any, context: __SerdeContext): InternalServerError => {
605
- return {
606
- message: __expectString(output.message),
607
- } as any;
608
- };
609
-
610
- const deserializeAws_json1_0KeySchema = (output: any, context: __SerdeContext): KeySchemaElement[] => {
611
- return (output || [])
612
- .filter((e: any) => e != null)
613
- .map((entry: any) => {
614
- if (entry === null) {
615
- return null as any;
616
- }
617
- return deserializeAws_json1_0KeySchemaElement(entry, context);
618
- });
619
- };
620
-
621
- const deserializeAws_json1_0KeySchemaElement = (output: any, context: __SerdeContext): KeySchemaElement => {
622
- return {
623
- AttributeName: __expectString(output.AttributeName),
624
- KeyType: __expectString(output.KeyType),
625
- } as any;
626
- };
627
-
628
- const deserializeAws_json1_0LimitExceededException = (output: any, context: __SerdeContext): LimitExceededException => {
629
- return {
630
- message: __expectString(output.message),
631
- } as any;
632
- };
633
-
634
- const deserializeAws_json1_0ListAttributeValue = (output: any, context: __SerdeContext): AttributeValue[] => {
635
- return (output || [])
636
- .filter((e: any) => e != null)
637
- .map((entry: any) => {
638
- if (entry === null) {
639
- return null as any;
640
- }
641
- return deserializeAws_json1_0AttributeValue(__expectUnion(entry), context);
642
- });
643
- };
644
-
645
- const deserializeAws_json1_0ListStreamsOutput = (output: any, context: __SerdeContext): ListStreamsOutput => {
646
- return {
647
- LastEvaluatedStreamArn: __expectString(output.LastEvaluatedStreamArn),
648
- Streams:
649
- output.Streams !== undefined && output.Streams !== null
650
- ? deserializeAws_json1_0StreamList(output.Streams, context)
651
- : undefined,
652
- } as any;
653
- };
654
-
655
- const deserializeAws_json1_0MapAttributeValue = (
656
- output: any,
657
- context: __SerdeContext
658
- ): { [key: string]: AttributeValue } => {
659
- return Object.entries(output).reduce((acc: { [key: string]: AttributeValue }, [key, value]: [string, any]) => {
660
- if (value === null) {
661
- return acc;
662
- }
663
- return {
664
- ...acc,
665
- [key]: deserializeAws_json1_0AttributeValue(__expectUnion(value), context),
666
- };
667
- }, {});
668
- };
669
-
670
- const deserializeAws_json1_0NumberSetAttributeValue = (output: any, context: __SerdeContext): string[] => {
671
- return (output || [])
672
- .filter((e: any) => e != null)
673
- .map((entry: any) => {
674
- if (entry === null) {
675
- return null as any;
676
- }
677
- return __expectString(entry) as any;
678
- });
679
- };
680
-
681
- const deserializeAws_json1_0_Record = (output: any, context: __SerdeContext): _Record => {
682
- return {
683
- awsRegion: __expectString(output.awsRegion),
684
- dynamodb:
685
- output.dynamodb !== undefined && output.dynamodb !== null
686
- ? deserializeAws_json1_0StreamRecord(output.dynamodb, context)
687
- : undefined,
688
- eventID: __expectString(output.eventID),
689
- eventName: __expectString(output.eventName),
690
- eventSource: __expectString(output.eventSource),
691
- eventVersion: __expectString(output.eventVersion),
692
- userIdentity:
693
- output.userIdentity !== undefined && output.userIdentity !== null
694
- ? deserializeAws_json1_0Identity(output.userIdentity, context)
695
- : undefined,
696
- } as any;
697
- };
698
-
699
- const deserializeAws_json1_0RecordList = (output: any, context: __SerdeContext): _Record[] => {
700
- return (output || [])
701
- .filter((e: any) => e != null)
702
- .map((entry: any) => {
703
- if (entry === null) {
704
- return null as any;
705
- }
706
- return deserializeAws_json1_0_Record(entry, context);
707
- });
708
- };
709
-
710
- const deserializeAws_json1_0ResourceNotFoundException = (
711
- output: any,
712
- context: __SerdeContext
713
- ): ResourceNotFoundException => {
714
- return {
715
- message: __expectString(output.message),
716
- } as any;
717
- };
718
-
719
- const deserializeAws_json1_0SequenceNumberRange = (output: any, context: __SerdeContext): SequenceNumberRange => {
720
- return {
721
- EndingSequenceNumber: __expectString(output.EndingSequenceNumber),
722
- StartingSequenceNumber: __expectString(output.StartingSequenceNumber),
723
- } as any;
724
- };
725
-
726
- const deserializeAws_json1_0Shard = (output: any, context: __SerdeContext): Shard => {
727
- return {
728
- ParentShardId: __expectString(output.ParentShardId),
729
- SequenceNumberRange:
730
- output.SequenceNumberRange !== undefined && output.SequenceNumberRange !== null
731
- ? deserializeAws_json1_0SequenceNumberRange(output.SequenceNumberRange, context)
732
- : undefined,
733
- ShardId: __expectString(output.ShardId),
734
- } as any;
735
- };
736
-
737
- const deserializeAws_json1_0ShardDescriptionList = (output: any, context: __SerdeContext): Shard[] => {
738
- return (output || [])
739
- .filter((e: any) => e != null)
740
- .map((entry: any) => {
741
- if (entry === null) {
742
- return null as any;
743
- }
744
- return deserializeAws_json1_0Shard(entry, context);
745
- });
746
- };
747
-
748
- const deserializeAws_json1_0_Stream = (output: any, context: __SerdeContext): _Stream => {
749
- return {
750
- StreamArn: __expectString(output.StreamArn),
751
- StreamLabel: __expectString(output.StreamLabel),
752
- TableName: __expectString(output.TableName),
753
- } as any;
754
- };
755
-
756
- const deserializeAws_json1_0StreamDescription = (output: any, context: __SerdeContext): StreamDescription => {
757
- return {
758
- CreationRequestDateTime:
759
- output.CreationRequestDateTime !== undefined && output.CreationRequestDateTime !== null
760
- ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.CreationRequestDateTime)))
761
- : undefined,
762
- KeySchema:
763
- output.KeySchema !== undefined && output.KeySchema !== null
764
- ? deserializeAws_json1_0KeySchema(output.KeySchema, context)
765
- : undefined,
766
- LastEvaluatedShardId: __expectString(output.LastEvaluatedShardId),
767
- Shards:
768
- output.Shards !== undefined && output.Shards !== null
769
- ? deserializeAws_json1_0ShardDescriptionList(output.Shards, context)
770
- : undefined,
771
- StreamArn: __expectString(output.StreamArn),
772
- StreamLabel: __expectString(output.StreamLabel),
773
- StreamStatus: __expectString(output.StreamStatus),
774
- StreamViewType: __expectString(output.StreamViewType),
775
- TableName: __expectString(output.TableName),
776
- } as any;
777
- };
778
-
779
- const deserializeAws_json1_0StreamList = (output: any, context: __SerdeContext): _Stream[] => {
780
- return (output || [])
781
- .filter((e: any) => e != null)
782
- .map((entry: any) => {
783
- if (entry === null) {
784
- return null as any;
785
- }
786
- return deserializeAws_json1_0_Stream(entry, context);
787
- });
788
- };
789
-
790
- const deserializeAws_json1_0StreamRecord = (output: any, context: __SerdeContext): StreamRecord => {
791
- return {
792
- ApproximateCreationDateTime:
793
- output.ApproximateCreationDateTime !== undefined && output.ApproximateCreationDateTime !== null
794
- ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.ApproximateCreationDateTime)))
795
- : undefined,
796
- Keys:
797
- output.Keys !== undefined && output.Keys !== null
798
- ? deserializeAws_json1_0AttributeMap(output.Keys, context)
799
- : undefined,
800
- NewImage:
801
- output.NewImage !== undefined && output.NewImage !== null
802
- ? deserializeAws_json1_0AttributeMap(output.NewImage, context)
803
- : undefined,
804
- OldImage:
805
- output.OldImage !== undefined && output.OldImage !== null
806
- ? deserializeAws_json1_0AttributeMap(output.OldImage, context)
807
- : undefined,
808
- SequenceNumber: __expectString(output.SequenceNumber),
809
- SizeBytes: __expectLong(output.SizeBytes),
810
- StreamViewType: __expectString(output.StreamViewType),
811
- } as any;
812
- };
813
-
814
- const deserializeAws_json1_0StringSetAttributeValue = (output: any, context: __SerdeContext): string[] => {
815
- return (output || [])
816
- .filter((e: any) => e != null)
817
- .map((entry: any) => {
818
- if (entry === null) {
819
- return null as any;
820
- }
821
- return __expectString(entry) as any;
822
- });
823
- };
824
-
825
- const deserializeAws_json1_0TrimmedDataAccessException = (
826
- output: any,
827
- context: __SerdeContext
828
- ): TrimmedDataAccessException => {
829
- return {
830
- message: __expectString(output.message),
831
- } as any;
832
- };
833
-
834
- const deserializeMetadata = (output: __HttpResponse): __ResponseMetadata => ({
835
- httpStatusCode: output.statusCode,
836
- requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"],
837
- extendedRequestId: output.headers["x-amz-id-2"],
838
- cfId: output.headers["x-amz-cf-id"],
839
- });
840
-
841
- // Collect low-level response body stream to Uint8Array.
842
- const collectBody = (streamBody: any = new Uint8Array(), context: __SerdeContext): Promise<Uint8Array> => {
843
- if (streamBody instanceof Uint8Array) {
844
- return Promise.resolve(streamBody);
845
- }
846
- return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
847
- };
848
-
849
- // Encode Uint8Array data into string with utf-8.
850
- const collectBodyString = (streamBody: any, context: __SerdeContext): Promise<string> =>
851
- collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
852
-
853
- const buildHttpRpcRequest = async (
854
- context: __SerdeContext,
855
- headers: __HeaderBag,
856
- path: string,
857
- resolvedHostname: string | undefined,
858
- body: any
859
- ): Promise<__HttpRequest> => {
860
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
861
- const contents: any = {
862
- protocol,
863
- hostname,
864
- port,
865
- method: "POST",
866
- path: basePath.endsWith("/") ? basePath.slice(0, -1) + path : basePath + path,
867
- headers,
868
- };
869
- if (resolvedHostname !== undefined) {
870
- contents.hostname = resolvedHostname;
871
- }
872
- if (body !== undefined) {
873
- contents.body = body;
874
- }
875
- return new __HttpRequest(contents);
876
- };
877
-
878
- const parseBody = (streamBody: any, context: __SerdeContext): any =>
879
- collectBodyString(streamBody, context).then((encoded) => {
880
- if (encoded.length) {
881
- return JSON.parse(encoded);
882
- }
883
- return {};
884
- });
885
-
886
- /**
887
- * Load an error code for the aws.rest-json-1.1 protocol.
888
- */
889
- const loadRestJsonErrorCode = (output: __HttpResponse, data: any): string => {
890
- const findKey = (object: any, key: string) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
891
-
892
- const sanitizeErrorCode = (rawValue: string): string => {
893
- let cleanValue = rawValue;
894
- if (cleanValue.indexOf(":") >= 0) {
895
- cleanValue = cleanValue.split(":")[0];
896
- }
897
- if (cleanValue.indexOf("#") >= 0) {
898
- cleanValue = cleanValue.split("#")[1];
899
- }
900
- return cleanValue;
901
- };
902
-
903
- const headerKey = findKey(output.headers, "x-amzn-errortype");
904
- if (headerKey !== undefined) {
905
- return sanitizeErrorCode(output.headers[headerKey]);
906
- }
907
-
908
- if (data.code !== undefined) {
909
- return sanitizeErrorCode(data.code);
910
- }
911
-
912
- if (data["__type"] !== undefined) {
913
- return sanitizeErrorCode(data["__type"]);
914
- }
915
-
916
- return "";
917
- };