@helia/car 5.0.1 → 5.1.0-faac4ad3

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 (50) hide show
  1. package/README.md +54 -4
  2. package/dist/index.min.js +1 -1
  3. package/dist/index.min.js.map +4 -4
  4. package/dist/src/car.d.ts +1 -2
  5. package/dist/src/car.d.ts.map +1 -1
  6. package/dist/src/car.js +46 -124
  7. package/dist/src/car.js.map +1 -1
  8. package/dist/src/errors.d.ts +8 -0
  9. package/dist/src/errors.d.ts.map +1 -1
  10. package/dist/src/errors.js +8 -0
  11. package/dist/src/errors.js.map +1 -1
  12. package/dist/src/export-strategies/block-exporter.d.ts +5 -2
  13. package/dist/src/export-strategies/block-exporter.d.ts.map +1 -1
  14. package/dist/src/export-strategies/block-exporter.js +9 -3
  15. package/dist/src/export-strategies/block-exporter.js.map +1 -1
  16. package/dist/src/export-strategies/subgraph-exporter.d.ts +5 -2
  17. package/dist/src/export-strategies/subgraph-exporter.d.ts.map +1 -1
  18. package/dist/src/export-strategies/subgraph-exporter.js +8 -3
  19. package/dist/src/export-strategies/subgraph-exporter.js.map +1 -1
  20. package/dist/src/export-strategies/unixfs-exporter.d.ts +10 -4
  21. package/dist/src/export-strategies/unixfs-exporter.d.ts.map +1 -1
  22. package/dist/src/export-strategies/unixfs-exporter.js +15 -8
  23. package/dist/src/export-strategies/unixfs-exporter.js.map +1 -1
  24. package/dist/src/index.d.ts +64 -12
  25. package/dist/src/index.d.ts.map +1 -1
  26. package/dist/src/index.js +56 -6
  27. package/dist/src/index.js.map +1 -1
  28. package/dist/src/traversal-strategies/cid-path.d.ts +9 -6
  29. package/dist/src/traversal-strategies/cid-path.d.ts.map +1 -1
  30. package/dist/src/traversal-strategies/cid-path.js +35 -12
  31. package/dist/src/traversal-strategies/cid-path.js.map +1 -1
  32. package/dist/src/traversal-strategies/graph-search.d.ts +15 -7
  33. package/dist/src/traversal-strategies/graph-search.d.ts.map +1 -1
  34. package/dist/src/traversal-strategies/graph-search.js +57 -11
  35. package/dist/src/traversal-strategies/graph-search.js.map +1 -1
  36. package/dist/src/traversal-strategies/unixfs-path.d.ts +53 -3
  37. package/dist/src/traversal-strategies/unixfs-path.d.ts.map +1 -1
  38. package/dist/src/traversal-strategies/unixfs-path.js +70 -30
  39. package/dist/src/traversal-strategies/unixfs-path.js.map +1 -1
  40. package/package.json +7 -5
  41. package/src/car.ts +54 -163
  42. package/src/errors.ts +10 -0
  43. package/src/export-strategies/block-exporter.ts +13 -4
  44. package/src/export-strategies/subgraph-exporter.ts +13 -4
  45. package/src/export-strategies/unixfs-exporter.ts +20 -9
  46. package/src/index.ts +66 -15
  47. package/src/traversal-strategies/cid-path.ts +43 -13
  48. package/src/traversal-strategies/graph-search.ts +70 -12
  49. package/src/traversal-strategies/unixfs-path.ts +77 -41
  50. package/dist/typedoc-urls.json +0 -20
package/dist/src/car.d.ts CHANGED
@@ -5,10 +5,9 @@ import type { AbortOptions } from '@libp2p/interface';
5
5
  import type { CID } from 'multiformats/cid';
6
6
  import type { ProgressOptions } from 'progress-events';
7
7
  export declare class Car implements CarInterface {
8
- #private;
9
8
  private readonly components;
10
9
  private readonly log;
11
- constructor(components: CarComponents, init: any);
10
+ constructor(components: CarComponents);
12
11
  import(reader: Pick<CarReader, 'blocks'>, options?: AbortOptions & ProgressOptions<PutManyBlocksProgressEvents>): Promise<void>;
13
12
  export(root: CID | CID[], options?: ExportCarOptions): AsyncGenerator<Uint8Array, void, undefined>;
14
13
  private _export;
@@ -1 +1 @@
1
- {"version":3,"file":"car.d.ts","sourceRoot":"","sources":["../../src/car.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,aAAa,EAAE,GAAG,IAAI,YAAY,EAAE,gBAAgB,EAAqC,MAAM,YAAY,CAAA;AACzH,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAA;AAC1E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;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AG,CAAQ;gBAEf,UAAU,EAAE,aAAa;IAKhC,MAAM,CAAE,MAAM,EAAE,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,eAAe,CAAC,2BAA2B,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAO9H,MAAM,CAAE,IAAI,EAAE,GAAG,GAAG,GAAG,EAAE,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,cAAc,CAAC,UAAU,EAAE,IAAI,EAAE,SAAS,CAAC;YAkC7F,OAAO;CAgEtB"}
package/dist/src/car.js CHANGED
@@ -1,17 +1,14 @@
1
1
  import { CarWriter } from '@ipld/car';
2
- import { Queue } from '@libp2p/utils';
3
2
  import drain from 'it-drain';
4
3
  import map from 'it-map';
5
- import toBuffer from 'it-to-buffer';
6
- import { createUnsafe } from 'multiformats/block';
7
4
  import { raceSignal } from 'race-signal';
8
- import { DAG_WALK_QUEUE_CONCURRENCY } from './constants.js';
5
+ import { DAG_PB_CODEC_CODE } from "./constants.js";
9
6
  import { SubgraphExporter } from './export-strategies/subgraph-exporter.js';
10
- import { GraphSearch } from './traversal-strategies/graph-search.js';
7
+ import { UnixFSExporter } from './index.js';
11
8
  export class Car {
12
9
  components;
13
10
  log;
14
- constructor(components, init) {
11
+ constructor(components) {
15
12
  this.components = components;
16
13
  this.log = components.logger.forComponent('helia:car');
17
14
  }
@@ -47,132 +44,57 @@ export class Car {
47
44
  }
48
45
  }
49
46
  async _export(root, writer, options) {
50
- const deferred = Promise.withResolvers();
51
47
  const roots = Array.isArray(root) ? root : [root];
52
- // Create traversal-specific context
53
- const traversalContext = {
54
- currentPath: [],
55
- pathsToTarget: null
56
- };
57
48
  const traversalStrategy = options?.traversal;
58
- const exportStrategy = options?.exporter ?? new SubgraphExporter();
59
- // use a queue to walk the DAG instead of recursion so we can traverse very
60
- // large DAGs
61
- const queue = new Queue({
62
- concurrency: DAG_WALK_QUEUE_CONCURRENCY
63
- });
64
- let startedExport = false;
65
- queue.addEventListener('idle', () => {
66
- if (startedExport) {
67
- // idle event was called, and started exporting, so we are done.
68
- deferred.resolve();
69
- }
70
- else if (!startedExport && traversalContext.pathsToTarget?.length === roots.length) {
71
- // queue is idle, we haven't started exporting yet, and we have path(s)
72
- // to the target(s), so we can start the export process.
73
- this.log.trace('starting export of blocks to the car file');
74
- startedExport = true;
75
- for (const path of traversalContext.pathsToTarget) {
76
- const targetIndex = path.length - 1;
77
- const targetCid = path[targetIndex];
78
- // Process all verification blocks in the path except the target
79
- path.slice(0, -1).forEach(cid => {
80
- queue.add(async () => {
81
- await this.#exportDagNode({ cid, queue, writer, strategy: exportStrategy, options, recursive: false });
82
- })
83
- .catch((err) => {
84
- this.log.error('error during queue operation - %e', err);
49
+ for (const root of roots) {
50
+ const exportStrategy = options?.exporter ?? (root.code === DAG_PB_CODEC_CODE ? new UnixFSExporter() : new SubgraphExporter());
51
+ let current = root;
52
+ let underRoot = false;
53
+ if (traversalStrategy != null) {
54
+ for await (const { cid, bytes } of traversalStrategy.traverse(current, this.components.blockstore, this.components.getCodec, options)) {
55
+ this.log.trace('next CID on path to %c is %c', root, cid);
56
+ current = cid;
57
+ // the traversal is under the root we are exporting
58
+ if (root.equals(cid)) {
59
+ underRoot = true;
60
+ }
61
+ // include the traversal block if we are under the root CID or it has
62
+ // been explicitly requested
63
+ if (underRoot || options?.includeTraversalBlocks === true) {
64
+ // eslint-disable-next-line max-depth
65
+ if (options?.blockFilter?.has(cid.multihash.bytes) === true) {
66
+ continue;
67
+ }
68
+ // mark as processed
69
+ options?.blockFilter?.add(cid.multihash.bytes);
70
+ // store block on path to target
71
+ await writer.put({
72
+ cid,
73
+ bytes
85
74
  });
86
- });
87
- // Process the target block (which will recursively export its DAG)
88
- queue.add(async () => {
89
- await this.#exportDagNode({ cid: targetCid, queue, writer, strategy: exportStrategy, options });
90
- })
91
- .catch((err) => {
92
- this.log.error('error during queue operation - %e', err);
93
- });
75
+ }
94
76
  }
95
77
  }
96
- else {
97
- // queue is idle, we haven't started exporting yet, and we don't have
98
- // path(s) to the target(s), so we can't start the export process.
99
- // this should not happen without a separate error during traversal, but
100
- // we'll handle it here anyway.
101
- this.log.trace('no paths to target, skipping export');
102
- deferred.reject(new Error('Could not traverse to target CID(s)'));
103
- }
104
- });
105
- queue.addEventListener('failure', (evt) => {
106
- queue.clear();
107
- deferred.reject(evt.detail.error);
108
- });
109
- for (const root of roots) {
110
- void queue.add(async () => {
111
- this.log.trace('traversing dag from %c', root);
112
- await this.#traverseDagNode({ cid: root, queue, strategy: traversalStrategy ?? new GraphSearch(root), traversalContext, parentPath: [], options });
113
- })
114
- .catch((err) => {
115
- this.log.error('error during queue operation - %e', err);
116
- });
117
- }
118
- // wait for the writer to end
119
- try {
120
- await deferred.promise;
121
- }
122
- finally {
123
- await writer.close();
124
- }
125
- }
126
- /**
127
- * Traverse a DAG and stop when we reach the target node
128
- */
129
- async #traverseDagNode({ cid, queue, strategy, traversalContext, parentPath, options }) {
130
- // if we are traversing, we need to gather path(s) to the target(s)
131
- const currentPath = [...parentPath, cid];
132
- if (strategy.isTarget(cid)) {
133
- traversalContext.pathsToTarget = traversalContext.pathsToTarget ?? [];
134
- traversalContext.pathsToTarget.push([...currentPath]);
135
- this.log.trace('found path to target %c', cid);
136
- return;
137
- }
138
- const codec = await this.components.getCodec(cid.code);
139
- const bytes = await toBuffer(this.components.blockstore.get(cid, options));
140
- // we are recursively traversing the dag
141
- const decodedBlock = createUnsafe({ bytes, cid, codec });
142
- for await (const nextCid of strategy.traverse(cid, decodedBlock)) {
143
- void queue.add(async () => {
144
- await this.#traverseDagNode({ cid: nextCid, queue, strategy, traversalContext, parentPath: currentPath ?? [], options });
145
- })
146
- .catch((err) => {
147
- this.log.error('error during traversal queue operation - %e', err);
148
- });
149
- }
150
- }
151
- /**
152
- * Use an ExportStrategy to export part of all of a DAG
153
- */
154
- async #exportDagNode({ cid, queue, writer, strategy, options, recursive = true }) {
155
- if (options?.blockFilter?.has(cid.multihash.bytes) === true) {
156
- return;
157
- }
158
- const codec = await this.components.getCodec(cid.code);
159
- const bytes = await toBuffer(this.components.blockstore.get(cid, options));
160
- // Mark as processed
161
- options?.blockFilter?.add(cid.multihash.bytes);
162
- // Write to CAR
163
- await writer.put({ cid, bytes });
164
- if (recursive) {
165
- // we are recursively traversing the dag
166
- const decodedBlock = createUnsafe({ bytes, cid, codec });
167
- for await (const nextCid of strategy.export(cid, decodedBlock)) {
168
- void queue.add(async () => {
169
- await this.#exportDagNode({ cid: nextCid, queue, writer, strategy, options });
170
- })
171
- .catch((err) => {
172
- this.log.error('error during export queue operation - %e', err);
78
+ for await (const { cid, bytes } of exportStrategy.export(current, this.components.blockstore, this.components.getCodec, options)) {
79
+ if (options?.blockFilter?.has(cid.multihash.bytes) === true) {
80
+ continue;
81
+ }
82
+ // skip the export target block if we have already included it during
83
+ // traversal
84
+ if (underRoot && cid.equals(current)) {
85
+ continue;
86
+ }
87
+ // mark as processed
88
+ options?.blockFilter?.add(cid.multihash.bytes);
89
+ // write to CAR
90
+ await writer.put({
91
+ cid,
92
+ bytes
173
93
  });
174
94
  }
175
95
  }
96
+ // wait for the writer to end
97
+ await writer.close();
176
98
  }
177
99
  }
178
100
  //# sourceMappingURL=car.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"car.js","sourceRoot":"","sources":["../../src/car.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AACrC,OAAO,KAAK,MAAM,UAAU,CAAA;AAC5B,OAAO,GAAG,MAAM,QAAQ,CAAA;AACxB,OAAO,QAAQ,MAAM,cAAc,CAAA;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAA;AAC3D,OAAO,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,IAAI,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,cAAc,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAE,CAAC;gBACjI,IAAI,OAAO,EAAE,WAAW,EAAE,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC;oBAC5D,SAAQ;gBACV,CAAC;gBAED,qEAAqE;gBACrE,YAAY;gBACZ,IAAI,SAAS,IAAI,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;oBACrC,SAAQ;gBACV,CAAC;gBAED,oBAAoB;gBACpB,OAAO,EAAE,WAAW,EAAE,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;gBAE9C,eAAe;gBACf,MAAM,MAAM,CAAC,GAAG,CAAC;oBACf,GAAG;oBACH,KAAK;iBACN,CAAC,CAAA;YACJ,CAAC;QACH,CAAC;QAED,6BAA6B;QAC7B,MAAM,MAAM,CAAC,KAAK,EAAE,CAAA;IACtB,CAAC;CACF"}
@@ -6,4 +6,12 @@ export declare class NotUnixFSError extends Error {
6
6
  message: string;
7
7
  name: string;
8
8
  }
9
+ export declare class NotDescendantError extends Error {
10
+ static name: string;
11
+ name: string;
12
+ }
13
+ export declare class InvalidTraversalError extends Error {
14
+ static name: string;
15
+ name: string;
16
+ }
9
17
  //# sourceMappingURL=errors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,cAAe,SAAQ,KAAK;IACvC,MAAM,CAAC,IAAI,SAAmB;IAC9B,MAAM,CAAC,OAAO,SAAsB;IACpC,MAAM,CAAC,IAAI,SAAmB;IAC9B,IAAI,SAAmB;IACvB,OAAO,SAAsB;IAC7B,IAAI,SAAmB;CACxB"}
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,cAAe,SAAQ,KAAK;IACvC,MAAM,CAAC,IAAI,SAAmB;IAC9B,MAAM,CAAC,OAAO,SAAsB;IACpC,MAAM,CAAC,IAAI,SAAmB;IAC9B,IAAI,SAAmB;IACvB,OAAO,SAAsB;IAC7B,IAAI,SAAmB;CACxB;AAED,qBAAa,kBAAmB,SAAQ,KAAK;IAC3C,MAAM,CAAC,IAAI,SAAuB;IAClC,IAAI,SAAuB;CAC5B;AAED,qBAAa,qBAAsB,SAAQ,KAAK;IAC9C,MAAM,CAAC,IAAI,SAA0B;IACrC,IAAI,SAA0B;CAC/B"}
@@ -6,4 +6,12 @@ export class NotUnixFSError extends Error {
6
6
  message = 'Not a UnixFS node';
7
7
  name = 'NotUnixFSError';
8
8
  }
9
+ export class NotDescendantError extends Error {
10
+ static name = 'NotDescendantError';
11
+ name = 'NotDescendantError';
12
+ }
13
+ export class InvalidTraversalError extends Error {
14
+ static name = 'InvalidTraversalError';
15
+ name = 'InvalidTraversalError';
16
+ }
9
17
  //# sourceMappingURL=errors.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,cAAe,SAAQ,KAAK;IACvC,MAAM,CAAC,IAAI,GAAG,gBAAgB,CAAA;IAC9B,MAAM,CAAC,OAAO,GAAG,mBAAmB,CAAA;IACpC,MAAM,CAAC,IAAI,GAAG,gBAAgB,CAAA;IAC9B,IAAI,GAAG,gBAAgB,CAAA;IACvB,OAAO,GAAG,mBAAmB,CAAA;IAC7B,IAAI,GAAG,gBAAgB,CAAA"}
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,cAAe,SAAQ,KAAK;IACvC,MAAM,CAAC,IAAI,GAAG,gBAAgB,CAAA;IAC9B,MAAM,CAAC,OAAO,GAAG,mBAAmB,CAAA;IACpC,MAAM,CAAC,IAAI,GAAG,gBAAgB,CAAA;IAC9B,IAAI,GAAG,gBAAgB,CAAA;IACvB,OAAO,GAAG,mBAAmB,CAAA;IAC7B,IAAI,GAAG,gBAAgB,CAAA;;AAGzB,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAC3C,MAAM,CAAC,IAAI,GAAG,oBAAoB,CAAA;IAClC,IAAI,GAAG,oBAAoB,CAAA;;AAG7B,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IAC9C,MAAM,CAAC,IAAI,GAAG,uBAAuB,CAAA;IACrC,IAAI,GAAG,uBAAuB,CAAA"}
@@ -1,10 +1,13 @@
1
1
  import type { ExportStrategy } from '../index.js';
2
- import type { BlockView } from 'multiformats/block/interface';
2
+ import type { CodecLoader } from '@helia/interface';
3
+ import type { AbortOptions } from '@libp2p/interface';
4
+ import type { Blockstore } from 'interface-blockstore';
5
+ import type { BlockView } from 'multiformats';
3
6
  import type { CID } from 'multiformats/cid';
4
7
  /**
5
8
  * Yields the first block from the first CID and stops
6
9
  */
7
10
  export declare class BlockExporter implements ExportStrategy {
8
- export(cid: CID, block: BlockView<any, any, any, 0 | 1>): AsyncGenerator<CID, void, undefined>;
11
+ export(cid: CID, blockstore: Blockstore, getCodec: CodecLoader, options?: AbortOptions): AsyncGenerator<BlockView<unknown, number, number, 0 | 1>, void, undefined>;
9
12
  }
10
13
  //# sourceMappingURL=block-exporter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"block-exporter.d.ts","sourceRoot":"","sources":["../../../src/export-strategies/block-exporter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AAC7D,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAA;AAE3C;;GAEG;AACH,qBAAa,aAAc,YAAW,cAAc;IAC1C,MAAM,CAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,GAAG,cAAc,CAAC,GAAG,EAAE,IAAI,EAAE,SAAS,CAAC;CAIxG"}
1
+ {"version":3,"file":"block-exporter.d.ts","sourceRoot":"","sources":["../../../src/export-strategies/block-exporter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAA;AAE3C;;GAEG;AACH,qBAAa,aAAc,YAAW,cAAc;IAC1C,MAAM,CAAE,GAAG,EAAE,GAAG,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,cAAc,CAAC,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC;CAQ7K"}
@@ -1,10 +1,16 @@
1
+ import toBuffer from 'it-to-buffer';
2
+ import { createUnsafe } from 'multiformats/block';
1
3
  /**
2
4
  * Yields the first block from the first CID and stops
3
5
  */
4
6
  export class BlockExporter {
5
- async *export(cid, block) {
6
- // don't yield the block, index.ts will add it to the car file and then
7
- // we're done
7
+ async *export(cid, blockstore, getCodec, options) {
8
+ const bytes = await toBuffer(blockstore.get(cid, options));
9
+ yield createUnsafe({
10
+ cid,
11
+ bytes,
12
+ codec: await getCodec(cid.code)
13
+ });
8
14
  }
9
15
  }
10
16
  //# sourceMappingURL=block-exporter.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"block-exporter.js","sourceRoot":"","sources":["../../../src/export-strategies/block-exporter.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,MAAM,OAAO,aAAa;IACxB,KAAK,CAAC,CAAE,MAAM,CAAE,GAAQ,EAAE,KAAsC;QAC9D,uEAAuE;QACvE,aAAa;IACf,CAAC;CACF"}
1
+ {"version":3,"file":"block-exporter.js","sourceRoot":"","sources":["../../../src/export-strategies/block-exporter.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,cAAc,CAAA;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAQjD;;GAEG;AACH,MAAM,OAAO,aAAa;IACxB,KAAK,CAAC,CAAE,MAAM,CAAE,GAAQ,EAAE,UAAsB,EAAE,QAAqB,EAAE,OAAsB;QAC7F,MAAM,KAAK,GAAG,MAAM,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAA;QAC1D,MAAM,YAAY,CAAC;YACjB,GAAG;YACH,KAAK;YACL,KAAK,EAAE,MAAM,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC;SAChC,CAAC,CAAA;IACJ,CAAC;CACF"}
@@ -1,5 +1,8 @@
1
1
  import type { ExportStrategy } from '../index.js';
2
- import type { BlockView } from 'multiformats/block/interface';
2
+ import type { CodecLoader } from '@helia/interface';
3
+ import type { AbortOptions } from '@libp2p/interface';
4
+ import type { Blockstore } from 'interface-blockstore';
5
+ import type { BlockView } from 'multiformats';
3
6
  import type { CID } from 'multiformats/cid';
4
7
  /**
5
8
  * Traverses the DAG breadth-first starting at the target CID and yields all
@@ -9,6 +12,6 @@ import type { CID } from 'multiformats/cid';
9
12
  * the helia config.
10
13
  */
11
14
  export declare class SubgraphExporter implements ExportStrategy {
12
- export(_cid: CID, block: BlockView<any, any, any, 0 | 1>): AsyncGenerator<CID, void, undefined>;
15
+ export(cid: CID, blockstore: Blockstore, getCodec: CodecLoader, options?: AbortOptions): AsyncGenerator<BlockView<unknown, number, number, 0 | 1>, void, undefined>;
13
16
  }
14
17
  //# sourceMappingURL=subgraph-exporter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"subgraph-exporter.d.ts","sourceRoot":"","sources":["../../../src/export-strategies/subgraph-exporter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AAC7D,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAA;AAE3C;;;;;;GAMG;AACH,qBAAa,gBAAiB,YAAW,cAAc;IAC7C,MAAM,CAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,GAAG,cAAc,CAAC,GAAG,EAAE,IAAI,EAAE,SAAS,CAAC;CAKzG"}
1
+ {"version":3,"file":"subgraph-exporter.d.ts","sourceRoot":"","sources":["../../../src/export-strategies/subgraph-exporter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAA;AAE3C;;;;;;GAMG;AACH,qBAAa,gBAAiB,YAAW,cAAc;IAC7C,MAAM,CAAE,GAAG,EAAE,GAAG,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,cAAc,CAAC,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC;CAU7K"}
@@ -1,3 +1,4 @@
1
+ import { breadthFirstWalker } from '@helia/utils';
1
2
  /**
2
3
  * Traverses the DAG breadth-first starting at the target CID and yields all
3
4
  * encountered blocks.
@@ -6,9 +7,13 @@
6
7
  * the helia config.
7
8
  */
8
9
  export class SubgraphExporter {
9
- async *export(_cid, block) {
10
- for (const [, linkedCid] of block.links()) {
11
- yield linkedCid;
10
+ async *export(cid, blockstore, getCodec, options) {
11
+ const walker = breadthFirstWalker({
12
+ blockstore,
13
+ getCodec
14
+ });
15
+ for await (const node of walker.walk(cid, options)) {
16
+ yield node.block;
12
17
  }
13
18
  }
14
19
  }
@@ -1 +1 @@
1
- {"version":3,"file":"subgraph-exporter.js","sourceRoot":"","sources":["../../../src/export-strategies/subgraph-exporter.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,MAAM,OAAO,gBAAgB;IAC3B,KAAK,CAAC,CAAE,MAAM,CAAE,IAAS,EAAE,KAAsC;QAC/D,KAAK,MAAM,CAAC,EAAE,SAAS,CAAC,IAAI,KAAK,CAAC,KAAK,EAAE,EAAE,CAAC;YAC1C,MAAM,SAAS,CAAA;QACjB,CAAC;IACH,CAAC;CACF"}
1
+ {"version":3,"file":"subgraph-exporter.js","sourceRoot":"","sources":["../../../src/export-strategies/subgraph-exporter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AAQjD;;;;;;GAMG;AACH,MAAM,OAAO,gBAAgB;IAC3B,KAAK,CAAC,CAAE,MAAM,CAAE,GAAQ,EAAE,UAAsB,EAAE,QAAqB,EAAE,OAAsB;QAC7F,MAAM,MAAM,GAAG,kBAAkB,CAAC;YAChC,UAAU;YACV,QAAQ;SACT,CAAC,CAAA;QAEF,IAAI,KAAK,EAAE,MAAM,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,CAAC,EAAE,CAAC;YACnD,MAAM,IAAI,CAAC,KAAK,CAAA;QAClB,CAAC;IACH,CAAC;CACF"}
@@ -1,11 +1,17 @@
1
1
  import type { ExportStrategy } from '../index.js';
2
- import type { BlockView } from 'multiformats/block/interface';
2
+ import type { CodecLoader } from '@helia/interface';
3
+ import type { AbortOptions } from '@libp2p/interface';
4
+ import type { Blockstore } from 'interface-blockstore';
5
+ import type { BlockView } from 'multiformats';
3
6
  import type { CID } from 'multiformats/cid';
4
7
  /**
5
- * This exporter is used when you want to generate a car file that contains a
6
- * single UnixFS file or directory
8
+ * Traverses the DAG depth-first starting at the target CID and yields all
9
+ * encountered blocks.
10
+ *
11
+ * Blocks linked to from the target block are traversed using codecs defined in
12
+ * the helia config.
7
13
  */
8
14
  export declare class UnixFSExporter implements ExportStrategy {
9
- export(cid: CID, block: BlockView<any, any, any, 0 | 1>): AsyncGenerator<CID, void, undefined>;
15
+ export(cid: CID, blockstore: Blockstore, getCodec: CodecLoader, options?: AbortOptions): AsyncGenerator<BlockView<unknown, number, number, 0 | 1>, void, undefined>;
10
16
  }
11
17
  //# sourceMappingURL=unixfs-exporter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"unixfs-exporter.d.ts","sourceRoot":"","sources":["../../../src/export-strategies/unixfs-exporter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AAC7D,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAA;AAE3C;;;GAGG;AACH,qBAAa,cAAe,YAAW,cAAc;IAC3C,MAAM,CAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,GAAG,cAAc,CAAC,GAAG,EAAE,IAAI,EAAE,SAAS,CAAC;CAUxG"}
1
+ {"version":3,"file":"unixfs-exporter.d.ts","sourceRoot":"","sources":["../../../src/export-strategies/unixfs-exporter.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAA;AAE3C;;;;;;GAMG;AACH,qBAAa,cAAe,YAAW,cAAc;IAC3C,MAAM,CAAE,GAAG,EAAE,GAAG,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,cAAc,CAAC,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC;CAc7K"}
@@ -1,17 +1,24 @@
1
- import { DAG_PB_CODEC_CODE, RAW_PB_CODEC_CODE } from '../constants.js';
2
- import { NotUnixFSError } from '../errors.js';
1
+ import { depthFirstWalker } from '@helia/utils';
2
+ import { DAG_PB_CODEC_CODE, RAW_PB_CODEC_CODE } from "../constants.js";
3
+ import { NotUnixFSError } from "../errors.js";
3
4
  /**
4
- * This exporter is used when you want to generate a car file that contains a
5
- * single UnixFS file or directory
5
+ * Traverses the DAG depth-first starting at the target CID and yields all
6
+ * encountered blocks.
7
+ *
8
+ * Blocks linked to from the target block are traversed using codecs defined in
9
+ * the helia config.
6
10
  */
7
11
  export class UnixFSExporter {
8
- async *export(cid, block) {
12
+ async *export(cid, blockstore, getCodec, options) {
9
13
  if (cid.code !== DAG_PB_CODEC_CODE && cid.code !== RAW_PB_CODEC_CODE) {
10
14
  throw new NotUnixFSError('Target CID was not UnixFS - use the SubGraphExporter to export arbitrary graphs');
11
15
  }
12
- // yield all the blocks that make up the file or directory
13
- for (const [, linkedCid] of block.links()) {
14
- yield linkedCid;
16
+ const walker = depthFirstWalker({
17
+ blockstore,
18
+ getCodec
19
+ });
20
+ for await (const node of walker.walk(cid, options)) {
21
+ yield node.block;
15
22
  }
16
23
  }
17
24
  }
@@ -1 +1 @@
1
- {"version":3,"file":"unixfs-exporter.js","sourceRoot":"","sources":["../../../src/export-strategies/unixfs-exporter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAK7C;;;GAGG;AACH,MAAM,OAAO,cAAc;IACzB,KAAK,CAAC,CAAE,MAAM,CAAE,GAAQ,EAAE,KAAsC;QAC9D,IAAI,GAAG,CAAC,IAAI,KAAK,iBAAiB,IAAI,GAAG,CAAC,IAAI,KAAK,iBAAiB,EAAE,CAAC;YACrE,MAAM,IAAI,cAAc,CAAC,iFAAiF,CAAC,CAAA;QAC7G,CAAC;QAED,0DAA0D;QAC1D,KAAK,MAAM,CAAC,EAAE,SAAS,CAAC,IAAI,KAAK,CAAC,KAAK,EAAE,EAAE,CAAC;YAC1C,MAAM,SAAS,CAAA;QACjB,CAAC;IACH,CAAC;CACF"}
1
+ {"version":3,"file":"unixfs-exporter.js","sourceRoot":"","sources":["../../../src/export-strategies/unixfs-exporter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAQ7C;;;;;;GAMG;AACH,MAAM,OAAO,cAAc;IACzB,KAAK,CAAC,CAAE,MAAM,CAAE,GAAQ,EAAE,UAAsB,EAAE,QAAqB,EAAE,OAAsB;QAC7F,IAAI,GAAG,CAAC,IAAI,KAAK,iBAAiB,IAAI,GAAG,CAAC,IAAI,KAAK,iBAAiB,EAAE,CAAC;YACrE,MAAM,IAAI,cAAc,CAAC,iFAAiF,CAAC,CAAA;QAC7G,CAAC;QAED,MAAM,MAAM,GAAG,gBAAgB,CAAC;YAC9B,UAAU;YACV,QAAQ;SACT,CAAC,CAAA;QAEF,IAAI,KAAK,EAAE,MAAM,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,CAAC,EAAE,CAAC;YACnD,MAAM,IAAI,CAAC,KAAK,CAAA;QAClB,CAAC;IACH,CAAC;CACF"}
@@ -23,7 +23,9 @@
23
23
  * const c = car(helia)
24
24
  * const out = nodeFs.createWriteStream('example.car')
25
25
  *
26
- * for await (const buf of c.export(cid)) {
26
+ * for await (const buf of c.export(cid, {
27
+ * signal: AbortSignal.timeout(5_000)
28
+ * })) {
27
29
  * out.write(buf)
28
30
  * }
29
31
  *
@@ -32,6 +34,14 @@
32
34
  *
33
35
  * @example Exporting a part of a UnixFS DAG as a CAR file
34
36
  *
37
+ * Here the graph traversal will start at `root` and include the blocks for
38
+ * `root`, `/foo`, `/bar`, and all the blocks that make up `baz.txt`.
39
+ *
40
+ * If there are other files/directories in the UnixFS DAG under `root`, they
41
+ * will not be included.
42
+ *
43
+ * `root` will be the only entry in the CAR file roots.
44
+ *
35
45
  * ```typescript
36
46
  * import { createHelia } from 'helia'
37
47
  * import { car, UnixFSPath } from '@helia/car'
@@ -39,12 +49,13 @@
39
49
  * import nodeFs from 'node:fs'
40
50
  *
41
51
  * const helia = await createHelia()
42
- * const cid = CID.parse('QmFoo...')
52
+ * const root = CID.parse('QmFoo...')
43
53
  *
44
54
  * const c = car(helia)
45
55
  * const out = nodeFs.createWriteStream('example.car')
46
56
  *
47
- * for await (const buf of c.export(cid, {
57
+ * for await (const buf of c.export(root, {
58
+ * signal: AbortSignal.timeout(5_000),
48
59
  * traversal: new UnixFSPath('/foo/bar/baz.txt')
49
60
  * })) {
50
61
  * out.write(buf)
@@ -53,6 +64,43 @@
53
64
  * out.end()
54
65
  * ```
55
66
  *
67
+ * @example Including traversal path above the root in a CAR
68
+ *
69
+ * The `includeTraversalBlocks` option will include the traversal blocks in the
70
+ * CAR when they would otherwise be excluded (for example when the traversal
71
+ * starts in a parent of the export root).
72
+ *
73
+ * Here `baz` is the CID for `baz.txt`.
74
+ *
75
+ * The CAR file will include the blocks for `parent`, `/foo`, `/bar`, and
76
+ * `/baz.txt`.
77
+ *
78
+ * `baz` will be the only entry in the CAR file roots.
79
+ *
80
+ * ```typescript
81
+ * import { createHelia } from 'helia'
82
+ * import { car, UnixFSPath } from '@helia/car'
83
+ * import { CID } from 'multiformats/cid'
84
+ * import nodeFs from 'node:fs'
85
+ *
86
+ * const helia = await createHelia()
87
+ * const parent = CID.parse('QmFoo...')
88
+ * const baz = CID.parse('QmBar...')
89
+ *
90
+ * const c = car(helia)
91
+ * const out = nodeFs.createWriteStream('example.car')
92
+ *
93
+ * for await (const buf of c.export(baz, {
94
+ * signal: AbortSignal.timeout(5_000),
95
+ * traversal: new UnixFSPath(parent, '/foo/bar/baz.txt'),
96
+ * includeTraversalBlocks: true
97
+ * })) {
98
+ * out.write(buf)
99
+ * }
100
+ *
101
+ * out.end()
102
+ * ```
103
+ *
56
104
  * @example Importing all blocks from a CAR file
57
105
  *
58
106
  * ```typescript
@@ -72,7 +120,9 @@
72
120
  * const reader = await CarReader.fromIterable(inStream)
73
121
  *
74
122
  * const c = car(helia)
75
- * await c.import(reader)
123
+ * await c.import(reader, {
124
+ * signal: AbortSignal.timeout(5_000)
125
+ * })
76
126
  * ```
77
127
  */
78
128
  import type { CodecLoader } from '@helia/interface';
@@ -98,12 +148,7 @@ export interface TraversalStrategy {
98
148
  /**
99
149
  * Traverse the DAG and yield the next CID to traverse
100
150
  */
101
- traverse<T extends BlockView<any, any, any, 0 | 1>>(cid: CID, block: T): AsyncGenerator<CID, void, undefined>;
102
- /**
103
- * Returns true if the current CID is the target and we should switch to the
104
- * export strategy
105
- */
106
- isTarget(cid: CID): boolean;
151
+ traverse(root: CID, blockstore: Blockstore, getCodec: CodecLoader, options?: AbortOptions): AsyncGenerator<BlockView<unknown, number, number, 0 | 1>, void, undefined>;
107
152
  }
108
153
  /**
109
154
  * Interface for different export strategies.
@@ -115,7 +160,7 @@ export interface ExportStrategy {
115
160
  /**
116
161
  * Export the DAG and yield the next CID to traverse
117
162
  */
118
- export<T extends BlockView<any, any, any, 0 | 1>>(cid: CID, block: T): AsyncGenerator<CID, void, undefined>;
163
+ export(cid: CID, blockstore: Blockstore, getCodec: CodecLoader, options?: AbortOptions): AsyncGenerator<BlockView<unknown, number, number, 0 | 1>, void, undefined>;
119
164
  }
120
165
  export * from './export-strategies/index.js';
121
166
  export * from './traversal-strategies/index.js';
@@ -141,6 +186,13 @@ export interface ExportCarOptions extends AbortOptions, ProgressOptions<GetBlock
141
186
  * blocks included in the exported car file. (e.g. https://specs.ipfs.tech/http-gateways/trustless-gateway/#dag-scope-request-query-parameter)
142
187
  */
143
188
  exporter?: ExportStrategy;
189
+ /**
190
+ * If `true`, and the traversal strategy starts above the root, include the
191
+ * traversed blocks in the CAR file before the root and subsequent blocks
192
+ *
193
+ * @default false
194
+ */
195
+ includeTraversalBlocks?: boolean;
144
196
  }
145
197
  /**
146
198
  * The Car interface provides operations for importing and exporting Car files
@@ -193,5 +245,5 @@ export interface Car {
193
245
  /**
194
246
  * Create a {@link Car} instance for use with {@link https://github.com/ipfs/helia Helia}
195
247
  */
196
- export declare function car(helia: CarComponents, init?: any): Car;
248
+ export declare function car(helia: CarComponents): Car;
197
249
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d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