@dxos/plugin-wnfs 0.8.4-main.7996785055 → 0.8.4-main.8baae0fced
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/README.md +2 -2
- package/dist/lib/neutral/WnfsPlugin.mjs +39 -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-DHBQUTPC.mjs +47 -0
- package/dist/lib/neutral/backend-DHBQUTPC.mjs.map +7 -0
- package/dist/lib/{browser/blockstore-TUV5YIC5.mjs → neutral/blockstore-3NLSWC7Z.mjs} +6 -7
- package/dist/lib/neutral/blockstore-3NLSWC7Z.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/{browser/chunk-A7ETWNGC.mjs → neutral/chunk-7KFJ6LYH.mjs} +32 -17
- package/dist/lib/neutral/chunk-7KFJ6LYH.mjs.map +7 -0
- package/dist/lib/neutral/chunk-EKFVDDRY.mjs +26 -0
- package/dist/lib/neutral/chunk-EKFVDDRY.mjs.map +7 -0
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -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/index.mjs +34 -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-UD3ZP77Y.mjs +47 -0
- package/dist/lib/neutral/url-resolver-UD3ZP77Y.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/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 -0
- package/dist/types/src/capabilities/index.d.ts +5 -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 +1 -1
- package/dist/types/src/helpers/load.d.ts.map +1 -1
- package/dist/types/src/helpers/upload.d.ts +1 -1
- package/dist/types/src/helpers/upload.d.ts.map +1 -1
- package/dist/types/src/helpers/wnfs-url.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +2 -2
- package/dist/types/src/index.d.ts.map +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 +96 -49
- package/src/WnfsPlugin.node.ts +11 -0
- package/src/WnfsPlugin.test.ts +20 -0
- package/src/WnfsPlugin.tsx +11 -40
- package/src/WnfsPlugin.workerd.ts +11 -0
- package/src/capabilities/backend.ts +43 -0
- package/src/capabilities/{blockstore/blockstore.ts → blockstore.ts} +3 -2
- package/src/capabilities/index.ts +14 -5
- package/src/capabilities/url-resolver.ts +44 -0
- package/src/helpers/load.ts +3 -3
- package/src/helpers/upload.ts +2 -2
- package/src/index.ts +2 -2
- package/src/meta.ts +4 -0
- package/src/plugin.ts +9 -0
- package/src/translations.ts +2 -15
- package/src/types/WnfsCapabilities.ts +18 -0
- package/src/types/index.ts +1 -3
- package/dist/lib/browser/FileContainer-TFENLFD5.mjs +0 -72
- package/dist/lib/browser/FileContainer-TFENLFD5.mjs.map +0 -7
- package/dist/lib/browser/blockstore-TUV5YIC5.mjs.map +0 -7
- package/dist/lib/browser/chunk-3I3QQNA3.mjs +0 -84
- package/dist/lib/browser/chunk-3I3QQNA3.mjs.map +0 -7
- package/dist/lib/browser/chunk-A7ETWNGC.mjs.map +0 -7
- package/dist/lib/browser/chunk-CXWUR7YI.mjs +0 -8
- package/dist/lib/browser/chunk-CXWUR7YI.mjs.map +0 -7
- package/dist/lib/browser/chunk-HXGK35WW.mjs +0 -65
- package/dist/lib/browser/chunk-HXGK35WW.mjs.map +0 -7
- package/dist/lib/browser/chunk-QE7ZSOYG.mjs +0 -69
- package/dist/lib/browser/chunk-QE7ZSOYG.mjs.map +0 -7
- package/dist/lib/browser/create-WQ6CUUDN.mjs +0 -24
- package/dist/lib/browser/create-WQ6CUUDN.mjs.map +0 -7
- package/dist/lib/browser/create-file-NGKX6CFL.mjs +0 -49
- package/dist/lib/browser/create-file-NGKX6CFL.mjs.map +0 -7
- package/dist/lib/browser/file-uploader-THECEDM2.mjs +0 -37
- package/dist/lib/browser/file-uploader-THECEDM2.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -124
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/markdown-IEDBXCLX.mjs +0 -201
- package/dist/lib/browser/markdown-IEDBXCLX.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/operation-handler-YAYDKG7R.mjs +0 -16
- package/dist/lib/browser/operation-handler-YAYDKG7R.mjs.map +0 -7
- package/dist/lib/browser/operations/index.mjs +0 -12
- package/dist/lib/browser/react-surface-UGRUPU56.mjs +0 -60
- package/dist/lib/browser/react-surface-UGRUPU56.mjs.map +0 -7
- package/dist/lib/browser/types/index.mjs +0 -11
- package/dist/lib/browser/upload-42ZL2AE4.mjs +0 -42
- package/dist/lib/browser/upload-42ZL2AE4.mjs.map +0 -7
- package/dist/types/src/capabilities/blockstore/blockstore.d.ts.map +0 -1
- package/dist/types/src/capabilities/blockstore/index.d.ts +0 -3
- package/dist/types/src/capabilities/blockstore/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/file-uploader/file-uploader.d.ts +0 -6
- package/dist/types/src/capabilities/file-uploader/file-uploader.d.ts.map +0 -1
- package/dist/types/src/capabilities/file-uploader/index.d.ts +0 -3
- package/dist/types/src/capabilities/file-uploader/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/markdown/index.d.ts +0 -3
- package/dist/types/src/capabilities/markdown/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/markdown/markdown.d.ts +0 -5
- package/dist/types/src/capabilities/markdown/markdown.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-handler/index.d.ts +0 -4
- package/dist/types/src/capabilities/operation-handler/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-handler/operation-handler.d.ts +0 -6
- package/dist/types/src/capabilities/operation-handler/operation-handler.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts +0 -3
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +0 -5
- package/dist/types/src/capabilities/react-surface/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 -16
- 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 -3
- 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/blockstore/index.ts +0 -7
- package/src/capabilities/file-uploader/file-uploader.ts +0 -34
- package/src/capabilities/file-uploader/index.ts +0 -7
- package/src/capabilities/markdown/index.ts +0 -7
- package/src/capabilities/markdown/markdown.ts +0 -33
- package/src/capabilities/operation-handler/index.ts +0 -11
- package/src/capabilities/operation-handler/operation-handler.ts +0 -16
- package/src/capabilities/react-surface/index.ts +0 -7
- package/src/capabilities/react-surface/react-surface.tsx +0 -51
- 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 -56
- package/src/containers/FileContainer/index.ts +0 -7
- package/src/containers/index.ts +0 -7
- package/src/extensions/image.stories.tsx +0 -104
- package/src/extensions/image.tsx +0 -203
- package/src/extensions/index.ts +0 -5
- package/src/operations/create-file.ts +0 -32
- package/src/operations/create.ts +0 -23
- package/src/operations/definitions.ts +0 -40
- package/src/operations/index.ts +0 -13
- package/src/operations/upload.ts +0 -30
- 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/operations/index.mjs.map → neutral/chunk-J5LGTIGS.mjs.map} +0 -0
- /package/dist/lib/{browser/types → neutral/helpers}/index.mjs.map +0 -0
- /package/dist/types/src/capabilities/{blockstore/blockstore.d.ts → blockstore.d.ts} +0 -0
package/src/operations/upload.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import * as Effect from 'effect/Effect';
|
|
6
|
-
|
|
7
|
-
import { Capability } from '@dxos/app-framework';
|
|
8
|
-
import { invariant } from '@dxos/invariant';
|
|
9
|
-
import { Operation } from '@dxos/operation';
|
|
10
|
-
import { ClientCapabilities } from '@dxos/plugin-client';
|
|
11
|
-
|
|
12
|
-
import { upload } from '../helpers';
|
|
13
|
-
import { WnfsCapabilities } from '../types';
|
|
14
|
-
|
|
15
|
-
import { Upload } from './definitions';
|
|
16
|
-
|
|
17
|
-
const handler: Operation.WithHandler<typeof Upload> = Upload.pipe(
|
|
18
|
-
Operation.withHandler(
|
|
19
|
-
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
|
-
const info = yield* Effect.promise(() => upload({ file, blockstore, space }));
|
|
25
|
-
return info;
|
|
26
|
-
}),
|
|
27
|
-
),
|
|
28
|
-
);
|
|
29
|
-
|
|
30
|
-
export default handler;
|
package/src/types/File.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2024 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import * as Schema from 'effect/Schema';
|
|
6
|
-
|
|
7
|
-
import { Annotation, Obj, Type } from '@dxos/echo';
|
|
8
|
-
import { FormInputAnnotation } from '@dxos/echo/internal';
|
|
9
|
-
|
|
10
|
-
export const File = Schema.Struct({
|
|
11
|
-
name: Schema.String.pipe(Schema.optional),
|
|
12
|
-
type: Schema.String.pipe(FormInputAnnotation.set(false)),
|
|
13
|
-
cid: Schema.String.pipe(FormInputAnnotation.set(false)),
|
|
14
|
-
timestamp: Schema.String.pipe(FormInputAnnotation.set(false), Schema.optional),
|
|
15
|
-
}).pipe(
|
|
16
|
-
Type.object({
|
|
17
|
-
typename: 'org.dxos.type.file',
|
|
18
|
-
version: '0.1.0',
|
|
19
|
-
}),
|
|
20
|
-
Annotation.IconAnnotation.set({
|
|
21
|
-
icon: 'ph--file--regular',
|
|
22
|
-
hue: 'teal',
|
|
23
|
-
}),
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
export type File = Schema.Schema.Type<typeof File>;
|
|
27
|
-
|
|
28
|
-
export const make = (props: Obj.MakeProps<typeof File>) => Obj.make(File, props);
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { type Blockstore } from 'interface-blockstore';
|
|
6
|
-
import { type PrivateDirectory, type PrivateForest } from 'wnfs';
|
|
7
|
-
|
|
8
|
-
import { Capability } from '@dxos/app-framework';
|
|
9
|
-
import { type SpaceId } from '@dxos/keys';
|
|
10
|
-
|
|
11
|
-
import { meta } from '../meta';
|
|
12
|
-
|
|
13
|
-
export namespace WnfsCapabilities {
|
|
14
|
-
export const Blockstore = Capability.make<Blockstore>(`${meta.id}.capability.blockstore`);
|
|
15
|
-
|
|
16
|
-
export type Instances = Record<SpaceId, { directory: PrivateDirectory; forest: PrivateForest }>;
|
|
17
|
-
export const Instances = Capability.make<Instances>(`${meta.id}.capability.instances`);
|
|
18
|
-
}
|
package/src/types/types.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import * as Schema from 'effect/Schema';
|
|
6
|
-
|
|
7
|
-
import { meta } from '../meta';
|
|
8
|
-
|
|
9
|
-
export namespace WnfsAction {
|
|
10
|
-
export const UploadAnnotationId = Symbol.for(`${meta.id}.annotation.upload`);
|
|
11
|
-
|
|
12
|
-
export const UploadFileSchema = Schema.Struct({
|
|
13
|
-
file: Schema.instanceOf(File).annotations({
|
|
14
|
-
[UploadAnnotationId]: {
|
|
15
|
-
// Accept file types.
|
|
16
|
-
'image/*': ['.jpg', '.jpeg', '.png', '.gif'],
|
|
17
|
-
'application/pdf': ['.pdf'],
|
|
18
|
-
// TODO(wittjosiah): Add more file types.
|
|
19
|
-
},
|
|
20
|
-
}),
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
export type UploadFileForm = Schema.Schema.Type<typeof UploadFileSchema>;
|
|
24
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|