@dxos/plugin-wnfs 0.8.4-main.f9ba587 → 0.8.4-main.fcc0d83b33
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/{node-esm/chunk-CGW32EZB.mjs → browser/chunk-7KFJ6LYH.mjs} +44 -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/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 +79 -103
- 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 +8 -6
- 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 +2 -1
- 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 +3 -2
- package/dist/types/src/capabilities/blockstore.d.ts.map +1 -1
- package/dist/types/src/capabilities/file-uploader.d.ts +4 -2
- package/dist/types/src/capabilities/file-uploader.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +7 -6
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/markdown.d.ts +4 -2
- package/dist/types/src/capabilities/markdown.d.ts.map +1 -1
- 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 +3 -2
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/components/{FileInput.d.ts → FileInput/FileInput.d.ts} +1 -1
- 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/components/index.d.ts +1 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/FileContainer/FileContainer.d.ts +7 -0
- package/dist/types/src/containers/FileContainer/FileContainer.d.ts.map +1 -0
- package/dist/types/src/containers/FileContainer/index.d.ts +2 -0
- package/dist/types/src/containers/FileContainer/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +3 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- 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 +5 -4
- 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 +2 -2
- 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/index.d.ts +1 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -3
- package/dist/types/src/meta.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 -10
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/File.d.ts +16 -0
- package/dist/types/src/types/File.d.ts.map +1 -0
- package/dist/types/src/{capabilities → types}/capabilities.d.ts +3 -2
- package/dist/types/src/types/capabilities.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +2 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +4 -46
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +73 -47
- package/src/WnfsPlugin.tsx +66 -85
- package/src/blockstore.ts +3 -3
- package/src/capabilities/blockstore.ts +15 -10
- package/src/capabilities/file-uploader.ts +25 -15
- package/src/capabilities/index.ts +10 -8
- package/src/capabilities/markdown.ts +25 -12
- package/src/capabilities/operation-handler.ts +16 -0
- package/src/capabilities/react-surface.tsx +50 -35
- package/src/components/{FileInput.tsx → FileInput/FileInput.tsx} +8 -8
- 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/components/index.ts +1 -4
- package/src/containers/FileContainer/FileContainer.tsx +57 -0
- package/src/containers/FileContainer/index.ts +5 -0
- package/src/containers/index.ts +7 -0
- package/src/extensions/image.stories.tsx +22 -19
- package/src/extensions/image.tsx +10 -9
- package/src/helpers/load.ts +14 -8
- package/src/helpers/upload.ts +6 -2
- package/src/index.ts +1 -1
- package/src/meta.ts +9 -6
- 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 +14 -8
- package/src/types/File.ts +28 -0
- package/src/{capabilities → types}/capabilities.ts +4 -4
- package/src/types/index.ts +2 -1
- package/src/types/types.ts +3 -19
- package/dist/lib/browser/FileContainer-Q4GUPBVD.mjs +0 -107
- package/dist/lib/browser/FileContainer-Q4GUPBVD.mjs.map +0 -7
- package/dist/lib/browser/blockstore-KQO2NTVM.mjs +0 -191
- package/dist/lib/browser/blockstore-KQO2NTVM.mjs.map +0 -7
- package/dist/lib/browser/chunk-BANMVVJV.mjs +0 -16
- package/dist/lib/browser/chunk-BANMVVJV.mjs.map +0 -7
- package/dist/lib/browser/chunk-GVBV2QWA.mjs +0 -64
- package/dist/lib/browser/chunk-GVBV2QWA.mjs.map +0 -7
- package/dist/lib/browser/chunk-KZANQHJY.mjs +0 -16
- package/dist/lib/browser/chunk-KZANQHJY.mjs.map +0 -7
- package/dist/lib/browser/chunk-VDDGZWAY.mjs +0 -15
- package/dist/lib/browser/chunk-VDDGZWAY.mjs.map +0 -7
- package/dist/lib/browser/chunk-VRRXG6IB.mjs +0 -159
- package/dist/lib/browser/chunk-VRRXG6IB.mjs.map +0 -7
- package/dist/lib/browser/file-uploader-JA55DPMW.mjs +0 -29
- package/dist/lib/browser/file-uploader-JA55DPMW.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-YM6QRFIH.mjs +0 -49
- package/dist/lib/browser/intent-resolver-YM6QRFIH.mjs.map +0 -7
- package/dist/lib/browser/markdown-6VH477GB.mjs +0 -196
- package/dist/lib/browser/markdown-6VH477GB.mjs.map +0 -7
- package/dist/lib/browser/react-surface-XAHVMWIH.mjs +0 -88
- package/dist/lib/browser/react-surface-XAHVMWIH.mjs.map +0 -7
- package/dist/lib/node-esm/FileContainer-22IPNDDA.mjs +0 -108
- package/dist/lib/node-esm/FileContainer-22IPNDDA.mjs.map +0 -7
- package/dist/lib/node-esm/blockstore-7KQTFHK5.mjs +0 -192
- package/dist/lib/node-esm/blockstore-7KQTFHK5.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-47QYKNA6.mjs +0 -17
- package/dist/lib/node-esm/chunk-47QYKNA6.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-BM37ZAHF.mjs +0 -65
- package/dist/lib/node-esm/chunk-BM37ZAHF.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CGW32EZB.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-DWYM7FD7.mjs +0 -18
- package/dist/lib/node-esm/chunk-DWYM7FD7.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-YTWL64Z6.mjs +0 -17
- package/dist/lib/node-esm/chunk-YTWL64Z6.mjs.map +0 -7
- package/dist/lib/node-esm/file-uploader-WGDG2YV5.mjs +0 -30
- package/dist/lib/node-esm/file-uploader-WGDG2YV5.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -117
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-5QOT2SLD.mjs +0 -50
- package/dist/lib/node-esm/intent-resolver-5QOT2SLD.mjs.map +0 -7
- package/dist/lib/node-esm/markdown-R4PBXDJO.mjs +0 -197
- package/dist/lib/node-esm/markdown-R4PBXDJO.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/react-surface-HAOUJUXJ.mjs +0 -89
- package/dist/lib/node-esm/react-surface-HAOUJUXJ.mjs.map +0 -7
- package/dist/lib/node-esm/types/index.mjs +0 -11
- package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/components/FileContainer.d.ts +0 -9
- package/dist/types/src/components/FileContainer.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/dist/types/src/types/file.d.ts +0 -16
- package/dist/types/src/types/file.d.ts.map +0 -1
- package/src/capabilities/intent-resolver.ts +0 -32
- package/src/components/FileContainer.tsx +0 -51
- package/src/components/FilePreview.tsx +0 -23
- package/src/types/file.ts +0 -17
- /package/dist/lib/{node-esm/types/index.mjs.map → browser/chunk-J5LGTIGS.mjs.map} +0 -0
package/package.json
CHANGED
|
@@ -1,44 +1,67 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-wnfs",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.fcc0d83b33",
|
|
4
4
|
"description": "WNFS file management plugin",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/dxos/dxos"
|
|
10
|
+
},
|
|
7
11
|
"license": "MIT",
|
|
8
12
|
"author": "DXOS.org",
|
|
9
13
|
"type": "module",
|
|
14
|
+
"imports": {
|
|
15
|
+
"#capabilities": "./src/capabilities/index.ts",
|
|
16
|
+
"#components": "./src/components/index.ts",
|
|
17
|
+
"#containers": "./src/containers/index.ts",
|
|
18
|
+
"#meta": "./src/meta.ts",
|
|
19
|
+
"#operations": "./src/operations/index.ts",
|
|
20
|
+
"#translations": "./src/translations.ts",
|
|
21
|
+
"#types": "./src/types/index.ts"
|
|
22
|
+
},
|
|
10
23
|
"exports": {
|
|
11
24
|
".": {
|
|
12
|
-
"
|
|
13
|
-
"browser": "./dist/lib/browser/index.mjs"
|
|
25
|
+
"source": "./src/index.ts",
|
|
26
|
+
"browser": "./dist/lib/browser/index.mjs",
|
|
27
|
+
"types": "./dist/types/src/index.d.ts"
|
|
28
|
+
},
|
|
29
|
+
"./helpers": {
|
|
30
|
+
"source": "./src/helpers/index.ts",
|
|
31
|
+
"browser": "./dist/lib/browser/helpers/index.mjs",
|
|
32
|
+
"types": "./dist/types/src/helpers/index.d.ts"
|
|
33
|
+
},
|
|
34
|
+
"./operations": {
|
|
35
|
+
"source": "./src/operations/index.ts",
|
|
36
|
+
"browser": "./dist/lib/browser/operations/index.mjs",
|
|
37
|
+
"types": "./dist/types/src/operations/index.d.ts"
|
|
38
|
+
},
|
|
39
|
+
"./translations": {
|
|
40
|
+
"source": "./src/translations.ts",
|
|
41
|
+
"types": "./dist/types/src/translations.d.ts",
|
|
42
|
+
"browser": "./dist/lib/browser/translations.mjs",
|
|
43
|
+
"node": "./dist/lib/node-esm/translations.mjs"
|
|
14
44
|
},
|
|
15
45
|
"./types": {
|
|
16
|
-
"
|
|
17
|
-
"browser": "./dist/lib/browser/types/index.mjs"
|
|
46
|
+
"source": "./src/types/index.ts",
|
|
47
|
+
"browser": "./dist/lib/browser/types/index.mjs",
|
|
48
|
+
"types": "./dist/types/src/types/index.d.ts"
|
|
18
49
|
}
|
|
19
50
|
},
|
|
20
51
|
"types": "dist/types/src/index.d.ts",
|
|
21
|
-
"typesVersions": {
|
|
22
|
-
"*": {
|
|
23
|
-
"types": [
|
|
24
|
-
"dist/types/src/types/index.d.ts"
|
|
25
|
-
]
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
52
|
"files": [
|
|
29
53
|
"dist",
|
|
30
54
|
"src"
|
|
31
55
|
],
|
|
32
56
|
"dependencies": {
|
|
33
|
-
"@codemirror/language": "^6.
|
|
34
|
-
"@codemirror/state": "^6.
|
|
35
|
-
"@codemirror/view": "^6.
|
|
57
|
+
"@codemirror/language": "^6.11.3",
|
|
58
|
+
"@codemirror/state": "^6.5.2",
|
|
59
|
+
"@codemirror/view": "^6.38.4",
|
|
36
60
|
"@ipld/car": "^5.3.3",
|
|
37
|
-
"@preact-signals/safe-react": "^0.9.0",
|
|
38
61
|
"blockstore-core": "^5.0.1",
|
|
39
62
|
"blockstore-idb": "^2.0.0",
|
|
40
63
|
"debounce": "^2.2.0",
|
|
41
|
-
"effect": "3.
|
|
64
|
+
"effect": "3.20.0",
|
|
42
65
|
"idb-keyval": "^6.2.1",
|
|
43
66
|
"interface-blockstore": "^5.2.10",
|
|
44
67
|
"it-all": "^3.0.6",
|
|
@@ -46,40 +69,43 @@
|
|
|
46
69
|
"react-dropzone": "^14.2.3",
|
|
47
70
|
"uint8arrays": "^5.1.0",
|
|
48
71
|
"wnfs": "0.2.2",
|
|
49
|
-
"@dxos/app-
|
|
50
|
-
"@dxos/
|
|
51
|
-
"@dxos/
|
|
52
|
-
"@dxos/
|
|
53
|
-
"@dxos/
|
|
54
|
-
"@dxos/
|
|
55
|
-
"@dxos/
|
|
56
|
-
"@dxos/
|
|
57
|
-
"@dxos/plugin-
|
|
58
|
-
"@dxos/plugin-space": "0.8.4-main.
|
|
59
|
-
"@dxos/
|
|
60
|
-
"@dxos/react-
|
|
61
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
62
|
-
"@dxos/react-ui-
|
|
63
|
-
"@dxos/react-ui-
|
|
64
|
-
"@dxos/react-ui-
|
|
65
|
-
"@dxos/
|
|
72
|
+
"@dxos/app-toolkit": "0.8.4-main.fcc0d83b33",
|
|
73
|
+
"@dxos/echo": "0.8.4-main.fcc0d83b33",
|
|
74
|
+
"@dxos/compute": "0.8.4-main.fcc0d83b33",
|
|
75
|
+
"@dxos/crypto": "0.8.4-main.fcc0d83b33",
|
|
76
|
+
"@dxos/invariant": "0.8.4-main.fcc0d83b33",
|
|
77
|
+
"@dxos/effect": "0.8.4-main.fcc0d83b33",
|
|
78
|
+
"@dxos/log": "0.8.4-main.fcc0d83b33",
|
|
79
|
+
"@dxos/plugin-client": "0.8.4-main.fcc0d83b33",
|
|
80
|
+
"@dxos/plugin-markdown": "0.8.4-main.fcc0d83b33",
|
|
81
|
+
"@dxos/plugin-space": "0.8.4-main.fcc0d83b33",
|
|
82
|
+
"@dxos/react-client": "0.8.4-main.fcc0d83b33",
|
|
83
|
+
"@dxos/react-ui": "0.8.4-main.fcc0d83b33",
|
|
84
|
+
"@dxos/react-ui-mosaic": "0.8.4-main.fcc0d83b33",
|
|
85
|
+
"@dxos/react-ui-form": "0.8.4-main.fcc0d83b33",
|
|
86
|
+
"@dxos/react-ui-stack": "0.8.4-main.fcc0d83b33",
|
|
87
|
+
"@dxos/react-ui-editor": "0.8.4-main.fcc0d83b33",
|
|
88
|
+
"@dxos/app-framework": "0.8.4-main.fcc0d83b33",
|
|
89
|
+
"@dxos/schema": "0.8.4-main.fcc0d83b33",
|
|
90
|
+
"@dxos/util": "0.8.4-main.fcc0d83b33",
|
|
91
|
+
"@dxos/ui-editor": "0.8.4-main.fcc0d83b33"
|
|
66
92
|
},
|
|
67
93
|
"devDependencies": {
|
|
68
|
-
"@types/react": "~
|
|
69
|
-
"@types/react-dom": "~
|
|
70
|
-
"react": "~
|
|
71
|
-
"react-dom": "~
|
|
72
|
-
"vite": "
|
|
73
|
-
"@dxos/
|
|
74
|
-
"@dxos/storybook-utils": "0.8.4-main.
|
|
75
|
-
"@dxos/
|
|
94
|
+
"@types/react": "~19.2.7",
|
|
95
|
+
"@types/react-dom": "~19.2.3",
|
|
96
|
+
"react": "~19.2.3",
|
|
97
|
+
"react-dom": "~19.2.3",
|
|
98
|
+
"vite": "^8.0.10",
|
|
99
|
+
"@dxos/random": "0.8.4-main.fcc0d83b33",
|
|
100
|
+
"@dxos/storybook-utils": "0.8.4-main.fcc0d83b33",
|
|
101
|
+
"@dxos/ui-theme": "0.8.4-main.fcc0d83b33"
|
|
76
102
|
},
|
|
77
103
|
"peerDependencies": {
|
|
78
|
-
"effect": "
|
|
79
|
-
"react": "~
|
|
80
|
-
"react-dom": "~
|
|
81
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
82
|
-
"@dxos/
|
|
104
|
+
"effect": "3.20.0",
|
|
105
|
+
"react": "~19.2.3",
|
|
106
|
+
"react-dom": "~19.2.3",
|
|
107
|
+
"@dxos/react-ui": "0.8.4-main.fcc0d83b33",
|
|
108
|
+
"@dxos/ui-theme": "0.8.4-main.fcc0d83b33"
|
|
83
109
|
},
|
|
84
110
|
"publishConfig": {
|
|
85
111
|
"access": "public"
|
package/src/WnfsPlugin.tsx
CHANGED
|
@@ -2,92 +2,73 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import * as Option from 'effect/Option';
|
|
6
7
|
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
} from '@dxos/app-framework';
|
|
16
|
-
import { ClientEvents } from '@dxos/plugin-client';
|
|
17
|
-
import { MarkdownEvents } from '@dxos/plugin-markdown';
|
|
18
|
-
import { SpaceCapabilities } from '@dxos/plugin-space';
|
|
19
|
-
import { defineObjectForm } from '@dxos/plugin-space/types';
|
|
8
|
+
import { Capability, Plugin } from '@dxos/app-framework';
|
|
9
|
+
import { AppPlugin } from '@dxos/app-toolkit';
|
|
10
|
+
import { Operation } from '@dxos/compute';
|
|
11
|
+
import { Annotation } from '@dxos/echo';
|
|
12
|
+
import { ClientEvents } from '@dxos/plugin-client/types';
|
|
13
|
+
import { MarkdownEvents } from '@dxos/plugin-markdown/types';
|
|
14
|
+
import { SpaceOperation } from '@dxos/plugin-space/operations';
|
|
15
|
+
import { type CreateObject } from '@dxos/plugin-space/types';
|
|
20
16
|
|
|
21
|
-
import { Blockstore, FileUploader,
|
|
22
|
-
import { meta } from '
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
17
|
+
import { Blockstore, FileUploader, Markdown, OperationHandler, ReactSurface } from '#capabilities';
|
|
18
|
+
import { meta } from '#meta';
|
|
19
|
+
import { WnfsOperation } from '#operations';
|
|
20
|
+
import { translations } from '#translations';
|
|
21
|
+
import { WnfsAction, WnfsCapabilities, WnfsFile } from '#types';
|
|
25
22
|
|
|
26
|
-
export const WnfsPlugin = ()
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
id:
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
23
|
+
export const WnfsPlugin = Plugin.define(meta).pipe(
|
|
24
|
+
AppPlugin.addMetadataModule({
|
|
25
|
+
metadata: {
|
|
26
|
+
id: WnfsFile.File.typename,
|
|
27
|
+
metadata: {
|
|
28
|
+
// TODO(wittjosiah): Would be nice if icon could change based on the type of the file.
|
|
29
|
+
icon: Annotation.IconAnnotation.get(WnfsFile.File).pipe(Option.getOrThrow).icon,
|
|
30
|
+
iconHue: Annotation.IconAnnotation.get(WnfsFile.File).pipe(Option.getOrThrow).hue ?? 'white',
|
|
31
|
+
inputSchema: WnfsAction.UploadFileSchema,
|
|
32
|
+
createObject: ((props, options) =>
|
|
33
|
+
Effect.gen(function* () {
|
|
34
|
+
const { object } = yield* Operation.invoke(WnfsOperation.CreateFile, { ...props, db: options.db });
|
|
35
|
+
return yield* Operation.invoke(SpaceOperation.AddObject, {
|
|
36
|
+
object,
|
|
37
|
+
target: options.target,
|
|
38
|
+
hidden: true,
|
|
39
|
+
targetNodeId: options.targetNodeId,
|
|
40
|
+
});
|
|
41
|
+
})) satisfies CreateObject,
|
|
39
42
|
},
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}),
|
|
73
|
-
defineModule({
|
|
74
|
-
id: `${meta.id}/module/file-uploader`,
|
|
75
|
-
activatesOn: ClientEvents.ClientReady,
|
|
76
|
-
activate: FileUploader,
|
|
77
|
-
}),
|
|
78
|
-
defineModule({
|
|
79
|
-
id: `${meta.id}/module/markdown`,
|
|
80
|
-
activatesOn: MarkdownEvents.SetupExtensions,
|
|
81
|
-
activate: Markdown,
|
|
82
|
-
}),
|
|
83
|
-
defineModule({
|
|
84
|
-
id: `${meta.id}/module/react-surface`,
|
|
85
|
-
activatesOn: Events.SetupReactSurface,
|
|
86
|
-
activate: ReactSurface,
|
|
87
|
-
}),
|
|
88
|
-
defineModule({
|
|
89
|
-
id: `${meta.id}/module/intent-resolver`,
|
|
90
|
-
activatesOn: Events.SetupIntentResolver,
|
|
91
|
-
activate: IntentResolver,
|
|
92
|
-
}),
|
|
93
|
-
]);
|
|
43
|
+
},
|
|
44
|
+
}),
|
|
45
|
+
AppPlugin.addOperationHandlerModule({ activate: OperationHandler }),
|
|
46
|
+
AppPlugin.addSchemaModule({ schema: [WnfsFile.File] }),
|
|
47
|
+
AppPlugin.addSurfaceModule({ activate: ReactSurface }),
|
|
48
|
+
AppPlugin.addTranslationsModule({ translations }),
|
|
49
|
+
Plugin.addModule({
|
|
50
|
+
id: 'blockstore',
|
|
51
|
+
activatesOn: ClientEvents.ClientReady,
|
|
52
|
+
activate: Blockstore,
|
|
53
|
+
}),
|
|
54
|
+
Plugin.addModule({
|
|
55
|
+
id: 'instances',
|
|
56
|
+
activatesOn: ClientEvents.ClientReady,
|
|
57
|
+
activate: () =>
|
|
58
|
+
Effect.sync(() => {
|
|
59
|
+
const instances: WnfsCapabilities.Instances = {};
|
|
60
|
+
return Capability.contributes(WnfsCapabilities.Instances, instances);
|
|
61
|
+
}),
|
|
62
|
+
}),
|
|
63
|
+
Plugin.addModule({
|
|
64
|
+
id: 'file-uploader',
|
|
65
|
+
activatesOn: ClientEvents.ClientReady,
|
|
66
|
+
activate: FileUploader,
|
|
67
|
+
}),
|
|
68
|
+
Plugin.addModule({
|
|
69
|
+
id: 'markdown',
|
|
70
|
+
activatesOn: MarkdownEvents.SetupExtensions,
|
|
71
|
+
activate: Markdown,
|
|
72
|
+
}),
|
|
73
|
+
Plugin.make,
|
|
74
|
+
);
|
package/src/blockstore.ts
CHANGED
|
@@ -126,7 +126,7 @@ export class MixedBlockstore extends BaseBlockstore {
|
|
|
126
126
|
if (this.#apiHost) {
|
|
127
127
|
await fetch(this.url(this.#apiHost, key), {
|
|
128
128
|
method: 'POST',
|
|
129
|
-
body: val
|
|
129
|
+
body: val as Uint8Array<ArrayBuffer>,
|
|
130
130
|
});
|
|
131
131
|
}
|
|
132
132
|
}
|
|
@@ -138,14 +138,14 @@ export class MixedBlockstore extends BaseBlockstore {
|
|
|
138
138
|
headers: {
|
|
139
139
|
'Content-Type': 'application/vnd.ipld.car',
|
|
140
140
|
},
|
|
141
|
-
body: car
|
|
141
|
+
body: car as Uint8Array<ArrayBuffer>,
|
|
142
142
|
});
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
145
|
|
|
146
146
|
// QUEUE
|
|
147
147
|
|
|
148
|
-
readonly queueCacheName = `${storeName()}
|
|
148
|
+
readonly queueCacheName = `${storeName()}.state.queue`;
|
|
149
149
|
|
|
150
150
|
async #addToQueue(key: CID): Promise<void> {
|
|
151
151
|
await this.#saveQueue([...this.#queue, key.toString()]);
|
|
@@ -2,17 +2,22 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
6
|
-
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Capability } from '@dxos/app-framework';
|
|
8
|
+
import { ClientCapabilities } from '@dxos/plugin-client/types';
|
|
9
|
+
|
|
10
|
+
import { WnfsCapabilities } from '#types';
|
|
7
11
|
|
|
8
|
-
import { WnfsCapabilities } from './capabilities';
|
|
9
12
|
import * as Blockstore from '../blockstore';
|
|
10
13
|
|
|
11
|
-
export default
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
export default Capability.makeModule(
|
|
15
|
+
Effect.fnUntraced(function* () {
|
|
16
|
+
const client = yield* Capability.get(ClientCapabilities.Client);
|
|
17
|
+
const apiHost = client.config.values.runtime?.services?.edge?.url || 'http://localhost:8787';
|
|
18
|
+
const blockstore = Blockstore.create(apiHost);
|
|
19
|
+
yield* Effect.tryPromise(() => blockstore.open());
|
|
16
20
|
|
|
17
|
-
|
|
18
|
-
}
|
|
21
|
+
return Capability.contributes(WnfsCapabilities.Blockstore, blockstore);
|
|
22
|
+
}),
|
|
23
|
+
);
|
|
@@ -2,23 +2,33 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
6
|
|
|
7
|
-
import { Capabilities,
|
|
8
|
-
import {
|
|
7
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
8
|
+
import { AppCapabilities } from '@dxos/app-toolkit';
|
|
9
|
+
import { runAndForwardErrors } from '@dxos/effect';
|
|
10
|
+
import { SpaceOperation } from '@dxos/plugin-space/operations';
|
|
9
11
|
|
|
10
|
-
import {
|
|
12
|
+
import { WnfsOperation } from '#operations';
|
|
11
13
|
|
|
12
|
-
export default (
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
export default Capability.makeModule(
|
|
15
|
+
Effect.fnUntraced(function* () {
|
|
16
|
+
// Get context for lazy capability access in callbacks.
|
|
17
|
+
const capabilities = yield* Capability.Service;
|
|
15
18
|
|
|
16
|
-
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
return Capability.contributes(AppCapabilities.FileUploader, (db, file) => {
|
|
20
|
+
const { invoke } = capabilities.get(Capabilities.OperationInvoker);
|
|
21
|
+
const program = Effect.gen(function* () {
|
|
22
|
+
const fileInfo = yield* invoke(WnfsOperation.Upload, { db, file });
|
|
23
|
+
const createResult = yield* invoke(WnfsOperation.Create, fileInfo);
|
|
24
|
+
if (createResult?.object) {
|
|
25
|
+
yield* invoke(SpaceOperation.AddObject, { target: db, object: createResult.object });
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return fileInfo;
|
|
29
|
+
});
|
|
21
30
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
31
|
+
return runAndForwardErrors(program);
|
|
32
|
+
});
|
|
33
|
+
}),
|
|
34
|
+
);
|
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Capability } from '@dxos/app-framework';
|
|
6
|
+
import { OperationHandlerSet } from '@dxos/compute';
|
|
6
7
|
|
|
7
|
-
export const Blockstore = lazy(() => import('./blockstore'));
|
|
8
|
-
export const FileUploader = lazy(() => import('./file-uploader'));
|
|
9
|
-
export const
|
|
10
|
-
export const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
export const Blockstore = Capability.lazy('Blockstore', () => import('./blockstore'));
|
|
9
|
+
export const FileUploader = Capability.lazy('FileUploader', () => import('./file-uploader'));
|
|
10
|
+
export const Markdown = Capability.lazy('Markdown', () => import('./markdown'));
|
|
11
|
+
export const OperationHandler = Capability.lazy<OperationHandlerSet.OperationHandlerSet>(
|
|
12
|
+
'OperationHandler',
|
|
13
|
+
() => import('./operation-handler'),
|
|
14
|
+
);
|
|
15
|
+
export const ReactSurface = Capability.lazy('ReactSurface', () => import('./react-surface'));
|
|
@@ -2,24 +2,37 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
6
|
-
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Capability } from '@dxos/app-framework';
|
|
8
|
+
import { type MarkdownExtensionProvider, MarkdownCapabilities } from '@dxos/plugin-markdown/types';
|
|
7
9
|
import { getSpace } from '@dxos/react-client/echo';
|
|
8
10
|
|
|
9
|
-
import { WnfsCapabilities } from '
|
|
11
|
+
import { WnfsCapabilities } from '#types';
|
|
12
|
+
|
|
10
13
|
import { image } from '../extensions';
|
|
11
14
|
|
|
12
|
-
export default (
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
export default Capability.makeModule(
|
|
16
|
+
Effect.fnUntraced(function* () {
|
|
17
|
+
// Get context for lazy capability access in callbacks.
|
|
18
|
+
const capabilities = yield* Capability.Service;
|
|
19
|
+
|
|
20
|
+
const provider: MarkdownExtensionProvider = ({ document, viewMode }) => {
|
|
21
|
+
if (viewMode === 'source') {
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const blockstore = capabilities.get(WnfsCapabilities.Blockstore);
|
|
26
|
+
const instances = capabilities.get(WnfsCapabilities.Instances);
|
|
17
27
|
|
|
18
28
|
if (document) {
|
|
19
29
|
const space = getSpace(document);
|
|
20
|
-
return space ? [image({ blockstore, instances, space })] :
|
|
30
|
+
return space ? [image({ blockstore, instances, space })] : undefined;
|
|
21
31
|
}
|
|
22
32
|
|
|
23
|
-
return
|
|
24
|
-
}
|
|
25
|
-
|
|
33
|
+
return undefined;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
return Capability.contributes(MarkdownCapabilities.Extensions, [provider]);
|
|
37
|
+
}),
|
|
38
|
+
);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
8
|
+
import type { OperationHandlerSet } from '@dxos/compute';
|
|
9
|
+
|
|
10
|
+
import { WnfsOperationHandlerSet } from '#operations';
|
|
11
|
+
|
|
12
|
+
export default Capability.makeModule<OperationHandlerSet.OperationHandlerSet>(
|
|
13
|
+
Effect.fnUntraced(function* () {
|
|
14
|
+
return Capability.contributes(Capabilities.OperationHandler, WnfsOperationHandlerSet);
|
|
15
|
+
}),
|
|
16
|
+
);
|
|
@@ -2,44 +2,59 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import type * as Schema from 'effect/Schema';
|
|
7
|
+
import * as SchemaAST from 'effect/SchemaAST';
|
|
6
8
|
import React, { useCallback } from 'react';
|
|
7
9
|
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
11
|
+
import { Surface } from '@dxos/app-framework/ui';
|
|
12
|
+
import { AppSurface } from '@dxos/app-toolkit/ui';
|
|
10
13
|
import { findAnnotation } from '@dxos/effect';
|
|
11
|
-
import { type
|
|
14
|
+
import { type FormFieldComponentProps } from '@dxos/react-ui-form';
|
|
12
15
|
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
+
import { FileInput } from '#components';
|
|
17
|
+
import { FileContainer } from '#containers';
|
|
18
|
+
import { WnfsAction, WnfsFile } from '#types';
|
|
16
19
|
|
|
17
|
-
export default () =>
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
)
|
|
20
|
+
export default Capability.makeModule(() =>
|
|
21
|
+
Effect.succeed(
|
|
22
|
+
Capability.contributes(Capabilities.ReactSurface, [
|
|
23
|
+
Surface.create({
|
|
24
|
+
id: 'article',
|
|
25
|
+
// TODO(wittjosiah): Split into multiple surfaces if this filter proves too strict for non-article roles.
|
|
26
|
+
filter: AppSurface.oneOf(
|
|
27
|
+
AppSurface.object(AppSurface.Article, WnfsFile.File),
|
|
28
|
+
AppSurface.object(AppSurface.Section, WnfsFile.File),
|
|
29
|
+
AppSurface.object(AppSurface.Slide, WnfsFile.File),
|
|
30
|
+
),
|
|
31
|
+
component: ({ data, role }) => <FileContainer role={role} subject={data.subject} />,
|
|
32
|
+
}),
|
|
33
|
+
Surface.create({
|
|
34
|
+
id: 'create-form',
|
|
35
|
+
role: 'form-input',
|
|
36
|
+
filter: (data): data is { prop: string; schema: Schema.Schema.Any; fieldPropertyAst?: SchemaAST.AST } => {
|
|
37
|
+
const annotation = findAnnotation<boolean>(
|
|
38
|
+
(data.schema as Schema.Schema.All).ast,
|
|
39
|
+
WnfsAction.UploadAnnotationId,
|
|
40
|
+
);
|
|
41
|
+
return !!annotation;
|
|
42
|
+
},
|
|
43
|
+
component: ({ data: { schema, fieldPropertyAst }, ...props }) => {
|
|
44
|
+
const ast = fieldPropertyAst;
|
|
45
|
+
if (!ast) {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
41
48
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
49
|
+
const inputProps = { ...props, type: ast } as unknown as FormFieldComponentProps;
|
|
50
|
+
const handleChange = useCallback(
|
|
51
|
+
(file: File) => inputProps.onValueChange?.(ast, file),
|
|
52
|
+
[ast, inputProps.onValueChange],
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
return <FileInput schema={schema} onChange={handleChange} />;
|
|
56
|
+
},
|
|
57
|
+
}),
|
|
58
|
+
]),
|
|
59
|
+
),
|
|
60
|
+
);
|