@dxos/random-access-storage 0.8.4-main.c85a9c8dae → 0.8.4-main.d05539e30a

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 (41) hide show
  1. package/LICENSE +102 -5
  2. package/dist/lib/browser/browser/index.mjs +15 -104
  3. package/dist/lib/browser/browser/index.mjs.map +3 -3
  4. package/dist/lib/browser/{chunk-QQKT3REB.mjs → chunk-V3ALAPAH.mjs} +7 -37
  5. package/dist/lib/browser/chunk-V3ALAPAH.mjs.map +7 -0
  6. package/dist/lib/browser/meta.json +1 -1
  7. package/dist/lib/browser/node/index.mjs +2 -2
  8. package/dist/lib/browser/node/index.mjs.map +3 -3
  9. package/dist/lib/node-esm/browser/index.mjs +15 -104
  10. package/dist/lib/node-esm/browser/index.mjs.map +3 -3
  11. package/dist/lib/node-esm/{chunk-OW63I6TJ.mjs → chunk-7W2LPI7I.mjs} +7 -37
  12. package/dist/lib/node-esm/chunk-7W2LPI7I.mjs.map +7 -0
  13. package/dist/lib/node-esm/meta.json +1 -1
  14. package/dist/lib/node-esm/node/index.mjs +2 -2
  15. package/dist/lib/node-esm/node/index.mjs.map +3 -3
  16. package/dist/types/src/browser/idb-storage.d.ts.map +1 -1
  17. package/dist/types/src/browser/storage.d.ts.map +1 -1
  18. package/dist/types/src/browser/web-fs.d.ts +1 -1
  19. package/dist/types/src/browser/web-fs.d.ts.map +1 -1
  20. package/dist/types/src/common/abstract-storage.d.ts.map +1 -1
  21. package/dist/types/src/common/directory.d.ts.map +1 -1
  22. package/dist/types/src/common/file.d.ts.map +1 -1
  23. package/dist/types/src/common/memory-storage.d.ts.map +1 -1
  24. package/dist/types/src/common/utils.d.ts.map +1 -1
  25. package/dist/types/src/node/node-storage.d.ts.map +1 -1
  26. package/dist/types/src/node/storage.d.ts.map +1 -1
  27. package/dist/types/src/testing/benchmark.blueprint-test.d.ts.map +1 -1
  28. package/dist/types/src/testing/storage.blueprint-test.d.ts.map +1 -1
  29. package/dist/types/tsconfig.tsbuildinfo +1 -1
  30. package/package.json +9 -12
  31. package/src/browser/bench.browser.test.ts +0 -1
  32. package/src/browser/storage.browser.test.ts +0 -1
  33. package/src/browser/storage.ts +0 -1
  34. package/src/browser/web-fs.ts +0 -1
  35. package/src/common/abstract-storage.ts +0 -1
  36. package/src/node/bench.node.test.ts +1 -3
  37. package/src/node/node-storage.ts +1 -2
  38. package/src/node/storage.node.test.ts +1 -3
  39. package/src/node/storage.ts +0 -1
  40. package/dist/lib/browser/chunk-QQKT3REB.mjs.map +0 -7
  41. package/dist/lib/node-esm/chunk-OW63I6TJ.mjs.map +0 -7
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/common/utils.ts", "../../../src/common/directory.ts", "../../../src/common/file.ts", "../../../src/common/abstract-storage.ts", "../../../src/common/storage.ts", "../../../src/common/memory-storage.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2022 DXOS.org\n//\n\nimport { join } from 'node:path';\n\n// TODO(burdon): Document.\nexport const stringDiff = (first: string, second: string) => first.split(second).join('');\n\nexport const getFullPath = (root: string, path: string) => join(root, stringDiff(path, root));\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { type File } from './file';\nimport { type StorageType } from './storage';\nimport { getFullPath } from './utils';\n\nexport type DirectoryProps = {\n type: StorageType;\n path: string;\n // TODO(burdon): Create interface for these methods (shared with AbstractStorage).\n list: (path: string) => Promise<string[]>;\n getOrCreateFile: (path: string, filename: string, opts?: any) => File;\n remove: () => Promise<void>;\n onFlush?: () => Promise<void>;\n};\n\n/**\n * Wraps a directory in the storage file system.\n */\nexport class Directory {\n public readonly type: StorageType;\n public readonly path: string;\n // TODO(burdon): Create interface for these methods (shared with AbstractStorage).\n private readonly _list: (path: string) => Promise<string[]>;\n private readonly _getOrCreateFile: (path: string, filename: string, opts?: any) => File;\n private readonly _remove: () => Promise<void>;\n private readonly _onFlush?: () => Promise<void>;\n\n constructor({ type, path, list, getOrCreateFile, remove, onFlush }: DirectoryProps) {\n this.type = type;\n this.path = path;\n this._list = list;\n this._getOrCreateFile = getOrCreateFile;\n this._remove = remove;\n this._onFlush = onFlush;\n }\n\n toString(): string {\n return `Directory(${JSON.stringify({ type: this.type, path: this.path })})`;\n }\n\n /**\n * Create a new sub-directory.\n */\n createDirectory(path: string): Directory {\n return new Directory({\n type: this.type,\n path: getFullPath(this.path, path),\n list: this._list,\n getOrCreateFile: this._getOrCreateFile,\n remove: this._remove,\n });\n }\n\n /**\n * Get all files in the current directory.\n */\n list(): Promise<string[]> {\n return this._list(this.path);\n }\n\n /**\n * Get or create a new file.\n */\n getOrCreateFile(filename: string, opts?: any): File {\n return this._getOrCreateFile(this.path, filename, opts);\n }\n\n async flush(): Promise<void> {\n await this._onFlush?.();\n }\n\n /**\n * Close and delete all files in the directory and all its sub-directories.\n */\n async delete(): Promise<void> {\n await this._remove();\n }\n}\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport pify from 'pify';\nimport type { FileStat, RandomAccessStorage, RandomAccessStorageProperties } from 'random-access-storage';\n\nimport { log } from '@dxos/log';\n\nimport { type StorageType } from './storage';\n\nconst MAX_STORAGE_OPERATION_TIME = 50;\n\n/**\n * Random access file wrapper.\n * https://github.com/random-access-storage/random-access-storage\n */\nexport interface File extends RandomAccessStorageProperties {\n readonly destroyed: boolean;\n\n // TODO(burdon): Can we remove these since they are not standard across implementations?\n readonly directory: string;\n readonly filename: string;\n\n // Added by factory.\n readonly type: StorageType;\n readonly native: RandomAccessStorage;\n\n write(offset: number, data: Buffer): Promise<void>;\n read(offset: number, size: number): Promise<Buffer>;\n del(offset: number, size: number): Promise<void>;\n stat(): Promise<FileStat>;\n close(): Promise<Error | void>;\n destroy(): Promise<Error | void>;\n\n /**\n * Save changes to disk.\n */\n flush?(): Promise<void>;\n\n // Not supported in node, memory.\n truncate?(offset: number): Promise<void>;\n\n // random-access-memory only.\n clone?(): RandomAccessStorage;\n}\n\nconst pifyFields = (object: any, type: StorageType, fields: string[]) => {\n for (const field of fields) {\n if (!object[field]) {\n // TODO(burdon): Suppress warning and throw error if used.\n // console.warn(`Field not supported for type: ${JSON.stringify({ type, field })}`);\n } else {\n const fn = pify(object[field].bind(object));\n object[field] = async (...args: any) => {\n const before = performance.now();\n\n const res = await fn(...args);\n\n const elapsed = performance.now() - before;\n if (elapsed > MAX_STORAGE_OPERATION_TIME) {\n log('Slow storage operation', { type, operation: field, elapsed });\n }\n\n return res;\n };\n }\n }\n\n return object;\n};\n\n/**\n * Construct async File wrapper.\n * NOTE: This is safe since these are interface methods only (not used internally).\n */\nexport const wrapFile = (native: RandomAccessStorage, type: StorageType): File => {\n const file = pifyFields(native, type, ['write', 'read', 'del', 'stat', 'close', 'destroy', 'truncate']);\n return Object.assign(file, { type, native });\n};\n", "//\n// Copyright 2021 DXOS.org\n//\n\nimport { join } from 'node:path';\nimport { inspect } from 'node:util';\nimport type { RandomAccessStorage } from 'random-access-storage';\n\nimport { inspectObject } from '@dxos/debug';\nimport { log } from '@dxos/log';\n\nimport { Directory } from './directory';\nimport { type File, wrapFile } from './file';\nimport { type Storage, type StorageType } from './storage';\nimport { getFullPath } from './utils';\n\n/**\n * Base class for all storage implementations.\n * https://github.com/random-access-storage\n * https://github.com/random-access-storage/random-access-storage\n */\n// TODO(dmaretskyi): Remove this class.\nexport abstract class AbstractStorage implements Storage {\n protected readonly _files = new Map<string, File>();\n\n public abstract readonly type: StorageType;\n\n // TODO(burdon): Make required.\n constructor(public readonly path: string) {}\n\n [inspect.custom](): string {\n return inspectObject(this);\n }\n\n toJSON(): { type: StorageType; path: string } {\n return { type: this.type, path: this.path };\n }\n\n public get size() {\n return this._files.size;\n }\n\n // TODO(burdon): Make required.\n public createDirectory(sub = ''): Directory {\n // invariant(sub.length);\n return new Directory({\n type: this.type,\n path: getFullPath(this.path, sub),\n list: this._list.bind(this),\n getOrCreateFile: (...args) => this.getOrCreateFile(...args),\n remove: () => this._remove(sub),\n });\n }\n\n /**\n * Delete all files.\n */\n async reset(): Promise<void> {\n try {\n log.info('Erasing all data...');\n await this._closeFilesInPath('');\n await this._remove('');\n await this._destroy();\n log('Erased...');\n } catch (err: any) {\n log.catch(err);\n }\n }\n\n protected async _list(path: string): Promise<string[]> {\n // TODO(dmaretskyi): Fix me.\n return Array.from((await this._getFiles(path)).keys()).map((filename) => {\n let name = filename.replace(path, '');\n if (name.startsWith('/')) {\n name = name.substring(1);\n }\n return name;\n });\n }\n\n protected getOrCreateFile(path: string, filename: string, opts?: any): File {\n const fullPath = join(path, filename);\n\n let native;\n let file = this._getFileIfExists(fullPath);\n if (file) {\n if (!file.closed) {\n return file;\n }\n\n native = this._openFile(file.native);\n }\n\n if (!native) {\n native = this._createFile(path, filename, opts);\n }\n\n file = wrapFile(native, this.type);\n this._files.set(fullPath, file);\n return file;\n }\n\n protected _destroy(): Promise<void> | undefined {\n return undefined;\n }\n\n /**\n * Attempt to reopen file.\n */\n protected _openFile(file: RandomAccessStorage): RandomAccessStorage | undefined {\n return undefined;\n }\n\n protected abstract _createFile(path: string, filename: string, opts?: any): RandomAccessStorage;\n\n private _getFileIfExists(filename: string): File | undefined {\n if (this._files.has(filename)) {\n const file = this._files.get(filename);\n if (file && !file.destroyed) {\n return file;\n }\n }\n }\n\n protected async _getFiles(path: string): Promise<Map<string, File>> {\n const fullPath = getFullPath(this.path, path);\n return new Map(\n [...this._files.entries()].filter(([path, file]) => path.includes(fullPath) && file.destroyed !== true),\n );\n }\n\n protected async _closeFilesInPath(path: string): Promise<void> {\n await Promise.all(\n Array.from((await this._getFiles(path)).values()).map((file) => file.close().catch((err: any) => log.catch(err))),\n );\n }\n\n async close(): Promise<void> {\n await this._closeFilesInPath('');\n }\n\n // TODO(burdon): Delete directory (not just listed files).\n protected async _remove(path: string): Promise<void> {\n await Promise.all(\n Array.from(await this._getFiles(path)).map(([path, file]) => {\n return file\n .destroy()\n .then(() => this._files.delete(path))\n .catch((err: any) => log.error(err.message));\n }),\n );\n }\n}\n", "//\n// Copyright 2021 DXOS.org\n//\n\nimport { type Directory } from './directory';\n\n// TODO(burdon): Reconcile with ConfigProto.\nexport enum StorageType {\n RAM = 'ram',\n IDB = 'idb',\n /**\n * @deprecated\n */\n CHROME = 'chrome',\n /**\n * @deprecated\n */\n FIREFOX = 'firefox',\n NODE = 'node',\n /**\n * @deprecated\n */\n WEBFS = 'webfs',\n}\n\nexport type DiskInfo = {\n /**\n * Bytes.\n */\n used: number;\n};\n\nexport interface Storage {\n readonly path: string;\n readonly type: StorageType;\n readonly size: number;\n\n getDiskInfo?(): Promise<DiskInfo>;\n\n // TODO(burdon): Make required.\n createDirectory: (path?: string) => Directory;\n reset: () => Promise<void>;\n close: () => Promise<void>;\n}\n\nexport type StorageConstructor = (params?: { type?: StorageType; root?: string }) => Storage;\n", "//\n// Copyright 2021 DXOS.org\n//\n\nimport ram from 'random-access-memory';\nimport { type Callback, type RandomAccessStorage } from 'random-access-storage';\n\nimport { arrayToBuffer } from '@dxos/util';\n\nimport { AbstractStorage } from './abstract-storage';\nimport { type DiskInfo, StorageType } from './storage';\n\n/**\n * Storage interface implementation for RAM.\n * https://github.com/random-access-storage/random-access-memory\n */\nexport class MemoryStorage extends AbstractStorage {\n public override type: StorageType = StorageType.RAM;\n\n protected override _createFile(path: string, filename: string): RandomAccessStorage {\n return this._patchFile(ram());\n }\n\n protected override _openFile(file: RandomAccessStorage): RandomAccessStorage {\n const newFile = file.clone!();\n (newFile as any).closed = false;\n return this._patchFile(newFile);\n }\n\n private _patchFile(file: RandomAccessStorage): RandomAccessStorage {\n // Patch required to make consistent across platforms.\n const trueRead = file.read.bind(file);\n\n file.read = (offset: number, size: number, cb: Callback<Buffer>) =>\n trueRead(offset, size, (err: Error | null, data?: Buffer) => {\n if (err) {\n return cb(err);\n } else {\n return cb(err, arrayToBuffer(data!));\n }\n });\n\n return file;\n }\n\n async getDiskInfo(): Promise<DiskInfo> {\n let used = 0;\n\n for (const file of this._files.values()) {\n const size = (file as any).length;\n used += Number.is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gBAAAA;EACjBC,OAAoBC,YAAYC;EAE7BC,YAAYC,MAAcC,UAAuC;AAClF,WAAO,KAAKC,WAAWC,IAAAA,CAAAA;EACzB;EAEmBC,UAAUC,MAAgD;AAC3E,UAAMC,UAAUD,KAAKE,MAAK;AACzBD,YAAgBE,SAAS;AAC1B,WAAO,KAAKN,WAAWI,OAAAA;EACzB;EAEQJ,WAAWG,MAAgD;AAEjE,UAAMI,WAAWJ,KAAKK,KAAKC,KAAKN,IAAAA;AAEhCA,SAAKK,OAAO,CAACE,QAAgBC,MAAcC,OACzCL,SAASG,QAAQC,MAAM,CAACE,KAAmBC,SAAAA;AACzC,UAAID,KAAK;AACP,eAAOD,GAAGC,GAAAA;MACZ,OAAO;AACL,eAAOD,GAAGC,KAAKE,cAAcD,IAAAA,CAAAA;MAC/B;IACF,CAAA;AAEF,WAAOX;EACT;EAEA,MAAMa,cAAiC;AACrC,QAAIC,OAAO;AAEX,eAAWd,QAAQ,KAAKe,OAAOC,OAAM,GAAI;AACvC,YAAMR,OAAQR,KAAaiB;AAC3BH,cAAQI,OAAOC,MAAMX,IAAAA,IAAQ,IAAIA;IACnC;AAEA,WAAO;MACLM;IACF;EACF;AACF;",
6
+ "names": ["join", "stringDiff", "first", "second", "split", "getFullPath", "root", "path", "Directory", "type", "path", "_list", "_getOrCreateFile", "_remove", "_onFlush", "list", "getOrCreateFile", "remove", "onFlush", "toString", "JSON", "stringify", "createDirectory", "getFullPath", "filename", "opts", "flush", "delete", "pify", "log", "MAX_STORAGE_OPERATION_TIME", "field", "object", "before", "performance", "res", "fn", "args", "elapsed", "type", "operation", "native", "join", "inspect", "inspectObject", "log", "__dxlog_file", "_files", "path", "inspect", "custom", "toJSON", "type", "size", "createDirectory", "Directory", "getFullPath", "list", "_list", "getOrCreateFile", "args", "remove", "_remove", "sub", "log", "_destroy", "err", "catch", "Array", "from", "startsWith", "name", "substring", "native", "file", "_getFileIfExists", "fullPath", "closed", "wrapFile", "destroyed", "Map", "filter", "_closeFilesInPath", "close", "destroy", "StorageType", "ram", "arrayToBuffer", "MemoryStorage", "AbstractStorage", "type", "StorageType", "RAM", "_createFile", "path", "filename", "_patchFile", "ram", "_openFile", "file", "newFile", "clone", "closed", "trueRead", "read", "bind", "offset", "size", "cb", "err", "data", "arrayToBuffer", "getDiskInfo", "used", "_files", "values", "length", "Number", "isNaN"]
7
+ }
@@ -1 +1 @@
1
- {"inputs":{"src/index.ts":{"bytes":462,"imports":[{"path":"#storage","kind":"import-statement","external":true}],"format":"esm"},"src/common/utils.ts":{"bytes":1282,"imports":[{"path":"@dxos/node-std/path","kind":"import-statement","external":true}],"format":"esm"},"src/common/directory.ts":{"bytes":6526,"imports":[{"path":"src/common/utils.ts","kind":"import-statement","original":"./utils"}],"format":"esm"},"src/common/file.ts":{"bytes":6324,"imports":[{"path":"pify","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"src/common/abstract-storage.ts":{"bytes":15034,"imports":[{"path":"@dxos/node-std/path","kind":"import-statement","external":true},{"path":"@dxos/node-std/util","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"src/common/directory.ts","kind":"import-statement","original":"./directory"},{"path":"src/common/file.ts","kind":"import-statement","original":"./file"},{"path":"src/common/utils.ts","kind":"import-statement","original":"./utils"}],"format":"esm"},"src/common/storage.ts":{"bytes":2045,"imports":[],"format":"esm"},"src/common/memory-storage.ts":{"bytes":5299,"imports":[{"path":"random-access-memory","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"src/common/abstract-storage.ts","kind":"import-statement","original":"./abstract-storage"},{"path":"src/common/storage.ts","kind":"import-statement","original":"./storage"}],"format":"esm"},"src/common/index.ts":{"bytes":934,"imports":[{"path":"src/common/abstract-storage.ts","kind":"import-statement","original":"./abstract-storage"},{"path":"src/common/directory.ts","kind":"import-statement","original":"./directory"},{"path":"src/common/file.ts","kind":"import-statement","original":"./file"},{"path":"src/common/memory-storage.ts","kind":"import-statement","original":"./memory-storage"},{"path":"src/common/storage.ts","kind":"import-statement","original":"./storage"},{"path":"src/common/utils.ts","kind":"import-statement","original":"./utils"}],"format":"esm"},"../../../node_modules/.pnpm/random-access-idb@1.2.2_patch_hash=207ec2404ef8b5e9e6d9de8ce83586d215ef77b94a7d0cadced03125874a1d9e/node_modules/random-access-idb/lib/blocks.js":{"bytes":297,"imports":[],"format":"cjs"},"../../../node_modules/.pnpm/random-access-idb@1.2.2_patch_hash=207ec2404ef8b5e9e6d9de8ce83586d215ef77b94a7d0cadced03125874a1d9e/node_modules/random-access-idb/index.js":{"bytes":5428,"imports":[{"path":"random-access-storage","kind":"require-call","external":true},{"path":"inherits","kind":"require-call","external":true},{"path":"next-tick","kind":"require-call","external":true},{"path":"once","kind":"require-call","external":true},{"path":"../../../node_modules/.pnpm/random-access-idb@1.2.2_patch_hash=207ec2404ef8b5e9e6d9de8ce83586d215ef77b94a7d0cadced03125874a1d9e/node_modules/random-access-idb/lib/blocks.js","kind":"require-call","original":"./lib/blocks.js"},{"path":"buffer-from","kind":"require-call","external":true},{"path":"buffer-alloc","kind":"require-call","external":true}],"format":"cjs"},"src/browser/idb-storage.ts":{"bytes":14368,"imports":[{"path":"../../../node_modules/.pnpm/random-access-idb@1.2.2_patch_hash=207ec2404ef8b5e9e6d9de8ce83586d215ef77b94a7d0cadced03125874a1d9e/node_modules/random-access-idb/index.js","kind":"import-statement","original":"random-access-idb"},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"src/common/index.ts","kind":"import-statement","original":"../common"}],"format":"esm"},"src/browser/web-fs.ts":{"bytes":48359,"imports":[{"path":"@dxos/node-std/events","kind":"import-statement","external":true},{"path":"@dxos/node-std/util","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/tracing","kind":"import-statement","external":true},{"path":"src/common/index.ts","kind":"import-statement","original":"../common"}],"format":"esm"},"src/browser/storage.ts":{"bytes":3014,"imports":[{"path":"src/common/index.ts","kind":"import-statement","original":"../common"},{"path":"src/browser/idb-storage.ts","kind":"import-statement","original":"./idb-storage"},{"path":"src/browser/web-fs.ts","kind":"import-statement","original":"./web-fs"}],"format":"esm"},"src/browser/index.ts":{"bytes":558,"imports":[{"path":"src/common/index.ts","kind":"import-statement","original":"../common"},{"path":"src/browser/storage.ts","kind":"import-statement","original":"./storage"}],"format":"esm"},"src/node/node-storage.ts":{"bytes":8430,"imports":[{"path":"@dxos/node-std/fs","kind":"import-statement","external":true},{"path":"@dxos/node-std/fs/promises","kind":"import-statement","external":true},{"path":"@dxos/node-std/path","kind":"import-statement","external":true},{"path":"del","kind":"import-statement","external":true},{"path":"random-access-file","kind":"import-statement","external":true},{"path":"src/common/index.ts","kind":"import-statement","original":"../common"}],"format":"esm"},"src/node/storage.ts":{"bytes":2424,"imports":[{"path":"src/common/index.ts","kind":"import-statement","original":"../common"},{"path":"src/node/node-storage.ts","kind":"import-statement","original":"./node-storage"}],"format":"esm"},"src/node/index.ts":{"bytes":555,"imports":[{"path":"src/common/index.ts","kind":"import-statement","original":"../common"},{"path":"src/node/storage.ts","kind":"import-statement","original":"./storage"}],"format":"esm"}},"outputs":{"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":196},"dist/lib/browser/index.mjs":{"imports":[{"path":"#storage","kind":"import-statement","external":true}],"exports":[],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":26}},"bytes":111},"dist/lib/browser/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":42762},"dist/lib/browser/browser/index.mjs":{"imports":[{"path":"dist/lib/browser/chunk-QQKT3REB.mjs","kind":"import-statement"},{"path":"random-access-storage","kind":"require-call","external":true},{"path":"inherits","kind":"require-call","external":true},{"path":"next-tick","kind":"require-call","external":true},{"path":"once","kind":"require-call","external":true},{"path":"buffer-from","kind":"require-call","external":true},{"path":"buffer-alloc","kind":"require-call","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/node-std/events","kind":"import-statement","external":true},{"path":"@dxos/node-std/util","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/tracing","kind":"import-statement","external":true}],"exports":["AbstractStorage","Directory","MemoryStorage","StorageType","createStorage","getFullPath","stringDiff","wrapFile"],"entryPoint":"src/browser/index.ts","inputs":{"../../../node_modules/.pnpm/random-access-idb@1.2.2_patch_hash=207ec2404ef8b5e9e6d9de8ce83586d215ef77b94a7d0cadced03125874a1d9e/node_modules/random-access-idb/lib/blocks.js":{"bytesInOutput":592},"../../../node_modules/.pnpm/random-access-idb@1.2.2_patch_hash=207ec2404ef8b5e9e6d9de8ce83586d215ef77b94a7d0cadced03125874a1d9e/node_modules/random-access-idb/index.js":{"bytesInOutput":6367},"src/browser/index.ts":{"bytesInOutput":0},"src/browser/idb-storage.ts":{"bytesInOutput":3058},"src/browser/web-fs.ts":{"bytesInOutput":12658},"src/browser/storage.ts":{"bytesInOutput":474}},"bytes":23966},"dist/lib/browser/node/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":5505},"dist/lib/browser/node/index.mjs":{"imports":[{"path":"dist/lib/browser/chunk-QQKT3REB.mjs","kind":"import-statement"},{"path":"@dxos/node-std/fs","kind":"import-statement","external":true},{"path":"@dxos/node-std/fs/promises","kind":"import-statement","external":true},{"path":"@dxos/node-std/path","kind":"import-statement","external":true},{"path":"del","kind":"import-statement","external":true},{"path":"random-access-file","kind":"import-statement","external":true}],"exports":["AbstractStorage","Directory","MemoryStorage","StorageType","createStorage","getFullPath","stringDiff","wrapFile"],"entryPoint":"src/node/index.ts","inputs":{"src/node/index.ts":{"bytesInOutput":0},"src/node/node-storage.ts":{"bytesInOutput":1701},"src/node/storage.ts":{"bytesInOutput":369}},"bytes":2469},"dist/lib/browser/chunk-QQKT3REB.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":18496},"dist/lib/browser/chunk-QQKT3REB.mjs":{"imports":[{"path":"@dxos/node-std/path","kind":"import-statement","external":true},{"path":"pify","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/node-std/path","kind":"import-statement","external":true},{"path":"@dxos/node-std/util","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"random-access-memory","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"exports":["AbstractStorage","Directory","MemoryStorage","StorageType","__commonJS","__require","__toESM","getFullPath","stringDiff","wrapFile"],"inputs":{"src/common/utils.ts":{"bytesInOutput":180},"src/common/directory.ts":{"bytesInOutput":1256},"src/common/file.ts":{"bytesInOutput":1131},"src/common/abstract-storage.ts":{"bytesInOutput":3505},"src/common/storage.ts":{"bytesInOutput":297},"src/common/memory-storage.ts":{"bytesInOutput":846}},"bytes":9302}}}
1
+ {"inputs":{"src/index.ts":{"bytes":370,"imports":[{"path":"#storage","kind":"import-statement","external":true}],"format":"esm"},"src/common/utils.ts":{"bytes":1187,"imports":[{"path":"@dxos/node-std/path","kind":"import-statement","external":true}],"format":"esm"},"src/common/directory.ts":{"bytes":6427,"imports":[{"path":"src/common/utils.ts","kind":"import-statement","original":"./utils"}],"format":"esm"},"src/common/file.ts":{"bytes":6193,"imports":[{"path":"pify","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"src/common/abstract-storage.ts":{"bytes":14542,"imports":[{"path":"@dxos/node-std/path","kind":"import-statement","external":true},{"path":"@dxos/node-std/util","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"src/common/directory.ts","kind":"import-statement","original":"./directory"},{"path":"src/common/file.ts","kind":"import-statement","original":"./file"},{"path":"src/common/utils.ts","kind":"import-statement","original":"./utils"}],"format":"esm"},"src/common/storage.ts":{"bytes":1948,"imports":[],"format":"esm"},"src/common/memory-storage.ts":{"bytes":5195,"imports":[{"path":"random-access-memory","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"src/common/abstract-storage.ts","kind":"import-statement","original":"./abstract-storage"},{"path":"src/common/storage.ts","kind":"import-statement","original":"./storage"}],"format":"esm"},"src/common/index.ts":{"bytes":839,"imports":[{"path":"src/common/abstract-storage.ts","kind":"import-statement","original":"./abstract-storage"},{"path":"src/common/directory.ts","kind":"import-statement","original":"./directory"},{"path":"src/common/file.ts","kind":"import-statement","original":"./file"},{"path":"src/common/memory-storage.ts","kind":"import-statement","original":"./memory-storage"},{"path":"src/common/storage.ts","kind":"import-statement","original":"./storage"},{"path":"src/common/utils.ts","kind":"import-statement","original":"./utils"}],"format":"esm"},"../../../node_modules/.pnpm/random-access-idb@1.2.2_patch_hash=207ec2404ef8b5e9e6d9de8ce83586d215ef77b94a7d0cadced03125874a1d9e/node_modules/random-access-idb/lib/blocks.js":{"bytes":297,"imports":[],"format":"cjs"},"../../../node_modules/.pnpm/random-access-idb@1.2.2_patch_hash=207ec2404ef8b5e9e6d9de8ce83586d215ef77b94a7d0cadced03125874a1d9e/node_modules/random-access-idb/index.js":{"bytes":5428,"imports":[{"path":"random-access-storage","kind":"require-call","external":true},{"path":"inherits","kind":"require-call","external":true},{"path":"next-tick","kind":"require-call","external":true},{"path":"once","kind":"require-call","external":true},{"path":"../../../node_modules/.pnpm/random-access-idb@1.2.2_patch_hash=207ec2404ef8b5e9e6d9de8ce83586d215ef77b94a7d0cadced03125874a1d9e/node_modules/random-access-idb/lib/blocks.js","kind":"require-call","original":"./lib/blocks.js"},{"path":"buffer-from","kind":"require-call","external":true},{"path":"buffer-alloc","kind":"require-call","external":true}],"format":"cjs"},"src/browser/idb-storage.ts":{"bytes":14264,"imports":[{"path":"../../../node_modules/.pnpm/random-access-idb@1.2.2_patch_hash=207ec2404ef8b5e9e6d9de8ce83586d215ef77b94a7d0cadced03125874a1d9e/node_modules/random-access-idb/index.js","kind":"import-statement","original":"random-access-idb"},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"src/common/index.ts","kind":"import-statement","original":"../common"}],"format":"esm"},"src/browser/web-fs.ts":{"bytes":46949,"imports":[{"path":"@dxos/node-std/events","kind":"import-statement","external":true},{"path":"@dxos/node-std/util","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/tracing","kind":"import-statement","external":true},{"path":"src/common/index.ts","kind":"import-statement","original":"../common"}],"format":"esm"},"src/browser/storage.ts":{"bytes":2912,"imports":[{"path":"src/common/index.ts","kind":"import-statement","original":"../common"},{"path":"src/browser/idb-storage.ts","kind":"import-statement","original":"./idb-storage"},{"path":"src/browser/web-fs.ts","kind":"import-statement","original":"./web-fs"}],"format":"esm"},"src/browser/index.ts":{"bytes":458,"imports":[{"path":"src/common/index.ts","kind":"import-statement","original":"../common"},{"path":"src/browser/storage.ts","kind":"import-statement","original":"./storage"}],"format":"esm"},"src/node/node-storage.ts":{"bytes":8326,"imports":[{"path":"del","kind":"import-statement","external":true},{"path":"@dxos/node-std/fs","kind":"import-statement","external":true},{"path":"@dxos/node-std/fs/promises","kind":"import-statement","external":true},{"path":"@dxos/node-std/path","kind":"import-statement","external":true},{"path":"random-access-file","kind":"import-statement","external":true},{"path":"src/common/index.ts","kind":"import-statement","original":"../common"}],"format":"esm"},"src/node/storage.ts":{"bytes":2325,"imports":[{"path":"src/common/index.ts","kind":"import-statement","original":"../common"},{"path":"src/node/node-storage.ts","kind":"import-statement","original":"./node-storage"}],"format":"esm"},"src/node/index.ts":{"bytes":458,"imports":[{"path":"src/common/index.ts","kind":"import-statement","original":"../common"},{"path":"src/node/storage.ts","kind":"import-statement","original":"./storage"}],"format":"esm"}},"outputs":{"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":196},"dist/lib/browser/index.mjs":{"imports":[{"path":"#storage","kind":"import-statement","external":true}],"exports":[],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":26}},"bytes":111},"dist/lib/browser/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":41708},"dist/lib/browser/browser/index.mjs":{"imports":[{"path":"dist/lib/browser/chunk-V3ALAPAH.mjs","kind":"import-statement"},{"path":"random-access-storage","kind":"require-call","external":true},{"path":"inherits","kind":"require-call","external":true},{"path":"next-tick","kind":"require-call","external":true},{"path":"once","kind":"require-call","external":true},{"path":"buffer-from","kind":"require-call","external":true},{"path":"buffer-alloc","kind":"require-call","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/node-std/events","kind":"import-statement","external":true},{"path":"@dxos/node-std/util","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/tracing","kind":"import-statement","external":true}],"exports":["AbstractStorage","Directory","MemoryStorage","StorageType","createStorage","getFullPath","stringDiff","wrapFile"],"entryPoint":"src/browser/index.ts","inputs":{"../../../node_modules/.pnpm/random-access-idb@1.2.2_patch_hash=207ec2404ef8b5e9e6d9de8ce83586d215ef77b94a7d0cadced03125874a1d9e/node_modules/random-access-idb/lib/blocks.js":{"bytesInOutput":592},"../../../node_modules/.pnpm/random-access-idb@1.2.2_patch_hash=207ec2404ef8b5e9e6d9de8ce83586d215ef77b94a7d0cadced03125874a1d9e/node_modules/random-access-idb/index.js":{"bytesInOutput":6367},"src/browser/index.ts":{"bytesInOutput":0},"src/browser/idb-storage.ts":{"bytesInOutput":3030},"src/browser/web-fs.ts":{"bytesInOutput":12212},"src/browser/storage.ts":{"bytesInOutput":474}},"bytes":23492},"dist/lib/browser/node/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":5501},"dist/lib/browser/node/index.mjs":{"imports":[{"path":"dist/lib/browser/chunk-V3ALAPAH.mjs","kind":"import-statement"},{"path":"del","kind":"import-statement","external":true},{"path":"@dxos/node-std/fs","kind":"import-statement","external":true},{"path":"@dxos/node-std/fs/promises","kind":"import-statement","external":true},{"path":"@dxos/node-std/path","kind":"import-statement","external":true},{"path":"random-access-file","kind":"import-statement","external":true}],"exports":["AbstractStorage","Directory","MemoryStorage","StorageType","createStorage","getFullPath","stringDiff","wrapFile"],"entryPoint":"src/node/index.ts","inputs":{"src/node/index.ts":{"bytesInOutput":0},"src/node/node-storage.ts":{"bytesInOutput":1701},"src/node/storage.ts":{"bytesInOutput":369}},"bytes":2469},"dist/lib/browser/chunk-V3ALAPAH.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":18038},"dist/lib/browser/chunk-V3ALAPAH.mjs":{"imports":[{"path":"@dxos/node-std/path","kind":"import-statement","external":true},{"path":"pify","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/node-std/path","kind":"import-statement","external":true},{"path":"@dxos/node-std/util","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"random-access-memory","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"exports":["AbstractStorage","Directory","MemoryStorage","StorageType","__commonJS","__require","__toESM","getFullPath","stringDiff","wrapFile"],"inputs":{"src/common/utils.ts":{"bytesInOutput":180},"src/common/directory.ts":{"bytesInOutput":1256},"src/common/file.ts":{"bytesInOutput":1075},"src/common/abstract-storage.ts":{"bytesInOutput":3335},"src/common/storage.ts":{"bytesInOutput":297},"src/common/memory-storage.ts":{"bytesInOutput":846}},"bytes":9076}}}
@@ -7,13 +7,13 @@ import {
7
7
  getFullPath,
8
8
  stringDiff,
9
9
  wrapFile
10
- } from "../chunk-QQKT3REB.mjs";
10
+ } from "../chunk-V3ALAPAH.mjs";
11
11
 
12
12
  // src/node/node-storage.ts
13
+ import del from "del";
13
14
  import { existsSync } from "@dxos/node-std/fs";
14
15
  import { readdir, stat } from "@dxos/node-std/fs/promises";
15
16
  import { join } from "@dxos/node-std/path";
16
- import del from "del";
17
17
  import raf from "random-access-file";
18
18
  var NodeStorage = class extends AbstractStorage {
19
19
  type = StorageType.NODE;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/node/node-storage.ts", "../../../../src/node/storage.ts"],
4
- "sourcesContent": ["//\n// Copyright 2021 DXOS.org\n//\n\nimport { existsSync } from 'node:fs';\nimport { readdir, stat } from 'node:fs/promises';\nimport { join } from 'node:path';\n\nimport del from 'del';\nimport raf from 'random-access-file';\nimport { type RandomAccessStorage } from 'random-access-storage';\n\nimport { AbstractStorage, type DiskInfo, type Storage, StorageType, wrapFile } from '../common';\n\n/**\n * Storage interface implementation for Node.\n */\nexport class NodeStorage extends AbstractStorage implements Storage {\n public override type: StorageType = StorageType.NODE;\n private _initialized = false;\n\n private async _loadFiles(path: string): Promise<void> {\n // TODO(mykola): Do not load all files at once. It is a quick fix.\n if (!existsSync(path)) {\n return;\n }\n\n // Preload all files in a directory.\n const dir = await readdir(path);\n for (const entry of dir) {\n const fullPath = join(path, entry);\n if (this._files.has(fullPath)) {\n continue;\n }\n const entryInfo = await stat(fullPath);\n if (entryInfo.isDirectory()) {\n await this._loadFiles(fullPath);\n } else if (entryInfo.isFile()) {\n const file = this._createFile(path, entry);\n this._files.set(fullPath, wrapFile(file, this.type));\n }\n }\n }\n\n protected override _createFile(path: string, filename: string, opts: any = {}): RandomAccessStorage {\n const file = raf(filename, { directory: path, ...opts });\n\n // Empty write to create file on a drive.\n file.write(0, Buffer.from(''));\n\n return file;\n }\n\n protected override async _destroy(): Promise<void> {\n await del(this.path, { force: true });\n }\n\n protected override async _getFiles(path: string) {\n if (!this._initialized) {\n await this._loadFiles(this.path);\n this._initialized = true;\n }\n\n return super._getFiles(path);\n }\n\n async getDiskInfo(): Promise<DiskInfo> {\n let used = 0;\n\n const recurse = async (path: string) => {\n const pathStats = await stat(path);\n\n if (pathStats.isDirectory()) {\n const entries = await readdir(path);\n await Promise.all(entries.map((entry) => recurse(join(path, entry))));\n } else {\n used += pathStats.size;\n }\n };\n\n await recurse(this.path);\n\n return {\n used,\n };\n }\n}\n", "//\n// Copyright 2021 DXOS.org\n//\n\nimport { MemoryStorage, type Storage, type StorageConstructor, StorageType } from '../common';\n\nimport { NodeStorage } from './node-storage';\n\nexport const createStorage: StorageConstructor = ({ type, root = '/tmp/dxos/testing' } = {}): Storage => {\n if (type === undefined) {\n return new NodeStorage(root);\n }\n\n switch (type) {\n case StorageType.RAM: {\n return new MemoryStorage(root);\n }\n\n case StorageType.NODE: {\n return new NodeStorage(root);\n }\n\n default: {\n throw new Error(`Invalid type: ${type}`);\n }\n }\n};\n"],
5
- "mappings": ";;;;;;;;;;;;AAIA,SAASA,kBAAkB;AAC3B,SAASC,SAASC,YAAY;AAC9B,SAASC,YAAY;AAErB,OAAOC,SAAS;AAChB,OAAOC,SAAS;AAQT,IAAMC,cAAN,cAA0BC,gBAAAA;EACfC,OAAoBC,YAAYC;EACxCC,eAAe;EAEvB,MAAcC,WAAWC,MAA6B;AAEpD,QAAI,CAACC,WAAWD,IAAAA,GAAO;AACrB;IACF;AAGA,UAAME,MAAM,MAAMC,QAAQH,IAAAA;AAC1B,eAAWI,SAASF,KAAK;AACvB,YAAMG,WAAWC,KAAKN,MAAMI,KAAAA;AAC5B,UAAI,KAAKG,OAAOC,IAAIH,QAAAA,GAAW;AAC7B;MACF;AACA,YAAMI,YAAY,MAAMC,KAAKL,QAAAA;AAC7B,UAAII,UAAUE,YAAW,GAAI;AAC3B,cAAM,KAAKZ,WAAWM,QAAAA;MACxB,WAAWI,UAAUG,OAAM,GAAI;AAC7B,cAAMC,OAAO,KAAKC,YAAYd,MAAMI,KAA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rB,aAAO,IAAIJ,YAAYF,IAAAA;IACzB;IAEA,SAAS;AACP,YAAM,IAAIO,MAAM,iBAAiBR,IAAAA,EAAM;IACzC;EACF;AACF;",
6
- "names": ["existsSync", "readdir", "stat", "join", "del", "raf", "NodeStorage", "AbstractStorage", "type", "StorageType", "NODE", "_initialized", "_loadFiles", "path", "existsSync", "dir", "readdir", "entry", "fullPath", "join", "_files", "has", "entryInfo", "stat", "isDirectory", "isFile", "file", "_createFile", "set", "wrapFile", "filename", "opts", "raf", "directory", "write", "Buffer", "from", "_destroy", "del", "force", "_getFiles", "getDiskInfo", "used", "recurse", "pathStats", "entries", "Promise", "all", "map", "size", "createStorage", "type", "root", "undefined", "NodeStorage", "StorageType", "RAM", "MemoryStorage", "NODE", "Error"]
4
+ "sourcesContent": ["//\n// Copyright 2021 DXOS.org\n//\n\nimport del from 'del';\nimport { existsSync } from 'node:fs';\nimport { readdir, stat } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport raf from 'random-access-file';\nimport { type RandomAccessStorage } from 'random-access-storage';\n\nimport { AbstractStorage, type DiskInfo, type Storage, StorageType, wrapFile } from '../common';\n\n/**\n * Storage interface implementation for Node.\n */\nexport class NodeStorage extends AbstractStorage implements Storage {\n public override type: StorageType = StorageType.NODE;\n private _initialized = false;\n\n private async _loadFiles(path: string): Promise<void> {\n // TODO(mykola): Do not load all files at once. It is a quick fix.\n if (!existsSync(path)) {\n return;\n }\n\n // Preload all files in a directory.\n const dir = await readdir(path);\n for (const entry of dir) {\n const fullPath = join(path, entry);\n if (this._files.has(fullPath)) {\n continue;\n }\n const entryInfo = await stat(fullPath);\n if (entryInfo.isDirectory()) {\n await this._loadFiles(fullPath);\n } else if (entryInfo.isFile()) {\n const file = this._createFile(path, entry);\n this._files.set(fullPath, wrapFile(file, this.type));\n }\n }\n }\n\n protected override _createFile(path: string, filename: string, opts: any = {}): RandomAccessStorage {\n const file = raf(filename, { directory: path, ...opts });\n\n // Empty write to create file on a drive.\n file.write(0, Buffer.from(''));\n\n return file;\n }\n\n protected override async _destroy(): Promise<void> {\n await del(this.path, { force: true });\n }\n\n protected override async _getFiles(path: string) {\n if (!this._initialized) {\n await this._loadFiles(this.path);\n this._initialized = true;\n }\n\n return super._getFiles(path);\n }\n\n async getDiskInfo(): Promise<DiskInfo> {\n let used = 0;\n\n const recurse = async (path: string) => {\n const pathStats = await stat(path);\n\n if (pathStats.isDirectory()) {\n const entries = await readdir(path);\n await Promise.all(entries.map((entry) => recurse(join(path, entry))));\n } else {\n used += pathStats.size;\n }\n };\n\n await recurse(this.path);\n\n return {\n used,\n };\n }\n}\n", "//\n// Copyright 2021 DXOS.org\n//\n\nimport { MemoryStorage, type Storage, type StorageConstructor, StorageType } from '../common';\nimport { NodeStorage } from './node-storage';\n\nexport const createStorage: StorageConstructor = ({ type, root = '/tmp/dxos/testing' } = {}): Storage => {\n if (type === undefined) {\n return new NodeStorage(root);\n }\n\n switch (type) {\n case StorageType.RAM: {\n return new MemoryStorage(root);\n }\n\n case StorageType.NODE: {\n return new NodeStorage(root);\n }\n\n default: {\n throw new Error(`Invalid type: ${type}`);\n }\n }\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;AAIA,OAAOA,SAAS;AAChB,SAASC,kBAAkB;AAC3B,SAASC,SAASC,YAAY;AAC9B,SAASC,YAAY;AACrB,OAAOC,SAAS;AAQT,IAAMC,cAAN,cAA0BC,gBAAAA;EACfC,OAAoBC,YAAYC;EACxCC,eAAe;EAEvB,MAAcC,WAAWC,MAA6B;AAEpD,QAAI,CAACC,WAAWD,IAAAA,GAAO;AACrB;IACF;AAGA,UAAME,MAAM,MAAMC,QAAQH,IAAAA;AAC1B,eAAWI,SAASF,KAAK;AACvB,YAAMG,WAAWC,KAAKN,MAAMI,KAAAA;AAC5B,UAAI,KAAKG,OAAOC,IAAIH,QAAAA,GAAW;AAC7B;MACF;AACA,YAAMI,YAAY,MAAMC,KAAKL,QAAAA;AAC7B,UAAII,UAAUE,YAAW,GAAI;AAC3B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AAQD,MAAAA;IACN,KAAKI,YAAYC,KAAK;AACpB,aAAO,IAAIC,cAAcL,IAAAA;IAC3B;IAEA,KAAKG,YAAYG,MAAM;AACrB,aAAO,IAAIJ,YAAYF,IAAAA;IACzB;IAEA,SAAS;AACP,YAAM,IAAIO,MAAM,iBAAiBR,IAAAA,EAAM;IACzC;EACF;AACF;",
6
+ "names": ["del", "existsSync", "readdir", "stat", "join", "raf", "NodeStorage", "AbstractStorage", "type", "StorageType", "NODE", "_initialized", "_loadFiles", "path", "existsSync", "dir", "readdir", "entry", "fullPath", "join", "_files", "has", "entryInfo", "stat", "isDirectory", "isFile", "file", "_createFile", "set", "wrapFile", "filename", "opts", "raf", "directory", "write", "Buffer", "from", "_destroy", "del", "force", "_getFiles", "getDiskInfo", "used", "recurse", "pathStats", "entries", "Promise", "all", "map", "size", "createStorage", "type", "root", "undefined", "NodeStorage", "StorageType", "RAM", "MemoryStorage", "NODE", "Error"]
7
7
  }
@@ -10,7 +10,7 @@ import {
10
10
  getFullPath,
11
11
  stringDiff,
12
12
  wrapFile
13
- } from "../chunk-OW63I6TJ.mjs";
13
+ } from "../chunk-7W2LPI7I.mjs";
14
14
 
15
15
  // ../../../node_modules/.pnpm/random-access-idb@1.2.2_patch_hash=207ec2404ef8b5e9e6d9de8ce83586d215ef77b94a7d0cadced03125874a1d9e/node_modules/random-access-idb/lib/blocks.js
16
16
  var require_blocks = __commonJS({
@@ -261,15 +261,7 @@ var IDbStorage = class extends AbstractStorage {
261
261
  }
262
262
  async _loadFiles(path) {
263
263
  const db = await this._db;
264
- invariant(db, "Database is not initialized.", {
265
- F: __dxlog_file,
266
- L: 85,
267
- S: this,
268
- A: [
269
- "db",
270
- "'Database is not initialized.'"
271
- ]
272
- });
264
+ invariant(db, "Database is not initialized.", { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 69, S: this, A: ["db", "'Database is not initialized.'"] });
273
265
  const lowerBound = path;
274
266
  const upperBound = `${path}\uFFFF`;
275
267
  const range = IDBKeyRange.bound(lowerBound, upperBound);
@@ -311,13 +303,13 @@ import { synchronized } from "@dxos/async";
311
303
  import { invariant as invariant2 } from "@dxos/invariant";
312
304
  import { log } from "@dxos/log";
313
305
  import { TimeSeriesCounter, trace } from "@dxos/tracing";
306
+ var __dxlog_file2 = "/__w/dxos/dxos/packages/common/random-access-storage/src/browser/web-fs.ts";
314
307
  function _ts_decorate(decorators, target, key, desc) {
315
308
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
316
309
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
317
310
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
318
311
  return c > 3 && r && Object.defineProperty(target, key, r), r;
319
312
  }
320
- var __dxlog_file2 = "/__w/dxos/dxos/packages/common/random-access-storage/src/browser/web-fs.ts";
321
313
  var WebFS = class {
322
314
  path;
323
315
  _files = /* @__PURE__ */ new Map();
@@ -353,15 +345,7 @@ var WebFS = class {
353
345
  return this._root;
354
346
  }
355
347
  this._root = await navigator.storage.getDirectory();
356
- invariant2(this._root, "Root is undefined", {
357
- F: __dxlog_file2,
358
- L: 74,
359
- S: this,
360
- A: [
361
- "this._root",
362
- "'Root is undefined'"
363
- ]
364
- });
348
+ invariant2(this._root, "Root is undefined", { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 65, S: this, A: ["this._root", "'Root is undefined'"] });
365
349
  return this._root;
366
350
  }
367
351
  createDirectory(sub = "") {
@@ -401,12 +385,7 @@ var WebFS = class {
401
385
  }
402
386
  async _delete(path) {
403
387
  await Promise.all(Array.from(this._getFiles(path)).map(async ([path2, file]) => {
404
- await file.destroy().catch((err) => log.warn(err, void 0, {
405
- F: __dxlog_file2,
406
- L: 117,
407
- S: this,
408
- C: (f, a) => f(...a)
409
- }));
388
+ await file.destroy().catch((err) => log.warn(err, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 105, S: this }));
410
389
  this._files.delete(path2);
411
390
  }));
412
391
  }
@@ -418,12 +397,7 @@ var WebFS = class {
418
397
  }).catch((err) => log.warn("failed to remove an entry", {
419
398
  filename,
420
399
  err
421
- }, {
422
- F: __dxlog_file2,
423
- L: 127,
424
- S: this,
425
- C: (f, a) => f(...a)
426
- }));
400
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 114, S: this }));
427
401
  this._files.delete(filename);
428
402
  }
429
403
  this._root = void 0;
@@ -433,12 +407,7 @@ var WebFS = class {
433
407
  return file.close().catch((e) => log.warn("failed to close a file", {
434
408
  file: file.fileName,
435
409
  e
436
- }, {
437
- F: __dxlog_file2,
438
- L: 137,
439
- S: this,
440
- C: (f, a) => f(...a)
441
- }));
410
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 124, S: this }));
442
411
  }));
443
412
  }
444
413
  _getFullFilename(path, filename) {
@@ -553,15 +522,7 @@ var WebFile = class extends EventEmitter {
553
522
  this._flushSequence = sequence + 1;
554
523
  this._flushes.inc();
555
524
  await this._loadBufferGuarded();
556
- invariant2(this._buffer, void 0, {
557
- F: __dxlog_file2,
558
- L: 301,
559
- S: this,
560
- A: [
561
- "this._buffer",
562
- ""
563
- ]
564
- });
525
+ invariant2(this._buffer, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 243, S: this, A: ["this._buffer", ""] });
565
526
  const fileHandle = await this._fileHandle;
566
527
  const writable = await fileHandle.createWritable({
567
528
  keepExistingData: true
@@ -581,23 +542,13 @@ var WebFile = class extends EventEmitter {
581
542
  setTimeout(async () => {
582
543
  await this._flushPromise;
583
544
  this._flushScheduled = false;
584
- this._flushPromise = this._flushCache(sequence).catch((err) => log.warn(err, void 0, {
585
- F: __dxlog_file2,
586
- L: 319,
587
- S: this,
588
- C: (f, a) => f(...a)
589
- }));
545
+ this._flushPromise = this._flushCache(sequence).catch((err) => log.warn(err, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 264, S: this }));
590
546
  });
591
547
  this._flushScheduled = true;
592
548
  }
593
549
  async _flushNow() {
594
550
  await this._flushPromise;
595
- this._flushPromise = this._flushCache(this._flushSequence).catch((err) => log.warn(err, void 0, {
596
- F: __dxlog_file2,
597
- L: 327,
598
- S: this,
599
- C: (f, a) => f(...a)
600
- }));
551
+ this._flushPromise = this._flushCache(this._flushSequence).catch((err) => log.warn(err, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 270, S: this }));
601
552
  await this._flushPromise;
602
553
  }
603
554
  async read(offset, size) {
@@ -607,15 +558,7 @@ var WebFile = class extends EventEmitter {
607
558
  this._readBytes.inc(size);
608
559
  if (!this._buffer) {
609
560
  await this._loadBufferGuarded();
610
- invariant2(this._buffer, void 0, {
611
- F: __dxlog_file2,
612
- L: 340,
613
- S: this,
614
- A: [
615
- "this._buffer",
616
- ""
617
- ]
618
- });
561
+ invariant2(this._buffer, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 280, S: this, A: ["this._buffer", ""] });
619
562
  }
620
563
  if (offset + size > this._buffer.length) {
621
564
  throw new Error("Read out of bounds");
@@ -629,15 +572,7 @@ var WebFile = class extends EventEmitter {
629
572
  this._writeBytes.inc(data.length);
630
573
  if (!this._buffer) {
631
574
  await this._loadBufferGuarded();
632
- invariant2(this._buffer, void 0, {
633
- F: __dxlog_file2,
634
- L: 360,
635
- S: this,
636
- A: [
637
- "this._buffer",
638
- ""
639
- ]
640
- });
575
+ invariant2(this._buffer, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 295, S: this, A: ["this._buffer", ""] });
641
576
  }
642
577
  if (offset + data.length <= this._buffer.length) {
643
578
  this._buffer.set(data, offset);
@@ -657,15 +592,7 @@ var WebFile = class extends EventEmitter {
657
592
  }
658
593
  if (!this._buffer) {
659
594
  await this._loadBufferGuarded();
660
- invariant2(this._buffer, void 0, {
661
- F: __dxlog_file2,
662
- L: 387,
663
- S: this,
664
- A: [
665
- "this._buffer",
666
- ""
667
- ]
668
- });
595
+ invariant2(this._buffer, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 316, S: this, A: ["this._buffer", ""] });
669
596
  }
670
597
  let leftoverSize = 0;
671
598
  if (offset + size < this._buffer.length) {
@@ -680,15 +607,7 @@ var WebFile = class extends EventEmitter {
680
607
  this._operations.inc();
681
608
  if (!this._buffer) {
682
609
  await this._loadBufferGuarded();
683
- invariant2(this._buffer, void 0, {
684
- F: __dxlog_file2,
685
- L: 409,
686
- S: this,
687
- A: [
688
- "this._buffer",
689
- ""
690
- ]
691
- });
610
+ invariant2(this._buffer, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 332, S: this, A: ["this._buffer", ""] });
692
611
  }
693
612
  return {
694
613
  size: this._buffer.length
@@ -699,15 +618,7 @@ var WebFile = class extends EventEmitter {
699
618
  this._operations.inc();
700
619
  if (!this._buffer) {
701
620
  await this._loadBufferGuarded();
702
- invariant2(this._buffer, void 0, {
703
- F: __dxlog_file2,
704
- L: 424,
705
- S: this,
706
- A: [
707
- "this._buffer",
708
- ""
709
- ]
710
- });
621
+ invariant2(this._buffer, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 343, S: this, A: ["this._buffer", ""] });
711
622
  }
712
623
  this._buffer = this._buffer.slice(0, offset);
713
624
  this._flushLater();