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

steveo

Package Overview
Dependencies
Maintainers
0
Versions
220
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

steveo - npm Package Compare versions

Comparing version 7.0.1-steveo-sqs.2 to 7.0.1

6

lib/common.d.ts

@@ -58,6 +58,4 @@ import { NodeHttpHandler } from '@smithy/node-http-handler';

receiveMessageWaitTimeSeconds: string;
credentials?: {
accessKeyId: string;
secretAccessKey: string;
};
accessKeyId?: string;
secretAccessKey?: string;
maxNumberOfMessages: number;

@@ -64,0 +62,0 @@ visibilityTimeout: number;

@@ -56,3 +56,4 @@ "use strict";

sqsConfig.receiveMessageWaitTimeSeconds;
parameters.credentials = sqsConfig.credentials;
parameters.accessKeyId = sqsConfig.accessKeyId;
parameters.secretAccessKey = sqsConfig.secretAccessKey;
parameters.maxNumberOfMessages = sqsConfig.maxNumberOfMessages;

@@ -59,0 +60,0 @@ parameters.visibilityTimeout = sqsConfig.visibilityTimeout;

@@ -9,9 +9,11 @@ "use strict";

region: sqsConfig.region,
credentials: sqsConfig.credentials,
credentials: {
accessKeyId: sqsConfig.accessKeyId ?? '',
secretAccessKey: sqsConfig.secretAccessKey ?? '',
},
endpoint: sqsConfig.endpoint,
};
// This is set as https by default in AWS SDK 3
// if (sqsConfig.httpOptions) {
// conf.requestHandler = sqsConfig.httpOptions as NodeHttpHandler;
// }
if (sqsConfig.httpOptions) {
conf.requestHandler = sqsConfig.httpOptions;
}
return new client_sqs_1.SQS(conf);

@@ -18,0 +20,0 @@ };

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

`consumer-${this.constructor.name}-${(0, crypto_1.randomBytes)(16).toString('hex')}`;
this.logger.info({ config: this.config }, `${this.config.engine.toUpperCase()} config`);
}

@@ -67,3 +68,3 @@ get registry() {

async stop() {
this.logger.debug(`${this.config.engine.toUpperCase()}: stopping consumer ${this.name}`);
this.logger.debug(`stopping consumer ${this.name}`);
this.manager.state = 'terminating';

@@ -75,3 +76,3 @@ }

const topics = this.registry.getTopics();
this.logger.debug(`${this.config.engine.toUpperCase()}: creating queues: ${topics}`);
this.logger.debug(`creating queues: ${topics}`);
if (!topics || topics.length === 0) {

@@ -82,3 +83,4 @@ this.logger.debug('no topics found');

await bluebird_1.default.map(topics, (topic) => this.createQueue(topic).catch(er => {
this.logger.error(`${this.config.engine.toUpperCase()}: error creating queue for topic: ${er.toString()}`);
console.log(this.config.engine.toUpperCase());
this.logger.error(`error creating queue for topic: ${er.toString()}`);
}), { concurrency: 10 });

@@ -85,0 +87,0 @@ return true;

@@ -123,5 +123,8 @@ "use strict";

const subscriptions = this.getActiveSubsciptions(topics);
this.logger.info({ allSubscriptions: subscriptions }, `Processing active subscriptions`);
this.logger.debug(`Polling for messages (name: ${this.name}) (state: ${this.manager.state}) (${topics ? topics.join(',') : 'all'})`);
await bluebird_1.default.map(subscriptions, async (topic) => {
this.logger.info(`Processing topic ${topic}`);
const queueURL = await this.getQueueUrl(topic);
this.logger.info(`Queue URL for ${topic}: ${queueURL}`);
if (queueURL) {

@@ -182,2 +185,3 @@ this.logger.debug(`starting processing of ${topic} with ${queueURL}`);

getUrl(topic) {
this.logger.info({ topicParams: { QueueName: topic } }, `Getting url for topic ${topic}`);
return this.sqs

@@ -184,0 +188,0 @@ .getQueueUrl({ QueueName: topic })

@@ -32,3 +32,3 @@ "use strict";

const timeoutId = setTimeout(() => {
this.logger.error(`${this.config.engine.toUpperCase()}: Connection timed out`);
this.logger.error('Connection timed out');
reject();

@@ -39,3 +39,3 @@ }, this.config.connectionTimeout);

clearTimeout(timeoutId);
this.logger.error(`${this.config.engine.toUpperCase()}: Error initializing producer`, err);
this.logger.error('Error initializing producer', err);
reject(err);

@@ -46,7 +46,7 @@ }

clearTimeout(timeoutId);
this.logger.debug(`${this.config.engine.toUpperCase()}: producer ready`);
this.logger.debug('producer ready');
resolve(this.producer);
});
this.producer.on('disconnected', () => {
this.logger.debug(`${this.config.engine.toUpperCase()}: Producer disconnected`);
this.logger.debug('Producer disconnected');
});

@@ -69,3 +69,3 @@ });

if (err) {
this.logger.error(`${this.config.engine.toUpperCase()} Error while sending payload:`, JSON.stringify(data, null, 2), 'topic :', topic, 'Error :', err);
this.logger.error('Error while sending payload:', JSON.stringify(data, null, 2), 'topic :', topic, 'Error :', err);
this.registry.emit('producer_failure', topic, err);

@@ -90,3 +90,3 @@ reject();

catch (ex) {
this.logger.error(`${this.config.engine.toUpperCase()}: Error while sending payload`, topic, ex);
this.logger.error('Error while sending Redis payload', topic, ex);
this.registry.emit('producer_failure', topic, ex, payload);

@@ -100,3 +100,3 @@ throw ex;

if (err) {
this.logger.error(`${this.config.engine.toUpperCase()}: Error while disconnecting producer`, err);
this.logger.error('Error while disconnecting producer', err);
}

@@ -103,0 +103,0 @@ });

@@ -66,3 +66,3 @@ "use strict";

}
this.logger.debug(`${this.config.engine.toUpperCase()}: Creating queue`, util_1.default.inspect(params));
this.logger.debug(`Creating queue`, util_1.default.inspect(params));
const res = await this.producer

@@ -99,10 +99,10 @@ .createQueue(params)

};
this.logger.debug(`${this.config.engine.toUpperCase()}: Creating DLQ for orginal queue ${queueName}`, util_1.default.inspect(params));
this.logger.debug(`Creating DLQ for orginal queue ${queueName}`, util_1.default.inspect(params));
const res = await this.producer
.createQueue(params)
.catch(err => {
throw new Error(`${this.config.engine.toUpperCase()}: Failed to call SQS createQueue: ${err}`);
throw new Error(`Failed to call SQS createQueue: ${err}`);
});
if (!res.QueueUrl) {
throw new Error(`${this.config.engine.toUpperCase()}: createQueue response does not contain a queue name`);
throw new Error('SQS createQueue response does not contain a queue name');
}

@@ -119,7 +119,7 @@ dlQueueUrl = res.QueueUrl;

.catch(err => {
throw new Error(`${this.config.engine.toUpperCase()}: Failed to call SQS getQueueAttributes: ${err}`);
throw new Error(`Failed to call SQS getQueueAttributes: ${err}`);
});
const dlQueueArn = attributesResult.Attributes?.QueueArn;
if (!dlQueueArn) {
throw new Error(`${this.config.engine.toUpperCase()}: Failed to retrieve the DLQ ARN`);
throw new Error('Failed to retrieve the DLQ ARN');
}

@@ -126,0 +126,0 @@ return {

{
"name": "steveo",
"version": "7.0.1-steveo-sqs.2",
"version": "7.0.1",
"description": "A Task Pub/Sub Background processing library",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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