@dxos/plugin-wnfs 0.8.4-main.c1de068 → 0.8.4-main.c85a9c8dae

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.
Files changed (151) hide show
  1. package/dist/lib/browser/FileContainer-EILNV5LV.mjs +74 -0
  2. package/dist/lib/browser/FileContainer-EILNV5LV.mjs.map +7 -0
  3. package/dist/lib/browser/{blockstore-KQO2NTVM.mjs → blockstore-Q66HQJ4Q.mjs} +19 -19
  4. package/dist/lib/browser/blockstore-Q66HQJ4Q.mjs.map +7 -0
  5. package/dist/lib/browser/chunk-BXGCJRL2.mjs +155 -0
  6. package/dist/lib/browser/chunk-BXGCJRL2.mjs.map +7 -0
  7. package/dist/lib/browser/chunk-HXVPBJ3A.mjs +56 -0
  8. package/dist/lib/browser/chunk-HXVPBJ3A.mjs.map +7 -0
  9. package/dist/lib/browser/{chunk-VRRXG6IB.mjs → chunk-UC4HMNZZ.mjs} +24 -14
  10. package/dist/lib/browser/chunk-UC4HMNZZ.mjs.map +7 -0
  11. package/dist/lib/browser/file-uploader-QL4DTOMM.mjs +35 -0
  12. package/dist/lib/browser/file-uploader-QL4DTOMM.mjs.map +7 -0
  13. package/dist/lib/browser/index.mjs +85 -86
  14. package/dist/lib/browser/index.mjs.map +4 -4
  15. package/dist/lib/browser/{markdown-6VH477GB.mjs → markdown-AYCVG6TJ.mjs} +31 -26
  16. package/dist/lib/browser/markdown-AYCVG6TJ.mjs.map +7 -0
  17. package/dist/lib/browser/meta.json +1 -1
  18. package/dist/lib/browser/operation-resolver-YYWUF6EY.mjs +99 -0
  19. package/dist/lib/browser/operation-resolver-YYWUF6EY.mjs.map +7 -0
  20. package/dist/lib/browser/react-surface-3LKVDPH7.mjs +60 -0
  21. package/dist/lib/browser/react-surface-3LKVDPH7.mjs.map +7 -0
  22. package/dist/lib/browser/types/index.mjs +9 -6
  23. package/dist/types/src/WnfsPlugin.d.ts +2 -1
  24. package/dist/types/src/WnfsPlugin.d.ts.map +1 -1
  25. package/dist/types/src/capabilities/blockstore/blockstore.d.ts +5 -0
  26. package/dist/types/src/capabilities/blockstore/blockstore.d.ts.map +1 -0
  27. package/dist/types/src/capabilities/blockstore/index.d.ts +3 -0
  28. package/dist/types/src/capabilities/blockstore/index.d.ts.map +1 -0
  29. package/dist/types/src/capabilities/file-uploader/file-uploader.d.ts +6 -0
  30. package/dist/types/src/capabilities/file-uploader/file-uploader.d.ts.map +1 -0
  31. package/dist/types/src/capabilities/file-uploader/index.d.ts +3 -0
  32. package/dist/types/src/capabilities/file-uploader/index.d.ts.map +1 -0
  33. package/dist/types/src/capabilities/index.d.ts +5 -6
  34. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  35. package/dist/types/src/capabilities/markdown/index.d.ts +3 -0
  36. package/dist/types/src/capabilities/markdown/index.d.ts.map +1 -0
  37. package/dist/types/src/capabilities/markdown/markdown.d.ts +5 -0
  38. package/dist/types/src/capabilities/markdown/markdown.d.ts.map +1 -0
  39. package/dist/types/src/capabilities/operation-resolver/index.d.ts +3 -0
  40. package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +1 -0
  41. package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +5 -0
  42. package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -0
  43. package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
  44. package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
  45. package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
  46. package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
  47. package/dist/types/src/components/FileInput.d.ts +1 -1
  48. package/dist/types/src/components/FileInput.d.ts.map +1 -1
  49. package/dist/types/src/components/index.d.ts +1 -1
  50. package/dist/types/src/components/index.d.ts.map +1 -1
  51. package/dist/types/src/containers/FileContainer/FileContainer.d.ts +7 -0
  52. package/dist/types/src/containers/FileContainer/FileContainer.d.ts.map +1 -0
  53. package/dist/types/src/containers/FileContainer/index.d.ts +3 -0
  54. package/dist/types/src/containers/FileContainer/index.d.ts.map +1 -0
  55. package/dist/types/src/containers/index.d.ts +3 -0
  56. package/dist/types/src/containers/index.d.ts.map +1 -0
  57. package/dist/types/src/extensions/image.d.ts +1 -1
  58. package/dist/types/src/extensions/image.d.ts.map +1 -1
  59. package/dist/types/src/extensions/image.stories.d.ts +5 -4
  60. package/dist/types/src/extensions/image.stories.d.ts.map +1 -1
  61. package/dist/types/src/helpers/load.d.ts +2 -2
  62. package/dist/types/src/helpers/load.d.ts.map +1 -1
  63. package/dist/types/src/helpers/upload.d.ts +1 -1
  64. package/dist/types/src/helpers/upload.d.ts.map +1 -1
  65. package/dist/types/src/index.d.ts +1 -1
  66. package/dist/types/src/index.d.ts.map +1 -1
  67. package/dist/types/src/meta.d.ts +2 -3
  68. package/dist/types/src/meta.d.ts.map +1 -1
  69. package/dist/types/src/translations.d.ts +6 -3
  70. package/dist/types/src/translations.d.ts.map +1 -1
  71. package/dist/types/src/types/File.d.ts +16 -0
  72. package/dist/types/src/types/File.d.ts.map +1 -0
  73. package/dist/types/src/{capabilities → types}/capabilities.d.ts +3 -2
  74. package/dist/types/src/types/capabilities.d.ts.map +1 -0
  75. package/dist/types/src/types/index.d.ts +2 -1
  76. package/dist/types/src/types/index.d.ts.map +1 -1
  77. package/dist/types/src/types/types.d.ts +108 -47
  78. package/dist/types/src/types/types.d.ts.map +1 -1
  79. package/dist/types/tsconfig.tsbuildinfo +1 -1
  80. package/package.json +48 -40
  81. package/src/WnfsPlugin.tsx +63 -80
  82. package/src/blockstore.ts +2 -2
  83. package/src/capabilities/blockstore/blockstore.ts +22 -0
  84. package/src/capabilities/blockstore/index.ts +7 -0
  85. package/src/capabilities/file-uploader/file-uploader.ts +34 -0
  86. package/src/capabilities/file-uploader/index.ts +7 -0
  87. package/src/capabilities/index.ts +5 -9
  88. package/src/capabilities/markdown/index.ts +7 -0
  89. package/src/capabilities/markdown/markdown.ts +33 -0
  90. package/src/capabilities/operation-resolver/index.ts +7 -0
  91. package/src/capabilities/operation-resolver/operation-resolver.ts +62 -0
  92. package/src/capabilities/react-surface/index.ts +7 -0
  93. package/src/capabilities/react-surface/react-surface.tsx +51 -0
  94. package/src/components/FileInput.tsx +6 -6
  95. package/src/components/FilePreview.tsx +1 -1
  96. package/src/components/index.ts +1 -4
  97. package/src/containers/FileContainer/FileContainer.tsx +58 -0
  98. package/src/containers/FileContainer/index.ts +7 -0
  99. package/src/containers/index.ts +7 -0
  100. package/src/extensions/image.stories.tsx +18 -14
  101. package/src/extensions/image.tsx +9 -9
  102. package/src/helpers/load.ts +14 -8
  103. package/src/helpers/upload.ts +6 -2
  104. package/src/index.ts +1 -1
  105. package/src/meta.ts +9 -6
  106. package/src/translations.ts +6 -3
  107. package/src/types/File.ts +24 -0
  108. package/src/{capabilities → types}/capabilities.ts +4 -4
  109. package/src/types/index.ts +2 -1
  110. package/src/types/types.ts +58 -17
  111. package/dist/lib/browser/FileContainer-6P2SYTVH.mjs +0 -105
  112. package/dist/lib/browser/FileContainer-6P2SYTVH.mjs.map +0 -7
  113. package/dist/lib/browser/blockstore-KQO2NTVM.mjs.map +0 -7
  114. package/dist/lib/browser/chunk-GVBV2QWA.mjs +0 -64
  115. package/dist/lib/browser/chunk-GVBV2QWA.mjs.map +0 -7
  116. package/dist/lib/browser/chunk-KZANQHJY.mjs +0 -16
  117. package/dist/lib/browser/chunk-KZANQHJY.mjs.map +0 -7
  118. package/dist/lib/browser/chunk-VDDGZWAY.mjs +0 -15
  119. package/dist/lib/browser/chunk-VDDGZWAY.mjs.map +0 -7
  120. package/dist/lib/browser/chunk-VRRXG6IB.mjs.map +0 -7
  121. package/dist/lib/browser/chunk-WTYTESSC.mjs +0 -16
  122. package/dist/lib/browser/chunk-WTYTESSC.mjs.map +0 -7
  123. package/dist/lib/browser/file-uploader-JA55DPMW.mjs +0 -29
  124. package/dist/lib/browser/file-uploader-JA55DPMW.mjs.map +0 -7
  125. package/dist/lib/browser/intent-resolver-YM6QRFIH.mjs +0 -49
  126. package/dist/lib/browser/intent-resolver-YM6QRFIH.mjs.map +0 -7
  127. package/dist/lib/browser/markdown-6VH477GB.mjs.map +0 -7
  128. package/dist/lib/browser/react-surface-NOSB5MZ2.mjs +0 -88
  129. package/dist/lib/browser/react-surface-NOSB5MZ2.mjs.map +0 -7
  130. package/dist/types/src/capabilities/blockstore.d.ts +0 -4
  131. package/dist/types/src/capabilities/blockstore.d.ts.map +0 -1
  132. package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
  133. package/dist/types/src/capabilities/file-uploader.d.ts +0 -4
  134. package/dist/types/src/capabilities/file-uploader.d.ts.map +0 -1
  135. package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
  136. package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
  137. package/dist/types/src/capabilities/markdown.d.ts +0 -4
  138. package/dist/types/src/capabilities/markdown.d.ts.map +0 -1
  139. package/dist/types/src/capabilities/react-surface.d.ts +0 -4
  140. package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
  141. package/dist/types/src/components/FileContainer.d.ts +0 -9
  142. package/dist/types/src/components/FileContainer.d.ts.map +0 -1
  143. package/dist/types/src/types/file.d.ts +0 -16
  144. package/dist/types/src/types/file.d.ts.map +0 -1
  145. package/src/capabilities/blockstore.ts +0 -18
  146. package/src/capabilities/file-uploader.ts +0 -24
  147. package/src/capabilities/intent-resolver.ts +0 -32
  148. package/src/capabilities/markdown.ts +0 -25
  149. package/src/capabilities/react-surface.tsx +0 -45
  150. package/src/components/FileContainer.tsx +0 -51
  151. package/src/types/file.ts +0 -17
@@ -0,0 +1,58 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ import React, { useState } from 'react';
6
+
7
+ import { useCapability } from '@dxos/app-framework/ui';
8
+ import { type SurfaceComponentProps } from '@dxos/app-toolkit/ui';
9
+ import { invariant } from '@dxos/invariant';
10
+ import { getSpace } from '@dxos/react-client/echo';
11
+ import { Panel, useAsyncEffect } from '@dxos/react-ui';
12
+
13
+ import { FilePreview } from '../../components';
14
+ import { filePath, getBlobUrl, loadWnfs, wnfsUrl } from '../../helpers';
15
+ import { WnfsCapabilities, type WnfsFile } from '../../types';
16
+
17
+ export type FileContainerProps = SurfaceComponentProps<WnfsFile.File>;
18
+
19
+ export const FileContainer = ({ role, subject: file }: FileContainerProps) => {
20
+ const blockstore = useCapability(WnfsCapabilities.Blockstore);
21
+ const instances = useCapability(WnfsCapabilities.Instances);
22
+ const [blobUrl, setBlobUrl] = useState<string>();
23
+
24
+ useAsyncEffect(async () => {
25
+ const space = getSpace(file);
26
+ invariant(space);
27
+ const { directory, forest } = await loadWnfs({
28
+ blockstore,
29
+ instances,
30
+ space,
31
+ });
32
+ const path = filePath(file.cid.toString(), space);
33
+ const url = await getBlobUrl({
34
+ wnfsUrl: wnfsUrl(path),
35
+ blockstore,
36
+ directory,
37
+ forest,
38
+ type: file.type,
39
+ });
40
+ setBlobUrl(url);
41
+ }, [file]);
42
+
43
+ if (!blobUrl) {
44
+ return null;
45
+ }
46
+
47
+ return (
48
+ <Panel.Root role={role} className='dx-article'>
49
+ <Panel.Content asChild>
50
+ <Panel.Content asChild>
51
+ <FilePreview type={file.type} url={blobUrl} />
52
+ </Panel.Content>
53
+ </Panel.Content>
54
+ </Panel.Root>
55
+ );
56
+ };
57
+
58
+ export default FileContainer;
@@ -0,0 +1,7 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { FileContainer } from './FileContainer';
6
+
7
+ export default FileContainer;
@@ -0,0 +1,7 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { type ComponentType, lazy } from 'react';
6
+
7
+ export const FileContainer: ComponentType<any> = lazy(() => import('./FileContainer'));
@@ -2,8 +2,7 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import '@dxos-theme';
6
-
5
+ import { type Meta, type StoryObj } from '@storybook/react-vite';
7
6
  import type { Blockstore } from 'interface-blockstore';
8
7
  import React, { type ChangeEvent, useEffect, useState } from 'react';
9
8
 
@@ -11,25 +10,26 @@ import { faker } from '@dxos/random';
11
10
  import { useSpace } from '@dxos/react-client/echo';
12
11
  import { withClientProvider } from '@dxos/react-client/testing';
13
12
  import { useThemeContext } from '@dxos/react-ui';
13
+ import { withTheme } from '@dxos/react-ui/testing';
14
+ import { useTextEditor } from '@dxos/react-ui-editor';
14
15
  import {
15
16
  createBasicExtensions,
16
17
  createMarkdownExtensions,
17
18
  createThemeExtensions,
18
19
  decorateMarkdown,
19
20
  processEditorPayload,
20
- useTextEditor,
21
- } from '@dxos/react-ui-editor';
22
- import { withTheme, withLayout } from '@dxos/storybook-utils';
21
+ } from '@dxos/ui-editor';
23
22
 
24
- import { image } from './image';
25
23
  import { create as createBlockstore } from '../blockstore';
26
24
  import { upload } from '../helpers';
27
25
 
26
+ import { image } from './image';
27
+
28
28
  faker.seed(1);
29
29
  const initialValue = faker.lorem.paragraphs(100);
30
30
  const instances = {};
31
31
 
32
- const Story = () => {
32
+ const DefaultStory = () => {
33
33
  const { themeMode } = useThemeContext();
34
34
  const space = useSpace();
35
35
  const [blockstore, setBlockstore] = useState<Blockstore>();
@@ -54,7 +54,7 @@ const Story = () => {
54
54
  initialValue,
55
55
  extensions: [
56
56
  createBasicExtensions(),
57
- createMarkdownExtensions({ themeMode }),
57
+ createMarkdownExtensions(),
58
58
  createThemeExtensions({ themeMode, syntaxHighlighting: true }),
59
59
  blockstore && space ? [image({ blockstore, instances, space })] : [],
60
60
  decorateMarkdown(),
@@ -91,10 +91,14 @@ const Story = () => {
91
91
  );
92
92
  };
93
93
 
94
- export default {
95
- title: 'plugins/plugin-wnfs/image',
96
- render: Story,
97
- decorators: [withClientProvider({ createIdentity: true, createSpace: true }), withTheme, withLayout()],
98
- };
94
+ const meta = {
95
+ title: 'plugins/plugin-wnfs/extensions/image',
96
+ render: DefaultStory,
97
+ decorators: [withTheme(), withClientProvider({ createIdentity: true, createSpace: true })],
98
+ } satisfies Meta<typeof DefaultStory>;
99
+
100
+ export default meta;
101
+
102
+ type Story = StoryObj<typeof meta>;
99
103
 
100
- export const Default = {};
104
+ export const Default: Story = {};
@@ -3,7 +3,7 @@
3
3
  //
4
4
 
5
5
  import { syntaxTree } from '@codemirror/language';
6
- import { type EditorState, type Extension, StateField, type Range } from '@codemirror/state';
6
+ import { type EditorState, type Extension, type Range, StateField } from '@codemirror/state';
7
7
  import { Decoration, EditorView, WidgetType } from '@codemirror/view';
8
8
  import type { Blockstore } from 'interface-blockstore';
9
9
  import React from 'react';
@@ -11,12 +11,12 @@ import { createRoot } from 'react-dom/client';
11
11
 
12
12
  import { type Space } from '@dxos/react-client/echo';
13
13
  import { Status, ThemeProvider } from '@dxos/react-ui';
14
- import { focusField } from '@dxos/react-ui-editor';
15
- import { defaultTx } from '@dxos/react-ui-theme';
14
+ import { focusField } from '@dxos/ui-editor';
15
+ import { defaultTx } from '@dxos/ui-theme';
16
16
  import { type MaybePromise } from '@dxos/util';
17
17
 
18
- import { type WnfsCapabilities } from '../capabilities';
19
18
  import { getBlobUrl, getPathFromUrl, loadWnfs } from '../helpers';
19
+ import { type WnfsCapabilities } from '../types';
20
20
 
21
21
  const WAIT_UNTIL_LOADER = 1500;
22
22
 
@@ -80,16 +80,16 @@ export const image = (options: ImageOptions): Extension[] => {
80
80
  };
81
81
 
82
82
  const buildDecorations = ({
83
+ state,
83
84
  from,
84
85
  to,
85
- state,
86
86
  blobUrlCache,
87
87
  preload,
88
88
  options: { blockstore, instances, space },
89
89
  }: {
90
+ state: EditorState;
90
91
  from: number;
91
92
  to: number;
92
- state: EditorState;
93
93
  blobUrlCache: Record<string, string>;
94
94
  preload: (url: string) => void;
95
95
  options: ImageOptions;
@@ -165,11 +165,11 @@ class WnfsImageWidget extends WidgetType {
165
165
  super();
166
166
  }
167
167
 
168
- override eq(other: this): boolean {
169
- return this._wnfsUrl === (other as any as WnfsImageWidget)._wnfsUrl;
168
+ override eq(other: this) {
169
+ return this._wnfsUrl === other._wnfsUrl;
170
170
  }
171
171
 
172
- override toDOM(view: EditorView): HTMLDivElement {
172
+ override toDOM(view: EditorView) {
173
173
  if (typeof this._url === 'string') {
174
174
  return createImg(view, this._url);
175
175
  }
@@ -5,12 +5,14 @@
5
5
  import type { Blockstore } from 'interface-blockstore';
6
6
  import { CID } from 'multiformats';
7
7
  import * as Uint8Arrays from 'uint8arrays';
8
- import { AccessKey, PrivateForest, PrivateDirectory, PrivateNode } from 'wnfs';
8
+ import { AccessKey, PrivateDirectory, PrivateForest, PrivateNode } from 'wnfs';
9
9
 
10
+ import { Obj } from '@dxos/echo';
10
11
  import { type Space } from '@dxos/react-client/echo';
11
12
 
13
+ import { type WnfsCapabilities } from '../types';
14
+
12
15
  import { Rng, store } from './common';
13
- import { type WnfsCapabilities } from '../capabilities';
14
16
 
15
17
  //
16
18
  // LOAD
@@ -28,8 +30,10 @@ export const loadWnfs = async ({
28
30
  // TODO(wittjosiah): Remove.
29
31
  // Delete old properties if they exist.
30
32
  if (space.properties.wnfs_access_key !== undefined && space.properties.wnfs_private_forest_cid !== undefined) {
31
- delete space.properties.wnfs_access_key;
32
- delete space.properties.wnfs_private_forest_cid;
33
+ Obj.change(space.properties, (p) => {
34
+ delete p['wnfs_access_key'];
35
+ delete p['wnfs_private_forest_cid'];
36
+ });
33
37
  }
34
38
 
35
39
  const cacheKey = space.properties.wnfs?.privateForestCid;
@@ -64,10 +68,12 @@ const createWnfsDir = async (blockstore: Blockstore, space: Space) => {
64
68
 
65
69
  const cidBytes = await newForest.store(wnfsStore);
66
70
 
67
- space.properties.wnfs = {
68
- accessKey: Uint8Arrays.toString(accessKeyRaw.toBytes(), 'base64'),
69
- privateForestCid: CID.decode(cidBytes).toString(),
70
- };
71
+ Obj.change(space.properties, (p) => {
72
+ p.wnfs = {
73
+ accessKey: Uint8Arrays.toString(accessKeyRaw.toBytes(), 'base64'),
74
+ privateForestCid: CID.decode(cidBytes).toString(),
75
+ };
76
+ });
71
77
 
72
78
  return {
73
79
  directory: dir,
@@ -8,12 +8,14 @@ import * as Raw from 'multiformats/codecs/raw';
8
8
  import { sha256 } from 'multiformats/hashes/sha2';
9
9
 
10
10
  import type { Space } from '@dxos/client/echo';
11
+ import { Obj } from '@dxos/echo';
11
12
  import { log } from '@dxos/log';
12
13
 
14
+ import { type WnfsCapabilities } from '../types';
15
+
13
16
  import { Rng, filePath, store } from './common';
14
17
  import { loadWnfs } from './load';
15
18
  import { wnfsUrl } from './wnfs-url';
16
- import { type WnfsCapabilities } from '../capabilities';
17
19
 
18
20
  export const upload = async ({
19
21
  file,
@@ -45,7 +47,9 @@ export const upload = async ({
45
47
  const cidBytes = await updatedForest.store(wnfsStore);
46
48
 
47
49
  // Update the forest pointer on the associated space.
48
- space.properties.wnfs.privateForestCid = CID.decode(cidBytes).toString();
50
+ Obj.change(space.properties, (p) => {
51
+ p.wnfs.privateForestCid = CID.decode(cidBytes).toString();
52
+ });
49
53
 
50
54
  // Generate `wnfs://` URL & return the info.
51
55
  const info = {
package/src/index.ts CHANGED
@@ -2,6 +2,6 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- export { WnfsCapabilities } from './capabilities';
5
+ export { WnfsCapabilities } from './types';
6
6
  export * from './meta';
7
7
  export * from './WnfsPlugin';
package/src/meta.ts CHANGED
@@ -2,14 +2,17 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { type PluginMeta } from '@dxos/app-framework';
5
+ import { type Plugin } from '@dxos/app-framework';
6
+ import { trim } from '@dxos/util';
6
7
 
7
- export const WNFS_PLUGIN = 'dxos.org/plugin/wnfs';
8
-
9
- export const meta: PluginMeta = {
10
- id: WNFS_PLUGIN,
8
+ export const meta: Plugin.Meta = {
9
+ id: 'dxos.org/plugin/wnfs',
11
10
  name: 'WNFS',
12
- description: 'Manage and view files with via the Web Native File System (WNFS).',
11
+ description: trim`
12
+ Decentralized file storage using the Web Native File System protocol.
13
+ Store and sync files with end-to-end encryption across devices without central servers.
14
+ `,
13
15
  icon: 'ph--file-cloud--regular',
16
+ iconHue: 'teal',
14
17
  source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-wnfs',
15
18
  };
@@ -5,20 +5,23 @@
5
5
  import { type Resource } from '@dxos/react-ui';
6
6
 
7
7
  import { meta } from './meta';
8
- import { FileType } from './types';
8
+ import { WnfsFile } from './types';
9
9
 
10
10
  export const translations = [
11
11
  {
12
12
  'en-US': {
13
- [FileType.typename]: {
13
+ [WnfsFile.File.typename]: {
14
14
  'typename label': 'File',
15
+ 'typename label_zero': 'Files',
16
+ 'typename label_one': 'File',
17
+ 'typename label_other': 'Files',
15
18
  'object name placeholder': 'New file',
16
19
  'rename object label': 'Rename file',
17
20
  'delete object label': 'Delete file',
21
+ 'object deleted label': 'File deleted',
18
22
  },
19
23
  [meta.id]: {
20
24
  'plugin name': 'Files',
21
- 'delete object label': 'Delete',
22
25
  'file input placeholder': 'Drop a file here, or click to select a file',
23
26
  },
24
27
  },
@@ -0,0 +1,24 @@
1
+ //
2
+ // Copyright 2024 DXOS.org
3
+ //
4
+
5
+ import * as Schema from 'effect/Schema';
6
+
7
+ import { 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: 'dxos.org/type/File',
18
+ version: '0.1.0',
19
+ }),
20
+ );
21
+
22
+ export type File = Schema.Schema.Type<typeof File>;
23
+
24
+ export const make = (props: Obj.MakeProps<typeof File>) => Obj.make(File, props);
@@ -5,14 +5,14 @@
5
5
  import { type Blockstore } from 'interface-blockstore';
6
6
  import { type PrivateDirectory, type PrivateForest } from 'wnfs';
7
7
 
8
- import { defineCapability } from '@dxos/app-framework';
8
+ import { Capability } from '@dxos/app-framework';
9
9
  import { type SpaceId } from '@dxos/keys';
10
10
 
11
- import { WNFS_PLUGIN } from '../meta';
11
+ import { meta } from '../meta';
12
12
 
13
13
  export namespace WnfsCapabilities {
14
- export const Blockstore = defineCapability<Blockstore>(`${WNFS_PLUGIN}/capability/blockstore`);
14
+ export const Blockstore = Capability.make<Blockstore>(`${meta.id}/capability/blockstore`);
15
15
 
16
16
  export type Instances = Record<SpaceId, { directory: PrivateDirectory; forest: PrivateForest }>;
17
- export const Instances = defineCapability<Instances>(`${WNFS_PLUGIN}/capability/instances`);
17
+ export const Instances = Capability.make<Instances>(`${meta.id}/capability/instances`);
18
18
  }
@@ -2,5 +2,6 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- export * from './file';
5
+ export * from './capabilities';
6
+ export * as WnfsFile from './File';
6
7
  export * from './types';
@@ -2,26 +2,24 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
5
+ import * as Schema from 'effect/Schema';
6
6
 
7
- import { FileInfoSchema } from '@dxos/app-framework';
7
+ import { Capability } from '@dxos/app-framework';
8
+ import { FileInfoSchema } from '@dxos/app-toolkit';
9
+ import { Database } from '@dxos/echo';
10
+ import { Collection } from '@dxos/echo';
11
+ import { Operation } from '@dxos/operation';
8
12
  import { SpaceSchema } from '@dxos/react-client/echo';
9
13
 
10
- import { FileType } from './file';
11
- import { WNFS_PLUGIN } from '../meta';
14
+ import { meta } from '../meta';
12
15
 
13
- export namespace WnfsAction {
14
- export class Create extends Schema.TaggedClass<Create>()(`${WNFS_PLUGIN}/action/create`, {
15
- input: FileInfoSchema.pick('name', 'type', 'cid').pipe(Schema.required),
16
- output: Schema.Struct({
17
- object: FileType,
18
- }),
19
- }) {}
16
+ import * as File from './File';
20
17
 
21
- export const UploadAnnotationId = Symbol.for(`${WNFS_PLUGIN}/annotation/upload`);
18
+ export namespace WnfsAction {
19
+ export const UploadAnnotationId = Symbol.for(`${meta.id}/annotation/upload`);
22
20
 
23
21
  export const UploadFileSchema = Schema.Struct({
24
- file: Schema.instanceOf(File).annotations({
22
+ file: Schema.instanceOf(File.File).annotations({
25
23
  [UploadAnnotationId]: {
26
24
  // Accept file types.
27
25
  'image/*': ['.jpg', '.jpeg', '.png', '.gif'],
@@ -32,9 +30,52 @@ export namespace WnfsAction {
32
30
  });
33
31
 
34
32
  export type UploadFileForm = Schema.Schema.Type<typeof UploadFileSchema>;
33
+ }
34
+
35
+ const WNFS_OPERATION = `${meta.id}/operation`;
36
+
37
+ export namespace WnfsOperation {
38
+ export const OnCreateSpace = Operation.make({
39
+ meta: { key: `${WNFS_OPERATION}/on-create-space`, name: 'On Create Space' },
40
+ services: [Capability.Service],
41
+ schema: {
42
+ input: Schema.Struct({
43
+ space: SpaceSchema,
44
+ rootCollection: Collection.Collection,
45
+ isDefault: Schema.optional(Schema.Boolean),
46
+ }),
47
+ output: Schema.Void,
48
+ },
49
+ });
50
+
51
+ export const Create = Operation.make({
52
+ meta: { key: `${WNFS_OPERATION}/create`, name: 'Create WNFS File' },
53
+ services: [Capability.Service],
54
+ schema: {
55
+ input: FileInfoSchema.pick('name', 'type', 'cid').pipe(Schema.required),
56
+ output: Schema.Struct({
57
+ object: File.File,
58
+ }),
59
+ },
60
+ });
35
61
 
36
- export class Upload extends Schema.TaggedClass<Upload>()(`${WNFS_PLUGIN}/action/upload`, {
37
- input: Schema.extend(UploadFileSchema, Schema.Struct({ space: SpaceSchema })),
38
- output: Schema.required(FileInfoSchema),
39
- }) {}
62
+ export const Upload = Operation.make({
63
+ meta: { key: `${WNFS_OPERATION}/upload`, name: 'Upload File' },
64
+ services: [Capability.Service],
65
+ schema: {
66
+ input: Schema.extend(WnfsAction.UploadFileSchema, Schema.Struct({ db: Database.Database })),
67
+ output: Schema.required(FileInfoSchema),
68
+ },
69
+ });
70
+
71
+ export const CreateFile = Operation.make({
72
+ meta: { key: `${WNFS_OPERATION}/create-file`, name: 'Create File' },
73
+ services: [Capability.Service],
74
+ schema: {
75
+ input: Schema.extend(WnfsAction.UploadFileSchema, Schema.Struct({ db: Database.Database })),
76
+ output: Schema.Struct({
77
+ object: File.File,
78
+ }),
79
+ },
80
+ });
40
81
  }
@@ -1,105 +0,0 @@
1
- import "./chunk-WTYTESSC.mjs";
2
- import {
3
- filePath,
4
- getBlobUrl,
5
- loadWnfs,
6
- wnfsUrl
7
- } from "./chunk-VRRXG6IB.mjs";
8
- import {
9
- WnfsCapabilities
10
- } from "./chunk-KZANQHJY.mjs";
11
- import "./chunk-VDDGZWAY.mjs";
12
-
13
- // src/components/FileContainer.tsx
14
- import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
15
- import React2, { useEffect, useState } from "react";
16
- import { useCapability } from "@dxos/app-framework";
17
- import { invariant } from "@dxos/invariant";
18
- import { getSpace } from "@dxos/react-client/echo";
19
- import { StackItem } from "@dxos/react-ui-stack";
20
-
21
- // src/components/FilePreview.tsx
22
- import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
23
- import React from "react";
24
- import { mx } from "@dxos/react-ui-theme";
25
- var FilePreview = ({ type, url, classNames }) => {
26
- var _effect = _useSignals();
27
- try {
28
- if (type.startsWith("image/")) {
29
- return /* @__PURE__ */ React.createElement("img", {
30
- className: mx("w-full h-full object-contain", classNames),
31
- src: url
32
- });
33
- } else if (type.startsWith("video/")) {
34
- return /* @__PURE__ */ React.createElement("video", {
35
- className: mx("w-full h-full object-contain", classNames),
36
- src: url,
37
- controls: true
38
- });
39
- } else {
40
- return /* @__PURE__ */ React.createElement("iframe", {
41
- className: mx("w-full h-full overflow-auto", classNames),
42
- src: url
43
- });
44
- }
45
- } finally {
46
- _effect.f();
47
- }
48
- };
49
-
50
- // src/components/FileContainer.tsx
51
- var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-wnfs/src/components/FileContainer.tsx";
52
- var FileContainer = ({ file }) => {
53
- var _effect = _useSignals2();
54
- try {
55
- const blockstore = useCapability(WnfsCapabilities.Blockstore);
56
- const instances = useCapability(WnfsCapabilities.Instances);
57
- const [blobUrl, setBlobUrl] = useState();
58
- useEffect(() => {
59
- const timeout = setTimeout(async () => {
60
- const space = getSpace(file);
61
- invariant(space, void 0, {
62
- F: __dxlog_file,
63
- L: 30,
64
- S: void 0,
65
- A: [
66
- "space",
67
- ""
68
- ]
69
- });
70
- const { directory, forest } = await loadWnfs({
71
- blockstore,
72
- instances,
73
- space
74
- });
75
- const path = filePath(file.cid.toString(), space);
76
- const url = await getBlobUrl({
77
- wnfsUrl: wnfsUrl(path),
78
- blockstore,
79
- directory,
80
- forest,
81
- type: file.type
82
- });
83
- setBlobUrl(url);
84
- });
85
- return () => clearTimeout(timeout);
86
- }, [
87
- file
88
- ]);
89
- if (!blobUrl) {
90
- return null;
91
- }
92
- return /* @__PURE__ */ React2.createElement(StackItem.Content, null, /* @__PURE__ */ React2.createElement(FilePreview, {
93
- type: file.type,
94
- url: blobUrl
95
- }));
96
- } finally {
97
- _effect.f();
98
- }
99
- };
100
- var FileContainer_default = FileContainer;
101
- export {
102
- FileContainer,
103
- FileContainer_default as default
104
- };
105
- //# sourceMappingURL=FileContainer-6P2SYTVH.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/FileContainer.tsx", "../../../src/components/FilePreview.tsx"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { useEffect, useState } from 'react';\n\nimport { useCapability } from '@dxos/app-framework';\nimport { invariant } from '@dxos/invariant';\nimport { getSpace } from '@dxos/react-client/echo';\nimport { StackItem } from '@dxos/react-ui-stack';\n\nimport { FilePreview } from './FilePreview';\nimport { WnfsCapabilities } from '../capabilities';\nimport { filePath, getBlobUrl, loadWnfs, wnfsUrl } from '../helpers';\nimport { type FileType } from '../types';\n\nexport type FileContainerProps = {\n role: string;\n file: FileType;\n};\n\nexport const FileContainer = ({ file }: FileContainerProps) => {\n const blockstore = useCapability(WnfsCapabilities.Blockstore);\n const instances = useCapability(WnfsCapabilities.Instances);\n const [blobUrl, setBlobUrl] = useState<string>();\n\n useEffect(() => {\n const timeout = setTimeout(async () => {\n const space = getSpace(file);\n invariant(space);\n const { directory, forest } = await loadWnfs({ blockstore, instances, space });\n const path = filePath(file.cid.toString(), space);\n const url = await getBlobUrl({ wnfsUrl: wnfsUrl(path), blockstore, directory, forest, type: file.type });\n setBlobUrl(url);\n });\n\n return () => clearTimeout(timeout);\n }, [file]);\n\n if (!blobUrl) {\n return null;\n }\n\n return (\n <StackItem.Content>\n <FilePreview type={file.type} url={blobUrl} />\n </StackItem.Content>\n );\n};\n\nexport default FileContainer;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport { type ThemedClassName } from '@dxos/react-ui';\nimport { mx } from '@dxos/react-ui-theme';\n\nexport type FilePreviewProps = ThemedClassName<{ type: string; url: string }>;\n\n/**\n * File/content preview iframe.\n */\nexport const FilePreview = ({ type, url, classNames }: FilePreviewProps) => {\n if (type.startsWith('image/')) {\n return <img className={mx('w-full h-full object-contain', classNames)} src={url} />;\n } else if (type.startsWith('video/')) {\n return <video className={mx('w-full h-full object-contain', classNames)} src={url} controls />;\n } else {\n return <iframe className={mx('w-full h-full overflow-auto', classNames)} src={url} />;\n }\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;AAIA,OAAOA,UAASC,WAAWC,gBAAgB;AAE3C,SAASC,qBAAqB;AAC9B,SAASC,iBAAiB;AAC1B,SAASC,gBAAgB;AACzB,SAASC,iBAAiB;;;;ACL1B,OAAOC,WAAW;AAGlB,SAASC,UAAU;AAOZ,IAAMC,cAAc,CAAC,EAAEC,MAAMC,KAAKC,WAAU,MAAoB;;;AACrE,QAAIF,KAAKG,WAAW,QAAA,GAAW;AAC7B,aAAO,sBAAA,cAACC,OAAAA;QAAIC,WAAWC,GAAG,gCAAgCJ,UAAAA;QAAaK,KAAKN;;IAC9E,WAAWD,KAAKG,WAAW,QAAA,GAAW;AACpC,aAAO,sBAAA,cAACK,SAAAA;QAAMH,WAAWC,GAAG,gCAAgCJ,UAAAA;QAAaK,KAAKN;QAAKQ,UAAAA;;IACrF,OAAO;AACL,aAAO,sBAAA,cAACC,UAAAA;QAAOL,WAAWC,GAAG,+BAA+BJ,UAAAA;QAAaK,KAAKN;;IAChF;;;;AACF;;;;ADDO,IAAMU,gBAAgB,CAAC,EAAEC,KAAI,MAAsB;;;AACxD,UAAMC,aAAaC,cAAcC,iBAAiBC,UAAU;AAC5D,UAAMC,YAAYH,cAAcC,iBAAiBG,SAAS;AAC1D,UAAM,CAACC,SAASC,UAAAA,IAAcC,SAAAA;AAE9BC,cAAU,MAAA;AACR,YAAMC,UAAUC,WAAW,YAAA;AACzB,cAAMC,QAAQC,SAASd,IAAAA;AACvBe,kBAAUF,OAAAA,QAAAA;;;;;;;;;AACV,cAAM,EAAEG,WAAWC,OAAM,IAAK,MAAMC,SAAS;UAAEjB;UAAYI;UAAWQ;QAAM,CAAA;AAC5E,cAAMM,OAAOC,SAASpB,KAAKqB,IAAIC,SAAQ,GAAIT,KAAAA;AAC3C,cAAMU,MAAM,MAAMC,WAAW;UAAEC,SAASA,QAAQN,IAAAA;UAAOlB;UAAYe;UAAWC;UAAQS,MAAM1B,KAAK0B;QAAK,CAAA;AACtGlB,mBAAWe,GAAAA;MACb,CAAA;AAEA,aAAO,MAAMI,aAAahB,OAAAA;IAC5B,GAAG;MAACX;KAAK;AAET,QAAI,CAACO,SAAS;AACZ,aAAO;IACT;AAEA,WACE,gBAAAqB,OAAA,cAACC,UAAUC,SAAO,MAChB,gBAAAF,OAAA,cAACG,aAAAA;MAAYL,MAAM1B,KAAK0B;MAAMH,KAAKhB;;;;;AAGzC;AAEA,IAAA,wBAAeR;",
6
- "names": ["React", "useEffect", "useState", "useCapability", "invariant", "getSpace", "StackItem", "React", "mx", "FilePreview", "type", "url", "classNames", "startsWith", "img", "className", "mx", "src", "video", "controls", "iframe", "FileContainer", "file", "blockstore", "useCapability", "WnfsCapabilities", "Blockstore", "instances", "Instances", "blobUrl", "setBlobUrl", "useState", "useEffect", "timeout", "setTimeout", "space", "getSpace", "invariant", "directory", "forest", "loadWnfs", "path", "filePath", "cid", "toString", "url", "getBlobUrl", "wnfsUrl", "type", "clearTimeout", "React", "StackItem", "Content", "FilePreview"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/capabilities/blockstore.ts", "../../../src/blockstore.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { contributes, type PluginContext } from '@dxos/app-framework';\nimport { ClientCapabilities } from '@dxos/plugin-client';\n\nimport { WnfsCapabilities } from './capabilities';\nimport * as Blockstore from '../blockstore';\n\nexport default async (context: PluginContext) => {\n const client = context.getCapability(ClientCapabilities.Client);\n const apiHost = client.config.values.runtime?.services?.edge?.url || 'http://localhost:8787';\n const blockstore = Blockstore.create(apiHost);\n await blockstore.open();\n\n return contributes(WnfsCapabilities.Blockstore, blockstore);\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { CarWriter } from '@ipld/car';\nimport type { Block } from '@ipld/car/reader';\nimport { BaseBlockstore } from 'blockstore-core';\nimport { IDBBlockstore } from 'blockstore-idb';\nimport debounce from 'debounce';\nimport * as IDB from 'idb-keyval';\nimport all from 'it-all';\nimport { CID } from 'multiformats';\nimport * as Uint8Arrays from 'uint8arrays';\n\nimport { storeName } from './helpers';\n\nexport const create = (apiHost?: string) => {\n return new MixedBlockstore(apiHost);\n};\n\n/**\n * A blockstore that communicates with the DXOS blob service,\n * and which uses an indexedDB blockstore as a client cache.\n */\nexport class MixedBlockstore extends BaseBlockstore {\n readonly #apiHost: string | undefined;\n readonly #localStore: IDBBlockstore;\n\n #isConnected: boolean;\n #flushQueue: () => void;\n #queue: string[];\n\n constructor(apiHost?: string) {\n super();\n\n this.#apiHost = apiHost ? apiHost.replace(/\\/?$/, '') : undefined;\n this.#localStore = new IDBBlockstore(storeName());\n this.#isConnected = navigator.onLine;\n this.#queue = [];\n\n this.#flushQueue = debounce(this.#flushQueueInt, 5000);\n }\n\n async open(): Promise<void> {\n await this.#localStore.open();\n await this.#restoreQueue();\n\n window.addEventListener('offline', async () => {\n this.#isConnected = false;\n });\n\n window.addEventListener('online', async () => {\n this.#isConnected = true;\n this.#flushQueue();\n });\n }\n\n url(apiHost: string, cid?: CID): string {\n const path = cid ? cid.toString() : '';\n return `${apiHost}/api/file${path.length ? '/' + path : ''}`;\n }\n\n // BLOCKSTORE IMPLEMENTATION\n\n override async delete(key: CID): Promise<void> {\n await this.#localStore.delete(key);\n\n if (this.#isConnected && this.#apiHost) {\n await fetch(this.url(this.#apiHost, key), {\n method: 'DELETE',\n });\n }\n }\n\n override async get(key: CID): Promise<Uint8Array> {\n if (await this.#localStore.has(key)) {\n return await this.#localStore.get(key);\n }\n\n if (this.#isConnected && this.#apiHost) {\n const block = await fetch(this.url(this.#apiHost, key), {\n method: 'GET',\n })\n .then((r) => r.arrayBuffer())\n .then((r) => new Uint8Array(r));\n\n // Make sure it is cached locally\n await this.#localStore.put(key, block);\n\n return block;\n }\n\n return await this.#localStore.get(key);\n }\n\n override async has(key: CID): Promise<boolean> {\n if (await this.#localStore.has(key)) {\n return true;\n }\n\n if (this.#isConnected && this.#apiHost) {\n return await fetch(this.url(this.#apiHost, key), {\n method: 'HEAD',\n }).then((r) => r.ok);\n }\n\n return false;\n }\n\n override async put(key: CID, val: Uint8Array): Promise<CID> {\n await this.#localStore.put(key, val);\n\n await this.#addToQueue(key);\n this.#flushQueue();\n\n return key;\n }\n\n async destroy(): Promise<void> {\n await this.#localStore.destroy();\n }\n\n // REMOTE\n\n async putRemote(key: CID, val: Uint8Array): Promise<void> {\n if (this.#apiHost) {\n await fetch(this.url(this.#apiHost, key), {\n method: 'POST',\n body: val,\n });\n }\n }\n\n async putCarRemote(car: Uint8Array): Promise<void> {\n if (this.#apiHost) {\n await fetch(this.url(this.#apiHost), {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/vnd.ipld.car',\n },\n body: car,\n });\n }\n }\n\n // QUEUE\n\n readonly queueCacheName = `${storeName()}/state/queue`;\n\n async #addToQueue(key: CID): Promise<void> {\n await this.#saveQueue([...this.#queue, key.toString()]);\n }\n\n async #flushQueueInt(): Promise<void> {\n if (!this.#isConnected || !this.#apiHost) {\n return;\n }\n\n const keys = [...this.#queue];\n if (keys.length === 0) {\n return;\n }\n\n // Collect blocks\n const blocks = await Promise.all(\n keys.map(async (key) => {\n const cid = CID.parse(key);\n const bytes = await this.#localStore.get(cid);\n return { cid, bytes };\n }),\n );\n\n // Create & submit CAR\n const car = await this.#createCar(blocks);\n await this.putCarRemote(car);\n\n // Adjust queue\n const queue = [...this.#queue].filter((k) => {\n if (keys.includes(k)) {\n return false;\n }\n\n return true;\n });\n\n await this.#saveQueue(queue);\n }\n\n async #restoreQueue(): Promise<void> {\n const fromCache = await IDB.get(this.queueCacheName);\n if (fromCache && Array.isArray(fromCache)) {\n this.#queue = fromCache;\n this.#flushQueue();\n }\n }\n\n async #saveQueue(items: string[]): Promise<void> {\n const arr = [...items];\n this.#queue = arr;\n await IDB.set(this.queueCacheName, arr);\n }\n\n // 🛠️\n\n async #createCar(blocks: Block[]): Promise<Uint8Array> {\n const { writer, out } = CarWriter.create();\n const outPromise = all(out);\n\n await Promise.all(\n blocks.map((block) => {\n return writer.put(block);\n }),\n );\n\n await writer.close();\n return Uint8Arrays.concat(await outPromise);\n }\n}\n"],
5
- "mappings": ";;;;;;;;;AAIA,SAASA,mBAAuC;AAChD,SAASC,0BAA0B;;;ACDnC,SAASC,iBAAiB;AAE1B,SAASC,sBAAsB;AAC/B,SAASC,qBAAqB;AAC9B,OAAOC,cAAc;AACrB,YAAYC,SAAS;AACrB,OAAOC,SAAS;AAChB,SAASC,WAAW;AACpB,YAAYC,iBAAiB;AAItB,IAAMC,SAAS,CAACC,YAAAA;AACrB,SAAO,IAA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D,QAAQE,cAAcC,mBAAmBC,MAAM;AAC9D,QAAMC,UAAUJ,OAAOK,OAAOC,OAAOC,SAASC,UAAUC,MAAMC,OAAO;AACrE,QAAMC,aAAwBC,OAAOR,OAAAA;AACrC,QAAMO,WAAWE,KAAI;AAErB,SAAOC,YAAYC,iBAAiBC,YAAYL,UAAAA;AAClD;",
6
- "names": ["contributes", "ClientCapabilities", "CarWriter", "BaseBlockstore", "IDBBlockstore", "debounce", "IDB", "all", "CID", "Uint8Arrays", "create", "apiHost", "MixedBlockstore", "BaseBlockstore", "queueCacheName", "storeName", "replace", "undefined", "IDBBlockstore", "navigator", "onLine", "debounce", "open", "window", "addEventListener", "url", "cid", "path", "toString", "length", "delete", "key", "fetch", "method", "get", "has", "block", "then", "r", "arrayBuffer", "Uint8Array", "put", "ok", "val", "destroy", "putRemote", "body", "putCarRemote", "car", "headers", "keys", "blocks", "Promise", "all", "map", "CID", "parse", "bytes", "queue", "filter", "k", "includes", "fromCache", "Array", "isArray", "items", "arr", "set", "writer", "out", "CarWriter", "outPromise", "close", "concat", "context", "client", "getCapability", "ClientCapabilities", "Client", "apiHost", "config", "values", "runtime", "services", "edge", "url", "blockstore", "create", "open", "contributes", "WnfsCapabilities", "Blockstore"]
7
- }