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