@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,10 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ELECTRON_FILE_SYSTEM_V2_CAPABILITIES,
|
|
3
3
|
maybeGetDocBlocksHost
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-6XHOOBYF.js";
|
|
5
5
|
import {
|
|
6
|
+
isRecord
|
|
7
|
+
} from "./chunk-73OOROXH.js";
|
|
8
|
+
import {
|
|
9
|
+
compareSnapshotsByPath,
|
|
10
|
+
compareText,
|
|
11
|
+
copyBytes,
|
|
6
12
|
parseFileSystemVersion
|
|
7
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-M62ZGJ5I.js";
|
|
8
14
|
import {
|
|
9
15
|
FsError,
|
|
10
16
|
WORKSPACE_ROOT,
|
|
@@ -14,7 +20,7 @@ import {
|
|
|
14
20
|
parseWorkspacePath,
|
|
15
21
|
workspacePathBasename,
|
|
16
22
|
workspacePathDirname
|
|
17
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-AYWKIZLD.js";
|
|
18
24
|
|
|
19
25
|
// src/filesystem/electron-provider-v2.ts
|
|
20
26
|
var fallbackInstanceSequence = 0;
|
|
@@ -327,7 +333,7 @@ function normalizeDirectoryListing(value, parent) {
|
|
|
327
333
|
if (seen.has(entry.path)) throw new TypeError("Filesystem listing contained a duplicate path.");
|
|
328
334
|
seen.add(entry.path);
|
|
329
335
|
}
|
|
330
|
-
const ordered = [...entries].sort(
|
|
336
|
+
const ordered = [...entries].sort(compareSnapshotsByPath);
|
|
331
337
|
if (ordered.some((entry, index) => entry.path !== entries[index]?.path)) {
|
|
332
338
|
throw new TypeError("Filesystem listing was not in canonical deterministic order.");
|
|
333
339
|
}
|
|
@@ -439,13 +445,6 @@ function assertCapabilities(value, operation) {
|
|
|
439
445
|
}
|
|
440
446
|
}
|
|
441
447
|
}
|
|
442
|
-
function compareDirectoryEntries(left, right) {
|
|
443
|
-
if (left.kind !== right.kind) return left.kind === "directory" ? -1 : 1;
|
|
444
|
-
return compareText(left.path, right.path);
|
|
445
|
-
}
|
|
446
|
-
function compareText(left, right) {
|
|
447
|
-
return left < right ? -1 : left > right ? 1 : 0;
|
|
448
|
-
}
|
|
449
448
|
function isWatchOrigin(value) {
|
|
450
449
|
return value === "local" || value === "external" || value === "unknown";
|
|
451
450
|
}
|
|
@@ -458,9 +457,6 @@ function isNonNegativeSafeInteger(value) {
|
|
|
458
457
|
function isPositiveSafeInteger(value) {
|
|
459
458
|
return isNonNegativeSafeInteger(value) && value > 0;
|
|
460
459
|
}
|
|
461
|
-
function isRecord(value) {
|
|
462
|
-
return typeof value === "object" && value !== null;
|
|
463
|
-
}
|
|
464
460
|
function invalidTransport(operation, message) {
|
|
465
461
|
return new FsError("io", message, { operation, retryable: false });
|
|
466
462
|
}
|
|
@@ -477,12 +473,6 @@ function withOperation(error, operation) {
|
|
|
477
473
|
retryable: error.retryable
|
|
478
474
|
});
|
|
479
475
|
}
|
|
480
|
-
function copyBytes(data) {
|
|
481
|
-
const source = ArrayBuffer.isView(data) ? new Uint8Array(data.buffer, data.byteOffset, data.byteLength) : new Uint8Array(data);
|
|
482
|
-
const copy = new Uint8Array(source.byteLength);
|
|
483
|
-
copy.set(source);
|
|
484
|
-
return copy.buffer;
|
|
485
|
-
}
|
|
486
476
|
function copyWireBuffer(data) {
|
|
487
477
|
if (Object.prototype.toString.call(data) !== "[object ArrayBuffer]") {
|
|
488
478
|
throw new TypeError("Expected an ArrayBuffer from the filesystem transport.");
|
|
@@ -560,4 +550,3 @@ export {
|
|
|
560
550
|
ElectronFileSystemProviderV2,
|
|
561
551
|
ElectronFileSystemProvider
|
|
562
552
|
};
|
|
563
|
-
//# sourceMappingURL=chunk-GCPBEMMH.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
tryParseWorkspacePath
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-AYWKIZLD.js";
|
|
4
4
|
|
|
5
5
|
// src/mcp/types.ts
|
|
6
6
|
var DOCBLOCKS_MCP_WIRE_VERSION = 1;
|
|
@@ -105,16 +105,22 @@ function parseDocumentSource(value) {
|
|
|
105
105
|
if (!isRecord(value) || typeof value.kind !== "string") return null;
|
|
106
106
|
switch (value.kind) {
|
|
107
107
|
case "markdown": {
|
|
108
|
-
if (!hasExactKeys(value, ["kind", "markdown", "name"]))
|
|
109
|
-
|
|
108
|
+
if (!hasExactKeys(value, ["kind", "markdown"]) && !hasExactKeys(value, ["kind", "markdown", "name"])) {
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
const { markdown } = value;
|
|
112
|
+
const name = Object.prototype.hasOwnProperty.call(value, "name") ? value.name : null;
|
|
110
113
|
if (!isBoundedString(markdown, MCP_WIRE_LIMITS.documentCharacters) || !isNullableBoundedString(name, MCP_WIRE_LIMITS.labelCharacters)) {
|
|
111
114
|
return null;
|
|
112
115
|
}
|
|
113
116
|
return { kind: "markdown", markdown, name };
|
|
114
117
|
}
|
|
115
118
|
case "file": {
|
|
116
|
-
if (!hasExactKeys(value, ["kind", "rootId", "path", "format"]))
|
|
117
|
-
|
|
119
|
+
if (!hasExactKeys(value, ["kind", "rootId", "path"]) && !hasExactKeys(value, ["kind", "rootId", "path", "format"])) {
|
|
120
|
+
return null;
|
|
121
|
+
}
|
|
122
|
+
const { rootId, path } = value;
|
|
123
|
+
const format = Object.prototype.hasOwnProperty.call(value, "format") ? value.format : null;
|
|
118
124
|
const parsedPath = parseNonRootWorkspacePath(path);
|
|
119
125
|
if (!isIdentifier(rootId) || parsedPath === null || !(format === null || isFormat(format))) {
|
|
120
126
|
return null;
|
|
@@ -126,8 +132,11 @@ function parseDocumentSource(value) {
|
|
|
126
132
|
return { kind: "artifact", uri: value.uri };
|
|
127
133
|
}
|
|
128
134
|
case "bundle": {
|
|
129
|
-
if (!hasExactKeys(value, ["kind", "markdown", "assets", "name"]))
|
|
130
|
-
|
|
135
|
+
if (!hasExactKeys(value, ["kind", "markdown", "assets"]) && !hasExactKeys(value, ["kind", "markdown", "assets", "name"])) {
|
|
136
|
+
return null;
|
|
137
|
+
}
|
|
138
|
+
const { markdown } = value;
|
|
139
|
+
const name = Object.prototype.hasOwnProperty.call(value, "name") ? value.name : null;
|
|
131
140
|
if (!isBoundedString(markdown, MCP_WIRE_LIMITS.documentCharacters) || !isNullableBoundedString(name, MCP_WIRE_LIMITS.labelCharacters)) {
|
|
132
141
|
return null;
|
|
133
142
|
}
|
|
@@ -390,12 +399,12 @@ function parseComparisonResult(value) {
|
|
|
390
399
|
};
|
|
391
400
|
}
|
|
392
401
|
function parseMaterializationOptions(value) {
|
|
393
|
-
if (!isRecord(value) || !hasExactKeys(value, ["rootId", "path", "ifExists", "expectedSha256"]) || !isIdentifier(value.rootId)) {
|
|
402
|
+
if (!isRecord(value) || !hasExactKeys(value, ["rootId", "path", "ifExists"]) && !hasExactKeys(value, ["rootId", "path", "ifExists", "expectedSha256"]) || !isIdentifier(value.rootId)) {
|
|
394
403
|
return null;
|
|
395
404
|
}
|
|
396
405
|
const path = parseNonRootWorkspacePath(value.path);
|
|
397
406
|
if (path === null) return null;
|
|
398
|
-
if (value.ifExists === "error" && value.expectedSha256 === null) {
|
|
407
|
+
if (value.ifExists === "error" && (value.expectedSha256 === null || !Object.prototype.hasOwnProperty.call(value, "expectedSha256"))) {
|
|
399
408
|
return { rootId: value.rootId, path, ifExists: "error", expectedSha256: null };
|
|
400
409
|
}
|
|
401
410
|
if (value.ifExists === "replace" && isSha256(value.expectedSha256)) {
|
|
@@ -799,4 +808,3 @@ export {
|
|
|
799
808
|
parseComparisonResult,
|
|
800
809
|
parseMaterializationOptions
|
|
801
810
|
};
|
|
802
|
-
//# sourceMappingURL=chunk-75UUF6C4.js.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {
|
|
2
|
+
workspacePathDirname
|
|
3
|
+
} from "./chunk-AYWKIZLD.js";
|
|
4
|
+
|
|
5
|
+
// src/filesystem/internal/parent-chain.ts
|
|
6
|
+
function parentChain(path) {
|
|
7
|
+
const parents = [];
|
|
8
|
+
let current = workspacePathDirname(path);
|
|
9
|
+
while (current) {
|
|
10
|
+
parents.unshift(current);
|
|
11
|
+
current = workspacePathDirname(current);
|
|
12
|
+
}
|
|
13
|
+
return parents;
|
|
14
|
+
}
|
|
15
|
+
function parentChainWithRoot(path) {
|
|
16
|
+
const parents = [];
|
|
17
|
+
let current = workspacePathDirname(path);
|
|
18
|
+
while (true) {
|
|
19
|
+
parents.unshift(current);
|
|
20
|
+
if (!current) return parents;
|
|
21
|
+
current = workspacePathDirname(current);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export {
|
|
26
|
+
parentChain,
|
|
27
|
+
parentChainWithRoot
|
|
28
|
+
};
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
// src/share/index.ts
|
|
2
|
+
var SHARED_DOCUMENT_LIMITS = Object.freeze({
|
|
3
|
+
/** A conservative interoperability threshold, not a universal browser limit. */
|
|
4
|
+
portableUrlCharacters: 4096,
|
|
5
|
+
/** Hard cap applied before a hash is copied or decoded. */
|
|
6
|
+
urlCharacters: 32768,
|
|
7
|
+
/** Maximum UTF-8 Markdown accepted by the first-party link generator. */
|
|
8
|
+
markdownBytes: 20 * 1024,
|
|
9
|
+
/** Maximum compressed DBK bytes carried by the versioned envelope. */
|
|
10
|
+
archiveBytes: 23 * 1024
|
|
11
|
+
});
|
|
12
|
+
var BASE64_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
13
|
+
var HASH_PREFIX = "#shared(";
|
|
14
|
+
var MAGIC = new Uint8Array([68, 66, 83, 72, 65, 82, 69]);
|
|
15
|
+
var VERSION = 1;
|
|
16
|
+
var HEADER_BYTES = MAGIC.byteLength + 2;
|
|
17
|
+
var MODE_TO_CODE = Object.freeze({
|
|
18
|
+
slideshow: 1,
|
|
19
|
+
video: 2,
|
|
20
|
+
page: 3,
|
|
21
|
+
document: 4,
|
|
22
|
+
narrate: 5
|
|
23
|
+
});
|
|
24
|
+
var CODE_TO_MODE = Object.freeze({
|
|
25
|
+
1: "slideshow",
|
|
26
|
+
2: "video",
|
|
27
|
+
3: "page",
|
|
28
|
+
4: "document",
|
|
29
|
+
5: "narrate"
|
|
30
|
+
});
|
|
31
|
+
function createSharedDocumentHash(archive, mode = null) {
|
|
32
|
+
assertArchive(archive);
|
|
33
|
+
const bytes = new Uint8Array(HEADER_BYTES + archive.byteLength);
|
|
34
|
+
bytes.set(MAGIC, 0);
|
|
35
|
+
bytes[MAGIC.byteLength] = VERSION;
|
|
36
|
+
bytes[MAGIC.byteLength + 1] = mode === null ? 0 : MODE_TO_CODE[mode];
|
|
37
|
+
bytes.set(archive, HEADER_BYTES);
|
|
38
|
+
const hash = `${HASH_PREFIX}${encodeBase64(bytes)})`;
|
|
39
|
+
if (hash.length > SHARED_DOCUMENT_LIMITS.urlCharacters) {
|
|
40
|
+
throw new Error("The shared document payload exceeds the URL length limit.");
|
|
41
|
+
}
|
|
42
|
+
return hash;
|
|
43
|
+
}
|
|
44
|
+
function createSharedDocumentUrl(baseUrl, archive, mode = null) {
|
|
45
|
+
const url = new URL(baseUrl);
|
|
46
|
+
if (url.protocol !== "http:" && url.protocol !== "https:") {
|
|
47
|
+
throw new Error("Shared document links require an HTTP(S) DocBlocks URL.");
|
|
48
|
+
}
|
|
49
|
+
url.hash = createSharedDocumentHash(archive, mode);
|
|
50
|
+
const result = url.toString();
|
|
51
|
+
if (result.length > SHARED_DOCUMENT_LIMITS.urlCharacters) {
|
|
52
|
+
throw new Error("The shared document link exceeds the URL length limit.");
|
|
53
|
+
}
|
|
54
|
+
return result;
|
|
55
|
+
}
|
|
56
|
+
function parseSharedDocumentHash(hash) {
|
|
57
|
+
if (!hash.startsWith("#shared")) return { kind: "none" };
|
|
58
|
+
if (hash.length > SHARED_DOCUMENT_LIMITS.urlCharacters || !hash.startsWith(HASH_PREFIX) || !hash.endsWith(")")) {
|
|
59
|
+
return invalid("This shared document link is malformed or too long.");
|
|
60
|
+
}
|
|
61
|
+
const encoded = hash.slice(HASH_PREFIX.length, -1);
|
|
62
|
+
const maximumPayloadBytes = HEADER_BYTES + SHARED_DOCUMENT_LIMITS.archiveBytes;
|
|
63
|
+
const maximumBase64Characters = Math.ceil(maximumPayloadBytes / 3) * 4;
|
|
64
|
+
if (encoded.length === 0 || encoded.length > maximumBase64Characters) {
|
|
65
|
+
return invalid("This shared document payload is empty or too large.");
|
|
66
|
+
}
|
|
67
|
+
const bytes = decodeBase64(encoded, maximumPayloadBytes);
|
|
68
|
+
if (!bytes || bytes.byteLength <= HEADER_BYTES) {
|
|
69
|
+
return invalid("This shared document payload is not valid base64 data.");
|
|
70
|
+
}
|
|
71
|
+
for (let index = 0; index < MAGIC.byteLength; index += 1) {
|
|
72
|
+
if (bytes[index] !== MAGIC[index]) {
|
|
73
|
+
return invalid("This shared document payload has an unknown format.");
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
if (bytes[MAGIC.byteLength] !== VERSION) {
|
|
77
|
+
return invalid("This shared document link uses an unsupported version.");
|
|
78
|
+
}
|
|
79
|
+
const modeCode = bytes[MAGIC.byteLength + 1] ?? 0;
|
|
80
|
+
const mode = modeCode === 0 ? null : CODE_TO_MODE[modeCode];
|
|
81
|
+
if (modeCode !== 0 && !mode) {
|
|
82
|
+
return invalid("This shared document link has an unsupported launch mode.");
|
|
83
|
+
}
|
|
84
|
+
const archive = bytes.slice(HEADER_BYTES);
|
|
85
|
+
if (!hasZipSignature(archive)) {
|
|
86
|
+
return invalid("This shared document payload does not contain a DBK archive.");
|
|
87
|
+
}
|
|
88
|
+
return { kind: "valid", payload: { archive, mode } };
|
|
89
|
+
}
|
|
90
|
+
function assertArchive(archive) {
|
|
91
|
+
if (archive.byteLength === 0 || archive.byteLength > SHARED_DOCUMENT_LIMITS.archiveBytes) {
|
|
92
|
+
throw new Error("The shared document archive exceeds the URL payload limit.");
|
|
93
|
+
}
|
|
94
|
+
if (!hasZipSignature(archive)) {
|
|
95
|
+
throw new Error("A shared document payload must contain a DBK ZIP archive.");
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
function hasZipSignature(bytes) {
|
|
99
|
+
return bytes.byteLength >= 4 && bytes[0] === 80 && bytes[1] === 75 && bytes[2] === 3 && bytes[3] === 4;
|
|
100
|
+
}
|
|
101
|
+
function invalid(message) {
|
|
102
|
+
return { kind: "invalid", message };
|
|
103
|
+
}
|
|
104
|
+
function encodeBase64(bytes) {
|
|
105
|
+
let result = "";
|
|
106
|
+
for (let index = 0; index < bytes.byteLength; index += 3) {
|
|
107
|
+
const first = bytes[index] ?? 0;
|
|
108
|
+
const hasSecond = index + 1 < bytes.byteLength;
|
|
109
|
+
const hasThird = index + 2 < bytes.byteLength;
|
|
110
|
+
const second = bytes[index + 1] ?? 0;
|
|
111
|
+
const third = bytes[index + 2] ?? 0;
|
|
112
|
+
const value = first << 16 | second << 8 | third;
|
|
113
|
+
result += BASE64_ALPHABET[value >>> 18 & 63];
|
|
114
|
+
result += BASE64_ALPHABET[value >>> 12 & 63];
|
|
115
|
+
result += hasSecond ? BASE64_ALPHABET[value >>> 6 & 63] : "=";
|
|
116
|
+
result += hasThird ? BASE64_ALPHABET[value & 63] : "=";
|
|
117
|
+
}
|
|
118
|
+
return result;
|
|
119
|
+
}
|
|
120
|
+
function decodeBase64(value, maximumBytes) {
|
|
121
|
+
if (value.length % 4 !== 0 || !/^[A-Za-z0-9+/]*={0,2}$/u.test(value) || value.slice(0, -2).includes("=")) {
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
const padding = value.endsWith("==") ? 2 : value.endsWith("=") ? 1 : 0;
|
|
125
|
+
const byteLength = value.length / 4 * 3 - padding;
|
|
126
|
+
if (byteLength <= 0 || byteLength > maximumBytes) return null;
|
|
127
|
+
const result = new Uint8Array(byteLength);
|
|
128
|
+
let outputIndex = 0;
|
|
129
|
+
for (let index = 0; index < value.length; index += 4) {
|
|
130
|
+
const a = BASE64_ALPHABET.indexOf(value[index] ?? "");
|
|
131
|
+
const b = BASE64_ALPHABET.indexOf(value[index + 1] ?? "");
|
|
132
|
+
const c = value[index + 2] === "=" ? 0 : BASE64_ALPHABET.indexOf(value[index + 2] ?? "");
|
|
133
|
+
const d = value[index + 3] === "=" ? 0 : BASE64_ALPHABET.indexOf(value[index + 3] ?? "");
|
|
134
|
+
if (a < 0 || b < 0 || c < 0 || d < 0) return null;
|
|
135
|
+
const combined = a << 18 | b << 12 | c << 6 | d;
|
|
136
|
+
if (outputIndex < byteLength) result[outputIndex++] = combined >>> 16 & 255;
|
|
137
|
+
if (outputIndex < byteLength) result[outputIndex++] = combined >>> 8 & 255;
|
|
138
|
+
if (outputIndex < byteLength) result[outputIndex++] = combined & 255;
|
|
139
|
+
}
|
|
140
|
+
return encodeBase64(result) === value ? result : null;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export {
|
|
144
|
+
SHARED_DOCUMENT_LIMITS,
|
|
145
|
+
createSharedDocumentHash,
|
|
146
|
+
createSharedDocumentUrl,
|
|
147
|
+
parseSharedDocumentHash
|
|
148
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
FsError
|
|
3
|
+
} from "./chunk-AYWKIZLD.js";
|
|
4
|
+
|
|
5
|
+
// src/filesystem/utf8.ts
|
|
6
|
+
function decodeUtf8Text(data, options = {}) {
|
|
7
|
+
try {
|
|
8
|
+
return new TextDecoder("utf-8", { fatal: true }).decode(data);
|
|
9
|
+
} catch {
|
|
10
|
+
throw new FsError("corrupt", `${options.label ?? "Text content"} is not valid UTF-8.`, {
|
|
11
|
+
operation: options.operation ?? "read",
|
|
12
|
+
path: options.path
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export {
|
|
18
|
+
decodeUtf8Text
|
|
19
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// src/filesystem/v2.ts
|
|
2
|
+
function parseFileSystemVersion(value) {
|
|
3
|
+
if (typeof value !== "string" || !value || value.length > 1024 || value.includes("\0")) {
|
|
4
|
+
throw new TypeError("Filesystem version tokens must be non-empty bounded strings.");
|
|
5
|
+
}
|
|
6
|
+
return value;
|
|
7
|
+
}
|
|
8
|
+
function tryParseFileSystemVersion(value) {
|
|
9
|
+
try {
|
|
10
|
+
return parseFileSystemVersion(value);
|
|
11
|
+
} catch {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// src/filesystem/internal/bytes.ts
|
|
17
|
+
function copyBytes(data) {
|
|
18
|
+
const source = ArrayBuffer.isView(data) ? new Uint8Array(data.buffer, data.byteOffset, data.byteLength) : new Uint8Array(data);
|
|
19
|
+
const copy = new Uint8Array(source.byteLength);
|
|
20
|
+
copy.set(source);
|
|
21
|
+
return copy.buffer;
|
|
22
|
+
}
|
|
23
|
+
function bytesEqual(left, right) {
|
|
24
|
+
const leftBytes = ArrayBuffer.isView(left) ? new Uint8Array(left.buffer, left.byteOffset, left.byteLength) : new Uint8Array(left);
|
|
25
|
+
const rightBytes = ArrayBuffer.isView(right) ? new Uint8Array(right.buffer, right.byteOffset, right.byteLength) : new Uint8Array(right);
|
|
26
|
+
if (leftBytes.byteLength !== rightBytes.byteLength) return false;
|
|
27
|
+
return leftBytes.every((byte, index) => byte === rightBytes[index]);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// src/filesystem/internal/entry-order.ts
|
|
31
|
+
function compareText(left, right) {
|
|
32
|
+
return left < right ? -1 : left > right ? 1 : 0;
|
|
33
|
+
}
|
|
34
|
+
function compareSnapshotsByName(left, right) {
|
|
35
|
+
if (left.kind !== right.kind) return left.kind === "directory" ? -1 : 1;
|
|
36
|
+
return compareText(left.name, right.name);
|
|
37
|
+
}
|
|
38
|
+
function compareSnapshotsByPath(left, right) {
|
|
39
|
+
if (left.kind !== right.kind) return left.kind === "directory" ? -1 : 1;
|
|
40
|
+
return compareText(left.path, right.path);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export {
|
|
44
|
+
parseFileSystemVersion,
|
|
45
|
+
tryParseFileSystemVersion,
|
|
46
|
+
copyBytes,
|
|
47
|
+
bytesEqual,
|
|
48
|
+
compareText,
|
|
49
|
+
compareSnapshotsByName,
|
|
50
|
+
compareSnapshotsByPath
|
|
51
|
+
};
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
// src/filesystem/indexeddb-store.ts
|
|
2
|
+
function indexedDBWorkspaceDatabaseName(workspaceId) {
|
|
3
|
+
return `docblocks-fs-${workspaceId}`;
|
|
4
|
+
}
|
|
5
|
+
function deleteIndexedDBDatabase(databaseName) {
|
|
6
|
+
if (typeof indexedDB === "undefined") {
|
|
7
|
+
return Promise.reject(new Error("IndexedDB is not available in this environment."));
|
|
8
|
+
}
|
|
9
|
+
return new Promise((resolve, reject) => {
|
|
10
|
+
const request = indexedDB.deleteDatabase(databaseName);
|
|
11
|
+
request.onsuccess = () => resolve();
|
|
12
|
+
request.onerror = () => reject(request.error ?? new Error(`Failed to delete the "${databaseName}" database.`));
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
function deleteIndexedDBWorkspaceData(workspaceId) {
|
|
16
|
+
return deleteIndexedDBDatabase(indexedDBWorkspaceDatabaseName(workspaceId));
|
|
17
|
+
}
|
|
18
|
+
var RawIndexedDBFileSystemStore = class {
|
|
19
|
+
constructor(databaseName, storeName) {
|
|
20
|
+
this.databaseName = databaseName;
|
|
21
|
+
this.storeName = storeName;
|
|
22
|
+
this.database = null;
|
|
23
|
+
this.opening = null;
|
|
24
|
+
this.closed = false;
|
|
25
|
+
}
|
|
26
|
+
async transaction(mode, operation) {
|
|
27
|
+
const database = await this.getDatabase();
|
|
28
|
+
const nativeTransaction = database.transaction(this.storeName, mode);
|
|
29
|
+
const completion = waitForTransaction(nativeTransaction);
|
|
30
|
+
const transaction = new RawIndexedDBFileSystemTransaction(
|
|
31
|
+
nativeTransaction.objectStore(this.storeName)
|
|
32
|
+
);
|
|
33
|
+
let result;
|
|
34
|
+
try {
|
|
35
|
+
result = await operation(transaction);
|
|
36
|
+
} catch (error) {
|
|
37
|
+
try {
|
|
38
|
+
nativeTransaction.abort();
|
|
39
|
+
} catch {
|
|
40
|
+
}
|
|
41
|
+
await completion.catch(() => void 0);
|
|
42
|
+
throw error;
|
|
43
|
+
}
|
|
44
|
+
await completion;
|
|
45
|
+
return result;
|
|
46
|
+
}
|
|
47
|
+
close() {
|
|
48
|
+
if (this.closed) return;
|
|
49
|
+
this.closed = true;
|
|
50
|
+
this.database?.close();
|
|
51
|
+
this.database = null;
|
|
52
|
+
this.opening = null;
|
|
53
|
+
}
|
|
54
|
+
getDatabase() {
|
|
55
|
+
if (this.closed) {
|
|
56
|
+
return Promise.reject(new Error("The IndexedDB filesystem store is closed."));
|
|
57
|
+
}
|
|
58
|
+
if (this.database) return Promise.resolve(this.database);
|
|
59
|
+
if (this.opening) return this.opening;
|
|
60
|
+
if (typeof indexedDB === "undefined") {
|
|
61
|
+
return Promise.reject(new Error("IndexedDB is not available in this environment."));
|
|
62
|
+
}
|
|
63
|
+
this.opening = openDatabaseWithStore(this.databaseName, this.storeName).then((database) => {
|
|
64
|
+
if (this.closed) {
|
|
65
|
+
database.close();
|
|
66
|
+
throw new Error("The IndexedDB filesystem store is closed.");
|
|
67
|
+
}
|
|
68
|
+
this.database = database;
|
|
69
|
+
this.opening = null;
|
|
70
|
+
database.onversionchange = () => {
|
|
71
|
+
database.close();
|
|
72
|
+
if (this.database === database) this.database = null;
|
|
73
|
+
};
|
|
74
|
+
return database;
|
|
75
|
+
}).catch((error) => {
|
|
76
|
+
this.opening = null;
|
|
77
|
+
throw error;
|
|
78
|
+
});
|
|
79
|
+
return this.opening;
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
var RawIndexedDBFileSystemTransaction = class {
|
|
83
|
+
constructor(store) {
|
|
84
|
+
this.store = store;
|
|
85
|
+
}
|
|
86
|
+
async get(key) {
|
|
87
|
+
const value = await requestResult(this.store.get(key));
|
|
88
|
+
return value === void 0 ? null : value;
|
|
89
|
+
}
|
|
90
|
+
async put(key, value) {
|
|
91
|
+
await requestResult(this.store.put(value, key));
|
|
92
|
+
}
|
|
93
|
+
async delete(key) {
|
|
94
|
+
await requestResult(this.store.delete(key));
|
|
95
|
+
}
|
|
96
|
+
async keys() {
|
|
97
|
+
const keys = await requestResult(this.store.getAllKeys());
|
|
98
|
+
return keys.map((key) => {
|
|
99
|
+
if (typeof key !== "string") {
|
|
100
|
+
throw new Error("The DocBlocks filesystem store contains a non-string key.");
|
|
101
|
+
}
|
|
102
|
+
return key;
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
async hasKeyWithPrefix(prefix) {
|
|
106
|
+
const cursor = await requestResult(this.store.openKeyCursor(IDBKeyRange.lowerBound(prefix)));
|
|
107
|
+
return cursor !== null && typeof cursor.key === "string" && cursor.key.startsWith(prefix);
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
async function openDatabaseWithStore(databaseName, storeName) {
|
|
111
|
+
const database = await openDatabase(databaseName, void 0, (upgradeDatabase) => {
|
|
112
|
+
if (!upgradeDatabase.objectStoreNames.contains(storeName)) {
|
|
113
|
+
upgradeDatabase.createObjectStore(storeName);
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
if (database.objectStoreNames.contains(storeName)) return database;
|
|
117
|
+
const nextVersion = database.version + 1;
|
|
118
|
+
database.close();
|
|
119
|
+
return openDatabase(databaseName, nextVersion, (upgradeDatabase) => {
|
|
120
|
+
if (!upgradeDatabase.objectStoreNames.contains(storeName)) {
|
|
121
|
+
upgradeDatabase.createObjectStore(storeName);
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
function openDatabase(databaseName, version, upgrade) {
|
|
126
|
+
return new Promise((resolve, reject) => {
|
|
127
|
+
const request = version === void 0 ? indexedDB.open(databaseName) : indexedDB.open(databaseName, version);
|
|
128
|
+
let settled = false;
|
|
129
|
+
request.onupgradeneeded = () => upgrade(request.result);
|
|
130
|
+
request.onsuccess = () => {
|
|
131
|
+
if (settled) {
|
|
132
|
+
request.result.close();
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
settled = true;
|
|
136
|
+
resolve(request.result);
|
|
137
|
+
};
|
|
138
|
+
request.onerror = () => {
|
|
139
|
+
if (settled) return;
|
|
140
|
+
settled = true;
|
|
141
|
+
reject(request.error ?? new Error(`Could not open IndexedDB database ${databaseName}.`));
|
|
142
|
+
};
|
|
143
|
+
request.onblocked = () => {
|
|
144
|
+
if (settled) return;
|
|
145
|
+
settled = true;
|
|
146
|
+
reject(new Error(`IndexedDB database ${databaseName} is blocked by another open page.`));
|
|
147
|
+
};
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
function requestResult(request) {
|
|
151
|
+
return new Promise((resolve, reject) => {
|
|
152
|
+
request.onsuccess = () => resolve(request.result);
|
|
153
|
+
request.onerror = () => reject(request.error ?? new Error("IndexedDB request failed."));
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
function waitForTransaction(transaction) {
|
|
157
|
+
return new Promise((resolve, reject) => {
|
|
158
|
+
transaction.oncomplete = () => resolve();
|
|
159
|
+
transaction.onabort = () => reject(transaction.error ?? new Error("IndexedDB transaction was aborted."));
|
|
160
|
+
transaction.onerror = () => reject(transaction.error ?? new Error("IndexedDB transaction failed."));
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export {
|
|
165
|
+
indexedDBWorkspaceDatabaseName,
|
|
166
|
+
deleteIndexedDBWorkspaceData,
|
|
167
|
+
RawIndexedDBFileSystemStore
|
|
168
|
+
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
parseWorkspacePath
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-AYWKIZLD.js";
|
|
4
4
|
import {
|
|
5
5
|
getFileSystemProviderV2
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-XAMILHQP.js";
|
|
7
7
|
|
|
8
8
|
// src/filesystem/move-error.ts
|
|
9
9
|
function locationFromPresence(source, destination) {
|
|
@@ -108,4 +108,3 @@ export {
|
|
|
108
108
|
describePartialMove,
|
|
109
109
|
describeEntryMove
|
|
110
110
|
};
|
|
111
|
-
//# sourceMappingURL=chunk-EGNDADXB.js.map
|