Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
guylabs committed Mar 20, 2015
1 parent 72359f9 commit 5abd4e9
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 49 deletions.
6 changes: 3 additions & 3 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
28 changes: 5 additions & 23 deletions dist/angular-spring-data-rest.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
21 changes: 8 additions & 13 deletions dist/angular-spring-data-rest.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand All @@ -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) {
Expand All @@ -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}
}]
Expand Down
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down

0 comments on commit 5abd4e9

Please sign in to comment.