@capriza/connector-controller
Advanced tools
Comparing version 1.0.48 to 1.0.49
@@ -347,3 +347,2 @@ /** | ||
try{ | ||
var taskContext = {logger: taskLogger, taskType, taskId}; | ||
this.workInProgressTasks[taskId] = { type : taskType }; | ||
@@ -354,9 +353,8 @@ progressUpdater = this.updateTaskInProgress(taskId, taskLogger); | ||
case "sync": | ||
await Promise.race([this._doSync(taskContext), this._taskTimeout(taskLogger)]); | ||
await Promise.race([this._doSync({logger: taskLogger}), this._taskTimeout(taskLogger)]); | ||
break; | ||
case "approve": | ||
Object.assign(taskContext, {id: task.data.approval.id}); | ||
await this._getBackendApproval(taskContext); | ||
var approvalSyncResult = await Promise.race ([this._doApprove(task.data, taskContext), this._taskTimeout(taskLogger)]); | ||
await this._sendApprovals(approvalSyncResult, taskContext); | ||
await this._getBackendApproval({logger: taskLogger, id: task.data.approval.id}); | ||
var approvalSyncResult = await Promise.race ([this._doApprove(task.data, {logger: taskLogger}), this._taskTimeout(taskLogger)]); | ||
await this._sendApprovals(approvalSyncResult, {logger: taskLogger}); | ||
break; | ||
@@ -363,0 +361,0 @@ case "reject": |
@@ -77,10 +77,4 @@ var Syncher = require ("./syncher.js"); | ||
_getLoggerFunc(logger){ | ||
return (component, approvalId)=>{ | ||
return this.getBLLogger(logger).child ({component, approvalId}); | ||
} | ||
} | ||
async _performAction (type, data, taskContext) { | ||
var logger = taskContext.logger.child({component: "connector-controller", approvalId: data.approval.private.id}); | ||
async _performAction (type, data, options) { | ||
var logger = options.logger.child({component: "connector-controller", approvalId: data.approval.private.id}); | ||
var blLogger = this.getBLLogger(logger); | ||
@@ -87,0 +81,0 @@ |
{ | ||
"name": "@capriza/connector-controller", | ||
"version": "1.0.48", | ||
"version": "1.0.49", | ||
"description": "Capriza connectors controller", | ||
@@ -28,3 +28,3 @@ "main": "index.js", | ||
"devDependencies": { | ||
"capriza-schema": "git+ssh://git@git.assembla.com:caprizaportfolio/capriza-ng.schemas.git#dev", | ||
"@capriza/schemas": "^1.0.0", | ||
"chai": "^4.1.2", | ||
@@ -31,0 +31,0 @@ "chai-as-promised": "^7.1.1", |
@@ -14,3 +14,3 @@ require('syswide-cas'); | ||
var loggerFactory; | ||
if ("dev" in argv) process.env.logStream = "console"; //in dev m q ode write log to console | ||
if ("dev" in argv) process.env.logStream = "console"; //in dev mode write log to console | ||
else process.env.logStream = "file"; //in production write log to file | ||
@@ -57,2 +57,1 @@ loggerFactory = new Logger(process.env.logStream); | ||
run (1); //1st attempt | ||
@@ -12,2 +12,5 @@ var fse = require ("fs-extra"); | ||
server.initBL(); | ||
try{ | ||
var schema = require (`${process.cwd()}/resources/schema.json`); | ||
server.registerSchema(schema); | ||
} catch(ex) { } |
@@ -1,2 +0,3 @@ | ||
var validate = require('capriza-schema').validate; | ||
var validate = require('@capriza/schemas').validate; | ||
var registerSchema = require('@capriza/schemas').registerSchema; | ||
var http = require('http'); | ||
@@ -221,2 +222,11 @@ var fs = require('fs'); | ||
}, | ||
"/registerSchema": function (req, res){ | ||
res.writeHeader(200, {"Content-Type": "text/html"}); | ||
var params = JSON.parse(req.body), | ||
schema = require(params.filePath); | ||
registerSchema(schema); | ||
res.write(`Schema ${schema.id} was registered successfully`); | ||
res.end(); | ||
}, | ||
} | ||
@@ -265,2 +275,7 @@ | ||
registerSchema(schema){ | ||
registerSchema(schema); | ||
logger.log(`Schema ${schema.id} was registered successfully`) | ||
}, | ||
async initBL(){ | ||
@@ -267,0 +282,0 @@ await bl.init({config: config.blConfig, logger}); |
Sorry, the diff of this file is not supported yet
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
130659
24
1504
26