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

@restroom-mw/db

Package Overview
Dependencies
Maintainers
3
Versions
176
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@restroom-mw/db - npm Package Compare versions

Comparing version 0.9.3-1bc602d.8 to 0.9.3-2b8285e.31

41

dist/index.js

@@ -28,4 +28,3 @@ "use strict";

catch (e) {
throw new Error(`[DATABASE]
Error in JSON format "${o}"`);
throw new Error(`[DATABASE] Error in JSON format "${o}"`);
}

@@ -44,2 +43,16 @@ };

const { zencode, keys, data } = params;
keysContent =
typeof keys === "undefined"
? {}
: keys && typeof keys === "object"
? keys
: parse(keys);
dataContent =
typeof data === "undefined"
? {}
: data && typeof data === "object"
? data
: parse(data);
content = Object.assign(Object.assign({}, dataContent), keysContent);
contentKeys = Object.keys(content);
if (zencode.match(ACTIONS.GET_URI_KEYS)) {

@@ -53,16 +66,2 @@ dbUriKeys = zencode.paramsOf(ACTIONS.GET_URI_KEYS);

const dbAllRecordData = zencode.paramsOf(ACTIONS.GET_RECORD);
keysContent =
typeof keys === "undefined"
? {}
: keys && typeof keys === "object"
? keys
: parse(keys);
dataContent =
typeof data === "undefined"
? {}
: data && typeof data === "object"
? data
: parse(data);
content = Object.assign(Object.assign({}, dataContent), keysContent);
contentKeys = Object.keys(content);
//create object(s) with the FOUR values of each GET_RECORD

@@ -221,5 +220,7 @@ const dbQueries = [];

// check that all endpoints (urlKeys) are properties in either data or keys
if (contentKeys.includes(key[keyName]) === false) {
throw new Error(`[DATABASE]
Endpoint "${key[keyName]}" has not been defined in keys or data.`);
if (contentKeys) {
if (contentKeys.includes(key[keyName]) === false) {
throw new Error(`[DATABASE]
Endpoint "${key[keyName]}" has not been defined in keys or data.`);
}
}

@@ -240,3 +241,3 @@ });

throw new Error(`[HTTP]
Boolean values are not permitted. Response JSON has property "${key}" with a boolean value.
Boolean values are not permitted. Response JSON has property "${key}" with a boolean value.
Please use, for example, 0 and 1`);

@@ -243,0 +244,0 @@ }

{
"name": "@restroom-mw/db",
"version": "0.9.3-1bc602d.8+1bc602d",
"version": "0.9.3-2b8285e.31+2b8285e",
"description": "Database utilities middleware for Restroom",

@@ -25,2 +25,4 @@ "author": "Puria Nafisi Azizi <puria@dyne.org>",

"build": "tsc -b tsconfig.json",
"unlinks": "yarn unlink",
"links": "yarn link",
"test": "nyc ava"

@@ -35,6 +37,8 @@ },

"dependencies": {
"mariadb": "^2.5.4",
"mysql2": "^2.2.5",
"sequelize": "^5.21.7",
"sqlite3": "^5.0.0"
},
"gitHead": "1bc602d083e2a99c76ecf3b4dec64c95f06f515f"
"gitHead": "2b8285e3885d1a0df4d11909f59dab7ff514f669"
}

@@ -22,4 +22,3 @@ import { DataTypes, Model, Sequelize } from "sequelize";

} catch (e) {
throw new Error(`[DATABASE]
Error in JSON format "${o}"`);
throw new Error(`[DATABASE] Error in JSON format "${o}"`);
}

@@ -63,2 +62,16 @@ };

const { zencode, keys, data } = params;
keysContent =
typeof keys === "undefined"
? {}
: keys && typeof keys === "object"
? keys
: parse(keys);
dataContent =
typeof data === "undefined"
? {}
: data && typeof data === "object"
? data
: parse(data);
content = { ...dataContent, ...keysContent };
contentKeys = Object.keys(content);

@@ -75,16 +88,3 @@ if (zencode.match(ACTIONS.GET_URI_KEYS)) {

const dbAllRecordData: string[] = zencode.paramsOf(ACTIONS.GET_RECORD);
keysContent =
typeof keys === "undefined"
? {}
: keys && typeof keys === "object"
? keys
: parse(keys);
dataContent =
typeof data === "undefined"
? {}
: data && typeof data === "object"
? data
: parse(data);
content = { ...dataContent, ...keysContent };
contentKeys = Object.keys(content);
//create object(s) with the FOUR values of each GET_RECORD

@@ -257,5 +257,7 @@ const dbQueries: QueryGetRecord[] = [];

// check that all endpoints (urlKeys) are properties in either data or keys
if (contentKeys.includes(key[keyName]) === false) {
throw new Error(`[DATABASE]
Endpoint "${key[keyName]}" has not been defined in keys or data.`);
if (contentKeys) {
if (contentKeys.includes(key[keyName]) === false) {
throw new Error(`[DATABASE]
Endpoint "${key[keyName]}" has not been defined in keys or data.`);
}
}

@@ -276,3 +278,3 @@ });

throw new Error(`[HTTP]
Boolean values are not permitted. Response JSON has property "${key}" with a boolean value.
Boolean values are not permitted. Response JSON has property "${key}" with a boolean value.
Please use, for example, 0 and 1`);

@@ -279,0 +281,0 @@ }

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