New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

db2graphql

Package Overview
Dependencies
Maintainers
1
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

db2graphql - npm Package Compare versions

Comparing version 0.5.2 to 0.5.3

2

package.json
{
"name": "db2graphql",
"version": "0.5.2",
"version": "0.5.3",
"description": "Generate Graphql schema based on existing relational database",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -167,2 +167,3 @@ const hash = require('string-hash-64');

result = [lastIdresult[0]];
if (data._debug) console.log('db insert:', query.toSQL().sql, query.toSQL().bindings);
} else {

@@ -172,2 +173,3 @@ let query = this.db(tablename)

result = await query.update(data.input);
if (data._debug) console.log('db update:', query.toSQL().sql, query.toSQL().bindings);
}

@@ -174,0 +176,0 @@ return result;

@@ -158,2 +158,3 @@ const hash = require('string-hash-64');

result = await query.insert(data.input);
if (data._debug) console.log('db insert:', query.toSQL().sql, query.toSQL().bindings);
} else {

@@ -163,2 +164,3 @@ let query = this.db(fullname)

result = await query.update(data.input);
if (data._debug) console.log('db update:', query.toSQL().sql, query.toSQL().bindings);
}

@@ -165,0 +167,0 @@ return result;

@@ -74,12 +74,10 @@ const utils = require('../utils/utils');

const pk = this.dbDriver.getPrimaryKeyFromSchema(tablename);
let id = data.input[pk];
// Filter data
delete data['_debug'];
// Store item
const result = await this.dbDriver.putItem(tablename, data);
if (!data[pk]) data[pk] = result[0];
if (!id) id = result[0];
// Retrieve updated item
const args = { filter: { [tablename]: [['=', pk, data[pk]]] }};
const args = { filter: { [tablename]: [['=', pk, id]] }};
return await this.dbDriver.firstOf(tablename, args);

@@ -86,0 +84,0 @@ }

@@ -252,3 +252,3 @@ const Mysql = require('../../src/adapters/mysql');

const adapter = new Mysql(db, schema);
let result = await adapter.putItem('foo', { input: { bar: true }});
let result = await adapter.putItem('foo', { input: { bar: true }, _debug: true});
expect(Array.isArray(result)).toBe(true);

@@ -255,0 +255,0 @@ expect(result.length).toBe(1);

@@ -259,3 +259,3 @@ const PostgreSQL = require('../../src/adapters/postgres');

const adapter = new PostgreSQL(db, schema);
let result = await adapter.putItem('foo', { input: { bar: true }});
let result = await adapter.putItem('foo', { input: { bar: true }, _debug: true });
expect(Array.isArray(result)).toBe(true);

@@ -262,0 +262,0 @@ expect(result.length).toBe(1);

@@ -95,6 +95,6 @@ const Resolver = require('../../src/graphql/resolver');

const resolver = new Resolver(dbDriver);
let result = await resolver.putItem('foo', null, {});
let result = await resolver.putItem('foo', null, { input: {}});
let expected = {id:1};
expect(result).toEqual(expected);
result = await resolver.putItem('foo', null, {id:1});
result = await resolver.putItem('foo', null, { input: {id:1}});
expected = {id:1};

@@ -292,4 +292,4 @@ expect(result).toEqual(expected);

await resolvers.Query.getFirstFoo();
await resolvers.Mutation.putItemFoo();
await resolvers.Mutation.putItemFoo(null, { input: {}, _debug: true });
done();
});
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