-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use native ipfs types and remove hand-written ones #243
Conversation
I've updated dependencies in this PR. I think merging this will also close most of the dependabot PRs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
package.json
Outdated
"ipfs-core": "^0.6.1", | ||
"cids": "^1.1.6", | ||
"fission-bloom-filters": "1.7.0", | ||
"ipfs-core": "^0.7.0", |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
YES! Fuuuuu...
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' |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 🤔
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 intoImportCandidate
(from ipfs). This makes sense, because some of theFileContent
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).