Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@seald-io/nedb

Package Overview
Dependencies
Maintainers
3
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@seald-io/nedb - npm Package Compare versions

Comparing version 4.0.3 to 4.0.4

13

browser-version/lib/storage.browser.js

@@ -142,2 +142,13 @@ /**

/**
* Shim for {@link module:storage.ensureParentDirectoryExistsAsync}, nothing to do, no directories will be used on the browser.
* @function
* @param {string} file
* @param {number} [mode]
* @return {Promise<void|string>}
* @alias module:storageBrowser.ensureParentDirectoryExistsAsync
* @async
*/
const ensureParentDirectoryExistsAsync = async (file, mode) => Promise.resolve()
/**
* Shim for {@link module:storage.ensureDatafileIntegrityAsync}, nothing to do, no data corruption possible in the browser.

@@ -180,1 +191,3 @@ * @param {string} filename

module.exports.ensureDatafileIntegrityAsync = ensureDatafileIntegrityAsync
module.exports.ensureParentDirectoryExistsAsync = ensureParentDirectoryExistsAsync

@@ -256,2 +256,13 @@ /**

/**
* Shim for {@link module:storage.ensureParentDirectoryExistsAsync}, nothing to do, no directories will be used on the browser.
* @function
* @param {string} file
* @param {number} [mode]
* @return {Promise<void|string>}
* @alias module:storageBrowser.ensureParentDirectoryExistsAsync
* @async
*/
const ensureParentDirectoryExistsAsync = async (file, mode) => Promise.resolve()
// Interface

@@ -284,1 +295,3 @@ module.exports.exists = exists

module.exports.ensureDatafileIntegrityAsync = ensureDatafileIntegrityAsync
module.exports.ensureParentDirectoryExistsAsync = ensureParentDirectoryExistsAsync

14

index.d.ts

@@ -108,10 +108,10 @@ // Type definitions for @seald-io/nedb 2.1.0

update<T extends Schema>(
update<T extends Schema, O extends Nedb.UpdateOptions>(
query: any,
updateQuery: any,
options?: Nedb.UpdateOptions,
options?: O,
callback?: (
err: Error | null,
numberOfUpdated: number,
affectedDocuments: Document<T> | Document<T>[] | null,
affectedDocuments: O['returnUpdatedDocs'] extends true ? O['multi'] extends true ? Document<T>[] | null : Document<T> | null : null,
upsert: boolean | null

@@ -121,9 +121,9 @@ ) => void

updateAsync<T extends Schema>(
updateAsync<T extends Schema, O extends Nedb.UpdateOptions>(
query: any,
updateQuery: any,
options?: Nedb.UpdateOptions
options?: O
): Promise<{
numAffected: number;
affectedDocuments: Document<T> | Document<T>[] | null;
affectedDocuments: O['returnUpdatedDocs'] extends true ? O['multi'] extends true ? Document<T>[] | null : Document<T> | null : null;
upsert: boolean;

@@ -154,3 +154,3 @@ }>;

declare namespace Nedb {
interface Cursor<T> extends Promise<T> {
interface Cursor<T> extends Promise<Document<T>> {
sort(query: any): Cursor<T>;

@@ -157,0 +157,0 @@ skip(n: number): Cursor<T>;

@@ -28,2 +28,3 @@ // Forked from https://github.com/jahewson/node-byline

const timers = require('timers')
const { Buffer } = require('buffer')

@@ -30,0 +31,0 @@ const createLineStream = (readStream, options) => {

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

const path = require('path')
const { deprecate } = require('util')

@@ -311,3 +310,3 @@ const byline = require('./byline')

if (this.inMemoryOnly) return
await Persistence.ensureDirectoryExistsAsync(path.dirname(this.filename), this.modes.dirMode)
await Persistence.ensureParentDirectoryExistsAsync(this.filename, this.modes.dirMode)
await storage.ensureDatafileIntegrityAsync(this.filename, this.modes.fileMode)

@@ -376,8 +375,4 @@

*/
static async ensureDirectoryExistsAsync (dir, mode = DEFAULT_DIR_MODE) {
const parsedDir = path.parse(path.resolve(dir))
// this is because on Windows mkdir throws a permission error when called on the root directory of a volume
if (process.platform !== 'win32' || parsedDir.dir !== parsedDir.root || parsedDir.base !== '') {
await storage.mkdirAsync(dir, { recursive: true, mode })
}
static async ensureParentDirectoryExistsAsync (dir, mode = DEFAULT_DIR_MODE) {
return storage.ensureParentDirectoryExistsAsync(dir, mode)
}

@@ -384,0 +379,0 @@ }

/**
* Way data is stored for this database.
* This version is the Node.js/Node Webkit version.
* This version is the Node.js version.
* It's essentially fs, mkdirp and crash safe write and read functions.

@@ -274,2 +274,18 @@ *

/**
* Check if a file's parent directory exists and create it on the fly if it is not the case.
* @param {string} filename
* @param {number} mode
* @return {Promise<void>}
* @private
*/
const ensureParentDirectoryExistsAsync = async (filename, mode) => {
const dir = path.dirname(filename)
const parsedDir = path.parse(path.resolve(dir))
// this is because on Windows mkdir throws a permission error when called on the root directory of a volume
if (process.platform !== 'win32' || parsedDir.dir !== parsedDir.root || parsedDir.base !== '') {
await mkdirAsync(dir, { recursive: true, mode })
}
}
// Interface

@@ -301,1 +317,3 @@ module.exports.existsAsync = existsAsync

module.exports.ensureFileDoesntExistAsync = ensureFileDoesntExistAsync
module.exports.ensureParentDirectoryExistsAsync = ensureParentDirectoryExistsAsync
{
"name": "@seald-io/nedb",
"version": "4.0.3",
"version": "4.0.4",
"files": [

@@ -5,0 +5,0 @@ "lib/**/*.js",

@@ -841,2 +841,6 @@ <img src="http://i.imgur.com/9O1xHFb.png" style="width: 25%; height: 25%; float: left;">

However, the `browser` and `react-native` versions rely on node native modules and therefore must be polyfilled:
- `util` with https://github.com/browserify/node-util.
- `events` with https://github.com/browserify/events.
## Performance

@@ -843,0 +847,0 @@

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

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

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