This repository was archived by the owner on Feb 12, 2024. It is now read-only.
Commit bdc6f4d
Alan Shaw
refactor: object APIs write methods now return CIDs
For the back story on this change, please see: ipfs-inactive/interface-js-ipfs-core#388 (review)
BREAKING CHANGE: Object API refactor.
Object API methods that write DAG nodes now return a [CID](https://www.npmjs.com/package/cids) instead of a DAG node. Affected methods:
* `ipfs.object.new`
* `ipfs.object.patch.addLink`
* `ipfs.object.patch.appendData`
* `ipfs.object.patch.rmLink`
* `ipfs.object.patch.setData`
* `ipfs.object.put`
Example:
```js
// Before
const dagNode = await ipfs.object.new()
```
```js
// After
const cid = await ipfs.object.new() // now returns a CID
const dagNode = await ipfs.object.get(cid) // fetch the DAG node that was created
```
IMPORTANT: `DAGNode` instances, which are part of the IPLD dag-pb format have been refactored.
These instances no longer have `multihash`, `cid` or `serialized` properties.
This effects the following API methods that return these types of objects:
* `ipfs.object.get`
* `ipfs.dag.get`
See ipld/js-ipld-dag-pb#99 for more information.
License: MIT
Signed-off-by: Alan Shaw <[email protected]>1 parent 5237dd9 commit bdc6f4d
2 files changed
+13
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
101 | | - | |
| 101 | + | |
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
| |||
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
153 | | - | |
| 153 | + | |
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
| |||
209 | 209 | | |
210 | 210 | | |
211 | 211 | | |
212 | | - | |
213 | | - | |
214 | | - | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
215 | 217 | | |
216 | 218 | | |
217 | 219 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| |||
200 | 200 | | |
201 | 201 | | |
202 | 202 | | |
203 | | - | |
204 | | - | |
| 203 | + | |
205 | 204 | | |
206 | 205 | | |
207 | 206 | | |
| |||
366 | 365 | | |
367 | 366 | | |
368 | 367 | | |
369 | | - | |
| 368 | + | |
370 | 369 | | |
371 | 370 | | |
372 | 371 | | |
| |||
409 | 408 | | |
410 | 409 | | |
411 | 410 | | |
412 | | - | |
| 411 | + | |
413 | 412 | | |
414 | 413 | | |
415 | 414 | | |
| |||
477 | 476 | | |
478 | 477 | | |
479 | 478 | | |
480 | | - | |
| 479 | + | |
481 | 480 | | |
482 | 481 | | |
483 | 482 | | |
| |||
544 | 543 | | |
545 | 544 | | |
546 | 545 | | |
547 | | - | |
| 546 | + | |
548 | 547 | | |
549 | 548 | | |
550 | 549 | | |
| |||
0 commit comments