Skip to content

Commit c53cb86

Browse files
committed
Merge branch 'master' of github.com:datapartyjs/dataparty-api into ncc-upgrade
2 parents 8bbb1c6 + fc7be3f commit c53cb86

5 files changed

Lines changed: 29 additions & 8 deletions

File tree

src/sandbox/endpoint-info-sandbox.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,13 @@ const Sandbox = require('./sandbox')
33

44
class EndpointInfoSandbox extends Sandbox {
55
constructor(code, map){
6-
super(`
6+
super(`
7+
8+
var self={};
9+
10+
function userCode(){
11+
${code}
12+
}
713
814
module.exports = async ()=>{
915
@@ -16,8 +22,8 @@ module.exports = async ()=>{
1622
}
1723
1824
try{
19-
var self = {}
20-
${code}
25+
26+
userCode()
2127
2228
return {
2329
Name: self.Lib.Name,

src/sandbox/middleware-exec-sandbox.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ class MiddlewareExecSandbox extends Sandbox {
55
constructor(code, map, func='run'){
66
super(`
77
8+
var self={};
9+
10+
function userCode(){
11+
${code}
12+
}
13+
14+
815
module.exports = async (ctx, static_ctx)=>{
916
1017
class ErrorError extends Error {
@@ -16,8 +23,7 @@ module.exports = async (ctx, static_ctx)=>{
1623
}
1724
1825
try{
19-
var self = {}
20-
${code}
26+
userCode()
2127
2228
return await self.Lib.${func}(ctx, static_ctx)
2329
}

src/sandbox/middleware-info-sandbox.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ class MiddlewareInfoSandbox extends Sandbox {
55
constructor(code, map){
66
super(`
77
8+
var self={};
9+
10+
function userCode(){
11+
${code}
12+
}
13+
14+
815
module.exports = async ()=>{
916
1017
class ErrorError extends Error {
@@ -16,8 +23,7 @@ module.exports = async ()=>{
1623
}
1724
1825
try{
19-
var self = {}
20-
${code}
26+
userCode()
2127
2228
return {
2329
Name: self.Lib.Name,

src/service/service-runner-node.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ class ServiceRunnerNode {
5050
this.started = true
5151

5252
const taskMap = Hoek.reach(this.service, 'compiled.tasks')
53-
//const endpointsLoading = []
5453
for(let name in taskMap){
5554
debug('\t',name)
5655
await this.loadTask(name)

src/service/service-runner.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const EndpointRunner = require('./endpoint-runner')
1111
const DeltaTime = require('../utils/delta-time')
1212

1313
const Router = require('origin-router').Router
14+
const Runner = require('@dataparty/tasker').Runner
1415

1516
class ServiceRunner {
1617

@@ -33,9 +34,12 @@ class ServiceRunner {
3334

3435
this.middleware = { pre: {}, post: {} }
3536
this.endpoint = {}
37+
this.tasks = {}
3638

3739
this.prefix = prefix
3840
this.router = router
41+
this.taskRunner = new Runner()
42+
3943
this.started = false
4044
}
4145

0 commit comments

Comments
 (0)