lambda-toolkit 1.0.0 → 1.1.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.
- package/dist/index.js +33 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1017,12 +1017,14 @@ module.exports = nativeArgs => {
|
|
|
1017
1017
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
1018
1018
|
|
|
1019
1019
|
const publish = __webpack_require__( 8080 );
|
|
1020
|
+
const publishBatch = __webpack_require__( 3531 );
|
|
1020
1021
|
const { SNSClient } = __webpack_require__( 7651 );
|
|
1021
1022
|
const clientProvider = __webpack_require__( 9039 );
|
|
1022
1023
|
const createInstance = __webpack_require__( 5438 );
|
|
1023
1024
|
|
|
1024
1025
|
const methods = {
|
|
1025
|
-
publish
|
|
1026
|
+
publish,
|
|
1027
|
+
publishBatch
|
|
1026
1028
|
};
|
|
1027
1029
|
|
|
1028
1030
|
module.exports = createInstance( clientProvider.bind( null, SNSClient ), methods );
|
|
@@ -1180,7 +1182,7 @@ const sanitizeSqs = __webpack_require__( 8175 );
|
|
|
1180
1182
|
|
|
1181
1183
|
module.exports = async ( client, queue, messages ) => {
|
|
1182
1184
|
if ( messages.length > 10 ) {
|
|
1183
|
-
throw new Error( 'SQS.sendMessageBatch only accepts up to
|
|
1185
|
+
throw new Error( 'SQS.sendMessageBatch only accepts up to 10 messages.' );
|
|
1184
1186
|
}
|
|
1185
1187
|
const response = await client.send( new SendMessageBatchCommand( {
|
|
1186
1188
|
QueueUrl: queue,
|
|
@@ -1284,6 +1286,35 @@ module.exports = class LambdaApiValidationError extends Error {};
|
|
|
1284
1286
|
"use strict";
|
|
1285
1287
|
module.exports = require("@aws-sdk/lib-dynamodb");
|
|
1286
1288
|
|
|
1289
|
+
/***/ }),
|
|
1290
|
+
|
|
1291
|
+
/***/ 3531:
|
|
1292
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
1293
|
+
|
|
1294
|
+
const { PublishBatchCommand } = __webpack_require__( 7651 );
|
|
1295
|
+
|
|
1296
|
+
module.exports = async ( client, topic, messages ) => {
|
|
1297
|
+
if ( messages.length > 10 ) {
|
|
1298
|
+
throw new Error( 'SNS.publishBatch only accepts up to 10 messages.' );
|
|
1299
|
+
}
|
|
1300
|
+
const response = await client.send( new PublishBatchCommand( {
|
|
1301
|
+
TopicArn: topic,
|
|
1302
|
+
PublishBatchRequestEntries: messages.map( ( { body, id = null, nativeArgs }, index ) => ( {
|
|
1303
|
+
Id: id ?? `message_${index}`,
|
|
1304
|
+
Message: typeof body === 'string' ? body : JSON.stringify( body ),
|
|
1305
|
+
...nativeArgs
|
|
1306
|
+
} ) )
|
|
1307
|
+
} ) );
|
|
1308
|
+
|
|
1309
|
+
if ( response.Failed?.length > 0 ) {
|
|
1310
|
+
const error = new Error( 'SNS.publishBatch Failed. See error details' );
|
|
1311
|
+
error.details = response.Failed;
|
|
1312
|
+
throw error;
|
|
1313
|
+
}
|
|
1314
|
+
return response;
|
|
1315
|
+
};
|
|
1316
|
+
|
|
1317
|
+
|
|
1287
1318
|
/***/ }),
|
|
1288
1319
|
|
|
1289
1320
|
/***/ 3544:
|