dnr-daemon
Advanced tools
Comparing version 2.0.6 to 2.0.7
@@ -17,5 +17,3 @@ "use strict"; | ||
} | ||
catch (e) { | ||
console.log(e); | ||
} | ||
catch (e) { } | ||
} | ||
@@ -22,0 +20,0 @@ Auth.prototype.getToken = function () { |
@@ -27,3 +27,3 @@ "use strict"; | ||
if (command === 'getallflow') { | ||
upstreamFlowsApi.getAllFlow().then(function (r) { | ||
upstreamFlowsApi.getFlows().then(function (r) { | ||
console.log(r); | ||
@@ -30,0 +30,0 @@ }).catch(function (e) { |
@@ -62,2 +62,3 @@ "use strict"; | ||
} | ||
dnrized.label = 'dnr_' + dnrized.id; | ||
return dnrized; | ||
@@ -64,0 +65,0 @@ }; |
@@ -21,3 +21,3 @@ "use strict"; | ||
}; | ||
FlowsAPI.prototype.getAllFlow = function () { | ||
FlowsAPI.prototype.getFlows = function () { | ||
var obj = this; | ||
@@ -65,2 +65,18 @@ var opt = clone(obj.authOpt); | ||
}; | ||
FlowsAPI.prototype.updateFlow = function (id, flow) { | ||
var obj = this; | ||
var opt = clone(obj.authOpt); | ||
opt.uri = FlowsAPI.FLOW_RESOURCE + '/' + id; | ||
opt.body = flow; | ||
opt.method = 'PUT'; | ||
return new Promise(function (f, r) { | ||
request(opt) | ||
.then(function (body) { | ||
f(body); | ||
}) | ||
.catch(function (er) { | ||
r({ error: er.error, statusCode: er.statusCode, statusMessage: er.message }); | ||
}); | ||
}); | ||
}; | ||
FlowsAPI.prototype.installFlow = function (flow) { | ||
@@ -67,0 +83,0 @@ var obj = this; |
@@ -8,3 +8,3 @@ "use strict"; | ||
var CMD_GET_FLOWS = 'getflows'; | ||
var CMD_DELETE_FLOW = 'deleteflow'; | ||
var CMD_DELETE_FLOW = 'uninstallflow'; | ||
var CMD_INSTALL_FLOW = 'installflow'; | ||
@@ -63,3 +63,3 @@ var CMD_TARGET = 'target'; | ||
if (command === CMD_GET_FLOWS) { | ||
flowsApi.getAllFlow().then(function (r) { | ||
flowsApi.getFlows().then(function (r) { | ||
console.log(r); | ||
@@ -66,0 +66,0 @@ }).catch(function (e) { |
@@ -12,2 +12,3 @@ "use strict"; | ||
var dnrized = dnr_1.default.dnrize(test_flow); | ||
chai_1.expect(dnrized.label.startsWith('dnr_') && dnrized.label.endsWith(test_flow.id)); | ||
var dnrGateway = []; | ||
@@ -14,0 +15,0 @@ var originalNodesMap = new Map(); |
{ | ||
"name": "dnr-daemon", | ||
"version": "2.0.6", | ||
"version": "2.0.7", | ||
"description": "dnr service that downloads dnr flows, parse them based on constraints and redeploy to vanilla node-red", | ||
@@ -5,0 +5,0 @@ "main": "build/src/module.js", |
@@ -28,3 +28,3 @@ import request = require('request'); | ||
obj.token = fs.readFileSync(Auth.DNR_HOME + '/token_' + this.hostString, 'utf8'); | ||
} catch (e){console.log(e)} | ||
} catch (e){} | ||
} | ||
@@ -31,0 +31,0 @@ |
@@ -32,3 +32,3 @@ import Auth from './auth'; | ||
if (command === 'getallflow'){ | ||
upstreamFlowsApi.getAllFlow().then(r=>{ | ||
upstreamFlowsApi.getFlows().then(r=>{ | ||
console.log(r) | ||
@@ -35,0 +35,0 @@ }).catch(e=>{ |
@@ -80,4 +80,9 @@ import request = require('request'); | ||
// step 4: keep original flow ID by rewriting the label | ||
// because when deployed, new flow Id will be generated | ||
// also distinguish between dnrized flows and normal flows | ||
dnrized.label = 'dnr_' + dnrized.id | ||
return dnrized | ||
} | ||
} |
@@ -30,3 +30,3 @@ import request = require('request-promise-native'); | ||
public getAllFlow(): Promise<string> { | ||
public getFlows(): Promise<string> { | ||
let obj = this | ||
@@ -61,3 +61,2 @@ let opt = clone(obj.authOpt) | ||
public uninstallFlow(id: string): Promise<string> { | ||
@@ -79,2 +78,19 @@ let obj = this | ||
public updateFlow(id: string, flow: string): Promise<string> { | ||
let obj = this | ||
let opt = clone(obj.authOpt) | ||
opt.uri = FlowsAPI.FLOW_RESOURCE + '/' + id | ||
opt.body = flow | ||
opt.method = 'PUT' | ||
return new Promise<string>(function(f,r){ | ||
request(opt) | ||
.then((body) => { | ||
f(body) | ||
}) | ||
.catch(function (er) { | ||
r({error: er.error, statusCode: er.statusCode, statusMessage: er.message}) | ||
}) | ||
}) | ||
} | ||
public installFlow(flow: string): Promise<string> { | ||
@@ -81,0 +97,0 @@ let obj = this |
@@ -10,3 +10,3 @@ import Auth from './auth'; | ||
const CMD_GET_FLOWS: string = 'getflows' | ||
const CMD_DELETE_FLOW: string = 'deleteflow' | ||
const CMD_DELETE_FLOW: string = 'uninstallflow' | ||
const CMD_INSTALL_FLOW: string = 'installflow' | ||
@@ -73,3 +73,3 @@ const CMD_TARGET: string = 'target' | ||
if (command === CMD_GET_FLOWS){ | ||
flowsApi.getAllFlow().then(r=>{ | ||
flowsApi.getFlows().then(r=>{ | ||
console.log(r) | ||
@@ -76,0 +76,0 @@ }).catch(e=>{ |
@@ -16,2 +16,3 @@ import fs = require('fs'); | ||
var dnrized = Dnr.dnrize(test_flow) | ||
expect(dnrized.label.startsWith('dnr_') && dnrized.label.endsWith(test_flow.id)) | ||
var dnrGateway : string[]= [] | ||
@@ -18,0 +19,0 @@ // mapify |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
1303263
71
5032