Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
@saulx/selva
Advanced tools
🌴 Selva is a realtime undirected acyclic graph database.
Takes an object with options
example
import { getService } from 'registry'
const client = selva.connect(() => getService('name-of-db'))
// client.redis.hget()
client.set('myId', { myShine: true }).then((result) => console.log(result)) // logs OK
const client = selva.connect({
port: 8080,
host: 'whatever', // defaults to localhost
retryStrategy() {
// optional
return 5e3
},
})
or with a promise
const client = selva.connect(new Promise(resolve => {
resolve({
port: 8080,
host: 'whatever',
retryStrategy () {
return 5e3
}
})
})
or with a (async) function
const client = selva.connect(async () => {
await doSomething()
return {
port: 8080,
host: 'whatever',
retryStrategy() {
return 5e3
},
}
})
On every reconnect selva will call the given function. This allows you to change the configuration (eg. if a db has become unresponsive).
Set an object on an id. Will deep merge objects by default.
Default behaviours
await client.set({
$id: 'myId',
$merge: false, // defaults to true
$version: 'mySpecialversion', // optional
id: 'myNewId',
foo: true,
})
await client.set({
$id: 'myId',
$merge: false, // defaults to true
$version: 'mySpecialversion', // optional
id: 'myNewId',
foo: true,
children: {
$add: 'smukytown',
$delete: 'myblarf',
},
})
await client.set({
$id: 'myId',
children: {
// maybe redis SET do it?
// ---- :(
$hierarchy: false, // defaults to true
$add: 'smukytown',
$delete: ['myblarf', 'xxx'],
},
})
await client.set({
$id: 'myId',
children: {
// ---- :(
$hierarchy: false, // defaults to true
$value: ['root'],
},
})
await client.set({
// gen id, add to root
type: 'tag',
title: 'flowers',
externalId: 'myflower.de'
}
})
await client.set({
// gen id, add to root
type: 'tag',
title: 'flowers',
externalId: {
$merge: false,
$value: 'myflower.de',
},
})
await client.set({
type: 'tag',
title: { de: 'blümen' },
})
await client.set({
$id: 'myId',
$merge: false, // defaults to true
$version: 'mySpecialversion', // optional
myThing: {
title: 'blurf',
nestedCount: {
$default: 100,
$inc: { $value: 1 },
},
access: {
$default: {
flurpiepants: 'my pants',
},
},
},
})
myId
myId#mySpecialversion
const result = await client.get(
{
$id: 'myId',
$version: 'mySpecialversion'
}
)
const versioned = redisClient.get('myId#mySpecialversion')
const original = redisClient.get('myId') || {}
const result = { ...original, ...versioned }
myId
myId#mySpecialversion
const obj = {
foo: {
bar: true,
},
haha: true,
}
'foo.bar': true
'foo.foo': true
'foo.baz': true
'foo.baz.blarf': true,
haha: true
hkeys: foo.*
{ foo: true }
const result = await client.subscribe(
{
id: 'myId',
version: 'mySpecialversion', // optional
},
(id, msg) => {
console.log(`Fired for ${id} with message: ${msg}`)
}
)
const result = await client.subscribe(
{
id: 'myId',
date: 123123123,
version: 'mySpecialversion', // optional
},
(id, msg) => {
console.log(`Fired for ${id} with message: ${msg}`)
}
)
or with an array for ids
const result = await client.subscribe(
{
id: ['myId', 'myOtherId'],
version: 'mySpecialversion', // optional
},
(id, msg) => {
console.log(`Fired for ${id} with message: ${msg}`)
}
)
const result = await client.unsubscribe(
{
id: 'myId',
version: 'mySpecialversion', // optional
},
myCallback // if omitted will remove all listeners
)
Generate an id
Max types 1764!
const id = await client.id({ type: 'flurpy', externalId: 'smurkysmurk' })
// flgurk
await client.delete('ma12231')
await client.delete({ $id: 'ma12231' })
await client.delete({ $id: 'ma12231', $hierarchy: false })
FAQs
🌴 Selva is a realtime undirected acyclic graph database.
The npm package @saulx/selva receives a total of 91 weekly downloads. As such, @saulx/selva popularity was classified as not popular.
We found that @saulx/selva 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.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.