@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.
- package/CHANGELOG.md +174 -0
- package/LICENSE +202 -0
- package/README.md +21 -0
- package/package.json +44 -0
- package/rescript.json +23 -0
- package/src/CloudWatchEvents.res +162 -0
- package/src/CloudWatchEvents.res.mjs +94 -0
- package/src/CognitoIdentityServiceProvider.res +117 -0
- package/src/CognitoIdentityServiceProvider.res.mjs +70 -0
- package/src/DynamoDb.res +3 -0
- package/src/DynamoDb.res.mjs +15 -0
- package/src/DynamoDb_DocumentClient.res +905 -0
- package/src/DynamoDb_DocumentClient.res.mjs +338 -0
- package/src/DynamoDb_DynamoDb.res +189 -0
- package/src/DynamoDb_DynamoDb.res.mjs +70 -0
- package/src/DynamoDb_Util.res +128 -0
- package/src/DynamoDb_Util.res.mjs +35 -0
- package/src/DynamoDb_Util_Helpers.res +7 -0
- package/src/DynamoDb_Util_Helpers.res.mjs +23 -0
- package/src/ECS.res +96 -0
- package/src/ECS.res.mjs +46 -0
- package/src/IAM.res +20 -0
- package/src/IAM.res.mjs +9 -0
- package/src/Kinesis.res +50 -0
- package/src/Kinesis.res.mjs +39 -0
- package/src/Metadata.res +9 -0
- package/src/Metadata.res.mjs +2 -0
- package/src/NodeHttpHandler.res +6 -0
- package/src/NodeHttpHandler.res.mjs +2 -0
- package/src/S3.res +152 -0
- package/src/S3.res.mjs +61 -0
- package/src/S3_Helpers.res +20 -0
- package/src/S3_Helpers.res.mjs +26 -0
- package/src/SES.res +113 -0
- package/src/SES.res.mjs +59 -0
- package/src/SNS.res +167 -0
- package/src/SNS.res.mjs +98 -0
- package/src/SNS_Helpers.res +45 -0
- package/src/SNS_Helpers.res.mjs +57 -0
- package/src/SQS.res +241 -0
- package/src/SQS.res.mjs +121 -0
- package/src/SQS_Helpers.res +267 -0
- package/src/SQS_Helpers.res.mjs +227 -0
- package/src/SecretsManager.res +61 -0
- package/src/SecretsManager.res.mjs +46 -0
- package/src/example/DynamoDbUtilExample.res +20 -0
- package/src/example/DynamoDbUtilExample.res.mjs +66 -0
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as Stdlib_JSON from "@rescript/runtime/lib/es6/Stdlib_JSON.js";
|
|
4
|
+
import * as Stdlib_JsExn from "@rescript/runtime/lib/es6/Stdlib_JsExn.js";
|
|
5
|
+
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
6
|
+
import * as Primitive_option from "@rescript/runtime/lib/es6/Primitive_option.js";
|
|
7
|
+
import * as LibDynamodb from "@aws-sdk/lib-dynamodb";
|
|
8
|
+
import * as DynamoDb_DynamoDb$AwsSdk from "./DynamoDb_DynamoDb.res.mjs";
|
|
9
|
+
|
|
10
|
+
let Raw = {};
|
|
11
|
+
|
|
12
|
+
let clientInstance = {
|
|
13
|
+
contents: undefined
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
function client() {
|
|
17
|
+
let docClient = clientInstance.contents;
|
|
18
|
+
if (docClient !== undefined) {
|
|
19
|
+
return Primitive_option.valFromOption(docClient);
|
|
20
|
+
}
|
|
21
|
+
let docClient$1 = LibDynamodb.DynamoDBDocumentClient.from(DynamoDb_DynamoDb$AwsSdk.client(), {
|
|
22
|
+
marshallOptions: {
|
|
23
|
+
convertEmptyValues: false,
|
|
24
|
+
removeUndefinedValues: true
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
clientInstance.contents = Primitive_option.some(docClient$1);
|
|
28
|
+
return docClient$1;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function getIntAttribute(attributes, name) {
|
|
32
|
+
return Stdlib_Option.flatMap(attributes, attribute => Stdlib_Option.map(Stdlib_Option.flatMap(attribute[name], value => Stdlib_JSON.Decode.float(value)), number => number | 0));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
let Raw$1 = {};
|
|
36
|
+
|
|
37
|
+
function send(input) {
|
|
38
|
+
return client().send(input);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
let PutCommand = {
|
|
42
|
+
Raw: Raw$1,
|
|
43
|
+
send: send
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
function putMany(tableName, conditionalExpression, items) {
|
|
47
|
+
return Promise.all(items.map(item => {
|
|
48
|
+
let input = new LibDynamodb.PutCommand({
|
|
49
|
+
Item: item,
|
|
50
|
+
TableName: tableName,
|
|
51
|
+
ConditionExpression: conditionalExpression
|
|
52
|
+
});
|
|
53
|
+
return client().send(input);
|
|
54
|
+
}));
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function putIfNotExists(tableName, idKey, sortKey, item) {
|
|
58
|
+
let tmp;
|
|
59
|
+
let exit = 0;
|
|
60
|
+
if (sortKey !== undefined) {
|
|
61
|
+
let sortKey$1 = Primitive_option.valFromOption(sortKey);
|
|
62
|
+
if (sortKey$1 == null) {
|
|
63
|
+
exit = 1;
|
|
64
|
+
} else {
|
|
65
|
+
tmp = `attribute_not_exists(` + idKey + `) and attribute_not_exists(` + sortKey$1 + `)`;
|
|
66
|
+
}
|
|
67
|
+
} else {
|
|
68
|
+
exit = 1;
|
|
69
|
+
}
|
|
70
|
+
if (exit === 1) {
|
|
71
|
+
tmp = `attribute_not_exists(` + idKey + `)`;
|
|
72
|
+
}
|
|
73
|
+
let input = new LibDynamodb.PutCommand({
|
|
74
|
+
Item: item,
|
|
75
|
+
TableName: tableName,
|
|
76
|
+
ConditionExpression: tmp
|
|
77
|
+
});
|
|
78
|
+
return client().send(input);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
let name = "ConditionalCheckFailedException";
|
|
82
|
+
|
|
83
|
+
let ConditionCheckFailedException = {
|
|
84
|
+
name: name
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
let name$1 = "InternalServerError";
|
|
88
|
+
|
|
89
|
+
let InternalServerError = {
|
|
90
|
+
name: name$1
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
let name$2 = "InvalidEndpointException";
|
|
94
|
+
|
|
95
|
+
let InvalidEndpointException = {
|
|
96
|
+
name: name$2
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
let name$3 = "ItemCollectionSizeLimitExceededException";
|
|
100
|
+
|
|
101
|
+
let ItemCollectionSizeLimitExceededException = {
|
|
102
|
+
name: name$3
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
let name$4 = "ProvisionedThroughputExceededException";
|
|
106
|
+
|
|
107
|
+
let ProvisionedThroughputExceededException = {
|
|
108
|
+
name: name$4
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
let name$5 = "RequestLimitExceeded";
|
|
112
|
+
|
|
113
|
+
let RequestLimitExceeded = {
|
|
114
|
+
name: name$5
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
let name$6 = "ResourceNotFoundException";
|
|
118
|
+
|
|
119
|
+
let ResourceNotFoundException = {
|
|
120
|
+
name: name$6
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
let name$7 = "TransactionConflictException";
|
|
124
|
+
|
|
125
|
+
let TransactionConflictException = {
|
|
126
|
+
name: name$7
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
let name$8 = "DynamoDBServiceException";
|
|
130
|
+
|
|
131
|
+
let DynamoDBServiceException = {
|
|
132
|
+
name: name$8
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
function classify(exn) {
|
|
136
|
+
let name$9 = Stdlib_Option.getOr(Stdlib_JsExn.name(exn), "");
|
|
137
|
+
if (name$9 === name) {
|
|
138
|
+
return {
|
|
139
|
+
TAG: "ConditionCheckFailedException",
|
|
140
|
+
_0: exn
|
|
141
|
+
};
|
|
142
|
+
} else if (name$9 === name$1) {
|
|
143
|
+
return {
|
|
144
|
+
TAG: "InternalServerError",
|
|
145
|
+
_0: exn
|
|
146
|
+
};
|
|
147
|
+
} else if (name$9 === name$2) {
|
|
148
|
+
return {
|
|
149
|
+
TAG: "InvalidEndpointException",
|
|
150
|
+
_0: exn
|
|
151
|
+
};
|
|
152
|
+
} else if (name$9 === name$3) {
|
|
153
|
+
return {
|
|
154
|
+
TAG: "ItemCollectionSizeLimitExceededException",
|
|
155
|
+
_0: exn
|
|
156
|
+
};
|
|
157
|
+
} else if (name$9 === name$4) {
|
|
158
|
+
return {
|
|
159
|
+
TAG: "ProvisionedThroughputExceededException",
|
|
160
|
+
_0: exn
|
|
161
|
+
};
|
|
162
|
+
} else if (name$9 === name$5) {
|
|
163
|
+
return {
|
|
164
|
+
TAG: "RequestLimitExceeded",
|
|
165
|
+
_0: exn
|
|
166
|
+
};
|
|
167
|
+
} else if (name$9 === name$6) {
|
|
168
|
+
return {
|
|
169
|
+
TAG: "ResourceNotFoundException",
|
|
170
|
+
_0: exn
|
|
171
|
+
};
|
|
172
|
+
} else if (name$9 === name$7) {
|
|
173
|
+
return {
|
|
174
|
+
TAG: "TransactionConflictException",
|
|
175
|
+
_0: exn
|
|
176
|
+
};
|
|
177
|
+
} else if (name$9 === name$8) {
|
|
178
|
+
return {
|
|
179
|
+
TAG: "DynamoDBServiceException",
|
|
180
|
+
_0: exn
|
|
181
|
+
};
|
|
182
|
+
} else {
|
|
183
|
+
return {
|
|
184
|
+
TAG: "Unknown",
|
|
185
|
+
_0: exn
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
let PutError = {
|
|
191
|
+
ConditionCheckFailedException: ConditionCheckFailedException,
|
|
192
|
+
InternalServerError: InternalServerError,
|
|
193
|
+
InvalidEndpointException: InvalidEndpointException,
|
|
194
|
+
ItemCollectionSizeLimitExceededException: ItemCollectionSizeLimitExceededException,
|
|
195
|
+
ProvisionedThroughputExceededException: ProvisionedThroughputExceededException,
|
|
196
|
+
RequestLimitExceeded: RequestLimitExceeded,
|
|
197
|
+
ResourceNotFoundException: ResourceNotFoundException,
|
|
198
|
+
TransactionConflictException: TransactionConflictException,
|
|
199
|
+
DynamoDBServiceException: DynamoDBServiceException,
|
|
200
|
+
classify: classify
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
let Raw$2 = {};
|
|
204
|
+
|
|
205
|
+
function send$1(input) {
|
|
206
|
+
return client().send(input);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
let BatchWriteCommand = {
|
|
210
|
+
maxBatchSize: 25,
|
|
211
|
+
Raw: Raw$2,
|
|
212
|
+
send: send$1
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
let Raw$3 = {};
|
|
216
|
+
|
|
217
|
+
function send$2(input) {
|
|
218
|
+
return client().send(input);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
let UpdateCommand = {
|
|
222
|
+
Raw: Raw$3,
|
|
223
|
+
send: send$2
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
let Raw$4 = {};
|
|
227
|
+
|
|
228
|
+
function send$3(command) {
|
|
229
|
+
return client().send(command);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
let DeleteCommand = {
|
|
233
|
+
Raw: Raw$4,
|
|
234
|
+
send: send$3
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
function deleteById(tableName, id) {
|
|
238
|
+
let command = new LibDynamodb.DeleteCommand({
|
|
239
|
+
TableName: tableName,
|
|
240
|
+
Key: Object.fromEntries([[
|
|
241
|
+
"id",
|
|
242
|
+
id
|
|
243
|
+
]])
|
|
244
|
+
});
|
|
245
|
+
return client().send(command);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
function deleteByIdSort(tableName, id, sortField, sortKey) {
|
|
249
|
+
let keyDict = Object.fromEntries([
|
|
250
|
+
[
|
|
251
|
+
"id",
|
|
252
|
+
id
|
|
253
|
+
],
|
|
254
|
+
[
|
|
255
|
+
sortField,
|
|
256
|
+
sortKey
|
|
257
|
+
]
|
|
258
|
+
]);
|
|
259
|
+
let command = new LibDynamodb.DeleteCommand({
|
|
260
|
+
TableName: tableName,
|
|
261
|
+
Key: keyDict
|
|
262
|
+
});
|
|
263
|
+
return client().send(command);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
function $$delete(sort, tableName, id) {
|
|
267
|
+
if (sort !== undefined) {
|
|
268
|
+
return deleteByIdSort(tableName, id, sort[0], sort[1]);
|
|
269
|
+
} else {
|
|
270
|
+
return deleteById(tableName, id);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
let Raw$5 = {};
|
|
275
|
+
|
|
276
|
+
function send$4(command) {
|
|
277
|
+
return client().send(command);
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
let TransactWriteCommand = {
|
|
281
|
+
Raw: Raw$5,
|
|
282
|
+
send: send$4
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
let Raw$6 = {};
|
|
286
|
+
|
|
287
|
+
function send$5(command) {
|
|
288
|
+
return client().send(command);
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
let QueryCommand = {
|
|
292
|
+
Raw: Raw$6,
|
|
293
|
+
send: send$5
|
|
294
|
+
};
|
|
295
|
+
|
|
296
|
+
let Raw$7 = {};
|
|
297
|
+
|
|
298
|
+
function send$6(command) {
|
|
299
|
+
return client().send(command);
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
let GetCommand = {
|
|
303
|
+
Raw: Raw$7,
|
|
304
|
+
send: send$6
|
|
305
|
+
};
|
|
306
|
+
|
|
307
|
+
let Raw$8 = {};
|
|
308
|
+
|
|
309
|
+
function send$7(command) {
|
|
310
|
+
return client().send(command);
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
let ScanCommand = {
|
|
314
|
+
Raw: Raw$8,
|
|
315
|
+
send: send$7
|
|
316
|
+
};
|
|
317
|
+
|
|
318
|
+
export {
|
|
319
|
+
Raw,
|
|
320
|
+
clientInstance,
|
|
321
|
+
client,
|
|
322
|
+
getIntAttribute,
|
|
323
|
+
PutCommand,
|
|
324
|
+
putMany,
|
|
325
|
+
putIfNotExists,
|
|
326
|
+
PutError,
|
|
327
|
+
BatchWriteCommand,
|
|
328
|
+
UpdateCommand,
|
|
329
|
+
DeleteCommand,
|
|
330
|
+
deleteById,
|
|
331
|
+
deleteByIdSort,
|
|
332
|
+
$$delete,
|
|
333
|
+
TransactWriteCommand,
|
|
334
|
+
QueryCommand,
|
|
335
|
+
GetCommand,
|
|
336
|
+
ScanCommand,
|
|
337
|
+
}
|
|
338
|
+
/* Stdlib_JsExn Not a pure module */
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
/*** @aws-sdk/client-dynamodb
|
|
2
|
+
see: https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/dynamodb/
|
|
3
|
+
|
|
4
|
+
Use this client to modify (existing) tables.
|
|
5
|
+
|
|
6
|
+
## difference of dynamodb-client vs document-client
|
|
7
|
+
- dynamodb-client
|
|
8
|
+
- Operates on tables via commands
|
|
9
|
+
- Modification of table via dynamo-db-client update
|
|
10
|
+
- document-client
|
|
11
|
+
- Operates on the table content (documents), but not on the tables themselves
|
|
12
|
+
*/
|
|
13
|
+
type client
|
|
14
|
+
|
|
15
|
+
type options = {
|
|
16
|
+
region?: string,
|
|
17
|
+
maxAttempts?: int,
|
|
18
|
+
requestHandler?: NodeHttpHandler.t,
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
module Raw = {
|
|
22
|
+
@module("@aws-sdk/client-dynamodb") @new
|
|
23
|
+
external client: (~options: options=?, unit) => client = "DynamoDBClient"
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
let clientInstance = ref(None)
|
|
27
|
+
|
|
28
|
+
/** create a DynamoDBClient with default values:
|
|
29
|
+
- maxAttempts: 3,
|
|
30
|
+
- connectionTimeout: 1000ms
|
|
31
|
+
- requestTimeout: 5000ms
|
|
32
|
+
|
|
33
|
+
use `Raw.client` if you want to set alternative configuration
|
|
34
|
+
*/
|
|
35
|
+
let client: unit => client = () =>
|
|
36
|
+
switch clientInstance.contents {
|
|
37
|
+
| None =>
|
|
38
|
+
let client = Raw.client(
|
|
39
|
+
~options={
|
|
40
|
+
maxAttempts: 3,
|
|
41
|
+
requestHandler: NodeHttpHandler.make({
|
|
42
|
+
connectionTimeout: 1000,
|
|
43
|
+
requestTimeout: 5000,
|
|
44
|
+
}),
|
|
45
|
+
},
|
|
46
|
+
(),
|
|
47
|
+
)
|
|
48
|
+
clientInstance := Some(client)
|
|
49
|
+
client
|
|
50
|
+
| Some(client) => client
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
module UpdateTableCommand = {
|
|
54
|
+
/*** modify an existing table
|
|
55
|
+
|
|
56
|
+
this command is not available in document-client
|
|
57
|
+
|
|
58
|
+
see: https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/dynamodb/command/UpdateTableCommand/ */
|
|
59
|
+
|
|
60
|
+
type t
|
|
61
|
+
|
|
62
|
+
type billingMode = [
|
|
63
|
+
| #PROVISIONED
|
|
64
|
+
| #PAY_PER_REQUEST
|
|
65
|
+
]
|
|
66
|
+
|
|
67
|
+
type streamViewType = [
|
|
68
|
+
| #KEYS_ONLY
|
|
69
|
+
| #NEW_IMAGE
|
|
70
|
+
| #OLD_IMAGE
|
|
71
|
+
| #NEW_AND_OLD_IMAGES
|
|
72
|
+
]
|
|
73
|
+
type streamSpecification = {
|
|
74
|
+
@as("StreamEnabled") streamEnabled: bool,
|
|
75
|
+
@as("StreamViewType")
|
|
76
|
+
streamViewType?: streamViewType,
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** the following properties have no bindings yet:
|
|
80
|
+
- AttributeDefinitions
|
|
81
|
+
- DeletionProtectionEnabled
|
|
82
|
+
- GlobalSecondaryIndexUpdates
|
|
83
|
+
- OnDemandThroughput
|
|
84
|
+
- ProvisionedThroughput
|
|
85
|
+
- ReplicaUpdates
|
|
86
|
+
- SSESpecification
|
|
87
|
+
- TableClass
|
|
88
|
+
*/
|
|
89
|
+
type input = {
|
|
90
|
+
@as("TableName") tableName: string,
|
|
91
|
+
@as("BillingMode") billingMode?: billingMode,
|
|
92
|
+
@as("StreamSpecification") streamSpecification?: streamSpecification,
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
type tableDescription = {
|
|
96
|
+
@as("StreamSpecification") streamSpecification: streamSpecification,
|
|
97
|
+
@as("LatestStreamArn") latestStreamArn: string,
|
|
98
|
+
@as("LatestStreamLabel") latestStreamLabel: string,
|
|
99
|
+
}
|
|
100
|
+
type output = {
|
|
101
|
+
@as("$metadata") metadata: Metadata.t,
|
|
102
|
+
@as("TableDescription") tableDescription: tableDescription,
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
@new @module("@aws-sdk/client-dynamodb")
|
|
106
|
+
external make: input => t = "UpdateTableCommand"
|
|
107
|
+
|
|
108
|
+
module Raw = {
|
|
109
|
+
@send
|
|
110
|
+
external send: (client, t) => promise<output> = "send"
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
let send: t => promise<output> = command => Raw.send(client(), command)
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
module UpdateTimeToLiveCommand = {
|
|
117
|
+
/*** modify ttl config of an existing table
|
|
118
|
+
|
|
119
|
+
this command is not available in document-client
|
|
120
|
+
*/
|
|
121
|
+
|
|
122
|
+
type t
|
|
123
|
+
|
|
124
|
+
type timeToLiveSpecification = {
|
|
125
|
+
@as("Enabled") enabled: bool,
|
|
126
|
+
@as("AttributeName") attributeName: string,
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
type input = {
|
|
130
|
+
@as("TableName") tableName: string,
|
|
131
|
+
@as("TimeToLiveSpecification") timeToLiveSpecification: timeToLiveSpecification,
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
type output = {
|
|
135
|
+
@as("metadata") metadata: Metadata.t,
|
|
136
|
+
@as("TimeToLiveSpecification") timeToLiveSpecification: timeToLiveSpecification,
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
@new @module("@aws-sdk/client-dynamodb")
|
|
140
|
+
external make: input => t = "UpdateTimeToLiveCommand"
|
|
141
|
+
module Raw = {
|
|
142
|
+
@send
|
|
143
|
+
external send: (client, t) => promise<output> = "send"
|
|
144
|
+
}
|
|
145
|
+
let send: t => promise<output> = command => Raw.send(client(), command)
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
module UpdateContinuousBackupsCommand = {
|
|
149
|
+
/*** modify continuous backup config of an existing table
|
|
150
|
+
|
|
151
|
+
this command is not available in document-client
|
|
152
|
+
*/
|
|
153
|
+
|
|
154
|
+
type t
|
|
155
|
+
|
|
156
|
+
type pointInTimeRecoverySpecification = {
|
|
157
|
+
@as("PointInTimeRecoveryEnabled") pointInTimeRecoveryEnabled: bool,
|
|
158
|
+
}
|
|
159
|
+
type input = {
|
|
160
|
+
@as("TableName") tableName: string,
|
|
161
|
+
@as("PointInTimeRecoverySpecification")
|
|
162
|
+
pointInTimeRecoverySpecification: pointInTimeRecoverySpecification,
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
type continuousBackupsStatus = [#ENABLED | #DISABLED]
|
|
166
|
+
type pointInTimeRecoveryDescription = {
|
|
167
|
+
@as("EarliestRestorableDateTime") earliestRestorableDateTime?: Date.t,
|
|
168
|
+
@as("PointInTimeRecoveryStatus") pointInTimeRecoveryStatus?: string,
|
|
169
|
+
@as("LatestRestorableDateTime") latestRestorableDateTime?: Date.t,
|
|
170
|
+
}
|
|
171
|
+
type continuousBackupsDescription = {
|
|
172
|
+
@as("ContinuousBackupsStatus") continuousBackupsStatus: continuousBackupsStatus,
|
|
173
|
+
@as("PointInTimeRecoveryDescription")
|
|
174
|
+
pointInTimeRecoveryDescription?: pointInTimeRecoveryDescription,
|
|
175
|
+
}
|
|
176
|
+
type output = {
|
|
177
|
+
@as("$metadata") metadata: Metadata.t,
|
|
178
|
+
@as("ContinuousBackupsDescription") continuousBackupsDescription: continuousBackupsDescription,
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
@new @module("@aws-sdk/client-dynamodb")
|
|
182
|
+
external make: input => t = "UpdateContinuousBackupsCommand"
|
|
183
|
+
module Raw = {
|
|
184
|
+
@send
|
|
185
|
+
external send: (client, t) => promise<output> = "send"
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
let send: t => promise<output> = command => Raw.send(client(), command)
|
|
189
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as Primitive_option from "@rescript/runtime/lib/es6/Primitive_option.js";
|
|
4
|
+
import * as ClientDynamodb from "@aws-sdk/client-dynamodb";
|
|
5
|
+
import * as NodeHttpHandler from "@smithy/node-http-handler";
|
|
6
|
+
|
|
7
|
+
let Raw = {};
|
|
8
|
+
|
|
9
|
+
let clientInstance = {
|
|
10
|
+
contents: undefined
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
function client() {
|
|
14
|
+
let client$1 = clientInstance.contents;
|
|
15
|
+
if (client$1 !== undefined) {
|
|
16
|
+
return Primitive_option.valFromOption(client$1);
|
|
17
|
+
}
|
|
18
|
+
let client$2 = new ClientDynamodb.DynamoDBClient({
|
|
19
|
+
maxAttempts: 3,
|
|
20
|
+
requestHandler: Primitive_option.some(new NodeHttpHandler.NodeHttpHandler({
|
|
21
|
+
connectionTimeout: 1000,
|
|
22
|
+
requestTimeout: 5000
|
|
23
|
+
}))
|
|
24
|
+
});
|
|
25
|
+
clientInstance.contents = Primitive_option.some(client$2);
|
|
26
|
+
return client$2;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
let Raw$1 = {};
|
|
30
|
+
|
|
31
|
+
function send(command) {
|
|
32
|
+
return client().send(command);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
let UpdateTableCommand = {
|
|
36
|
+
Raw: Raw$1,
|
|
37
|
+
send: send
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
let Raw$2 = {};
|
|
41
|
+
|
|
42
|
+
function send$1(command) {
|
|
43
|
+
return client().send(command);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
let UpdateTimeToLiveCommand = {
|
|
47
|
+
Raw: Raw$2,
|
|
48
|
+
send: send$1
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
let Raw$3 = {};
|
|
52
|
+
|
|
53
|
+
function send$2(command) {
|
|
54
|
+
return client().send(command);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
let UpdateContinuousBackupsCommand = {
|
|
58
|
+
Raw: Raw$3,
|
|
59
|
+
send: send$2
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export {
|
|
63
|
+
Raw,
|
|
64
|
+
clientInstance,
|
|
65
|
+
client,
|
|
66
|
+
UpdateTableCommand,
|
|
67
|
+
UpdateTimeToLiveCommand,
|
|
68
|
+
UpdateContinuousBackupsCommand,
|
|
69
|
+
}
|
|
70
|
+
/* @aws-sdk/client-dynamodb Not a pure module */
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/*** bindings for `@aws-sdk/util-dynamodb`dynamoutil
|
|
2
|
+
https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-util-dynamodb
|
|
3
|
+
|
|
4
|
+
in aws sdk v2 this was `aws-sdk/DynamoDb/Converter`
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
type rec attributeValue = {
|
|
8
|
+
/** `B`inary attribute */
|
|
9
|
+
@as("B")
|
|
10
|
+
binary?: Js.TypedArray2.Uint8Array.t,
|
|
11
|
+
@as("BOOL") bool?: bool,
|
|
12
|
+
@as("BS") binarySet?: array<Js.TypedArray2.Uint8Array.t>,
|
|
13
|
+
@as("L") list?: array<attributeValue>,
|
|
14
|
+
@as("M") map?: dict<attributeValue>,
|
|
15
|
+
@as("N") number?: string,
|
|
16
|
+
@as("NS") numberSet?: array<string>,
|
|
17
|
+
@as("NULL") null?: bool,
|
|
18
|
+
@as("S") string?: string,
|
|
19
|
+
@as("SS") stringSet?: array<string>,
|
|
20
|
+
@as("$unknown") unknown?: (string, unknown),
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
module MarshallOptions: {
|
|
24
|
+
/*** see: https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-util-dynamodb/Interface/marshallOptions/ */
|
|
25
|
+
|
|
26
|
+
type options = {
|
|
27
|
+
/** Whether to automatically convert empty strings, blobs, and sets to `null` */
|
|
28
|
+
convertEmptyValues?: bool,
|
|
29
|
+
/** Whether to remove undefined values while marshalling. */
|
|
30
|
+
removeUndefinedValues?: bool,
|
|
31
|
+
/** Whether to convert typeof object to map attribute. */
|
|
32
|
+
convertClassInstanceToMap?: bool,
|
|
33
|
+
/** Whether to convert the top level container if it is a map or list. */
|
|
34
|
+
convertTopLevelContainer?: bool,
|
|
35
|
+
wrapNumbers?: bool,
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
The `marshall` function returns different types depending on `option.convertTopLevelContainer`.
|
|
40
|
+
To model this, the phantom type (parameter) `'output` is used. This type is abstract to enforce proper creation with one of this functions:
|
|
41
|
+
- `topLevelContainerConverted`
|
|
42
|
+
- `topLevelContainerNotConverted`
|
|
43
|
+
*/
|
|
44
|
+
type t<'output>
|
|
45
|
+
|
|
46
|
+
external toOptions: t<'output> => options = "%identity"
|
|
47
|
+
|
|
48
|
+
/** create objections with `convertTopLevelContainer` set to `true` */
|
|
49
|
+
let topLevelContainerConverted: (
|
|
50
|
+
~convertEmptyValues: bool=?,
|
|
51
|
+
~removeUndefinedValues: bool=?,
|
|
52
|
+
~convertClassInstanceToMap: bool=?,
|
|
53
|
+
~wrapNumbers: bool=?,
|
|
54
|
+
) => t<attributeValue>
|
|
55
|
+
|
|
56
|
+
/** create objections with `convertTopLevelContainer` set to `false` */
|
|
57
|
+
let topLevelContainerNotConverted: (
|
|
58
|
+
~convertEmptyValues: bool=?,
|
|
59
|
+
~removeUndefinedValues: bool=?,
|
|
60
|
+
~convertClassInstanceToMap: bool=?,
|
|
61
|
+
~wrapNumbers: bool=?,
|
|
62
|
+
) => t<dict<attributeValue>>
|
|
63
|
+
} = {
|
|
64
|
+
type options = {
|
|
65
|
+
convertEmptyValues?: bool,
|
|
66
|
+
removeUndefinedValues?: bool,
|
|
67
|
+
convertClassInstanceToMap?: bool,
|
|
68
|
+
convertTopLevelContainer?: bool,
|
|
69
|
+
wrapNumbers?: bool,
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
type t<'output> = options
|
|
73
|
+
|
|
74
|
+
external toOptions: t<'output> => options = "%identity"
|
|
75
|
+
|
|
76
|
+
/** convert the top level container into an attributeValue if it is a map or list. */
|
|
77
|
+
let topLevelContainerConverted = (
|
|
78
|
+
~convertEmptyValues=?,
|
|
79
|
+
~removeUndefinedValues=?,
|
|
80
|
+
~convertClassInstanceToMap=?,
|
|
81
|
+
~wrapNumbers=?,
|
|
82
|
+
) => {
|
|
83
|
+
{
|
|
84
|
+
?convertEmptyValues,
|
|
85
|
+
?removeUndefinedValues,
|
|
86
|
+
?convertClassInstanceToMap,
|
|
87
|
+
convertTopLevelContainer: true,
|
|
88
|
+
?wrapNumbers,
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** do NOT convert the top level container into an attributeValue if it is a map or list. */
|
|
93
|
+
let topLevelContainerNotConverted = (
|
|
94
|
+
~convertEmptyValues=?,
|
|
95
|
+
~removeUndefinedValues=?,
|
|
96
|
+
~convertClassInstanceToMap=?,
|
|
97
|
+
~wrapNumbers=?,
|
|
98
|
+
) => {
|
|
99
|
+
{
|
|
100
|
+
?convertEmptyValues,
|
|
101
|
+
?removeUndefinedValues,
|
|
102
|
+
?convertClassInstanceToMap,
|
|
103
|
+
convertTopLevelContainer: false,
|
|
104
|
+
?wrapNumbers,
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/** Convert JavaScript object into DynamoDB Record
|
|
110
|
+
see: https://github.com/aws/aws-sdk-js-v3/blob/de4dc495455a47cd718c635209cd7aef9167797c/packages/util-dynamodb/src/marshall.ts#L40
|
|
111
|
+
*/
|
|
112
|
+
@module("@aws-sdk/util-dynamodb")
|
|
113
|
+
external marshall: ('a, ~options: MarshallOptions.t<'output>=?) => 'output = "marshall"
|
|
114
|
+
|
|
115
|
+
module Raw = {
|
|
116
|
+
type unmarshallOptions = {
|
|
117
|
+
/** When true, skip wrapping the data in { M: data } before converting. Default is true when using the DynamoDBDocumentClient, but false if directly using the unmarshall function (backwards compatibility).
|
|
118
|
+
|
|
119
|
+
Set this to false if top level data is dict<attributeValue>
|
|
120
|
+
*/
|
|
121
|
+
convertWithoutMapWrapper?: bool,
|
|
122
|
+
/** Whether to return numbers as a string instead of converting them to native JavaScript numbers. This allows for the safe round-trip transport of numbers of arbitrary size. */
|
|
123
|
+
wrapNumbers?: bool,
|
|
124
|
+
}
|
|
125
|
+
@module("@aws-sdk/util-dynamodb")
|
|
126
|
+
external unmarshall: ('data, ~options: unmarshallOptions) => 'output = "unmarshall"
|
|
127
|
+
}
|
|
128
|
+
|