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

datastore-level

Package Overview
Dependencies
Maintainers
3
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

datastore-level - npm Package Compare versions

Comparing version 0.12.0 to 0.12.1

10

CHANGELOG.md

@@ -0,1 +1,11 @@

<a name="0.12.1"></a>
## [0.12.1](https://github.com/ipfs/js-datastore-level/compare/v0.12.0...v0.12.1) (2019-06-26)
### Bug Fixes
* swap leveldown/level.js for level ([#20](https://github.com/ipfs/js-datastore-level/issues/20)) ([d16e212](https://github.com/ipfs/js-datastore-level/commit/d16e212))
<a name="0.12.0"></a>

@@ -2,0 +12,0 @@ # [0.12.0](https://github.com/ipfs/js-datastore-level/compare/v0.11.0...v0.12.0) (2019-05-29)

16

package.json
{
"name": "datastore-level",
"version": "0.12.0",
"version": "0.12.1",
"description": "Datastore implementation with level(up|down) backend",
"leadMaintainer": "Pedro Teixeira <pedro@protocol.ai>",
"main": "src/index.js",
"browser": {
"leveldown": "level-js"
},
"scripts": {

@@ -44,7 +41,4 @@ "test": "aegir test",

"datastore-core": "~0.7.0",
"encoding-down": "^6.0.2",
"interface-datastore": "~0.7.0",
"level-js": "^4.0.1",
"leveldown": "^5.0.0",
"levelup": "^4.0.1"
"level": "^5.0.1"
},

@@ -56,3 +50,3 @@ "devDependencies": {

"dirty-chai": "^2.0.1",
"memdown": "^4.0.0",
"level-mem": "^4.0.0",
"rimraf": "^2.6.2"

@@ -62,2 +56,3 @@ },

"Alan Shaw <alan.shaw@protocol.ai>",
"Alex Potsides <alex@achingbrain.net>",
"David Dias <daviddias.p@gmail.com>",

@@ -71,5 +66,4 @@ "Friedel Ziegelmayer <dignifiedquire@gmail.com>",

"Vasco Santos <vasco.santos@moxy.studio>",
"Victor Bjelkholm <victorbjelkholm@gmail.com>",
"achingbrain <alex@achingbrain.net>"
"Victor Bjelkholm <victorbjelkholm@gmail.com>"
]
}

@@ -24,10 +24,10 @@ # js-datastore-level

- [js-datastore-level](#js-datastore-level)
- [Lead Maintainer](#lead-maintainer)
- [Table of Contents](#table-of-contents)
- [Install](#install)
- [Usage](#usage)
- [Browser Shimming Leveldown](#browser-shimming-leveldown)
- [Database names](#database-names)
- [Contribute](#contribute)
- [License](#license)
- [Lead Maintainer](#Lead-Maintainer)
- [Table of Contents](#Table-of-Contents)
- [Install](#Install)
- [Usage](#Usage)
- [Browser Shimming Leveldown](#Browser-Shimming-Leveldown)
- [Database names](#Database-names)
- [Contribute](#Contribute)
- [License](#License)

@@ -45,15 +45,17 @@ ## Install

// Default using leveldown as backend
// Default using level as backend for node or the browser
const store = new LevelStore('path/to/store')
// use in the browser with level.js
const browserStore = new LevelStore('my/db/name', {db: require('level-js')})
// another leveldown compliant backend like memdown
const memStore = new LevelStore('my/mem/store', {db: require('memdown')})
const memStore = new LevelStore('my/mem/store', {
db: require('level-mem')
})
```
### Browser Shimming Leveldown
As `leveldown` does not work in the browser, `LevelStore` takes advantage of the browser property in package.json to shim `level-js` in its place. Most modern bundlers such as webpack, will see the shim and replace it for use in the browser. If you are using a bundler that does not support pkg.browser, you will need to handle the shimming yourself, as was the case with versions of `LevelStore` 0.7.0 and earlier.
`LevelStore` uses the `level` module to automatically use `level.js` if a modern bundler is used which can detect bundle targets based on the `pkg.browser` property in your `package.json`.
If you are using a bundler that does not support `pkg.browser`, you will need to handle the shimming yourself, as was the case with versions of `LevelStore` 0.7.0 and earlier.
### Database names

@@ -60,0 +62,0 @@

'use strict'
const levelup = require('levelup')
const { Key, Errors, utils } = require('interface-datastore')
const encode = require('encoding-down')
const { filter, map, take, sortAll } = utils

@@ -20,18 +17,10 @@

} else {
// Default to leveldown db
database = require('leveldown')
database = require('level')
}
this.db = levelup(
encode(database(path), { valueEncoding: 'binary' }),
Object.assign({}, opts, {
compression: false // same default as go
}),
(err) => {
// Prevent an uncaught exception error on duplicate locks
if (err) {
throw err
}
}
)
this.db = database(path, {
...opts,
valueEncoding: 'binary',
compression: false // same default as go
})
}

@@ -38,0 +27,0 @@

@@ -6,6 +6,3 @@ /* eslint-env mocha */

const { Key } = require('interface-datastore')
// leveldown will be swapped for level-js
const leveljs = require('leveldown')
const leveljs = require('level')
const LevelStore = require('../src')

@@ -12,0 +9,0 @@

@@ -7,4 +7,4 @@ /* eslint-env mocha */

const expect = chai.expect
const memdown = require('memdown')
const LevelDown = require('leveldown')
const levelmem = require('level-mem')
const level = require('level')
const os = require('os')

@@ -19,3 +19,2 @@ const LevelStore = require('../src')

expect(levelStore.db.db.db instanceof LevelDown).to.equal(true)
expect(levelStore.db.options).to.include({

@@ -32,3 +31,3 @@ createIfMissing: true,

const levelStore = new LevelStore('init-default', {
db: memdown,
db: levelmem,
createIfMissing: true,

@@ -40,3 +39,2 @@ errorIfExists: true

expect(levelStore.db.db.db instanceof memdown).to.equal(true)
expect(levelStore.db.options).to.include({

@@ -49,3 +47,3 @@ createIfMissing: true,

;[memdown, LevelDown].forEach(database => {
;[levelmem, level].forEach(database => {
describe(`interface-datastore ${database.name}`, () => {

@@ -52,0 +50,0 @@ require('interface-datastore/src/tests')({

@@ -20,3 +20,3 @@ /* eslint-env mocha */

require('interface-datastore/src/tests')({
setup: () => new LevelStore(dir, { db: require('leveldown') }),
setup: () => new LevelStore(dir, { db: require('level') }),
teardown: () => promisify(rimraf)(dir)

@@ -38,3 +38,3 @@ })

datastore: new LevelStore(dirs[0], {
db: require('leveldown')
db: require('level')
})

@@ -44,3 +44,3 @@ }, {

datastore: new LevelStore(dirs[1], {
db: require('leveldown')
db: require('level')
})

@@ -50,3 +50,3 @@ }, {

datastore: new LevelStore(dirs[2], {
db: require('leveldown')
db: require('level')
})

@@ -63,3 +63,3 @@ }])

const store = new LevelStore(path.join(__dirname, 'test-repo', 'datastore'), {
db: require('leveldown')
db: require('level')
})

@@ -66,0 +66,0 @@

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