firestorm-db
Advanced tools
Comparing version 1.4.0 to 1.5.0
31
index.js
@@ -18,2 +18,7 @@ const { default: axios } = require("axios") | ||
/** | ||
* @typedef {Object} SelectOption | ||
* @property {Array<String>} fields Chosen fields to eventually return | ||
*/ | ||
let _address = undefined | ||
@@ -201,2 +206,28 @@ let _token = undefined | ||
/** | ||
* Upgraded read raw with field selection | ||
* @param {SelectOption} selectOption Select options | ||
*/ | ||
select(selectOption) { | ||
if(!selectOption) selectOption = {} | ||
return new Promise((resolve, reject) => { | ||
this.__extract_data(axios.get(readAddress(), { | ||
data: { | ||
'collection': this.collectionName, | ||
'command': 'select', | ||
'select': selectOption | ||
} | ||
})) | ||
.then(data => { | ||
Object.keys(data).forEach(key => { | ||
data[key][ID_FIELD_NAME] = key | ||
this.addMethods(data[key]) | ||
}) | ||
resolve(data) | ||
}) | ||
.catch(reject) | ||
}) | ||
} | ||
/** | ||
* | ||
@@ -203,0 +234,0 @@ * @param {String} command The write command you want |
{ | ||
"name": "firestorm-db", | ||
"version": "1.4.0", | ||
"version": "1.5.0", | ||
"description": "Self hosted Firestore-like database with API endpoints based on micro bulk operations", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -85,2 +85,3 @@ <div align="center"> | ||
| searchKeys(keys) | keys: ``String[] \| Number[]`` | Searches collections with given keys and returns matching results | | ||
| select(selectOption) | selectOption: ``{ field: String[] }`` | Improved read_raw with field selection | | ||
@@ -87,0 +88,0 @@ Search method can take one or more options to filter entries in a collection. A search option studies a ``field`` with a ``criteria`` and compares it to a ``value``. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
23245
356
196