Skip to content

Commit

Permalink
Publish v0.9
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Le Cam committed Aug 12, 2019
1 parent 54d3067 commit cb5ae3b
Show file tree
Hide file tree
Showing 10 changed files with 972 additions and 956 deletions.
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
## v0.9.0 (unreleased)
## v0.9.0 (2019-08-12)

### Breaking changes

#### TypeScript rewrite

The main change in this release is that the code based has been rewritten in TypeScript. As part of these changes, the library no longer uses ES modules `default` exports but only named exports, such as:
The main change in this release is the code base being rewritten in TypeScript. As part of these changes, the library no longer uses ES modules `default` exports but only named exports, such as:

- `import { Bzz } from '@erebos/api-bzz-node'`
- `import { Pss } from '@erebos/api-pss'`
Expand All @@ -30,7 +30,7 @@ The browser builds (in the `dist` folder) have been renamed from `erebos.develop
- The `sign()` and `verify()` functions exported by the `@erebos/secp256k1` package now accept a `BNInput` input value as exported by the `elliptic` package.
- The `addChapter()` method of the `Timeline` class now calls `createChapter()`, so default values for the chapter will be injected.
- Fixed links to Swarm install & run (by [thecryptofruit](https://github.com/thecryptofruit) in [PR #108](https://github.com/MainframeHQ/erebos/pull/108)).
- The docs have been updated to expose TypeScript interfaces rather than Flow types.
- Docs have been updated to expose TypeScript interfaces rather than Flow types.

## v0.8.1 (2019-06-17)

Expand Down
6 changes: 3 additions & 3 deletions __tests__/api-bzz-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,8 @@ describe('api-bzz-base', () => {
})
})

it('uploadDirectory() rejects an error it must be implemented in extending class', () => {
expect(bzz.uploadDirectory({})).rejects.toThrow(
it('uploadDirectory() rejects an error it must be implemented in extending class', async () => {
await expect(bzz.uploadDirectory({})).rejects.toThrow(
'Must be implemented in extending class',
)
})
Expand Down Expand Up @@ -296,7 +296,7 @@ describe('api-bzz-base', () => {
})

// Upload a directory
expect(bzz.upload({})).rejects.toThrow(
await expect(bzz.upload({})).rejects.toThrow(
'Must be implemented in extending class',
)
})
Expand Down
62 changes: 18 additions & 44 deletions __tests__/api-bzz-node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -487,17 +487,12 @@ describe('api-bzz-node', () => {
expect(text).toBe('hello')
})

it('supports feed chunk polling', async () => {
it('supports feed chunk polling', done => {
jest.setTimeout(40000)

let step = '0-idle'
let expectedValue

let completeTest
const testPromise = new Promise(resolve => {
completeTest = resolve
})

const params = { user, name: uploadContent }
const subscription = bzz
.pollFeedChunk(params, { interval: 2000 })
Expand All @@ -524,17 +519,15 @@ describe('api-bzz-node', () => {
subscription.unsubscribe()
step = '6-unsubscribed'
await sleep(5000)
completeTest()
done()
} else if (step === '6-unsubscribed') {
throw new Error('Event received after unsubscribed')
}
}
})

await testPromise
})

it('supports feed content hash polling', async () => {
it('supports feed content hash polling', done => {
jest.setTimeout(40000)

const params = { user, name: uploadContent }
Expand All @@ -548,11 +541,6 @@ describe('api-bzz-node', () => {
let expectedHash
let previousValue

let completeTest
const testPromise = new Promise(resolve => {
completeTest = resolve
})

const subscription = bzz
.pollFeedContentHash(params, {
interval: 5000,
Expand All @@ -579,15 +567,13 @@ describe('api-bzz-node', () => {
} else if (step === '5-second-value-posted') {
expect(value).toBe(expectedHash)
subscription.unsubscribe()
completeTest()
done()
}
}
})

await testPromise
})

it('supports feed content polling', async () => {
it('supports feed content polling', done => {
jest.setTimeout(40000)

const params = { user, name: uploadContent }
Expand All @@ -600,11 +586,6 @@ describe('api-bzz-node', () => {
let step = '0-idle'
let expectedValue

let completeTest
const testPromise = new Promise(resolve => {
completeTest = resolve
})

const subscription = bzz
.pollFeedContent(params, {
interval: 5000,
Expand Down Expand Up @@ -632,12 +613,10 @@ describe('api-bzz-node', () => {
} else if (step === '5-second-value-posted') {
expect(value).toBe(expectedValue)
subscription.unsubscribe()
completeTest()
done()
}
}
})

await testPromise
})

it('feed polling fails on not found error if the option is enabled', async () => {
Expand All @@ -660,23 +639,18 @@ describe('api-bzz-node', () => {
})
})

it('feed polling accepts an external trigger', async () => {
it('feed polling accepts an external trigger', done => {
const trigger = new Subject()
let subscription

await new Promise(resolve => {
subscription = bzz
.pollFeedChunk(
{ user, name: 'notfound' },
{ interval: 10000, immediate: false, trigger },
)
.subscribe(() => {
resolve()
})
// Test should timeout if the trigger is not executed
trigger.next()
})

subscription.unsubscribe()
const subscription = bzz
.pollFeedChunk(
{ user, name: 'notfound' },
{ interval: 10000, immediate: false, trigger },
)
.subscribe(() => {
subscription.unsubscribe()
done()
})
// Test should timeout if the trigger is not executed
trigger.next()
})
})
4 changes: 3 additions & 1 deletion __tests__/timeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ describe('timeline', () => {
content: { ok: true },
})

expect(timeline.getChapter(invalidID)).rejects.toThrow('Invalid payload')
await expect(timeline.getChapter(invalidID)).rejects.toThrow(
'Invalid payload',
)
})

it('postChapter() method encodes and uploads the chapter', async () => {
Expand Down
10 changes: 4 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,14 @@
"packages/*"
],
"scripts": {
"flow:install": "lerna exec --concurrency 1 -- flow-typed install --ignoreDeps=dev",
"bootstrap": "lerna bootstrap",
"lint": "eslint 'packages/*/src/**.ts' '__tests__/**.ts'",
"lint:fix": "yarn lint --fix",
"test:flow": "flow check",
"test:project": "jest --config jest.config.js",
"test": "jest --config jest.config.js",
"test:all": "yarn lint && yarn test",
"test:ci": "jest --ci --config jest.config.ci.js --runInBand",
"test": "yarn lint && yarn test:project",
"build": "lerna run build && lerna run build:dist",
"start": "yarn test && yarn build"
"build": "lerna run build",
"start": "yarn lint && yarn build && yarn test"
},
"devDependencies": {
"@babel/cli": "^7.5.5",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@erebos/cli",
"version": "0.8.0",
"version": "0.9.0",
"description": "Swarm command-line interface",
"repository": "[email protected]:MainframeHQ/erebos.git",
"main": "lib/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/swarm-browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"build:js": "yarn build:cjs && yarn build:esm && yarn build:dist",
"build:types": "tsc --emitDeclarationOnly -p tsconfig.build.json",
"build": "yarn test:types && yarn clean && yarn build:js && yarn build:types",
"prepublishOnly": "yarn build && yarn build:dist"
"prepublishOnly": "yarn build"
},
"dependencies": {
"@babel/runtime": "^7.5.5",
Expand Down
2 changes: 1 addition & 1 deletion packages/timeline/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"build:js": "yarn build:cjs && yarn build:esm && yarn build:dist",
"build:types": "tsc --emitDeclarationOnly -p tsconfig.build.json",
"build": "yarn test:types && yarn clean && yarn build:js && yarn build:types",
"prepublishOnly": "yarn build && yarn build:dist"
"prepublishOnly": "yarn build"
},
"dependencies": {
"@babel/runtime": "^7.5.5",
Expand Down
Loading

0 comments on commit cb5ae3b

Please sign in to comment.