abstract-leveldown
Advanced tools
Comparing version 6.0.0 to 6.0.1
@@ -5,2 +5,13 @@ # Changelog | ||
## [6.0.1] - 2018-12-27 | ||
### Changed | ||
- Upgrade `hallmark` devDependency from `0.0.2` to `0.1.0` ([#316](https://github.com/level/abstract-leveldown/issues/316)) ([**@vweevers**](https://github.com/vweevers)) | ||
- Split v6 upgrade guide into sections for consumers and implementors ([**@vweevers**](https://github.com/vweevers)) | ||
### Fixed | ||
- Remove range tests that assumed zero-length strings or Buffers meant "not defined" ([#319](https://github.com/level/abstract-leveldown/issues/319)) ([**@vweevers**](https://github.com/vweevers)) | ||
## [6.0.0] - 2018-10-20 | ||
@@ -724,4 +735,6 @@ | ||
[unreleased]: https://github.com/level/abstract-leveldown/compare/v6.0.0...HEAD | ||
[unreleased]: https://github.com/level/abstract-leveldown/compare/v6.0.1...HEAD | ||
[6.0.1]: https://github.com/level/abstract-leveldown/compare/v6.0.0...v6.0.1 | ||
[6.0.0]: https://github.com/level/abstract-leveldown/compare/v5.0.0...v6.0.0 | ||
@@ -728,0 +741,0 @@ |
{ | ||
"name": "abstract-leveldown", | ||
"description": "An abstract prototype matching the LevelDOWN API", | ||
"version": "6.0.0", | ||
"version": "6.0.1", | ||
"license": "MIT", | ||
@@ -24,3 +24,3 @@ "repository": { | ||
"coveralls": "~3.0.2", | ||
"hallmark": "0.0.2", | ||
"hallmark": "0.1.0", | ||
"level-community": "~3.0.0", | ||
@@ -27,0 +27,0 @@ "nyc": "~12.0.2", |
@@ -189,3 +189,3 @@ # abstract-leveldown | ||
**Note** Zero-length strings, buffers and arrays as well as `null` and `undefined` are invalid as keys, yet valid as range options. These types are significant in encodings like [`bytewise`](https://github.com/deanlandolt/bytewise) and [`charwise`](https://github.com/dominictarr/charwise). Consumers of an implementation should assume that `{ gt: undefined }` is _not_ the same as `{}`. An implementation can choose to: | ||
**Note** Zero-length strings, buffers and arrays as well as `null` and `undefined` are invalid as keys, yet valid as range options. These types are significant in encodings like [`bytewise`](https://github.com/deanlandolt/bytewise) and [`charwise`](https://github.com/dominictarr/charwise) as well as some underlying stores like IndexedDB. Consumers of an implementation should assume that `{ gt: undefined }` is _not_ the same as `{}`. An implementation can choose to: | ||
@@ -196,2 +196,4 @@ - [_Serialize_](#db_serializekeykey) or [_encode_][encoding-down] these types to make them meaningful | ||
If you are an implementor, a final note: the [abstract test suite](#test-suite) does not test these types. Whether they are supported or how they sort is up to you; add custom tests accordingly. | ||
In addition to range options, `iterator()` takes the following options: | ||
@@ -198,0 +200,0 @@ |
@@ -312,36 +312,2 @@ var collectEntries = require('level-concat-iterator') | ||
}, []) | ||
if (testCommon.bufferKeys) { | ||
rangeTest('test iterator with gte as empty buffer', { | ||
gte: Buffer.alloc(0) | ||
}, data) | ||
rangeTest('test iterator with start as empty buffer - legacy', { | ||
start: Buffer.alloc(0) | ||
}, data) | ||
rangeTest('test iterator with lte as empty buffer', { | ||
lte: Buffer.alloc(0) | ||
}, data) | ||
rangeTest('test iterator with end as empty buffer - legacy', { | ||
end: Buffer.alloc(0) | ||
}, data) | ||
} | ||
rangeTest('test iterator with gte as empty string', { | ||
gte: '' | ||
}, data) | ||
rangeTest('test iterator with start as empty string - legacy', { | ||
start: '' | ||
}, data) | ||
rangeTest('test iterator with lte as empty string', { | ||
lte: '' | ||
}, data) | ||
rangeTest('test iterator with end as empty string - legacy', { | ||
end: '' | ||
}, data) | ||
} | ||
@@ -348,0 +314,0 @@ |
@@ -18,6 +18,41 @@ # Upgrade Guide | ||
This release brings a major refactoring of the test suite, decouples `abstract-leveldown` from disk-based implementations and solves long-standing issues around serialization and type support. | ||
This release brings a major refactoring of the test suite, decouples `abstract-leveldown` from disk-based implementations and solves long-standing issues around serialization and type support. Because the changes are substantial, this guide has two sections: | ||
### `location` was removed | ||
1. **Changes to public API** - for consumers of any implementation. | ||
2. **Changes to private API** - intended for implementors. | ||
### Changes to public API | ||
#### Nullish values are rejected | ||
In addition to rejecting `null` and `undefined` as _keys_, `abstract-leveldown` now also rejects these types as _values_, due to preexisting significance in streams and iterators. | ||
Before this, the behavior of these types depended on a large number of factors: `_serializeValue` and type support of the underlying storage, whether `get()`, `iterator()` or a stream was used to retrieve values, the `keys` and `asBuffer` options of `iterator()` and finally, which encoding was selected. | ||
#### Range options are serialized | ||
Previously, range options like `lt` were passed through as-is, unlike keys. | ||
#### The rules for range options have been relaxed | ||
Because `null`, `undefined`, zero-length strings and zero-length buffers are significant types in encodings like `bytewise` and `charwise`, they became valid as range options. In fact, any type is now valid. This means `db.iterator({ gt: undefined })` is not the same as `db.iterator({})`. | ||
Furthermore, `abstract-leveldown` makes no assumptions about the meaning of these types. Range tests that assumed `null` meant "not defined" have been removed. | ||
#### Zero-length array keys are rejected | ||
Though this was already the case because `_checkKey` stringified its input before checking the length, that behavior has been replaced with an explicit `Array.isArray()` check and a new error message. | ||
#### No longer assumes support of boolean and `NaN` keys | ||
A test that asserted boolean and `NaN` keys were valid has been removed. | ||
#### Browser support | ||
IE10 has been dropped. | ||
### Changes to private API | ||
#### `location` was removed | ||
`AbstractLevelDOWN` is no longer associated with a `location`. It's up to the implementation to handle it if it's required. | ||
@@ -50,3 +85,3 @@ | ||
### Abstract test suite has moved to a single entry point | ||
#### Abstract test suite has moved to a single entry point | ||
@@ -120,3 +155,3 @@ Instead of including test files individually, you can and should include the test suite with one `require()` statement. If you previously did: | ||
### The `collectEntries` utility has moved | ||
#### The `collectEntries` utility has moved | ||
@@ -136,3 +171,3 @@ The `testCommon.collectEntries` method has moved to the npm package `level-concat-iterator`. If your (additional) tests depend on `collectEntries` and you previously did: | ||
### Setup and teardown became noops | ||
#### Setup and teardown became noops | ||
@@ -153,3 +188,3 @@ Because cleanup is no longer necessary, the `testCommon.setUp` and `testCommon.tearDown` methods are now noops by default. If you do need to perform (a)synchronous work before or after each test, `setUp` and `tearDown` can be overridden: | ||
### Optional tests have been separated | ||
#### Optional tests have been separated | ||
@@ -167,7 +202,7 @@ If your implementation does not support snapshots or other optional features, the relevant tests may be skipped. For example: | ||
### Iterator must have a `db` reference | ||
#### Iterator must have a `db` reference | ||
The `db` argument of the `AbstractIterator` constructor became mandatory, as well as a public `db` property on the instance. Its existence is not new; the test suite now asserts that your implementation also has it. | ||
### Seeking became part of official API | ||
#### Seeking became part of official API | ||
@@ -181,3 +216,3 @@ If your implementation previously defined the public `iterator.seek(target)`, it must now define the private `iterator._seek(target)`. The new public API is equal to the reference implementation of `leveldown` except for two differences: | ||
### Chained batch has been refactored | ||
#### Chained batch has been refactored | ||
@@ -188,34 +223,6 @@ - The default `_clear` method is no longer a noop; instead it clears the operations queued by `_put` and/or `_del` | ||
### Nullish values are rejected | ||
#### Default `_serializeKey` and `_serializeValue` became identity functions | ||
In addition to rejecting `null` and `undefined` as _keys_, `abstract-leveldown` now also rejects these types as _values_, due to preexisting significance in streams and iterators. | ||
Before this, the behavior of these types depended on a large number of factors: `_serializeValue` and type support of the underlying storage, whether `get()`, `iterator()` or a stream was used to retrieve values, the `keys` and `asBuffer` options of `iterator()` and finally, which encoding was selected. | ||
### Default `_serializeKey` and `_serializeValue` became identity functions | ||
They return whatever is given. Previously they were opinionated and mostly geared towards string- and Buffer-based storages. Implementations that didn't already define their own serialization should now do so, according to the types that they support. Please refer to the [README](README.md) for recommended behavior. | ||
### Range options are serialized | ||
Previously, range options like `lt` were passed through as-is, unlike keys. | ||
### The rules for range options have been relaxed | ||
Because `null`, `undefined`, zero-length strings and zero-length buffers are significant types in encodings like `bytewise` and `charwise`, they became valid as range options. In fact, any type is now valid. This means `db.iterator({ gt: undefined })` is not the same as `db.iterator({})`. | ||
Furthermore, `abstract-leveldown` makes no assumptions about the meaning of these types. Range tests that assumed `null` meant "not defined" have been removed. | ||
### Zero-length array keys are rejected | ||
Though this was already the case because `_checkKey` stringified its input before checking the length, that behavior has been replaced with an explicit `Array.isArray()` check and a new error message. | ||
### No longer assumes support of boolean and `NaN` keys | ||
A test that asserted boolean and `NaN` keys were valid has been removed. | ||
### Browser support | ||
IE10 has been dropped. | ||
## v5 | ||
@@ -222,0 +229,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
190145
540
0
3052