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

Commit

Permalink
4.0.0 (#126)
Browse files Browse the repository at this point in the history
* Comment and type tweaks

* 4.0.0

* Update changelog
  • Loading branch information
rekmarks committed Dec 23, 2020
1 parent 0d6000f commit 41ca3b6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
14 changes: 12 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@ For changes prior to `3.0.0`, please see the package's [GitHub Releases](https:/

## [Unreleased]

## [4.0.0] - 2020-12-22

### Changed

- **(SEMVER-MAJOR)** `filterResponse` caveat now performs a deep equality check ([#127](https://github.com/MetaMask/rpc-cap/pull/127))
- The filter was previously just a strict equality check per array item.
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.
Whether something _should_ be added we leave to the consumer.
- Since consumers may have relied on the previous behavior for object and/or array values, this change justifies a major version bump.

## [3.2.1] - 2020-11-19

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

### Changed

- **BREAKING:** `requestPermissionsMiddleware`: Stop using or setting the `id` property from the `IOriginMetadata` parameter
- **BREAKING:** `requestPermissionsMiddleware`: Default to `req.id` value as the pending permissions request object `id`, with `uuid()` as a fallback
- **(SEMVER-MAJOR)** `requestPermissionsMiddleware`: Stop using or setting the `id` property from the `IOriginMetadata` parameter
- **(SEMVER-MAJOR)** `requestPermissionsMiddleware`: Default to `req.id` value as the pending permissions request object `id`, with `uuid()` as a fallback
- `requestPermissionsMiddleware`: Rename `IOriginMetadata` parameter from `metadata` to `domain`, in line with other middleware functions
- Its former name led to confused usage by this package and its consumers
- Types
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rpc-cap",
"version": "3.2.1",
"version": "4.0.0",
"description": "A module for adding an object-capabilities system to any JSON-RPC API as middleware for json-rpc-engine",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
4 changes: 2 additions & 2 deletions src/caveats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const requireParams: ICaveatFunctionGenerator = function requireParams (s
};

/*
* Filters array results.
* Filters array results deeply.
*/
export const filterResponse: ICaveatFunctionGenerator = function filterResponse (serialized: IOcapLdCaveat) {
const { value } = serialized;
Expand All @@ -35,7 +35,7 @@ export const filterResponse: ICaveatFunctionGenerator = function filterResponse
next((done) => {
if (Array.isArray(res.result)) {
res.result = res.result.filter((item) => {
const findResult = value.find((v: any) => {
const findResult = value.find((v: unknown) => {
return equal(v, item);
});
return findResult !== undefined;
Expand Down

0 comments on commit 41ca3b6

Please sign in to comment.