Skip to content

Commit 0bbc68e

Browse files
committedMar 5, 2015
Stable Version 1.2.2.
Fixes #10
1 parent af81d23 commit 0bbc68e

12 files changed

+2325
-2147
lines changed
 

‎.travis.yml

-13
This file was deleted.

‎CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
##### 1.2.2 - 04 March 2015
2+
3+
###### Backwards compatible bug fixes
4+
- #10 - DSHttpAdapter#find does not call queryTransform
5+
6+
###### Other
7+
- Switched build to webpack. UMD should actually work now.
8+
19
##### 1.2.1 - 25 February 2015
210

311
###### Backwards compatible bug fixes

‎Gruntfile.js

+26-15
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* js-data-http
33
* http://github.com/js-data/js-data-http
44
*
5-
* Copyright (c) 2014 Jason Dobry <http://www.js-data.io/js-data-http>
5+
* Copyright (c) 2014-2015 Jason Dobry <http://www.js-data.io/js-data-http>
66
* Licensed under the MIT license. <https://github.com/js-data/js-data-http/blob/master/LICENSE>
77
*/
88
module.exports = function (grunt) {
@@ -42,27 +42,38 @@ module.exports = function (grunt) {
4242
'* @author Jason Dobry <jason.dobry@gmail.com>\n' +
4343
'* @file js-data-http.min.js\n' +
4444
'* @version <%= pkg.version %> - Homepage <http://www.js-data.io/docs/dshttpadapter>\n' +
45-
'* @copyright (c) 2014 Jason Dobry\n' +
45+
'* @copyright (c) 2014-2015 Jason Dobry\n' +
4646
'* @license MIT <https://github.com/js-data/js-data-http/blob/master/LICENSE>\n' +
4747
'*\n' +
48-
'* @overview My Adapter.\n' +
48+
'* @overview Http adapter for js-data.\n' +
4949
'*/\n'
5050
},
5151
files: {
5252
'dist/js-data-http.min.js': ['dist/js-data-http.js']
5353
}
5454
}
5555
},
56-
browserify: {
57-
options: {
58-
browserifyOptions: {
59-
standalone: 'DSHttpAdapter'
60-
},
61-
external: ['js-data']
62-
},
56+
webpack: {
6357
dist: {
64-
files: {
65-
'dist/js-data-http.js': ['src/index.js']
58+
entry: './src/index.js',
59+
output: {
60+
filename: './dist/js-data-http.js',
61+
libraryTarget: 'umd',
62+
library: 'DSHttpAdapter'
63+
},
64+
externals: {
65+
'js-data': {
66+
amd: 'js-data',
67+
commonjs: 'js-data',
68+
commonjs2: 'js-data',
69+
root: 'JSData'
70+
},
71+
'js-data-schema': {
72+
amd: 'js-data-schema',
73+
commonjs: 'js-data-schema',
74+
commonjs2: 'js-data-schema',
75+
root: 'Schemator'
76+
}
6677
}
6778
}
6879
},
@@ -114,10 +125,10 @@ module.exports = function (grunt) {
114125
'* @author Jason Dobry <jason.dobry@gmail.com>\n' +
115126
'* @file js-data-http.js\n' +
116127
'* @version ' + pkg.version + ' - Homepage <http://www.js-data.io/docs/dshttpadapter>\n' +
117-
'* @copyright (c) 2014 Jason Dobry \n' +
128+
'* @copyright (c) 2014-2015 Jason Dobry \n' +
118129
'* @license MIT <https://github.com/js-data/js-data-http/blob/master/LICENSE>\n' +
119130
'*\n' +
120-
'* @overview My Adapter.\n' +
131+
'* @overview Http adapter for js-data.\n' +
121132
'*/\n';
122133

123134
file = banner + file;
@@ -129,7 +140,7 @@ module.exports = function (grunt) {
129140
grunt.registerTask('build', [
130141
'clean',
131142
'jshint',
132-
'browserify',
143+
'webpack',
133144
'banner',
134145
'uglify:main'
135146
]);

‎dist/js-data-http.js

+2,257-2,099
Large diffs are not rendered by default.

‎dist/js-data-http.min.js

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/js-data-http.min.map

+1-1
Large diffs are not rendered by default.

‎package.json

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "js-data-http",
33
"description": "http adapter for js-data.",
4-
"version": "1.2.1",
4+
"version": "1.2.2",
55
"homepage": "http://www.js-data.io/docs/dshttpadapter",
66
"repository": {
77
"type": "git",
@@ -20,25 +20,27 @@
2020
"main": "./src/index.js",
2121
"devDependencies": {
2222
"grunt": "0.4.5",
23-
"grunt-browserify": "3.4.0",
2423
"grunt-contrib-clean": "0.6.0",
2524
"grunt-contrib-jshint": "0.11.0",
2625
"grunt-contrib-uglify": "0.8.0",
2726
"grunt-contrib-watch": "0.6.1",
2827
"grunt-karma": "0.10.1",
2928
"grunt-karma-coveralls": "2.5.3",
29+
"grunt-webpack": "^1.0.8",
30+
"jit-grunt": "0.9.1",
3031
"karma": "0.12.31",
3132
"karma-chai": "0.1.0",
3233
"karma-chrome-launcher": "0.1.7",
3334
"karma-coverage": "0.2.7",
34-
"karma-script-launcher": "0.1.0",
3535
"karma-firefox-launcher": "0.1.4",
36-
"karma-phantomjs-launcher": "0.1.4",
3736
"karma-mocha": "0.1.10",
37+
"karma-phantomjs-launcher": "0.1.4",
38+
"karma-script-launcher": "0.1.0",
3839
"karma-sinon": "1.0.4",
3940
"karma-spec-reporter": "0.0.16",
4041
"time-grunt": "1.1.0",
41-
"jit-grunt": "0.9.1"
42+
"webpack": "^1.7.2",
43+
"webpack-dev-server": "^1.7.0"
4244
},
4345
"scripts": {
4446
"test": "grunt test"

‎src/index.js

+8
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,8 @@ dsHttpAdapterPrototype.find = function (resourceConfig, id, options) {
155155
var _this = this;
156156
options = options || {};
157157
options.suffix = options.suffix || resourceConfig.suffix;
158+
options.params = options.params || {};
159+
options.params = _this.defaults.queryTransform(resourceConfig, options.params);
158160
return _this.GET(
159161
_this.getPath('find', resourceConfig, id, options),
160162
options
@@ -190,6 +192,8 @@ dsHttpAdapterPrototype.create = function (resourceConfig, attrs, options) {
190192
var _this = this;
191193
options = options || {};
192194
options.suffix = options.suffix || resourceConfig.suffix;
195+
options.params = options.params || {};
196+
options.params = _this.defaults.queryTransform(resourceConfig, options.params);
193197
return _this.POST(
194198
_this.getPath('create', resourceConfig, attrs, options),
195199
options.serialize ? options.serialize(resourceConfig, attrs) : _this.defaults.serialize(resourceConfig, attrs),
@@ -203,6 +207,8 @@ dsHttpAdapterPrototype.update = function (resourceConfig, id, attrs, options) {
203207
var _this = this;
204208
options = options || {};
205209
options.suffix = options.suffix || resourceConfig.suffix;
210+
options.params = options.params || {};
211+
options.params = _this.defaults.queryTransform(resourceConfig, options.params);
206212
return _this.PUT(
207213
_this.getPath('update', resourceConfig, id, options),
208214
options.serialize ? options.serialize(resourceConfig, attrs) : _this.defaults.serialize(resourceConfig, attrs),
@@ -235,6 +241,8 @@ dsHttpAdapterPrototype.destroy = function (resourceConfig, id, options) {
235241
var _this = this;
236242
options = options || {};
237243
options.suffix = options.suffix || resourceConfig.suffix;
244+
options.params = options.params || {};
245+
options.params = _this.defaults.queryTransform(resourceConfig, options.params);
238246
return _this.DEL(
239247
_this.getPath('destroy', resourceConfig, id, options),
240248
options

‎test/create.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ describe('DSHttpAdapter.create(resourceConfig, attrs, options)', function () {
99
dsHttpAdapter.create(Post, { author: 'John', age: 30 }, { basePath: 'api2' }).then(function (data) {
1010
assert.deepEqual(data, p1, 'post should have been created');
1111

12-
assert.equal(queryTransform.callCount, 0, 'queryTransform should not have been called');
12+
assert.equal(queryTransform.callCount, 2, 'queryTransform should have been called twice');
1313

1414
done();
1515
}).catch(function (err) {

‎test/destroy.spec.js

+11-7
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,27 @@ describe('DSHttpAdapter.destroy(resourceConfig, id, options)', function () {
88

99
dsHttpAdapter.destroy(Post, 1, { basePath: 'api2' }).then(function (data) {
1010
assert.deepEqual(data, '1', 'post should have been deleted');
11-
assert.equal(queryTransform.callCount, 0, 'queryTransform should not have been called');
11+
assert.equal(queryTransform.callCount, 2, 'queryTransform should have been called twice');
1212
done();
1313
}).catch(function (err) {
1414
console.error(err.stack);
15-
done('should not have rejected');
15+
done(err);
1616
});
1717

1818
setTimeout(function () {
19-
assert.equal(2, _this.requests.length);
20-
assert.equal(_this.requests[1].url, 'api2/posts/1');
21-
assert.equal(_this.requests[1].method, 'DELETE');
22-
_this.requests[1].respond(200, {'Content-Type': 'text/plain'}, '1');
19+
try {
20+
assert.equal(2, _this.requests.length);
21+
assert.equal(_this.requests[1].url, 'api2/posts/1');
22+
assert.equal(_this.requests[1].method, 'DELETE');
23+
_this.requests[1].respond(200, {'Content-Type': 'text/plain'}, '1');
24+
} catch (err) {
25+
done(err);
26+
}
2327
}, 10);
2428

2529
}).catch(function (err) {
2630
console.error(err.stack);
27-
done('should not have rejected');
31+
done(err);
2832
});
2933

3034
setTimeout(function () {

‎test/find.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ describe('DSHttpAdapter.find(resourceConfig, id, options)', function () {
88

99
dsHttpAdapter.find(Post, 1, { basePath: 'api2' }).then(function (data) {
1010
assert.deepEqual(data, p1, 'post should have been found');
11-
assert.equal(queryTransform.callCount, 0, 'queryTransform should not have been called');
11+
assert.equal(queryTransform.callCount, 2, 'queryTransform should have been called twice');
1212
done();
1313
}).catch(function (err) {
1414
console.error(err.stack);

‎test/update.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ describe('DSHttpAdapter.update(resourceConfig, id, attrs, options)', function ()
88

99
dsHttpAdapter.update(Post, 1, { author: 'John', age: 30 }, { basePath: 'api2' }).then(function (data) {
1010
assert.deepEqual(data, p1, 'post 5 should have been updated');
11-
assert.equal(queryTransform.callCount, 0, 'queryTransform should not have been called');
11+
assert.equal(queryTransform.callCount, 2, 'queryTransform should have been called twice');
1212
done();
1313
}).catch(function (err) {
1414
console.error(err.stack);

0 commit comments

Comments
 (0)
Please sign in to comment.