@reventlessdev/rescript-aws-sdk 2.2.0-alpha.20

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 (47) hide show
  1. package/CHANGELOG.md +174 -0
  2. package/LICENSE +202 -0
  3. package/README.md +21 -0
  4. package/package.json +44 -0
  5. package/rescript.json +23 -0
  6. package/src/CloudWatchEvents.res +162 -0
  7. package/src/CloudWatchEvents.res.mjs +94 -0
  8. package/src/CognitoIdentityServiceProvider.res +117 -0
  9. package/src/CognitoIdentityServiceProvider.res.mjs +70 -0
  10. package/src/DynamoDb.res +3 -0
  11. package/src/DynamoDb.res.mjs +15 -0
  12. package/src/DynamoDb_DocumentClient.res +905 -0
  13. package/src/DynamoDb_DocumentClient.res.mjs +338 -0
  14. package/src/DynamoDb_DynamoDb.res +189 -0
  15. package/src/DynamoDb_DynamoDb.res.mjs +70 -0
  16. package/src/DynamoDb_Util.res +128 -0
  17. package/src/DynamoDb_Util.res.mjs +35 -0
  18. package/src/DynamoDb_Util_Helpers.res +7 -0
  19. package/src/DynamoDb_Util_Helpers.res.mjs +23 -0
  20. package/src/ECS.res +96 -0
  21. package/src/ECS.res.mjs +46 -0
  22. package/src/IAM.res +20 -0
  23. package/src/IAM.res.mjs +9 -0
  24. package/src/Kinesis.res +50 -0
  25. package/src/Kinesis.res.mjs +39 -0
  26. package/src/Metadata.res +9 -0
  27. package/src/Metadata.res.mjs +2 -0
  28. package/src/NodeHttpHandler.res +6 -0
  29. package/src/NodeHttpHandler.res.mjs +2 -0
  30. package/src/S3.res +152 -0
  31. package/src/S3.res.mjs +61 -0
  32. package/src/S3_Helpers.res +20 -0
  33. package/src/S3_Helpers.res.mjs +26 -0
  34. package/src/SES.res +113 -0
  35. package/src/SES.res.mjs +59 -0
  36. package/src/SNS.res +167 -0
  37. package/src/SNS.res.mjs +98 -0
  38. package/src/SNS_Helpers.res +45 -0
  39. package/src/SNS_Helpers.res.mjs +57 -0
  40. package/src/SQS.res +241 -0
  41. package/src/SQS.res.mjs +121 -0
  42. package/src/SQS_Helpers.res +267 -0
  43. package/src/SQS_Helpers.res.mjs +227 -0
  44. package/src/SecretsManager.res +61 -0
  45. package/src/SecretsManager.res.mjs +46 -0
  46. package/src/example/DynamoDbUtilExample.res +20 -0
  47. package/src/example/DynamoDbUtilExample.res.mjs +66 -0
@@ -0,0 +1,905 @@
1
+ /*** @aws-sdk/lib-dynamodbdy
2
+ see: https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-lib-dynamodb/
3
+
4
+ ## difference of dynamodb-client vs document-client
5
+ - dynamodb-client is able to `send` commands which use attributeValues
6
+ - document-client only provides operations on "documents" (table-data)
7
+ - but not on the tables themselves
8
+ - document-client is able to `send` commands AND has methods (named like the commands) which (both) take js-objects instead of attribute values (and abstracts away un-/marshalling)
9
+ */
10
+
11
+ type client
12
+
13
+ /*
14
+ # TODO
15
+
16
+ - documentclient can `client.send(command)` AND call opertaions like `client.put(..)`
17
+ - use method variant for operations
18
+ */
19
+
20
+ type marshallOptions = {convertEmptyValues: bool}
21
+
22
+ type unmarshallOptions = {wrapNumbers: bool}
23
+
24
+ type translateConfig = {
25
+ marshallOptions?: DynamoDb_Util.MarshallOptions.options,
26
+ unmarshallOptions?: DynamoDb_Util.Raw.unmarshallOptions,
27
+ }
28
+
29
+ module Raw = {
30
+ @module("@aws-sdk/lib-dynamodb") @scope("DynamoDBDocumentClient")
31
+ external client: (DynamoDb_DynamoDb.client, translateConfig, unit) => client = "from"
32
+ }
33
+
34
+ let clientInstance = ref(None)
35
+
36
+ /** create a DynamoDBDocumentClient with default values:
37
+ - maxAttempts: 3,
38
+ - connectionTimeout: 1000ms
39
+ - requestTimeout: 5000ms
40
+ - convertEmptyValues: false
41
+ - removeUndefinedValues: true
42
+
43
+ use `Raw.client` if you want to set alternative configuration
44
+ */
45
+ let client = () =>
46
+ switch clientInstance.contents {
47
+ | None =>
48
+ let docClient = DynamoDb_DynamoDb.client()->Raw.client(
49
+ {
50
+ // removeUndefinedValues: ReScript's `field?: T` syntax leaves
51
+ // unset optional record fields as JS `undefined`. Without this flag the
52
+ // marshaller rejects the whole item — see e.g. PluginsReadModelSpec.state
53
+ // with its optional `apiTarget?: string`, where every put that omits
54
+ // the field would otherwise throw.
55
+ marshallOptions: {
56
+ convertEmptyValues: false,
57
+ removeUndefinedValues: true,
58
+ },
59
+ },
60
+ (),
61
+ )
62
+ clientInstance := Some(docClient)
63
+ docClient
64
+ | Some(docClient) => docClient
65
+ }
66
+
67
+ type capacity = {
68
+ @as("ReadCapacityUnits") readCapacityUnits: int,
69
+ @as("WriteCapacityUnits") writeCapacityUnits: int,
70
+ @as("CapacityUnits") capacityUnits: int,
71
+ }
72
+ type consumedCapacity = {
73
+ @as("TableName") tableName: string,
74
+ @as("CapacityUnits") capacityUnits: int,
75
+ @as("ReadCapacityUnits") readCapacityUnits: int,
76
+ @as("WriteCapacityUnits") writeCapacityUnits: int,
77
+ @as("Table") table: capacity,
78
+ @as("LocalSecondaryIndexes") localSecondaryIndexes: dict<capacity>,
79
+ @as("GlobalSecondaryIndexes") globalSecondaryIndexes: dict<capacity>,
80
+ }
81
+ type itemCollectionMetric = {
82
+ @as("ItemCollectionKey") itemCollectionKey: JSON.t,
83
+ @as("SizeEstimateRangeGB") sizeEstimateRangeGB: array<float>,
84
+ }
85
+ type returnConsumedCapacity = [#INDEXES | #TOTAL | #NONE]
86
+ type returnItemCollectionMetrics = [#SIZE | #NONE]
87
+ type returnValues = [
88
+ | #NONE
89
+ | #ALL_OLD
90
+ | #UPDATED_OLD
91
+ | #ALL_NEW
92
+ | #UPDATED_NEW
93
+ ]
94
+
95
+ type returnValuesOnConditionCheckFailure = [#NONE | #ALL_OLD]
96
+
97
+ type select = [
98
+ /** Returns all of the item attributes from the specified table or index. If you query a local secondary index, then for each matching item in the index, DynamoDB fetches the entire item from the parent table. If the index is configured to project all item attributes, then all of the data can be obtained from the local secondary index, and no fetching is required. */
99
+ | #ALL_ATTRIBUTES
100
+ /** Allowed only when querying an index. Retrieves all attributes that have been projected into the index. If the index is configured to project all attributes, this return value is equivalent to specifying ALL_ATTRIBUTES. */
101
+ | #ALL_PROJECTED_ATTRIBUTES
102
+ /** Returns the number of matching items, rather than the matching items themselves. Note that this uses the same quantity of read capacity units as getting the items, and is subject to the same item size calculations. */
103
+ | #COUNT
104
+ /** Returns only the attributes listed in ProjectionExpression. This return value is equivalent to specifying ProjectionExpression without specifying any value for Select. */
105
+ | #SPECIFIC_ATTRIBUTES
106
+ ]
107
+
108
+ let getIntAttribute = (attributes: option<dict<JSON.t>>, name: string) => {
109
+ attributes->Option.flatMap(attribute =>
110
+ attribute
111
+ ->Dict.get(name)
112
+ ->Option.flatMap(value => value->JSON.Decode.float)
113
+ ->Option.map(number => number->Int.fromFloat)
114
+ )
115
+ }
116
+
117
+ module PutCommand = {
118
+ type t
119
+
120
+ /** see: https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-lib-dynamodb/TypeAlias/PutCommandInput/
121
+ and: https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/dynamodb/command/PutItemCommand/
122
+
123
+ attributes without bindings yet:
124
+ - ConditionalOperator
125
+ - Expected
126
+ */
127
+ type input = {
128
+ @as("Item")
129
+ item: JSON.t,
130
+ @as("TableName") tableName: string,
131
+ @as("ConditionExpression") conditionExpression?: string,
132
+ @as("ExpressionAttributeNames") expressionAttributeNames?: dict<string>,
133
+ /** this is actually a js object (key/value pairs)*/
134
+ @as("ExpressionAttributeValues")
135
+ expressionAttributeValues?: dict<JSON.t>,
136
+ @as("ReturnConsumedCapacity") returnConsumedCapacity?: returnConsumedCapacity,
137
+ @as("ReturnItemCollectionMetrics") returnItemCollectionMetrics?: returnItemCollectionMetrics,
138
+ @as("ReturnValues") returnValues?: returnValues,
139
+ @as("ReturnValuesOnConditionCheckFailure")
140
+ returnValuesOnConditionCheckFailure?: returnValuesOnConditionCheckFailure,
141
+ }
142
+
143
+ type output = {
144
+ @as("$metadata") metadata: Metadata.t,
145
+ @as("Attributes") attributes?: JSON.t,
146
+ @as("ConsumedCapacity") consumedCapacity?: consumedCapacity,
147
+ @as("ItemCollectionMetrics") itemCollectionMetrics?: itemCollectionMetric,
148
+ }
149
+
150
+ @new @module("@aws-sdk/lib-dynamodb")
151
+ external make: input => t = "PutCommand"
152
+
153
+ module Raw = {
154
+ @send
155
+ external send: (client, t) => promise<output> = "send"
156
+ }
157
+
158
+ let send: t => promise<output> = input => Raw.send(client(), input)
159
+ }
160
+
161
+ /** send individual put requests for any item
162
+ `batchWrite` can not use `conditionExpression`s
163
+ */
164
+ let putMany = (tableName, conditionalExpression, items) => {
165
+ items
166
+ ->Array.map(item => {
167
+ open PutCommand
168
+ {
169
+ PutCommand.tableName,
170
+ item,
171
+ conditionExpression: conditionalExpression,
172
+ }
173
+ ->make
174
+ ->send
175
+ })
176
+ ->Promise.all // FIXME: use allSettled (otherwise the first rejection in the array, will "cancel" out all others
177
+ }
178
+
179
+ /** send put request with a default conditionExpression */
180
+ let putIfNotExists = (tableName, idKey, sortKey: option<Nullable.t<string>>, item) => {
181
+ open PutCommand
182
+ {
183
+ PutCommand.item,
184
+ tableName,
185
+ conditionExpression: switch sortKey {
186
+ | Some(Value(sortKey)) => `attribute_not_exists(${idKey}) and attribute_not_exists(${sortKey})`
187
+ | _ => `attribute_not_exists(${idKey})`
188
+ },
189
+ }
190
+ ->make
191
+ ->send
192
+ }
193
+
194
+ module PutError = {
195
+ /*** see throws section in: https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/dynamodb/command/PutItemCommand/ */
196
+
197
+ module ConditionCheckFailedException = {
198
+ let name = "ConditionalCheckFailedException"
199
+ /** see:
200
+ - https://github.com/smithy-lang/smithy-typescript/blob/75e0125c8d25c4b1002f39d9d0fac7792acc3d43/packages/types/src/http.ts#L33
201
+ - https://github.com/smithy-lang/smithy-typescript/blob/75e0125c8d25c4b1002f39d9d0fac7792acc3d43/packages/types/src/http.ts#L43
202
+ */
203
+ type response = {
204
+ headers: dict<string>,
205
+ statusCode: int,
206
+ body: unknown,
207
+ }
208
+ /** see: https://github.com/smithy-lang/smithy-typescript/blob/75e0125c8d25c4b1002f39d9d0fac7792acc3d43/packages/types/src/shapes.ts#L30 */
209
+ type retryable = {throttling?: bool}
210
+ /* TODO: extract to dynamoDBServiceException type
211
+ this enables you to use type coercion (https://rescript-lang.org/docs/manual/latest/record#record-type-coercion) to transform any of the concretely type records to dynamoDBServiceException
212
+ e.g.
213
+ ```rescript
214
+ let exn: ConditionCheckFailedException.t = <exn>
215
+ let coercedExn: dynamoDBServiceException = <exn> :> dynamoDBServiceException
216
+ ```
217
+ */
218
+ type t = {
219
+ /** `="client"` */
220
+ @as("$fault")
221
+ fault: string, // TODO: extract to `DynamoDBServiceException` type and spread this type
222
+ @as("$metadata")
223
+ metadata: Metadata.t, // TODO: extract to `DynamoDBServiceException` type and spread this type
224
+ @as("$response")
225
+ response?: response, // TODO: extract to `DynamoDBServiceException` type and spread this type
226
+ @as("$retryable")
227
+ retryable?: retryable, // TODO: extract to `DynamoDBServiceException` type and spread this type
228
+ // this must be an object!
229
+ @as("Item")
230
+ item: JSON.t,
231
+ /** `ConditionalCheckFailedException` */
232
+ name: string,
233
+ }
234
+
235
+ external ofJsExn: JsExn.t => t = "%identity"
236
+ }
237
+
238
+ module InternalServerError = {
239
+ let name = "InternalServerError"
240
+ type t
241
+
242
+ external ofJsExn: JsExn.t => t = "%identity"
243
+ }
244
+
245
+ module InvalidEndpointException = {
246
+ let name = "InvalidEndpointException"
247
+ type t
248
+
249
+ external ofJsExn: JsExn.t => t = "%identity"
250
+ }
251
+
252
+ module ItemCollectionSizeLimitExceededException = {
253
+ let name = "ItemCollectionSizeLimitExceededException"
254
+ type t
255
+
256
+ external ofJsExn: JsExn.t => t = "%identity"
257
+ }
258
+
259
+ module ProvisionedThroughputExceededException = {
260
+ let name = "ProvisionedThroughputExceededException"
261
+ type t
262
+
263
+ external ofJsExn: JsExn.t => t = "%identity"
264
+ }
265
+
266
+ module RequestLimitExceeded = {
267
+ let name = "RequestLimitExceeded"
268
+ type t
269
+
270
+ external ofJsExn: JsExn.t => t = "%identity"
271
+ }
272
+
273
+ module ResourceNotFoundException = {
274
+ let name = "ResourceNotFoundException"
275
+ type t
276
+
277
+ external ofJsExn: JsExn.t => t = "%identity"
278
+ }
279
+
280
+ module TransactionConflictException = {
281
+ let name = "TransactionConflictException"
282
+ type t
283
+
284
+ external ofJsExn: JsExn.t => t = "%identity"
285
+ }
286
+
287
+ module DynamoDBServiceException = {
288
+ let name = "DynamoDBServiceException"
289
+ type t
290
+
291
+ external ofJsExn: JsExn.t => t = "%identity"
292
+ }
293
+
294
+ type t =
295
+ | ConditionCheckFailedException(ConditionCheckFailedException.t)
296
+ | InternalServerError(InternalServerError.t)
297
+ | InvalidEndpointException(InvalidEndpointException.t)
298
+ | ItemCollectionSizeLimitExceededException(ItemCollectionSizeLimitExceededException.t)
299
+ | ProvisionedThroughputExceededException(ProvisionedThroughputExceededException.t)
300
+ | RequestLimitExceeded(RequestLimitExceeded.t)
301
+ | ResourceNotFoundException(ResourceNotFoundException.t)
302
+ | TransactionConflictException(TransactionConflictException.t)
303
+ | DynamoDBServiceException(DynamoDBServiceException.t)
304
+ | Unknown(JsExn.t)
305
+
306
+ let classify: JsExn.t => t = exn => {
307
+ let name = exn->JsExn.name->Option.getOr("")
308
+ if name == ConditionCheckFailedException.name {
309
+ ConditionCheckFailedException(exn->ConditionCheckFailedException.ofJsExn)
310
+ } else if name == InternalServerError.name {
311
+ InternalServerError(exn->InternalServerError.ofJsExn)
312
+ } else if name == InvalidEndpointException.name {
313
+ InvalidEndpointException(exn->InvalidEndpointException.ofJsExn)
314
+ } else if name == ItemCollectionSizeLimitExceededException.name {
315
+ ItemCollectionSizeLimitExceededException(
316
+ exn->ItemCollectionSizeLimitExceededException.ofJsExn,
317
+ )
318
+ } else if name == ProvisionedThroughputExceededException.name {
319
+ ProvisionedThroughputExceededException(exn->ProvisionedThroughputExceededException.ofJsExn)
320
+ } else if name == RequestLimitExceeded.name {
321
+ RequestLimitExceeded(exn->RequestLimitExceeded.ofJsExn)
322
+ } else if name == ResourceNotFoundException.name {
323
+ ResourceNotFoundException(exn->ResourceNotFoundException.ofJsExn)
324
+ } else if name == TransactionConflictException.name {
325
+ TransactionConflictException(exn->TransactionConflictException.ofJsExn)
326
+ } else if name == DynamoDBServiceException.name {
327
+ DynamoDBServiceException(exn->DynamoDBServiceException.ofJsExn)
328
+ } else {
329
+ Unknown(exn)
330
+ }
331
+ }
332
+ }
333
+
334
+ module BatchWriteCommand = {
335
+ /*** see: https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/dynamodb/command/BatchWriteItemCommand/ */
336
+
337
+ type t
338
+
339
+ type putRequest = {
340
+ /** A map of attribute name to attribute values, representing the primary key of an item to be processed by PutItem. All of the table's primary key attributes must be specified, and their data types must match those of the table's key schema. If any attributes are present in the item that are part of an index key schema for the table, their types must match the index key schema.
341
+
342
+ this must be an object!
343
+ */
344
+ @as("Item")
345
+ item: JSON.t,
346
+ }
347
+ type deleteRequest = {
348
+ /** A map of attribute name to attribute values, representing the primary key of the item to delete. All of the table's primary key attributes must be specified, and their data types must match those of the table's key schema.
349
+ note: this uses JSON.t to have a single type for any value
350
+ note: JSON.t is _not_ the json stringified value!
351
+
352
+ */
353
+ @as("Key")
354
+ key: dict<JSON.t>,
355
+ }
356
+ /** use either putRequest _or_ deleteRequest: both being set will result in a runtime error!
357
+ TODO: `@as` is not supported in rescript v10 -> use following code, when rescript v11 is used:
358
+ NOTE: this will result in an object having a TAG property of either "Put" or "Delete" _additionally_ to either "putRequest" or "deleteRequest" field
359
+ type writeRequest =
360
+ | Put({@as("PutRequest") putRequest: putRequest})
361
+ | Delete({@as("DeleteRequest") deleteRequest: deleteRequest})
362
+ */
363
+ type writeRequest = {
364
+ @as("PutRequest") putRequest?: putRequest,
365
+ @as("DeleteRequest") deleteRequest?: deleteRequest,
366
+ }
367
+
368
+ /** see: https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-dynamodb/Interface/BatchWriteItemCommandInput */
369
+ type input = {
370
+ /** map of table name to Requests */
371
+ @as("RequestItems")
372
+ requestItems: dict<array<writeRequest>>, // TODO: model max batch size of 25 in type system
373
+ @as("ReturnConsumedCapacity") returnConsumedCapacity?: returnConsumedCapacity,
374
+ @as("ReturnItemCollectionMetrics") returnItemCollectionMetrics?: returnItemCollectionMetrics,
375
+ }
376
+
377
+ /** see: https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-lib-dynamodb/TypeAlias/BatchWriteCommandOutput/
378
+ and: https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-dynamodb/Interface/BatchWriteItemCommandOutput/
379
+ */
380
+ type output = {
381
+ @as("$metadata") metadata: Metadata.t,
382
+ @as("ConsumedCapacity") consumedCapacity?: array<consumedCapacity>,
383
+ @as("ItemCollectionMetrics") itemCollectionMetrics?: dict<array<itemCollectionMetric>>,
384
+ @as("UnprocessedItems") unprocessedItems?: dict<array<writeRequest>>,
385
+ }
386
+
387
+ @new @module("@aws-sdk/lib-dynamodb")
388
+ external make: input => t = "BatchWriteCommand"
389
+
390
+ let maxBatchSize = 25
391
+
392
+ module Raw = {
393
+ @send
394
+ external send: (client, t) => promise<output> = "send"
395
+ }
396
+
397
+ /** batchWrite: max. batch size is 25 */
398
+ let send: t => promise<output> = input => Raw.send(client(), input)
399
+ }
400
+
401
+ module UpdateCommand = {
402
+ /*** see: https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/dynamodb/command/UpdateItemCommand/ */
403
+
404
+ type t
405
+
406
+ /** see: https://github.com/aws/aws-sdk-js-v3/blob/de4dc495455a47cd718c635209cd7aef9167797c/clients/client-dynamodb/src/models/models_0.ts#L11460 */
407
+ type input = {
408
+ /** The primary key of the item to be updated. Each element consists of an attribute name and a value for that attribute.
409
+
410
+ For the primary key, you must provide all of the attributes. For example, with a simple primary key, you only need to provide a value for the partition key. For a composite primary key, you must provide values for both the partition key and the sort key.
411
+ */
412
+ @as("Key")
413
+ key: dict<JSON.t>,
414
+ /** The name of the table containing the item to update. You can also provide the Amazon Resource Name (ARN) of the table in this parameter. */
415
+ @as("TableName")
416
+ tableName: string,
417
+ /** A condition that must be satisfied in order for a conditional update to succeed. */
418
+ @as("ConditionExpression")
419
+ conditionExpression?: string, // TODO: implemend a functional interface to create valid conditionExpressions (aka SDL or builder pattern)
420
+ /** One or more substitution tokens for attribute names in an expression. */
421
+ @as("ExpressionAttributeNames")
422
+ expressionAttributeNames?: dict<string>,
423
+ /** One or more values that can be substituted in an expression. */
424
+ @as("ExpressionAttributeValues")
425
+ expressionAttributeValues?: dict<JSON.t>,
426
+ /** Determines the level of detail about either provisioned or on-demand throughput consumption that is returned in the response */
427
+ @as("ReturnConsumedCapacity")
428
+ returnConsumedCapacity?: returnConsumedCapacity,
429
+ /** Determines whether item collection metrics are returned. */
430
+ @as("ReturnItemCollectionMetrics")
431
+ returnItemCollectionMetrics?: returnItemCollectionMetrics,
432
+ /** Use ReturnValues if you want to get the item attributes as they appear before or after they are successfully updated. */
433
+ @as("ReturnValues")
434
+ returnValues?: returnValues,
435
+ /** An optional parameter that returns the item attributes for an UpdateItem operation that failed a condition check. */
436
+ @as("ReturnValuesOnConditionCheckFailure")
437
+ returnValuesOnConditionCheckFailure?: returnValuesOnConditionCheckFailure,
438
+ /** An expression that defines one or more attributes to be updated, the action to be performed on them, and new values for them. */
439
+ @as("UpdateExpression")
440
+ updateExpression?: string, // TODO: implemend a functional interface to create valid updateExpressions (aka SDL or builder pattern)
441
+ }
442
+
443
+ type output = {
444
+ @as("$metadata") metadata: Metadata.t,
445
+ /** A map of attribute values as they appear before or after the UpdateItem operation, as determined by the ReturnValues parameter.*/
446
+ @as("Attributes")
447
+ attributes?: dict<JSON.t>,
448
+ @as("ConsumedCapacity") consumedCapacity?: consumedCapacity,
449
+ @as("ItemCollectionMetrics") itemCollectionMetrics?: itemCollectionMetric,
450
+ }
451
+
452
+ @new @module("@aws-sdk/lib-dynamodb")
453
+ external make: input => t = "UpdateCommand"
454
+
455
+ module Raw = {
456
+ @send
457
+ external send: (client, t) => promise<output> = "send"
458
+ }
459
+
460
+ let send: t => promise<output> = input => Raw.send(client(), input)
461
+ }
462
+
463
+ module DeleteCommand = {
464
+ /*** see: https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-lib-dynamodb/Class/DeleteCommand/ */
465
+
466
+ type t
467
+
468
+ type input = {
469
+ /** The name of the table from which to delete the item. You can also provide the Amazon Resource Name (ARN) of the table in this parameter. */
470
+ @as("TableName")
471
+ tableName: string,
472
+ /** A map of attribute names to values, representing the primary key of the item to delete. */
473
+ @as("Key")
474
+ key: dict<JSON.t>,
475
+ /** A condition that must be satisfied in order for a conditional DeleteItem to succeed. */
476
+ @as("ConditionExpression")
477
+ conditionExpression?: string,
478
+ /** One or more substitution tokens for attribute names in an expression. */
479
+ @as("ExpressionAttributeNames")
480
+ expressionAttributeNames?: dict<string>,
481
+ /** One or more values that can be substituted in an expression. */
482
+ @as("ExpressionAttributeValues")
483
+ expressionAttributeValues?: dict<JSON.t>,
484
+ /** Determines the level of detail about either provisioned or on-demand throughput consumption that is returned in the response. */
485
+ @as("ReturnConsumedCapacity")
486
+ returnConsumedCapacity?: returnConsumedCapacity,
487
+ /** Determines whether item collection metrics are returned. If set to SIZE, the response includes statistics about item collections, if any, that were modified during the operation are returned in the response. */
488
+ @as("ReturnItemCollectionMetrics")
489
+ returnItemCollectionMetrics?: returnItemCollectionMetrics,
490
+ /** Use ReturnValues if you want to get the item attributes as they appeared before they were deleted. */
491
+ @as("ReturnValues")
492
+ returnValues?: returnValues,
493
+ /** An optional parameter that returns the item attributes for a DeleteItem operation that failed a condition check. */
494
+ @as("ReturnValuesOnConditionCheckFailure")
495
+ returnValuesOnConditionCheckFailure?: returnValuesOnConditionCheckFailure,
496
+ }
497
+
498
+ type output = {
499
+ @as("$metadata") metadata: Metadata.t,
500
+ /** A map of attribute names to values, representing the item as it appeared before the DeleteItem operation. This map appears in the response only if ReturnValues was specified as ALL_OLD in the request. */
501
+ @as("Attributes")
502
+ attributes?: dict<JSON.t>,
503
+ /** The capacity units consumed by the DeleteItem operation. The data returned includes the total provisioned throughput consumed, along with statistics for the table and any indexes involved in the operation. ConsumedCapacity is only returned if the ReturnConsumedCapacity parameter was specified. For more information, see Provisioned capacity mode
504
+ in the Amazon DynamoDB Developer Guide. */
505
+ @as("ConsumedCapacity")
506
+ consumedCapacity?: consumedCapacity,
507
+ /** Information about item collections, if any, that were affected by the DeleteItem operation. ItemCollectionMetrics is only returned if the ReturnItemCollectionMetrics parameter was specified. */
508
+ @as("ItemCollectionMetrics")
509
+ itemCollectionMetrics?: itemCollectionMetric,
510
+ }
511
+
512
+ @new @module("@aws-sdk/lib-dynamodb")
513
+ external make: input => t = "DeleteCommand"
514
+ module Raw = {
515
+ @send
516
+ external send: (client, t) => promise<output> = "send"
517
+ }
518
+ let send: t => promise<output> = command => {
519
+ Raw.send(client(), command)
520
+ }
521
+ }
522
+
523
+ let deleteById: (~tableName: string, ~id: string) => promise<DeleteCommand.output> = (
524
+ ~tableName,
525
+ ~id,
526
+ ) => {
527
+ open DeleteCommand
528
+ {
529
+ DeleteCommand.tableName,
530
+ key: [("id", id->JSON.Encode.string)]->Dict.fromArray,
531
+ }
532
+ ->make
533
+ ->send
534
+ }
535
+
536
+ let deleteByIdSort: (
537
+ ~tableName: string,
538
+ ~id: string,
539
+ ~sortField: string,
540
+ ~sortKey: string,
541
+ ) => promise<DeleteCommand.output> = (~tableName, ~id, ~sortField, ~sortKey) => {
542
+ let keyDict =
543
+ [("id", id->JSON.Encode.string), (sortField, sortKey->JSON.Encode.string)]->Dict.fromArray
544
+ open DeleteCommand
545
+ {
546
+ DeleteCommand.tableName,
547
+ key: keyDict,
548
+ }
549
+ ->make
550
+ ->send
551
+ }
552
+
553
+ let delete: (
554
+ ~sort: (string, string)=?,
555
+ ~tableName: string,
556
+ ~id: string,
557
+ ) => promise<DeleteCommand.output> = (~sort=?, ~tableName, ~id) =>
558
+ switch sort {
559
+ | Some((sortField, sortKey)) => deleteByIdSort(~tableName, ~id, ~sortField, ~sortKey)
560
+ | None => deleteById(~tableName, ~id)
561
+ }
562
+
563
+ module TransactWriteCommand = {
564
+ /*** see: https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-lib-dynamodb/Class/TransactWriteCommand/ */
565
+
566
+ type t
567
+
568
+ type conditionCheck = {
569
+ /** The primary key of the item to be checked. Each element consists of an attribute name and a value for that attribute. */
570
+ @as("Key")
571
+ key: dict<JSON.t>,
572
+ /** Name of the table for the check item request. You can also provide the Amazon Resource Name (ARN) of the table in this parameter. */
573
+ @as("TableName")
574
+ tableName: string,
575
+ /** A condition that must be satisfied in order for a conditional update to succeed. */
576
+ @as("ConditionExpression")
577
+ conditionExpression: string,
578
+ /** One or more substitution tokens for attribute names in an expression. */
579
+ @as("ExpressionAttributeNames")
580
+ expressionAttributeNames?: dict<string>,
581
+ /* One or more values that can be substituted in an expression. */
582
+ @as("ExpressionAttributeValues") expressionAttributeValues?: dict<JSON.t>,
583
+ /** Use ReturnValuesOnConditionCheckFailure to get the item attributes if the ConditionCheck condition fails. */
584
+ @as("ReturnValuesOnConditionCheckFailure")
585
+ returnValuesOnConditionCheckFailure?: returnValuesOnConditionCheckFailure,
586
+ }
587
+
588
+ type delete = {
589
+ /** The primary key of the item to be deleted. Each element consists of an attribute name and a value for that attribute. */
590
+ @as("Key")
591
+ key: dict<JSON.t>,
592
+ /** Name of the table in which the item to be deleted resides. You can also provide the Amazon Resource Name (ARN) of the table in this parameter. */
593
+ @as("TableName")
594
+ tableName: string,
595
+ /** A condition that must be satisfied in order for a conditional delete to succeed. */
596
+ @as("ConditionExpression")
597
+ conditionExpression?: string,
598
+ /** One or more substitution tokens for attribute names in an expression. */
599
+ @as("ExpressionAttributeNames)")
600
+ expressionAttributeNames?: dict<string>,
601
+ /** One or more values that can be substituted in an expression. */
602
+ @as("ExpressionAttributeValues")
603
+ expressionAttributeValues?: dict<JSON.t>,
604
+ /** Use ReturnValuesOnConditionCheckFailure to get the item attributes if the Delete condition fails. */
605
+ @as("ReturnValuesOnConditionCheckFailure")
606
+ returnValuesOnConditionCheckFailure?: returnValuesOnConditionCheckFailure,
607
+ }
608
+
609
+ type put = {
610
+ /** A map of attribute name to attribute values, representing the primary key of the item to be written by PutItem. All of the table's primary key attributes must be specified, and their data types must match those of the table's key schema. If any attributes are present in the item that are part of an index key schema for the table, their types must match the index key schema.
611
+
612
+ this must be an object!
613
+ */
614
+ @as("Item")
615
+ item: JSON.t,
616
+ /** Name of the table in which to write the item. You can also provide the Amazon Resource Name (ARN) of the table in this parameter. */
617
+ @as("TableName")
618
+ tableName: string,
619
+ /** A condition that must be satisfied in order for a conditional update to succeed. */
620
+ @as("ConditionExpression")
621
+ conditionExpression?: string,
622
+ /** One or more substitution tokens for attribute names in an expression. */
623
+ @as("ExpressionAttributeNames")
624
+ expressionAttributeNames?: dict<string>,
625
+ /** One or more values that can be substituted in an expression. */
626
+ @as("ExpressionAttributeValues")
627
+ expressionAttributeValues?: dict<JSON.t>,
628
+ /** se ReturnValuesOnConditionCheckFailure to get the item attributes if the Put condition fails. */
629
+ @as("ReturnValuesOnConditionCheckFailure")
630
+ returnValuesOnConditionCheckFailure?: returnValuesOnConditionCheckFailure,
631
+ }
632
+
633
+ type update = {
634
+ /** The primary key of the item to be updated. Each element consists of an attribute name and a value for that attribute. */
635
+ @as("Key")
636
+ key: dict<JSON.t>,
637
+ /** Name of the table for the UpdateItem request. You can also provide the Amazon Resource Name (ARN) of the table in this parameter. */
638
+ @as("TableName")
639
+ tableName: string,
640
+ /** An expression that defines one or more attributes to be updated, the action to be performed on them, and new value(s) for them. */
641
+ @as("UpdateExpression")
642
+ updateExpression: string,
643
+ /** A condition that must be satisfied in order for a conditional update to succeed. */
644
+ @as("ConditionExpression")
645
+ conditionExpression?: string,
646
+ /** One or more substitution tokens for attribute names in an expression. */
647
+ @as("ExpressionAttributeNames")
648
+ expressionAttributeNames?: dict<string>,
649
+ /** One or more values that can be substituted in an expression. */
650
+ @as("ExpressionAttributeValues")
651
+ expressionAttributeValues?: dict<JSON.t>,
652
+ /** Use ReturnValuesOnConditionCheckFailure to get the item attributes if the Update condition fails. */
653
+ @as("ReturnValuesOnConditionCheckFailure")
654
+ returnValuesOnConditionCheckFailure?: returnValuesOnConditionCheckFailure,
655
+ }
656
+
657
+ type transactWriteItem = {
658
+ /** A request to perform a check item operation. */
659
+ @as("ConditionCheck")
660
+ conditionCheck?: conditionCheck,
661
+ /** A request to perform a DeleteItem operation. */
662
+ @as("Delete")
663
+ delete?: delete,
664
+ /** A request to perform a PutItem operation. */
665
+ @as("Put")
666
+ put?: put,
667
+ /** A request to perform an UpdateItem operation. */
668
+ @as("Update")
669
+ update?: update,
670
+ }
671
+
672
+ type input = {
673
+ /** An ordered array of up to 100 TransactWriteItem objects, each of which contains a ConditionCheck, Put, Update, or Delete object. These can operate on items in different tables, but the tables must reside in the same Amazon Web Services account and Region, and no two of them can operate on the same item. */
674
+ @as("TransactItems")
675
+ transactItems: array<transactWriteItem>,
676
+ /** Providing a ClientRequestToken makes the call to TransactWriteItems idempotent, meaning that multiple identical calls have the same effect as one single call. */
677
+ @as("ClientRequestToken")
678
+ clientRequestToken?: string,
679
+ /** Determines the level of detail about either provisioned or on-demand throughput consumption that is returned in the response. */
680
+ @as("ReturnConsumedCapacity")
681
+ returnConsumedCapacity?: returnConsumedCapacity,
682
+ /** Determines whether item collection metrics are returned. If set to SIZE, the response includes statistics about item collections (if any), that were modified during the operation and are returned in the response. If set to NONE (the default), no statistics are returned. */
683
+ @as("ReturnItemCollectionMetrics")
684
+ returnItemCollectionMetrics?: returnItemCollectionMetrics,
685
+ }
686
+
687
+ type output = {
688
+ @as("$metadata") metadata: Metadata.t,
689
+ /** The capacity units consumed by the entire TransactWriteItems operation. The values of the list are ordered according to the ordering of the TransactItems request parameter. */
690
+ @as("ConsumedCapacity")
691
+ consumedCapacity?: array<consumedCapacity>,
692
+ /** A list of tables that were processed by TransactWriteItems and, for each table, information about any item collections that were affected by individual UpdateItem, PutItem, or DeleteItem operations. */
693
+ @as("ItemCollectionMetrics")
694
+ itemCollectionMetrics?: dict<array<itemCollectionMetric>>,
695
+ }
696
+
697
+ @new @module("@aws-sdk/lib-dynamodb")
698
+ external make: input => t = "TransactWriteCommand"
699
+
700
+ module Raw = {
701
+ @send
702
+ external send: (client, t) => promise<output> = "send"
703
+ }
704
+ let send: t => promise<output> = command => Raw.send(client(), command)
705
+ }
706
+
707
+ module QueryCommand = {
708
+ /*** see: https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-lib-dynamodb/Class/QueryCommand/ */
709
+
710
+ type t
711
+
712
+ type input = {
713
+ /** The name of the table containing the requested items. You can also provide the Amazon Resource Name (ARN) of the table in this parameter. */
714
+ @as("TableName")
715
+ tableName: string,
716
+ /** Determines the read consistency model: If set to true, then the operation uses strongly consistent reads; otherwise, the operation uses eventually consistent reads.
717
+ Strongly consistent reads are not supported on global secondary indexes. If you query a global secondary index with ConsistentRead set to true, you will receive a ValidationException. */
718
+ @as("ConsistentRead")
719
+ consistentRead?: bool,
720
+ /** The primary key of the first item that this operation will evaluate. Use the value that was returned for LastEvaluatedKey in the previous operation.
721
+ The data type for ExclusiveStartKey must be String, Number, or Binary. No set data types are allowed. */
722
+ @as("ExclusiveStartKey")
723
+ exclusiveStartKey?: dict<JSON.t>,
724
+ /** One or more substitution tokens for attribute names in an expression. */
725
+ @as("ExpressionAttributeNames")
726
+ expressionAttributeNames?: dict<string>,
727
+ /** One or more values that can be substituted in an expression. */
728
+ @as("ExpressionAttributeValues")
729
+ expressionAttributeValues?: dict<JSON.t>,
730
+ /** A string that contains conditions that DynamoDB applies after the Query operation, but before the data is returned to you. Items that do not satisfy the FilterExpression criteria are not returned.
731
+ A FilterExpression does not allow key attributes. You cannot define a filter expression based on a partition key or a sort key.
732
+ A FilterExpression is applied after the items have already been read; the process of filtering does not consume any additional read capacity units. */
733
+ @as("FilterExpression")
734
+ filterExpression?: string,
735
+ /** The name of an index to query. This index can be any local secondary index or global secondary index on the table. Note that if you use the IndexName parameter, you must also provide TableName. */
736
+ @as("IndexName")
737
+ indexName?: string,
738
+ /** he condition that specifies the key values for items to be retrieved by the Query action.
739
+ The condition must perform an equality test on a single partition key value. */
740
+ @as("KeyConditionExpression")
741
+ keyConditionExpression?: string,
742
+ /** The maximum number of items to evaluate (not necessarily the number of matching items). If DynamoDB processes the number of items up to the limit while processing the results, it stops the operation and returns the matching values up to that point, and a key in LastEvaluatedKey to apply in a subsequent operation, so that you can pick up where you left off. Also, if the processed dataset size exceeds 1 MB before DynamoDB reaches this limit, it stops the operation and returns the matching values up to the limit, and a key in LastEvaluatedKey to apply in a subsequent operation to continue the operation. */
743
+ @as("Limit")
744
+ limit?: int,
745
+ /** A string that identifies one or more attributes to retrieve from the table. These attributes can include scalars, sets, or elements of a JSON document. The attributes in the expression must be separated by commas.
746
+ If no attribute names are specified, then all attributes will be returned. If any of the requested attributes are not found, they will not appear in the result. */
747
+ @as("ProjectionExpression")
748
+ projectionExpression?: string,
749
+ /** Determines the level of detail about either provisioned or on-demand throughput consumption that is returned in the response. */
750
+ @as("ReturnConsumedCapacity")
751
+ returnConsumedCapacity?: returnConsumedCapacity,
752
+ /** Specifies the order for index traversal: If true (default), the traversal is performed in ascending order; if false, the traversal is performed in descending order. */
753
+ @as("ScanIndexForward")
754
+ scanIndexForward?: bool,
755
+ /** The attributes to be returned in the result. You can retrieve all item attributes, specific item attributes, the count of matching items, or in the case of an index, some or all of the attributes projected into the index. */
756
+ @as("Select")
757
+ select?: select,
758
+ }
759
+
760
+ type output = {
761
+ @as("$metadata") metadata: Metadata.t,
762
+ /** The capacity units consumed by the Query operation. The data returned includes the total provisioned throughput consumed, along with statistics for the table and any indexes involved in the operation. ConsumedCapacity is only returned if the ReturnConsumedCapacity parameter was specified. */
763
+ @as("ConsumedCapacity")
764
+ consumedCapacity?: consumedCapacity,
765
+ /** The number of items in the response.
766
+ If you used a QueryFilter in the request, then Count is the number of items returned after the filter was applied, and ScannedCount is the number of matching items before the filter was applied.
767
+ If you did not use a filter in the request, then Count and ScannedCount are the same. */
768
+ @as("Count")
769
+ count?: int,
770
+ /** An array of item attributes that match the query criteria. Each element in this array consists of an attribute name and the value for that attribute.
771
+
772
+ this data type is an array of objects.
773
+ */
774
+ @as("Items")
775
+ items?: array<JSON.t>,
776
+ /** The primary key of the item where the operation stopped, inclusive of the previous result set. Use this value to start a new operation, excluding this value in the new request.
777
+ If LastEvaluatedKey is empty, then the "last page" of results has been processed and there is no more data to be retrieved.
778
+ If LastEvaluatedKey is not empty, it does not necessarily mean that there is more data in the result set. The only way to know when you have reached the end of the result set is when LastEvaluatedKey is empty. */
779
+ @as("LastEvaluatedKey")
780
+ lastEvaluatedKey?: dict<JSON.t>,
781
+ /** The number of items evaluated, before any QueryFilter is applied. A high ScannedCount value with few, or no, Count results indicates an inefficient Query operation.
782
+ If you did not use a filter in the request, then ScannedCount is the same as Count. */
783
+ @as("ScannedCount")
784
+ scannedCount?: int,
785
+ }
786
+
787
+ @new @module("@aws-sdk/lib-dynamodb")
788
+ external make: input => t = "QueryCommand"
789
+
790
+ module Raw = {
791
+ @send
792
+ external send: (client, t) => promise<output> = "send"
793
+ }
794
+
795
+ let send: t => promise<output> = command => Raw.send(client(), command)
796
+ }
797
+
798
+ module GetCommand = {
799
+ /*** see: https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-lib-dynamodb/Class/GetCommand/ */
800
+
801
+ type t
802
+
803
+ type input = {
804
+ @as("TableName")
805
+ tableName: string,
806
+ @as("Key")
807
+ key: dict<JSON.t>,
808
+ @as("ConsistentRead")
809
+ consistentRead?: bool,
810
+ @as("ExpressionAttributeNames")
811
+ expressionAttributeNames?: dict<string>,
812
+ @as("ProjectionExpression")
813
+ projectionExpression?: string,
814
+ @as("ReturnConsumedCapacity")
815
+ returnConsumedCapacity?: returnConsumedCapacity,
816
+ }
817
+
818
+ type output = {
819
+ @as("$metadata") metadata: Metadata.t,
820
+ @as("Item") item?: JSON.t,
821
+ @as("ConsumedCapacity") consumedCapacity?: consumedCapacity,
822
+ }
823
+
824
+ @new @module("@aws-sdk/lib-dynamodb")
825
+ external make: input => t = "GetCommand"
826
+
827
+ module Raw = {
828
+ @send
829
+ external send: (client, t) => promise<output> = "send"
830
+ }
831
+
832
+ let send: t => promise<output> = command => Raw.send(client(), command)
833
+ }
834
+
835
+
836
+ module ScanCommand = {
837
+ /*** see: https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-lib-dynamodb/Class/ScanCommand/ */
838
+
839
+ type t
840
+
841
+ type input = {
842
+ /** The name of the table containing the requested items or if you provide IndexName, the name of the table to which that index belongs.
843
+ You can also provide the Amazon Resource Name (ARN) of the table in this parameter. */
844
+ @as("TableName")
845
+ tableName: string,
846
+ /** A Boolean value that determines the read consistency model during the scan. */
847
+ @as("ConsistentRead")
848
+ consistentRead?: bool,
849
+ /** The primary key of the first item that this operation will evaluate. Use the value that was returned for LastEvaluatedKey in the previous operation.
850
+ The data type for ExclusiveStartKey must be String, Number or Binary. No set data types are allowed. */
851
+ @as("ExclusiveStartKey")
852
+ exclusiveStartKey?: dict<JSON.t>,
853
+ /** One or more substitution tokens for attribute names in an expression. */
854
+ @as("ExpressionAttributeNames")
855
+ expressionAttributeNames?: dict<string>,
856
+ /** One or more values that can be substituted in an expression. */
857
+ @as("ExpressionAttributeValues")
858
+ expressionAttributeValues?: dict<JSON.t>,
859
+ /** A string that contains conditions that DynamoDB applies after the Scan operation, but before the data is returned to you. Items that do not satisfy the FilterExpression criteria are not returned.
860
+ A FilterExpression is applied after the items have already been read; the process of filtering does not consume any additional read capacity units. */
861
+ @as("FilterExpression")
862
+ filterExpression?: string,
863
+ /** The name of a secondary index to scan. This index can be any local secondary index or global secondary index. Note that if you use the IndexName parameter, you must also provide TableName. */
864
+ @as("IndexName")
865
+ indexName?: string,
866
+ /** The maximum number of items to evaluate (not necessarily the number of matching items). If DynamoDB processes the number of items up to the limit while processing the results, it stops the operation and returns the matching values up to that point, and a key in LastEvaluatedKey to apply in a subsequent operation, so that you can pick up where you left off. Also, if the processed dataset size exceeds 1 MB before DynamoDB reaches this limit, it stops the operation and returns the matching values up to the limit, and a key in LastEvaluatedKey to apply in a subsequent operation to continue the operation. */
867
+ @as("Limit")
868
+ limit?: int,
869
+ /** A string that identifies one or more attributes to retrieve from the specified table or index. These attributes can include scalars, sets, or elements of a JSON document. The attributes in the expression must be separated by commas.
870
+ If no attribute names are specified, then all attributes will be returned. If any of the requested attributes are not found, they will not appear in the result. */
871
+ @as("ProjectionExpression")
872
+ projectionExpression?: string,
873
+ /** Determines the level of detail about either provisioned or on-demand throughput consumption that is returned in the response. */
874
+ @as("ReturnConsumedCapacity")
875
+ returnConsumedCapacity?: returnConsumedCapacity,
876
+ /** For a parallel Scan request, Segment identifies an individual segment to be scanned by an application worker.
877
+ Segment IDs are zero-based, so the first segment is always 0. For example, if you want to use four application threads to scan a table or an index, then the first thread specifies a Segment value of 0, the second thread specifies 1, and so on.
878
+ The value of LastEvaluatedKey returned from a parallel Scan request must be used as ExclusiveStartKey with the same segment ID in a subsequent Scan operation.
879
+ The value for Segment must be greater than or equal to 0, and less than the value provided for TotalSegments.
880
+ If you provide Segment, you must also provide TotalSegments. */
881
+ @as("Segment")
882
+ segment?: int,
883
+ /** The attributes to be returned in the result. You can retrieve all item attributes, specific item attributes, the count of matching items, or in the case of an index, some or all of the attributes projected into the index. */
884
+ @as("Select")
885
+ select?: select,
886
+ /** For a parallel Scan request, TotalSegments represents the total number of segments into which the Scan operation will be divided. The value of TotalSegments corresponds to the number of application workers that will perform the parallel scan. For example, if you want to use four application threads to scan a table or an index, specify a TotalSegments value of 4.
887
+ The value for TotalSegments must be greater than or equal to 1, and less than or equal to 1000000. If you specify a TotalSegments value of 1, the Scan operation will be sequential rather than parallel.
888
+ If you specify TotalSegments, you must also specify Segment. */
889
+ @as("TotalSegments")
890
+ totalSegments?: int,
891
+ }
892
+
893
+ type output = QueryCommand.output
894
+
895
+ @new @module("@aws-sdk/lib-dynamodb")
896
+ external make: input => t = "ScanCommand"
897
+
898
+ module Raw = {
899
+ @send
900
+ external send: (client, t) => promise<output> = "send"
901
+ }
902
+
903
+ let send: t => promise<output> = command => Raw.send(client(), command)
904
+ }
905
+