lambda-toolkit 0.0.14-beta → 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.
Files changed (2) hide show
  1. package/dist/index.js +33 -2
  2. package/package.json +18 -18
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 then messages.' );
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:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lambda-toolkit",
3
- "version": "0.0.14-beta",
3
+ "version": "1.1.0",
4
4
  "description": "A set of tools to help and simplify Node Js code development for AWS Lambdas",
5
5
  "files": [
6
6
  "./license",
@@ -24,25 +24,25 @@
24
24
  },
25
25
  "homepage": "https://github.com/szanata/lambda-toolkit",
26
26
  "dependencies": {
27
- "@aws-sdk/client-athena": "^3.758.0",
28
- "@aws-sdk/client-cloudwatch-logs": "^3.774.0",
29
- "@aws-sdk/client-dynamodb": "^3.758.0",
30
- "@aws-sdk/client-lambda": "^3.758.0",
31
- "@aws-sdk/client-s3": "^3.758.0",
32
- "@aws-sdk/client-sesv2": "^3.758.0",
33
- "@aws-sdk/client-sns": "^3.758.0",
34
- "@aws-sdk/client-sqs": "^3.758.0",
35
- "@aws-sdk/client-ssm": "^3.759.0",
36
- "@aws-sdk/client-timestream-query": "^3.758.0",
37
- "@aws-sdk/client-timestream-write": "^3.758.0",
38
- "@aws-sdk/lib-dynamodb": "^3.758.0",
39
- "@aws-sdk/s3-request-presigner": "^3.758.0"
27
+ "@aws-sdk/client-athena": "^3.840.0",
28
+ "@aws-sdk/client-cloudwatch-logs": "^3.840.0",
29
+ "@aws-sdk/client-dynamodb": "^3.840.0",
30
+ "@aws-sdk/client-lambda": "^3.840.0",
31
+ "@aws-sdk/client-s3": "^3.840.0",
32
+ "@aws-sdk/client-sesv2": "^3.840.0",
33
+ "@aws-sdk/client-sns": "^3.840.0",
34
+ "@aws-sdk/client-sqs": "^3.840.0",
35
+ "@aws-sdk/client-ssm": "^3.840.0",
36
+ "@aws-sdk/client-timestream-query": "^3.840.0",
37
+ "@aws-sdk/client-timestream-write": "^3.840.0",
38
+ "@aws-sdk/lib-dynamodb": "^3.840.0",
39
+ "@aws-sdk/s3-request-presigner": "^3.840.0"
40
40
  },
41
41
  "devDependencies": {
42
- "eslint": "9.22.0",
43
- "eslint-plugin-import": "2.31.0",
44
- "jest": "29.7.0",
45
- "webpack": "5.98.0",
42
+ "eslint": "9.30.1",
43
+ "eslint-plugin-import": "2.32.0",
44
+ "jest": "30.0.3",
45
+ "webpack": "5.99.9",
46
46
  "webpack-cli": "6.0.1"
47
47
  }
48
48
  }