New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@live-change/db

Package Overview
Dependencies
Maintainers
1
Versions
298
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@live-change/db - npm Package Compare versions

Comparing version 0.3.32 to 0.3.33

43

lib/AtomicWriter.js

@@ -7,2 +7,8 @@ function getProperty(of, propertyName) {

}
function hasProperty(of, propertyName) {
const path = propertyName.split('.')
let p = of
for(let part of path.slice(0,-1)) p = p[part]
return p && p.hasOwnProperty(path[path.length-1])
}
function setProperty(of, propertyName, value) {

@@ -58,2 +64,26 @@ const path = propertyName.split('.')

const tests = {
gt(obj, { property, value }) {
return getProperty(obj, property) > value
},
gte(obj, { property, value }) {
return getProperty(obj, property) >= value
},
lt(obj, { property, value }) {
return getProperty(obj, property) < value
},
lte(obj, { property, value }) {
return getProperty(obj, property) <= value
},
eq(obj, { property, value }) {
return JSON.stringify(getProperty(obj, property)) == JSON.stringify(value)
},
exist(obj, { property }) {
return hasProperty(obj, property)
},
notExist(obj, { property }) {
return !hasProperty(obj, property)
}
}
const mutators = {

@@ -115,2 +145,15 @@ set(obj, { property, value }) {

},
conditional(value, { conditions, operations }) {
for(const condition of conditions) {
const test = tests[condition.test]
if(!test) throw new Error(`test ${condition.test} not exists`)
if(!test(value, condition)) return value
}
for(let operation of operations) {
const mutator = mutators[operation.op]
if(!mutator) throw new Error(`mutator "${operation.op}" not exists`)
value = mutator(value, operation)
}
return value
}
}

@@ -117,0 +160,0 @@

2

lib/Index.js

@@ -387,3 +387,3 @@ const IntervalTree = require('node-interval-tree').default

let timeCounter = 0
const startReader = new queryGet.QueryReader(this.database, (''+timeCounter).padStart(16, '0'))
const startReader = new queryGet.QueryReader(this.database, () => (''+(++timeCounter)).padStart(16, '0'))
await this.code(startReader, this.writer)

@@ -390,0 +390,0 @@ lastUpdateTimestamp = indexCreateTimestamp - 1000 // one second overlay

@@ -60,5 +60,4 @@ const { TableWriter, LogWriter } = require('./queryUpdate.js')

while(true) {
const now = this.#time()
objects = await (await this.#table).rangeGet(range)
results = results.concat(await Promise.all(objects.map(object => cb(object, null, object.id, now))))
results = results.concat(await Promise.all(objects.map(object => cb(object, null, object.id, this.#time()))))
if(objects.length == maxGetLimit) {

@@ -65,0 +64,0 @@ range.gt = objects[objects.length - 1].id

{
"name": "@live-change/db",
"version": "0.3.32",
"version": "0.3.33",
"description": "Database with observable data for live queries",

@@ -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