Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: class exports #4

Merged
merged 2 commits into from
Oct 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
.travis.yml
.travis.yml
.codeclimate.yml
yarn.lock
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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 <jakub@keboola.com>",
Expand Down
4 changes: 1 addition & 3 deletions src/Buckets.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import _ from 'lodash';
import Storage from './Storage';

class Buckets {
export default class Buckets {
storage: Storage;

constructor(storage: Object) {
Expand All @@ -25,5 +25,3 @@ class Buckets {
return this.storage.request('delete', uri);
}
}

module.exports = Buckets;
4 changes: 1 addition & 3 deletions src/Configurations.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import _ from 'lodash';
import Storage from './Storage';

class Configurations {
export default class Configurations {
storage: Storage;

constructor(storage: Object) {
Expand Down Expand Up @@ -47,5 +47,3 @@ class Configurations {
return this.storage.request('delete', `components/${componentName}/configs/${id}`);
}
}

module.exports = Configurations;
4 changes: 1 addition & 3 deletions src/Files.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import _ from 'lodash';
import Storage from './Storage';

class Files {
export default class Files {
storage: Storage;

constructor(storage: Object) {
Expand All @@ -23,5 +23,3 @@ class Files {
return this.storage.request('get', uri);
}
}

module.exports = Files;
4 changes: 1 addition & 3 deletions src/Jobs.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -26,5 +26,3 @@ class Jobs {
throw createError(400, `Storage job ${id} failed with error ${JSON.stringify(res)}`);
}
}

module.exports = Jobs;
4 changes: 1 addition & 3 deletions src/Storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import Tables from './Tables';

axiosRetry(axios, { retries: 5 });

class Storage {
export default class Storage {
baseUri: string;

token: string;
Expand Down Expand Up @@ -74,5 +74,3 @@ class Storage {
return auth;
}
}

module.exports = Storage;
4 changes: 1 addition & 3 deletions src/Tables.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const aws = require('aws-sdk');

axiosRetry(axios, { retries: 5 });

class Tables {
export default class Tables {
storage: Storage;

constructor(storage: Object) {
Expand Down Expand Up @@ -76,5 +76,3 @@ class Tables {
return this.storage.request('delete', `tables/${id}`);
}
}

module.exports = Tables;
6 changes: 3 additions & 3 deletions test/Buckets.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
Expand All @@ -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 }))
Expand All @@ -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 }))
Expand Down
6 changes: 3 additions & 3 deletions test/Configurations.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand All @@ -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');

Expand All @@ -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',
Expand Down
4 changes: 2 additions & 2 deletions test/Tables.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
});
Expand Down