@helia/mfs 5.0.4 → 5.1.0-1071f986

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mfs.js","sourceRoot":"","sources":["../../src/mfs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AACtC,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AACxH,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAA;AACzC,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,aAAa,CAAA;AAClD,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAA;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAkB9C,MAAM,OAAO,GAAG;IACG,UAAU,CAAe;IACzB,MAAM,CAAQ;IACvB,IAAI,CAAM;IACD,GAAG,CAAK;IACR,GAAG,CAAQ;IAE5B,YAAa,UAAyB,EAAE,OAAgB,EAAE;QACxD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC5B,IAAI,CAAC,GAAG,GAAG,UAAU,CAAC,MAAM,CAAC,YAAY,CAAC,WAAW,CAAC,CAAA;QAEtD,iCAAiC;QACjC,IAAI,CAAC,GAAG,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,GAAG,IAAI,mBAAmB,CAAC,CAAA;QACnD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,CAAA;IAClC,CAAC;IAED,KAAK,CAAC,WAAW;QACf,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,EAAE,CAAC;YACtB,IAAI,CAAC;gBACH,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;gBACzD,IA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;QAEjE,OAAO,GAAG,CAAA;IACZ,CAAC;IAED,KAAK,CAAC,iBAAiB,CAAE,IAAY,EAAE,UAAuB,EAAE;QAC9D,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;QAEpD,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,iBAAiB,EAAE,CAAA;QAC/B,CAAC;IACH,CAAC;IAED,KAAK,CAAC,uBAAuB,CAAE,IAAY,EAAE,UAAuB,EAAE;QACpE,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;QAEpD,IAAI,MAAM,EAAE,CAAC;YACX,MAAM,IAAI,kBAAkB,EAAE,CAAA;QAChC,CAAC;IACH,CAAC;IAED,KAAK,CAAC,WAAW,CAAE,IAAY,EAAE,UAAuB,EAAE;QACxD,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;gBACpB,GAAG,OAAO;gBACV,OAAO,EAAE,IAAI;aACd,CAAC,CAAA;YAEF,OAAO,IAAI,CAAA;QACb,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,KAAK,CAAA;QACd,CAAC;IACH,CAAC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@helia/mfs",
3
- "version": "5.0.4",
3
+ "version": "5.1.0-1071f986",
4
4
  "description": "A mutable filesystem powered by Helia",
5
5
  "license": "Apache-2.0 OR MIT",
6
6
  "homepage": "https://github.com/ipfs/helia/tree/main/packages/mfs#readme",
@@ -32,13 +32,6 @@
32
32
  "import": "./dist/src/index.js"
33
33
  }
34
34
  },
35
- "eslintConfig": {
36
- "extends": "ipfs",
37
- "parserOptions": {
38
- "project": true,
39
- "sourceType": "module"
40
- }
41
- },
42
35
  "scripts": {
43
36
  "clean": "aegir clean",
44
37
  "lint": "aegir lint",
@@ -54,27 +47,27 @@
54
47
  "test:electron-main": "aegir test -t electron-main"
55
48
  },
56
49
  "dependencies": {
57
- "@helia/unixfs": "^5.0.4",
58
- "@libp2p/interface": "^2.2.1",
59
- "@libp2p/logger": "^5.1.4",
60
- "interface-blockstore": "^5.3.1",
61
- "interface-datastore": "^8.3.1",
62
- "ipfs-unixfs": "^11.2.0",
63
- "ipfs-unixfs-exporter": "^13.6.1",
64
- "ipfs-unixfs-importer": "^15.3.1",
65
- "multiformats": "^13.3.1"
50
+ "@helia/unixfs": "5.1.0-1071f986",
51
+ "@libp2p/interface": "^3.0.2",
52
+ "interface-blockstore": "^6.0.1",
53
+ "interface-datastore": "^9.0.2",
54
+ "ipfs-unixfs": "^12.0.0",
55
+ "ipfs-unixfs-exporter": "^14.0.1",
56
+ "ipfs-unixfs-importer": "^16.0.1",
57
+ "multiformats": "^13.4.1"
66
58
  },
67
59
  "devDependencies": {
68
- "@ipld/dag-pb": "^4.1.3",
69
- "aegir": "^47.0.7",
70
- "blockstore-core": "^5.0.2",
71
- "datastore-core": "^10.0.2",
60
+ "@ipld/dag-pb": "^4.1.5",
61
+ "@libp2p/logger": "^6.0.5",
62
+ "aegir": "^47.0.22",
63
+ "blockstore-core": "^6.0.2",
64
+ "datastore-core": "^11.0.2",
72
65
  "delay": "^6.0.0",
73
- "it-all": "^3.0.6",
74
- "it-drain": "^3.0.7",
75
- "it-first": "^3.0.6",
76
- "it-last": "^3.0.6",
77
- "it-to-buffer": "^4.0.7",
66
+ "it-all": "^3.0.9",
67
+ "it-drain": "^3.0.10",
68
+ "it-first": "^3.0.9",
69
+ "it-last": "^3.0.9",
70
+ "it-to-buffer": "^4.0.10",
78
71
  "uint8arrays": "^5.1.0"
79
72
  },
80
73
  "sideEffects": false
package/src/index.ts CHANGED
@@ -27,26 +27,20 @@
27
27
  * ```
28
28
  */
29
29
 
30
- import { unixfs } from '@helia/unixfs'
31
- import { AlreadyExistsError, DoesNotExistError, InvalidParametersError, NotADirectoryError } from '@helia/unixfs/errors'
32
- import { logger } from '@libp2p/logger'
33
- import { Key } from 'interface-datastore'
34
- import { UnixFS as IPFSUnixFS } from 'ipfs-unixfs'
35
30
  import { CID } from 'multiformats/cid'
36
- import { basename } from './utils/basename.js'
37
- import type { AddOptions, CatOptions, ChmodOptions, CpOptions, LsOptions, MkdirOptions as UnixFsMkdirOptions, RmOptions as UnixFsRmOptions, StatOptions, TouchOptions, UnixFS, FileStats, DirectoryStats, RawStats, ExtendedStatOptions, ExtendedFileStats, ExtendedDirectoryStats, ExtendedRawStats } from '@helia/unixfs'
38
- import type { AbortOptions } from '@libp2p/interface'
31
+ import { MFS as MFSClass } from './mfs.js'
32
+ import type { AddOptions, CatOptions, ChmodOptions, CpOptions, LsOptions, MkdirOptions as UnixFsMkdirOptions, RmOptions as UnixFsRmOptions, StatOptions, TouchOptions, FileStats, DirectoryStats, RawStats, ExtendedStatOptions, ExtendedFileStats, ExtendedDirectoryStats, ExtendedRawStats } from '@helia/unixfs'
33
+ import type { ComponentLogger } from '@libp2p/interface'
39
34
  import type { Blockstore } from 'interface-blockstore'
40
35
  import type { Datastore } from 'interface-datastore'
41
36
  import type { Mtime } from 'ipfs-unixfs'
42
- import type { UnixFSEntry } from 'ipfs-unixfs-exporter'
37
+ import type { UnixFSEntry, UnixFSBasicEntry } from 'ipfs-unixfs-exporter'
43
38
  import type { ByteStream } from 'ipfs-unixfs-importer'
44
39
 
45
- const log = logger('helia:mfs')
46
-
47
40
  export interface MFSComponents {
48
41
  blockstore: Blockstore
49
42
  datastore: Datastore
43
+ logger: ComponentLogger
50
44
  }
51
45
 
52
46
  export interface MFSInit {
@@ -178,6 +172,7 @@ export interface MFS {
178
172
  * ```
179
173
  */
180
174
  ls(path?: string, options?: Partial<LsOptions>): AsyncIterable<UnixFSEntry>
175
+ ls(path: string, options: Partial<LsOptions> & { extended: false }): AsyncIterable<UnixFSBasicEntry>
181
176
 
182
177
  /**
183
178
  * Make a new directory in your MFS.
@@ -236,369 +231,9 @@ export interface MFS {
236
231
  touch(path: string, options?: Partial<TouchOptions>): Promise<void>
237
232
  }
238
233
 
239
- interface PathEntry {
240
- cid: CID
241
- name: string
242
- unixfs?: IPFSUnixFS
243
- }
244
-
245
- interface WalkPathOptions extends AbortOptions {
246
- createMissingDirectories: boolean
247
- finalSegmentMustBeDirectory: boolean
248
- }
249
-
250
- class DefaultMFS implements MFS {
251
- private readonly components: MFSComponents
252
- private readonly unixfs: UnixFS
253
- private root?: CID
254
- private readonly key: Key
255
-
256
- constructor (components: MFSComponents, init: MFSInit = {}) {
257
- this.components = components
258
-
259
- // spellchecker:disable-next-line
260
- this.key = new Key(init.key ?? '/locals/filesroot')
261
- this.unixfs = unixfs(components)
262
- }
263
-
264
- async #getRootCID (): Promise<CID> {
265
- if (this.root == null) {
266
- try {
267
- const buf = await this.components.datastore.get(this.key)
268
- this.root = CID.decode(buf)
269
- } catch (err: any) {
270
- if (err.name !== 'NotFoundError') {
271
- throw err
272
- }
273
-
274
- this.root = await this.unixfs.addDirectory()
275
- }
276
- }
277
-
278
- return this.root
279
- }
280
-
281
- async writeBytes (bytes: Uint8Array, path: string, options?: Partial<WriteOptions>): Promise<void> {
282
- const cid = await this.unixfs.addBytes(bytes, options)
283
-
284
- await this.cp(cid, path, options)
285
-
286
- if (options?.mode != null) {
287
- await this.chmod(path, options.mode, options)
288
- }
289
-
290
- if (options?.mtime != null) {
291
- await this.touch(path, options)
292
- }
293
- }
294
-
295
- async writeByteStream (bytes: ByteStream, path: string, options?: Partial<WriteOptions>): Promise<void> {
296
- const cid = await this.unixfs.addByteStream(bytes, options)
297
-
298
- await this.cp(cid, path, options)
299
-
300
- if (options?.mode != null) {
301
- await this.chmod(path, options.mode, options)
302
- }
303
-
304
- if (options?.mtime != null) {
305
- await this.touch(path, options)
306
- }
307
- }
308
-
309
- async * cat (path: string, options: Partial<CatOptions> = {}): AsyncIterable<Uint8Array> {
310
- const root = await this.#getRootCID()
311
- const trail = await this.#walkPath(root, path, {
312
- ...options,
313
- createMissingDirectories: false,
314
- finalSegmentMustBeDirectory: false
315
- })
316
-
317
- yield * this.unixfs.cat(trail[trail.length - 1].cid, options)
318
- }
319
-
320
- async chmod (path: string, mode: number, options: Partial<ChmodOptions> = {}): Promise<void> {
321
- const root = await this.#getRootCID()
322
-
323
- this.root = await this.unixfs.chmod(root, mode, {
324
- ...options,
325
- path
326
- })
327
- }
328
-
329
- async cp (source: CID | string, destination: string, options?: Partial<CpOptions>): Promise<void> {
330
- const root = await this.#getRootCID()
331
- const force = options?.force ?? false
332
-
333
- if (typeof source === 'string') {
334
- const stat = await this.stat(source, options)
335
-
336
- source = stat.cid
337
- }
338
-
339
- if (!force) {
340
- await this.#ensurePathDoesNotExist(destination, options)
341
- }
342
-
343
- const fileName = basename(destination)
344
- const containingDirectory = destination.substring(0, destination.length - `/${fileName}`.length)
345
-
346
- let trail: PathEntry[] = [{
347
- cid: root,
348
- name: ''
349
- }]
350
-
351
- if (containingDirectory !== '') {
352
- trail = await this.#walkPath(root, containingDirectory, {
353
- ...options,
354
- createMissingDirectories: options?.force ?? false,
355
- finalSegmentMustBeDirectory: true
356
- })
357
- }
358
-
359
- trail.push({
360
- cid: source,
361
- name: fileName
362
- })
363
-
364
- this.root = await this.#persistPath(trail, options)
365
- }
366
-
367
- async * ls (path?: string, options?: Partial<LsOptions>): AsyncIterable<UnixFSEntry> {
368
- const root = await this.#getRootCID()
369
-
370
- if (options?.path != null) {
371
- path = `${path}/${options.path}`
372
- }
373
-
374
- yield * this.unixfs.ls(root, {
375
- ...options,
376
- path
377
- })
378
- }
379
-
380
- async mkdir (path: string, options?: Partial<MkdirOptions>): Promise<void> {
381
- const force = options?.force ?? false
382
-
383
- if (!force) {
384
- await this.#ensurePathDoesNotExist(path, options)
385
- }
386
-
387
- const dirName = basename(path)
388
- const containingDirectory = path.substring(0, path.length - `/${dirName}`.length)
389
- const root = await this.#getRootCID()
390
-
391
- let trail: PathEntry[] = [{
392
- cid: root,
393
- name: ''
394
- }]
395
-
396
- if (containingDirectory !== '') {
397
- trail = await this.#walkPath(root, containingDirectory, {
398
- ...options,
399
- createMissingDirectories: force,
400
- finalSegmentMustBeDirectory: true
401
- })
402
- }
403
-
404
- trail.push({
405
- cid: await this.unixfs.addDirectory({
406
- mode: options?.mode,
407
- mtime: options?.mtime
408
- }, options),
409
- name: basename(path)
410
- })
411
-
412
- this.root = await this.#persistPath(trail, options)
413
- }
414
-
415
- async rm (path: string, options?: Partial<RmOptions>): Promise<void> {
416
- const force = options?.force ?? false
417
-
418
- if (!force) {
419
- await this.#ensurePathExists(path, options)
420
- }
421
-
422
- const root = await this.#getRootCID()
423
-
424
- const trail = await this.#walkPath(root, path, {
425
- ...options,
426
- createMissingDirectories: false,
427
- finalSegmentMustBeDirectory: false
428
- })
429
-
430
- const lastSegment = trail.pop()
431
-
432
- if (lastSegment == null) {
433
- throw new InvalidParametersError('path was too short')
434
- }
435
-
436
- // remove directory entry
437
- const containingDir = trail[trail.length - 1]
438
- containingDir.cid = await this.unixfs.rm(containingDir.cid, lastSegment.name, options)
439
-
440
- this.root = await this.#persistPath(trail, options)
441
- }
442
-
443
- async stat (path: string, options?: StatOptions): Promise<FileStats | DirectoryStats | RawStats>
444
- async stat (path: string, options?: ExtendedStatOptions): Promise<ExtendedFileStats | ExtendedDirectoryStats | ExtendedRawStats>
445
- async stat (path: string, options?: StatOptions | ExtendedStatOptions): Promise<FileStats | DirectoryStats | RawStats | ExtendedFileStats | ExtendedDirectoryStats | ExtendedRawStats> {
446
- const root = await this.#getRootCID()
447
-
448
- const trail = await this.#walkPath(root, path, {
449
- ...options,
450
- createMissingDirectories: false,
451
- finalSegmentMustBeDirectory: false
452
- })
453
-
454
- const finalEntry = trail.pop()
455
-
456
- if (finalEntry == null) {
457
- throw new DoesNotExistError()
458
- }
459
-
460
- return this.unixfs.stat(finalEntry.cid, options)
461
- }
462
-
463
- async touch (path: string, options?: Partial<TouchOptions>): Promise<void> {
464
- const root = await this.#getRootCID()
465
- const trail = await this.#walkPath(root, path, {
466
- ...options,
467
- createMissingDirectories: false,
468
- finalSegmentMustBeDirectory: false
469
- })
470
-
471
- const finalEntry = trail[trail.length - 1]
472
-
473
- if (finalEntry == null) {
474
- throw new DoesNotExistError()
475
- }
476
-
477
- finalEntry.cid = await this.unixfs.touch(finalEntry.cid, options)
478
-
479
- this.root = await this.#persistPath(trail, options)
480
- }
481
-
482
- async #walkPath (root: CID, path: string, opts: WalkPathOptions): Promise<PathEntry[]> {
483
- if (!path.startsWith('/')) {
484
- throw new InvalidParametersError('path must be absolute')
485
- }
486
-
487
- const stat = await this.unixfs.stat(root, {
488
- ...opts,
489
- offline: true
490
- })
491
-
492
- const output: PathEntry[] = [{
493
- cid: root,
494
- name: '',
495
- unixfs: stat.unixfs
496
- }]
497
-
498
- let cid = root
499
- const parts = path.split('/').filter(Boolean)
500
-
501
- for (let i = 0; i < parts.length; i++) {
502
- const segment = parts[i]
503
-
504
- try {
505
- const stat = await this.unixfs.stat(cid, {
506
- ...opts,
507
- offline: true,
508
- path: segment
509
- })
510
-
511
- output.push({
512
- cid: stat.cid,
513
- name: segment,
514
- unixfs: stat.unixfs
515
- })
516
-
517
- cid = stat.cid
518
- } catch (err) {
519
- log.error('could not resolve path segment %s of %s under %c', segment, path, root)
520
-
521
- if (opts.createMissingDirectories) {
522
- const cid = await this.unixfs.addDirectory()
523
-
524
- output.push({
525
- cid,
526
- name: segment,
527
- unixfs: new IPFSUnixFS({ type: 'directory' })
528
- })
529
- } else {
530
- throw new DoesNotExistError(`${path} does not exist`)
531
- }
532
- }
533
- }
534
-
535
- const lastSegment = output[output.length - 1]
536
-
537
- if (opts.finalSegmentMustBeDirectory && lastSegment.unixfs?.isDirectory() !== true) {
538
- throw new NotADirectoryError(`${path} was not a directory`)
539
- }
540
-
541
- return output
542
- }
543
-
544
- async #persistPath (path: PathEntry[], options: Partial<CpOptions> = {}): Promise<CID> {
545
- let child = path.pop()
546
-
547
- if (child == null) {
548
- throw new InvalidParametersError('path was too short')
549
- }
550
-
551
- let cid = child.cid
552
-
553
- for (let i = path.length - 1; i > -1; i--) {
554
- const segment = path[i]
555
- segment.cid = await this.unixfs.cp(child.cid, segment.cid, child.name, {
556
- ...options,
557
- force: true
558
- })
559
-
560
- child = segment
561
- cid = segment.cid
562
- }
563
-
564
- await this.components.datastore.put(this.key, cid.bytes, options)
565
-
566
- return cid
567
- }
568
-
569
- async #ensurePathExists (path: string, options: StatOptions = {}): Promise<void> {
570
- const exists = await this.#pathExists(path, options)
571
-
572
- if (!exists) {
573
- throw new DoesNotExistError()
574
- }
575
- }
576
-
577
- async #ensurePathDoesNotExist (path: string, options: StatOptions = {}): Promise<void> {
578
- const exists = await this.#pathExists(path, options)
579
-
580
- if (exists) {
581
- throw new AlreadyExistsError()
582
- }
583
- }
584
-
585
- async #pathExists (path: string, options: StatOptions = {}): Promise<boolean> {
586
- try {
587
- await this.stat(path, {
588
- ...options,
589
- offline: true
590
- })
591
-
592
- return true
593
- } catch {
594
- return false
595
- }
596
- }
597
- }
598
-
599
234
  /**
600
235
  * Create a {@link MFS} instance powered by {@link https://github.com/ipfs/helia Helia}
601
236
  */
602
- export function mfs (helia: { blockstore: Blockstore, datastore: Datastore }, init: MFSInit = {}): MFS {
603
- return new DefaultMFS(helia, init)
237
+ export function mfs (helia: { blockstore: Blockstore, datastore: Datastore, logger: ComponentLogger }, init: MFSInit = {}): MFS {
238
+ return new MFSClass(helia, init)
604
239
  }