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

defender-base-client

Package Overview
Dependencies
Maintainers
8
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

defender-base-client - npm Package Compare versions

Comparing version 1.34.0 to 1.36.0-rc.1

lib/utils/rate-limit.d.ts

1

lib/autotask/index.d.ts
export declare abstract class BaseAutotaskClient {
private arn;
private lambda;
private invocationRateLimit;
constructor(credentials: string, arn: string);

@@ -5,0 +6,0 @@ protected execute<T>(request: object): Promise<T>;

14

lib/autotask/index.js

@@ -8,2 +8,4 @@ "use strict";

const lambda_1 = __importDefault(require("aws-sdk/clients/lambda"));
const rate_limit_1 = require("../utils/rate-limit");
const time_1 = require("../utils/time");
// do our best to get .errorMessage, but return object by default

@@ -27,2 +29,3 @@ function cleanError(payload) {

const creds = credentials ? JSON.parse(credentials) : undefined;
this.invocationRateLimit = rate_limit_1.rateLimitModule.createCounterFor(arn, 300);
this.lambda = new lambda_1.default(creds

@@ -40,3 +43,6 @@ ? {

async execute(request) {
const result = await this.lambda
const invocationTimeStamp = time_1.getTimestampInSeconds();
this.invocationRateLimit.checkRateFor(invocationTimeStamp);
this.invocationRateLimit.incrementRateFor(invocationTimeStamp);
const invocationRequestResult = await this.lambda
.invoke({

@@ -48,8 +54,8 @@ FunctionName: this.arn,

.promise();
if (result.FunctionError) {
throw new Error(`Error while attempting request: ${cleanError(result.Payload)}`);
if (invocationRequestResult.FunctionError) {
throw new Error(`Error while attempting request: ${cleanError(invocationRequestResult.Payload)}`);
}
return JSON.parse(result.Payload);
return JSON.parse(invocationRequestResult.Payload);
}
}
exports.BaseAutotaskClient = BaseAutotaskClient;
{
"name": "defender-base-client",
"version": "1.34.0",
"version": "1.36.0-rc.1",
"description": "",

@@ -34,3 +34,3 @@ "main": "./lib/index.js",

},
"gitHead": "47cf06c2db2ff19d9711a542bd70620d2b558ab2"
"gitHead": "b98cfa3f7afa424e6e514701452a1920576bd726"
}

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