Skip to content
This repository was archived by the owner on Jan 3, 2022. It is now read-only.

Commit 41ca3b6

Browse files
authored
4.0.0 (#126)
* Comment and type tweaks * 4.0.0 * Update changelog
1 parent 0d6000f commit 41ca3b6

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

CHANGELOG.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,16 @@ For changes prior to `3.0.0`, please see the package's [GitHub Releases](https:/
99

1010
## [Unreleased]
1111

12+
## [4.0.0] - 2020-12-22
13+
14+
### Changed
15+
16+
- **(SEMVER-MAJOR)** `filterResponse` caveat now performs a deep equality check ([#127](https://github.com/MetaMask/rpc-cap/pull/127))
17+
- The filter was previously just a strict equality check per array item.
18+
Anything that can be compared by [`fast-deep-equal@^2.0.1`](https://npmjs.com/package/fast-deep-equal) can now be added to the caveat value.
19+
Whether something _should_ be added we leave to the consumer.
20+
- Since consumers may have relied on the previous behavior for object and/or array values, this change justifies a major version bump.
21+
1222
## [3.2.1] - 2020-11-19
1323

1424
### Changed
@@ -43,8 +53,8 @@ For changes prior to `3.0.0`, please see the package's [GitHub Releases](https:/
4353

4454
### Changed
4555

46-
- **BREAKING:** `requestPermissionsMiddleware`: Stop using or setting the `id` property from the `IOriginMetadata` parameter
47-
- **BREAKING:** `requestPermissionsMiddleware`: Default to `req.id` value as the pending permissions request object `id`, with `uuid()` as a fallback
56+
- **(SEMVER-MAJOR)** `requestPermissionsMiddleware`: Stop using or setting the `id` property from the `IOriginMetadata` parameter
57+
- **(SEMVER-MAJOR)** `requestPermissionsMiddleware`: Default to `req.id` value as the pending permissions request object `id`, with `uuid()` as a fallback
4858
- `requestPermissionsMiddleware`: Rename `IOriginMetadata` parameter from `metadata` to `domain`, in line with other middleware functions
4959
- Its former name led to confused usage by this package and its consumers
5060
- Types

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "rpc-cap",
3-
"version": "3.2.1",
3+
"version": "4.0.0",
44
"description": "A module for adding an object-capabilities system to any JSON-RPC API as middleware for json-rpc-engine",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

src/caveats.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export const requireParams: ICaveatFunctionGenerator = function requireParams (s
2626
};
2727

2828
/*
29-
* Filters array results.
29+
* Filters array results deeply.
3030
*/
3131
export const filterResponse: ICaveatFunctionGenerator = function filterResponse (serialized: IOcapLdCaveat) {
3232
const { value } = serialized;
@@ -35,7 +35,7 @@ export const filterResponse: ICaveatFunctionGenerator = function filterResponse
3535
next((done) => {
3636
if (Array.isArray(res.result)) {
3737
res.result = res.result.filter((item) => {
38-
const findResult = value.find((v: any) => {
38+
const findResult = value.find((v: unknown) => {
3939
return equal(v, item);
4040
});
4141
return findResult !== undefined;

0 commit comments

Comments
 (0)