-
Notifications
You must be signed in to change notification settings - Fork 28
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!: use bzz endpoint for file and dirs #280
Conversation
396bdfc
to
20cf6d5
Compare
20cf6d5
to
695e865
Compare
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.
LGTM!
src/modules/bzz.ts
Outdated
headers: { | ||
...extractFileUploadHeaders(options), | ||
}, | ||
params, |
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.
It's possible to rewrite this as
params: {
name,
},
Then the params
declaration above with the if (name) { ... }
is not necessary.
name?: string, | ||
options?: FileUploadOptions, | ||
): Promise<Reference> { | ||
if (!url) { |
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.
This check is not strictly necessary because uploadFile
is not exposed to the public API, therefore it's always called with the inputs already validated.
We also doesn't check the inputs or the url in other functions. If you want stronger guarantees it's possible to create a BeeURL
type which is already validated and have the type system enforce its validity.
This PR adopts the upcoming changes to bee (see ethersphere/bee#1501). Also tackles partially the #265. It won't be merged atm. but it is ready for review.
Current limitation of this PR:
isSupportedVersion
fails because we are running tests against latest master.browsershould pin and unpin collection
test is disabled as it now newly usesSwarm-Collection
header and because of that it runs into bee bug CORS Preflight request: return supported headers bee#1376Breaking changes:
download*FromCollection
recursive
flag fromuploadFilesFromDirectory