From 5abd4e98ab3a1bc42adde91a78845df910256ed7 Mon Sep 17 00:00:00 2001 From: guylabs Date: Fri, 20 Mar 2015 12:59:25 +0100 Subject: [PATCH] Update dependencies --- bower.json | 6 +++--- dist/angular-spring-data-rest.js | 28 +++++----------------------- dist/angular-spring-data-rest.min.js | 21 ++++++++------------- package.json | 20 ++++++++++---------- 4 files changed, 26 insertions(+), 49 deletions(-) diff --git a/bower.json b/bower.json index e9d8b5a..a90f80e 100644 --- a/bower.json +++ b/bower.json @@ -33,10 +33,10 @@ "url": "https://github.com/guylabs/angular-spring-data-rest.git" }, "dependencies": { - "angular": "~1.3.0", - "angular-resource": "~1.3.0" + "angular": "~1.3.15", + "angular-resource": "~1.3.15" }, "devDependencies": { - "angular-mocks": "~1.3.0" + "angular-mocks": "~1.3.15" } } diff --git a/dist/angular-spring-data-rest.js b/dist/angular-spring-data-rest.js index 79a459e..6d5c531 100644 --- a/dist/angular-spring-data-rest.js +++ b/dist/angular-spring-data-rest.js @@ -139,10 +139,7 @@ angular.module("spring-data-rest").provider("SpringDataRestAdapter", function () var processData = function processDataFunction(promiseOrData, fetchLinkNames, recursive) { // convert the given promise or data to a $q promise - var promise = $injector.get("$q").when(promiseOrData); - var deferred = $injector.get("$q").defer(); - - promise.then(function (data) { + return $injector.get("$q").when(promiseOrData).then(function (data) { /** * Wraps the Angular $resource method and adds the ability to retrieve the available resources. If no @@ -221,14 +218,12 @@ angular.module("spring-data-rest").provider("SpringDataRestAdapter", function () // throw an exception if given data parameter is not of type object if (!angular.isObject(data) || data instanceof Array) { - deferred.reject("Given data '" + data + "' is not of type object."); - return; + return $injector.get("$q").reject("Given data '" + data + "' is not of type object."); } // throw an exception if given fetch links parameter is not of type array or string if (fetchLinkNames && !(fetchLinkNames instanceof Array || typeof fetchLinkNames === "string")) { - deferred.reject("Given fetch links '" + fetchLinkNames + "' is not of type array or string."); - return; + return $injector.get("$q").reject("Given fetch links '" + fetchLinkNames + "' is not of type array or string."); } var processedData = undefined; @@ -307,26 +302,13 @@ angular.module("spring-data-rest").provider("SpringDataRestAdapter", function () }); } - $injector.get("$q").all(promisesArray).then(function () { + return $injector.get("$q").all(promisesArray).then(function () { // return the original data object if no processing is done - deferred.resolve(processedData ? processedData : data); - }, function (error) { - deferred.reject(error); - - // reject the error because we do not handle the error here - return $injector.get("$q").reject(error); + return processedData ? processedData : data; }); - }, function (error) { - deferred.reject(error); - - // reject the error because we do not handle the error here - return $injector.get("$q").reject(error); }); - // return the promise - return deferred.promise; - /** * Gets the processed URL of the given resource name form the given data object. * @param {object} data the given data object diff --git a/dist/angular-spring-data-rest.min.js b/dist/angular-spring-data-rest.min.js index 160bbb7..0906ad9 100644 --- a/dist/angular-spring-data-rest.min.js +++ b/dist/angular-spring-data-rest.min.js @@ -95,8 +95,7 @@ return c(f, a[e.linksKey][b].templated) } - var n = a.get("$q").when(i), o = a.get("$q").defer(); - return n.then(function (c) { + return a.get("$q").when(i).then(function (c) { var d = function (a, b, d, h) { var i = this[e.linksKey], j = b; if (angular.isObject(a)) { @@ -115,16 +114,16 @@ } else l.push({name: b}) }), l }; - if (c && c.data && (c = c.data), !angular.isObject(c) || c instanceof Array)return void o.reject("Given data '" + c + "' is not of type object."); - if (k && !(k instanceof Array || "string" == typeof k))return void o.reject("Given fetch links '" + k + "' is not of type array or string."); + if (c && c.data && (c = c.data), !angular.isObject(c) || c instanceof Array)return a.get("$q").reject("Given data '" + c + "' is not of type object."); + if (k && !(k instanceof Array || "string" == typeof k))return a.get("$q").reject("Given fetch links '" + k + "' is not of type array or string."); var i = void 0, n = []; if (e.linksKey in c) { - var p = {}; - p[e.resourcesKey] = d, i = angular.extend(angular.copy(c), p), void 0 != k && angular.forEach(c[e.linksKey], function (a, b) { + var o = {}; + o[e.resourcesKey] = d, i = angular.extend(angular.copy(c), o), void 0 != k && angular.forEach(c[e.linksKey], function (a, b) { b != e.linksSelfLinkName && (k == e.fetchAllKey || "string" == typeof k && b == k || k instanceof Array && k.indexOf(b) >= 0) && n.push(h(m(c, b), b, i, k, l)) }) } - e.embeddedKey in c && (i || (i = angular.copy(c)), i = b(i, e.embeddedKey, e.embeddedNewKey, e.embeddedNamedResources), angular.forEach(i[e.embeddedNewKey], function (a, b) { + return e.embeddedKey in c && (i || (i = angular.copy(c)), i = b(i, e.embeddedKey, e.embeddedNewKey, e.embeddedNamedResources), angular.forEach(i[e.embeddedNewKey], function (a, b) { if (a instanceof Array && a.length > 0) { var c, d = []; angular.forEach(a, function (a, b) { @@ -138,13 +137,9 @@ i[e.embeddedNewKey][b] = a })) })), a.get("$q").all(n).then(function () { - o.resolve(i ? i : c) - }, function (b) { - return o.reject(b), a.get("$q").reject(b) + return i ? i : c }) - }, function (b) { - return o.reject(b), a.get("$q").reject(b) - }), o.promise + }) }; return {process: i} }] diff --git a/package.json b/package.json index 9b9ae1a..1b88ebb 100644 --- a/package.json +++ b/package.json @@ -26,18 +26,18 @@ "bower": "~1.3.12", "coveralls": "^2.11.2", "grunt": "~0.4.5", - "grunt-bower-install-simple": "~1.0.3", - "grunt-contrib-concat": "~0.5.0", - "grunt-contrib-uglify": "~0.6.0", - "grunt-karma": "~0.9.0", - "karma": "~0.12.23", - "karma-chrome-launcher": "~0.1.4", + "grunt-bower-install-simple": "~1.1.0", + "grunt-contrib-concat": "~0.5.1", + "grunt-contrib-uglify": "~0.8.0", + "grunt-karma": "~0.10.1", + "karma": "~0.12.31", + "karma-chrome-launcher": "~0.1.7", "karma-coverage": "^0.2.7", - "karma-firefox-launcher": "~0.1.3", + "karma-firefox-launcher": "~0.1.4", "karma-jasmine": "~0.3.5", - "karma-phantomjs-launcher": "~0.1.3", - "load-grunt-tasks": "~1.0.0", - "time-grunt": "~1.0.0" + "karma-phantomjs-launcher": "~0.1.4", + "load-grunt-tasks": "~3.1.0", + "time-grunt": "~1.1.0" }, "dependencies": {}, "license": {