Skip to content

Commit 4c82c7e

Browse files
committed
Stable Version 0.2.0.
1 parent 787eae4 commit 4c82c7e

11 files changed

+39
-42
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
##### 0.2.0 - 25 February 2015
2+
3+
- Upgraded dependencies
4+
15
##### 0.1.0 - 05 February 2015
26

37
- Initial Release

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Postgres/MySQL/MariaDB/SQLite3 adapter for [js-data](http://www.js-data.io/).
1111

1212
| Branch | Master |
1313
| ------ | ------ |
14-
| NPM | [![NPM version](https://badge.fury.io/js/js-data-sql.png)](http://badge.fury.io/js/js-data-sql) |
14+
| NPM | [![NPM](https://nodei.co/npm/js-data-sql.png?downloads=true&stars=true)](https://nodei.co/npm/js-data-sql/) |
1515
| Build Status | [![Circle CI](https://circleci.com/gh/js-data/js-data-sql.svg?style=svg)](https://circleci.com/gh/js-data/js-data-sql) |
1616
| Code Climate | [![Code Climate](https://codeclimate.com/github/js-data/js-data-sql.png)](https://codeclimate.com/github/js-data/js-data-sql) |
1717
| Dependency Status | [![Dependency Status](https://gemnasium.com/js-data/js-data-sql.png)](https://gemnasium.com/js-data/js-data-sql) |

package.json

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "js-data-sql",
33
"description": "Postgres/MySQL/MariaDB/SQLite3 adapter for js-data.",
4-
"version": "0.1.0",
4+
"version": "0.2.0",
55
"homepage": "http://www.js-data.io/docs/dssqladapter",
66
"repository": {
77
"type": "git",
@@ -31,26 +31,26 @@
3131
"sqlite"
3232
],
3333
"devDependencies": {
34-
"chai": "1.10.0",
34+
"chai": "2.1.0",
3535
"grunt": "0.4.5",
3636
"grunt-contrib-jshint": "0.11.0",
3737
"grunt-contrib-watch": "0.6.1",
3838
"grunt-karma-coveralls": "2.5.3",
39-
"grunt-mocha-test": "0.12.6",
39+
"grunt-mocha-test": "0.12.7",
4040
"jit-grunt": "0.9.1",
4141
"sinon": "1.12.2",
42-
"time-grunt": "1.0.0"
42+
"time-grunt": "1.1.0"
4343
},
4444
"scripts": {
4545
"test": "grunt test"
4646
},
4747
"dependencies": {
4848
"js-data": ">=1.2.0",
49-
"knex": "^0.7.3",
49+
"knex": "^0.7.4",
5050
"mariasql": "^0.1.21",
5151
"mout": "0.11.0",
52-
"mysql": "^2.5.4",
53-
"pg": "^4.2.0",
54-
"sqlite3": "^3.0.4"
52+
"mysql": "^2.5.5",
53+
"pg": "^4.3.0",
54+
"sqlite3": "^3.0.5"
5555
}
5656
}

src/index.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
var knex = require('knex');
22
var JSData = require('js-data');
3+
var P = JSData.DSUtils.Promise;
34
var contains = require('mout/array/contains');
45
var forOwn = require('mout/object/forOwn');
56
var keys = require('mout/object/keys');
@@ -146,7 +147,7 @@ dsSqlAdapterPrototype.find = function find(resourceConfig, id, options) {
146147
.where(resourceConfig.idAttribute, toString(id))
147148
.then(function (rows) {
148149
if (!rows.length) {
149-
throw new Error('Not Found!');
150+
return P.reject(new Error('Not Found!'));
150151
} else {
151152
instance = rows[0];
152153
var tasks = [];
@@ -186,7 +187,7 @@ dsSqlAdapterPrototype.find = function find(resourceConfig, id, options) {
186187
}
187188
});
188189

189-
return JSData.DSUtils.Promise.all(tasks);
190+
return P.all(tasks);
190191
}
191192
})
192193
.then(function (loadedRelations) {

test/create.spec.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
describe('DSSqlAdapter#create', function () {
2-
it('should create a user in a sql db', function (done) {
2+
it('should create a user in a sql db', function () {
33
var id;
4-
adapter.create(User, { name: 'John' }).then(function (user) {
4+
return adapter.create(User, { name: 'John' }).then(function (user) {
55
id = user.id;
66
assert.equal(user.name, 'John');
77
assert.isDefined(user.id);
@@ -18,11 +18,10 @@ describe('DSSqlAdapter#create', function () {
1818
return adapter.find(User, id);
1919
})
2020
.then(function () {
21-
done('Should not have reached here!');
21+
throw new Error('Should not have reached here!');
2222
})
2323
.catch(function (err) {
2424
assert.equal(err.message, 'Not Found!');
25-
done();
2625
});
2726
});
2827
});

test/destroy.spec.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
describe('DSSqlAdapter#destroy', function () {
2-
it('should destroy a user from a Sql db', function (done) {
2+
it('should destroy a user from a Sql db', function () {
33
var id;
4-
adapter.create(User, { name: 'John' })
4+
return adapter.create(User, { name: 'John' })
55
.then(function (user) {
66
id = user.id;
77
return adapter.destroy(User, user.id);
@@ -11,11 +11,10 @@ describe('DSSqlAdapter#destroy', function () {
1111
return adapter.find(User, id);
1212
})
1313
.then(function () {
14-
done('Should not have reached here!');
14+
throw new Error('Should not have reached here!');
1515
})
1616
.catch(function (err) {
1717
assert.equal(err.message, 'Not Found!');
18-
done();
1918
});
2019
});
2120
});

test/destroyAll.spec.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
describe('DSSqlAdapter#destroyAll', function () {
2-
it('should destroy all items', function (done) {
2+
it('should destroy all items', function () {
33
var id;
4-
adapter.create(User, { name: 'John' })
4+
return adapter.create(User, { name: 'John' })
55
.then(function (user) {
66
id = user.id;
77
return adapter.findAll(User, {
@@ -19,7 +19,6 @@ describe('DSSqlAdapter#destroyAll', function () {
1919
});
2020
}).then(function (users) {
2121
assert.equal(users.length, 0);
22-
done();
23-
}).catch(done);
22+
});
2423
});
2524
});

test/find.spec.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
describe('DSSqlAdapter#find', function () {
2-
it('should find a user in a Sql db', function (done) {
2+
it('should find a user in a Sql db', function () {
33
var id, id2, _user, _post, _comments;
4-
adapter.create(User, { name: 'John' })
4+
return adapter.create(User, { name: 'John' })
55
.then(function (user) {
66
_user = user;
77
id = user.id;
@@ -63,11 +63,10 @@ describe('DSSqlAdapter#find', function () {
6363
return adapter.find(User, id);
6464
})
6565
.then(function () {
66-
done('Should not have reached here!');
66+
throw new Error('Should not have reached here!');
6767
})
6868
.catch(function (err) {
6969
assert.equal(err.message, 'Not Found!');
70-
done();
7170
});
7271
});
7372
});

test/findAll.spec.js

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
describe('DSSqlAdapter#findAll', function () {
2-
it('should filter users', function (done) {
2+
it('should filter users', function () {
33
var id;
44

5-
adapter.findAll(User, {
5+
return adapter.findAll(User, {
66
age: 30
77
}).then(function (users) {
88
assert.equal(users.length, 0);
@@ -18,10 +18,9 @@ describe('DSSqlAdapter#findAll', function () {
1818
return adapter.destroy(User, id);
1919
}).then(function (destroyedUser) {
2020
assert.isFalse(!!destroyedUser);
21-
done();
22-
}).catch(done);
21+
});
2322
});
24-
it('should filter users using the "in" operator', function (done) {
23+
it('should filter users using the "in" operator', function () {
2524
var id;
2625

2726
adapter.findAll(User, {
@@ -44,7 +43,6 @@ describe('DSSqlAdapter#findAll', function () {
4443
return adapter.destroy(User, id);
4544
}).then(function (destroyedUser) {
4645
assert.isFalse(!!destroyedUser);
47-
done();
48-
}).catch(done);
46+
});
4947
});
5048
});

test/update.spec.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
describe('DSSqlAdapter#update', function () {
2-
it('should update a user in a Sql db', function (done) {
2+
it('should update a user in a Sql db', function () {
33
var id;
4-
adapter.create(User, { name: 'John' })
4+
return adapter.create(User, { name: 'John' })
55
.then(function (user) {
66
id = user.id;
77
assert.equal(user.name, 'John');
@@ -31,11 +31,10 @@ describe('DSSqlAdapter#update', function () {
3131
return adapter.find(User, id);
3232
})
3333
.then(function () {
34-
done('Should not have reached here!');
34+
throw new Error('Should not have reached here!');
3535
})
3636
.catch(function (err) {
3737
assert.equal(err.message, 'Not Found!');
38-
done();
3938
});
4039
});
4140
});

test/updateAll.spec.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
describe('DSSqlAdapter#updateAll', function () {
2-
it('should update all items', function (done) {
2+
it('should update all items', function () {
33
var id, id2;
4-
adapter.create(User, { name: 'John', age: 20 })
4+
return adapter.create(User, { name: 'John', age: 20 })
55
.then(function (user) {
66
id = user.id;
77
return adapter.create(User, { name: 'John', age: 30 });
@@ -42,7 +42,6 @@ describe('DSSqlAdapter#updateAll', function () {
4242
return adapter.destroyAll(User);
4343
}).then(function (destroyedUser) {
4444
assert.isFalse(!!destroyedUser);
45-
done();
46-
}).catch(done);
45+
});
4746
});
4847
});

0 commit comments

Comments
 (0)