Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

lib-task-scheduler

Package Overview
Dependencies
Maintainers
1
Versions
70
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lib-task-scheduler - npm Package Compare versions

Comparing version 1.0.38 to 1.0.42

2

dist/src/clients/sqs.d.ts

@@ -29,2 +29,3 @@ import * as AWS from 'aws-sdk';

private awsAttrs();
private awsAttrsWithTopicWritePermissions(awsAccountId);
private getQueueAttributes(attrNames);

@@ -47,2 +48,3 @@ /**

getOrCreateArn(): Promise<string>;
addSendMessagesPermissions(awsAccountId: string): Promise<any>;
}

@@ -46,2 +46,23 @@ "use strict";

}
awsAttrsWithTopicWritePermissions(awsAccountId) {
const attributes = this.awsAttrs();
attributes['Policy'] = JSON.stringify({
'Version': '2012-10-17',
'Id': 'SNStoSQS',
'Statement': [
{
'Effect': 'Allow',
'Principal': '*',
'Action': 'sqs:SendMessage',
'Resource': `arn:aws:sqs:*:${awsAccountId}:*`,
'Condition': {
'ArnLike': {
'aws:SourceArn': `arn:aws:sns:*:${awsAccountId}:*`,
},
},
},
],
});
return attributes;
}
getQueueAttributes(attrNames) {

@@ -67,2 +88,4 @@ return __awaiter(this, void 0, void 0, function* () {

this.log.debug(`Setting queue at ${this.queueUrl} to these attributes ${JSON.stringify(desired)}`);
// This does not overwrite values for attributes that are not included here, such as Policy.
// Thus, Policy (permissions) will not be overwritten here
yield this.awsSetQueueAttributes({

@@ -175,4 +198,14 @@ QueueUrl: this.queueUrl,

}
addSendMessagesPermissions(awsAccountId) {
return __awaiter(this, void 0, void 0, function* () {
this.log.debug(`Adding SendMessage permissions to queue ${this.queueUrl} for aws account`);
const attrs = this.awsAttrsWithTopicWritePermissions(awsAccountId);
yield this.awsSetQueueAttributes({
QueueUrl: this.queueUrl,
Attributes: attrs,
});
});
}
}
exports.SQSClient = SQSClient;
//# sourceMappingURL=sqs.js.map

@@ -7,2 +7,3 @@ /// <reference types="chai" />

export interface SNSSQSConsumerTaskConfig {
awsAccountId: string;
topicName: string;

@@ -17,2 +18,3 @@ snsClient: SNSClient;

private subscribed;
private readonly awsAccountId;
private readonly topicName;

@@ -19,0 +21,0 @@ private readonly snsClient;

5

dist/src/sns_sqs_consumer_task.js

@@ -20,2 +20,3 @@ "use strict";

this.subscribed = false;
this.awsAccountId = config.awsAccountId;
this.topicName = config.topicName;

@@ -60,3 +61,5 @@ this.snsClient = config.snsClient;

const queueArn = yield this.sqsClient.getOrCreateArn();
return yield this.snsClient.subscribeQueueToTopic(this.topicName, queueArn);
const subscriptionArn = yield this.snsClient.subscribeQueueToTopic(this.topicName, queueArn);
yield this.sqsClient.addSendMessagesPermissions(this.awsAccountId);
return subscriptionArn;
});

@@ -63,0 +66,0 @@ }

{
"name": "lib-task-scheduler",
"version": "1.0.38",
"version": "1.0.42",
"description": "A lightweight, modular task scheduler.",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/convoyinc/lib-task-scheduler",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc