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

sylviejs

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

sylviejs - npm Package Compare versions

Comparing version 0.0.9 to 0.0.10

2

package.json
{
"name": "sylviejs",
"version": "0.0.9",
"version": "0.0.10",
"description": "SylvieJS: Fast document oriented javascript in-memory database",

@@ -5,0 +5,0 @@ "homepage": "https://cfu288.github.io/SylvieJS/",

@@ -23,3 +23,3 @@ # SylvieJS

SylvieJS is a document oriented database written in javascript, published under MIT License.
Its purpose is to store javascript objects as documents in a nosql fashion and retrieve them with a similar mechanism.
Its purpose is to store javascript objects as documents in a NoSQL fashion and retrieve them with a similar mechanism.
Runs in node and the browser.

@@ -31,9 +31,43 @@

2. performance critical applications
3. cordova/phonegap mobile apps where you can leverage the power of javascript and avoid interacting with native databases
4. data sets loaded into a browser page and synchronised at the end of the work session
5. node-webkit desktop apps
6. nativescript mobile apps that mix the power and ubiquity of javascript with native performance and ui
3. Ionic/Capacitor mobile apps where you can leverage the power of javascript and avoid interacting with native databases
4. Data sets loaded into a browser page and synchronised at the end of the work session
5. Electron desktop apps
SylvieJS supports indexing and views and achieves high-performance through maintaining unique and binary indexes (indices) for data.
## Quickstart
### Install via npm
```bash
npm install sylviejs
```
### Example usage with default IndexedDB adapter
```ts
import Sylvie from "sylviejs";
let db = new Sylvie("example.db");
let users = db.addCollection("users");
users.insert([
{
name: "Odin",
age: 50,
address: "Asgard",
},
{ name: "Thor", age: 35 },
{ name: "Loki", age: 30 },
{ name: "Sylvie", age: 25 },
]);
console.group("Search by find() with mongo-like query")
let results = users.find({ age: { $gte: 35 } });
console.log(results);
console.groupEnd()
```
[Full documentation can be found here.](https://cfu288.github.io/SylvieJS/).
## Demo

@@ -44,9 +78,4 @@

- [Sandbox / Playground](https://replit.com/@cfu288/sylviejs-sandbox)
- a node-webkit small demo in the folder demos/desktop_app. You can launch it by running `/path/to/nw demos/desktop_app/`
## Wiki
Example usage can be found in our [documentation](https://cfu288.github.io/SylvieJS/).
## Main Features

@@ -53,0 +82,0 @@

/**
* A loki persistence adapter which persists using node fs module
* @constructor LokiFsAdapter
* A Sylvie persistence adapter which persists using node fs module
*/
import { NormalSyncPersistenceAdapter } from "./persistence-adapter";
export declare class FsAdapter implements NormalSyncPersistenceAdapter {
fs: any;
constructor();
#private;
fs?: typeof import("node:fs/promises");
mode: "normal";

@@ -15,3 +14,3 @@ /** loadDatabase() - Load data from file, will throw an error if the file does not exist

*/
loadDatabase(dbname: string, callback: (value: any) => void): void;
loadDatabase: (dbname: string, callback: (serialized: string | Error) => void) => void;
/**

@@ -24,3 +23,8 @@ * saveDatabase() - save data to file, will throw an error if the file can't be saved

*/
saveDatabase(dbname: any, dbstring: any, callback: any): void;
saveDatabase: (dbname: string, dbstring: string, callback: (_?: Error | {
success: true;
} | {
success: false;
error: Error;
}) => void) => void;
/**

@@ -33,3 +37,8 @@ * deleteDatabase() - delete the database file, will throw an error if the

*/
deleteDatabase(dbname: any, callback: any): void;
deleteDatabase: (dbname: string, callback: (_?: Error | {
success: true;
} | {
success: false;
error: Error;
}) => void) => void;
}

@@ -1,2 +0,2 @@

var m=Object.defineProperty;var o=(t,e)=>m(t,"name",{value:e,configurable:!0}),u=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,s)=>(typeof require<"u"?require:e)[s]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+t+'" is not supported')});var a=class{constructor(){try{this.fs=u("fs")}catch(e){this.fs=null}}loadDatabase(e,s){let n=this;this.fs.stat(e,(i,r)=>{!i&&r.isFile()?n.fs.readFile(e,{encoding:"utf8"},o(function(l,c){s(l?new Error(l):c)},"readFileCallback")):s(null)})}saveDatabase(e,s,n){let i=this,r=`${e}~`;this.fs.writeFile(r,s,o(function(l){l?n(new Error(l)):i.fs.rename(r,e,n)},"writeFileCallback"))}deleteDatabase(e,s){this.fs.unlink(e,o(function(i){i?s(new Error(i)):s()},"deleteDatabaseCallback"))}};o(a,"FsAdapter");export{a as FsAdapter};
var y=Object.defineProperty;var o=(e,s)=>y(e,"name",{value:s,configurable:!0});var E=(e,s,t)=>{if(!s.has(e))throw TypeError("Cannot "+t)};var u=(e,s,t)=>{if(s.has(e))throw TypeError("Cannot add the same private member more than once");s instanceof WeakSet?s.add(e):s.set(e,t)};var c=(e,s,t)=>(E(e,s,"access private method"),t);var p=(e,s,t)=>new Promise((r,i)=>{var g=n=>{try{f(t.next(n))}catch(d){i(d)}},v=n=>{try{f(t.throw(n))}catch(d){i(d)}},f=n=>n.done?r(n.value):Promise.resolve(n.value).then(g,v);f((t=t.apply(e,s)).next())});var h,a,m=class{constructor(){u(this,h);this.loadDatabase=o((s,t)=>{c(this,h,a).call(this).then(()=>{this.fs.stat(s).then(r=>{r.isFile()&&this.fs.readFile(s,{encoding:"utf8"}).then(i=>{t(i)}).catch(i=>{t(i)})}).catch(r=>{t(r)}).catch(t)})},"loadDatabase");this.saveDatabase=o((s,t,r)=>{c(this,h,a).call(this).then(()=>{let i=`${s}~`;this.fs.writeFile(i,t).then(()=>{this.fs.rename(i,s).then(()=>r()).catch(r)}).catch(r)}).catch(r)},"saveDatabase");this.deleteDatabase=o((s,t)=>{c(this,h,a).call(this).then(()=>{this.fs.unlink(s).then(()=>t()).catch(r=>{t(r)})}).catch(t)},"deleteDatabase")}};o(m,"FsAdapter"),h=new WeakSet,a=o(function(){return p(this,null,function*(){if(this.fs===null||this.fs===void 0)try{this.fs=yield import("node:fs/promises")}catch(s){console.error(`FsAdapter - ${s}`)}})},"#initializeFS");export{m as FsAdapter};
//# sourceMappingURL=fs-adapter.js.map

@@ -23,3 +23,3 @@ export declare var Comparators: {

export declare function gtHelper(prop1: number | boolean | string, prop2: number | boolean | string, equal: boolean): boolean;
export declare function sortHelper(prop1: string | number | boolean, prop2: string | number | boolean, desc: boolean): 0 | 1 | -1;
export declare function sortHelper(prop1: string | number | boolean, prop2: string | number | boolean, desc: boolean): 1 | 0 | -1;
/**

@@ -26,0 +26,0 @@ * compoundeval() - helper function for compoundsort(), performing individual object comparisons

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

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