@itcutives/adapter-memory
Advanced tools
Comparing version 1.0.0-beta to 1.0.0
{ | ||
"name": "@itcutives/adapter-memory", | ||
"version": "1.0.0-beta", | ||
"version": "1.0.0", | ||
"description": "Memory Adapter for ITcutives API", | ||
@@ -30,5 +30,5 @@ "main": "index.js", | ||
"mocha": "^5.2.0", | ||
"nyc": "^11.8.0", | ||
"nyc": "^13.1.0", | ||
"proxyquire": "^2.0.1", | ||
"sinon": "^5.0.10", | ||
"sinon": "^7.0.0", | ||
"sinon-chai": "^3.1.0", | ||
@@ -41,4 +41,5 @@ "eslint": "^5.6.1", | ||
"boom": "^7.2.0", | ||
"lodash": "^4.17.10" | ||
"lodash": "^4.17.10", | ||
"uuid": "^3.3.2" | ||
} | ||
} |
@@ -99,2 +99,10 @@ /* eslint-disable no-unused-vars,class-methods-use-this */ | ||
async toLink(fields, ModelPath) { | ||
return this.properties; | ||
} | ||
static async fromLink(Cls, object) { | ||
return new Cls(object); | ||
} | ||
/** | ||
@@ -135,7 +143,5 @@ * | ||
/** | ||
* | ||
* @param values | ||
* @return {*|promise} | ||
*/ | ||
INSERT(values) { | ||
INSERT() { | ||
throw Boom.badImplementation('[adapter] `INSERT` method not implemented'); | ||
@@ -145,8 +151,5 @@ } | ||
/** | ||
* | ||
* @param changes | ||
* @param condition | ||
* @return {*|promise} | ||
*/ | ||
UPDATE(changes, condition) { | ||
UPDATE() { | ||
throw Boom.badImplementation('[adapter] `UPDATE` method not implemented'); | ||
@@ -156,7 +159,5 @@ } | ||
/** | ||
* | ||
* @param condition | ||
* @return {*|promise} | ||
*/ | ||
DELETE(condition) { | ||
DELETE() { | ||
throw Boom.badImplementation('[adapter] `DELETE` method not implemented'); | ||
@@ -163,0 +164,0 @@ } |
@@ -11,7 +11,7 @@ /* eslint-disable class-methods-use-this */ | ||
openConnection() { | ||
throw new Error('Method not implemented'); | ||
throw new Error('[adapter] `openConnection` method not implemented'); | ||
} | ||
closeConnection() { | ||
throw new Error('Method not implemented'); | ||
throw new Error('[adapter] `closeConnection` method not implemented'); | ||
} | ||
@@ -18,0 +18,0 @@ } |
@@ -8,2 +8,7 @@ /* eslint-disable class-methods-use-this */ | ||
class Connection extends AbstractConnection { | ||
constructor(config) { | ||
super(config); | ||
this.database = {}; | ||
} | ||
static get TYPE() { | ||
@@ -14,6 +19,6 @@ return 'MEMORY'; | ||
async openConnection() { | ||
return true; | ||
return this.database; | ||
} | ||
closeConnection() { | ||
async closeConnection() { | ||
return true; | ||
@@ -20,0 +25,0 @@ } |
@@ -217,2 +217,36 @@ /** | ||
describe('toLink', () => { | ||
let a; | ||
beforeEach(() => { | ||
Abstract.FIELDS = ['id', 'name']; | ||
a = new Abstract({ id: 'A001', name: 'ashish' }); | ||
}); | ||
afterEach(() => { | ||
Abstract.FIELDS = []; | ||
}); | ||
it('should resolve with properties of object', (done) => { | ||
a.toLink().should.eventually.deep.eql({ id: 'A001', name: 'ashish' }).notify(done); | ||
}); | ||
}); | ||
describe('STATIC fromLink', () => { | ||
beforeEach(() => { | ||
Abstract.FIELDS = ['id', 'name']; | ||
}); | ||
afterEach(() => { | ||
Abstract.FIELDS = []; | ||
}); | ||
it('should resolve with properties of object', (done) => { | ||
Abstract.fromLink(Abstract, { id: 'A001', name: 'ashish' }).should.eventually.deep.eql(new Abstract({ | ||
id: 'A001', | ||
name: 'ashish', | ||
})).notify(done); | ||
}); | ||
}); | ||
describe('query', () => { | ||
@@ -219,0 +253,0 @@ let a; |
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
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
76938
13
1540
0
3
1
+ Addeduuid@^3.3.2
+ Addeduuid@3.4.0(transitive)