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

firestorm-db

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

firestorm-db - npm Package Compare versions

Comparing version 1.3.0 to 1.4.0

48

index.js

@@ -81,3 +81,3 @@ const { default: axios } = require("axios")

request.then(res => {
if('data' in res) return resolve(res.data)
if ('data' in res) return resolve(res.data)
return resolve(res)

@@ -108,2 +108,18 @@ })

search(searchOptions) {
if(!Array.isArray(searchOptions))
return Promise.reject(new Error('searchOptions shall be an array'))
searchOptions.forEach(searchOption => {
if(!searchOption.field || !searchOption.criteria || !searchOption.value)
return Promise.reject(new Error('Missing fields in searchOptions array'))
if(typeof searchOption.field !== 'string')
return Promise.reject(new Error(`${JSON.stringify(searchOption)} search option field is not a string`))
if(searchOption.criteria == 'in' && !Array.isArray(searchOption.value))
return Promise.reject(new Error('in takes an array of values'))
//TODO: add more strict value field warnings in JS and PHP
})
return new Promise((resolve, reject) => {

@@ -118,2 +134,3 @@ this.__extract_data(axios.get(readAddress(), {

const arr = []
Object.keys(res).forEach(contribID => {

@@ -198,10 +215,10 @@ const tmp = res[contribID]

}
if(multiple === true) {
if(multiple === true && Array.isArray(value)) { // solves errors with undefined and null values
value.forEach(v => {
delete v[ID_FIELD_NAME]
if(typeof value != 'number' && typeof value != 'string' && !Array.isArray(value))
delete v[ID_FIELD_NAME]
})
} else if(multiple === false) {
} else if(multiple === false && value != null && value != undefined && typeof value != 'number' && typeof value != 'string' && !Array.isArray(value)) { // solves errors with undefined and null values
delete value[ID_FIELD_NAME]
}
if(value) {

@@ -223,2 +240,5 @@ if(multiple)

write_raw(value) {
if(value === undefined || value === null) {
return Promise.reject(new Error('write_raw value must not be undefined or null'))
}
return this.__extract_data(axios.post(writeAddress(), this.__write_data('write_raw', value)))

@@ -233,3 +253,15 @@ }

add(value) {
return this.__extract_data(axios.post(writeAddress(), this.__write_data('add', value)))
return new Promise((resolve, reject) => {
axios.post(writeAddress(), this.__write_data('add', value))
.then(res => {
return this.__extract_data(Promise.resolve(res))
})
.then(res => {
if(typeof res != 'object' || !('id' in res) || typeof res.id != 'string') throw(new Error('Incorrect result'))
resolve(res.id)
})
.catch(err => {
reject(err)
})
})
}

@@ -300,4 +332,4 @@

editField(obj) {
const data = this.__write_data('editField', obj, undefined)
return this.__extract_data(axios.post(writeAddress()), data)
const data = this.__write_data('editField', obj, null)
return this.__extract_data(axios.post(writeAddress(), data))
}

@@ -304,0 +336,0 @@

{
"name": "firestorm-db",
"version": "1.3.0",
"version": "1.4.0",
"description": "Self hosted Firestore-like database with API endpoints based on micro bulk operations",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"php_start": "node tests/php_setup.js",
"test": "mocha tests/**/*.spec.js",
"php_stop": "sh tests/php_server_kill.sh",
"full": "npm run php_start && npm run test ; npm run php_stop",
"local_tests": "sudo act"
},

@@ -31,3 +35,12 @@ "repository": {

"axios": "^0.21.1"
},
"devDependencies": {
"chai": "^4.3.4",
"fs": "0.0.1-security",
"fs-extra": "^10.0.0",
"glob": "^7.1.7",
"mocha": "^9.0.0",
"path": "^0.12.7",
"recursive-copy": "^2.0.11"
}
}

2

README.md

@@ -6,3 +6,3 @@ <div align="center">

<a href="https://www.npmjs.com/package/firestorm-db" targtet="_blank" ><img alt="npm" src="https://img.shields.io/npm/v/firestorm-db?color=cb0000&logo=npm&style=flat-square"> <img alt="npm bundle size" src="https://img.shields.io/bundlephobia/min/firestorm-db?label=NPM%20minified%20size&style=flat-square"> </a> <img alt="GitHub file size in bytes" src="https://img.shields.io/github/size/TheRolfFR/firestorm-db/index.js?color=43A047&label=Script%20size&logoColor=green&style=flat-square">
<a href="https://www.npmjs.com/package/firestorm-db" targtet="_blank" ><img alt="npm" src="https://img.shields.io/npm/v/firestorm-db?color=cb0000&logo=npm&style=flat-square"> <img alt="npm bundle size" src="https://img.shields.io/bundlephobia/min/firestorm-db?label=NPM%20minified%20size&style=flat-square"> </a> <img alt="GitHub file size in bytes" src="https://img.shields.io/github/size/TheRolfFR/firestorm-db/index.js?color=43A047&label=Script%20size&logoColor=green&style=flat-square"><a href="https://github.com/TheRolfFR/firestorm-db/actions/workflows/testjs.yml"><img src="https://github.com/TheRolfFR/firestorm-db/actions/workflows/testjs.yml/badge.svg" alt="Tests" /></a>

@@ -9,0 +9,0 @@ </div>

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