Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 05c4e7a

Browse files
committedMar 5, 2015
Stable Version 2.2.2.
Fixes #312 Fixes #313
1 parent 2176abd commit 05c4e7a

File tree

12 files changed

+68
-75
lines changed

12 files changed

+68
-75
lines changed
 

‎.travis.yml

Lines changed: 0 additions & 13 deletions
This file was deleted.

‎CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
##### 2.2.2 - 04 March 2015
2+
3+
###### Backwards compatible bug fixes
4+
- #312 - UMDifying js-data-angular
5+
- #313 - DSHttpAdapter#find/create/update/destroy do not call queryTransform
6+
17
##### 2.2.1 - 25 February 2015
28

39
###### Backwards compatible bug fixes

‎Gruntfile.js

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* js-data-angular
33
* http://github.com/js-data/js-data-angular
44
*
5-
* Copyright (c) 2014 Jason Dobry <http://www.js-data.io/js-data-angular>
5+
* Copyright (c) 2014-2015 Jason Dobry <http://www.js-data.io/docs/js-data-angular>
66
* Licensed under the MIT license. <https://github.com/js-data/js-data-angular/blob/master/LICENSE>
77
*/
88
module.exports = function (grunt) {
@@ -40,7 +40,7 @@ module.exports = function (grunt) {
4040
'* @author Jason Dobry <jason.dobry@gmail.com>\n' +
4141
'* @file js-data-angular.min.js\n' +
4242
'* @version <%= pkg.version %> - Homepage <https://www.js-data.io/js-data-angular/>\n' +
43-
'* @copyright (c) 2014 Jason Dobry <https://github.com/jmdobry/>\n' +
43+
'* @copyright (c) 2014-2015 Jason Dobry <https://github.com/jmdobry/>\n' +
4444
'* @license MIT <https://github.com/js-data/js-data-angular/blob/master/LICENSE>\n' +
4545
'*\n' +
4646
'* @overview Angular wrapper for js-data.\n' +
@@ -49,21 +49,6 @@ module.exports = function (grunt) {
4949
files: {
5050
'dist/js-data-angular.min.js': ['dist/js-data-angular.js']
5151
}
52-
},
53-
scripts: {
54-
files: {
55-
'doc/resources/js/libs.min.js': ['doc/resources/js/libs.js']
56-
}
57-
}
58-
},
59-
browserify: {
60-
options: {
61-
external: ['js-data']
62-
},
63-
dist: {
64-
files: {
65-
'dist/js-data-angular.js': ['src/index.js']
66-
}
6752
}
6853
},
6954
karma: {
@@ -107,29 +92,28 @@ module.exports = function (grunt) {
10792
});
10893

10994
grunt.registerTask('banner', function () {
110-
var file = grunt.file.read('dist/js-data-angular.js');
95+
var file = grunt.file.read('./src/index.js');
11196

11297
var banner = '/**\n' +
11398
'* @author Jason Dobry <jason.dobry@gmail.com>\n' +
11499
'* @file js-data-angular.js\n' +
115-
'* @version ' + pkg.version + ' - Homepage <http://www.js-data.io/js-data-angular/>\n' +
116-
'* @copyright (c) 2014 Jason Dobry <https://github.com/jmdobry/>\n' +
100+
'* @version ' + pkg.version + ' - Homepage <http://www.js-data.io/docs/js-data-angular/>\n' +
101+
'* @copyright (c) 2014-2015 Jason Dobry <https://github.com/jmdobry/>\n' +
117102
'* @license MIT <https://github.com/js-data/js-data-angular/blob/master/LICENSE>\n' +
118103
'*\n' +
119104
'* @overview Angular wrapper for js-data.js.\n' +
120105
'*/\n';
121106

122107
file = banner + file;
123108

124-
grunt.file.write('dist/js-data-angular.js', file);
109+
grunt.file.write('./dist/js-data-angular.js', file);
125110
});
126111

127112
grunt.registerTask('build', [
128113
'clean',
129114
'jshint',
130-
'browserify',
131115
'banner',
132-
'uglify:main'
116+
'uglify'
133117
]);
134118
grunt.registerTask('go', ['build', 'watch:dist']);
135119
grunt.registerTask('default', ['build']);

‎dist/js-data-angular.js

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,32 @@
11
/**
22
* @author Jason Dobry <jason.dobry@gmail.com>
33
* @file js-data-angular.js
4-
* @version 2.2.1 - Homepage <http://www.js-data.io/js-data-angular/>
5-
* @copyright (c) 2014 Jason Dobry <https://github.com/jmdobry/>
4+
* @version 2.2.2 - Homepage <http://www.js-data.io/docs/js-data-angular/>
5+
* @copyright (c) 2014-2015 Jason Dobry <https://github.com/jmdobry/>
66
* @license MIT <https://github.com/js-data/js-data-angular/blob/master/LICENSE>
77
*
88
* @overview Angular wrapper for js-data.js.
99
*/
10-
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
1110
/*jshint loopfunc:true*/
12-
(function (window, angular, undefined) {
11+
(function (root, factory) {
1312
'use strict';
1413

15-
var JSData;
16-
17-
try {
18-
JSData = require('js-data');
19-
} catch (e) {
20-
21-
}
22-
23-
if (!JSData) {
24-
JSData = window.JSData;
14+
if (typeof define === 'function' && define.amd) {
15+
define(['angular', 'js-data'], function (angular, JSData) {
16+
return factory(root, angular, JSData, undefined);
17+
});
18+
} else if (typeof exports === 'object' && typeof module === 'object') {
19+
module.exports = factory(root, require('angular') || root.angular, require('js-data') || root.JSData, undefined);
20+
} else if (typeof exports === 'object') {
21+
exports.jsDataAngularModuleName = factory(root, require('angular') || root.angular, require('js-data') || root.JSData, undefined);
22+
} else {
23+
root.jsDataAngularModuleName = factory(root, root.angular, root.JSData, undefined);
2524
}
25+
}(this, function (window, angular, JSData, undefined) {
26+
'use strict';
2627

27-
if (!JSData) {
28-
throw new Error('js-data must be loaded!');
28+
if (!JSData || !angular) {
29+
throw new Error('js-data and angular must be loaded!');
2930
}
3031

3132
var DSUtils = JSData.DSUtils;
@@ -358,6 +359,8 @@
358359
var _this = this;
359360
options = options || {};
360361
options.suffix = options.suffix || resourceConfig.suffix;
362+
options.params = options.params || {};
363+
options.params = _this.defaults.queryTransform(resourceConfig, options.params);
361364
return _this.GET(
362365
_this.getPath('find', resourceConfig, id, options),
363366
options
@@ -393,6 +396,8 @@
393396
var _this = this;
394397
options = options || {};
395398
options.suffix = options.suffix || resourceConfig.suffix;
399+
options.params = options.params || {};
400+
options.params = _this.defaults.queryTransform(resourceConfig, options.params);
396401
return _this.POST(
397402
_this.getPath('create', resourceConfig, attrs, options),
398403
(options.serialize ? options.serialize : _this.defaults.serialize)(resourceConfig, attrs),
@@ -406,6 +411,8 @@
406411
var _this = this;
407412
options = options || {};
408413
options.suffix = options.suffix || resourceConfig.suffix;
414+
options.params = options.params || {};
415+
options.params = _this.defaults.queryTransform(resourceConfig, options.params);
409416
return _this.PUT(
410417
_this.getPath('update', resourceConfig, id, options),
411418
(options.serialize ? options.serialize : _this.defaults.serialize)(resourceConfig, attrs),
@@ -438,6 +445,8 @@
438445
var _this = this;
439446
options = options || {};
440447
options.suffix = options.suffix || resourceConfig.suffix;
448+
options.params = options.params || {};
449+
options.params = _this.defaults.queryTransform(resourceConfig, options.params);
441450
return _this.DEL(
442451
_this.getPath('destroy', resourceConfig, id, options),
443452
options
@@ -472,7 +481,7 @@
472481
var _this = this;
473482
var start = new Date();
474483
config = deepMixIn(config, _this.defaults.httpConfig);
475-
if (_this.defaults.forceTrailingSlash && config.url[config.url.length-1] !== '/') {
484+
if (_this.defaults.forceTrailingSlash && config.url[config.url.length - 1] !== '/') {
476485
config.url += '/';
477486
}
478487
config.method = config.method.toUpperCase();
@@ -513,6 +522,6 @@
513522
}]);
514523
}
515524

516-
})(window, window.angular);
517-
518-
},{"js-data":"js-data"}]},{},[1]);
525+
// return the module name
526+
return 'js-data';
527+
}));

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

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "js-data-angular",
33
"description": "Angular wrapper for js-data.",
4-
"version": "2.2.1",
4+
"version": "2.2.2",
55
"homepage": "http://www.js-data.io/docs/js-data-angular",
66
"repository": {
77
"type": "git",
@@ -21,7 +21,6 @@
2121
"main": "src/index.js",
2222
"devDependencies": {
2323
"grunt": "0.4.5",
24-
"grunt-browserify": "3.4.0",
2524
"grunt-contrib-clean": "0.6.0",
2625
"grunt-contrib-jshint": "0.11.0",
2726
"grunt-contrib-uglify": "0.8.0",
@@ -45,7 +44,6 @@
4544
"test": "grunt test"
4645
},
4746
"dependencies": {
48-
"mout": "0.11.0",
4947
"js-data": ">=1.1.0"
5048
}
5149
}

‎src/index.js

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,17 @@
33
'use strict';
44

55
if (typeof define === 'function' && define.amd) {
6-
define(['angular', 'js-data'], function(angular, JSData) {
6+
define(['angular', 'js-data'], function (angular, JSData) {
77
return factory(root, angular, JSData, undefined);
88
});
9-
} else if (typeof module !== 'undefined' && module.exports) {
10-
module.exports = factory(root, require('angular') || root.angular, require('js-data'), undefined);
9+
} else if (typeof exports === 'object' && typeof module === 'object') {
10+
module.exports = factory(root, require('angular') || root.angular, require('js-data') || root.JSData, undefined);
11+
} else if (typeof exports === 'object') {
12+
exports.jsDataAngularModuleName = factory(root, require('angular') || root.angular, require('js-data') || root.JSData, undefined);
1113
} else {
1214
root.jsDataAngularModuleName = factory(root, root.angular, root.JSData, undefined);
1315
}
14-
}(this, function(window, angular, JSData, undefined) {
16+
}(this, function (window, angular, JSData, undefined) {
1517
'use strict';
1618

1719
if (!JSData || !angular) {
@@ -348,6 +350,8 @@
348350
var _this = this;
349351
options = options || {};
350352
options.suffix = options.suffix || resourceConfig.suffix;
353+
options.params = options.params || {};
354+
options.params = _this.defaults.queryTransform(resourceConfig, options.params);
351355
return _this.GET(
352356
_this.getPath('find', resourceConfig, id, options),
353357
options
@@ -383,6 +387,8 @@
383387
var _this = this;
384388
options = options || {};
385389
options.suffix = options.suffix || resourceConfig.suffix;
390+
options.params = options.params || {};
391+
options.params = _this.defaults.queryTransform(resourceConfig, options.params);
386392
return _this.POST(
387393
_this.getPath('create', resourceConfig, attrs, options),
388394
(options.serialize ? options.serialize : _this.defaults.serialize)(resourceConfig, attrs),
@@ -396,6 +402,8 @@
396402
var _this = this;
397403
options = options || {};
398404
options.suffix = options.suffix || resourceConfig.suffix;
405+
options.params = options.params || {};
406+
options.params = _this.defaults.queryTransform(resourceConfig, options.params);
399407
return _this.PUT(
400408
_this.getPath('update', resourceConfig, id, options),
401409
(options.serialize ? options.serialize : _this.defaults.serialize)(resourceConfig, attrs),
@@ -428,6 +436,8 @@
428436
var _this = this;
429437
options = options || {};
430438
options.suffix = options.suffix || resourceConfig.suffix;
439+
options.params = options.params || {};
440+
options.params = _this.defaults.queryTransform(resourceConfig, options.params);
431441
return _this.DEL(
432442
_this.getPath('destroy', resourceConfig, id, options),
433443
options
@@ -462,7 +472,7 @@
462472
var _this = this;
463473
var start = new Date();
464474
config = deepMixIn(config, _this.defaults.httpConfig);
465-
if (_this.defaults.forceTrailingSlash && config.url[config.url.length-1] !== '/') {
475+
if (_this.defaults.forceTrailingSlash && config.url[config.url.length - 1] !== '/') {
466476
config.url += '/';
467477
}
468478
config.method = config.method.toUpperCase();
@@ -502,8 +512,7 @@
502512
DS.registerAdapter('http', DSHttpAdapter, { default: true });
503513
}]);
504514
}
505-
515+
506516
// return the module name
507517
return 'js-data';
508-
509-
});
518+
}));

‎test/adapters/http/create.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@ describe('DSHttpAdapter.create', function () {
3131

3232
$httpBackend.flush();
3333

34-
assert.equal(lifecycle.queryTransform.callCount, 0, 'queryTransform should not have been called');
34+
assert.equal(lifecycle.queryTransform.callCount, 2, 'queryTransform should have been called twice');
3535
});
3636
});

‎test/adapters/http/destroy.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ describe('DSHttpAdapter.destroy', function () {
2525

2626
$httpBackend.flush();
2727

28-
assert.equal(lifecycle.queryTransform.callCount, 0, 'queryTransform should not have been called');
28+
assert.equal(lifecycle.queryTransform.callCount, 2, 'queryTransform should have been called twice');
2929
});
3030
});

‎test/adapters/http/find.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ describe('DSHttpAdapter.find', function () {
2525

2626
$httpBackend.flush();
2727

28-
assert.equal(lifecycle.queryTransform.callCount, 0, 'queryTransform should not have been called');
28+
assert.equal(lifecycle.queryTransform.callCount, 2, 'queryTransform should have been called twice');
2929
});
3030

3131
it('should error if the item is undefined', function () {

‎test/adapters/http/update.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@ describe('DSHttpAdapter.update', function () {
3131

3232
$httpBackend.flush();
3333

34-
assert.equal(lifecycle.queryTransform.callCount, 0, 'queryTransform should not have been called');
34+
assert.equal(lifecycle.queryTransform.callCount, 2, 'queryTransform should have been called twice');
3535
});
3636
});

0 commit comments

Comments
 (0)
Please sign in to comment.