@automattic/jetpack-boost-score-api 0.1.3 → 0.1.5

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
@@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.1.5] - 2023-07-17
9
+ ### Changed
10
+ - Updated package dependencies. [#31815]
11
+
12
+ ## [0.1.4] - 2023-07-11
13
+ ### Changed
14
+ - Updated package dependencies. [#31785]
15
+
16
+ ### Fixed
17
+ - Fix type declarations for vars holding returns from `setTimeout`, `setInterval`. [#31769]
18
+
8
19
  ## [0.1.3] - 2023-07-05
9
20
  ### Changed
10
21
  - Updated package dependencies. [#31659]
@@ -24,6 +35,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
24
35
  ### Added
25
36
  - Create package for the boost score bar API [#30781]
26
37
 
38
+ [0.1.5]: https://github.com/Automattic/jetpack-boost-score-api/compare/v0.1.4...v0.1.5
39
+ [0.1.4]: https://github.com/Automattic/jetpack-boost-score-api/compare/v0.1.3...v0.1.4
27
40
  [0.1.3]: https://github.com/Automattic/jetpack-boost-score-api/compare/v0.1.2...v0.1.3
28
41
  [0.1.2]: https://github.com/Automattic/jetpack-boost-score-api/compare/v0.1.1...v0.1.2
29
42
  [0.1.1]: https://github.com/Automattic/jetpack-boost-score-api/compare/v0.1.0...v0.1.1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automattic/jetpack-boost-score-api",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "A package to get the Jetpack Boost score of a site",
5
5
  "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/boost-score-api/#readme",
6
6
  "bugs": {
@@ -20,13 +20,13 @@
20
20
  "test": "jest tests"
21
21
  },
22
22
  "dependencies": {
23
- "@wordpress/i18n": "4.36.0",
23
+ "@wordpress/i18n": "4.37.0",
24
24
  "zod": "3.20.2"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@automattic/jetpack-webpack-config": "workspace:*",
28
- "@typescript-eslint/parser": "5.59.0",
29
- "eslint": "8.39.0",
28
+ "@typescript-eslint/parser": "5.62.0",
29
+ "eslint": "8.44.0",
30
30
  "jest": "29.5.0",
31
31
  "jest-environment-jsdom": "29.4.3",
32
32
  "ts-loader": "9.4.2",
@@ -1,12 +1,12 @@
1
1
  import { __ } from '@wordpress/i18n';
2
2
 
3
- type Resolve< ReturnType = void > = ( value: ReturnType | PromiseLike< ReturnType > ) => void;
3
+ type Resolve< RetType = void > = ( value: RetType | PromiseLike< RetType > ) => void;
4
4
 
5
- type PollPromiseArgs< ReturnType = void > = {
5
+ type PollPromiseArgs< RetType = void > = {
6
6
  interval: number;
7
7
  timeout: number;
8
8
  timeoutError?: string;
9
- callback: ( resolve: Resolve< ReturnType > ) => Promise< void > | void;
9
+ callback: ( resolve: Resolve< RetType > ) => Promise< void > | void;
10
10
  };
11
11
 
12
12
  /**
@@ -16,23 +16,24 @@ type PollPromiseArgs< ReturnType = void > = {
16
16
  *
17
17
  * Rejects with a timeout after <timeout> milliseconds.
18
18
  *
19
- * @template ReturnType
19
+ * @template RetType
20
20
  * @param {object} obj - Arguments object.
21
21
  * @param {number} obj.interval - Milliseconds between calling callback
22
22
  * @param {number} obj.timeout - Milliseconds before rejecting w/ a timeout
23
23
  * @param {Function} obj.callback - Callback to call every <interval> ms.
24
24
  * @param {string} obj.timeoutError - Message to throw on timeout.
25
- * @returns {Promise< ReturnType >} - A promise which resolves to the value resolved() inside callback.
25
+ * @returns {Promise< RetType >} - A promise which resolves to the value resolved() inside callback.
26
26
  */
27
- export default async function pollPromise< ReturnType = void >( {
27
+ export default async function pollPromise< RetType = void >( {
28
28
  interval,
29
29
  callback,
30
30
  timeout,
31
31
  timeoutError,
32
- }: PollPromiseArgs< ReturnType > ): Promise< ReturnType > {
33
- let timeoutHandle: number, intervalHandle: number;
32
+ }: PollPromiseArgs< RetType > ): Promise< RetType > {
33
+ let timeoutHandle: ReturnType< typeof setTimeout >,
34
+ intervalHandle: ReturnType< typeof setInterval >;
34
35
 
35
- return new Promise< ReturnType >( ( resolve, reject ) => {
36
+ return new Promise< RetType >( ( resolve, reject ) => {
36
37
  timeoutHandle = setTimeout( () => {
37
38
  reject( new Error( timeoutError || __( 'Timed out', 'boost-score-api' ) ) );
38
39
  }, timeout || 2 * 60 * 1000 );