@bendyline/docblocks 2.0.0 → 2.1.1
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 +2 -2
- package/dist/{chunk-2D7Y4IR3.js → chunk-4437YWLE.js} +123 -67
- package/dist/{chunk-5MYAICRE.js → chunk-45T5AFCN.js} +44 -57
- package/dist/{chunk-PGR7LK6D.js → chunk-6L3JRDE7.js} +14 -6
- package/dist/{chunk-RVQHY3XU.js → chunk-6XHOOBYF.js} +0 -1
- package/dist/chunk-73OOROXH.js +8 -0
- package/dist/{chunk-SI2LU2RP.js → chunk-AYWKIZLD.js} +1 -1
- package/dist/{chunk-GCPBEMMH.js → chunk-BVY7GGNV.js} +10 -21
- package/dist/{chunk-AEHCVWU5.js → chunk-DZB666V7.js} +0 -1
- package/dist/{chunk-75UUF6C4.js → chunk-HI7QEWL6.js} +18 -10
- package/dist/chunk-KQ6756AJ.js +28 -0
- package/dist/chunk-LMMOFRGQ.js +148 -0
- package/dist/{chunk-FNW556FN.js → chunk-M2PUNKHS.js} +0 -1
- package/dist/chunk-M5ZNQGR5.js +19 -0
- package/dist/chunk-M62ZGJ5I.js +51 -0
- package/dist/chunk-OQCPBOQA.js +168 -0
- package/dist/{chunk-EGNDADXB.js → chunk-QI6YKTQV.js} +2 -3
- package/dist/chunk-SJBB5OD7.js +227 -0
- package/dist/{chunk-EZKJZUNJ.js → chunk-XAMILHQP.js} +0 -1
- package/dist/{chunk-J32GU3F3.js → chunk-YM7O3PWO.js} +249 -222
- package/dist/{chunk-RQJRQF46.js → chunk-ZO7G53QP.js} +41 -49
- package/dist/document/index.d.ts +358 -6
- package/dist/document/index.js +24 -4
- package/dist/filesystem/electron.d.ts +73 -4
- package/dist/filesystem/electron.js +16 -4
- package/dist/filesystem/index.d.ts +228 -22
- package/dist/filesystem/index.js +133 -20
- package/dist/filesystem/indexeddb.d.ts +284 -5
- package/dist/filesystem/indexeddb.js +22 -5
- package/dist/filesystem/memory.d.ts +152 -4
- package/dist/filesystem/memory.js +12 -4
- package/dist/filesystem/native.d.ts +136 -4
- package/dist/filesystem/native.js +27 -4
- package/dist/host/index.d.ts +32 -9
- package/dist/host/index.js +26 -30
- package/dist/index.d.ts +14 -10
- package/dist/index.js +204 -10
- package/dist/mcp/index.d.ts +33 -4
- package/dist/mcp/index.js +31 -4
- package/dist/mcp/zod.d.ts +645 -643
- package/dist/mcp/zod.js +700 -885
- package/dist/share/index.d.ts +43 -0
- package/dist/share/index.js +12 -0
- package/dist/{types-CsX6EN2t.d.ts → types-BEg5SQ1_.d.ts} +1 -1
- package/dist/{types-eOlt9J7n.d.ts → types-CueK0tvU.d.ts} +34 -11
- package/dist/vscode/index.d.ts +225 -3
- package/dist/vscode/index.js +389 -3
- package/dist/workspace/index.d.ts +141 -4
- package/dist/workspace/index.js +28 -3
- package/package.json +10 -5
- package/dist/chunk-2D7Y4IR3.js.map +0 -1
- package/dist/chunk-5MYAICRE.js.map +0 -1
- package/dist/chunk-75UUF6C4.js.map +0 -1
- package/dist/chunk-AEHCVWU5.js.map +0 -1
- package/dist/chunk-AYZ4HN5M.js +0 -20
- package/dist/chunk-AYZ4HN5M.js.map +0 -1
- package/dist/chunk-EGNDADXB.js.map +0 -1
- package/dist/chunk-EZKJZUNJ.js.map +0 -1
- package/dist/chunk-FNW556FN.js.map +0 -1
- package/dist/chunk-GCPBEMMH.js.map +0 -1
- package/dist/chunk-J32GU3F3.js.map +0 -1
- package/dist/chunk-PGR7LK6D.js.map +0 -1
- package/dist/chunk-RQJRQF46.js.map +0 -1
- package/dist/chunk-RVQHY3XU.js.map +0 -1
- package/dist/chunk-SI2LU2RP.js.map +0 -1
- package/dist/chunk-W5UUUII5.js +0 -142
- package/dist/chunk-W5UUUII5.js.map +0 -1
- package/dist/document/document-session.d.ts +0 -127
- package/dist/document/document-session.d.ts.map +0 -1
- package/dist/document/document-session.js +0 -749
- package/dist/document/document-session.js.map +0 -1
- package/dist/document/filesystem-target.d.ts +0 -17
- package/dist/document/filesystem-target.d.ts.map +0 -1
- package/dist/document/filesystem-target.js +0 -70
- package/dist/document/filesystem-target.js.map +0 -1
- package/dist/document/index.d.ts.map +0 -1
- package/dist/document/index.js.map +0 -1
- package/dist/document/recovery-journal.d.ts +0 -125
- package/dist/document/recovery-journal.d.ts.map +0 -1
- package/dist/document/recovery-journal.js +0 -385
- package/dist/document/recovery-journal.js.map +0 -1
- package/dist/document/types.d.ts +0 -89
- package/dist/document/types.d.ts.map +0 -1
- package/dist/document/types.js +0 -9
- package/dist/document/types.js.map +0 -1
- package/dist/filesystem/commit-lock.d.ts +0 -3
- package/dist/filesystem/commit-lock.d.ts.map +0 -1
- package/dist/filesystem/commit-lock.js +0 -20
- package/dist/filesystem/commit-lock.js.map +0 -1
- package/dist/filesystem/dbk-workspace.d.ts +0 -34
- package/dist/filesystem/dbk-workspace.d.ts.map +0 -1
- package/dist/filesystem/dbk-workspace.js +0 -85
- package/dist/filesystem/dbk-workspace.js.map +0 -1
- package/dist/filesystem/electron-provider-v2.d.ts +0 -36
- package/dist/filesystem/electron-provider-v2.d.ts.map +0 -1
- package/dist/filesystem/electron-provider-v2.js +0 -503
- package/dist/filesystem/electron-provider-v2.js.map +0 -1
- package/dist/filesystem/electron-provider.d.ts +0 -35
- package/dist/filesystem/electron-provider.d.ts.map +0 -1
- package/dist/filesystem/electron-provider.js +0 -69
- package/dist/filesystem/electron-provider.js.map +0 -1
- package/dist/filesystem/electron.d.ts.map +0 -1
- package/dist/filesystem/electron.js.map +0 -1
- package/dist/filesystem/file-media-provider.d.ts +0 -23
- package/dist/filesystem/file-media-provider.d.ts.map +0 -1
- package/dist/filesystem/file-media-provider.js +0 -85
- package/dist/filesystem/file-media-provider.js.map +0 -1
- package/dist/filesystem/filesystem-content-container.d.ts +0 -24
- package/dist/filesystem/filesystem-content-container.d.ts.map +0 -1
- package/dist/filesystem/filesystem-content-container.js +0 -153
- package/dist/filesystem/filesystem-content-container.js.map +0 -1
- package/dist/filesystem/fs-error.d.ts +0 -46
- package/dist/filesystem/fs-error.d.ts.map +0 -1
- package/dist/filesystem/fs-error.js +0 -170
- package/dist/filesystem/fs-error.js.map +0 -1
- package/dist/filesystem/index.d.ts.map +0 -1
- package/dist/filesystem/index.js.map +0 -1
- package/dist/filesystem/indexeddb-content-container.d.ts +0 -22
- package/dist/filesystem/indexeddb-content-container.d.ts.map +0 -1
- package/dist/filesystem/indexeddb-content-container.js +0 -100
- package/dist/filesystem/indexeddb-content-container.js.map +0 -1
- package/dist/filesystem/indexeddb-provider-v2.d.ts +0 -96
- package/dist/filesystem/indexeddb-provider-v2.d.ts.map +0 -1
- package/dist/filesystem/indexeddb-provider-v2.js +0 -1241
- package/dist/filesystem/indexeddb-provider-v2.js.map +0 -1
- package/dist/filesystem/indexeddb-provider.d.ts +0 -39
- package/dist/filesystem/indexeddb-provider.d.ts.map +0 -1
- package/dist/filesystem/indexeddb-provider.js +0 -145
- package/dist/filesystem/indexeddb-provider.js.map +0 -1
- package/dist/filesystem/indexeddb-store.d.ts +0 -34
- package/dist/filesystem/indexeddb-store.d.ts.map +0 -1
- package/dist/filesystem/indexeddb-store.js +0 -165
- package/dist/filesystem/indexeddb-store.js.map +0 -1
- package/dist/filesystem/indexeddb.d.ts.map +0 -1
- package/dist/filesystem/indexeddb.js.map +0 -1
- package/dist/filesystem/legacy-v2-adapter.d.ts +0 -62
- package/dist/filesystem/legacy-v2-adapter.d.ts.map +0 -1
- package/dist/filesystem/legacy-v2-adapter.js +0 -499
- package/dist/filesystem/legacy-v2-adapter.js.map +0 -1
- package/dist/filesystem/memory-provider-v2.d.ts +0 -92
- package/dist/filesystem/memory-provider-v2.d.ts.map +0 -1
- package/dist/filesystem/memory-provider-v2.js +0 -615
- package/dist/filesystem/memory-provider-v2.js.map +0 -1
- package/dist/filesystem/memory-provider.d.ts +0 -54
- package/dist/filesystem/memory-provider.d.ts.map +0 -1
- package/dist/filesystem/memory-provider.js +0 -132
- package/dist/filesystem/memory-provider.js.map +0 -1
- package/dist/filesystem/memory.d.ts.map +0 -1
- package/dist/filesystem/memory.js.map +0 -1
- package/dist/filesystem/move-entry.d.ts +0 -9
- package/dist/filesystem/move-entry.d.ts.map +0 -1
- package/dist/filesystem/move-entry.js +0 -103
- package/dist/filesystem/move-entry.js.map +0 -1
- package/dist/filesystem/move-error.d.ts +0 -53
- package/dist/filesystem/move-error.d.ts.map +0 -1
- package/dist/filesystem/move-error.js +0 -99
- package/dist/filesystem/move-error.js.map +0 -1
- package/dist/filesystem/native-provider-v2.d.ts +0 -75
- package/dist/filesystem/native-provider-v2.d.ts.map +0 -1
- package/dist/filesystem/native-provider-v2.js +0 -849
- package/dist/filesystem/native-provider-v2.js.map +0 -1
- package/dist/filesystem/native-provider.d.ts +0 -53
- package/dist/filesystem/native-provider.d.ts.map +0 -1
- package/dist/filesystem/native-provider.js +0 -471
- package/dist/filesystem/native-provider.js.map +0 -1
- package/dist/filesystem/native.d.ts.map +0 -1
- package/dist/filesystem/native.js.map +0 -1
- package/dist/filesystem/types.d.ts +0 -83
- package/dist/filesystem/types.d.ts.map +0 -1
- package/dist/filesystem/types.js +0 -16
- package/dist/filesystem/types.js.map +0 -1
- package/dist/filesystem/v2.d.ts +0 -172
- package/dist/filesystem/v2.d.ts.map +0 -1
- package/dist/filesystem/v2.js +0 -16
- package/dist/filesystem/v2.js.map +0 -1
- package/dist/filesystem/workspace-path.d.ts +0 -21
- package/dist/filesystem/workspace-path.d.ts.map +0 -1
- package/dist/filesystem/workspace-path.js +0 -80
- package/dist/filesystem/workspace-path.js.map +0 -1
- package/dist/host/filesystem-v2.d.ts +0 -45
- package/dist/host/filesystem-v2.d.ts.map +0 -1
- package/dist/host/filesystem-v2.js +0 -13
- package/dist/host/filesystem-v2.js.map +0 -1
- package/dist/host/git.d.ts +0 -200
- package/dist/host/git.d.ts.map +0 -1
- package/dist/host/git.js +0 -15
- package/dist/host/git.js.map +0 -1
- package/dist/host/index.d.ts.map +0 -1
- package/dist/host/index.js.map +0 -1
- package/dist/host/types.d.ts +0 -232
- package/dist/host/types.d.ts.map +0 -1
- package/dist/host/types.js +0 -10
- package/dist/host/types.js.map +0 -1
- package/dist/host/wire-policy.d.ts +0 -22
- package/dist/host/wire-policy.d.ts.map +0 -1
- package/dist/host/wire-policy.js +0 -92
- package/dist/host/wire-policy.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/mcp/index.d.ts.map +0 -1
- package/dist/mcp/index.js.map +0 -1
- package/dist/mcp/types.d.ts +0 -466
- package/dist/mcp/types.d.ts.map +0 -1
- package/dist/mcp/types.js +0 -25
- package/dist/mcp/types.js.map +0 -1
- package/dist/mcp/wire.d.ts +0 -29
- package/dist/mcp/wire.d.ts.map +0 -1
- package/dist/mcp/wire.js +0 -1046
- package/dist/mcp/wire.js.map +0 -1
- package/dist/mcp/zod.d.ts.map +0 -1
- package/dist/mcp/zod.js.map +0 -1
- package/dist/vscode/index.d.ts.map +0 -1
- package/dist/vscode/index.js.map +0 -1
- package/dist/vscode/messages.d.ts +0 -204
- package/dist/vscode/messages.d.ts.map +0 -1
- package/dist/vscode/messages.js +0 -494
- package/dist/vscode/messages.js.map +0 -1
- package/dist/workspace/index.d.ts.map +0 -1
- package/dist/workspace/index.js.map +0 -1
- package/dist/workspace/reconcile-electron.d.ts +0 -19
- package/dist/workspace/reconcile-electron.d.ts.map +0 -1
- package/dist/workspace/reconcile-electron.js +0 -42
- package/dist/workspace/reconcile-electron.js.map +0 -1
- package/dist/workspace/types.d.ts +0 -69
- package/dist/workspace/types.d.ts.map +0 -1
- package/dist/workspace/types.js +0 -2
- package/dist/workspace/types.js.map +0 -1
- package/dist/workspace/workspace-manager.d.ts +0 -47
- package/dist/workspace/workspace-manager.d.ts.map +0 -1
- package/dist/workspace/workspace-manager.js +0 -126
- package/dist/workspace/workspace-manager.js.map +0 -1
- package/src/document/document-session.ts +0 -834
- package/src/document/filesystem-target.ts +0 -109
- package/src/document/index.ts +0 -41
- package/src/document/recovery-journal.ts +0 -536
- package/src/document/types.ts +0 -116
- package/src/filesystem/commit-lock.ts +0 -29
- package/src/filesystem/dbk-workspace.ts +0 -135
- package/src/filesystem/electron-provider-v2.ts +0 -630
- package/src/filesystem/electron-provider.ts +0 -99
- package/src/filesystem/electron.ts +0 -3
- package/src/filesystem/file-media-provider.ts +0 -103
- package/src/filesystem/filesystem-content-container.ts +0 -164
- package/src/filesystem/fs-error.ts +0 -234
- package/src/filesystem/index.ts +0 -143
- package/src/filesystem/indexeddb-content-container.ts +0 -112
- package/src/filesystem/indexeddb-provider-v2.ts +0 -1740
- package/src/filesystem/indexeddb-provider.ts +0 -171
- package/src/filesystem/indexeddb-store.ts +0 -207
- package/src/filesystem/indexeddb.ts +0 -12
- package/src/filesystem/legacy-v2-adapter.ts +0 -779
- package/src/filesystem/memory-provider-v2.ts +0 -896
- package/src/filesystem/memory-provider.ts +0 -180
- package/src/filesystem/memory.ts +0 -15
- package/src/filesystem/move-entry.ts +0 -142
- package/src/filesystem/move-error.ts +0 -159
- package/src/filesystem/native-provider-v2.ts +0 -1165
- package/src/filesystem/native-provider.ts +0 -537
- package/src/filesystem/native.ts +0 -16
- package/src/filesystem/types.ts +0 -114
- package/src/filesystem/v2.ts +0 -231
- package/src/filesystem/workspace-path.ts +0 -92
- package/src/host/filesystem-v2.ts +0 -104
- package/src/host/git.ts +0 -246
- package/src/host/index.ts +0 -93
- package/src/host/types.ts +0 -274
- package/src/host/wire-policy.ts +0 -103
- package/src/index.ts +0 -10
- package/src/mcp/index.ts +0 -3
- package/src/mcp/types.ts +0 -594
- package/src/mcp/wire.ts +0 -1280
- package/src/mcp/zod.ts +0 -1000
- package/src/vscode/index.ts +0 -2
- package/src/vscode/messages.ts +0 -704
- package/src/workspace/index.ts +0 -17
- package/src/workspace/reconcile-electron.ts +0 -65
- package/src/workspace/types.ts +0 -67
- package/src/workspace/workspace-manager.ts +0 -151
|
@@ -1,5 +1,284 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { s as FileSystemProviderV2, r as FileSystemProviderCapabilities, k as FileSystemEntrySnapshot, m as FileSystemFileRead, K as FileSystemWriteOptions, n as FileSystemFileSnapshot, g as FileSystemCreateDirectoryOptions, h as FileSystemDirectorySnapshot, u as FileSystemRemoveOptions, v as FileSystemRemoveResult, o as FileSystemMoveOptions, w as FileSystemSnapshot, G as FileSystemWatchListener, H as FileSystemWatchOptions, I as FileSystemWatchSubscription, b as FileMeta, q as FileSystemProvider, F as FileCommitResult, j as FileSystemEntry } from '../types-BEg5SQ1_.js';
|
|
2
|
+
import { a as WorkspacePath } from '../workspace-path-CWVrcuPL.js';
|
|
3
|
+
import { ContentContainer, ContentEntry } from '@bendyline/squisq/storage';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Minimal, error-propagating IndexedDB store used by the virtual filesystem.
|
|
7
|
+
*
|
|
8
|
+
* The previous Squisq LocalForage adapter intentionally converted failed
|
|
9
|
+
* reads/enumerations/removals into null/empty/success. Those semantics are
|
|
10
|
+
* unsuitable for filesystem mutations: an unavailable database must never be
|
|
11
|
+
* interpreted as an absent file. This layer opens the old database and object
|
|
12
|
+
* store directly so existing data can be migrated in one transaction.
|
|
13
|
+
*/
|
|
14
|
+
type IndexedDBFileSystemTransactionMode = 'readonly' | 'readwrite';
|
|
15
|
+
/** The database holding one browser-local workspace's files. */
|
|
16
|
+
declare function indexedDBWorkspaceDatabaseName(workspaceId: string): string;
|
|
17
|
+
/**
|
|
18
|
+
* Delete a browser-local workspace's stored files.
|
|
19
|
+
*
|
|
20
|
+
* Removing a workspace descriptor alone leaves these bytes behind: invisible to
|
|
21
|
+
* the user, still counted against the origin's quota, and ready to reappear
|
|
22
|
+
* under any later workspace that reuses the same id.
|
|
23
|
+
*/
|
|
24
|
+
declare function deleteIndexedDBWorkspaceData(workspaceId: string): Promise<void>;
|
|
25
|
+
interface IndexedDBFileSystemTransaction {
|
|
26
|
+
get<T>(key: string): Promise<T | null>;
|
|
27
|
+
put<T>(key: string, value: T): Promise<void>;
|
|
28
|
+
delete(key: string): Promise<void>;
|
|
29
|
+
keys(): Promise<string[]>;
|
|
30
|
+
/** O(log n) namespace probe in the concrete IndexedDB implementation. */
|
|
31
|
+
hasKeyWithPrefix(prefix: string): Promise<boolean>;
|
|
32
|
+
}
|
|
33
|
+
interface IndexedDBFileSystemStore {
|
|
34
|
+
transaction<T>(mode: IndexedDBFileSystemTransactionMode, operation: (transaction: IndexedDBFileSystemTransaction) => Promise<T>): Promise<T>;
|
|
35
|
+
close?(): void;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
type IndexedDBLegacyConflictReason = 'dual-payload' | 'kind-collision' | 'authority-collision' | 'stale-client-write';
|
|
39
|
+
type IndexedDBLegacyRecoveryKind = 'file' | 'directory';
|
|
40
|
+
interface IndexedDBLegacyRecoveryCandidate {
|
|
41
|
+
readonly kind: IndexedDBLegacyRecoveryKind;
|
|
42
|
+
readonly reason: IndexedDBLegacyConflictReason;
|
|
43
|
+
readonly text: string | null;
|
|
44
|
+
readonly binary: ArrayBuffer | null;
|
|
45
|
+
readonly metadata: FileMeta | null;
|
|
46
|
+
readonly detectedAt: string;
|
|
47
|
+
}
|
|
48
|
+
interface IndexedDBLegacyMigrationConflict {
|
|
49
|
+
readonly path: WorkspacePath;
|
|
50
|
+
/** Backward-compatible projection of the newest quarantined candidate. */
|
|
51
|
+
readonly reason: IndexedDBLegacyConflictReason;
|
|
52
|
+
readonly kind: IndexedDBLegacyRecoveryKind;
|
|
53
|
+
readonly text: string | null;
|
|
54
|
+
readonly binary: ArrayBuffer | null;
|
|
55
|
+
readonly metadata: FileMeta | null;
|
|
56
|
+
readonly detectedAt: string;
|
|
57
|
+
readonly candidates: readonly IndexedDBLegacyRecoveryCandidate[];
|
|
58
|
+
}
|
|
59
|
+
type IndexedDBLegacyConflictResolution = 'v2' | 'text' | 'binary' | {
|
|
60
|
+
readonly candidate: number;
|
|
61
|
+
readonly payload: 'text' | 'binary' | 'directory';
|
|
62
|
+
};
|
|
63
|
+
/** One archived snapshot of an unrecognized legacy key's value. */
|
|
64
|
+
interface IndexedDBLegacyOpaqueValue {
|
|
65
|
+
/**
|
|
66
|
+
* The structured-clone value exactly as the legacy key held it. DocBlocks
|
|
67
|
+
* never interpreted these bytes, so the shape is whatever the writing tool
|
|
68
|
+
* chose. Callers must treat it as untrusted and narrow it themselves.
|
|
69
|
+
*/
|
|
70
|
+
readonly value: unknown;
|
|
71
|
+
/** Byte size when the value is sized (bytes or string); null otherwise. */
|
|
72
|
+
readonly byteLength: number | null;
|
|
73
|
+
/** Null for values archived before archival timestamps were recorded. */
|
|
74
|
+
readonly archivedAt: string | null;
|
|
75
|
+
}
|
|
76
|
+
/** What is archived under one unrecognized legacy key, without its values. */
|
|
77
|
+
interface IndexedDBLegacyOpaqueRecordSummary {
|
|
78
|
+
/** The original legacy key, decoded (for example `fs:some-other-tool`). */
|
|
79
|
+
readonly key: string;
|
|
80
|
+
/** Archived snapshots of this key, oldest first. Never zero. */
|
|
81
|
+
readonly valueCount: number;
|
|
82
|
+
/** Total bytes across values; null when any value is not sized. */
|
|
83
|
+
readonly byteLength: number | null;
|
|
84
|
+
readonly firstArchivedAt: string | null;
|
|
85
|
+
readonly lastArchivedAt: string | null;
|
|
86
|
+
}
|
|
87
|
+
/** An archived legacy key together with every value snapshot it holds. */
|
|
88
|
+
interface IndexedDBLegacyOpaqueRecord extends IndexedDBLegacyOpaqueRecordSummary {
|
|
89
|
+
/** Oldest first. Index N here matches index N of the archival order. */
|
|
90
|
+
readonly values: readonly IndexedDBLegacyOpaqueValue[];
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* One record a caller has looked at and intends to destroy.
|
|
94
|
+
*
|
|
95
|
+
* Both {@link IndexedDBLegacyOpaqueRecordSummary} and
|
|
96
|
+
* {@link IndexedDBLegacyOpaqueRecord} satisfy this shape, so the value returned
|
|
97
|
+
* by a list or read can be handed straight to the discard call.
|
|
98
|
+
*/
|
|
99
|
+
interface IndexedDBLegacyOpaqueDiscardTarget {
|
|
100
|
+
readonly key: string;
|
|
101
|
+
/**
|
|
102
|
+
* The number of archived values the caller saw. The discard fails if the
|
|
103
|
+
* record has since grown, so a snapshot that arrived after the caller looked
|
|
104
|
+
* is never destroyed unseen.
|
|
105
|
+
*/
|
|
106
|
+
readonly valueCount: number;
|
|
107
|
+
}
|
|
108
|
+
interface IndexedDBFileSystemProviderV2Options {
|
|
109
|
+
/** Injectable store for fault, migration, and concurrency tests. */
|
|
110
|
+
readonly store?: IndexedDBFileSystemStore;
|
|
111
|
+
readonly now?: () => Date;
|
|
112
|
+
/** Shared-store owners can retain the connection when this facade is disposed. */
|
|
113
|
+
readonly closeStoreOnDispose?: boolean;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* IndexedDB implementation of the correctness-first filesystem contract.
|
|
117
|
+
*
|
|
118
|
+
* Each canonical path has one authoritative structured-clone record containing
|
|
119
|
+
* its kind, owned bytes (for files), version, and metadata. Every mutation and
|
|
120
|
+
* snapshot is one IndexedDB transaction. Legacy v1 keys are imported once;
|
|
121
|
+
* ambiguous or stale branches move into durable recovery records before the
|
|
122
|
+
* legacy namespace is deleted, leaving one live authority.
|
|
123
|
+
*/
|
|
124
|
+
declare class IndexedDBFileSystemProviderV2 implements FileSystemProviderV2 {
|
|
125
|
+
readonly id: string;
|
|
126
|
+
readonly label: string;
|
|
127
|
+
readonly capabilities: FileSystemProviderCapabilities;
|
|
128
|
+
private readonly store;
|
|
129
|
+
private readonly now;
|
|
130
|
+
private readonly closeStoreOnDispose;
|
|
131
|
+
private readonly versionPrefix;
|
|
132
|
+
private readonly subscriptions;
|
|
133
|
+
private readonly inFlight;
|
|
134
|
+
private initialization;
|
|
135
|
+
private disposePromise;
|
|
136
|
+
private storeClosed;
|
|
137
|
+
private disposed;
|
|
138
|
+
constructor(id: string, label: string, options?: IndexedDBFileSystemProviderV2Options);
|
|
139
|
+
/** Track accepted storage work so disposal can join it before closing. */
|
|
140
|
+
private runSharedTransaction;
|
|
141
|
+
stat(path: WorkspacePath): Promise<FileSystemEntrySnapshot | null>;
|
|
142
|
+
readFile(path: WorkspacePath): Promise<FileSystemFileRead | null>;
|
|
143
|
+
readDirectory(path: WorkspacePath): Promise<readonly FileSystemEntrySnapshot[]>;
|
|
144
|
+
writeFile(path: WorkspacePath, data: ArrayBuffer | Uint8Array, options?: FileSystemWriteOptions): Promise<FileSystemFileSnapshot>;
|
|
145
|
+
createDirectory(path: WorkspacePath, options?: FileSystemCreateDirectoryOptions): Promise<FileSystemDirectorySnapshot>;
|
|
146
|
+
remove(path: WorkspacePath, options?: FileSystemRemoveOptions): Promise<FileSystemRemoveResult>;
|
|
147
|
+
move(oldPath: WorkspacePath, newPath: WorkspacePath, options?: FileSystemMoveOptions): Promise<FileSystemEntrySnapshot>;
|
|
148
|
+
snapshot(): Promise<FileSystemSnapshot>;
|
|
149
|
+
/** IndexedDB has no reliable cross-browser external-change observer. */
|
|
150
|
+
watch(_listener: FileSystemWatchListener, options?: FileSystemWatchOptions): FileSystemWatchSubscription;
|
|
151
|
+
dispose(): Promise<void>;
|
|
152
|
+
/** List unresolved, byte-preserving conflicts found during v1 migration. */
|
|
153
|
+
listLegacyMigrationConflicts(): Promise<readonly IndexedDBLegacyMigrationConflict[]>;
|
|
154
|
+
/** Resolve quarantined legacy data by choosing v2 or one legacy byte payload. */
|
|
155
|
+
resolveLegacyMigrationConflict(path: WorkspacePath, resolution: IndexedDBLegacyConflictResolution): Promise<FileSystemEntrySnapshot>;
|
|
156
|
+
/** Explicitly discard every quarantined legacy candidate at a path. */
|
|
157
|
+
discardLegacyMigrationConflict(path: WorkspacePath): Promise<boolean>;
|
|
158
|
+
/**
|
|
159
|
+
* List the unrecognized legacy keys this workspace archived during migration.
|
|
160
|
+
*
|
|
161
|
+
* Migration deletes the legacy `fs:` namespace, but a key it cannot interpret
|
|
162
|
+
* is copied aside first rather than dropped: those bytes belong to whatever
|
|
163
|
+
* tool wrote them against this origin, and DocBlocks is not entitled to
|
|
164
|
+
* decide they are worthless. Nothing else reads that archive, so without this
|
|
165
|
+
* call the bytes are invisible and their quota is unaccountable.
|
|
166
|
+
*
|
|
167
|
+
* Values are deliberately excluded — an archive large enough to matter is an
|
|
168
|
+
* archive too large to materialize just to count it. Use
|
|
169
|
+
* {@link readLegacyOpaqueRecord} for the values themselves.
|
|
170
|
+
*/
|
|
171
|
+
listLegacyOpaqueRecords(): Promise<readonly IndexedDBLegacyOpaqueRecordSummary[]>;
|
|
172
|
+
/** Retrieve every archived value for one unrecognized legacy key. */
|
|
173
|
+
readLegacyOpaqueRecord(key: string): Promise<IndexedDBLegacyOpaqueRecord | null>;
|
|
174
|
+
/**
|
|
175
|
+
* Permanently destroy archived legacy values. This is the only operation that
|
|
176
|
+
* can lose data the archive exists to protect.
|
|
177
|
+
*
|
|
178
|
+
* For every target, all of that key's archived value snapshots are erased and
|
|
179
|
+
* the quota they held is reclaimed. There is no undo, no tombstone, and no
|
|
180
|
+
* other copy: migration already deleted the original `fs:` key, so the
|
|
181
|
+
* archive is the last one. Retrieve anything worth keeping with
|
|
182
|
+
* {@link readLegacyOpaqueRecord} before calling this.
|
|
183
|
+
*
|
|
184
|
+
* Each target must carry the `valueCount` the caller actually observed, which
|
|
185
|
+
* is why a target is a value returned by {@link listLegacyOpaqueRecords} or
|
|
186
|
+
* {@link readLegacyOpaqueRecord} rather than a bare key. A stale client can
|
|
187
|
+
* append a new snapshot at any time; if any target has grown since it was
|
|
188
|
+
* observed, the whole call fails with `conflict` and destroys nothing, so
|
|
189
|
+
* re-list and look again. A key that is already absent is not an error —
|
|
190
|
+
* discarding what is gone is a no-op — but a key whose count disagrees is.
|
|
191
|
+
*
|
|
192
|
+
* @returns how many records were destroyed.
|
|
193
|
+
*/
|
|
194
|
+
discardLegacyOpaqueRecords(targets: readonly IndexedDBLegacyOpaqueDiscardTarget[]): Promise<number>;
|
|
195
|
+
private ensureInitialized;
|
|
196
|
+
private migrateLegacy;
|
|
197
|
+
private quarantineExistingLegacy;
|
|
198
|
+
private transaction;
|
|
199
|
+
private withMutationLock;
|
|
200
|
+
private nextMutationVersion;
|
|
201
|
+
private advanceState;
|
|
202
|
+
private makeVersion;
|
|
203
|
+
private planParents;
|
|
204
|
+
private addDirectories;
|
|
205
|
+
private touchParents;
|
|
206
|
+
private canonicalNonRoot;
|
|
207
|
+
private assertExpectedVersion;
|
|
208
|
+
private assertOpen;
|
|
209
|
+
private error;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Legacy FileSystemProvider facade over the revisioned IndexedDB authority.
|
|
214
|
+
*
|
|
215
|
+
* The old `fs:*` namespace is migration input only. Keeping this facade as an
|
|
216
|
+
* adapter prevents current callers from recreating a second persistent source
|
|
217
|
+
* of truth while the workspace moves to FileSystemProviderV2.
|
|
218
|
+
*/
|
|
219
|
+
|
|
220
|
+
interface IndexedDBFileSystemProviderOptions {
|
|
221
|
+
/** Injectable transaction store for deterministic fault/concurrency tests. */
|
|
222
|
+
store?: IndexedDBFileSystemStore;
|
|
223
|
+
/** Injectable metadata clock. */
|
|
224
|
+
now?: () => Date;
|
|
225
|
+
}
|
|
226
|
+
declare class IndexedDBFileSystemProvider implements FileSystemProvider {
|
|
227
|
+
readonly id: string;
|
|
228
|
+
readonly label: string;
|
|
229
|
+
readonly v2: IndexedDBFileSystemProviderV2;
|
|
230
|
+
private disposed;
|
|
231
|
+
constructor(id: string, label: string, options?: IndexedDBFileSystemProviderOptions);
|
|
232
|
+
/** Release the underlying database connection after accepted work settles. */
|
|
233
|
+
dispose(): Promise<void>;
|
|
234
|
+
readFile(path: string): Promise<string | null>;
|
|
235
|
+
writeFile(path: string, content: string): Promise<void>;
|
|
236
|
+
commitFile(path: string, content: string, expectedContent: string | null): Promise<FileCommitResult>;
|
|
237
|
+
delete(path: string): Promise<void>;
|
|
238
|
+
rename(oldPath: string, newPath: string): Promise<void>;
|
|
239
|
+
readDirectory(path: string): Promise<FileSystemEntry[]>;
|
|
240
|
+
exists(path: string): Promise<boolean>;
|
|
241
|
+
createDirectory(path: string): Promise<void>;
|
|
242
|
+
stat(path: string): Promise<FileMeta | null>;
|
|
243
|
+
readBinary(path: string): Promise<ArrayBuffer | null>;
|
|
244
|
+
writeBinary(path: string, data: ArrayBuffer | Uint8Array): Promise<void>;
|
|
245
|
+
/**
|
|
246
|
+
* Canonicalize only. Root policy is the v2 authority's to state: it accepts
|
|
247
|
+
* the root wherever the root is a legitimate target (`stat`, `readDirectory`,
|
|
248
|
+
* `createDirectory`) and rejects it with one consistent code and message
|
|
249
|
+
* everywhere else. Re-deriving that policy here is how this facade previously
|
|
250
|
+
* drifted from both v2 and its sibling facades.
|
|
251
|
+
*/
|
|
252
|
+
private path;
|
|
253
|
+
/**
|
|
254
|
+
* Byte-authoritative entries may hold payloads that are not valid UTF-8. A
|
|
255
|
+
* lossy decode would hand the caller replacement characters that a later save
|
|
256
|
+
* writes back over the user's original bytes, so surface the fault instead.
|
|
257
|
+
*/
|
|
258
|
+
private decode;
|
|
259
|
+
private assertOpen;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* IndexedDBContentContainer — a ContentContainer backed by IndexedDB.
|
|
264
|
+
*
|
|
265
|
+
* Uses a dedicated IndexedDBFileSystemProvider instance (separate store)
|
|
266
|
+
* to persist media files across page refreshes.
|
|
267
|
+
*/
|
|
268
|
+
|
|
269
|
+
declare class IndexedDBContentContainer implements ContentContainer {
|
|
270
|
+
private readonly provider;
|
|
271
|
+
constructor(workspaceId: string);
|
|
272
|
+
readFile(path: string): Promise<ArrayBuffer | null>;
|
|
273
|
+
writeFile(path: string, data: ArrayBuffer | Uint8Array, _mimeType?: string): Promise<void>;
|
|
274
|
+
removeFile(path: string): Promise<void>;
|
|
275
|
+
listFiles(prefix?: string): Promise<ContentEntry[]>;
|
|
276
|
+
exists(path: string): Promise<boolean>;
|
|
277
|
+
getDocumentPath(): Promise<string | null>;
|
|
278
|
+
readDocument(): Promise<string | null>;
|
|
279
|
+
writeDocument(markdown: string, filename?: string): Promise<void>;
|
|
280
|
+
/** Release the IndexedDB connection when a long-lived container is retired. */
|
|
281
|
+
dispose(): Promise<void>;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
export { IndexedDBContentContainer, IndexedDBFileSystemProvider, IndexedDBFileSystemProviderV2, type IndexedDBFileSystemProviderV2Options, type IndexedDBLegacyConflictReason, type IndexedDBLegacyConflictResolution, type IndexedDBLegacyMigrationConflict, type IndexedDBLegacyOpaqueDiscardTarget, type IndexedDBLegacyOpaqueRecord, type IndexedDBLegacyOpaqueRecordSummary, type IndexedDBLegacyOpaqueValue, type IndexedDBLegacyRecoveryCandidate, type IndexedDBLegacyRecoveryKind, deleteIndexedDBWorkspaceData, indexedDBWorkspaceDatabaseName };
|
|
@@ -1,5 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import {
|
|
2
|
+
IndexedDBContentContainer,
|
|
3
|
+
IndexedDBFileSystemProvider,
|
|
4
|
+
IndexedDBFileSystemProviderV2
|
|
5
|
+
} from "../chunk-YM7O3PWO.js";
|
|
6
|
+
import "../chunk-DZB666V7.js";
|
|
7
|
+
import "../chunk-KQ6756AJ.js";
|
|
8
|
+
import "../chunk-73OOROXH.js";
|
|
9
|
+
import "../chunk-M62ZGJ5I.js";
|
|
10
|
+
import "../chunk-M5ZNQGR5.js";
|
|
11
|
+
import "../chunk-AYWKIZLD.js";
|
|
12
|
+
import {
|
|
13
|
+
deleteIndexedDBWorkspaceData,
|
|
14
|
+
indexedDBWorkspaceDatabaseName
|
|
15
|
+
} from "../chunk-OQCPBOQA.js";
|
|
16
|
+
export {
|
|
17
|
+
IndexedDBContentContainer,
|
|
18
|
+
IndexedDBFileSystemProvider,
|
|
19
|
+
IndexedDBFileSystemProviderV2,
|
|
20
|
+
deleteIndexedDBWorkspaceData,
|
|
21
|
+
indexedDBWorkspaceDatabaseName
|
|
22
|
+
};
|
|
@@ -1,4 +1,152 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { s as FileSystemProviderV2, r as FileSystemProviderCapabilities, K as FileSystemWriteOptions, n as FileSystemFileSnapshot, F as FileCommitResult, k as FileSystemEntrySnapshot, m as FileSystemFileRead, g as FileSystemCreateDirectoryOptions, h as FileSystemDirectorySnapshot, u as FileSystemRemoveOptions, v as FileSystemRemoveResult, o as FileSystemMoveOptions, w as FileSystemSnapshot, G as FileSystemWatchListener, H as FileSystemWatchOptions, I as FileSystemWatchSubscription, q as FileSystemProvider, j as FileSystemEntry, b as FileMeta } from '../types-BEg5SQ1_.js';
|
|
2
|
+
import { a as WorkspacePath } from '../workspace-path-CWVrcuPL.js';
|
|
3
|
+
|
|
4
|
+
type MemoryFilePayloadKind = 'text' | 'binary';
|
|
5
|
+
interface MemoryFileSystemV2StateFile {
|
|
6
|
+
readonly path: WorkspacePath;
|
|
7
|
+
readonly data: ArrayBuffer;
|
|
8
|
+
readonly payloadKind: MemoryFilePayloadKind;
|
|
9
|
+
}
|
|
10
|
+
interface MemoryFileSystemV2CompatibilityFile {
|
|
11
|
+
readonly data: ArrayBuffer;
|
|
12
|
+
readonly payloadKind: MemoryFilePayloadKind;
|
|
13
|
+
}
|
|
14
|
+
interface MemoryFileSystemV2State {
|
|
15
|
+
readonly revision: number;
|
|
16
|
+
readonly files: readonly MemoryFileSystemV2StateFile[];
|
|
17
|
+
readonly directories: readonly WorkspacePath[];
|
|
18
|
+
}
|
|
19
|
+
interface MemoryFileSystemV2ReplacementFile {
|
|
20
|
+
readonly path: WorkspacePath;
|
|
21
|
+
readonly data: ArrayBuffer | Uint8Array;
|
|
22
|
+
readonly payloadKind: MemoryFilePayloadKind;
|
|
23
|
+
}
|
|
24
|
+
interface MemoryFileSystemV2Replacement {
|
|
25
|
+
readonly files: readonly MemoryFileSystemV2ReplacementFile[];
|
|
26
|
+
readonly directories?: readonly WorkspacePath[];
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Correctness reference for FileSystemProviderV2.
|
|
30
|
+
*
|
|
31
|
+
* Every mutation validates first, stages a fresh map, swaps it once, and only
|
|
32
|
+
* then emits notifications. File buffers are owned by the provider and every
|
|
33
|
+
* read/snapshot returns a defensive copy.
|
|
34
|
+
*/
|
|
35
|
+
declare class MemoryFileSystemProviderV2 implements FileSystemProviderV2 {
|
|
36
|
+
readonly id: string;
|
|
37
|
+
readonly label: string;
|
|
38
|
+
readonly capabilities: FileSystemProviderCapabilities;
|
|
39
|
+
private entries;
|
|
40
|
+
private readonly watchers;
|
|
41
|
+
private readonly subscriptions;
|
|
42
|
+
private readonly pendingEvents;
|
|
43
|
+
private emittingEvents;
|
|
44
|
+
private mutationCounter;
|
|
45
|
+
private eventSequence;
|
|
46
|
+
private treeVersion;
|
|
47
|
+
private disposed;
|
|
48
|
+
private disposePromise;
|
|
49
|
+
constructor(id: string, label: string);
|
|
50
|
+
/** Monotonic in-process revision used by synchronous transient-workspace staging. */
|
|
51
|
+
get mutationRevision(): number;
|
|
52
|
+
/** @internal Atomically couple owned bytes to their v1 compatibility kind. */
|
|
53
|
+
readCompatibilityFile(path: WorkspacePath): MemoryFileSystemV2CompatibilityFile | null;
|
|
54
|
+
/** @internal Capture an owned synchronous copy for DBK whole-tree staging. */
|
|
55
|
+
captureState(): MemoryFileSystemV2State;
|
|
56
|
+
/** @internal Atomically replace a transient workspace after complete validation. */
|
|
57
|
+
replaceState(replacement: MemoryFileSystemV2Replacement, expectedRevision?: number): void;
|
|
58
|
+
/** @internal Synchronous setup hook used before a transient provider is published. */
|
|
59
|
+
seedText(path: WorkspacePath, content: string): void;
|
|
60
|
+
/** @internal Legacy text write that preserves text/binary compatibility metadata. */
|
|
61
|
+
writeText(path: WorkspacePath, content: string, options?: FileSystemWriteOptions): Promise<FileSystemFileSnapshot>;
|
|
62
|
+
/** @internal Legacy binary write that explicitly changes compatibility payload kind. */
|
|
63
|
+
writeBinary(path: WorkspacePath, data: ArrayBuffer | Uint8Array, options?: FileSystemWriteOptions): Promise<FileSystemFileSnapshot>;
|
|
64
|
+
/** @internal Atomic legacy compare-and-write over the authoritative v2 entry. */
|
|
65
|
+
commitText(path: WorkspacePath, content: string, expectedContent: string | null): Promise<FileCommitResult>;
|
|
66
|
+
stat(path: WorkspacePath): Promise<FileSystemEntrySnapshot | null>;
|
|
67
|
+
readFile(path: WorkspacePath): Promise<FileSystemFileRead | null>;
|
|
68
|
+
readDirectory(path: WorkspacePath): Promise<readonly FileSystemEntrySnapshot[]>;
|
|
69
|
+
writeFile(path: WorkspacePath, data: ArrayBuffer | Uint8Array, options?: FileSystemWriteOptions): Promise<FileSystemFileSnapshot>;
|
|
70
|
+
private writeFileNow;
|
|
71
|
+
createDirectory(path: WorkspacePath, options?: FileSystemCreateDirectoryOptions): Promise<FileSystemDirectorySnapshot>;
|
|
72
|
+
remove(path: WorkspacePath, options?: FileSystemRemoveOptions): Promise<FileSystemRemoveResult>;
|
|
73
|
+
move(oldPath: WorkspacePath, newPath: WorkspacePath, options?: FileSystemMoveOptions): Promise<FileSystemEntrySnapshot>;
|
|
74
|
+
snapshot(): Promise<FileSystemSnapshot>;
|
|
75
|
+
watch(listener: FileSystemWatchListener, options?: FileSystemWatchOptions): FileSystemWatchSubscription;
|
|
76
|
+
dispose(): Promise<void>;
|
|
77
|
+
private canonical;
|
|
78
|
+
private canonicalNonRoot;
|
|
79
|
+
private assertOpen;
|
|
80
|
+
private assertExpectedVersion;
|
|
81
|
+
private planParents;
|
|
82
|
+
private addDirectories;
|
|
83
|
+
private touchParents;
|
|
84
|
+
private withVersion;
|
|
85
|
+
private nextVersion;
|
|
86
|
+
private toEntrySnapshot;
|
|
87
|
+
private toFileSnapshot;
|
|
88
|
+
private toDirectorySnapshot;
|
|
89
|
+
private emit;
|
|
90
|
+
private error;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* In-memory filesystem used by transient loose-file and DBK workspaces.
|
|
95
|
+
*
|
|
96
|
+
* MemoryFileSystemProviderV2 is authoritative. This class is the temporary
|
|
97
|
+
* text-oriented v1 facade retained while callers migrate to the byte contract.
|
|
98
|
+
*/
|
|
99
|
+
|
|
100
|
+
type MemoryFileSystemSnapshotFile = {
|
|
101
|
+
readonly kind: 'text';
|
|
102
|
+
readonly path: string;
|
|
103
|
+
readonly content: string;
|
|
104
|
+
} | {
|
|
105
|
+
readonly kind: 'binary';
|
|
106
|
+
readonly path: string;
|
|
107
|
+
readonly data: ArrayBuffer | Uint8Array;
|
|
108
|
+
};
|
|
109
|
+
/** Complete provider-relative state for a transient memory workspace. */
|
|
110
|
+
interface MemoryFileSystemSnapshot {
|
|
111
|
+
readonly files: readonly MemoryFileSystemSnapshotFile[];
|
|
112
|
+
readonly directories?: readonly string[];
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Legacy facade over the correctness-first memory provider.
|
|
116
|
+
*
|
|
117
|
+
* Synchronous seed/snapshot replacement methods remain because DBK import
|
|
118
|
+
* fully stages external bytes before publishing one atomic in-memory swap.
|
|
119
|
+
*/
|
|
120
|
+
declare class MemoryFileSystemProvider implements FileSystemProvider {
|
|
121
|
+
readonly id: string;
|
|
122
|
+
readonly label: string;
|
|
123
|
+
readonly v2: MemoryFileSystemProviderV2;
|
|
124
|
+
constructor(id: string, label: string);
|
|
125
|
+
/** Monotonic version of the complete in-memory tree. */
|
|
126
|
+
get treeVersion(): number;
|
|
127
|
+
/** Capture an owned deterministic copy of the complete transient tree. */
|
|
128
|
+
captureContents(): MemoryFileSystemSnapshot;
|
|
129
|
+
/** Atomically replace the complete tree after validating and owning all input. */
|
|
130
|
+
replaceContents(snapshot: MemoryFileSystemSnapshot, expectedTreeVersion?: number): void;
|
|
131
|
+
/** Seed synchronously before publishing a transient provider to consumers. */
|
|
132
|
+
seedText(path: string, content: string): void;
|
|
133
|
+
readFile(path: string): Promise<string | null>;
|
|
134
|
+
writeFile(path: string, content: string): Promise<void>;
|
|
135
|
+
commitFile(path: string, content: string, expectedContent: string | null): Promise<FileCommitResult>;
|
|
136
|
+
delete(path: string): Promise<void>;
|
|
137
|
+
rename(oldPath: string, newPath: string): Promise<void>;
|
|
138
|
+
readDirectory(path: string): Promise<FileSystemEntry[]>;
|
|
139
|
+
exists(path: string): Promise<boolean>;
|
|
140
|
+
createDirectory(path: string): Promise<void>;
|
|
141
|
+
stat(path: string): Promise<FileMeta | null>;
|
|
142
|
+
/**
|
|
143
|
+
* Every stored file is bytes, so every stored file is readable as binary.
|
|
144
|
+
* `payloadKind` records how a file was written for DBK export fidelity; it is
|
|
145
|
+
* not a filter. Gating on it made `readBinary` report an existing text file as
|
|
146
|
+
* missing, which no other provider does and which callers read as "no file".
|
|
147
|
+
*/
|
|
148
|
+
readBinary(path: string): Promise<ArrayBuffer | null>;
|
|
149
|
+
writeBinary(path: string, data: ArrayBuffer | Uint8Array): Promise<void>;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export { type MemoryFilePayloadKind, MemoryFileSystemProvider, MemoryFileSystemProviderV2, type MemoryFileSystemSnapshot, type MemoryFileSystemSnapshotFile, type MemoryFileSystemV2CompatibilityFile, type MemoryFileSystemV2Replacement, type MemoryFileSystemV2ReplacementFile, type MemoryFileSystemV2State, type MemoryFileSystemV2StateFile };
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import {
|
|
2
|
+
MemoryFileSystemProvider,
|
|
3
|
+
MemoryFileSystemProviderV2
|
|
4
|
+
} from "../chunk-ZO7G53QP.js";
|
|
5
|
+
import "../chunk-KQ6756AJ.js";
|
|
6
|
+
import "../chunk-M62ZGJ5I.js";
|
|
7
|
+
import "../chunk-M5ZNQGR5.js";
|
|
8
|
+
import "../chunk-AYWKIZLD.js";
|
|
9
|
+
export {
|
|
10
|
+
MemoryFileSystemProvider,
|
|
11
|
+
MemoryFileSystemProviderV2
|
|
12
|
+
};
|
|
@@ -1,4 +1,136 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { M as FsError, s as FileSystemProviderV2, r as FileSystemProviderCapabilities, k as FileSystemEntrySnapshot, m as FileSystemFileRead, K as FileSystemWriteOptions, n as FileSystemFileSnapshot, g as FileSystemCreateDirectoryOptions, h as FileSystemDirectorySnapshot, u as FileSystemRemoveOptions, v as FileSystemRemoveResult, o as FileSystemMoveOptions, w as FileSystemSnapshot, G as FileSystemWatchListener, H as FileSystemWatchOptions, I as FileSystemWatchSubscription, q as FileSystemProvider, F as FileCommitResult, j as FileSystemEntry, b as FileMeta } from '../types-BEg5SQ1_.js';
|
|
2
|
+
import { a as WorkspacePath } from '../workspace-path-CWVrcuPL.js';
|
|
3
|
+
|
|
4
|
+
type NativeFileSystemMovePathState = 'present' | 'missing' | 'unknown';
|
|
5
|
+
interface NativeFileSystemMoveRecoveryState {
|
|
6
|
+
readonly source: NativeFileSystemMovePathState;
|
|
7
|
+
readonly destination: NativeFileSystemMovePathState;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* A copy/delete move failed and the provider could not prove that rollback
|
|
11
|
+
* restored the source-only state. Callers must inspect `state` before retrying.
|
|
12
|
+
*/
|
|
13
|
+
declare class NativeFileSystemMoveRecoveryError extends FsError {
|
|
14
|
+
readonly primaryError: FsError;
|
|
15
|
+
readonly recoveryErrors: readonly FsError[];
|
|
16
|
+
readonly state: NativeFileSystemMoveRecoveryState;
|
|
17
|
+
constructor(sourcePath: WorkspacePath, destinationPath: WorkspacePath, primaryError: FsError, recoveryErrors: readonly FsError[], state: NativeFileSystemMoveRecoveryState);
|
|
18
|
+
}
|
|
19
|
+
/** Direct File System Access API implementation of FileSystemProviderV2. */
|
|
20
|
+
declare class NativeFileSystemProviderV2 implements FileSystemProviderV2 {
|
|
21
|
+
readonly id: string;
|
|
22
|
+
readonly label: string;
|
|
23
|
+
readonly capabilities: FileSystemProviderCapabilities;
|
|
24
|
+
private readonly root;
|
|
25
|
+
private readonly lockKey;
|
|
26
|
+
private readonly subscriptions;
|
|
27
|
+
private readonly inFlight;
|
|
28
|
+
private disposed;
|
|
29
|
+
private disposePromise;
|
|
30
|
+
constructor(id: string, root: FileSystemDirectoryHandle);
|
|
31
|
+
stat(path: WorkspacePath): Promise<FileSystemEntrySnapshot | null>;
|
|
32
|
+
readFile(path: WorkspacePath): Promise<FileSystemFileRead | null>;
|
|
33
|
+
readDirectory(path: WorkspacePath): Promise<readonly FileSystemEntrySnapshot[]>;
|
|
34
|
+
writeFile(path: WorkspacePath, data: ArrayBuffer | Uint8Array, options?: FileSystemWriteOptions): Promise<FileSystemFileSnapshot>;
|
|
35
|
+
createDirectory(path: WorkspacePath, options?: FileSystemCreateDirectoryOptions): Promise<FileSystemDirectorySnapshot>;
|
|
36
|
+
remove(path: WorkspacePath, options?: FileSystemRemoveOptions): Promise<FileSystemRemoveResult>;
|
|
37
|
+
move(oldPath: WorkspacePath, newPath: WorkspacePath, options?: FileSystemMoveOptions): Promise<FileSystemEntrySnapshot>;
|
|
38
|
+
snapshot(): Promise<FileSystemSnapshot>;
|
|
39
|
+
watch(_listener: FileSystemWatchListener, options?: FileSystemWatchOptions): FileSystemWatchSubscription;
|
|
40
|
+
dispose(): Promise<void>;
|
|
41
|
+
private canonical;
|
|
42
|
+
private canonicalNonRoot;
|
|
43
|
+
private execute;
|
|
44
|
+
private mutate;
|
|
45
|
+
private assertOpen;
|
|
46
|
+
private translateError;
|
|
47
|
+
private error;
|
|
48
|
+
private assertExpectedVersion;
|
|
49
|
+
private resolveDirectory;
|
|
50
|
+
private getHandle;
|
|
51
|
+
private tryScanMetadata;
|
|
52
|
+
private tryScanSnapshot;
|
|
53
|
+
private requireMetadata;
|
|
54
|
+
private requireSnapshot;
|
|
55
|
+
private scanMetadataHandle;
|
|
56
|
+
private scanSnapshotHandle;
|
|
57
|
+
private scanHandle;
|
|
58
|
+
private scanFileMetadata;
|
|
59
|
+
private scanFileSnapshot;
|
|
60
|
+
private getFileSnapshot;
|
|
61
|
+
private fileMetadata;
|
|
62
|
+
private planParents;
|
|
63
|
+
private createDirectories;
|
|
64
|
+
private rollbackDirectories;
|
|
65
|
+
private writeBytes;
|
|
66
|
+
private removeEntry;
|
|
67
|
+
private removeEmptyFileIfPresent;
|
|
68
|
+
private currentTreeVersion;
|
|
69
|
+
private writeTree;
|
|
70
|
+
private rollbackMoveAndThrow;
|
|
71
|
+
/**
|
|
72
|
+
* Whether the source still holds exactly the bytes the move captured.
|
|
73
|
+
*
|
|
74
|
+
* A probe that fails answers "no": rollback must never treat an unverifiable
|
|
75
|
+
* source as whole, because that is precisely what licenses deleting the copy
|
|
76
|
+
* at the destination.
|
|
77
|
+
*/
|
|
78
|
+
private matchesCapturedSource;
|
|
79
|
+
private probeScan;
|
|
80
|
+
private probeSnapshot;
|
|
81
|
+
private probePresence;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* NativeFileSystemProvider — wraps the File System Access API
|
|
86
|
+
* (window.showDirectoryPicker / FileSystemDirectoryHandle).
|
|
87
|
+
*
|
|
88
|
+
* Progressive enhancement: only available in browsers that support
|
|
89
|
+
* the API (Chrome, Edge). Feature-detect with `isNativeFileSystemSupported()`.
|
|
90
|
+
*/
|
|
91
|
+
|
|
92
|
+
declare function isNativeFileSystemSupported(): boolean;
|
|
93
|
+
/** Persist a FileSystemDirectoryHandle so it survives page reloads. */
|
|
94
|
+
declare function storeDirectoryHandle(workspaceId: string, handle: FileSystemDirectoryHandle): Promise<void>;
|
|
95
|
+
/** Retrieve a previously stored handle. Returns null if not found. */
|
|
96
|
+
declare function loadDirectoryHandle(workspaceId: string): Promise<FileSystemDirectoryHandle | null>;
|
|
97
|
+
/** Remove a stored handle (e.g. when deleting a workspace). */
|
|
98
|
+
declare function removeDirectoryHandle(workspaceId: string): Promise<void>;
|
|
99
|
+
declare class NativeFileSystemProvider implements FileSystemProvider {
|
|
100
|
+
readonly id: string;
|
|
101
|
+
readonly label: string;
|
|
102
|
+
readonly v2: NativeFileSystemProviderV2;
|
|
103
|
+
private root;
|
|
104
|
+
constructor(id: string, root: FileSystemDirectoryHandle);
|
|
105
|
+
private withMutationLock;
|
|
106
|
+
private copyDirectory;
|
|
107
|
+
readFile(path: string): Promise<string | null>;
|
|
108
|
+
writeFile(path: string, content: string): Promise<void>;
|
|
109
|
+
private writeFileUnlocked;
|
|
110
|
+
commitFile(path: string, content: string, expectedContent: string | null): Promise<FileCommitResult>;
|
|
111
|
+
delete(path: string): Promise<void>;
|
|
112
|
+
private deleteUnlocked;
|
|
113
|
+
rename(oldPath: string, newPath: string): Promise<void>;
|
|
114
|
+
private renameUnlocked;
|
|
115
|
+
readDirectory(path: string): Promise<FileSystemEntry[]>;
|
|
116
|
+
exists(path: string): Promise<boolean>;
|
|
117
|
+
createDirectory(path: string): Promise<void>;
|
|
118
|
+
stat(path: string): Promise<FileMeta | null>;
|
|
119
|
+
readBinary(path: string): Promise<ArrayBuffer | null>;
|
|
120
|
+
writeBinary(path: string, data: ArrayBuffer | Uint8Array): Promise<void>;
|
|
121
|
+
private writeBinaryUnlocked;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Prompt the user to pick a local folder and return a NativeFileSystemProvider.
|
|
125
|
+
* The directory handle is persisted in IndexedDB so it can be restored later.
|
|
126
|
+
* Throws if the user cancels or the API is unsupported.
|
|
127
|
+
*/
|
|
128
|
+
declare function openNativeFolder(): Promise<NativeFileSystemProvider>;
|
|
129
|
+
/**
|
|
130
|
+
* Restore a previously opened native folder from a persisted handle.
|
|
131
|
+
* Re-requests read/write permission (browser will show a prompt).
|
|
132
|
+
* Returns null if the handle is not found or permission is denied.
|
|
133
|
+
*/
|
|
134
|
+
declare function restoreNativeFolder(workspaceId: string): Promise<NativeFileSystemProvider | null>;
|
|
135
|
+
|
|
136
|
+
export { type NativeFileSystemMovePathState, NativeFileSystemMoveRecoveryError, type NativeFileSystemMoveRecoveryState, NativeFileSystemProvider, NativeFileSystemProviderV2, isNativeFileSystemSupported, loadDirectoryHandle, openNativeFolder, removeDirectoryHandle, restoreNativeFolder, storeDirectoryHandle };
|
|
@@ -1,4 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import {
|
|
2
|
+
NativeFileSystemMoveRecoveryError,
|
|
3
|
+
NativeFileSystemProvider,
|
|
4
|
+
NativeFileSystemProviderV2,
|
|
5
|
+
isNativeFileSystemSupported,
|
|
6
|
+
loadDirectoryHandle,
|
|
7
|
+
openNativeFolder,
|
|
8
|
+
removeDirectoryHandle,
|
|
9
|
+
restoreNativeFolder,
|
|
10
|
+
storeDirectoryHandle
|
|
11
|
+
} from "../chunk-4437YWLE.js";
|
|
12
|
+
import "../chunk-DZB666V7.js";
|
|
13
|
+
import "../chunk-KQ6756AJ.js";
|
|
14
|
+
import "../chunk-M62ZGJ5I.js";
|
|
15
|
+
import "../chunk-M5ZNQGR5.js";
|
|
16
|
+
import "../chunk-AYWKIZLD.js";
|
|
17
|
+
export {
|
|
18
|
+
NativeFileSystemMoveRecoveryError,
|
|
19
|
+
NativeFileSystemProvider,
|
|
20
|
+
NativeFileSystemProviderV2,
|
|
21
|
+
isNativeFileSystemSupported,
|
|
22
|
+
loadDirectoryHandle,
|
|
23
|
+
openNativeFolder,
|
|
24
|
+
removeDirectoryHandle,
|
|
25
|
+
restoreNativeFolder,
|
|
26
|
+
storeDirectoryHandle
|
|
27
|
+
};
|