camou 0.6.1 → 0.8.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 +13 -0
- package/README.md +81 -69
- package/dist/browser/manager.d.ts +21 -1
- package/dist/browser/manager.js +89 -1
- package/dist/browser/manager.js.map +1 -1
- package/dist/cli/defaults.js +5 -0
- package/dist/cli/defaults.js.map +1 -1
- package/dist/cli/output.js +135 -0
- package/dist/cli/output.js.map +1 -1
- package/dist/cli/program.js +54 -0
- package/dist/cli/program.js.map +1 -1
- package/dist/daemon/router.js +14 -0
- package/dist/daemon/router.js.map +1 -1
- package/dist/ipc/protocol.d.ts +575 -0
- package/dist/ipc/protocol.js +41 -0
- package/dist/ipc/protocol.js.map +1 -1
- package/dist/state/session-profiles.d.ts +24 -0
- package/dist/state/session-profiles.js +50 -0
- package/dist/state/session-profiles.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { CamoucliPaths } from './paths.js';
|
|
2
|
+
export interface StoredSessionProfile {
|
|
3
|
+
profileName: string;
|
|
4
|
+
rootDir: string;
|
|
5
|
+
profileDir: string;
|
|
6
|
+
downloadsDir: string;
|
|
7
|
+
artifactsDir: string;
|
|
8
|
+
stored: true;
|
|
9
|
+
}
|
|
10
|
+
export interface RemovedStoredSessionProfile {
|
|
11
|
+
profileName: string;
|
|
12
|
+
rootDir: string;
|
|
13
|
+
removed: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare function resolveStoredSessionProfile(paths: CamoucliPaths, profileName: string): StoredSessionProfile;
|
|
16
|
+
export declare function listStoredSessionProfiles(paths: CamoucliPaths): Promise<StoredSessionProfile[]>;
|
|
17
|
+
export declare function inspectStoredSessionProfile(paths: CamoucliPaths, profileName: string): Promise<(StoredSessionProfile & {
|
|
18
|
+
found: true;
|
|
19
|
+
}) | {
|
|
20
|
+
profileName: string;
|
|
21
|
+
rootDir: string;
|
|
22
|
+
found: false;
|
|
23
|
+
}>;
|
|
24
|
+
export declare function removeStoredSessionProfile(paths: CamoucliPaths, profileName: string): Promise<RemovedStoredSessionProfile>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { readdir, rm, stat } from 'node:fs/promises';
|
|
3
|
+
import { sanitizeName } from './paths.js';
|
|
4
|
+
export function resolveStoredSessionProfile(paths, profileName) {
|
|
5
|
+
const safeProfileName = sanitizeName(profileName);
|
|
6
|
+
const rootDir = path.join(paths.profilesDir, safeProfileName);
|
|
7
|
+
return {
|
|
8
|
+
profileName: safeProfileName,
|
|
9
|
+
rootDir,
|
|
10
|
+
profileDir: path.join(rootDir, 'user-data'),
|
|
11
|
+
downloadsDir: path.join(rootDir, 'downloads'),
|
|
12
|
+
artifactsDir: path.join(rootDir, 'artifacts'),
|
|
13
|
+
stored: true,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export async function listStoredSessionProfiles(paths) {
|
|
17
|
+
const entries = await readdir(paths.profilesDir, { withFileTypes: true });
|
|
18
|
+
return entries
|
|
19
|
+
.filter((entry) => entry.isDirectory())
|
|
20
|
+
.map((entry) => resolveStoredSessionProfile(paths, entry.name))
|
|
21
|
+
.sort((left, right) => left.profileName.localeCompare(right.profileName));
|
|
22
|
+
}
|
|
23
|
+
export async function inspectStoredSessionProfile(paths, profileName) {
|
|
24
|
+
const record = resolveStoredSessionProfile(paths, profileName);
|
|
25
|
+
try {
|
|
26
|
+
const details = await stat(record.rootDir);
|
|
27
|
+
if (!details.isDirectory()) {
|
|
28
|
+
return { profileName: record.profileName, rootDir: record.rootDir, found: false };
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
return { profileName: record.profileName, rootDir: record.rootDir, found: false };
|
|
33
|
+
}
|
|
34
|
+
return { ...record, found: true };
|
|
35
|
+
}
|
|
36
|
+
export async function removeStoredSessionProfile(paths, profileName) {
|
|
37
|
+
const record = resolveStoredSessionProfile(paths, profileName);
|
|
38
|
+
try {
|
|
39
|
+
const details = await stat(record.rootDir);
|
|
40
|
+
if (!details.isDirectory()) {
|
|
41
|
+
return { profileName: record.profileName, rootDir: record.rootDir, removed: false };
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
return { profileName: record.profileName, rootDir: record.rootDir, removed: false };
|
|
46
|
+
}
|
|
47
|
+
await rm(record.rootDir, { recursive: true, force: true });
|
|
48
|
+
return { profileName: record.profileName, rootDir: record.rootDir, removed: true };
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=session-profiles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-profiles.js","sourceRoot":"","sources":["../../src/state/session-profiles.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAGrD,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAiB1C,MAAM,UAAU,2BAA2B,CAAC,KAAoB,EAAE,WAAmB;IACnF,MAAM,eAAe,GAAG,YAAY,CAAC,WAAW,CAAC,CAAC;IAClD,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC;IAC9D,OAAO;QACL,WAAW,EAAE,eAAe;QAC5B,OAAO;QACP,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,WAAW,CAAC;QAC3C,YAAY,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,WAAW,CAAC;QAC7C,YAAY,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,WAAW,CAAC;QAC7C,MAAM,EAAE,IAAI;KACb,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAAC,KAAoB;IAClE,MAAM,OAAO,GAAG,MAAM,OA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