diff --git a/.npmignore b/.npmignore index e623fa5..0e98964 100644 --- a/.npmignore +++ b/.npmignore @@ -1 +1,3 @@ -.travis.yml \ No newline at end of file +.travis.yml +.codeclimate.yml +yarn.lock diff --git a/package.json b/package.json index e09ac25..b56fb34 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@keboola/storage-api-js-client", - "version": "2.2.0", + "version": "2.2.1", "description": "Javascript client for Keboola Storage API", "repository": "https://github.com/keboola/storage-api-js-client", "author": "Jakub Matejka ", diff --git a/src/Buckets.js b/src/Buckets.js index 1616ac0..0de40da 100644 --- a/src/Buckets.js +++ b/src/Buckets.js @@ -2,7 +2,7 @@ import _ from 'lodash'; import Storage from './Storage'; -class Buckets { +export default class Buckets { storage: Storage; constructor(storage: Object) { @@ -25,5 +25,3 @@ class Buckets { return this.storage.request('delete', uri); } } - -module.exports = Buckets; diff --git a/src/Configurations.js b/src/Configurations.js index 0c8329d..299f628 100644 --- a/src/Configurations.js +++ b/src/Configurations.js @@ -2,7 +2,7 @@ import _ from 'lodash'; import Storage from './Storage'; -class Configurations { +export default class Configurations { storage: Storage; constructor(storage: Object) { @@ -47,5 +47,3 @@ class Configurations { return this.storage.request('delete', `components/${componentName}/configs/${id}`); } } - -module.exports = Configurations; diff --git a/src/Files.js b/src/Files.js index 0a4c18e..6658339 100644 --- a/src/Files.js +++ b/src/Files.js @@ -2,7 +2,7 @@ import _ from 'lodash'; import Storage from './Storage'; -class Files { +export default class Files { storage: Storage; constructor(storage: Object) { @@ -23,5 +23,3 @@ class Files { return this.storage.request('get', uri); } } - -module.exports = Files; diff --git a/src/Jobs.js b/src/Jobs.js index b90f0bf..5744fab 100644 --- a/src/Jobs.js +++ b/src/Jobs.js @@ -4,7 +4,7 @@ import createError from 'http-errors'; import sleep from 'sleep-promise'; import Storage from './Storage'; -class Jobs { +export default class Jobs { storage: Storage; constructor(storage: Object) { @@ -26,5 +26,3 @@ class Jobs { throw createError(400, `Storage job ${id} failed with error ${JSON.stringify(res)}`); } } - -module.exports = Jobs; diff --git a/src/Storage.js b/src/Storage.js index 7bdccf1..deff02d 100644 --- a/src/Storage.js +++ b/src/Storage.js @@ -13,7 +13,7 @@ import Tables from './Tables'; axiosRetry(axios, { retries: 5 }); -class Storage { +export default class Storage { baseUri: string; token: string; @@ -74,5 +74,3 @@ class Storage { return auth; } } - -module.exports = Storage; diff --git a/src/Tables.js b/src/Tables.js index cac28d6..17039d0 100644 --- a/src/Tables.js +++ b/src/Tables.js @@ -10,7 +10,7 @@ const aws = require('aws-sdk'); axiosRetry(axios, { retries: 5 }); -class Tables { +export default class Tables { storage: Storage; constructor(storage: Object) { @@ -76,5 +76,3 @@ class Tables { return this.storage.request('delete', `tables/${id}`); } } - -module.exports = Tables; diff --git a/test/Buckets.js b/test/Buckets.js index 0d7e91b..41262eb 100644 --- a/test/Buckets.js +++ b/test/Buckets.js @@ -6,7 +6,7 @@ const expect = require('unexpected'); describe('Storage.Buckets', () => { const storage = new Storage(process.env.KBC_URL, process.env.KBC_TOKEN); - const bucketName1 = `bucket1-${_.random(1000, 2000)}`; + const bucketName1 = `bucket1-${_.random(1000, 20000)}`; const bucketId1 = `in.c-${bucketName1}`; it('create', () => expect(() => storage.request('get', `buckets/${bucketId1}`), 'to be rejected') .then(() => expect(() => storage.Buckets.create('in', bucketName1, { description: bucketName1 }), 'to be fulfilled')) @@ -17,7 +17,7 @@ describe('Storage.Buckets', () => { }) .then(() => storage.request('delete', `buckets/${bucketId1}`))); - const bucketName2 = `bucket2-${_.random(1000, 2000)}`; + const bucketName2 = `bucket2-${_.random(1000, 20000)}`; const bucketId2 = `in.c-${bucketName2}`; it('get', () => expect(() => storage.Buckets.get(bucketId2), 'to be rejected') .then(() => storage.request('post', 'buckets', { stage: 'in', name: bucketName2 })) @@ -31,7 +31,7 @@ describe('Storage.Buckets', () => { .then(() => storage.request('delete', `buckets/${bucketId2}`)) .then(() => expect(() => storage.Buckets.get(bucketId2), 'to be rejected'))); - const bucketName3 = `bucket3-${_.random(1000, 2000)}`; + const bucketName3 = `bucket3-${_.random(1000, 20000)}`; const bucketId3 = `in.c-${bucketName3}`; it('delete', () => expect(() => storage.Buckets.delete(bucketId3), 'to be rejected') .then(() => storage.request('post', 'buckets', { stage: 'in', name: bucketName3 })) diff --git a/test/Configurations.js b/test/Configurations.js index cd44732..8d09e26 100644 --- a/test/Configurations.js +++ b/test/Configurations.js @@ -7,7 +7,7 @@ describe('Storage.Configurations', () => { const storage = new Storage(process.env.KBC_URL, process.env.KBC_TOKEN); const component = process.env.KBC_COMPONENT; - const config1 = `c1-${_.random(1000, 9000)}`; + const config1 = `c1-${_.random(1000, 90000)}`; it('create', async () => { await expect(storage.request('get', `components/${component}/configs/${config1}`), 'to be rejected'); @@ -25,7 +25,7 @@ describe('Storage.Configurations', () => { await storage.request('delete', `components/${component}/configs/${configId}`); }); - const config2 = `c2-${_.random(1000, 9000)}`; + const config2 = `c2-${_.random(1000, 90000)}`; it('get', async () => { await expect(storage.Configurations.get(component, config2), 'to be rejected'); @@ -47,7 +47,7 @@ describe('Storage.Configurations', () => { await storage.request('delete', `components/${component}/configs/${config2}`); }); - const config3 = `c3-${_.random(1000, 9000)}`; + const config3 = `c3-${_.random(1000, 90000)}`; it('delete', async () => { await storage.request( 'post', diff --git a/test/Tables.js b/test/Tables.js index a98d667..c1f6a20 100644 --- a/test/Tables.js +++ b/test/Tables.js @@ -35,9 +35,9 @@ describe('Storage.Tables', () => { let tableName; let tableId; beforeEach(() => { - bucketName = `bucket-${_.random(1000, 2000)}`; + bucketName = `bucket-${_.random(1000, 20000)}`; bucketId = `in.c-${bucketName}`; - tableName = `table-${_.random(1000, 2000)}`; + tableName = `table-${_.random(1000, 20000)}`; tableId = `${bucketId}.${tableName}`; return storage.request('post', 'buckets', { stage: 'in', name: bucketName }); });