@dxos/plugin-wnfs 0.10.0 → 0.11.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/PLUGIN.mdl +92 -46
- package/dist/lib/WnfsPlugin.mjs +28 -0
- package/dist/lib/WnfsPlugin.mjs.map +1 -0
- package/dist/lib/WnfsPlugin.node.mjs +8 -0
- package/dist/lib/WnfsPlugin.node.mjs.map +1 -0
- package/dist/lib/WnfsPlugin.workerd.mjs +8 -0
- package/dist/lib/WnfsPlugin.workerd.mjs.map +1 -0
- package/dist/lib/capabilities.mjs +8 -0
- package/dist/lib/capabilities.mjs.map +1 -0
- package/dist/lib/chunk-blob-backend.mjs +118 -0
- package/dist/lib/chunk-blob-backend.mjs.map +1 -0
- package/dist/lib/chunk-dependencies.mjs +146 -0
- package/dist/lib/chunk-dependencies.mjs.map +1 -0
- package/dist/lib/chunk-helpers.mjs +198 -0
- package/dist/lib/chunk-helpers.mjs.map +1 -0
- package/dist/lib/chunk-meta.mjs +38 -0
- package/dist/lib/chunk-meta.mjs.map +1 -0
- package/dist/lib/chunk-types.mjs +46 -0
- package/dist/lib/chunk-types.mjs.map +1 -0
- package/dist/lib/helpers.mjs +2 -0
- package/dist/lib/index.mjs +4 -0
- package/dist/lib/meta.mjs +2 -0
- package/dist/lib/plugin.mjs +8 -0
- package/dist/lib/plugin.mjs.map +1 -0
- package/dist/lib/translations.mjs +7 -0
- package/dist/lib/translations.mjs.map +1 -0
- package/dist/lib/types.mjs +2 -0
- package/dist/types/src/WnfsPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/blob-backend.d.ts +22 -0
- package/dist/types/src/capabilities/blob-backend.d.ts.map +1 -0
- package/dist/types/src/capabilities/blob-backend.test.d.ts +2 -0
- package/dist/types/src/capabilities/blob-backend.test.d.ts.map +1 -0
- package/dist/types/src/capabilities/dependencies.d.ts +5 -0
- package/dist/types/src/capabilities/dependencies.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +2 -3
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/helpers/wnfs-url.d.ts +6 -0
- package/dist/types/src/helpers/wnfs-url.d.ts.map +1 -1
- package/dist/types/src/types/WnfsCapabilities.d.ts +7 -0
- package/dist/types/src/types/WnfsCapabilities.d.ts.map +1 -1
- package/dist/types/src/types/WnfsEvents.d.ts +11 -0
- package/dist/types/src/types/WnfsEvents.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +1 -0
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/dx.config.ts +4 -4
- package/package.json +34 -32
- package/src/WnfsPlugin.tsx +9 -24
- package/src/capabilities/blob-backend.test.ts +108 -0
- package/src/capabilities/blob-backend.ts +104 -0
- package/src/capabilities/{blockstore.ts → dependencies.ts} +6 -1
- package/src/capabilities/index.ts +2 -4
- package/src/helpers/wnfs-url.ts +22 -4
- package/src/types/WnfsCapabilities.ts +9 -0
- package/src/types/WnfsEvents.ts +19 -0
- package/src/types/index.ts +1 -0
- package/dist/lib/neutral/WnfsPlugin.mjs +0 -51
- package/dist/lib/neutral/WnfsPlugin.mjs.map +0 -7
- package/dist/lib/neutral/WnfsPlugin.node.mjs +0 -12
- package/dist/lib/neutral/WnfsPlugin.node.mjs.map +0 -7
- package/dist/lib/neutral/WnfsPlugin.workerd.mjs +0 -12
- package/dist/lib/neutral/WnfsPlugin.workerd.mjs.map +0 -7
- package/dist/lib/neutral/backend-4HPTHS33.mjs +0 -47
- package/dist/lib/neutral/backend-4HPTHS33.mjs.map +0 -7
- package/dist/lib/neutral/blockstore-U6SPNL2C.mjs +0 -190
- package/dist/lib/neutral/blockstore-U6SPNL2C.mjs.map +0 -7
- package/dist/lib/neutral/capabilities/index.mjs +0 -13
- package/dist/lib/neutral/capabilities/index.mjs.map +0 -7
- package/dist/lib/neutral/chunk-2WLTMUHV.mjs +0 -19
- package/dist/lib/neutral/chunk-2WLTMUHV.mjs.map +0 -7
- package/dist/lib/neutral/chunk-H2YCLSRI.mjs +0 -47
- package/dist/lib/neutral/chunk-H2YCLSRI.mjs.map +0 -7
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs +0 -10
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs.map +0 -7
- package/dist/lib/neutral/chunk-L33MOD23.mjs +0 -219
- package/dist/lib/neutral/chunk-L33MOD23.mjs.map +0 -7
- package/dist/lib/neutral/helpers/index.mjs +0 -26
- package/dist/lib/neutral/helpers/index.mjs.map +0 -7
- package/dist/lib/neutral/index.mjs +0 -36
- package/dist/lib/neutral/index.mjs.map +0 -7
- package/dist/lib/neutral/meta.json +0 -1
- package/dist/lib/neutral/meta.mjs +0 -8
- package/dist/lib/neutral/meta.mjs.map +0 -7
- package/dist/lib/neutral/plugin.mjs +0 -12
- package/dist/lib/neutral/plugin.mjs.map +0 -7
- package/dist/lib/neutral/translations.mjs +0 -17
- package/dist/lib/neutral/translations.mjs.map +0 -7
- package/dist/lib/neutral/types/index.mjs +0 -8
- package/dist/lib/neutral/types/index.mjs.map +0 -7
- package/dist/lib/neutral/url-resolver-BIRH7WHL.mjs +0 -47
- package/dist/lib/neutral/url-resolver-BIRH7WHL.mjs.map +0 -7
- package/dist/types/src/capabilities/backend.d.ts +0 -6
- package/dist/types/src/capabilities/backend.d.ts.map +0 -1
- package/dist/types/src/capabilities/blockstore.d.ts +0 -5
- package/dist/types/src/capabilities/blockstore.d.ts.map +0 -1
- package/dist/types/src/capabilities/url-resolver.d.ts +0 -6
- package/dist/types/src/capabilities/url-resolver.d.ts.map +0 -1
- package/src/capabilities/backend.ts +0 -43
- package/src/capabilities/url-resolver.ts +0 -44
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import "./chunk-J5LGTIGS.mjs";
|
|
2
|
-
|
|
3
|
-
// src/WnfsPlugin.node.ts
|
|
4
|
-
import { Plugin } from "@dxos/app-framework";
|
|
5
|
-
import { meta } from "#meta";
|
|
6
|
-
var WnfsPlugin = Plugin.define(meta).pipe(Plugin.make);
|
|
7
|
-
var WnfsPlugin_node_default = WnfsPlugin;
|
|
8
|
-
export {
|
|
9
|
-
WnfsPlugin,
|
|
10
|
-
WnfsPlugin_node_default as default
|
|
11
|
-
};
|
|
12
|
-
//# sourceMappingURL=WnfsPlugin.node.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/WnfsPlugin.node.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { Plugin } from '@dxos/app-framework';\n\nimport { meta } from '#meta';\n\nexport const WnfsPlugin = Plugin.define(meta).pipe(Plugin.make);\n\nexport default WnfsPlugin;\n"],
|
|
5
|
-
"mappings": ";;;AAIA,SAASA,cAAc;AAEvB,SAASC,YAAY;AAEd,IAAMC,aAAaF,OAAOG,OAAOF,IAAAA,EAAMG,KAAKJ,OAAOK,IAAI;AAE9D,IAAA,0BAAeH;",
|
|
6
|
-
"names": ["Plugin", "meta", "WnfsPlugin", "define", "pipe", "make"]
|
|
7
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import "./chunk-J5LGTIGS.mjs";
|
|
2
|
-
|
|
3
|
-
// src/WnfsPlugin.workerd.ts
|
|
4
|
-
import { Plugin } from "@dxos/app-framework";
|
|
5
|
-
import { meta } from "#meta";
|
|
6
|
-
var WnfsPlugin = Plugin.define(meta).pipe(Plugin.make);
|
|
7
|
-
var WnfsPlugin_workerd_default = WnfsPlugin;
|
|
8
|
-
export {
|
|
9
|
-
WnfsPlugin,
|
|
10
|
-
WnfsPlugin_workerd_default as default
|
|
11
|
-
};
|
|
12
|
-
//# sourceMappingURL=WnfsPlugin.workerd.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/WnfsPlugin.workerd.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { Plugin } from '@dxos/app-framework';\n\nimport { meta } from '#meta';\n\nexport const WnfsPlugin = Plugin.define(meta).pipe(Plugin.make);\n\nexport default WnfsPlugin;\n"],
|
|
5
|
-
"mappings": ";;;AAIA,SAASA,cAAc;AAEvB,SAASC,YAAY;AAEd,IAAMC,aAAaF,OAAOG,OAAOF,IAAAA,EAAMG,KAAKJ,OAAOK,IAAI;AAE9D,IAAA,6BAAeH;",
|
|
6
|
-
"names": ["Plugin", "meta", "WnfsPlugin", "define", "pipe", "make"]
|
|
7
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
upload
|
|
3
|
-
} from "./chunk-L33MOD23.mjs";
|
|
4
|
-
import "./chunk-J5LGTIGS.mjs";
|
|
5
|
-
|
|
6
|
-
// src/capabilities/backend.ts
|
|
7
|
-
import * as Effect from "effect/Effect";
|
|
8
|
-
import { Capability } from "@dxos/app-framework";
|
|
9
|
-
import { invariant } from "@dxos/invariant";
|
|
10
|
-
import { ClientCapabilities } from "@dxos/plugin-client";
|
|
11
|
-
import { FileCapabilities } from "@dxos/plugin-file/types";
|
|
12
|
-
import { File } from "@dxos/types";
|
|
13
|
-
import { WnfsCapabilities } from "#types";
|
|
14
|
-
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-wnfs/src/capabilities/backend.ts";
|
|
15
|
-
var WNFS_BACKEND_ID = "wnfs";
|
|
16
|
-
var backend_default = Capability.makeModule(Effect.fnUntraced(function* () {
|
|
17
|
-
const capabilities = yield* Capability.Service;
|
|
18
|
-
return Capability.contributes(FileCapabilities.Backend, {
|
|
19
|
-
id: WNFS_BACKEND_ID,
|
|
20
|
-
name: "WNFS",
|
|
21
|
-
description: "Decentralized, end-to-end encrypted storage via Web Native File System.",
|
|
22
|
-
upload: async (file, db) => {
|
|
23
|
-
const client = capabilities.get(ClientCapabilities.Client);
|
|
24
|
-
const blockstore = capabilities.get(WnfsCapabilities.Blockstore);
|
|
25
|
-
const instances = capabilities.get(WnfsCapabilities.Instances);
|
|
26
|
-
const space = client.spaces.get(db.spaceId);
|
|
27
|
-
invariant(space, "Space not found", { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 24, S: this, A: ["space", "'Space not found'"] });
|
|
28
|
-
const info = await upload({
|
|
29
|
-
file,
|
|
30
|
-
blockstore,
|
|
31
|
-
instances,
|
|
32
|
-
space
|
|
33
|
-
});
|
|
34
|
-
return {
|
|
35
|
-
name: info.name,
|
|
36
|
-
type: info.type,
|
|
37
|
-
size: file.size,
|
|
38
|
-
data: File.externalData(info.url, info.cid)
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
}));
|
|
43
|
-
export {
|
|
44
|
-
WNFS_BACKEND_ID,
|
|
45
|
-
backend_default as default
|
|
46
|
-
};
|
|
47
|
-
//# sourceMappingURL=backend-4HPTHS33.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/backend.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2026 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Capability } from '@dxos/app-framework';\nimport { invariant } from '@dxos/invariant';\nimport { ClientCapabilities } from '@dxos/plugin-client';\nimport { FileCapabilities } from '@dxos/plugin-file/types';\nimport { File } from '@dxos/types';\n\nimport { WnfsCapabilities } from '#types';\n\nimport { upload } from '../helpers';\n\nexport const WNFS_BACKEND_ID = 'wnfs';\n\nexport default Capability.makeModule(\n Effect.fnUntraced(function* () {\n const capabilities = yield* Capability.Service;\n\n return Capability.contributes(FileCapabilities.Backend, {\n id: WNFS_BACKEND_ID,\n name: 'WNFS',\n description: 'Decentralized, end-to-end encrypted storage via Web Native File System.',\n upload: async (file, db) => {\n const client = capabilities.get(ClientCapabilities.Client);\n const blockstore = capabilities.get(WnfsCapabilities.Blockstore);\n const instances = capabilities.get(WnfsCapabilities.Instances);\n const space = client.spaces.get(db.spaceId);\n invariant(space, 'Space not found');\n const info = await upload({ file, blockstore, instances, space });\n return {\n name: info.name,\n type: info.type,\n size: file.size,\n data: File.externalData(info.url, info.cid),\n };\n },\n });\n }),\n);\n"],
|
|
5
|
-
"mappings": ";;;;;;AAIA,YAAYA,YAAY;AAExB,SAASC,kBAAkB;AAC3B,SAASC,iBAAiB;AAC1B,SAASC,0BAA0B;AACnC,SAASC,wBAAwB;AACjC,SAASC,YAAY;AAErB,SAASC,wBAAwB;AAIjC,IAAA,eAAaC;AAIT,IAAMC,kBAAe;IAErB,kBAAOC,WAAWC,WAAYC,kBAAiBC,aAAS;QACtDC,eAAIN,OAAAA,WAAAA;SACJO,WAAM,YAAA,iBAAA,SAAA;IACNC,IAAAA;IACAC,MAAAA;iBACQC;YACN,OAAMC,MAAAA,OAAaV;AACnB,YAAMW,SAAAA,aAAYX,IAAaY,mBAAIC,MAAiBC;AACpD,YAAMC,aAAQN,aAAkBO,IAAGC,iBAAO,UAAA;AAC1CC,YAAAA,YAAiB,aAAA,IAAA,iBAAA,SAAA;AACjB,YAAMC,QAAO,OAAMX,OAAO,IAAA,GAAA,OAAA;gBAAEY,OAAAA,mBAAAA,EAAAA,YAAAA,YAAAA,GAAAA,cAAAA,GAAAA,IAAAA,GAAAA,MAAAA,GAAAA,CAAAA,SAAAA,mBAAAA,EAAAA,CAAAA;YAAMV,OAAAA,MAAAA,OAAAA;QAAYC;QAAWI;QAAM;QAC/D;;aAEEM;QACAC,MAAMF,KAAKE;QACXC,MAAMC,KAAKC;QACb,MAAA,KAAA;QACF,MAAA,KAAA,aAAA,KAAA,KAAA,KAAA,GAAA;MACF;IAEF;;;",
|
|
6
|
-
"names": ["Effect", "Capability", "invariant", "ClientCapabilities", "FileCapabilities", "File", "WnfsCapabilities", "WNFS_BACKEND_ID", "capabilities", "Capability", "contributes", "FileCapabilities", "Backend", "id", "name", "description", "upload", "client", "blockstore", "instances", "get", "WnfsCapabilities", "Instances", "space", "db", "spaceId", "invariant", "info", "file", "type", "size", "data", "File", "externalData"]
|
|
7
|
-
}
|
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
storeName
|
|
3
|
-
} from "./chunk-L33MOD23.mjs";
|
|
4
|
-
import "./chunk-J5LGTIGS.mjs";
|
|
5
|
-
|
|
6
|
-
// src/capabilities/blockstore.ts
|
|
7
|
-
import * as Effect from "effect/Effect";
|
|
8
|
-
import { Capability } from "@dxos/app-framework";
|
|
9
|
-
import { ClientCapabilities } from "@dxos/plugin-client";
|
|
10
|
-
import { WnfsCapabilities } from "#types";
|
|
11
|
-
|
|
12
|
-
// src/blockstore.ts
|
|
13
|
-
import { CarWriter } from "@ipld/car";
|
|
14
|
-
import { BaseBlockstore } from "blockstore-core";
|
|
15
|
-
import { IDBBlockstore } from "blockstore-idb";
|
|
16
|
-
import debounce from "debounce";
|
|
17
|
-
import * as IDB from "idb-keyval";
|
|
18
|
-
import all from "it-all";
|
|
19
|
-
import { CID } from "multiformats";
|
|
20
|
-
import * as Uint8Arrays from "uint8arrays";
|
|
21
|
-
var create = (apiHost) => {
|
|
22
|
-
return new MixedBlockstore(apiHost);
|
|
23
|
-
};
|
|
24
|
-
var MixedBlockstore = class extends BaseBlockstore {
|
|
25
|
-
#apiHost;
|
|
26
|
-
#localStore;
|
|
27
|
-
#isConnected;
|
|
28
|
-
#flushQueue;
|
|
29
|
-
#queue;
|
|
30
|
-
constructor(apiHost) {
|
|
31
|
-
super();
|
|
32
|
-
this.#apiHost = apiHost ? apiHost.replace(/\/?$/, "") : void 0;
|
|
33
|
-
this.#localStore = new IDBBlockstore(storeName());
|
|
34
|
-
this.#isConnected = navigator.onLine;
|
|
35
|
-
this.#queue = [];
|
|
36
|
-
this.#flushQueue = debounce(this.#flushQueueInt, 5e3);
|
|
37
|
-
}
|
|
38
|
-
async open() {
|
|
39
|
-
await this.#localStore.open();
|
|
40
|
-
await this.#restoreQueue();
|
|
41
|
-
window.addEventListener("offline", async () => {
|
|
42
|
-
this.#isConnected = false;
|
|
43
|
-
});
|
|
44
|
-
window.addEventListener("online", async () => {
|
|
45
|
-
this.#isConnected = true;
|
|
46
|
-
this.#flushQueue();
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
url(apiHost, cid) {
|
|
50
|
-
const path = cid ? cid.toString() : "";
|
|
51
|
-
return `${apiHost}/api/file${path.length ? "/" + path : ""}`;
|
|
52
|
-
}
|
|
53
|
-
// BLOCKSTORE IMPLEMENTATION
|
|
54
|
-
async delete(key) {
|
|
55
|
-
await this.#localStore.delete(key);
|
|
56
|
-
if (this.#isConnected && this.#apiHost) {
|
|
57
|
-
await fetch(this.url(this.#apiHost, key), {
|
|
58
|
-
method: "DELETE"
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
async get(key) {
|
|
63
|
-
if (await this.#localStore.has(key)) {
|
|
64
|
-
return await this.#localStore.get(key);
|
|
65
|
-
}
|
|
66
|
-
if (this.#isConnected && this.#apiHost) {
|
|
67
|
-
const block = await fetch(this.url(this.#apiHost, key), {
|
|
68
|
-
method: "GET"
|
|
69
|
-
}).then((r) => r.arrayBuffer()).then((r) => new Uint8Array(r));
|
|
70
|
-
await this.#localStore.put(key, block);
|
|
71
|
-
return block;
|
|
72
|
-
}
|
|
73
|
-
return await this.#localStore.get(key);
|
|
74
|
-
}
|
|
75
|
-
async has(key) {
|
|
76
|
-
if (await this.#localStore.has(key)) {
|
|
77
|
-
return true;
|
|
78
|
-
}
|
|
79
|
-
if (this.#isConnected && this.#apiHost) {
|
|
80
|
-
return await fetch(this.url(this.#apiHost, key), {
|
|
81
|
-
method: "HEAD"
|
|
82
|
-
}).then((r) => r.ok);
|
|
83
|
-
}
|
|
84
|
-
return false;
|
|
85
|
-
}
|
|
86
|
-
async put(key, val) {
|
|
87
|
-
await this.#localStore.put(key, val);
|
|
88
|
-
await this.#addToQueue(key);
|
|
89
|
-
this.#flushQueue();
|
|
90
|
-
return key;
|
|
91
|
-
}
|
|
92
|
-
async destroy() {
|
|
93
|
-
await this.#localStore.destroy();
|
|
94
|
-
}
|
|
95
|
-
// REMOTE
|
|
96
|
-
async putRemote(key, val) {
|
|
97
|
-
if (this.#apiHost) {
|
|
98
|
-
await fetch(this.url(this.#apiHost, key), {
|
|
99
|
-
method: "POST",
|
|
100
|
-
body: val
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
async putCarRemote(car) {
|
|
105
|
-
if (this.#apiHost) {
|
|
106
|
-
await fetch(this.url(this.#apiHost), {
|
|
107
|
-
method: "POST",
|
|
108
|
-
headers: {
|
|
109
|
-
"Content-Type": "application/vnd.ipld.car"
|
|
110
|
-
},
|
|
111
|
-
body: car
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
// QUEUE
|
|
116
|
-
queueCacheName = `${storeName()}.state.queue`;
|
|
117
|
-
async #addToQueue(key) {
|
|
118
|
-
await this.#saveQueue([
|
|
119
|
-
...this.#queue,
|
|
120
|
-
key.toString()
|
|
121
|
-
]);
|
|
122
|
-
}
|
|
123
|
-
async #flushQueueInt() {
|
|
124
|
-
if (!this.#isConnected || !this.#apiHost) {
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
const keys = [
|
|
128
|
-
...this.#queue
|
|
129
|
-
];
|
|
130
|
-
if (keys.length === 0) {
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
133
|
-
const blocks = await Promise.all(keys.map(async (key) => {
|
|
134
|
-
const cid = CID.parse(key);
|
|
135
|
-
const bytes = await this.#localStore.get(cid);
|
|
136
|
-
return {
|
|
137
|
-
cid,
|
|
138
|
-
bytes
|
|
139
|
-
};
|
|
140
|
-
}));
|
|
141
|
-
const car = await this.#createCar(blocks);
|
|
142
|
-
await this.putCarRemote(car);
|
|
143
|
-
const queue = [
|
|
144
|
-
...this.#queue
|
|
145
|
-
].filter((k) => {
|
|
146
|
-
if (keys.includes(k)) {
|
|
147
|
-
return false;
|
|
148
|
-
}
|
|
149
|
-
return true;
|
|
150
|
-
});
|
|
151
|
-
await this.#saveQueue(queue);
|
|
152
|
-
}
|
|
153
|
-
async #restoreQueue() {
|
|
154
|
-
const fromCache = await IDB.get(this.queueCacheName);
|
|
155
|
-
if (fromCache && Array.isArray(fromCache)) {
|
|
156
|
-
this.#queue = fromCache;
|
|
157
|
-
this.#flushQueue();
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
async #saveQueue(items) {
|
|
161
|
-
const arr = [
|
|
162
|
-
...items
|
|
163
|
-
];
|
|
164
|
-
this.#queue = arr;
|
|
165
|
-
await IDB.set(this.queueCacheName, arr);
|
|
166
|
-
}
|
|
167
|
-
// 🛠️
|
|
168
|
-
async #createCar(blocks) {
|
|
169
|
-
const { writer, out } = CarWriter.create();
|
|
170
|
-
const outPromise = all(out);
|
|
171
|
-
await Promise.all(blocks.map((block) => {
|
|
172
|
-
return writer.put(block);
|
|
173
|
-
}));
|
|
174
|
-
await writer.close();
|
|
175
|
-
return Uint8Arrays.concat(await outPromise);
|
|
176
|
-
}
|
|
177
|
-
};
|
|
178
|
-
|
|
179
|
-
// src/capabilities/blockstore.ts
|
|
180
|
-
var blockstore_default = Capability.makeModule(Effect.fnUntraced(function* () {
|
|
181
|
-
const client = yield* Capability.get(ClientCapabilities.Client);
|
|
182
|
-
const apiHost = client.config.values.runtime?.services?.edge?.url || "http://localhost:8787";
|
|
183
|
-
const blockstore = create(apiHost);
|
|
184
|
-
yield* Effect.tryPromise(() => blockstore.open());
|
|
185
|
-
return Capability.contributes(WnfsCapabilities.Blockstore, blockstore);
|
|
186
|
-
}));
|
|
187
|
-
export {
|
|
188
|
-
blockstore_default as default
|
|
189
|
-
};
|
|
190
|
-
//# sourceMappingURL=blockstore-U6SPNL2C.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/blockstore.ts", "../../../src/blockstore.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Capability } from '@dxos/app-framework';\nimport { ClientCapabilities } from '@dxos/plugin-client';\n\nimport { WnfsCapabilities } from '#types';\n\nimport * as Blockstore from '../blockstore';\n\nexport default Capability.makeModule(\n Effect.fnUntraced(function* () {\n const client = yield* Capability.get(ClientCapabilities.Client);\n const apiHost = client.config.values.runtime?.services?.edge?.url || 'http://localhost:8787';\n const blockstore = Blockstore.create(apiHost);\n yield* Effect.tryPromise(() => blockstore.open());\n\n return Capability.contributes(WnfsCapabilities.Blockstore, blockstore);\n }),\n);\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { CarWriter } from '@ipld/car';\nimport type { Block } from '@ipld/car/reader';\nimport { BaseBlockstore } from 'blockstore-core';\nimport { IDBBlockstore } from 'blockstore-idb';\nimport debounce from 'debounce';\nimport * as IDB from 'idb-keyval';\nimport all from 'it-all';\nimport { CID } from 'multiformats';\nimport * as Uint8Arrays from 'uint8arrays';\n\nimport { storeName } from './helpers';\n\nexport const create = (apiHost?: string) => {\n return new MixedBlockstore(apiHost);\n};\n\n/**\n * A blockstore that communicates with the DXOS blob service,\n * and which uses an indexedDB blockstore as a client cache.\n */\nexport class MixedBlockstore extends BaseBlockstore {\n readonly #apiHost: string | undefined;\n readonly #localStore: IDBBlockstore;\n\n #isConnected: boolean;\n #flushQueue: () => void;\n #queue: string[];\n\n constructor(apiHost?: string) {\n super();\n\n this.#apiHost = apiHost ? apiHost.replace(/\\/?$/, '') : undefined;\n this.#localStore = new IDBBlockstore(storeName());\n this.#isConnected = navigator.onLine;\n this.#queue = [];\n\n this.#flushQueue = debounce(this.#flushQueueInt, 5000);\n }\n\n async open(): Promise<void> {\n await this.#localStore.open();\n await this.#restoreQueue();\n\n window.addEventListener('offline', async () => {\n this.#isConnected = false;\n });\n\n window.addEventListener('online', async () => {\n this.#isConnected = true;\n this.#flushQueue();\n });\n }\n\n url(apiHost: string, cid?: CID): string {\n const path = cid ? cid.toString() : '';\n return `${apiHost}/api/file${path.length ? '/' + path : ''}`;\n }\n\n // BLOCKSTORE IMPLEMENTATION\n\n override async delete(key: CID): Promise<void> {\n await this.#localStore.delete(key);\n\n if (this.#isConnected && this.#apiHost) {\n await fetch(this.url(this.#apiHost, key), {\n method: 'DELETE',\n });\n }\n }\n\n override async get(key: CID): Promise<Uint8Array> {\n if (await this.#localStore.has(key)) {\n return await this.#localStore.get(key);\n }\n\n if (this.#isConnected && this.#apiHost) {\n const block = await fetch(this.url(this.#apiHost, key), {\n method: 'GET',\n })\n .then((r) => r.arrayBuffer())\n .then((r) => new Uint8Array(r));\n\n // Make sure it is cached locally\n await this.#localStore.put(key, block);\n\n return block;\n }\n\n return await this.#localStore.get(key);\n }\n\n override async has(key: CID): Promise<boolean> {\n if (await this.#localStore.has(key)) {\n return true;\n }\n\n if (this.#isConnected && this.#apiHost) {\n return await fetch(this.url(this.#apiHost, key), {\n method: 'HEAD',\n }).then((r) => r.ok);\n }\n\n return false;\n }\n\n override async put(key: CID, val: Uint8Array): Promise<CID> {\n await this.#localStore.put(key, val);\n\n await this.#addToQueue(key);\n this.#flushQueue();\n\n return key;\n }\n\n async destroy(): Promise<void> {\n await this.#localStore.destroy();\n }\n\n // REMOTE\n\n async putRemote(key: CID, val: Uint8Array): Promise<void> {\n if (this.#apiHost) {\n await fetch(this.url(this.#apiHost, key), {\n method: 'POST',\n body: val as Uint8Array<ArrayBuffer>,\n });\n }\n }\n\n async putCarRemote(car: Uint8Array): Promise<void> {\n if (this.#apiHost) {\n await fetch(this.url(this.#apiHost), {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/vnd.ipld.car',\n },\n body: car as Uint8Array<ArrayBuffer>,\n });\n }\n }\n\n // QUEUE\n\n readonly queueCacheName = `${storeName()}.state.queue`;\n\n async #addToQueue(key: CID): Promise<void> {\n await this.#saveQueue([...this.#queue, key.toString()]);\n }\n\n async #flushQueueInt(): Promise<void> {\n if (!this.#isConnected || !this.#apiHost) {\n return;\n }\n\n const keys = [...this.#queue];\n if (keys.length === 0) {\n return;\n }\n\n // Collect blocks\n const blocks = await Promise.all(\n keys.map(async (key) => {\n const cid = CID.parse(key);\n const bytes = await this.#localStore.get(cid);\n return { cid, bytes };\n }),\n );\n\n // Create & submit CAR\n const car = await this.#createCar(blocks);\n await this.putCarRemote(car);\n\n // Adjust queue\n const queue = [...this.#queue].filter((k) => {\n if (keys.includes(k)) {\n return false;\n }\n\n return true;\n });\n\n await this.#saveQueue(queue);\n }\n\n async #restoreQueue(): Promise<void> {\n const fromCache = await IDB.get(this.queueCacheName);\n if (fromCache && Array.isArray(fromCache)) {\n this.#queue = fromCache;\n this.#flushQueue();\n }\n }\n\n async #saveQueue(items: string[]): Promise<void> {\n const arr = [...items];\n this.#queue = arr;\n await IDB.set(this.queueCacheName, arr);\n }\n\n // 🛠️\n\n async #createCar(blocks: Block[]): Promise<Uint8Array> {\n const { writer, out } = CarWriter.create();\n const outPromise = all(out);\n\n await Promise.all(\n blocks.map((block) => {\n return writer.put(block);\n }),\n );\n\n await writer.close();\n return Uint8Arrays.concat(await outPromise);\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;AAIA,YAAYA,YAAY;AAExB,SAASC,kBAAkB;AAC3B,SAASC,0BAA0B;AAEnC,SAASC,wBAAwB;;;ACLjC,SAASC,iBAAiB;AAE1B,SAASC,sBAAsB;AAC/B,SAASC,qBAAqB;AAC9B,OAAOC,cAAc;AACrB,YAAYC,SAAS;AACrB,OAAOC,SAAS;AAChB,SAASC,WAAW;AACpB,YAAYC,iBAAiB;AAItB,IAAMC,SAAS,CAACC,YAAAA;AACrB,SAAO,IAAIC,gBAAgBD,OAAAA;AAC7B;AAMO,IAAMC,kBAAN,cAA8BC,eAAAA;EAC1B;EACA;EAET;EACA;EACA;EAEA,YAAYF,SAAkB;AAC5B,UAAK;AAEL,SAAK,WAAWA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AOR,OAAAA;AACrC,SAAcS,kBAAW,MAAMF,WAAWG,KAAI,CAAA;AAE9C,SAAOjB,WAAWkB,YAAYC,iBAAiBC,YAAYN,UAAAA;AAC7D,CAAA,CAAA;",
|
|
6
|
-
"names": ["Effect", "Capability", "ClientCapabilities", "WnfsCapabilities", "CarWriter", "BaseBlockstore", "IDBBlockstore", "debounce", "IDB", "all", "CID", "Uint8Arrays", "create", "apiHost", "MixedBlockstore", "BaseBlockstore", "replace", "undefined", "IDBBlockstore", "storeName", "navigator", "onLine", "debounce", "open", "window", "addEventListener", "url", "cid", "path", "toString", "length", "delete", "key", "fetch", "method", "get", "has", "block", "then", "r", "arrayBuffer", "Uint8Array", "put", "ok", "val", "destroy", "putRemote", "body", "putCarRemote", "car", "headers", "queueCacheName", "keys", "blocks", "Promise", "all", "map", "CID", "parse", "bytes", "queue", "filter", "k", "includes", "fromCache", "Array", "isArray", "items", "arr", "set", "writer", "out", "CarWriter", "outPromise", "close", "concat", "Capability", "makeModule", "fnUntraced", "client", "get", "ClientCapabilities", "Client", "apiHost", "config", "values", "runtime", "services", "edge", "url", "blockstore", "create", "tryPromise", "open", "contributes", "WnfsCapabilities", "Blockstore"]
|
|
7
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import "../chunk-J5LGTIGS.mjs";
|
|
2
|
-
|
|
3
|
-
// src/capabilities/index.ts
|
|
4
|
-
import { Capability } from "@dxos/app-framework";
|
|
5
|
-
var Backend = Capability.lazy("Backend", () => import("../backend-4HPTHS33.mjs"));
|
|
6
|
-
var Blockstore = Capability.lazy("Blockstore", () => import("../blockstore-U6SPNL2C.mjs"));
|
|
7
|
-
var UrlResolver = Capability.lazy("UrlResolver", () => import("../url-resolver-BIRH7WHL.mjs"));
|
|
8
|
-
export {
|
|
9
|
-
Backend,
|
|
10
|
-
Blockstore,
|
|
11
|
-
UrlResolver
|
|
12
|
-
};
|
|
13
|
-
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/capabilities/index.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capability } from '@dxos/app-framework';\n\nexport const Backend = Capability.lazy('Backend', () => import('./backend'));\n\nexport const Blockstore = Capability.lazy('Blockstore', () => import('./blockstore'));\n\nexport const UrlResolver = Capability.lazy('UrlResolver', () => import('./url-resolver'));\n"],
|
|
5
|
-
"mappings": ";;;AAIA,SAASA,kBAAkB;AAEpB,IAAMC,UAAUD,WAAWE,KAAK,WAAW,MAAM,OAAO,yBAAA,CAAA;AAExD,IAAMC,aAAaH,WAAWE,KAAK,cAAc,MAAM,OAAO,4BAAA,CAAA;AAE9D,IAAME,cAAcJ,WAAWE,KAAK,eAAe,MAAM,OAAO,8BAAA,CAAA;",
|
|
6
|
-
"names": ["Capability", "Backend", "lazy", "Blockstore", "UrlResolver"]
|
|
7
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
__export
|
|
3
|
-
} from "./chunk-J5LGTIGS.mjs";
|
|
4
|
-
|
|
5
|
-
// src/types/WnfsCapabilities.ts
|
|
6
|
-
var WnfsCapabilities_exports = {};
|
|
7
|
-
__export(WnfsCapabilities_exports, {
|
|
8
|
-
Blockstore: () => Blockstore,
|
|
9
|
-
Instances: () => Instances
|
|
10
|
-
});
|
|
11
|
-
import { Capability } from "@dxos/app-framework";
|
|
12
|
-
import { meta } from "#meta";
|
|
13
|
-
var Blockstore = Capability.make(`${meta.profile.key}.capability.blockstore`);
|
|
14
|
-
var Instances = Capability.make(`${meta.profile.key}.capability.instances`);
|
|
15
|
-
|
|
16
|
-
export {
|
|
17
|
-
WnfsCapabilities_exports
|
|
18
|
-
};
|
|
19
|
-
//# sourceMappingURL=chunk-2WLTMUHV.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/types/WnfsCapabilities.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\n// @import-as-namespace\n\nimport { type Blockstore as BlockstoreInterface } from 'interface-blockstore';\nimport { type PrivateDirectory, type PrivateForest } from 'wnfs';\n\nimport { Capability } from '@dxos/app-framework';\nimport { type SpaceId } from '@dxos/keys';\n\nimport { meta } from '#meta';\n\nexport const Blockstore = Capability.make<BlockstoreInterface>(`${meta.profile.key}.capability.blockstore`);\n\nexport type Instances = Record<SpaceId, { directory: PrivateDirectory; forest: PrivateForest }>;\nexport const Instances = Capability.make<Instances>(`${meta.profile.key}.capability.instances`);\n"],
|
|
5
|
-
"mappings": ";;;;;AAAA;;;;;AASA,SAASA,kBAAkB;AAG3B,SAASC,YAAY;AAEd,IAAMC,aAAaF,WAAWG,KAA0B,GAAGF,KAAKG,QAAQC,GAAG,wBAAwB;AAGnG,IAAMC,YAAYN,WAAWG,KAAgB,GAAGF,KAAKG,QAAQC,GAAG,uBAAuB;",
|
|
6
|
-
"names": ["Capability", "meta", "Blockstore", "make", "profile", "key", "Instances"]
|
|
7
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
// src/meta.ts
|
|
2
|
-
import { Plugin } from "@dxos/app-framework";
|
|
3
|
-
|
|
4
|
-
// dx.config.ts
|
|
5
|
-
import { Config2 } from "@dxos/app-framework/config";
|
|
6
|
-
import { trim } from "@dxos/util";
|
|
7
|
-
var dx_config_default = Config2.make({
|
|
8
|
-
plugin: {
|
|
9
|
-
key: "org.dxos.plugin.wnfs",
|
|
10
|
-
name: "WNFS",
|
|
11
|
-
author: "DXOS",
|
|
12
|
-
description: trim`
|
|
13
|
-
Decentralized, end-to-end encrypted file storage for DXOS Composer built on the Web Native File System (WNFS) protocol.
|
|
14
|
-
|
|
15
|
-
WNFS organizes files inside a cryptographic "dark forest" — a content-addressed private file system
|
|
16
|
-
where each write produces a new immutable root CID. Files are stored as IPLD blocks (CIDv1, sha2-256),
|
|
17
|
-
cached locally in IndexedDB, and asynchronously replicated to the DXOS edge blob service as CAR archives.
|
|
18
|
-
Uploads and reads are scoped to a DXOS Space; the forest root CID is persisted atomically on the
|
|
19
|
-
space's ECHO properties so the file system state survives across sessions and devices.
|
|
20
|
-
|
|
21
|
-
The plugin registers as a \`FileCapabilities.Backend\` and \`FileCapabilities.UrlResolver\` so any plugin
|
|
22
|
-
that uses \`plugin-file\` (e.g. \`plugin-gallery\`) can upload files and resolve \`wnfs://\` URLs without
|
|
23
|
-
coupling to the storage implementation. The blockstore automatically queues blocks while offline and
|
|
24
|
-
flushes them when connectivity is restored.
|
|
25
|
-
`,
|
|
26
|
-
icon: {
|
|
27
|
-
key: "ph--file-cloud--regular",
|
|
28
|
-
hue: "teal"
|
|
29
|
-
},
|
|
30
|
-
source: "https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-wnfs",
|
|
31
|
-
spec: "PLUGIN.mdl",
|
|
32
|
-
tags: [
|
|
33
|
-
"labs"
|
|
34
|
-
],
|
|
35
|
-
dependsOn: [
|
|
36
|
-
"org.dxos.plugin.file"
|
|
37
|
-
]
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
// src/meta.ts
|
|
42
|
-
var meta = Plugin.getMetaFromConfig(dx_config_default);
|
|
43
|
-
|
|
44
|
-
export {
|
|
45
|
-
meta
|
|
46
|
-
};
|
|
47
|
-
//# sourceMappingURL=chunk-H2YCLSRI.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/meta.ts", "../../../dx.config.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { Plugin } from '@dxos/app-framework';\n\nimport config from '../dx.config';\n\nexport const meta = Plugin.getMetaFromConfig(config);\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { Config2 } from '@dxos/app-framework/config';\nimport { trim } from '@dxos/util';\n\nexport default Config2.make({\n plugin: {\n key: 'org.dxos.plugin.wnfs',\n name: 'WNFS',\n author: 'DXOS',\n description: trim`\n Decentralized, end-to-end encrypted file storage for DXOS Composer built on the Web Native File System (WNFS) protocol.\n\n WNFS organizes files inside a cryptographic \"dark forest\" — a content-addressed private file system\n where each write produces a new immutable root CID. Files are stored as IPLD blocks (CIDv1, sha2-256),\n cached locally in IndexedDB, and asynchronously replicated to the DXOS edge blob service as CAR archives.\n Uploads and reads are scoped to a DXOS Space; the forest root CID is persisted atomically on the\n space's ECHO properties so the file system state survives across sessions and devices.\n\n The plugin registers as a \\`FileCapabilities.Backend\\` and \\`FileCapabilities.UrlResolver\\` so any plugin\n that uses \\`plugin-file\\` (e.g. \\`plugin-gallery\\`) can upload files and resolve \\`wnfs://\\` URLs without\n coupling to the storage implementation. The blockstore automatically queues blocks while offline and\n flushes them when connectivity is restored.\n `,\n icon: { key: 'ph--file-cloud--regular', hue: 'teal' },\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-wnfs',\n spec: 'PLUGIN.mdl',\n tags: ['labs'],\n dependsOn: ['org.dxos.plugin.file'],\n },\n});\n"],
|
|
5
|
-
"mappings": ";AAIA,SAASA,cAAc;;;ACAvB,SAASC,eAAe;AACxB,SAASC,YAAY;AAErB,IAAA,oBAAeD,QAAQE,KAAK;EAC1BC,QAAQ;IACNC,KAAK;IACLC,MAAM;IACNC,QAAQ;IACRC,aAAaN;;;;;;;;;;;;;;IAcbO,MAAM;MAAEJ,KAAK;MAA2BK,KAAK;IAAO;IACpDC,QAAQ;IACRC,MAAM;IACNC,MAAM;MAAC;;IACPC,WAAW;MAAC;;EACd;AACF,CAAA;;;ADxBO,IAAMC,OAAOC,OAAOC,kBAAkBC,iBAAAA;",
|
|
6
|
-
"names": ["Plugin", "Config2", "trim", "make", "plugin", "key", "name", "author", "description", "icon", "hue", "source", "spec", "tags", "dependsOn", "meta", "Plugin", "getMetaFromConfig", "config"]
|
|
7
|
-
}
|