New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@capriza/connector-controller

Package Overview
Dependencies
Maintainers
4
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.87 to 1.1.0

12

lib/local/api.js

@@ -32,3 +32,13 @@ const path = require('path');

async sendApprovals(approvalsObj) {
approvalsObj.approvals.forEach(ap=>LocalAPI.approvals[ap.private.id]=ap);
approvalsObj.approvals.forEach(ap=>{
if (ap.deleted){
delete LocalAPI.approvals[ap.id];
return;
}
if (!ap.id) {
ap.id = ap.private.id;
}
LocalAPI.approvals[ap.id]=ap;
});
LocalAPI.approvalsState.push(approvalsObj);

@@ -35,0 +45,0 @@ }

@@ -5,2 +5,3 @@ const express = require('express');

const sse = require('./sse');
const bodyParser = require("body-parser");

@@ -24,3 +25,6 @@ function getUITemplateData(approval, UITemplate){

this.connections = [];
this.app.use(cors());
this.app.use(bodyParser.urlencoded({ extended: false }));
this.app.use(bodyParser.json());
}

@@ -32,6 +36,10 @@

generateTaskId(){
return "task-" + this.syncCounter++;
}
async start(){
var logger = this.logger;
this.app.get('/fetch', async (req, res) => {
var taskId = "sync-" + this.syncCounter++;
var taskId = this.generateTaskId();
var task = new this.TaskClasses.Task({ id : taskId, type : "sync" }),

@@ -58,2 +66,28 @@ backend = task.backend, result;

this.app.post('/action',async (req,res)=>{
var data = req.body.data;
this.logger.info(`Action Data ${JSON.stringify(data)}`);
var taskId = data.id = this.generateTaskId();
var task = new this.TaskClasses.Task(data),
backend = task.backend, result;
try{
await task.execute();
var approvalsResult = backend.getApprovalState(),
taskStatus = backend.getTaskStatus(taskId);
approvalsResult.forEach(approvalsObj=>{
approvalsObj.uiApprovals = approvalsObj.transformedApprovals.map(approval=>getUITemplateData(approval.public, backend.getUITemplate(approval.schemaId)));
});
result = JSON.stringify({approvalsResult, taskStatus});
} catch(ex){
result = `Action error ${ex.stack}`;
}
res.send(result);
res.end();
});
this.app.get('/ServerMessages', async (req, res)=>{

@@ -60,0 +94,0 @@ sse(res);

13

package.json
{
"name": "@capriza/connector-controller",
"version": "1.0.87",
"version": "1.1.0",
"description": "Capriza connectors controller",

@@ -28,4 +28,8 @@ "license": "MIT",

"dependencies": {
"@capriza/schemas": "^1.0.0",
"async-exit-hook": "2.0.1",
"axios": "0.17.1",
"body-parser": "^1.18.3",
"chokidar": "1.7.0",
"cors": "~2.8.4",
"deepmerge": "2.0.1",

@@ -38,2 +42,3 @@ "express": "4.16.3",

"object-hash": "1.2.0",
"opn": "^5.1.0",
"path": "0.12.7",

@@ -43,7 +48,3 @@ "pino": "4.10.2",

"syswide-cas": "^5.0.0",
"ws": "^5.1.1",
"@capriza/schemas": "^1.0.0",
"chokidar": "1.7.0",
"opn": "^5.1.0",
"cors": "~2.8.4"
"ws": "^5.1.1"
},

@@ -50,0 +51,0 @@ "devDependencies": {

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