Initial import with skill sheet working
This commit is contained in:
95
node_modules/level-supports/CHANGELOG.md
generated
vendored
Normal file
95
node_modules/level-supports/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,95 @@
|
||||
# Changelog
|
||||
|
||||
## [4.0.1] - 2022-03-06
|
||||
|
||||
### Fixed
|
||||
|
||||
- Update support matrix ([`c30998f`](https://github.com/Level/supports/commit/c30998f)) (Vincent Weevers)
|
||||
- Align LICENSE with SPDX ([`1bb9f9c`](https://github.com/Level/supports/commit/1bb9f9c)) (Vincent Weevers)
|
||||
|
||||
## [4.0.0] - 2022-01-02
|
||||
|
||||
### Removed
|
||||
|
||||
- **Breaking:** drop Node.js 10 ([`ad1c533`](https://github.com/Level/supports/commit/ad1c533)) (Vincent Weevers)
|
||||
- Remove unused properties ([`c894eba`](https://github.com/Level/supports/commit/c894eba)) (Vincent Weevers).
|
||||
|
||||
### Fixed
|
||||
|
||||
- Align docs with `abstract-level` ([`c894eba`](https://github.com/Level/supports/commit/c894eba)) (Vincent Weevers).
|
||||
|
||||
## [3.0.0] - 2021-11-07
|
||||
|
||||
_No longer compatible with `abstract-leveldown`, `levelup` or their dependents._
|
||||
|
||||
### Changed
|
||||
|
||||
- **Breaking:** change `encodings` and `events` to always be objects ([`eb819a6`](https://github.com/Level/supports/commit/eb819a6)) (Vincent Weevers)
|
||||
- **Breaking:** replace default export with named export ([`7e9e467`](https://github.com/Level/supports/commit/7e9e467)) (Vincent Weevers)
|
||||
|
||||
### Added
|
||||
|
||||
- Add typings ([`3df48fc`](https://github.com/Level/supports/commit/3df48fc)) (Vincent Weevers).
|
||||
|
||||
## [2.1.0] - 2021-10-27
|
||||
|
||||
### Changed
|
||||
|
||||
- Allow `manifest.encodings` to be an object ([`284e0db`](https://github.com/Level/supports/commit/284e0db)) (Vincent Weevers)
|
||||
|
||||
## [2.0.2] - 2021-10-09
|
||||
|
||||
### Added
|
||||
|
||||
- Add `idempotentOpen` and `passiveOpen` features ([`fc3f1e0`](https://github.com/Level/supports/commit/fc3f1e0)) (Vincent Weevers)
|
||||
- Add `events` feature ([`22a3837`](https://github.com/Level/supports/commit/22a3837)) (Vincent Weevers)
|
||||
- Document that `encodings` implies utf8 default ([`d1b6d89`](https://github.com/Level/supports/commit/d1b6d89)) (Vincent Weevers)
|
||||
- Document `status` values ([`0837a16`](https://github.com/Level/supports/commit/0837a16)) (Vincent Weevers)
|
||||
|
||||
### Fixed
|
||||
|
||||
- Update support matrices ([`eb92d8b`](https://github.com/Level/supports/commit/eb92d8b), [`ef14920`](https://github.com/Level/supports/commit/ef14920), [`0681a1e`](https://github.com/Level/supports/commit/0681a1e), [`ca2a0e6`](https://github.com/Level/supports/commit/ca2a0e6)) (Vincent Weevers)
|
||||
|
||||
## [2.0.1] - 2021-09-24
|
||||
|
||||
### Added
|
||||
|
||||
- Add features: `getMany`, `keyIterator`, `valueIterator`, `iteratorNextv`, `iteratorAll` ([#11](https://github.com/Level/supports/issues/11)) ([`b44a410`](https://github.com/Level/supports/commit/b44a410)) (Vincent Weevers)
|
||||
|
||||
## [2.0.0] - 2021-04-09
|
||||
|
||||
### Changed
|
||||
|
||||
- **Breaking:** modernize syntax and bump standard ([`5d7cc6d`](https://github.com/Level/supports/commit/5d7cc6d)) ([Level/community#98](https://github.com/Level/community/issues/98)) (Vincent Weevers). Drops support of node 6, node 8 and old browsers.
|
||||
|
||||
## [1.0.1] - 2019-10-13
|
||||
|
||||
### Added
|
||||
|
||||
- Document format of `additionalMethods` ([`192bc9e`](https://github.com/Level/supports/commit/192bc9e)) ([**@vweevers**](https://github.com/vweevers))
|
||||
|
||||
### Fixed
|
||||
|
||||
- Clone `additionalMethods` to prevent mutation ([#4](https://github.com/Level/supports/issues/4)) ([**@vweevers**](https://github.com/vweevers))
|
||||
|
||||
## [1.0.0] - 2019-09-22
|
||||
|
||||
:seedling: Initial release.
|
||||
|
||||
[4.0.1]: https://github.com/Level/supports/releases/tag/v4.0.1
|
||||
|
||||
[4.0.0]: https://github.com/Level/supports/releases/tag/v4.0.0
|
||||
|
||||
[3.0.0]: https://github.com/Level/supports/releases/tag/v3.0.0
|
||||
|
||||
[2.1.0]: https://github.com/Level/supports/releases/tag/v2.1.0
|
||||
|
||||
[2.0.2]: https://github.com/Level/supports/releases/tag/v2.0.2
|
||||
|
||||
[2.0.1]: https://github.com/Level/supports/releases/tag/v2.0.1
|
||||
|
||||
[2.0.0]: https://github.com/Level/supports/releases/tag/v2.0.0
|
||||
|
||||
[1.0.1]: https://github.com/Level/supports/releases/tag/v1.0.1
|
||||
|
||||
[1.0.0]: https://github.com/Level/supports/releases/tag/v1.0.0
|
21
node_modules/level-supports/LICENSE
generated
vendored
Normal file
21
node_modules/level-supports/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2019 The contributors to level-supports.
|
||||
|
||||
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.
|
405
node_modules/level-supports/README.md
generated
vendored
Normal file
405
node_modules/level-supports/README.md
generated
vendored
Normal file
@@ -0,0 +1,405 @@
|
||||
# level-supports
|
||||
|
||||
**Create a manifest describing the abilities of an [`abstract-level`](https://github.com/Level/abstract-level) database.** No longer compatible with [`levelup`](https://github.com/Level/levelup) or [`abstract-leveldown`](https://github.com/Level/abstract-leveldown) since version 3.0.0.
|
||||
|
||||
[![level badge][level-badge]](https://github.com/Level/awesome)
|
||||
[](https://www.npmjs.com/package/level-supports)
|
||||
[](https://www.npmjs.com/package/level-supports)
|
||||
[](https://github.com/Level/supports/actions/workflows/test.yml)
|
||||
[](https://codecov.io/gh/Level/supports)
|
||||
[](https://standardjs.com)
|
||||
[](https://common-changelog.org)
|
||||
[](https://opencollective.com/level)
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const { supports } = require('level-supports')
|
||||
|
||||
db.supports = supports({
|
||||
permanence: false,
|
||||
encodings: {
|
||||
utf8: true
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
Receivers of the db can then use it like so:
|
||||
|
||||
```js
|
||||
if (!db.supports.permanence) {
|
||||
throw new Error('Persistent storage is required')
|
||||
}
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### `manifest = supports([manifest, ..])`
|
||||
|
||||
Given zero or more manifest objects, returns a merged and enriched manifest object that has truthy properties for each of the features listed below.
|
||||
|
||||
For future extensibility, the properties are truthy rather than strictly typed booleans. Falsy or absent properties are converted to `false`, other values are allowed:
|
||||
|
||||
```js
|
||||
supports().snapshots // false
|
||||
supports({ snapshots: true }).snapshots // true
|
||||
supports({ snapshots: {} }).snapshots // {}
|
||||
supports({ snapshots: 1 }, { snapshots: 2 }).snapshots // 2
|
||||
```
|
||||
|
||||
For consumers of the manifest this means they should check support like so:
|
||||
|
||||
```js
|
||||
if (db.supports.snapshots)
|
||||
```
|
||||
|
||||
Rather than:
|
||||
|
||||
```js
|
||||
if (db.supports.snapshots === true)
|
||||
```
|
||||
|
||||
**Note:** the manifest describes high-level features that typically encompass multiple methods of a db. It is currently not a goal to describe a full API, or versions of it.
|
||||
|
||||
## Features
|
||||
|
||||
### `snapshots` (boolean)
|
||||
|
||||
Does the database have snapshot guarantees? Meaning that reads are unaffected by simultaneous writes. For example, an iterator should read from a snapshot of the database, created at the time `db.iterator()` was called. This means the iterator will not see the data of simultaneous write operations.
|
||||
|
||||
Must be `false` if any of the following is true:
|
||||
|
||||
- Reads don't operate on a snapshot
|
||||
- Snapshots are created asynchronously.
|
||||
|
||||
<details>
|
||||
<summary>Support matrix</summary>
|
||||
|
||||
| Module | Snapshot guarantee |
|
||||
| :------------------- | :-------------------------- |
|
||||
| `classic-level` | ✅ |
|
||||
| `memory-level` | ✅ |
|
||||
| `browser-level` | ❌ |
|
||||
| `rocks-level` | ✅ |
|
||||
| `leveldown` | ✅ |
|
||||
| `rocksdb` | ✅ |
|
||||
| `memdown` | ✅ |
|
||||
| `level-js` | ✅ (by buffering) |
|
||||
| `encoding-down` | ✅ |
|
||||
| `deferred-leveldown` | ✅ |
|
||||
| `levelup` | ✅ |
|
||||
| `level-packager` | ✅ |
|
||||
| `level` | ✅ |
|
||||
| `level-mem` | ✅ |
|
||||
| `level-rocksdb` | ✅ |
|
||||
| `subleveldown` | ✅ |
|
||||
| `multileveldown` | ✅ (unless `retry` is true) |
|
||||
| `level-party` | ❌ (unless `retry` is false) |
|
||||
|
||||
</details>
|
||||
|
||||
### `permanence` (boolean)
|
||||
|
||||
Does data survive after process (or environment) exit? Typically true. False for [`memory-level`](https://github.com/Level/memory-level) and [`memdown`](https://github.com/Level/memdown).
|
||||
|
||||
### `seek` (boolean)
|
||||
|
||||
Do iterators support [`seek(..)`](https://github.com/Level/abstract-level/#iteratorseektarget-options)?
|
||||
|
||||
<details>
|
||||
<summary>Support matrix</summary>
|
||||
|
||||
| Module | Support |
|
||||
| :------------------- | :------ |
|
||||
| `abstract-level` | ✅ 1.0.0 |
|
||||
| `classic-level` | ✅ 1.0.0 |
|
||||
| `memory-level` | ✅ 1.0.0 |
|
||||
| `browser-level` | ✅ 1.0.0 |
|
||||
| `rocks-level` | ✅ 1.0.0 |
|
||||
| `abstract-leveldown` | ✅ 6.0.0 |
|
||||
| `leveldown` | ✅ 1.2.0 |
|
||||
| `rocksdb` | ✅ 1.0.0 |
|
||||
| `memdown` | ✅ 4.1.0 |
|
||||
| `level-js` | ❌ |
|
||||
| `encoding-down` | ✅ 6.1.0 |
|
||||
| `deferred-leveldown` | ✅ 5.1.0 |
|
||||
| `levelup` | ✅ n/a |
|
||||
| `level-packager` | ✅ n/a |
|
||||
| `level` | ✅ 8.0.0 |
|
||||
| `level-mem` | ✅ 4.0.0 |
|
||||
| `level-rocksdb` | ✅ 1.0.0 |
|
||||
| `subleveldown` | ✅ 4.1.0 |
|
||||
| `multileveldown` | ❌ |
|
||||
| `level-party` | ❌ |
|
||||
|
||||
</details>
|
||||
|
||||
#### `clear` (boolean)
|
||||
|
||||
Does the database support `db.clear()`? Always true since `abstract-level@1`.
|
||||
|
||||
<details>
|
||||
<summary>Support matrix</summary>
|
||||
|
||||
See also [Level/community#79](https://github.com/Level/community/issues/79).
|
||||
|
||||
| Module | Support | Optimized |
|
||||
| :------------------------------ | :------ | :-------- |
|
||||
| `abstract-level` and dependents | ✅ 1.0.0 | ✅ 1.0.0 |
|
||||
| `abstract-leveldown` | ✅ 6.1.0 | n/a |
|
||||
| `leveldown` | ✅ 5.2.0 | ✅ 6.0.3 |
|
||||
| `rocksdb` | ✅ 4.1.0 | ✅ 5.2.0 |
|
||||
| `memdown` | ✅ 5.0.0 | ✅ 6.1.1 |
|
||||
| `level-js` | ✅ 5.0.0 | ✅ 5.0.0 |
|
||||
| `encoding-down` | ✅ 6.2.0 | n/a |
|
||||
| `deferred-leveldown` | ✅ 5.2.0 | n/a |
|
||||
| `levelup` | ✅ 4.2.0 | n/a |
|
||||
| `level-packager` | ✅ 5.0.3 | n/a |
|
||||
| `level` | ✅ 6.0.0 | ✅ 7.0.1 |
|
||||
| `level-mem` | ✅ 5.0.1 | ✅ 6.0.1 |
|
||||
| `level-rocksdb` | ✅ 5.0.0 | ✅ 5.0.0 |
|
||||
| `subleveldown` | ✅ 4.2.1 | ✅ 4.2.1 |
|
||||
| `multileveldown` | ✅ 5.0.0 | ✅ 5.0.0 |
|
||||
| `level-party` | ✅ 5.1.0 | ✅ 5.1.0 |
|
||||
|
||||
</details>
|
||||
|
||||
### `status` (boolean)
|
||||
|
||||
Does the database have a [`status`](https://github.com/Level/abstract-level/#dbstatus) property? Always true since `abstract-level@1`.
|
||||
|
||||
### `deferredOpen` (boolean)
|
||||
|
||||
Can operations like `db.put()` be called without explicitly opening the db? Like so:
|
||||
|
||||
```js
|
||||
const db = new Level()
|
||||
await db.put('key', 'value')
|
||||
```
|
||||
|
||||
Always true since `abstract-level@1`.
|
||||
|
||||
### `createIfMissing`, `errorIfExists` (boolean)
|
||||
|
||||
Does `db.open()` support these options?
|
||||
|
||||
<details>
|
||||
<summary>Support matrix</summary>
|
||||
|
||||
| Module | Support |
|
||||
| :-------------- | :------ |
|
||||
| `classic-level` | ✅ |
|
||||
| `rocks-level` | ✅ |
|
||||
| `memory-level` | ❌ |
|
||||
| `browser-level` | ❌ |
|
||||
| `leveldown` | ✅ |
|
||||
| `rocksdb` | ✅ |
|
||||
| `memdown` | ❌ |
|
||||
| `level-js` | ❌ |
|
||||
|
||||
</details>
|
||||
|
||||
### `promises` (boolean)
|
||||
|
||||
Do all database methods (that don't otherwise have a return value) support promises, in addition to callbacks? Such that, when a callback argument is omitted, a promise is returned:
|
||||
|
||||
```js
|
||||
db.put('key', 'value', callback)
|
||||
await db.put('key', 'value')
|
||||
```
|
||||
|
||||
Always true since `abstract-level@1`.
|
||||
|
||||
<details>
|
||||
<summary>Support matrix</summary>
|
||||
|
||||
| Module | Support |
|
||||
| :---------------------------------- | :------------------- |
|
||||
| `abstract-level` and dependents | ✅ |
|
||||
| `abstract-leveldown` and dependents | ❌ (except iterators) |
|
||||
| `levelup` | ✅ |
|
||||
| `level-packager` | ✅ |
|
||||
| `level` | ✅ |
|
||||
| `level-mem` | ✅ |
|
||||
| `level-rocksdb` | ✅ |
|
||||
| `subleveldown` | ✅ |
|
||||
| `multileveldown` | ✅ |
|
||||
| `level-party` | ✅ |
|
||||
|
||||
</details>
|
||||
|
||||
### `events` (object)
|
||||
|
||||
Which events does the database emit, as indicated by nested properties? For example:
|
||||
|
||||
```js
|
||||
if (db.supports.events.put) {
|
||||
db.on('put', listener)
|
||||
}
|
||||
```
|
||||
|
||||
### `streams` (boolean)
|
||||
|
||||
Does database have the methods `createReadStream`, `createKeyStream` and `createValueStream`, following the API documented in `levelup`? For `abstract-level` databases, a standalone module called [`level-read-stream`](https://github.com/Level/read-stream) is available.
|
||||
|
||||
<details>
|
||||
<summary>Support matrix</summary>
|
||||
|
||||
| Module | Support |
|
||||
| :---------------------------------- | :------ |
|
||||
| `abstract-level` and dependents | ❌ |
|
||||
| `abstract-leveldown` and dependents | ❌ |
|
||||
| `levelup` | ✅ |
|
||||
| `level-packager` | ✅ |
|
||||
| `level` | ✅ |
|
||||
| `level-mem` | ✅ |
|
||||
| `level-rocksdb` | ✅ |
|
||||
| `subleveldown` | ✅ |
|
||||
| `multileveldown` | ✅ |
|
||||
| `level-party` | ✅ |
|
||||
|
||||
</details>
|
||||
|
||||
### `encodings` (object)
|
||||
|
||||
Which encodings (by name) does the database support, as indicated by nested properties? For example:
|
||||
|
||||
```js
|
||||
{ utf8: true, json: true }
|
||||
```
|
||||
|
||||
As the `encodings` property cannot be false (anymore, since `level-supports` v3.0.0) it implies that the database supports `keyEncoding` and `valueEncoding` options on all relevant methods, uses a default encoding of utf8 and that hence all of its read operations return strings rather than buffers by default.
|
||||
|
||||
<details>
|
||||
<summary>Support matrix (general support)</summary>
|
||||
|
||||
_This matrix just indicates general support of encodings as a feature, not that the listed modules support the `encodings` property exactly as described above, which only works on `abstract-level` databases._
|
||||
|
||||
| Module | Support |
|
||||
| :------------------------------------- | :------ |
|
||||
| `abstract-level` (and dependents) | ✅ |
|
||||
| `abstract-leveldown` (and dependents) | ❌ |
|
||||
| `encoding-down` | ✅ |
|
||||
| `levelup` | ✅ |
|
||||
| `level-packager` | ✅ |
|
||||
| `level` | ✅ |
|
||||
| `level-mem` | ✅ |
|
||||
| `level-rocksdb` | ✅ |
|
||||
| `subleveldown` | ✅ |
|
||||
| `multileveldown` | ✅ |
|
||||
| `level-party` | ✅ |
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>Support matrix (specific encodings)</summary>
|
||||
|
||||
_This matrix lists which encodings are supported as indicated by e.g. `db.supports.encodings.utf8`. Encodings that encode to another (like how `'json'` encodes to `'utf8'`) are excluded here, though they are present in `db.supports.encodings`._
|
||||
|
||||
| Module | `'utf8'` | `'buffer'` | `'view'` |
|
||||
| :-------------- | :------------ | :------------ | :------------ |
|
||||
| `classic-level` | ✅ | ✅ | ✅ <sup>1<sup> |
|
||||
| `memory-level` | ✅ <sup>2<sup> | ✅ <sup>2<sup> | ✅ <sup>2<sup> |
|
||||
| `browser-level` | ✅ <sup>1<sup> | ✅ <sup>1<sup> | ✅ |
|
||||
| `rocks-level` | ✅ | ✅ | ✅ <sup>1<sup> |
|
||||
| `level@8` | ✅ <sup>3<sup> | ✅ <sup>3<sup> | ✅ <sup>3<sup> |
|
||||
|
||||
<small>
|
||||
|
||||
1. Transcoded (which may have a performance impact).
|
||||
2. Can be controlled via `storeEncoding` option.
|
||||
3. Whether it's transcoded depends on environment (Node.js or browser).
|
||||
|
||||
</small>
|
||||
|
||||
</details>
|
||||
|
||||
### `getMany` (boolean)
|
||||
|
||||
Does the database support `db.getMany()`? Always true since `abstract-level@1`.
|
||||
|
||||
<details>
|
||||
<summary>Support matrix</summary>
|
||||
|
||||
| Module | Support |
|
||||
| :------------------------------ | :------ |
|
||||
| `abstract-level` and dependents | ✅ 1.0.0 |
|
||||
| `abstract-leveldown` | ✅ 7.2.0 |
|
||||
| `leveldown` | ✅ 6.1.0 |
|
||||
| `rocksdb` | ✅ 5.2.0 |
|
||||
| `memdown` | ✅ |
|
||||
| `level-js` | ✅ 6.1.0 |
|
||||
| `encoding-down` | ✅ 7.1.0 |
|
||||
| `deferred-leveldown` | ✅ 7.0.0 |
|
||||
| `levelup` | ✅ 5.1.0 |
|
||||
| `level` | ✅ 7.0.1 |
|
||||
| `level-mem` | ✅ 6.0.1 |
|
||||
| `level-rocksdb` | ✅ 5.0.0 |
|
||||
| `subleveldown` | ✅ 6.0.0 |
|
||||
| `multileveldown` | ✅ 5.0.0 |
|
||||
| `level-party` | ✅ 5.1.0 |
|
||||
|
||||
</details>
|
||||
|
||||
### `keyIterator` (boolean)
|
||||
|
||||
Does the database have a `keys([options])` method that returns a key iterator? Always true since `abstract-level@1`.
|
||||
|
||||
### `valueIterator` (boolean)
|
||||
|
||||
Does the database have a `values([options])` method that returns a key iterator? Always true since `abstract-level@1`.
|
||||
|
||||
### `iteratorNextv` (boolean)
|
||||
|
||||
Do iterators have a `nextv(size[, options][, callback])` method? Always true since `abstract-level@1`.
|
||||
|
||||
### `iteratorAll` (boolean)
|
||||
|
||||
Do iterators have a `all([options][, callback])` method? Always true since `abstract-level@1`.
|
||||
|
||||
### `additionalMethods` (object)
|
||||
|
||||
Declares support of additional methods, that are not part of the `abstract-level` interface. In the form of:
|
||||
|
||||
```js
|
||||
{
|
||||
foo: true,
|
||||
bar: true
|
||||
}
|
||||
```
|
||||
|
||||
Which says the db has two methods, `foo` and `bar`. It might be used like so:
|
||||
|
||||
```js
|
||||
if (db.supports.additionalMethods.foo) {
|
||||
db.foo()
|
||||
}
|
||||
```
|
||||
|
||||
For future extensibility, the properties of `additionalMethods` should be taken as truthy rather than strictly typed booleans. We may add additional metadata (see [#1](https://github.com/Level/supports/issues/1)).
|
||||
|
||||
## Install
|
||||
|
||||
With [npm](https://npmjs.org) do:
|
||||
|
||||
```
|
||||
npm install level-supports
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
[`Level/supports`](https://github.com/Level/supports) 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
|
||||
|
||||
Support us with a monthly donation on [Open Collective](https://opencollective.com/level) and help us continue our work.
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
|
||||
[level-badge]: https://leveljs.org/img/badge.svg
|
161
node_modules/level-supports/index.d.ts
generated
vendored
Normal file
161
node_modules/level-supports/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,161 @@
|
||||
/**
|
||||
* Given zero or more manifest objects, returns a merged and enriched manifest object
|
||||
* that has truthy properties for each of the features listed in {@link IManifest}.
|
||||
*
|
||||
* @param manifests Partial manifest(s) to merge.
|
||||
*/
|
||||
export function supports (...manifests: Array<Partial<IManifest>>): IManifest
|
||||
|
||||
/**
|
||||
* Describes the abilities of an
|
||||
* [`abstract-level`](https://github.com/Level/abstract-level) database. Support matrices
|
||||
* for known `abstract-level` implementations can be found in
|
||||
* [`level-supports`](https://github.com/Level/supports#features).
|
||||
*/
|
||||
export interface IManifest {
|
||||
/**
|
||||
* Does the database have snapshot guarantees? Meaning that reads are unaffected by
|
||||
* simultaneous writes. For example, an iterator should read from a snapshot of the
|
||||
* database, created at the time `db.iterator()` was called. This means the iterator
|
||||
* will not see the data of simultaneous write operations.
|
||||
*/
|
||||
snapshots: boolean
|
||||
|
||||
/**
|
||||
* Does data survive after process (or environment) exit?
|
||||
*/
|
||||
permanence: boolean
|
||||
|
||||
/**
|
||||
* Do iterators support
|
||||
* [`seek(..)`](https://github.com/Level/abstract-level/#iteratorseektarget-options)?
|
||||
*/
|
||||
seek: boolean
|
||||
|
||||
/**
|
||||
* Does the database support `db.clear()`? Always true since `abstract-level@1`.
|
||||
*/
|
||||
clear: boolean
|
||||
|
||||
/**
|
||||
* Does the database support `db.getMany()`? Always true since `abstract-level@1`.
|
||||
*/
|
||||
getMany: boolean
|
||||
|
||||
/**
|
||||
* Does the database have a `keys([options])` method that returns a key iterator?
|
||||
* Always true since `abstract-level@1`.
|
||||
*/
|
||||
keyIterator: boolean
|
||||
|
||||
/**
|
||||
* Does the database have a `values([options])` method that returns a key iterator?
|
||||
* Always true since `abstract-level@1`.
|
||||
*/
|
||||
valueIterator: boolean
|
||||
|
||||
/**
|
||||
* Do iterators have a `nextv(size[, options][, callback])` method? Always true since
|
||||
* `abstract-level@1`.
|
||||
*/
|
||||
iteratorNextv: boolean
|
||||
|
||||
/**
|
||||
* Do iterators have a `all([options][, callback])` method? Always true since
|
||||
* `abstract-level@1`.
|
||||
*/
|
||||
iteratorAll: boolean
|
||||
|
||||
/**
|
||||
* Does the database have a
|
||||
* [`status`](https://github.com/Level/abstract-level/#dbstatus) property? Always true
|
||||
* since `abstract-level@1`.
|
||||
*/
|
||||
status: boolean
|
||||
|
||||
/**
|
||||
* Does `db.open()` and the database constructor support this option?
|
||||
*/
|
||||
createIfMissing: boolean
|
||||
|
||||
/**
|
||||
* Does `db.open()` and the database constructor support this option?
|
||||
*/
|
||||
errorIfExists: boolean
|
||||
|
||||
/**
|
||||
* Can operations like `db.put()` be called without explicitly opening the db? Like so:
|
||||
*
|
||||
* ```js
|
||||
* const db = new Level()
|
||||
* await db.put('key', 'value')
|
||||
* ```
|
||||
*
|
||||
* Always true since `abstract-level@1`.
|
||||
*/
|
||||
deferredOpen: boolean
|
||||
|
||||
/**
|
||||
* Do all database methods (that don't otherwise have a return value) support promises,
|
||||
* in addition to callbacks? Such that, when a callback argument is omitted, a promise
|
||||
* is returned:
|
||||
*
|
||||
* ```js
|
||||
* db.put('key', 'value', callback)
|
||||
* await db.put('key', 'value')
|
||||
* ```
|
||||
*
|
||||
* Always true since `abstract-level@1`.
|
||||
*/
|
||||
promises: boolean
|
||||
|
||||
/**
|
||||
* Does database have the methods `createReadStream`, `createKeyStream` and
|
||||
* `createValueStream`, following the API documented in `levelup`? For `abstract-level`
|
||||
* databases, a standalone module called
|
||||
* [`level-read-stream`](https://github.com/Level/read-stream) is available.
|
||||
*/
|
||||
streams: boolean
|
||||
|
||||
/**
|
||||
* Which encodings (by name) does the database support, as indicated by nested
|
||||
* properties? For example:
|
||||
*
|
||||
* ```js
|
||||
* { utf8: true, json: true }
|
||||
* ```
|
||||
*/
|
||||
encodings: Record<string, boolean>
|
||||
|
||||
/**
|
||||
* Which events does the database emit, as indicated by nested properties? For example:
|
||||
*
|
||||
* ```js
|
||||
* if (db.supports.events.put) {
|
||||
* db.on('put', listener)
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
events: Record<string, boolean>
|
||||
|
||||
/**
|
||||
* Declares support of additional methods, that are not part of the `abstract-level`
|
||||
* interface. In the form of:
|
||||
*
|
||||
* ```js
|
||||
* {
|
||||
* foo: true,
|
||||
* bar: true
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* Which says the db has two methods, `foo` and `bar`. It might be used like so:
|
||||
*
|
||||
* ```js
|
||||
* if (db.supports.additionalMethods.foo) {
|
||||
* db.foo()
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
additionalMethods: Record<string, boolean>
|
||||
}
|
26
node_modules/level-supports/index.js
generated
vendored
Normal file
26
node_modules/level-supports/index.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
'use strict'
|
||||
|
||||
exports.supports = function supports (...manifests) {
|
||||
const manifest = manifests.reduce((acc, m) => Object.assign(acc, m), {})
|
||||
|
||||
return Object.assign(manifest, {
|
||||
snapshots: manifest.snapshots || false,
|
||||
permanence: manifest.permanence || false,
|
||||
seek: manifest.seek || false,
|
||||
clear: manifest.clear || false,
|
||||
getMany: manifest.getMany || false,
|
||||
keyIterator: manifest.keyIterator || false,
|
||||
valueIterator: manifest.valueIterator || false,
|
||||
iteratorNextv: manifest.iteratorNextv || false,
|
||||
iteratorAll: manifest.iteratorAll || false,
|
||||
status: manifest.status || false,
|
||||
createIfMissing: manifest.createIfMissing || false,
|
||||
errorIfExists: manifest.errorIfExists || false,
|
||||
deferredOpen: manifest.deferredOpen || false,
|
||||
promises: manifest.promises || false,
|
||||
streams: manifest.streams || false,
|
||||
encodings: Object.assign({}, manifest.encodings),
|
||||
events: Object.assign({}, manifest.events),
|
||||
additionalMethods: Object.assign({}, manifest.additionalMethods)
|
||||
})
|
||||
}
|
48
node_modules/level-supports/package.json
generated
vendored
Normal file
48
node_modules/level-supports/package.json
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
{
|
||||
"name": "level-supports",
|
||||
"version": "4.0.1",
|
||||
"description": "Create a manifest describing the abilities of an abstract-level database",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"test": "standard && ts-standard *.ts && hallmark && (nyc -s node test/self.js | faucet) && nyc report",
|
||||
"test-browsers-local": "airtap --coverage test/self.js && nyc report",
|
||||
"coverage": "nyc report -r lcovonly",
|
||||
"hallmark": "hallmark --fix"
|
||||
},
|
||||
"types": "./index.d.ts",
|
||||
"files": [
|
||||
"test",
|
||||
"CHANGELOG.md",
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@types/node": "^17.0.6",
|
||||
"@voxpelli/tsconfig": "^3.1.0",
|
||||
"airtap": "^4.0.4",
|
||||
"airtap-playwright": "^1.0.1",
|
||||
"faucet": "^0.0.1",
|
||||
"hallmark": "^4.0.0",
|
||||
"nyc": "^15.1.0",
|
||||
"standard": "^16.0.3",
|
||||
"tape": "^5.4.0",
|
||||
"ts-standard": "^11.0.0",
|
||||
"typescript": "^4.5.4"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Level/supports.git"
|
||||
},
|
||||
"homepage": "https://github.com/Level/supports",
|
||||
"keywords": [
|
||||
"abstract-leveldown",
|
||||
"database",
|
||||
"db",
|
||||
"level",
|
||||
"levelup",
|
||||
"manifest"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
}
|
26
node_modules/level-supports/test/cloneable.js
generated
vendored
Normal file
26
node_modules/level-supports/test/cloneable.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
'use strict'
|
||||
|
||||
const { supports } = require('..')
|
||||
|
||||
// Every object in a manifest must have a unique identity, to avoid accidental
|
||||
// mutation. In supports() we only shallowly clone the manifest object itself
|
||||
// and additionalMethods. If in the future we add more objects to manifests,
|
||||
// this test will break and we'll know to start performing a deep clone.
|
||||
module.exports = function cloneable (t, manifest) {
|
||||
const copy = supports(manifest)
|
||||
verifyUnique(t, 'manifest', manifest, copy)
|
||||
}
|
||||
|
||||
function verifyUnique (t, path, a, b) {
|
||||
if (isObject(a) && isObject(b)) {
|
||||
t.ok(a !== b, path + ' has unique identity')
|
||||
|
||||
Object.keys(a).forEach(function (key) {
|
||||
verifyUnique(t, path + '.' + key, a[key], b[key])
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function isObject (o) {
|
||||
return typeof o === 'object' && o !== null
|
||||
}
|
29
node_modules/level-supports/test/index.js
generated
vendored
Normal file
29
node_modules/level-supports/test/index.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
'use strict'
|
||||
|
||||
const shape = require('./shape')
|
||||
const cloneable = require('./cloneable')
|
||||
|
||||
module.exports = function suite (test, testCommon) {
|
||||
test('db has manifest', function (t) {
|
||||
const db = testCommon.factory()
|
||||
const manifest = db.supports
|
||||
|
||||
shape(t, manifest)
|
||||
cloneable(t, manifest)
|
||||
|
||||
const before = Object.assign({}, manifest, {
|
||||
additionalMethods: Object.assign({}, manifest.additionalMethods)
|
||||
})
|
||||
|
||||
db.open(function (err) {
|
||||
t.ifError(err, 'no open error')
|
||||
t.same(db.supports, before, 'manifest did not change after open')
|
||||
|
||||
db.close(function (err) {
|
||||
t.ifError(err, 'no close error')
|
||||
t.same(db.supports, before, 'manifest did not change after close')
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
75
node_modules/level-supports/test/self.js
generated
vendored
Normal file
75
node_modules/level-supports/test/self.js
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
'use strict'
|
||||
|
||||
const test = require('tape')
|
||||
const { supports } = require('..')
|
||||
const shape = require('./shape')
|
||||
const cloneable = require('./cloneable')
|
||||
|
||||
test('no options', function (t) {
|
||||
shape(t, supports())
|
||||
cloneable(t, supports())
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('falsy options', function (t) {
|
||||
;[null, false, undefined, 0, ''].forEach(function (value) {
|
||||
const manifest = supports({
|
||||
seek: value,
|
||||
additionalMethods: {
|
||||
foo: value
|
||||
}
|
||||
})
|
||||
|
||||
shape(t, manifest)
|
||||
t.is(manifest.seek, false)
|
||||
})
|
||||
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('truthy options', function (t) {
|
||||
;[true, {}, 'yes', 1, []].forEach(function (value) {
|
||||
const manifest = supports({
|
||||
streams: value,
|
||||
additionalMethods: {
|
||||
foo: value
|
||||
}
|
||||
})
|
||||
|
||||
shape(t, manifest)
|
||||
t.same(manifest.streams, value)
|
||||
t.same(manifest.additionalMethods.foo, value)
|
||||
})
|
||||
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('merges input objects without mutating them', function (t) {
|
||||
const input1 = { seek: null, streams: false }
|
||||
const input2 = { streams: true, additionalMethods: {} }
|
||||
const manifest = supports(input1, input2)
|
||||
|
||||
manifest.foobar = true
|
||||
manifest.additionalMethods.baz = true
|
||||
|
||||
t.same(input1, { seek: null, streams: false })
|
||||
t.same(input2, { streams: true, additionalMethods: {} })
|
||||
t.is(manifest.seek, false)
|
||||
t.is(manifest.streams, true)
|
||||
shape(t, manifest)
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('inherits additionalMethods', function (t) {
|
||||
const manifest = supports({ additionalMethods: { foo: true } }, {})
|
||||
t.same(manifest.additionalMethods, { foo: true })
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('does not merge additionalMethods', function (t) {
|
||||
const input1 = { additionalMethods: { foo: true } }
|
||||
const input2 = { additionalMethods: { bar: true } }
|
||||
const manifest = supports(input1, input2)
|
||||
t.same(manifest.additionalMethods, { bar: true })
|
||||
t.end()
|
||||
})
|
22
node_modules/level-supports/test/shape.js
generated
vendored
Normal file
22
node_modules/level-supports/test/shape.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
'use strict'
|
||||
|
||||
const hasOwnProperty = Object.prototype.hasOwnProperty
|
||||
|
||||
module.exports = function shape (t, manifest) {
|
||||
t.ok(isObject(manifest), 'manifest is object')
|
||||
t.ok(isObject(manifest.additionalMethods), 'additionalMethods is object')
|
||||
|
||||
for (const k in manifest) {
|
||||
if (!hasOwnProperty.call(manifest, k)) continue
|
||||
|
||||
if (manifest[k]) {
|
||||
t.ok(manifest[k], 'truthy: ' + k)
|
||||
} else {
|
||||
t.is(manifest[k], false, 'false: ' + k)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function isObject (o) {
|
||||
return typeof o === 'object' && o !== null
|
||||
}
|
Reference in New Issue
Block a user