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.24 to 1.0.25

2

lib/connector.js
var syncher = require ("./syncher.js");
var hashFunction = require('object-hash');
var jslt = require('jslt');
var jslt = require('@capriza/jslt');

@@ -5,0 +5,0 @@ exports.Connector = class Connector {

module.exports = {
codes: {
"ERROR": { code: "ERROR", name: "General error", description: "General error" },
"CONNECTOR_ERROR": { code: "CONNECTOR_ERROR", name: "Connector business logic error", description: "An unknows error has occured in the connector's business logic" },
"SYSTEM_UNAVAILABLE": { code: "SYSTEM_UNAVAILABLE", name: "System unavailable", description: "Source system is unavailable, or not responsive" },
"AUTHENTICATION": { code: "AUTHENTICATION", name: "Authentication error", description: "Source system authentication failed" },
"ATTACHMENT_NOT_FOUND": { code: "ATTACHMENT_NOT_FOUND", name: "Attachment not found", description: "Attachment was not found, or is not available in the source system" },
"TASK_INVALID": { code: "TASK_INVALID", name: "Invalid task type", description: "Invalid task type" },
"TASK_TIMEOUT": { code: "TASK_TIMEOUT", name: "Task timeout", description: "Task took to long to complete and was timed out." },
"APPROVAL_DATA_MISMATCH": { code: "APPROVAL_DATA_MISMATCH", name: "Approval data mismatch", description: "Approval data doesn't match to the source system" },
"ERROR": { code: "ERROR", severity: "NORMAL", name: "General error", description: "General error" },
"CONNECTOR_ERROR": { code: "CONNECTOR_ERROR", severity: "NORMAL", name: "Connector business logic error", description: "An unknows error has occured in the connector's business logic" },
"SYSTEM_UNAVAILABLE": { code: "SYSTEM_UNAVAILABLE", severity: "NORMAL", name: "System unavailable", description: "Source system is unavailable, or not responsive" },
"AUTHENTICATION": { code: "AUTHENTICATION", severity: "CRITICAL", name: "Authentication error", description: "Source system authentication failed" },
"ATTACHMENT_NOT_FOUND": { code: "ATTACHMENT_NOT_FOUND", severity: "NORMAL", name: "Attachment not found", description: "Attachment was not found, or is not available in the source system" },
"TASK_INVALID": { code: "TASK_INVALID", severity: "NORMAL", name: "Invalid task type", description: "Invalid task type" },
"TASK_TIMEOUT": { code: "TASK_TIMEOUT", severity: "CRITICAL", name: "Task timeout", description: "Task took to long to complete and was timed out." },
"APPROVAL_DATA_MISMATCH": { code: "APPROVAL_DATA_MISMATCH", severity: "CRITICAL", name: "Approval data mismatch", description: "Approval data doesn't match to the source system" },
"APPROVAL_NOT_EXIST": { code: "APPROVAL_NOT_EXIST", severity: "NORMAL", name: "Approval wasn't found", description: "approval wasn't found in the source system or is not pending" }
},

@@ -12,0 +13,0 @@ get(code) {

@@ -19,3 +19,4 @@ /**

};
var errorCount = 0;
hashList.filter(app=>!app.deleted).forEach (hashListApproval => {

@@ -25,2 +26,4 @@ var existingApproval = approvals.find(approval => approval.private.id == hashListApproval.private.id);

return result.removed.push ({id: hashListApproval.id, syncver: hashListApproval.syncver, deleted: true});
else if (existingApproval.error)
++errorCount;
else if (hashListApproval.private.approver != existingApproval.private.approver){

@@ -37,7 +40,14 @@ //in case the approval was found but changed owner, we need to remove it and create a new one, and not update the existing one.

result.added = approvals.filter (approval => !hashList.find (hashListApproval => hashListApproval.private.id == approval.private.id));
result.added = approvals.filter (approval => !approval.error && !hashList.find (hashListApproval => hashListApproval.private.id == approval.private.id));
options.logger.info(`[syncher] Sync complete. added:${result.added.length}, removed: ${result.removed.length}, updated: ${result.updated.length}`);
options.logger.info({
added : result.added.length,
removed : result.removed.length,
updated : result.updated.length,
error : errorCount,
errorRate : errorCount / ((result.added.length + result.updated.length + errorCount) || 1)
}, "Sync statistics");
return result.added.concat(result.removed).concat(result.updated);
}
}

@@ -44,6 +44,6 @@ const util = require("util");

outpost.log = msg => origLogger(`[${file}] ${msg}`);
require(`${prefix}/${file}`);
require(file);
}
catch (ex) {
throw new Error(`Error running prestart script ${prefix}/${file}: ${ex.message}`);
throw new Error(`Error running prestart script ${file}: ${ex.message}`);
}

@@ -50,0 +50,0 @@ finally {

{
"name": "@capriza/connector-controller",
"version": "1.0.24",
"version": "1.0.25",
"description": "Capriza connectors controller",

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

@@ -8,3 +8,2 @@ var validate = require('capriza-schema').validate;

logger.level = 'trace';
var jslt = require ("jslt");
var argv = require('minimist')(process.argv.slice(2));

@@ -15,3 +14,3 @@ var path = require ("path");

var template = config.controllerConfig.schemaTransformer;
var jslt = new (require ("jslt"))(template);
var jslt = new (require ("@capriza/jslt"))(template);
jslt.setTemplate(template);

@@ -18,0 +17,0 @@ var old_write = process.stdout.write;

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