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.1.0 to 1.2.0

71

index.js

@@ -121,2 +121,32 @@ const { default: axios } = require("axios")

/**
* Search specific keys through collection
* @param {String[]|Number[]} keys Wanted keys
* @returns {Promise<T[]>} Search results
*/
searchKeys(keys) {
if(!Array.isArray(keys))
return Promise.reject('Incorrect keys')
return new Promise((resolve, reject) => {
this.__extract_data(axios.get(readAddress(), {
data: {
"collection": this.collectionName,
"command": "searchKeys",
"search": keys
}
})).then(res => {
const arr = []
Object.keys(res).forEach(contribID => {
const tmp = res[contribID]
tmp[ID_FIELD_NAME] = contribID
arr.push(tmp)
})
resolve(this.__add_methods(Promise.resolve(arr)))
}).catch(err => reject(err))
})
}
/**
* Returns the whole content of the file

@@ -126,14 +156,19 @@ * @returns {Promise} // the get promise of the collection raw file content

read_raw() {
let data = this.__extract_data(axios.get(readAddress(), {
data: {
"collection": this.collectionName,
"command": "read_raw"
}
}))
return new Promise((resolve, reject) => {
this.__extract_data(axios.get(readAddress(), {
data: {
"collection": this.collectionName,
"command": "read_raw"
}
}))
.then(data => {
Object.keys(data).forEach(key => {
data[key][ID_FIELD_NAME] = key
this.addMethods(data[key])
})
Object.keys(data).forEach(key => {
this.addMethods(data[key])
resolve(data)
})
.catch(reject)
})
return data
}

@@ -153,2 +188,10 @@

}
if(multiple) {
value.forEach(v => {
delete v[ID_FIELD_NAME]
})
} else {
delete value[ID_FIELD_NAME]
}
if(value) {

@@ -188,3 +231,9 @@ if(multiple)

addBulk(values) {
return this.__extract_data(axios.post(writeAddress(), this.__write_data('addBulk', values, true)))
return new Promise((resolve, reject) => {
this.__extract_data(axios.post(writeAddress(), this.__write_data('addBulk', values, true)))
.then(res => {
resolve(res.ids)
})
.catch(reject)
})
}

@@ -191,0 +240,0 @@

2

package.json
{
"name": "firestorm-db",
"version": "1.1.0",
"version": "1.2.0",
"description": "Self hosted Firestore-like database with API endpoints based on micro bulk operations",

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

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