@automattic/jetpack-scan 0.4.1 → 0.5.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,13 @@ 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.5.0] - 2024-12-04
9
+ ### Added
10
+ - Added more types for working with scan results. [#40399]
11
+
12
+ ### Changed
13
+ - Updated package dependencies. [#40363]
14
+
8
15
  ## [0.4.1] - 2024-11-28
9
16
  ### Fixed
10
17
  - Fix package build. [#40299]
@@ -72,6 +79,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
72
79
  ### Removed
73
80
  - Updated dependencies. [#39754]
74
81
 
82
+ [0.5.0]: https://github.com/Automattic/jetpack-scan/compare/v0.4.1...v0.5.0
75
83
  [0.4.1]: https://github.com/Automattic/jetpack-scan/compare/v0.4.0...v0.4.1
76
84
  [0.4.0]: https://github.com/Automattic/jetpack-scan/compare/v0.3.0...v0.4.0
77
85
  [0.3.0]: https://github.com/Automattic/jetpack-scan/compare/v0.2.0...v0.3.0
@@ -12,3 +12,23 @@ export type ThreatFixStatusSuccess = {
12
12
  lastUpdated: string;
13
13
  };
14
14
  export type ThreatFixStatus = ThreatFixStatusError | ThreatFixStatusSuccess;
15
+ /**
16
+ * Fixers Status
17
+ *
18
+ * Overall status of all fixers.
19
+ */
20
+ type FixersStatusBase = {
21
+ ok: boolean;
22
+ };
23
+ export type FixersStatusError = FixersStatusBase & {
24
+ ok: false;
25
+ error: string;
26
+ };
27
+ export type FixersStatusSuccess = FixersStatusBase & {
28
+ ok: true;
29
+ threats: {
30
+ [key: number]: ThreatFixStatus;
31
+ };
32
+ };
33
+ export type FixersStatus = FixersStatusSuccess | FixersStatusError;
34
+ export {};
@@ -1,2 +1,3 @@
1
1
  export * from './fixers.js';
2
+ export * from './status.js';
2
3
  export * from './threats.js';
@@ -1,2 +1,3 @@
1
1
  export * from './fixers.js';
2
+ export * from './status.js';
2
3
  export * from './threats.js';
@@ -0,0 +1,23 @@
1
+ import { Threat } from './threats.js';
2
+ export type ScanStatus = {
3
+ /** The current status of the scanner. */
4
+ status: 'unavailable' | 'provisioning' | 'idle' | 'scanning' | 'scheduled';
5
+ /** The IDs of fixable threats. */
6
+ fixableThreatIds: number[];
7
+ /** The current scan progress, only available from the Scan API. */
8
+ currentProgress: number | null;
9
+ /** The data source for the scan status. */
10
+ dataSource: 'protect_report' | 'scan_api';
11
+ /** Whether the site currently has extensions not checked in the latest scan. */
12
+ hasUncheckedItems: boolean;
13
+ /** The time the last scan was checked, in YYYY-MM-DD HH:MM:SS format. */
14
+ lastChecked: string | null;
15
+ /** Whether there was an error in the scan results. */
16
+ error: boolean | null;
17
+ /** The error code. */
18
+ errorCode: string | null;
19
+ /** The error message. */
20
+ errorMessage: string | null;
21
+ /** The detected threats. */
22
+ threats: Threat[];
23
+ };
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@automattic/jetpack-scan",
4
- "version": "0.4.1",
4
+ "version": "0.5.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": {
@@ -45,18 +45,18 @@
45
45
  "main": "./build/index.js",
46
46
  "types": "./build/index.d.ts",
47
47
  "dependencies": {
48
- "@automattic/jetpack-api": "^0.17.19",
49
- "@automattic/jetpack-base-styles": "^0.6.37",
50
- "@wordpress/api-fetch": "7.12.0",
51
- "@wordpress/element": "6.12.0",
52
- "@wordpress/i18n": "5.12.0",
53
- "@wordpress/url": "4.12.0",
48
+ "@automattic/jetpack-api": "^0.17.20",
49
+ "@automattic/jetpack-base-styles": "^0.6.38",
50
+ "@wordpress/api-fetch": "7.13.0",
51
+ "@wordpress/element": "6.13.0",
52
+ "@wordpress/i18n": "5.13.0",
53
+ "@wordpress/url": "4.13.0",
54
54
  "debug": "4.3.4",
55
55
  "react": "^18.2.0",
56
56
  "react-dom": "^18.2.0"
57
57
  },
58
58
  "peerDependencies": {
59
- "@wordpress/i18n": "5.12.0",
59
+ "@wordpress/i18n": "5.13.0",
60
60
  "react": "^18.2.0",
61
61
  "react-dom": "^18.2.0"
62
62
  }
@@ -15,3 +15,26 @@ export type ThreatFixStatusSuccess = {
15
15
  };
16
16
 
17
17
  export type ThreatFixStatus = ThreatFixStatusError | ThreatFixStatusSuccess;
18
+
19
+ /**
20
+ * Fixers Status
21
+ *
22
+ * Overall status of all fixers.
23
+ */
24
+ type FixersStatusBase = {
25
+ ok: boolean; // Discriminator for overall success
26
+ };
27
+
28
+ export type FixersStatusError = FixersStatusBase & {
29
+ ok: false;
30
+ error: string;
31
+ };
32
+
33
+ export type FixersStatusSuccess = FixersStatusBase & {
34
+ ok: true;
35
+ threats: {
36
+ [ key: number ]: ThreatFixStatus;
37
+ };
38
+ };
39
+
40
+ export type FixersStatus = FixersStatusSuccess | FixersStatusError;
@@ -1,2 +1,3 @@
1
1
  export * from './fixers.js';
2
+ export * from './status.js';
2
3
  export * from './threats.js';
@@ -0,0 +1,33 @@
1
+ import { Threat } from './threats.js';
2
+
3
+ export type ScanStatus = {
4
+ /** The current status of the scanner. */
5
+ status: 'unavailable' | 'provisioning' | 'idle' | 'scanning' | 'scheduled';
6
+
7
+ /** The IDs of fixable threats. */
8
+ fixableThreatIds: number[];
9
+
10
+ /** The current scan progress, only available from the Scan API. */
11
+ currentProgress: number | null;
12
+
13
+ /** The data source for the scan status. */
14
+ dataSource: 'protect_report' | 'scan_api';
15
+
16
+ /** Whether the site currently has extensions not checked in the latest scan. */
17
+ hasUncheckedItems: boolean;
18
+
19
+ /** The time the last scan was checked, in YYYY-MM-DD HH:MM:SS format. */
20
+ lastChecked: string | null;
21
+
22
+ /** Whether there was an error in the scan results. */
23
+ error: boolean | null;
24
+
25
+ /** The error code. */
26
+ errorCode: string | null;
27
+
28
+ /** The error message. */
29
+ errorMessage: string | null;
30
+
31
+ /** The detected threats. */
32
+ threats: Threat[];
33
+ };