@dxos/plugin-wnfs 0.8.4-main.4a85c3132b → 0.8.4-main.51f1e5ca51
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 +1 -1
- package/dist/lib/browser/chunk-4D4K5JCC.mjs +66 -0
- package/dist/lib/browser/chunk-4D4K5JCC.mjs.map +7 -0
- package/dist/lib/browser/{chunk-UC4HMNZZ.mjs → chunk-7KFJ6LYH.mjs} +36 -21
- package/dist/lib/browser/chunk-7KFJ6LYH.mjs.map +7 -0
- package/dist/lib/browser/chunk-DK62NQ5T.mjs +71 -0
- package/dist/lib/browser/chunk-DK62NQ5T.mjs.map +7 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs.map +7 -0
- package/dist/lib/browser/create-QRLX4IMZ.mjs +25 -0
- package/dist/lib/browser/create-QRLX4IMZ.mjs.map +7 -0
- package/dist/lib/browser/create-file-INAT56PX.mjs +42 -0
- package/dist/lib/browser/create-file-INAT56PX.mjs.map +7 -0
- package/dist/lib/browser/helpers/index.mjs +26 -0
- package/dist/lib/browser/helpers/index.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +45 -70
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operations/index.mjs +14 -0
- package/dist/lib/browser/operations/index.mjs.map +7 -0
- package/dist/lib/browser/translations.mjs +30 -0
- package/dist/lib/browser/translations.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +4 -5
- package/dist/lib/browser/upload-ZQI66T4Y.mjs +35 -0
- package/dist/lib/browser/upload-ZQI66T4Y.mjs.map +7 -0
- package/dist/types/src/WnfsPlugin.d.ts.map +1 -1
- package/dist/types/src/blockstore.d.ts.map +1 -1
- package/dist/types/src/capabilities/blockstore.d.ts.map +1 -0
- package/dist/types/src/capabilities/file-uploader.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +7 -5
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/markdown.d.ts +6 -0
- package/dist/types/src/capabilities/markdown.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/components/FileInput/FileInput.d.ts.map +1 -0
- package/dist/types/src/components/FileInput/index.d.ts +2 -0
- package/dist/types/src/components/FileInput/index.d.ts.map +1 -0
- package/dist/types/src/components/FilePreview/FilePreview.d.ts +12 -0
- package/dist/types/src/components/FilePreview/FilePreview.d.ts.map +1 -0
- package/dist/types/src/components/FilePreview/index.d.ts +2 -0
- package/dist/types/src/components/FilePreview/index.d.ts.map +1 -0
- package/dist/types/src/containers/FileContainer/FileContainer.d.ts +3 -3
- package/dist/types/src/containers/FileContainer/FileContainer.d.ts.map +1 -1
- package/dist/types/src/containers/FileContainer/index.d.ts +1 -2
- package/dist/types/src/containers/FileContainer/index.d.ts.map +1 -1
- package/dist/types/src/extensions/image.d.ts +1 -1
- package/dist/types/src/extensions/image.d.ts.map +1 -1
- package/dist/types/src/extensions/image.stories.d.ts.map +1 -1
- package/dist/types/src/helpers/common.d.ts.map +1 -1
- package/dist/types/src/helpers/load.d.ts +1 -1
- package/dist/types/src/helpers/load.d.ts.map +1 -1
- package/dist/types/src/helpers/upload.d.ts +1 -1
- package/dist/types/src/helpers/upload.d.ts.map +1 -1
- package/dist/types/src/helpers/wnfs-url.d.ts.map +1 -1
- package/dist/types/src/operations/create-file.d.ts +5 -0
- package/dist/types/src/operations/create-file.d.ts.map +1 -0
- package/dist/types/src/operations/create.d.ts +5 -0
- package/dist/types/src/operations/create.d.ts.map +1 -0
- package/dist/types/src/operations/definitions.d.ts +38 -0
- package/dist/types/src/operations/definitions.d.ts.map +1 -0
- package/dist/types/src/operations/index.d.ts +4 -0
- package/dist/types/src/operations/index.d.ts.map +1 -0
- package/dist/types/src/operations/upload.d.ts +5 -0
- package/dist/types/src/operations/upload.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +24 -15
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/File.d.ts.map +1 -1
- package/dist/types/src/types/capabilities.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +1 -104
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +54 -36
- package/src/WnfsPlugin.tsx +22 -24
- package/src/blockstore.ts +1 -1
- package/src/capabilities/{blockstore/blockstore.ts → blockstore.ts} +4 -3
- package/src/capabilities/{file-uploader/file-uploader.ts → file-uploader.ts} +2 -2
- package/src/capabilities/index.ts +11 -5
- package/src/capabilities/markdown.ts +38 -0
- package/src/capabilities/operation-handler.ts +16 -0
- package/src/capabilities/{react-surface/react-surface.tsx → react-surface.tsx} +23 -14
- package/src/components/{FileInput.tsx → FileInput/FileInput.tsx} +3 -3
- package/src/components/FileInput/index.ts +5 -0
- package/src/components/FilePreview/FilePreview.tsx +43 -0
- package/src/components/FilePreview/index.ts +5 -0
- package/src/containers/FileContainer/FileContainer.tsx +7 -8
- package/src/containers/FileContainer/index.ts +1 -3
- package/src/extensions/image.stories.tsx +6 -7
- package/src/extensions/image.tsx +2 -1
- package/src/helpers/load.ts +6 -6
- package/src/helpers/upload.ts +3 -3
- package/src/meta.ts +1 -1
- package/src/operations/create-file.ts +31 -0
- package/src/operations/create.ts +22 -0
- package/src/operations/definitions.ts +41 -0
- package/src/operations/index.ts +13 -0
- package/src/operations/upload.ts +29 -0
- package/src/translations.ts +13 -12
- package/src/types/File.ts +6 -2
- package/src/types/capabilities.ts +3 -3
- package/src/types/types.ts +3 -60
- package/dist/lib/browser/FileContainer-EILNV5LV.mjs +0 -74
- package/dist/lib/browser/FileContainer-EILNV5LV.mjs.map +0 -7
- package/dist/lib/browser/blockstore-Q66HQJ4Q.mjs +0 -191
- package/dist/lib/browser/blockstore-Q66HQJ4Q.mjs.map +0 -7
- package/dist/lib/browser/chunk-BXGCJRL2.mjs +0 -155
- package/dist/lib/browser/chunk-BXGCJRL2.mjs.map +0 -7
- package/dist/lib/browser/chunk-HXVPBJ3A.mjs +0 -56
- package/dist/lib/browser/chunk-HXVPBJ3A.mjs.map +0 -7
- package/dist/lib/browser/chunk-UC4HMNZZ.mjs.map +0 -7
- package/dist/lib/browser/file-uploader-QL4DTOMM.mjs +0 -35
- package/dist/lib/browser/file-uploader-QL4DTOMM.mjs.map +0 -7
- package/dist/lib/browser/markdown-AYCVG6TJ.mjs +0 -201
- package/dist/lib/browser/markdown-AYCVG6TJ.mjs.map +0 -7
- package/dist/lib/browser/operation-resolver-YYWUF6EY.mjs +0 -99
- package/dist/lib/browser/operation-resolver-YYWUF6EY.mjs.map +0 -7
- package/dist/lib/browser/react-surface-3LKVDPH7.mjs +0 -60
- package/dist/lib/browser/react-surface-3LKVDPH7.mjs.map +0 -7
- package/dist/types/src/capabilities/blockstore/blockstore.d.ts.map +0 -1
- package/dist/types/src/capabilities/blockstore/index.d.ts +0 -3
- package/dist/types/src/capabilities/blockstore/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/file-uploader/file-uploader.d.ts.map +0 -1
- package/dist/types/src/capabilities/file-uploader/index.d.ts +0 -3
- package/dist/types/src/capabilities/file-uploader/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/markdown/index.d.ts +0 -3
- package/dist/types/src/capabilities/markdown/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/markdown/markdown.d.ts +0 -5
- package/dist/types/src/capabilities/markdown/markdown.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +0 -3
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +0 -5
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts +0 -3
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +0 -1
- package/dist/types/src/components/FileInput.d.ts.map +0 -1
- package/dist/types/src/components/FilePreview.d.ts +0 -11
- package/dist/types/src/components/FilePreview.d.ts.map +0 -1
- package/src/capabilities/blockstore/index.ts +0 -7
- package/src/capabilities/file-uploader/index.ts +0 -7
- package/src/capabilities/markdown/index.ts +0 -7
- package/src/capabilities/markdown/markdown.ts +0 -33
- package/src/capabilities/operation-resolver/index.ts +0 -7
- package/src/capabilities/operation-resolver/operation-resolver.ts +0 -62
- package/src/capabilities/react-surface/index.ts +0 -7
- package/src/components/FilePreview.tsx +0 -23
- /package/dist/types/src/capabilities/{blockstore/blockstore.d.ts → blockstore.d.ts} +0 -0
- /package/dist/types/src/capabilities/{file-uploader/file-uploader.d.ts → file-uploader.d.ts} +0 -0
- /package/dist/types/src/capabilities/{react-surface/react-surface.d.ts → react-surface.d.ts} +0 -0
- /package/dist/types/src/components/{FileInput.d.ts → FileInput/FileInput.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ Plugin that allows for data to be stored on WNFS.
|
|
|
6
6
|
|
|
7
7
|
- [Website](https://dxos.org)
|
|
8
8
|
- [Developer Documentation](https://docs.dxos.org)
|
|
9
|
-
- Talk to us on [Discord](https://
|
|
9
|
+
- Talk to us on [Discord](https://dxos.org/discord)
|
|
10
10
|
|
|
11
11
|
## Contributions
|
|
12
12
|
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__export
|
|
3
|
+
} from "./chunk-J5LGTIGS.mjs";
|
|
4
|
+
|
|
5
|
+
// src/types/capabilities.ts
|
|
6
|
+
import { Capability } from "@dxos/app-framework";
|
|
7
|
+
import { meta } from "#meta";
|
|
8
|
+
(function(WnfsCapabilities2) {
|
|
9
|
+
WnfsCapabilities2.Blockstore = Capability.make(`${meta.id}.capability.blockstore`);
|
|
10
|
+
WnfsCapabilities2.Instances = Capability.make(`${meta.id}.capability.instances`);
|
|
11
|
+
})(WnfsCapabilities || (WnfsCapabilities = {}));
|
|
12
|
+
var WnfsCapabilities;
|
|
13
|
+
|
|
14
|
+
// src/types/File.ts
|
|
15
|
+
var File_exports = {};
|
|
16
|
+
__export(File_exports, {
|
|
17
|
+
File: () => File2,
|
|
18
|
+
make: () => make
|
|
19
|
+
});
|
|
20
|
+
import * as Schema from "effect/Schema";
|
|
21
|
+
import { Annotation, Obj, Type } from "@dxos/echo";
|
|
22
|
+
import { FormInputAnnotation } from "@dxos/echo/internal";
|
|
23
|
+
var File2 = Schema.Struct({
|
|
24
|
+
name: Schema.String.pipe(Schema.optional),
|
|
25
|
+
type: Schema.String.pipe(FormInputAnnotation.set(false)),
|
|
26
|
+
cid: Schema.String.pipe(FormInputAnnotation.set(false)),
|
|
27
|
+
timestamp: Schema.String.pipe(FormInputAnnotation.set(false), Schema.optional)
|
|
28
|
+
}).pipe(Type.object({
|
|
29
|
+
typename: "org.dxos.type.file",
|
|
30
|
+
version: "0.1.0"
|
|
31
|
+
}), Annotation.IconAnnotation.set({
|
|
32
|
+
icon: "ph--file--regular",
|
|
33
|
+
hue: "teal"
|
|
34
|
+
}));
|
|
35
|
+
var make = (props) => Obj.make(File2, props);
|
|
36
|
+
|
|
37
|
+
// src/types/types.ts
|
|
38
|
+
import * as Schema2 from "effect/Schema";
|
|
39
|
+
import { meta as meta2 } from "#meta";
|
|
40
|
+
(function(WnfsAction2) {
|
|
41
|
+
WnfsAction2.UploadAnnotationId = /* @__PURE__ */ Symbol.for(`${meta2.id}.annotation.upload`);
|
|
42
|
+
WnfsAction2.UploadFileSchema = Schema2.Struct({
|
|
43
|
+
file: Schema2.instanceOf(File).annotations({
|
|
44
|
+
[WnfsAction2.UploadAnnotationId]: {
|
|
45
|
+
// Accept file types.
|
|
46
|
+
"image/*": [
|
|
47
|
+
".jpg",
|
|
48
|
+
".jpeg",
|
|
49
|
+
".png",
|
|
50
|
+
".gif"
|
|
51
|
+
],
|
|
52
|
+
"application/pdf": [
|
|
53
|
+
".pdf"
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
})
|
|
57
|
+
});
|
|
58
|
+
})(WnfsAction || (WnfsAction = {}));
|
|
59
|
+
var WnfsAction;
|
|
60
|
+
|
|
61
|
+
export {
|
|
62
|
+
WnfsCapabilities,
|
|
63
|
+
File_exports,
|
|
64
|
+
WnfsAction
|
|
65
|
+
};
|
|
66
|
+
//# sourceMappingURL=chunk-4D4K5JCC.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/types/capabilities.ts", "../../../src/types/File.ts", "../../../src/types/types.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Blockstore } 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 namespace WnfsCapabilities {\n export const Blockstore = Capability.make<Blockstore>(`${meta.id}.capability.blockstore`);\n\n export type Instances = Record<SpaceId, { directory: PrivateDirectory; forest: PrivateForest }>;\n export const Instances = Capability.make<Instances>(`${meta.id}.capability.instances`);\n}\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { Annotation, Obj, Type } from '@dxos/echo';\nimport { FormInputAnnotation } from '@dxos/echo/internal';\n\nexport const File = Schema.Struct({\n name: Schema.String.pipe(Schema.optional),\n type: Schema.String.pipe(FormInputAnnotation.set(false)),\n cid: Schema.String.pipe(FormInputAnnotation.set(false)),\n timestamp: Schema.String.pipe(FormInputAnnotation.set(false), Schema.optional),\n}).pipe(\n Type.object({\n typename: 'org.dxos.type.file',\n version: '0.1.0',\n }),\n Annotation.IconAnnotation.set({\n icon: 'ph--file--regular',\n hue: 'teal',\n }),\n);\n\nexport type File = Schema.Schema.Type<typeof File>;\n\nexport const make = (props: Obj.MakeProps<typeof File>) => Obj.make(File, props);\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { meta } from '#meta';\n\nexport namespace WnfsAction {\n export const UploadAnnotationId = Symbol.for(`${meta.id}.annotation.upload`);\n\n export const UploadFileSchema = Schema.Struct({\n file: Schema.instanceOf(File).annotations({\n [UploadAnnotationId]: {\n // Accept file types.\n 'image/*': ['.jpg', '.jpeg', '.png', '.gif'],\n 'application/pdf': ['.pdf'],\n // TODO(wittjosiah): Add more file types.\n },\n }),\n });\n\n export type UploadFileForm = Schema.Schema.Type<typeof UploadFileSchema>;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;AAOA,SAASA,kBAAkB;AAG3B,SAASC,YAAY;UAEJC,mBAAAA;oBACFC,aAAaH,WAAWI,KAAiB,GAAGH,KAAKI,EAAE,wBAAwB;oBAG3EC,YAAYN,WAAWI,KAAgB,GAAGH,KAAKI,EAAE,uBAAuB;AACvF,GALiBH,qBAAAA,mBAAAA,CAAAA,EAAAA;;;;ACZjB;;cAAAK;EAAA;;AAIA,YAAYC,YAAY;AAExB,SAASC,YAAYC,KAAKC,YAAY;AACtC,SAASC,2BAA2B;AAE7B,IAAML,QAAcM,cAAO;EAChCC,MAAaC,cAAOC,KAAYC,eAAQ;EACxCC,MAAaH,cAAOC,KAAKJ,oBAAoBO,IAAI,KAAA,CAAA;EACjDC,KAAYL,cAAOC,KAAKJ,oBAAoBO,IAAI,KAAA,CAAA;EAChDE,WAAkBN,cAAOC,KAAKJ,oBAAoBO,IAAI,KAAA,GAAeF,eAAQ;AAC/E,CAAA,EAAGD,KACDL,KAAKW,OAAO;EACVC,UAAU;EACVC,SAAS;AACX,CAAA,GACAf,WAAWgB,eAAeN,IAAI;EAC5BO,MAAM;EACNC,KAAK;AACP,CAAA,CAAA;AAKK,IAAMC,OAAO,CAACC,UAAsCnB,IAAIkB,KAAKrB,OAAMsB,KAAAA;;;ACvB1E,YAAYC,aAAY;AAExB,SAASC,QAAAA,aAAY;UAEJC,aAAAA;cACFC,qBAAqBC,uBAAOC,IAAI,GAAGJ,MAAKK,EAAE,oBAAoB;cAE9DC,mBAA0BC,eAAO;IAC5CC,MAAaC,mBAAWC,IAAAA,EAAMC,YAAY;MACxC,CAAAV,YAACC,kBAAAA,GAAqB;;QAEpB,WAAW;UAAC;UAAQ;UAAS;UAAQ;;QACrC,mBAAmB;UAAC;;MAEtB;IACF,CAAA;EACF,CAAA;AAGF,GAfiBD,eAAAA,aAAAA,CAAAA,EAAAA;;",
|
|
6
|
+
"names": ["Capability", "meta", "WnfsCapabilities", "Blockstore", "make", "id", "Instances", "File", "Schema", "Annotation", "Obj", "Type", "FormInputAnnotation", "Struct", "name", "String", "pipe", "optional", "type", "set", "cid", "timestamp", "object", "typename", "version", "IconAnnotation", "icon", "hue", "make", "props", "Schema", "meta", "WnfsAction", "UploadAnnotationId", "Symbol", "for", "id", "UploadFileSchema", "Struct", "file", "instanceOf", "File", "annotations"]
|
|
7
|
+
}
|
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
// src/helpers/upload.ts
|
|
2
|
-
import { CID as CID3 } from "multiformats";
|
|
3
|
-
import * as Raw from "multiformats/codecs/raw";
|
|
4
|
-
import { sha256 as sha2562 } from "multiformats/hashes/sha2";
|
|
5
|
-
import { Obj as Obj2 } from "@dxos/echo";
|
|
6
|
-
import { log } from "@dxos/log";
|
|
7
|
-
|
|
8
1
|
// src/helpers/common.ts
|
|
9
2
|
import { CID } from "multiformats/cid";
|
|
10
3
|
import { sha256 } from "multiformats/hashes/sha2";
|
|
@@ -49,6 +42,23 @@ var store = (blockstore) => {
|
|
|
49
42
|
};
|
|
50
43
|
};
|
|
51
44
|
var storeName = () => "dxos/wnfs";
|
|
45
|
+
var readFile = (file) => {
|
|
46
|
+
return new Promise((resolve, reject) => {
|
|
47
|
+
const reader = new FileReader();
|
|
48
|
+
reader.onload = (event) => {
|
|
49
|
+
const result = event.target?.result;
|
|
50
|
+
if (result === null || result === void 0 || typeof result === "string") {
|
|
51
|
+
reject(new Error("Expected an ArrayBuffer"));
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
resolve(new Uint8Array(result));
|
|
55
|
+
};
|
|
56
|
+
reader.onerror = (err) => {
|
|
57
|
+
reject(err);
|
|
58
|
+
};
|
|
59
|
+
reader.readAsArrayBuffer(file);
|
|
60
|
+
});
|
|
61
|
+
};
|
|
52
62
|
|
|
53
63
|
// src/helpers/load.ts
|
|
54
64
|
import { CID as CID2 } from "multiformats";
|
|
@@ -57,9 +67,9 @@ import { AccessKey, PrivateDirectory, PrivateForest, PrivateNode } from "wnfs";
|
|
|
57
67
|
import { Obj } from "@dxos/echo";
|
|
58
68
|
var loadWnfs = async ({ space, blockstore, instances }) => {
|
|
59
69
|
if (space.properties.wnfs_access_key !== void 0 && space.properties.wnfs_private_forest_cid !== void 0) {
|
|
60
|
-
Obj.
|
|
61
|
-
delete
|
|
62
|
-
delete
|
|
70
|
+
Obj.update(space.properties, (obj) => {
|
|
71
|
+
delete obj["wnfs_access_key"];
|
|
72
|
+
delete obj["wnfs_private_forest_cid"];
|
|
63
73
|
});
|
|
64
74
|
}
|
|
65
75
|
const cacheKey = space.properties.wnfs?.privateForestCid;
|
|
@@ -81,8 +91,8 @@ var createWnfsDir = async (blockstore, space) => {
|
|
|
81
91
|
const dir = dirResult.rootDir;
|
|
82
92
|
const [accessKeyRaw, newForest] = await dir.asNode().store(dirResult.forest, wnfsStore, rng);
|
|
83
93
|
const cidBytes = await newForest.store(wnfsStore);
|
|
84
|
-
Obj.
|
|
85
|
-
|
|
94
|
+
Obj.update(space.properties, (obj) => {
|
|
95
|
+
obj.wnfs = {
|
|
86
96
|
accessKey: Uint8Arrays.toString(accessKeyRaw.toBytes(), "base64"),
|
|
87
97
|
privateForestCid: CID2.decode(cidBytes).toString()
|
|
88
98
|
};
|
|
@@ -103,6 +113,13 @@ var loadWnfsDir = async (blockstore, space) => {
|
|
|
103
113
|
};
|
|
104
114
|
};
|
|
105
115
|
|
|
116
|
+
// src/helpers/upload.ts
|
|
117
|
+
import { CID as CID3 } from "multiformats";
|
|
118
|
+
import * as Raw from "multiformats/codecs/raw";
|
|
119
|
+
import { sha256 as sha2562 } from "multiformats/hashes/sha2";
|
|
120
|
+
import { Obj as Obj2 } from "@dxos/echo";
|
|
121
|
+
import { log } from "@dxos/log";
|
|
122
|
+
|
|
106
123
|
// src/helpers/wnfs-url.ts
|
|
107
124
|
var wnfsUrl = (filePath2) => {
|
|
108
125
|
return "wnfs://" + filePath2.map((f) => encodeURIComponent(f)).join("/");
|
|
@@ -136,8 +153,8 @@ var upload = async ({ file, blockstore, instances, space }) => {
|
|
|
136
153
|
const result = await directory.write(path, true, bytes, /* @__PURE__ */ new Date(), forest, wnfsStore, new Rng());
|
|
137
154
|
const [_, updatedForest] = await result.rootDir.store(result.forest, wnfsStore, new Rng());
|
|
138
155
|
const cidBytes = await updatedForest.store(wnfsStore);
|
|
139
|
-
Obj2.
|
|
140
|
-
|
|
156
|
+
Obj2.update(space.properties, (obj) => {
|
|
157
|
+
obj.wnfs.privateForestCid = CID3.decode(cidBytes).toString();
|
|
141
158
|
});
|
|
142
159
|
const info = {
|
|
143
160
|
name: file.name,
|
|
@@ -148,22 +165,20 @@ var upload = async ({ file, blockstore, instances, space }) => {
|
|
|
148
165
|
log("upload", {
|
|
149
166
|
file,
|
|
150
167
|
info
|
|
151
|
-
}, {
|
|
152
|
-
F: __dxlog_file,
|
|
153
|
-
L: 62,
|
|
154
|
-
S: void 0,
|
|
155
|
-
C: (f, a) => f(...a)
|
|
156
|
-
});
|
|
168
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 41, S: void 0 });
|
|
157
169
|
return info;
|
|
158
170
|
};
|
|
159
171
|
|
|
160
172
|
export {
|
|
161
173
|
filePath,
|
|
174
|
+
Rng,
|
|
175
|
+
store,
|
|
162
176
|
storeName,
|
|
177
|
+
readFile,
|
|
163
178
|
loadWnfs,
|
|
164
179
|
wnfsUrl,
|
|
165
180
|
getPathFromUrl,
|
|
166
181
|
getBlobUrl,
|
|
167
182
|
upload
|
|
168
183
|
};
|
|
169
|
-
//# sourceMappingURL=chunk-
|
|
184
|
+
//# sourceMappingURL=chunk-7KFJ6LYH.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/helpers/common.ts", "../../../src/helpers/load.ts", "../../../src/helpers/upload.ts", "../../../src/helpers/wnfs-url.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport type { Blockstore } from 'interface-blockstore';\nimport { CID } from 'multiformats/cid';\nimport { sha256 } from 'multiformats/hashes/sha2';\nimport { type BlockStore as WnfsBlockStore } from 'wnfs';\n\nimport * as crypto from '@dxos/crypto';\nimport { type Space } from '@dxos/react-client/echo';\n\n//\n// PATH\n//\n\nexport const filePath = (fileName: string, space: Space) => {\n return ['spaces', space.id, 'files', fileName];\n};\n\n//\n// RNG\n//\n\nexport class Rng {\n randomBytes(count: number): Uint8Array {\n return new Uint8Array(crypto.randomBytes(count));\n }\n}\n\n//\n// STORE\n//\n\nexport const store = (blockstore: Blockstore): WnfsBlockStore => {\n const getBlock = async (cid: Uint8Array): Promise<Uint8Array | undefined> => {\n const decodedCid = CID.decode(cid);\n return await blockstore.get(decodedCid);\n };\n\n const hasBlock = async (cid: Uint8Array): Promise<boolean> => {\n const decodedCid = CID.decode(cid);\n return await blockstore.has(decodedCid);\n };\n\n const putBlockKeyed = async (cid: Uint8Array, bytes: Uint8Array): Promise<void> => {\n const decodedCid = CID.decode(cid);\n await blockstore.put(decodedCid, bytes);\n };\n\n // Don't hash blocks with the rs-wnfs default Blake 3, sha256 has better support.\n const putBlock = async (bytes: Uint8Array, codec: number): Promise<Uint8Array> => {\n const hash = await sha256.digest(bytes);\n const cid = CID.create(1, codec, hash);\n await blockstore.put(cid, bytes);\n return cid.bytes;\n };\n\n return { getBlock, hasBlock, putBlockKeyed, putBlock };\n};\n\nexport const storeName = () => 'dxos/wnfs';\n\n//\n// OTHER\n//\n\nexport const readFile = (file: File): Promise<Uint8Array> => {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.onload = (event) => {\n const result = event.target?.result;\n if (result === null || result === undefined || typeof result === 'string') {\n reject(new Error('Expected an ArrayBuffer'));\n return;\n }\n resolve(new Uint8Array(result));\n };\n reader.onerror = (err) => {\n reject(err);\n };\n reader.readAsArrayBuffer(file);\n });\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport type { Blockstore } from 'interface-blockstore';\nimport { CID } from 'multiformats';\nimport * as Uint8Arrays from 'uint8arrays';\nimport { AccessKey, PrivateDirectory, PrivateForest, PrivateNode } from 'wnfs';\n\nimport { Obj } from '@dxos/echo';\nimport { type Space } from '@dxos/react-client/echo';\n\nimport { type WnfsCapabilities } from '#types';\n\nimport { Rng, store } from './common';\n\n//\n// LOAD\n//\n\nexport const loadWnfs = async ({\n space,\n blockstore,\n instances,\n}: {\n space: Space;\n blockstore: Blockstore;\n instances?: WnfsCapabilities.Instances;\n}) => {\n // TODO(wittjosiah): Remove.\n // Delete old properties if they exist.\n if (space.properties.wnfs_access_key !== undefined && space.properties.wnfs_private_forest_cid !== undefined) {\n Obj.update(space.properties, (obj) => {\n delete obj['wnfs_access_key'];\n delete obj['wnfs_private_forest_cid'];\n });\n }\n\n const cacheKey = space.properties.wnfs?.privateForestCid;\n if (instances?.[cacheKey]) {\n return instances[cacheKey];\n }\n\n const exists = !!space.properties.wnfs;\n const instance = exists ? await loadWnfsDir(blockstore, space) : await createWnfsDir(blockstore, space);\n if (instances) {\n instances[cacheKey] = instance;\n }\n\n return instance;\n};\n\n//\n// PRIVATE\n//\n\nconst createWnfsDir = async (blockstore: Blockstore, space: Space) => {\n const wnfsStore = store(blockstore);\n const rng = new Rng();\n const forest = new PrivateForest(rng);\n\n const dirResult = await PrivateDirectory.newAndStore(forest.emptyName(), new Date(), forest, wnfsStore, rng);\n const dir = dirResult.rootDir as PrivateDirectory;\n\n const [accessKeyRaw, newForest]: [AccessKey, PrivateForest] = await dir\n .asNode()\n .store(dirResult.forest as PrivateForest, wnfsStore, rng);\n\n const cidBytes = await newForest.store(wnfsStore);\n\n Obj.update(space.properties, (obj) => {\n obj.wnfs = {\n accessKey: Uint8Arrays.toString(accessKeyRaw.toBytes(), 'base64'),\n privateForestCid: CID.decode(cidBytes).toString(),\n };\n });\n\n return {\n directory: dir,\n forest: newForest,\n };\n};\n\nconst loadWnfsDir = async (blockstore: Blockstore, space: Space) => {\n const wnfsStore = store(blockstore);\n\n const accessKey = AccessKey.fromBytes(Uint8Arrays.fromString(space.properties.wnfs.accessKey, 'base64'));\n const forest: PrivateForest = await PrivateForest.load(\n CID.parse(space.properties.wnfs.privateForestCid).bytes,\n wnfsStore,\n );\n const node: PrivateNode = await PrivateNode.load(accessKey, forest, wnfsStore);\n\n return {\n directory: node.asDir(),\n forest,\n };\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport type { Blockstore } from 'interface-blockstore';\nimport { CID } from 'multiformats';\nimport * as Raw from 'multiformats/codecs/raw';\nimport { sha256 } from 'multiformats/hashes/sha2';\n\nimport type { Space } from '@dxos/client/echo';\nimport { Obj } from '@dxos/echo';\nimport { log } from '@dxos/log';\n\nimport { type WnfsCapabilities } from '#types';\n\nimport { Rng, filePath, store } from './common';\nimport { loadWnfs } from './load';\nimport { wnfsUrl } from './wnfs-url';\n\nexport const upload = async ({\n file,\n blockstore,\n instances,\n space,\n}: {\n file: File;\n blockstore: Blockstore;\n instances?: WnfsCapabilities.Instances;\n space: Space;\n}) => {\n const { directory, forest } = await loadWnfs({ blockstore, instances, space });\n const wnfsStore = store(blockstore);\n\n const bytes = new Uint8Array(await file.arrayBuffer());\n const hash = await sha256.digest(bytes);\n const cid = CID.create(1, Raw.code, hash);\n\n const path = filePath(cid.toString(), space);\n\n // Given the root directory of the private file system,\n // write the file contents to `path` in said directory.\n const result = await directory.write(path, true, bytes, new Date(), forest, wnfsStore, new Rng());\n\n // Given the new immutable instance of the root directory after writing to it,\n // **store** the changes in the \"dark forest\" and the associated (block) store.\n const [_, updatedForest] = await result.rootDir.store(result.forest, wnfsStore, new Rng());\n const cidBytes = await updatedForest.store(wnfsStore);\n\n // Update the forest pointer on the associated space.\n Obj.update(space.properties, (obj) => {\n obj.wnfs.privateForestCid = CID.decode(cidBytes).toString();\n });\n\n // Generate `wnfs://` URL & return the info.\n const info = {\n name: file.name,\n type: file.type,\n url: wnfsUrl(path),\n cid: cid.toString(),\n };\n\n log('upload', { file, info });\n return info;\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport type { Blockstore } from 'interface-blockstore';\nimport { type PrivateDirectory, type PrivateForest } from 'wnfs';\n\nimport { store } from './common';\n\nexport const wnfsUrl = (filePath: string[]) => {\n return 'wnfs://' + filePath.map((f) => encodeURIComponent(f)).join('/');\n};\n\nexport const getPathFromUrl = (wnfsUrl: string) =>\n wnfsUrl\n .replace(/^wnfs:\\/\\//, '')\n .split('/')\n .map((p) => decodeURIComponent(p));\n\nexport const getBlobUrl = async ({\n wnfsUrl,\n blockstore,\n forest,\n directory,\n type,\n}: {\n wnfsUrl: string;\n blockstore: Blockstore;\n forest: PrivateForest;\n directory: PrivateDirectory;\n type?: string;\n}) => {\n const path = getPathFromUrl(wnfsUrl);\n const wnfsStore = store(blockstore);\n const { result } = await directory.read(path, true, forest, wnfsStore);\n const blob = new Blob([result], { type });\n return URL.createObjectURL(blob);\n};\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["CID", "sha256", "crypto", "filePath", "fileName", "space", "id", "Rng", "randomBytes", "count", "Uint8Array", "store", "blockstore", "getBlock", "cid", "decodedCid", "decode", "get", "hasBlock", "has", "putBlockKeyed", "bytes", "put", "putBlock", "codec", "hash", "digest", "create", "storeName", "readFile", "file", "Promise", "resolve", "reject", "reader", "FileReader", "onload", "event", "result", "target", "undefined", "Error", "onerror", "err", "readAsArrayBuffer", "CID", "Uint8Arrays", "AccessKey", "PrivateDirectory", "PrivateForest", "PrivateNode", "Obj", "loadWnfs", "space", "blockstore", "instances", "properties", "wnfs_access_key", "undefined", "wnfs_private_forest_cid", "Obj", "update", "obj", "cacheKey", "wnfs", "privateForestCid", "exists", "instance", "loadWnfsDir", "createWnfsDir", "wnfsStore", "store", "rng", "Rng", "forest", "PrivateForest", "dirResult", "PrivateDirectory", "newAndStore", "emptyName", "Date", "dir", "rootDir", "accessKeyRaw", "newForest", "asNode", "cidBytes", "accessKey", "toString", "toBytes", "CID", "decode", "directory", "AccessKey", "fromBytes", "fromString", "load", "parse", "bytes", "node", "PrivateNode", "asDir", "CID", "Raw", "sha256", "Obj", "log", "wnfsUrl", "filePath", "map", "f", "encodeURIComponent", "join", "getPathFromUrl", "replace", "split", "p", "decodeURIComponent", "getBlobUrl", "blockstore", "forest", "directory", "type", "path", "wnfsStore", "store", "result", "read", "blob", "Blob", "URL", "createObjectURL", "upload", "blockstore", "instances", "space", "hash", "sha256", "bytes", "cid", "CID", "create", "Raw", "path", "filePath", "toString", "Obj", "update", "properties", "obj", "type", "file", "url", "wnfsUrl", "info"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import {
|
|
2
|
+
File_exports,
|
|
3
|
+
WnfsAction
|
|
4
|
+
} from "./chunk-4D4K5JCC.mjs";
|
|
5
|
+
import {
|
|
6
|
+
__export
|
|
7
|
+
} from "./chunk-J5LGTIGS.mjs";
|
|
8
|
+
|
|
9
|
+
// src/operations/definitions.ts
|
|
10
|
+
var definitions_exports = {};
|
|
11
|
+
__export(definitions_exports, {
|
|
12
|
+
Create: () => Create,
|
|
13
|
+
CreateFile: () => CreateFile,
|
|
14
|
+
Upload: () => Upload
|
|
15
|
+
});
|
|
16
|
+
import * as Schema from "effect/Schema";
|
|
17
|
+
import { Capability } from "@dxos/app-framework";
|
|
18
|
+
import { FileInfoSchema } from "@dxos/app-toolkit";
|
|
19
|
+
import { Operation } from "@dxos/compute";
|
|
20
|
+
import { Database } from "@dxos/echo";
|
|
21
|
+
import { meta } from "#meta";
|
|
22
|
+
var WNFS_OPERATION = `${meta.id}.operation`;
|
|
23
|
+
var Create = Operation.make({
|
|
24
|
+
meta: {
|
|
25
|
+
key: `${WNFS_OPERATION}.create`,
|
|
26
|
+
name: "Create WNFS File"
|
|
27
|
+
},
|
|
28
|
+
services: [
|
|
29
|
+
Capability.Service
|
|
30
|
+
],
|
|
31
|
+
input: FileInfoSchema.pick("name", "type", "cid").pipe(Schema.required),
|
|
32
|
+
output: Schema.Struct({
|
|
33
|
+
object: File_exports.File
|
|
34
|
+
})
|
|
35
|
+
});
|
|
36
|
+
var Upload = Operation.make({
|
|
37
|
+
meta: {
|
|
38
|
+
key: `${WNFS_OPERATION}.upload`,
|
|
39
|
+
name: "Upload File"
|
|
40
|
+
},
|
|
41
|
+
services: [
|
|
42
|
+
Capability.Service
|
|
43
|
+
],
|
|
44
|
+
input: Schema.extend(WnfsAction.UploadFileSchema, Schema.Struct({
|
|
45
|
+
db: Database.Database
|
|
46
|
+
})),
|
|
47
|
+
output: Schema.required(FileInfoSchema)
|
|
48
|
+
});
|
|
49
|
+
var CreateFile = Operation.make({
|
|
50
|
+
meta: {
|
|
51
|
+
key: `${WNFS_OPERATION}.create-file`,
|
|
52
|
+
name: "Create File"
|
|
53
|
+
},
|
|
54
|
+
services: [
|
|
55
|
+
Capability.Service
|
|
56
|
+
],
|
|
57
|
+
input: Schema.extend(WnfsAction.UploadFileSchema, Schema.Struct({
|
|
58
|
+
db: Database.Database
|
|
59
|
+
})),
|
|
60
|
+
output: Schema.Struct({
|
|
61
|
+
object: File_exports.File
|
|
62
|
+
})
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
export {
|
|
66
|
+
Create,
|
|
67
|
+
Upload,
|
|
68
|
+
CreateFile,
|
|
69
|
+
definitions_exports
|
|
70
|
+
};
|
|
71
|
+
//# sourceMappingURL=chunk-DK62NQ5T.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/operations/definitions.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { Capability } from '@dxos/app-framework';\nimport { FileInfoSchema } from '@dxos/app-toolkit';\nimport { Operation } from '@dxos/compute';\nimport { Database } from '@dxos/echo';\n\nimport { meta } from '#meta';\n\nimport { WnfsFile, WnfsAction } from '../types';\n\nconst WNFS_OPERATION = `${meta.id}.operation`;\n\nexport const Create = Operation.make({\n meta: { key: `${WNFS_OPERATION}.create`, name: 'Create WNFS File' },\n services: [Capability.Service],\n input: FileInfoSchema.pick('name', 'type', 'cid').pipe(Schema.required),\n output: Schema.Struct({\n object: WnfsFile.File,\n }),\n});\n\nexport const Upload = Operation.make({\n meta: { key: `${WNFS_OPERATION}.upload`, name: 'Upload File' },\n services: [Capability.Service],\n input: Schema.extend(WnfsAction.UploadFileSchema, Schema.Struct({ db: Database.Database })),\n output: Schema.required(FileInfoSchema),\n});\n\nexport const CreateFile = Operation.make({\n meta: { key: `${WNFS_OPERATION}.create-file`, name: 'Create File' },\n services: [Capability.Service],\n input: Schema.extend(WnfsAction.UploadFileSchema, Schema.Struct({ db: Database.Database })),\n output: Schema.Struct({\n object: WnfsFile.File,\n }),\n});\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;AAAA;;;;;;AAIA,YAAYA,YAAY;AAExB,SAASC,kBAAkB;AAC3B,SAASC,sBAAsB;AAC/B,SAASC,iBAAiB;AAC1B,SAASC,gBAAgB;AAEzB,SAASC,YAAY;AAIrB,IAAMC,iBAAiB,GAAGC,KAAKC,EAAE;AAE1B,IAAMC,SAASC,UAAUC,KAAK;EACnCJ,MAAM;IAAEK,KAAK,GAAGN,cAAAA;IAAyBO,MAAM;EAAmB;EAClEC,UAAU;IAACC,WAAWC;;EACtBC,OAAOC,eAAeC,KAAK,QAAQ,QAAQ,KAAA,EAAOC,KAAYC,eAAQ;EACtEC,QAAeC,cAAO;IACpBC,QAAQC,aAASC;EACnB,CAAA;AACF,CAAA;AAEO,IAAMC,SAASjB,UAAUC,KAAK;EACnCJ,MAAM;IAAEK,KAAK,GAAGN,cAAAA;IAAyBO,MAAM;EAAc;EAC7DC,UAAU;IAACC,WAAWC;;EACtBC,OAAcW,cAAOC,WAAWC,kBAAyBP,cAAO;IAAEQ,IAAIC,SAASA;EAAS,CAAA,CAAA;EACxFV,QAAeD,gBAASH,cAAAA;AAC1B,CAAA;AAEO,IAAMe,aAAavB,UAAUC,KAAK;EACvCJ,MAAM;IAAEK,KAAK,GAAGN,cAAAA;IAA8BO,MAAM;EAAc;EAClEC,UAAU;IAACC,WAAWC;;EACtBC,OAAcW,cAAOC,WAAWC,kBAAyBP,cAAO;IAAEQ,IAAIC,SAASA;EAAS,CAAA,CAAA;EACxFV,QAAeC,cAAO;IACpBC,QAAQC,aAASC;EACnB,CAAA;AACF,CAAA;",
|
|
6
|
+
"names": ["Schema", "Capability", "FileInfoSchema", "Operation", "Database", "meta", "WNFS_OPERATION", "meta", "id", "Create", "Operation", "make", "key", "name", "services", "Capability", "Service", "input", "FileInfoSchema", "pick", "pipe", "required", "output", "Struct", "object", "WnfsFile", "File", "Upload", "extend", "WnfsAction", "UploadFileSchema", "db", "Database", "CreateFile"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Create
|
|
3
|
+
} from "./chunk-DK62NQ5T.mjs";
|
|
4
|
+
import {
|
|
5
|
+
File_exports
|
|
6
|
+
} from "./chunk-4D4K5JCC.mjs";
|
|
7
|
+
import "./chunk-J5LGTIGS.mjs";
|
|
8
|
+
|
|
9
|
+
// src/operations/create.ts
|
|
10
|
+
import * as Effect from "effect/Effect";
|
|
11
|
+
import { Operation } from "@dxos/compute";
|
|
12
|
+
var handler = Create.pipe(Operation.withHandler(Effect.fnUntraced(function* ({ name, type, cid }) {
|
|
13
|
+
return {
|
|
14
|
+
object: File_exports.make({
|
|
15
|
+
name,
|
|
16
|
+
type,
|
|
17
|
+
cid
|
|
18
|
+
})
|
|
19
|
+
};
|
|
20
|
+
})));
|
|
21
|
+
var create_default = handler;
|
|
22
|
+
export {
|
|
23
|
+
create_default as default
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=create-QRLX4IMZ.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/operations/create.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Operation } from '@dxos/compute';\n\nimport { WnfsFile } from '../types';\nimport { Create } from './definitions';\n\nconst handler: Operation.WithHandler<typeof Create> = Create.pipe(\n Operation.withHandler(\n Effect.fnUntraced(function* ({ name, type, cid }) {\n return {\n object: WnfsFile.make({ name, type, cid }),\n };\n }),\n ),\n);\n\nexport default handler;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;AAIA,YAAYA,YAAY;AAExB,SAASC,iBAAiB;AAK1B,IAAMC,UAAgDC,OAAOC,KAC3DC,UAAUC,YACDC,kBAAW,WAAW,EAAEC,MAAMC,MAAMC,IAAG,GAAE;AAC9C,SAAO;IACLC,QAAQC,aAASC,KAAK;MAAEL;MAAMC;MAAMC;IAAI,CAAA;EAC1C;AACF,CAAA,CAAA,CAAA;AAIJ,IAAA,iBAAeR;",
|
|
6
|
+
"names": ["Effect", "Operation", "handler", "Create", "pipe", "Operation", "withHandler", "fnUntraced", "name", "type", "cid", "object", "WnfsFile", "make"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import {
|
|
2
|
+
upload
|
|
3
|
+
} from "./chunk-7KFJ6LYH.mjs";
|
|
4
|
+
import {
|
|
5
|
+
CreateFile
|
|
6
|
+
} from "./chunk-DK62NQ5T.mjs";
|
|
7
|
+
import {
|
|
8
|
+
File_exports,
|
|
9
|
+
WnfsCapabilities
|
|
10
|
+
} from "./chunk-4D4K5JCC.mjs";
|
|
11
|
+
import "./chunk-J5LGTIGS.mjs";
|
|
12
|
+
|
|
13
|
+
// src/operations/create-file.ts
|
|
14
|
+
import * as Effect from "effect/Effect";
|
|
15
|
+
import { Capability } from "@dxos/app-framework";
|
|
16
|
+
import { Operation } from "@dxos/compute";
|
|
17
|
+
import { invariant } from "@dxos/invariant";
|
|
18
|
+
import { ClientCapabilities } from "@dxos/plugin-client/types";
|
|
19
|
+
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-wnfs/src/operations/create-file.ts";
|
|
20
|
+
var handler = CreateFile.pipe(Operation.withHandler(Effect.fnUntraced(function* ({ file, db }) {
|
|
21
|
+
const client = yield* Capability.get(ClientCapabilities.Client);
|
|
22
|
+
const blockstore = yield* Capability.get(WnfsCapabilities.Blockstore);
|
|
23
|
+
const space = client.spaces.get(db.spaceId);
|
|
24
|
+
invariant(space, "Space not found", { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 16, S: this, A: ["space", "'Space not found'"] });
|
|
25
|
+
const info = yield* Effect.promise(() => upload({
|
|
26
|
+
file,
|
|
27
|
+
blockstore,
|
|
28
|
+
space
|
|
29
|
+
}));
|
|
30
|
+
return {
|
|
31
|
+
object: File_exports.make({
|
|
32
|
+
name: info.name,
|
|
33
|
+
type: info.type,
|
|
34
|
+
cid: info.cid
|
|
35
|
+
})
|
|
36
|
+
};
|
|
37
|
+
})));
|
|
38
|
+
var create_file_default = handler;
|
|
39
|
+
export {
|
|
40
|
+
create_file_default as default
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=create-file-INAT56PX.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/operations/create-file.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Capability } from '@dxos/app-framework';\nimport { Operation } from '@dxos/compute';\nimport { invariant } from '@dxos/invariant';\nimport { ClientCapabilities } from '@dxos/plugin-client/types';\n\nimport { upload } from '../helpers';\nimport { WnfsCapabilities, WnfsFile } from '../types';\nimport { CreateFile } from './definitions';\n\nconst handler: Operation.WithHandler<typeof CreateFile> = CreateFile.pipe(\n Operation.withHandler(\n Effect.fnUntraced(function* ({ file, db }) {\n const client = yield* Capability.get(ClientCapabilities.Client);\n const blockstore = yield* Capability.get(WnfsCapabilities.Blockstore);\n const space = client.spaces.get(db.spaceId);\n invariant(space, 'Space not found');\n const info = yield* Effect.promise(() => upload({ file, blockstore, space }));\n return {\n object: WnfsFile.make({ name: info.name, type: info.type, cid: info.cid }),\n };\n }),\n ),\n);\n\nexport default handler;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;AAIA,YAAYA,YAAY;AAExB,SAASC,kBAAkB;AAC3B,SAASC,iBAAiB;AAC1B,SAASC,iBAAiB;AAC1B,SAASC,0BAA0B;AAMnC,IAAA,eAA0DC;IAIpD,UAAMC,WAAa,KAAOC,UAAWC,YAAIC,kBAA2B,WAAA,EAAA,MAAA,GAAA,GAAA;AACpE,QAAMC,SAAQC,OAAOC,WAAWC,IAAGC,mBAAO,MAAA;AAC1CC,QAAAA,aAAiB,OAAA,WAAA,IAAA,iBAAA,UAAA;AACjB,QAAMC,QAAO,OAAOC,OAAOC,IAAAA,GAAQ,OAAMC;YAASC,OAAAA,mBAAAA,EAAAA,YAAAA,YAAAA,GAAAA,cAAAA,GAAAA,IAAAA,GAAAA,MAAAA,GAAAA,CAAAA,SAAAA,mBAAAA,EAAAA,CAAAA;eAAMd,OAAAA,eAAAA,MAAAA,OAAAA;IAAYI;IAAM;IACnE;EACLW,CAAAA,CAAAA;;YAAyCC,aAAWA,KAAI;MAAEC,MAAKP,KAAKO;MAAI,MAAA,KAAA;MAC1E,KAAA,KAAA;IACF,CAAA;EAIJ;;;",
|
|
6
|
+
"names": ["Effect", "Capability", "Operation", "invariant", "ClientCapabilities", "CreateFile", "blockstore", "Capability", "get", "WnfsCapabilities", "space", "client", "spaces", "db", "spaceId", "invariant", "info", "Effect", "promise", "upload", "file", "object", "type", "cid"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Rng,
|
|
3
|
+
filePath,
|
|
4
|
+
getBlobUrl,
|
|
5
|
+
getPathFromUrl,
|
|
6
|
+
loadWnfs,
|
|
7
|
+
readFile,
|
|
8
|
+
store,
|
|
9
|
+
storeName,
|
|
10
|
+
upload,
|
|
11
|
+
wnfsUrl
|
|
12
|
+
} from "../chunk-7KFJ6LYH.mjs";
|
|
13
|
+
import "../chunk-J5LGTIGS.mjs";
|
|
14
|
+
export {
|
|
15
|
+
Rng,
|
|
16
|
+
filePath,
|
|
17
|
+
getBlobUrl,
|
|
18
|
+
getPathFromUrl,
|
|
19
|
+
loadWnfs,
|
|
20
|
+
readFile,
|
|
21
|
+
store,
|
|
22
|
+
storeName,
|
|
23
|
+
upload,
|
|
24
|
+
wnfsUrl
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,85 +1,64 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
} from "
|
|
2
|
+
WnfsCapabilities
|
|
3
|
+
} from "./chunk-4D4K5JCC.mjs";
|
|
4
|
+
import "./chunk-J5LGTIGS.mjs";
|
|
5
|
+
|
|
6
|
+
// src/meta.ts
|
|
7
|
+
import { trim } from "@dxos/util";
|
|
8
|
+
var meta = {
|
|
9
|
+
id: "org.dxos.plugin.wnfs",
|
|
10
|
+
name: "WNFS",
|
|
11
|
+
description: trim`
|
|
12
|
+
Decentralized file storage using the Web Native File System protocol.
|
|
13
|
+
Store and sync files with end-to-end encryption across devices without central servers.
|
|
14
|
+
`,
|
|
15
|
+
icon: "ph--file-cloud--regular",
|
|
16
|
+
iconHue: "teal",
|
|
17
|
+
source: "https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-wnfs"
|
|
18
|
+
};
|
|
8
19
|
|
|
9
20
|
// src/WnfsPlugin.tsx
|
|
10
21
|
import * as Effect from "effect/Effect";
|
|
11
|
-
import
|
|
22
|
+
import * as Option from "effect/Option";
|
|
23
|
+
import { Capability, Plugin } from "@dxos/app-framework";
|
|
12
24
|
import { AppPlugin } from "@dxos/app-toolkit";
|
|
13
|
-
import { Operation } from "@dxos/
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
import {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
var FileUploader = Capability2.lazy("FileUploader", () => import("./file-uploader-QL4DTOMM.mjs"));
|
|
25
|
-
|
|
26
|
-
// src/capabilities/markdown/index.ts
|
|
27
|
-
import { Capability as Capability3 } from "@dxos/app-framework";
|
|
28
|
-
var Markdown = Capability3.lazy("Markdown", () => import("./markdown-AYCVG6TJ.mjs"));
|
|
29
|
-
|
|
30
|
-
// src/capabilities/operation-resolver/index.ts
|
|
31
|
-
import { Capability as Capability4 } from "@dxos/app-framework";
|
|
32
|
-
var OperationResolver = Capability4.lazy("OperationResolver", () => import("./operation-resolver-YYWUF6EY.mjs"));
|
|
33
|
-
|
|
34
|
-
// src/capabilities/react-surface/index.ts
|
|
35
|
-
import { Capability as Capability5 } from "@dxos/app-framework";
|
|
36
|
-
var ReactSurface = Capability5.lazy("ReactSurface", () => import("./react-surface-3LKVDPH7.mjs"));
|
|
37
|
-
|
|
38
|
-
// src/translations.ts
|
|
39
|
-
var translations = [
|
|
40
|
-
{
|
|
41
|
-
"en-US": {
|
|
42
|
-
[File_exports.File.typename]: {
|
|
43
|
-
"typename label": "File",
|
|
44
|
-
"typename label_zero": "Files",
|
|
45
|
-
"typename label_one": "File",
|
|
46
|
-
"typename label_other": "Files",
|
|
47
|
-
"object name placeholder": "New file",
|
|
48
|
-
"rename object label": "Rename file",
|
|
49
|
-
"delete object label": "Delete file",
|
|
50
|
-
"object deleted label": "File deleted"
|
|
51
|
-
},
|
|
52
|
-
[meta.id]: {
|
|
53
|
-
"plugin name": "Files",
|
|
54
|
-
"file input placeholder": "Drop a file here, or click to select a file"
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
];
|
|
59
|
-
|
|
60
|
-
// src/WnfsPlugin.tsx
|
|
61
|
-
var WnfsPlugin = Plugin.define(meta).pipe(AppPlugin.addMetadataModule({
|
|
25
|
+
import { Operation } from "@dxos/compute";
|
|
26
|
+
import { Annotation } from "@dxos/echo";
|
|
27
|
+
import { ClientEvents } from "@dxos/plugin-client/types";
|
|
28
|
+
import { MarkdownEvents } from "@dxos/plugin-markdown/types";
|
|
29
|
+
import { SpaceOperation } from "@dxos/plugin-space/operations";
|
|
30
|
+
import { Blockstore, FileUploader, Markdown, OperationHandler, ReactSurface } from "#capabilities";
|
|
31
|
+
import { meta as meta2 } from "#meta";
|
|
32
|
+
import { WnfsOperation } from "#operations";
|
|
33
|
+
import { translations } from "#translations";
|
|
34
|
+
import { WnfsAction, WnfsCapabilities as WnfsCapabilities2, WnfsFile } from "#types";
|
|
35
|
+
var WnfsPlugin = Plugin.define(meta2).pipe(AppPlugin.addMetadataModule({
|
|
62
36
|
metadata: {
|
|
63
|
-
id:
|
|
37
|
+
id: WnfsFile.File.typename,
|
|
64
38
|
metadata: {
|
|
65
39
|
// TODO(wittjosiah): Would be nice if icon could change based on the type of the file.
|
|
66
|
-
icon:
|
|
67
|
-
iconHue: "
|
|
40
|
+
icon: Annotation.IconAnnotation.get(WnfsFile.File).pipe(Option.getOrThrow).icon,
|
|
41
|
+
iconHue: Annotation.IconAnnotation.get(WnfsFile.File).pipe(Option.getOrThrow).hue ?? "white",
|
|
68
42
|
inputSchema: WnfsAction.UploadFileSchema,
|
|
69
|
-
createObject: (props,
|
|
43
|
+
createObject: (props, options) => Effect.gen(function* () {
|
|
70
44
|
const { object } = yield* Operation.invoke(WnfsOperation.CreateFile, {
|
|
71
45
|
...props,
|
|
72
|
-
db
|
|
46
|
+
db: options.db
|
|
47
|
+
});
|
|
48
|
+
return yield* Operation.invoke(SpaceOperation.AddObject, {
|
|
49
|
+
object,
|
|
50
|
+
target: options.target,
|
|
51
|
+
hidden: true,
|
|
52
|
+
targetNodeId: options.targetNodeId
|
|
73
53
|
});
|
|
74
|
-
return object;
|
|
75
54
|
})
|
|
76
55
|
}
|
|
77
56
|
}
|
|
78
|
-
}), AppPlugin.
|
|
79
|
-
activate:
|
|
57
|
+
}), AppPlugin.addOperationHandlerModule({
|
|
58
|
+
activate: OperationHandler
|
|
80
59
|
}), AppPlugin.addSchemaModule({
|
|
81
60
|
schema: [
|
|
82
|
-
|
|
61
|
+
WnfsFile.File
|
|
83
62
|
]
|
|
84
63
|
}), AppPlugin.addSurfaceModule({
|
|
85
64
|
activate: ReactSurface
|
|
@@ -94,12 +73,8 @@ var WnfsPlugin = Plugin.define(meta).pipe(AppPlugin.addMetadataModule({
|
|
|
94
73
|
activatesOn: ClientEvents.ClientReady,
|
|
95
74
|
activate: () => Effect.sync(() => {
|
|
96
75
|
const instances = {};
|
|
97
|
-
return
|
|
76
|
+
return Capability.contributes(WnfsCapabilities2.Instances, instances);
|
|
98
77
|
})
|
|
99
|
-
}), Plugin.addModule({
|
|
100
|
-
id: "on-space-created",
|
|
101
|
-
activatesOn: SpaceEvents.SpaceCreated,
|
|
102
|
-
activate: () => Effect.succeed(Capability6.contributes(SpaceCapabilities.OnCreateSpace, (params) => Operation.invoke(WnfsOperation.OnCreateSpace, params)))
|
|
103
78
|
}), Plugin.addModule({
|
|
104
79
|
id: "file-uploader",
|
|
105
80
|
activatesOn: ClientEvents.ClientReady,
|