@dxos/random-access-storage 0.8.4-main.b97322e → 0.8.4-main.f5c0578

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.
@@ -1 +1 @@
1
- {"inputs":{"src/common/utils.ts":{"bytes":1282,"imports":[{"path":"@dxos/node-std/path","kind":"import-statement","external":true}],"format":"esm"},"src/common/directory.ts":{"bytes":6530,"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":15059,"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":48383,"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":3010,"imports":[{"path":"src/browser/idb-storage.ts","kind":"import-statement","original":"./idb-storage"},{"path":"src/browser/web-fs.ts","kind":"import-statement","original":"./web-fs"},{"path":"src/common/index.ts","kind":"import-statement","original":"../common"}],"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"}},"outputs":{"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":61089},"dist/lib/browser/index.mjs":{"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":"buffer-from","kind":"require-call","external":true},{"path":"buffer-alloc","kind":"require-call","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":"@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":"random-access-memory","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","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/common/abstract-storage.ts":{"bytesInOutput":3504},"src/common/utils.ts":{"bytesInOutput":180},"src/common/directory.ts":{"bytesInOutput":1103},"src/common/file.ts":{"bytesInOutput":1131},"src/common/index.ts":{"bytesInOutput":0},"src/common/memory-storage.ts":{"bytesInOutput":900},"src/common/storage.ts":{"bytesInOutput":295},"src/browser/index.ts":{"bytesInOutput":0},"src/browser/idb-storage.ts":{"bytesInOutput":3058},"src/browser/web-fs.ts":{"bytesInOutput":12855},"src/browser/storage.ts":{"bytesInOutput":474}},"bytes":33016}}}
1
+ {"inputs":{"src/common/utils.ts":{"bytes":1282,"imports":[{"path":"@dxos/node-std/path","kind":"import-statement","external":true}],"format":"esm"},"src/common/directory.ts":{"bytes":6530,"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":15063,"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":48423,"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"}},"outputs":{"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":61177},"dist/lib/browser/index.mjs":{"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":"buffer-from","kind":"require-call","external":true},{"path":"buffer-alloc","kind":"require-call","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":"@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":"random-access-memory","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","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/common/abstract-storage.ts":{"bytesInOutput":3522},"src/common/utils.ts":{"bytesInOutput":180},"src/common/directory.ts":{"bytesInOutput":1256},"src/common/file.ts":{"bytesInOutput":1131},"src/common/index.ts":{"bytesInOutput":0},"src/common/memory-storage.ts":{"bytesInOutput":846},"src/common/storage.ts":{"bytesInOutput":295},"src/browser/index.ts":{"bytesInOutput":0},"src/browser/idb-storage.ts":{"bytesInOutput":3060},"src/browser/web-fs.ts":{"bytesInOutput":12703},"src/browser/storage.ts":{"bytesInOutput":474}},"bytes":32983}}}
@@ -13,6 +13,13 @@ var getFullPath = (root, path) => join(root, stringDiff(path, root));
13
13
 
14
14
  // src/common/directory.ts
15
15
  var Directory = class _Directory {
16
+ type;
17
+ path;
18
+ // TODO(burdon): Create interface for these methods (shared with AbstractStorage).
19
+ _list;
20
+ _getOrCreateFile;
21
+ _remove;
22
+ _onFlush;
16
23
  constructor({ type, path, list, getOrCreateFile, remove, onFlush }) {
17
24
  this.type = type;
18
25
  this.path = path;
@@ -113,6 +120,8 @@ var wrapFile = (native, type) => {
113
120
  // src/common/abstract-storage.ts
114
121
  var __dxlog_file2 = "/__w/dxos/dxos/packages/common/random-access-storage/src/common/abstract-storage.ts";
115
122
  var AbstractStorage = class {
123
+ path;
124
+ _files;
116
125
  // TODO(burdon): Make required.
117
126
  constructor(path) {
118
127
  this.path = path;
@@ -147,7 +156,7 @@ var AbstractStorage = class {
147
156
  try {
148
157
  log2.info("Erasing all data...", void 0, {
149
158
  F: __dxlog_file2,
150
- L: 60,
159
+ L: 61,
151
160
  S: this,
152
161
  C: (f, a) => f(...a)
153
162
  });
@@ -156,14 +165,14 @@ var AbstractStorage = class {
156
165
  await this._destroy();
157
166
  log2("Erased...", void 0, {
158
167
  F: __dxlog_file2,
159
- L: 64,
168
+ L: 65,
160
169
  S: this,
161
170
  C: (f, a) => f(...a)
162
171
  });
163
172
  } catch (err) {
164
173
  log2.catch(err, void 0, {
165
174
  F: __dxlog_file2,
166
- L: 66,
175
+ L: 67,
167
176
  S: this,
168
177
  C: (f, a) => f(...a)
169
178
  });
@@ -221,7 +230,7 @@ var AbstractStorage = class {
221
230
  async _closeFilesInPath(path) {
222
231
  await Promise.all(Array.from((await this._getFiles(path)).values()).map((file) => file.close().catch((err) => log2.catch(err, void 0, {
223
232
  F: __dxlog_file2,
224
- L: 134,
233
+ L: 135,
225
234
  S: this,
226
235
  C: (f, a) => f(...a)
227
236
  }))));
@@ -234,7 +243,7 @@ var AbstractStorage = class {
234
243
  await Promise.all(Array.from(await this._getFiles(path)).map(([path2, file]) => {
235
244
  return file.destroy().then(() => this._files.delete(path2)).catch((err) => log2.error(err.message, void 0, {
236
245
  F: __dxlog_file2,
237
- L: 149,
246
+ L: 150,
238
247
  S: this,
239
248
  C: (f, a) => f(...a)
240
249
  }));
@@ -259,10 +268,7 @@ var StorageType = /* @__PURE__ */ function(StorageType2) {
259
268
 
260
269
  // src/common/memory-storage.ts
261
270
  var MemoryStorage = class extends AbstractStorage {
262
- constructor() {
263
- super(...arguments);
264
- this.type = StorageType.RAM;
265
- }
271
+ type = StorageType.RAM;
266
272
  _createFile(path, filename) {
267
273
  return this._patchFile(ram());
268
274
  }
@@ -295,17 +301,14 @@ var MemoryStorage = class extends AbstractStorage {
295
301
  };
296
302
 
297
303
  // src/node/node-storage.ts
298
- import del from "del";
299
304
  import { existsSync } from "node:fs";
300
305
  import { readdir, stat } from "node:fs/promises";
301
306
  import { join as join3 } from "node:path";
307
+ import del from "del";
302
308
  import raf from "random-access-file";
303
309
  var NodeStorage = class extends AbstractStorage {
304
- constructor() {
305
- super(...arguments);
306
- this.type = StorageType.NODE;
307
- this._initialized = false;
308
- }
310
+ type = StorageType.NODE;
311
+ _initialized = false;
309
312
  async _loadFiles(path) {
310
313
  if (!existsSync(path)) {
311
314
  return;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/common/abstract-storage.ts", "../../../src/common/utils.ts", "../../../src/common/directory.ts", "../../../src/common/file.ts", "../../../src/common/memory-storage.ts", "../../../src/common/storage.ts", "../../../src/node/node-storage.ts", "../../../src/node/storage.ts"],
4
- "sourcesContent": ["//\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 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 DirectoryParams = {\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 }: DirectoryParams) {\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 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.isNaN(size) ? 0 : size;\n }\n\n return {\n used,\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 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 { NodeStorage } from './node-storage';\nimport { MemoryStorage, type Storage, type StorageConstructor, StorageType } from '../common';\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,QAAAA,aAAY;AACrB,SAASC,eAAe;AAGxB,SAASC,qBAAqB;AAC9B,SAASC,OAAAA,YAAW;;;ACLpB,SAASC,YAAY;AAGd,IAAMC,aAAa,CAACC,OAAeC,WAAmBD,MAAME,MAAMD,MAAAA,EAAQE,KAAK,EAAA;AAE/E,IAAMC,cAAc,CAACC,MAAcC,SAAiBH,KAAKE,MAAMN,WAAWO,MAAMD,IAAAA,CAAAA;;;ACYhF,IAAME,YAAN,MAAMA,WAAAA;EASX,YAAY,EAAEC,MAAMC,MAAMC,MAAMC,iBAAiBC,QAAQC,QAAO,GAAqB;AACnF,SAAKL,OAAOA;AACZ,SAAKC,OAAOA;AACZ,SAAKK,QAAQJ;AACb,SAAKK,mBAAmBJ;AACxB,SAAKK,UAAUJ;AACf,SAAKK,WAAWJ;EAClB;EAEAK,WAAmB;AACjB,WAAO,aAAaC,KAAKC,UAAU;MAAEZ,MAAM,KAAKA;MAAMC,MAAM,KAAKA;IAAK,CAAA,CAAA;EACxE;;;;EAKAY,gBAAgBZ,MAAyB;AACvC,WAAO,IAAIF,WAAU;MACnBC,MAAM,KAAKA;MACXC,MAAMa,YAAY,KAAKb,MAAMA,IAAAA;MAC7BC,MAAM,KAAKI;MACXH,iBAAiB,KAAKI;MACtBH,QAAQ,KAAKI;IACf,CAAA;EACF;;;;EAKAN,OAA0B;AACxB,WAAO,KAAKI,MAAM,KAAKL,IAAI;EAC7B;;;;EAKAE,gBAAgBY,UAAkBC,MAAkB;AAClD,WAAO,KAAKT,iBAAiB,KAAKN,MAAMc,UAAUC,IAAAA;EACpD;EAEA,MAAMC,QAAuB;AAC3B,UAAM,KAAKR,WAAQ;EACrB;;;;EAKA,MAAMS,SAAwB;AAC5B,UAAM,KAAKV,QAAO;EACpB;AACF;;;AC5EA,OAAOW,U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gBAAoC,CAAC,EAAEC,MAAMC,OAAO,oBAAmB,IAAK,CAAC,MAAC;AACzF,MAAID,SAASE,QAAW;AACtB,WAAO,IAAIC,YAAYF,IAAAA;EACzB;AAEA,UAAQD,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": ["join", "inspect", "inspectObject", "log", "join", "stringDiff", "first", "second", "split", "join", "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", "pifyFields", "object", "type", "fields", "field", "fn", "bind", "args", "before", "performance", "now", "res", "elapsed", "operation", "wrapFile", "native", "file", "Object", "assign", "AbstractStorage", "path", "_files", "Map", "inspect", "custom", "inspectObject", "toJSON", "type", "size", "createDirectory", "sub", "Directory", "getFullPath", "list", "_list", "bind", "getOrCreateFile", "args", "remove", "_remove", "reset", "log", "info", "_closeFilesInPath", "_destroy", "err", "catch", "Array", "from", "_getFiles", "keys", "map", "filename", "name", "replace", "startsWith", "substring", "opts", "fullPath", "join", "native", "file", "_getFileIfExists", "closed", "_openFile", "_createFile", "wrapFile", "set", "undefined", "has", "get", "destroyed", "entries", "filter", "includes", "Promise", "all", "values", "close", "destroy", "then", "delete", "error", "message", "ram", "arrayToBuffer", "StorageType", "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", "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"]
4
+ "sourcesContent": ["//\n// Copyright 2021 DXOS.org\n//\n\nimport { join } from 'node:path';\nimport { inspect } from 'node:util';\n\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 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 DirectoryParams = {\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 }: DirectoryParams) {\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 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.isNaN(size) ? 0 : size;\n }\n\n return {\n used,\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 { 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 Nod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C,CAAC,EAAEC,MAAMC,OAAO,oBAAmB,IAAK,CAAC,MAAC;AACzF,MAAID,SAASE,QAAW;AACtB,WAAO,IAAIC,YAAYF,IAAAA;EACzB;AAEA,UAAQD,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": ["join", "inspect", "inspectObject", "log", "join", "stringDiff", "first", "second", "split", "join", "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", "pifyFields", "object", "type", "fields", "field", "fn", "bind", "args", "before", "performance", "now", "res", "elapsed", "operation", "wrapFile", "native", "file", "Object", "assign", "AbstractStorage", "_files", "path", "Map", "inspect", "custom", "inspectObject", "toJSON", "type", "size", "createDirectory", "sub", "Directory", "getFullPath", "list", "_list", "bind", "getOrCreateFile", "args", "remove", "_remove", "reset", "log", "info", "_closeFilesInPath", "_destroy", "err", "catch", "Array", "from", "_getFiles", "keys", "map", "filename", "name", "replace", "startsWith", "substring", "opts", "fullPath", "join", "native", "file", "_getFileIfExists", "closed", "_openFile", "_createFile", "wrapFile", "set", "undefined", "has", "get", "destroyed", "entries", "filter", "includes", "Promise", "all", "values", "close", "destroy", "then", "delete", "error", "message", "ram", "arrayToBuffer", "StorageType", "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", "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"]
7
7
  }
@@ -1 +1 @@
1
- {"inputs":{"src/common/utils.ts":{"bytes":1282,"imports":[{"path":"node:path","kind":"import-statement","external":true}],"format":"esm"},"src/common/directory.ts":{"bytes":6530,"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":15059,"imports":[{"path":"node:path","kind":"import-statement","external":true},{"path":"node: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"},"src/node/node-storage.ts":{"bytes":8426,"imports":[{"path":"del","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node: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":2420,"imports":[{"path":"src/node/node-storage.ts","kind":"import-statement","original":"./node-storage"},{"path":"src/common/index.ts","kind":"import-statement","original":"../common"}],"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"},"src/index.ts":{"bytes":456,"imports":[{"path":"src/node/index.ts","kind":"import-statement","original":"./node"}],"format":"esm"}},"outputs":{"dist/lib/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":23855},"dist/lib/node-esm/index.mjs":{"imports":[{"path":"node:path","kind":"import-statement","external":true},{"path":"node:util","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"pify","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},{"path":"del","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node: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/index.ts","inputs":{"src/common/abstract-storage.ts":{"bytesInOutput":3484},"src/common/utils.ts":{"bytesInOutput":170},"src/common/directory.ts":{"bytesInOutput":1103},"src/common/file.ts":{"bytesInOutput":1131},"src/common/index.ts":{"bytesInOutput":0},"src/common/memory-storage.ts":{"bytesInOutput":900},"src/common/storage.ts":{"bytesInOutput":295},"src/node/index.ts":{"bytesInOutput":0},"src/node/node-storage.ts":{"bytesInOutput":1743},"src/node/storage.ts":{"bytesInOutput":369},"src/index.ts":{"bytesInOutput":0}},"bytes":9745}}}
1
+ {"inputs":{"src/common/utils.ts":{"bytes":1282,"imports":[{"path":"node:path","kind":"import-statement","external":true}],"format":"esm"},"src/common/directory.ts":{"bytes":6530,"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":15063,"imports":[{"path":"node:path","kind":"import-statement","external":true},{"path":"node: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"},"src/node/node-storage.ts":{"bytes":8430,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node: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"},"src/index.ts":{"bytes":456,"imports":[{"path":"src/node/index.ts","kind":"import-statement","original":"./node"}],"format":"esm"}},"outputs":{"dist/lib/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":23887},"dist/lib/node-esm/index.mjs":{"imports":[{"path":"node:path","kind":"import-statement","external":true},{"path":"node:util","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"pify","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},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:fs/promises","kind":"import-statement","external":true},{"path":"node: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/index.ts","inputs":{"src/common/abstract-storage.ts":{"bytesInOutput":3502},"src/common/utils.ts":{"bytesInOutput":170},"src/common/directory.ts":{"bytesInOutput":1256},"src/common/file.ts":{"bytesInOutput":1131},"src/common/index.ts":{"bytesInOutput":0},"src/common/memory-storage.ts":{"bytesInOutput":846},"src/common/storage.ts":{"bytesInOutput":295},"src/node/index.ts":{"bytesInOutput":0},"src/node/node-storage.ts":{"bytesInOutput":1682},"src/node/storage.ts":{"bytesInOutput":369},"src/index.ts":{"bytesInOutput":0}},"bytes":9801}}}
@@ -1 +1 @@
1
- {"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../../src/browser/storage.ts"],"names":[],"mappings":"AAMA,OAAO,EAA4C,KAAK,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE9F,eAAO,MAAM,aAAa,EAAE,kBAwB3B,CAAC"}
1
+ {"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../../src/browser/storage.ts"],"names":[],"mappings":"AAIA,OAAO,EAA+B,KAAK,kBAAkB,EAAe,MAAM,WAAW,CAAC;AAK9F,eAAO,MAAM,aAAa,EAAE,kBAwB3B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"web-fs.d.ts","sourceRoot":"","sources":["../../../../src/browser/web-fs.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAOjE,OAAO,EAAE,SAAS,EAAE,KAAK,QAAQ,EAAE,KAAK,IAAI,EAAE,KAAK,OAAO,EAAE,WAAW,EAAe,MAAM,WAAW,CAAC;AAExG;;GAEG;AACH,qBAAa,KAAM,YAAW,OAAO;aAOP,IAAI,EAAE,MAAM;IANxC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA8B;IAErD,QAAQ,CAAC,IAAI,q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,IAAI,OAAO,CAAC,IAAI,CAAC;cAKZ,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAUrD"}
@@ -1 +1 @@
1
- {"version":3,"file":"node-storage.d.ts","sourceRoot":"","sources":["../../../../src/node/node-storage.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAEjE,OAAO,EAAE,eAAe,EAAE,KAAK,QAAQ,EAAE,KAAK,OAAO,EAAE,WAAW,EAAY,MAAM,WAAW,CAAC;AAEhG;;GAEG;AACH,qBAAa,WAAY,SAAQ,eAAgB,YAAW,OAAO;IACjD,IAAI,EAAE,WAAW,CAAoB;IACrD,OAAO,CAAC,YAAY,CAAS;YAEf,UAAU;cAuBL,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,GAAE,GAAQ,GAAG,mBAAmB;cAS1E,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;cAIzB,SAAS,CAAC,IAAI,EAAE,MAAM;IASzC,WAAW,IAAI,OAAO,CAAC,QAAQ,CAAC;CAoBvC"}
1
+ {"version":3,"file":"node-storage.d.ts","sourceRoot":"","sources":["../../../../src/node/node-storage.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAEjE,OAAO,EAAE,eAAe,EAAE,KAAK,QAAQ,EAAE,KAAK,OAAO,EAAE,WAAW,EAAY,MAAM,WAAW,CAAC;AAEhG;;GAEG;AACH,qBAAa,WAAY,SAAQ,eAAgB,YAAW,OAAO;IACjD,IAAI,EAAE,WAAW,CAAoB;IACrD,OAAO,CAAC,YAAY,CAAS;YAEf,UAAU;cAuBL,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,GAAE,GAAQ,GAAG,mBAAmB;cAS1E,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;cAIzB,SAAS,CAAC,IAAI,EAAE,MAAM;IASzC,WAAW,IAAI,OAAO,CAAC,QAAQ,CAAC;CAoBvC"}
@@ -1 +1 @@
1
- {"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../../src/node/storage.ts"],"names":[],"mappings":"AAKA,OAAO,EAA+B,KAAK,kBAAkB,EAAe,MAAM,WAAW,CAAC;AAE9F,eAAO,MAAM,aAAa,EAAE,kBAkB3B,CAAC"}
1
+ {"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../../src/node/storage.ts"],"names":[],"mappings":"AAIA,OAAO,EAA+B,KAAK,kBAAkB,EAAe,MAAM,WAAW,CAAC;AAI9F,eAAO,MAAM,aAAa,EAAE,kBAkB3B,CAAC"}