@metamask/polling-controller 15.0.0 → 16.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [16.0.1]
11
+
12
+ ### Changed
13
+
14
+ - Upgrade `@metamask/utils` from `^11.8.1` to `^11.9.0` ([#7511](https://github.com/MetaMask/core/pull/7511))
15
+ - Move peer dependencies for controller and service packages to direct dependencies ([#7209](https://github.com/MetaMask/core/pull/7209), [#7258](https://github.com/MetaMask/core/pull/7258), [#7534](https://github.com/MetaMask/core/pull/7534), [#7583](https://github.com/MetaMask/core/pull/7583), [#7604](https://github.com/MetaMask/core/pull/7604))
16
+ - The dependencies moved are:
17
+ - `@metamask/network-controller` (^28.0.0)
18
+ - In clients, it is now possible for multiple versions of these packages to exist in the dependency tree.
19
+ - For example, this scenario would be valid: a client relies on `@metamask/controller-a` 1.0.0 and `@metamask/controller-b` 1.0.0, and `@metamask/controller-b` depends on `@metamask/controller-a` 1.1.0.
20
+ - Note, however, that the versions specified in the client's `package.json` always "win", and you are expected to keep them up to date so as not to break controller and service intercommunication.
21
+ - Bump `@metamask/controller-utils` from `^11.16.0` to `^11.18.0` ([#7534](https://github.com/MetaMask/core/pull/7534), [#7583](https://github.com/MetaMask/core/pull/7583))
22
+
23
+ ## [16.0.0]
24
+
25
+ ### Changed
26
+
27
+ - Bump `@metamask/controller-utils` from `^11.15.0` to `^11.16.0` ([#7202](https://github.com/MetaMask/core/pull/7202))
28
+ - **BREAKING:** Bump `@metamask/network-controller` from `^25.0.0` to `^26.0.0` ([#7202](https://github.com/MetaMask/core/pull/7202))
29
+
10
30
  ## [15.0.0]
11
31
 
12
32
  ### Changed
@@ -273,7 +293,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
273
293
 
274
294
  - Initial release
275
295
 
276
- [Unreleased]: https://github.com/MetaMask/core/compare/@metamask/polling-controller@15.0.0...HEAD
296
+ [Unreleased]: https://github.com/MetaMask/core/compare/@metamask/polling-controller@16.0.1...HEAD
297
+ [16.0.1]: https://github.com/MetaMask/core/compare/@metamask/polling-controller@16.0.0...@metamask/polling-controller@16.0.1
298
+ [16.0.0]: https://github.com/MetaMask/core/compare/@metamask/polling-controller@15.0.0...@metamask/polling-controller@16.0.0
277
299
  [15.0.0]: https://github.com/MetaMask/core/compare/@metamask/polling-controller@14.0.2...@metamask/polling-controller@15.0.0
278
300
  [14.0.2]: https://github.com/MetaMask/core/compare/@metamask/polling-controller@14.0.1...@metamask/polling-controller@14.0.2
279
301
  [14.0.1]: https://github.com/MetaMask/core/compare/@metamask/polling-controller@14.0.0...@metamask/polling-controller@14.0.1
@@ -19,8 +19,6 @@ exports.getKey = getKey;
19
19
  * @param Base - The base class to mix onto.
20
20
  * @returns The composed class.
21
21
  */
22
- // TODO: Either fix this lint violation or explain why it's necessary to ignore.
23
- // eslint-disable-next-line @typescript-eslint/naming-convention
24
22
  function AbstractPollingControllerBaseMixin(Base) {
25
23
  var _AbstractPollingControllerBase_pollingTokenSets, _AbstractPollingControllerBase_callbacks;
26
24
  class AbstractPollingControllerBase extends Base {
@@ -1 +1 @@
1
- {"version":3,"file":"AbstractPollingController.cjs","sourceRoot":"","sources":["../src/AbstractPollingController.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,4FAAmD;AACnD,+BAAoC;AAQ7B,MAAM,MAAM,GAAG,CAAe,KAAmB,EAAqB,EAAE,CAC7E,IAAA,oCAAS,EAAC,KAAK,CAAC,CAAC;AADN,QAAA,MAAM,UACA;AAEnB;;;;;GAKG;AACH,gFAAgF;AAChF,gEAAgE;AAChE,SAAgB,kCAAkC,CAGhD,IAAW;;IACX,MAAe,6BACb,SAAQ,IAAI;QADd;;YAIW,0DAAyD,IAAI,GAAG,EAAE,EAAC;YAE5E,mDACE,IAAI,GAAG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IAAI,CAAC,+BAA+B,CAAC,WAAW,CAAC,CAAC;gBAClD,uBAAA,IAAI,uDAAkB,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;gBAC3C,MAAM,SAAS,GAAG,uBAAA,IAAI,gDAAW,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;gBACnD,IAAI,SAAS,EAAE;oBACb,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE;wBAChC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC;qBACnC;oBACD,SAAS,CAAC,KAAK,EAAE,CAAC;iBACnB;aACF;QACH,CAAC;QAED,iBAAiB,CACf,KAAmB,EACnB,QAAuC;YAEvC,MAAM,GAAG,GAAG,IAAA,cAAM,EAAC,KAAK,CAAC,CAAC;YAC1B,MAAM,SAAS,GAAG,uBAAA,IAAI,gDAAW,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,IAAI,GAAG,EAAmB,CAAC;YACzE,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YACxB,uBAAA,IAAI,gDAAW,CAAC,GAAG,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;QACtC,CAAC;KACF;;IACD,OAAO,6BAA6B,CAAC;AACvC,CAAC;AAjFD,gFAiFC","sourcesContent":["import type { Json } from '@metamask/utils';\nimport stringify from 'fast-json-stable-stringify';\nimport { v4 as random } from 'uuid';\n\nimport type {\n Constructor,\n PollingTokenSetId,\n IPollingController,\n} from './types';\n\nexport const getKey = <PollingInput>(input: PollingInput): PollingTokenSetId =>\n stringify(input);\n\n/**\n * AbstractPollingControllerBaseMixin\n *\n * @param Base - The base class to mix onto.\n * @returns The composed class.\n */\n// TODO: Either fix this lint violation or explain why it's necessary to ignore.\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function AbstractPollingControllerBaseMixin<\n TBase extends Constructor,\n PollingInput extends Json,\n>(Base: TBase) {\n abstract class AbstractPollingControllerBase\n extends Base\n implements IPollingController<PollingInput>\n {\n readonly #pollingTokenSets: Map<PollingTokenSetId, Set<string>> = new Map();\n\n #callbacks: Map<PollingTokenSetId, Set<(input: PollingInput) => void>> =\n new Map();\n\n abstract _executePoll(input: PollingInput): Promise<void>;\n\n abstract _startPolling(input: PollingInput): void;\n\n abstract _stopPollingByPollingTokenSetId(key: PollingTokenSetId): void;\n\n startPolling(input: PollingInput): string {\n const pollToken = random();\n const key = getKey(input);\n const pollingTokenSet =\n this.#pollingTokenSets.get(key) ?? new Set<string>();\n pollingTokenSet.add(pollToken);\n this.#pollingTokenSets.set(key, pollingTokenSet);\n\n if (pollingTokenSet.size === 1) {\n this._startPolling(input);\n }\n\n return pollToken;\n }\n\n stopAllPolling() {\n this.#pollingTokenSets.forEach((tokenSet, _key) => {\n tokenSet.forEach((token) => {\n this.stopPollingByPollingToken(token);\n });\n });\n }\n\n stopPollingByPollingToken(pollingToken: string) {\n if (!pollingToken) {\n throw new Error('pollingToken required');\n }\n\n let keyToDelete: PollingTokenSetId | null = null;\n for (const [key, tokenSet] of this.#pollingTokenSets) {\n if (tokenSet.delete(pollingToken)) {\n if (tokenSet.size === 0) {\n keyToDelete = key;\n }\n break;\n }\n }\n\n if (keyToDelete) {\n this._stopPollingByPollingTokenSetId(keyToDelete);\n this.#pollingTokenSets.delete(keyToDelete);\n const callbacks = this.#callbacks.get(keyToDelete);\n if (callbacks) {\n for (const callback of callbacks) {\n callback(JSON.parse(keyToDelete));\n }\n callbacks.clear();\n }\n }\n }\n\n onPollingComplete(\n input: PollingInput,\n callback: (input: PollingInput) => void,\n ) {\n const key = getKey(input);\n const callbacks = this.#callbacks.get(key) ?? new Set<typeof callback>();\n callbacks.add(callback);\n this.#callbacks.set(key, callbacks);\n }\n }\n return AbstractPollingControllerBase;\n}\n"]}
1
+ {"version":3,"file":"AbstractPollingController.cjs","sourceRoot":"","sources":["../src/AbstractPollingController.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,4FAAmD;AACnD,+BAAoC;AAQ7B,M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,CAAC;YACjD,KAAK,MAAM,CAAC,GAAG,EAAE,QAAQ,CAAC,IAAI,uBAAA,IAAI,uDAAkB,EAAE,CAAC;gBACrD,IAAI,QAAQ,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,CAAC;oBAClC,IAAI,QAAQ,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;wBACxB,WAAW,GAAG,GAAG,CAAC;oBACpB,CAAC;oBACD,MAAM;gBACR,CAAC;YACH,CAAC;YAED,IAAI,WAAW,EAAE,CAAC;gBAChB,IAAI,CAAC,+BAA+B,CAAC,WAAW,CAAC,CAAC;gBAClD,uBAAA,IAAI,uDAAkB,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;gBAC3C,MAAM,SAAS,GAAG,uBAAA,IAAI,gDAAW,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;gBACnD,IAAI,SAAS,EAAE,CAAC;oBACd,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;wBACjC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC;oBACpC,CAAC;oBACD,SAAS,CAAC,KAAK,EAAE,CAAC;gBACpB,CAAC;YACH,CAAC;QACH,CAAC;QAED,iBAAiB,CACf,KAAmB,EACnB,QAAuC;YAEvC,MAAM,GAAG,GAAG,IAAA,cAAM,EAAC,KAAK,CAAC,CAAC;YAC1B,MAAM,SAAS,GAAG,uBAAA,IAAI,gDAAW,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,IAAI,GAAG,EAAmB,CAAC;YACzE,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YACxB,uBAAA,IAAI,gDAAW,CAAC,GAAG,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;QACtC,CAAC;KACF;;IACD,OAAO,6BAA6B,CAAC;AACvC,CAAC;AAnFD,gFAmFC","sourcesContent":["import type { Json } from '@metamask/utils';\nimport stringify from 'fast-json-stable-stringify';\nimport { v4 as random } from 'uuid';\n\nimport type {\n Constructor,\n PollingTokenSetId,\n IPollingController,\n} from './types';\n\nexport const getKey = <PollingInput>(input: PollingInput): PollingTokenSetId =>\n stringify(input);\n\n/**\n * AbstractPollingControllerBaseMixin\n *\n * @param Base - The base class to mix onto.\n * @returns The composed class.\n */\nexport function AbstractPollingControllerBaseMixin<\n TBase extends Constructor,\n PollingInput extends Json,\n>(Base: TBase) {\n abstract class AbstractPollingControllerBase\n extends Base\n implements IPollingController<PollingInput>\n {\n readonly #pollingTokenSets: Map<PollingTokenSetId, Set<string>> = new Map();\n\n readonly #callbacks: Map<\n PollingTokenSetId,\n Set<(input: PollingInput) => void>\n > = new Map();\n\n abstract _executePoll(input: PollingInput): Promise<void>;\n\n abstract _startPolling(input: PollingInput): void;\n\n abstract _stopPollingByPollingTokenSetId(key: PollingTokenSetId): void;\n\n startPolling(input: PollingInput): string {\n const pollToken = random();\n const key = getKey(input);\n const pollingTokenSet =\n this.#pollingTokenSets.get(key) ?? new Set<string>();\n pollingTokenSet.add(pollToken);\n this.#pollingTokenSets.set(key, pollingTokenSet);\n\n if (pollingTokenSet.size === 1) {\n this._startPolling(input);\n }\n\n return pollToken;\n }\n\n stopAllPolling() {\n this.#pollingTokenSets.forEach((tokenSet, _key) => {\n tokenSet.forEach((token) => {\n this.stopPollingByPollingToken(token);\n });\n });\n }\n\n stopPollingByPollingToken(pollingToken: string) {\n if (!pollingToken) {\n throw new Error('pollingToken required');\n }\n\n let keyToDelete: PollingTokenSetId | null = null;\n for (const [key, tokenSet] of this.#pollingTokenSets) {\n if (tokenSet.delete(pollingToken)) {\n if (tokenSet.size === 0) {\n keyToDelete = key;\n }\n break;\n }\n }\n\n if (keyToDelete) {\n this._stopPollingByPollingTokenSetId(keyToDelete);\n this.#pollingTokenSets.delete(keyToDelete);\n const callbacks = this.#callbacks.get(keyToDelete);\n if (callbacks) {\n for (const callback of callbacks) {\n callback(JSON.parse(keyToDelete));\n }\n callbacks.clear();\n }\n }\n }\n\n onPollingComplete(\n input: PollingInput,\n callback: (input: PollingInput) => void,\n ) {\n const key = getKey(input);\n const callbacks = this.#callbacks.get(key) ?? new Set<typeof callback>();\n callbacks.add(callback);\n this.#callbacks.set(key, callbacks);\n }\n }\n return AbstractPollingControllerBase;\n}\n"]}
@@ -9,7 +9,7 @@ export declare const getKey: <PollingInput>(input: PollingInput) => PollingToken
9
9
  */
10
10
  export declare function AbstractPollingControllerBaseMixin<TBase extends Constructor, PollingInput extends Json>(Base: TBase): (abstract new (...args: any[]) => {
11
11
  readonly "__#3@#pollingTokenSets": Map<PollingTokenSetId, Set<string>>;
12
- "__#3@#callbacks": Map<string, Set<(input: PollingInput) => void>>;
12
+ readonly "__#3@#callbacks": Map<string, Set<(input: PollingInput) => void>>;
13
13
  _executePoll(input: PollingInput): Promise<void>;
14
14
  _startPolling(input: PollingInput): void;
15
15
  _stopPollingByPollingTokenSetId(key: PollingTokenSetId): void;
@@ -1 +1 @@
1
- {"version":3,"file":"AbstractPollingController.d.cts","sourceRoot":"","sources":["../src/AbstractPollingController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,wBAAwB;AAI5C,OAAO,KAAK,EACV,WAAW,EACX,iBAAiB,EAElB,oBAAgB;AAEjB,eAAO,MAAM,MAAM,yCAAwC,iBACzC,CAAC;AAEnB;;;;;GAKG;AAGH,wBAAgB,kCAAkC,CAChD,KAAK,SAAS,WAAW,EACzB,YAAY,SAAS,IAAI,EACzB,IAAI,EAAE,KAAK;uCAKmB,IAAI,iBAAiB,EAAE,IAAI,MAAM,CAAC,CAAC;+CAEhB,YAAY,KAAK,IAAI;wBAGvC,YAAY,GAAG,QAAQ,IAAI,CAAC;yBAE3B,YAAY,GAAG,IAAI;yCAEH,iBAAiB,GAAG,IAAI;wBAElD,YAAY,GAAG,MAAM;;4CAuBD,MAAM;6BA6BrC,YAAY,oBACD,YAAY,KAAK,IAAI;WAS5C"}
1
+ {"version":3,"file":"AbstractPollingController.d.cts","sourceRoot":"","sources":["../src/AbstractPollingController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,wBAAwB;AAI5C,OAAO,KAAK,EACV,WAAW,EACX,iBAAiB,EAElB,oBAAgB;AAEjB,eAAO,MAAM,MAAM,yCAAwC,iBACzC,CAAC;AAEnB;;;;;GAKG;AACH,wBAAgB,kCAAkC,CAChD,KAAK,SAAS,WAAW,EACzB,YAAY,SAAS,IAAI,EACzB,IAAI,EAAE,KAAK;uCAKmB,IAAI,iBAAiB,EAAE,IAAI,MAAM,CAAC,CAAC;wDAIjD,YAAY,KAAK,IAAI;wBAGN,YAAY,GAAG,QAAQ,IAAI,CAAC;yBAE3B,YAAY,GAAG,IAAI;yCAEH,iBAAiB,GAAG,IAAI;wBAElD,YAAY,GAAG,MAAM;;4CAuBD,MAAM;6BA6BrC,YAAY,oBACD,YAAY,KAAK,IAAI;WAS5C"}
@@ -9,7 +9,7 @@ export declare const getKey: <PollingInput>(input: PollingInput) => PollingToken
9
9
  */
10
10
  export declare function AbstractPollingControllerBaseMixin<TBase extends Constructor, PollingInput extends Json>(Base: TBase): (abstract new (...args: any[]) => {
11
11
  readonly "__#3@#pollingTokenSets": Map<PollingTokenSetId, Set<string>>;
12
- "__#3@#callbacks": Map<string, Set<(input: PollingInput) => void>>;
12
+ readonly "__#3@#callbacks": Map<string, Set<(input: PollingInput) => void>>;
13
13
  _executePoll(input: PollingInput): Promise<void>;
14
14
  _startPolling(input: PollingInput): void;
15
15
  _stopPollingByPollingTokenSetId(key: PollingTokenSetId): void;
@@ -1 +1 @@
1
- {"version":3,"file":"AbstractPollingController.d.mts","sourceRoot":"","sources":["../src/AbstractPollingController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,wBAAwB;AAI5C,OAAO,KAAK,EACV,WAAW,EACX,iBAAiB,EAElB,oBAAgB;AAEjB,eAAO,MAAM,MAAM,yCAAwC,iBACzC,CAAC;AAEnB;;;;;GAKG;AAGH,wBAAgB,kCAAkC,CAChD,KAAK,SAAS,WAAW,EACzB,YAAY,SAAS,IAAI,EACzB,IAAI,EAAE,KAAK;uCAKmB,IAAI,iBAAiB,EAAE,IAAI,MAAM,CAAC,CAAC;+CAEhB,YAAY,KAAK,IAAI;wBAGvC,YAAY,GAAG,QAAQ,IAAI,CAAC;yBAE3B,YAAY,GAAG,IAAI;yCAEH,iBAAiB,GAAG,IAAI;wBAElD,YAAY,GAAG,MAAM;;4CAuBD,MAAM;6BA6BrC,YAAY,oBACD,YAAY,KAAK,IAAI;WAS5C"}
1
+ {"version":3,"file":"AbstractPollingController.d.mts","sourceRoot":"","sources":["../src/AbstractPollingController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,wBAAwB;AAI5C,OAAO,KAAK,EACV,WAAW,EACX,iBAAiB,EAElB,oBAAgB;AAEjB,eAAO,MAAM,MAAM,yCAAwC,iBACzC,CAAC;AAEnB;;;;;GAKG;AACH,wBAAgB,kCAAkC,CAChD,KAAK,SAAS,WAAW,EACzB,YAAY,SAAS,IAAI,EACzB,IAAI,EAAE,KAAK;uCAKmB,IAAI,iBAAiB,EAAE,IAAI,MAAM,CAAC,CAAC;wDAIjD,YAAY,KAAK,IAAI;wBAGN,YAAY,GAAG,QAAQ,IAAI,CAAC;yBAE3B,YAAY,GAAG,IAAI;yCAEH,iBAAiB,GAAG,IAAI;wBAElD,YAAY,GAAG,MAAM;;4CAuBD,MAAM;6BA6BrC,YAAY,oBACD,YAAY,KAAK,IAAI;WAS5C"}
@@ -19,8 +19,6 @@ export const getKey = (input) => stringify(input);
19
19
  * @param Base - The base class to mix onto.
20
20
  * @returns The composed class.
21
21
  */
22
- // TODO: Either fix this lint violation or explain why it's necessary to ignore.
23
- // eslint-disable-next-line @typescript-eslint/naming-convention
24
22
  export function AbstractPollingControllerBaseMixin(Base) {
25
23
  var _AbstractPollingControllerBase_pollingTokenSets, _AbstractPollingControllerBase_callbacks;
26
24
  class AbstractPollingControllerBase extends Base {
@@ -1 +1 @@
1
- {"version":3,"file":"AbstractPollingController.mjs","sourceRoot":"","sources":["../src/AbstractPollingController.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,OAAO,UAAS,mCAAmC;;AACnD,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,aAAa;AAQpC,MAAM,CAAC,MAAM,MAAM,GAAG,CAAe,KAAmB,EAAqB,EAAE,CAC7E,SAAS,CAAC,KAAK,CAAC,CAAC;AAEnB;;;;;GAKG;AACH,gFAAgF;AAChF,gEAAgE;AAChE,MAAM,UAAU,kCAAkC,CAGhD,IAAW;;IACX,MAAe,6BACb,SAAQ,IAAI;QADd;;YAIW,0DAAyD,IAAI,GAAG,EAAE,EAAC;YAE5E,mDACE,IAAI,GAAG,EAAE,EAAC;QAoEd,CAAC;QA5DC,YAAY,CAAC,KAAmB;YAC9B,MAAM,SAAS,GAAG,MAAM,EAAE,CAAC;YAC3B,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;YAC1B,MAAM,eAAe,GACnB,uBAAA,IAAI,uDAAkB,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,IAAI,GAAG,EAAU,CAAC;YACvD,eAAe,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;YAC/B,uBAAA,IAAI,uDAAkB,CAAC,GAAG,CAAC,GAAG,EAAE,eAAe,CAAC,CAAC;YAEjD,IAAI,eAAe,CAAC,IAAI,KAAK,CAAC,EAAE;gBAC9B,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;aAC3B;YAED,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,cAAc;YACZ,uBAAA,IAAI,uDAAkB,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,IAAI,EAAE,EAAE;gBAChD,QAAQ,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;oBACzB,IAAI,CAAC,yBAAyB,CAAC,KAAK,CAAC,CAAC;gBACxC,CAAC,CAAC,CAAC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AACvC,CAAC","sourcesContent":["import type { Json } from '@metamask/utils';\nimport stringify from 'fast-json-stable-stringify';\nimport { v4 as random } from 'uuid';\n\nimport type {\n Constructor,\n PollingTokenSetId,\n IPollingController,\n} from './types';\n\nexport const getKey = <PollingInput>(input: PollingInput): PollingTokenSetId =>\n stringify(input);\n\n/**\n * AbstractPollingControllerBaseMixin\n *\n * @param Base - The base class to mix onto.\n * @returns The composed class.\n */\n// TODO: Either fix this lint violation or explain why it's necessary to ignore.\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function AbstractPollingControllerBaseMixin<\n TBase extends Constructor,\n PollingInput extends Json,\n>(Base: TBase) {\n abstract class AbstractPollingControllerBase\n extends Base\n implements IPollingController<PollingInput>\n {\n readonly #pollingTokenSets: Map<PollingTokenSetId, Set<string>> = new Map();\n\n #callbacks: Map<PollingTokenSetId, Set<(input: PollingInput) => void>> =\n new Map();\n\n abstract _executePoll(input: PollingInput): Promise<void>;\n\n abstract _startPolling(input: PollingInput): void;\n\n abstract _stopPollingByPollingTokenSetId(key: PollingTokenSetId): void;\n\n startPolling(input: PollingInput): string {\n const pollToken = random();\n const key = getKey(input);\n const pollingTokenSet =\n this.#pollingTokenSets.get(key) ?? new Set<string>();\n pollingTokenSet.add(pollToken);\n this.#pollingTokenSets.set(key, pollingTokenSet);\n\n if (pollingTokenSet.size === 1) {\n this._startPolling(input);\n }\n\n return pollToken;\n }\n\n stopAllPolling() {\n this.#pollingTokenSets.forEach((tokenSet, _key) => {\n tokenSet.forEach((token) => {\n this.stopPollingByPollingToken(token);\n });\n });\n }\n\n stopPollingByPollingToken(pollingToken: string) {\n if (!pollingToken) {\n throw new Error('pollingToken required');\n }\n\n let keyToDelete: PollingTokenSetId | null = null;\n for (const [key, tokenSet] of this.#pollingTokenSets) {\n if (tokenSet.delete(pollingToken)) {\n if (tokenSet.size === 0) {\n keyToDelete = key;\n }\n break;\n }\n }\n\n if (keyToDelete) {\n this._stopPollingByPollingTokenSetId(keyToDelete);\n this.#pollingTokenSets.delete(keyToDelete);\n const callbacks = this.#callbacks.get(keyToDelete);\n if (callbacks) {\n for (const callback of callbacks) {\n callback(JSON.parse(keyToDelete));\n }\n callbacks.clear();\n }\n }\n }\n\n onPollingComplete(\n input: PollingInput,\n callback: (input: PollingInput) => void,\n ) {\n const key = getKey(input);\n const callbacks = this.#callbacks.get(key) ?? new Set<typeof callback>();\n callbacks.add(callback);\n this.#callbacks.set(key, callbacks);\n }\n }\n return AbstractPollingControllerBase;\n}\n"]}
1
+ {"version":3,"file":"AbstractPollingController.mjs","sourceRoot":"","sources":["../src/AbstractPollingController.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,OAAO,UAAS,mCAAmC;;AACnD,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,aAAa;AAQpC,MAAM,CAAC,MAAM,MAAM,GAAG,CAAe,KAAmB,EAAqB,EAAE,CAC7E,SAAS,CAAC,KAAK,CAAC,CAAC;AAEnB;;;;;GAKG;AACH,MAAM,UAAU,kCAAkC,CAGhD,IAAW;;IACX,MAAe,6BACb,SAAQ,IAAI;QADd;;YAIW,0DAAyD,IAAI,GAAG,EAAE,EAAC;YAEnE,mDAGL,IAAI,GAAG,EAAE,EAAC;QAoEhB,CAAC;QA5DC,YAAY,CAAC,KAAmB;YAC9B,MAAM,SAAS,GAAG,MAAM,EAAE,CAAC;YAC3B,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;YAC1B,MAAM,eAAe,GACnB,uBAAA,IAAI,uDAAkB,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,IAAI,GAAG,EAAU,CAAC;YACvD,eAAe,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;YAC/B,uBAAA,IAAI,uDAAkB,CAAC,GAAG,CAAC,GAAG,EAAE,eAAe,CAAC,CAAC;YAEjD,IAAI,eAAe,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;gBAC/B,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC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AAiB,CACf,KAAmB,EACnB,QAAuC;YAEvC,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;YAC1B,MAAM,SAAS,GAAG,uBAAA,IAAI,gDAAW,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,IAAI,GAAG,EAAmB,CAAC;YACzE,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YACxB,uBAAA,IAAI,gDAAW,CAAC,GAAG,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;QACtC,CAAC;KACF;;IACD,OAAO,6BAA6B,CAAC;AACvC,CAAC","sourcesContent":["import type { Json } from '@metamask/utils';\nimport stringify from 'fast-json-stable-stringify';\nimport { v4 as random } from 'uuid';\n\nimport type {\n Constructor,\n PollingTokenSetId,\n IPollingController,\n} from './types';\n\nexport const getKey = <PollingInput>(input: PollingInput): PollingTokenSetId =>\n stringify(input);\n\n/**\n * AbstractPollingControllerBaseMixin\n *\n * @param Base - The base class to mix onto.\n * @returns The composed class.\n */\nexport function AbstractPollingControllerBaseMixin<\n TBase extends Constructor,\n PollingInput extends Json,\n>(Base: TBase) {\n abstract class AbstractPollingControllerBase\n extends Base\n implements IPollingController<PollingInput>\n {\n readonly #pollingTokenSets: Map<PollingTokenSetId, Set<string>> = new Map();\n\n readonly #callbacks: Map<\n PollingTokenSetId,\n Set<(input: PollingInput) => void>\n > = new Map();\n\n abstract _executePoll(input: PollingInput): Promise<void>;\n\n abstract _startPolling(input: PollingInput): void;\n\n abstract _stopPollingByPollingTokenSetId(key: PollingTokenSetId): void;\n\n startPolling(input: PollingInput): string {\n const pollToken = random();\n const key = getKey(input);\n const pollingTokenSet =\n this.#pollingTokenSets.get(key) ?? new Set<string>();\n pollingTokenSet.add(pollToken);\n this.#pollingTokenSets.set(key, pollingTokenSet);\n\n if (pollingTokenSet.size === 1) {\n this._startPolling(input);\n }\n\n return pollToken;\n }\n\n stopAllPolling() {\n this.#pollingTokenSets.forEach((tokenSet, _key) => {\n tokenSet.forEach((token) => {\n this.stopPollingByPollingToken(token);\n });\n });\n }\n\n stopPollingByPollingToken(pollingToken: string) {\n if (!pollingToken) {\n throw new Error('pollingToken required');\n }\n\n let keyToDelete: PollingTokenSetId | null = null;\n for (const [key, tokenSet] of this.#pollingTokenSets) {\n if (tokenSet.delete(pollingToken)) {\n if (tokenSet.size === 0) {\n keyToDelete = key;\n }\n break;\n }\n }\n\n if (keyToDelete) {\n this._stopPollingByPollingTokenSetId(keyToDelete);\n this.#pollingTokenSets.delete(keyToDelete);\n const callbacks = this.#callbacks.get(keyToDelete);\n if (callbacks) {\n for (const callback of callbacks) {\n callback(JSON.parse(keyToDelete));\n }\n callbacks.clear();\n }\n }\n }\n\n onPollingComplete(\n input: PollingInput,\n callback: (input: PollingInput) => void,\n ) {\n const key = getKey(input);\n const callbacks = this.#callbacks.get(key) ?? new Set<typeof callback>();\n callbacks.add(callback);\n this.#callbacks.set(key, callbacks);\n }\n }\n return AbstractPollingControllerBase;\n}\n"]}
@@ -15,8 +15,9 @@ const AbstractPollingController_1 = require("./AbstractPollingController.cjs");
15
15
  * @param Base - The base class to mix onto.
16
16
  * @returns The composed class.
17
17
  */
18
- // TODO: Either fix this lint violation or explain why it's necessary to ignore.
19
- // eslint-disable-next-line @typescript-eslint/naming-convention
18
+ // This is a function that's used as class, and the return type is inferred from
19
+ // the class defined inside the function scope, so this can't be easily typed.
20
+ // eslint-disable-next-line @typescript-eslint/explicit-function-return-type, @typescript-eslint/naming-convention
20
21
  function BlockTrackerPollingControllerMixin(Base) {
21
22
  var _BlockTrackerPollingController_activeListeners;
22
23
  class BlockTrackerPollingController extends (0, AbstractPollingController_1.AbstractPollingControllerBaseMixin)(Base) {
@@ -38,10 +39,7 @@ function BlockTrackerPollingControllerMixin(Base) {
38
39
  __classPrivateFieldGet(this, _BlockTrackerPollingController_activeListeners, "f")[key] = updateOnNewBlock;
39
40
  }
40
41
  else {
41
- throw new Error(
42
- // TODO: Either fix this lint violation or explain why it's necessary to ignore.
43
- // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
44
- `Unable to retrieve blockTracker for networkClientId ${input.networkClientId}`);
42
+ throw new Error(`Unable to retrieve blockTracker for networkClientId ${input.networkClientId}`);
45
43
  }
46
44
  }
47
45
  _stopPollingByPollingTokenSetId(key) {
@@ -1 +1 @@
1
- {"version":3,"file":"BlockTrackerPollingController.cjs","sourceRoot":"","sources":["../src/BlockTrackerPollingController.ts"],"names":[],"mappings":";;;;;;;;AAAA,+DAA2D;AAO3D,+EAGqC;AAWrC;;;;;;GAMG;AACH,gFAAgF;AAChF,gEAAgE;AAChE,SAAS,kCAAkC,CAGzC,IAAW;;IACX,MAAe,6BAA8B,SAAQ,IAAA,8DAAkC,EAGrF,IAAI,CAAC;QAHP;;YAIE,yDAAqE,EAAE,EAAC;QA6C1E,CAAC;QAvCC,aAAa,CAAC,KAAmB;YAC/B,MAAM,GAAG,GAAG,IAAA,kCAAM,EAAC,KAAK,CAAC,CAAC;YAE1B,IAAI,uBAAA,IAAI,sDAAiB,CAAC,GAAG,CAAC,EAAE;gBAC9B,OAAO;aACR;YAED,MAAM,aAAa,GAAG,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;YACxE,IAAI,aAAa,EAAE;gBACjB,MAAM,gBAAgB,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;gBAC7D,gFAAgF;gBAChF,kEAAkE;gBAClE,aAAa,CAAC,YAAY,CAAC,WAAW,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC;gBACnE,uBAAA,IAAI,sDAAiB,CAAC,GAAG,CAAC,GAAG,gBAAgB,CAAC;aAC/C;iBAAM;gBACL,MAAM,IAAI,KAAK;gBACb,gFAAgF;gBAChF,4EAA4E;gBAC5E,uDAAuD,KAAK,CAAC,eAAe,EAAE,CAC/E,CAAC;aACH;QACH,CAAC;QAED,+BAA+B,CAAC,GAAsB;YACpD,MAAM,EAAE,eAAe,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAC5C,MAAM,aAAa,GAAG,IAAI,CAAC,qBAAqB,CAC9C,eAAkC,CACnC,CAAC;YAEF,IAAI,aAAa,IAAI,uBAAA,IAAI,sDAAiB,CAAC,GAAG,CAAC,EAAE;gBAC/C,MAAM,QAAQ,GAAG,uBAAA,IAAI,sDAAiB,CAAC,GAAG,CAAC,CAAC;gBAC5C,IAAI,QAAQ,EAAE;oBACZ,gFAAgF;oBAChF,kEAAkE;oBAClE,aAAa,CAAC,YAAY,CAAC,cAAc,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;oBAC9D,OAAO,uBAAA,IAAI,sDAAiB,CAAC,GAAG,CAAC,CAAC;iBACnC;aACF;QACH,CAAC;KACF;;IAED,OAAO,6BAA6B,CAAC;AACvC,CAAC;AAED,MAAM,KAAK;CAAG;AAEP,MAAM,iCAAiC,GAAG,GAE7C,EAAE,CAAC,kCAAkC,CAA6B,KAAK,CAAC,CAAC;AAFhE,QAAA,iCAAiC,qCAE+B;AAEtE,MAAM,6BAA6B,GAAG,GAEzC,EAAE,CACJ,kCAAkC,CAChC,gCAAc,CACf,CAAC;AALS,QAAA,6BAA6B,iCAKtC","sourcesContent":["import { BaseController } from '@metamask/base-controller';\nimport type {\n NetworkClientId,\n NetworkClient,\n} from '@metamask/network-controller';\nimport type { Json } from '@metamask/utils';\n\nimport {\n AbstractPollingControllerBaseMixin,\n getKey,\n} from './AbstractPollingController';\nimport type { Constructor, PollingTokenSetId } from './types';\n\n/**\n * The minimum input required to start polling for a {@link BlockTrackerPollingController}.\n * Implementing classes may provide additional properties.\n */\nexport type BlockTrackerPollingInput = {\n networkClientId: NetworkClientId;\n};\n\n/**\n * BlockTrackerPollingControllerMixin\n * A polling controller that polls using a block tracker.\n *\n * @param Base - The base class to mix onto.\n * @returns The composed class.\n */\n// TODO: Either fix this lint violation or explain why it's necessary to ignore.\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction BlockTrackerPollingControllerMixin<\n TBase extends Constructor,\n PollingInput extends BlockTrackerPollingInput,\n>(Base: TBase) {\n abstract class BlockTrackerPollingController extends AbstractPollingControllerBaseMixin<\n TBase,\n PollingInput\n >(Base) {\n #activeListeners: Record<string, (options: Json) => Promise<void>> = {};\n\n abstract _getNetworkClientById(\n networkClientId: NetworkClientId,\n ): NetworkClient | undefined;\n\n _startPolling(input: PollingInput) {\n const key = getKey(input);\n\n if (this.#activeListeners[key]) {\n return;\n }\n\n const networkClient = this._getNetworkClientById(input.networkClientId);\n if (networkClient) {\n const updateOnNewBlock = this._executePoll.bind(this, input);\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n networkClient.blockTracker.addListener('latest', updateOnNewBlock);\n this.#activeListeners[key] = updateOnNewBlock;\n } else {\n throw new Error(\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/restrict-template-expressions\n `Unable to retrieve blockTracker for networkClientId ${input.networkClientId}`,\n );\n }\n }\n\n _stopPollingByPollingTokenSetId(key: PollingTokenSetId) {\n const { networkClientId } = JSON.parse(key);\n const networkClient = this._getNetworkClientById(\n networkClientId as NetworkClientId,\n );\n\n if (networkClient && this.#activeListeners[key]) {\n const listener = this.#activeListeners[key];\n if (listener) {\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n networkClient.blockTracker.removeListener('latest', listener);\n delete this.#activeListeners[key];\n }\n }\n }\n }\n\n return BlockTrackerPollingController;\n}\n\nclass Empty {}\n\nexport const BlockTrackerPollingControllerOnly = <\n PollingInput extends BlockTrackerPollingInput,\n>() => BlockTrackerPollingControllerMixin<typeof Empty, PollingInput>(Empty);\n\nexport const BlockTrackerPollingController = <\n PollingInput extends BlockTrackerPollingInput,\n>() =>\n BlockTrackerPollingControllerMixin<typeof BaseController, PollingInput>(\n BaseController,\n );\n"]}
1
+ {"version":3,"file":"BlockTrackerPollingController.cjs","sourceRoot":"","sources":["../src/BlockTrackerPollingController.ts"],"names":[],"mappings":";;;;;;;;AAAA,+DAA2D;AAO3D,+EAGqC;AAWrC;;;;;;GAMG;AACH,gFAAgF;AAChF,8EAA8E;AAC9E,kHAAkH;AAClH,SAAS,kCAAkC,CAGzC,IAAW;;IACX,MAAe,6BAA8B,SAAQ,IAAA,8DAAkC,EAGrF,IAAI,CAAC;QAHP;;YAIE,yDAAqE,EAAE,EAAC;QA2C1E,CAAC;QArCC,aAAa,CAAC,KAAmB;YAC/B,MAAM,GAAG,GAAG,IAAA,kCAAM,EAAC,KAAK,CAAC,CAAC;YAE1B,IAAI,uBAAA,IAAI,sDAAiB,CAAC,GAAG,CAAC,EAAE,CAAC;gBAC/B,OAAO;YACT,CAAC;YAED,MAAM,aAAa,GAAG,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;YACxE,IAAI,aAAa,EAAE,CAAC;gBAClB,MAAM,gBAAgB,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;gBAC7D,gFAAgF;gBAChF,kEAAkE;gBAClE,aAAa,CAAC,YAAY,CAAC,WAAW,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC;gBACnE,uBAAA,IAAI,sDAAiB,CAAC,GAAG,CAAC,GAAG,gBAAgB,CAAC;YAChD,CAAC;iBAAM,CAAC;gBACN,MAAM,IAAI,KAAK,CACb,uDAAuD,KAAK,CAAC,eAAe,EAAE,CAC/E,CAAC;YACJ,CAAC;QACH,CAAC;QAED,+BAA+B,CAAC,GAAsB;YACpD,MAAM,EAAE,eAAe,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAC5C,MAAM,aAAa,GAAG,IAAI,CAAC,qBAAqB,CAC9C,eAAkC,CACnC,CAAC;YAEF,IAAI,aAAa,IAAI,uBAAA,IAAI,sDAAiB,CAAC,GAAG,CAAC,EAAE,CAAC;gBAChD,MAAM,QAAQ,GAAG,uBAAA,IAAI,sDAAiB,CAAC,GAAG,CAAC,CAAC;gBAC5C,IAAI,QAAQ,EAAE,CAAC;oBACb,gFAAgF;oBAChF,kEAAkE;oBAClE,aAAa,CAAC,YAAY,CAAC,cAAc,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;oBAC9D,OAAO,uBAAA,IAAI,sDAAiB,CAAC,GAAG,CAAC,CAAC;gBACpC,CAAC;YACH,CAAC;QACH,CAAC;KACF;;IAED,OAAO,6BAA6B,CAAC;AACvC,CAAC;AAED,MAAM,KAAK;CAAG;AAEP,MAAM,iCAAiC,GAAG,GAK7C,EAAE,CAAC,kCAAkC,CAA6B,KAAK,CAAC,CAAC;AALhE,QAAA,iCAAiC,qCAK+B;AAEtE,MAAM,6BAA6B,GAAG,GAKzC,EAAE,CACJ,kCAAkC,CAChC,gCAAc,CACf,CAAC;AARS,QAAA,6BAA6B,iCAQtC","sourcesContent":["import { BaseController } from '@metamask/base-controller';\nimport type {\n NetworkClientId,\n NetworkClient,\n} from '@metamask/network-controller';\nimport type { Json } from '@metamask/utils';\n\nimport {\n AbstractPollingControllerBaseMixin,\n getKey,\n} from './AbstractPollingController';\nimport type { Constructor, PollingTokenSetId } from './types';\n\n/**\n * The minimum input required to start polling for a {@link BlockTrackerPollingController}.\n * Implementing classes may provide additional properties.\n */\nexport type BlockTrackerPollingInput = {\n networkClientId: NetworkClientId;\n};\n\n/**\n * BlockTrackerPollingControllerMixin\n * A polling controller that polls using a block tracker.\n *\n * @param Base - The base class to mix onto.\n * @returns The composed class.\n */\n// This is a function that's used as class, and the return type is inferred from\n// the class defined inside the function scope, so this can't be easily typed.\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type, @typescript-eslint/naming-convention\nfunction BlockTrackerPollingControllerMixin<\n TBase extends Constructor,\n PollingInput extends BlockTrackerPollingInput,\n>(Base: TBase) {\n abstract class BlockTrackerPollingController extends AbstractPollingControllerBaseMixin<\n TBase,\n PollingInput\n >(Base) {\n #activeListeners: Record<string, (options: Json) => Promise<void>> = {};\n\n abstract _getNetworkClientById(\n networkClientId: NetworkClientId,\n ): NetworkClient | undefined;\n\n _startPolling(input: PollingInput): void {\n const key = getKey(input);\n\n if (this.#activeListeners[key]) {\n return;\n }\n\n const networkClient = this._getNetworkClientById(input.networkClientId);\n if (networkClient) {\n const updateOnNewBlock = this._executePoll.bind(this, input);\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n networkClient.blockTracker.addListener('latest', updateOnNewBlock);\n this.#activeListeners[key] = updateOnNewBlock;\n } else {\n throw new Error(\n `Unable to retrieve blockTracker for networkClientId ${input.networkClientId}`,\n );\n }\n }\n\n _stopPollingByPollingTokenSetId(key: PollingTokenSetId): void {\n const { networkClientId } = JSON.parse(key);\n const networkClient = this._getNetworkClientById(\n networkClientId as NetworkClientId,\n );\n\n if (networkClient && this.#activeListeners[key]) {\n const listener = this.#activeListeners[key];\n if (listener) {\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n networkClient.blockTracker.removeListener('latest', listener);\n delete this.#activeListeners[key];\n }\n }\n }\n }\n\n return BlockTrackerPollingController;\n}\n\nclass Empty {}\n\nexport const BlockTrackerPollingControllerOnly = <\n PollingInput extends BlockTrackerPollingInput,\n // The return type is inferred from the class defined inside the function\n // scope, so this can't be easily typed.\n // eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n>() => BlockTrackerPollingControllerMixin<typeof Empty, PollingInput>(Empty);\n\nexport const BlockTrackerPollingController = <\n PollingInput extends BlockTrackerPollingInput,\n // The return type is inferred from the class defined inside the function\n // scope, so this can't be easily typed.\n // eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n>() =>\n BlockTrackerPollingControllerMixin<typeof BaseController, PollingInput>(\n BaseController,\n );\n"]}
@@ -17,7 +17,7 @@ export declare const BlockTrackerPollingControllerOnly: <PollingInput extends Bl
17
17
  _startPolling(input: PollingInput): void;
18
18
  _stopPollingByPollingTokenSetId(key: PollingTokenSetId): void;
19
19
  readonly "__#3@#pollingTokenSets": Map<string, Set<string>>;
20
- "__#3@#callbacks": Map<string, Set<(input: PollingInput) => void>>;
20
+ readonly "__#3@#callbacks": Map<string, Set<(input: PollingInput) => void>>;
21
21
  _executePoll(input: PollingInput): Promise<void>;
22
22
  startPolling(input: PollingInput): string;
23
23
  stopAllPolling(): void;
@@ -30,7 +30,7 @@ export declare const BlockTrackerPollingController: <PollingInput extends BlockT
30
30
  _startPolling(input: PollingInput): void;
31
31
  _stopPollingByPollingTokenSetId(key: PollingTokenSetId): void;
32
32
  readonly "__#3@#pollingTokenSets": Map<string, Set<string>>;
33
- "__#3@#callbacks": Map<string, Set<(input: PollingInput) => void>>;
33
+ readonly "__#3@#callbacks": Map<string, Set<(input: PollingInput) => void>>;
34
34
  _executePoll(input: PollingInput): Promise<void>;
35
35
  startPolling(input: PollingInput): string;
36
36
  stopAllPolling(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"BlockTrackerPollingController.d.cts","sourceRoot":"","sources":["../src/BlockTrackerPollingController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,kCAAkC;AAC3D,OAAO,KAAK,EACV,eAAe,EACf,aAAa,EACd,qCAAqC;AACtC,OAAO,KAAK,EAAE,IAAI,EAAE,wBAAwB;AAM5C,OAAO,KAAK,EAAe,iBAAiB,EAAE,oBAAgB;AAE9D;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACrC,eAAe,EAAE,eAAe,CAAC;CAClC,CAAC;AAqEF,cAAM,KAAK;CAAG;AAEd,eAAO,MAAM,iCAAiC;uDApDC,IAAI,KAAK,QAAQ,IAAI,CAAC;2CAG9C,eAAe,GAC/B,aAAa,GAAG,SAAS;;yCAyBS,iBAAiB;;;;;;;;iBAyBkB,CAAC;AAE7E,eAAO,MAAM,6BAA6B;uDAxDK,IAAI,KAAK,QAAQ,IAAI,CAAC;2CAG9C,eAAe,GAC/B,aAAa,GAAG,SAAS;;yCAyBS,iBAAiB;;;;;;;;0BAgCvD,CAAC"}
1
+ {"version":3,"file":"BlockTrackerPollingController.d.cts","sourceRoot":"","sources":["../src/BlockTrackerPollingController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,kCAAkC;AAC3D,OAAO,KAAK,EACV,eAAe,EACf,aAAa,EACd,qCAAqC;AACtC,OAAO,KAAK,EAAE,IAAI,EAAE,wBAAwB;AAM5C,OAAO,KAAK,EAAe,iBAAiB,EAAE,oBAAgB;AAE9D;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACrC,eAAe,EAAE,eAAe,CAAC;CAClC,CAAC;AAoEF,cAAM,KAAK;CAAG;AAEd,eAAO,MAAM,iCAAiC;uDAlDC,IAAI,KAAK,QAAQ,IAAI,CAAC;2CAG9C,eAAe,GAC/B,aAAa,GAAG,SAAS;wCAEQ,IAAI;yCAqBH,iBAAiB,GAAG,IAAI;;;;;;;;iBA4BW,CAAC;AAE7E,eAAO,MAAM,6BAA6B;uDAzDK,IAAI,KAAK,QAAQ,IAAI,CAAC;2CAG9C,eAAe,GAC/B,aAAa,GAAG,SAAS;wCAEQ,IAAI;yCAqBH,iBAAiB,GAAG,IAAI;;;;;;;;0BAsC9D,CAAC"}
@@ -17,7 +17,7 @@ export declare const BlockTrackerPollingControllerOnly: <PollingInput extends Bl
17
17
  _startPolling(input: PollingInput): void;
18
18
  _stopPollingByPollingTokenSetId(key: PollingTokenSetId): void;
19
19
  readonly "__#3@#pollingTokenSets": Map<string, Set<string>>;
20
- "__#3@#callbacks": Map<string, Set<(input: PollingInput) => void>>;
20
+ readonly "__#3@#callbacks": Map<string, Set<(input: PollingInput) => void>>;
21
21
  _executePoll(input: PollingInput): Promise<void>;
22
22
  startPolling(input: PollingInput): string;
23
23
  stopAllPolling(): void;
@@ -30,7 +30,7 @@ export declare const BlockTrackerPollingController: <PollingInput extends BlockT
30
30
  _startPolling(input: PollingInput): void;
31
31
  _stopPollingByPollingTokenSetId(key: PollingTokenSetId): void;
32
32
  readonly "__#3@#pollingTokenSets": Map<string, Set<string>>;
33
- "__#3@#callbacks": Map<string, Set<(input: PollingInput) => void>>;
33
+ readonly "__#3@#callbacks": Map<string, Set<(input: PollingInput) => void>>;
34
34
  _executePoll(input: PollingInput): Promise<void>;
35
35
  startPolling(input: PollingInput): string;
36
36
  stopAllPolling(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"BlockTrackerPollingController.d.mts","sourceRoot":"","sources":["../src/BlockTrackerPollingController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,kCAAkC;AAC3D,OAAO,KAAK,EACV,eAAe,EACf,aAAa,EACd,qCAAqC;AACtC,OAAO,KAAK,EAAE,IAAI,EAAE,wBAAwB;AAM5C,OAAO,KAAK,EAAe,iBAAiB,EAAE,oBAAgB;AAE9D;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACrC,eAAe,EAAE,eAAe,CAAC;CAClC,CAAC;AAqEF,cAAM,KAAK;CAAG;AAEd,eAAO,MAAM,iCAAiC;uDApDC,IAAI,KAAK,QAAQ,IAAI,CAAC;2CAG9C,eAAe,GAC/B,aAAa,GAAG,SAAS;;yCAyBS,iBAAiB;;;;;;;;iBAyBkB,CAAC;AAE7E,eAAO,MAAM,6BAA6B;uDAxDK,IAAI,KAAK,QAAQ,IAAI,CAAC;2CAG9C,eAAe,GAC/B,aAAa,GAAG,SAAS;;yCAyBS,iBAAiB;;;;;;;;0BAgCvD,CAAC"}
1
+ {"version":3,"file":"BlockTrackerPollingController.d.mts","sourceRoot":"","sources":["../src/BlockTrackerPollingController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,kCAAkC;AAC3D,OAAO,KAAK,EACV,eAAe,EACf,aAAa,EACd,qCAAqC;AACtC,OAAO,KAAK,EAAE,IAAI,EAAE,wBAAwB;AAM5C,OAAO,KAAK,EAAe,iBAAiB,EAAE,oBAAgB;AAE9D;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACrC,eAAe,EAAE,eAAe,CAAC;CAClC,CAAC;AAoEF,cAAM,KAAK;CAAG;AAEd,eAAO,MAAM,iCAAiC;uDAlDC,IAAI,KAAK,QAAQ,IAAI,CAAC;2CAG9C,eAAe,GAC/B,aAAa,GAAG,SAAS;wCAEQ,IAAI;yCAqBH,iBAAiB,GAAG,IAAI;;;;;;;;iBA4BW,CAAC;AAE7E,eAAO,MAAM,6BAA6B;uDAzDK,IAAI,KAAK,QAAQ,IAAI,CAAC;2CAG9C,eAAe,GAC/B,aAAa,GAAG,SAAS;wCAEQ,IAAI;yCAqBH,iBAAiB,GAAG,IAAI;;;;;;;;0BAsC9D,CAAC"}
@@ -12,8 +12,9 @@ import { AbstractPollingControllerBaseMixin, getKey } from "./AbstractPollingCon
12
12
  * @param Base - The base class to mix onto.
13
13
  * @returns The composed class.
14
14
  */
15
- // TODO: Either fix this lint violation or explain why it's necessary to ignore.
16
- // eslint-disable-next-line @typescript-eslint/naming-convention
15
+ // This is a function that's used as class, and the return type is inferred from
16
+ // the class defined inside the function scope, so this can't be easily typed.
17
+ // eslint-disable-next-line @typescript-eslint/explicit-function-return-type, @typescript-eslint/naming-convention
17
18
  function BlockTrackerPollingControllerMixin(Base) {
18
19
  var _BlockTrackerPollingController_activeListeners;
19
20
  class BlockTrackerPollingController extends AbstractPollingControllerBaseMixin(Base) {
@@ -35,10 +36,7 @@ function BlockTrackerPollingControllerMixin(Base) {
35
36
  __classPrivateFieldGet(this, _BlockTrackerPollingController_activeListeners, "f")[key] = updateOnNewBlock;
36
37
  }
37
38
  else {
38
- throw new Error(
39
- // TODO: Either fix this lint violation or explain why it's necessary to ignore.
40
- // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
41
- `Unable to retrieve blockTracker for networkClientId ${input.networkClientId}`);
39
+ throw new Error(`Unable to retrieve blockTracker for networkClientId ${input.networkClientId}`);
42
40
  }
43
41
  }
44
42
  _stopPollingByPollingTokenSetId(key) {
@@ -1 +1 @@
1
- {"version":3,"file":"BlockTrackerPollingController.mjs","sourceRoot":"","sources":["../src/BlockTrackerPollingController.ts"],"names":[],"mappings":";;;;;AAAA,OAAO,EAAE,cAAc,EAAE,kCAAkC;AAO3D,OAAO,EACL,kCAAkC,EAClC,MAAM,EACP,wCAAoC;AAWrC;;;;;;GAMG;AACH,gFAAgF;AAChF,gEAAgE;AAChE,SAAS,kCAAkC,CAGzC,IAAW;;IACX,MAAe,6BAA8B,SAAQ,kCAAkC,CAGrF,IAAI,CAAC;QAHP;;YAIE,yDAAqE,EAAE,EAAC;QA6C1E,CAAC;QAvCC,aAAa,CAAC,KAAmB;YAC/B,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;YAE1B,IAAI,uBAAA,IAAI,sDAAiB,CAAC,GAAG,CAAC,EAAE;gBAC9B,OAAO;aACR;YAED,MAAM,aAAa,GAAG,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;YACxE,IAAI,aAAa,EAAE;gBACjB,MAAM,gBAAgB,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;gBAC7D,gFAAgF;gBAChF,kEAAkE;gBAClE,aAAa,CAAC,YAAY,CAAC,WAAW,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC;gBACnE,uBAAA,IAAI,sDAAiB,CAAC,GAAG,CAAC,GAAG,gBAAgB,CAAC;aAC/C;iBAAM;gBACL,MAAM,IAAI,KAAK;gBACb,gFAAgF;gBAChF,4EAA4E;gBAC5E,uDAAuD,KAAK,CAAC,eAAe,EAAE,CAC/E,CAAC;aACH;QACH,CAAC;QAED,+BAA+B,CAAC,GAAsB;YACpD,MAAM,EAAE,eAAe,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAC5C,MAAM,aAAa,GAAG,IAAI,CAAC,qBAAqB,CAC9C,eAAkC,CACnC,CAAC;YAEF,IAAI,aAAa,IAAI,uBAAA,IAAI,sDAAiB,CAAC,GAAG,CAAC,EAAE;gBAC/C,MAAM,QAAQ,GAAG,uBAAA,IAAI,sDAAiB,CAAC,GAAG,CAAC,CAAC;gBAC5C,IAAI,QAAQ,EAAE;oBACZ,gFAAgF;oBAChF,kEAAkE;oBAClE,aAAa,CAAC,YAAY,CAAC,cAAc,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;oBAC9D,OAAO,uBAAA,IAAI,sDAAiB,CAAC,GAAG,CAAC,CAAC;iBACnC;aACF;QACH,CAAC;KACF;;IAED,OAAO,6BAA6B,CAAC;AACvC,CAAC;AAED,MAAM,KAAK;CAAG;AAEd,MAAM,CAAC,MAAM,iCAAiC,GAAG,GAE7C,EAAE,CAAC,kCAAkC,CAA6B,KAAK,CAAC,CAAC;AAE7E,MAAM,CAAC,MAAM,6BAA6B,GAAG,GAEzC,EAAE,CACJ,kCAAkC,CAChC,cAAc,CACf,CAAC","sourcesContent":["import { BaseController } from '@metamask/base-controller';\nimport type {\n NetworkClientId,\n NetworkClient,\n} from '@metamask/network-controller';\nimport type { Json } from '@metamask/utils';\n\nimport {\n AbstractPollingControllerBaseMixin,\n getKey,\n} from './AbstractPollingController';\nimport type { Constructor, PollingTokenSetId } from './types';\n\n/**\n * The minimum input required to start polling for a {@link BlockTrackerPollingController}.\n * Implementing classes may provide additional properties.\n */\nexport type BlockTrackerPollingInput = {\n networkClientId: NetworkClientId;\n};\n\n/**\n * BlockTrackerPollingControllerMixin\n * A polling controller that polls using a block tracker.\n *\n * @param Base - The base class to mix onto.\n * @returns The composed class.\n */\n// TODO: Either fix this lint violation or explain why it's necessary to ignore.\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction BlockTrackerPollingControllerMixin<\n TBase extends Constructor,\n PollingInput extends BlockTrackerPollingInput,\n>(Base: TBase) {\n abstract class BlockTrackerPollingController extends AbstractPollingControllerBaseMixin<\n TBase,\n PollingInput\n >(Base) {\n #activeListeners: Record<string, (options: Json) => Promise<void>> = {};\n\n abstract _getNetworkClientById(\n networkClientId: NetworkClientId,\n ): NetworkClient | undefined;\n\n _startPolling(input: PollingInput) {\n const key = getKey(input);\n\n if (this.#activeListeners[key]) {\n return;\n }\n\n const networkClient = this._getNetworkClientById(input.networkClientId);\n if (networkClient) {\n const updateOnNewBlock = this._executePoll.bind(this, input);\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n networkClient.blockTracker.addListener('latest', updateOnNewBlock);\n this.#activeListeners[key] = updateOnNewBlock;\n } else {\n throw new Error(\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/restrict-template-expressions\n `Unable to retrieve blockTracker for networkClientId ${input.networkClientId}`,\n );\n }\n }\n\n _stopPollingByPollingTokenSetId(key: PollingTokenSetId) {\n const { networkClientId } = JSON.parse(key);\n const networkClient = this._getNetworkClientById(\n networkClientId as NetworkClientId,\n );\n\n if (networkClient && this.#activeListeners[key]) {\n const listener = this.#activeListeners[key];\n if (listener) {\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n networkClient.blockTracker.removeListener('latest', listener);\n delete this.#activeListeners[key];\n }\n }\n }\n }\n\n return BlockTrackerPollingController;\n}\n\nclass Empty {}\n\nexport const BlockTrackerPollingControllerOnly = <\n PollingInput extends BlockTrackerPollingInput,\n>() => BlockTrackerPollingControllerMixin<typeof Empty, PollingInput>(Empty);\n\nexport const BlockTrackerPollingController = <\n PollingInput extends BlockTrackerPollingInput,\n>() =>\n BlockTrackerPollingControllerMixin<typeof BaseController, PollingInput>(\n BaseController,\n );\n"]}
1
+ {"version":3,"file":"BlockTrackerPollingController.mjs","sourceRoot":"","sources":["../src/B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G,CAAC,EAAE,CAAC;gBAChD,MAAM,QAAQ,GAAG,uBAAA,IAAI,sDAAiB,CAAC,GAAG,CAAC,CAAC;gBAC5C,IAAI,QAAQ,EAAE,CAAC;oBACb,gFAAgF;oBAChF,kEAAkE;oBAClE,aAAa,CAAC,YAAY,CAAC,cAAc,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;oBAC9D,OAAO,uBAAA,IAAI,sDAAiB,CAAC,GAAG,CAAC,CAAC;gBACpC,CAAC;YACH,CAAC;QACH,CAAC;KACF;;IAED,OAAO,6BAA6B,CAAC;AACvC,CAAC;AAED,MAAM,KAAK;CAAG;AAEd,MAAM,CAAC,MAAM,iCAAiC,GAAG,GAK7C,EAAE,CAAC,kCAAkC,CAA6B,KAAK,CAAC,CAAC;AAE7E,MAAM,CAAC,MAAM,6BAA6B,GAAG,GAKzC,EAAE,CACJ,kCAAkC,CAChC,cAAc,CACf,CAAC","sourcesContent":["import { BaseController } from '@metamask/base-controller';\nimport type {\n NetworkClientId,\n NetworkClient,\n} from '@metamask/network-controller';\nimport type { Json } from '@metamask/utils';\n\nimport {\n AbstractPollingControllerBaseMixin,\n getKey,\n} from './AbstractPollingController';\nimport type { Constructor, PollingTokenSetId } from './types';\n\n/**\n * The minimum input required to start polling for a {@link BlockTrackerPollingController}.\n * Implementing classes may provide additional properties.\n */\nexport type BlockTrackerPollingInput = {\n networkClientId: NetworkClientId;\n};\n\n/**\n * BlockTrackerPollingControllerMixin\n * A polling controller that polls using a block tracker.\n *\n * @param Base - The base class to mix onto.\n * @returns The composed class.\n */\n// This is a function that's used as class, and the return type is inferred from\n// the class defined inside the function scope, so this can't be easily typed.\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type, @typescript-eslint/naming-convention\nfunction BlockTrackerPollingControllerMixin<\n TBase extends Constructor,\n PollingInput extends BlockTrackerPollingInput,\n>(Base: TBase) {\n abstract class BlockTrackerPollingController extends AbstractPollingControllerBaseMixin<\n TBase,\n PollingInput\n >(Base) {\n #activeListeners: Record<string, (options: Json) => Promise<void>> = {};\n\n abstract _getNetworkClientById(\n networkClientId: NetworkClientId,\n ): NetworkClient | undefined;\n\n _startPolling(input: PollingInput): void {\n const key = getKey(input);\n\n if (this.#activeListeners[key]) {\n return;\n }\n\n const networkClient = this._getNetworkClientById(input.networkClientId);\n if (networkClient) {\n const updateOnNewBlock = this._executePoll.bind(this, input);\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n networkClient.blockTracker.addListener('latest', updateOnNewBlock);\n this.#activeListeners[key] = updateOnNewBlock;\n } else {\n throw new Error(\n `Unable to retrieve blockTracker for networkClientId ${input.networkClientId}`,\n );\n }\n }\n\n _stopPollingByPollingTokenSetId(key: PollingTokenSetId): void {\n const { networkClientId } = JSON.parse(key);\n const networkClient = this._getNetworkClientById(\n networkClientId as NetworkClientId,\n );\n\n if (networkClient && this.#activeListeners[key]) {\n const listener = this.#activeListeners[key];\n if (listener) {\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n networkClient.blockTracker.removeListener('latest', listener);\n delete this.#activeListeners[key];\n }\n }\n }\n }\n\n return BlockTrackerPollingController;\n}\n\nclass Empty {}\n\nexport const BlockTrackerPollingControllerOnly = <\n PollingInput extends BlockTrackerPollingInput,\n // The return type is inferred from the class defined inside the function\n // scope, so this can't be easily typed.\n // eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n>() => BlockTrackerPollingControllerMixin<typeof Empty, PollingInput>(Empty);\n\nexport const BlockTrackerPollingController = <\n PollingInput extends BlockTrackerPollingInput,\n // The return type is inferred from the class defined inside the function\n // scope, so this can't be easily typed.\n // eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n>() =>\n BlockTrackerPollingControllerMixin<typeof BaseController, PollingInput>(\n BaseController,\n );\n"]}
@@ -21,8 +21,9 @@ const AbstractPollingController_1 = require("./AbstractPollingController.cjs");
21
21
  * @param Base - The base class to mix onto.
22
22
  * @returns The composed class.
23
23
  */
24
- // TODO: Either fix this lint violation or explain why it's necessary to ignore.
25
- // eslint-disable-next-line @typescript-eslint/naming-convention
24
+ // This is a function that's used as class, and the return type is inferred from
25
+ // the class defined inside the function scope, so this can't be easily typed.
26
+ // eslint-disable-next-line @typescript-eslint/explicit-function-return-type, @typescript-eslint/naming-convention
26
27
  function StaticIntervalPollingControllerMixin(Base) {
27
28
  var _StaticIntervalPollingController_intervalIds, _StaticIntervalPollingController_intervalLength;
28
29
  class StaticIntervalPollingController extends (0, AbstractPollingController_1.AbstractPollingControllerBaseMixin)(Base) {
@@ -75,6 +76,9 @@ class Empty {
75
76
  }
76
77
  const StaticIntervalPollingControllerOnly = () => StaticIntervalPollingControllerMixin(Empty);
77
78
  exports.StaticIntervalPollingControllerOnly = StaticIntervalPollingControllerOnly;
79
+ // The return type is inferred from the class defined inside the function
80
+ // scope, so this can't be easily typed.
81
+ // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
78
82
  const StaticIntervalPollingController = () => StaticIntervalPollingControllerMixin(base_controller_1.BaseController);
79
83
  exports.StaticIntervalPollingController = StaticIntervalPollingController;
80
84
  //# sourceMappingURL=StaticIntervalPollingController.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"StaticIntervalPollingController.cjs","sourceRoot":"","sources":["../src/StaticIntervalPollingController.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAA2D;AAG3D,+EAGqC;AAOrC;;;;;;GAMG;AACH,gFAAgF;AAChF,gEAAgE;AAChE,SAAS,oCAAoC,CAG3C,IAAW;;IACX,MAAe,+BACb,SAAQ,IAAA,8DAAkC,EAAsB,IAAI,CAAC;QADvE;;YAIW,uDAA0D,EAAE,EAAC;YAEtE,0DAAsC,IAAI,EAAC;QA4C7C,CAAC;QA1CC,iBAAiB,CAAC,cAAsB;YACtC,uBAAA,IAAI,mDAAmB,cAAc,MAAA,CAAC;QACxC,CAAC;QAED,iBAAiB;YAC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G,GAE/C,EAAE,CAAC,oCAAoC,CAA6B,KAAK,CAAC,CAAC;AAFlE,QAAA,mCAAmC,uCAE+B;AAExE,MAAM,+BAA+B,GAAG,GAA8B,EAAE,CAC7E,oCAAoC,CAClC,gCAAc,CACf,CAAC;AAHS,QAAA,+BAA+B,mCAGxC","sourcesContent":["import { BaseController } from '@metamask/base-controller';\nimport type { Json } from '@metamask/utils';\n\nimport {\n AbstractPollingControllerBaseMixin,\n getKey,\n} from './AbstractPollingController';\nimport type {\n Constructor,\n IPollingController,\n PollingTokenSetId,\n} from './types';\n\n/**\n * StaticIntervalPollingControllerMixin\n * A polling controller that polls on a static interval.\n *\n * @param Base - The base class to mix onto.\n * @returns The composed class.\n */\n// TODO: Either fix this lint violation or explain why it's necessary to ignore.\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction StaticIntervalPollingControllerMixin<\n TBase extends Constructor,\n PollingInput extends Json,\n>(Base: TBase) {\n abstract class StaticIntervalPollingController\n extends AbstractPollingControllerBaseMixin<TBase, PollingInput>(Base)\n implements IPollingController<PollingInput>\n {\n readonly #intervalIds: Record<PollingTokenSetId, NodeJS.Timeout> = {};\n\n #intervalLength: number | undefined = 1000;\n\n setIntervalLength(intervalLength: number) {\n this.#intervalLength = intervalLength;\n }\n\n getIntervalLength() {\n return this.#intervalLength;\n }\n\n _startPolling(input: PollingInput) {\n if (!this.#intervalLength) {\n throw new Error('intervalLength must be defined and greater than 0');\n }\n\n const key = getKey(input);\n const existingInterval = this.#intervalIds[key];\n this._stopPollingByPollingTokenSetId(key);\n\n // eslint-disable-next-line no-multi-assign\n const intervalId = (this.#intervalIds[key] = setTimeout(\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n async () => {\n try {\n await this._executePoll(input);\n } catch (error) {\n console.error(error);\n }\n if (intervalId === this.#intervalIds[key]) {\n this._startPolling(input);\n }\n },\n existingInterval ? this.#intervalLength : 0,\n ));\n }\n\n _stopPollingByPollingTokenSetId(key: PollingTokenSetId) {\n const intervalId = this.#intervalIds[key];\n if (intervalId) {\n clearTimeout(intervalId);\n delete this.#intervalIds[key];\n }\n }\n }\n\n return StaticIntervalPollingController;\n}\n\nclass Empty {}\n\nexport const StaticIntervalPollingControllerOnly = <\n PollingInput extends Json,\n>() => StaticIntervalPollingControllerMixin<typeof Empty, PollingInput>(Empty);\n\nexport const StaticIntervalPollingController = <PollingInput extends Json>() =>\n StaticIntervalPollingControllerMixin<typeof BaseController, PollingInput>(\n BaseController,\n );\n"]}
1
+ {"version":3,"file":"StaticIntervalPollingController.cjs","sourceRoot":"","sources":["../src/StaticIntervalPollingController.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAA2D;AAG3D,+EAGqC;AAOrC;;;;;;GAMG;AACH,gFAAgF;AAChF,8EAA8E;AAC9E,kHAAkH;AAClH,SAAS,oCAAoC,CAG3C,IAAW;;IACX,MAAe,+BACb,SAAQ,IAAA,8DAAkC,EAAsB,IAAI,CAAC;QADvE;;YAIW,uDAA0D,EAAE,EAAC;YAEtE,0DAAsC,IAAI,EAAC;QA4C7C,CAAC;QA1CC,iBAAiB,CAAC,cAAsB;YACtC,uBAAA,IAAI,mDAAmB,cAAc,MAAA,CAAC;QACxC,CAAC;QAED,iBAAiB;YACf,OAAO,uBAAA,IAAI,uDAAgB,CAAC;QAC9B,CAAC;QAED,aAAa,CAAC,KAAmB;YAC/B,IAAI,CAAC,uBAAA,IAAI,uDAAgB,EAAE,CAAC;gBAC1B,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;YACvE,CAAC;YAED,MAAM,GAAG,GAAG,IAAA,kCAAM,EAAC,KAAK,CAAC,CAAC;YAC1B,MAAM,gBAAgB,GAAG,uBAAA,IAAI,oDAAa,CAAC,GAAG,CAAC,CAAC;YAChD,IAAI,CAAC,+BAA+B,CAAC,GAAG,CAAC,CAAC;YAE1C,2CAA2C;YAC3C,MAAM,UAAU,GAAG,CAAC,uBAAA,IAAI,oDAAa,CAAC,GAAG,CAAC,GAAG,UAAU;YACrD,gFAAgF;YAChF,kEAAkE;YAClE,KAAK,IAAI,EAAE;gBACT,IAAI,CAAC;oBACH,MAAM,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;gBACjC,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;gBACvB,CAAC;gBACD,IAAI,UAAU,KAAK,uBAAA,IAAI,oDAAa,CAAC,GAAG,CAAC,EAAE,CAAC;oBAC1C,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;gBAC5B,CAAC;YACH,CAAC,EACD,gBAAgB,CAAC,CAAC,CAAC,uBAAA,IAAI,uDAAgB,CAAC,CAAC,CAAC,CAAC,CAC5C,CAAC,CAAC;QACL,CAAC;QAED,+BAA+B,CAAC,GAAsB;YACpD,MAAM,UAAU,GAAG,uBAAA,IAAI,oDAAa,CAAC,GAAG,CAAC,CAAC;YAC1C,IAAI,UAAU,EAAE,CAAC;gBACf,YAAY,CAAC,UAAU,CAAC,CAAC;gBACzB,OAAO,uBAAA,IAAI,oDAAa,CAAC,GAAG,CAAC,CAAC;YAChC,CAAC;QACH,CAAC;KACF;;IAED,OAAO,+BAA+B,CAAC;AACzC,CAAC;AAED,MAAM,KAAK;CAAG;AAEP,MAAM,mCAAmC,GAAG,GAK/C,EAAE,CAAC,oCAAoC,CAA6B,KAAK,CAAC,CAAC;AALlE,QAAA,mCAAmC,uCAK+B;AAE/E,yEAAyE;AACzE,wCAAwC;AACxC,4EAA4E;AACrE,MAAM,+BAA+B,GAAG,GAA8B,EAAE,CAC7E,oCAAoC,CAClC,gCAAc,CACf,CAAC;AAHS,QAAA,+BAA+B,mCAGxC","sourcesContent":["import { BaseController } from '@metamask/base-controller';\nimport type { Json } from '@metamask/utils';\n\nimport {\n AbstractPollingControllerBaseMixin,\n getKey,\n} from './AbstractPollingController';\nimport type {\n Constructor,\n IPollingController,\n PollingTokenSetId,\n} from './types';\n\n/**\n * StaticIntervalPollingControllerMixin\n * A polling controller that polls on a static interval.\n *\n * @param Base - The base class to mix onto.\n * @returns The composed class.\n */\n// This is a function that's used as class, and the return type is inferred from\n// the class defined inside the function scope, so this can't be easily typed.\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type, @typescript-eslint/naming-convention\nfunction StaticIntervalPollingControllerMixin<\n TBase extends Constructor,\n PollingInput extends Json,\n>(Base: TBase) {\n abstract class StaticIntervalPollingController\n extends AbstractPollingControllerBaseMixin<TBase, PollingInput>(Base)\n implements IPollingController<PollingInput>\n {\n readonly #intervalIds: Record<PollingTokenSetId, NodeJS.Timeout> = {};\n\n #intervalLength: number | undefined = 1000;\n\n setIntervalLength(intervalLength: number): void {\n this.#intervalLength = intervalLength;\n }\n\n getIntervalLength(): number | undefined {\n return this.#intervalLength;\n }\n\n _startPolling(input: PollingInput): void {\n if (!this.#intervalLength) {\n throw new Error('intervalLength must be defined and greater than 0');\n }\n\n const key = getKey(input);\n const existingInterval = this.#intervalIds[key];\n this._stopPollingByPollingTokenSetId(key);\n\n // eslint-disable-next-line no-multi-assign\n const intervalId = (this.#intervalIds[key] = setTimeout(\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n async () => {\n try {\n await this._executePoll(input);\n } catch (error) {\n console.error(error);\n }\n if (intervalId === this.#intervalIds[key]) {\n this._startPolling(input);\n }\n },\n existingInterval ? this.#intervalLength : 0,\n ));\n }\n\n _stopPollingByPollingTokenSetId(key: PollingTokenSetId): void {\n const intervalId = this.#intervalIds[key];\n if (intervalId) {\n clearTimeout(intervalId);\n delete this.#intervalIds[key];\n }\n }\n }\n\n return StaticIntervalPollingController;\n}\n\nclass Empty {}\n\nexport const StaticIntervalPollingControllerOnly = <\n PollingInput extends Json,\n // The return type is inferred from the class defined inside the function\n // scope, so this can't be easily typed.\n // eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n>() => StaticIntervalPollingControllerMixin<typeof Empty, PollingInput>(Empty);\n\n// The return type is inferred from the class defined inside the function\n// scope, so this can't be easily typed.\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nexport const StaticIntervalPollingController = <PollingInput extends Json>() =>\n StaticIntervalPollingControllerMixin<typeof BaseController, PollingInput>(\n BaseController,\n );\n"]}
@@ -11,7 +11,7 @@ export declare const StaticIntervalPollingControllerOnly: <PollingInput extends
11
11
  _startPolling(input: PollingInput): void;
12
12
  _stopPollingByPollingTokenSetId(key: PollingTokenSetId): void;
13
13
  readonly "__#3@#pollingTokenSets": Map<string, Set<string>>;
14
- "__#3@#callbacks": Map<string, Set<(input: PollingInput) => void>>;
14
+ readonly "__#3@#callbacks": Map<string, Set<(input: PollingInput) => void>>;
15
15
  _executePoll(input: PollingInput): Promise<void>;
16
16
  startPolling(input: PollingInput): string;
17
17
  stopAllPolling(): void;
@@ -26,7 +26,7 @@ export declare const StaticIntervalPollingController: <PollingInput extends Json
26
26
  _startPolling(input: PollingInput): void;
27
27
  _stopPollingByPollingTokenSetId(key: PollingTokenSetId): void;
28
28
  readonly "__#3@#pollingTokenSets": Map<string, Set<string>>;
29
- "__#3@#callbacks": Map<string, Set<(input: PollingInput) => void>>;
29
+ readonly "__#3@#callbacks": Map<string, Set<(input: PollingInput) => void>>;
30
30
  _executePoll(input: PollingInput): Promise<void>;
31
31
  startPolling(input: PollingInput): string;
32
32
  stopAllPolling(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"StaticIntervalPollingController.d.cts","sourceRoot":"","sources":["../src/StaticIntervalPollingController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,kCAAkC;AAC3D,OAAO,KAAK,EAAE,IAAI,EAAE,wBAAwB;AAM5C,OAAO,KAAK,EAGV,iBAAiB,EAClB,oBAAgB;AAsEjB,cAAM,KAAK;CAAG;AAEd,eAAO,MAAM,mCAAmC;mCArDrB,OAAO,iBAAiB,EAAE,OAAO,OAAO,CAAC;6BAE/C,MAAM,GAAG,SAAS;sCAED,MAAM;;;yCAmCH,iBAAiB;;;;;;;;iBAgBoB,CAAC;AAE/E,eAAO,MAAM,+BAA+B;mCAzDjB,OAAO,iBAAiB,EAAE,OAAO,OAAO,CAAC;6BAE/C,MAAM,GAAG,SAAS;sCAED,MAAM;;;yCAmCH,iBAAiB;;;;;;;;0BAqBvD,CAAC"}
1
+ {"version":3,"file":"StaticIntervalPollingController.d.cts","sourceRoot":"","sources":["../src/StaticIntervalPollingController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,kCAAkC;AAC3D,OAAO,KAAK,EAAE,IAAI,EAAE,wBAAwB;AAM5C,OAAO,KAAK,EAGV,iBAAiB,EAClB,oBAAgB;AAuEjB,cAAM,KAAK;CAAG;AAEd,eAAO,MAAM,mCAAmC;mCArDrB,OAAO,iBAAiB,EAAE,OAAO,OAAO,CAAC;6BAE/C,MAAM,GAAG,SAAS;sCAED,MAAM,GAAG,IAAI;yBAI1B,MAAM,GAAG,SAAS;wCAIH,IAAI;yCA2BH,iBAAiB,GAAG,IAAI;;;;;;;;iBAmBa,CAAC;AAK/E,eAAO,MAAM,+BAA+B;mCA/DjB,OAAO,iBAAiB,EAAE,OAAO,OAAO,CAAC;6BAE/C,MAAM,GAAG,SAAS;sCAED,MAAM,GAAG,IAAI;yBAI1B,MAAM,GAAG,SAAS;wCAIH,IAAI;yCA2BH,iBAAiB,GAAG,IAAI;;;;;;;;0BA2B9D,CAAC"}
@@ -11,7 +11,7 @@ export declare const StaticIntervalPollingControllerOnly: <PollingInput extends
11
11
  _startPolling(input: PollingInput): void;
12
12
  _stopPollingByPollingTokenSetId(key: PollingTokenSetId): void;
13
13
  readonly "__#3@#pollingTokenSets": Map<string, Set<string>>;
14
- "__#3@#callbacks": Map<string, Set<(input: PollingInput) => void>>;
14
+ readonly "__#3@#callbacks": Map<string, Set<(input: PollingInput) => void>>;
15
15
  _executePoll(input: PollingInput): Promise<void>;
16
16
  startPolling(input: PollingInput): string;
17
17
  stopAllPolling(): void;
@@ -26,7 +26,7 @@ export declare const StaticIntervalPollingController: <PollingInput extends Json
26
26
  _startPolling(input: PollingInput): void;
27
27
  _stopPollingByPollingTokenSetId(key: PollingTokenSetId): void;
28
28
  readonly "__#3@#pollingTokenSets": Map<string, Set<string>>;
29
- "__#3@#callbacks": Map<string, Set<(input: PollingInput) => void>>;
29
+ readonly "__#3@#callbacks": Map<string, Set<(input: PollingInput) => void>>;
30
30
  _executePoll(input: PollingInput): Promise<void>;
31
31
  startPolling(input: PollingInput): string;
32
32
  stopAllPolling(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"StaticIntervalPollingController.d.mts","sourceRoot":"","sources":["../src/StaticIntervalPollingController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,kCAAkC;AAC3D,OAAO,KAAK,EAAE,IAAI,EAAE,wBAAwB;AAM5C,OAAO,KAAK,EAGV,iBAAiB,EAClB,oBAAgB;AAsEjB,cAAM,KAAK;CAAG;AAEd,eAAO,MAAM,mCAAmC;mCArDrB,OAAO,iBAAiB,EAAE,OAAO,OAAO,CAAC;6BAE/C,MAAM,GAAG,SAAS;sCAED,MAAM;;;yCAmCH,iBAAiB;;;;;;;;iBAgBoB,CAAC;AAE/E,eAAO,MAAM,+BAA+B;mCAzDjB,OAAO,iBAAiB,EAAE,OAAO,OAAO,CAAC;6BAE/C,MAAM,GAAG,SAAS;sCAED,MAAM;;;yCAmCH,iBAAiB;;;;;;;;0BAqBvD,CAAC"}
1
+ {"version":3,"file":"StaticIntervalPollingController.d.mts","sourceRoot":"","sources":["../src/StaticIntervalPollingController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,kCAAkC;AAC3D,OAAO,KAAK,EAAE,IAAI,EAAE,wBAAwB;AAM5C,OAAO,KAAK,EAGV,iBAAiB,EAClB,oBAAgB;AAuEjB,cAAM,KAAK;CAAG;AAEd,eAAO,MAAM,mCAAmC;mCArDrB,OAAO,iBAAiB,EAAE,OAAO,OAAO,CAAC;6BAE/C,MAAM,GAAG,SAAS;sCAED,MAAM,GAAG,IAAI;yBAI1B,MAAM,GAAG,SAAS;wCAIH,IAAI;yCA2BH,iBAAiB,GAAG,IAAI;;;;;;;;iBAmBa,CAAC;AAK/E,eAAO,MAAM,+BAA+B;mCA/DjB,OAAO,iBAAiB,EAAE,OAAO,OAAO,CAAC;6BAE/C,MAAM,GAAG,SAAS;sCAED,MAAM,GAAG,IAAI;yBAI1B,MAAM,GAAG,SAAS;wCAIH,IAAI;yCA2BH,iBAAiB,GAAG,IAAI;;;;;;;;0BA2B9D,CAAC"}
@@ -18,8 +18,9 @@ import { AbstractPollingControllerBaseMixin, getKey } from "./AbstractPollingCon
18
18
  * @param Base - The base class to mix onto.
19
19
  * @returns The composed class.
20
20
  */
21
- // TODO: Either fix this lint violation or explain why it's necessary to ignore.
22
- // eslint-disable-next-line @typescript-eslint/naming-convention
21
+ // This is a function that's used as class, and the return type is inferred from
22
+ // the class defined inside the function scope, so this can't be easily typed.
23
+ // eslint-disable-next-line @typescript-eslint/explicit-function-return-type, @typescript-eslint/naming-convention
23
24
  function StaticIntervalPollingControllerMixin(Base) {
24
25
  var _StaticIntervalPollingController_intervalIds, _StaticIntervalPollingController_intervalLength;
25
26
  class StaticIntervalPollingController extends AbstractPollingControllerBaseMixin(Base) {
@@ -71,5 +72,8 @@ function StaticIntervalPollingControllerMixin(Base) {
71
72
  class Empty {
72
73
  }
73
74
  export const StaticIntervalPollingControllerOnly = () => StaticIntervalPollingControllerMixin(Empty);
75
+ // The return type is inferred from the class defined inside the function
76
+ // scope, so this can't be easily typed.
77
+ // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
74
78
  export const StaticIntervalPollingController = () => StaticIntervalPollingControllerMixin(BaseController);
75
79
  //# sourceMappingURL=StaticIntervalPollingController.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"StaticIntervalPollingController.mjs","source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CAAC;iBAC3B;YACH,CAAC,EACD,gBAAgB,CAAC,CAAC,CAAC,uBAAA,IAAI,uDAAgB,CAAC,CAAC,CAAC,CAAC,CAC5C,CAAC,CAAC;QACL,CAAC;QAED,+BAA+B,CAAC,GAAsB;YACpD,MAAM,UAAU,GAAG,uBAAA,IAAI,oDAAa,CAAC,GAAG,CAAC,CAAC;YAC1C,IAAI,UAAU,EAAE;gBACd,YAAY,CAAC,UAAU,CAAC,CAAC;gBACzB,OAAO,uBAAA,IAAI,oDAAa,CAAC,GAAG,CAAC,CAAC;aAC/B;QACH,CAAC;KACF;;IAED,OAAO,+BAA+B,CAAC;AACzC,CAAC;AAED,MAAM,KAAK;CAAG;AAEd,MAAM,CAAC,MAAM,mCAAmC,GAAG,GAE/C,EAAE,CAAC,oCAAoC,CAA6B,KAAK,CAAC,CAAC;AAE/E,MAAM,CAAC,MAAM,+BAA+B,GAAG,GAA8B,EAAE,CAC7E,oCAAoC,CAClC,cAAc,CACf,CAAC","sourcesContent":["import { BaseController } from '@metamask/base-controller';\nimport type { Json } from '@metamask/utils';\n\nimport {\n AbstractPollingControllerBaseMixin,\n getKey,\n} from './AbstractPollingController';\nimport type {\n Constructor,\n IPollingController,\n PollingTokenSetId,\n} from './types';\n\n/**\n * StaticIntervalPollingControllerMixin\n * A polling controller that polls on a static interval.\n *\n * @param Base - The base class to mix onto.\n * @returns The composed class.\n */\n// TODO: Either fix this lint violation or explain why it's necessary to ignore.\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction StaticIntervalPollingControllerMixin<\n TBase extends Constructor,\n PollingInput extends Json,\n>(Base: TBase) {\n abstract class StaticIntervalPollingController\n extends AbstractPollingControllerBaseMixin<TBase, PollingInput>(Base)\n implements IPollingController<PollingInput>\n {\n readonly #intervalIds: Record<PollingTokenSetId, NodeJS.Timeout> = {};\n\n #intervalLength: number | undefined = 1000;\n\n setIntervalLength(intervalLength: number) {\n this.#intervalLength = intervalLength;\n }\n\n getIntervalLength() {\n return this.#intervalLength;\n }\n\n _startPolling(input: PollingInput) {\n if (!this.#intervalLength) {\n throw new Error('intervalLength must be defined and greater than 0');\n }\n\n const key = getKey(input);\n const existingInterval = this.#intervalIds[key];\n this._stopPollingByPollingTokenSetId(key);\n\n // eslint-disable-next-line no-multi-assign\n const intervalId = (this.#intervalIds[key] = setTimeout(\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n async () => {\n try {\n await this._executePoll(input);\n } catch (error) {\n console.error(error);\n }\n if (intervalId === this.#intervalIds[key]) {\n this._startPolling(input);\n }\n },\n existingInterval ? this.#intervalLength : 0,\n ));\n }\n\n _stopPollingByPollingTokenSetId(key: PollingTokenSetId) {\n const intervalId = this.#intervalIds[key];\n if (intervalId) {\n clearTimeout(intervalId);\n delete this.#intervalIds[key];\n }\n }\n }\n\n return StaticIntervalPollingController;\n}\n\nclass Empty {}\n\nexport const StaticIntervalPollingControllerOnly = <\n PollingInput extends Json,\n>() => StaticIntervalPollingControllerMixin<typeof Empty, PollingInput>(Empty);\n\nexport const StaticIntervalPollingController = <PollingInput extends Json>() =>\n StaticIntervalPollingControllerMixin<typeof BaseController, PollingInput>(\n BaseController,\n );\n"]}
1
+ {"version":3,"file":"StaticIntervalPollingController.mjs","sourceRoot":"","sources":["../src/StaticIntervalPollingController.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,cAAc,EAAE,kCAAkC;AAG3D,OAAO,EACL,kCAAkC,EAClC,MAAM,EACP,wCAAoC;AAOrC;;;;;;GAMG;AACH,gFAAgF;AAChF,8EAA8E;AAC9E,kHAAkH;AAClH,SAAS,oCAAoC,CAG3C,IAAW;;IACX,MAAe,+BACb,SAAQ,kCAAkC,CAAsB,IAAI,CAAC;QADvE;;YAIW,uDAA0D,EAAE,EAAC;YAEtE,0DAAsC,IAAI,EAAC;QA4C7C,CAAC;QA1CC,iBAAiB,CAAC,cAAsB;YACtC,uBAAA,IAAI,mDAAm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;QACH,CAAC;KACF;;IAED,OAAO,+BAA+B,CAAC;AACzC,CAAC;AAED,MAAM,KAAK;CAAG;AAEd,MAAM,CAAC,MAAM,mCAAmC,GAAG,GAK/C,EAAE,CAAC,oCAAoC,CAA6B,KAAK,CAAC,CAAC;AAE/E,yEAAyE;AACzE,wCAAwC;AACxC,4EAA4E;AAC5E,MAAM,CAAC,MAAM,+BAA+B,GAAG,GAA8B,EAAE,CAC7E,oCAAoC,CAClC,cAAc,CACf,CAAC","sourcesContent":["import { BaseController } from '@metamask/base-controller';\nimport type { Json } from '@metamask/utils';\n\nimport {\n AbstractPollingControllerBaseMixin,\n getKey,\n} from './AbstractPollingController';\nimport type {\n Constructor,\n IPollingController,\n PollingTokenSetId,\n} from './types';\n\n/**\n * StaticIntervalPollingControllerMixin\n * A polling controller that polls on a static interval.\n *\n * @param Base - The base class to mix onto.\n * @returns The composed class.\n */\n// This is a function that's used as class, and the return type is inferred from\n// the class defined inside the function scope, so this can't be easily typed.\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type, @typescript-eslint/naming-convention\nfunction StaticIntervalPollingControllerMixin<\n TBase extends Constructor,\n PollingInput extends Json,\n>(Base: TBase) {\n abstract class StaticIntervalPollingController\n extends AbstractPollingControllerBaseMixin<TBase, PollingInput>(Base)\n implements IPollingController<PollingInput>\n {\n readonly #intervalIds: Record<PollingTokenSetId, NodeJS.Timeout> = {};\n\n #intervalLength: number | undefined = 1000;\n\n setIntervalLength(intervalLength: number): void {\n this.#intervalLength = intervalLength;\n }\n\n getIntervalLength(): number | undefined {\n return this.#intervalLength;\n }\n\n _startPolling(input: PollingInput): void {\n if (!this.#intervalLength) {\n throw new Error('intervalLength must be defined and greater than 0');\n }\n\n const key = getKey(input);\n const existingInterval = this.#intervalIds[key];\n this._stopPollingByPollingTokenSetId(key);\n\n // eslint-disable-next-line no-multi-assign\n const intervalId = (this.#intervalIds[key] = setTimeout(\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n async () => {\n try {\n await this._executePoll(input);\n } catch (error) {\n console.error(error);\n }\n if (intervalId === this.#intervalIds[key]) {\n this._startPolling(input);\n }\n },\n existingInterval ? this.#intervalLength : 0,\n ));\n }\n\n _stopPollingByPollingTokenSetId(key: PollingTokenSetId): void {\n const intervalId = this.#intervalIds[key];\n if (intervalId) {\n clearTimeout(intervalId);\n delete this.#intervalIds[key];\n }\n }\n }\n\n return StaticIntervalPollingController;\n}\n\nclass Empty {}\n\nexport const StaticIntervalPollingControllerOnly = <\n PollingInput extends Json,\n // The return type is inferred from the class defined inside the function\n // scope, so this can't be easily typed.\n // eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n>() => StaticIntervalPollingControllerMixin<typeof Empty, PollingInput>(Empty);\n\n// The return type is inferred from the class defined inside the function\n// scope, so this can't be easily typed.\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nexport const StaticIntervalPollingController = <PollingInput extends Json>() =>\n StaticIntervalPollingControllerMixin<typeof BaseController, PollingInput>(\n BaseController,\n );\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask/polling-controller",
3
- "version": "15.0.0",
3
+ "version": "16.0.1",
4
4
  "description": "Polling Controller is the base for controllers that polling by networkClientId",
5
5
  "keywords": [
6
6
  "MetaMask",
@@ -36,6 +36,7 @@
36
36
  ],
37
37
  "scripts": {
38
38
  "build": "ts-bridge --project tsconfig.build.json --verbose --clean --no-references",
39
+ "build:all": "ts-bridge --project tsconfig.build.json --verbose --clean",
39
40
  "build:docs": "typedoc",
40
41
  "changelog:update": "../../scripts/update-changelog.sh @metamask/polling-controller",
41
42
  "changelog:validate": "../../scripts/validate-changelog.sh @metamask/polling-controller",
@@ -48,15 +49,16 @@
48
49
  },
49
50
  "dependencies": {
50
51
  "@metamask/base-controller": "^9.0.0",
51
- "@metamask/controller-utils": "^11.14.1",
52
- "@metamask/utils": "^11.8.1",
52
+ "@metamask/controller-utils": "^11.18.0",
53
+ "@metamask/network-controller": "^28.0.0",
54
+ "@metamask/utils": "^11.9.0",
53
55
  "@types/uuid": "^8.3.0",
54
56
  "fast-json-stable-stringify": "^2.1.0",
55
57
  "uuid": "^8.3.2"
56
58
  },
57
59
  "devDependencies": {
58
60
  "@metamask/auto-changelog": "^3.4.4",
59
- "@metamask/network-controller": "^25.0.0",
61
+ "@ts-bridge/cli": "^0.6.4",
60
62
  "@types/jest": "^27.4.1",
61
63
  "deepmerge": "^4.2.2",
62
64
  "jest": "^27.5.1",
@@ -64,10 +66,7 @@
64
66
  "ts-jest": "^27.1.4",
65
67
  "typedoc": "^0.24.8",
66
68
  "typedoc-plugin-missing-exports": "^2.0.0",
67
- "typescript": "~5.2.2"
68
- },
69
- "peerDependencies": {
70
- "@metamask/network-controller": "^25.0.0"
69
+ "typescript": "~5.3.3"
71
70
  },
72
71
  "engines": {
73
72
  "node": "^18.18 || >=20"