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

sqns

Package Overview
Dependencies
Maintainers
1
Versions
75
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sqns - npm Package Compare versions

Comparing version 2.1.6 to 2.1.7

2

package.json
{
"name": "sqns",
"version": "2.1.6",
"version": "2.1.7",
"description": "",

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

@@ -10,4 +10,4 @@ ![build](https://github.com/yog27ray/sqns/actions/workflows/node.js.yml/badge.svg?branch=master)

This project has been inspired from AWS SQS and AWS SNS.
This is an extension of the existing AWS SQS and AWS SNS with some more functionality add that we felt were lagging.
This project is inspired by AWS SQS and AWS SNS.
This is an extension of the existing AWS SQS and AWS SNS with some more functionality add that I felt were missing.

@@ -14,0 +14,0 @@ # Prerequisites

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

const worker_event_scheduler_1 = require("../../../scheduler/scheduler-worker/worker-event-scheduler");
const delivery_policy_helper_1 = require("../../helper/delivery-policy-helper");
const base_storage_engine_1 = require("../../model/base-storage-engine");

@@ -30,3 +31,10 @@ const request_client_1 = require("../../request-client/request-client");

});
queue = await client.createQueue({ QueueName: 'queue1' });
const deliveryPolicy = JSON.parse(JSON.stringify(delivery_policy_helper_1.DeliveryPolicyHelper
.DEFAULT_DELIVERY_POLICY.default.defaultHealthyRetryPolicy));
deliveryPolicy.minDelayTarget = 60;
deliveryPolicy.maxDelayTarget = 60;
queue = await client.createQueue({
QueueName: 'queue1',
Attributes: { DeliveryPolicy: JSON.stringify(deliveryPolicy) },
});
});

@@ -102,11 +110,3 @@ it('should call failure api when request fails in mongoDB. for exponential retry', async () => {

failureResponse: 'Event marked failed without response.',
DeliveryPolicy: {
numRetries: 3,
numNoDelayRetries: 0,
minDelayTarget: 20,
maxDelayTarget: 20,
numMinDelayRetries: 0,
numMaxDelayRetries: 0,
backoffFunction: 'exponential',
},
DeliveryPolicy: null,
}, {

@@ -123,11 +123,3 @@ priority: 999999,

processingResponse: 'sent to slave',
DeliveryPolicy: {
numRetries: 3,
numNoDelayRetries: 0,
minDelayTarget: 20,
maxDelayTarget: 20,
numMinDelayRetries: 0,
numMaxDelayRetries: 0,
backoffFunction: 'exponential',
},
DeliveryPolicy: null,
}, {

@@ -145,11 +137,3 @@ priority: 999999,

successResponse: 'this is success message',
DeliveryPolicy: {
numRetries: 3,
numNoDelayRetries: 0,
minDelayTarget: 20,
maxDelayTarget: 20,
numMinDelayRetries: 0,
numMaxDelayRetries: 0,
backoffFunction: 'exponential',
},
DeliveryPolicy: null,
}]);

@@ -163,3 +147,3 @@ });

minDelayTarget: 20,
maxDelayTarget: 20,
maxDelayTarget: 2000,
numMinDelayRetries: 0,

@@ -271,11 +255,3 @@ numMaxDelayRetries: 0,

processingResponse: 'sent to slave',
DeliveryPolicy: {
numRetries: 3,
numNoDelayRetries: 0,
minDelayTarget: 20,
maxDelayTarget: 20,
numMinDelayRetries: 0,
numMaxDelayRetries: 0,
backoffFunction: 'exponential',
},
DeliveryPolicy: null,
}]);

@@ -282,0 +258,0 @@ });

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

import { SupportedProtocol, SUPPORTED_BACKOFF_FUNCTIONS_TYPE, SUPPORTED_CHANNEL_TYPE } from '../../../../typings/typings';
import { SupportedProtocol, SUPPORTED_BACKOFF_FUNCTIONS_TYPE, SUPPORTED_CHANNEL_TYPE } from '../../../../typings/common';
declare const SUPPORTED_PROTOCOL: Array<SupportedProtocol>;

@@ -3,0 +3,0 @@ declare const SUPPORTED_CHANNEL: Array<SUPPORTED_CHANNEL_TYPE>;

@@ -10,3 +10,3 @@ import { ChannelDeliveryPolicy, DeliveryPolicy } from '../../../../typings/delivery-policy';

}): Date;
static verifyAndGetChannelDeliveryPolicy(channelDeliveryPolicy?: string, replyWithDefaultPolicy?: boolean): ChannelDeliveryPolicy;
static verifyAndGetChannelDeliveryPolicy(channelDeliveryPolicy: string, replyWithDefaultPolicy?: boolean): ChannelDeliveryPolicy;
static getEffectiveChannelDeliveryPolicyForSubscription(deliveryPolicy: DeliveryPolicy, subscription: GetSubscriptionResponse): ChannelDeliveryPolicy;

@@ -13,0 +13,0 @@ static checkDeliveryPolicyCorrectness(deliveryPolicyStringValue?: string): void;

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

case 'exponential': {
timeDelay = (DeliveryPolicyHelper.DELAY_CONFIG.exponential ** params.attempt) * params.minDelay * 1000;
timeDelay = params.minDelay ** params.attempt;
break;

@@ -26,8 +26,10 @@ }

}
return new Date(startTime.getTime() + Math.max(timeDelay, params.minDelay));
const effectiveDelay = Math.min(channelDeliveryPolicy.maxDelayTarget, Math.max(timeDelay, params.minDelay, channelDeliveryPolicy.minDelayTarget)) * 1000;
return new Date(startTime.getTime() + effectiveDelay);
}
static verifyAndGetChannelDeliveryPolicy(channelDeliveryPolicy, replyWithDefaultPolicy) {
try {
DeliveryPolicyHelper.hasAllKeys(JSON.parse(channelDeliveryPolicy), DeliveryPolicyHelper.DEFAULT_DELIVERY_POLICY.default.defaultHealthyRetryPolicy);
return JSON.parse(channelDeliveryPolicy);
const channelDeliveryPolicyJSON = JSON.parse(channelDeliveryPolicy);
DeliveryPolicyHelper.hasAllKeys(channelDeliveryPolicyJSON, DeliveryPolicyHelper.DEFAULT_DELIVERY_POLICY.default.defaultHealthyRetryPolicy);
return channelDeliveryPolicyJSON;
}

@@ -102,5 +104,4 @@ catch (error) {

DeliveryPolicyHelper.DELAY_CONFIG = {
linear: 1000 * 60 * 10,
exponential: 2,
linear: 60 * 10,
};
//# sourceMappingURL=delivery-policy-helper.js.map
import { QueueType } from '../../../../typings/class-types';
import { ARN } from '../../../../typings/common';
import { ChannelDeliveryPolicy } from '../../../../typings/delivery-policy';
import { ARN } from '../../../../typings/typings';
import { BaseObject } from './base-object';

@@ -5,0 +5,0 @@ declare class Queue extends BaseObject {

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

this.arn = item.arn || this.getARN();
this.DeliveryPolicy = item.DeliveryPolicy || delivery_policy_helper_1.DeliveryPolicyHelper.verifyAndGetChannelDeliveryPolicy(this.attributes.DeliveryPolicy);
this.DeliveryPolicy = delivery_policy_helper_1.DeliveryPolicyHelper.verifyAndGetChannelDeliveryPolicy(this.attributes.DeliveryPolicy);
}

@@ -20,0 +20,0 @@ static arn(companyId, region, name) {

@@ -138,4 +138,4 @@ "use strict";

this.storageToQueueWorker.setUpIntervalForQueue(queue);
const DeliveryPolicy = delivery_policy_helper_1.DeliveryPolicyHelper
.verifyAndGetChannelDeliveryPolicy((_a = MessageAttribute === null || MessageAttribute === void 0 ? void 0 : MessageAttribute.DeliveryPolicy) === null || _a === void 0 ? void 0 : _a.StringValue, true) || queue.DeliveryPolicy;
const deliveryPolicy = delivery_policy_helper_1.DeliveryPolicyHelper
.verifyAndGetChannelDeliveryPolicy((_a = MessageAttribute === null || MessageAttribute === void 0 ? void 0 : MessageAttribute.DeliveryPolicy) === null || _a === void 0 ? void 0 : _a.StringValue);
const eventItem = new event_item_1.EventItem({

@@ -147,3 +147,3 @@ id: undefined,

queueARN: queue.arn,
DeliveryPolicy,
DeliveryPolicy: deliveryPolicy,
MessageDeduplicationId,

@@ -150,0 +150,0 @@ maxReceiveCount: queue.getMaxReceiveCount(),

@@ -19,5 +19,6 @@ "use strict";

eventItem.incrementReceiveCount();
const effectiveDeliveryPolicy = eventItem.DeliveryPolicy || queue.DeliveryPolicy;
eventItem.eventTime = delivery_policy_helper_1.DeliveryPolicyHelper
.calculateNewEventTime(new Date(), effectiveDeliveryPolicy, { attempt: eventItem.receiveCount, minDelay: visibilityTimeout });
const effectiveDeliveryPolicy = eventItem.DeliveryPolicy
|| queue.DeliveryPolicy
|| delivery_policy_helper_1.DeliveryPolicyHelper.DEFAULT_DELIVERY_POLICY.default.defaultHealthyRetryPolicy;
eventItem.eventTime = delivery_policy_helper_1.DeliveryPolicyHelper.calculateNewEventTime(new Date(), effectiveDeliveryPolicy, { attempt: eventItem.receiveCount, minDelay: visibilityTimeout || effectiveDeliveryPolicy.minDelayTarget });
await this._storageAdapter.updateEvent(eventItem.id, {

@@ -24,0 +25,0 @@ state: event_item_1.EventItem.State.PROCESSING.valueOf(),

@@ -61,3 +61,3 @@ import { EventState } from '../src/sqns/common/model/event-item';

arn?: ARN;
DeliveryPolicy?: ChannelDeliveryPolicy;
DeliveryPolicy?: DeliveryPolicy;
}

@@ -64,0 +64,0 @@ export declare interface SubscriptionVerificationTokenType extends BaseObjectType {

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 too big to display

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