Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@sodular/lite
Advanced tools
Sodular a Lite JSON database similar to firebase. Visit the master branch: https://github.com/coorise/sodular-lite-js.git
SoduLite (Sodular Lite) is a lightweight JSON database based on path-like (similar to firebase database )
The data can be saved on local json file if you use Node JS or on browser with localStorage.
Node JS: npm install @sodular/lite
Browser:
//import SoduLite from '@sodular/lite'; //Node JS
import SoduLite from '../sodulite.min.js'; //For browser
let db = SoduLite.init({
dbName: 'sodulite @&', // we use regex to replace any special character to '\_'
path: './database@/project-Z $é/', //same for path, using '/xxxx' or './xxxx' is not necessary because we use the root of the project only.
});
Note: path is only for Node JS
db = db = db.load('data'); //In Node Js, if .json is not added , it will automatically create it.
Note: load('service_name') is like your sub-dbName (sub-dbName.json if you are on Node Js).
As service you have: auth, data, storage...
Note: All operations are async, for those who don't know what we mean, it is as example below:
doSomething.then((result)=>{
//work with your result
})
//OR
(async () => {
let result= await doSomething()
//work with your result
})()
let op = db
.ref('/members/users/0')
.create({ name: 'Alice' })
.then((node) => { // using then to get the value
console.log('Create Alice: ', {
path: node.path,
key: node.key,
value: node.value,
error: node.error,
});
})
.catch((e) => {
console.log('Create Alice Error: ', e);
});
//OR
let op = await db // asuming it's in an async function
.ref('/members/users/0') // you could generate a unique uid for your users.
.create({ name: 'Alice' })
.catch((e) => {
console.log('Create Bob Error: ', e);
});
console.log('Create Alice:', {
path: op.path,
key: op.key,
value: op.value, // you get the object value
error: op.error,
});
Note: If the ref with data exists already, you won't be allowed to create, instead you have to do the Update Operation.
//Get the value of a path
let alice = await db // asuming it's in an async function
.ref('/members/users/0')
.get() //let it empty
.catch((e) => {
console.log('Get Alice Error: ', e);
});
console.log('Get Alice:', {
path: alice.path,
key: alice.key,
value: alice.value,//the info of alice is here or it will return false.
error: alice.error,
});
//If path is an array[list of ids] or object{list of ids}
let alice = await db // asuming it's in an async function
.ref('/members/users') //users is an array or object with ids as property
.get({name:'Alice'}) // Will only fetch the first Alice found, so add multiple parameter to get your result efficiently like {name:'Alice,age:30,...}, but the best is {uid:'userId'}.
.catch((e) => {
console.log('Get Alice Error: ', e);
});
console.log('Get Alice:', {
path: alice.path,
key: alice.key,
value: alice.value,//the info of alice is here or it will return false.
error: alice.error,
});
let query = await db // asuming it's in an async function
.ref('/members/users') //users is an array or object with ids as property
.query({ filter: { age: { _lte: 30 } } }) //Or { '$<=': 30 } , to get the condition little or equal to 30.
.catch((e) => {
console.log('Get Query Error: ', e);
});
console.log('Get Query:', {
path: query.path,
key: query.key,
value: query.value,//array the value of query is here or it will return false.
error: query.error,
});
Note: See the parameters for query(filter = {}, sort, pagination, mod)
//If you data is [], you could also use a path query string for a shorthand of pagination to get the list of objects in array.
let query = await db // asuming it's in an async function
.ref('/members/users[0;1;5]') // if exist will select only the users[O], users[1] and users[5] in an array
.query() //let it empty
.catch((e) => {
console.log('Get Query Error: ', e);
});
console.log('Get Query:', {
path: query.path,
key: query.key,
value: query.value,//the array value of query is here or it will return false.
error: query.error,
});
Note: Check the path query string.
//Overwrite the previous data
let alice = await db // asuming it's in an async function
.ref('/members/users/0')
.update({ name: 'Alice Lite' })
.catch((e) => {
console.log('Update Alice Error: ', e);
});
console.log('Update Alice:', {
path: alice.path,
key: alice.key,
value: alice.value,//the info of alice is here or it will return false.
error: alice.error,
});
// To merge with the previous data , you add {merge=true}
let alice = await db // asuming it's in an async function
.ref('/members/users/0')
.update({ age: 26 },{merge=true}) //Here we merge with the existing value.
.catch((e) => {
console.log('Update Alice Error: ', e);
});
console.log('Update Alice:', {
path: alice.path,
key: alice.key,
value: alice.value,//the info of alice is here or it will return false.
error: alice.error,
});
//Delete value with path
let alice = await db // asuming it's in an async function
.ref('/members/users/0')
.delete() //let it empty, it will delete everything on child=0
.catch((e) => {
console.log('Delete Alice Error: ', e);
});
console.log('Delete Alice:', {
path: alice.path,
key: alice.key,
value: alice.value,//the info of alice is here or it will return false.
error: alice.error,
});
//If the final path is an array[list of ids] or object{list of ids}, the you can do the filter:
let alice = await db // asuming it's in an async function
.ref('/members/users') //here you won't go to child=0, //users is an array or object with ids as property
.delete({ age: 26 }) // will delete child which has age=26,
.catch((e) => {
console.log('Delete Alice Error: ', e);
});
console.log('Delete Alice:', {
path: alice.path,
key: alice.key,
value: alice.value,//the info of alice is here or it will return false.
error: alice.error,
});
Note:It will only delete the first object which has age=26 not all objects having age=26,
so be careful to delete a unique uid, instead you should do .delete({ uid: uid_of_user }) or delete with the first method using path only.
let filter={
//...
}
let sort={
//...
}
let pagination={
//...
}
let mod={
//...
}
let result=await db //assuming async
.ref()
.query({filter,sort,pagination,mod})
.catch((e) => {})
console.log('The result of filter: ', result?.value)
The available parameters are:
^${operand?.replace(/\*/g, '.*')}$
).test(value); ^${operand?.replace(/\*/g, '.*')}$
).test(value); If you have any suggestion, feature to add ...etc
MIT: You can use it for educational/personal/business purpose!
FAQs
Sodular a Lite JSON database similar to firebase. Visit the master branch: https://github.com/coorise/sodular-lite-js.git
The npm package @sodular/lite receives a total of 1 weekly downloads. As such, @sodular/lite popularity was classified as not popular.
We found that @sodular/lite demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.