Skip to content

Use native ipfs types and remove hand-written ones#243

Merged
matheus23 merged 6 commits intomainfrom
matheus23/use-ipfs-types
Jun 4, 2021
Merged

Use native ipfs types and remove hand-written ones#243
matheus23 merged 6 commits intomainfrom
matheus23/use-ipfs-types

Conversation

@matheus23
Copy link
Copy Markdown
Contributor

Summary

This will make webnative use the typescript types that were now developed by ipfs (ipfs/js-ipfs#2945).
This in turn makes the types more accurate, as it seems they've become somewhat outdated. E.g. see this line in the dashboard for one of the cases we've gotten it slightly wrong.

Test plan (required)

Unfortunately it's not a pure refactor: On the public side, I've had to transform the FileContent type into ImportCandidate (from ipfs). This makes sense, because some of the FileContent types wouldn't be supported to be added on the public filesystem side.
This changes behavior, but I decided that in this case it makes sense to fix the implementation and adjust it to the types instead of adjusting the types. This is something I'm not 100% sure about, so please discuss if you have some ideas.

Since I've changed behavior, we should test some apps, including drive, the dashboard & maybe flatmate (or something else using webnative-elm).

@matheus23
Copy link
Copy Markdown
Contributor Author

I've updated dependencies in this PR. I think merging this will also close most of the dependabot PRs.

Copy link
Copy Markdown
Contributor

@icidasset icidasset left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few questions, looks great otherwise!

Comment thread package.json Outdated
"ipfs-core": "^0.6.1",
"cids": "^1.1.6",
"fission-bloom-filters": "1.7.0",
"ipfs-core": "^0.7.0",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be in devDependencies?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

YES! Fuuuuu...

Comment thread src/ipfs/util.ts
import { DAGNode, RawDAGNode, DAGLink, RawDAGLink } from './types'
import dagPB, { DAGLink, DAGNode } from 'ipld-dag-pb'
import type { GetResult } from 'ipfs-core-types/src/dag'
import { CID } from 'ipfs-message-port-client/src/block'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the same CID type as from the cids library?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope. Super annoying that it isn't. Not sure what's up with that in the js-ipfs ecosystems right now 🤔

@matheus23 matheus23 merged commit abe1b36 into main Jun 4, 2021
@matheus23 matheus23 deleted the matheus23/use-ipfs-types branch June 4, 2021 11:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants