-
-
Notifications
You must be signed in to change notification settings - Fork 203
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Import permission log controller (#1871)
## Description <!-- Thanks for your contribution! Take a moment to answer these questions so that reviewers have the information they need to properly understand your changes: * What is the current state of things and why does it need to change? * What is the solution your changes offer and how does it work? * What packages are you updating? * Are you introducing a breaking change to a package (renaming or removing a part of a public interface)? --> This PR adds the `permission-log-controller` from metamask-extension. ## Changes <!-- Pretend that you're updating a changelog. How would you categorize your changes? CATEGORY is one of: - BREAKING - ADDED - CHANGED - DEPRECATED - REMOVED - FIXED (Security-related changes should go through the Security Advisory process.) --> - **ADDED**: `permission-log-controller` controller ## References <!-- Are there any issues or other links that reviewers should consult to understand this pull request better? For instance: * Fixes #12345 * See: #67890 --> * Fixes: #1826 ## Checklist - [x] I've updated the test suite for new or updated code as appropriate - [x] I've updated documentation for new or updated code as appropriate (note: this will usually be JSDoc) - [x] I've highlighted breaking changes using the "BREAKING" category above as appropriate --------- Co-authored-by: Jongsun Suh <34228073+MajorLift@users.noreply.github.com>
- Loading branch information
1 parent
7c74b62
commit e56b975
Showing
19 changed files
with
1,926 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Changelog | ||
All notable changes to this project will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | ||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
||
## [Unreleased] | ||
|
||
[Unreleased]: https://github.com/MetaMask/core/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
Copyright ConsenSys Software Inc. 2022. All rights reserved. | ||
|
||
You acknowledge and agree that ConsenSys Software Inc. (“ConsenSys”) (or ConsenSys’s licensors) own all legal right, title and interest in and to the work, software, application, source code, documentation and any other documents in this repository (collectively, the “Program”), including any intellectual property rights which subsist in the Program (whether those rights happen to be registered or not, and wherever in the world those rights may exist), whether in source code or any other form. | ||
|
||
Subject to the limited license below, you may not (and you may not permit anyone else to) distribute, publish, copy, modify, merge, combine with another program, create derivative works of, reverse engineer, decompile or otherwise attempt to extract the source code of, the Program or any part thereof, except that you may contribute to this repository. | ||
|
||
You are granted a non-exclusive, non-transferable, non-sublicensable license to distribute, publish, copy, modify, merge, combine with another program or create derivative works of the Program (such resulting program, collectively, the “Resulting Program”) solely for Non-Commercial Use as long as you: | ||
1. give prominent notice (“Notice”) with each copy of the Resulting Program that the Program is used in the Resulting Program and that the Program is the copyright of ConsenSys; and | ||
2. subject the Resulting Program and any distribution, publication, copy, modification, merger therewith, combination with another program or derivative works thereof to the same Notice requirement and Non-Commercial Use restriction set forth herein. | ||
|
||
“Non-Commercial Use” means each use as described in clauses (1)-(3) below, as reasonably determined by ConsenSys in its sole discretion: | ||
1. personal use for research, personal study, private entertainment, hobby projects or amateur pursuits, in each case without any anticipated commercial application; | ||
2. use by any charitable organization, educational institution, public research organization, public safety or health organization, environmental protection organization or government institution; or | ||
3. the number of monthly active users of the Resulting Program across all versions thereof and platforms globally do not exceed 10,000 at any time. | ||
|
||
You will not use any trade mark, service mark, trade name, logo of ConsenSys or any other company or organization in a way that is likely or intended to cause confusion about the owner or authorized user of such marks, names or logos. | ||
|
||
If you have any questions, comments or interest in pursuing any other use cases, please reach out to us at communications@metamask.io. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# `@metamask/permission-log-controller` | ||
|
||
Controller with middleware for logging requests and responses to restricted and permissions-related methods. | ||
|
||
## Installation | ||
|
||
`yarn add @metamask/permission-log-controller` | ||
|
||
or | ||
|
||
`npm install @metamask/permission-log-controller` | ||
|
||
## Contributing | ||
|
||
This package is part of a monorepo. Instructions for contributing can be found in the [monorepo README](https://github.com/MetaMask/core#readme). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* For a detailed explanation regarding each configuration property and type check, visit: | ||
* https://jestjs.io/docs/configuration | ||
*/ | ||
|
||
const merge = require('deepmerge'); | ||
const path = require('path'); | ||
|
||
const baseConfig = require('../../jest.config.packages'); | ||
|
||
const displayName = path.basename(__dirname); | ||
|
||
module.exports = merge(baseConfig, { | ||
// The display name when running multiple projects | ||
displayName, | ||
|
||
// An object that configures minimum threshold enforcement for coverage results | ||
coverageThreshold: { | ||
global: { | ||
branches: 100, | ||
functions: 100, | ||
lines: 100, | ||
statements: 100, | ||
}, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
{ | ||
"name": "@metamask/permission-log-controller", | ||
"version": "0.0.0", | ||
"description": "Controller with middleware for logging requests and responses to restricted and permissions-related methods", | ||
"keywords": [ | ||
"MetaMask", | ||
"Ethereum" | ||
], | ||
"homepage": "https://github.com/MetaMask/core/tree/main/packages/permission-log-controller#readme", | ||
"bugs": { | ||
"url": "https://github.com/MetaMask/core/issues" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/MetaMask/core.git" | ||
}, | ||
"license": "SEE LICENSE IN LICENSE", | ||
"main": "./dist/index.js", | ||
"types": "./dist/index.d.ts", | ||
"files": [ | ||
"dist/" | ||
], | ||
"scripts": { | ||
"build:docs": "typedoc", | ||
"changelog:validate": "../../scripts/validate-changelog.sh @metamask/permission-log-controller", | ||
"publish:preview": "yarn npm publish --tag preview", | ||
"test": "jest --reporters=jest-silent-reporter", | ||
"test:clean": "jest --clearCache", | ||
"test:verbose": "jest --verbose", | ||
"test:watch": "jest --watch" | ||
}, | ||
"dependencies": { | ||
"@metamask/base-controller": "^3.2.3", | ||
"@metamask/json-rpc-engine": "^7.2.0", | ||
"@metamask/utils": "^8.2.0" | ||
}, | ||
"devDependencies": { | ||
"@metamask/auto-changelog": "^3.4.3", | ||
"@types/deep-freeze-strict": "^1.1.0", | ||
"@types/jest": "^27.4.1", | ||
"deep-freeze-strict": "^1.1.1", | ||
"deepmerge": "^4.2.2", | ||
"jest": "^27.5.1", | ||
"nanoid": "^3.1.31", | ||
"sinon": "^9.2.4", | ||
"ts-jest": "^27.1.4", | ||
"typedoc": "^0.24.8", | ||
"typedoc-plugin-missing-exports": "^2.0.0", | ||
"typescript": "~4.8.4" | ||
}, | ||
"engines": { | ||
"node": ">=16.0.0" | ||
}, | ||
"publishConfig": { | ||
"access": "public", | ||
"registry": "https://registry.npmjs.org/" | ||
} | ||
} |
Oops, something went wrong.