kinvey-backend-sdk
Advanced tools
Comparing version 0.4.0 to 0.4.1
## Changelog | ||
### 0.4.1 | ||
* BACK-1670: Added support for business logic handler discovery | ||
* Modified service discovery response structure | ||
### 0.4.0 | ||
* Complete rewrite in es6, targeting node 6 | ||
* Back 1531 make backend sdk work externally | ||
* BACK-1531: make backend sdk work externally | ||
@@ -7,0 +11,0 @@ ### 0.3.4 |
@@ -40,4 +40,12 @@ /** | ||
return this.dataLink.process(task, this.moduleGenerator.generate(task), completionCallback); | ||
} else if (task.taskType === 'dataLinkDiscovery') { | ||
return this.dataLink.getServiceObjects(task, completionCallback); | ||
} else if (task.taskType === 'serviceDiscovery') { | ||
task.discoveryObjects = { | ||
dataLink: { | ||
serviceObjects: this.dataLink.getServiceObjects() | ||
}, | ||
businessLogic: { | ||
handlers: this.businessLogic.getHandlers() | ||
} | ||
}; | ||
return completionCallback(null, task); | ||
} else if (task.taskType === 'businessLogic') { | ||
@@ -44,0 +52,0 @@ return this.businessLogic.process(task, this.moduleGenerator.generate(task), completionCallback); |
@@ -21,2 +21,6 @@ /** | ||
function getHandlers() { | ||
return [...registeredFunctions.keys()]; | ||
} | ||
function register(taskName, functionToExecute) { | ||
@@ -62,2 +66,3 @@ registeredFunctions.set(taskName, functionToExecute); | ||
exports.getHandlers = getHandlers; | ||
exports.register = register; | ||
@@ -64,0 +69,0 @@ exports.resolve = resolve; |
@@ -108,5 +108,4 @@ /** | ||
function getServiceObjects(task, callback) { | ||
task.serviceObjects = [...registeredServiceObjects.keys()]; | ||
callback(null, task); | ||
function getServiceObjects() { | ||
return [...registeredServiceObjects.keys()]; | ||
} | ||
@@ -113,0 +112,0 @@ |
{ | ||
"name": "kinvey-backend-sdk", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"description": "Backend SDK", | ||
@@ -5,0 +5,0 @@ "engines": { |
@@ -58,2 +58,6 @@ /** | ||
describe('logic registration', () => { | ||
afterEach((done) => { | ||
logic.clearAll(); | ||
return done(); | ||
}); | ||
it('can register a logic task', (done) => { | ||
@@ -67,2 +71,17 @@ logic.register(testTaskName, (request, complete) => { | ||
}); | ||
describe('discovery', () => { | ||
afterEach((done) => { | ||
logic.clearAll(); | ||
return done(); | ||
}); | ||
it('returns an array of all registered business logic handlers', (done) => { | ||
const testHandlerName = 'testObj'; | ||
logic.register(testHandlerName, () => {}); | ||
const discoveredHandlers = logic.getHandlers(); | ||
should.exist(discoveredHandlers[0]); | ||
discoveredHandlers.length.should.eql(1); | ||
discoveredHandlers[0].should.eql(testHandlerName); | ||
done(); | ||
}); | ||
}); | ||
describe('completion handlers', () => { | ||
@@ -69,0 +88,0 @@ afterEach((done) => { |
@@ -116,11 +116,14 @@ /** | ||
describe('discovery', () => { | ||
afterEach((done) => { | ||
data.clearAll(); | ||
return done(); | ||
}); | ||
it('returns an array of all registered serviceObjects', (done) => { | ||
const testName = 'testObj'; | ||
const sampleTask = {}; | ||
data.serviceObject(testName); | ||
data.getServiceObjects(sampleTask, () => { | ||
should.exist(sampleTask.serviceObjects[0]); | ||
sampleTask.serviceObjects[0].should.eql(testName); | ||
done(); | ||
}); | ||
const discoveredServiceObjects = data.getServiceObjects(); | ||
discoveredServiceObjects.length.should.eql(1); | ||
should.exist(discoveredServiceObjects[0]); | ||
discoveredServiceObjects[0].should.eql(testName); | ||
done(); | ||
}); | ||
@@ -127,0 +130,0 @@ }); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
238280
4654
0