diff --git a/.jshintrc b/.jshintrc
index e408dcf..eed0c57 100644
--- a/.jshintrc
+++ b/.jshintrc
@@ -1,7 +1,6 @@
{
"node": false,
"browser": true,
- "es5": true,
"esnext": true,
"bitwise": true,
"camelcase": true,
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0b35bf8..05391f8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,7 +1,12 @@
+##### 2.2.3 - 08 March 2015
+
+###### Other
+- Converted to ES6, using Babel.js to transpile to ES5.
+
##### 2.2.2 - 04 March 2015
###### Backwards compatible bug fixes
-- #312 - UMDifying js-data-angular
+- #312 - UMDifying js-data-angular
- #313 - DSHttpAdapter#find/create/update/destroy do not call queryTransform
##### 2.2.1 - 25 February 2015
diff --git a/Gruntfile.js b/Gruntfile.js
index 58acb59..ca7988b 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -13,7 +13,15 @@ module.exports = function (grunt) {
});
require('time-grunt')(grunt);
+ var webpack = require('webpack');
var pkg = grunt.file.readJSON('package.json');
+ var banner = 'js-data-angular\n' +
+ '@version ' + pkg.version + ' - Homepage \n' +
+ '@author Jason Dobry \n' +
+ '@copyright (c) 2014-2015 Jason Dobry \n' +
+ '@license MIT \n' +
+ '\n' +
+ '@overview Angular wrapper for js-data.';
// Project configuration.
grunt.initConfig({
@@ -21,10 +29,6 @@ module.exports = function (grunt) {
clean: {
dist: ['dist/']
},
- jshint: {
- all: ['Gruntfile.js', 'src/**/*.js'],
- jshintrc: '.jshintrc'
- },
watch: {
dist: {
files: ['src/**/*.js'],
@@ -36,10 +40,10 @@ module.exports = function (grunt) {
options: {
sourceMap: true,
sourceMapName: 'dist/js-data-angular.min.map',
- banner: '/**\n' +
+ banner: '/*!\n' +
+ '* js-data-angular\n' +
+ '* @version <%= pkg.version %> - Homepage \n' +
'* @author Jason Dobry \n' +
- '* @file js-data-angular.min.js\n' +
- '* @version <%= pkg.version %> - Homepage \n' +
'* @copyright (c) 2014-2015 Jason Dobry \n' +
'* @license MIT \n' +
'*\n' +
@@ -80,6 +84,40 @@ module.exports = function (grunt) {
options: {
coverage_dir: 'coverage'
}
+ },
+ webpack: {
+ dist: {
+ entry: './src/index.js',
+ output: {
+ filename: './dist/js-data-angular.js',
+ libraryTarget: 'umd',
+ library: 'jsDataAngularModuleName'
+ },
+ externals: {
+ 'js-data': {
+ amd: 'js-data',
+ commonjs: 'js-data',
+ commonjs2: 'js-data',
+ root: 'JSData'
+ },
+ 'angular': 'angular'
+ },
+ module: {
+ loaders: [
+ { test: /(src)(.+)\.js$/, exclude: /node_modules/, loader: 'babel-loader?blacklist=useStrict' }
+ ],
+ preLoaders: [
+ {
+ test: /(src)(.+)\.js$|(test)(.+)\.js$/, // include .js files
+ exclude: /node_modules/, // exclude any and all files in the node_modules folder
+ loader: "jshint-loader?failOnHint=true"
+ }
+ ]
+ },
+ plugins: [
+ new webpack.BannerPlugin(banner)
+ ]
+ }
}
});
@@ -91,28 +129,9 @@ module.exports = function (grunt) {
grunt.file.write(filePath, file);
});
- grunt.registerTask('banner', function () {
- var file = grunt.file.read('./src/index.js');
-
- var banner = '/**\n' +
- '* @author Jason Dobry \n' +
- '* @file js-data-angular.js\n' +
- '* @version ' + pkg.version + ' - Homepage \n' +
- '* @copyright (c) 2014-2015 Jason Dobry \n' +
- '* @license MIT \n' +
- '*\n' +
- '* @overview Angular wrapper for js-data.js.\n' +
- '*/\n';
-
- file = banner + file;
-
- grunt.file.write('./dist/js-data-angular.js', file);
- });
-
grunt.registerTask('build', [
'clean',
- 'jshint',
- 'banner',
+ 'webpack',
'uglify'
]);
grunt.registerTask('go', ['build', 'watch:dist']);
diff --git a/dist/js-data-angular.js b/dist/js-data-angular.js
index a8ba577..bacca2a 100644
--- a/dist/js-data-angular.js
+++ b/dist/js-data-angular.js
@@ -1,527 +1,631 @@
-/**
-* @author Jason Dobry
-* @file js-data-angular.js
-* @version 2.2.2 - Homepage
-* @copyright (c) 2014-2015 Jason Dobry
-* @license MIT
-*
-* @overview Angular wrapper for js-data.js.
-*/
-/*jshint loopfunc:true*/
-(function (root, factory) {
- 'use strict';
-
- if (typeof define === 'function' && define.amd) {
- define(['angular', 'js-data'], function (angular, JSData) {
- return factory(root, angular, JSData, undefined);
- });
- } else if (typeof exports === 'object' && typeof module === 'object') {
- module.exports = factory(root, require('angular') || root.angular, require('js-data') || root.JSData, undefined);
- } else if (typeof exports === 'object') {
- exports.jsDataAngularModuleName = factory(root, require('angular') || root.angular, require('js-data') || root.JSData, undefined);
- } else {
- root.jsDataAngularModuleName = factory(root, root.angular, root.JSData, undefined);
- }
-}(this, function (window, angular, JSData, undefined) {
- 'use strict';
-
- if (!JSData || !angular) {
- throw new Error('js-data and angular must be loaded!');
- }
-
- var DSUtils = JSData.DSUtils;
-
- var deepMixIn = DSUtils.deepMixIn;
- var httpLoaded = false;
-
- var adapters = [
- {
- project: 'js-data-http',
- name: 'http',
- class: 'DSHttpAdapter'
- },
- {
- project: 'js-data-localstorage',
- name: 'localstorage',
- class: 'DSLocalStorageAdapter'
- },
- {
- project: 'js-data-localforage',
- name: 'localforage',
- class: 'DSLocalForageAdapter'
- },
- {
- project: 'js-data-firebase',
- name: 'firebase',
- class: 'DSFirebaseAdapter'
- }
- ];
-
- var functionsToWrap = [
- 'compute',
- 'digest',
- 'eject',
- 'inject',
- 'link',
- 'linkAll',
- 'linkInverse',
- 'unlinkInverse'
- ];
-
- function Defaults() {
-
- }
-
- function DSHttpAdapter(options) {
- this.defaults = new Defaults();
- deepMixIn(this.defaults, options);
- }
-
- function registerAdapter(adapter) {
- var Adapter;
-
- try {
- Adapter = require(adapter.project);
- } catch (e) {
-
- }
-
- if (!Adapter) {
- Adapter = window[adapter.class];
- }
-
- if (Adapter) {
- if (adapter.name === 'http') {
- httpLoaded = true;
- }
- adapter.loaded = true;
- angular.module('js-data').provider(adapter.class, function () {
- var _this = this;
- _this.defaults = {};
- _this.$get = [function () {
- return new Adapter(_this.defaults);
- }];
- });
- }
- }
-
- angular.module('js-data', ['ng'])
- .value('DSUtils', JSData.DSUtils)
- .value('DSErrors', JSData.DSErrors)
- .provider('DS', function () {
-
- var _this = this;
- var DSErrors = JSData.DSErrors;
- var deps = [];
-
- for (var i = 0; i < adapters.length; i++) {
- if (adapters[i].loaded) {
- deps.push(adapters[i].class);
- }
- }
-
- _this.defaults = {};
-
- JSData.DS.prototype.bindAll = function (resourceName, params, scope, expr, cb) {
- var _this = this;
-
- params = params || {};
-
- if (!_this.definitions[resourceName]) {
- throw new DSErrors.NER(resourceName);
- } else if (!DSUtils.isObject(params)) {
- throw new DSErrors.IA('"params" must be an object!');
- } else if (!DSUtils.isObject(scope)) {
- throw new DSErrors.IA('"scope" must be an object!');
- } else if (!DSUtils.isString(expr)) {
- throw new DSErrors.IA('"expr" must be a string!');
- }
-
- try {
- return scope.$watch(function () {
- return _this.lastModified(resourceName);
- }, function () {
- var items = _this.filter(resourceName, params);
- DSUtils.set(scope, expr, items);
- if (cb) {
- cb(null, items);
- }
- });
- } catch (err) {
- if (cb) {
- cb(err);
- } else {
- throw err;
- }
- }
- };
-
- JSData.DS.prototype.bindOne = function (resourceName, id, scope, expr, cb) {
- var _this = this;
-
- id = DSUtils.resolveId(_this.definitions[resourceName], id);
- if (!_this.definitions[resourceName]) {
- throw new DSErrors.NER(resourceName);
- } else if (!DSUtils.isString(id) && !DSUtils.isNumber(id)) {
- throw new DSErrors.IA('"id" must be a string or a number!');
- } else if (!DSUtils.isObject(scope)) {
- throw new DSErrors.IA('"scope" must be an object!');
- } else if (!DSUtils.isString(expr)) {
- throw new DSErrors.IA('"expr" must be a string!');
- }
-
- try {
- return scope.$watch(function () {
- return _this.lastModified(resourceName, id);
- }, function () {
- var item = _this.get(resourceName, id);
- DSUtils.set(scope, expr, item);
- if (cb) {
- cb(null, item);
- }
- });
- } catch (err) {
- if (cb) {
- cb(err);
- } else {
- throw err;
- }
- }
- };
-
- function load() {
- var args = Array.prototype.slice.call(arguments);
- var $rootScope = args[args.length - 2];
- var $q = args[args.length - 1];
- var store = new JSData.DS(_this.defaults);
- var originals = {};
-
- function QPromise(executor) {
- var deferred = $q.defer();
-
- try {
- executor.call(undefined,
- angular.bind(deferred, deferred.resolve),
- angular.bind(deferred, deferred.reject));
- } catch (err) {
- deferred.reject(err);
- }
-
- return deferred.promise;
- }
-
- QPromise.all = $q.all;
- QPromise.when = $q.when;
- QPromise.reject = $q.reject;
-
- DSUtils.Promise = QPromise;
-
- // Register any adapters that have been loaded
- if (args.length) {
- for (var i = 0; i < args.length; i++) {
- for (var j = 0; j < adapters.length; j++) {
- if (adapters[j].loaded && !adapters[j].registered) {
- adapters[j].registered = true;
- store.registerAdapter(adapters[j].name, args[i]);
- }
- }
- }
- }
-
- // Wrap certain sync functions with $apply
- for (var k = 0; k < functionsToWrap.length; k++) {
- originals[functionsToWrap[k]] = store[functionsToWrap[k]];
- store[functionsToWrap[k]] = (function (name) {
- return function () {
- var args = arguments;
- if (!$rootScope.$$phase) {
- return $rootScope.$apply(function () {
- return originals[name].apply(store, args);
- });
- }
- return originals[name].apply(store, args);
- };
- })(functionsToWrap[k]);
- }
-
- // Hook into the digest loop
- if (typeof Object.observe !== 'function' || typeof Array.observe !== 'function') {
- $rootScope.$watch(function () {
- store.observe.Platform.performMicrotaskCheckpoint();
- });
- }
-
- return store;
- }
-
- deps.push('$rootScope');
- deps.push('$q');
- deps.push(load);
-
- _this.$get = deps;
- });
-
-
- for (var i = 0; i < adapters.length; i++) {
- registerAdapter(adapters[i]);
- }
-
- if (!httpLoaded) {
- var defaultsPrototype = Defaults.prototype;
-
- defaultsPrototype.queryTransform = function (resource, params) {
- return params;
- };
-
- defaultsPrototype.basePath = '';
-
- defaultsPrototype.forceTrailingSlash = '';
-
- defaultsPrototype.httpConfig = {};
-
- defaultsPrototype.log = console ? function (a, b) {
- console[typeof console.info === 'function' ? 'info' : 'log'](a, b);
- } : function () {
- };
-
- defaultsPrototype.error = console ? function (a, b) {
- console[typeof console.error === 'function' ? 'error' : 'log'](a, b);
- } : function () {
- };
-
- defaultsPrototype.deserialize = function (resource, data) {
- return data ? ('data' in data ? data.data : data) : data;
- };
-
- defaultsPrototype.serialize = function (resource, data) {
- return data;
- };
-
- var dsHttpAdapterPrototype = DSHttpAdapter.prototype;
-
- dsHttpAdapterPrototype.getPath = function (method, resourceConfig, id, options) {
- var _this = this;
- options = options || {};
- var args = [
- options.basePath || _this.defaults.basePath || resourceConfig.basePath,
- resourceConfig.getEndpoint((DSUtils.isString(id) || DSUtils.isNumber(id) || method === 'create') ? id : null, options)
- ];
- if (method === 'find' || method === 'update' || method === 'destroy') {
- args.push(id);
- }
- return DSUtils.makePath.apply(DSUtils, args);
- };
-
- dsHttpAdapterPrototype.GET = function (url, config) {
- config = config || {};
- if (!('method' in config)) {
- config.method = 'get';
- }
- return this.HTTP(deepMixIn(config, {
- url: url
- }));
- };
-
- dsHttpAdapterPrototype.POST = function (url, attrs, config) {
- config = config || {};
- config = DSUtils.copy(config);
- if (!('method' in config)) {
- config.method = 'post';
- }
- return this.HTTP(deepMixIn(config, {
- url: url,
- data: attrs
- }));
- };
-
- dsHttpAdapterPrototype.PUT = function (url, attrs, config) {
- config = config || {};
- if (!('method' in config)) {
- config.method = 'put';
- }
- return this.HTTP(deepMixIn(config, {
- url: url,
- data: attrs || {}
- }));
- };
-
- dsHttpAdapterPrototype.DEL = function (url, config) {
- config = config || {};
- if (!('method' in config)) {
- config.method = 'delete';
- }
- return this.HTTP(deepMixIn(config, {
- url: url
- }));
- };
-
- dsHttpAdapterPrototype.find = function (resourceConfig, id, options) {
- var _this = this;
- options = options || {};
- options.suffix = options.suffix || resourceConfig.suffix;
- options.params = options.params || {};
- options.params = _this.defaults.queryTransform(resourceConfig, options.params);
- return _this.GET(
- _this.getPath('find', resourceConfig, id, options),
- options
- ).then(function (data) {
- var item = (options.deserialize ? options.deserialize : _this.defaults.deserialize)(resourceConfig, data);
- if (!item) {
- return JSData.DSUtils.Promise.reject(new Error('Not Found!'));
- } else {
- return item;
- }
- });
- };
-
- dsHttpAdapterPrototype.findAll = function (resourceConfig, params, options) {
- var _this = this;
- options = options || {};
- options = DSUtils.copy(options);
- options.suffix = options.suffix || resourceConfig.suffix;
- options.params = options.params || {};
- if (params) {
- params = _this.defaults.queryTransform(resourceConfig, params);
- deepMixIn(options.params, params);
- }
- return _this.GET(
- _this.getPath('findAll', resourceConfig, params, options),
- options
- ).then(function (data) {
- return (options.deserialize ? options.deserialize : _this.defaults.deserialize)(resourceConfig, data);
- });
- };
-
- dsHttpAdapterPrototype.create = function (resourceConfig, attrs, options) {
- var _this = this;
- options = options || {};
- options.suffix = options.suffix || resourceConfig.suffix;
- options.params = options.params || {};
- options.params = _this.defaults.queryTransform(resourceConfig, options.params);
- return _this.POST(
- _this.getPath('create', resourceConfig, attrs, options),
- (options.serialize ? options.serialize : _this.defaults.serialize)(resourceConfig, attrs),
- options
- ).then(function (data) {
- return (options.deserialize ? options.deserialize : _this.defaults.deserialize)(resourceConfig, data);
- });
- };
-
- dsHttpAdapterPrototype.update = function (resourceConfig, id, attrs, options) {
- var _this = this;
- options = options || {};
- options.suffix = options.suffix || resourceConfig.suffix;
- options.params = options.params || {};
- options.params = _this.defaults.queryTransform(resourceConfig, options.params);
- return _this.PUT(
- _this.getPath('update', resourceConfig, id, options),
- (options.serialize ? options.serialize : _this.defaults.serialize)(resourceConfig, attrs),
- options
- ).then(function (data) {
- return (options.deserialize ? options.deserialize : _this.defaults.deserialize)(resourceConfig, data);
- });
- };
-
- dsHttpAdapterPrototype.updateAll = function (resourceConfig, attrs, params, options) {
- var _this = this;
- options = options || {};
- options = DSUtils.copy(options);
- options.suffix = options.suffix || resourceConfig.suffix;
- options.params = options.params || {};
- if (params) {
- params = _this.defaults.queryTransform(resourceConfig, params);
- deepMixIn(options.params, params);
- }
- return this.PUT(
- _this.getPath('updateAll', resourceConfig, attrs, options),
- (options.serialize ? options.serialize : _this.defaults.serialize)(resourceConfig, attrs),
- options
- ).then(function (data) {
- return (options.deserialize ? options.deserialize : _this.defaults.deserialize)(resourceConfig, data);
- });
- };
-
- dsHttpAdapterPrototype.destroy = function (resourceConfig, id, options) {
- var _this = this;
- options = options || {};
- options.suffix = options.suffix || resourceConfig.suffix;
- options.params = options.params || {};
- options.params = _this.defaults.queryTransform(resourceConfig, options.params);
- return _this.DEL(
- _this.getPath('destroy', resourceConfig, id, options),
- options
- ).then(function (data) {
- return (options.deserialize ? options.deserialize : _this.defaults.deserialize)(resourceConfig, data);
- });
- };
-
- dsHttpAdapterPrototype.destroyAll = function (resourceConfig, params, options) {
- var _this = this;
- options = options || {};
- options = DSUtils.copy(options);
- options.suffix = options.suffix || resourceConfig.suffix;
- options.params = options.params || {};
- if (params) {
- params = _this.defaults.queryTransform(resourceConfig, params);
- deepMixIn(options.params, params);
- }
- return this.DEL(
- _this.getPath('destroyAll', resourceConfig, params, options),
- options
- ).then(function (data) {
- return (options.deserialize ? options.deserialize : _this.defaults.deserialize)(resourceConfig, data);
- });
- };
-
- angular.module('js-data').provider('DSHttpAdapter', function () {
- var _this = this;
- _this.defaults = {};
- _this.$get = ['$http', 'DS', '$q', function ($http, DS, $q) {
- dsHttpAdapterPrototype.HTTP = function (config) {
- var _this = this;
- var start = new Date();
- config = deepMixIn(config, _this.defaults.httpConfig);
- if (_this.defaults.forceTrailingSlash && config.url[config.url.length - 1] !== '/') {
- config.url += '/';
- }
- config.method = config.method.toUpperCase();
- if (typeof config.data === 'object') {
- config.data = DSUtils.removeCircular(config.data);
- }
- var suffix = config.suffix || _this.defaults.suffix;
- if (suffix && config.url.substr(config.url.length - suffix.length) !== suffix) {
- config.url += suffix;
- }
-
- function logResponse(data) {
- 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);
- }
- return data;
- } else {
- if (_this.defaults.error) {
- _this.defaults.error('FAILED: ' + str, data);
- }
- return $q.reject(data);
- }
- }
-
- return $http(config).then(logResponse, logResponse);
- };
-
- var adapter = new DSHttpAdapter(_this.defaults);
- DS.registerAdapter('http', adapter, { default: true });
- return adapter;
- }];
- });
-
- angular.module('js-data').run(['DS', 'DSHttpAdapter', function (DS, DSHttpAdapter) {
- DS.registerAdapter('http', DSHttpAdapter, { default: true });
- }]);
- }
-
- // return the module name
- return 'js-data';
-}));
+/*!
+ * js-data-angular
+ * @version 2.2.3 - Homepage
+ * @author Jason Dobry
+ * @copyright (c) 2014-2015 Jason Dobry
+ * @license MIT
+ *
+ * @overview Angular wrapper for js-data.
+ */
+(function webpackUniversalModuleDefinition(root, factory) {
+ if(typeof exports === 'object' && typeof module === 'object')
+ module.exports = factory((function webpackLoadOptionalExternalModule() { try { return require("js-data"); } catch(e) {} }()), (function webpackLoadOptionalExternalModule() { try { return require("angular"); } catch(e) {} }()));
+ else if(typeof define === 'function' && define.amd)
+ define(["js-data", "angular"], factory);
+ else if(typeof exports === 'object')
+ exports["jsDataAngularModuleName"] = factory((function webpackLoadOptionalExternalModule() { try { return require("js-data"); } catch(e) {} }()), (function webpackLoadOptionalExternalModule() { try { return require("angular"); } catch(e) {} }()));
+ else
+ root["jsDataAngularModuleName"] = factory(root["JSData"], root["angular"]);
+})(this, function(__WEBPACK_EXTERNAL_MODULE_1__, __WEBPACK_EXTERNAL_MODULE_2__) {
+return /******/ (function(modules) { // webpackBootstrap
+/******/ // The module cache
+/******/ var installedModules = {};
+
+/******/ // The require function
+/******/ function __webpack_require__(moduleId) {
+
+/******/ // Check if module is in cache
+/******/ if(installedModules[moduleId])
+/******/ return installedModules[moduleId].exports;
+
+/******/ // Create a new module (and put it into the cache)
+/******/ var module = installedModules[moduleId] = {
+/******/ exports: {},
+/******/ id: moduleId,
+/******/ loaded: false
+/******/ };
+
+/******/ // Execute the module function
+/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
+
+/******/ // Flag the module as loaded
+/******/ module.loaded = true;
+
+/******/ // Return the exports of the module
+/******/ return module.exports;
+/******/ }
+
+
+/******/ // expose the modules object (__webpack_modules__)
+/******/ __webpack_require__.m = modules;
+
+/******/ // expose the module cache
+/******/ __webpack_require__.c = installedModules;
+
+/******/ // __webpack_public_path__
+/******/ __webpack_require__.p = "";
+
+/******/ // Load entry module and return exports
+/******/ return __webpack_require__(0);
+/******/ })
+/************************************************************************/
+/******/ ([
+/* 0 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = props[key]; prop.configurable = true; if (prop.value) prop.writable = true; } Object.defineProperties(target, props); } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
+
+ var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
+
+ /*jshint loopfunc:true*/
+ var angular = undefined,
+ JSData = undefined;
+ try {
+ JSData = __webpack_require__(1);
+ } catch (e) {}
+
+ if (!JSData) {
+ try {
+ JSData = window.JSData;
+ } catch (e) {}
+ }
+ if (!JSData) {
+ throw new Error("js-data must be loaded!");
+ }
+ try {
+ angular = __webpack_require__(2);
+ } catch (e) {}
+
+ if (!angular) {
+ try {
+ angular = window.angular;
+ } catch (e) {}
+ }
+ if (!angular) {
+ throw new Error("angular must be loaded!");
+ }
+
+ var DSUtils = JSData.DSUtils;
+ var DSErrors = JSData.DSErrors;
+ var deepMixIn = DSUtils.deepMixIn;
+ var copy = DSUtils.copy;
+ var removeCircular = DSUtils.removeCircular;
+ var isString = DSUtils.isString;
+ var isNumber = DSUtils.isNumber;
+ var makePath = DSUtils.makePath;
+ var httpLoaded = false;
+
+ var adapters = [{
+ project: "js-data-http",
+ name: "http",
+ "class": "DSHttpAdapter"
+ }, {
+ project: "js-data-localstorage",
+ name: "localstorage",
+ "class": "DSLocalStorageAdapter"
+ }, {
+ project: "js-data-localforage",
+ name: "localforage",
+ "class": "DSLocalForageAdapter"
+ }, {
+ project: "js-data-firebase",
+ name: "firebase",
+ "class": "DSFirebaseAdapter"
+ }];
+
+ var functionsToWrap = ["compute", "digest", "eject", "inject", "link", "linkAll", "linkInverse", "unlinkInverse"];
+
+ function registerAdapter(adapter) {
+ var Adapter = undefined;
+
+ try {
+ Adapter = __webpack_require__(3)(adapter.project);
+ } catch (e) {}
+
+ if (!Adapter) {
+ Adapter = window[adapter["class"]];
+ }
+
+ if (Adapter) {
+ if (adapter.name === "http") {
+ httpLoaded = true;
+ }
+ adapter.loaded = true;
+ angular.module("js-data").provider(adapter["class"], function () {
+ var _this = this;
+ _this.defaults = {};
+ _this.$get = [function () {
+ return new Adapter(_this.defaults);
+ }];
+ });
+ }
+ }
+
+ var DSProvider = function DSProvider() {
+ _classCallCheck(this, DSProvider);
+
+ var _this = this;
+ var deps = [];
+
+ for (var i = 0; i < adapters.length; i++) {
+ if (adapters[i].loaded) {
+ deps.push(adapters[i]["class"]);
+ }
+ }
+
+ _this.defaults = {};
+
+ JSData.DS.prototype.bindAll = function (resourceName, params, scope, expr, cb) {
+ var _this = this;
+
+ params = params || {};
+
+ if (!_this.definitions[resourceName]) {
+ throw new DSErrors.NER(resourceName);
+ } else if (!DSUtils.isObject(params)) {
+ throw new DSErrors.IA("\"params\" must be an object!");
+ } else if (!DSUtils.isObject(scope)) {
+ throw new DSErrors.IA("\"scope\" must be an object!");
+ } else if (!DSUtils.isString(expr)) {
+ throw new DSErrors.IA("\"expr\" must be a string!");
+ }
+
+ try {
+ return scope.$watch(function () {
+ return _this.lastModified(resourceName);
+ }, function () {
+ var items = _this.filter(resourceName, params);
+ DSUtils.set(scope, expr, items);
+ if (cb) {
+ cb(null, items);
+ }
+ });
+ } catch (err) {
+ if (cb) {
+ cb(err);
+ } else {
+ throw err;
+ }
+ }
+ };
+
+ JSData.DS.prototype.bindOne = function (resourceName, id, scope, expr, cb) {
+ var _this = this;
+
+ id = DSUtils.resolveId(_this.definitions[resourceName], id);
+ if (!_this.definitions[resourceName]) {
+ throw new DSErrors.NER(resourceName);
+ } else if (!DSUtils.isString(id) && !DSUtils.isNumber(id)) {
+ throw new DSErrors.IA("\"id\" must be a string or a number!");
+ } else if (!DSUtils.isObject(scope)) {
+ throw new DSErrors.IA("\"scope\" must be an object!");
+ } else if (!DSUtils.isString(expr)) {
+ throw new DSErrors.IA("\"expr\" must be a string!");
+ }
+
+ try {
+ return scope.$watch(function () {
+ return _this.lastModified(resourceName, id);
+ }, function () {
+ var item = _this.get(resourceName, id);
+ DSUtils.set(scope, expr, item);
+ if (cb) {
+ cb(null, item);
+ }
+ });
+ } catch (err) {
+ if (cb) {
+ cb(err);
+ } else {
+ throw err;
+ }
+ }
+ };
+
+ function load() {
+ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
+ args[_key] = arguments[_key];
+ }
+
+ var $rootScope = args[args.length - 2];
+ var $q = args[args.length - 1];
+ var store = new JSData.DS(_this.defaults);
+ var originals = {};
+
+ function QPromise(executor) {
+ var deferred = $q.defer();
+
+ try {
+ executor.call(undefined, angular.bind(deferred, deferred.resolve), angular.bind(deferred, deferred.reject));
+ } catch (err) {
+ deferred.reject(err);
+ }
+
+ return deferred.promise;
+ }
+
+ QPromise.all = $q.all;
+ QPromise.when = $q.when;
+ QPromise.reject = $q.reject;
+
+ DSUtils.Promise = QPromise;
+
+ // Register any adapters that have been loaded
+ if (args.length) {
+ for (var i = 0; i < args.length; i++) {
+ for (var j = 0; j < adapters.length; j++) {
+ if (adapters[j].loaded && !adapters[j].registered) {
+ adapters[j].registered = true;
+ store.registerAdapter(adapters[j].name, args[i]);
+ }
+ }
+ }
+ }
+
+ // Wrap certain sync functions with $apply
+ for (var k = 0; k < functionsToWrap.length; k++) {
+ (function () {
+ var name = functionsToWrap[k];
+ originals[name] = store[name];
+ store[name] = function () {
+ for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
+ args[_key2] = arguments[_key2];
+ }
+
+ if (!$rootScope.$$phase) {
+ return $rootScope.$apply(function () {
+ return originals[name].apply(store, args);
+ });
+ }
+ return originals[name].apply(store, args);
+ };
+ })();
+ }
+
+ // Hook into the digest loop
+ if (typeof Object.observe !== "function" || typeof Array.observe !== "function") {
+ $rootScope.$watch(function () {
+ return store.observe.Platform.performMicrotaskCheckpoint();
+ });
+ }
+
+ return store;
+ }
+
+ deps.push("$rootScope");
+ deps.push("$q");
+ deps.push(load);
+
+ _this.$get = deps;
+ };
+
+ angular.module("js-data", ["ng"]).value("DSUtils", JSData.DSUtils).value("DSErrors", JSData.DSErrors).provider("DS", DSProvider);
+
+ for (var i = 0; i < adapters.length; i++) {
+ registerAdapter(adapters[i]);
+ }
+
+ if (!httpLoaded) {
+ (function () {
+ var Defaults = (function () {
+ function Defaults() {
+ _classCallCheck(this, Defaults);
+ }
+
+ _createClass(Defaults, {
+ queryTransform: {
+ value: function queryTransform(resourceConfig, params) {
+ return params;
+ }
+ },
+ deserialize: {
+ value: function deserialize(resourceConfig, data) {
+ return data ? "data" in data ? data.data : data : data;
+ }
+ },
+ serialize: {
+ value: function serialize(resourceConfig, data) {
+ return data;
+ }
+ },
+ log: {
+ value: function log() {}
+ },
+ error: {
+ value: function error() {}
+ }
+ });
+
+ return Defaults;
+ })();
+
+ var defaultsPrototype = Defaults.prototype;
+
+ defaultsPrototype.basePath = "";
+
+ defaultsPrototype.forceTrailingSlash = "";
+
+ defaultsPrototype.httpConfig = {};
+
+ var DSHttpAdapter = (function () {
+ function DSHttpAdapter(options) {
+ _classCallCheck(this, DSHttpAdapter);
+
+ this.defaults = new Defaults();
+ if (console) {
+ this.defaults.log = function (a, b) {
+ return console[typeof console.info === "function" ? "info" : "log"](a, b);
+ };
+ }
+ if (console) {
+ this.defaults.error = function (a, b) {
+ return console[typeof console.error === "function" ? "error" : "log"](a, b);
+ };
+ }
+ deepMixIn(this.defaults, options);
+ }
+
+ _createClass(DSHttpAdapter, {
+ 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)];
+ if (method === "find" || method === "update" || method === "destroy") {
+ args.push(id);
+ }
+ return makePath.apply(DSUtils, args);
+ }
+ },
+ GET: {
+ value: function GET(url, config) {
+ config = config || {};
+ if (!("method" in config)) {
+ config.method = "get";
+ }
+ return this.HTTP(deepMixIn(config, {
+ url: url
+ }));
+ }
+ },
+ POST: {
+ value: function POST(url, attrs, config) {
+ config = config || {};
+ config = DSUtils.copy(config);
+ if (!("method" in config)) {
+ config.method = "post";
+ }
+ return this.HTTP(deepMixIn(config, {
+ url: url,
+ data: attrs
+ }));
+ }
+ },
+ PUT: {
+ value: function PUT(url, attrs, config) {
+ config = config || {};
+ if (!("method" in config)) {
+ config.method = "put";
+ }
+ return this.HTTP(deepMixIn(config, {
+ url: url,
+ data: attrs || {}
+ }));
+ }
+ },
+ DEL: {
+ value: function DEL(url, config) {
+ config = config || {};
+ if (!("method" in config)) {
+ config.method = "delete";
+ }
+ return this.HTTP(deepMixIn(config, {
+ url: url
+ }));
+ }
+ },
+ find: {
+ value: function find(resourceConfig, id, options) {
+ var _this = this;
+ options = options ? copy(options) : {};
+ options.suffix = options.suffix || resourceConfig.suffix;
+ options.params = options.params || {};
+ options.params = _this.defaults.queryTransform(resourceConfig, options.params);
+ return _this.GET(_this.getPath("find", resourceConfig, id, options), options).then(function (data) {
+ var item = (options.deserialize ? options.deserialize : _this.defaults.deserialize)(resourceConfig, data);
+ return !item ? JSData.DSUtils.Promise.reject(new Error("Not Found!")) : item;
+ });
+ }
+ },
+ findAll: {
+ value: function findAll(resourceConfig, params, options) {
+ var _this = this;
+ options = options ? copy(options) : {};
+ options.suffix = options.suffix || resourceConfig.suffix;
+ options.params = options.params || {};
+ if (params) {
+ params = _this.defaults.queryTransform(resourceConfig, params);
+ deepMixIn(options.params, params);
+ }
+ return _this.GET(_this.getPath("findAll", resourceConfig, params, options), options).then(function (data) {
+ return (options.deserialize ? options.deserialize : _this.defaults.deserialize)(resourceConfig, data);
+ });
+ }
+ },
+ create: {
+ value: function create(resourceConfig, attrs, options) {
+ var _this = this;
+ options = options ? copy(options) : {};
+ options.suffix = options.suffix || resourceConfig.suffix;
+ options.params = options.params || {};
+ options.params = _this.defaults.queryTransform(resourceConfig, options.params);
+ return _this.POST(_this.getPath("create", resourceConfig, attrs, options), (options.serialize ? options.serialize : _this.defaults.serialize)(resourceConfig, attrs), options).then(function (data) {
+ return (options.deserialize ? options.deserialize : _this.defaults.deserialize)(resourceConfig, data);
+ });
+ }
+ },
+ update: {
+ value: function update(resourceConfig, id, attrs, options) {
+ var _this = this;
+ options = options ? copy(options) : {};
+ options.suffix = options.suffix || resourceConfig.suffix;
+ options.params = options.params || {};
+ options.params = _this.defaults.queryTransform(resourceConfig, options.params);
+ return _this.PUT(_this.getPath("update", resourceConfig, id, options), (options.serialize ? options.serialize : _this.defaults.serialize)(resourceConfig, attrs), options).then(function (data) {
+ return (options.deserialize ? options.deserialize : _this.defaults.deserialize)(resourceConfig, data);
+ });
+ }
+ },
+ updateAll: {
+ value: function updateAll(resourceConfig, attrs, params, options) {
+ var _this = this;
+ options = options ? copy(options) : {};
+ options.suffix = options.suffix || resourceConfig.suffix;
+ options.params = options.params || {};
+ if (params) {
+ params = _this.defaults.queryTransform(resourceConfig, params);
+ deepMixIn(options.params, params);
+ }
+ return this.PUT(_this.getPath("updateAll", resourceConfig, attrs, options), (options.serialize ? options.serialize : _this.defaults.serialize)(resourceConfig, attrs), options).then(function (data) {
+ return (options.deserialize ? options.deserialize : _this.defaults.deserialize)(resourceConfig, data);
+ });
+ }
+ },
+ destroy: {
+ value: function destroy(resourceConfig, id, options) {
+ var _this = this;
+ options = options ? copy(options) : {};
+ options.suffix = options.suffix || resourceConfig.suffix;
+ options.params = options.params || {};
+ options.params = _this.defaults.queryTransform(resourceConfig, options.params);
+ return _this.DEL(_this.getPath("destroy", resourceConfig, id, options), options).then(function (data) {
+ return (options.deserialize ? options.deserialize : _this.defaults.deserialize)(resourceConfig, data);
+ });
+ }
+ },
+ destroyAll: {
+ value: function destroyAll(resourceConfig, params, options) {
+ var _this = this;
+ options = options ? copy(options) : {};
+ options.suffix = options.suffix || resourceConfig.suffix;
+ options.params = options.params || {};
+ if (params) {
+ params = _this.defaults.queryTransform(resourceConfig, params);
+ deepMixIn(options.params, params);
+ }
+ return this.DEL(_this.getPath("destroyAll", resourceConfig, params, options), options).then(function (data) {
+ return (options.deserialize ? options.deserialize : _this.defaults.deserialize)(resourceConfig, data);
+ });
+ }
+ }
+ });
+
+ return DSHttpAdapter;
+ })();
+
+ var dsHttpAdapterPrototype = DSHttpAdapter.prototype;
+
+ var DSHttpAdapterProvider = function DSHttpAdapterProvider() {
+ _classCallCheck(this, DSHttpAdapterProvider);
+
+ var _this = this;
+ _this.defaults = {};
+ _this.$get = ["$http", "DS", "$q", function ($http, DS, $q) {
+ dsHttpAdapterPrototype.HTTP = function (config) {
+ var _this = this;
+ var start = new Date();
+ config = copy(config);
+ config = deepMixIn(config, _this.defaults.httpConfig);
+ if (_this.defaults.forceTrailingSlash && config.url[config.url.length - 1] !== "/") {
+ config.url += "/";
+ }
+ config.method = config.method.toUpperCase();
+ if (typeof config.data === "object") {
+ config.data = removeCircular(config.data);
+ }
+ var suffix = config.suffix || _this.defaults.suffix;
+ if (suffix && config.url.substr(config.url.length - suffix.length) !== suffix) {
+ config.url += suffix;
+ }
+
+ function logResponse(data) {
+ 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);
+ }
+ return data;
+ } else {
+ if (_this.defaults.error) {
+ _this.defaults.error("FAILED: " + str, data);
+ }
+ return $q.reject(data);
+ }
+ }
+
+ return $http(config).then(logResponse, logResponse);
+ };
+
+ var adapter = new DSHttpAdapter(_this.defaults);
+ DS.registerAdapter("http", adapter, { "default": true });
+ return adapter;
+ }];
+ };
+
+ angular.module("js-data").provider("DSHttpAdapter", DSHttpAdapterProvider);
+ })();
+ }
+ angular.module("js-data").run(["DS", "DSHttpAdapter", function (DS, DSHttpAdapter) {
+ return DS.registerAdapter("http", DSHttpAdapter, { "default": true });
+ }]);
+
+ // return the module name
+ module.exports = "js-data";
+
+/***/ },
+/* 1 */
+/***/ function(module, exports, __webpack_require__) {
+
+ if(typeof __WEBPACK_EXTERNAL_MODULE_1__ === 'undefined') {var e = new Error("Cannot find module \"undefined\""); e.code = 'MODULE_NOT_FOUND'; throw e;}
+ module.exports = __WEBPACK_EXTERNAL_MODULE_1__;
+
+/***/ },
+/* 2 */
+/***/ function(module, exports, __webpack_require__) {
+
+ if(typeof __WEBPACK_EXTERNAL_MODULE_2__ === 'undefined') {var e = new Error("Cannot find module \"angular\""); e.code = 'MODULE_NOT_FOUND'; throw e;}
+ module.exports = __WEBPACK_EXTERNAL_MODULE_2__;
+
+/***/ },
+/* 3 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var map = {};
+ function webpackContext(req) {
+ return __webpack_require__(webpackContextResolve(req));
+ };
+ function webpackContextResolve(req) {
+ return map[req] || (function() { throw new Error("Cannot find module '" + req + "'.") }());
+ };
+ webpackContext.keys = function webpackContextKeys() {
+ return Object.keys(map);
+ };
+ webpackContext.resolve = webpackContextResolve;
+ module.exports = webpackContext;
+ webpackContext.id = 3;
+
+
+/***/ }
+/******/ ])
+});
+;
\ No newline at end of file
diff --git a/dist/js-data-angular.min.js b/dist/js-data-angular.min.js
index 87c7a9e..6a373d9 100644
--- a/dist/js-data-angular.min.js
+++ b/dist/js-data-angular.min.js
@@ -1,12 +1,12 @@
-/**
+/*!
+* js-data-angular
+* @version 2.2.3 - Homepage
* @author Jason Dobry
-* @file js-data-angular.min.js
-* @version 2.2.2 - Homepage
* @copyright (c) 2014-2015 Jason Dobry
* @license MIT
*
* @overview Angular wrapper for js-data.
*/
-!function(a,b){"use strict";"function"==typeof define&&define.amd?define(["angular","js-data"],function(c,d){return b(a,c,d,void 0)}):"object"==typeof exports&&"object"==typeof module?module.exports=b(a,require("angular")||a.angular,require("js-data")||a.JSData,void 0):"object"==typeof exports?exports.jsDataAngularModuleName=b(a,require("angular")||a.angular,require("js-data")||a.JSData,void 0):a.jsDataAngularModuleName=b(a,a.angular,a.JSData,void 0)}(this,function(a,b,c,d){"use strict";function e(){}function f(a){this.defaults=new e,i(this.defaults,a)}function g(c){var d;try{d=require(c.project)}catch(e){}d||(d=a[c["class"]]),d&&("http"===c.name&&(j=!0),c.loaded=!0,b.module("js-data").provider(c["class"],function(){var a=this;a.defaults={},a.$get=[function(){return new d(a.defaults)}]}))}if(!c||!b)throw new Error("js-data and angular must be loaded!");var h=c.DSUtils,i=h.deepMixIn,j=!1,k=[{project:"js-data-http",name:"http","class":"DSHttpAdapter"},{project:"js-data-localstorage",name:"localstorage","class":"DSLocalStorageAdapter"},{project:"js-data-localforage",name:"localforage","class":"DSLocalForageAdapter"},{project:"js-data-firebase",name:"firebase","class":"DSFirebaseAdapter"}],l=["compute","digest","eject","inject","link","linkAll","linkInverse","unlinkInverse"];b.module("js-data",["ng"]).value("DSUtils",c.DSUtils).value("DSErrors",c.DSErrors).provider("DS",function(){function a(){function a(a){var c=i.defer();try{a.call(d,b.bind(c,c.resolve),b.bind(c,c.reject))}catch(e){c.reject(e)}return c.promise}var f=Array.prototype.slice.call(arguments),g=f[f.length-2],i=f[f.length-1],j=new c.DS(e.defaults),m={};if(a.all=i.all,a.when=i.when,a.reject=i.reject,h.Promise=a,f.length)for(var n=0;n=200&&a.status<300?(e.defaults.log&&e.defaults.log(b,a),a):(e.defaults.error&&e.defaults.error("FAILED: "+b,a),d.reject(a))}var e=this,f=new Date;a=i(a,e.defaults.httpConfig),e.defaults.forceTrailingSlash&&"/"!==a.url[a.url.length-1]&&(a.url+="/"),a.method=a.method.toUpperCase(),"object"==typeof a.data&&(a.data=h.removeCircular(a.data));var g=a.suffix||e.defaults.suffix;return g&&a.url.substr(a.url.length-g.length)!==g&&(a.url+=g),b(a).then(c,c)};var e=new f(a.defaults);return c.registerAdapter("http",e,{"default":!0}),e}]}),b.module("js-data").run(["DS","DSHttpAdapter",function(a,b){a.registerAdapter("http",b,{"default":!0})}])}return"js-data"});
+!function(a,b){"object"==typeof exports&&"object"==typeof module?module.exports=b(function(){try{return require("js-data")}catch(a){}}(),function(){try{return require("angular")}catch(a){}}()):"function"==typeof define&&define.amd?define(["js-data","angular"],b):"object"==typeof exports?exports.jsDataAngularModuleName=b(function(){try{return require("js-data")}catch(a){}}(),function(){try{return require("angular")}catch(a){}}()):a.jsDataAngularModuleName=b(a.JSData,a.angular)}(this,function(a,b){return function(a){function b(d){if(c[d])return c[d].exports;var e=c[d]={exports:{},id:d,loaded:!1};return a[d].call(e.exports,e,e.exports,b),e.loaded=!0,e.exports}var c={};return b.m=a,b.c=c,b.p="",b(0)}([function(a,b,c){function d(a){var b=void 0;try{b=c(3)(a.project)}catch(d){}b||(b=window[a["class"]]),b&&("http"===a.name&&(r=!0),a.loaded=!0,g.module("js-data").provider(a["class"],function(){var a=this;a.defaults={},a.$get=[function(){return new b(a.defaults)}]}))}var e=function(){function a(a,b){for(var c in b){var d=b[c];d.configurable=!0,d.value&&(d.writable=!0)}Object.defineProperties(a,b)}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),f=function(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")},g=void 0,h=void 0;try{h=c(1)}catch(i){}if(!h)try{h=window.JSData}catch(i){}if(!h)throw new Error("js-data must be loaded!");try{g=c(2)}catch(i){}if(!g)try{g=window.angular}catch(i){}if(!g)throw new Error("angular must be loaded!");var j=h.DSUtils,k=h.DSErrors,l=j.deepMixIn,m=j.copy,n=j.removeCircular,o=j.isString,p=j.isNumber,q=j.makePath,r=!1,s=[{project:"js-data-http",name:"http","class":"DSHttpAdapter"},{project:"js-data-localstorage",name:"localstorage","class":"DSLocalStorageAdapter"},{project:"js-data-localforage",name:"localforage","class":"DSLocalForageAdapter"},{project:"js-data-firebase",name:"firebase","class":"DSFirebaseAdapter"}],t=["compute","digest","eject","inject","link","linkAll","linkInverse","unlinkInverse"],u=function w(){function a(){function a(a){var b=i.defer();try{a.call(void 0,g.bind(b,b.resolve),g.bind(b,b.reject))}catch(c){b.reject(c)}return b.promise}for(var c=arguments.length,d=Array(c),e=0;c>e;e++)d[e]=arguments[e];var f=d[d.length-2],i=d[d.length-1],k=new h.DS(b.defaults),l={};if(a.all=i.all,a.when=i.when,a.reject=i.reject,j.Promise=a,d.length)for(var m=0;md;d++)c[d]=arguments[d];return f.$$phase?l[a].apply(k,c):f.$apply(function(){return l[a].apply(k,c)})}}();return("function"!=typeof Object.observe||"function"!=typeof Array.observe)&&f.$watch(function(){return k.observe.Platform.performMicrotaskCheckpoint()}),k}f(this,w);for(var b=this,c=[],d=0;d=200&&a.status<300?(d.defaults.log&&d.defaults.log(b,a),a):(d.defaults.error&&d.defaults.error("FAILED: "+b,a),f.reject(a))}var d=this,e=new Date;a=m(a),a=l(a,d.defaults.httpConfig),d.defaults.forceTrailingSlash&&"/"!==a.url[a.url.length-1]&&(a.url+="/"),a.method=a.method.toUpperCase(),"object"==typeof a.data&&(a.data=n(a.data));var g=a.suffix||d.defaults.suffix;return g&&a.url.substr(a.url.length-g.length)!==g&&(a.url+=g),b(a).then(c,c)};var g=new c(a.defaults);return e.registerAdapter("http",g,{"default":!0}),g}]};g.module("js-data").provider("DSHttpAdapter",i)}(),g.module("js-data").run(["DS","DSHttpAdapter",function(a,b){return a.registerAdapter("http",b,{"default":!0})}]),a.exports="js-data"},function(b){if("undefined"==typeof a){var c=new Error('Cannot find module "undefined"');throw c.code="MODULE_NOT_FOUND",c}b.exports=a},function(a){if("undefined"==typeof b){var c=new Error('Cannot find module "angular"');throw c.code="MODULE_NOT_FOUND",c}a.exports=b},function(a,b,c){function d(a){return c(e(a))}function e(a){return f[a]||function(){throw new Error("Cannot find module '"+a+"'.")}()}var f={};d.keys=function(){return Object.keys(f)},d.resolve=e,a.exports=d,d.id=3}])});
//# sourceMappingURL=js-data-angular.min.map
\ No newline at end of file
diff --git a/dist/js-data-angular.min.map b/dist/js-data-angular.min.map
index 92791fd..c9e321e 100644
--- a/dist/js-data-angular.min.map
+++ b/dist/js-data-angular.min.map
@@ -1 +1 @@
-{"version":3,"file":"js-data-angular.min.js","sources":["js-data-angular.js"],"names":["root","factory","define","amd","angular","JSData","undefined","exports","module","require","jsDataAngularModuleName","this","window","Defaults","DSHttpAdapter","options","defaults","deepMixIn","registerAdapter","adapter","Adapter","project","e","name","httpLoaded","loaded","provider","_this","$get","Error","DSUtils","adapters","class","functionsToWrap","value","DSErrors","load","QPromise","executor","deferred","$q","defer","call","bind","resolve","reject","err","promise","args","Array","prototype","slice","arguments","$rootScope","length","store","DS","originals","all","when","Promise","i","j","registered","k","$$phase","apply","$apply","Object","observe","$watch","Platform","performMicrotaskCheckpoint","deps","push","bindAll","resourceName","params","scope","expr","cb","definitions","NER","isObject","IA","isString","lastModified","items","filter","set","bindOne","id","resolveId","isNumber","item","get","defaultsPrototype","queryTransform","resource","basePath","forceTrailingSlash","httpConfig","log","console","a","b","info","error","deserialize","data","serialize","dsHttpAdapterPrototype","getPath","method","resourceConfig","getEndpoint","makePath","GET","url","config","HTTP","POST","attrs","copy","PUT","DEL","find","suffix","then","findAll","create","update","updateAll","destroy","destroyAll","$http","logResponse","str","start","toUTCString","toUpperCase","status","Date","getTime","removeCircular","substr","default","run"],"mappings":";;;;;;;;;;CAUC,SAAUA,EAAMC,GACf,YAEsB,mBAAXC,SAAyBA,OAAOC,IACzCD,QAAQ,UAAW,WAAY,SAAUE,EAASC,GAChD,MAAOJ,GAAQD,EAAMI,EAASC,EAAQC,UAEZ,gBAAZC,UAA0C,gBAAXC,QAC/CA,OAAOD,QAAUN,EAAQD,EAAMS,QAAQ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G,EAAMX,SAAS+G,MAoB7C,OAnBIA,IAAUR,EAAOD,IAAI2B,OAAO1B,EAAOD,IAAIhE,OAASyE,EAAOzE,UAAYyE,IACrER,EAAOD,KAAOS,GAkBTQ,EAAMhB,GAAQS,KAAKQ,EAAaA,GAGzC,IAAIrH,GAAU,GAAIL,GAAca,EAAMX,SAEtC,OADAwC,GAAGtC,gBAAgB,OAAQC,GAAW+H,WAAS,IACxC/H,MAIXf,EAAQI,OAAO,WAAW2I,KAAK,KAAM,gBAAiB,SAAU3F,EAAI1C,GAClE0C,EAAGtC,gBAAgB,OAAQJ,GAAiBoI,WAAS,OAKzD,MAAO"}
\ No newline at end of file
+{"version":3,"file":"js-data-angular.min.js","sources":["js-data-angular.js"],"names":["root","factory","exports","module","require","e","define","amd","this","__WEBPACK_EXTERNAL_MODULE_1__","__WEBPACK_EXTERNAL_MODULE_2__","modules","__webpack_require__","moduleId","installedModules","id","loaded","call","m","c","p","registerAdapter","adapter","Adapter","undefined","project","window","name","httpLoaded","angular","provider","_this","defaults","$get","_createClass","defineProperties","target","props","key","prop","configurable","value","writable","Object","Constructor","protoProps","staticProps","prototype","_classCallCheck","instance","TypeError","JSData","Error","DSUtils","DSErrors","deepMixIn","copy","removeCircular","isString","isNumber","makePath","adapters","class","functionsToWrap","DSProvider","load","QPromise","executor","deferred","$q","defer","bind","resolve","reject","err","promise","_len","arguments","length","args","Array","_key","$rootScope","store","DS","originals","all","when","Promise","i","j","registered","k","_len2","_key2","$$phase","apply","$apply","observe","$watch","Platform","performMicrotaskCheckpoint","deps","push","bindAll","resourceName","params","scope","expr","cb","definitions","NER","isObject","IA","lastModified","items","filter","set","bindOne","resolveId","item","get","Defaults","queryTransform","resourceConfig","deserialize","data","serialize","log","error","defaultsPrototype","basePath","forceTrailingSlash","httpConfig","DSHttpAdapter","options","console","a","b","info","getPath","method","getEndpoint","GET","url","config","HTTP","POST","attrs","PUT","DEL","find","suffix","then","findAll","create","update","updateAll","destroy","destroyAll","dsHttpAdapterPrototype","DSHttpAdapterProvider","$http","logResponse","str","start","toUTCString","toUpperCase","status","Date","getTime","substr","default","run","code","webpackContext","req","webpackContextResolve","map","keys"],"mappings":";;;;;;;;;;CASA,SAA2CA,EAAMC,GAC1B,gBAAZC,UAA0C,gBAAXC,QACxCA,OAAOD,QAAUD,EAAS,WAA+C,IAAM,MAAOG,SAAQ,WAAc,MAAMC,QAAa,WAA+C,IAAM,MAAOD,SAAQ,WAAc,MAAMC,SAC9L,kBAAXC,SAAyBA,OAAOC,IAC9CD,QAAQ,UAAW,WAAYL,GACL,gBAAZC,SACdA,QAAiC,wBAAID,EAAS,WAA+C,IAAM,MAAOG,SAAQ,WAAc,MAAMC,QAAa,WAA+C,IAAM,MAAOD,SAAQ,WAAc,MAAMC,SAE3OL,EAA8B,wBAAIC,EAAQD,EAAa,OAAGA,EAAc,UACvEQ,KAAM,SAASC,EAA+BC,GACjD,MAAgB,UAAUC,GAKhB,QAASC,GAAoBC,GAG5B,GAAGC,EAAiBD,GACnB,MAAOC,GAAiBD,GAAUX,OAGnC,IAAIC,GAASW,EAAiBD,IAC7BX,WACAa,GAAIF,EACJG,QAAQ,EAUT,OANAL,GAAQE,GAAUI,KAAKd,EAAOD,QAASC,EAAQA,EAAOD,QAASU,GAG/DT,EAAOa,QAAS,EAGTb,EAAOD,QAvBf,GAAIY,KAqCJ,OATAF,GAAoBM,EAAIP,EAGxBC,EAAoBO,EAAIL,EAGxBF,EAAoBQ,EAAI,GAGjBR,EAAoB,KAK/B,SAAST,EAAQD,EAASU,GAgE/B,QAASS,GAAgBC,GACvB,GAAIC,GAAUC,MAEd,KACED,EAAUX,EAAoB,GAAGU,EAAQG,SACzC,MAAOpB,IAEJkB,IACHA,EAAUG,OAAOJ,EAAQ,WAGvBC,IACmB,SAAjBD,EAAQK,OACVC,GAAa,GAEfN,EAAQN,QAAS,EACjBa,EAAQ1B,OAAO,WAAW2B,SAASR,EAAQ,SAAU,WACnD,GAAIS,GAAQvB,IACZuB,GA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,mBAAlCM,GAA+C,CAAC,GAAIJ,GAAI,GAAI+C,OAAM,iCAAkE,MAA7B/C,GAAEyK,KAAO,mBAA0BzK,EACpJF,EAAOD,QAAUO,GAIZ,SAASN,GAEd,GAA4C,mBAAlCO,GAA+C,CAAC,GAAIL,GAAI,GAAI+C,OAAM,+BAAgE,MAA7B/C,GAAEyK,KAAO,mBAA0BzK,EAClJF,EAAOD,QAAUQ,GAIZ,SAASP,EAAQD,EAASU,GAG/B,QAASmK,GAAeC,GACvB,MAAOpK,GAAoBqK,EAAsBD,IAElD,QAASC,GAAsBD,GAC9B,MAAOE,GAAIF,IAAS,WAAa,KAAM,IAAI5H,OAAM,uBAAyB4H,EAAM,SALjF,GAAIE,KAOJH,GAAeI,KAAO,WACrB,MAAOxI,QAAOwI,KAAKD,IAEpBH,EAAevG,QAAUyG,EACzB9K,EAAOD,QAAU6K,EACjBA,EAAehK,GAAK"}
\ No newline at end of file
diff --git a/package.json b/package.json
index f3686de..fab568d 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "js-data-angular",
"description": "Angular wrapper for js-data.",
- "version": "2.2.2",
+ "version": "2.2.3",
"homepage": "http://www.js-data.io/docs/js-data-angular",
"repository": {
"type": "git",
@@ -18,32 +18,39 @@
"url": "https://github.com/js-data/js-data-angular/blob/master/LICENSE"
}
],
- "main": "src/index.js",
+ "main": "dist/js-data-angular.js",
"devDependencies": {
+ "babel-core": "^4.7.3",
+ "babel-loader": "^4.1.0",
"grunt": "0.4.5",
"grunt-contrib-clean": "0.6.0",
- "grunt-contrib-jshint": "0.11.0",
"grunt-contrib-uglify": "0.8.0",
"grunt-contrib-watch": "0.6.1",
"grunt-karma": "0.10.1",
"grunt-karma-coveralls": "2.5.3",
+ "grunt-webpack": "^1.0.8",
+ "jit-grunt": "0.9.1",
+ "jshint": "^2.6.3",
+ "jshint-loader": "^0.8.3",
"karma": "0.12.31",
"karma-chai": "0.1.0",
"karma-chrome-launcher": "0.1.7",
"karma-coverage": "0.2.7",
- "karma-script-launcher": "0.1.0",
"karma-firefox-launcher": "0.1.4",
- "karma-phantomjs-launcher": "0.1.4",
"karma-mocha": "0.1.10",
+ "karma-phantomjs-launcher": "0.1.4",
+ "karma-script-launcher": "0.1.0",
"karma-sinon": "1.0.4",
"karma-spec-reporter": "0.0.16",
"time-grunt": "1.1.0",
- "jit-grunt": "0.9.1"
+ "webpack": "^1.7.2",
+ "webpack-dev-server": "^1.7.0"
},
"scripts": {
"test": "grunt test"
},
"dependencies": {
+ "angular": ">=1.1.0",
"js-data": ">=1.1.0"
}
}
diff --git a/src/index.js b/src/index.js
index fa76644..477fd4e 100644
--- a/src/index.js
+++ b/src/index.js
@@ -1,374 +1,372 @@
/*jshint loopfunc:true*/
-(function (root, factory) {
- 'use strict';
-
- if (typeof define === 'function' && define.amd) {
- define(['angular', 'js-data'], function (angular, JSData) {
- return factory(root, angular, JSData, undefined);
- });
- } else if (typeof exports === 'object' && typeof module === 'object') {
- module.exports = factory(root, require('angular') || root.angular, require('js-data') || root.JSData, undefined);
- } else if (typeof exports === 'object') {
- exports.jsDataAngularModuleName = factory(root, require('angular') || root.angular, require('js-data') || root.JSData, undefined);
- } else {
- root.jsDataAngularModuleName = factory(root, root.angular, root.JSData, undefined);
+let angular, JSData;
+try {
+ JSData = require('js-data');
+} catch (e) {
+}
+
+if (!JSData) {
+ try {
+ JSData = window.JSData;
+ } catch (e) {
}
-}(this, function (window, angular, JSData, undefined) {
- 'use strict';
-
- if (!JSData || !angular) {
- throw new Error('js-data and angular must be loaded!');
+}
+if (!JSData) {
+ throw new Error('js-data must be loaded!');
+}
+try {
+ angular = require('angular');
+} catch (e) {
+}
+
+if (!angular) {
+ try {
+ angular = window.angular;
+ } catch (e) {
}
-
- var DSUtils = JSData.DSUtils;
-
- var deepMixIn = DSUtils.deepMixIn;
- var httpLoaded = false;
-
- var adapters = [
- {
- project: 'js-data-http',
- name: 'http',
- class: 'DSHttpAdapter'
- },
- {
- project: 'js-data-localstorage',
- name: 'localstorage',
- class: 'DSLocalStorageAdapter'
- },
- {
- project: 'js-data-localforage',
- name: 'localforage',
- class: 'DSLocalForageAdapter'
- },
- {
- project: 'js-data-firebase',
- name: 'firebase',
- class: 'DSFirebaseAdapter'
- }
- ];
-
- var functionsToWrap = [
- 'compute',
- 'digest',
- 'eject',
- 'inject',
- 'link',
- 'linkAll',
- 'linkInverse',
- 'unlinkInverse'
- ];
-
- function Defaults() {
-
+}
+if (!angular) {
+ throw new Error('angular must be loaded!');
+}
+
+let DSUtils = JSData.DSUtils;
+let DSErrors = JSData.DSErrors;
+let deepMixIn = DSUtils.deepMixIn;
+let copy = DSUtils.copy;
+let removeCircular = DSUtils.removeCircular;
+let isString = DSUtils.isString;
+let isNumber = DSUtils.isNumber;
+let makePath = DSUtils.makePath;
+let httpLoaded = false;
+
+let adapters = [
+ {
+ project: 'js-data-http',
+ name: 'http',
+ class: 'DSHttpAdapter'
+ },
+ {
+ project: 'js-data-localstorage',
+ name: 'localstorage',
+ class: 'DSLocalStorageAdapter'
+ },
+ {
+ project: 'js-data-localforage',
+ name: 'localforage',
+ class: 'DSLocalForageAdapter'
+ },
+ {
+ project: 'js-data-firebase',
+ name: 'firebase',
+ class: 'DSFirebaseAdapter'
}
+];
+
+let functionsToWrap = [
+ 'compute',
+ 'digest',
+ 'eject',
+ 'inject',
+ 'link',
+ 'linkAll',
+ 'linkInverse',
+ 'unlinkInverse'
+];
+
+function registerAdapter(adapter) {
+ let Adapter;
+
+ try {
+ Adapter = require(adapter.project);
+ } catch (e) {
- function DSHttpAdapter(options) {
- this.defaults = new Defaults();
- deepMixIn(this.defaults, options);
}
- function registerAdapter(adapter) {
- var Adapter;
-
- try {
- Adapter = require(adapter.project);
- } catch (e) {
+ if (!Adapter) {
+ Adapter = window[adapter.class];
+ }
+ if (Adapter) {
+ if (adapter.name === 'http') {
+ httpLoaded = true;
}
+ adapter.loaded = true;
+ angular.module('js-data').provider(adapter.class, function () {
+ let _this = this;
+ _this.defaults = {};
+ _this.$get = [() => new Adapter(_this.defaults)];
+ });
+ }
+}
- if (!Adapter) {
- Adapter = window[adapter.class];
- }
+class DSProvider {
+ constructor() {
+ let _this = this;
+ let deps = [];
- if (Adapter) {
- if (adapter.name === 'http') {
- httpLoaded = true;
+ for (var i = 0; i < adapters.length; i++) {
+ if (adapters[i].loaded) {
+ deps.push(adapters[i].class);
}
- adapter.loaded = true;
- angular.module('js-data').provider(adapter.class, function () {
- var _this = this;
- _this.defaults = {};
- _this.$get = [function () {
- return new Adapter(_this.defaults);
- }];
- });
}
- }
- angular.module('js-data', ['ng'])
- .value('DSUtils', JSData.DSUtils)
- .value('DSErrors', JSData.DSErrors)
- .provider('DS', function () {
+ _this.defaults = {};
- var _this = this;
- var DSErrors = JSData.DSErrors;
- var deps = [];
+ JSData.DS.prototype.bindAll = function (resourceName, params, scope, expr, cb) {
+ let _this = this;
- for (var i = 0; i < adapters.length; i++) {
- if (adapters[i].loaded) {
- deps.push(adapters[i].class);
- }
- }
-
- _this.defaults = {};
+ params = params || {};
- JSData.DS.prototype.bindAll = function (resourceName, params, scope, expr, cb) {
- var _this = this;
-
- params = params || {};
+ if (!_this.definitions[resourceName]) {
+ throw new DSErrors.NER(resourceName);
+ } else if (!DSUtils.isObject(params)) {
+ throw new DSErrors.IA('"params" must be an object!');
+ } else if (!DSUtils.isObject(scope)) {
+ throw new DSErrors.IA('"scope" must be an object!');
+ } else if (!DSUtils.isString(expr)) {
+ throw new DSErrors.IA('"expr" must be a string!');
+ }
- if (!_this.definitions[resourceName]) {
- throw new DSErrors.NER(resourceName);
- } else if (!DSUtils.isObject(params)) {
- throw new DSErrors.IA('"params" must be an object!');
- } else if (!DSUtils.isObject(scope)) {
- throw new DSErrors.IA('"scope" must be an object!');
- } else if (!DSUtils.isString(expr)) {
- throw new DSErrors.IA('"expr" must be a string!');
+ try {
+ return scope.$watch(() => _this.lastModified(resourceName), () => {
+ let items = _this.filter(resourceName, params);
+ DSUtils.set(scope, expr, items);
+ if (cb) {
+ cb(null, items);
+ }
+ });
+ } catch (err) {
+ if (cb) {
+ cb(err);
+ } else {
+ throw err;
}
+ }
+ };
- try {
- return scope.$watch(function () {
- return _this.lastModified(resourceName);
- }, function () {
- var items = _this.filter(resourceName, params);
- DSUtils.set(scope, expr, items);
- if (cb) {
- cb(null, items);
- }
- });
- } catch (err) {
+ JSData.DS.prototype.bindOne = function (resourceName, id, scope, expr, cb) {
+ let _this = this;
+
+ id = DSUtils.resolveId(_this.definitions[resourceName], id);
+ if (!_this.definitions[resourceName]) {
+ throw new DSErrors.NER(resourceName);
+ } else if (!DSUtils.isString(id) && !DSUtils.isNumber(id)) {
+ throw new DSErrors.IA('"id" must be a string or a number!');
+ } else if (!DSUtils.isObject(scope)) {
+ throw new DSErrors.IA('"scope" must be an object!');
+ } else if (!DSUtils.isString(expr)) {
+ throw new DSErrors.IA('"expr" must be a string!');
+ }
+
+ try {
+ return scope.$watch(() => _this.lastModified(resourceName, id), () => {
+ let item = _this.get(resourceName, id);
+ DSUtils.set(scope, expr, item);
if (cb) {
- cb(err);
- } else {
- throw err;
+ cb(null, item);
}
+ });
+ } catch (err) {
+ if (cb) {
+ cb(err);
+ } else {
+ throw err;
}
- };
-
- JSData.DS.prototype.bindOne = function (resourceName, id, scope, expr, cb) {
- var _this = this;
-
- id = DSUtils.resolveId(_this.definitions[resourceName], id);
- if (!_this.definitions[resourceName]) {
- throw new DSErrors.NER(resourceName);
- } else if (!DSUtils.isString(id) && !DSUtils.isNumber(id)) {
- throw new DSErrors.IA('"id" must be a string or a number!');
- } else if (!DSUtils.isObject(scope)) {
- throw new DSErrors.IA('"scope" must be an object!');
- } else if (!DSUtils.isString(expr)) {
- throw new DSErrors.IA('"expr" must be a string!');
- }
+ }
+ };
+
+ function load(...args) {
+ let $rootScope = args[args.length - 2];
+ let $q = args[args.length - 1];
+ let store = new JSData.DS(_this.defaults);
+ let originals = {};
+
+ function QPromise(executor) {
+ let deferred = $q.defer();
try {
- return scope.$watch(function () {
- return _this.lastModified(resourceName, id);
- }, function () {
- var item = _this.get(resourceName, id);
- DSUtils.set(scope, expr, item);
- if (cb) {
- cb(null, item);
- }
- });
+ executor.call(undefined,
+ angular.bind(deferred, deferred.resolve),
+ angular.bind(deferred, deferred.reject));
} catch (err) {
- if (cb) {
- cb(err);
- } else {
- throw err;
- }
+ deferred.reject(err);
}
- };
-
- function load() {
- var args = Array.prototype.slice.call(arguments);
- var $rootScope = args[args.length - 2];
- var $q = args[args.length - 1];
- var store = new JSData.DS(_this.defaults);
- var originals = {};
-
- function QPromise(executor) {
- var deferred = $q.defer();
-
- try {
- executor.call(undefined,
- angular.bind(deferred, deferred.resolve),
- angular.bind(deferred, deferred.reject));
- } catch (err) {
- deferred.reject(err);
- }
- return deferred.promise;
- }
+ return deferred.promise;
+ }
- QPromise.all = $q.all;
- QPromise.when = $q.when;
- QPromise.reject = $q.reject;
+ QPromise.all = $q.all;
+ QPromise.when = $q.when;
+ QPromise.reject = $q.reject;
- DSUtils.Promise = QPromise;
+ DSUtils.Promise = QPromise;
- // Register any adapters that have been loaded
- if (args.length) {
- for (var i = 0; i < args.length; i++) {
- for (var j = 0; j < adapters.length; j++) {
- if (adapters[j].loaded && !adapters[j].registered) {
- adapters[j].registered = true;
- store.registerAdapter(adapters[j].name, args[i]);
- }
+ // Register any adapters that have been loaded
+ if (args.length) {
+ for (var i = 0; i < args.length; i++) {
+ for (var j = 0; j < adapters.length; j++) {
+ if (adapters[j].loaded && !adapters[j].registered) {
+ adapters[j].registered = true;
+ store.registerAdapter(adapters[j].name, args[i]);
}
}
}
+ }
- // Wrap certain sync functions with $apply
- for (var k = 0; k < functionsToWrap.length; k++) {
- originals[functionsToWrap[k]] = store[functionsToWrap[k]];
- store[functionsToWrap[k]] = (function (name) {
- return function () {
- var args = arguments;
- if (!$rootScope.$$phase) {
- return $rootScope.$apply(function () {
- return originals[name].apply(store, args);
- });
- }
- return originals[name].apply(store, args);
- };
- })(functionsToWrap[k]);
- }
-
- // Hook into the digest loop
- if (typeof Object.observe !== 'function' || typeof Array.observe !== 'function') {
- $rootScope.$watch(function () {
- store.observe.Platform.performMicrotaskCheckpoint();
- });
- }
-
- return store;
+ // Wrap certain sync functions with $apply
+ for (var k = 0; k < functionsToWrap.length; k++) {
+ let name = functionsToWrap[k];
+ originals[name] = store[name];
+ store[name] = (...args) => {
+ if (!$rootScope.$$phase) {
+ return $rootScope.$apply(() => originals[name].apply(store, args));
+ }
+ return originals[name].apply(store, args);
+ };
}
- deps.push('$rootScope');
- deps.push('$q');
- deps.push(load);
+ // Hook into the digest loop
+ if (typeof Object.observe !== 'function' || typeof Array.observe !== 'function') {
+ $rootScope.$watch(() => store.observe.Platform.performMicrotaskCheckpoint());
+ }
- _this.$get = deps;
- });
+ return store;
+ }
+ deps.push('$rootScope');
+ deps.push('$q');
+ deps.push(load);
- for (var i = 0; i < adapters.length; i++) {
- registerAdapter(adapters[i]);
+ _this.$get = deps;
}
+}
+angular.module('js-data', ['ng'])
+ .value('DSUtils', JSData.DSUtils)
+ .value('DSErrors', JSData.DSErrors)
+ .provider('DS', DSProvider);
+
+
+for (var i = 0; i < adapters.length; i++) {
+ registerAdapter(adapters[i]);
+}
- if (!httpLoaded) {
- var defaultsPrototype = Defaults.prototype;
+if (!httpLoaded) {
- defaultsPrototype.queryTransform = function (resource, params) {
+ class Defaults {
+ queryTransform(resourceConfig, params) {
return params;
- };
+ }
+
+ deserialize(resourceConfig, data) {
+ return data ? ('data' in data ? data.data : data) : data;
+ }
- defaultsPrototype.basePath = '';
+ serialize(resourceConfig, data) {
+ return data;
+ }
- defaultsPrototype.forceTrailingSlash = '';
+ log() {
- defaultsPrototype.httpConfig = {};
+ }
- defaultsPrototype.log = console ? function (a, b) {
- console[typeof console.info === 'function' ? 'info' : 'log'](a, b);
- } : function () {
- };
+ error() {
- defaultsPrototype.error = console ? function (a, b) {
- console[typeof console.error === 'function' ? 'error' : 'log'](a, b);
- } : function () {
- };
+ }
+ }
+ let defaultsPrototype = Defaults.prototype;
- defaultsPrototype.deserialize = function (resource, data) {
- return data ? ('data' in data ? data.data : data) : data;
- };
+ defaultsPrototype.basePath = '';
- defaultsPrototype.serialize = function (resource, data) {
- return data;
- };
+ defaultsPrototype.forceTrailingSlash = '';
+
+ defaultsPrototype.httpConfig = {};
- var dsHttpAdapterPrototype = DSHttpAdapter.prototype;
+ class DSHttpAdapter {
+ constructor(options) {
+ this.defaults = new Defaults();
+ if (console) {
+ this.defaults.log = (a, b) => console[typeof console.info === 'function' ? 'info' : 'log'](a, b);
+ }
+ if (console) {
+ this.defaults.error = (a, b) => console[typeof console.error === 'function' ? 'error' : 'log'](a, b);
+ }
+ deepMixIn(this.defaults, options);
+ }
- dsHttpAdapterPrototype.getPath = function (method, resourceConfig, id, options) {
- var _this = this;
+ getPath(method, resourceConfig, id, options) {
+ let _this = this;
options = options || {};
- var args = [
+ let args = [
options.basePath || _this.defaults.basePath || resourceConfig.basePath,
- resourceConfig.getEndpoint((DSUtils.isString(id) || DSUtils.isNumber(id) || method === 'create') ? id : null, options)
+ resourceConfig.getEndpoint((isString(id) || isNumber(id) || method === 'create') ? id : null, options)
];
if (method === 'find' || method === 'update' || method === 'destroy') {
args.push(id);
}
- return DSUtils.makePath.apply(DSUtils, args);
- };
+ return makePath.apply(DSUtils, args);
+ }
- dsHttpAdapterPrototype.GET = function (url, config) {
+ GET(url, config) {
config = config || {};
if (!('method' in config)) {
config.method = 'get';
}
return this.HTTP(deepMixIn(config, {
- url: url
+ url
}));
- };
+ }
- dsHttpAdapterPrototype.POST = function (url, attrs, config) {
+ POST(url, attrs, config) {
config = config || {};
config = DSUtils.copy(config);
if (!('method' in config)) {
config.method = 'post';
}
return this.HTTP(deepMixIn(config, {
- url: url,
+ url,
data: attrs
}));
- };
+ }
- dsHttpAdapterPrototype.PUT = function (url, attrs, config) {
+ PUT(url, attrs, config) {
config = config || {};
if (!('method' in config)) {
config.method = 'put';
}
return this.HTTP(deepMixIn(config, {
- url: url,
+ url,
data: attrs || {}
}));
- };
+ }
- dsHttpAdapterPrototype.DEL = function (url, config) {
+ DEL(url, config) {
config = config || {};
if (!('method' in config)) {
config.method = 'delete';
}
return this.HTTP(deepMixIn(config, {
- url: url
+ url
}));
- };
+ }
- dsHttpAdapterPrototype.find = function (resourceConfig, id, options) {
- var _this = this;
- options = options || {};
+ find(resourceConfig, id, options) {
+ let _this = this;
+ options = options ? copy(options) : {};
options.suffix = options.suffix || resourceConfig.suffix;
options.params = options.params || {};
options.params = _this.defaults.queryTransform(resourceConfig, options.params);
return _this.GET(
_this.getPath('find', resourceConfig, id, options),
options
- ).then(function (data) {
- var item = (options.deserialize ? options.deserialize : _this.defaults.deserialize)(resourceConfig, data);
- if (!item) {
- return JSData.DSUtils.Promise.reject(new Error('Not Found!'));
- } else {
- return item;
- }
+ ).then(data => {
+ let item = (options.deserialize ? options.deserialize : _this.defaults.deserialize)(resourceConfig, data);
+ return !item ? JSData.DSUtils.Promise.reject(new Error('Not Found!')) : item;
});
- };
+ }
- dsHttpAdapterPrototype.findAll = function (resourceConfig, params, options) {
- var _this = this;
- options = options || {};
- options = DSUtils.copy(options);
+ findAll(resourceConfig, params, options) {
+ let _this = this;
+ options = options ? copy(options) : {};
options.suffix = options.suffix || resourceConfig.suffix;
options.params = options.params || {};
if (params) {
@@ -378,14 +376,12 @@
return _this.GET(
_this.getPath('findAll', resourceConfig, params, options),
options
- ).then(function (data) {
- return (options.deserialize ? options.deserialize : _this.defaults.deserialize)(resourceConfig, data);
- });
- };
+ ).then(data => (options.deserialize ? options.deserialize : _this.defaults.deserialize)(resourceConfig, data));
+ }
- dsHttpAdapterPrototype.create = function (resourceConfig, attrs, options) {
- var _this = this;
- options = options || {};
+ create(resourceConfig, attrs, options) {
+ let _this = this;
+ options = options ? copy(options) : {};
options.suffix = options.suffix || resourceConfig.suffix;
options.params = options.params || {};
options.params = _this.defaults.queryTransform(resourceConfig, options.params);
@@ -393,14 +389,12 @@
_this.getPath('create', resourceConfig, attrs, options),
(options.serialize ? options.serialize : _this.defaults.serialize)(resourceConfig, attrs),
options
- ).then(function (data) {
- return (options.deserialize ? options.deserialize : _this.defaults.deserialize)(resourceConfig, data);
- });
- };
+ ).then(data => (options.deserialize ? options.deserialize : _this.defaults.deserialize)(resourceConfig, data));
+ }
- dsHttpAdapterPrototype.update = function (resourceConfig, id, attrs, options) {
- var _this = this;
- options = options || {};
+ update(resourceConfig, id, attrs, options) {
+ let _this = this;
+ options = options ? copy(options) : {};
options.suffix = options.suffix || resourceConfig.suffix;
options.params = options.params || {};
options.params = _this.defaults.queryTransform(resourceConfig, options.params);
@@ -408,15 +402,12 @@
_this.getPath('update', resourceConfig, id, options),
(options.serialize ? options.serialize : _this.defaults.serialize)(resourceConfig, attrs),
options
- ).then(function (data) {
- return (options.deserialize ? options.deserialize : _this.defaults.deserialize)(resourceConfig, data);
- });
- };
+ ).then(data => (options.deserialize ? options.deserialize : _this.defaults.deserialize)(resourceConfig, data));
+ }
- dsHttpAdapterPrototype.updateAll = function (resourceConfig, attrs, params, options) {
- var _this = this;
- options = options || {};
- options = DSUtils.copy(options);
+ updateAll(resourceConfig, attrs, params, options) {
+ let _this = this;
+ options = options ? copy(options) : {};
options.suffix = options.suffix || resourceConfig.suffix;
options.params = options.params || {};
if (params) {
@@ -427,29 +418,24 @@
_this.getPath('updateAll', resourceConfig, attrs, options),
(options.serialize ? options.serialize : _this.defaults.serialize)(resourceConfig, attrs),
options
- ).then(function (data) {
- return (options.deserialize ? options.deserialize : _this.defaults.deserialize)(resourceConfig, data);
- });
- };
+ ).then(data => (options.deserialize ? options.deserialize : _this.defaults.deserialize)(resourceConfig, data));
+ }
- dsHttpAdapterPrototype.destroy = function (resourceConfig, id, options) {
- var _this = this;
- options = options || {};
+ destroy(resourceConfig, id, options) {
+ let _this = this;
+ options = options ? copy(options) : {};
options.suffix = options.suffix || resourceConfig.suffix;
options.params = options.params || {};
options.params = _this.defaults.queryTransform(resourceConfig, options.params);
return _this.DEL(
_this.getPath('destroy', resourceConfig, id, options),
options
- ).then(function (data) {
- return (options.deserialize ? options.deserialize : _this.defaults.deserialize)(resourceConfig, data);
- });
- };
+ ).then(data => (options.deserialize ? options.deserialize : _this.defaults.deserialize)(resourceConfig, data));
+ }
- dsHttpAdapterPrototype.destroyAll = function (resourceConfig, params, options) {
- var _this = this;
- options = options || {};
- options = DSUtils.copy(options);
+ destroyAll(resourceConfig, params, options) {
+ let _this = this;
+ options = options ? copy(options) : {};
options.suffix = options.suffix || resourceConfig.suffix;
options.params = options.params || {};
if (params) {
@@ -459,33 +445,36 @@
return this.DEL(
_this.getPath('destroyAll', resourceConfig, params, options),
options
- ).then(function (data) {
- return (options.deserialize ? options.deserialize : _this.defaults.deserialize)(resourceConfig, data);
- });
- };
+ ).then(data => (options.deserialize ? options.deserialize : _this.defaults.deserialize)(resourceConfig, data));
+ }
+ }
+
+ let dsHttpAdapterPrototype = DSHttpAdapter.prototype;
- angular.module('js-data').provider('DSHttpAdapter', function () {
- var _this = this;
+ class DSHttpAdapterProvider {
+ constructor() {
+ let _this = this;
_this.defaults = {};
- _this.$get = ['$http', 'DS', '$q', function ($http, DS, $q) {
+ _this.$get = ['$http', 'DS', '$q', ($http, DS, $q) => {
dsHttpAdapterPrototype.HTTP = function (config) {
- var _this = this;
- var start = new Date();
+ let _this = this;
+ let start = new Date();
+ config = copy(config);
config = deepMixIn(config, _this.defaults.httpConfig);
if (_this.defaults.forceTrailingSlash && config.url[config.url.length - 1] !== '/') {
config.url += '/';
}
config.method = config.method.toUpperCase();
if (typeof config.data === 'object') {
- config.data = DSUtils.removeCircular(config.data);
+ config.data = removeCircular(config.data);
}
- var suffix = config.suffix || _this.defaults.suffix;
+ let suffix = config.suffix || _this.defaults.suffix;
if (suffix && config.url.substr(config.url.length - suffix.length) !== suffix) {
config.url += suffix;
}
function logResponse(data) {
- var str = start.toUTCString() + ' - ' + data.config.method.toUpperCase() + ' ' + data.config.url + ' - ' + data.status + ' ' + (new Date().getTime() - start.getTime()) + 'ms';
+ let 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);
@@ -493,7 +482,7 @@
return data;
} else {
if (_this.defaults.error) {
- _this.defaults.error('FAILED: ' + str, data);
+ _this.defaults.error(`FAILED: ${str}`, data);
}
return $q.reject(data);
}
@@ -502,17 +491,15 @@
return $http(config).then(logResponse, logResponse);
};
- var adapter = new DSHttpAdapter(_this.defaults);
- DS.registerAdapter('http', adapter, { default: true });
+ let adapter = new DSHttpAdapter(_this.defaults);
+ DS.registerAdapter('http', adapter, { 'default': true });
return adapter;
}];
- });
-
- angular.module('js-data').run(['DS', 'DSHttpAdapter', function (DS, DSHttpAdapter) {
- DS.registerAdapter('http', DSHttpAdapter, { default: true });
- }]);
+ }
}
+ angular.module('js-data').provider('DSHttpAdapter', DSHttpAdapterProvider);
+}
+angular.module('js-data').run(['DS', 'DSHttpAdapter', (DS, DSHttpAdapter) => DS.registerAdapter('http', DSHttpAdapter, { 'default': true })]);
- // return the module name
- return 'js-data';
-}));
+// return the module name
+export default 'js-data';