Skip to content
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

refactor(strings)!: remove codec from AddOptions #668

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tabcat
Copy link
Contributor

@tabcat tabcat commented Oct 28, 2024

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 relying
on 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 same
CID as before.

Change checklist

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation if necessary (this includes comments as well)
  • I have added tests that prove my fix is effective or that my feature works

BREAKING CHANGE:

Removes `codec` from AddOptions for `@helia/strings.add`. Anyone relying
on 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 same
CID as before.

This changes @helia/strings to act more like the other helia importers.
@tabcat tabcat marked this pull request as ready for review October 28, 2024 13:06
@tabcat tabcat requested a review from a team as a code owner October 28, 2024 13:06
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.

1 participant