Ipfs package#188
Closed
MakMuftic wants to merge 69 commits into
Closed
Conversation
added 9 commits
February 26, 2021 11:35
…into mmuftic/ipfs-package
… mmuftic/ipfs-package
added 12 commits
March 9, 2021 13:36
added 10 commits
June 1, 2021 15:15
Contributor
|
hey @MakMuftic I am trying to build this locally but I am getting an error: Probably I am missing something, do you have any idea? |
Contributor
Author
Sorry for the late reply, I will investigate what happened and try to resolve this problem asap |
Contributor
|
Thank you so much for your work on this @MakMuftic, it's wonderful! We're migrating this wrapper to the integrations repo in this PR: polywrap/wrap-integrations#101 Going to close this. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

Changes
HTTP plugin
I have refactored the HTTP plugin to support sending body as form data (this is necessary as IPFS expects files to come in this way). Currently, I implemented this by defining
Bodytype to be:This allows users to define what kind of request body (payload) is going to be sent. I am not entirely pleased with this solution...it would be for sure better to define a union type for the body that would include all defined types (
body: String | Bytes | FormData) but we are not going to support this so I had to find a workaround. Another idea is to have multiple post functions defined within HTTP plugin (postWithStringPayload,postWithFormDataPayload,...).@dOrgJelli I would like to hear what you think about the current solution.
IPFS package
Implemented catFile, catToString and addFile ipfs functions + e2e tests.
Other
I expanded query command of CLI to support defining paths toward files in format
file:path/to/file/example.txt. This will read file content and convert it toUint8Array. This is used when testing ipfs function addFile, but I think functionality itself could be useful in multiple usecases.TODO
I can't figure out why, but when inside schema definition of HTTP plugin I set property
formDataBodyofbodyto be nullable then generated code has a problem on the compilation. For some reason in generated functionwriteHttp_Bodyeven though there is a checkif (type.formDataBody)before calling write, the type is being considered to beHttp_FormData | null, and because of that compilation fails.Here is the error message:
And here is a snip from generated code where an error occurs:
Issues
Closes #188
Closes #247