@cfour-hi/dsh-plugin-devicex 0.0.0-stage → 1.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/LICENSE +21 -0
- package/README.md +38 -2
- package/client.js +754 -0
- package/cordis.patch.yml +3 -0
- package/host/actions-darwin.js +1052 -0
- package/host/actions-win32.js +1299 -0
- package/host/actions.js +45 -0
- package/host/benchmark.js +413 -0
- package/host/cleanup-darwin.js +715 -0
- package/host/cleanup-win32.js +760 -0
- package/host/cleanup.js +62 -0
- package/host/collector-darwin.js +2995 -0
- package/host/collector-win32.js +2057 -0
- package/host/collector.js +71 -0
- package/host/proc.js +232 -0
- package/host/tool.js +254 -0
- package/host/transport.js +294 -0
- package/host/win/hardware.ps1 +501 -0
- package/host/win/metrics.ps1 +535 -0
- package/host/win/network.ps1 +322 -0
- package/host/win/processes.ps1 +169 -0
- package/host/win/security.ps1 +197 -0
- package/host/win/software.ps1 +119 -0
- package/host/win/system.ps1 +279 -0
- package/host/win.js +187 -0
- package/icon.svg +18 -0
- package/index.js +65 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +60 -4
package/host/cleanup.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Device X cleanup — platform dispatcher.
|
|
3
|
+
*
|
|
4
|
+
* The cleanup API is identical on every supported platform; this module only
|
|
5
|
+
* picks the implementation:
|
|
6
|
+
*
|
|
7
|
+
* - `darwin` → `cleanup-darwin.js` (macOS cache/log/trash/developer roots)
|
|
8
|
+
* - `win32` → `cleanup-win32.js` (Windows temp/update/thumbnail roots and the
|
|
9
|
+
* Recycle Bin)
|
|
10
|
+
*
|
|
11
|
+
* `dsh.bundle.platforms` limits installation to those two hosts; the darwin
|
|
12
|
+
* branch is the safe fallback for anything else (every root then fails into
|
|
13
|
+
* the item's `error` string instead of throwing).
|
|
14
|
+
*
|
|
15
|
+
* Deletion never accepts a path from the caller: `deleteCleanup(ids)` maps ids
|
|
16
|
+
* to the fixed absolute allowlist entries and refuses everything else.
|
|
17
|
+
*
|
|
18
|
+
* @module @cfour-hi/dsh-plugin-devicex/host/cleanup
|
|
19
|
+
*/
|
|
20
|
+
import * as darwin from './cleanup-darwin.js';
|
|
21
|
+
import * as win32 from './cleanup-win32.js';
|
|
22
|
+
|
|
23
|
+
/** Host platform. */
|
|
24
|
+
export const PLATFORM = process.platform;
|
|
25
|
+
|
|
26
|
+
const impl = process.platform === 'win32' ? win32 : darwin;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Scan every allowlisted cleanup location. Cached for 60 s.
|
|
30
|
+
* @param {{fresh?: boolean}} [options]
|
|
31
|
+
* @returns {Promise<object>} the cleanup scan document.
|
|
32
|
+
*/
|
|
33
|
+
export function scanCleanup(options = {}) {
|
|
34
|
+
return impl.scanCleanup(options);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Delete the contents of allowlisted cleanup items (ids only, never paths).
|
|
39
|
+
* @param {unknown} ids cleanup item ids (array or comma separated string).
|
|
40
|
+
* @returns {Promise<object>} `{ok, message, data:{deletedBytes, items}}`.
|
|
41
|
+
*/
|
|
42
|
+
export function deleteCleanup(ids) {
|
|
43
|
+
return impl.deleteCleanup(ids);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* The cleanup allowlist as public metadata (ids, labels, categories, fixed
|
|
48
|
+
* paths). Used by the action validator, tests and client labelling.
|
|
49
|
+
* @returns {Array<{id: string, label: string, category: string,
|
|
50
|
+
* requiresAdmin: boolean, path: string|null}>}
|
|
51
|
+
*/
|
|
52
|
+
export function cleanupItems() {
|
|
53
|
+
return impl.cleanupItems();
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** Test seam exposing the selected implementation for offline verification. */
|
|
57
|
+
export const __test = {
|
|
58
|
+
platform: impl.PLATFORM,
|
|
59
|
+
hostPlatform: PLATFORM,
|
|
60
|
+
darwin,
|
|
61
|
+
win32,
|
|
62
|
+
};
|