@dxos/plugin-wnfs 0.8.1-staging.9eaf14f → 0.8.2-main.10c050d

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 (82) hide show
  1. package/dist/lib/browser/FileContainer-SEU43TLT.mjs +106 -0
  2. package/dist/lib/browser/FileContainer-SEU43TLT.mjs.map +7 -0
  3. package/dist/lib/browser/{blockstore-G47Q25U6.mjs → blockstore-UT7233RJ.mjs} +5 -5
  4. package/dist/lib/browser/blockstore-UT7233RJ.mjs.map +7 -0
  5. package/dist/lib/browser/{chunk-NIDFBTNY.mjs → chunk-DL7BBH57.mjs} +3 -3
  6. package/dist/lib/browser/{chunk-NIDFBTNY.mjs.map → chunk-DL7BBH57.mjs.map} +1 -1
  7. package/dist/lib/browser/chunk-LQYDI474.mjs +16 -0
  8. package/dist/lib/browser/{chunk-X54OT4V3.mjs → chunk-PHTWWADN.mjs} +2 -2
  9. package/dist/lib/browser/{chunk-X54OT4V3.mjs.map → chunk-PHTWWADN.mjs.map} +1 -1
  10. package/dist/lib/browser/{chunk-FKYLWLNM.mjs → chunk-RY5XZCVP.mjs} +21 -17
  11. package/dist/lib/browser/chunk-RY5XZCVP.mjs.map +7 -0
  12. package/dist/lib/browser/{chunk-SCQWJNHD.mjs → chunk-YYAW4U6J.mjs} +5 -3
  13. package/dist/lib/browser/{chunk-SCQWJNHD.mjs.map → chunk-YYAW4U6J.mjs.map} +3 -3
  14. package/dist/lib/browser/{file-uploader-L4TDVJBE.mjs → file-uploader-OQHVKRQ5.mjs} +4 -4
  15. package/dist/lib/browser/file-uploader-OQHVKRQ5.mjs.map +7 -0
  16. package/dist/lib/browser/index.mjs +4 -4
  17. package/dist/lib/browser/{intent-resolver-VSMIQLGS.mjs → intent-resolver-42B3MXJZ.mjs} +8 -8
  18. package/dist/lib/browser/intent-resolver-42B3MXJZ.mjs.map +7 -0
  19. package/dist/lib/browser/{markdown-MWMZVPEX.mjs → markdown-BWBHUHHH.mjs} +7 -9
  20. package/dist/lib/browser/markdown-BWBHUHHH.mjs.map +7 -0
  21. package/dist/lib/browser/meta.json +1 -1
  22. package/dist/lib/browser/{react-surface-MKJYHQ4P.mjs → react-surface-GTYQZY3L.mjs} +28 -22
  23. package/dist/lib/browser/react-surface-GTYQZY3L.mjs.map +7 -0
  24. package/dist/lib/browser/types/index.mjs +2 -2
  25. package/dist/types/src/blockstore.d.ts.map +1 -1
  26. package/dist/types/src/capabilities/blockstore.d.ts +2 -2
  27. package/dist/types/src/capabilities/blockstore.d.ts.map +1 -1
  28. package/dist/types/src/capabilities/file-uploader.d.ts +2 -2
  29. package/dist/types/src/capabilities/file-uploader.d.ts.map +1 -1
  30. package/dist/types/src/capabilities/index.d.ts +4 -4
  31. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  32. package/dist/types/src/capabilities/intent-resolver.d.ts +2 -2
  33. package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
  34. package/dist/types/src/capabilities/markdown.d.ts +2 -2
  35. package/dist/types/src/capabilities/markdown.d.ts.map +1 -1
  36. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  37. package/dist/types/src/components/FileContainer.d.ts.map +1 -1
  38. package/dist/types/src/components/FileInput.d.ts +2 -2
  39. package/dist/types/src/components/FileInput.d.ts.map +1 -1
  40. package/dist/types/src/components/FilePreview.d.ts.map +1 -1
  41. package/dist/types/src/components/index.d.ts +2 -3
  42. package/dist/types/src/components/index.d.ts.map +1 -1
  43. package/dist/types/src/extensions/image.d.ts.map +1 -1
  44. package/dist/types/src/extensions/image.stories.d.ts.map +1 -1
  45. package/dist/types/src/helpers/common.d.ts.map +1 -1
  46. package/dist/types/src/helpers/load.d.ts.map +1 -1
  47. package/dist/types/src/helpers/upload.d.ts.map +1 -1
  48. package/dist/types/src/helpers/wnfs-url.d.ts +3 -2
  49. package/dist/types/src/helpers/wnfs-url.d.ts.map +1 -1
  50. package/dist/types/src/translations.d.ts +2 -10
  51. package/dist/types/src/translations.d.ts.map +1 -1
  52. package/dist/types/src/types/file.d.ts +10 -10
  53. package/dist/types/src/types/file.d.ts.map +1 -1
  54. package/dist/types/src/types/types.d.ts +15 -15
  55. package/dist/types/src/types/types.d.ts.map +1 -1
  56. package/dist/types/tsconfig.tsbuildinfo +1 -1
  57. package/package.json +26 -23
  58. package/src/blockstore.ts +9 -9
  59. package/src/capabilities/blockstore.ts +3 -3
  60. package/src/capabilities/file-uploader.ts +3 -3
  61. package/src/capabilities/intent-resolver.ts +5 -5
  62. package/src/capabilities/markdown.ts +4 -4
  63. package/src/capabilities/react-surface.tsx +6 -3
  64. package/src/components/FileContainer.tsx +1 -1
  65. package/src/components/FileInput.tsx +2 -2
  66. package/src/components/index.ts +2 -2
  67. package/src/extensions/image.stories.tsx +2 -2
  68. package/src/extensions/image.tsx +2 -2
  69. package/src/helpers/wnfs-url.ts +5 -3
  70. package/src/meta.ts +1 -1
  71. package/src/types/file.ts +7 -5
  72. package/src/types/types.ts +12 -10
  73. package/dist/lib/browser/FileContainer-4HNP22HU.mjs +0 -93
  74. package/dist/lib/browser/FileContainer-4HNP22HU.mjs.map +0 -7
  75. package/dist/lib/browser/blockstore-G47Q25U6.mjs.map +0 -7
  76. package/dist/lib/browser/chunk-FH2Q7ZBE.mjs +0 -16
  77. package/dist/lib/browser/chunk-FKYLWLNM.mjs.map +0 -7
  78. package/dist/lib/browser/file-uploader-L4TDVJBE.mjs.map +0 -7
  79. package/dist/lib/browser/intent-resolver-VSMIQLGS.mjs.map +0 -7
  80. package/dist/lib/browser/markdown-MWMZVPEX.mjs.map +0 -7
  81. package/dist/lib/browser/react-surface-MKJYHQ4P.mjs.map +0 -7
  82. /package/dist/lib/browser/{chunk-FH2Q7ZBE.mjs.map → chunk-LQYDI474.mjs.map} +0 -0
@@ -0,0 +1,106 @@
1
+ import "./chunk-LQYDI474.mjs";
2
+ import {
3
+ filePath,
4
+ getBlobUrl,
5
+ loadWnfs,
6
+ wnfsUrl
7
+ } from "./chunk-YYAW4U6J.mjs";
8
+ import {
9
+ WnfsCapabilities
10
+ } from "./chunk-DL7BBH57.mjs";
11
+ import "./chunk-PHTWWADN.mjs";
12
+
13
+ // packages/plugins/plugin-wnfs/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
+ // packages/plugins/plugin-wnfs/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
+ // packages/plugins/plugin-wnfs/src/components/FileContainer.tsx
51
+ var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/plugin-wnfs/src/components/FileContainer.tsx";
52
+ var FileContainer = ({ file, role }) => {
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: 25,
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, {
93
+ role
94
+ }, /* @__PURE__ */ React2.createElement(FilePreview, {
95
+ type: file.type,
96
+ url: blobUrl
97
+ }));
98
+ } finally {
99
+ _effect.f();
100
+ }
101
+ };
102
+ var FileContainer_default = FileContainer;
103
+ export {
104
+ FileContainer_default as default
105
+ };
106
+ //# sourceMappingURL=FileContainer-SEU43TLT.mjs.map
@@ -0,0 +1,7 @@
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\nconst FileContainer = ({ file, role }: { file: FileType; role: string }) => {\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 role={role}>\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;;;;ADNA,IAAMU,gBAAgB,CAAC,EAAEC,MAAMC,KAAI,MAAoC;;;AACrE,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,SAASf,IAAAA;AACvBgB,kBAAUF,OAAAA,QAAAA;;;;;;;;;AACV,cAAM,EAAEG,WAAWC,OAAM,IAAK,MAAMC,SAAS;UAAEjB;UAAYI;UAAWQ;QAAM,CAAA;AAC5E,cAAMM,OAAOC,SAASrB,KAAKsB,IAAIC,SAAQ,GAAIT,KAAAA;AAC3C,cAAMU,MAAM,MAAMC,WAAW;UAAEC,SAASA,QAAQN,IAAAA;UAAOlB;UAAYe;UAAWC;UAAQS,MAAM3B,KAAK2B;QAAK,CAAA;AACtGlB,mBAAWe,GAAAA;MACb,CAAA;AAEA,aAAO,MAAMI,aAAahB,OAAAA;IAC5B,GAAG;MAACZ;KAAK;AAET,QAAI,CAACQ,SAAS;AACZ,aAAO;IACT;AAEA,WACE,gBAAAqB,OAAA,cAACC,UAAUC,SAAO;MAAC9B;OACjB,gBAAA4B,OAAA,cAACG,aAAAA;MAAYL,MAAM3B,KAAK2B;MAAMH,KAAKhB;;;;;AAGzC;AAEA,IAAA,wBAAeT;",
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", "role", "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,10 +1,10 @@
1
1
  import {
2
2
  storeName
3
- } from "./chunk-SCQWJNHD.mjs";
3
+ } from "./chunk-YYAW4U6J.mjs";
4
4
  import {
5
5
  WnfsCapabilities
6
- } from "./chunk-NIDFBTNY.mjs";
7
- import "./chunk-X54OT4V3.mjs";
6
+ } from "./chunk-DL7BBH57.mjs";
7
+ import "./chunk-PHTWWADN.mjs";
8
8
 
9
9
  // packages/plugins/plugin-wnfs/src/capabilities/blockstore.ts
10
10
  import { contributes } from "@dxos/app-framework";
@@ -179,7 +179,7 @@ var MixedBlockstore = class extends BaseBlockstore {
179
179
 
180
180
  // packages/plugins/plugin-wnfs/src/capabilities/blockstore.ts
181
181
  var blockstore_default = async (context) => {
182
- const client = context.requestCapability(ClientCapabilities.Client);
182
+ const client = context.getCapability(ClientCapabilities.Client);
183
183
  const apiHost = client.config.values.runtime?.services?.edge?.url || "http://localhost:8787";
184
184
  const blockstore = create(apiHost);
185
185
  await blockstore.open();
@@ -188,4 +188,4 @@ var blockstore_default = async (context) => {
188
188
  export {
189
189
  blockstore_default as default
190
190
  };
191
- //# sourceMappingURL=blockstore-G47Q25U6.mjs.map
191
+ //# sourceMappingURL=blockstore-UT7233RJ.mjs.map
@@ -0,0 +1,7 @@
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,IAAIC,gBAAgBD,OAAAA;AAC7B;AAMO,IAAMC,kBAAN,cAA8BC,eAAAA;EAQnC,YAAYF,SAAkB;AAC5B,UAAK;AAkHEG;0BAAiB,GAAGC,UAAAA,CAAAA;AAhH3B,SAAK,WAAWJ,UAAUA,QAAQK,QAAQ,QAAQ,EAAA,IAAMC;AACxD,SAAK,cAAc,IAAIC,cAAcH,UAAAA,CAAAA;AACrC,SAAK,eAAeI,UAAUC;AAC9B,SAAK,SAAS,CAAA;AAEd,SAAK,cAAcC,SAAS,KAAK,gBAAgB,GAAA;EACnD;EAhBS;EACA;EAET;EACA;EACA;EAaA,MAAMC,OAAsB;AAC1B,UAAM,KAAK,YAAYA,KAAI;AAC3B,UAAM,KAAK,cAAa;AAExBC,WAAOC,iBAAiB,WAAW,YAAA;AACjC,WAAK,eAAe;IACtB,CAAA;AAEAD,WAAOC,iBAAiB,UAAU,YAAA;AAChC,WAAK,eAAe;AACpB,WAAK,YAAW;IA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AAM,gBAAa;AACjB,UAAMI,YAAY,MAAU5B,QAAI,KAAKpB,cAAc;AACnD,QAAIgD,aAAaC,MAAMC,QAAQF,SAAAA,GAAY;AACzC,WAAK,SAASA;AACd,WAAK,YAAW;IAClB;EACF;EAEA,MAAM,WAAWG,OAAe;AAC9B,UAAMC,MAAM;SAAID;;AAChB,SAAK,SAASC;AACd,UAAUC,QAAI,KAAKrD,gBAAgBoD,GAAAA;EACrC;;EAIA,MAAM,WAAWf,QAAe;AAC9B,UAAM,EAAEiB,QAAQC,IAAG,IAAKC,UAAU5D,OAAM;AACxC,UAAM6D,aAAalB,IAAIgB,GAAAA;AAEvB,UAAMjB,QAAQC,IACZF,OAAOG,IAAI,CAAClB,UAAAA;AACV,aAAOgC,OAAO3B,IAAIL,KAAAA;IACpB,CAAA,CAAA;AAGF,UAAMgC,OAAOI,MAAK;AAClB,WAAmBC,mBAAO,MAAMF,UAAAA;EAClC;AACF;;;AD/MA,IAAA,qBAAe,OAAOG,YAAAA;AACpB,QAAMC,SAASD,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
+ }
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  WNFS_PLUGIN
3
- } from "./chunk-X54OT4V3.mjs";
3
+ } from "./chunk-PHTWWADN.mjs";
4
4
 
5
5
  // packages/plugins/plugin-wnfs/src/capabilities/capabilities.ts
6
6
  import { defineCapability } from "@dxos/app-framework";
7
- var WnfsCapabilities;
8
7
  (function(WnfsCapabilities2) {
9
8
  WnfsCapabilities2.Blockstore = defineCapability(`${WNFS_PLUGIN}/capability/blockstore`);
10
9
  WnfsCapabilities2.Instances = defineCapability(`${WNFS_PLUGIN}/capability/instances`);
11
10
  })(WnfsCapabilities || (WnfsCapabilities = {}));
11
+ var WnfsCapabilities;
12
12
 
13
13
  export {
14
14
  WnfsCapabilities
15
15
  };
16
- //# sourceMappingURL=chunk-NIDFBTNY.mjs.map
16
+ //# sourceMappingURL=chunk-DL7BBH57.mjs.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../src/capabilities/capabilities.ts"],
4
4
  "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Blockstore } from 'interface-blockstore';\nimport { type PrivateDirectory, type PrivateForest } from 'wnfs';\n\nimport { defineCapability } from '@dxos/app-framework';\nimport { type SpaceId } from '@dxos/keys';\n\nimport { WNFS_PLUGIN } from '../meta';\n\nexport namespace WnfsCapabilities {\n export const Blockstore = defineCapability<Blockstore>(`${WNFS_PLUGIN}/capability/blockstore`);\n\n export type Instances = Record<SpaceId, { directory: PrivateDirectory; forest: PrivateForest }>;\n export const Instances = defineCapability<Instances>(`${WNFS_PLUGIN}/capability/instances`);\n}\n"],
5
- "mappings": ";;;;;AAOA,SAASA,wBAAwB;;UAKhBC,mBAAAA;oBACFC,aAAaC,iBAA6B,GAAGC,WAAAA,wBAAmC;oBAGhFC,YAAYF,iBAA4B,GAAGC,WAAAA,uBAAkC;AAC5F,GALiBH,qBAAAA,mBAAAA,CAAAA,EAAAA;",
5
+ "mappings": ";;;;;AAOA,SAASA,wBAAwB;UAKhBC,mBAAAA;oBACFC,aAAaC,iBAA6B,GAAGC,WAAAA,wBAAmC;oBAGhFC,YAAYF,iBAA4B,GAAGC,WAAAA,uBAAkC;AAC5F,GALiBH,qBAAAA,mBAAAA,CAAAA,EAAAA;;",
6
6
  "names": ["defineCapability", "WnfsCapabilities", "Blockstore", "defineCapability", "WNFS_PLUGIN", "Instances"]
7
7
  }
@@ -0,0 +1,16 @@
1
+ // packages/plugins/plugin-wnfs/src/capabilities/index.ts
2
+ import { lazy } from "@dxos/app-framework";
3
+ var Blockstore = lazy(() => import("./blockstore-UT7233RJ.mjs"));
4
+ var FileUploader = lazy(() => import("./file-uploader-OQHVKRQ5.mjs"));
5
+ var IntentResolver = lazy(() => import("./intent-resolver-42B3MXJZ.mjs"));
6
+ var Markdown = lazy(() => import("./markdown-BWBHUHHH.mjs"));
7
+ var ReactSurface = lazy(() => import("./react-surface-GTYQZY3L.mjs"));
8
+
9
+ export {
10
+ Blockstore,
11
+ FileUploader,
12
+ IntentResolver,
13
+ Markdown,
14
+ ReactSurface
15
+ };
16
+ //# sourceMappingURL=chunk-LQYDI474.mjs.map
@@ -5,11 +5,11 @@ var meta = {
5
5
  name: "WNFS",
6
6
  description: "Manage and view files with via the Web Native File System (WNFS).",
7
7
  icon: "ph--file-cloud--regular",
8
- source: "https://github.com/dxos/dxos/tree/main/packages/plugins/experimental/plugin-wnfs"
8
+ source: "https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-wnfs"
9
9
  };
10
10
 
11
11
  export {
12
12
  WNFS_PLUGIN,
13
13
  meta
14
14
  };
15
- //# sourceMappingURL=chunk-X54OT4V3.mjs.map
15
+ //# sourceMappingURL=chunk-PHTWWADN.mjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/meta.ts"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type PluginMeta } from '@dxos/app-framework';\n\nexport const WNFS_PLUGIN = 'dxos.org/plugin/wnfs';\n\nexport const meta: PluginMeta = {\n id: WNFS_PLUGIN,\n name: 'WNFS',\n description: 'Manage and view files with via the Web Native File System (WNFS).',\n icon: 'ph--file-cloud--regular',\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/experimental/plugin-wnfs',\n};\n"],
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type PluginMeta } from '@dxos/app-framework';\n\nexport const WNFS_PLUGIN = 'dxos.org/plugin/wnfs';\n\nexport const meta: PluginMeta = {\n id: WNFS_PLUGIN,\n name: 'WNFS',\n description: 'Manage and view files with via the Web Native File System (WNFS).',\n icon: 'ph--file-cloud--regular',\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-wnfs',\n};\n"],
5
5
  "mappings": ";AAMO,IAAMA,cAAc;AAEpB,IAAMC,OAAmB;EAC9BC,IAAIF;EACJG,MAAM;EACNC,aAAa;EACbC,MAAM;EACNC,QAAQ;AACV;",
6
6
  "names": ["WNFS_PLUGIN", "meta", "id", "name", "description", "icon", "source"]
7
7
  }
@@ -1,37 +1,37 @@
1
1
  import {
2
2
  WNFS_PLUGIN
3
- } from "./chunk-X54OT4V3.mjs";
3
+ } from "./chunk-PHTWWADN.mjs";
4
4
 
5
5
  // packages/plugins/plugin-wnfs/src/types/file.ts
6
- import { S, TypedObject } from "@dxos/echo-schema";
6
+ import { Schema } from "effect";
7
+ import { TypedObject } from "@dxos/echo-schema";
7
8
  var FileType = class extends TypedObject({
8
9
  typename: "dxos.org/type/File",
9
10
  version: "0.1.0"
10
11
  })({
11
- name: S.optional(S.String),
12
- type: S.String,
13
- cid: S.String,
14
- timestamp: S.optional(S.String)
12
+ name: Schema.optional(Schema.String),
13
+ type: Schema.String,
14
+ cid: Schema.String,
15
+ timestamp: Schema.optional(Schema.String)
15
16
  }) {
16
17
  };
17
18
 
18
19
  // packages/plugins/plugin-wnfs/src/types/types.ts
20
+ import { Schema as Schema2 } from "effect";
19
21
  import { FileInfoSchema } from "@dxos/app-framework";
20
- import { S as S2 } from "@dxos/echo-schema";
21
22
  import { SpaceSchema } from "@dxos/react-client/echo";
22
- var WnfsAction;
23
23
  (function(WnfsAction2) {
24
- class Create extends S2.TaggedClass()(`${WNFS_PLUGIN}/action/create`, {
25
- input: FileInfoSchema.pick("name", "type", "cid").pipe(S2.required),
26
- output: S2.Struct({
24
+ class Create extends Schema2.TaggedClass()(`${WNFS_PLUGIN}/action/create`, {
25
+ input: FileInfoSchema.pick("name", "type", "cid").pipe(Schema2.required),
26
+ output: Schema2.Struct({
27
27
  object: FileType
28
28
  })
29
29
  }) {
30
30
  }
31
31
  WnfsAction2.Create = Create;
32
32
  WnfsAction2.UploadAnnotationId = Symbol.for(`${WNFS_PLUGIN}/annotation/upload`);
33
- WnfsAction2.UploadFileSchema = S2.Struct({
34
- file: S2.instanceOf(File).annotations({
33
+ WnfsAction2.UploadFileSchema = Schema2.Struct({
34
+ file: Schema2.instanceOf(File).annotations({
35
35
  [WnfsAction2.UploadAnnotationId]: {
36
36
  // Accept file types.
37
37
  "image/*": [
@@ -39,22 +39,26 @@ var WnfsAction;
39
39
  ".jpeg",
40
40
  ".png",
41
41
  ".gif"
42
+ ],
43
+ "application/pdf": [
44
+ ".pdf"
42
45
  ]
43
46
  }
44
47
  })
45
48
  });
46
- class Upload extends S2.TaggedClass()(`${WNFS_PLUGIN}/action/upload`, {
47
- input: S2.extend(WnfsAction2.UploadFileSchema, S2.Struct({
49
+ class Upload extends Schema2.TaggedClass()(`${WNFS_PLUGIN}/action/upload`, {
50
+ input: Schema2.extend(WnfsAction2.UploadFileSchema, Schema2.Struct({
48
51
  space: SpaceSchema
49
52
  })),
50
- output: S2.required(FileInfoSchema)
53
+ output: Schema2.required(FileInfoSchema)
51
54
  }) {
52
55
  }
53
56
  WnfsAction2.Upload = Upload;
54
57
  })(WnfsAction || (WnfsAction = {}));
58
+ var WnfsAction;
55
59
 
56
60
  export {
57
61
  FileType,
58
62
  WnfsAction
59
63
  };
60
- //# sourceMappingURL=chunk-FKYLWLNM.mjs.map
64
+ //# sourceMappingURL=chunk-RY5XZCVP.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/types/file.ts", "../../../src/types/types.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { Schema } from 'effect';\n\nimport { TypedObject } from '@dxos/echo-schema';\n\nexport class FileType extends TypedObject({ typename: 'dxos.org/type/File', version: '0.1.0' })({\n name: Schema.optional(Schema.String),\n type: Schema.String,\n cid: Schema.String,\n timestamp: Schema.optional(Schema.String),\n}) {}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Schema } from 'effect';\n\nimport { FileInfoSchema } from '@dxos/app-framework';\nimport { SpaceSchema } from '@dxos/react-client/echo';\n\nimport { FileType } from './file';\nimport { WNFS_PLUGIN } from '../meta';\n\nexport namespace WnfsAction {\n export class Create extends Schema.TaggedClass<Create>()(`${WNFS_PLUGIN}/action/create`, {\n input: FileInfoSchema.pick('name', 'type', 'cid').pipe(Schema.required),\n output: Schema.Struct({\n object: FileType,\n }),\n }) {}\n\n export const UploadAnnotationId = Symbol.for(`${WNFS_PLUGIN}/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 export class Upload extends Schema.TaggedClass<Upload>()(`${WNFS_PLUGIN}/action/upload`, {\n input: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;",
6
+ "names": ["Schema", "TypedObject", "FileType", "TypedObject", "typename", "version", "name", "Schema", "optional", "String", "type", "cid", "timestamp", "Schema", "FileInfoSchema", "SpaceSchema", "WnfsAction", "Create", "Schema", "TaggedClass", "WNFS_PLUGIN", "input", "FileInfoSchema", "pick", "pipe", "required", "output", "Struct", "object", "FileType", "UploadAnnotationId", "Symbol", "for", "UploadFileSchema", "file", "instanceOf", "File", "annotations", "Upload", "extend", "space", "SpaceSchema"]
7
+ }
@@ -96,13 +96,15 @@ var wnfsUrl = (filePath2) => {
96
96
  return "wnfs://" + filePath2.map((f) => encodeURIComponent(f)).join("/");
97
97
  };
98
98
  var getPathFromUrl = (wnfsUrl2) => wnfsUrl2.replace(/^wnfs:\/\//, "").split("/").map((p) => decodeURIComponent(p));
99
- var getBlobUrl = async ({ wnfsUrl: wnfsUrl2, blockstore, directory, forest }) => {
99
+ var getBlobUrl = async ({ wnfsUrl: wnfsUrl2, blockstore, forest, directory, type }) => {
100
100
  const path = getPathFromUrl(wnfsUrl2);
101
101
  const wnfsStore = store(blockstore);
102
102
  const { result } = await directory.read(path, true, forest, wnfsStore);
103
103
  const blob = new Blob([
104
104
  result
105
- ]);
105
+ ], {
106
+ type
107
+ });
106
108
  return URL.createObjectURL(blob);
107
109
  };
108
110
 
@@ -154,4 +156,4 @@ export {
154
156
  getBlobUrl,
155
157
  upload
156
158
  };
157
- //# sourceMappingURL=chunk-SCQWJNHD.mjs.map
159
+ //# sourceMappingURL=chunk-YYAW4U6J.mjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/helpers/common.ts", "../../../src/helpers/load.ts", "../../../src/helpers/wnfs-url.ts", "../../../src/helpers/upload.ts"],
4
- "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport type { Blockstore } from 'interface-blockstore';\nimport { CID } from 'multiformats/cid';\nimport { sha256 } from 'multiformats/hashes/sha2';\nimport { type BlockStore as WnfsBlockStore } from 'wnfs';\n\nimport * as crypto from '@dxos/crypto';\nimport { type Space } from '@dxos/react-client/echo';\n\n//\n// PATH\n//\n\nexport const filePath = (fileName: string, space: Space) => {\n return ['spaces', space.id, 'files', fileName];\n};\n\n//\n// RNG\n//\n\nexport class Rng {\n randomBytes(count: number): Uint8Array {\n return new Uint8Array(crypto.randomBytes(count));\n }\n}\n\n//\n// STORE\n//\n\nexport const store = (blockstore: Blockstore): WnfsBlockStore => {\n const getBlock = async (cid: Uint8Array): Promise<Uint8Array | undefined> => {\n const decodedCid = CID.decode(cid);\n return await blockstore.get(decodedCid);\n };\n\n const hasBlock = async (cid: Uint8Array): Promise<boolean> => {\n const decodedCid = CID.decode(cid);\n return await blockstore.has(decodedCid);\n };\n\n const putBlockKeyed = async (cid: Uint8Array, bytes: Uint8Array): Promise<void> => {\n const decodedCid = CID.decode(cid);\n await blockstore.put(decodedCid, bytes);\n };\n\n // Don't hash blocks with the rs-wnfs default Blake 3, sha256 has better support.\n const putBlock = async (bytes: Uint8Array, codec: number): Promise<Uint8Array> => {\n const hash = await sha256.digest(bytes);\n const cid = CID.create(1, codec, hash);\n await blockstore.put(cid, bytes);\n return cid.bytes;\n };\n\n return { getBlock, hasBlock, putBlockKeyed, putBlock };\n};\n\nexport const storeName = () => 'dxos/wnfs';\n\n//\n// OTHER\n//\n\nexport const readFile = (file: File): Promise<Uint8Array> => {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.onload = (event) => {\n const result = event.target?.result;\n if (result === null || result === undefined || typeof result === 'string') {\n reject(new Error('Expected an ArrayBuffer'));\n return;\n }\n resolve(new Uint8Array(result));\n };\n reader.onerror = (err) => {\n reject(err);\n };\n reader.readAsArrayBuffer(file);\n });\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport type { Blockstore } from 'interface-blockstore';\nimport { CID } from 'multiformats';\nimport * as Uint8Arrays from 'uint8arrays';\nimport { AccessKey, PrivateForest, PrivateDirectory, PrivateNode } from 'wnfs';\n\nimport { type Space } from '@dxos/react-client/echo';\n\nimport { Rng, store } from './common';\nimport { type WnfsCapabilities } from '../capabilities';\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 delete space.properties.wnfs_access_key;\n delete space.properties.wnfs_private_forest_cid;\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 space.properties.wnfs = {\n accessKey: Uint8Arrays.toString(accessKeyRaw.toBytes(), 'base64'),\n privateForestCid: CID.decode(cidBytes).toString(),\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 directory,\n forest,\n}: {\n wnfsUrl: string;\n blockstore: Blockstore;\n directory: PrivateDirectory;\n forest: PrivateForest;\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]);\n return URL.createObjectURL(blob);\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport type { Blockstore } from 'interface-blockstore';\nimport { CID } from 'multiformats';\nimport * as Raw from 'multiformats/codecs/raw';\nimport { sha256 } from 'multiformats/hashes/sha2';\n\nimport type { Space } from '@dxos/client/echo';\nimport { log } from '@dxos/log';\n\nimport { Rng, filePath, store } from './common';\nimport { loadWnfs } from './load';\nimport { wnfsUrl } from './wnfs-url';\nimport { type WnfsCapabilities } from '../capabilities';\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 space.properties.wnfs.privateForestCid = CID.decode(cidBytes).toString();\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"],
5
- "mappings": ";AAKA,SAASA,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,eAAAA;AACpB,QAAMC,WAAW,OAAOC,QAAAA;AACtB,UAAMC,aAAaC,IAAIC,OAAOH,GAAAA;AAC9B,WAAO,MAAMF,WAAWM,IAAIH,UAAAA;EAC9B;AAEA,QAAMI,WAAW,OAAOL,QAAAA;AACtB,UAAMC,aAAaC,IAAIC,OAAOH,GAAAA;AAC9B,WAAO,MAAMF,WAAWQ,IAAIL,UAAAA;EAC9B;AAEA,QAAMM,gBAAgB,OAAOP,KAAiBQ,UAAAA;AAC5C,UAAMP,aAAaC,IAAIC,OAAOH,GAAAA;AAC9B,UAAMF,WAAWW,IAAIR,YAAYO,KAAAA;EACnC;AAGA,QAAME,WAAW,OAAOF,OAAmBG,UAAAA;AACzC,UAAMC,OAAO,MAAMC,OAAOC,OAAON,KAAAA;AACjC,UAAMR,MAAME,IAAIa,OAAO,GAAGJ,OAAOC,IAAAA;AACjC,UAAMd,WAAWW,IAAIT,KAAKQ,KAAAA;AAC1B,WAAOR,IAAIQ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;AACC,QAAM,EAAEC,WAAWC,OAAM,IAAK,MAAMC,SAAS;IAAEL;IAAYC;IAAWC;EAAM,CAAA;AAC5E,QAAMI,YAAYC,MAAMP,UAAAA;AAExB,QAAMQ,QAAQ,IAAIC,WAAW,MAAMV,KAAKW,YAAW,CAAA;AACnD,QAAMC,OAAO,MAAMC,QAAOC,OAAOL,KAAAA;AACjC,QAAMM,MAAMC,KAAIC,OAAO,GAAOC,UAAMN,IAAAA;AAEpC,QAAMO,OAAOC,SAASL,IAAIM,SAAQ,GAAIlB,KAAAA;AAItC,QAAMmB,SAAS,MAAMlB,UAAUmB,MAAMJ,MAAM,MAAMV,OAAO,oBAAIe,KAAAA,GAAQnB,QAAQE,WAAW,IAAIkB,IAAAA,CAAAA;AAI3F,QAAM,CAACC,GAAGC,aAAAA,IAAiB,MAAML,OAAOM,QAAQpB,MAAMc,OAAOjB,QAAQE,WAAW,IAAIkB,IAAAA,CAAAA;AACpF,QAAMI,WAAW,MAAMF,cAAcnB,MAAMD,SAAAA;AAG3CJ,QAAM2B,WAAWC,KAAKC,mBAAmBhB,KAAIiB,OAAOJ,QAAAA,EAAUR,SAAQ;AAGtE,QAAMa,OAAO;IACXC,MAAMnC,KAAKmC;IACXC,MAAMpC,KAAKoC;IACXC,KAAKC,QAAQnB,IAAAA;IACbJ,KAAKA,IAAIM,SAAQ;EACnB;AAEAkB,MAAI,UAAU;IAAEvC;IAAMkC;EAAK,GAAA;;;;;;AAC3B,SAAOA;AACT;",
6
- "names": ["CID", "sha256", "crypto", "filePath", "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", "storeName", "CID", "Uint8Arrays", "AccessKey", "PrivateForest", "PrivateDirectory", "PrivateNode", "loadWnfs", "space", "blockstore", "instances", "properties", "wnfs_access_key", "undefined", "wnfs_private_forest_cid", "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", "getPathFromUrl", "replace", "split", "p", "decodeURIComponent", "getBlobUrl", "blockstore", "directory", "forest", "path", "wnfsStore", "store", "result", "read", "blob", "Blob", "URL", "createObjectURL", "CID", "Raw", "sha256", "log", "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", "properties", "wnfs", "privateForestCid", "decode", "info", "name", "type", "url", "wnfsUrl", "log"]
4
+ "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport type { Blockstore } from 'interface-blockstore';\nimport { CID } from 'multiformats/cid';\nimport { sha256 } from 'multiformats/hashes/sha2';\nimport { type BlockStore as WnfsBlockStore } from 'wnfs';\n\nimport * as crypto from '@dxos/crypto';\nimport { type Space } from '@dxos/react-client/echo';\n\n//\n// PATH\n//\n\nexport const filePath = (fileName: string, space: Space) => {\n return ['spaces', space.id, 'files', fileName];\n};\n\n//\n// RNG\n//\n\nexport class Rng {\n randomBytes(count: number): Uint8Array {\n return new Uint8Array(crypto.randomBytes(count));\n }\n}\n\n//\n// STORE\n//\n\nexport const store = (blockstore: Blockstore): WnfsBlockStore => {\n const getBlock = async (cid: Uint8Array): Promise<Uint8Array | undefined> => {\n const decodedCid = CID.decode(cid);\n return await blockstore.get(decodedCid);\n };\n\n const hasBlock = async (cid: Uint8Array): Promise<boolean> => {\n const decodedCid = CID.decode(cid);\n return await blockstore.has(decodedCid);\n };\n\n const putBlockKeyed = async (cid: Uint8Array, bytes: Uint8Array): Promise<void> => {\n const decodedCid = CID.decode(cid);\n await blockstore.put(decodedCid, bytes);\n };\n\n // Don't hash blocks with the rs-wnfs default Blake 3, sha256 has better support.\n const putBlock = async (bytes: Uint8Array, codec: number): Promise<Uint8Array> => {\n const hash = await sha256.digest(bytes);\n const cid = CID.create(1, codec, hash);\n await blockstore.put(cid, bytes);\n return cid.bytes;\n };\n\n return { getBlock, hasBlock, putBlockKeyed, putBlock };\n};\n\nexport const storeName = () => 'dxos/wnfs';\n\n//\n// OTHER\n//\n\nexport const readFile = (file: File): Promise<Uint8Array> => {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.onload = (event) => {\n const result = event.target?.result;\n if (result === null || result === undefined || typeof result === 'string') {\n reject(new Error('Expected an ArrayBuffer'));\n return;\n }\n resolve(new Uint8Array(result));\n };\n reader.onerror = (err) => {\n reject(err);\n };\n reader.readAsArrayBuffer(file);\n });\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport type { Blockstore } from 'interface-blockstore';\nimport { CID } from 'multiformats';\nimport * as Uint8Arrays from 'uint8arrays';\nimport { AccessKey, PrivateForest, PrivateDirectory, PrivateNode } from 'wnfs';\n\nimport { type Space } from '@dxos/react-client/echo';\n\nimport { Rng, store } from './common';\nimport { type WnfsCapabilities } from '../capabilities';\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 delete space.properties.wnfs_access_key;\n delete space.properties.wnfs_private_forest_cid;\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 space.properties.wnfs = {\n accessKey: Uint8Arrays.toString(accessKeyRaw.toBytes(), 'base64'),\n privateForestCid: CID.decode(cidBytes).toString(),\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", "//\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 { log } from '@dxos/log';\n\nimport { Rng, filePath, store } from './common';\nimport { loadWnfs } from './load';\nimport { wnfsUrl } from './wnfs-url';\nimport { type WnfsCapabilities } from '../capabilities';\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 space.properties.wnfs.privateForestCid = CID.decode(cidBytes).toString();\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"],
5
+ "mappings": ";AAKA,SAASA,WAAW;AACpB,SAASC,cAAc;AA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MmB,SAAS,MAAMlB,UAAUmB,MAAMJ,MAAM,MAAMV,OAAO,oBAAIe,KAAAA,GAAQnB,QAAQE,WAAW,IAAIkB,IAAAA,CAAAA;AAI3F,QAAM,CAACC,GAAGC,aAAAA,IAAiB,MAAML,OAAOM,QAAQpB,MAAMc,OAAOjB,QAAQE,WAAW,IAAIkB,IAAAA,CAAAA;AACpF,QAAMI,WAAW,MAAMF,cAAcnB,MAAMD,SAAAA;AAG3CJ,QAAM2B,WAAWC,KAAKC,mBAAmBhB,KAAIiB,OAAOJ,QAAAA,EAAUR,SAAQ;AAGtE,QAAMa,OAAO;IACXC,MAAMnC,KAAKmC;IACXC,MAAMpC,KAAKoC;IACXC,KAAKC,QAAQnB,IAAAA;IACbJ,KAAKA,IAAIM,SAAQ;EACnB;AAEAkB,MAAI,UAAU;IAAEvC;IAAMkC;EAAK,GAAA;;;;;;AAC3B,SAAOA;AACT;",
6
+ "names": ["CID", "sha256", "crypto", "filePath", "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", "storeName", "CID", "Uint8Arrays", "AccessKey", "PrivateForest", "PrivateDirectory", "PrivateNode", "loadWnfs", "space", "blockstore", "instances", "properties", "wnfs_access_key", "undefined", "wnfs_private_forest_cid", "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", "getPathFromUrl", "replace", "split", "p", "decodeURIComponent", "getBlobUrl", "blockstore", "forest", "directory", "type", "path", "wnfsStore", "store", "result", "read", "blob", "Blob", "URL", "createObjectURL", "CID", "Raw", "sha256", "log", "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", "properties", "wnfs", "privateForestCid", "decode", "info", "name", "type", "url", "wnfsUrl", "log"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  WnfsAction
3
- } from "./chunk-FKYLWLNM.mjs";
4
- import "./chunk-X54OT4V3.mjs";
3
+ } from "./chunk-RY5XZCVP.mjs";
4
+ import "./chunk-PHTWWADN.mjs";
5
5
 
6
6
  // packages/plugins/plugin-wnfs/src/capabilities/file-uploader.ts
7
7
  import { Effect, pipe } from "effect";
@@ -9,7 +9,7 @@ import { Capabilities, chain, contributes, createIntent } from "@dxos/app-framew
9
9
  import { SpaceAction } from "@dxos/plugin-space/types";
10
10
  var file_uploader_default = (context) => {
11
11
  return contributes(Capabilities.FileUploader, (file, space) => {
12
- const { dispatch } = context.requestCapability(Capabilities.IntentDispatcher);
12
+ const { dispatch } = context.getCapability(Capabilities.IntentDispatcher);
13
13
  const program = Effect.gen(function* () {
14
14
  const fileInfo = yield* dispatch(createIntent(WnfsAction.Upload, {
15
15
  file,
@@ -26,4 +26,4 @@ var file_uploader_default = (context) => {
26
26
  export {
27
27
  file_uploader_default as default
28
28
  };
29
- //# sourceMappingURL=file-uploader-L4TDVJBE.mjs.map
29
+ //# sourceMappingURL=file-uploader-OQHVKRQ5.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/capabilities/file-uploader.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Effect, pipe } from 'effect';\n\nimport { Capabilities, chain, contributes, createIntent, type PluginContext } from '@dxos/app-framework';\nimport { SpaceAction } from '@dxos/plugin-space/types';\n\nimport { WnfsAction } from '../types';\n\nexport default (context: PluginContext) => {\n return contributes(Capabilities.FileUploader, (file, space) => {\n const { dispatch } = context.getCapability(Capabilities.IntentDispatcher);\n\n const program = Effect.gen(function* () {\n const fileInfo = yield* dispatch(createIntent(WnfsAction.Upload, { file, space }));\n yield* dispatch(pipe(createIntent(WnfsAction.Create, fileInfo), chain(SpaceAction.AddObject, { target: space })));\n return fileInfo;\n });\n\n return Effect.runPromise(program);\n });\n};\n"],
5
+ "mappings": ";;;;;;AAIA,SAASA,QAAQC,YAAY;AAE7B,SAASC,cAAcC,OAAOC,aAAaC,oBAAwC;AACnF,SAASC,mBAAmB;AAI5B,IAAA,wBAAe,CAACC,YAAAA;AACd,SAAOC,YAAYC,aAAaC,cAAc,CAACC,MAAMC,UAAAA;AACnD,UAAM,EAAEC,SAAQ,IAAKN,QAAQO,cAAcL,aAAaM,gBAAgB;AAExE,UAAMC,UAAUC,OAAOC,IAAI,aAAA;AACzB,YAAMC,WAAW,OAAON,SAASO,aAAaC,WAAWC,QAAQ;QAAEX;QAAMC;MAAM,CAAA,CAAA;AAC/E,aAAOC,SAASU,KAAKH,aAAaC,WAAWG,QAAQL,QAAAA,GAAWM,MAAMC,YAAYC,WAAW;QAAEC,QAAQhB;MAAM,CAAA,CAAA,CAAA;AAC7G,aAAOO;IACT,CAAA;AAEA,WAAOF,OAAOY,WAAWb,OAAAA;EAC3B,CAAA;AACF;",
6
+ "names": ["Effect", "pipe", "Capabilities", "chain", "contributes", "createIntent", "SpaceAction", "context", "contributes", "Capabilities", "FileUploader", "file", "space", "dispatch", "getCapability", "IntentDispatcher", "program", "Effect", "gen", "fileInfo", "createIntent", "WnfsAction", "Upload", "pipe", "Create", "chain", "SpaceAction", "AddObject", "target", "runPromise"]
7
+ }
@@ -4,18 +4,18 @@ import {
4
4
  IntentResolver,
5
5
  Markdown,
6
6
  ReactSurface
7
- } from "./chunk-FH2Q7ZBE.mjs";
7
+ } from "./chunk-LQYDI474.mjs";
8
8
  import {
9
9
  WnfsCapabilities
10
- } from "./chunk-NIDFBTNY.mjs";
10
+ } from "./chunk-DL7BBH57.mjs";
11
11
  import {
12
12
  FileType,
13
13
  WnfsAction
14
- } from "./chunk-FKYLWLNM.mjs";
14
+ } from "./chunk-RY5XZCVP.mjs";
15
15
  import {
16
16
  WNFS_PLUGIN,
17
17
  meta
18
- } from "./chunk-X54OT4V3.mjs";
18
+ } from "./chunk-PHTWWADN.mjs";
19
19
 
20
20
  // packages/plugins/plugin-wnfs/src/WnfsPlugin.tsx
21
21
  import { pipe } from "effect";
@@ -1,18 +1,18 @@
1
1
  import {
2
2
  upload
3
- } from "./chunk-SCQWJNHD.mjs";
3
+ } from "./chunk-YYAW4U6J.mjs";
4
4
  import {
5
5
  WnfsCapabilities
6
- } from "./chunk-NIDFBTNY.mjs";
6
+ } from "./chunk-DL7BBH57.mjs";
7
7
  import {
8
8
  FileType,
9
9
  WnfsAction
10
- } from "./chunk-FKYLWLNM.mjs";
11
- import "./chunk-X54OT4V3.mjs";
10
+ } from "./chunk-RY5XZCVP.mjs";
11
+ import "./chunk-PHTWWADN.mjs";
12
12
 
13
13
  // packages/plugins/plugin-wnfs/src/capabilities/intent-resolver.ts
14
14
  import { contributes, Capabilities, createResolver } from "@dxos/app-framework";
15
- import { create } from "@dxos/react-client/echo";
15
+ import { live } from "@dxos/react-client/echo";
16
16
  var intent_resolver_default = (context) => contributes(Capabilities.IntentResolver, [
17
17
  // TODO(wittjosiah): Deleting the object doesn't delete the wnfs blob.
18
18
  // Consider ways to trigger blob deletion based on object deletion and/or adding file system manager.
@@ -20,7 +20,7 @@ var intent_resolver_default = (context) => contributes(Capabilities.IntentResolv
20
20
  intent: WnfsAction.Create,
21
21
  resolve: ({ name, type, cid }) => ({
22
22
  data: {
23
- object: create(FileType, {
23
+ object: live(FileType, {
24
24
  name,
25
25
  type,
26
26
  cid
@@ -31,7 +31,7 @@ var intent_resolver_default = (context) => contributes(Capabilities.IntentResolv
31
31
  createResolver({
32
32
  intent: WnfsAction.Upload,
33
33
  resolve: async ({ file, space }) => {
34
- const blockstore = context.requestCapability(WnfsCapabilities.Blockstore);
34
+ const blockstore = context.getCapability(WnfsCapabilities.Blockstore);
35
35
  const info = await upload({
36
36
  file,
37
37
  blockstore,
@@ -46,4 +46,4 @@ var intent_resolver_default = (context) => contributes(Capabilities.IntentResolv
46
46
  export {
47
47
  intent_resolver_default as default
48
48
  };
49
- //# sourceMappingURL=intent-resolver-VSMIQLGS.mjs.map
49
+ //# sourceMappingURL=intent-resolver-42B3MXJZ.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/capabilities/intent-resolver.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { contributes, Capabilities, createResolver, type PluginContext } from '@dxos/app-framework';\nimport { live } from '@dxos/react-client/echo';\n\nimport { WnfsCapabilities } from './capabilities';\nimport { upload } from '../helpers';\nimport { FileType, WnfsAction } from '../types';\n\nexport default (context: PluginContext) =>\n contributes(Capabilities.IntentResolver, [\n // TODO(wittjosiah): Deleting the object doesn't delete the wnfs blob.\n // Consider ways to trigger blob deletion based on object deletion and/or adding file system manager.\n createResolver({\n intent: WnfsAction.Create,\n resolve: ({ name, type, cid }) => ({\n data: {\n object: live(FileType, { name, type, cid }),\n },\n }),\n }),\n createResolver({\n intent: WnfsAction.Upload,\n resolve: async ({ file, space }) => {\n const blockstore = context.getCapability(WnfsCapabilities.Blockstore);\n const info = await upload({ file, blockstore, space });\n return { data: info };\n },\n }),\n ]);\n"],
5
+ "mappings": ";;;;;;;;;;;;;AAIA,SAASA,aAAaC,cAAcC,sBAA0C;AAC9E,SAASC,YAAY;AAMrB,IAAA,0BAAe,CAACC,YACdC,YAAYC,aAAaC,gBAAgB;;;EAGvCC,eAAe;IACbC,QAAQC,WAAWC;IACnBC,SAAS,CAAC,EAAEC,MAAMC,MAAMC,IAAG,OAAQ;MACjCC,MAAM;QACJC,QAAQC,KAAKC,UAAU;UAAEN;UAAMC;UAAMC;QAAI,CAAA;MAC3C;IACF;EACF,CAAA;EACAP,eAAe;IACbC,QAAQC,WAAWU;IACnBR,SAAS,OAAO,EAAES,MAAMC,MAAK,MAAE;AAC7B,YAAMC,aAAanB,QAAQoB,cAAcC,iBAAiBC,UAAU;AACpE,YAAMC,OAAO,MAAMC,OAAO;QAAEP;QAAME;QAAYD;MAAM,CAAA;AACpD,aAAO;QAAEN,MAAMW;MAAK;IACtB;EACF,CAAA;CACD;",
6
+ "names": ["contributes", "Capabilities", "createResolver", "live", "context", "contributes", "Capabilities", "IntentResolver", "createResolver", "intent", "WnfsAction", "Create", "resolve", "name", "type", "cid", "data", "object", "live", "FileType", "Upload", "file", "space", "blockstore", "getCapability", "WnfsCapabilities", "Blockstore", "info", "upload"]
7
+ }
@@ -2,11 +2,11 @@ import {
2
2
  getBlobUrl,
3
3
  getPathFromUrl,
4
4
  loadWnfs
5
- } from "./chunk-SCQWJNHD.mjs";
5
+ } from "./chunk-YYAW4U6J.mjs";
6
6
  import {
7
7
  WnfsCapabilities
8
- } from "./chunk-NIDFBTNY.mjs";
9
- import "./chunk-X54OT4V3.mjs";
8
+ } from "./chunk-DL7BBH57.mjs";
9
+ import "./chunk-PHTWWADN.mjs";
10
10
 
11
11
  // packages/plugins/plugin-wnfs/src/capabilities/markdown.ts
12
12
  import { contributes } from "@dxos/app-framework";
@@ -138,9 +138,7 @@ var createImg = (view, url) => {
138
138
  };
139
139
  var WnfsImageWidget = class extends WidgetType {
140
140
  constructor(_wnfsUrl, _url) {
141
- super();
142
- this._wnfsUrl = _wnfsUrl;
143
- this._url = _url;
141
+ super(), this._wnfsUrl = _wnfsUrl, this._url = _url;
144
142
  }
145
143
  eq(other) {
146
144
  return this._wnfsUrl === other._wnfsUrl;
@@ -177,8 +175,8 @@ var WnfsImageWidget = class extends WidgetType {
177
175
  // packages/plugins/plugin-wnfs/src/capabilities/markdown.ts
178
176
  var markdown_default = (context) => contributes(MarkdownCapabilities.Extensions, [
179
177
  ({ document: document2 }) => {
180
- const blockstore = context.requestCapability(WnfsCapabilities.Blockstore);
181
- const instances = context.requestCapability(WnfsCapabilities.Instances);
178
+ const blockstore = context.getCapability(WnfsCapabilities.Blockstore);
179
+ const instances = context.getCapability(WnfsCapabilities.Instances);
182
180
  if (document2) {
183
181
  const space = getSpace(document2);
184
182
  return space ? [
@@ -195,4 +193,4 @@ var markdown_default = (context) => contributes(MarkdownCapabilities.Extensions,
195
193
  export {
196
194
  markdown_default as default
197
195
  };
198
- //# sourceMappingURL=markdown-MWMZVPEX.mjs.map
196
+ //# sourceMappingURL=markdown-BWBHUHHH.mjs.map