diff --git a/.travis.yml b/.travis.yml index 3ef3e9a..4308ace 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,12 @@ language: node_js cache: npm +dist: bionic + +branches: + only: + - master + - /^release\/.*$/ + stages: - check - test @@ -14,7 +21,7 @@ os: - osx - windows -script: npx nyc -s npm run test:node -- --bail +script: npx aegir test -t node --cov --bail after_success: npx nyc report --reporter=text-lcov > coverage.lcov && npx codecov jobs: @@ -34,8 +41,7 @@ jobs: name: firefox addons: firefox: latest - script: npx aegir test -t browser -- --browsers FirefoxHeadless + script: npx aegir test -t browser -- --browser firefox notifications: email: false - diff --git a/package.json b/package.json index 7862e7e..325de9a 100644 --- a/package.json +++ b/package.json @@ -35,21 +35,23 @@ }, "homepage": "https://github.com/ipfs/js-datastore-s3#readme", "dependencies": { - "buffer": "^5.6.0", - "datastore-core": "^2.0.0", - "interface-datastore": "^2.0.0" + "buffer": "^6.0.3", + "datastore-core": "^3.0.0", + "interface-datastore": "^3.0.5" }, "devDependencies": { - "aegir": "^26.0.0", + "aegir": "^33.0.0", + "assert": "^2.0.0", "aws-sdk": "^2.579.0", "chai": "^4.2.0", "dirty-chai": "^2.0.1", - "ipfs-repo": "^6.0.3", - "stand-in": "^4.2.0" + "ipfs-repo": "9.0.0", + "stand-in": "^4.2.0", + "util": "^0.12.3" }, "peerDependencies": { "aws-sdk": "2.x", - "ipfs-repo": "^6.0.3" + "ipfs-repo": "^9.0.0" }, "contributors": [ "Jacob Heun ", diff --git a/src/index.js b/src/index.js index 76917c8..160a87a 100644 --- a/src/index.js +++ b/src/index.js @@ -47,8 +47,9 @@ class S3Datastore extends Adapter { /** * Returns the full key which includes the path to the ipfs store + * * @param {Key} key - * @returns {String} + * @returns {string} */ _getFullKey (key) { // Avoid absolute paths with s3 @@ -168,6 +169,7 @@ class S3Datastore extends Adapter { /** * Recursively fetches all keys from s3 + * * @param {Object} params * @returns {Iterator} */ @@ -184,7 +186,7 @@ class S3Datastore extends Adapter { yield new Key(d.Key.slice(this.path.length), false) } - // If we didnt get all records, recursively query + // If we didn't get all records, recursively query if (data.isTruncated) { // If NextMarker is absent, use the key from the last result params.StartAfter = data.Contents[data.Contents.length - 1].Key @@ -242,13 +244,13 @@ class S3Datastore extends Adapter { Key: this.path }).promise() } catch (err) { - if (err.statusCode === 404) { - return this.put(new Key('/', false), Uint8Array.from('')) + if (err.statusCode !== 404) { + throw Errors.dbOpenFailedError(err) } - - throw Errors.dbOpenFailedError(err) } } + + close () {} } module.exports = S3Datastore diff --git a/src/s3-repo.js b/src/s3-repo.js index f782ff4..3013fde 100644 --- a/src/s3-repo.js +++ b/src/s3-repo.js @@ -15,6 +15,7 @@ const notALock = { /** * A convenience method for creating an S3 backed IPFS repo + * * @param {Object} S3Store * @param {Object} options * @param {Object} s3Options diff --git a/test/utils/s3-mock.js b/test/utils/s3-mock.js index b9cbb0b..d756690 100644 --- a/test/utils/s3-mock.js +++ b/test/utils/s3-mock.js @@ -20,6 +20,7 @@ const s3Reject = (err) => ({ promise: () => Promise.reject(err) }) /** * Mocks out the s3 calls made by datastore-s3 + * * @param {S3Instance} s3 * @returns {void} */