Skip to content

Commit

Permalink
Stable Version 3.0.0-rc.1.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmdobry committed Jun 28, 2015
1 parent ab5575c commit c083e7e
Show file tree
Hide file tree
Showing 11 changed files with 108 additions and 79 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
##### 3.0.0-rc.1 - 28 June 2015

Stable Version 3.0.0-rc.1

##### 3.0.0-beta.2 - 19 April 2015

Added examples of various build setups `./build_examples/`
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Angular wrapper for [js-data](http://www.js-data.io).

#### What happened Angular-data?
Js-data-angular is Angular-data 2.0, with [js-data](http://www.js-data.io) as the framework-agnostic core. Documentation for Angular-data 1.x can be found at [angular-data.pseudobry.com](http://angular-data.pseudobry.com).
Angular-data is deprecated. js-data + js-data-angular is the new hotness.

### Guides
- [Angular + JSData (js-data-angular)](http://www.js-data.io/docs/js-data-angular)
Expand Down Expand Up @@ -41,7 +41,7 @@ __Latest Release:__ [![Latest Release](https://img.shields.io/github/release/js-

__Status:__

[![Dependency Status](https://img.shields.io/gemnasium/js-data/js-data-angular.svg?style=flat-square)](https://gemnasium.com/js-data/js-data-angular) [![Coverage Status](https://img.shields.io/coveralls/js-data/js-data-angular/master.svg?style=flat-square)](https://coveralls.io/r/js-data/js-data-angular?branch=master) [![Codacity](https://img.shields.io/codacy/e7690b906dfa471ebcc8b2bdc52e9662.svg?style=flat-square)](https://www.codacy.com/public/jasondobry/js-data-angular/dashboard)
[![Dependency Status](https://img.shields.io/gemnasium/js-data/js-data-angular.svg?style=flat-square)](https://gemnasium.com/js-data/js-data-angular) [![Coverage Status](https://img.shields.io/coveralls/js-data/js-data-angular/master.svg?style=flat-square)](https://coveralls.io/r/js-data/js-data-angular?branch=master) [![Codacity](https://img.shields.io/codacy/e7690b906dfa471ebcc8b2bdc52e9662.svg?style=flat-square)](https://www.codacy.com/public/jasondobry/js-data-angular/dashboard)

__Supported Platforms:__

Expand Down
7 changes: 2 additions & 5 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,8 @@
"angular-mocks-1.3.2": "angular-mocks#1.3.2"
},
"dependencies": {
"js-data": "2.0.0-beta.3",
"js-data-http": "2.0.0-beta.3",
"js-data": "2.0.0-rc.1",
"js-data-http": "2.0.0-rc.1",
"angular": ">=1.1.0"
},
"resolutions": {
"angular": "1.3.2"
}
}
2 changes: 1 addition & 1 deletion build_examples/browserify/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
`browserify -x axios app.js > bundle.js` will produce `bundle.js`
Running `browserify -x axios app.js > bundle.js` in this directory will produce `bundle.js`

Note the external dependency "axios" that is excluded from the build (it's not needed when using js-data-angular).
2 changes: 1 addition & 1 deletion build_examples/r.js/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
`r.js -o require.config.js` will produce `bundle.js`
Running `r.js -o require.config.js` in this directory will produce `bundle.js`

In `index.html` switch `script/main` between `main` (load scripts dynamically) and `bundle` (load bundled scripts)
2 changes: 1 addition & 1 deletion build_examples/webpack/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
`browserify -x axios app.js > bundle.js` will produce `bundle.js`
Running `webpack` in this directory will produce `bundle.js`

Note the external dependency "axios" that is excluded from the build (it's not needed when using js-data-angular).
119 changes: 73 additions & 46 deletions dist/js-data-angular.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* js-data-angular
* @version 3.0.0-beta.2 - Homepage <https://www.js-data.io/docs/js-data-angular/>
* @version 3.0.0-rc.1 - Homepage <https://www.js-data.io/docs/js-data-angular/>
* @author Jason Dobry <[email protected]>
* @copyright (c) 2014-2015 Jason Dobry
* @license MIT <https://github.com/js-data/js-data-angular/blob/master/LICENSE>
Expand Down Expand Up @@ -65,29 +65,15 @@ return /******/ (function(modules) { // webpackBootstrap
/* 0 */
/***/ function(module, exports, __webpack_require__) {

var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { 'default': obj }; };
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }

var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };

Object.defineProperty(exports, '__esModule', {
value: true
});
/*jshint loopfunc:true*/
var JSData = __webpack_require__(1);
var DSHttpAdapter = __webpack_require__(4);
var angular = __webpack_require__(2);

var _JSData = __webpack_require__(1);

var _JSData2 = _interopRequireWildcard(_JSData);

var _DSHttpAdapter = __webpack_require__(4);

var _DSHttpAdapter2 = _interopRequireWildcard(_DSHttpAdapter);

var _angular = __webpack_require__(2);

var _angular2 = _interopRequireWildcard(_angular);

var DSUtils = _JSData2['default'].DSUtils;
var DSErrors = _JSData2['default'].DSErrors;
var DSUtils = JSData.DSUtils;
var DSErrors = JSData.DSErrors;
var isString = DSUtils.isString;
var isNumber = DSUtils.isNumber;
var isObject = DSUtils.isObject;
Expand Down Expand Up @@ -127,7 +113,7 @@ return /******/ (function(modules) { // webpackBootstrap

if (Adapter) {
adapter.loaded = true;
_angular2['default'].module('js-data').provider(adapter['class'], function () {
angular.module('js-data').provider(adapter['class'], function () {
var _this = this;
_this.defaults = {};
_this.$get = [function () {
Expand All @@ -145,7 +131,7 @@ return /******/ (function(modules) { // webpackBootstrap

this.$get = ['$http', 'DS', function ($http, DS) {
defaults.http = defaults.http || $http;
var adapter = new _DSHttpAdapter2['default'](defaults);
var adapter = new DSHttpAdapter(defaults);
DS.registerAdapter('http', adapter, { 'default': true });
return adapter;
}];
Expand All @@ -165,7 +151,7 @@ return /******/ (function(modules) { // webpackBootstrap

_this.defaults = {};

_JSData2['default'].DS.prototype.bindAll = function (resourceName, params, scope, expr, cb) {
JSData.DS.prototype.bindAll = function (resourceName, params, scope, expr, cb) {
var _this = this;

params = params || {};
Expand Down Expand Up @@ -199,7 +185,7 @@ return /******/ (function(modules) { // webpackBootstrap
}
};

_JSData2['default'].DS.prototype.bindOne = function (resourceName, id, scope, expr, cb) {
JSData.DS.prototype.bindOne = function (resourceName, id, scope, expr, cb) {
var _this = this;

id = resolveId(_this.definitions[resourceName], id);
Expand Down Expand Up @@ -242,14 +228,14 @@ return /******/ (function(modules) { // webpackBootstrap

var $rootScope = args[args.length - 2];
var $q = args[args.length - 1];
var store = new _JSData2['default'].DS(_this.defaults);
var store = new JSData.DS(_this.defaults);
var originals = {};

function QPromise(executor) {
var deferred = $q.defer();

try {
executor.call(undefined, _angular2['default'].bind(deferred, deferred.resolve), _angular2['default'].bind(deferred, deferred.reject));
executor.call(undefined, angular.bind(deferred, deferred.resolve), angular.bind(deferred, deferred.reject));
} catch (err) {
deferred.reject(err);
}
Expand Down Expand Up @@ -315,7 +301,7 @@ return /******/ (function(modules) { // webpackBootstrap
_this.$get = deps;
};

_angular2['default'].module('js-data', ['ng']).value('DSUtils', DSUtils).value('DSErrors', DSErrors).value('DSVersion', _JSData2['default'].version).provider('DS', DSProvider).provider('DSHttpAdapter', DSHttpAdapterProvider).run(['DS', 'DSHttpAdapter', function (DS, DSHttpAdapter) {
angular.module('js-data', ['ng']).value('DSUtils', DSUtils).value('DSErrors', DSErrors).value('DSVersion', JSData.version).provider('DS', DSProvider).provider('DSHttpAdapter', DSHttpAdapterProvider).run(['DS', 'DSHttpAdapter', function (DS, DSHttpAdapter) {
DS.registerAdapter('http', DSHttpAdapter, { 'default': true });
}]);

Expand All @@ -324,8 +310,8 @@ return /******/ (function(modules) { // webpackBootstrap
}

// return the module name
exports['default'] = 'js-data';
module.exports = exports['default'];
module.exports = 'js-data';
module.exports.name = 'js-data';

/***/ },
/* 1 */
Expand Down Expand Up @@ -362,27 +348,18 @@ return /******/ (function(modules) { // webpackBootstrap
/* 4 */
/***/ function(module, exports, __webpack_require__) {

var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { 'default': obj }; };

var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };

var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();

Object.defineProperty(exports, '__esModule', {
value: true
});

var _JSData = __webpack_require__(1);

var _JSData2 = _interopRequireWildcard(_JSData);
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }

var JSData = __webpack_require__(1);
var axios = null;

try {
axios = __webpack_require__(5);
} catch (e) {}

var DSUtils = _JSData2['default'].DSUtils;
var DSUtils = JSData.DSUtils;
var deepMixIn = DSUtils.deepMixIn;
var removeCircular = DSUtils.removeCircular;
var copy = DSUtils.copy;
Expand Down Expand Up @@ -449,11 +426,62 @@ return /******/ (function(modules) { // webpackBootstrap
}

_createClass(DSHttpAdapter, [{
key: 'getEndpoint',
value: function getEndpoint(resourceConfig, id, options) {
var _this2 = this;

options = options || {};
options.params = options.params || {};

var item = undefined;
var parentKey = resourceConfig.parentKey;
var endpoint = options.hasOwnProperty('endpoint') ? options.endpoint : resourceConfig.endpoint;
var parentField = resourceConfig.parentField;
var parentDef = resourceConfig.getResource(resourceConfig.parent);
var parentId = options.params[parentKey];

if (parentId === false || !parentKey || !parentDef) {
if (parentId === false) {
delete options.params[parentKey];
}
return endpoint;
} else {
delete options.params[parentKey];

if (DSUtils._sn(id)) {
item = resourceConfig.get(id);
} else if (DSUtils._o(id)) {
item = id;
}

if (item) {
parentId = parentId || item[parentKey] || (item[parentField] ? item[parentField][parentDef.idAttribute] : null);
}

if (parentId) {
var _ret = (function () {
delete options.endpoint;
var _options = {};
DSUtils.forOwn(options, function (value, key) {
_options[key] = value;
});
return {
v: DSUtils.makePath(_this2.getEndpoint(parentDef, parentId, DSUtils._(parentDef, _options)), parentId, endpoint)
};
})();

if (typeof _ret === 'object') return _ret.v;
} else {
return endpoint;
}
}
}
}, {
key: 'getPath',
value: function getPath(method, resourceConfig, id, options) {
var _this = this;
options = options || {};
var args = [options.basePath || _this.defaults.basePath || resourceConfig.basePath, resourceConfig.getEndpoint(isString(id) || isNumber(id) || method === 'create' ? id : null, options)];
var args = [options.basePath || _this.defaults.basePath || resourceConfig.basePath, this.getEndpoint(resourceConfig, isString(id) || isNumber(id) || method === 'create' ? id : null, options)];
if (method === 'find' || method === 'update' || method === 'destroy') {
args.push(id);
}
Expand All @@ -479,7 +507,7 @@ return /******/ (function(modules) { // webpackBootstrap
}

function logResponse(data) {
var str = '' + start.toUTCString() + ' - ' + data.config.method.toUpperCase() + ' ' + data.config.url + ' - ' + data.status + ' ' + (new Date().getTime() - start.getTime()) + 'ms';
var str = start.toUTCString() + ' - ' + data.config.method.toUpperCase() + ' ' + data.config.url + ' - ' + data.status + ' ' + (new Date().getTime() - start.getTime()) + 'ms';
if (data.status >= 200 && data.status < 300) {
if (_this.defaults.log) {
_this.defaults.log(str, data);
Expand Down Expand Up @@ -644,8 +672,7 @@ return /******/ (function(modules) { // webpackBootstrap
return DSHttpAdapter;
})();

exports['default'] = DSHttpAdapter;
module.exports = exports['default'];
module.exports = DSHttpAdapter;

/***/ },
/* 5 */
Expand Down
Loading

0 comments on commit c083e7e

Please sign in to comment.