refactor(strings)!: remove codec from AddOptions #668
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Title
refactor(strings)!: remove codec from AddOptions
Description
This changes @helia/strings to act more like the other helia importers.
It simplifies the
@helia/strings
importer to only encode strings as 'utf8' and apply the raw codec to output CIDs.If users need to import data to helia using a different codec, one of the other helia importers (json, dag-json, dag-cbor) can be used.
For special use cases a user can handle the encoding/decoding, hashing, and then importing themselves.
multiformats
' Block.encode/decode is helpful for this. Happy to add an example with this pull.Notes & open questions
This would be a prerequisite to #643
BREAKING CHANGE:
Removes
codec
from AddOptions for@helia/strings.add
. Anyone relyingon this option currently would have to encode, hash, and import the data
using helia's blockstore (unless implemented by another helia importer
e.g.
@helia/json
or@helia/dag-cbor
) in order to receive the sameCID as before.
Change checklist