FRE-600: Fix code review blockers

- Consolidated duplicate UndoManagers to single instance
- Fixed connection promise to only resolve on 'connected' status
- Fixed WebSocketProvider import (WebsocketProvider)
- Added proper doc.destroy() cleanup
- Renamed isPresenceInitialized property to avoid conflict

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
2026-04-25 00:08:01 -04:00
parent 65b552bb08
commit 7c684a42cc
48450 changed files with 5679671 additions and 383 deletions

452
node_modules/level-packager/CHANGELOG.md generated vendored Normal file
View File

@@ -0,0 +1,452 @@
# Changelog
## [5.1.1] - 2019-11-29
### Fixed
- Pass options to `abstract-leveldown` store ([#96](https://github.com/Level/packager/issues/96)) ([**@achingbrain**](https://github.com/achingbrain)). In addition to passing options to the `levelup` wrapper.
## [5.1.0] - 2019-10-13
### Added
- Support constructing without location ([#95](https://github.com/Level/packager/issues/95)) ([**@vweevers**](https://github.com/vweevers))
### Fixed
- Bump `levelup` and `encoding-down` to prevent dedupe ([`cd22e66`](https://github.com/Level/packager/commit/cd22e66)) ([**@vweevers**](https://github.com/vweevers))
## [5.0.3] - 2019-09-08
### Changed
- Upgrade `hallmark` devDependency from `^0.1.0` to `^2.0.0` ([#90](https://github.com/Level/packager/issues/90), [#93](https://github.com/Level/packager/issues/93)) ([**@vweevers**](https://github.com/vweevers))
- Upgrade `standard` devDependency from `^12.0.0` to `^14.0.0` ([#89](https://github.com/Level/packager/issues/89), [#92](https://github.com/Level/packager/issues/92)) ([**@vweevers**](https://github.com/vweevers))
### Fixed
- Bump `levelup` and `encoding-down` to prevent dedupe ([`a293d30`](https://github.com/Level/packager/commit/a293d30)) ([**@vweevers**](https://github.com/vweevers))
## [5.0.2] - 2019-06-08
### Changed
- Upgrade `nyc` devDependency from `^13.2.0` to `^14.0.0` ([#85](https://github.com/Level/packager/issues/85)) ([**@vweevers**](https://github.com/vweevers))
### Added
- Add `.npmignore` ([`85b9a84`](https://github.com/Level/packager/commit/85b9a84)) ([**@vweevers**](https://github.com/vweevers))
### Fixed
- Support variadic arguments in `destroy()` and `repair()` ([#88](https://github.com/Level/packager/issues/88)) ([**@vweevers**](https://github.com/vweevers))
- Don't assume existence of a `LOG` file in abstract `destroy-test` ([#87](https://github.com/Level/packager/issues/87)) ([**@vweevers**](https://github.com/vweevers))
- Fix Level badge ([`2429718`](https://github.com/Level/packager/commit/2429718)) ([**@vweevers**](https://github.com/vweevers))
- Remove link to dead website ([`d671d63`](https://github.com/Level/packager/commit/d671d63)) ([**@vweevers**](https://github.com/vweevers))
## [5.0.1] - 2019-03-31
### Changed
- Update `nyc` devDependency from `^12.0.2` to `^13.2.0` ([#84](https://github.com/Level/packager/issues/84)) ([**@vweevers**](https://github.com/vweevers))
- Apply common project tweaks ([#82](https://github.com/Level/packager/issues/82), [#83](https://github.com/Level/packager/issues/83)) ([**@vweevers**](https://github.com/vweevers))
## [5.0.0] - 2018-12-27
### Changed
- Upgrade `encoding-down` from `~5.0.0` to `^6.0.0` ([#80](https://github.com/Level/packager/issues/80), [#81](https://github.com/Level/packager/issues/81)) ([**@vweevers**](https://github.com/vweevers))
- Upgrade `levelup` from `^3.0.0` to `^4.0.0` ([#79](https://github.com/Level/packager/issues/79)) ([**@ralphtheninja**](https://github.com/ralphtheninja))
- Upgrade `standard` devDependency from `^11.0.0` to `^12.0.0` ([#74](https://github.com/Level/packager/issues/74)) ([**@ralphtheninja**](https://github.com/ralphtheninja))
- Replace `remark-cli` devDependency with `hallmark` ([#81](https://github.com/Level/packager/issues/81)) ([**@vweevers**](https://github.com/vweevers))
### Added
- Add nyc and coveralls ([#73](https://github.com/Level/packager/issues/73)) ([**@ralphtheninja**](https://github.com/ralphtheninja))
### Removed
- Remove node 9 ([`29fdaf4`](https://github.com/Level/packager/commit/29fdaf4)) ([**@ralphtheninja**](https://github.com/ralphtheninja))
## [4.0.1] - 2018-06-23
### Changed
- Use `var` instead of `let` ([**@ralphtheninja**](https://github.com/ralphtheninja))
### Added
- Add `remark` tooling ([**@ralphtheninja**](https://github.com/ralphtheninja))
- Add `'use strict'` to all abstract tests ([**@ralphtheninja**](https://github.com/ralphtheninja))
### Removed
- Remove `contributors` from `package.json` ([**@ralphtheninja**](https://github.com/ralphtheninja))
## [4.0.0] - 2018-06-13
### Changed
- Rewrite `test.js` to test `level-packager` api ([**@ralphtheninja**](https://github.com/ralphtheninja))
## [3.1.0] - 2018-05-28
### Changed
- Split up tests into `abstract/*-test.js` ([**@ralphtheninja**](https://github.com/ralphtheninja))
### Removed
- Remove `.jshintrc` ([**@ralphtheninja**](https://github.com/ralphtheninja))
## [3.0.0] - 2018-05-23
### Added
- Add node 10 to Travis ([**@ralphtheninja**](https://github.com/ralphtheninja))
- Add `UPGRADING.md` ([**@ralphtheninja**](https://github.com/ralphtheninja))
### Changed
- Update `standard` to `^11.0.0` ([**@ralphtheninja**](https://github.com/ralphtheninja))
- Update `encoding-down` to `~5.0.0` ([**@ralphtheninja**](https://github.com/ralphtheninja))
- Update `leveldown` to `^4.0.0` ([**@ralphtheninja**](https://github.com/ralphtheninja))
- Update `levelup` to `^3.0.0` ([**@ralphtheninja**](https://github.com/ralphtheninja))
- Change `License & Copyright` to `License` in README ([**@ralphtheninja**](https://github.com/ralphtheninja))
- Replace `const` with `var` for IE10 support ([**@ralphtheninja**](https://github.com/ralphtheninja))
### Removed
- Remove node 4 from Travis ([**@ralphtheninja**](https://github.com/ralphtheninja))
## [2.1.1] - 2018-02-13
### Added
- Travis: add 9 ([**@ralphtheninja**](https://github.com/ralphtheninja))
### Changed
- Update `encoding-down` to `~4.0.0` ([**@ralphtheninja**](https://github.com/ralphtheninja))
- Update `leveldown` to `^3.0.0` ([**@ralphtheninja**](https://github.com/ralphtheninja))
- Update copyright year to 2018 ([**@ralphtheninja**](https://github.com/ralphtheninja))
### Fixed
- Test: clean up `level-test-*` dbs after tests are done ([**@ralphtheninja**](https://github.com/ralphtheninja))
## [2.1.0] - 2017-12-13
### Added
- Add `standard` for linting ([**@ralphtheninja**](https://github.com/ralphtheninja))
### Changed
- Attach `.errors` from `levelup` to `Level` constructor ([**@ralphtheninja**](https://github.com/ralphtheninja))
## [2.0.2] - 2017-11-11
### Changed
- Update `encoding-down` to `~3.0.0` ([**@vweevers**](https://github.com/vweevers))
- README: update node badge ([**@vweevers**](https://github.com/vweevers))
### Fixed
- Travis: restore node 4 ([**@vweevers**](https://github.com/vweevers))
## [2.0.1] - 2017-10-12
### Added
- Test that encoding options default to utf8 ([**@ralphtheninja**](https://github.com/ralphtheninja))
- Test that `.keyEncoding` and `.valueEncoding` are passed to `encoding-down` ([**@ralphtheninja**](https://github.com/ralphtheninja))
### Fixed
- Fix encoding options to `encoding-down` ([**@ralphtheninja**](https://github.com/ralphtheninja))
## [2.0.0] - 2017-10-11
### Added
- README: add `level` badge ([**@ralphtheninja**](https://github.com/ralphtheninja))
### Changed
- Update `levelup` to `^2.0.0` ([**@ralphtheninja**](https://github.com/ralphtheninja))
- Update `encoding-down` to `~2.3.0` ([**@ralphtheninja**](https://github.com/ralphtheninja))
- Update `leveldown` to `^2.0.0` ([**@ralphtheninja**](https://github.com/ralphtheninja))
- README: update npm badges to similar badge style ([**@ralphtheninja**](https://github.com/ralphtheninja))
### Removed
- README: Remove Greenkeeper badge ([**@ralphtheninja**](https://github.com/ralphtheninja))
## [2.0.0-rc3] - 2017-09-16
### Changed
- Update `levelup` to `2.0.0-rc3` ([**@ralphtheninja**](https://github.com/ralphtheninja))
- Update `leveldown` to `^1.8.0` ([**@ralphtheninja**](https://github.com/ralphtheninja))
## [2.0.0-rc2] - 2017-09-12
### Changed
- Update `levelup` to `2.0.0-rc2` ([**@ralphtheninja**](https://github.com/ralphtheninja))
- Update `encoding-down` to `~2.2.0` ([**@ralphtheninja**](https://github.com/ralphtheninja))
## [2.0.0-rc1] - 2017-09-04
### Added
- Travis: add 8 ([**@ralphtheninja**](https://github.com/ralphtheninja))
- README: add Greenkeeper badge ([**@ralphtheninja**](https://github.com/ralphtheninja))
- README: add node badge ([**@ralphtheninja**](https://github.com/ralphtheninja))
### Changed
- README: steer away from `LevelDOWN` to `abstract-leveldown` ([**@ralphtheninja**](https://github.com/ralphtheninja))
- Update copyright year to 2017 ([**@ralphtheninja**](https://github.com/ralphtheninja))
### Removed
- Travis: remove 0.12, 4, 5 and 7 ([**@ralphtheninja**](https://github.com/ralphtheninja))
### Fixed
## [1.2.1] - 2016-12-27
### Added
- Travis: add 6 and 7 ([**@ralphtheninja**](https://github.com/ralphtheninja))
### Changed
- Travis: use gcc 4.8 ([**@ralphtheninja**](https://github.com/ralphtheninja))
### Removed
- Travis: remove 0.10, 1.0, 1.8, 2 and 3 ([**@ralphtheninja**](https://github.com/ralphtheninja))
## [1.2.0] - 2015-11-27
### Added
- Add dependency badge ([**@ralphtheninja**](https://github.com/ralphtheninja))
- Travis: add 1.0, 2, 3, 4 and 5 ([**@ralphtheninja**](https://github.com/ralphtheninja))
### Changed
- Update `levelup` to `~1.3.0` ([**@ralphtheninja**](https://github.com/ralphtheninja))
- Update `leveldown` to `^1.4.2` ([**@ralphtheninja**](https://github.com/ralphtheninja))
## [1.1.0] - 2015-06-09
### Changed
- Update `levelup` to `~1.2.0` ([**@mcollina**](https://github.com/mcollina))
- Update `leveldown` to `~1.2.2` ([**@mcollina**](https://github.com/mcollina))
## [1.0.0] - 2015-05-19
### Changed
- README: add link to `level/community` repo ([**@ralphtheninja**](https://github.com/ralphtheninja))
## [1.0.0-0] - 2015-05-16
### Added
- Add Travis ([**@ralphtheninja**](https://github.com/ralphtheninja))
- Add `leveldown` dev dependency ([**@ralphtheninja**](https://github.com/ralphtheninja))
### Changed
- Update `levelup` to `~1.0.0` ([**@ralphtheninja**](https://github.com/ralphtheninja))
- Run tests using `packager(leveldown)` ([**@ralphtheninja**](https://github.com/ralphtheninja))
### Removed
- Remove `level` dependency ([**@ralphtheninja**](https://github.com/ralphtheninja))
## [0.19.7] - 2015-05-10
### Added
- Add `level-test-*` to `.gitignore` ([**@juliangruber**](https://github.com/juliangruber))
### Changed
- Run the tests if they are not required ([**@juliangruber**](https://github.com/juliangruber))
- Rename the repository to `packager` ([**@juliangruber**](https://github.com/juliangruber))
## [0.19.6] - 2015-05-10
### Fixed
- Fix incorrect options logic ([**@juliangruber**](https://github.com/juliangruber))
## [0.19.5] - 2015-05-10
### Fixed
- Fixed bug with missing opening curly brace ([**@juliangruber**](https://github.com/juliangruber))
## [0.19.4] - 2015-05-10
### Changed
- Use `typeof` instead of `util.isFunction()` ([**@juliangruber**](https://github.com/juliangruber))
## [0.19.3] - 2015-05-10
### Fixed
- Fix missing closing parenthesis ([**@juliangruber**](https://github.com/juliangruber))
## [0.19.2] - 2015-05-10
### Fixed
- Fix missing closing parenthesis ([**@ralphtheninja**](https://github.com/ralphtheninja))
## [0.19.1] - 2015-05-10
### Fixed
- `null` options should not be treated as object ([**@deian**](https://github.com/deian))
## [0.19.0] - 2015-05-04
### Changed
- Plain MIT license ([**@andrewrk**](https://github.com/andrewrk))
- README: update logo and copyright year ([**@ralphtheninja**](https://github.com/ralphtheninja))
- Update `levelup` to `~0.19.0` ([**@ralphtheninja**](https://github.com/ralphtheninja))
## [0.18.0] - 2013-11-18
### Changed
- Bumped version ([**@rvagg**](https://github.com/rvagg))
## [0.17.0] - 2013-10-09
:seedling: Initial release.
**Historical Note** This changelog is ordered by semver-version, but the first few releases here did not use semver-valid tags.
## [0.17.0-5] - 2013-10-12
### Changed
- Clean up debugging noise ([**@rvagg**](https://github.com/rvagg))
## [0.17.0-4] - 2013-10-12
### Removed
- Remove `copy()` ([**@rvagg**](https://github.com/rvagg))
### Fixed
- Fix `repair()` and `destroy()` ([**@rvagg**](https://github.com/rvagg))
## [0.17.0-3] - 2013-10-12
### Fixed
- Made tests compatible with node 0.8 ([**@rvagg**](https://github.com/rvagg))
## [0.17.0-2] - 2013-10-12
### Added
- Add options to exported tests to handle memdown ([**@rvagg**](https://github.com/rvagg))
### Changed
- README: `level` -> `level-packager` ([**@rvagg**](https://github.com/rvagg))
## 0.17.0-1 - 2013-10-09
### Removed
- Remove `tape` from devDependencies, allow callers to pass in custom test function ([**@rvagg**](https://github.com/rvagg))
[5.1.1]: https://github.com/Level/packager/compare/v5.1.0...v5.1.1
[5.1.0]: https://github.com/Level/packager/compare/v5.0.3...v5.1.0
[5.0.3]: https://github.com/Level/packager/compare/v5.0.2...v5.0.3
[5.0.2]: https://github.com/Level/packager/compare/v5.0.1...v5.0.2
[5.0.1]: https://github.com/Level/packager/compare/v5.0.0...v5.0.1
[5.0.0]: https://github.com/Level/packager/compare/v4.0.1...v5.0.0
[4.0.1]: https://github.com/Level/packager/compare/v4.0.0...v4.0.1
[4.0.0]: https://github.com/Level/packager/compare/v3.1.0...v4.0.0
[3.1.0]: https://github.com/Level/packager/compare/v3.0.0...v3.1.0
[3.0.0]: https://github.com/Level/packager/compare/v2.1.1...v3.0.0
[2.1.1]: https://github.com/Level/packager/compare/v2.1.0...v2.1.1
[2.1.0]: https://github.com/Level/packager/compare/v2.0.2...v2.1.0
[2.0.2]: https://github.com/Level/packager/compare/v2.0.1...v2.0.2
[2.0.1]: https://github.com/Level/packager/compare/v2.0.0...v2.0.1
[2.0.0]: https://github.com/Level/packager/compare/v2.0.0-rc3...v2.0.0
[2.0.0-rc3]: https://github.com/Level/packager/compare/v2.0.0-rc2...v2.0.0-rc3
[2.0.0-rc2]: https://github.com/Level/packager/compare/v2.0.0-rc1...v2.0.0-rc2
[2.0.0-rc1]: https://github.com/Level/packager/compare/v1.2.1...v2.0.0-rc1
[1.2.1]: https://github.com/Level/packager/compare/v1.2.0...v1.2.1
[1.2.0]: https://github.com/Level/packager/compare/v1.1.0...v1.2.0
[1.1.0]: https://github.com/Level/packager/compare/v1.0.0...v1.1.0
[1.0.0]: https://github.com/Level/packager/compare/v1.0.0-0...v1.0.0
[1.0.0-0]: https://github.com/Level/packager/compare/v0.19.7...v1.0.0-0
[0.19.7]: https://github.com/Level/packager/compare/v0.19.6...v0.19.7
[0.19.6]: https://github.com/Level/packager/compare/v0.19.5...v0.19.6
[0.19.5]: https://github.com/Level/packager/compare/v0.19.4...v0.19.5
[0.19.4]: https://github.com/Level/packager/compare/v0.19.3...v0.19.4
[0.19.3]: https://github.com/Level/packager/compare/v0.19.2...v0.19.3
[0.19.2]: https://github.com/Level/packager/compare/v0.19.1...v0.19.2
[0.19.1]: https://github.com/Level/packager/compare/v0.19.0...v0.19.1
[0.19.0]: https://github.com/Level/packager/compare/0.18.0...v0.19.0
[0.18.0]: https://github.com/Level/packager/compare/0.17.0...0.18.0
[0.17.0]: https://github.com/Level/packager/compare/0.17.0-5...0.17.0
[0.17.0-5]: https://github.com/Level/packager/compare/0.17.0-4...0.17.0-5
[0.17.0-4]: https://github.com/Level/packager/compare/0.17.0-3...0.17.0-4
[0.17.0-3]: https://github.com/Level/packager/compare/0.17.0-2...0.17.0-3
[0.17.0-2]: https://github.com/Level/packager/compare/0.17.0-1...0.17.0-2

12
node_modules/level-packager/CONTRIBUTORS.md generated vendored Normal file
View File

@@ -0,0 +1,12 @@
# Contributors
| Name | GitHub | Social |
| :------------------- | :----------------------------------------------------- | :-------------------------------------------------------------- |
| **Lars-Magnus Skog** | [**@ralphtheninja**](https://github.com/ralphtheninja) | [**@ralph@social.weho.st**](https://social.weho.st/@ralph) |
| **Vincent Weevers** | [**@vweevers**](https://github.com/vweevers) | [**@vweevers@twitter**](https://twitter.com/vweevers) |
| **Julian Gruber** | [**@juliangruber**](https://github.com/juliangruber) | [**@juliangruber@twitter**](https://twitter.com/juliangruber) |
| **Rod Vagg** | [**@rvagg**](https://github.com/rvagg) | [**@rvagg@twitter**](https://twitter.com/rvagg) |
| **Alex Potsides** | | |
| **Andrew Kelley** | [**@andrewrk**](https://github.com/andrewrk) | |
| **Deian Stefan** | [**@deian**](https://github.com/deian) | |
| **Matteo Collina** | [**@mcollina**](https://github.com/mcollina) | [**@matteocollina@twitter**](https://twitter.com/matteocollina) |

21
node_modules/level-packager/LICENSE.md generated vendored Normal file
View File

@@ -0,0 +1,21 @@
# The MIT License (MIT)
**Copyright © 2013-present [Contributors](CONTRIBUTORS.md).**
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

56
node_modules/level-packager/README.md generated vendored Normal file
View File

@@ -0,0 +1,56 @@
# level-packager
> `levelup` package helper for distributing with an `abstract-leveldown` compatible back-end
[![level badge][level-badge]](https://github.com/Level/awesome)
[![npm](https://img.shields.io/npm/v/level-packager.svg?label=&logo=npm)](https://www.npmjs.com/package/level-packager)
[![Node version](https://img.shields.io/node/v/level-packager.svg)](https://www.npmjs.com/package/level-packager)
[![Travis](https://img.shields.io/travis/com/Level/packager.svg?logo=travis&label=)](https://travis-ci.com/Level/packager)
[![Coverage Status](https://coveralls.io/repos/github/Level/packager/badge.svg)](https://coveralls.io/github/Level/packager)
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
[![npm](https://img.shields.io/npm/dm/level-packager.svg?label=dl)](https://www.npmjs.com/package/level-packager)
[![Backers on Open Collective](https://opencollective.com/level/backers/badge.svg?color=orange)](#backers)
[![Sponsors on Open Collective](https://opencollective.com/level/sponsors/badge.svg?color=orange)](#sponsors)
## API
Exports a single function which takes a single argument, an `abstract-leveldown` compatible storage back-end for [`levelup`](https://github.com/Level/levelup). The function returns a constructor function that will bundle `levelup` with the given `abstract-leveldown` replacement. The full API is supported, including optional functions, `destroy()`, and `repair()`. Encoding functionality is provided by [`encoding-down`](https://github.com/Level/encoding-down).
The constructor function has a `.errors` property which provides access to the different error types from [`level-errors`](https://github.com/Level/errors#api).
For example use-cases, see:
- [`level`](https://github.com/Level/level)
- [`level-mem`](https://github.com/Level/level-mem)
- [`level-hyper`](https://github.com/Level/level-hyper)
- [`level-lmdb`](https://github.com/Level/level-lmdb)
Also available is a _test.js_ file that can be used to verify that the user-package works as expected.
**If you are upgrading:** please see [`UPGRADING.md`](UPGRADING.md).
## Contributing
[`Level/packager`](https://github.com/Level/packager) is an **OPEN Open Source Project**. This means that:
> Individuals making significant and valuable contributions are given commit-access to the project to contribute as they see fit. This project is more like an open wiki than a standard guarded open source project.
See the [Contribution Guide](https://github.com/Level/community/blob/master/CONTRIBUTING.md) for more details.
## Donate
To sustain [`Level`](https://github.com/Level) and its activities, become a backer or sponsor on [Open Collective](https://opencollective.com/level). Your logo or avatar will be displayed on our 28+ [GitHub repositories](https://github.com/Level) and [npm](https://www.npmjs.com/) packages. 💖
### Backers
[![Open Collective backers](https://opencollective.com/level/backers.svg?width=890)](https://opencollective.com/level)
### Sponsors
[![Open Collective sponsors](https://opencollective.com/level/sponsors.svg?width=890)](https://opencollective.com/level)
## License
[MIT](LICENSE.md) © 2013-present [Contributors](CONTRIBUTORS.md).
[level-badge]: https://leveljs.org/img/badge.svg

15
node_modules/level-packager/UPGRADING.md generated vendored Normal file
View File

@@ -0,0 +1,15 @@
# Upgrade Guide
This document describes breaking changes and how to upgrade. For a complete list of changes including minor and patch releases, please refer to the [changelog](CHANGELOG.md).
## v5
Upgraded to [`levelup@4`](https://github.com/Level/levelup/blob/v4.0.0/UPGRADING.md#v4) and [`encoding-down@6`](https://github.com/Level/encoding-down/blob/v6.0.0/UPGRADING.md#v6). We recommend to pair `level-packager@5` only with a store based on `abstract-leveldown` >= 6. Please follow the earlier links for more information.
## v4
The `test.js` file was rewritten to test the `level-packager` api and is no longer part of the api. Implementations based on `level-packager` should instead use the tests in the `abstract/` folder.
## v3
Dropped support for node 4. No other breaking changes.

53
node_modules/level-packager/abstract/base-test.js generated vendored Normal file
View File

@@ -0,0 +1,53 @@
'use strict'
var location = require('./location')
module.exports = function (test, level) {
test('test db open and use, level(location, cb)', function (t) {
level(location, function (err, db) {
t.notOk(err, 'no error')
db.put('test1', 'success', function (err) {
t.notOk(err, 'no error')
db.close(t.end.bind(t))
})
})
})
test('test db open and use, level(location, options, cb)', function (t) {
level(location, { createIfMissing: false, errorIfExists: false }, function (err, db) {
t.notOk(err, 'no error')
db.put('test2', 'success', function (err) {
t.notOk(err, 'no error')
db.close(t.end.bind(t))
})
})
})
test('test db open and use, db=level(location)', function (t) {
var db = level(location)
db.put('test3', 'success', function (err) {
t.notOk(err, 'no error')
db.close(t.end.bind(t))
})
})
test('options.keyEncoding and options.valueEncoding are passed on to encoding-down', function (t) {
var db = level(location, { keyEncoding: 'json', valueEncoding: 'json' })
db.on('ready', function () {
var codec = db.db.codec
t.equal(codec.opts.keyEncoding, 'json', 'keyEncoding correct')
t.equal(codec.opts.valueEncoding, 'json', 'valueEncoding correct')
db.close(t.end.bind(t))
})
})
test('encoding options default to utf8', function (t) {
var db = level(location)
db.on('ready', function () {
var codec = db.db.codec
t.equal(codec.opts.keyEncoding, 'utf8', 'keyEncoding correct')
t.equal(codec.opts.valueEncoding, 'utf8', 'valueEncoding correct')
db.close(t.end.bind(t))
})
})
}

30
node_modules/level-packager/abstract/db-values-test.js generated vendored Normal file
View File

@@ -0,0 +1,30 @@
'use strict'
var location = require('./location')
module.exports = function (test, level, nonPersistent) {
test('test db values', function (t) {
var c = 0
var db = level(location)
var setup = nonPersistent ? function (callback) {
db.batch([
{ type: 'put', key: 'test1', value: 'success' },
{ type: 'put', key: 'test2', value: 'success' },
{ type: 'put', key: 'test3', value: 'success' }
], callback)
} : function (callback) { callback() }
function read (err, value) {
t.notOk(err, 'no error')
t.equal(value, 'success')
if (++c === 3) { db.close(t.end.bind(t)) }
}
setup(function (err) {
t.notOk(err, 'no error')
db.get('test1', read)
db.get('test2', read)
db.get('test3', read)
})
})
}

17
node_modules/level-packager/abstract/destroy-test.js generated vendored Normal file
View File

@@ -0,0 +1,17 @@
'use strict'
var fs = require('fs')
var path = require('path')
var location = require('./location')
module.exports = function (test, level) {
test('test destroy', function (t) {
t.plan(4)
t.ok(fs.statSync(location).isDirectory(), 'sanity check, directory exists')
t.ok(fs.existsSync(path.join(location, 'CURRENT')), 'sanity check, CURRENT exists')
level.destroy(location, function (err) {
t.notOk(err, 'no error')
t.notOk(fs.existsSync(path.join(location, 'CURRENT')), 'db gone (mostly)')
})
})
}

View File

@@ -0,0 +1,13 @@
'use strict'
var location = require('./location')
module.exports = function (test, level) {
test('test db open and use, level(location, options, cb) force error', function (t) {
level(location, { errorIfExists: true }, function (err, db) {
t.ok(err, 'got error opening existing db')
t.notOk(db, 'no db')
t.end()
})
})
}

3
node_modules/level-packager/abstract/location.js generated vendored Normal file
View File

@@ -0,0 +1,3 @@
var path = require('path')
module.exports = path.join(__dirname, 'level-test-' + process.pid + '.db')

12
node_modules/level-packager/abstract/repair-test.js generated vendored Normal file
View File

@@ -0,0 +1,12 @@
'use strict'
var location = require('./location')
module.exports = function (test, level) {
test('test repair', function (t) {
t.plan(1)
level.repair(location, function (err) {
t.notOk(err, 'no error')
})
})
}

20
node_modules/level-packager/abstract/test.js generated vendored Normal file
View File

@@ -0,0 +1,20 @@
'use strict'
module.exports = function (test, level, options) {
options = options || {}
require('./base-test')(test, level)
require('./db-values-test')(test, level, options.nonPersistent)
if (!options.skipErrorIfExistsTest) {
require('./error-if-exists-test')(test, level)
}
if (!options.skipRepairTest) {
require('./repair-test')(test, level)
}
if (!options.skipDestroyTest) {
require('./destroy-test')(test, level)
}
}

36
node_modules/level-packager/level-packager.js generated vendored Normal file
View File

@@ -0,0 +1,36 @@
var levelup = require('levelup')
var encode = require('encoding-down')
function packager (leveldown) {
function Level (location, options, callback) {
if (typeof location === 'function') {
callback = location
} else if (typeof options === 'function') {
callback = options
}
if (!isObject(options)) {
options = isObject(location) ? location : {}
}
return levelup(encode(leveldown(location, options), options), options, callback)
}
function isObject (o) {
return typeof o === 'object' && o !== null
}
['destroy', 'repair'].forEach(function (m) {
if (typeof leveldown[m] === 'function') {
Level[m] = function () {
leveldown[m].apply(leveldown, arguments)
}
}
})
Level.errors = levelup.errors
return Level
}
module.exports = packager

48
node_modules/level-packager/package.json generated vendored Normal file
View File

@@ -0,0 +1,48 @@
{
"name": "level-packager",
"version": "5.1.1",
"description": "LevelUP package helper for distributing with a LevelDOWN-compatible back-end",
"license": "MIT",
"main": "level-packager.js",
"scripts": {
"test": "standard && hallmark && nyc node test.js",
"coverage": "nyc report --reporter=text-lcov | coveralls",
"hallmark": "hallmark --fix",
"dependency-check": "dependency-check . test.js abstract/*.js",
"prepublishOnly": "npm run dependency-check"
},
"dependencies": {
"encoding-down": "^6.3.0",
"levelup": "^4.3.2"
},
"devDependencies": {
"coveralls": "^3.0.2",
"dependency-check": "^3.3.0",
"hallmark": "^2.0.0",
"level-community": "^3.0.0",
"nyc": "^14.0.0",
"standard": "^14.0.0",
"tape": "^4.0.0"
},
"hallmark": {
"community": "level-community"
},
"repository": {
"type": "git",
"url": "https://github.com/Level/packager.git"
},
"homepage": "https://github.com/Level/packager",
"keywords": [
"level",
"leveldb",
"stream",
"database",
"db",
"store",
"storage",
"json"
],
"engines": {
"node": ">=6"
}
}

204
node_modules/level-packager/test.js generated vendored Normal file
View File

@@ -0,0 +1,204 @@
'use strict'
var test = require('tape')
var packager = require('.')
test('Level constructor has access to levelup errors', function (t) {
function Down () {}
t.ok(packager(Down).errors, '.errors property set on constructor')
t.end()
})
test('Level constructor relays .destroy and .repair if they exist', function (t) {
t.plan(8)
test('destroy')
test('repair')
function test (method) {
function Down () {}
Down[method] = function () {
t.same([].slice.call(arguments), args, 'supports variadic arguments')
}
var level = packager(Down)
var args = []
for (var i = 0; i < 4; i++) {
args.push(i)
level[method].apply(level, args)
}
}
})
test('Level constructor', function (t) {
t.plan(3)
function Down () {
return {
open: function (opts, cb) {
t.same(opts, {
createIfMissing: true,
errorIfExists: false,
// This is a side effect of encoding-down (mutating options)
keyEncoding: 'utf8',
valueEncoding: 'utf8'
})
}
}
}
var levelup = packager(Down)()
t.is(levelup.options.keyEncoding, 'utf8')
t.is(levelup.options.valueEncoding, 'utf8')
})
test('Level constructor with location', function (t) {
t.plan(4)
function Down (location) {
t.is(location, 'location', 'location is correct')
return {
open: function (opts, cb) {
t.same(opts, {
createIfMissing: true,
errorIfExists: false,
keyEncoding: 'utf8',
valueEncoding: 'utf8'
})
}
}
}
var levelup = packager(Down)('location')
t.is(levelup.options.keyEncoding, 'utf8')
t.is(levelup.options.valueEncoding, 'utf8')
})
test('Level constructor with location & options', function (t) {
t.plan(2)
function Down (location, opts) {
t.is(location, 'location', 'location is correct')
t.same(opts, {
prefix: 'foo'
})
return {
open: function (opts, cb) {
cb()
}
}
}
packager(Down)('location', { prefix: 'foo' })
})
test('Level constructor with callback', function (t) {
t.plan(3)
function Down () {
return {
open: function (opts, cb) {
t.same(opts, {
createIfMissing: true,
errorIfExists: false,
keyEncoding: 'utf8',
valueEncoding: 'utf8'
})
process.nextTick(cb)
}
}
}
packager(Down)(function (err, db) {
t.error(err)
t.ok(db, 'db set in callback')
})
})
test('Level constructor with location & callback', function (t) {
t.plan(4)
function Down (location) {
t.is(location, 'location', 'location is correct')
return {
open: function (opts, cb) {
t.same(opts, {
createIfMissing: true,
errorIfExists: false,
keyEncoding: 'utf8',
valueEncoding: 'utf8'
})
process.nextTick(cb)
}
}
}
packager(Down)('location', function (err, db) {
t.error(err)
t.ok(db, 'db set in callback')
})
})
test('Level constructor with location & options passed to levelup', function (t) {
t.plan(4)
var Down = function (location) {
t.is(location, 'location', 'location is correct')
return {
open: function (opts, cb) {
t.same(opts, {
createIfMissing: true,
errorIfExists: false,
keyEncoding: 'binary',
valueEncoding: 'binary'
})
}
}
}
var levelup = packager(Down)('location', {
keyEncoding: 'binary',
valueEncoding: 'binary'
})
t.is(levelup.options.keyEncoding, 'binary')
t.is(levelup.options.valueEncoding, 'binary')
})
test('Level constructor with options passed to levelup', function (t) {
t.plan(3)
var Down = function () {
return {
open: function (opts, cb) {
t.same(opts, {
createIfMissing: true,
errorIfExists: false,
keyEncoding: 'binary',
valueEncoding: 'binary'
})
}
}
}
var levelup = packager(Down)({
keyEncoding: 'binary',
valueEncoding: 'binary'
})
t.is(levelup.options.keyEncoding, 'binary')
t.is(levelup.options.valueEncoding, 'binary')
})
test('Level constructor with options & callback passed to levelup', function (t) {
t.plan(5)
var Down = function () {
return {
open: function (opts, cb) {
t.same(opts, {
createIfMissing: true,
errorIfExists: false,
keyEncoding: 'binary',
valueEncoding: 'binary'
})
process.nextTick(cb)
}
}
}
var levelup = packager(Down)({
keyEncoding: 'binary',
valueEncoding: 'binary'
}, function (err, db) {
t.error(err)
t.ok(db, 'db set in callback')
})
t.is(levelup.options.keyEncoding, 'binary')
t.is(levelup.options.valueEncoding, 'binary')
})