Skip to content

Releases: ethersphere/bee-js

@ethersphere/bee-js v2.1.0

13 Oct 14:14
ae6a776
Compare
Choose a tag to compare

This release is a compatibility release with Bee 1.2.0 release, which brings few new features.

Is retrievable? support

The new method bee.isReferenceRetrievable() allows you to check whether the data represented by a reference is present in the network. This is part of the Stewardship endpoint, which also allows you to reupload the data that you have locally available (pinned).

🏷 New Postage Batch methods

There is a new method beeDebug.topUpBatch(), that allows you to top-up the amount of existing batch, effectively prolonging its lifetime.

Moreover, there is also a new method beeDebug.diluteBatch() that increases the depth of a batch, effectively extending the number of chunks that the batch can stamp and lowering the lifetime of a batch.

📨 PSS Target limit increase

⚠️ If you use the utility function makeMaxTarget, then the time of sending a PSS message will increase! Consider using your own criteria based on your use-case.

Features

Bug Fixes

Reverts


@ethersphere/bee-js v2.0.0

23 Sep 16:27
5b112bf
Compare
Choose a tag to compare

This is our first major version bump as we did a big revamp of bee-js internals and fixed a few things and shortcomings that required breaking changes.

🤖 HTTP client swap (timeout and retries support)

In the JS browser ecosystem, there are two main HTTP clients: old XMLHttpRequest (XHR) API and new modern fetch API.

We originally used axios library that employs the XHR client, but XHR is old and will not get any new features as it is superseded with fetch API that is actively developed by the WHATWG group, and hence it has its limitations. Many limitations can be overcome using polyfills etc. but a hard stop is networking that only browsers decide what to allow (usually based on the specification). In the case of XHR the limitation is streaming support.

We have therefore decided to use fetch based library ky that supports streaming downloads and hopefully in close future will support also streaming uploads (see whatwg/fetch#966, there is also already functional experiment that enables this in Chrome). fetch is also more future-proof.

This change, unfortunately, does not come without a cost and that is support for tracking upload progress, that fetch still does not have (if interested please comment on the relevant whatwg/fetch#607 issue to raise importance).
If this feature is crucial for you, we have devised a workaround thanks to @mattiaz9, which is demonstrated in our example upload-progress.

This change unfortunately is breaking as we originally exposed AxiosOptions on our API. We have refactored this into more generic HTTP options that should be more future-proof. Thanks to ky we also now have support for retries of failed requests (only for non-POST requests, defaults are seen here) and timeouts. Both are possible to set generally for the Bee instance and/or override it for each method call.

🎏 Streaming revamp

As part of the HTTP client revamp, we had a deeper look at how we handle streams. In the JS land, there are two main types of streams the NodeJS Readable and the browser WHATWG ReadableStream. As our design mindset is browser-first and polyfill the rest in NodeJs, we have unified all returned streams into the WHATWG ReadableStream no matter what platform you are on. Most probably you will want to use NodeJs Readable on NodeJs platform, so we have included utility function readableWebToNode that converts WHATWG stream into NodeJs. There are also more stream-related utility functions that you can check out.

For stream inputs, we accept both types of streams and convert them internally.

⏎ Upload results refactor

One of our short-coming was dropping the returned object from upload methods in favor of the simple string Reference. Later on, we discovered that there is actually a need to return more information from upload operations because Bee automatically creates a Tag for each upload that we could return. Hence we have introduced back UploadResult interface that all the upload methods will now return.

🫓 Utility namespace flatting and filtering

We have merged all the Utils.* namespaces directly into Utils and we have filtered out the functions only to those that make sense to expose in order to minimize the public API and possible future breaking changes.

🗾 uploadCollection() method

We have introduced new uploadCollection method that is more flexible in uploading collection if you do not want to use our convenience methods like uploadFilesFromDirectory() or uploadFiles. This new method accepts the Collection<Uint8Array | Readable> interface.

⚠ BREAKING CHANGES

  • Requests made by bee-js are now reported with User-Agent: bee-js/<<bee-js's version>> (#390)
  • Utils.setDefaultHeaders() was removed in favor of Bee/BeeDebug instance's option defaultHeaders (#390)
  • Hooks (#390)
    • Utils.hooks.* was removed in favor of Bee/BeeDebug instance's options onRequest and onResponse
    • Hooks now pass only metadata of the requests and not the payload
  • All returned streams are now of WHATWG ReadableStream. If you need NodeJS's Readable you can use Utils.readableWebToNode() utility function. (#390)
  • All axiosOptions were removed from those methods that supported it (for example bee.downloadReadableData(), bee.reuploadPinnedData(), UploadOptions does not have axiosOptions property anymore) (#390)
  • Unfortunately fetch does not support tracking of upload progress (like XHR/axios supported with the onUploadProgress). Please see our example upload-progress for work-around. (#390)
  • All upload methods now returns UploadResult interface (#408)
  • bee.pssSend() now throws error if the specified target exceeds maximal value. Use Utils.makeMaxTarget() that will give you the max target that Bee accepts. (#384)
  • Utils namespace is flattened and limited on the functions (#395)

Other changes:

  • All upload methods that used to accept NodeJS's Readable now accept both NodeJS and WHATWG Readable(Stream).
  • Usage of ReadableStreams in a browser is now possible. Be aware that real support for streaming browsers has only for download, but not upload. When Readable is passed to upload methods it is first fully buffered before making the request.

Features

  • HTTP request options is possible to override per method call (#411) (9eac5cd)
  • return UploadResult for upload methods (#408) (e58b8e8)

Bug Fixes

Code Refactoring

@ethersphere/bee-js v1.2.1

27 Aug 09:56
74056cb
Compare
Choose a tag to compare

This is a small patch release that fixes wrongly reporting incompatible version with Bee 1.1.0 builds for Mac and Windows. Related to ethersphere/bee#2451

Bug Fixes

  • bee 1.1.0 version reporting workaround (#401) (687e431)

@ethersphere/bee-js v1.2.0

24 Aug 10:19
2538afe
Compare
Choose a tag to compare

This is mainly a compatibility release with Bee 1.1.0 release.

🏷 Stamps API move and deprecation

The Stamps API was moved to Debug API and on normal API it is now deprecated. Moreover, Bee provides more information on Debug API with for example batchTtl that gives an estimation for how long the batch will be valid.

⛓ Pending transaction management supports

New Debug API was added that allows you to manage pending transactions and do things like:

  • list pending transactions
  • rebroadcast already created (pending) transaction
  • cancel a pending transaction

Features

@ethersphere/bee-js v1.1.1

21 Jul 09:05
803c8a4
Compare
Choose a tag to compare

This is a small patch release that fixes missing headers in requests/responses returned using the hooks system.

Bug Fixes

@ethersphere/bee-js v1.1.0

20 Jul 09:07
6f227e1
Compare
Choose a tag to compare

This is a small incremental release that brings two new features.

🪝 Hooks system

If you need to know what exact HTTP requests bee-js sends to Bee you can now register hooks for outgoing requests and incoming responses using Utils.Hooks interface.

Be aware! These listeners listen to all outgoing bee-js's requests/responses, so if you have multiple Bee/BeeDebug instances for different Bee nodes, than all requests will be forwarded to your callbacks!

🏷 New Tag endpoints

With the 1.0 Bee release few new endpoints related to Tags were introduced that allows you to list, update and delete tags.

Features


@ethersphere/bee-js v1.0.0

22 Jun 10:02
2b238cf
Compare
Choose a tag to compare

This release bumps the supported Bee version to 1.0.0, which marks the mainnet launch of the project.

Miscellaneous Chores

@ethersphere/bee-js v0.12.0

17 Jun 13:22
eb76cfb
Compare
Choose a tag to compare

This is a compatibility release for the Bee 1.0.0-rc2. It also handles extended postage stamp information.

⚠ BREAKING CHANGES

  • use string instead of bigint (#345)

Features

  • add folder and collection size check utility functions (#349) (f289c81)
  • extend PostageBatch type and creation with new properties (#350) (7695e27)

Bug Fixes

Code Refactoring

@ethersphere/bee-js v0.11.0

09 Jun 15:35
430becc
Compare
Choose a tag to compare

This release mainly brings internal improvements as we have attacked head-on our backlog with outstanding issues. But several changes introduce breaking changes so be aware and continue reading on!

🔎 Input validation

We implemented thorough input validation to catch problems even before sending requests to Bee and give better errors on what is wrong.

⚠ BREAKING CHANGES

  • Methods Bee.pin(), Bee.unpin(), Bee.pssSend() now return Promise<void> (#342)
  • Methods Bee.setJsonFeed(), SocWriter.upload(), FeedWriter.upload() now return directly the reference hash (string) instead of it being wrapped in object (#341)
  • The new input validation might require more thorough types specification

Features

Reverts

Code Refactoring

  • no generic BeeResponse returned from Bee class (#342) (d2a65ee)
  • no single-property object returned (#341) (572253c)

@ethersphere/bee-js v0.10.0

01 Jun 10:14
0a6d858
Compare
Choose a tag to compare

We would like to introduce you to a new release that brings access to other new features of 0.6.0 Bee release and several other improvements. This version is compatible with 0.6.2 version of Bee.

⁉️ Improved error reporting

Until now most returned Errors contained very limited information on what actually went wrong as most of the problems originated directly from the Bee node. We improved our internal handling of these errors and now if Bee returns the reason for the error we pass it along with our thrown errors.

⛓ New endpoints

We have included support for the new Bee Debug's endpoints that exposes chain state with BeeDebug.getChainState() (/chainstate) and reserve state BeeDebug.getReserveState() (/reservestate).

♻️ Reupload support

Now you can re-upload content that you have locally pinned in your node to the network with Bee.reuploadPinnedData(). If the data is not pinned, then an error is thrown.

⛽️ Gas prices and limits for transactions

Now you can specify a gas price for methods that create transactions:

  • BeeDebug.cashoutLastCheque()
  • BeeDebug.depositTokens()
  • BeeDebug.withdrawTokens()

⚠ BREAKING CHANGES

  • Promise returning methods from now on never throw errors, but return rejected promise instead (#326)
  • BeeDebug.cashoutLastCheque() now directly returns the transaction hash as string and not object (#325)
  • BeeDebug.depositTokens() now directly returns the transaction hash as string and not object (#336)
  • BeeDebug.withdrawTokens() now directly returns the transaction hash as string and not object (#336)

Features

Bug Fixes

  • correctly return reject promise for promise returning fnc (#326) (d76ef2d)