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

@capriza/connector-controller

Package Overview
Dependencies
Maintainers
1
Versions
345
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@capriza/connector-controller - npm Package Compare versions

Comparing version 1.0.27 to 1.0.28

32

lib/com.js

@@ -191,2 +191,10 @@ /**

_updateApprovalInCache (serverApproval){
if (!serverApproval.deleted){
this.dataCache[serverApproval.id] = serverApproval;
} else {
delete this.dataCache[serverApproval.id];
}
}
async _syncData(options){

@@ -206,7 +214,4 @@ try{

if (!serverApproval.deleted){
this.dataCache[serverApproval.id] = serverApproval;
} else {
delete this.dataCache[serverApproval.id]
}
this._updateApprovalInCache(serverApproval);
});

@@ -227,2 +232,15 @@

async _getBackendApproval({logger, id}) {
logger.log (`Fetching approval '${id}' from backend`);
try {
var response = await axios.get(`${this.apiUrl}/rawapprovals/${id}`, {headers: this.requestHeaders}),
serverApproval = response.data;
this._updateApprovalInCache(serverApproval);
this.connector.signatureList = this.data = Object.values(this.dataCache);
}
catch (ex) {
throw new Error (`Error fetching approval '${id}' from backend: ${ex.message || ex}`);
}
}
async _sendApprovals(approvals, options) {

@@ -305,5 +323,5 @@ var bulk = [], promises = [], bulkSize = 0;

progressUpdater = this.updateTaskInProgress(taskId, taskLogger);
await this._syncData({logger: taskLogger});
switch(taskType) {
case "sync":
await this._syncData({logger: taskLogger});
var approvalSyncResult = await Promise.race ([this._doSync({logger: taskLogger}), this._taskTimeout(taskLogger)]);

@@ -314,2 +332,3 @@ taskLogger.log(`Got ${approvalSyncResult.length} approvals to send...`);

case "approve":
await this._getBackendApproval({logger: taskLogger, id: task.data.approval.id});
var approvalSyncResult = await Promise.race ([this._doApprove(task.data, {logger: taskLogger}), this._taskTimeout(taskLogger)]);

@@ -319,2 +338,3 @@ await this._sendApprovals(approvalSyncResult, {logger: taskLogger});

case "reject":
await this._getBackendApproval({logger: taskLogger, id: task.data.approval.id});
var approvalSyncResult = await Promise.race ([this._doReject(task.data, {logger: taskLogger}), this._taskTimeout(taskLogger)]);

@@ -321,0 +341,0 @@ await this._sendApprovals(approvalSyncResult, {logger: taskLogger});

7

lib/connector.js

@@ -79,3 +79,3 @@ var syncher = require ("./syncher.js");

var error = new Error (`Approval was not returned from the connector`);
error.error = "APPROVAL_DATA_MISMATCH";
error.error = "APPROVAL_NOT_EXIST";
throw error;

@@ -89,2 +89,3 @@ }

error.error = "APPROVAL_DATA_MISMATCH";
error.fetchedApproval = fetchedApproval;
throw error;

@@ -108,3 +109,5 @@ }

catch (ex) {
var error = new Error (`Error performing action '${type}' for approval '${data.approval.private.id}': ${(ex.message || ex)}`);
const fetchedApprovalId = ex.fetchedApproval && ex.fetchedApproval.private && ex.fetchedApproval.private.id;
var error = new Error (`Error performing action '${type}' for approval '${data.approval.private.id}'
${fetchedApprovalId ? ' (source approval id was ' + fetchedApprovalId + ')' : ''}: ${(ex.message || ex)}`);
error.details = ex.message || ex;

@@ -111,0 +114,0 @@ error.error = ex.error;

{
"name": "@capriza/connector-controller",
"version": "1.0.27",
"version": "1.0.28",
"description": "Capriza connectors controller",

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

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