Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@itcutives/adapter-memory

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@itcutives/adapter-memory - npm Package Compare versions

Comparing version 1.0.0-beta to 1.0.0

src/adapter.js

9

package.json
{
"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;

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc