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 3.0.95 to 4.0.97

6

dist/src/clients/sns.d.ts

@@ -1,2 +0,1 @@

import * as AWS from 'aws-sdk';
import { AwsCredentialsConfig } from './aws';

@@ -18,9 +17,6 @@ import { Logger } from '../logger';

private topicFullName(topicName);
private getOrCreateArn(topicName, createIfUnknown);
private getOrCreateArn(topicName);
publishEvent(topicName: string, message: Object): Promise<void>;
createTopic(topicName: string): Promise<string | undefined>;
findTopicArnOrThrow(topicName: string): Promise<string>;
listAllTopics(): Promise<AWS.SNS.Topic[]>;
listTopics(nextToken?: string | undefined): Promise<AWS.SNS.ListTopicsResponse>;
subscribeQueueToTopic(topicName: string, queueArn: string): Promise<string | undefined>;
}

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

Object.defineProperty(exports, "__esModule", { value: true });
const _ = require("lodash");
const AWS = require("aws-sdk");

@@ -38,11 +37,6 @@ const bPromise = require("bluebird");

}
getOrCreateArn(topicName, createIfUnknown) {
getOrCreateArn(topicName) {
return __awaiter(this, void 0, void 0, function* () {
if (!this.topicArns.has(topicName)) {
if (createIfUnknown) {
this.topicArns.set(topicName, yield this.createTopic(topicName));
}
else {
this.topicArns.set(topicName, yield this.findTopicArnOrThrow(topicName));
}
this.topicArns.set(topicName, yield this.createTopic(topicName));
}

@@ -54,3 +48,3 @@ return this.topicArns.get(topicName);

return __awaiter(this, void 0, void 0, function* () {
const topicArn = yield this.getOrCreateArn(topicName, true);
const topicArn = yield this.getOrCreateArn(topicName);
this.log.info(`Publishing message to ${topicName}: ${JSON.stringify(message)}`);

@@ -74,41 +68,6 @@ yield this.snsPublish({

}
findTopicArnOrThrow(topicName) {
return __awaiter(this, void 0, void 0, function* () {
const fullTopicName = this.topicFullName(topicName);
// the topic name is the last part of the Arn, which has ':' as field separator
const mapped = _.map(yield this.listAllTopics(), 'TopicArn');
const foundArn = _.find(mapped, t => t.endsWith(`:${fullTopicName}`));
if (!foundArn) {
throw new Error(`Unable to find arn for topic ${fullTopicName}. Arns found: ${JSON.stringify(mapped)}`);
}
return foundArn;
});
}
listAllTopics() {
return __awaiter(this, void 0, void 0, function* () {
let allTopics = [];
let nextToken = undefined;
do {
const response = yield this.listTopics(nextToken);
nextToken = response.NextToken;
if (response.Topics) {
allTopics = _.concat(allTopics, response.Topics);
}
} while (nextToken);
this.log.debug(`Found topics: ${JSON.stringify(allTopics)}`);
return allTopics;
});
}
listTopics(nextToken = undefined) {
return __awaiter(this, void 0, void 0, function* () {
this.log.debug('Listing topics');
return yield this.snsListTopics({
NextToken: nextToken,
});
});
}
// this call is idempotent
subscribeQueueToTopic(topicName, queueArn) {
return __awaiter(this, void 0, void 0, function* () {
const topicArn = yield this.getOrCreateArn(topicName, false);
const topicArn = yield this.getOrCreateArn(topicName);
this.log.info(`Subscribing queue ${queueArn} to topic ${topicArn}`);

@@ -115,0 +74,0 @@ const result = yield this.snsSubscribeTopic({

2

package.json
{
"name": "lib-task-scheduler",
"version": "3.0.95",
"version": "4.0.97",
"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

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