Skip to content

Commit

Permalink
v0.12
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Le Cam committed Dec 17, 2019
1 parent ec85bb5 commit 45f8ca6
Show file tree
Hide file tree
Showing 24 changed files with 437 additions and 513 deletions.
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
## v0.12.0 (2019-12-17)

### Breaking change

The `Timeline` class has been split between the [`TimelineReader`](https://erebos.js.org/docs/timeline-api#timelinereader-class) and [`TimelineWriter`](https://erebos.js.org/docs/timeline-api#timelinewriter-class) classes. `TimelineWriter` extends `TimelineReader` and therefore can be used as a dropped-in replacement for `Timeline`.

### Additional features

- Support for [raw Swarm feeds](https://erebos.js.org/docs/api-bzz#raw-feeds-methods) has been added thanks to [Attila Gazso's pull request](https://github.com/MainframeHQ/erebos/pull/122).
- `@erebos/api-bzz-browser` can now be used in a Web Worker thanks to [Adam Uhlíř's pull request](https://github.com/MainframeHQ/erebos/pull/128).
- The [`uploadData()`](https://erebos.js.org/docs/api-bzz#uploaddata) and [`downloadData()`](https://erebos.js.org/docs/api-bzz#downloaddata) methods have been added to the [Bzz APIs](https://erebos.js.org/docs/api-bzz).
- The [`Hex.from()`](https://erebos.js.org/docs/hex#hexfrom) static method has been added as a replacement for `createHex()`.

### Other change

HTTP error messages from Swarm are now parsed when possible thanks to [Adam Uhlíř's pull request](https://github.com/MainframeHQ/erebos/pull/129).

### New package

The `@erebos/feed-list` package has been added, implementing [lists data structures](https://erebos.js.org/docs/feed-list) on top of raw Swarm feeds.

## v0.11.0 (2019-11-28)

This release adds support for [Readable streams](https://nodejs.org/api/stream.html#stream_class_stream_readable) in `@erebos/api-bzz-base`, thanks to [Adam Uhlíř's pull request](https://github.com/MainframeHQ/erebos/pull/116).
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,13 @@ npm install -g @erebos/cli
| [`@erebos/swarm-node`](/packages/swarm-node) | [![npm version](https://img.shields.io/npm/v/@erebos/swarm-node.svg)](https://www.npmjs.com/package/@erebos/swarm-node)| ⚛️ ⚙️ | Electron and Node Erebos library for Swarm
| **CLI**
| [`@erebos/cli`](/packages/cli) | [![npm version](https://img.shields.io/npm/v/@erebos/cli.svg)](https://www.npmjs.com/package/@erebos/cli) |
| **Individual APIs**
| **Individual Swarm APIs**
| [`@erebos/api-bzz-browser`](/packages/api-bzz-browser) | [![npm version](https://img.shields.io/npm/v/@erebos/api-bzz-browser.svg)](https://www.npmjs.com/package/@erebos/api-bzz-browser) | 🌐 | Browser-only Swarm (BZZ) APIs
| [`@erebos/api-bzz-node`](/packages/api-bzz-node) | [![npm version](https://img.shields.io/npm/v/@erebos/api-bzz-node.svg)](https://www.npmjs.com/package/@erebos/api-bzz-node) | ⚛️ ⚙️ | Electron and Node Swarm (BZZ) APIs
| [`@erebos/api-bzz-react-native`](/packages/api-bzz-react-native) | [![npm version](https://img.shields.io/npm/v/@erebos/api-bzz-react-native.svg)](https://www.npmjs.com/package/@erebos/api-bzz-react-native) | 📱 | Experimental React Native Swarm (BZZ) APIs
| [`@erebos/api-pss`](/packages/api-pss) | [![npm version](https://img.shields.io/npm/v/@erebos/api-pss.svg)](https://www.npmjs.com/package/@erebos/api-pss) | ⚛️ ⚙️ 📱 🌐 | Postal Services over Swarm (PSS) APIs
| **Higher-level APIs**
| [`@erebos/feed-list`](/packages/feed-list) | [![npm version](https://img.shields.io/npm/v/@erebos/feed-list.svg)](https://www.npmjs.com/package/@erebos/feed-list) | ⚛️ ⚙️ 📱 🌐 | List APIs using raw Swarm feeds
| [`@erebos/timeline`](/packages/timeline) | [![npm version](https://img.shields.io/npm/v/@erebos/timeline.svg)](https://www.npmjs.com/package/@erebos/timeline) | ⚛️ ⚙️ 📱 🌐 | Feed-based Timeline APIs
| **Ethereum and Swarm utilities**
| [`@erebos/hex`](/packages/hex) | [![npm version](https://img.shields.io/npm/v/@erebos/hex.svg)](https://www.npmjs.com/package/@erebos/hex) | ⚛️ ⚙️ 📱 🌐 | Hexadecimal values encoding and decoding
Expand Down
1 change: 1 addition & 0 deletions __tests__/api-bzz-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ describe('api-bzz-base', () => {
expect(setTimeout).toHaveBeenCalledTimes(2)

// Rejects with timeout error
// eslint-disable-next-line @typescript-eslint/no-empty-function
fetch.mockResponseOnce(() => new Promise(() => {})) // Never resolves
const req = bzzTimeout.fetchTimeout('test', {})
expect(setTimeout).toHaveBeenCalledTimes(3)
Expand Down
1 change: 1 addition & 0 deletions __tests__/rpc-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ describe('rpc-handler', () => {
)
expect(() =>
normalizeMethods({
// eslint-disable-next-line @typescript-eslint/no-empty-function
ok: () => {},
objectFails: {
nohandler: true,
Expand Down
22 changes: 22 additions & 0 deletions docs/api-bzz.md
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,17 @@ The `downloadStream()` method returns a NodeJs's compatible [`Readable` instance

**Returns** `Promise<Readable>`

### .downloadData()

Downloads and parses JSON data.

**Arguments**

1. `hashOrDomain: string`: ENS name or Swarm hash
1. [`options?: DownloadOptions = {}`](#downloadoptions)

**Returns** `Promise<any>`

### .downloadObservable()

Returns a [RxJS `Observable`](https://rxjs.dev/api/index/class/Observable) emitting the [`FileEntry`](#fileentry) objects as they are downloaded.
Expand Down Expand Up @@ -596,6 +607,17 @@ Uploads a single file and returns the hash. If the `contentType` option is provi

**Returns** `Promise<string>`

### .uploadData()

Stringifies and uploads JSON data.

**Arguments**

1. `data: any`
1. [`options: UploadOptions = {}`](#uploadoptions)

**Returns** `Promise<string>`

### .uploadDirectory()

Uploads multiple files and returns the hash of the manifest containing these files.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "erebos-project",
"version": "0.11.0",
"version": "0.12.0",
"description": "Swarm client and tools",
"repository": "git@github.com:MainframeHQ/erebos.git",
"license": "MIT",
Expand Down
4 changes: 2 additions & 2 deletions packages/api-bzz-base/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@erebos/api-bzz-base",
"version": "0.11.0",
"version": "0.12.0",
"description": "Base Bzz API",
"repository": "git@github.com:MainframeHQ/erebos.git",
"main": "cjs/index.js",
Expand All @@ -25,7 +25,7 @@
},
"dependencies": {
"@babel/runtime": "^7.7.6",
"@erebos/hex": "^0.11.0",
"@erebos/hex": "^0.12.0",
"@erebos/keccak256": "^0.11.0",
"readable-stream": "^3.1.1",
"rxjs": "^6.5.3",
Expand Down
4 changes: 2 additions & 2 deletions packages/api-bzz-browser/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@erebos/api-bzz-browser",
"version": "0.11.0",
"version": "0.12.0",
"description": "Bzz API for browser",
"repository": "git@github.com:MainframeHQ/erebos.git",
"main": "cjs/index.js",
Expand All @@ -25,7 +25,7 @@
},
"dependencies": {
"@babel/runtime": "^7.7.6",
"@erebos/api-bzz-base": "^0.11.0",
"@erebos/api-bzz-base": "^0.12.0",
"readable-stream": "^3.4.0"
},
"devDependencies": {
Expand Down
6 changes: 3 additions & 3 deletions packages/api-bzz-node/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@erebos/api-bzz-node",
"version": "0.11.0",
"version": "0.12.0",
"description": "Bzz API for node",
"repository": "git@github.com:MainframeHQ/erebos.git",
"main": "lib/index.js",
Expand All @@ -21,7 +21,7 @@
},
"dependencies": {
"@babel/runtime": "^7.7.6",
"@erebos/api-bzz-base": "^0.11.0",
"@erebos/api-bzz-base": "^0.12.0",
"form-data": "^3.0.0",
"fs-extra": "^8.0.1",
"node-fetch": "^2.6.0",
Expand All @@ -30,7 +30,7 @@
},
"devDependencies": {
"@types/fs-extra": "^8.0.1",
"@types/node": "^12.12.17",
"@types/node": "^12.12.18",
"@types/node-fetch": "^2.5.4",
"@types/tar-fs": "^1.16.1",
"@types/tar-stream": "^1.6.1"
Expand Down
4 changes: 2 additions & 2 deletions packages/api-bzz-react-native/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@erebos/api-bzz-react-native",
"version": "0.11.0",
"version": "0.12.0",
"description": "Bzz API for react-native",
"repository": "git@github.com:MainframeHQ/erebos.git",
"main": "cjs/index.js",
Expand All @@ -24,7 +24,7 @@
},
"dependencies": {
"@babel/runtime": "^7.7.6",
"@erebos/api-bzz-base": "^0.11.0",
"@erebos/api-bzz-base": "^0.12.0",
"universal-url": "^2.0.0"
}
}
4 changes: 2 additions & 2 deletions packages/api-pss/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@erebos/api-pss",
"version": "0.11.0",
"version": "0.12.0",
"description": "PSS API",
"repository": "git@github.com:MainframeHQ/erebos.git",
"main": "cjs/index.js",
Expand All @@ -25,7 +25,7 @@
},
"dependencies": {
"@babel/runtime": "^7.7.6",
"@erebos/hex": "^0.11.0",
"@erebos/hex": "^0.12.0",
"@erebos/rpc-stream": "^0.11.0",
"rxjs": "^6.5.3"
}
Expand Down
14 changes: 7 additions & 7 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@erebos/cli",
"version": "0.11.0",
"version": "0.12.0",
"description": "Command-line interface for Swarm",
"repository": "git@github.com:MainframeHQ/erebos.git",
"main": "lib/index.js",
Expand Down Expand Up @@ -51,16 +51,16 @@
},
"dependencies": {
"@babel/runtime": "^7.7.6",
"@erebos/api-bzz-node": "^0.11.0",
"@erebos/api-pss": "^0.11.0",
"@erebos/hex": "^0.11.0",
"@erebos/api-bzz-node": "^0.12.0",
"@erebos/api-pss": "^0.12.0",
"@erebos/hex": "^0.12.0",
"@erebos/keccak256": "^0.11.0",
"@erebos/secp256k1": "^0.10.0",
"@erebos/swarm-node": "^0.11.0",
"@erebos/timeline": "^0.11.0",
"@erebos/swarm-node": "^0.12.0",
"@erebos/timeline": "^0.12.0",
"@oclif/command": "^1.5.19",
"@oclif/config": "^1.13.3",
"@oclif/plugin-help": "^2.2.2",
"@oclif/plugin-help": "^2.2.3",
"fs-extra": "^8.0.1",
"ora": "^4.0.3",
"update-notifier": "^4.0.0"
Expand Down
6 changes: 3 additions & 3 deletions packages/feed-list/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@erebos/feed-list",
"version": "0.11.0",
"version": "0.12.0",
"description": "Feed-based list data structure",
"repository": "git@github.com:MainframeHQ/erebos.git",
"main": "cjs/index.js",
Expand All @@ -25,7 +25,7 @@
},
"dependencies": {
"@babel/runtime": "^7.7.6",
"@erebos/api-bzz-base": "^0.11.0",
"@erebos/hex": "^0.11.0"
"@erebos/api-bzz-base": "^0.12.0",
"@erebos/hex": "^0.12.0"
}
}
2 changes: 1 addition & 1 deletion packages/hex/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@erebos/hex",
"version": "0.11.0",
"version": "0.12.0",
"description": "Hex conversion utilities",
"repository": "git@github.com:MainframeHQ/erebos.git",
"main": "cjs/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/rpc-base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
},
"dependencies": {
"@babel/runtime": "^7.7.6",
"nanoid": "^2.1.7"
"nanoid": "^2.1.8"
},
"devDependencies": {
"@types/nanoid": "^2.1.0"
Expand Down
10 changes: 5 additions & 5 deletions packages/swarm-browser/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@erebos/swarm-browser",
"version": "0.11.0",
"version": "0.12.0",
"description": "Swarm client for browser",
"repository": "git@github.com:MainframeHQ/erebos.git",
"main": "cjs/index.js",
Expand Down Expand Up @@ -30,9 +30,9 @@
},
"dependencies": {
"@babel/runtime": "^7.7.6",
"@erebos/api-bzz-base": "^0.11.0",
"@erebos/api-bzz-browser": "^0.11.0",
"@erebos/api-pss": "^0.11.0",
"@erebos/api-bzz-base": "^0.12.0",
"@erebos/api-bzz-browser": "^0.12.0",
"@erebos/api-pss": "^0.12.0",
"@erebos/client-base": "^0.11.0",
"@erebos/rpc-browser": "^0.11.0",
"@erebos/rpc-stream": "^0.11.0",
Expand All @@ -41,7 +41,7 @@
"devDependencies": {
"babel-loader": "^8.0.5",
"terser-webpack-plugin": "^2.3.0",
"webpack": "^4.40.2",
"webpack": "^4.41.3",
"webpack-cli": "^3.3.8"
}
}
8 changes: 4 additions & 4 deletions packages/swarm-node/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@erebos/swarm-node",
"version": "0.11.0",
"version": "0.12.0",
"description": "Swarm client for node",
"repository": "git@github.com:MainframeHQ/erebos.git",
"main": "lib/index.js",
Expand All @@ -21,9 +21,9 @@
},
"dependencies": {
"@babel/runtime": "^7.7.6",
"@erebos/api-bzz-base": "^0.11.0",
"@erebos/api-bzz-node": "^0.11.0",
"@erebos/api-pss": "^0.11.0",
"@erebos/api-bzz-base": "^0.12.0",
"@erebos/api-bzz-node": "^0.12.0",
"@erebos/api-pss": "^0.12.0",
"@erebos/client-base": "^0.11.0",
"@erebos/rpc-ipc": "^0.11.0",
"@erebos/rpc-node": "^0.11.0",
Expand Down
6 changes: 3 additions & 3 deletions packages/swarm/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@erebos/swarm",
"version": "0.11.0",
"version": "0.12.0",
"description": "Swarm client",
"repository": "git@github.com:MainframeHQ/erebos.git",
"main": "index.js",
Expand All @@ -12,7 +12,7 @@
"browser.js"
],
"dependencies": {
"@erebos/swarm-browser": "^0.11.0",
"@erebos/swarm-node": "^0.11.0"
"@erebos/swarm-browser": "^0.12.0",
"@erebos/swarm-node": "^0.12.0"
}
}
6 changes: 3 additions & 3 deletions packages/timeline/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@erebos/timeline",
"version": "0.11.0",
"version": "0.12.0",
"description": "Linked-list data structure for Swarm feeds",
"repository": "git@github.com:MainframeHQ/erebos.git",
"main": "cjs/index.js",
Expand Down Expand Up @@ -30,15 +30,15 @@
},
"dependencies": {
"@babel/runtime": "^7.7.6",
"@erebos/api-bzz-base": "^0.11.0",
"@erebos/api-bzz-base": "^0.12.0",
"rxjs": "^6.5.3",
"semver": "^6.3.0"
},
"devDependencies": {
"@types/semver": "^6.0.2",
"babel-loader": "^8.0.5",
"terser-webpack-plugin": "^2.3.0",
"webpack": "^4.40.2",
"webpack": "^4.41.3",
"webpack-cli": "^3.3.8"
}
}
6 changes: 3 additions & 3 deletions packages/timeline/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
} from '@erebos/api-bzz-base'
import { Observable, Observer } from 'rxjs'
import { flatMap } from 'rxjs/operators'
import semver from 'semver'
import { satisfies as semverSatisfies, valid as semverValid } from 'semver'

export const PROTOCOL = 'timeline'
export const VERSION = '1.0.0'
Expand Down Expand Up @@ -87,8 +87,8 @@ export function validateChapter<T extends MaybeChapter>(chapter: T): T {
throw new Error('Unsupported protocol')
}
if (
semver.valid(chapter.version) === null ||
!semver.satisfies(chapter.version, VERSION_RANGE)
semverValid(chapter.version) === null ||
!semverSatisfies(chapter.version, VERSION_RANGE)
) {
throw new Error('Unsupported protocol version')
}
Expand Down
Loading

0 comments on commit 45f8ca6

Please sign in to comment.