From ff7d3d4fa60596a7a6d2087f162d33e4a0c12b88 Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" Date: Mon, 19 Jun 2017 17:20:13 +0000 Subject: [PATCH 01/26] chore(package): update webpack to version 3.0.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6d533b1..9d68fd5 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "husky": "^0.13.4", "release-it": "^2.7.3", "rimraf": "^2.5.4", - "webpack": "^2.2.1" + "webpack": "^3.0.0" }, "dependencies": { "browser-resolve": "^1.11.2", From b78e33466fc4242cb99bf400d972003402e5b392 Mon Sep 17 00:00:00 2001 From: tim Date: Wed, 21 Jun 2017 13:17:00 +0200 Subject: [PATCH 02/26] Add codecovfefe --- .eslintignore | 3 +- .gitignore | 3 + .travis.yml | 1 + package.json | 9 +- yarn.lock | 360 +++++++++++++++++++++++++++++++++++++++++++++----- 5 files changed, 339 insertions(+), 37 deletions(-) diff --git a/.eslintignore b/.eslintignore index db4c6d9..007ea8a 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,2 +1,3 @@ dist -node_modules \ No newline at end of file +node_modules +coverage diff --git a/.gitignore b/.gitignore index 55fafa3..71ebeb4 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,6 @@ node_modules dist package-lock.json +coverage +coverage.lcov +.nyc_output diff --git a/.travis.yml b/.travis.yml index 1a817bc..cde552a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,6 +20,7 @@ before_install: -e BIGCHAINDB_DATABASE_HOST=172.17.0.1 bigchaindb/bigchaindb:master start + - npm install -g codecov script: yarn test diff --git a/package.json b/package.json index 43ca2c6..82821a9 100644 --- a/package.json +++ b/package.json @@ -19,12 +19,13 @@ "build:cjs": "cross-env BABEL_ENV=cjs babel ./src -d dist/node", "build:dist": "cross-env NODE_ENV=production webpack -p", "clean": "rimraf dist/bundle dist/node", - "test": "npm run lint && ava", + "test": "npm run lint && nyc ava test/ && npm run report-coverage", "release": "./node_modules/release-it/bin/release.js --src.tagName='v%s' --github.release --npm.publish --non-interactive", "release-minor": "./node_modules/release-it/bin/release.js minor --src.tagName='v%s' --github.release --npm.publish --non-interactive", "release-major": "./node_modules/release-it/bin/release.js major --src.tagName='v%s' --github.release --npm.publish --non-interactive", "prepublishOnly": "npm update && npm run build", - "precommit": "npm run lint" + "precommit": "npm run lint", + "report-coverage": "nyc report --reporter=lcov > coverage.lcov && codecov" }, "devDependencies": { "ava": "^0.19.1", @@ -45,6 +46,7 @@ "eslint-config-ascribe": "^3.0.4", "eslint-plugin-import": "^2.2.0", "husky": "^0.13.4", + "nyc": "^11.0.2", "release-it": "^2.7.3", "rimraf": "^2.5.4", "sinon": "^2.3.4", @@ -66,7 +68,8 @@ "json-stable-stringify": "^1.0.1", "query-string": "^4.3.4", "sprintf-js": "^1.0.3", - "tweetnacl": "^1.0.0" + "tweetnacl": "^1.0.0", + "yarn": "^0.24.5" }, "keywords": [ "bigchaindb", diff --git a/yarn.lock b/yarn.lock index 3856e56..5c3c449 100644 --- a/yarn.lock +++ b/yarn.lock @@ -101,6 +101,10 @@ ansi-escapes@^1.1.0: version "1.4.0" resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-1.4.0.tgz#d3a8a83b319aa67793662b13e761c7911422306e" +ansi-escapes@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-2.0.0.tgz#5bae52be424878dd9783e8910e3fc2922e83c81b" + ansi-regex@^2.0.0: version "2.1.1" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" @@ -505,10 +509,10 @@ babel-helpers@^6.24.1: babel-template "^6.24.1" babel-loader@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/babel-loader/-/babel-loader-7.0.0.tgz#2e43a66bee1fff4470533d0402c8a4532fafbaf7" + version "7.1.0" + resolved "https://registry.yarnpkg.com/babel-loader/-/babel-loader-7.1.0.tgz#3fbf2581f085774bd9642dca9990e6d6c1491144" dependencies: - find-cache-dir "^0.1.1" + find-cache-dir "^1.0.0" loader-utils "^1.0.2" mkdirp "^0.5.1" @@ -877,7 +881,7 @@ babel-register@^6.24.1: mkdirp "^0.5.1" source-map-support "^0.4.2" -babel-runtime@^6.18.0, babel-runtime@^6.22.0, babel-runtime@^6.9.2: +babel-runtime@^6.0.0, babel-runtime@^6.18.0, babel-runtime@^6.22.0, babel-runtime@^6.9.2: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.23.0.tgz#0a9489f144de70efb3ce4300accdb329e2fc543b" dependencies: @@ -953,6 +957,12 @@ bindings@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.2.1.tgz#14ad6113812d2d37d72e67b4cacb4bb726505f11" +bl@^1.0.0: + version "1.2.1" + resolved "https://registry.yarnpkg.com/bl/-/bl-1.2.1.tgz#cac328f7bee45730d404b692203fcb590e172d5e" + dependencies: + readable-stream "^2.0.5" + block-stream@*: version "0.0.9" resolved "https://registry.yarnpkg.com/block-stream/-/block-stream-0.0.9.tgz#13ebfe778a03205cfe03751481ebb4b3300c126a" @@ -964,8 +974,8 @@ bluebird@^3.0.0: resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.5.0.tgz#791420d7f551eea2897453a8a77653f96606d67c" bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.1.1, bn.js@^4.4.0: - version "4.11.6" - resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.6.tgz#53344adb14617a13f6e8dd2ce28905d1c0ba3215" + version "4.11.7" + resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.7.tgz#ddb048e50d9482790094c13eb3fcfc833ce7ab46" boom@2.x.x: version "2.10.1" @@ -1102,6 +1112,10 @@ builtin-status-codes@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz#85982878e21b98e1c66425e03d0174788f569ee8" +bytes@^2.4.0: + version "2.5.0" + resolved "https://registry.yarnpkg.com/bytes/-/bytes-2.5.0.tgz#4c9423ea2d252c270c41b2bdefeff9bb6b62c06a" + caching-transform@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/caching-transform/-/caching-transform-1.0.1.tgz#6dbdb2f20f8d8fbce79f3e94e9d1742dcdf5c0a1" @@ -1204,6 +1218,10 @@ chokidar@^1.4.2, chokidar@^1.4.3, chokidar@^1.6.1: optionalDependencies: fsevents "^1.0.0" +chownr@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.0.1.tgz#e2a75042a9551908bebd25b8523d5f9769d79181" + ci-info@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-1.0.0.tgz#dc5285f2b4e251821683681c381c3388f46ec534" @@ -1277,6 +1295,13 @@ clone@^2.1.0: version "2.1.1" resolved "https://registry.yarnpkg.com/clone/-/clone-2.1.1.tgz#d217d1e961118e3ac9a4b8bba3285553bf647cdb" +cmd-shim@^2.0.1: + version "2.0.2" + resolved "https://registry.yarnpkg.com/cmd-shim/-/cmd-shim-2.0.2.tgz#6fcbda99483a8fd15d7d30a196ca69d688a2efdb" + dependencies: + graceful-fs "^4.1.2" + mkdirp "~0.5.0" + co-with-promise@^4.6.0: version "4.6.0" resolved "https://registry.yarnpkg.com/co-with-promise/-/co-with-promise-4.6.0.tgz#413e7db6f5893a60b942cf492c4bec93db415ab7" @@ -1313,7 +1338,7 @@ combined-stream@^1.0.5, combined-stream@~1.0.5: dependencies: delayed-stream "~1.0.0" -commander@^2.8.1: +commander@^2.8.1, commander@^2.9.0: version "2.9.0" resolved "https://registry.yarnpkg.com/commander/-/commander-2.9.0.tgz#9c99094176e12240cb22d6c5146098400fe0f7d4" dependencies: @@ -1504,6 +1529,10 @@ date-time@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/date-time/-/date-time-0.1.1.tgz#ed2f6d93d9790ce2fd66d5b5ff3edd5bbcbf3b07" +death@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/death/-/death-1.1.0.tgz#01aa9c401edd92750514470b8266390c66c67318" + debug@2, debug@^2.1.1, debug@^2.2.0: version "2.6.8" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.8.tgz#e731531ca2ede27d188222427da17821d68ff4fc" @@ -1573,7 +1602,7 @@ diff-match-patch@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/diff-match-patch/-/diff-match-patch-1.0.0.tgz#1cc3c83a490d67f95d91e39f6ad1f2e086b63048" -diff@^3.0.0, diff@^3.0.1: +diff@^3.0.0, diff@^3.0.1, diff@^3.1.0: version "3.2.0" resolved "https://registry.yarnpkg.com/diff/-/diff-3.2.0.tgz#c9ce393a4b7cbd0b058a725c93df299027868ff9" @@ -1613,6 +1642,15 @@ duplexer3@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/duplexer3/-/duplexer3-0.1.4.tgz#ee01dd1cac0ed3cbc7fdbea37dc0a8f1ce002ce2" +duplexify@^3.1.2, duplexify@^3.5.0: + version "3.5.0" + resolved "https://registry.yarnpkg.com/duplexify/-/duplexify-3.5.0.tgz#1aa773002e1578457e9d9d4a50b0ccaaebcbd604" + dependencies: + end-of-stream "1.0.0" + inherits "^2.0.1" + readable-stream "^2.0.0" + stream-shift "^1.0.0" + ecc-jsbn@~0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz#0fc73a9ed5f0d53c38193398523ef7e543777505" @@ -1655,6 +1693,18 @@ encoding@^0.1.11: dependencies: iconv-lite "~0.4.13" +end-of-stream@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.0.0.tgz#d4596e702734a93e40e9af864319eabd99ff2f0e" + dependencies: + once "~1.3.0" + +end-of-stream@^1.0.0, end-of-stream@^1.1.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.0.tgz#7a90d833efda6cfa6eac0f4949dbb0fad3a63206" + dependencies: + once "^1.4.0" + enhanced-resolve@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-3.1.0.tgz#9f4b626f577245edcf4b2ad83d86e17f4f421dec" @@ -1761,9 +1811,9 @@ eslint-config-airbnb-base@^11.1.0: version "11.2.0" resolved "https://registry.yarnpkg.com/eslint-config-airbnb-base/-/eslint-config-airbnb-base-11.2.0.tgz#19a9dc4481a26f70904545ec040116876018f853" -eslint-config-ascribe@^3.0.1: - version "3.0.3" - resolved "https://registry.yarnpkg.com/eslint-config-ascribe/-/eslint-config-ascribe-3.0.3.tgz#d1f4c2eb5b15b467e8423e109449ca33f3a90825" +eslint-config-ascribe@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/eslint-config-ascribe/-/eslint-config-ascribe-3.0.4.tgz#d60a5ea879698ebe0d6ba252b4e12d6f43902198" dependencies: eslint-config-airbnb-base "^11.1.0" @@ -1870,20 +1920,16 @@ esquery@^1.0.0: estraverse "^4.0.0" esrecurse@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.1.0.tgz#4713b6536adf7f2ac4f327d559e7756bff648220" + version "4.2.0" + resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.2.0.tgz#fa9568d98d3823f9a41d91e902dcab9ea6e5b163" dependencies: - estraverse "~4.1.0" + estraverse "^4.1.0" object-assign "^4.0.1" -estraverse@^4.0.0, estraverse@^4.1.1, estraverse@^4.2.0: +estraverse@^4.0.0, estraverse@^4.1.0, estraverse@^4.1.1, estraverse@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.2.0.tgz#0dee3fed31fcd469618ce7342099fc1afa0bdb13" -estraverse@~4.1.0: - version "4.1.1" - resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.1.1.tgz#f6caca728933a850ef90661d0e17982ba47111a2" - esutils@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" @@ -1948,7 +1994,7 @@ extend@3, extend@~3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.1.tgz#a755ea7bc1adfcc5a31ce7e762dbaadc5e636444" -external-editor@^2.0.1: +external-editor@^2.0.1, external-editor@^2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-2.0.4.tgz#1ed9199da9cbfe2ef2f7a31b2fde8b0d12368972" dependencies: @@ -2024,6 +2070,14 @@ find-cache-dir@^0.1.1: mkdirp "^0.5.1" pkg-dir "^1.0.0" +find-cache-dir@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/find-cache-dir/-/find-cache-dir-1.0.0.tgz#9288e3e9e3cc3748717d39eade17cf71fc30ee6f" + dependencies: + commondir "^1.0.1" + make-dir "^1.0.0" + pkg-dir "^2.0.0" + find-parent-dir@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/find-parent-dir/-/find-parent-dir-0.3.0.tgz#33c44b429ab2b2f0646299c5f9f718f376ff8d54" @@ -2094,6 +2148,12 @@ form-data@~2.1.1: combined-stream "^1.0.5" mime-types "^2.1.12" +formatio@1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/formatio/-/formatio-1.2.0.tgz#f3b2167d9068c4698a8d51f4f760a39a54d818eb" + dependencies: + samsam "1.x" + fs-readdir-recursive@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs-readdir-recursive/-/fs-readdir-recursive-1.0.0.tgz#8cd1745c8b4f8a29c8caec392476921ba195f560" @@ -2275,6 +2335,17 @@ graceful-fs@4.1.11, graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.4, version "1.0.1" resolved "https://registry.yarnpkg.com/graceful-readlink/-/graceful-readlink-1.0.1.tgz#4cafad76bc62f02fa039b2f94e9a3dd3a391a725" +gunzip-maybe@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/gunzip-maybe/-/gunzip-maybe-1.4.0.tgz#7d8316c8d0571e1d08a5a79e46fff0afe8172b19" + dependencies: + browserify-zlib "^0.1.4" + is-deflate "^1.0.0" + is-gzip "^1.0.0" + peek-stream "^1.1.0" + pumpify "^1.3.3" + through2 "^2.0.3" + har-schema@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-1.0.5.tgz#d263135f43307c02c602afc8fe95970c0151369e" @@ -2325,10 +2396,11 @@ hash-base@^2.0.0: inherits "^2.0.1" hash.js@^1.0.0, hash.js@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.0.3.tgz#1332ff00156c0a0ffdd8236013d07b77a0451573" + version "1.1.1" + resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.1.tgz#5cb2e796499224e69fd0b00ed01d2d4a16e7a323" dependencies: - inherits "^2.0.1" + inherits "^2.0.3" + minimalistic-assert "^1.0.0" hawk@~3.1.3: version "3.1.3" @@ -2463,7 +2535,7 @@ inherits@2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.1.tgz#b17d08d326b4423e568eff719f91b0b1cbdf69f1" -ini@~1.3.0: +ini@^1.3.4, ini@~1.3.0: version "1.3.4" resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.4.tgz#0537cb79daf59b59a1a517dff706c86ec039162e" @@ -2503,6 +2575,25 @@ inquirer@^0.12.0: strip-ansi "^3.0.0" through "^2.3.6" +inquirer@^3.0.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-3.1.1.tgz#87621c4fba4072f48a8dd71c9f9df6f100b2d534" + dependencies: + ansi-escapes "^2.0.0" + chalk "^1.0.0" + cli-cursor "^2.1.0" + cli-width "^2.0.0" + external-editor "^2.0.4" + figures "^2.0.0" + lodash "^4.3.0" + mute-stream "0.0.7" + run-async "^2.2.0" + rx-lite "^4.0.8" + rx-lite-aggregates "^4.0.8" + string-width "^2.0.0" + strip-ansi "^3.0.0" + through "^2.3.6" + interpret@^1.0.0: version "1.0.3" resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.0.3.tgz#cbc35c62eeee73f19ab7b10a801511401afc0f90" @@ -2541,12 +2632,16 @@ is-builtin-module@^1.0.0: dependencies: builtin-modules "^1.0.0" -is-ci@^1.0.7, is-ci@^1.0.9: +is-ci@^1.0.10, is-ci@^1.0.7, is-ci@^1.0.9: version "1.0.10" resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-1.0.10.tgz#f739336b2632365061a9d48270cd56ae3369318e" dependencies: ci-info "^1.0.0" +is-deflate@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-deflate/-/is-deflate-1.0.0.tgz#c862901c3c161fb09dac7cdc7e784f80e98f2f14" + is-dotfile@^1.0.0: version "1.0.3" resolved "https://registry.yarnpkg.com/is-dotfile/-/is-dotfile-1.0.3.tgz#a6a2f32ffd2dfb04f5ca25ecd0f6b83cf798a1e1" @@ -2595,6 +2690,10 @@ is-glob@^2.0.0, is-glob@^2.0.1: dependencies: is-extglob "^1.0.0" +is-gzip@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-gzip/-/is-gzip-1.0.0.tgz#6ca8b07b99c77998025900e555ced8ed80879a83" + is-my-json-valid@^2.10.0: version "2.16.0" resolved "https://registry.yarnpkg.com/is-my-json-valid/-/is-my-json-valid-2.16.0.tgz#f079dd9bfdae65ee2038aae8acbc86ab109e3693" @@ -2700,6 +2799,10 @@ is-windows@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.1.tgz#310db70f742d259a16a369202b51af84233310d9" +isarray@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf" + isarray@1.0.0, isarray@^1.0.0, isarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" @@ -3013,6 +3116,10 @@ lodash@4.17.4, lodash@^4.0.0, lodash@^4.14.0, lodash@^4.2.0, lodash@^4.3.0: version "4.17.4" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae" +lolex@^1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/lolex/-/lolex-1.6.0.tgz#3a9a0283452a47d7439e72731b9e07d7386e49f6" + longest@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097" @@ -3191,7 +3298,7 @@ mute-stream@0.0.5: version "0.0.5" resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.5.tgz#8fbfabb0a98a253d3184331f9e8deb7372fac6c0" -mute-stream@0.0.7: +mute-stream@0.0.7, mute-stream@~0.0.4: version "0.0.7" resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" @@ -3199,6 +3306,10 @@ nan@^2.0.9, nan@^2.3.0: version "2.6.2" resolved "https://registry.yarnpkg.com/nan/-/nan-2.6.2.tgz#e4ff34e6c95fdfb5aecc08de6596f43605a7db45" +native-promise-only@^0.8.1: + version "0.8.1" + resolved "https://registry.yarnpkg.com/native-promise-only/-/native-promise-only-0.8.1.tgz#20a318c30cb45f71fe7adfbf7b21c99c1472ef11" + natural-compare@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" @@ -3207,6 +3318,12 @@ netrc@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/netrc/-/netrc-0.1.4.tgz#6be94fcaca8d77ade0a9670dc460914c94472444" +node-emoji@^1.0.4: + version "1.5.1" + resolved "https://registry.yarnpkg.com/node-emoji/-/node-emoji-1.5.1.tgz#fd918e412769bf8c448051238233840b2aff16a1" + dependencies: + string.prototype.codepointat "^0.2.0" + node-fetch@1.5.1: version "1.5.1" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-1.5.1.tgz#edc64350cc0bca48a5f79e038c1f7c5ff0869fef" @@ -3214,7 +3331,14 @@ node-fetch@1.5.1: encoding "^0.1.11" is-stream "^1.0.1" -node-fetch@^1.0.1, node-fetch@~1.6.0: +node-fetch@^1.0.1: + version "1.7.1" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-1.7.1.tgz#899cb3d0a3c92f952c47f1b876f4c8aeabd400d5" + dependencies: + encoding "^0.1.11" + is-stream "^1.0.1" + +node-fetch@~1.6.0: version "1.6.3" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-1.6.3.tgz#dc234edd6489982d58e8f0db4f695029abcd8c04" dependencies: @@ -3322,6 +3446,10 @@ object-assign@^4.0.1, object-assign@^4.1.0: version "4.1.1" resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" +object-path@^0.11.2: + version "0.11.4" + resolved "https://registry.yarnpkg.com/object-path/-/object-path-0.11.4.tgz#370ae752fbf37de3ea70a861c23bba8915691949" + object.omit@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/object.omit/-/object.omit-2.0.1.tgz#1a9c744829f39dbb858c76ca3579ae2a54ebd1fa" @@ -3342,12 +3470,18 @@ oer-utils@^1.2.0: dependencies: core-js "^2.4.1" -once@^1.3.0, once@^1.3.3: +once@^1.3.0, once@^1.3.1, once@^1.3.3, once@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" dependencies: wrappy "1" +once@~1.3.0: + version "1.3.3" + resolved "https://registry.yarnpkg.com/once/-/once-1.3.3.tgz#b2e261557ce4c314ec8304f3fa82663e4297ca20" + dependencies: + wrappy "1" + onetime@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/onetime/-/onetime-1.1.0.tgz#a1f7838f8314c516f05ecefcbc4ccfe04b4ed789" @@ -3517,6 +3651,12 @@ path-key@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" +path-to-regexp@^1.7.0: + version "1.7.0" + resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-1.7.0.tgz#59fde0f435badacba103a84e9d3bc64e96b9937d" + dependencies: + isarray "0.0.1" + path-type@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/path-type/-/path-type-1.1.0.tgz#59c44f7ee491da704da415da5a4070ba4f8fe441" @@ -3541,6 +3681,13 @@ pbkdf2@^3.0.3: safe-buffer "^5.0.1" sha.js "^2.4.8" +peek-stream@^1.1.0: + version "1.1.2" + resolved "https://registry.yarnpkg.com/peek-stream/-/peek-stream-1.1.2.tgz#97eb76365bcfd8c89e287f55c8b69d4c3e9bcc52" + dependencies: + duplexify "^3.5.0" + through2 "^2.0.3" + performance-now@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-0.2.0.tgz#33ef30c5c77d4ea21c5a53869d91b56d8f2555e5" @@ -3650,6 +3797,13 @@ progress@^1.1.8: version "1.1.8" resolved "https://registry.yarnpkg.com/progress/-/progress-1.1.8.tgz#e260c78f6161cdd9b0e56cc3e0a85de17c7a57be" +proper-lockfile@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/proper-lockfile/-/proper-lockfile-2.0.1.tgz#159fb06193d32003f4b3691dd2ec1a634aa80d1d" + dependencies: + graceful-fs "^4.1.2" + retry "^0.10.0" + prr@~0.0.0: version "0.0.0" resolved "https://registry.yarnpkg.com/prr/-/prr-0.0.0.tgz#1a84b85908325501411853d0081ee3fa86e2926a" @@ -3668,6 +3822,21 @@ public-encrypt@^4.0.0: parse-asn1 "^5.0.0" randombytes "^2.0.1" +pump@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/pump/-/pump-1.0.2.tgz#3b3ee6512f94f0e575538c17995f9f16990a5d51" + dependencies: + end-of-stream "^1.1.0" + once "^1.3.1" + +pumpify@^1.3.3: + version "1.3.5" + resolved "https://registry.yarnpkg.com/pumpify/-/pumpify-1.3.5.tgz#1b671c619940abcaeac0ad0e3a3c164be760993b" + dependencies: + duplexify "^3.1.2" + inherits "^2.0.1" + pump "^1.0.0" + punycode@1.3.2: version "1.3.2" resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.3.2.tgz#9653a036fb7c1ee42342f2325cceefea3926c48d" @@ -3747,7 +3916,13 @@ read-pkg@^2.0.0: normalize-package-data "^2.3.2" path-type "^2.0.0" -readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.5, readable-stream@^2.0.6, readable-stream@^2.1.4, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@^2.2.6: +read@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/read/-/read-1.0.7.tgz#b3da19bd052431a97671d44a42634adf710b40c4" + dependencies: + mute-stream "~0.0.4" + +readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.5, readable-stream@^2.0.6, readable-stream@^2.1.4, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@^2.2.6: version "2.3.0" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.0.tgz#640f5dcda88c91a8dc60787145629170813a1ed2" dependencies: @@ -3884,6 +4059,10 @@ repeating@^2.0.0: dependencies: is-finite "^1.0.0" +request-capture-har@^1.2.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/request-capture-har/-/request-capture-har-1.2.2.tgz#cd692cfb2cc744fd84a3358aac6ee51528cf720d" + request@^2.81.0: version "2.81.0" resolved "https://registry.yarnpkg.com/request/-/request-2.81.0.tgz#c6928946a0e06c5f8d6f8a9333469ffda46298a0" @@ -3966,13 +4145,17 @@ restore-cursor@^2.0.0: onetime "^2.0.0" signal-exit "^3.0.2" +retry@^0.10.0: + version "0.10.1" + resolved "https://registry.yarnpkg.com/retry/-/retry-0.10.1.tgz#e76388d217992c252750241d3d3956fed98d8ff4" + right-align@^0.1.1: version "0.1.3" resolved "https://registry.yarnpkg.com/right-align/-/right-align-0.1.3.tgz#61339b722fe6a3515689210d24e14c96148613ef" dependencies: align-text "^0.1.1" -rimraf@2, rimraf@^2.2.8, rimraf@^2.5.1, rimraf@^2.5.4, rimraf@^2.6.1: +rimraf@2, rimraf@^2.2.8, rimraf@^2.5.0, rimraf@^2.5.1, rimraf@^2.5.4, rimraf@^2.6.1: version "2.6.1" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.1.tgz#c2338ec643df7a1b7fe5c54fa86f57428a55f33d" dependencies: @@ -3997,6 +4180,16 @@ run-async@^2.2.0: dependencies: is-promise "^2.1.0" +rx-lite-aggregates@^4.0.8: + version "4.0.8" + resolved "https://registry.yarnpkg.com/rx-lite-aggregates/-/rx-lite-aggregates-4.0.8.tgz#753b87a89a11c95467c4ac1626c4efc4e05c67be" + dependencies: + rx-lite "*" + +rx-lite@*, rx-lite@^4.0.8: + version "4.0.8" + resolved "https://registry.yarnpkg.com/rx-lite/-/rx-lite-4.0.8.tgz#0b1e11af8bc44836f04a6407e92da42467b79444" + rx-lite@^3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/rx-lite/-/rx-lite-3.1.2.tgz#19ce502ca572665f3b647b10939f97fd1615f102" @@ -4013,6 +4206,10 @@ safe-buffer@~5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.0.1.tgz#d263ca54696cd8a306b5ca6551e92de57918fbe7" +samsam@1.x, samsam@^1.1.3: + version "1.2.1" + resolved "https://registry.yarnpkg.com/samsam/-/samsam-1.2.1.tgz#edd39093a3184370cb859243b2bdf255e7d8ea67" + semver-diff@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/semver-diff/-/semver-diff-2.1.0.tgz#4bbb8437c8d37e4b0cf1a68fd726ec6d645d6d36" @@ -4059,7 +4256,7 @@ shebang-regex@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" -shelljs@0.7.7, shelljs@^0.7.5: +shelljs@0.7.7: version "0.7.7" resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.7.7.tgz#b2f5c77ef97148f4b4f6e22682e10bba8667cff1" dependencies: @@ -4067,10 +4264,31 @@ shelljs@0.7.7, shelljs@^0.7.5: interpret "^1.0.0" rechoir "^0.6.2" +shelljs@^0.7.5: + version "0.7.8" + resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.7.8.tgz#decbcf874b0d1e5fb72e14b164a9683048e9acb3" + dependencies: + glob "^7.0.0" + interpret "^1.0.0" + rechoir "^0.6.2" + signal-exit@^3.0.0, signal-exit@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" +sinon@^2.3.4: + version "2.3.5" + resolved "https://registry.yarnpkg.com/sinon/-/sinon-2.3.5.tgz#9a2fc0ff8d526da716f30953aa2c65d518917f6c" + dependencies: + diff "^3.1.0" + formatio "1.2.0" + lolex "^1.6.0" + native-promise-only "^0.8.1" + path-to-regexp "^1.7.0" + samsam "^1.1.3" + text-encoding "0.6.4" + type-detect "^4.0.0" + slash@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/slash/-/slash-1.0.0.tgz#c41f2f6c39fc16d1cd17ad4b5d896114ae470d55" @@ -4174,6 +4392,10 @@ stream-http@^2.3.1: to-arraybuffer "^1.0.0" xtend "^4.0.0" +stream-shift@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/stream-shift/-/stream-shift-1.0.0.tgz#d5c752825e5367e786f78e18e445ea223a155952" + strict-uri-encode@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz#279b225df1d582b1f54e65addd4352e18faa0713" @@ -4193,6 +4415,10 @@ string-width@^2.0.0: is-fullwidth-code-point "^2.0.0" strip-ansi "^3.0.0" +string.prototype.codepointat@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/string.prototype.codepointat/-/string.prototype.codepointat-0.2.0.tgz#6b26e9bd3afcaa7be3b4269b526de1b82000ac78" + string_decoder@^0.10.25: version "0.10.31" resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-0.10.31.tgz#62e203bc41766c6c28c9fc84301dab1c5310fa94" @@ -4280,6 +4506,15 @@ tapable@^0.2.5, tapable@~0.2.5: version "0.2.6" resolved "https://registry.yarnpkg.com/tapable/-/tapable-0.2.6.tgz#206be8e188860b514425375e6f1ae89bfb01fd8d" +tar-fs@^1.15.1: + version "1.15.3" + resolved "https://registry.yarnpkg.com/tar-fs/-/tar-fs-1.15.3.tgz#eccf935e941493d8151028e636e51ce4c3ca7f20" + dependencies: + chownr "^1.0.1" + mkdirp "^0.5.1" + pump "^1.0.0" + tar-stream "^1.1.2" + tar-pack@^3.4.0: version "3.4.0" resolved "https://registry.yarnpkg.com/tar-pack/-/tar-pack-3.4.0.tgz#23be2d7f671a8339376cbdb0b8fe3fdebf317984" @@ -4293,6 +4528,15 @@ tar-pack@^3.4.0: tar "^2.2.1" uid-number "^0.0.6" +tar-stream@^1.1.2, tar-stream@^1.5.2: + version "1.5.4" + resolved "https://registry.yarnpkg.com/tar-stream/-/tar-stream-1.5.4.tgz#36549cf04ed1aee9b2a30c0143252238daf94016" + dependencies: + bl "^1.0.0" + end-of-stream "^1.0.0" + readable-stream "^2.0.0" + xtend "^4.0.0" + tar@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/tar/-/tar-2.2.1.tgz#8e4d2a256c0e2185c6b18ad694aec968b83cb1d1" @@ -4307,11 +4551,15 @@ term-size@^0.1.0: dependencies: execa "^0.4.0" +text-encoding@0.6.4: + version "0.6.4" + resolved "https://registry.yarnpkg.com/text-encoding/-/text-encoding-0.6.4.tgz#e399a982257a276dae428bb92845cb71bdc26d19" + text-table@^0.2.0, text-table@~0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" -through2@^2.0.0: +through2@^2.0.0, through2@^2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/through2/-/through2-2.0.3.tgz#0004569b37c7c74ba39c43f3ced78d1ad94140be" dependencies: @@ -4397,6 +4645,10 @@ type-check@~0.3.2: dependencies: prelude-ls "~1.1.2" +type-detect@^4.0.0: + version "4.0.3" + resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.3.tgz#0e3f2670b44099b0b46c284d136a7ef49c74c2ea" + typedarray@^0.0.6: version "0.0.6" resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" @@ -4486,10 +4738,14 @@ util@0.10.3, util@^0.10.3: dependencies: inherits "2.0.1" -uuid@^3.0.0: +uuid@^3.0.0, uuid@^3.0.1: version "3.1.0" resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.1.0.tgz#3dd3d3e790abc24d7b0d3a034ffababe28ebbc04" +v8-compile-cache@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-1.1.0.tgz#1dc2a340fb8e5f800a32bcdbfb8c23cd747021b9" + v8flags@^2.0.10: version "2.1.1" resolved "https://registry.yarnpkg.com/v8flags/-/v8flags-2.1.1.tgz#aab1a1fa30d45f88dd321148875ac02c0b55e5b4" @@ -4697,3 +4953,41 @@ yargs@~3.10.0: cliui "^2.1.0" decamelize "^1.0.0" window-size "0.1.0" + +yarn@^0.24.5: + version "0.24.6" + resolved "https://registry.yarnpkg.com/yarn/-/yarn-0.24.6.tgz#4a128448000425f45df5cd6280b003a6201044fc" + dependencies: + babel-runtime "^6.0.0" + bytes "^2.4.0" + camelcase "^4.0.0" + chalk "^1.1.1" + cmd-shim "^2.0.1" + commander "^2.9.0" + death "^1.0.0" + debug "^2.2.0" + detect-indent "^5.0.0" + gunzip-maybe "^1.4.0" + ini "^1.3.4" + inquirer "^3.0.1" + invariant "^2.2.0" + is-builtin-module "^1.0.0" + is-ci "^1.0.10" + leven "^2.0.0" + loud-rejection "^1.2.0" + minimatch "^3.0.3" + mkdirp "^0.5.1" + node-emoji "^1.0.4" + object-path "^0.11.2" + proper-lockfile "^2.0.0" + read "^1.0.7" + request "^2.81.0" + request-capture-har "^1.2.2" + rimraf "^2.5.0" + semver "^5.1.0" + strip-bom "^3.0.0" + tar-fs "^1.15.1" + tar-stream "^1.5.2" + uuid "^3.0.1" + v8-compile-cache "^1.1.0" + validate-npm-package-license "^3.0.1" From 2fa28d7fd1ae1ea066ec3747ea1b290b66aa7706 Mon Sep 17 00:00:00 2001 From: tim Date: Wed, 21 Jun 2017 13:22:25 +0200 Subject: [PATCH 03/26] Add coverage badge --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 3e57c68..e945922 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ > Official JavaScript driver for [BigchainDB](https://github.com/bigchaindb/bigchaindb) with some naive helpers to get you on your way making transactions in Node.js and the browser. [![npm](https://img.shields.io/npm/v/bigchaindb-driver.svg)](https://www.npmjs.com/package/bigchaindb-driver) +[![codecov](https://codecov.io/gh/bigchaindb/js-bigchaindb-driver/branch/master/graph/badge.svg)](https://codecov.io/gh/bigchaindb/js-bigchaindb-driver) [![js ascribe](https://img.shields.io/badge/js-ascribe-39BA91.svg)](https://github.com/ascribe/javascript) [![Build Status](https://travis-ci.org/bigchaindb/js-bigchaindb-driver.svg?branch=master)](https://travis-ci.org/bigchaindb/js-bigchaindb-driver) [![Greenkeeper badge](https://badges.greenkeeper.io/bigchaindb/js-bigchaindb-driver.svg)](https://greenkeeper.io/) From af49ec1c7a521bc95cf7fea589219a24e1019390 Mon Sep 17 00:00:00 2001 From: tim Date: Mon, 19 Jun 2017 14:40:22 +0200 Subject: [PATCH 04/26] Adjust HTTP API endpoints and test --- src/connection/index.js | 44 ++++++++------- test/connection/test_connection.js | 90 ++++++++++++++++++++++++++++++ 2 files changed, 113 insertions(+), 21 deletions(-) create mode 100644 test/connection/test_connection.js diff --git a/src/connection/index.js b/src/connection/index.js index 26a241d..7248e4a 100644 --- a/src/connection/index.js +++ b/src/connection/index.js @@ -9,15 +9,15 @@ export default class Connection { getApiUrls(endpoints) { // TODO: Use camel case - return { - 'blocks': `${this.path}blocks`, - 'blocks_detail': `${this.path}blocks/%(blockId)s`, - 'outputs': `${this.path}outputs`, - 'statuses': `${this.path}statuses`, - 'transactions': `${this.path}transactions`, - 'transactions_detail': `${this.path}transactions/%(txId)s`, - 'search_assets': `${this.path}assets`, - 'votes': `${this.path}votes` + return this.path + { + 'blocks': 'blocks', + 'blocks_detail': 'blocks/%(blockId)s', + 'outputs': 'outputs', + 'statuses': 'statuses', + 'transactions': 'transactions', + 'transactions_detail': 'transactions/%(transactionId)s', + 'search_assets': 'assets', + 'votes': 'votes' }[endpoints] } @@ -41,37 +41,37 @@ export default class Connection { /** * @public - * @param tx_id + * @param transactionId */ - getStatus(tx_id) { // eslint-disable-line camelcase + getStatus(transactionId) { return this._req(this.getApiUrls('statuses'), { query: { - tx_id + transaction_id: transactionId } }) } /** * @public - * @param txId + * @param transactionId */ - getTransaction(txId) { + getTransaction(transactionId) { return this._req(this.getApiUrls('transactions_detail'), { urlTemplateSpec: { - txId + transaction_id: transactionId } }) } /** * @public - * @param tx_id + * @param transactionId * @param status */ - listBlocks({ tx_id, status }) { + listBlocks({ transactionId, status }) { return this._req(this.getApiUrls('blocks'), { query: { - tx_id, + transaction_id: transactionId, status } }) @@ -83,6 +83,7 @@ export default class Connection { * @param unspent * @param onlyJsonResponse */ + // TODO: Use camel case for parameters listOutputs({ public_key, unspent }, onlyJsonResponse = true) { return this._req(this.getApiUrls('outputs'), { query: { @@ -97,6 +98,7 @@ export default class Connection { * @param asset_id * @param operation */ + // TODO: Use camel case for parameters listTransactions({ asset_id, operation }) { return this._req(this.getApiUrls('transactions'), { query: { @@ -108,12 +110,12 @@ export default class Connection { /** * @public - * @param block_id + * @param blockId */ - listVotes(block_id) { // eslint-disable-line camelcase + listVotes(blockId) { return this._req(this.getApiUrls('votes'), { query: { - block_id + block_id: blockId } }) } diff --git a/test/connection/test_connection.js b/test/connection/test_connection.js new file mode 100644 index 0000000..301515a --- /dev/null +++ b/test/connection/test_connection.js @@ -0,0 +1,90 @@ +import test from 'ava' +import sinon from 'sinon' +import { Connection } from '../../src' + +const API_PATH = 'http://localhost:9984/api/v1/' +const conn = new Connection(API_PATH) + + +test('generate API URLS', t => { + const endpoints = { + 'blocks': 'blocks', + 'blocks_detail': 'blocks/%(blockId)s', + 'outputs': 'outputs', + 'statuses': 'statuses', + 'transactions': 'transactions', + 'transactions_detail': 'transactions/%(transactionId)s', + 'search_assets': 'assets', + } + Object.keys(endpoints).forEach((endpointName) => { + const url = conn.getApiUrls(endpointName) + const expected = API_PATH + endpoints[endpointName] + t.is(url, expected) + }) +}) + + +test('Get status for a transaction', t => { + const expectedPath = 'path' + const transactionId = 'abc' + + conn._req = sinon.spy() + conn.getApiUrls = sinon.stub().returns(expectedPath) + + conn.getStatus(transactionId) + t.truthy(conn._req.calledWith( + expectedPath, + { query: { transaction_id: transactionId } } + )) +}) + + +test('Get transaction for a transaction id', t => { + const expectedPath = 'path' + const transactionId = 'abc' + + conn._req = sinon.spy() + conn.getApiUrls = sinon.stub().returns(expectedPath) + + conn.getTransaction(transactionId) + t.truthy(conn._req.calledWith( + expectedPath, + { urlTemplateSpec: { transaction_id: transactionId } } + )) +}) + + +test('Get list of blocks for a transaction id', t => { + const expectedPath = 'path' + const transactionId = 'abc' + const status = 'status' + + conn._req = sinon.spy() + conn.getApiUrls = sinon.stub().returns(expectedPath) + + conn.listBlocks({ transactionId, status }) + t.truthy(conn._req.calledWith( + expectedPath, + { + query: { + transaction_id: transactionId, + status + } + } + )) +}) + + +test('Get votes for a block id', t => { + const expectedPath = 'path' + const blockId = 'abc' + + conn._req = sinon.spy() + conn.getApiUrls = sinon.stub().returns(expectedPath) + + conn.listVotes(blockId) + t.truthy(conn._req.calledWith( + expectedPath, + { query: { block_id: blockId } } + )) +}) From d4ea4d6ccd8d4fc5e9ae38a790eece4bbe9e53ca Mon Sep 17 00:00:00 2001 From: tim Date: Mon, 19 Jun 2017 14:56:00 +0200 Subject: [PATCH 05/26] CamelCase for path keys --- src/connection/index.js | 17 +++++++------ test/connection/test_connection.js | 38 ++++++++++++++++++++++++++---- test/test.js | 30 ----------------------- 3 files changed, 42 insertions(+), 43 deletions(-) delete mode 100644 test/test.js diff --git a/src/connection/index.js b/src/connection/index.js index 7248e4a..068bf88 100644 --- a/src/connection/index.js +++ b/src/connection/index.js @@ -8,15 +8,14 @@ export default class Connection { } getApiUrls(endpoints) { - // TODO: Use camel case return this.path + { 'blocks': 'blocks', - 'blocks_detail': 'blocks/%(blockId)s', + 'blocksDetail': 'blocks/%(blockId)s', 'outputs': 'outputs', 'statuses': 'statuses', 'transactions': 'transactions', - 'transactions_detail': 'transactions/%(transactionId)s', - 'search_assets': 'assets', + 'transactionsDetail': 'transactions/%(transactionId)s', + 'searchAssets': 'assets', 'votes': 'votes' }[endpoints] } @@ -32,7 +31,7 @@ export default class Connection { * @param blockId */ getBlock(blockId) { - return this._req(this.getApiUrls('blocks_detail'), { + return this._req(this.getApiUrls('blocksDetail'), { urlTemplateSpec: { blockId } @@ -56,9 +55,9 @@ export default class Connection { * @param transactionId */ getTransaction(transactionId) { - return this._req(this.getApiUrls('transactions_detail'), { + return this._req(this.getApiUrls('transactionsDetail'), { urlTemplateSpec: { - transaction_id: transactionId + transactionId } }) } @@ -164,10 +163,10 @@ export default class Connection { /** * @public * - * @param transaction + * @param query */ searchAssets(query) { - return this.req(this.getApiUrls('search_assets'), { + return this._req(this.getApiUrls('searchAssets'), { query: { text_search: query } diff --git a/test/connection/test_connection.js b/test/connection/test_connection.js index 301515a..3cc7bf2 100644 --- a/test/connection/test_connection.js +++ b/test/connection/test_connection.js @@ -9,12 +9,12 @@ const conn = new Connection(API_PATH) test('generate API URLS', t => { const endpoints = { 'blocks': 'blocks', - 'blocks_detail': 'blocks/%(blockId)s', + 'blocksDetail': 'blocks/%(blockId)s', 'outputs': 'outputs', 'statuses': 'statuses', 'transactions': 'transactions', - 'transactions_detail': 'transactions/%(transactionId)s', - 'search_assets': 'assets', + 'transactionsDetail': 'transactions/%(transactionId)s', + 'searchAssets': 'assets', } Object.keys(endpoints).forEach((endpointName) => { const url = conn.getApiUrls(endpointName) @@ -24,6 +24,21 @@ test('generate API URLS', t => { }) +test('Get block for a block id', t => { + const expectedPath = 'path' + const blockId = 'abc' + + conn._req = sinon.spy() + conn.getApiUrls = sinon.stub().returns(expectedPath) + + conn.getBlock(blockId) + t.truthy(conn._req.calledWith( + expectedPath, + { urlTemplateSpec: { blockId } } + )) +}) + + test('Get status for a transaction', t => { const expectedPath = 'path' const transactionId = 'abc' @@ -49,7 +64,7 @@ test('Get transaction for a transaction id', t => { conn.getTransaction(transactionId) t.truthy(conn._req.calledWith( expectedPath, - { urlTemplateSpec: { transaction_id: transactionId } } + { urlTemplateSpec: { transactionId } } )) }) @@ -88,3 +103,18 @@ test('Get votes for a block id', t => { { query: { block_id: blockId } } )) }) + + +test('Get asset for a text', t => { + const expectedPath = 'path' + const query = 'abc' + + conn._req = sinon.spy() + conn.getApiUrls = sinon.stub().returns(expectedPath) + + conn.searchAssets(query) + t.truthy(conn._req.calledWith( + expectedPath, + { query: { text_search: query } } + )) +}) diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 5a1e216..0000000 --- a/test/test.js +++ /dev/null @@ -1,30 +0,0 @@ -import test from 'ava' -import { Ed25519Keypair, Transaction, Connection } from '../src' - -const API_PATH = 'http://localhost:9984/api/v1/' - -test('Keypair is created', t => { - const keyPair = new Ed25519Keypair() - - t.truthy(keyPair.publicKey) - t.truthy(keyPair.privateKey) -}) - -test('Valid CREATE transaction is evaluated by BigchainDB', t => { - const alice = new Ed25519Keypair() - const asset = { name: 'Shmui', type: 'cat' } - const metadata = { dayOfTheWeek: 'Caturday' } - - const tx = Transaction.makeCreateTransaction( - asset, - metadata, - [Transaction.makeOutput(Transaction.makeEd25519Condition(alice.publicKey))], - alice.publicKey - ) - - const txSigned = Transaction.signTransaction(tx, alice.privateKey) - const conn = new Connection(API_PATH) - return conn.postTransaction(txSigned) - .then(resTx => t.truthy(resTx)) -}) - From d8cb13ba91ca5b99b644f0c004d37ce16ac15614 Mon Sep 17 00:00:00 2001 From: tim Date: Mon, 19 Jun 2017 16:30:00 +0200 Subject: [PATCH 06/26] Test Connection._req --- test/connection/test_connection.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/test/connection/test_connection.js b/test/connection/test_connection.js index 3cc7bf2..fafa883 100644 --- a/test/connection/test_connection.js +++ b/test/connection/test_connection.js @@ -1,5 +1,6 @@ import test from 'ava' import sinon from 'sinon' +import * as request from '../../src/request' // eslint-disable-line import { Connection } from '../../src' const API_PATH = 'http://localhost:9984/api/v1/' @@ -24,6 +25,24 @@ test('generate API URLS', t => { }) +test('Request with custom headers', t => { + const testConn = new Connection(API_PATH, { hello: 'world' }) + const expectedOptions = { + headers: { + hello: 'world', + custom: 'headers' + } + } + + // request is read only, cannot be mocked? + sinon.spy(request, 'default') + testConn._req(API_PATH, { headers: { custom: 'headers' } }) + + t.truthy(request.default.calledWith(API_PATH, expectedOptions)) + request.default.restore() +}) + + test('Get block for a block id', t => { const expectedPath = 'path' const blockId = 'abc' From 9bc0773b4ed2274b7a2c930987a78da5868497b1 Mon Sep 17 00:00:00 2001 From: tim Date: Mon, 19 Jun 2017 17:50:09 +0200 Subject: [PATCH 07/26] Add constants.js --- test/constants.js | 32 ++++++++++++++++++++++++++++ test/transaction/test_transaction.js | 22 ++++++------------- 2 files changed, 38 insertions(+), 16 deletions(-) create mode 100644 test/constants.js diff --git a/test/constants.js b/test/constants.js new file mode 100644 index 0000000..47cf12f --- /dev/null +++ b/test/constants.js @@ -0,0 +1,32 @@ +import test from 'ava' +import { Transaction, Ed25519Keypair } from '../src' +// TODO: Find out if ava has something like conftest, if so put this there. + +// TODO: We're adding `Math.random()` here to never create the same transaction +// twice. +export const assetMessage = { assetMessage: Math.random() } +export const metaDataMessage = { metaDataMessage: 'metaDataMessage' } + +export const alice = new Ed25519Keypair() +export const aliceCondition = Transaction.makeEd25519Condition(alice.publicKey) +export const aliceOutput = Transaction.makeOutput(aliceCondition) +export const createTx = Transaction.makeCreateTransaction( + assetMessage, + metaDataMessage, + [aliceOutput], + alice.publicKey +) +export const transferTx = Transaction.makeTransferTransaction( + createTx, + metaDataMessage, + [aliceOutput], + 0 +) + +export const bob = new Ed25519Keypair() +export const bobCondition = Transaction.makeEd25519Condition(bob.publicKey) +export const bobOutput = Transaction.makeOutput(bobCondition) + + +// TODO: https://github.com/avajs/ava/issues/1190 +test('', () => 'dirty hack. TODO: Exclude this file from being run by ava') diff --git a/test/transaction/test_transaction.js b/test/transaction/test_transaction.js index 6ef3f6d..5584658 100644 --- a/test/transaction/test_transaction.js +++ b/test/transaction/test_transaction.js @@ -5,25 +5,15 @@ import { Transaction, Ed25519Keypair } from '../../src' import * as makeTransaction from '../../src/transaction/makeTransaction' // eslint-disable-line import makeInputTemplate from '../../src/transaction/makeInputTemplate' - -// TODO: Find out if ava has something like conftest, if so put this there. -const alice = new Ed25519Keypair() -const aliceCondition = Transaction.makeEd25519Condition(alice.publicKey) -const aliceOutput = Transaction.makeOutput(aliceCondition) -const assetMessage = { assetMessage: 'assetMessage' } -const metaDataMessage = { metaDataMessage: 'metaDataMessage' } -const createTx = Transaction.makeCreateTransaction( +import { + alice, + aliceCondition, + aliceOutput, assetMessage, metaDataMessage, - [aliceOutput], - alice.publicKey -) -const transferTx = Transaction.makeTransferTransaction( createTx, - metaDataMessage, - [aliceOutput], - 0 -) + transferTx +} from '../constants' test('Create valid output with default amount', t => { From 03c17ef70cb5e1546a9f6b3628834acc4a0a60c0 Mon Sep 17 00:00:00 2001 From: tim Date: Mon, 19 Jun 2017 17:50:34 +0200 Subject: [PATCH 08/26] Add integration tests --- src/connection/index.js | 2 - test/integration/test_integration.js | 110 +++++++++++++++++++++++++++ 2 files changed, 110 insertions(+), 2 deletions(-) create mode 100644 test/integration/test_integration.js diff --git a/src/connection/index.js b/src/connection/index.js index 068bf88..c1e3efd 100644 --- a/src/connection/index.js +++ b/src/connection/index.js @@ -129,12 +129,10 @@ export default class Connection { const timer = setInterval(() => { this.getStatus(txId) .then((res) => { - console.log('Fetched transaction status:', res) // eslint-disable-line no-console if (res.status === 'valid') { clearInterval(timer) this.getTransaction(txId) .then((res_) => { - console.log('Fetched transaction:', res_) // eslint-disable-line no-console resolve(res_) }) } diff --git a/test/integration/test_integration.js b/test/integration/test_integration.js new file mode 100644 index 0000000..50992dc --- /dev/null +++ b/test/integration/test_integration.js @@ -0,0 +1,110 @@ +import test from 'ava' +import { Ed25519Keypair, Transaction, Connection } from '../../src' + +import { + alice, + aliceCondition, + aliceOutput, + bob, + bobOutput, + assetMessage, + metaDataMessage +} from '../constants' + +const API_PATH = 'http://localhost:9984/api/v1/' + + +test('Keypair is created', t => { + const keyPair = new Ed25519Keypair() + + t.truthy(keyPair.publicKey) + t.truthy(keyPair.privateKey) +}) + + +// TODO: The following tests are a bit messy currently, please do: +// +// - tidy up dependency on `pollStatusAndFetchTransaction` +test('Valid CREATE transaction', t => { + const conn = new Connection(API_PATH) + + const tx = Transaction.makeCreateTransaction( + assetMessage, + metaDataMessage, + [aliceOutput], + alice.publicKey + ) + + const txSigned = Transaction.signTransaction(tx, alice.privateKey) + return conn.postTransaction(txSigned) + .then(({ 'id': txId }) => conn.pollStatusAndFetchTransaction(txId)) + .then(resTx => t.truthy(resTx)) +}) + + +test('Valid TRANSFER transaction with single Ed25519 input', t => { + const conn = new Connection(API_PATH) + const createTx = Transaction.makeCreateTransaction( + assetMessage, + metaDataMessage, + [aliceOutput], + alice.publicKey + ) + const createTxSigned = Transaction.signTransaction( + createTx, + alice.privateKey + ) + + return conn.postTransaction(createTxSigned) + .then(({ 'id': txId }) => conn.pollStatusAndFetchTransaction(txId)) + .then(() => { + const transferTx = Transaction.makeTransferTransaction( + createTxSigned, + metaDataMessage, + [aliceOutput], + 0 + ) + const transferTxSigned = Transaction.signTransaction( + transferTx, + alice.privateKey + ) + return conn.postTransaction(transferTxSigned) + .then(({ id }) => conn.pollStatusAndFetchTransaction(id)) + .then(resTx => t.truthy(resTx)) + }) +}) + + +test('Valid TRANSFER transaction with multiple Ed25519 inputs', t => { + const conn = new Connection(API_PATH) + const createTx = Transaction.makeCreateTransaction( + assetMessage, + metaDataMessage, + [aliceOutput, bobOutput], + alice.publicKey + ) + const createTxSigned = Transaction.signTransaction( + createTx, + alice.privateKey + ) + + return conn.postTransaction(createTxSigned) + .then(({ 'id': txId }) => conn.pollStatusAndFetchTransaction(txId)) + .then(() => { + const transferTx = Transaction.makeTransferTransaction( + createTxSigned, + metaDataMessage, + [Transaction.makeOutput(aliceCondition, '2')], + 0, + 1 + ) + const transferTxSigned = Transaction.signTransaction( + transferTx, + alice.privateKey, + bob.privateKey + ) + return conn.postTransaction(transferTxSigned) + .then(({ id }) => conn.pollStatusAndFetchTransaction(id)) + .then(resTx => t.truthy(resTx)) + }) +}) From 44896b98dcc77c7c9d329ae6879cf43bb770d8dc Mon Sep 17 00:00:00 2001 From: tim Date: Mon, 19 Jun 2017 18:15:12 +0200 Subject: [PATCH 09/26] serializeTransactionIntoCanonicalString line length --- src/transaction/serializeTransactionIntoCanonicalString.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/transaction/serializeTransactionIntoCanonicalString.js b/src/transaction/serializeTransactionIntoCanonicalString.js index 786cecf..382ed32 100644 --- a/src/transaction/serializeTransactionIntoCanonicalString.js +++ b/src/transaction/serializeTransactionIntoCanonicalString.js @@ -9,7 +9,8 @@ import clone from 'clone' * @return {string} a canonically serialized Transaction */ export default function serializeTransactionIntoCanonicalString(transaction) { - // BigchainDB signs fulfillments by serializing transactions into a "canonical" format where + // BigchainDB signs fulfillments by serializing transactions into a + // "canonical" format where const tx = clone(transaction) // TODO: set fulfillments to null // Sort the keys From 3fdaf406022228f1910915b38339770c3c52dee1 Mon Sep 17 00:00:00 2001 From: tim Date: Tue, 20 Jun 2017 11:03:19 +0200 Subject: [PATCH 10/26] Comply to eslint :gun: --- test/connection/test_connection.js | 1 + test/integration/test_integration.js | 4 ++-- test/transaction/test_transaction.js | 2 -- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/test/connection/test_connection.js b/test/connection/test_connection.js index fafa883..0d79c01 100644 --- a/test/connection/test_connection.js +++ b/test/connection/test_connection.js @@ -1,5 +1,6 @@ import test from 'ava' import sinon from 'sinon' + import * as request from '../../src/request' // eslint-disable-line import { Connection } from '../../src' diff --git a/test/integration/test_integration.js b/test/integration/test_integration.js index 50992dc..8eb43ca 100644 --- a/test/integration/test_integration.js +++ b/test/integration/test_integration.js @@ -71,7 +71,7 @@ test('Valid TRANSFER transaction with single Ed25519 input', t => { return conn.postTransaction(transferTxSigned) .then(({ id }) => conn.pollStatusAndFetchTransaction(id)) .then(resTx => t.truthy(resTx)) - }) + }) }) @@ -106,5 +106,5 @@ test('Valid TRANSFER transaction with multiple Ed25519 inputs', t => { return conn.postTransaction(transferTxSigned) .then(({ id }) => conn.pollStatusAndFetchTransaction(id)) .then(resTx => t.truthy(resTx)) - }) + }) }) diff --git a/test/transaction/test_transaction.js b/test/transaction/test_transaction.js index 5584658..3e4f854 100644 --- a/test/transaction/test_transaction.js +++ b/test/transaction/test_transaction.js @@ -7,9 +7,7 @@ import makeInputTemplate from '../../src/transaction/makeInputTemplate' import { alice, - aliceCondition, aliceOutput, - assetMessage, metaDataMessage, createTx, transferTx From db10937f9e58090a482264fa1e9c435d3289e51c Mon Sep 17 00:00:00 2001 From: tim Date: Tue, 20 Jun 2017 16:17:43 +0200 Subject: [PATCH 11/26] Add integration test for asset endpoint :diamond: --- src/connection/index.js | 10 +++--- test/connection/test_connection.js | 10 +++--- test/constants.js | 14 ++++---- test/integration/test_integration.js | 50 ++++++++++++++++++++-------- test/transaction/test_transaction.js | 12 +++---- 5 files changed, 60 insertions(+), 36 deletions(-) diff --git a/src/connection/index.js b/src/connection/index.js index c1e3efd..80702de 100644 --- a/src/connection/index.js +++ b/src/connection/index.js @@ -15,7 +15,7 @@ export default class Connection { 'statuses': 'statuses', 'transactions': 'transactions', 'transactionsDetail': 'transactions/%(transactionId)s', - 'searchAssets': 'assets', + 'assets': 'assets', 'votes': 'votes' }[endpoints] } @@ -161,12 +161,12 @@ export default class Connection { /** * @public * - * @param query + * @param search */ - searchAssets(query) { - return this._req(this.getApiUrls('searchAssets'), { + searchAssets(search) { + return this._req(this.getApiUrls('assets'), { query: { - text_search: query + search } }) } diff --git a/test/connection/test_connection.js b/test/connection/test_connection.js index 0d79c01..4ccbb41 100644 --- a/test/connection/test_connection.js +++ b/test/connection/test_connection.js @@ -16,7 +16,7 @@ test('generate API URLS', t => { 'statuses': 'statuses', 'transactions': 'transactions', 'transactionsDetail': 'transactions/%(transactionId)s', - 'searchAssets': 'assets', + 'assets': 'assets', } Object.keys(endpoints).forEach((endpointName) => { const url = conn.getApiUrls(endpointName) @@ -125,16 +125,16 @@ test('Get votes for a block id', t => { }) -test('Get asset for a text', t => { +test('Get asset for text', t => { const expectedPath = 'path' - const query = 'abc' + const search = 'abc' conn._req = sinon.spy() conn.getApiUrls = sinon.stub().returns(expectedPath) - conn.searchAssets(query) + conn.searchAssets(search) t.truthy(conn._req.calledWith( expectedPath, - { query: { text_search: query } } + { query: { search } } )) }) diff --git a/test/constants.js b/test/constants.js index 47cf12f..d67d66f 100644 --- a/test/constants.js +++ b/test/constants.js @@ -2,23 +2,23 @@ import test from 'ava' import { Transaction, Ed25519Keypair } from '../src' // TODO: Find out if ava has something like conftest, if so put this there. -// TODO: We're adding `Math.random()` here to never create the same transaction -// twice. -export const assetMessage = { assetMessage: Math.random() } -export const metaDataMessage = { metaDataMessage: 'metaDataMessage' } +// NOTE: We cast `Math.random()` to a string, as sometimes Javascript simply +// yields a slightly different float during runtime, lol +export function asset() { return { message: `${Math.random()}` } } +export const metaData = { message: 'metaDataMessage' } export const alice = new Ed25519Keypair() export const aliceCondition = Transaction.makeEd25519Condition(alice.publicKey) export const aliceOutput = Transaction.makeOutput(aliceCondition) export const createTx = Transaction.makeCreateTransaction( - assetMessage, - metaDataMessage, + asset, + metaData, [aliceOutput], alice.publicKey ) export const transferTx = Transaction.makeTransferTransaction( createTx, - metaDataMessage, + metaData, [aliceOutput], 0 ) diff --git a/test/integration/test_integration.js b/test/integration/test_integration.js index 8eb43ca..1f38853 100644 --- a/test/integration/test_integration.js +++ b/test/integration/test_integration.js @@ -7,8 +7,8 @@ import { aliceOutput, bob, bobOutput, - assetMessage, - metaDataMessage + asset, + metaData } from '../constants' const API_PATH = 'http://localhost:9984/api/v1/' @@ -29,15 +29,15 @@ test('Valid CREATE transaction', t => { const conn = new Connection(API_PATH) const tx = Transaction.makeCreateTransaction( - assetMessage, - metaDataMessage, + asset(), + metaData, [aliceOutput], alice.publicKey ) - const txSigned = Transaction.signTransaction(tx, alice.privateKey) + return conn.postTransaction(txSigned) - .then(({ 'id': txId }) => conn.pollStatusAndFetchTransaction(txId)) + .then(({ id }) => conn.pollStatusAndFetchTransaction(id)) .then(resTx => t.truthy(resTx)) }) @@ -45,8 +45,8 @@ test('Valid CREATE transaction', t => { test('Valid TRANSFER transaction with single Ed25519 input', t => { const conn = new Connection(API_PATH) const createTx = Transaction.makeCreateTransaction( - assetMessage, - metaDataMessage, + asset(), + metaData, [aliceOutput], alice.publicKey ) @@ -56,11 +56,11 @@ test('Valid TRANSFER transaction with single Ed25519 input', t => { ) return conn.postTransaction(createTxSigned) - .then(({ 'id': txId }) => conn.pollStatusAndFetchTransaction(txId)) + .then(({ id }) => conn.pollStatusAndFetchTransaction(id)) .then(() => { const transferTx = Transaction.makeTransferTransaction( createTxSigned, - metaDataMessage, + metaData, [aliceOutput], 0 ) @@ -78,8 +78,8 @@ test('Valid TRANSFER transaction with single Ed25519 input', t => { test('Valid TRANSFER transaction with multiple Ed25519 inputs', t => { const conn = new Connection(API_PATH) const createTx = Transaction.makeCreateTransaction( - assetMessage, - metaDataMessage, + asset(), + metaData, [aliceOutput, bobOutput], alice.publicKey ) @@ -93,7 +93,7 @@ test('Valid TRANSFER transaction with multiple Ed25519 inputs', t => { .then(() => { const transferTx = Transaction.makeTransferTransaction( createTxSigned, - metaDataMessage, + metaData, [Transaction.makeOutput(aliceCondition, '2')], 0, 1 @@ -108,3 +108,27 @@ test('Valid TRANSFER transaction with multiple Ed25519 inputs', t => { .then(resTx => t.truthy(resTx)) }) }) + + +test('Search for an asset', t => { + const conn = new Connection(API_PATH) + + const createTx = Transaction.makeCreateTransaction( + asset(), + metaData, + [aliceOutput], + alice.publicKey + ) + const createTxSigned = Transaction.signTransaction( + createTx, + alice.privateKey + ) + + return conn.postTransaction(createTxSigned) + .then(({ id }) => conn.pollStatusAndFetchTransaction(id)) + .then(() => conn.searchAssets(createTxSigned.asset.data.message)) + .then(assets => t.truthy( + assets.pop(), + createTxSigned.asset.data.message + )) +}) diff --git a/test/transaction/test_transaction.js b/test/transaction/test_transaction.js index 3e4f854..1df642f 100644 --- a/test/transaction/test_transaction.js +++ b/test/transaction/test_transaction.js @@ -1,14 +1,14 @@ import test from 'ava' import sinon from 'sinon' -import { Transaction, Ed25519Keypair } from '../../src' +import { Transaction } from '../../src' import * as makeTransaction from '../../src/transaction/makeTransaction' // eslint-disable-line import makeInputTemplate from '../../src/transaction/makeInputTemplate' import { alice, aliceOutput, - metaDataMessage, + metaData, createTx, transferTx } from '../constants' @@ -72,14 +72,14 @@ test('Create TRANSFER transaction based on CREATE transaction', t => { Transaction.makeTransferTransaction( createTx, - metaDataMessage, + metaData, [aliceOutput], 0 ) const expected = [ 'TRANSFER', { id: createTx.id }, - metaDataMessage, + metaData, [aliceOutput], [makeInputTemplate( [alice.publicKey], @@ -100,14 +100,14 @@ test('Create TRANSFER transaction based on TRANSFER transaction', t => { Transaction.makeTransferTransaction( transferTx, - metaDataMessage, + metaData, [aliceOutput], 0 ) const expected = [ 'TRANSFER', { id: transferTx.asset.id }, - metaDataMessage, + metaData, [aliceOutput], [makeInputTemplate( [alice.publicKey], From 8bd602f446172010029930b0f2493735a8d01b98 Mon Sep 17 00:00:00 2001 From: tim Date: Tue, 20 Jun 2017 17:46:25 +0200 Subject: [PATCH 12/26] Fix and test outputs endpoint --- src/connection/index.js | 20 ++-- test/connection/test_connection.js | 47 +++++++++ test/integration/test_integration.js | 137 +++++++++++++++++++++++++++ 3 files changed, 196 insertions(+), 8 deletions(-) diff --git a/src/connection/index.js b/src/connection/index.js index 80702de..59be9a4 100644 --- a/src/connection/index.js +++ b/src/connection/index.js @@ -78,17 +78,21 @@ export default class Connection { /** * @public - * @param public_key - * @param unspent + * @param publicKey + * @param spent * @param onlyJsonResponse */ - // TODO: Use camel case for parameters - listOutputs({ public_key, unspent }, onlyJsonResponse = true) { + listOutputs(publicKey, spent, onlyJsonResponse = true) { + const query = { + public_key: publicKey + } + // NOTE: If `spent` is not defined, it must not be included in the + // query parameters. + if (spent !== undefined) { + query.spent = spent + } return this._req(this.getApiUrls('outputs'), { - query: { - public_key, - unspent - } + query }, onlyJsonResponse) } diff --git a/test/connection/test_connection.js b/test/connection/test_connection.js index 4ccbb41..8a8979e 100644 --- a/test/connection/test_connection.js +++ b/test/connection/test_connection.js @@ -110,6 +110,53 @@ test('Get list of blocks for a transaction id', t => { }) +test('Get outputs for a public key and no spent flag', t => { + const expectedPath = 'path' + const publicKey = 'publicKey' + + conn._req = sinon.spy() + conn.getApiUrls = sinon.stub().returns(expectedPath) + + conn.listOutputs(publicKey) + t.truthy(conn._req.calledWith( + expectedPath, + { query: { public_key: publicKey } } + )) +}) + + +test('Get outputs for a public key and spent=false', t => { + const expectedPath = 'path' + const publicKey = 'publicKey' + const spent = false + + conn._req = sinon.spy() + conn.getApiUrls = sinon.stub().returns(expectedPath) + + conn.listOutputs(publicKey, spent) + t.truthy(conn._req.calledWith( + expectedPath, + { query: { public_key: publicKey, spent } } + )) +}) + + +test('Get outputs for a public key and spent=true', t => { + const expectedPath = 'path' + const publicKey = 'publicKey' + const spent = true + + conn._req = sinon.spy() + conn.getApiUrls = sinon.stub().returns(expectedPath) + + conn.listOutputs(publicKey, spent) + t.truthy(conn._req.calledWith( + expectedPath, + { query: { public_key: publicKey, spent } } + )) +}) + + test('Get votes for a block id', t => { const expectedPath = 'path' const blockId = 'abc' diff --git a/test/integration/test_integration.js b/test/integration/test_integration.js index 1f38853..8d38b70 100644 --- a/test/integration/test_integration.js +++ b/test/integration/test_integration.js @@ -110,6 +110,143 @@ test('Valid TRANSFER transaction with multiple Ed25519 inputs', t => { }) +test('Search for spent and unspent outputs of a given public key', t => { + const conn = new Connection(API_PATH) + + const createTx = Transaction.makeCreateTransaction( + asset(), + metaData, + [aliceOutput, aliceOutput], + alice.publicKey + ) + const createTxSigned = Transaction.signTransaction( + createTx, + alice.privateKey, + alice.privateKey + ) + + // We spent output 1 (of 0, 1) + const transferTx = Transaction.makeTransferTransaction( + createTxSigned, + metaData, + [bobOutput], + 1 + ) + const transferTxSigned = Transaction.signTransaction( + transferTx, + alice.privateKey, + ) + + function byTransactionId(transactionId, ...outputIndices) { + return value => transactionId === value.transaction_id && + outputIndices.includes(value.output) + } + + return conn.postTransaction(createTxSigned) + .then(({ id }) => conn.pollStatusAndFetchTransaction(id)) + .then(() => conn.postTransaction(transferTxSigned)) + .then(({ id }) => conn.pollStatusAndFetchTransaction(id)) + .then(() => conn.listOutputs(alice.publicKey)) + // now listOutputs should return us outputs 0 and 1 (unfiltered) + .then(outputs => outputs.filter(byTransactionId( + createTxSigned.id, + 0, + 1 + ))) + .then(outputs => t.truthy(outputs.length === 2)) +}) + + +test('Search for unspent outputs for a given public key', t => { + const conn = new Connection(API_PATH) + + const createTx = Transaction.makeCreateTransaction( + asset(), + metaData, + [aliceOutput, aliceOutput, aliceOutput], + alice.publicKey + ) + const createTxSigned = Transaction.signTransaction( + createTx, + alice.privateKey, + alice.privateKey + ) + + // We spent output 1 (of 0, 1, 2) + const transferTx = Transaction.makeTransferTransaction( + createTxSigned, + metaData, + [bobOutput], + 1 + ) + const transferTxSigned = Transaction.signTransaction( + transferTx, + alice.privateKey, + ) + + function byTransactionId(transactionId, ...outputIndices) { + return value => transactionId === value.transaction_id && + outputIndices.includes(value.output) + } + + return conn.postTransaction(createTxSigned) + .then(({ id }) => conn.pollStatusAndFetchTransaction(id)) + .then(() => conn.postTransaction(transferTxSigned)) + .then(({ id }) => conn.pollStatusAndFetchTransaction(id)) + // now listOutputs should return us outputs 0 and 2 (1 is spent) + .then(() => conn.listOutputs(alice.publicKey, false)) + .then(outputs => outputs.filter(byTransactionId( + createTxSigned.id, + 0, + 2 + ))) + .then(outputs => t.truthy(outputs.length === 2)) +}) + + +test('Search for spent outputs for a given public key', t => { + const conn = new Connection(API_PATH) + + const createTx = Transaction.makeCreateTransaction( + asset(), + metaData, + [aliceOutput, aliceOutput, aliceOutput], + alice.publicKey + ) + const createTxSigned = Transaction.signTransaction( + createTx, + alice.privateKey, + alice.privateKey + ) + + // We spent output 1 (of 0, 1, 2) + const transferTx = Transaction.makeTransferTransaction( + createTxSigned, + metaData, + [bobOutput], + 1 + ) + const transferTxSigned = Transaction.signTransaction( + transferTx, + alice.privateKey, + ) + + function byTransactionId(transactionId, ...outputIndices) { + return value => transactionId === value.transaction_id && + outputIndices.includes(value.output) + } + + return conn.postTransaction(createTxSigned) + .then(({ id }) => conn.pollStatusAndFetchTransaction(id)) + .then(() => conn.postTransaction(transferTxSigned)) + .then(({ id }) => conn.pollStatusAndFetchTransaction(id)) + // now listOutputs should only return us output 1 (0 and 2 are unspent) + .then(() => conn.listOutputs(alice.publicKey, true)) + .then(outputs => outputs.filter(byTransactionId(createTxSigned.id, 1))) + .then(outputs => t.truthy(outputs.length === 1)) +}) + + test('Search for an asset', t => { const conn = new Connection(API_PATH) From 3671c5758c327e5e0c8ecc0809ff74548daf7600 Mon Sep 17 00:00:00 2001 From: tim Date: Wed, 21 Jun 2017 11:00:51 +0200 Subject: [PATCH 13/26] Test list blocks for a transaction id --- src/connection/index.js | 2 +- test/connection/test_connection.js | 2 +- test/integration/test_integration.js | 25 +++++++++++++++++++++++++ 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/connection/index.js b/src/connection/index.js index 59be9a4..64afc6a 100644 --- a/src/connection/index.js +++ b/src/connection/index.js @@ -67,7 +67,7 @@ export default class Connection { * @param transactionId * @param status */ - listBlocks({ transactionId, status }) { + listBlocks(transactionId, status) { return this._req(this.getApiUrls('blocks'), { query: { transaction_id: transactionId, diff --git a/test/connection/test_connection.js b/test/connection/test_connection.js index 8a8979e..6b90186 100644 --- a/test/connection/test_connection.js +++ b/test/connection/test_connection.js @@ -97,7 +97,7 @@ test('Get list of blocks for a transaction id', t => { conn._req = sinon.spy() conn.getApiUrls = sinon.stub().returns(expectedPath) - conn.listBlocks({ transactionId, status }) + conn.listBlocks(transactionId, status) t.truthy(conn._req.calledWith( expectedPath, { diff --git a/test/integration/test_integration.js b/test/integration/test_integration.js index 8d38b70..7199722 100644 --- a/test/integration/test_integration.js +++ b/test/integration/test_integration.js @@ -269,3 +269,28 @@ test('Search for an asset', t => { createTxSigned.asset.data.message )) }) + + +test('Search blocks containing a transaction', t => { + const conn = new Connection(API_PATH) + + const createTx = Transaction.makeCreateTransaction( + asset(), + metaData, + [aliceOutput], + alice.publicKey + ) + const createTxSigned = Transaction.signTransaction( + createTx, + alice.privateKey + ) + + return conn.postTransaction(createTxSigned) + .then(({ id }) => conn.pollStatusAndFetchTransaction(id)) + .then(({ id }) => conn.listBlocks(id, 'VALID')) + .then(blocks => conn.getBlock(blocks.pop())) + .then(({ block: { transactions } }) => transactions.filter( + ({ id }) => id === createTxSigned.id + )) + .then(transactions => t.truthy(transactions.length === 1)) +}) From 1696f7c1ac3827e8caca4f1efcafcce7abd9d836 Mon Sep 17 00:00:00 2001 From: tim Date: Wed, 21 Jun 2017 11:01:28 +0200 Subject: [PATCH 14/26] Test list transaction for an asset id --- src/connection/index.js | 7 +++---- test/connection/test_connection.js | 23 ++++++++++++++++++++++- test/integration/test_integration.js | 21 +++++++++++++++++++++ 3 files changed, 46 insertions(+), 5 deletions(-) diff --git a/src/connection/index.js b/src/connection/index.js index 64afc6a..a4dafc6 100644 --- a/src/connection/index.js +++ b/src/connection/index.js @@ -98,14 +98,13 @@ export default class Connection { /** * @public - * @param asset_id + * @param assetId * @param operation */ - // TODO: Use camel case for parameters - listTransactions({ asset_id, operation }) { + listTransactions(assetId, operation) { return this._req(this.getApiUrls('transactions'), { query: { - asset_id, + asset_id: assetId, operation } }) diff --git a/test/connection/test_connection.js b/test/connection/test_connection.js index 6b90186..af398c5 100644 --- a/test/connection/test_connection.js +++ b/test/connection/test_connection.js @@ -59,7 +59,7 @@ test('Get block for a block id', t => { }) -test('Get status for a transaction', t => { +test('Get status for a transaction id', t => { const expectedPath = 'path' const transactionId = 'abc' @@ -110,6 +110,27 @@ test('Get list of blocks for a transaction id', t => { }) +test('Get list of transactions for an asset id', t => { + const expectedPath = 'path' + const assetId = 'abc' + const operation = 'operation' + + conn._req = sinon.spy() + conn.getApiUrls = sinon.stub().returns(expectedPath) + + conn.listTransactions(assetId, operation) + t.truthy(conn._req.calledWith( + expectedPath, + { + query: { + asset_id: assetId, + operation + } + } + )) +}) + + test('Get outputs for a public key and no spent flag', t => { const expectedPath = 'path' const publicKey = 'publicKey' diff --git a/test/integration/test_integration.js b/test/integration/test_integration.js index 7199722..5b1d184 100644 --- a/test/integration/test_integration.js +++ b/test/integration/test_integration.js @@ -294,3 +294,24 @@ test('Search blocks containing a transaction', t => { )) .then(transactions => t.truthy(transactions.length === 1)) }) + + +test('Search transaction containing an asset', t => { + const conn = new Connection(API_PATH) + + const createTx = Transaction.makeCreateTransaction( + asset(), + metaData, + [aliceOutput], + alice.publicKey + ) + const createTxSigned = Transaction.signTransaction( + createTx, + alice.privateKey + ) + + return conn.postTransaction(createTxSigned) + .then(({ id }) => conn.pollStatusAndFetchTransaction(id, 'CREATE')) + .then(({ id }) => conn.listTransactions(id)) + .then(transactions => t.truthy(transactions.length === 1)) +}) From b883e1f6d9484734d3595d089c2ca852492e5644 Mon Sep 17 00:00:00 2001 From: tim Date: Wed, 21 Jun 2017 11:17:59 +0200 Subject: [PATCH 15/26] endpoints => endpoint --- src/connection/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/connection/index.js b/src/connection/index.js index a4dafc6..48d9a67 100644 --- a/src/connection/index.js +++ b/src/connection/index.js @@ -7,7 +7,7 @@ export default class Connection { this.headers = headers } - getApiUrls(endpoints) { + getApiUrls(endpoint) { return this.path + { 'blocks': 'blocks', 'blocksDetail': 'blocks/%(blockId)s', @@ -17,7 +17,7 @@ export default class Connection { 'transactionsDetail': 'transactions/%(transactionId)s', 'assets': 'assets', 'votes': 'votes' - }[endpoints] + }[endpoint] } _req(path, options = {}) { From 0c6098fce75c2d6344f395b3b12c266066e85ee9 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Tue, 20 Jun 2017 15:44:07 +0200 Subject: [PATCH 16/26] run precommit eslint on staged files only * closes #42 --- package.json | 6 +- yarn.lock | 191 ++++++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 188 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 82821a9..017df51 100644 --- a/package.json +++ b/package.json @@ -24,9 +24,12 @@ "release-minor": "./node_modules/release-it/bin/release.js minor --src.tagName='v%s' --github.release --npm.publish --non-interactive", "release-major": "./node_modules/release-it/bin/release.js major --src.tagName='v%s' --github.release --npm.publish --non-interactive", "prepublishOnly": "npm update && npm run build", - "precommit": "npm run lint", + "precommit": "lint-staged", "report-coverage": "nyc report --reporter=lcov > coverage.lcov && codecov" }, + "lint-staged": { + "*.js": ["npm run lint"] + }, "devDependencies": { "ava": "^0.19.1", "babel-cli": "^6.22.2", @@ -46,6 +49,7 @@ "eslint-config-ascribe": "^3.0.4", "eslint-plugin-import": "^2.2.0", "husky": "^0.13.4", + "lint-staged": "^4.0.0", "nyc": "^11.0.2", "release-it": "^2.7.3", "rimraf": "^2.5.4", diff --git a/yarn.lock b/yarn.lock index 5c3c449..4b9bf86 100644 --- a/yarn.lock +++ b/yarn.lock @@ -97,7 +97,7 @@ ansi-align@^2.0.0: dependencies: string-width "^2.0.0" -ansi-escapes@^1.1.0: +ansi-escapes@^1.0.0, ansi-escapes@^1.1.0: version "1.4.0" resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-1.4.0.tgz#d3a8a83b319aa67793662b13e761c7911422306e" @@ -130,6 +130,10 @@ anymatch@^1.3.0: arrify "^1.0.0" micromatch "^2.1.5" +app-root-path@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/app-root-path/-/app-root-path-2.0.1.tgz#cd62dcf8e4fd5a417efc664d2e5b10653c651b46" + aproba@^1.0.3: version "1.1.2" resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.1.2.tgz#45c6629094de4e96f693ef7eab74ae079c240fc1" @@ -1248,7 +1252,7 @@ cli-boxes@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/cli-boxes/-/cli-boxes-1.0.0.tgz#4fa917c3e59c94a004cd61f8ee509da651687143" -cli-cursor@^1.0.1: +cli-cursor@^1.0.1, cli-cursor@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-1.0.2.tgz#64da3f7d56a54412e59794bd62dc35295e8f2987" dependencies: @@ -1260,10 +1264,21 @@ cli-cursor@^2.1.0: dependencies: restore-cursor "^2.0.0" +cli-spinners@^0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/cli-spinners/-/cli-spinners-0.1.2.tgz#bb764d88e185fb9e1e6a2a1f19772318f605e31c" + cli-spinners@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/cli-spinners/-/cli-spinners-1.0.0.tgz#ef987ed3d48391ac3dab9180b406a742180d6e6a" +cli-truncate@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/cli-truncate/-/cli-truncate-0.2.1.tgz#9f15cfbb0705005369216c626ac7d05ab90dd574" + dependencies: + slice-ansi "0.0.4" + string-width "^1.0.1" + cli-truncate@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/cli-truncate/-/cli-truncate-1.0.0.tgz#21eb91f47b3f6560f004db77a769b4668d9c5518" @@ -1416,6 +1431,19 @@ core-util-is@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" +cosmiconfig@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-1.1.0.tgz#0dea0f9804efdfb929fbb1b188e25553ea053d37" + dependencies: + graceful-fs "^4.1.2" + js-yaml "^3.4.3" + minimist "^1.2.0" + object-assign "^4.0.1" + os-homedir "^1.0.1" + parse-json "^2.2.0" + pinkie-promise "^2.0.0" + require-from-string "^1.1.0" + create-ecdh@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/create-ecdh/-/create-ecdh-4.0.0.tgz#888c723596cdf7612f6498233eebd7a35301737d" @@ -1470,7 +1498,7 @@ cross-spawn@^4.0.0: lru-cache "^4.0.1" which "^1.2.9" -cross-spawn@^5.1.0: +cross-spawn@^5.0.1, cross-spawn@^5.1.0: version "5.1.0" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449" dependencies: @@ -1521,6 +1549,10 @@ dashdash@^1.12.0: dependencies: assert-plus "^1.0.0" +date-fns@^1.27.2: + version "1.28.5" + resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-1.28.5.tgz#257cfc45d322df45ef5658665967ee841cd73faf" + date-now@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/date-now/-/date-now-0.1.4.tgz#eaf439fd4d4848ad74e5cc7dbef200672b9e345b" @@ -1664,6 +1696,10 @@ ed25519@0.0.4: bindings "^1.2.1" nan "^2.0.9" +elegant-spinner@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/elegant-spinner/-/elegant-spinner-1.0.1.tgz#db043521c95d7e303fd8f345bedc3349cfb0729e" + elliptic@^6.0.0: version "6.4.0" resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.4.0.tgz#cac9af8762c85836187003c8dfe193e5e2eae5df" @@ -1930,6 +1966,10 @@ estraverse@^4.0.0, estraverse@^4.1.0, estraverse@^4.1.1, estraverse@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.2.0.tgz#0dee3fed31fcd469618ce7342099fc1afa0bdb13" +estraverse@~4.1.0: + version "4.1.1" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.1.1.tgz#f6caca728933a850ef90661d0e17982ba47111a2" + esutils@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" @@ -1974,6 +2014,18 @@ execa@^0.5.0: signal-exit "^3.0.0" strip-eof "^1.0.0" +execa@^0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/execa/-/execa-0.7.0.tgz#944becd34cc41ee32a63a9faf27ad5a65fc59777" + dependencies: + cross-spawn "^5.0.1" + get-stream "^3.0.0" + is-stream "^1.1.0" + npm-run-path "^2.0.0" + p-finally "^1.0.0" + signal-exit "^3.0.0" + strip-eof "^1.0.0" + exit-hook@^1.0.0: version "1.1.1" resolved "https://registry.yarnpkg.com/exit-hook/-/exit-hook-1.1.1.tgz#f05ca233b48c05d54fff07765df8507e95c02ff8" @@ -2028,7 +2080,7 @@ fetch-ponyfill@^4.0.0: dependencies: node-fetch "~1.6.0" -figures@^1.3.5: +figures@^1.3.5, figures@^1.7.0: version "1.7.0" resolved "https://registry.yarnpkg.com/figures/-/figures-1.7.0.tgz#cbe1e3affcf1cd44b80cadfed28dc793a9701d2e" dependencies: @@ -2922,7 +2974,7 @@ js-utility-belt@^1.5.0: spark-md5 "^2.0.2" sprintf-js "^1.0.3" -js-yaml@^3.5.1, js-yaml@^3.8.2: +js-yaml@^3.4.3, js-yaml@^3.5.1, js-yaml@^3.8.2: version "3.8.4" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.8.4.tgz#520b4564f86573ba96662af85a8cafa7b4b5a6f6" dependencies: @@ -3029,6 +3081,67 @@ levn@^0.3.0, levn@~0.3.0: prelude-ls "~1.1.2" type-check "~0.3.2" +lint-staged@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-4.0.0.tgz#c15669f598614a6e68090303e175a799d48e0d85" + dependencies: + app-root-path "^2.0.0" + cosmiconfig "^1.1.0" + execa "^0.7.0" + listr "^0.12.0" + lodash.chunk "^4.2.0" + minimatch "^3.0.0" + npm-which "^3.0.1" + p-map "^1.1.1" + staged-git-files "0.0.4" + +listr-silent-renderer@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/listr-silent-renderer/-/listr-silent-renderer-1.1.1.tgz#924b5a3757153770bf1a8e3fbf74b8bbf3f9242e" + +listr-update-renderer@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/listr-update-renderer/-/listr-update-renderer-0.2.0.tgz#ca80e1779b4e70266807e8eed1ad6abe398550f9" + dependencies: + chalk "^1.1.3" + cli-truncate "^0.2.1" + elegant-spinner "^1.0.1" + figures "^1.7.0" + indent-string "^3.0.0" + log-symbols "^1.0.2" + log-update "^1.0.2" + strip-ansi "^3.0.1" + +listr-verbose-renderer@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/listr-verbose-renderer/-/listr-verbose-renderer-0.4.0.tgz#44dc01bb0c34a03c572154d4d08cde9b1dc5620f" + dependencies: + chalk "^1.1.3" + cli-cursor "^1.0.2" + date-fns "^1.27.2" + figures "^1.7.0" + +listr@^0.12.0: + version "0.12.0" + resolved "https://registry.yarnpkg.com/listr/-/listr-0.12.0.tgz#6bce2c0f5603fa49580ea17cd6a00cc0e5fa451a" + dependencies: + chalk "^1.1.3" + cli-truncate "^0.2.1" + figures "^1.7.0" + indent-string "^2.1.0" + is-promise "^2.1.0" + is-stream "^1.1.0" + listr-silent-renderer "^1.1.1" + listr-update-renderer "^0.2.0" + listr-verbose-renderer "^0.4.0" + log-symbols "^1.0.2" + log-update "^1.0.2" + ora "^0.2.3" + p-map "^1.1.1" + rxjs "^5.0.0-beta.11" + stream-to-observable "^0.1.0" + strip-ansi "^3.0.1" + load-json-file@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-1.1.0.tgz#956905708d58b4bab4c2261b04f59f31c99374c0" @@ -3076,6 +3189,10 @@ locate-path@^2.0.0: p-locate "^2.0.0" path-exists "^3.0.0" +lodash.chunk@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/lodash.chunk/-/lodash.chunk-4.2.0.tgz#66e5ce1f76ed27b4303d8c6512e8d1216e8106bc" + lodash.clonedeep@^4.5.0: version "4.5.0" resolved "https://registry.yarnpkg.com/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef" @@ -3116,6 +3233,19 @@ lodash@4.17.4, lodash@^4.0.0, lodash@^4.14.0, lodash@^4.2.0, lodash@^4.3.0: version "4.17.4" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae" +log-symbols@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-1.0.2.tgz#376ff7b58ea3086a0f09facc74617eca501e1a18" + dependencies: + chalk "^1.0.0" + +log-update@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/log-update/-/log-update-1.0.2.tgz#19929f64c4093d2d2e7075a1dad8af59c296b8d1" + dependencies: + ansi-escapes "^1.0.0" + cli-cursor "^1.0.2" + lolex@^1.6.0: version "1.6.0" resolved "https://registry.yarnpkg.com/lolex/-/lolex-1.6.0.tgz#3a9a0283452a47d7439e72731b9e07d7386e49f6" @@ -3413,6 +3543,12 @@ normalize-path@^2.0.1: dependencies: remove-trailing-separator "^1.0.1" +npm-path@^2.0.2: + version "2.0.3" + resolved "https://registry.yarnpkg.com/npm-path/-/npm-path-2.0.3.tgz#15cff4e1c89a38da77f56f6055b24f975dfb2bbe" + dependencies: + which "^1.2.10" + npm-run-path@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-1.0.0.tgz#f5c32bf595fe81ae927daec52e82f8b000ac3c8f" @@ -3425,6 +3561,14 @@ npm-run-path@^2.0.0: dependencies: path-key "^2.0.0" +npm-which@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/npm-which/-/npm-which-3.0.1.tgz#9225f26ec3a285c209cae67c3b11a6b4ab7140aa" + dependencies: + commander "^2.9.0" + npm-path "^2.0.2" + which "^1.2.10" + npmlog@^4.0.2: version "4.1.0" resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-4.1.0.tgz#dc59bee85f64f00ed424efb2af0783df25d1c0b5" @@ -3509,11 +3653,20 @@ optionator@^0.8.2: type-check "~0.3.2" wordwrap "~1.0.0" +ora@^0.2.3: + version "0.2.3" + resolved "https://registry.yarnpkg.com/ora/-/ora-0.2.3.tgz#37527d220adcd53c39b73571d754156d5db657a4" + dependencies: + chalk "^1.1.1" + cli-cursor "^1.0.2" + cli-spinners "^0.1.2" + object-assign "^4.0.1" + os-browserify@^0.2.0: version "0.2.1" resolved "https://registry.yarnpkg.com/os-browserify/-/os-browserify-0.2.1.tgz#63fc4ccee5d2d7763d26bbf8601078e6c2e0044f" -os-homedir@^1.0.0: +os-homedir@^1.0.0, os-homedir@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3" @@ -3556,6 +3709,10 @@ p-locate@^2.0.0: dependencies: p-limit "^1.1.0" +p-map@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/p-map/-/p-map-1.1.1.tgz#05f5e4ae97a068371bc2a5cc86bfbdbc19c4ae7a" + package-hash@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/package-hash/-/package-hash-1.2.0.tgz#003e56cd57b736a6ed6114cc2b81542672770e44" @@ -4094,6 +4251,10 @@ require-directory@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" +require-from-string@^1.1.0: + version "1.2.1" + resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-1.2.1.tgz#529c9ccef27380adfec9a2f965b649bbee636418" + require-main-filename@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-1.0.1.tgz#97f717b69d48784f5f526a6c5aa8ffdda055a4d1" @@ -4198,6 +4359,12 @@ rx@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/rx/-/rx-4.1.0.tgz#a5f13ff79ef3b740fe30aa803fb09f98805d4782" +rxjs@^5.0.0-beta.11: + version "5.4.1" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-5.4.1.tgz#b62f757f279445d265a18a58fb0a70dc90e91626" + dependencies: + symbol-observable "^1.0.1" + safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@~5.1.0: version "5.1.0" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.0.tgz#fe4c8460397f9eaaaa58e73be46273408a45e223" @@ -4371,6 +4538,10 @@ stack-utils@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/stack-utils/-/stack-utils-1.0.1.tgz#d4f33ab54e8e38778b0ca5cfd3b3afb12db68620" +staged-git-files@0.0.4: + version "0.0.4" + resolved "https://registry.yarnpkg.com/staged-git-files/-/staged-git-files-0.0.4.tgz#d797e1b551ca7a639dec0237dc6eb4bb9be17d35" + stream-browserify@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/stream-browserify/-/stream-browserify-2.0.1.tgz#66266ee5f9bdb9940a4e4514cafb43bb71e5c9db" @@ -4396,6 +4567,10 @@ stream-shift@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/stream-shift/-/stream-shift-1.0.0.tgz#d5c752825e5367e786f78e18e445ea223a155952" +stream-to-observable@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/stream-to-observable/-/stream-to-observable-0.1.0.tgz#45bf1d9f2d7dc09bed81f1c307c430e68b84cffe" + strict-uri-encode@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz#279b225df1d582b1f54e65addd4352e18faa0713" @@ -4487,7 +4662,7 @@ symbol-observable@^0.2.2: version "0.2.4" resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-0.2.4.tgz#95a83db26186d6af7e7a18dbd9760a2f86d08f40" -symbol-observable@^1.0.4: +symbol-observable@^1.0.1, symbol-observable@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.0.4.tgz#29bf615d4aa7121bdd898b22d4b3f9bc4e2aa03d" @@ -4824,7 +4999,7 @@ which-module@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/which-module/-/which-module-1.0.0.tgz#bba63ca861948994ff307736089e3b96026c2a4f" -which@^1.2.8, which@^1.2.9: +which@^1.2.10, which@^1.2.8, which@^1.2.9: version "1.2.14" resolved "https://registry.yarnpkg.com/which/-/which-1.2.14.tgz#9a87c4378f03e827cecaf1acdf56c736c01c14e5" dependencies: From 4fe121f77c4c4aa232f9f8ea43c1b4b5c7049342 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Wed, 21 Jun 2017 13:38:15 +0200 Subject: [PATCH 17/26] fix lint-staged eslint running on everything --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 017df51..afca354 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "report-coverage": "nyc report --reporter=lcov > coverage.lcov && codecov" }, "lint-staged": { - "*.js": ["npm run lint"] + "*.js": ["eslint"] }, "devDependencies": { "ava": "^0.19.1", From 53071f631605b1f214dd1ecb9845198b1f1759ca Mon Sep 17 00:00:00 2001 From: tim Date: Wed, 21 Jun 2017 13:50:41 +0200 Subject: [PATCH 18/26] such importance, wow --- .travis.yml | 2 ++ package.json | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index cde552a..72685c3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,6 +20,8 @@ before_install: -e BIGCHAINDB_DATABASE_HOST=172.17.0.1 bigchaindb/bigchaindb:master start + - gem install lolcat + - apt-get install cowsay - npm install -g codecov script: yarn test diff --git a/package.json b/package.json index 82821a9..608d71c 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,8 @@ "build:cjs": "cross-env BABEL_ENV=cjs babel ./src -d dist/node", "build:dist": "cross-env NODE_ENV=production webpack -p", "clean": "rimraf dist/bundle dist/node", - "test": "npm run lint && nyc ava test/ && npm run report-coverage", + "test": "npm run lint && nyc ava test/ && npm run thanks && npm run report-coverage", + "thanks": "cowsay Hi, thanks for your interest in BigchainDB! We appreciate your contribution :) | lolcat", "release": "./node_modules/release-it/bin/release.js --src.tagName='v%s' --github.release --npm.publish --non-interactive", "release-minor": "./node_modules/release-it/bin/release.js minor --src.tagName='v%s' --github.release --npm.publish --non-interactive", "release-major": "./node_modules/release-it/bin/release.js major --src.tagName='v%s' --github.release --npm.publish --non-interactive", From f007dedd35c3f959bf572a58eae4a325f73b12e8 Mon Sep 17 00:00:00 2001 From: tim Date: Wed, 21 Jun 2017 15:06:15 +0200 Subject: [PATCH 19/26] hello --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 72685c3..9aa9e7f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,7 +21,7 @@ before_install: bigchaindb/bigchaindb:master start - gem install lolcat - - apt-get install cowsay + - sudo apt-get install cowsay - npm install -g codecov script: yarn test From 5bf7009c3ea635fe786a861a2caeeb8ca2824fd2 Mon Sep 17 00:00:00 2001 From: tim Date: Wed, 21 Jun 2017 15:09:35 +0200 Subject: [PATCH 20/26] come on --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 608d71c..167eca2 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "build:dist": "cross-env NODE_ENV=production webpack -p", "clean": "rimraf dist/bundle dist/node", "test": "npm run lint && nyc ava test/ && npm run thanks && npm run report-coverage", - "thanks": "cowsay Hi, thanks for your interest in BigchainDB! We appreciate your contribution :) | lolcat", + "thanks": "cowsay Hi, thanks for your interest in BigchainDB. We appreciate your contribution! | lolcat", "release": "./node_modules/release-it/bin/release.js --src.tagName='v%s' --github.release --npm.publish --non-interactive", "release-minor": "./node_modules/release-it/bin/release.js minor --src.tagName='v%s' --github.release --npm.publish --non-interactive", "release-major": "./node_modules/release-it/bin/release.js major --src.tagName='v%s' --github.release --npm.publish --non-interactive", From 895b6960b22333d594c5fdcdf6bf0c58c2a9b92d Mon Sep 17 00:00:00 2001 From: tim Date: Wed, 21 Jun 2017 15:19:07 +0200 Subject: [PATCH 21/26] ok a last one --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 9aa9e7f..fa1e2c4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,7 +21,7 @@ before_install: bigchaindb/bigchaindb:master start - gem install lolcat - - sudo apt-get install cowsay + - gem install cowsay - npm install -g codecov script: yarn test From f77f22b89dbf44d77b15e3adabfadcdcdd5c9374 Mon Sep 17 00:00:00 2001 From: tim Date: Wed, 21 Jun 2017 15:27:02 +0200 Subject: [PATCH 22/26] final --- .travis.yml | 1 - package.json | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index fa1e2c4..c213072 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,7 +20,6 @@ before_install: -e BIGCHAINDB_DATABASE_HOST=172.17.0.1 bigchaindb/bigchaindb:master start - - gem install lolcat - gem install cowsay - npm install -g codecov diff --git a/package.json b/package.json index 167eca2..70faf1f 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "build:dist": "cross-env NODE_ENV=production webpack -p", "clean": "rimraf dist/bundle dist/node", "test": "npm run lint && nyc ava test/ && npm run thanks && npm run report-coverage", - "thanks": "cowsay Hi, thanks for your interest in BigchainDB. We appreciate your contribution! | lolcat", + "thanks": "cowsay Hi, thanks for your interest in BigchainDB. We appreciate your contribution!", "release": "./node_modules/release-it/bin/release.js --src.tagName='v%s' --github.release --npm.publish --non-interactive", "release-minor": "./node_modules/release-it/bin/release.js minor --src.tagName='v%s' --github.release --npm.publish --non-interactive", "release-major": "./node_modules/release-it/bin/release.js major --src.tagName='v%s' --github.release --npm.publish --non-interactive", From c17d614ab6303653aa5cf97ec3f5fece142aca5c Mon Sep 17 00:00:00 2001 From: tim Date: Wed, 21 Jun 2017 15:59:28 +0200 Subject: [PATCH 23/26] Dynamically generated keys for /outputs tests + bool fix --- src/connection/index.js | 2 +- test/connection/test_connection.js | 4 +- test/integration/test_integration.js | 87 +++++++++++++--------------- 3 files changed, 43 insertions(+), 50 deletions(-) diff --git a/src/connection/index.js b/src/connection/index.js index 48d9a67..aa7131e 100644 --- a/src/connection/index.js +++ b/src/connection/index.js @@ -89,7 +89,7 @@ export default class Connection { // NOTE: If `spent` is not defined, it must not be included in the // query parameters. if (spent !== undefined) { - query.spent = spent + query.spent = spent.toString() } return this._req(this.getApiUrls('outputs'), { query diff --git a/test/connection/test_connection.js b/test/connection/test_connection.js index af398c5..eb7bf34 100644 --- a/test/connection/test_connection.js +++ b/test/connection/test_connection.js @@ -157,7 +157,7 @@ test('Get outputs for a public key and spent=false', t => { conn.listOutputs(publicKey, spent) t.truthy(conn._req.calledWith( expectedPath, - { query: { public_key: publicKey, spent } } + { query: { public_key: publicKey, spent: 'false' } } )) }) @@ -173,7 +173,7 @@ test('Get outputs for a public key and spent=true', t => { conn.listOutputs(publicKey, spent) t.truthy(conn._req.calledWith( expectedPath, - { query: { public_key: publicKey, spent } } + { query: { public_key: publicKey, spent: 'true' } } )) }) diff --git a/test/integration/test_integration.js b/test/integration/test_integration.js index 5b1d184..b6808d5 100644 --- a/test/integration/test_integration.js +++ b/test/integration/test_integration.js @@ -112,137 +112,130 @@ test('Valid TRANSFER transaction with multiple Ed25519 inputs', t => { test('Search for spent and unspent outputs of a given public key', t => { const conn = new Connection(API_PATH) + const carol = new Ed25519Keypair() + const carolCondition = Transaction.makeEd25519Condition(carol.publicKey) + const carolOutput = Transaction.makeOutput(carolCondition) + const trent = new Ed25519Keypair() + const trentCondition = Transaction.makeEd25519Condition(trent.publicKey) + const trentOutput = Transaction.makeOutput(trentCondition) + const createTx = Transaction.makeCreateTransaction( asset(), metaData, - [aliceOutput, aliceOutput], - alice.publicKey + [carolOutput, carolOutput], + carol.publicKey ) const createTxSigned = Transaction.signTransaction( createTx, - alice.privateKey, - alice.privateKey + carol.privateKey, + carol.privateKey ) // We spent output 1 (of 0, 1) const transferTx = Transaction.makeTransferTransaction( createTxSigned, metaData, - [bobOutput], + [trentOutput], 1 ) const transferTxSigned = Transaction.signTransaction( transferTx, - alice.privateKey, + carol.privateKey, ) - function byTransactionId(transactionId, ...outputIndices) { - return value => transactionId === value.transaction_id && - outputIndices.includes(value.output) - } - return conn.postTransaction(createTxSigned) .then(({ id }) => conn.pollStatusAndFetchTransaction(id)) .then(() => conn.postTransaction(transferTxSigned)) .then(({ id }) => conn.pollStatusAndFetchTransaction(id)) - .then(() => conn.listOutputs(alice.publicKey)) + .then(() => conn.listOutputs(carol.publicKey)) // now listOutputs should return us outputs 0 and 1 (unfiltered) - .then(outputs => outputs.filter(byTransactionId( - createTxSigned.id, - 0, - 1 - ))) .then(outputs => t.truthy(outputs.length === 2)) }) test('Search for unspent outputs for a given public key', t => { const conn = new Connection(API_PATH) + const carol = new Ed25519Keypair() + const carolCondition = Transaction.makeEd25519Condition(carol.publicKey) + const carolOutput = Transaction.makeOutput(carolCondition) + const trent = new Ed25519Keypair() + const trentCondition = Transaction.makeEd25519Condition(trent.publicKey) + const trentOutput = Transaction.makeOutput(trentCondition) const createTx = Transaction.makeCreateTransaction( asset(), metaData, - [aliceOutput, aliceOutput, aliceOutput], - alice.publicKey + [carolOutput, carolOutput, carolOutput], + carol.publicKey ) const createTxSigned = Transaction.signTransaction( createTx, - alice.privateKey, - alice.privateKey + carol.privateKey, + carol.privateKey ) // We spent output 1 (of 0, 1, 2) const transferTx = Transaction.makeTransferTransaction( createTxSigned, metaData, - [bobOutput], + [trentOutput], 1 ) const transferTxSigned = Transaction.signTransaction( transferTx, - alice.privateKey, + carol.privateKey, ) - function byTransactionId(transactionId, ...outputIndices) { - return value => transactionId === value.transaction_id && - outputIndices.includes(value.output) - } - return conn.postTransaction(createTxSigned) .then(({ id }) => conn.pollStatusAndFetchTransaction(id)) .then(() => conn.postTransaction(transferTxSigned)) .then(({ id }) => conn.pollStatusAndFetchTransaction(id)) // now listOutputs should return us outputs 0 and 2 (1 is spent) - .then(() => conn.listOutputs(alice.publicKey, false)) - .then(outputs => outputs.filter(byTransactionId( - createTxSigned.id, - 0, - 2 - ))) + .then(() => conn.listOutputs(carol.publicKey, 'false')) .then(outputs => t.truthy(outputs.length === 2)) }) test('Search for spent outputs for a given public key', t => { const conn = new Connection(API_PATH) + const carol = new Ed25519Keypair() + const carolCondition = Transaction.makeEd25519Condition(carol.publicKey) + const carolOutput = Transaction.makeOutput(carolCondition) + const trent = new Ed25519Keypair() + const trentCondition = Transaction.makeEd25519Condition(trent.publicKey) + const trentOutput = Transaction.makeOutput(trentCondition) const createTx = Transaction.makeCreateTransaction( asset(), metaData, - [aliceOutput, aliceOutput, aliceOutput], - alice.publicKey + [carolOutput, carolOutput, carolOutput], + carol.publicKey ) const createTxSigned = Transaction.signTransaction( createTx, - alice.privateKey, - alice.privateKey + carol.privateKey, + carol.privateKey ) // We spent output 1 (of 0, 1, 2) const transferTx = Transaction.makeTransferTransaction( createTxSigned, metaData, - [bobOutput], + [trentOutput], 1 ) const transferTxSigned = Transaction.signTransaction( transferTx, - alice.privateKey, + carol.privateKey, ) - function byTransactionId(transactionId, ...outputIndices) { - return value => transactionId === value.transaction_id && - outputIndices.includes(value.output) - } - return conn.postTransaction(createTxSigned) .then(({ id }) => conn.pollStatusAndFetchTransaction(id)) .then(() => conn.postTransaction(transferTxSigned)) .then(({ id }) => conn.pollStatusAndFetchTransaction(id)) // now listOutputs should only return us output 1 (0 and 2 are unspent) - .then(() => conn.listOutputs(alice.publicKey, true)) - .then(outputs => outputs.filter(byTransactionId(createTxSigned.id, 1))) + .then(() => conn.listOutputs(carol.publicKey, true)) .then(outputs => t.truthy(outputs.length === 1)) }) From 99b263387c1a4b8622e7274da3801ab962e10389 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Wed, 21 Jun 2017 16:03:38 +0200 Subject: [PATCH 24/26] yarn upgrade --- yarn.lock | 338 +++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 282 insertions(+), 56 deletions(-) diff --git a/yarn.lock b/yarn.lock index 4b9bf86..a78b071 100644 --- a/yarn.lock +++ b/yarn.lock @@ -72,10 +72,14 @@ agent-base@2: extend "~3.0.0" semver "~5.0.1" -ajv-keywords@^1.0.0, ajv-keywords@^1.1.1: +ajv-keywords@^1.0.0: version "1.5.1" resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-1.5.1.tgz#314dd0a4b3368fad3dfcdc54ede6171b886daf3c" +ajv-keywords@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-2.1.0.tgz#a296e17f7bfae7c1ce4f7e0de53d29cb32162df0" + ajv@^4.7.0, ajv@^4.9.1: version "4.11.8" resolved "https://registry.yarnpkg.com/ajv/-/ajv-4.11.8.tgz#82ffb02b29e662ae53bdc20af15947706739c536" @@ -83,6 +87,15 @@ ajv@^4.7.0, ajv@^4.9.1: co "^4.6.0" json-stable-stringify "^1.0.1" +ajv@^5.1.5: + version "5.2.0" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-5.2.0.tgz#c1735024c5da2ef75cc190713073d44f098bf486" + dependencies: + co "^4.6.0" + fast-deep-equal "^0.1.0" + json-schema-traverse "^0.3.0" + json-stable-stringify "^1.0.1" + align-text@^0.1.1, align-text@^0.1.3: version "0.1.4" resolved "https://registry.yarnpkg.com/align-text/-/align-text-0.1.4.tgz#0cd90a561093f35d0a99256c22b7069433fad117" @@ -91,6 +104,10 @@ align-text@^0.1.1, align-text@^0.1.3: longest "^1.0.1" repeat-string "^1.5.2" +amdefine@>=0.0.4: + version "1.0.1" + resolved "https://registry.yarnpkg.com/amdefine/-/amdefine-1.0.1.tgz#4a5282ac164729e93619bcfd3ad151f817ce91f5" + ansi-align@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ansi-align/-/ansi-align-2.0.0.tgz#c36aeccba563b89ceb556f3690f0b1d9e3547f7f" @@ -134,10 +151,20 @@ app-root-path@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/app-root-path/-/app-root-path-2.0.1.tgz#cd62dcf8e4fd5a417efc664d2e5b10653c651b46" +append-transform@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/append-transform/-/append-transform-0.4.0.tgz#d76ebf8ca94d276e247a36bad44a4b74ab611991" + dependencies: + default-require-extensions "^1.0.0" + aproba@^1.0.3: version "1.1.2" resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.1.2.tgz#45c6629094de4e96f693ef7eab74ae079c240fc1" +archy@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/archy/-/archy-1.0.0.tgz#f9c8c13757cc1dd7bc379ac77b2c62a5c2868c40" + are-we-there-yet@~1.1.2: version "1.1.4" resolved "https://registry.yarnpkg.com/are-we-there-yet/-/are-we-there-yet-1.1.4.tgz#bb5dca382bb94f05e15194373d16fd3ba1ca110d" @@ -187,7 +214,7 @@ array-unique@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.2.1.tgz#a1d97ccafcbc2625cc70fadceb36a50c58b01a53" -arrify@^1.0.0: +arrify@^1.0.0, arrify@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" @@ -221,6 +248,10 @@ async-each@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/async-each/-/async-each-1.0.1.tgz#19d386a1d9edc6e7c1c85d388aedbcc56d33602d" +async@^1.4.0: + version "1.5.2" + resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a" + async@^2.1.2: version "2.4.1" resolved "https://registry.yarnpkg.com/async/-/async-2.4.1.tgz#62a56b279c98a11d0987096a01cc3eeb8eb7bbd7" @@ -398,7 +429,7 @@ babel-eslint@^7.1.1: babel-types "^6.23.0" babylon "^6.17.0" -babel-generator@^6.1.0, babel-generator@^6.25.0: +babel-generator@^6.1.0, babel-generator@^6.18.0, babel-generator@^6.25.0: version "6.25.0" resolved "https://registry.yarnpkg.com/babel-generator/-/babel-generator-6.25.0.tgz#33a1af70d5f2890aeb465a4a7793c1df6a9ea9fc" dependencies: @@ -892,7 +923,7 @@ babel-runtime@^6.0.0, babel-runtime@^6.18.0, babel-runtime@^6.22.0, babel-runtim core-js "^2.4.0" regenerator-runtime "^0.10.0" -babel-template@^6.24.1, babel-template@^6.25.0: +babel-template@^6.16.0, babel-template@^6.24.1, babel-template@^6.25.0: version "6.25.0" resolved "https://registry.yarnpkg.com/babel-template/-/babel-template-6.25.0.tgz#665241166b7c2aa4c619d71e192969552b10c071" dependencies: @@ -902,7 +933,7 @@ babel-template@^6.24.1, babel-template@^6.25.0: babylon "^6.17.2" lodash "^4.2.0" -babel-traverse@^6.23.1, babel-traverse@^6.24.1, babel-traverse@^6.25.0: +babel-traverse@^6.18.0, babel-traverse@^6.23.1, babel-traverse@^6.24.1, babel-traverse@^6.25.0: version "6.25.0" resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-6.25.0.tgz#2257497e2fcd19b89edc13c4c91381f9512496f1" dependencies: @@ -916,7 +947,7 @@ babel-traverse@^6.23.1, babel-traverse@^6.24.1, babel-traverse@^6.25.0: invariant "^2.2.0" lodash "^4.2.0" -babel-types@^6.19.0, babel-types@^6.23.0, babel-types@^6.24.1, babel-types@^6.25.0: +babel-types@^6.18.0, babel-types@^6.19.0, babel-types@^6.23.0, babel-types@^6.24.1, babel-types@^6.25.0: version "6.25.0" resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-6.25.0.tgz#70afb248d5660e5d18f811d91c8303b54134a18e" dependencies: @@ -925,7 +956,7 @@ babel-types@^6.19.0, babel-types@^6.23.0, babel-types@^6.24.1, babel-types@^6.25 lodash "^4.2.0" to-fast-properties "^1.0.1" -babylon@^6.1.0, babylon@^6.17.0, babylon@^6.17.2: +babylon@^6.1.0, babylon@^6.13.0, babylon@^6.17.0, babylon@^6.17.2: version "6.17.4" resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.17.4.tgz#3e8b7402b88d22c3423e137a1577883b15ff869a" @@ -1170,7 +1201,7 @@ camelcase@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-3.0.0.tgz#32fc4b9fcdaf845fcdf7e73bb97cac2261f0ab0a" -camelcase@^4.0.0: +camelcase@^4.0.0, camelcase@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-4.1.0.tgz#d545635be1e33c542649c69173e5de6acfae34dd" @@ -1408,7 +1439,7 @@ contains-path@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/contains-path/-/contains-path-0.1.0.tgz#fe8cf184ff6670b6baef01a9d4861a5cbec4120a" -convert-source-map@^1.1.0, convert-source-map@^1.2.0: +convert-source-map@^1.1.0, convert-source-map@^1.2.0, convert-source-map@^1.3.0: version "1.5.0" resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.5.0.tgz#9acd70851c6d5dfdd93d9282e5edf94a03ff46b5" @@ -1491,7 +1522,7 @@ cross-spawn-async@^2.1.1: lru-cache "^4.0.0" which "^1.2.8" -cross-spawn@^4.0.0: +cross-spawn@^4, cross-spawn@^4.0.0: version "4.0.2" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-4.0.2.tgz#7b9247621c23adfdd3856004a823cbe397424d41" dependencies: @@ -1565,7 +1596,11 @@ death@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/death/-/death-1.1.0.tgz#01aa9c401edd92750514470b8266390c66c67318" -debug@2, debug@^2.1.1, debug@^2.2.0: +debug-log@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/debug-log/-/debug-log-1.0.1.tgz#2307632d4c04382b8df8a32f70b895046d52745f" + +debug@2, debug@^2.1.1, debug@^2.2.0, debug@^2.6.3: version "2.6.8" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.8.tgz#e731531ca2ede27d188222427da17821d68ff4fc" dependencies: @@ -1593,6 +1628,12 @@ deep-is@~0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" +default-require-extensions@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/default-require-extensions/-/default-require-extensions-1.0.0.tgz#f37ea15d3e13ffd9b437d33e1a75b5fb97874cb8" + dependencies: + strip-bom "^2.0.0" + del@^2.0.2: version "2.2.2" resolved "https://registry.yarnpkg.com/del/-/del-2.2.2.tgz#c12c981d067846c84bcaf862cff930d907ffd1a8" @@ -1966,10 +2007,6 @@ estraverse@^4.0.0, estraverse@^4.1.0, estraverse@^4.1.1, estraverse@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.2.0.tgz#0dee3fed31fcd469618ce7342099fc1afa0bdb13" -estraverse@~4.1.0: - version "4.1.1" - resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.1.1.tgz#f6caca728933a850ef90661d0e17982ba47111a2" - esutils@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" @@ -2064,6 +2101,10 @@ extsprintf@1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.0.2.tgz#e1080e0658e300b06294990cc70e1502235fd550" +fast-deep-equal@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-0.1.0.tgz#5c6f4599aba6b333ee3342e2ed978672f1001f8d" + fast-levenshtein@~2.0.4: version "2.0.6" resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" @@ -2188,6 +2229,13 @@ for-own@^0.1.4: dependencies: for-in "^1.0.1" +foreground-child@^1.5.3, foreground-child@^1.5.6: + version "1.5.6" + resolved "https://registry.yarnpkg.com/foreground-child/-/foreground-child-1.5.6.tgz#4fd71ad2dfde96789b980a5c0a295937cb2f5ce9" + dependencies: + cross-spawn "^4" + signal-exit "^3.0.0" + forever-agent@~0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" @@ -2327,7 +2375,7 @@ glob@7.1.1: once "^1.3.0" path-is-absolute "^1.0.0" -glob@^7.0.0, glob@^7.0.3, glob@^7.0.5: +glob@^7.0.0, glob@^7.0.3, glob@^7.0.5, glob@^7.0.6: version "7.1.2" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15" dependencies: @@ -2398,6 +2446,16 @@ gunzip-maybe@^1.4.0: pumpify "^1.3.3" through2 "^2.0.3" +handlebars@^4.0.3: + version "4.0.10" + resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.0.10.tgz#3d30c718b09a3d96f23ea4cc1f403c4d3ba9ff4f" + dependencies: + async "^1.4.0" + optimist "^0.6.1" + source-map "^0.4.4" + optionalDependencies: + uglify-js "^2.6" + har-schema@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-1.0.5.tgz#d263135f43307c02c602afc8fe95970c0151369e" @@ -2880,6 +2938,53 @@ isstream@~0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" +istanbul-lib-coverage@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-1.1.1.tgz#73bfb998885299415c93d38a3e9adf784a77a9da" + +istanbul-lib-hook@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/istanbul-lib-hook/-/istanbul-lib-hook-1.0.7.tgz#dd6607f03076578fe7d6f2a630cf143b49bacddc" + dependencies: + append-transform "^0.4.0" + +istanbul-lib-instrument@^1.7.2: + version "1.7.2" + resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-1.7.2.tgz#6014b03d3470fb77638d5802508c255c06312e56" + dependencies: + babel-generator "^6.18.0" + babel-template "^6.16.0" + babel-traverse "^6.18.0" + babel-types "^6.18.0" + babylon "^6.13.0" + istanbul-lib-coverage "^1.1.1" + semver "^5.3.0" + +istanbul-lib-report@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/istanbul-lib-report/-/istanbul-lib-report-1.1.1.tgz#f0e55f56655ffa34222080b7a0cd4760e1405fc9" + dependencies: + istanbul-lib-coverage "^1.1.1" + mkdirp "^0.5.1" + path-parse "^1.0.5" + supports-color "^3.1.2" + +istanbul-lib-source-maps@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-1.2.1.tgz#a6fe1acba8ce08eebc638e572e294d267008aa0c" + dependencies: + debug "^2.6.3" + istanbul-lib-coverage "^1.1.1" + mkdirp "^0.5.1" + rimraf "^2.6.1" + source-map "^0.5.3" + +istanbul-reports@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-1.1.1.tgz#042be5c89e175bc3f86523caab29c014e77fee4e" + dependencies: + handlebars "^4.0.3" + jest-diff@19.0.0, jest-diff@^19.0.0: version "19.0.0" resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-19.0.0.tgz#d1563cfc56c8b60232988fbc05d4d16ed90f063c" @@ -3001,6 +3106,10 @@ json-loader@^0.5.4: version "0.5.4" resolved "https://registry.yarnpkg.com/json-loader/-/json-loader-0.5.4.tgz#8baa1365a632f58a3c46d20175fc6002c96e37de" +json-schema-traverse@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.3.0.tgz#0016c0b1ca1efe46d44d37541bcdfc19dcfae0db" + json-schema@0.2.3: version "0.2.3" resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13" @@ -3165,16 +3274,7 @@ loader-runner@^2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-2.3.0.tgz#f482aea82d543e07921700d5a46ef26fdac6b8a2" -loader-utils@^0.2.16: - version "0.2.17" - resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-0.2.17.tgz#f86e6374d43205a6e6c60e9196f17c0299bfb348" - dependencies: - big.js "^3.1.3" - emojis-list "^2.0.0" - json5 "^0.5.0" - object-assign "^4.0.1" - -loader-utils@^1.0.2: +loader-utils@^1.0.2, loader-utils@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-1.1.0.tgz#c98aef488bcceda2ffb5e2de646d6a754429f5cd" dependencies: @@ -3310,6 +3410,12 @@ md5-o-matic@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/md5-o-matic/-/md5-o-matic-0.1.1.tgz#822bccd65e117c514fab176b25945d54100a03c3" +mem@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/mem/-/mem-1.1.0.tgz#5edd52b485ca1d900fe64895505399a0dfa45f76" + dependencies: + mimic-fn "^1.0.0" + memory-fs@^0.4.0, memory-fs@~0.4.1: version "0.4.1" resolved "https://registry.yarnpkg.com/memory-fs/-/memory-fs-0.4.1.tgz#3a9a20b8462523e447cfbc7e8bb80ed667bfc552" @@ -3332,6 +3438,12 @@ meow@^3.7.0: redent "^1.0.0" trim-newlines "^1.0.0" +merge-source-map@^1.0.2: + version "1.0.4" + resolved "https://registry.yarnpkg.com/merge-source-map/-/merge-source-map-1.0.4.tgz#a5de46538dae84d4114cc5ea02b4772a6346701f" + dependencies: + source-map "^0.5.6" + micromatch@^2.1.5, micromatch@^2.3.11: version "2.3.11" resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-2.3.11.tgz#86677c97d1720b363431d04d0d15293bd38c1565" @@ -3389,7 +3501,7 @@ minimatch@^3.0.0, minimatch@^3.0.2, minimatch@^3.0.3, minimatch@^3.0.4: dependencies: brace-expansion "^1.1.7" -minimist@0.0.8: +minimist@0.0.8, minimist@~0.0.1: version "0.0.8" resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" @@ -3461,14 +3573,7 @@ node-fetch@1.5.1: encoding "^0.1.11" is-stream "^1.0.1" -node-fetch@^1.0.1: - version "1.7.1" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-1.7.1.tgz#899cb3d0a3c92f952c47f1b876f4c8aeabd400d5" - dependencies: - encoding "^0.1.11" - is-stream "^1.0.1" - -node-fetch@~1.6.0: +node-fetch@^1.0.1, node-fetch@~1.6.0: version "1.6.3" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-1.6.3.tgz#dc234edd6489982d58e8f0db4f695029abcd8c04" dependencies: @@ -3582,6 +3687,38 @@ number-is-nan@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" +nyc@^11.0.2: + version "11.0.2" + resolved "https://registry.yarnpkg.com/nyc/-/nyc-11.0.2.tgz#9e592a697186028253b668516c38f079c39c08f3" + dependencies: + archy "^1.0.0" + arrify "^1.0.1" + caching-transform "^1.0.0" + convert-source-map "^1.3.0" + debug-log "^1.0.1" + default-require-extensions "^1.0.0" + find-cache-dir "^0.1.1" + find-up "^2.1.0" + foreground-child "^1.5.3" + glob "^7.0.6" + istanbul-lib-coverage "^1.1.1" + istanbul-lib-hook "^1.0.7" + istanbul-lib-instrument "^1.7.2" + istanbul-lib-report "^1.1.1" + istanbul-lib-source-maps "^1.2.1" + istanbul-reports "^1.1.1" + md5-hex "^1.2.0" + merge-source-map "^1.0.2" + micromatch "^2.3.11" + mkdirp "^0.5.0" + resolve-from "^2.0.0" + rimraf "^2.5.4" + signal-exit "^3.0.1" + spawn-wrap "^1.3.6" + test-exclude "^4.1.1" + yargs "^8.0.1" + yargs-parser "^5.0.0" + oauth-sign@~0.8.1: version "0.8.2" resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.8.2.tgz#46a6ab7f0aead8deae9ec0565780b7d4efeb9d43" @@ -3636,6 +3773,13 @@ onetime@^2.0.0: dependencies: mimic-fn "^1.0.0" +optimist@^0.6.1: + version "0.6.1" + resolved "https://registry.yarnpkg.com/optimist/-/optimist-0.6.1.tgz#da3ea74686fa21a19a111c326e90eb15a0196686" + dependencies: + minimist "~0.0.1" + wordwrap "~0.0.2" + option-chain@^0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/option-chain/-/option-chain-0.1.1.tgz#e9b811e006f1c0f54802f28295bfc8970f8dcfbd" @@ -3676,6 +3820,14 @@ os-locale@^1.4.0: dependencies: lcid "^1.0.0" +os-locale@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/os-locale/-/os-locale-2.0.0.tgz#15918ded510522b81ee7ae5a309d54f639fc39a4" + dependencies: + execa "^0.5.0" + lcid "^1.0.0" + mem "^1.1.0" + os-tmpdir@^1.0.0, os-tmpdir@^1.0.1, os-tmpdir@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" @@ -3808,6 +3960,10 @@ path-key@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" +path-parse@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.5.tgz#3c1adf871ea9cd6c9431b6ea2bd74a0ff055c4c1" + path-to-regexp@^1.7.0: version "1.7.0" resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-1.7.0.tgz#59fde0f435badacba103a84e9d3bc64e96b9937d" @@ -4316,7 +4472,7 @@ right-align@^0.1.1: dependencies: align-text "^0.1.1" -rimraf@2, rimraf@^2.2.8, rimraf@^2.5.0, rimraf@^2.5.1, rimraf@^2.5.4, rimraf@^2.6.1: +rimraf@2, rimraf@^2.2.8, rimraf@^2.3.3, rimraf@^2.5.0, rimraf@^2.5.1, rimraf@^2.5.4, rimraf@^2.6.1: version "2.6.1" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.1.tgz#c2338ec643df7a1b7fe5c54fa86f57428a55f33d" dependencies: @@ -4439,7 +4595,7 @@ shelljs@^0.7.5: interpret "^1.0.0" rechoir "^0.6.2" -signal-exit@^3.0.0, signal-exit@^3.0.2: +signal-exit@^3.0.0, signal-exit@^3.0.1, signal-exit@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" @@ -4480,9 +4636,9 @@ sort-keys@^1.1.1, sort-keys@^1.1.2: dependencies: is-plain-obj "^1.0.0" -source-list-map@^1.1.1: - version "1.1.2" - resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-1.1.2.tgz#9889019d1024cce55cdc069498337ef6186a11a1" +source-list-map@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-2.0.0.tgz#aaa47403f7b245a92fbc97ea08f250d6087ed085" source-map-support@^0.4.0, source-map-support@^0.4.2: version "0.4.15" @@ -4490,6 +4646,12 @@ source-map-support@^0.4.0, source-map-support@^0.4.2: dependencies: source-map "^0.5.6" +source-map@^0.4.4: + version "0.4.4" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.4.4.tgz#eba4f5da9c0dc999de68032d8b4f76173652036b" + dependencies: + amdefine ">=0.0.4" + source-map@^0.5.0, source-map@^0.5.3, source-map@^0.5.6, source-map@~0.5.1, source-map@~0.5.3: version "0.5.6" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.6.tgz#75ce38f52bf0733c5a7f0c118d81334a2bb5f412" @@ -4498,6 +4660,17 @@ spark-md5@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/spark-md5/-/spark-md5-2.0.2.tgz#37b763847763ae7e7acef2ca5233d01e649a78b7" +spawn-wrap@^1.3.6: + version "1.3.6" + resolved "https://registry.yarnpkg.com/spawn-wrap/-/spawn-wrap-1.3.6.tgz#ccec4a949d8ce7e2b1a35cf4671d683d2e76a1d1" + dependencies: + foreground-child "^1.5.6" + mkdirp "^0.5.0" + os-homedir "^1.0.1" + rimraf "^2.3.3" + signal-exit "^3.0.2" + which "^1.2.4" + spdx-correct@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-1.0.2.tgz#4b3073d933ff51f3912f03ac5519498a4150db40" @@ -4652,7 +4825,7 @@ supports-color@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" -supports-color@^3.1.0, supports-color@^3.2.3: +supports-color@^3.1.0, supports-color@^3.1.2, supports-color@^3.2.3: version "3.2.3" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-3.2.3.tgz#65ac0504b3954171d8a64946b2ae3cbb8a5f54f6" dependencies: @@ -4726,6 +4899,16 @@ term-size@^0.1.0: dependencies: execa "^0.4.0" +test-exclude@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-4.1.1.tgz#4d84964b0966b0087ecc334a2ce002d3d9341e26" + dependencies: + arrify "^1.0.1" + micromatch "^2.3.11" + object-assign "^4.1.0" + read-pkg-up "^1.0.1" + require-main-filename "^1.0.1" + text-encoding@0.6.4: version "0.6.4" resolved "https://registry.yarnpkg.com/text-encoding/-/text-encoding-0.6.4.tgz#e399a982257a276dae428bb92845cb71bdc26d19" @@ -4828,7 +5011,7 @@ typedarray@^0.0.6: version "0.0.6" resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" -uglify-js@^2.8.27: +uglify-js@^2.6, uglify-js@^2.8.29: version "2.8.29" resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.8.29.tgz#29c5733148057bb4e1f75df35b7a9cb72e6a59dd" dependencies: @@ -4841,6 +5024,14 @@ uglify-to-browserify@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz#6e0924d6bda6b5afe349e39a6d632850a0f882b7" +uglifyjs-webpack-plugin@^0.4.4: + version "0.4.6" + resolved "https://registry.yarnpkg.com/uglifyjs-webpack-plugin/-/uglifyjs-webpack-plugin-0.4.6.tgz#b951f4abb6bd617e66f63eb891498e391763e309" + dependencies: + source-map "^0.5.6" + uglify-js "^2.8.29" + webpack-sources "^1.0.1" + uid-number@^0.0.6: version "0.0.6" resolved "https://registry.yarnpkg.com/uid-number/-/uid-number-0.0.6.tgz#0ea10e8035e8eb5b8e4449f06da1c730663baa81" @@ -4954,37 +5145,38 @@ watchpack@^1.3.1: chokidar "^1.4.3" graceful-fs "^4.1.2" -webpack-sources@^0.2.3: - version "0.2.3" - resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-0.2.3.tgz#17c62bfaf13c707f9d02c479e0dcdde8380697fb" +webpack-sources@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-1.0.1.tgz#c7356436a4d13123be2e2426a05d1dad9cbe65cf" dependencies: - source-list-map "^1.1.1" + source-list-map "^2.0.0" source-map "~0.5.3" -webpack@^2.2.1: - version "2.6.1" - resolved "https://registry.yarnpkg.com/webpack/-/webpack-2.6.1.tgz#2e0457f0abb1ac5df3ab106c69c672f236785f07" +webpack@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/webpack/-/webpack-3.0.0.tgz#ee9bcebf21247f7153cb410168cab45e3a59d4d7" dependencies: acorn "^5.0.0" acorn-dynamic-import "^2.0.0" - ajv "^4.7.0" - ajv-keywords "^1.1.1" + ajv "^5.1.5" + ajv-keywords "^2.0.0" async "^2.1.2" enhanced-resolve "^3.0.0" + escope "^3.6.0" interpret "^1.0.0" json-loader "^0.5.4" json5 "^0.5.1" loader-runner "^2.3.0" - loader-utils "^0.2.16" + loader-utils "^1.1.0" memory-fs "~0.4.1" mkdirp "~0.5.0" node-libs-browser "^2.0.0" source-map "^0.5.3" supports-color "^3.1.0" tapable "~0.2.5" - uglify-js "^2.8.27" + uglifyjs-webpack-plugin "^0.4.4" watchpack "^1.3.1" - webpack-sources "^0.2.3" + webpack-sources "^1.0.1" yargs "^6.0.0" whatwg-fetch@>=0.10.0: @@ -4999,7 +5191,11 @@ which-module@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/which-module/-/which-module-1.0.0.tgz#bba63ca861948994ff307736089e3b96026c2a4f" -which@^1.2.10, which@^1.2.8, which@^1.2.9: +which-module@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" + +which@^1.2.10, which@^1.2.4, which@^1.2.8, which@^1.2.9: version "1.2.14" resolved "https://registry.yarnpkg.com/which/-/which-1.2.14.tgz#9a87c4378f03e827cecaf1acdf56c736c01c14e5" dependencies: @@ -5021,7 +5217,7 @@ window-size@0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.1.0.tgz#5438cd2ea93b202efa3a19fe8887aee7c94f9c9d" -wordwrap@0.0.2: +wordwrap@0.0.2, wordwrap@~0.0.2: version "0.0.2" resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.2.tgz#b79669bb42ecb409f83d583cad52ca17eaa1643f" @@ -5102,6 +5298,18 @@ yargs-parser@^4.2.0: dependencies: camelcase "^3.0.0" +yargs-parser@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-5.0.0.tgz#275ecf0d7ffe05c77e64e7c86e4cd94bf0e1228a" + dependencies: + camelcase "^3.0.0" + +yargs-parser@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-7.0.0.tgz#8d0ac42f16ea55debd332caf4c4038b3e3f5dfd9" + dependencies: + camelcase "^4.1.0" + yargs@^6.0.0: version "6.6.0" resolved "https://registry.yarnpkg.com/yargs/-/yargs-6.6.0.tgz#782ec21ef403345f830a808ca3d513af56065208" @@ -5120,6 +5328,24 @@ yargs@^6.0.0: y18n "^3.2.1" yargs-parser "^4.2.0" +yargs@^8.0.1: + version "8.0.2" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-8.0.2.tgz#6299a9055b1cefc969ff7e79c1d918dceb22c360" + dependencies: + camelcase "^4.1.0" + cliui "^3.2.0" + decamelize "^1.1.1" + get-caller-file "^1.0.1" + os-locale "^2.0.0" + read-pkg-up "^2.0.0" + require-directory "^2.1.1" + require-main-filename "^1.0.1" + set-blocking "^2.0.0" + string-width "^2.0.0" + which-module "^2.0.0" + y18n "^3.2.1" + yargs-parser "^7.0.0" + yargs@~3.10.0: version "3.10.0" resolved "https://registry.yarnpkg.com/yargs/-/yargs-3.10.0.tgz#f7ee7bd857dd7c1d2d38c0e74efbd681d1431fd1" From 0da90e825f1c122f7686df342a09f38703c3f2e8 Mon Sep 17 00:00:00 2001 From: tim Date: Wed, 21 Jun 2017 16:04:35 +0200 Subject: [PATCH 25/26] rm () --- test/connection/test_connection.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/connection/test_connection.js b/test/connection/test_connection.js index eb7bf34..8e7e495 100644 --- a/test/connection/test_connection.js +++ b/test/connection/test_connection.js @@ -18,7 +18,7 @@ test('generate API URLS', t => { 'transactionsDetail': 'transactions/%(transactionId)s', 'assets': 'assets', } - Object.keys(endpoints).forEach((endpointName) => { + Object.keys(endpoints).forEach(endpointName => { const url = conn.getApiUrls(endpointName) const expected = API_PATH + endpoints[endpointName] t.is(url, expected) From 1aa430a15cf0a15f6072d91431faf3b9d91303f2 Mon Sep 17 00:00:00 2001 From: tim Date: Wed, 21 Jun 2017 16:23:53 +0200 Subject: [PATCH 26/26] Adjust float interpretation comment --- test/constants.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/constants.js b/test/constants.js index d67d66f..cbfa4c0 100644 --- a/test/constants.js +++ b/test/constants.js @@ -2,8 +2,8 @@ import test from 'ava' import { Transaction, Ed25519Keypair } from '../src' // TODO: Find out if ava has something like conftest, if so put this there. -// NOTE: We cast `Math.random()` to a string, as sometimes Javascript simply -// yields a slightly different float during runtime, lol +// NOTE: It's safer to cast `Math.random()` to a string, to avoid differences +// in "float interpretation" between languages (e.g. JavaScript and Python) export function asset() { return { message: `${Math.random()}` } } export const metaData = { message: 'metaDataMessage' }