@almadar/workspace 0.6.0 → 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/dist/index.js +16 -0
- package/dist/index.js.map +1 -1
- package/dist/service.d.ts +1 -0
- package/dist/types.d.ts +7 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2032,6 +2032,16 @@ var WorkspaceServiceImpl = class {
|
|
|
2032
2032
|
});
|
|
2033
2033
|
await this.emit({ kind: "file", relPath, content });
|
|
2034
2034
|
}
|
|
2035
|
+
async removeFile(relPath) {
|
|
2036
|
+
const abs = sandboxedPath(this.workDir, relPath);
|
|
2037
|
+
let removed = false;
|
|
2038
|
+
await this.withLock(abs, async () => {
|
|
2039
|
+
if (!this.backend.exists(abs)) return;
|
|
2040
|
+
await this.backend.unlink(abs);
|
|
2041
|
+
removed = true;
|
|
2042
|
+
});
|
|
2043
|
+
if (removed) await this.emit({ kind: "file-removed", relPath });
|
|
2044
|
+
}
|
|
2035
2045
|
async listTree(relPath) {
|
|
2036
2046
|
const base = relPath === void 0 ? this.workDir : sandboxedPath(this.workDir, relPath);
|
|
2037
2047
|
if (!this.backend.exists(base)) return [];
|
|
@@ -2390,6 +2400,12 @@ async function openAccount(opts = {}) {
|
|
|
2390
2400
|
async listCredentialedProviders() {
|
|
2391
2401
|
return Object.keys(await readCredentials());
|
|
2392
2402
|
},
|
|
2403
|
+
async clearCredential(provider) {
|
|
2404
|
+
const creds = await readCredentials();
|
|
2405
|
+
if (!(provider in creds)) return;
|
|
2406
|
+
delete creds[provider];
|
|
2407
|
+
await writeCredentials(creds);
|
|
2408
|
+
},
|
|
2393
2409
|
async readAccount() {
|
|
2394
2410
|
return readJson(ACCOUNT_FILE);
|
|
2395
2411
|
},
|