@dxos/plugin-wnfs 0.8.4-main.fcfe5033a5 → 0.8.4-staging.60fe92afc8
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/LICENSE +102 -5
- package/PLUGIN.mdl +371 -0
- package/README.md +2 -2
- package/dist/lib/neutral/WnfsPlugin.mjs +51 -0
- package/dist/lib/neutral/WnfsPlugin.mjs.map +7 -0
- package/dist/lib/neutral/WnfsPlugin.node.mjs +12 -0
- package/dist/lib/neutral/WnfsPlugin.node.mjs.map +7 -0
- package/dist/lib/neutral/WnfsPlugin.workerd.mjs +12 -0
- package/dist/lib/neutral/WnfsPlugin.workerd.mjs.map +7 -0
- package/dist/lib/neutral/backend-4HPTHS33.mjs +47 -0
- package/dist/lib/neutral/backend-4HPTHS33.mjs.map +7 -0
- package/dist/lib/neutral/blockstore-U6SPNL2C.mjs +190 -0
- package/dist/lib/neutral/blockstore-U6SPNL2C.mjs.map +7 -0
- package/dist/lib/neutral/capabilities/index.mjs +13 -0
- package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/neutral/chunk-KUQHRT52.mjs +39 -0
- package/dist/lib/neutral/chunk-KUQHRT52.mjs.map +7 -0
- package/dist/lib/{browser/chunk-N6Y4QPNF.mjs → neutral/chunk-L33MOD23.mjs} +97 -28
- package/dist/lib/neutral/chunk-L33MOD23.mjs.map +7 -0
- package/dist/lib/neutral/chunk-QODCKFTY.mjs +19 -0
- package/dist/lib/neutral/chunk-QODCKFTY.mjs.map +7 -0
- package/dist/lib/neutral/helpers/index.mjs +26 -0
- package/dist/lib/neutral/helpers/index.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +36 -0
- package/dist/lib/neutral/index.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/neutral/meta.mjs +8 -0
- package/dist/lib/neutral/meta.mjs.map +7 -0
- package/dist/lib/neutral/plugin.mjs +12 -0
- package/dist/lib/neutral/plugin.mjs.map +7 -0
- package/dist/lib/neutral/translations.mjs +17 -0
- package/dist/lib/neutral/translations.mjs.map +7 -0
- package/dist/lib/neutral/types/index.mjs +8 -0
- package/dist/lib/neutral/types/index.mjs.map +7 -0
- package/dist/lib/neutral/url-resolver-BIRH7WHL.mjs +47 -0
- package/dist/lib/neutral/url-resolver-BIRH7WHL.mjs.map +7 -0
- package/dist/types/src/WnfsPlugin.d.ts +1 -0
- package/dist/types/src/WnfsPlugin.d.ts.map +1 -1
- package/dist/types/src/WnfsPlugin.node.d.ts +4 -0
- package/dist/types/src/WnfsPlugin.node.d.ts.map +1 -0
- package/dist/types/src/WnfsPlugin.test.d.ts +2 -0
- package/dist/types/src/WnfsPlugin.test.d.ts.map +1 -0
- package/dist/types/src/WnfsPlugin.workerd.d.ts +4 -0
- package/dist/types/src/WnfsPlugin.workerd.d.ts.map +1 -0
- package/dist/types/src/annotations.d.ts +7 -0
- package/dist/types/src/annotations.d.ts.map +1 -0
- package/dist/types/src/blockstore.d.ts.map +1 -1
- package/dist/types/src/capabilities/backend.d.ts +7 -0
- package/dist/types/src/capabilities/backend.d.ts.map +1 -0
- package/dist/types/src/capabilities/blockstore.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +3 -5
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/url-resolver.d.ts +7 -0
- package/dist/types/src/capabilities/url-resolver.d.ts.map +1 -0
- package/dist/types/src/helpers/common.d.ts.map +1 -1
- package/dist/types/src/helpers/load.d.ts.map +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/index.d.ts +3 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +1 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/plugin.d.ts +3 -0
- package/dist/types/src/plugin.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +2 -16
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/WnfsCapabilities.d.ts +11 -0
- package/dist/types/src/types/WnfsCapabilities.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +1 -3
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +74 -61
- package/src/WnfsPlugin.node.ts +11 -0
- package/src/WnfsPlugin.test.ts +20 -0
- package/src/WnfsPlugin.tsx +16 -40
- package/src/WnfsPlugin.workerd.ts +11 -0
- package/src/annotations.ts +16 -0
- package/src/capabilities/backend.ts +43 -0
- package/src/capabilities/blockstore.ts +1 -1
- package/src/capabilities/index.ts +11 -8
- package/src/capabilities/url-resolver.ts +44 -0
- package/src/helpers/load.ts +32 -18
- package/src/helpers/upload.ts +12 -3
- package/src/index.ts +3 -2
- package/src/meta.ts +22 -6
- package/src/plugin.ts +9 -0
- package/src/translations.ts +1 -14
- package/src/types/WnfsCapabilities.ts +18 -0
- package/src/types/index.ts +1 -3
- package/src/vite-env.d.ts +10 -0
- package/dist/lib/browser/chunk-BM3MEFES.mjs +0 -69
- package/dist/lib/browser/chunk-BM3MEFES.mjs.map +0 -7
- package/dist/lib/browser/chunk-N6Y4QPNF.mjs.map +0 -7
- package/dist/lib/browser/chunk-VXUCZHVZ.mjs +0 -69
- package/dist/lib/browser/chunk-VXUCZHVZ.mjs.map +0 -7
- package/dist/lib/browser/create-NOHKWE67.mjs +0 -24
- package/dist/lib/browser/create-NOHKWE67.mjs.map +0 -7
- package/dist/lib/browser/create-file-N7ADCFOF.mjs +0 -49
- package/dist/lib/browser/create-file-N7ADCFOF.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -117
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/operations/index.mjs +0 -13
- package/dist/lib/browser/operations/index.mjs.map +0 -7
- package/dist/lib/browser/types/index.mjs +0 -11
- package/dist/lib/browser/upload-DA7GBOXF.mjs +0 -42
- package/dist/lib/browser/upload-DA7GBOXF.mjs.map +0 -7
- package/dist/types/src/capabilities/file-uploader.d.ts +0 -6
- package/dist/types/src/capabilities/file-uploader.d.ts.map +0 -1
- package/dist/types/src/capabilities/markdown.d.ts +0 -5
- package/dist/types/src/capabilities/markdown.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-handler.d.ts +0 -6
- package/dist/types/src/capabilities/operation-handler.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface.d.ts +0 -5
- package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
- package/dist/types/src/components/FileInput/FileInput.d.ts +0 -8
- package/dist/types/src/components/FileInput/FileInput.d.ts.map +0 -1
- package/dist/types/src/components/FileInput/index.d.ts +0 -2
- package/dist/types/src/components/FileInput/index.d.ts.map +0 -1
- package/dist/types/src/components/FilePreview/FilePreview.d.ts +0 -12
- package/dist/types/src/components/FilePreview/FilePreview.d.ts.map +0 -1
- package/dist/types/src/components/FilePreview/index.d.ts +0 -2
- package/dist/types/src/components/FilePreview/index.d.ts.map +0 -1
- package/dist/types/src/components/index.d.ts +0 -3
- package/dist/types/src/components/index.d.ts.map +0 -1
- package/dist/types/src/containers/FileContainer/FileContainer.d.ts +0 -7
- package/dist/types/src/containers/FileContainer/FileContainer.d.ts.map +0 -1
- package/dist/types/src/containers/FileContainer/index.d.ts +0 -2
- package/dist/types/src/containers/FileContainer/index.d.ts.map +0 -1
- package/dist/types/src/containers/index.d.ts +0 -3
- package/dist/types/src/containers/index.d.ts.map +0 -1
- package/dist/types/src/extensions/image.d.ts +0 -14
- package/dist/types/src/extensions/image.d.ts.map +0 -1
- package/dist/types/src/extensions/image.stories.d.ts +0 -11
- package/dist/types/src/extensions/image.stories.d.ts.map +0 -1
- package/dist/types/src/extensions/index.d.ts +0 -2
- package/dist/types/src/extensions/index.d.ts.map +0 -1
- package/dist/types/src/operations/create-file.d.ts +0 -5
- package/dist/types/src/operations/create-file.d.ts.map +0 -1
- package/dist/types/src/operations/create.d.ts +0 -5
- package/dist/types/src/operations/create.d.ts.map +0 -1
- package/dist/types/src/operations/definitions.d.ts +0 -38
- package/dist/types/src/operations/definitions.d.ts.map +0 -1
- package/dist/types/src/operations/index.d.ts +0 -4
- package/dist/types/src/operations/index.d.ts.map +0 -1
- package/dist/types/src/operations/upload.d.ts +0 -5
- package/dist/types/src/operations/upload.d.ts.map +0 -1
- package/dist/types/src/types/File.d.ts +0 -16
- package/dist/types/src/types/File.d.ts.map +0 -1
- package/dist/types/src/types/capabilities.d.ts +0 -13
- package/dist/types/src/types/capabilities.d.ts.map +0 -1
- package/dist/types/src/types/types.d.ts +0 -9
- package/dist/types/src/types/types.d.ts.map +0 -1
- package/src/capabilities/file-uploader.ts +0 -34
- package/src/capabilities/markdown.ts +0 -34
- package/src/capabilities/operation-handler.ts +0 -16
- package/src/capabilities/react-surface.tsx +0 -54
- package/src/components/FileInput/FileInput.tsx +0 -47
- package/src/components/FileInput/index.ts +0 -5
- package/src/components/FilePreview/FilePreview.tsx +0 -43
- package/src/components/FilePreview/index.ts +0 -5
- package/src/components/index.ts +0 -6
- package/src/containers/FileContainer/FileContainer.tsx +0 -57
- package/src/containers/FileContainer/index.ts +0 -5
- package/src/containers/index.ts +0 -7
- package/src/extensions/image.stories.tsx +0 -103
- package/src/extensions/image.tsx +0 -204
- package/src/extensions/index.ts +0 -5
- package/src/operations/create-file.ts +0 -31
- package/src/operations/create.ts +0 -22
- package/src/operations/definitions.ts +0 -41
- package/src/operations/index.ts +0 -13
- package/src/operations/upload.ts +0 -29
- package/src/types/File.ts +0 -28
- package/src/types/capabilities.ts +0 -18
- package/src/types/types.ts +0 -24
- /package/dist/lib/{browser/types/index.mjs.map → neutral/chunk-J5LGTIGS.mjs.map} +0 -0
package/src/translations.ts
CHANGED
|
@@ -5,25 +5,12 @@
|
|
|
5
5
|
import { type Resource } from '@dxos/react-ui';
|
|
6
6
|
|
|
7
7
|
import { meta } from '#meta';
|
|
8
|
-
import { WnfsFile } from '#types';
|
|
9
8
|
|
|
10
9
|
export const translations = [
|
|
11
10
|
{
|
|
12
11
|
'en-US': {
|
|
13
|
-
[WnfsFile.File.typename]: {
|
|
14
|
-
'typename.label': 'File',
|
|
15
|
-
'typename.label_zero': 'Files',
|
|
16
|
-
'typename.label_one': 'File',
|
|
17
|
-
'typename.label_other': 'Files',
|
|
18
|
-
'object-name.placeholder': 'New file',
|
|
19
|
-
'add-object.label': 'Add file',
|
|
20
|
-
'rename-object.label': 'Rename file',
|
|
21
|
-
'delete-object.label': 'Delete file',
|
|
22
|
-
'object-deleted.label': 'File deleted',
|
|
23
|
-
},
|
|
24
12
|
[meta.id]: {
|
|
25
|
-
'plugin.name': '
|
|
26
|
-
'file-input.placeholder': 'Drop a file here, or click to select a file',
|
|
13
|
+
'plugin.name': 'WNFS',
|
|
27
14
|
},
|
|
28
15
|
},
|
|
29
16
|
},
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
// @import-as-namespace
|
|
6
|
+
|
|
7
|
+
import { type Blockstore as BlockstoreInterface } from 'interface-blockstore';
|
|
8
|
+
import { type PrivateDirectory, type PrivateForest } from 'wnfs';
|
|
9
|
+
|
|
10
|
+
import { Capability } from '@dxos/app-framework';
|
|
11
|
+
import { type SpaceId } from '@dxos/keys';
|
|
12
|
+
|
|
13
|
+
import { meta } from '#meta';
|
|
14
|
+
|
|
15
|
+
export const Blockstore = Capability.make<BlockstoreInterface>(`${meta.id}.capability.blockstore`);
|
|
16
|
+
|
|
17
|
+
export type Instances = Record<SpaceId, { directory: PrivateDirectory; forest: PrivateForest }>;
|
|
18
|
+
export const Instances = Capability.make<Instances>(`${meta.id}.capability.instances`);
|
package/src/types/index.ts
CHANGED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
File_exports,
|
|
3
|
-
WnfsAction,
|
|
4
|
-
__export
|
|
5
|
-
} from "./chunk-VXUCZHVZ.mjs";
|
|
6
|
-
|
|
7
|
-
// src/operations/definitions.ts
|
|
8
|
-
var definitions_exports = {};
|
|
9
|
-
__export(definitions_exports, {
|
|
10
|
-
Create: () => Create,
|
|
11
|
-
CreateFile: () => CreateFile,
|
|
12
|
-
Upload: () => Upload
|
|
13
|
-
});
|
|
14
|
-
import * as Schema from "effect/Schema";
|
|
15
|
-
import { Capability } from "@dxos/app-framework";
|
|
16
|
-
import { FileInfoSchema } from "@dxos/app-toolkit";
|
|
17
|
-
import { Database } from "@dxos/echo";
|
|
18
|
-
import { Operation } from "@dxos/operation";
|
|
19
|
-
import { meta } from "#meta";
|
|
20
|
-
var WNFS_OPERATION = `${meta.id}.operation`;
|
|
21
|
-
var Create = Operation.make({
|
|
22
|
-
meta: {
|
|
23
|
-
key: `${WNFS_OPERATION}.create`,
|
|
24
|
-
name: "Create WNFS File"
|
|
25
|
-
},
|
|
26
|
-
services: [
|
|
27
|
-
Capability.Service
|
|
28
|
-
],
|
|
29
|
-
input: FileInfoSchema.pick("name", "type", "cid").pipe(Schema.required),
|
|
30
|
-
output: Schema.Struct({
|
|
31
|
-
object: File_exports.File
|
|
32
|
-
})
|
|
33
|
-
});
|
|
34
|
-
var Upload = Operation.make({
|
|
35
|
-
meta: {
|
|
36
|
-
key: `${WNFS_OPERATION}.upload`,
|
|
37
|
-
name: "Upload File"
|
|
38
|
-
},
|
|
39
|
-
services: [
|
|
40
|
-
Capability.Service
|
|
41
|
-
],
|
|
42
|
-
input: Schema.extend(WnfsAction.UploadFileSchema, Schema.Struct({
|
|
43
|
-
db: Database.Database
|
|
44
|
-
})),
|
|
45
|
-
output: Schema.required(FileInfoSchema)
|
|
46
|
-
});
|
|
47
|
-
var CreateFile = Operation.make({
|
|
48
|
-
meta: {
|
|
49
|
-
key: `${WNFS_OPERATION}.create-file`,
|
|
50
|
-
name: "Create File"
|
|
51
|
-
},
|
|
52
|
-
services: [
|
|
53
|
-
Capability.Service
|
|
54
|
-
],
|
|
55
|
-
input: Schema.extend(WnfsAction.UploadFileSchema, Schema.Struct({
|
|
56
|
-
db: Database.Database
|
|
57
|
-
})),
|
|
58
|
-
output: Schema.Struct({
|
|
59
|
-
object: File_exports.File
|
|
60
|
-
})
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
export {
|
|
64
|
-
Create,
|
|
65
|
-
Upload,
|
|
66
|
-
CreateFile,
|
|
67
|
-
definitions_exports
|
|
68
|
-
};
|
|
69
|
-
//# sourceMappingURL=chunk-BM3MEFES.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
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 { Database } from '@dxos/echo';\nimport { Operation } from '@dxos/operation';\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,gBAAgB;AACzB,SAASC,iBAAiB;AAE1B,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", "Database", "Operation", "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
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/helpers/upload.ts", "../../../src/helpers/common.ts", "../../../src/helpers/load.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';\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.change(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 { 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.change(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.change(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 { 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": ";AAKA,SAASA,OAAAA,YAAW;AACpB,YAAYC,SAAS;AACrB,SAASC,UAAAA,eAAc;AAGvB,SAASC,OAAAA,YAAW;AACpB,SAASC,WAAW;;;ACNpB,SAASC,WAAW;AACpB,SAASC,cAAc;AAGvB,YAAYC,YAAY;AAOjB,IAAMC,WAAW,CAACC,UAAkBC,UAAAA;AACzC,SAAO;IAAC;IAAUA,MAAMC;IAAI;IAASF;;AACvC;AAMO,IAAMG,MAAN,MAAMA;EACXC,YAAYC,OAA2B;AACrC,WAAO,IAAIC,WAAkBF,mBAAYC,KAAAA,CAAAA;EAC3C;AACF;AAMO,IAAME,QAAQ,CAACC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", "fileName", "space", "id", "Rng", "randomBytes", "count", "Uint8Array", "store", "blockstore", "getBlock", "cid", "decodedCid", "CID", "decode", "get", "hasBlock", "has", "putBlockKeyed", "bytes", "put", "putBlock", "codec", "hash", "sha256", "digest", "create", "CID", "Uint8Arrays", "AccessKey", "PrivateDirectory", "PrivateForest", "PrivateNode", "Obj", "loadWnfs", "space", "blockstore", "instances", "properties", "wnfs_access_key", "undefined", "wnfs_private_forest_cid", "Obj", "change", "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", "wnfsUrl", "filePath", "map", "f", "encodeURIComponent", "join", "upload", "file", "blockstore", "instances", "space", "directory", "forest", "loadWnfs", "wnfsStore", "store", "bytes", "Uint8Array", "arrayBuffer", "hash", "sha256", "digest", "cid", "CID", "create", "code", "path", "filePath", "toString", "result", "write", "Date", "Rng", "_", "updatedForest", "rootDir", "cidBytes", "Obj", "change", "properties", "obj", "wnfs", "privateForestCid", "decode", "info", "name", "type", "url", "wnfsUrl", "log"]
|
|
7
|
-
}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __export = (target, all) => {
|
|
3
|
-
for (var name in all)
|
|
4
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
// src/types/capabilities.ts
|
|
8
|
-
import { Capability } from "@dxos/app-framework";
|
|
9
|
-
import { meta } from "#meta";
|
|
10
|
-
(function(WnfsCapabilities2) {
|
|
11
|
-
WnfsCapabilities2.Blockstore = Capability.make(`${meta.id}.capability.blockstore`);
|
|
12
|
-
WnfsCapabilities2.Instances = Capability.make(`${meta.id}.capability.instances`);
|
|
13
|
-
})(WnfsCapabilities || (WnfsCapabilities = {}));
|
|
14
|
-
var WnfsCapabilities;
|
|
15
|
-
|
|
16
|
-
// src/types/File.ts
|
|
17
|
-
var File_exports = {};
|
|
18
|
-
__export(File_exports, {
|
|
19
|
-
File: () => File2,
|
|
20
|
-
make: () => make
|
|
21
|
-
});
|
|
22
|
-
import * as Schema from "effect/Schema";
|
|
23
|
-
import { Annotation, Obj, Type } from "@dxos/echo";
|
|
24
|
-
import { FormInputAnnotation } from "@dxos/echo/internal";
|
|
25
|
-
var File2 = Schema.Struct({
|
|
26
|
-
name: Schema.String.pipe(Schema.optional),
|
|
27
|
-
type: Schema.String.pipe(FormInputAnnotation.set(false)),
|
|
28
|
-
cid: Schema.String.pipe(FormInputAnnotation.set(false)),
|
|
29
|
-
timestamp: Schema.String.pipe(FormInputAnnotation.set(false), Schema.optional)
|
|
30
|
-
}).pipe(Type.object({
|
|
31
|
-
typename: "org.dxos.type.file",
|
|
32
|
-
version: "0.1.0"
|
|
33
|
-
}), Annotation.IconAnnotation.set({
|
|
34
|
-
icon: "ph--file--regular",
|
|
35
|
-
hue: "teal"
|
|
36
|
-
}));
|
|
37
|
-
var make = (props) => Obj.make(File2, props);
|
|
38
|
-
|
|
39
|
-
// src/types/types.ts
|
|
40
|
-
import * as Schema2 from "effect/Schema";
|
|
41
|
-
import { meta as meta2 } from "#meta";
|
|
42
|
-
(function(WnfsAction2) {
|
|
43
|
-
WnfsAction2.UploadAnnotationId = /* @__PURE__ */ Symbol.for(`${meta2.id}.annotation.upload`);
|
|
44
|
-
WnfsAction2.UploadFileSchema = Schema2.Struct({
|
|
45
|
-
file: Schema2.instanceOf(File).annotations({
|
|
46
|
-
[WnfsAction2.UploadAnnotationId]: {
|
|
47
|
-
// Accept file types.
|
|
48
|
-
"image/*": [
|
|
49
|
-
".jpg",
|
|
50
|
-
".jpeg",
|
|
51
|
-
".png",
|
|
52
|
-
".gif"
|
|
53
|
-
],
|
|
54
|
-
"application/pdf": [
|
|
55
|
-
".pdf"
|
|
56
|
-
]
|
|
57
|
-
}
|
|
58
|
-
})
|
|
59
|
-
});
|
|
60
|
-
})(WnfsAction || (WnfsAction = {}));
|
|
61
|
-
var WnfsAction;
|
|
62
|
-
|
|
63
|
-
export {
|
|
64
|
-
__export,
|
|
65
|
-
WnfsCapabilities,
|
|
66
|
-
File_exports,
|
|
67
|
-
WnfsAction
|
|
68
|
-
};
|
|
69
|
-
//# sourceMappingURL=chunk-VXUCZHVZ.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
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,aAAaC,WAAWC,KAAiB,GAAGC,KAAKC,EAAE,wBAAwB;oBAG3EC,YAAYJ,WAAWC,KAAgB,GAAGC,KAAKC,EAAE,uBAAuB;AACvF,GALiBL,qBAAAA,mBAAAA,CAAAA,EAAAA;;;;ACZjB;;cAAAO;EAAA;;AAIA,YAAYC,YAAY;AAExB,SAASC,YAAYC,KAAKC,YAAY;AACtC,SAASC,2BAA2B;AAE7B,IAAMC,QAAcC,cAAO;EAChCC,MAAaC,cAAOC,KAAYC,eAAQ;EACxCC,MAAaH,cAAOC,KAAKG,oBAAoBC,IAAI,KAAA,CAAA;EACjDC,KAAYN,cAAOC,KAAKG,oBAAoBC,IAAI,KAAA,CAAA;EAChDE,WAAkBP,cAAOC,KAAKG,oBAAoBC,IAAI,KAAA,GAAeH,eAAQ;AAC/E,CAAA,EAAGD,KACDO,KAAKC,OAAO;EACVC,UAAU;EACVC,SAAS;AACX,CAAA,GACAC,WAAWC,eAAeR,IAAI;EAC5BS,MAAM;EACNC,KAAK;AACP,CAAA,CAAA;AAKK,IAAMC,OAAO,CAACC,UAAsCC,IAAIF,KAAKnB,OAAMoB,KAAAA;;;ACvB1E,YAAYE,aAAY;AAExB,SAASC,QAAAA,aAAY;UAEJC,aAAAA;cACFC,qBAAqBC,uBAAOC,IAAI,GAAGC,MAAKC,EAAE,oBAAoB;cAE9DC,mBAA0BC,eAAO;IAC5CC,MAAaC,mBAAWC,IAAAA,EAAMC,YAAY;MACxC,CAAAX,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", "Capability", "make", "meta", "id", "Instances", "File", "Schema", "Annotation", "Obj", "Type", "FormInputAnnotation", "File", "Struct", "name", "String", "pipe", "optional", "type", "FormInputAnnotation", "set", "cid", "timestamp", "Type", "object", "typename", "version", "Annotation", "IconAnnotation", "icon", "hue", "make", "props", "Obj", "Schema", "meta", "WnfsAction", "UploadAnnotationId", "Symbol", "for", "meta", "id", "UploadFileSchema", "Struct", "file", "instanceOf", "File", "annotations"]
|
|
7
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Create
|
|
3
|
-
} from "./chunk-BM3MEFES.mjs";
|
|
4
|
-
import {
|
|
5
|
-
File_exports
|
|
6
|
-
} from "./chunk-VXUCZHVZ.mjs";
|
|
7
|
-
|
|
8
|
-
// src/operations/create.ts
|
|
9
|
-
import * as Effect from "effect/Effect";
|
|
10
|
-
import { Operation } from "@dxos/operation";
|
|
11
|
-
var handler = Create.pipe(Operation.withHandler(Effect.fnUntraced(function* ({ name, type, cid }) {
|
|
12
|
-
return {
|
|
13
|
-
object: File_exports.make({
|
|
14
|
-
name,
|
|
15
|
-
type,
|
|
16
|
-
cid
|
|
17
|
-
})
|
|
18
|
-
};
|
|
19
|
-
})));
|
|
20
|
-
var create_default = handler;
|
|
21
|
-
export {
|
|
22
|
-
create_default as default
|
|
23
|
-
};
|
|
24
|
-
//# sourceMappingURL=create-NOHKWE67.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
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/operation';\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
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
upload
|
|
3
|
-
} from "./chunk-N6Y4QPNF.mjs";
|
|
4
|
-
import {
|
|
5
|
-
CreateFile
|
|
6
|
-
} from "./chunk-BM3MEFES.mjs";
|
|
7
|
-
import {
|
|
8
|
-
File_exports,
|
|
9
|
-
WnfsCapabilities
|
|
10
|
-
} from "./chunk-VXUCZHVZ.mjs";
|
|
11
|
-
|
|
12
|
-
// src/operations/create-file.ts
|
|
13
|
-
import * as Effect from "effect/Effect";
|
|
14
|
-
import { Capability } from "@dxos/app-framework";
|
|
15
|
-
import { invariant } from "@dxos/invariant";
|
|
16
|
-
import { Operation } from "@dxos/operation";
|
|
17
|
-
import { ClientCapabilities } from "@dxos/plugin-client/types";
|
|
18
|
-
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-wnfs/src/operations/create-file.ts";
|
|
19
|
-
var handler = CreateFile.pipe(Operation.withHandler(Effect.fnUntraced(function* ({ file, db }) {
|
|
20
|
-
const client = yield* Capability.get(ClientCapabilities.Client);
|
|
21
|
-
const blockstore = yield* Capability.get(WnfsCapabilities.Blockstore);
|
|
22
|
-
const space = client.spaces.get(db.spaceId);
|
|
23
|
-
invariant(space, "Space not found", {
|
|
24
|
-
F: __dxlog_file,
|
|
25
|
-
L: 22,
|
|
26
|
-
S: this,
|
|
27
|
-
A: [
|
|
28
|
-
"space",
|
|
29
|
-
"'Space not found'"
|
|
30
|
-
]
|
|
31
|
-
});
|
|
32
|
-
const info = yield* Effect.promise(() => upload({
|
|
33
|
-
file,
|
|
34
|
-
blockstore,
|
|
35
|
-
space
|
|
36
|
-
}));
|
|
37
|
-
return {
|
|
38
|
-
object: File_exports.make({
|
|
39
|
-
name: info.name,
|
|
40
|
-
type: info.type,
|
|
41
|
-
cid: info.cid
|
|
42
|
-
})
|
|
43
|
-
};
|
|
44
|
-
})));
|
|
45
|
-
var create_file_default = handler;
|
|
46
|
-
export {
|
|
47
|
-
create_file_default as default
|
|
48
|
-
};
|
|
49
|
-
//# sourceMappingURL=create-file-N7ADCFOF.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
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 { invariant } from '@dxos/invariant';\nimport { Operation } from '@dxos/operation';\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,IAAMC,UAAoDC,WAAWC,KACnEC,UAAUC,YACDC,kBAAW,WAAW,EAAEC,MAAMC,GAAE,GAAE;AACvC,QAAMC,SAAS,OAAOC,WAAWC,IAAIC,mBAAmBC,MAAM;AAC9D,QAAMC,aAAa,OAAOJ,WAAWC,IAAII,iBAAiBC,UAAU;AACpE,QAAMC,QAAQR,OAAOS,OAAOP,IAAIH,GAAGW,OAAO;AAC1CC,YAAUH,OAAO,mBAAA;;;;;;;;;AACjB,QAAMI,OAAO,OAAcC,eAAQ,MAAMC,OAAO;IAAEhB;IAAMO;IAAYG;EAAM,CAAA,CAAA;AAC1E,SAAO;IACLO,QAAQC,aAASC,KAAK;MAAEC,MAAMN,KAAKM;MAAMC,MAAMP,KAAKO;MAAMC,KAAKR,KAAKQ;IAAI,CAAA;EAC1E;AACF,CAAA,CAAA,CAAA;AAIJ,IAAA,sBAAe5B;",
|
|
6
|
-
"names": ["Effect", "Capability", "invariant", "Operation", "ClientCapabilities", "handler", "CreateFile", "pipe", "Operation", "withHandler", "fnUntraced", "file", "db", "client", "Capability", "get", "ClientCapabilities", "Client", "blockstore", "WnfsCapabilities", "Blockstore", "space", "spaces", "spaceId", "invariant", "info", "promise", "upload", "object", "WnfsFile", "make", "name", "type", "cid"]
|
|
7
|
-
}
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
WnfsCapabilities
|
|
3
|
-
} from "./chunk-VXUCZHVZ.mjs";
|
|
4
|
-
|
|
5
|
-
// src/meta.ts
|
|
6
|
-
import { trim } from "@dxos/util";
|
|
7
|
-
var meta = {
|
|
8
|
-
id: "org.dxos.plugin.wnfs",
|
|
9
|
-
name: "WNFS",
|
|
10
|
-
description: trim`
|
|
11
|
-
Decentralized file storage using the Web Native File System protocol.
|
|
12
|
-
Store and sync files with end-to-end encryption across devices without central servers.
|
|
13
|
-
`,
|
|
14
|
-
icon: "ph--file-cloud--regular",
|
|
15
|
-
iconHue: "teal",
|
|
16
|
-
source: "https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-wnfs"
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
// src/WnfsPlugin.tsx
|
|
20
|
-
import * as Effect from "effect/Effect";
|
|
21
|
-
import * as Option from "effect/Option";
|
|
22
|
-
import { Capability, Plugin } from "@dxos/app-framework";
|
|
23
|
-
import { AppPlugin } from "@dxos/app-toolkit";
|
|
24
|
-
import { Annotation } from "@dxos/echo";
|
|
25
|
-
import { Operation } from "@dxos/operation";
|
|
26
|
-
import { ClientEvents } from "@dxos/plugin-client/types";
|
|
27
|
-
import { MarkdownEvents } from "@dxos/plugin-markdown";
|
|
28
|
-
import { SpaceOperation } from "@dxos/plugin-space/operations";
|
|
29
|
-
import { Blockstore, FileUploader, Markdown, OperationHandler, ReactSurface } from "#capabilities";
|
|
30
|
-
import { meta as meta3 } from "#meta";
|
|
31
|
-
import { WnfsOperation } from "#operations";
|
|
32
|
-
import { WnfsAction, WnfsCapabilities as WnfsCapabilities2, WnfsFile as WnfsFile2 } from "#types";
|
|
33
|
-
|
|
34
|
-
// src/translations.ts
|
|
35
|
-
import { meta as meta2 } from "#meta";
|
|
36
|
-
import { WnfsFile } from "#types";
|
|
37
|
-
var translations = [
|
|
38
|
-
{
|
|
39
|
-
"en-US": {
|
|
40
|
-
[WnfsFile.File.typename]: {
|
|
41
|
-
"typename.label": "File",
|
|
42
|
-
"typename.label_zero": "Files",
|
|
43
|
-
"typename.label_one": "File",
|
|
44
|
-
"typename.label_other": "Files",
|
|
45
|
-
"object-name.placeholder": "New file",
|
|
46
|
-
"add-object.label": "Add file",
|
|
47
|
-
"rename-object.label": "Rename file",
|
|
48
|
-
"delete-object.label": "Delete file",
|
|
49
|
-
"object-deleted.label": "File deleted"
|
|
50
|
-
},
|
|
51
|
-
[meta2.id]: {
|
|
52
|
-
"plugin.name": "Files",
|
|
53
|
-
"file-input.placeholder": "Drop a file here, or click to select a file"
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
];
|
|
58
|
-
|
|
59
|
-
// src/WnfsPlugin.tsx
|
|
60
|
-
var WnfsPlugin = Plugin.define(meta3).pipe(AppPlugin.addMetadataModule({
|
|
61
|
-
metadata: {
|
|
62
|
-
id: WnfsFile2.File.typename,
|
|
63
|
-
metadata: {
|
|
64
|
-
// TODO(wittjosiah): Would be nice if icon could change based on the type of the file.
|
|
65
|
-
icon: Annotation.IconAnnotation.get(WnfsFile2.File).pipe(Option.getOrThrow).icon,
|
|
66
|
-
iconHue: Annotation.IconAnnotation.get(WnfsFile2.File).pipe(Option.getOrThrow).hue ?? "white",
|
|
67
|
-
inputSchema: WnfsAction.UploadFileSchema,
|
|
68
|
-
createObject: (props, options) => Effect.gen(function* () {
|
|
69
|
-
const { object } = yield* Operation.invoke(WnfsOperation.CreateFile, {
|
|
70
|
-
...props,
|
|
71
|
-
db: options.db
|
|
72
|
-
});
|
|
73
|
-
return yield* Operation.invoke(SpaceOperation.AddObject, {
|
|
74
|
-
object,
|
|
75
|
-
target: options.target,
|
|
76
|
-
hidden: true,
|
|
77
|
-
targetNodeId: options.targetNodeId
|
|
78
|
-
});
|
|
79
|
-
})
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}), AppPlugin.addOperationHandlerModule({
|
|
83
|
-
activate: OperationHandler
|
|
84
|
-
}), AppPlugin.addSchemaModule({
|
|
85
|
-
schema: [
|
|
86
|
-
WnfsFile2.File
|
|
87
|
-
]
|
|
88
|
-
}), AppPlugin.addSurfaceModule({
|
|
89
|
-
activate: ReactSurface
|
|
90
|
-
}), AppPlugin.addTranslationsModule({
|
|
91
|
-
translations
|
|
92
|
-
}), Plugin.addModule({
|
|
93
|
-
id: "blockstore",
|
|
94
|
-
activatesOn: ClientEvents.ClientReady,
|
|
95
|
-
activate: Blockstore
|
|
96
|
-
}), Plugin.addModule({
|
|
97
|
-
id: "instances",
|
|
98
|
-
activatesOn: ClientEvents.ClientReady,
|
|
99
|
-
activate: () => Effect.sync(() => {
|
|
100
|
-
const instances = {};
|
|
101
|
-
return Capability.contributes(WnfsCapabilities2.Instances, instances);
|
|
102
|
-
})
|
|
103
|
-
}), Plugin.addModule({
|
|
104
|
-
id: "file-uploader",
|
|
105
|
-
activatesOn: ClientEvents.ClientReady,
|
|
106
|
-
activate: FileUploader
|
|
107
|
-
}), Plugin.addModule({
|
|
108
|
-
id: "markdown",
|
|
109
|
-
activatesOn: MarkdownEvents.SetupExtensions,
|
|
110
|
-
activate: Markdown
|
|
111
|
-
}), Plugin.make);
|
|
112
|
-
export {
|
|
113
|
-
WnfsCapabilities,
|
|
114
|
-
WnfsPlugin,
|
|
115
|
-
meta
|
|
116
|
-
};
|
|
117
|
-
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/meta.ts", "../../../src/WnfsPlugin.tsx", "../../../src/translations.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Plugin } from '@dxos/app-framework';\nimport { trim } from '@dxos/util';\n\nexport const meta: Plugin.Meta = {\n id: 'org.dxos.plugin.wnfs',\n name: 'WNFS',\n description: trim`\n Decentralized file storage using the Web Native File System protocol.\n Store and sync files with end-to-end encryption across devices without central servers.\n `,\n icon: 'ph--file-cloud--regular',\n iconHue: 'teal',\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-wnfs',\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport * as Option from 'effect/Option';\n\nimport { Capability, Plugin } from '@dxos/app-framework';\nimport { AppPlugin } from '@dxos/app-toolkit';\nimport { Annotation } from '@dxos/echo';\nimport { Operation } from '@dxos/operation';\nimport { ClientEvents } from '@dxos/plugin-client/types';\nimport { MarkdownEvents } from '@dxos/plugin-markdown';\nimport { SpaceOperation } from '@dxos/plugin-space/operations';\nimport { type CreateObject } from '@dxos/plugin-space/types';\n\nimport { Blockstore, FileUploader, Markdown, OperationHandler, ReactSurface } from '#capabilities';\nimport { meta } from '#meta';\nimport { WnfsOperation } from '#operations';\nimport { WnfsAction, WnfsCapabilities, WnfsFile } from '#types';\n\nimport { translations } from './translations';\n\nexport const WnfsPlugin = Plugin.define(meta).pipe(\n AppPlugin.addMetadataModule({\n metadata: {\n id: WnfsFile.File.typename,\n metadata: {\n // TODO(wittjosiah): Would be nice if icon could change based on the type of the file.\n icon: Annotation.IconAnnotation.get(WnfsFile.File).pipe(Option.getOrThrow).icon,\n iconHue: Annotation.IconAnnotation.get(WnfsFile.File).pipe(Option.getOrThrow).hue ?? 'white',\n inputSchema: WnfsAction.UploadFileSchema,\n createObject: ((props, options) =>\n Effect.gen(function* () {\n const { object } = yield* Operation.invoke(WnfsOperation.CreateFile, { ...props, db: options.db });\n return yield* Operation.invoke(SpaceOperation.AddObject, {\n object,\n target: options.target,\n hidden: true,\n targetNodeId: options.targetNodeId,\n });\n })) satisfies CreateObject,\n },\n },\n }),\n AppPlugin.addOperationHandlerModule({ activate: OperationHandler }),\n AppPlugin.addSchemaModule({ schema: [WnfsFile.File] }),\n AppPlugin.addSurfaceModule({ activate: ReactSurface }),\n AppPlugin.addTranslationsModule({ translations }),\n Plugin.addModule({\n id: 'blockstore',\n activatesOn: ClientEvents.ClientReady,\n activate: Blockstore,\n }),\n Plugin.addModule({\n id: 'instances',\n activatesOn: ClientEvents.ClientReady,\n activate: () =>\n Effect.sync(() => {\n const instances: WnfsCapabilities.Instances = {};\n return Capability.contributes(WnfsCapabilities.Instances, instances);\n }),\n }),\n Plugin.addModule({\n id: 'file-uploader',\n activatesOn: ClientEvents.ClientReady,\n activate: FileUploader,\n }),\n Plugin.addModule({\n id: 'markdown',\n activatesOn: MarkdownEvents.SetupExtensions,\n activate: Markdown,\n }),\n Plugin.make,\n);\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Resource } from '@dxos/react-ui';\n\nimport { meta } from '#meta';\nimport { WnfsFile } from '#types';\n\nexport const translations = [\n {\n 'en-US': {\n [WnfsFile.File.typename]: {\n 'typename.label': 'File',\n 'typename.label_zero': 'Files',\n 'typename.label_one': 'File',\n 'typename.label_other': 'Files',\n 'object-name.placeholder': 'New file',\n 'add-object.label': 'Add file',\n 'rename-object.label': 'Rename file',\n 'delete-object.label': 'Delete file',\n 'object-deleted.label': 'File deleted',\n },\n [meta.id]: {\n 'plugin.name': 'Files',\n 'file-input.placeholder': 'Drop a file here, or click to select a file',\n },\n },\n },\n] as const satisfies Resource[];\n"],
|
|
5
|
-
"mappings": ";;;;;AAKA,SAASA,YAAY;AAEd,IAAMC,OAAoB;EAC/BC,IAAI;EACJC,MAAM;EACNC,aAAaC;;;;EAIbC,MAAM;EACNC,SAAS;EACTC,QAAQ;AACV;;;ACbA,YAAYC,YAAY;AACxB,YAAYC,YAAY;AAExB,SAASC,YAAYC,cAAc;AACnC,SAASC,iBAAiB;AAC1B,SAASC,kBAAkB;AAC3B,SAASC,iBAAiB;AAC1B,SAASC,oBAAoB;AAC7B,SAASC,sBAAsB;AAC/B,SAASC,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AAM,CAAA,GACpDL,UAAUqC,iBAAiB;EAAEJ,UAAUK;AAAa,CAAA,GACpDtC,UAAUuC,sBAAsB;EAAEC;AAAa,CAAA,GAC/C5C,OAAO6C,UAAU;EACftC,IAAI;EACJuC,aAAaC,aAAaC;EAC1BX,UAAUY;AACZ,CAAA,GACAjD,OAAO6C,UAAU;EACftC,IAAI;EACJuC,aAAaC,aAAaC;EAC1BX,UAAU,MACDa,YAAK,MAAA;AACV,UAAMC,YAAwC,CAAC;AAC/C,WAAOC,WAAWC,YAAYC,kBAAiBC,WAAWJ,SAAAA;EAC5D,CAAA;AACJ,CAAA,GACAnD,OAAO6C,UAAU;EACftC,IAAI;EACJuC,aAAaC,aAAaC;EAC1BX,UAAUmB;AACZ,CAAA,GACAxD,OAAO6C,UAAU;EACftC,IAAI;EACJuC,aAAaW,eAAeC;EAC5BrB,UAAUsB;AACZ,CAAA,GACA3D,OAAO4D,IAAI;",
|
|
6
|
-
"names": ["trim", "meta", "id", "name", "description", "trim", "icon", "iconHue", "source", "Effect", "Option", "Capability", "Plugin", "AppPlugin", "Annotation", "Operation", "ClientEvents", "MarkdownEvents", "SpaceOperation", "Blockstore", "FileUploader", "Markdown", "OperationHandler", "ReactSurface", "meta", "WnfsOperation", "WnfsAction", "WnfsCapabilities", "WnfsFile", "meta", "WnfsFile", "translations", "WnfsFile", "File", "typename", "meta", "id", "WnfsPlugin", "Plugin", "define", "meta", "pipe", "AppPlugin", "addMetadataModule", "metadata", "id", "WnfsFile", "File", "typename", "icon", "Annotation", "IconAnnotation", "get", "getOrThrow", "iconHue", "hue", "inputSchema", "WnfsAction", "UploadFileSchema", "createObject", "props", "options", "gen", "object", "Operation", "invoke", "WnfsOperation", "CreateFile", "db", "SpaceOperation", "AddObject", "target", "hidden", "targetNodeId", "addOperationHandlerModule", "activate", "OperationHandler", "addSchemaModule", "schema", "addSurfaceModule", "ReactSurface", "addTranslationsModule", "translations", "addModule", "activatesOn", "ClientEvents", "ClientReady", "Blockstore", "sync", "instances", "Capability", "contributes", "WnfsCapabilities", "Instances", "FileUploader", "MarkdownEvents", "SetupExtensions", "Markdown", "make"]
|
|
7
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"inputs":{"src/types/capabilities.ts":{"bytes":1908,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"#meta","kind":"import-statement","external":true}],"format":"esm"},"src/types/File.ts":{"bytes":3136,"imports":[{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo/internal","kind":"import-statement","external":true}],"format":"esm"},"src/types/types.ts":{"bytes":2514,"imports":[{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"#meta","kind":"import-statement","external":true}],"format":"esm"},"src/types/index.ts":{"bytes":698,"imports":[{"path":"src/types/capabilities.ts","kind":"import-statement","original":"./capabilities"},{"path":"src/types/File.ts","kind":"import-statement","original":"./File"},{"path":"src/types/types.ts","kind":"import-statement","original":"./types"}],"format":"esm"},"src/meta.ts":{"bytes":1782,"imports":[{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"src/translations.ts":{"bytes":2802,"imports":[{"path":"#meta","kind":"import-statement","external":true},{"path":"#types","kind":"import-statement","external":true}],"format":"esm"},"src/WnfsPlugin.tsx":{"bytes":10192,"imports":[{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Option","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-toolkit","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/operation","kind":"import-statement","external":true},{"path":"@dxos/plugin-client/types","kind":"import-statement","external":true},{"path":"@dxos/plugin-markdown","kind":"import-statement","external":true},{"path":"@dxos/plugin-space/operations","kind":"import-statement","external":true},{"path":"#capabilities","kind":"import-statement","external":true},{"path":"#meta","kind":"import-statement","external":true},{"path":"#operations","kind":"import-statement","external":true},{"path":"#types","kind":"import-statement","external":true},{"path":"src/translations.ts","kind":"import-statement","original":"./translations"}],"format":"esm"},"src/index.ts":{"bytes":705,"imports":[{"path":"src/types/index.ts","kind":"import-statement","original":"./types"},{"path":"src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"src/WnfsPlugin.tsx","kind":"import-statement","original":"./WnfsPlugin"}],"format":"esm"},"src/operations/definitions.ts":{"bytes":5331,"imports":[{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-toolkit","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/operation","kind":"import-statement","external":true},{"path":"#meta","kind":"import-statement","external":true},{"path":"src/types/index.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"src/operations/create.ts":{"bytes":1964,"imports":[{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"@dxos/operation","kind":"import-statement","external":true},{"path":"src/types/index.ts","kind":"import-statement","original":"../types"},{"path":"src/operations/definitions.ts","kind":"import-statement","original":"./definitions"}],"format":"esm"},"src/helpers/common.ts":{"bytes":7602,"imports":[{"path":"multiformats/cid","kind":"import-statement","external":true},{"path":"multiformats/hashes/sha2","kind":"import-statement","external":true},{"path":"@dxos/crypto","kind":"import-statement","external":true}],"format":"esm"},"src/helpers/load.ts":{"bytes":9373,"imports":[{"path":"multiformats","kind":"import-statement","external":true},{"path":"uint8arrays","kind":"import-statement","external":true},{"path":"wnfs","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"src/helpers/common.ts","kind":"import-statement","original":"./common"}],"format":"esm"},"src/helpers/wnfs-url.ts":{"bytes":3325,"imports":[{"path":"src/helpers/common.ts","kind":"import-statement","original":"./common"}],"format":"esm"},"src/helpers/upload.ts":{"bytes":6966,"imports":[{"path":"multiformats","kind":"import-statement","external":true},{"path":"multiformats/codecs/raw","kind":"import-statement","external":true},{"path":"multiformats/hashes/sha2","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"src/helpers/common.ts","kind":"import-statement","original":"./common"},{"path":"src/helpers/load.ts","kind":"import-statement","original":"./load"},{"path":"src/helpers/wnfs-url.ts","kind":"import-statement","original":"./wnfs-url"}],"format":"esm"},"src/helpers/index.ts":{"bytes":711,"imports":[{"path":"src/helpers/common.ts","kind":"import-statement","original":"./common"},{"path":"src/helpers/load.ts","kind":"import-statement","original":"./load"},{"path":"src/helpers/upload.ts","kind":"import-statement","original":"./upload"},{"path":"src/helpers/wnfs-url.ts","kind":"import-statement","original":"./wnfs-url"}],"format":"esm"},"src/operations/create-file.ts":{"bytes":4341,"imports":[{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/operation","kind":"import-statement","external":true},{"path":"@dxos/plugin-client/types","kind":"import-statement","external":true},{"path":"src/helpers/index.ts","kind":"import-statement","original":"../helpers"},{"path":"src/types/index.ts","kind":"import-statement","original":"../types"},{"path":"src/operations/definitions.ts","kind":"import-statement","original":"./definitions"}],"format":"esm"},"src/operations/upload.ts":{"bytes":3800,"imports":[{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/operation","kind":"import-statement","external":true},{"path":"@dxos/plugin-client/types","kind":"import-statement","external":true},{"path":"src/helpers/index.ts","kind":"import-statement","original":"../helpers"},{"path":"src/types/index.ts","kind":"import-statement","original":"../types"},{"path":"src/operations/definitions.ts","kind":"import-statement","original":"./definitions"}],"format":"esm"},"src/operations/index.ts":{"bytes":1307,"imports":[{"path":"@dxos/operation","kind":"import-statement","external":true},{"path":"src/operations/definitions.ts","kind":"import-statement","original":"./definitions"},{"path":"src/operations/create.ts","kind":"dynamic-import","original":"./create"},{"path":"src/operations/create-file.ts","kind":"dynamic-import","original":"./create-file"},{"path":"src/operations/upload.ts","kind":"dynamic-import","original":"./upload"}],"format":"esm"}},"outputs":{"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":7483},"dist/lib/browser/index.mjs":{"imports":[{"path":"dist/lib/browser/chunk-VXUCZHVZ.mjs","kind":"import-statement"},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Option","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-toolkit","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/operation","kind":"import-statement","external":true},{"path":"@dxos/plugin-client/types","kind":"import-statement","external":true},{"path":"@dxos/plugin-markdown","kind":"import-statement","external":true},{"path":"@dxos/plugin-space/operations","kind":"import-statement","external":true},{"path":"#capabilities","kind":"import-statement","external":true},{"path":"#meta","kind":"import-statement","external":true},{"path":"#operations","kind":"import-statement","external":true},{"path":"#types","kind":"import-statement","external":true},{"path":"#meta","kind":"import-statement","external":true},{"path":"#types","kind":"import-statement","external":true}],"exports":["WnfsCapabilities","WnfsPlugin","meta"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":0},"src/meta.ts":{"bytesInOutput":423},"src/WnfsPlugin.tsx":{"bytesInOutput":2443},"src/translations.ts":{"bytesInOutput":689}},"bytes":3788},"dist/lib/browser/types/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/lib/browser/types/index.mjs":{"imports":[{"path":"dist/lib/browser/chunk-VXUCZHVZ.mjs","kind":"import-statement"}],"exports":["WnfsAction","WnfsCapabilities","WnfsFile"],"entryPoint":"src/types/index.ts","inputs":{},"bytes":198},"dist/lib/browser/operations/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":641},"dist/lib/browser/operations/index.mjs":{"imports":[{"path":"dist/lib/browser/chunk-BM3MEFES.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-VXUCZHVZ.mjs","kind":"import-statement"},{"path":"@dxos/operation","kind":"import-statement","external":true},{"path":"dist/lib/browser/create-NOHKWE67.mjs","kind":"dynamic-import"},{"path":"dist/lib/browser/create-file-N7ADCFOF.mjs","kind":"dynamic-import"},{"path":"dist/lib/browser/upload-DA7GBOXF.mjs","kind":"dynamic-import"}],"exports":["WnfsOperation","WnfsOperationHandlerSet"],"entryPoint":"src/operations/index.ts","inputs":{"src/operations/index.ts":{"bytesInOutput":236}},"bytes":472},"dist/lib/browser/create-NOHKWE67.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":993},"dist/lib/browser/create-NOHKWE67.mjs":{"imports":[{"path":"dist/lib/browser/chunk-BM3MEFES.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-VXUCZHVZ.mjs","kind":"import-statement"},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"@dxos/operation","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"src/operations/create.ts","inputs":{"src/operations/create.ts":{"bytesInOutput":311}},"bytes":529},"dist/lib/browser/create-file-N7ADCFOF.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2176},"dist/lib/browser/create-file-N7ADCFOF.mjs":{"imports":[{"path":"dist/lib/browser/chunk-N6Y4QPNF.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-BM3MEFES.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-VXUCZHVZ.mjs","kind":"import-statement"},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/operation","kind":"import-statement","external":true},{"path":"@dxos/plugin-client/types","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"src/operations/create-file.ts","inputs":{"src/operations/create-file.ts":{"bytesInOutput":1029}},"bytes":1335},"dist/lib/browser/upload-DA7GBOXF.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1908},"dist/lib/browser/upload-DA7GBOXF.mjs":{"imports":[{"path":"dist/lib/browser/chunk-N6Y4QPNF.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-BM3MEFES.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-VXUCZHVZ.mjs","kind":"import-statement"},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/operation","kind":"import-statement","external":true},{"path":"@dxos/plugin-client/types","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"src/operations/upload.ts","inputs":{"src/operations/upload.ts":{"bytesInOutput":909}},"bytes":1180},"dist/lib/browser/chunk-N6Y4QPNF.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":13167},"dist/lib/browser/chunk-N6Y4QPNF.mjs":{"imports":[{"path":"multiformats","kind":"import-statement","external":true},{"path":"multiformats/codecs/raw","kind":"import-statement","external":true},{"path":"multiformats/hashes/sha2","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"multiformats/cid","kind":"import-statement","external":true},{"path":"multiformats/hashes/sha2","kind":"import-statement","external":true},{"path":"@dxos/crypto","kind":"import-statement","external":true},{"path":"multiformats","kind":"import-statement","external":true},{"path":"uint8arrays","kind":"import-statement","external":true},{"path":"wnfs","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true}],"exports":["upload"],"inputs":{"src/helpers/upload.ts":{"bytesInOutput":1348},"src/helpers/common.ts":{"bytesInOutput":1042},"src/helpers/load.ts":{"bytesInOutput":2031},"src/helpers/wnfs-url.ts":{"bytesInOutput":110},"src/helpers/index.ts":{"bytesInOutput":0}},"bytes":4726},"dist/lib/browser/chunk-BM3MEFES.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2650},"dist/lib/browser/chunk-BM3MEFES.mjs":{"imports":[{"path":"dist/lib/browser/chunk-VXUCZHVZ.mjs","kind":"import-statement"},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-toolkit","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/operation","kind":"import-statement","external":true},{"path":"#meta","kind":"import-statement","external":true}],"exports":["Create","CreateFile","Upload","definitions_exports"],"inputs":{"src/operations/definitions.ts":{"bytesInOutput":1358}},"bytes":1586},"dist/lib/browser/chunk-VXUCZHVZ.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3810},"dist/lib/browser/chunk-VXUCZHVZ.mjs":{"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"#meta","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo/internal","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"#meta","kind":"import-statement","external":true}],"exports":["File_exports","WnfsAction","WnfsCapabilities","__export"],"inputs":{"src/types/capabilities.ts":{"bytesInOutput":352},"src/types/index.ts":{"bytesInOutput":0},"src/types/File.ts":{"bytesInOutput":722},"src/types/types.ts":{"bytesInOutput":607}},"bytes":2041}}}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
definitions_exports
|
|
3
|
-
} from "../chunk-BM3MEFES.mjs";
|
|
4
|
-
import "../chunk-VXUCZHVZ.mjs";
|
|
5
|
-
|
|
6
|
-
// src/operations/index.ts
|
|
7
|
-
import { OperationHandlerSet } from "@dxos/operation";
|
|
8
|
-
var WnfsOperationHandlerSet = OperationHandlerSet.lazy(() => import("../create-NOHKWE67.mjs"), () => import("../create-file-N7ADCFOF.mjs"), () => import("../upload-DA7GBOXF.mjs"));
|
|
9
|
-
export {
|
|
10
|
-
definitions_exports as WnfsOperation,
|
|
11
|
-
WnfsOperationHandlerSet
|
|
12
|
-
};
|
|
13
|
-
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/operations/index.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { OperationHandlerSet } from '@dxos/operation';\n\nexport * as WnfsOperation from './definitions';\n\nexport const WnfsOperationHandlerSet = OperationHandlerSet.lazy(\n () => import('./create'),\n () => import('./create-file'),\n () => import('./upload'),\n);\n"],
|
|
5
|
-
"mappings": ";;;;;;AAIA,SAASA,2BAA2B;AAI7B,IAAMC,0BAA0BC,oBAAoBC,KACzD,MAAM,OAAO,wBAAA,GACb,MAAM,OAAO,6BAAA,GACb,MAAM,OAAO,wBAAA,CAAA;",
|
|
6
|
-
"names": ["OperationHandlerSet", "WnfsOperationHandlerSet", "OperationHandlerSet", "lazy"]
|
|
7
|
-
}
|