@automattic/jetpack-scan 0.1.0 → 0.2.0

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,10 @@ 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.2.0] - 2024-11-14
9
+ ### Added
10
+ - Adds fixer utility functions [#40111]
11
+
8
12
  ## 0.1.0 - 2024-11-11
9
13
  ### Added
10
14
  - Added threat and fixer types. [#39754]
@@ -52,3 +56,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
52
56
 
53
57
  ### Removed
54
58
  - Updated dependencies. [#39754]
59
+
60
+ [0.2.0]: https://github.com/Automattic/jetpack-scan/compare/v0.1.0...v0.2.0
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@automattic/jetpack-scan",
4
- "version": "0.1.0",
4
+ "version": "0.2.0",
5
5
  "description": "A JS client for consuming Jetpack Scan services",
6
6
  "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/scan/#readme",
7
7
  "bugs": {
@@ -50,8 +50,8 @@
50
50
  "main": "./build/index.js",
51
51
  "types": "./build/index.d.ts",
52
52
  "dependencies": {
53
- "@automattic/jetpack-api": "^0.17.17",
54
- "@automattic/jetpack-base-styles": "^0.6.35",
53
+ "@automattic/jetpack-api": "^0.17.18",
54
+ "@automattic/jetpack-base-styles": "^0.6.36",
55
55
  "@wordpress/api-fetch": "7.11.0",
56
56
  "@wordpress/element": "6.11.0",
57
57
  "@wordpress/i18n": "5.11.0",
@@ -20,10 +20,18 @@ export const fixerTimestampIsStale = ( lastUpdatedTimestamp: string ) => {
20
20
  return now.getTime() - lastUpdated.getTime() >= FIXER_IS_STALE_THRESHOLD;
21
21
  };
22
22
 
23
+ export const fixerIsInError = ( fixerStatus: ThreatFixStatus ) => {
24
+ return 'error' in fixerStatus && fixerStatus.error;
25
+ };
26
+
27
+ export const fixerIsInProgress = ( fixerStatus: ThreatFixStatus ) => {
28
+ return 'status' in fixerStatus && fixerStatus.status === 'in_progress';
29
+ };
30
+
23
31
  export const fixerStatusIsStale = ( fixerStatus: ThreatFixStatus ) => {
24
32
  return (
25
- 'status' in fixerStatus &&
26
- fixerStatus.status === 'in_progress' &&
33
+ fixerIsInProgress( fixerStatus ) &&
34
+ 'lastUpdated' in fixerStatus &&
27
35
  fixerTimestampIsStale( fixerStatus.lastUpdated )
28
36
  );
29
37
  };