@aws-sdk/client-dynamodb-streams 3.927.0 → 3.929.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,322 +0,0 @@
1
- import { awsExpectUnion as __expectUnion, loadRestJsonErrorCode, parseJsonBody as parseBody, parseJsonErrorBody as parseErrorBody, } from "@aws-sdk/core";
2
- import { HttpRequest as __HttpRequest } from "@smithy/protocol-http";
3
- import { _json, collectBody, decorateServiceException as __decorateServiceException, expectBoolean as __expectBoolean, expectLong as __expectLong, expectNonNull as __expectNonNull, expectNumber as __expectNumber, expectString as __expectString, parseEpochTimestamp as __parseEpochTimestamp, take, withBaseException, } from "@smithy/smithy-client";
4
- import { DynamoDBStreamsServiceException as __BaseException } from "../models/DynamoDBStreamsServiceException";
5
- import { ExpiredIteratorException, InternalServerError, LimitExceededException, ResourceNotFoundException, TrimmedDataAccessException, } from "../models/models_0";
6
- export const se_DescribeStreamCommand = async (input, context) => {
7
- const headers = sharedHeaders("DescribeStream");
8
- let body;
9
- body = JSON.stringify(_json(input));
10
- return buildHttpRpcRequest(context, headers, "/", undefined, body);
11
- };
12
- export const se_GetRecordsCommand = async (input, context) => {
13
- const headers = sharedHeaders("GetRecords");
14
- let body;
15
- body = JSON.stringify(_json(input));
16
- return buildHttpRpcRequest(context, headers, "/", undefined, body);
17
- };
18
- export const se_GetShardIteratorCommand = async (input, context) => {
19
- const headers = sharedHeaders("GetShardIterator");
20
- let body;
21
- body = JSON.stringify(_json(input));
22
- return buildHttpRpcRequest(context, headers, "/", undefined, body);
23
- };
24
- export const se_ListStreamsCommand = async (input, context) => {
25
- const headers = sharedHeaders("ListStreams");
26
- let body;
27
- body = JSON.stringify(_json(input));
28
- return buildHttpRpcRequest(context, headers, "/", undefined, body);
29
- };
30
- export const de_DescribeStreamCommand = async (output, context) => {
31
- if (output.statusCode >= 300) {
32
- return de_CommandError(output, context);
33
- }
34
- const data = await parseBody(output.body, context);
35
- let contents = {};
36
- contents = de_DescribeStreamOutput(data, context);
37
- const response = {
38
- $metadata: deserializeMetadata(output),
39
- ...contents,
40
- };
41
- return response;
42
- };
43
- export const de_GetRecordsCommand = async (output, context) => {
44
- if (output.statusCode >= 300) {
45
- return de_CommandError(output, context);
46
- }
47
- const data = await parseBody(output.body, context);
48
- let contents = {};
49
- contents = de_GetRecordsOutput(data, context);
50
- const response = {
51
- $metadata: deserializeMetadata(output),
52
- ...contents,
53
- };
54
- return response;
55
- };
56
- export const de_GetShardIteratorCommand = async (output, context) => {
57
- if (output.statusCode >= 300) {
58
- return de_CommandError(output, context);
59
- }
60
- const data = await parseBody(output.body, context);
61
- let contents = {};
62
- contents = _json(data);
63
- const response = {
64
- $metadata: deserializeMetadata(output),
65
- ...contents,
66
- };
67
- return response;
68
- };
69
- export const de_ListStreamsCommand = async (output, context) => {
70
- if (output.statusCode >= 300) {
71
- return de_CommandError(output, context);
72
- }
73
- const data = await parseBody(output.body, context);
74
- let contents = {};
75
- contents = _json(data);
76
- const response = {
77
- $metadata: deserializeMetadata(output),
78
- ...contents,
79
- };
80
- return response;
81
- };
82
- const de_CommandError = async (output, context) => {
83
- const parsedOutput = {
84
- ...output,
85
- body: await parseErrorBody(output.body, context),
86
- };
87
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
88
- switch (errorCode) {
89
- case "InternalServerError":
90
- case "com.amazonaws.dynamodbstreams#InternalServerError":
91
- throw await de_InternalServerErrorRes(parsedOutput, context);
92
- case "ResourceNotFoundException":
93
- case "com.amazonaws.dynamodbstreams#ResourceNotFoundException":
94
- throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
95
- case "ExpiredIteratorException":
96
- case "com.amazonaws.dynamodbstreams#ExpiredIteratorException":
97
- throw await de_ExpiredIteratorExceptionRes(parsedOutput, context);
98
- case "LimitExceededException":
99
- case "com.amazonaws.dynamodbstreams#LimitExceededException":
100
- throw await de_LimitExceededExceptionRes(parsedOutput, context);
101
- case "TrimmedDataAccessException":
102
- case "com.amazonaws.dynamodbstreams#TrimmedDataAccessException":
103
- throw await de_TrimmedDataAccessExceptionRes(parsedOutput, context);
104
- default:
105
- const parsedBody = parsedOutput.body;
106
- return throwDefaultError({
107
- output,
108
- parsedBody,
109
- errorCode,
110
- });
111
- }
112
- };
113
- const de_ExpiredIteratorExceptionRes = async (parsedOutput, context) => {
114
- const body = parsedOutput.body;
115
- const deserialized = _json(body);
116
- const exception = new ExpiredIteratorException({
117
- $metadata: deserializeMetadata(parsedOutput),
118
- ...deserialized,
119
- });
120
- return __decorateServiceException(exception, body);
121
- };
122
- const de_InternalServerErrorRes = async (parsedOutput, context) => {
123
- const body = parsedOutput.body;
124
- const deserialized = _json(body);
125
- const exception = new InternalServerError({
126
- $metadata: deserializeMetadata(parsedOutput),
127
- ...deserialized,
128
- });
129
- return __decorateServiceException(exception, body);
130
- };
131
- const de_LimitExceededExceptionRes = async (parsedOutput, context) => {
132
- const body = parsedOutput.body;
133
- const deserialized = _json(body);
134
- const exception = new LimitExceededException({
135
- $metadata: deserializeMetadata(parsedOutput),
136
- ...deserialized,
137
- });
138
- return __decorateServiceException(exception, body);
139
- };
140
- const de_ResourceNotFoundExceptionRes = async (parsedOutput, context) => {
141
- const body = parsedOutput.body;
142
- const deserialized = _json(body);
143
- const exception = new ResourceNotFoundException({
144
- $metadata: deserializeMetadata(parsedOutput),
145
- ...deserialized,
146
- });
147
- return __decorateServiceException(exception, body);
148
- };
149
- const de_TrimmedDataAccessExceptionRes = async (parsedOutput, context) => {
150
- const body = parsedOutput.body;
151
- const deserialized = _json(body);
152
- const exception = new TrimmedDataAccessException({
153
- $metadata: deserializeMetadata(parsedOutput),
154
- ...deserialized,
155
- });
156
- return __decorateServiceException(exception, body);
157
- };
158
- const de_AttributeMap = (output, context) => {
159
- return Object.entries(output).reduce((acc, [key, value]) => {
160
- if (value === null) {
161
- return acc;
162
- }
163
- acc[key] = de_AttributeValue(__expectUnion(value), context);
164
- return acc;
165
- }, {});
166
- };
167
- const de_AttributeValue = (output, context) => {
168
- if (output.B != null) {
169
- return {
170
- B: context.base64Decoder(output.B),
171
- };
172
- }
173
- if (__expectBoolean(output.BOOL) !== undefined) {
174
- return { BOOL: __expectBoolean(output.BOOL) };
175
- }
176
- if (output.BS != null) {
177
- return {
178
- BS: de_BinarySetAttributeValue(output.BS, context),
179
- };
180
- }
181
- if (output.L != null) {
182
- return {
183
- L: de_ListAttributeValue(output.L, context),
184
- };
185
- }
186
- if (output.M != null) {
187
- return {
188
- M: de_MapAttributeValue(output.M, context),
189
- };
190
- }
191
- if (__expectString(output.N) !== undefined) {
192
- return { N: __expectString(output.N) };
193
- }
194
- if (output.NS != null) {
195
- return {
196
- NS: _json(output.NS),
197
- };
198
- }
199
- if (__expectBoolean(output.NULL) !== undefined) {
200
- return { NULL: __expectBoolean(output.NULL) };
201
- }
202
- if (__expectString(output.S) !== undefined) {
203
- return { S: __expectString(output.S) };
204
- }
205
- if (output.SS != null) {
206
- return {
207
- SS: _json(output.SS),
208
- };
209
- }
210
- return { $unknown: Object.entries(output)[0] };
211
- };
212
- const de_BinarySetAttributeValue = (output, context) => {
213
- const retVal = (output || [])
214
- .filter((e) => e != null)
215
- .map((entry) => {
216
- return context.base64Decoder(entry);
217
- });
218
- return retVal;
219
- };
220
- const de_DescribeStreamOutput = (output, context) => {
221
- return take(output, {
222
- StreamDescription: (_) => de_StreamDescription(_, context),
223
- });
224
- };
225
- const de_GetRecordsOutput = (output, context) => {
226
- return take(output, {
227
- NextShardIterator: __expectString,
228
- Records: (_) => de_RecordList(_, context),
229
- });
230
- };
231
- const de_ListAttributeValue = (output, context) => {
232
- const retVal = (output || [])
233
- .filter((e) => e != null)
234
- .map((entry) => {
235
- return de_AttributeValue(__expectUnion(entry), context);
236
- });
237
- return retVal;
238
- };
239
- const de_MapAttributeValue = (output, context) => {
240
- return Object.entries(output).reduce((acc, [key, value]) => {
241
- if (value === null) {
242
- return acc;
243
- }
244
- acc[key] = de_AttributeValue(__expectUnion(value), context);
245
- return acc;
246
- }, {});
247
- };
248
- const de__Record = (output, context) => {
249
- return take(output, {
250
- awsRegion: __expectString,
251
- dynamodb: (_) => de_StreamRecord(_, context),
252
- eventID: __expectString,
253
- eventName: __expectString,
254
- eventSource: __expectString,
255
- eventVersion: __expectString,
256
- userIdentity: _json,
257
- });
258
- };
259
- const de_RecordList = (output, context) => {
260
- const retVal = (output || [])
261
- .filter((e) => e != null)
262
- .map((entry) => {
263
- return de__Record(entry, context);
264
- });
265
- return retVal;
266
- };
267
- const de_StreamDescription = (output, context) => {
268
- return take(output, {
269
- CreationRequestDateTime: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
270
- KeySchema: _json,
271
- LastEvaluatedShardId: __expectString,
272
- Shards: _json,
273
- StreamArn: __expectString,
274
- StreamLabel: __expectString,
275
- StreamStatus: __expectString,
276
- StreamViewType: __expectString,
277
- TableName: __expectString,
278
- });
279
- };
280
- const de_StreamRecord = (output, context) => {
281
- return take(output, {
282
- ApproximateCreationDateTime: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
283
- Keys: (_) => de_AttributeMap(_, context),
284
- NewImage: (_) => de_AttributeMap(_, context),
285
- OldImage: (_) => de_AttributeMap(_, context),
286
- SequenceNumber: __expectString,
287
- SizeBytes: __expectLong,
288
- StreamViewType: __expectString,
289
- });
290
- };
291
- const deserializeMetadata = (output) => ({
292
- httpStatusCode: output.statusCode,
293
- requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
294
- extendedRequestId: output.headers["x-amz-id-2"],
295
- cfId: output.headers["x-amz-cf-id"],
296
- });
297
- const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
298
- const throwDefaultError = withBaseException(__BaseException);
299
- const buildHttpRpcRequest = async (context, headers, path, resolvedHostname, body) => {
300
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
301
- const contents = {
302
- protocol,
303
- hostname,
304
- port,
305
- method: "POST",
306
- path: basePath.endsWith("/") ? basePath.slice(0, -1) + path : basePath + path,
307
- headers,
308
- };
309
- if (resolvedHostname !== undefined) {
310
- contents.hostname = resolvedHostname;
311
- }
312
- if (body !== undefined) {
313
- contents.body = body;
314
- }
315
- return new __HttpRequest(contents);
316
- };
317
- function sharedHeaders(operation) {
318
- return {
319
- "content-type": "application/x-amz-json-1.0",
320
- "x-amz-target": `DynamoDBStreams_20120810.${operation}`,
321
- };
322
- }
@@ -1,38 +0,0 @@
1
- import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@smithy/protocol-http";
2
- import { SerdeContext as __SerdeContext } from "@smithy/types";
3
- import { DescribeStreamCommandInput, DescribeStreamCommandOutput } from "../commands/DescribeStreamCommand";
4
- import { GetRecordsCommandInput, GetRecordsCommandOutput } from "../commands/GetRecordsCommand";
5
- import { GetShardIteratorCommandInput, GetShardIteratorCommandOutput } from "../commands/GetShardIteratorCommand";
6
- import { ListStreamsCommandInput, ListStreamsCommandOutput } from "../commands/ListStreamsCommand";
7
- /**
8
- * serializeAws_json1_0DescribeStreamCommand
9
- */
10
- export declare const se_DescribeStreamCommand: (input: DescribeStreamCommandInput, context: __SerdeContext) => Promise<__HttpRequest>;
11
- /**
12
- * serializeAws_json1_0GetRecordsCommand
13
- */
14
- export declare const se_GetRecordsCommand: (input: GetRecordsCommandInput, context: __SerdeContext) => Promise<__HttpRequest>;
15
- /**
16
- * serializeAws_json1_0GetShardIteratorCommand
17
- */
18
- export declare const se_GetShardIteratorCommand: (input: GetShardIteratorCommandInput, context: __SerdeContext) => Promise<__HttpRequest>;
19
- /**
20
- * serializeAws_json1_0ListStreamsCommand
21
- */
22
- export declare const se_ListStreamsCommand: (input: ListStreamsCommandInput, context: __SerdeContext) => Promise<__HttpRequest>;
23
- /**
24
- * deserializeAws_json1_0DescribeStreamCommand
25
- */
26
- export declare const de_DescribeStreamCommand: (output: __HttpResponse, context: __SerdeContext) => Promise<DescribeStreamCommandOutput>;
27
- /**
28
- * deserializeAws_json1_0GetRecordsCommand
29
- */
30
- export declare const de_GetRecordsCommand: (output: __HttpResponse, context: __SerdeContext) => Promise<GetRecordsCommandOutput>;
31
- /**
32
- * deserializeAws_json1_0GetShardIteratorCommand
33
- */
34
- export declare const de_GetShardIteratorCommand: (output: __HttpResponse, context: __SerdeContext) => Promise<GetShardIteratorCommandOutput>;
35
- /**
36
- * deserializeAws_json1_0ListStreamsCommand
37
- */
38
- export declare const de_ListStreamsCommand: (output: __HttpResponse, context: __SerdeContext) => Promise<ListStreamsCommandOutput>;
@@ -1,53 +0,0 @@
1
- import {
2
- HttpRequest as __HttpRequest,
3
- HttpResponse as __HttpResponse,
4
- } from "@smithy/protocol-http";
5
- import { SerdeContext as __SerdeContext } from "@smithy/types";
6
- import {
7
- DescribeStreamCommandInput,
8
- DescribeStreamCommandOutput,
9
- } from "../commands/DescribeStreamCommand";
10
- import {
11
- GetRecordsCommandInput,
12
- GetRecordsCommandOutput,
13
- } from "../commands/GetRecordsCommand";
14
- import {
15
- GetShardIteratorCommandInput,
16
- GetShardIteratorCommandOutput,
17
- } from "../commands/GetShardIteratorCommand";
18
- import {
19
- ListStreamsCommandInput,
20
- ListStreamsCommandOutput,
21
- } from "../commands/ListStreamsCommand";
22
- export declare const se_DescribeStreamCommand: (
23
- input: DescribeStreamCommandInput,
24
- context: __SerdeContext
25
- ) => Promise<__HttpRequest>;
26
- export declare const se_GetRecordsCommand: (
27
- input: GetRecordsCommandInput,
28
- context: __SerdeContext
29
- ) => Promise<__HttpRequest>;
30
- export declare const se_GetShardIteratorCommand: (
31
- input: GetShardIteratorCommandInput,
32
- context: __SerdeContext
33
- ) => Promise<__HttpRequest>;
34
- export declare const se_ListStreamsCommand: (
35
- input: ListStreamsCommandInput,
36
- context: __SerdeContext
37
- ) => Promise<__HttpRequest>;
38
- export declare const de_DescribeStreamCommand: (
39
- output: __HttpResponse,
40
- context: __SerdeContext
41
- ) => Promise<DescribeStreamCommandOutput>;
42
- export declare const de_GetRecordsCommand: (
43
- output: __HttpResponse,
44
- context: __SerdeContext
45
- ) => Promise<GetRecordsCommandOutput>;
46
- export declare const de_GetShardIteratorCommand: (
47
- output: __HttpResponse,
48
- context: __SerdeContext
49
- ) => Promise<GetShardIteratorCommandOutput>;
50
- export declare const de_ListStreamsCommand: (
51
- output: __HttpResponse,
52
- context: __SerdeContext
53
- ) => Promise<ListStreamsCommandOutput>;