Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added polling-controller #1703

Merged
merged 27 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
98efc47
Added polling-controller
shanejonas Sep 22, 2023
b3dafbf
Changed old names to PollingController in tests + other PR feedback f…
shanejonas Sep 22, 2023
1066d88
Added JSDoc for PollingController
shanejonas Sep 22, 2023
bdde0a2
Added yarn.lock changes
shanejonas Sep 22, 2023
18ec0fc
Changed validate in npm scripts
shanejonas Sep 22, 2023
488b144
Fixed homepage
shanejonas Sep 22, 2023
897f156
Fixed constraints
shanejonas Sep 22, 2023
8c4782c
Fixed yarn lock
shanejonas Sep 22, 2023
a48104e
Fixed changelog
shanejonas Sep 22, 2023
3177cd1
Update packages/polling-controller/src/PollingController.test.ts
shanejonas Sep 25, 2023
4104f26
Update packages/polling-controller/src/PollingController.test.ts
shanejonas Sep 25, 2023
510585c
Update packages/polling-controller/src/PollingController.test.ts
shanejonas Sep 25, 2023
ece9577
Update packages/polling-controller/src/PollingController.test.ts
shanejonas Sep 25, 2023
7cf3c13
Removed unused deps
shanejonas Sep 25, 2023
f663d29
Fixed naming on PollingController
shanejonas Sep 25, 2023
b6db670
Update packages/polling-controller/src/PollingController.test.ts
shanejonas Sep 25, 2023
58ab401
Changed PollingController test beforeEach to new createExecutePollMoc…
shanejonas Sep 25, 2023
4251790
Added TICK_TIME constant for PollingController tests
shanejonas Sep 25, 2023
c72f5d5
Added deepmerge dep
shanejonas Sep 25, 2023
cb99a77
Fixed deepmerge issue
shanejonas Sep 25, 2023
0ee7b44
add interval setting in the constructor
adonesky1 Sep 25, 2023
fac9924
update test
adonesky1 Sep 25, 2023
911ff20
add intervallength test
adonesky1 Sep 25, 2023
43e9ed5
Merge branch 'main' into polling-controller
shanejonas Sep 26, 2023
207e05c
Fixed constraint issues
shanejonas Sep 26, 2023
730fbd9
Merge branch 'main' into polling-controller
shanejonas Sep 26, 2023
4f02231
Fixed PollingController uuid to use v4
shanejonas Sep 26, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions packages/polling-controller/CHANGELOG.md
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/
20 changes: 20 additions & 0 deletions packages/polling-controller/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
MIT License

Copyright (c) 2018 MetaMask

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
15 changes: 15 additions & 0 deletions packages/polling-controller/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# `@metamask/polling-controller`

PollingController is used as the base for all controllers that need to poll for updates based on `networkClientId`.

## Installation

`yarn add @metamask/polling-controller`

or

`npm install @metamask/polling-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).
26 changes: 26 additions & 0 deletions packages/polling-controller/jest.config.js
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: 65.31,
functions: 76.59,
lines: 75.83,
statements: 75.91,
},
},
});
58 changes: 58 additions & 0 deletions packages/polling-controller/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"name": "@metamask/polling-controller",
"version": "0.0.0",
"description": "Polling Controller is the base for controllers that polling by networkClientId",
"keywords": [
"MetaMask",
"Ethereum"
],
"homepage": "https://github.com/MetaMask/core/tree/main/packages/polling-controller#readme",
"bugs": {
"url": "https://github.com/MetaMask/core/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/MetaMask/core.git"
},
"license": "MIT",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"files": [
"dist/"
],
"scripts": {
"build:docs": "typedoc",
"changelog:validate": "../../scripts/validate-changelog.sh @metamask/polling-controller",
"publish:preview": "yarn npm publish --tag preview",
"test": "jest",
"test:watch": "jest --watch"
},
"dependencies": {
"@metamask/base-controller": "^3.2.1",
"@metamask/controller-utils": "^4.3.2",
"@metamask/network-controller": "^12.2.0",
"@metamask/utils": "^6.2.0",
"@types/uuid": "^8.3.0",
"uuid": "^8.3.2"
},
"devDependencies": {
"@metamask/auto-changelog": "^3.1.0",
"@types/jest": "^27.4.1",
"deepmerge": "^4.2.2",
"jest": "^27.5.1",
"ts-jest": "^27.1.4",
"typedoc": "^0.22.15",
"typedoc-plugin-missing-exports": "^0.22.6",
Gudahtt marked this conversation as resolved.
Show resolved Hide resolved
"typescript": "~4.6.3"
},
"peerDependencies": {
"@metamask/network-controller": "^12.2.0"
},
"engines": {
"node": ">=16.0.0"
},
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org/"
}
}
Loading
Loading