Skip to content

Commit 589e045

Browse files
committed
Stable Version 2.0.0
1 parent 4770d0f commit 589e045

File tree

8 files changed

+246
-250
lines changed

8 files changed

+246
-250
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
##### 2.0.0 - 02 July 2015
2+
3+
Stable Version 2.0.0
4+
15
##### 1.1.0 - 27 March 2015
26

37
###### Backwards compatible API changes

Gruntfile.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,7 @@ module.exports = function (grunt) {
4747
externals: [
4848
'mout/string/underscore',
4949
'mout/random/guid',
50-
'mout/object/omit',
5150
'js-data',
52-
'js-data-schema',
5351
'redis'
5452
],
5553
module: {

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ store.registerAdapter('redis', adapter, { default: true });
3939
[CHANGELOG.md](https://github.com/js-data/js-data-redis/blob/master/CHANGELOG.md)
4040

4141
### Community
42+
- [Gitter Channel](https://gitter.im/js-data/js-data) - Better than IRC!
43+
- [Announcements](http://www.js-data.io/blog)
4244
- [Mailing List](https://groups.io/org/groupsio/jsdata) - Ask your questions!
4345
- [Issues](https://github.com/js-data/js-data-redis/issues) - Found a bug? Feature request? Submit an issue!
4446
- [GitHub](https://github.com/js-data/js-data-redis) - View the source code for js-data.

dist/js-data-redis.js

Lines changed: 209 additions & 219 deletions
Large diffs are not rendered by default.

mocha.start.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ var mocha = require('mocha');
66
var sinon = require('sinon');
77
var DSRedisAdapter = require('./');
88
var JSData = require('js-data');
9+
JSData.DSUtils.Promise = require('bluebird');
910

1011
var adapter, store, DSUtils, DSErrors, User, Post, Comment;
1112

package.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "js-data-redis",
33
"description": "Redis adapter for js-data.",
4-
"version": "1.1.0",
4+
"version": "2.0.0",
55
"homepage": "http://www.js-data.io/docs/dsredisadapter",
66
"repository": {
77
"type": "git",
@@ -27,21 +27,21 @@
2727
"redis"
2828
],
2929
"devDependencies": {
30-
"babel-core": "4.7.16",
31-
"babel-loader": "4.2.0",
32-
"chai": "2.1.1",
30+
"babel-core": "5.6.15",
31+
"babel-loader": "5.2.2",
32+
"bluebird": "2.9.30",
33+
"chai": "3.0.0",
3334
"grunt": "0.4.5",
3435
"grunt-contrib-watch": "0.6.1",
3536
"grunt-karma-coveralls": "2.5.3",
3637
"grunt-mocha-test": "0.12.7",
37-
"grunt-webpack": "1.0.8",
38+
"grunt-webpack": "1.0.11",
3839
"jit-grunt": "0.9.1",
39-
"jshint": "2.6.3",
40+
"jshint": "2.8.0",
4041
"jshint-loader": "0.8.3",
41-
"sinon": "1.13.0",
42-
"time-grunt": "1.1.0",
43-
"webpack": "1.7.3",
44-
"webpack-dev-server": "1.7.0"
42+
"sinon": "1.15.4",
43+
"time-grunt": "1.2.1",
44+
"webpack-dev-server": "1.10.1"
4545
},
4646
"scripts": {
4747
"test": "grunt test"
@@ -50,7 +50,7 @@
5050
"mout": "0.11.0"
5151
},
5252
"peerDependencies": {
53-
"js-data": ">=1.5.7",
53+
"js-data": ">=2.0.0",
5454
"redis": ">=0.12.1"
5555
}
5656
}

src/index.js

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
import JSData from 'js-data';
2-
import redis from 'redis';
3-
import underscore from 'mout/string/underscore';
4-
import guid from 'mout/random/guid';
5-
import omit from 'mout/object/omit';
1+
let JSData = require('js-data');
2+
let redis = require('redis');
3+
let underscore = require('mout/string/underscore');
4+
let guid = require('mout/random/guid');
65
let { DSUtils } = JSData;
7-
let { Promise: P, deepMixIn, removeCircular, forEach, contains } = DSUtils;
6+
let { deepMixIn, removeCircular, forEach, contains, omit } = DSUtils;
87
let emptyStore = new JSData.DS();
98
let filter = emptyStore.defaults.defaultFilter;
109

@@ -27,20 +26,20 @@ class DSRedisAdapter {
2726
}
2827

2928
getIds(resourceConfig) {
30-
return new P((resolve, reject) => {
29+
return new DSUtils.Promise((resolve, reject) => {
3130
return this.client.SMEMBERS(getPath(resourceConfig), (err, ids) => err ? reject(err) : resolve(ids));
3231
});
3332
}
3433

3534
GET(path) {
36-
return new P((resolve, reject) => {
35+
return new DSUtils.Promise((resolve, reject) => {
3736
return this.client.GET(path, (err, value) => err ? reject(err) : resolve(JSON.parse(value)));
3837
});
3938
}
4039

4140
find(resourceConfig, id, options) {
4241
let fields = [];
43-
return new P((resolve, reject) => {
42+
return new DSUtils.Promise((resolve, reject) => {
4443
options = options || {};
4544
return this.client.GET(`${getPath(resourceConfig)}-${id}`, (err, item) => {
4645
if (err) {
@@ -91,7 +90,7 @@ class DSRedisAdapter {
9190
}
9291
});
9392
if (tasks.length) {
94-
return P.all(tasks).then(loadedRelations => {
93+
return DSUtils.Promise.all(tasks).then(loadedRelations => {
9594
forEach(fields, (field, index) => {
9695
instance[field] = loadedRelations[index];
9796
});
@@ -108,7 +107,7 @@ class DSRedisAdapter {
108107
let tasks = [];
109108
let path = getPath(resourceConfig);
110109
forEach(ids, id => tasks.push(this.GET(`${path}-${id}`)));
111-
return P.all(tasks);
110+
return DSUtils.Promise.all(tasks);
112111
})
113112
.then(items => filter.call(emptyStore, items, resourceConfig.name, params, { allowSimpleWhere: true }))
114113
.then(items => {
@@ -154,7 +153,7 @@ class DSRedisAdapter {
154153
}
155154
});
156155
if (tasks.length) {
157-
topTasks.push(P.all(tasks).then(loadedRelations => {
156+
topTasks.push(DSUtils.Promise.all(tasks).then(loadedRelations => {
158157
forEach(fields, (field, index) => {
159158
instance[field] = loadedRelations[index];
160159
});
@@ -163,14 +162,14 @@ class DSRedisAdapter {
163162
}
164163
});
165164
if (topTasks.length) {
166-
return P.all(topTasks);
165+
return DSUtils.Promise.all(topTasks);
167166
}
168167
return items;
169168
});
170169
}
171170

172171
create(resourceConfig, attrs) {
173-
return new P((resolve, reject) => {
172+
return new DSUtils.Promise((resolve, reject) => {
174173
attrs = removeCircular(omit(attrs, resourceConfig.relationFields || []));
175174
attrs[resourceConfig.idAttribute] = attrs[resourceConfig.idAttribute] || guid();
176175
return this.client
@@ -182,7 +181,7 @@ class DSRedisAdapter {
182181
}
183182

184183
update(resourceConfig, id, attrs) {
185-
return new P((resolve, reject) => {
184+
return new DSUtils.Promise((resolve, reject) => {
186185
attrs = removeCircular(omit(attrs, resourceConfig.relationFields || []));
187186
let path = `${getPath(resourceConfig)}-${id}`;
188187
return this.client.GET(path, (err, value) => {
@@ -203,12 +202,12 @@ class DSRedisAdapter {
203202
return this.findAll(resourceConfig, params).then(items => {
204203
let tasks = [];
205204
forEach(items, item => tasks.push(this.update(resourceConfig, item[resourceConfig.idAttribute], attrs)));
206-
return P.all(tasks);
205+
return DSUtils.Promise.all(tasks);
207206
});
208207
}
209208

210209
destroy(resourceConfig, id) {
211-
return new P((resolve, reject) => {
210+
return new DSUtils.Promise((resolve, reject) => {
212211
let path = getPath(resourceConfig);
213212
return this.client
214213
.multi()
@@ -222,7 +221,7 @@ class DSRedisAdapter {
222221
return this.findAll(resourceConfig, params).then(items => {
223222
let tasks = [];
224223
forEach(items, item => tasks.push(this.destroy(resourceConfig, item[resourceConfig.idAttribute])));
225-
return P.all(tasks);
224+
return DSUtils.Promise.all(tasks);
226225
});
227226
}
228227
}

test/find.spec.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
var Promise = require('bluebird');
2+
13
describe('DSRedisAdapter#find', function () {
24
it('should find a user in Redis', function () {
35
var id, id2, _user, _post, _comments;

0 commit comments

Comments
 (0)