pushwork 1.0.5 → 1.0.11
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/README.md +87 -335
- package/babel.config.js +5 -0
- package/dist/cli/commands.d.ts +9 -15
- package/dist/cli/commands.d.ts.map +1 -1
- package/dist/cli/commands.js +37 -170
- package/dist/cli/commands.js.map +1 -1
- package/dist/cli/output.d.ts +11 -25
- package/dist/cli/output.d.ts.map +1 -1
- package/dist/cli/output.js +55 -61
- package/dist/cli/output.js.map +1 -1
- package/dist/cli.js +208 -213
- package/dist/cli.js.map +1 -1
- package/dist/commands.d.ts +51 -0
- package/dist/commands.d.ts.map +1 -0
- package/dist/commands.js +799 -0
- package/dist/commands.js.map +1 -0
- package/dist/core/change-detection.d.ts +7 -23
- package/dist/core/change-detection.d.ts.map +1 -1
- package/dist/core/change-detection.js +108 -122
- package/dist/core/change-detection.js.map +1 -1
- package/dist/core/config.d.ts +81 -0
- package/dist/core/config.d.ts.map +1 -0
- package/dist/core/config.js +296 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +1 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/move-detection.d.ts +4 -3
- package/dist/core/move-detection.d.ts.map +1 -1
- package/dist/core/move-detection.js +8 -7
- package/dist/core/move-detection.js.map +1 -1
- package/dist/core/snapshot.d.ts +0 -4
- package/dist/core/snapshot.d.ts.map +1 -1
- package/dist/core/snapshot.js +2 -11
- package/dist/core/snapshot.js.map +1 -1
- package/dist/core/sync-engine.d.ts +41 -12
- package/dist/core/sync-engine.d.ts.map +1 -1
- package/dist/core/sync-engine.js +522 -359
- package/dist/core/sync-engine.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -6
- package/dist/index.js.map +1 -1
- package/dist/types/config.d.ts +24 -88
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/config.js +6 -0
- package/dist/types/config.js.map +1 -1
- package/dist/types/documents.d.ts +15 -2
- package/dist/types/documents.d.ts.map +1 -1
- package/dist/types/documents.js.map +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +0 -3
- package/dist/types/index.js.map +1 -1
- package/dist/types/snapshot.d.ts +0 -21
- package/dist/types/snapshot.d.ts.map +1 -1
- package/dist/types/snapshot.js +0 -14
- package/dist/types/snapshot.js.map +1 -1
- package/dist/utils/content.d.ts.map +1 -1
- package/dist/utils/content.js +2 -6
- package/dist/utils/content.js.map +1 -1
- package/dist/utils/directory.d.ts +24 -0
- package/dist/utils/directory.d.ts.map +1 -0
- package/dist/utils/directory.js +56 -0
- package/dist/utils/directory.js.map +1 -0
- package/dist/utils/fs.d.ts +15 -2
- package/dist/utils/fs.d.ts.map +1 -1
- package/dist/utils/fs.js +53 -20
- package/dist/utils/fs.js.map +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -3
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/keyhive.d.ts +9 -0
- package/dist/utils/keyhive.d.ts.map +1 -0
- package/dist/utils/keyhive.js +26 -0
- package/dist/utils/keyhive.js.map +1 -0
- package/dist/utils/mime-types.d.ts.map +1 -1
- package/dist/utils/mime-types.js +11 -4
- package/dist/utils/mime-types.js.map +1 -1
- package/dist/utils/network-sync.d.ts +16 -7
- package/dist/utils/network-sync.d.ts.map +1 -1
- package/dist/utils/network-sync.js +158 -99
- package/dist/utils/network-sync.js.map +1 -1
- package/dist/utils/output.d.ts +129 -0
- package/dist/utils/output.d.ts.map +1 -0
- package/dist/utils/output.js +375 -0
- package/dist/utils/output.js.map +1 -0
- package/dist/utils/repo-factory.d.ts +2 -6
- package/dist/utils/repo-factory.d.ts.map +1 -1
- package/dist/utils/repo-factory.js +8 -31
- package/dist/utils/repo-factory.js.map +1 -1
- package/dist/utils/string-similarity.js +2 -2
- package/dist/utils/string-similarity.js.map +1 -1
- package/dist/utils/trace.d.ts +19 -0
- package/dist/utils/trace.d.ts.map +1 -0
- package/dist/utils/trace.js +68 -0
- package/dist/utils/trace.js.map +1 -0
- package/package.json +21 -11
- package/src/cli.ts +276 -308
- package/src/commands.ts +988 -0
- package/src/core/change-detection.ts +226 -246
- package/src/{config/index.ts → core/config.ts} +65 -82
- package/src/core/index.ts +1 -1
- package/src/core/move-detection.ts +10 -8
- package/src/core/snapshot.ts +2 -12
- package/src/core/sync-engine.ts +630 -478
- package/src/index.ts +0 -10
- package/src/types/config.ts +28 -93
- package/src/types/documents.ts +16 -2
- package/src/types/index.ts +0 -5
- package/src/types/snapshot.ts +0 -23
- package/src/utils/content.ts +2 -6
- package/src/utils/directory.ts +73 -0
- package/src/utils/fs.ts +57 -23
- package/src/utils/index.ts +1 -5
- package/src/utils/mime-types.ts +12 -4
- package/src/utils/network-sync.ts +216 -138
- package/src/utils/output.ts +450 -0
- package/src/utils/repo-factory.ts +13 -44
- package/src/utils/string-similarity.ts +2 -2
- package/src/utils/trace.ts +70 -0
- package/test/integration/exclude-patterns.test.ts +6 -15
- package/test/integration/fuzzer.test.ts +308 -391
- package/test/integration/in-memory-sync.test.ts +435 -0
- package/test/integration/init-sync.test.ts +89 -0
- package/test/integration/sync-deletion.test.ts +2 -61
- package/test/integration/sync-flow.test.ts +4 -24
- package/test/jest.setup.ts +34 -0
- package/test/unit/deletion-behavior.test.ts +3 -14
- package/test/unit/enhanced-mime-detection.test.ts +0 -22
- package/test/unit/snapshot.test.ts +2 -29
- package/test/unit/sync-convergence.test.ts +3 -198
- package/test/unit/sync-timing.test.ts +0 -44
- package/test/unit/utils.test.ts +0 -2
- package/tsconfig.json +3 -3
- package/bench/filesystem.bench.ts +0 -78
- package/bench/hashing.bench.ts +0 -60
- package/bench/move-detection.bench.ts +0 -130
- package/bench/runner.ts +0 -49
- package/dist/browser/browser-sync-engine.d.ts +0 -64
- package/dist/browser/browser-sync-engine.d.ts.map +0 -1
- package/dist/browser/browser-sync-engine.js +0 -303
- package/dist/browser/browser-sync-engine.js.map +0 -1
- package/dist/browser/filesystem-adapter.d.ts +0 -84
- package/dist/browser/filesystem-adapter.d.ts.map +0 -1
- package/dist/browser/filesystem-adapter.js +0 -413
- package/dist/browser/filesystem-adapter.js.map +0 -1
- package/dist/browser/index.d.ts +0 -36
- package/dist/browser/index.d.ts.map +0 -1
- package/dist/browser/index.js +0 -90
- package/dist/browser/index.js.map +0 -1
- package/dist/browser/types.d.ts +0 -70
- package/dist/browser/types.d.ts.map +0 -1
- package/dist/browser/types.js +0 -6
- package/dist/browser/types.js.map +0 -1
- package/dist/config/remote-manager.d.ts +0 -65
- package/dist/config/remote-manager.d.ts.map +0 -1
- package/dist/config/remote-manager.js +0 -243
- package/dist/config/remote-manager.js.map +0 -1
- package/dist/core/isomorphic-snapshot.d.ts +0 -58
- package/dist/core/isomorphic-snapshot.d.ts.map +0 -1
- package/dist/core/isomorphic-snapshot.js +0 -204
- package/dist/core/isomorphic-snapshot.js.map +0 -1
- package/dist/platform/browser-filesystem.d.ts +0 -26
- package/dist/platform/browser-filesystem.d.ts.map +0 -1
- package/dist/platform/browser-filesystem.js +0 -91
- package/dist/platform/browser-filesystem.js.map +0 -1
- package/dist/platform/filesystem.d.ts +0 -29
- package/dist/platform/filesystem.d.ts.map +0 -1
- package/dist/platform/filesystem.js +0 -65
- package/dist/platform/filesystem.js.map +0 -1
- package/dist/platform/node-filesystem.d.ts +0 -21
- package/dist/platform/node-filesystem.d.ts.map +0 -1
- package/dist/platform/node-filesystem.js +0 -93
- package/dist/platform/node-filesystem.js.map +0 -1
- package/dist/utils/fs-browser.d.ts +0 -57
- package/dist/utils/fs-browser.d.ts.map +0 -1
- package/dist/utils/fs-browser.js +0 -311
- package/dist/utils/fs-browser.js.map +0 -1
- package/dist/utils/fs-node.d.ts +0 -53
- package/dist/utils/fs-node.d.ts.map +0 -1
- package/dist/utils/fs-node.js +0 -220
- package/dist/utils/fs-node.js.map +0 -1
- package/dist/utils/isomorphic.d.ts +0 -29
- package/dist/utils/isomorphic.d.ts.map +0 -1
- package/dist/utils/isomorphic.js +0 -139
- package/dist/utils/isomorphic.js.map +0 -1
- package/dist/utils/pure.d.ts +0 -25
- package/dist/utils/pure.d.ts.map +0 -1
- package/dist/utils/pure.js +0 -112
- package/dist/utils/pure.js.map +0 -1
- package/src/cli/commands.ts +0 -1030
- package/src/cli/index.ts +0 -2
- package/src/cli/output.ts +0 -244
- package/test/README-TESTING-GAPS.md +0 -174
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { RemoteConfig } from "../types";
|
|
2
|
-
import { ConfigManager } from "./index";
|
|
3
|
-
/**
|
|
4
|
-
* Manages multiple remotes for a pushwork directory
|
|
5
|
-
*/
|
|
6
|
-
export declare class RemoteManager {
|
|
7
|
-
private workingDir;
|
|
8
|
-
private configManager;
|
|
9
|
-
private static readonly REMOTES_DIR;
|
|
10
|
-
constructor(workingDir: string, configManager: ConfigManager);
|
|
11
|
-
/**
|
|
12
|
-
* Get path to remotes directory
|
|
13
|
-
*/
|
|
14
|
-
private getRemotesDir;
|
|
15
|
-
/**
|
|
16
|
-
* Get path to a specific remote's directory
|
|
17
|
-
*/
|
|
18
|
-
private getRemoteDir;
|
|
19
|
-
/**
|
|
20
|
-
* Get path to a remote's snapshot file
|
|
21
|
-
*/
|
|
22
|
-
getRemoteSnapshotPath(remoteName: string): string;
|
|
23
|
-
/**
|
|
24
|
-
* Get path to a remote's automerge storage
|
|
25
|
-
*/
|
|
26
|
-
getRemoteAutomergePath(remoteName: string): string;
|
|
27
|
-
/**
|
|
28
|
-
* Add a new remote
|
|
29
|
-
*/
|
|
30
|
-
addRemote(remote: RemoteConfig): Promise<void>;
|
|
31
|
-
/**
|
|
32
|
-
* Remove a remote
|
|
33
|
-
*/
|
|
34
|
-
removeRemote(remoteName: string): Promise<void>;
|
|
35
|
-
/**
|
|
36
|
-
* List all remotes
|
|
37
|
-
*/
|
|
38
|
-
listRemotes(): Promise<RemoteConfig[]>;
|
|
39
|
-
/**
|
|
40
|
-
* Get a specific remote by name
|
|
41
|
-
*/
|
|
42
|
-
getRemote(remoteName: string): Promise<RemoteConfig | null>;
|
|
43
|
-
/**
|
|
44
|
-
* Get current remote
|
|
45
|
-
*/
|
|
46
|
-
getCurrentRemote(): Promise<RemoteConfig | null>;
|
|
47
|
-
/**
|
|
48
|
-
* Get current remote name
|
|
49
|
-
*/
|
|
50
|
-
getCurrentRemoteName(): Promise<string | null>;
|
|
51
|
-
/**
|
|
52
|
-
* Switch to a different remote
|
|
53
|
-
*/
|
|
54
|
-
switchRemote(remoteName: string): Promise<void>;
|
|
55
|
-
/**
|
|
56
|
-
* Check if remotes are configured
|
|
57
|
-
*/
|
|
58
|
-
hasRemotes(): Promise<boolean>;
|
|
59
|
-
/**
|
|
60
|
-
* Migrate legacy single-remote setup to new multi-remote format
|
|
61
|
-
* This converts the old root_directory_url to an "origin" remote
|
|
62
|
-
*/
|
|
63
|
-
migrateLegacyConfig(): Promise<boolean>;
|
|
64
|
-
}
|
|
65
|
-
//# sourceMappingURL=remote-manager.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"remote-manager.d.ts","sourceRoot":"","sources":["../../src/config/remote-manager.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAmB,MAAM,UAAU,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAGxC;;GAEG;AACH,qBAAa,aAAa;IAItB,OAAO,CAAC,UAAU;IAClB,OAAO,CAAC,aAAa;IAJvB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAa;gBAGtC,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,aAAa;IAGtC;;OAEG;IACH,OAAO,CAAC,aAAa;IAIrB;;OAEG;IACH,OAAO,CAAC,YAAY;IAIpB;;OAEG;IACH,qBAAqB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM;IAIjD;;OAEG;IACH,sBAAsB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM;IAIlD;;OAEG;IACG,SAAS,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAiCpD;;OAEG;IACG,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA6BrD;;OAEG;IACG,WAAW,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;IAS5C;;OAEG;IACG,SAAS,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;IASjE;;OAEG;IACG,gBAAgB,IAAI,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;IAStD;;OAEG;IACG,oBAAoB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAKpD;;OAEG;IACG,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAoBrD;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC;IAKpC;;;OAGG;IACG,mBAAmB,IAAI,OAAO,CAAC,OAAO,CAAC;CAkE9C"}
|
|
@@ -1,243 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.RemoteManager = void 0;
|
|
37
|
-
const fs = __importStar(require("fs/promises"));
|
|
38
|
-
const path = __importStar(require("path"));
|
|
39
|
-
const utils_1 = require("../utils");
|
|
40
|
-
/**
|
|
41
|
-
* Manages multiple remotes for a pushwork directory
|
|
42
|
-
*/
|
|
43
|
-
class RemoteManager {
|
|
44
|
-
constructor(workingDir, configManager) {
|
|
45
|
-
this.workingDir = workingDir;
|
|
46
|
-
this.configManager = configManager;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Get path to remotes directory
|
|
50
|
-
*/
|
|
51
|
-
getRemotesDir() {
|
|
52
|
-
return path.join(this.workingDir, ".pushwork", RemoteManager.REMOTES_DIR);
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Get path to a specific remote's directory
|
|
56
|
-
*/
|
|
57
|
-
getRemoteDir(remoteName) {
|
|
58
|
-
return path.join(this.getRemotesDir(), remoteName);
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Get path to a remote's snapshot file
|
|
62
|
-
*/
|
|
63
|
-
getRemoteSnapshotPath(remoteName) {
|
|
64
|
-
return path.join(this.getRemoteDir(remoteName), "snapshot.json");
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Get path to a remote's automerge storage
|
|
68
|
-
*/
|
|
69
|
-
getRemoteAutomergePath(remoteName) {
|
|
70
|
-
return path.join(this.getRemoteDir(remoteName), "automerge");
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Add a new remote
|
|
74
|
-
*/
|
|
75
|
-
async addRemote(remote) {
|
|
76
|
-
const config = await this.configManager.load();
|
|
77
|
-
if (!config) {
|
|
78
|
-
throw new Error("No configuration found. Run 'pushwork init' first.");
|
|
79
|
-
}
|
|
80
|
-
// Initialize remotes object if it doesn't exist
|
|
81
|
-
if (!config.remotes) {
|
|
82
|
-
config.remotes = {};
|
|
83
|
-
}
|
|
84
|
-
// Check if remote already exists
|
|
85
|
-
if (config.remotes[remote.name]) {
|
|
86
|
-
throw new Error(`Remote '${remote.name}' already exists.`);
|
|
87
|
-
}
|
|
88
|
-
// Add the remote
|
|
89
|
-
config.remotes[remote.name] = remote;
|
|
90
|
-
// Set as current remote if it's the first one
|
|
91
|
-
if (!config.current_remote) {
|
|
92
|
-
config.current_remote = remote.name;
|
|
93
|
-
}
|
|
94
|
-
// Create remote directory structure
|
|
95
|
-
const remoteDir = this.getRemoteDir(remote.name);
|
|
96
|
-
await (0, utils_1.ensureDirectoryExists)(remoteDir);
|
|
97
|
-
await (0, utils_1.ensureDirectoryExists)(this.getRemoteAutomergePath(remote.name));
|
|
98
|
-
// Save updated config
|
|
99
|
-
await this.configManager.save(config);
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Remove a remote
|
|
103
|
-
*/
|
|
104
|
-
async removeRemote(remoteName) {
|
|
105
|
-
const config = await this.configManager.load();
|
|
106
|
-
if (!config || !config.remotes) {
|
|
107
|
-
throw new Error("No remotes configured.");
|
|
108
|
-
}
|
|
109
|
-
if (!config.remotes[remoteName]) {
|
|
110
|
-
throw new Error(`Remote '${remoteName}' does not exist.`);
|
|
111
|
-
}
|
|
112
|
-
// Can't remove current remote without switching first
|
|
113
|
-
if (config.current_remote === remoteName) {
|
|
114
|
-
throw new Error(`Cannot remove current remote '${remoteName}'. Switch to another remote first.`);
|
|
115
|
-
}
|
|
116
|
-
// Remove remote from config
|
|
117
|
-
delete config.remotes[remoteName];
|
|
118
|
-
// Remove remote directory
|
|
119
|
-
const remoteDir = this.getRemoteDir(remoteName);
|
|
120
|
-
if (await (0, utils_1.pathExists)(remoteDir)) {
|
|
121
|
-
await fs.rm(remoteDir, { recursive: true, force: true });
|
|
122
|
-
}
|
|
123
|
-
await this.configManager.save(config);
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* List all remotes
|
|
127
|
-
*/
|
|
128
|
-
async listRemotes() {
|
|
129
|
-
const config = await this.configManager.load();
|
|
130
|
-
if (!config || !config.remotes) {
|
|
131
|
-
return [];
|
|
132
|
-
}
|
|
133
|
-
return Object.values(config.remotes);
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* Get a specific remote by name
|
|
137
|
-
*/
|
|
138
|
-
async getRemote(remoteName) {
|
|
139
|
-
const config = await this.configManager.load();
|
|
140
|
-
if (!config || !config.remotes) {
|
|
141
|
-
return null;
|
|
142
|
-
}
|
|
143
|
-
return config.remotes[remoteName] || null;
|
|
144
|
-
}
|
|
145
|
-
/**
|
|
146
|
-
* Get current remote
|
|
147
|
-
*/
|
|
148
|
-
async getCurrentRemote() {
|
|
149
|
-
const config = await this.configManager.load();
|
|
150
|
-
if (!config || !config.current_remote || !config.remotes) {
|
|
151
|
-
return null;
|
|
152
|
-
}
|
|
153
|
-
return config.remotes[config.current_remote] || null;
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* Get current remote name
|
|
157
|
-
*/
|
|
158
|
-
async getCurrentRemoteName() {
|
|
159
|
-
const config = await this.configManager.load();
|
|
160
|
-
return config?.current_remote || null;
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* Switch to a different remote
|
|
164
|
-
*/
|
|
165
|
-
async switchRemote(remoteName) {
|
|
166
|
-
const config = await this.configManager.load();
|
|
167
|
-
if (!config) {
|
|
168
|
-
throw new Error("No configuration found.");
|
|
169
|
-
}
|
|
170
|
-
if (!config.remotes || !config.remotes[remoteName]) {
|
|
171
|
-
throw new Error(`Remote '${remoteName}' does not exist.`);
|
|
172
|
-
}
|
|
173
|
-
// Ensure remote directory exists
|
|
174
|
-
const remoteDir = this.getRemoteDir(remoteName);
|
|
175
|
-
await (0, utils_1.ensureDirectoryExists)(remoteDir);
|
|
176
|
-
await (0, utils_1.ensureDirectoryExists)(this.getRemoteAutomergePath(remoteName));
|
|
177
|
-
// Update current remote
|
|
178
|
-
config.current_remote = remoteName;
|
|
179
|
-
await this.configManager.save(config);
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* Check if remotes are configured
|
|
183
|
-
*/
|
|
184
|
-
async hasRemotes() {
|
|
185
|
-
const config = await this.configManager.load();
|
|
186
|
-
return !!(config?.remotes && Object.keys(config.remotes).length > 0);
|
|
187
|
-
}
|
|
188
|
-
/**
|
|
189
|
-
* Migrate legacy single-remote setup to new multi-remote format
|
|
190
|
-
* This converts the old root_directory_url to an "origin" remote
|
|
191
|
-
*/
|
|
192
|
-
async migrateLegacyConfig() {
|
|
193
|
-
const config = await this.configManager.load();
|
|
194
|
-
if (!config) {
|
|
195
|
-
return false;
|
|
196
|
-
}
|
|
197
|
-
// Check if migration is needed
|
|
198
|
-
if (config.remotes && Object.keys(config.remotes).length > 0) {
|
|
199
|
-
return false; // Already migrated
|
|
200
|
-
}
|
|
201
|
-
if (!config.root_directory_url) {
|
|
202
|
-
return false; // Nothing to migrate
|
|
203
|
-
}
|
|
204
|
-
// Create origin remote from legacy config
|
|
205
|
-
const originRemote = {
|
|
206
|
-
name: "origin",
|
|
207
|
-
rootFolderUrl: config.root_directory_url,
|
|
208
|
-
syncServer: config.sync_server,
|
|
209
|
-
syncServerStorageId: config.sync_server_storage_id,
|
|
210
|
-
};
|
|
211
|
-
// Initialize remotes
|
|
212
|
-
config.remotes = {
|
|
213
|
-
origin: originRemote,
|
|
214
|
-
};
|
|
215
|
-
config.current_remote = "origin";
|
|
216
|
-
// Migrate legacy snapshot and automerge data to origin remote
|
|
217
|
-
const legacySnapshotPath = path.join(this.workingDir, ".pushwork", "snapshot.json");
|
|
218
|
-
const legacyAutomergePath = path.join(this.workingDir, ".pushwork", "automerge");
|
|
219
|
-
// Create origin remote directory
|
|
220
|
-
const originDir = this.getRemoteDir("origin");
|
|
221
|
-
await (0, utils_1.ensureDirectoryExists)(originDir);
|
|
222
|
-
// Move snapshot if it exists
|
|
223
|
-
if (await (0, utils_1.pathExists)(legacySnapshotPath)) {
|
|
224
|
-
const newSnapshotPath = this.getRemoteSnapshotPath("origin");
|
|
225
|
-
await fs.rename(legacySnapshotPath, newSnapshotPath);
|
|
226
|
-
}
|
|
227
|
-
// Move automerge data if it exists
|
|
228
|
-
if (await (0, utils_1.pathExists)(legacyAutomergePath)) {
|
|
229
|
-
const newAutomergePath = this.getRemoteAutomergePath("origin");
|
|
230
|
-
// Remove new path if it exists (shouldn't happen but be safe)
|
|
231
|
-
if (await (0, utils_1.pathExists)(newAutomergePath)) {
|
|
232
|
-
await fs.rm(newAutomergePath, { recursive: true, force: true });
|
|
233
|
-
}
|
|
234
|
-
await fs.rename(legacyAutomergePath, newAutomergePath);
|
|
235
|
-
}
|
|
236
|
-
// Save migrated config
|
|
237
|
-
await this.configManager.save(config);
|
|
238
|
-
return true;
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
exports.RemoteManager = RemoteManager;
|
|
242
|
-
RemoteManager.REMOTES_DIR = "remotes";
|
|
243
|
-
//# sourceMappingURL=remote-manager.js.map
|
|
@@ -1 +0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A,kBAAU,EAAC,kBAAkB,CAAC,EAAE,CAAC;YACzC,MAAM,eAAe,GAAG,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAC;YAC7D,MAAM,EAAE,CAAC,MAAM,CAAC,kBAAkB,EAAE,eAAe,CAAC,CAAC;QACvD,CAAC;QAED,mCAAmC;QACnC,IAAI,MAAM,IAAA,kBAAU,EAAC,mBAAmB,CAAC,EAAE,CAAC;YAC1C,MAAM,gBAAgB,GAAG,IAAI,CAAC,sBAAsB,CAAC,QAAQ,CAAC,CAAC;YAC/D,8DAA8D;YAC9D,IAAI,MAAM,IAAA,kBAAU,EAAC,gBAAgB,CAAC,EAAE,CAAC;gBACvC,MAAM,EAAE,CAAC,EAAE,CAAC,gBAAgB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;YAClE,CAAC;YACD,MAAM,EAAE,CAAC,MAAM,CAAC,mBAAmB,EAAE,gBAAgB,CAAC,CAAC;QACzD,CAAC;QAED,uBAAuB;QACvB,MAAM,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAEtC,OAAO,IAAI,CAAC;IACd,CAAC;;AAxPH,sCAyPC;AAxPyB,yBAAW,GAAG,SAAS,CAAC"}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Isomorphic snapshot manager that works in both Node.js and browser
|
|
3
|
-
*/
|
|
4
|
-
import { SyncSnapshot, SnapshotFileEntry, SnapshotDirectoryEntry } from "../types";
|
|
5
|
-
/**
|
|
6
|
-
* Platform-agnostic snapshot storage interface
|
|
7
|
-
*/
|
|
8
|
-
export interface SnapshotStorage {
|
|
9
|
-
save(snapshot: SyncSnapshot, key?: string): Promise<void>;
|
|
10
|
-
load(key?: string): Promise<SyncSnapshot | null>;
|
|
11
|
-
backup(key?: string): Promise<void>;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* File-based snapshot storage (for Node.js and browser with file system access)
|
|
15
|
-
*/
|
|
16
|
-
export declare class FileSnapshotStorage implements SnapshotStorage {
|
|
17
|
-
private rootPath;
|
|
18
|
-
private static readonly SNAPSHOT_FILENAME;
|
|
19
|
-
private static readonly SYNC_TOOL_DIR;
|
|
20
|
-
constructor(rootPath: string);
|
|
21
|
-
private getSnapshotPath;
|
|
22
|
-
private getSyncToolDir;
|
|
23
|
-
save(snapshot: SyncSnapshot, key?: string): Promise<void>;
|
|
24
|
-
load(key?: string): Promise<SyncSnapshot | null>;
|
|
25
|
-
backup(key?: string): Promise<void>;
|
|
26
|
-
private toSerializable;
|
|
27
|
-
private fromSerializable;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* IndexedDB-based snapshot storage (for browser environments)
|
|
31
|
-
*/
|
|
32
|
-
export declare class IndexedDBSnapshotStorage implements SnapshotStorage {
|
|
33
|
-
private dbName;
|
|
34
|
-
private storeName;
|
|
35
|
-
private version;
|
|
36
|
-
save(snapshot: SyncSnapshot, key?: string): Promise<void>;
|
|
37
|
-
load(key?: string): Promise<SyncSnapshot | null>;
|
|
38
|
-
backup(key?: string): Promise<void>;
|
|
39
|
-
private openDB;
|
|
40
|
-
private toSerializable;
|
|
41
|
-
private fromSerializable;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Isomorphic snapshot manager that uses appropriate storage for the platform
|
|
45
|
-
*/
|
|
46
|
-
export declare class IsomorphicSnapshotManager {
|
|
47
|
-
private storage;
|
|
48
|
-
constructor(rootPath: string, useIndexedDB?: boolean);
|
|
49
|
-
save(snapshot: SyncSnapshot): Promise<void>;
|
|
50
|
-
load(): Promise<SyncSnapshot | null>;
|
|
51
|
-
backup(): Promise<void>;
|
|
52
|
-
createEmptySnapshot(rootPath: string): Promise<SyncSnapshot>;
|
|
53
|
-
updateFileEntry(snapshot: SyncSnapshot, relativePath: string, entry: SnapshotFileEntry): void;
|
|
54
|
-
updateDirectoryEntry(snapshot: SyncSnapshot, relativePath: string, entry: SnapshotDirectoryEntry): void;
|
|
55
|
-
removeFileEntry(snapshot: SyncSnapshot, relativePath: string): void;
|
|
56
|
-
createEmpty(): SyncSnapshot;
|
|
57
|
-
}
|
|
58
|
-
//# sourceMappingURL=isomorphic-snapshot.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"isomorphic-snapshot.d.ts","sourceRoot":"","sources":["../../src/core/isomorphic-snapshot.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,YAAY,EAEZ,iBAAiB,EACjB,sBAAsB,EACvB,MAAM,UAAU,CAAC;AAQlB;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,QAAQ,EAAE,YAAY,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1D,IAAI,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;IACjD,MAAM,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACrC;AAED;;GAEG;AACH,qBAAa,mBAAoB,YAAW,eAAe;IAI7C,OAAO,CAAC,QAAQ;IAH5B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAAmB;IAC5D,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAe;gBAEhC,QAAQ,EAAE,MAAM;IAEpC,OAAO,CAAC,eAAe;IAIvB,OAAO,CAAC,cAAc;IAIhB,IAAI,CAAC,QAAQ,EAAE,YAAY,EAAE,GAAG,SAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAS5D,IAAI,CAAC,GAAG,SAAY,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;IAoBnD,MAAM,CAAC,GAAG,SAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ5C,OAAO,CAAC,cAAc;IAStB,OAA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/
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.IsomorphicSnapshotManager = exports.IndexedDBSnapshotStorage = exports.FileSnapshotStorage = void 0;
|
|
7
|
-
const isomorphic_1 = require("../utils/isomorphic");
|
|
8
|
-
/**
|
|
9
|
-
* File-based snapshot storage (for Node.js and browser with file system access)
|
|
10
|
-
*/
|
|
11
|
-
class FileSnapshotStorage {
|
|
12
|
-
constructor(rootPath) {
|
|
13
|
-
this.rootPath = rootPath;
|
|
14
|
-
}
|
|
15
|
-
getSnapshotPath(key = "current") {
|
|
16
|
-
return `${this.rootPath}/${FileSnapshotStorage.SYNC_TOOL_DIR}/${key}-${FileSnapshotStorage.SNAPSHOT_FILENAME}`;
|
|
17
|
-
}
|
|
18
|
-
getSyncToolDir() {
|
|
19
|
-
return `${this.rootPath}/${FileSnapshotStorage.SYNC_TOOL_DIR}`;
|
|
20
|
-
}
|
|
21
|
-
async save(snapshot, key = "current") {
|
|
22
|
-
await (0, isomorphic_1.ensureDirectoryExists)(this.getSyncToolDir());
|
|
23
|
-
const serializable = this.toSerializable(snapshot);
|
|
24
|
-
const content = JSON.stringify(serializable, null, 2);
|
|
25
|
-
await (0, isomorphic_1.writeFileContent)(this.getSnapshotPath(key), content);
|
|
26
|
-
}
|
|
27
|
-
async load(key = "current") {
|
|
28
|
-
const snapshotPath = this.getSnapshotPath(key);
|
|
29
|
-
if (!(await (0, isomorphic_1.pathExists)(snapshotPath))) {
|
|
30
|
-
return null;
|
|
31
|
-
}
|
|
32
|
-
try {
|
|
33
|
-
const content = await (0, isomorphic_1.readFileContent)(snapshotPath);
|
|
34
|
-
const contentStr = typeof content === "string"
|
|
35
|
-
? content
|
|
36
|
-
: new TextDecoder().decode(content);
|
|
37
|
-
const serializable = JSON.parse(contentStr);
|
|
38
|
-
return this.fromSerializable(serializable);
|
|
39
|
-
}
|
|
40
|
-
catch (error) {
|
|
41
|
-
throw new Error(`Failed to load snapshot from ${snapshotPath}: ${error}`);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
async backup(key = "current") {
|
|
45
|
-
const snapshot = await this.load(key);
|
|
46
|
-
if (snapshot) {
|
|
47
|
-
const backupKey = `${key}-backup-${Date.now()}`;
|
|
48
|
-
await this.save(snapshot, backupKey);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
toSerializable(snapshot) {
|
|
52
|
-
return {
|
|
53
|
-
rootPath: snapshot.rootPath,
|
|
54
|
-
timestamp: new Date(snapshot.timestamp).toISOString(),
|
|
55
|
-
files: Array.from(snapshot.files.entries()),
|
|
56
|
-
directories: Array.from(snapshot.directories.entries()),
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
fromSerializable(serializable) {
|
|
60
|
-
return {
|
|
61
|
-
rootPath: serializable.rootPath,
|
|
62
|
-
timestamp: new Date(serializable.timestamp).getTime(),
|
|
63
|
-
files: new Map(serializable.files),
|
|
64
|
-
directories: new Map(serializable.directories),
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
exports.FileSnapshotStorage = FileSnapshotStorage;
|
|
69
|
-
FileSnapshotStorage.SNAPSHOT_FILENAME = "snapshot.json";
|
|
70
|
-
FileSnapshotStorage.SYNC_TOOL_DIR = ".pushwork";
|
|
71
|
-
/**
|
|
72
|
-
* IndexedDB-based snapshot storage (for browser environments)
|
|
73
|
-
*/
|
|
74
|
-
class IndexedDBSnapshotStorage {
|
|
75
|
-
constructor() {
|
|
76
|
-
this.dbName = "pushwork-snapshots";
|
|
77
|
-
this.storeName = "snapshots";
|
|
78
|
-
this.version = 1;
|
|
79
|
-
}
|
|
80
|
-
async save(snapshot, key = "current") {
|
|
81
|
-
const db = await this.openDB();
|
|
82
|
-
const transaction = db.transaction([this.storeName], "readwrite");
|
|
83
|
-
const store = transaction.objectStore(this.storeName);
|
|
84
|
-
const serializable = this.toSerializable(snapshot);
|
|
85
|
-
const putRequest = store.put({
|
|
86
|
-
key,
|
|
87
|
-
snapshot: JSON.stringify(serializable),
|
|
88
|
-
timestamp: Date.now(),
|
|
89
|
-
});
|
|
90
|
-
await new Promise((resolve, reject) => {
|
|
91
|
-
putRequest.onsuccess = () => resolve(undefined);
|
|
92
|
-
putRequest.onerror = () => reject(putRequest.error);
|
|
93
|
-
});
|
|
94
|
-
db.close();
|
|
95
|
-
}
|
|
96
|
-
async load(key = "current") {
|
|
97
|
-
try {
|
|
98
|
-
const db = await this.openDB();
|
|
99
|
-
const transaction = db.transaction([this.storeName], "readonly");
|
|
100
|
-
const store = transaction.objectStore(this.storeName);
|
|
101
|
-
const request = store.get(key);
|
|
102
|
-
const result = await new Promise((resolve, reject) => {
|
|
103
|
-
request.onsuccess = () => resolve(request.result);
|
|
104
|
-
request.onerror = () => reject(request.error);
|
|
105
|
-
});
|
|
106
|
-
db.close();
|
|
107
|
-
if (result) {
|
|
108
|
-
const serializable = JSON.parse(result.snapshot);
|
|
109
|
-
return this.fromSerializable(serializable);
|
|
110
|
-
}
|
|
111
|
-
return null;
|
|
112
|
-
}
|
|
113
|
-
catch (error) {
|
|
114
|
-
console.warn("Failed to load snapshot from IndexedDB:", error);
|
|
115
|
-
return null;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
async backup(key = "current") {
|
|
119
|
-
const snapshot = await this.load(key);
|
|
120
|
-
if (snapshot) {
|
|
121
|
-
await this.save(snapshot, `${key}-backup-${Date.now()}`);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
async openDB() {
|
|
125
|
-
return new Promise((resolve, reject) => {
|
|
126
|
-
const request = indexedDB.open(this.dbName, this.version);
|
|
127
|
-
request.onerror = () => reject(request.error);
|
|
128
|
-
request.onsuccess = () => resolve(request.result);
|
|
129
|
-
request.onupgradeneeded = (event) => {
|
|
130
|
-
const db = event.target.result;
|
|
131
|
-
if (!db.objectStoreNames.contains(this.storeName)) {
|
|
132
|
-
db.createObjectStore(this.storeName, { keyPath: "key" });
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
toSerializable(snapshot) {
|
|
138
|
-
return {
|
|
139
|
-
rootPath: snapshot.rootPath,
|
|
140
|
-
timestamp: new Date(snapshot.timestamp).toISOString(),
|
|
141
|
-
files: Array.from(snapshot.files.entries()),
|
|
142
|
-
directories: Array.from(snapshot.directories.entries()),
|
|
143
|
-
};
|
|
144
|
-
}
|
|
145
|
-
fromSerializable(serializable) {
|
|
146
|
-
return {
|
|
147
|
-
rootPath: serializable.rootPath,
|
|
148
|
-
timestamp: new Date(serializable.timestamp).getTime(),
|
|
149
|
-
files: new Map(serializable.files),
|
|
150
|
-
directories: new Map(serializable.directories),
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
exports.IndexedDBSnapshotStorage = IndexedDBSnapshotStorage;
|
|
155
|
-
/**
|
|
156
|
-
* Isomorphic snapshot manager that uses appropriate storage for the platform
|
|
157
|
-
*/
|
|
158
|
-
class IsomorphicSnapshotManager {
|
|
159
|
-
constructor(rootPath, useIndexedDB = false) {
|
|
160
|
-
if (useIndexedDB ||
|
|
161
|
-
(typeof window !== "undefined" && typeof indexedDB !== "undefined")) {
|
|
162
|
-
this.storage = new IndexedDBSnapshotStorage();
|
|
163
|
-
}
|
|
164
|
-
else {
|
|
165
|
-
this.storage = new FileSnapshotStorage(rootPath);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
async save(snapshot) {
|
|
169
|
-
return this.storage.save(snapshot);
|
|
170
|
-
}
|
|
171
|
-
async load() {
|
|
172
|
-
return this.storage.load();
|
|
173
|
-
}
|
|
174
|
-
async backup() {
|
|
175
|
-
return this.storage.backup();
|
|
176
|
-
}
|
|
177
|
-
async createEmptySnapshot(rootPath) {
|
|
178
|
-
return {
|
|
179
|
-
rootPath,
|
|
180
|
-
timestamp: Date.now(),
|
|
181
|
-
files: new Map(),
|
|
182
|
-
directories: new Map(),
|
|
183
|
-
};
|
|
184
|
-
}
|
|
185
|
-
updateFileEntry(snapshot, relativePath, entry) {
|
|
186
|
-
snapshot.files.set(relativePath, entry);
|
|
187
|
-
}
|
|
188
|
-
updateDirectoryEntry(snapshot, relativePath, entry) {
|
|
189
|
-
snapshot.directories.set(relativePath, entry);
|
|
190
|
-
}
|
|
191
|
-
removeFileEntry(snapshot, relativePath) {
|
|
192
|
-
snapshot.files.delete(relativePath);
|
|
193
|
-
}
|
|
194
|
-
createEmpty() {
|
|
195
|
-
return {
|
|
196
|
-
rootPath: "",
|
|
197
|
-
timestamp: Date.now(),
|
|
198
|
-
files: new Map(),
|
|
199
|
-
directories: new Map(),
|
|
200
|
-
};
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
exports.IsomorphicSnapshotManager = IsomorphicSnapshotManager;
|
|
204
|
-
//# sourceMappingURL=isomorphic-snapshot.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"isomorphic-snapshot.js","sourceRoot":"","sources":["../../src/core/isomorphic-snapshot.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAQH,oDAK6B;AAW7B;;GAEG;AACH,MAAa,mBAAmB;IAI9B,YAAoB,QAAgB;QAAhB,aAAQ,GAAR,QAAQ,CAAQ;IAAG,CAAC;IAEhC,eAAe,CAAC,GAAG,GAAG,SAAS;QACrC,OAAO,GAAG,IAAI,CAAC,QAAQ,IAAI,mBAAmB,CAAC,aAAa,IAAI,GAAG,IAAI,mBAAmB,CAAC,iBAAiB,EAAE,CAAC;IACjH,CAAC;IAEO,cAAc;QACpB,OAAO,GAAG,IAAI,CAAC,QAAQ,IAAI,mBAAmB,CAAC,aAAa,EAAE,CAAC;IACjE,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,QAAsB,EAAE,GAAG,GAAG,SAAS;QAChD,MAAM,IAAA,kCAAqB,EAAC,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC;QAEnD,MAAM,YAAY,GAAG,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,C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C,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACrC,CAAC;IAED,KAAK,CAAC,IAAI;QACR,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;IAC7B,CAAC;IAED,KAAK,CAAC,MAAM;QACV,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;IAC/B,CAAC;IAED,KAAK,CAAC,mBAAmB,CAAC,QAAgB;QACxC,OAAO;YACL,QAAQ;YACR,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;YACrB,KAAK,EAAE,IAAI,GAAG,EAAE;YAChB,WAAW,EAAE,IAAI,GAAG,EAAE;SACvB,CAAC;IACJ,CAAC;IAED,eAAe,CACb,QAAsB,EACtB,YAAoB,EACpB,KAAwB;QAExB,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;IAC1C,CAAC;IAED,oBAAoB,CAClB,QAAsB,EACtB,YAAoB,EACpB,KAA6B;QAE7B,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;IAChD,CAAC;IAED,eAAe,CAAC,QAAsB,EAAE,YAAoB;QAC1D,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IACtC,CAAC;IAED,WAAW;QACT,OAAO;YACL,QAAQ,EAAE,EAAE;YACZ,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;YACrB,KAAK,EAAE,IAAI,GAAG,EAAE;YAChB,WAAW,EAAE,IAAI,GAAG,EAAE;SACvB,CAAC;IACJ,CAAC;CACF;AA/DD,8DA+DC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Browser filesystem implementation using File System Access API
|
|
3
|
-
*/
|
|
4
|
-
import { FileSystemInterface } from "./filesystem";
|
|
5
|
-
export declare class BrowserFilesystem implements FileSystemInterface {
|
|
6
|
-
private adapter;
|
|
7
|
-
private rootHandle;
|
|
8
|
-
constructor();
|
|
9
|
-
setRootDirectory(handle: any): Promise<void>;
|
|
10
|
-
private ensureRootHandle;
|
|
11
|
-
readFileContent(path: string): Promise<string | Uint8Array>;
|
|
12
|
-
writeFileContent(path: string, content: string | Uint8Array): Promise<void>;
|
|
13
|
-
removePath(path: string): Promise<void>;
|
|
14
|
-
movePath(fromPath: string, toPath: string): Promise<void>;
|
|
15
|
-
ensureDirectoryExists(path: string): Promise<void>;
|
|
16
|
-
listDirectory(path: string): Promise<Array<{
|
|
17
|
-
name: string;
|
|
18
|
-
type: "file" | "directory";
|
|
19
|
-
}>>;
|
|
20
|
-
getFileStats(path: string): Promise<{
|
|
21
|
-
size: number;
|
|
22
|
-
mtime: Date;
|
|
23
|
-
}>;
|
|
24
|
-
exists(path: string): Promise<boolean>;
|
|
25
|
-
}
|
|
26
|
-
//# sourceMappingURL=browser-filesystem.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"browser-filesystem.d.ts","sourceRoot":"","sources":["../../src/platform/browser-filesystem.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAGnD,qBAAa,iBAAkB,YAAW,mBAAmB;IAC3D,OAAO,CAAC,OAAO,CAA2B;IAC1C,OAAO,CAAC,UAAU,CAAa;;IAMzB,gBAAgB,CAAC,MAAM,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IAIlD,OAAO,CAAC,gBAAgB;IAQlB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,UAAU,CAAC;IAM3D,gBAAgB,CACpB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,GAAG,UAAU,GAC3B,OAAO,CAAC,IAAI,CAAC;IAQV,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKvC,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKzD,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAgBlD,aAAa,CACjB,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAAA;KAAE,CAAC,CAAC;IASzD,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,IAAI,CAAA;KAAE,CAAC;IAUlE,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAc7C"}
|