angular-data
Advanced tools
Comparing version 0.7.0 to 0.7.1
@@ -0,1 +1,6 @@ | ||
##### 0.7.1 - 26 February 2014 | ||
###### Backwards compatible bug fixes | ||
- #36 - Fixed inconsistencies in `DS.filter` when using skip or limit in the query | ||
##### 0.7.0 - 24 February 2014 | ||
@@ -6,3 +11,3 @@ | ||
###### Backwards API changes | ||
###### Backwards compatible API changes | ||
- #34 - Added `DS.ejectAll(resourceName, params)` | ||
@@ -9,0 +14,0 @@ - #33 - Added `DS.destroyAll(resourceName, params[, options])` |
/** | ||
* @author Jason Dobry <jason.dobry@gmail.com> | ||
* @file angular-data.min.js | ||
* @version 0.7.0 - Homepage <http://jmdobry.github.io/angular-data/> | ||
* @copyright (c) 2014 Jason Dobry <https://github.com/jmdobry/angular-data> | ||
* @version 0.7.1 - Homepage <http://angular-data.codetrain.io/> | ||
* @copyright (c) 2014 Jason Dobry <https://github.com/jmdobry> | ||
* @license MIT <https://github.com/jmdobry/angular-data/blob/master/LICENSE> | ||
@@ -10,3 +10,3 @@ * | ||
*/ | ||
require=function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};b[g][0].call(j.exports,function(a){var c=b[g][1][a];return e(c?c:a)},j,j.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({salHtg:[function(a,b,c){(function(){!function(a){"use strict";function b(){function a(a){"splice"===a[0].type&&"splice"===a[1].type&&(b=!0)}if("function"!=typeof Object.observe||"function"!=typeof Array.observe)return!1;var b=!1,c=[0];return Array.observe(c,a),c[1]=1,c.length=0,Object.deliverChangeRecords(a),b}function c(a){return a===Object(a)}function d(a){for(var b=0;s>b&&a.check();)a.report(),b++}function e(a){for(var b in a)return!1;return!0}function f(a){return e(a.added)&&e(a.removed)&&e(a.changed)}function g(a,b){var c={},d={},e={};for(var f in b){var g=a[f];(void 0===g||g!==b[f])&&(f in a?g!==b[f]&&(e[f]=g):d[f]=void 0)}for(var f in a)f in b||(c[f]=a[f]);return Array.isArray(a)&&a.length!==b.length&&(e.length=a.length),{added:c,removed:d,changed:e}}function h(a,b){var c=b||(Array.isArray(a)?[]:{});for(var d in a)c[d]=a[d];return Array.isArray(a)&&(c.length=a.length),c}function i(a,b,c,d){if(this.closed=!1,this.object=a,this.callback=b,this.target=c,this.token=d,this.reporting=!0,n){var e=this;this.boundInternalCallback=function(a){e.internalCallback(a)}}j(this),this.connect(),this.sync(!0)}function j(a){u&&(t.push(a),i._allObserversCount++)}function k(a,b,c,d){i.call(this,a,b,c,d)}function l(a){this.arr=[],this.callback=a,this.isObserved=!0}function m(a,b,c){for(var d={},e={},f=0;f<b.length;f++){var g=b[f];z[g.type]?(g.name in c||(c[g.name]=g.oldValue),"updated"!=g.type&&("new"!=g.type?g.name in d?(delete d[g.name],delete c[g.name]):e[g.name]=!0:g.name in e?delete e[g.name]:d[g.name]=!0)):(console.error("Unknown changeRecord type: "+g.type),console.error(g))}for(var h in d)d[h]=a[h];for(var h in e)e[h]=void 0;var i={};for(var h in c)if(!(h in d||h in e)){var j=a[h];c[h]!==j&&(i[h]=j)}return{added:d,removed:e,changed:i}}var n=b(),o=!1;try{var p=new Function("","return true;");o=p()}catch(q){}var r=(a.Number.isNaN||function(b){return"number"==typeof b&&a.isNaN(b)},"__proto__"in{}?function(a){return a}:function(a){var b=a.__proto__;if(!b)return a;var c=Object.create(b);return Object.getOwnPropertyNames(a).forEach(function(b){Object.defineProperty(c,b,Object.getOwnPropertyDescriptor(a,b))}),c}),s=1e3;i.prototype={internalCallback:function(a){this.closed||this.reporting&&this.check(a)&&(this.report(),this.testingResults&&(this.testingResults.anyChanged=!0))},close:function(){this.closed||(this.object&&"function"==typeof this.object.unobserved&&this.object.unobserved(),this.disconnect(),this.object=void 0,this.closed=!0)},deliver:function(a){this.closed||(n?(this.testingResults=a,Object.deliverChangeRecords(this.boundInternalCallback),this.testingResults=void 0):d(this))},report:function(){this.reporting&&(this.sync(!1),this.reportArgs.push(this.token),this.invokeCallback(this.reportArgs),this.reportArgs=void 0)},invokeCallback:function(a){try{this.callback.apply(this.target,a)}catch(b){i._errorThrownDuringCallback=!0,console.error("Exception caught during observer callback: "+b)}},reset:function(){this.closed||(n&&(this.reporting=!1,Object.deliverChangeRecords(this.boundInternalCallback),this.reporting=!0),this.sync(!0))}};var t,u=!n||a.forceCollectObservers;i._allObserversCount=0,u&&(t=[]);var v=!1,w="function"==typeof Object.deliverAllChangeRecords;a.Platform=a.Platform||{},a.Platform.performMicrotaskCheckpoint=function(){if(!v){if(w)return void Object.deliverAllChangeRecords();if(u){v=!0;var a=0,b={};do{a++;var c=t;t=[],b.anyChanged=!1;for(var d=0;d<c.length;d++){var e=c[d];e.closed||(n?e.deliver(b):e.check()&&(b.anyChanged=!0,e.report()),t.push(e))}}while(s>a&&b.anyChanged);i._allObserversCount=t.length,v=!1}}},u&&(a.Platform.clearObservers=function(){t=[]}),k.prototype=r({__proto__:i.prototype,connect:function(){n&&Object.observe(this.object,this.boundInternalCallback)},sync:function(){n||(this.oldObject=h(this.object))},check:function(a){var b,c;if(n){if(!a)return!1;c={},b=m(this.object,a,c)}else c=this.oldObject,b=g(this.object,this.oldObject);return f(b)?!1:(this.reportArgs=[b.added||{},b.removed||{},b.changed||{}],this.reportArgs.push(function(a){return c[a]}),!0)},disconnect:function(){n?this.object&&Object.unobserve(this.object,this.boundInternalCallback):this.oldObject=void 0}});var x=Object.getPrototypeOf({}),y=Object.getPrototypeOf([]);l.prototype={reset:function(){this.isObserved=!this.isObserved},observe:function(a){if(c(a)&&a!==x&&a!==y){var b=this.arr.indexOf(a);b>=0&&this.arr[b+1]===this.isObserved||(0>b&&(b=this.arr.length,this.arr[b]=a,Object.observe(a,this.callback)),this.arr[b+1]=this.isObserved,this.observe(Object.getPrototypeOf(a)))}},cleanup:function(){for(var a=0,b=0,c=this.isObserved;b<this.arr.length;){var d=this.arr[b];this.arr[b+1]==c?(b>a&&(this.arr[a]=d,this.arr[a+1]=c),a+=2):Object.unobserve(d,this.callback),b+=2}this.arr.length=a}};var z={"new":!0,updated:!0,deleted:!0};a.Observer=i,a.Observer.hasObjectObserve=n,a.ObjectObserver=k}((c.Number={isNaN:window.isNaN})?c:c)}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],observejs:[function(a,b){b.exports=a("salHtg")},{}],3:[function(a,b){function c(a,b){return-1!==d(a,b)}var d=a("./indexOf");b.exports=c},{"./indexOf":5}],4:[function(a,b){function c(a,b,c){b=d(b,c);var e=[];if(null==a)return e;for(var f,g=-1,h=a.length;++g<h;)f=a[g],b(f,g,a)&&e.push(f);return e}var d=a("../function/makeIterator_");b.exports=c},{"../function/makeIterator_":11}],5:[function(a,b){function c(a,b,c){if(c=c||0,null==a)return-1;for(var d=a.length,e=0>c?d+c:c;d>e;){if(a[e]===b)return e;e++}return-1}b.exports=c},{}],6:[function(a,b){function c(a){return null!=a&&""!==a}function d(a,b){return b=b||"",e(a,c).join(b)}var e=a("./filter");b.exports=d},{"./filter":4}],7:[function(a,b){function c(a,b,c){null==b?b=0:0>b&&(b=Math.max(a.length+b,0)),null==c?c=a.length:0>c&&(c=Math.max(a.length+c,0));for(var d=[];c>b;)d.push(a[b++]);return d}b.exports=c},{}],8:[function(a,b){function c(a,b){if(null==a)return[];if(a.length<2)return a;null==b&&(b=d);var f,g,h;return f=~~(a.length/2),g=c(a.slice(0,f),b),h=c(a.slice(f,a.length),b),e(g,h,b)}function d(a,b){return b>a?-1:a>b?1:0}function e(a,b,c){for(var d=[];a.length&&b.length;)d.push(c(a[0],b[0])<=0?a.shift():b.shift());return a.length&&d.push.apply(d,a),b.length&&d.push.apply(d,b),d}b.exports=c},{}],9:[function(a,b){function c(a,b){var c={};if(null==a)return c;var e,f=-1,g=a.length;if(d(b))for(;++f<g;)e=a[f],c[b(e)]=e;else for(;++f<g;)e=a[f],c[e[b]]=e;return c}var d=a("../lang/isFunction");b.exports=c},{"../lang/isFunction":15}],10:[function(a,b){function c(a){return a}b.exports=c},{}],11:[function(a,b){function c(a,b){if(null==a)return d;switch(typeof a){case"function":return"undefined"!=typeof b?function(c,d,e){return a.call(b,c,d,e)}:a;case"object":return function(b){return f(b,a)};case"string":case"number":return e(a)}}var d=a("./identity"),e=a("./prop"),f=a("../object/deepMatches");b.exports=c},{"../object/deepMatches":20,"./identity":10,"./prop":12}],12:[function(a,b){function c(a){return function(b){return b[a]}}b.exports=c},{}],13:[function(a,b){var c=a("./isKind"),d=Array.isArray||function(a){return c(a,"Array")};b.exports=d},{"./isKind":16}],14:[function(a,b){function c(a){if(null==a)return!1;if("string"==typeof a||e(a))return!a.length;if("object"==typeof a||"function"==typeof a){var b=!0;return d(a,function(){return b=!1,!1}),b}return!1}var d=a("../object/forOwn"),e=a("./isArray");b.exports=c},{"../object/forOwn":23,"./isArray":13}],15:[function(a,b){function c(a){return d(a,"Function")}var d=a("./isKind");b.exports=c},{"./isKind":16}],16:[function(a,b){function c(a,b){return d(a)===b}var d=a("./kindOf");b.exports=c},{"./kindOf":18}],17:[function(a,b){function c(a){return!!a&&"object"==typeof a&&a.constructor===Object}b.exports=c},{}],18:[function(a,b){function c(a){return null===a?"Null":a===d?"Undefined":e.exec(f.call(a))[1]}var d,e=/^\[object (.*)\]$/,f=Object.prototype.toString;b.exports=c},{}],19:[function(a,b){function c(a){return null==a?"":a.toString()}b.exports=c},{}],20:[function(a,b){function c(a,b){for(var c=-1,d=a.length;++c<d;)if(f(a[c],b))return!0;return!1}function d(a,b){for(var d=-1,e=b.length;++d<e;)if(!c(a,b[d]))return!1;return!0}function e(a,b){var c=!0;return g(b,function(b,d){return f(a[d],b)?void 0:c=!1}),c}function f(a,b){return a&&"object"==typeof a?h(a)&&h(b)?d(a,b):e(a,b):a===b}var g=a("./forOwn"),h=a("../lang/isArray");b.exports=f},{"../lang/isArray":13,"./forOwn":23}],21:[function(a,b){function c(a){for(var b,c=0,f=arguments.length;++c<f;)b=arguments[c],b&&e(b,d,a);return a}function d(a,b){var d=this[b];f(a)&&f(d)?c(d,a):this[b]=a}var e=a("./forOwn"),f=a("../lang/isPlainObject");b.exports=c},{"../lang/isPlainObject":17,"./forOwn":23}],22:[function(a,b){function c(){g=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],f=!0;for(var a in{toString:null})f=!1}function d(a,b,d){var i,j=0;null==f&&c();for(i in a)if(e(b,a,i,d)===!1)break;if(f)for(var k=a.constructor,l=!!k&&a===k.prototype;(i=g[j++])&&("constructor"===i&&(l||!h(a,i))||a[i]===Object.prototype[i]||e(b,a,i,d)!==!1););}function e(a,b,c,d){return a.call(d,b[c],c,b)}var f,g,h=a("./hasOwn");b.exports=d},{"./hasOwn":24}],23:[function(a,b){function c(a,b,c){e(a,function(e,f){return d(a,f)?b.call(c,a[f],f,a):void 0})}var d=a("./hasOwn"),e=a("./forIn");b.exports=c},{"./forIn":22,"./hasOwn":24}],24:[function(a,b){function c(a,b){return Object.prototype.hasOwnProperty.call(a,b)}b.exports=c},{}],25:[function(a,b){function c(){var a=d(e(arguments),"/");return a.replace(/([^:\/]|^)\/{2,}/g,"$1/")}var d=a("../array/join"),e=a("../array/slice");b.exports=c},{"../array/join":6,"../array/slice":7}],26:[function(a,b){function c(a){return a=d(a),a.toUpperCase()}var d=a("../lang/toString");b.exports=c},{"../lang/toString":19}],27:[function(a,b){function c(){this.$get=["$http","$log","DSUtils",function(a,b,c){function d(c){var d=(new Date).getTime();return a(c).then(function(a){return b.debug(a.config.method+" request:"+a.config.url+" Time taken: "+((new Date).getTime()-d)+"ms",arguments),o.deserialize(a)})}function e(a,b){return b=b||{},d(c.deepMixIn(b,{url:a,method:"GET"}))}function f(a,b,e){return e=e||{},d(c.deepMixIn(e,{url:a,data:b,method:"POST"}))}function g(a,b,e){return e=e||{},d(c.deepMixIn(e,{url:a,data:b,method:"PUT"}))}function h(a,b){return b=b||{},this.HTTP(c.deepMixIn(b,{url:a,method:"DELETE"}))}function i(a,b,d){return d=d||{},this.GET(c.makePath(a.baseUrl,a.endpoint,b),d)}function j(a,b,d){return d=d||{},d.params=d.params||{},d.params.query&&(d.params.query=o.queryTransform(d.params.query)),c.deepMixIn(d,b),this.GET(c.makePath(a.baseUrl,a.endpoint),d)}function k(a,b,d){return d=d||{},this.POST(c.makePath(a.baseUrl,a.endpoint),o.serialize(b),d)}function l(a,b,d,e){return this.PUT(c.makePath(a.baseUrl,a.endpoint,b),o.serialize(d),e)}function m(a,b,d){return d=d||{},this.DEL(c.makePath(a.baseUrl,a.endpoint,b),d)}function n(a,b,d){return d=d||{},d.params=d.params||{},d.params.query&&(d.params.query=o.queryTransform(d.params.query)),c.deepMixIn(d,b),this.DEL(c.makePath(a.baseUrl,a.endpoint),d)}var o=this.defaults={serialize:function(a){return a},deserialize:function(a){return a.data},queryTransform:function(a){return a}};return{defaults:o,HTTP:d,GET:e,POST:f,PUT:g,DEL:h,find:i,findAll:j,create:k,createMany:function(){throw new Error("Not yet implemented!")},update:l,updateMany:function(){throw new Error("Not yet implemented!")},destroy:m,destroyAll:n}}]}b.exports=c},{}],28:[function(a,b){function c(a,b,c){var e=this.$q.defer(),f=e.promise;if(c=c||{},this.definitions[a])if(this.utils.isObject(b))try{var g=this.definitions[a],h=this.store[a],i=this;f=f.then(function(b){return i.$q.promisify(g.beforeValidate)(a,b)}).then(function(b){return i.$q.promisify(g.validate)(a,b)}).then(function(b){return i.$q.promisify(g.afterValidate)(a,b)}).then(function(b){return i.$q.promisify(g.beforeCreate)(a,b)}).then(function(a){return i.adapters[c.adapter||g.defaultAdapter].create(g,a,c)}).then(function(b){return i.$q.promisify(g.afterCreate)(a,b)}).then(function(a){var b=i.inject(g.name,a),c=b[g.idAttribute];return h.previousAttributes[c]=i.utils.deepMixIn({},b),h.saved[c]=i.utils.updateTimestamp(h.saved[c]),i.get(g.name,c)}),e.resolve(b)}catch(j){e.reject(new this.errors.UnhandledError(j))}else e.reject(new this.errors.IllegalArgumentError(d+"attrs: Must be an object!",{attrs:{actual:typeof b,expected:"object"}}));else e.reject(new this.errors.RuntimeError(d+a+" is not a registered resource!"));return f}var d="DS.create(resourceName, attrs): ";b.exports=c},{}],29:[function(a,b){function c(a,b,c){var e=this.$q.defer(),f=e.promise;if(c=c||{},this.definitions[a])if(this.utils.isString(b)||this.utils.isNumber(b))if(b in this.store[a].index){var g=this.definitions[a],h=this.store[a],i=this;b in h.index?(f=f.then(function(b){return i.$q.promisify(g.beforeDestroy)(a,b)}).then(function(){return i.adapters[c.adapter||g.defaultAdapter].destroy(g,b,c)}).then(function(){return i.$q.promisify(g.afterDestroy)(a,h.index[b])}).then(function(){return i.eject(a,b),b}),e.resolve(h.index[b])):e.resolve()}else e.reject(new this.errors.RuntimeError(d+'id: "'+b+'" not found!'));else e.reject(new this.errors.IllegalArgumentError(d+"id: Must be a string or a number!",{id:{actual:typeof b,expected:"string|number"}}));else e.reject(new this.errors.RuntimeError(d+a+" is not a registered resource!"));return f}var d="DS.destroy(resourceName, id): ";b.exports=c},{}],30:[function(a,b){function c(a,b,c){var e=this.$q.defer(),f=e.promise,g=this;if(c=c||{},this.definitions[a])if(this.utils.isObject(b))if(this.utils.isObject(c))try{var h=this.definitions[a];f=f.then(function(){return g.adapters[c.adapter||h.defaultAdapter].destroyAll(h,{params:b},c)}).then(function(){return g.ejectAll(a,b)}),e.resolve()}catch(i){e.reject(new this.errors.UnhandledError(i))}else e.reject(new this.errors.IllegalArgumentError(d+"options: Must be an object!",{options:{actual:typeof c,expected:"object"}}));else e.reject(new this.errors.IllegalArgumentError(d+"params: Must be an object!",{params:{actual:typeof b,expected:"object"}}));else e.reject(new this.errors.RuntimeError(d+a+" is not a registered resource!"));return f}var d="DS.destroyAll(resourceName, params[, options]): ";b.exports=c},{}],31:[function(a,b){function c(a,b,c){var e=this.$q.defer(),f=e.promise;if(c=c||{},this.definitions[a])if(this.utils.isString(b)||this.utils.isNumber(b))if(this.utils.isObject(c)){c.cacheResponse="cacheResponse"in c?!!c.cacheResponse:!0;try{var g=this.definitions[a],h=this.store[a],i=this;if(c.bypassCache&&delete h.completedQueries[b],!(b in h.completedQueries))return b in h.pendingQueries||(f=h.pendingQueries[b]=i.adapters[c.adapter||g.defaultAdapter].find(g,b,c).then(function(d){return c.cacheResponse?(delete h.pendingQueries[b],h.completedQueries[b]=(new Date).getTime(),i.inject(a,d)):d})),h.pendingQueries[b];e.resolve(i.get(a,b))}catch(j){e.reject(j)}}else e.reject(new this.errors.IllegalArgumentError(d+"options: Must be an object!",{options:{actual:typeof c,expected:"object"}}));else e.reject(new this.errors.IllegalArgumentError(d+"id: Must be a string or a number!",{id:{actual:typeof b,expected:"string|number"}}));else e.reject(new this.errors.RuntimeError(d+a+" is not a registered resource!"));return f}var d="DS.find(resourceName, id[, options]): ";b.exports=c},{}],32:[function(a,b){function c(a,b,c,d){var e=this.store[c];b=b||[],delete e.pendingQueries[d],e.completedQueries[d]=(new Date).getTime();for(var f=0;f<b.length;f++)this.inject(c,b[f]);return e.index=a.toLookup(e.collection,this.definitions[c].idAttribute),e.collectionModified=a.updateTimestamp(e.collectionModified),b}function d(a,b,d,e){var f=this.definitions[b],g=this.store[b],h=this,i=a.toJson(d);return e.bypassCache&&delete g.completedQueries[i],i in g.completedQueries?this.filter(b,d,e):(i in g.pendingQueries||(g.pendingQueries[i]=h.adapters[e.adapter||f.defaultAdapter].findAll(f,{params:d},e).then(function(d){if(!e.cacheResponse)return d;try{return c.apply(h,[a,d,b,i])}catch(f){throw new h.errors.UnhandledError(f)}})),g.pendingQueries[i])}function e(a,b,c){var e=this.$q.defer(),g=e.promise,h=this;if(c=c||{},this.definitions[a])if(this.utils.isObject(b))if(this.utils.isObject(c)){c.cacheResponse="cacheResponse"in c?!!c.cacheResponse:!0;try{g=g.then(function(){return d.apply(h,[h.utils,a,b,c])}),e.resolve()}catch(i){e.reject(new this.errors.UnhandledError(i))}}else e.reject(new this.errors.IllegalArgumentError(f+"options: Must be an object!",{options:{actual:typeof c,expected:"object"}}));else e.reject(new this.errors.IllegalArgumentError(f+"params: Must be an object!",{params:{actual:typeof b,expected:"object"}}));else e.reject(new this.errors.RuntimeError(f+a+" is not a registered resource!"));return g}var f="DS.findAll(resourceName, params[, options]): ";b.exports=e},{}],33:[function(a,b){b.exports={create:a("./create"),destroy:a("./destroy"),destroyAll:a("./destroyAll"),find:a("./find"),findAll:a("./findAll"),refresh:a("./refresh"),save:a("./save")}},{"./create":28,"./destroy":29,"./destroyAll":30,"./find":31,"./findAll":32,"./refresh":34,"./save":35}],34:[function(a,b){function c(a,b,c){if(c=c||{},this.definitions[a]){if(this.utils.isString(b)||this.utils.isNumber(b)){if(this.utils.isObject(c))return c.bypassCache=!0,b in this.store[a].index?this.find(a,b,c):!1;throw new this.errors.IllegalArgumentError(d+"options: Must be an object!",{options:{actual:typeof c,expected:"object"}})}throw new this.errors.IllegalArgumentError(d+"id: Must be a string or a number!",{id:{actual:typeof b,expected:"string|number"}})}throw new this.errors.RuntimeError(d+a+" is not a registered resource!")}var d="DS.refresh(resourceName, id[, options]): ";b.exports=c},{}],35:[function(a,b){function c(a,b,c){var e=this.$q.defer(),f=e.promise;if(c=c||{},this.definitions[a])if(this.utils.isString(b)||this.utils.isNumber(b))if(this.utils.isObject(c))if(b in this.store[a].index){var g=this.definitions[a],h=this.store[a],i=this;f=f.then(function(b){return i.$q.promisify(g.beforeValidate)(a,b)}).then(function(b){return i.$q.promisify(g.validate)(a,b)}).then(function(b){return i.$q.promisify(g.afterValidate)(a,b)}).then(function(b){return i.$q.promisify(g.beforeUpdate)(a,b)}).then(function(a){return i.adapters[c.adapter||g.defaultAdapter].update(g,b,a,c)}).then(function(b){return i.$q.promisify(g.afterUpdate)(a,b)}).then(function(d){return i.inject(g.name,d,c),h.previousAttributes[b]=i.utils.deepMixIn({},d),h.saved[b]=i.utils.updateTimestamp(h.saved[b]),i.get(a,b)}),e.resolve(h.index[b])}else e.reject(new this.errors.RuntimeError(d+'id: "'+b+'" not found!'));else e.reject(new this.errors.IllegalArgumentError(d+"options: Must be an object!",{options:{actual:typeof c,expected:"object"}}));else e.reject(new this.errors.IllegalArgumentError(d+"id: Must be a string or a number!",{id:{actual:typeof b,expected:"string|number"}}));else e.reject(new this.errors.RuntimeError(d+a+" is not a registered resource!"));return f}var d="DS.save(resourceName, id[, options]): ";b.exports=c},{}],36:[function(a,b){function c(a,b,c){c(null,b)}function d(){}function e(){var b=this.defaults=new d;this.$get=["$rootScope","$log","$q","DSHttpAdapter","DSUtils","DSErrors",function(c,d,e,f,g,h){var i=a("./sync_methods"),j=a("./async_methods"),k={$rootScope:c,$log:d,$q:e,defaults:b,store:{},definitions:{},adapters:{DSHttpAdapter:f},errors:h,utils:g};g.deepFreeze(i),g.deepFreeze(j),g.deepMixIn(k,i),g.deepMixIn(k,j),g.deepFreeze(k.errors),g.deepFreeze(k.utils);var l=c.$new();return l.$watch(function(){return(new Date).getTime()/100|0},function(){k.digest()}),k}]}var f=a("../utils")[0]();d.prototype.idAttribute="id",d.prototype.defaultAdapter="DSHttpAdapter",d.prototype.filter=function(a,b,c){var d=!0;return f.forOwn(b,function(a,b){f.isString(a)?a={"===":a}:f.isNumber(a)&&(a={"==":a}),"=="in a?d=d&&c[b]==a["=="]:"==="in a?d=d&&c[b]===a["==="]:"!="in a?d=d&&c[b]!=a["!="]:">"in a?d=d&&c[b]>a[">"]:">="in a?d=d&&c[b]>=a[">="]:"<"in a?d=d&&c[b]<a["<"]:"<="in a?d=d&&c[b]<=a["<="]:"in"in a&&(d=d&&f.contains(a["in"],c[b]))}),d},d.prototype.baseUrl="",d.prototype.endpoint="",d.prototype.beforeValidate=c,d.prototype.validate=c,d.prototype.afterValidate=c,d.prototype.beforeCreate=c,d.prototype.afterCreate=c,d.prototype.beforeUpdate=c,d.prototype.afterUpdate=c,d.prototype.beforeDestroy=c,d.prototype.afterDestroy=c,b.exports=e},{"../utils":"uE/lJt","./async_methods":33,"./sync_methods":45}],37:[function(a,b){function c(a,b){if(!this.definitions[a])throw new this.errors.RuntimeError(d+a+" is not a registered resource!");if(!this.utils.isString(b)&&!this.utils.isNumber(b))throw new this.errors.IllegalArgumentError(d+"id: Must be a string or a number!",{id:{actual:typeof b,expected:"string|number"}});try{return angular.copy(this.store[a].changes[b])}catch(c){throw new this.errors.UnhandledError(c)}}var d="DS.changes(resourceName, id): ";b.exports=c},{}],38:[function(a,b){function c(a,b){a.deepMixIn(this,b),this.endpoint="endpoint"in b?b.endpoint:this.name}function d(a){if(this.utils.isString(a)&&(a={name:a}),!this.utils.isObject(a))throw new this.errors.IllegalArgumentError(e+"definition: Must be an object!",{definition:{actual:typeof a,expected:"object"}});if(!this.utils.isString(a.name))throw new this.errors.IllegalArgumentError(e+"definition.name: Must be a string!",{definition:{name:{actual:typeof a.name,expected:"string"}}});if(a.idAttribute&&!this.utils.isString(a.idAttribute))throw new this.errors.IllegalArgumentError(e+"definition.idAttribute: Must be a string!",{definition:{idAttribute:{actual:typeof a.idAttribute,expected:"string"}}});if(a.endpoint&&!this.utils.isString(a.endpoint))throw new this.errors.IllegalArgumentError(e+"definition.endpoint: Must be a string!",{definition:{endpoint:{actual:typeof a.endpoint,expected:"string"}}});if(this.store[a.name])throw new this.errors.RuntimeError(e+a.name+" is already registered!");try{c.prototype=this.defaults,this.definitions[a.name]=new c(this.utils,a),this.store[a.name]={collection:[],completedQueries:{},pendingQueries:{},index:{},changes:{},modified:{},saved:{},previousAttributes:{},observers:{},collectionModified:0}}catch(b){throw delete this.definitions[a.name],delete this.store[a.name],new this.errors.UnhandledError(b)}}var e="DS.defineResource(definition): ";b.exports=d},{}],39:[function(a,b){function c(){try{this.$rootScope.$$phase?d.Platform.performMicrotaskCheckpoint():this.$rootScope.$apply(function(){d.Platform.performMicrotaskCheckpoint()})}catch(a){throw new this.errors.UnhandledError(a)}}var d=a("observejs");b.exports=c},{observejs:"salHtg"}],40:[function(a,b){function c(a,b,c){for(var d=!1,e=0;e<b.collection.length;e++)if(b.collection[e][a.idAttribute]==c){d=!0;break}d&&(b.collection.splice(e,1),b.observers[c].close(),delete b.observers[c],delete b.index[c],delete b.changes[c],delete b.previousAttributes[c],delete b.modified[c],delete b.saved[c])}function d(a,b){if(!this.definitions[a])throw new this.errors.RuntimeError(e+a+" is not a registered resource!");if(!this.utils.isString(b)&&!this.utils.isNumber(b))throw new this.errors.IllegalArgumentError(e+"id: Must be a string or a number!",{id:{actual:typeof b,expected:"string|number"}});var d=this.store[a],f=this;try{this.$rootScope.$$phase?(c(f.definitions[a],d,b),d.collectionModified=f.utils.updateTimestamp(d.collectionModified)):this.$rootScope.$apply(function(){c(f.definitions[a],d,b),d.collectionModified=f.utils.updateTimestamp(d.collectionModified)}),delete this.store[a].completedQueries[b]}catch(g){throw new this.errors.UnhandledError(g)}}var e="DS.eject(resourceName, id): ";b.exports=d},{}],41:[function(a,b){function c(a,b,c){for(var d=this.utils.toJson(c),e=this.filter(a.name,c),f=0;f<e.length;f++)this.eject(a.name,e[f][a.idAttribute]);delete b.completedQueries[d]}function d(a,b){if(b=b||{},!this.definitions[a])throw new this.errors.RuntimeError(e+a+" is not a registered resource!");if(!this.utils.isObject(b))throw new this.errors.IllegalArgumentError(e+"params: Must be an object!",{params:{actual:typeof b,expected:"object"}});var d=this.store[a],f=this;try{this.$rootScope.$$phase?(c.apply(f,[f.definitions[a],d,b]),d.collectionModified=this.utils.updateTimestamp(d.collectionModified)):this.$rootScope.$apply(function(){c.apply(f,[f.definitions[a],d,b]),d.collectionModified=f.utils.updateTimestamp(d.collectionModified)})}catch(g){throw new this.errors.UnhandledError(g)}}var e="DS.ejectAll(resourceName[, params]): ";b.exports=d},{}],42:[function(a,b){function c(a,b,c){if(c=c||{},!this.definitions[a])throw new this.errors.RuntimeError(d+a+" is not a registered resource!");if(!this.utils.isObject(b))throw new this.errors.IllegalArgumentError(d+"params: Must be an object!",{params:{actual:typeof b,expected:"object"}});if(!this.utils.isObject(c))throw new this.errors.IllegalArgumentError(d+"options: Must be an object!",{options:{actual:typeof c,expected:"object"}});try{var e=this.definitions[a],f=this.store[a],g=this;b.query=b.query||{};var h=this.utils.toJson(b);h in f.completedQueries||!c.loadFromServer||f.pendingQueries[h]||this.findAll(a,b,c);var i=this.utils.filter(f.collection,function(c){var f=!0,h=b.query.where;if(h){if(!g.utils.isObject(h))throw new g.errors.IllegalArgumentError(d+"params.query.where: Must be an object!",{params:{query:{where:{actual:typeof b.query.where,expected:"object"}}}});f=e.filter(a,h,c)}return f});if(b.query.orderBy){if(this.utils.isString(b.query.orderBy)&&(b.query.orderBy=[[b.query.orderBy,"ASC"]]),!this.utils.isArray(b.query.orderBy))throw new this.errors.IllegalArgumentError(d+"params.query.orderBy: Must be a string or an array!",{params:{query:{orderBy:{actual:typeof b.query.orderBy,expected:"string|array"}}}});for(var j=0;j<b.query.orderBy.length;j++){if(this.utils.isString(b.query.orderBy[j]))b.query.orderBy[j]=[b.query.orderBy[j],"ASC"];else if(!this.utils.isArray(b.query.orderBy[j]))throw new this.errors.IllegalArgumentError(d+"params.query.orderBy["+j+"]: Must be a string or an array!",{params:{query:{"orderBy[i]":{actual:typeof b.query.orderBy[j],expected:"string|array"}}}});i=this.utils.sort(i,function(a,c){var d=a[b.query.orderBy[j][0]],e=c[b.query.orderBy[j][0]];return g.utils.isString(d)&&(d=g.utils.upperCase(d)),g.utils.isString(e)&&(e=g.utils.upperCase(e)),"DESC"===b.query.orderBy[j][1]?d>e?-1:e>d?1:0:e>d?-1:d>e?1:0})}}return this.utils.isNumber(b.query.limit)&&this.utils.isNumber(b.query.skip)?i=this.utils.slice(i,b.query.skip,b.query.skip+b.query.limit):this.utils.isNumber(b.query.limit)?i=this.utils.slice(i,0,b.query.limit):this.utils.isNumber(b.query.skip)&&(i=this.utils.slice(i,b.query.skip)),i}catch(k){throw k instanceof this.errors.IllegalArgumentError?k:new this.errors.UnhandledError(k)}}var d="DS.filter(resourceName, params[, options]): ";b.exports=c},{}],43:[function(a,b){function c(a,b,c){if(c=c||{},!this.definitions[a])throw new this.errors.RuntimeError(d+a+" is not a registered resource!");if(!this.utils.isString(b)&&!this.utils.isNumber(b))throw new this.errors.IllegalArgumentError(d+"id: Must be a string or a number!",{id:{actual:typeof b,expected:"string|number"}});if(!this.utils.isObject(c))throw new this.errors.IllegalArgumentError(d+"options: Must be an object!",{options:{actual:typeof c,expected:"object"}});try{return b in this.store[a].index||!c.loadFromServer||this.find(a,b).then(null,function(a){throw a}),this.store[a].index[b]}catch(e){throw new this.errors.UnhandledError(e)}}var d="DS.get(resourceName, id[, options]): ";b.exports=c},{}],44:[function(a,b){function c(a,b){return!(a.isEmpty(b.added)&&a.isEmpty(b.removed)&&a.isEmpty(b.changed))}function d(a,b){if(!this.definitions[a])throw new this.errors.RuntimeError(e+a+" is not a registered resource!");if(!this.utils.isString(b)&&!this.utils.isNumber(b))throw new this.errors.IllegalArgumentError(e+"id: Must be a string or a number!",{id:{actual:typeof b,expected:"string|number"}});try{return b in this.store[a].changes?c(this.utils,this.store[a].changes[b]):!1}catch(d){throw new this.errors.UnhandledError(d)}}var e="DS.hasChanges(resourceName, id): ";b.exports=d},{}],45:[function(a,b){b.exports={defineResource:a("./defineResource"),eject:a("./eject"),ejectAll:a("./ejectAll"),filter:a("./filter"),get:a("./get"),inject:a("./inject"),lastModified:a("./lastModified"),lastSaved:a("./lastSaved"),digest:a("./digest"),changes:a("./changes"),previous:a("./previous"),hasChanges:a("./hasChanges")}},{"./changes":37,"./defineResource":38,"./digest":39,"./eject":40,"./ejectAll":41,"./filter":42,"./get":43,"./hasChanges":44,"./inject":46,"./lastModified":47,"./lastSaved":48,"./previous":49}],46:[function(a,b){function c(a,b,d){function g(c,d,e,f){try{var g=f(a.idAttribute);b.changes[g]=h.utils.diffObjectFromOldObject(b.index[g],b.previousAttributes[g]),b.modified[g]=h.utils.updateTimestamp(b.modified[g]),b.collectionModified=h.utils.updateTimestamp(b.collectionModified),a.idAttribute in e&&$log.error("Doh! You just changed the primary key of an object! I don't know how to handle this yet, so your data for the \""+a.name+'" resource is now in an undefined (probably broken) state.')}catch(i){throw new h.errors.UnhandledError(i)}}var h=this;if(h.utils.isArray(d))for(var i=0;i<d.length;i++)c.call(h,a,b,d[i]);else{if(!(a.idAttribute in d))throw new h.errors.RuntimeError(f+"attrs: Must contain the property specified by `idAttribute`!");var j=d[a.idAttribute];j in b.index?(h.utils.deepMixIn(b.index[j],d),b.observers[j].deliver()):(b.index[j]={},b.previousAttributes[j]={},h.utils.deepMixIn(b.index[j],d),h.utils.deepMixIn(b.previousAttributes[j],d),b.collection.push(b.index[j]),b.observers[j]=new e.ObjectObserver(b.index[j],g),g({},{},{},function(){return j}))}}function d(a,b,d){if(d=d||{},!this.definitions[a])throw new this.errors.RuntimeError(f+a+" is not a registered resource!");if(!this.utils.isObject(b)&&!this.utils.isArray(b))throw new this.errors.IllegalArgumentError(f+"attrs: Must be an object or an array!",{attrs:{actual:typeof b,expected:"object|array"}});if(!this.utils.isObject(d))throw new this.errors.IllegalArgumentError(f+"options: Must be an object!",{options:{actual:typeof d,expected:"object"}});var e=this.definitions[a],g=this.store[a],h=this;try{return this.$rootScope.$$phase?c.apply(h,[e,g,b]):this.$rootScope.$apply(function(){c.apply(h,[e,g,b])}),b}catch(i){throw i instanceof this.errors.RuntimeError?i:new this.errors.UnhandledError(i)}}var e=a("observejs"),f="DS.inject(resourceName, attrs[, options]): ";b.exports=d},{observejs:"salHtg"}],47:[function(a,b){function c(a,b){if(!this.definitions[a])throw new this.errors.RuntimeError(d+a+" is not a registered resource!");if(b&&!this.utils.isString(b)&&!this.utils.isNumber(b))throw new this.errors.IllegalArgumentError(d+"id: Must be a string or a number!",{id:{actual:typeof b,expected:"string|number"}});try{return b?(b in this.store[a].modified||(this.store[a].modified[b]=0),this.store[a].modified[b]):this.store[a].collectionModified}catch(c){throw new this.errors.UnhandledError(c)}}var d="DS.lastModified(resourceName[, id]): ";b.exports=c},{}],48:[function(a,b){function c(a,b){if(!this.definitions[a])throw new this.errors.RuntimeError(d+a+" is not a registered resource!");if(b&&!this.utils.isString(b)&&!this.utils.isNumber(b))throw new this.errors.IllegalArgumentError(d+"id: Must be a string or a number!",{id:{actual:typeof b,expected:"string|number"}});try{return b?(b in this.store[a].saved||(this.store[a].saved[b]=0),this.store[a].saved[b]):this.store[a].collectionModified}catch(c){throw new this.errors.UnhandledError(c) | ||
}}var d="DS.lastSaved(resourceName[, id]): ";b.exports=c},{}],49:[function(a,b){function c(a,b){if(!this.definitions[a])throw new this.errors.RuntimeError(d+a+" is not a registered resource!");if(!this.utils.isString(b)&&!this.utils.isNumber(b))throw new this.errors.IllegalArgumentError(d+"id: Must be a string or a number!",{id:{actual:typeof b,expected:"string|number"}});try{return angular.copy(this.store[a].previousAttributes[b])}catch(c){throw new this.errors.UnhandledError(c)}}var d="DS.previous(resourceName, id): ";b.exports=c},{}],errors:[function(a,b){b.exports=a("hIh4e1")},{}],hIh4e1:[function(a,b){function c(a){Error.call(this),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),a=a||{},this.type=this.constructor.name,this.originalError=a,this.message="UnhandledError: This is an uncaught exception. Please consider submitting an issue at https://github.com/jmdobry/angular-data/issues.\n\nOriginal Uncaught Exception:\n"+(a.stack?a.stack.toString():a.stack),this.stack=this.message}function d(a,b){Error.call(this),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.type=this.constructor.name,this.errors=b||{},this.message=a||"Illegal Argument!"}function e(a,b){Error.call(this),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.type=this.constructor.name,this.errors=b||{},this.message=a||"RuntimeError Error!"}c.prototype=Object.create(Error.prototype),c.prototype.constructor=c,d.prototype=Object.create(Error.prototype),d.prototype.constructor=d,e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,b.exports=[function(){return{UnhandledError:c,IllegalArgumentError:d,RuntimeError:e}}]},{}],52:[function(a){!function(b,c){"use strict";c.module("angular-data.DS",["ng"]).service("DSUtils",a("./utils")).service("DSErrors",a("./errors")).provider("DSHttpAdapter",a("./adapters/http")).provider("DS",a("./datastore")).config(["$provide",function(a){a.decorator("$q",function(a){return a.promisify=function(a,b){var c=this;return function(){var d=c.defer(),e=Array.prototype.slice.apply(arguments);e.push(function(a,b){a?d.reject(a):d.resolve(b)});try{a.apply(b||this,e)}catch(f){d.reject(f)}return d.promise}},a})}])}(window,window.angular)},{"./adapters/http":27,"./datastore":36,"./errors":"hIh4e1","./utils":"uE/lJt"}],"uE/lJt":[function(a,b){b.exports=[function(){return{isString:angular.isString,isArray:angular.isArray,isObject:angular.isObject,isNumber:angular.isNumber,isFunction:angular.isFunction,isEmpty:a("mout/lang/isEmpty"),toJson:angular.toJson,makePath:a("mout/string/makePath"),upperCase:a("mout/string/upperCase"),deepMixIn:a("mout/object/deepMixIn"),forOwn:a("mout/object/forOwn"),contains:a("mout/array/contains"),filter:a("mout/array/filter"),toLookup:a("mout/array/toLookup"),slice:a("mout/array/slice"),sort:a("mout/array/sort"),updateTimestamp:function(a){var b="function"==typeof Date.now?Date.now():(new Date).getTime();return a&&a>=b?a+1:b},deepFreeze:function b(a){if("function"==typeof Object.freeze){var c,d;Object.freeze(a);for(d in a)c=a[d],a.hasOwnProperty(d)&&"object"==typeof c&&!Object.isFrozen(c)&&b(c)}},diffObjectFromOldObject:function(a,b){var c={},d={},e={};for(var f in b){var g=a[f];(void 0===g||g!==b[f])&&(f in a?g!==b[f]&&(e[f]=g):d[f]=void 0)}for(var h in a)h in b||(c[h]=a[h]);return{added:c,removed:d,changed:e}}}}]},{"mout/array/contains":3,"mout/array/filter":4,"mout/array/slice":7,"mout/array/sort":8,"mout/array/toLookup":9,"mout/lang/isEmpty":14,"mout/object/deepMixIn":21,"mout/object/forOwn":23,"mout/string/makePath":25,"mout/string/upperCase":26}],utils:[function(a,b){b.exports=a("uE/lJt")},{}]},{},[52]); | ||
require=function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};b[g][0].call(j.exports,function(a){var c=b[g][1][a];return e(c?c:a)},j,j.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({QYwGEY:[function(a,b,c){(function(){!function(a){"use strict";function b(){function a(a){"splice"===a[0].type&&"splice"===a[1].type&&(b=!0)}if("function"!=typeof Object.observe||"function"!=typeof Array.observe)return!1;var b=!1,c=[0];return Array.observe(c,a),c[1]=1,c.length=0,Object.deliverChangeRecords(a),b}function c(a){return a===Object(a)}function d(a){for(var b=0;s>b&&a.check();)a.report(),b++}function e(a){for(var b in a)return!1;return!0}function f(a){return e(a.added)&&e(a.removed)&&e(a.changed)}function g(a,b){var c={},d={},e={};for(var f in b){var g=a[f];(void 0===g||g!==b[f])&&(f in a?g!==b[f]&&(e[f]=g):d[f]=void 0)}for(var f in a)f in b||(c[f]=a[f]);return Array.isArray(a)&&a.length!==b.length&&(e.length=a.length),{added:c,removed:d,changed:e}}function h(a,b){var c=b||(Array.isArray(a)?[]:{});for(var d in a)c[d]=a[d];return Array.isArray(a)&&(c.length=a.length),c}function i(a,b,c,d){if(this.closed=!1,this.object=a,this.callback=b,this.target=c,this.token=d,this.reporting=!0,n){var e=this;this.boundInternalCallback=function(a){e.internalCallback(a)}}j(this),this.connect(),this.sync(!0)}function j(a){u&&(t.push(a),i._allObserversCount++)}function k(a,b,c,d){i.call(this,a,b,c,d)}function l(a){this.arr=[],this.callback=a,this.isObserved=!0}function m(a,b,c){for(var d={},e={},f=0;f<b.length;f++){var g=b[f];z[g.type]?(g.name in c||(c[g.name]=g.oldValue),"updated"!=g.type&&("new"!=g.type?g.name in d?(delete d[g.name],delete c[g.name]):e[g.name]=!0:g.name in e?delete e[g.name]:d[g.name]=!0)):(console.error("Unknown changeRecord type: "+g.type),console.error(g))}for(var h in d)d[h]=a[h];for(var h in e)e[h]=void 0;var i={};for(var h in c)if(!(h in d||h in e)){var j=a[h];c[h]!==j&&(i[h]=j)}return{added:d,removed:e,changed:i}}var n=b(),o=!1;try{var p=new Function("","return true;");o=p()}catch(q){}var r=(a.Number.isNaN||function(b){return"number"==typeof b&&a.isNaN(b)},"__proto__"in{}?function(a){return a}:function(a){var b=a.__proto__;if(!b)return a;var c=Object.create(b);return Object.getOwnPropertyNames(a).forEach(function(b){Object.defineProperty(c,b,Object.getOwnPropertyDescriptor(a,b))}),c}),s=1e3;i.prototype={internalCallback:function(a){this.closed||this.reporting&&this.check(a)&&(this.report(),this.testingResults&&(this.testingResults.anyChanged=!0))},close:function(){this.closed||(this.object&&"function"==typeof this.object.unobserved&&this.object.unobserved(),this.disconnect(),this.object=void 0,this.closed=!0)},deliver:function(a){this.closed||(n?(this.testingResults=a,Object.deliverChangeRecords(this.boundInternalCallback),this.testingResults=void 0):d(this))},report:function(){this.reporting&&(this.sync(!1),this.reportArgs.push(this.token),this.invokeCallback(this.reportArgs),this.reportArgs=void 0)},invokeCallback:function(a){try{this.callback.apply(this.target,a)}catch(b){i._errorThrownDuringCallback=!0,console.error("Exception caught during observer callback: "+b)}},reset:function(){this.closed||(n&&(this.reporting=!1,Object.deliverChangeRecords(this.boundInternalCallback),this.reporting=!0),this.sync(!0))}};var t,u=!n||a.forceCollectObservers;i._allObserversCount=0,u&&(t=[]);var v=!1,w="function"==typeof Object.deliverAllChangeRecords;a.Platform=a.Platform||{},a.Platform.performMicrotaskCheckpoint=function(){if(!v){if(w)return void Object.deliverAllChangeRecords();if(u){v=!0;var a=0,b={};do{a++;var c=t;t=[],b.anyChanged=!1;for(var d=0;d<c.length;d++){var e=c[d];e.closed||(n?e.deliver(b):e.check()&&(b.anyChanged=!0,e.report()),t.push(e))}}while(s>a&&b.anyChanged);i._allObserversCount=t.length,v=!1}}},u&&(a.Platform.clearObservers=function(){t=[]}),k.prototype=r({__proto__:i.prototype,connect:function(){n&&Object.observe(this.object,this.boundInternalCallback)},sync:function(){n||(this.oldObject=h(this.object))},check:function(a){var b,c;if(n){if(!a)return!1;c={},b=m(this.object,a,c)}else c=this.oldObject,b=g(this.object,this.oldObject);return f(b)?!1:(this.reportArgs=[b.added||{},b.removed||{},b.changed||{}],this.reportArgs.push(function(a){return c[a]}),!0)},disconnect:function(){n?this.object&&Object.unobserve(this.object,this.boundInternalCallback):this.oldObject=void 0}});var x=Object.getPrototypeOf({}),y=Object.getPrototypeOf([]);l.prototype={reset:function(){this.isObserved=!this.isObserved},observe:function(a){if(c(a)&&a!==x&&a!==y){var b=this.arr.indexOf(a);b>=0&&this.arr[b+1]===this.isObserved||(0>b&&(b=this.arr.length,this.arr[b]=a,Object.observe(a,this.callback)),this.arr[b+1]=this.isObserved,this.observe(Object.getPrototypeOf(a)))}},cleanup:function(){for(var a=0,b=0,c=this.isObserved;b<this.arr.length;){var d=this.arr[b];this.arr[b+1]==c?(b>a&&(this.arr[a]=d,this.arr[a+1]=c),a+=2):Object.unobserve(d,this.callback),b+=2}this.arr.length=a}};var z={"new":!0,updated:!0,deleted:!0};a.Observer=i,a.Observer.hasObjectObserve=n,a.ObjectObserver=k}((c.Number={isNaN:window.isNaN})?c:c)}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],observejs:[function(a,b){b.exports=a("QYwGEY")},{}],3:[function(a,b){function c(a,b){return-1!==d(a,b)}var d=a("./indexOf");b.exports=c},{"./indexOf":5}],4:[function(a,b){function c(a,b,c){b=d(b,c);var e=[];if(null==a)return e;for(var f,g=-1,h=a.length;++g<h;)f=a[g],b(f,g,a)&&e.push(f);return e}var d=a("../function/makeIterator_");b.exports=c},{"../function/makeIterator_":11}],5:[function(a,b){function c(a,b,c){if(c=c||0,null==a)return-1;for(var d=a.length,e=0>c?d+c:c;d>e;){if(a[e]===b)return e;e++}return-1}b.exports=c},{}],6:[function(a,b){function c(a){return null!=a&&""!==a}function d(a,b){return b=b||"",e(a,c).join(b)}var e=a("./filter");b.exports=d},{"./filter":4}],7:[function(a,b){function c(a,b,c){null==b?b=0:0>b&&(b=Math.max(a.length+b,0)),null==c?c=a.length:0>c&&(c=Math.max(a.length+c,0));for(var d=[];c>b;)d.push(a[b++]);return d}b.exports=c},{}],8:[function(a,b){function c(a,b){if(null==a)return[];if(a.length<2)return a;null==b&&(b=d);var f,g,h;return f=~~(a.length/2),g=c(a.slice(0,f),b),h=c(a.slice(f,a.length),b),e(g,h,b)}function d(a,b){return b>a?-1:a>b?1:0}function e(a,b,c){for(var d=[];a.length&&b.length;)d.push(c(a[0],b[0])<=0?a.shift():b.shift());return a.length&&d.push.apply(d,a),b.length&&d.push.apply(d,b),d}b.exports=c},{}],9:[function(a,b){function c(a,b){var c={};if(null==a)return c;var e,f=-1,g=a.length;if(d(b))for(;++f<g;)e=a[f],c[b(e)]=e;else for(;++f<g;)e=a[f],c[e[b]]=e;return c}var d=a("../lang/isFunction");b.exports=c},{"../lang/isFunction":15}],10:[function(a,b){function c(a){return a}b.exports=c},{}],11:[function(a,b){function c(a,b){if(null==a)return d;switch(typeof a){case"function":return"undefined"!=typeof b?function(c,d,e){return a.call(b,c,d,e)}:a;case"object":return function(b){return f(b,a)};case"string":case"number":return e(a)}}var d=a("./identity"),e=a("./prop"),f=a("../object/deepMatches");b.exports=c},{"../object/deepMatches":20,"./identity":10,"./prop":12}],12:[function(a,b){function c(a){return function(b){return b[a]}}b.exports=c},{}],13:[function(a,b){var c=a("./isKind"),d=Array.isArray||function(a){return c(a,"Array")};b.exports=d},{"./isKind":16}],14:[function(a,b){function c(a){if(null==a)return!1;if("string"==typeof a||e(a))return!a.length;if("object"==typeof a||"function"==typeof a){var b=!0;return d(a,function(){return b=!1,!1}),b}return!1}var d=a("../object/forOwn"),e=a("./isArray");b.exports=c},{"../object/forOwn":23,"./isArray":13}],15:[function(a,b){function c(a){return d(a,"Function")}var d=a("./isKind");b.exports=c},{"./isKind":16}],16:[function(a,b){function c(a,b){return d(a)===b}var d=a("./kindOf");b.exports=c},{"./kindOf":18}],17:[function(a,b){function c(a){return!!a&&"object"==typeof a&&a.constructor===Object}b.exports=c},{}],18:[function(a,b){function c(a){return null===a?"Null":a===d?"Undefined":e.exec(f.call(a))[1]}var d,e=/^\[object (.*)\]$/,f=Object.prototype.toString;b.exports=c},{}],19:[function(a,b){function c(a){return null==a?"":a.toString()}b.exports=c},{}],20:[function(a,b){function c(a,b){for(var c=-1,d=a.length;++c<d;)if(f(a[c],b))return!0;return!1}function d(a,b){for(var d=-1,e=b.length;++d<e;)if(!c(a,b[d]))return!1;return!0}function e(a,b){var c=!0;return g(b,function(b,d){return f(a[d],b)?void 0:c=!1}),c}function f(a,b){return a&&"object"==typeof a?h(a)&&h(b)?d(a,b):e(a,b):a===b}var g=a("./forOwn"),h=a("../lang/isArray");b.exports=f},{"../lang/isArray":13,"./forOwn":23}],21:[function(a,b){function c(a){for(var b,c=0,f=arguments.length;++c<f;)b=arguments[c],b&&e(b,d,a);return a}function d(a,b){var d=this[b];f(a)&&f(d)?c(d,a):this[b]=a}var e=a("./forOwn"),f=a("../lang/isPlainObject");b.exports=c},{"../lang/isPlainObject":17,"./forOwn":23}],22:[function(a,b){function c(){g=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],f=!0;for(var a in{toString:null})f=!1}function d(a,b,d){var i,j=0;null==f&&c();for(i in a)if(e(b,a,i,d)===!1)break;if(f)for(var k=a.constructor,l=!!k&&a===k.prototype;(i=g[j++])&&("constructor"===i&&(l||!h(a,i))||a[i]===Object.prototype[i]||e(b,a,i,d)!==!1););}function e(a,b,c,d){return a.call(d,b[c],c,b)}var f,g,h=a("./hasOwn");b.exports=d},{"./hasOwn":24}],23:[function(a,b){function c(a,b,c){e(a,function(e,f){return d(a,f)?b.call(c,a[f],f,a):void 0})}var d=a("./hasOwn"),e=a("./forIn");b.exports=c},{"./forIn":22,"./hasOwn":24}],24:[function(a,b){function c(a,b){return Object.prototype.hasOwnProperty.call(a,b)}b.exports=c},{}],25:[function(a,b){function c(){var a=d(e(arguments),"/");return a.replace(/([^:\/]|^)\/{2,}/g,"$1/")}var d=a("../array/join"),e=a("../array/slice");b.exports=c},{"../array/join":6,"../array/slice":7}],26:[function(a,b){function c(a){return a=d(a),a.toUpperCase()}var d=a("../lang/toString");b.exports=c},{"../lang/toString":19}],27:[function(a,b){function c(){this.$get=["$http","$log","DSUtils",function(a,b,c){function d(c){var d=(new Date).getTime();return a(c).then(function(a){return b.debug(a.config.method+" request:"+a.config.url+" Time taken: "+((new Date).getTime()-d)+"ms",arguments),o.deserialize(a)})}function e(a,b){return b=b||{},d(c.deepMixIn(b,{url:a,method:"GET"}))}function f(a,b,e){return e=e||{},d(c.deepMixIn(e,{url:a,data:b,method:"POST"}))}function g(a,b,e){return e=e||{},d(c.deepMixIn(e,{url:a,data:b,method:"PUT"}))}function h(a,b){return b=b||{},this.HTTP(c.deepMixIn(b,{url:a,method:"DELETE"}))}function i(a,b,d){return d=d||{},this.GET(c.makePath(a.baseUrl,a.endpoint,b),d)}function j(a,b,d){return d=d||{},d.params=d.params||{},d.params.query&&(d.params.query=o.queryTransform(d.params.query)),c.deepMixIn(d,b),this.GET(c.makePath(a.baseUrl,a.endpoint),d)}function k(a,b,d){return d=d||{},this.POST(c.makePath(a.baseUrl,a.endpoint),o.serialize(b),d)}function l(a,b,d,e){return this.PUT(c.makePath(a.baseUrl,a.endpoint,b),o.serialize(d),e)}function m(a,b,d){return d=d||{},this.DEL(c.makePath(a.baseUrl,a.endpoint,b),d)}function n(a,b,d){return d=d||{},d.params=d.params||{},d.params.query&&(d.params.query=o.queryTransform(d.params.query)),c.deepMixIn(d,b),this.DEL(c.makePath(a.baseUrl,a.endpoint),d)}var o=this.defaults={serialize:function(a){return a},deserialize:function(a){return a.data},queryTransform:function(a){return a}};return{defaults:o,HTTP:d,GET:e,POST:f,PUT:g,DEL:h,find:i,findAll:j,create:k,createMany:function(){throw new Error("Not yet implemented!")},update:l,updateMany:function(){throw new Error("Not yet implemented!")},destroy:m,destroyAll:n}}]}b.exports=c},{}],28:[function(a,b){function c(a,b,c){var e=this.$q.defer(),f=e.promise;if(c=c||{},this.definitions[a])if(this.utils.isObject(b))try{var g=this.definitions[a],h=this.store[a],i=this;f=f.then(function(b){return i.$q.promisify(g.beforeValidate)(a,b)}).then(function(b){return i.$q.promisify(g.validate)(a,b)}).then(function(b){return i.$q.promisify(g.afterValidate)(a,b)}).then(function(b){return i.$q.promisify(g.beforeCreate)(a,b)}).then(function(a){return i.adapters[c.adapter||g.defaultAdapter].create(g,a,c)}).then(function(b){return i.$q.promisify(g.afterCreate)(a,b)}).then(function(a){var b=i.inject(g.name,a),c=b[g.idAttribute];return h.previousAttributes[c]=i.utils.deepMixIn({},b),h.saved[c]=i.utils.updateTimestamp(h.saved[c]),i.get(g.name,c)}),e.resolve(b)}catch(j){e.reject(new this.errors.UnhandledError(j))}else e.reject(new this.errors.IllegalArgumentError(d+"attrs: Must be an object!",{attrs:{actual:typeof b,expected:"object"}}));else e.reject(new this.errors.RuntimeError(d+a+" is not a registered resource!"));return f}var d="DS.create(resourceName, attrs): ";b.exports=c},{}],29:[function(a,b){function c(a,b,c){var e=this.$q.defer(),f=e.promise;if(c=c||{},this.definitions[a])if(this.utils.isString(b)||this.utils.isNumber(b))if(b in this.store[a].index){var g=this.definitions[a],h=this.store[a],i=this;b in h.index?(f=f.then(function(b){return i.$q.promisify(g.beforeDestroy)(a,b)}).then(function(){return i.adapters[c.adapter||g.defaultAdapter].destroy(g,b,c)}).then(function(){return i.$q.promisify(g.afterDestroy)(a,h.index[b])}).then(function(){return i.eject(a,b),b}),e.resolve(h.index[b])):e.resolve()}else e.reject(new this.errors.RuntimeError(d+'id: "'+b+'" not found!'));else e.reject(new this.errors.IllegalArgumentError(d+"id: Must be a string or a number!",{id:{actual:typeof b,expected:"string|number"}}));else e.reject(new this.errors.RuntimeError(d+a+" is not a registered resource!"));return f}var d="DS.destroy(resourceName, id): ";b.exports=c},{}],30:[function(a,b){function c(a,b,c){var e=this.$q.defer(),f=e.promise,g=this;if(c=c||{},this.definitions[a])if(this.utils.isObject(b))if(this.utils.isObject(c))try{var h=this.definitions[a];f=f.then(function(){return g.adapters[c.adapter||h.defaultAdapter].destroyAll(h,{params:b},c)}).then(function(){return g.ejectAll(a,b)}),e.resolve()}catch(i){e.reject(new this.errors.UnhandledError(i))}else e.reject(new this.errors.IllegalArgumentError(d+"options: Must be an object!",{options:{actual:typeof c,expected:"object"}}));else e.reject(new this.errors.IllegalArgumentError(d+"params: Must be an object!",{params:{actual:typeof b,expected:"object"}}));else e.reject(new this.errors.RuntimeError(d+a+" is not a registered resource!"));return f}var d="DS.destroyAll(resourceName, params[, options]): ";b.exports=c},{}],31:[function(a,b){function c(a,b,c){var e=this.$q.defer(),f=e.promise;if(c=c||{},this.definitions[a])if(this.utils.isString(b)||this.utils.isNumber(b))if(this.utils.isObject(c)){c.cacheResponse="cacheResponse"in c?!!c.cacheResponse:!0;try{var g=this.definitions[a],h=this.store[a],i=this;if(c.bypassCache&&delete h.completedQueries[b],!(b in h.completedQueries))return b in h.pendingQueries||(f=h.pendingQueries[b]=i.adapters[c.adapter||g.defaultAdapter].find(g,b,c).then(function(d){return c.cacheResponse?(delete h.pendingQueries[b],h.completedQueries[b]=(new Date).getTime(),i.inject(a,d)):d})),h.pendingQueries[b];e.resolve(i.get(a,b))}catch(j){e.reject(j)}}else e.reject(new this.errors.IllegalArgumentError(d+"options: Must be an object!",{options:{actual:typeof c,expected:"object"}}));else e.reject(new this.errors.IllegalArgumentError(d+"id: Must be a string or a number!",{id:{actual:typeof b,expected:"string|number"}}));else e.reject(new this.errors.RuntimeError(d+a+" is not a registered resource!"));return f}var d="DS.find(resourceName, id[, options]): ";b.exports=c},{}],32:[function(a,b){function c(a,b,c,d){var e=this.store[c];b=b||[],delete e.pendingQueries[d],e.completedQueries[d]=(new Date).getTime();for(var f=0;f<b.length;f++)this.inject(c,b[f]);return e.index=a.toLookup(e.collection,this.definitions[c].idAttribute),e.collectionModified=a.updateTimestamp(e.collectionModified),b}function d(a,b,d,e){var f=this.definitions[b],g=this.store[b],h=this,i=a.toJson(d);return e.bypassCache&&delete g.completedQueries[i],i in g.completedQueries?this.filter(b,d,e):(i in g.pendingQueries||(g.pendingQueries[i]=h.adapters[e.adapter||f.defaultAdapter].findAll(f,{params:d},e).then(function(d){if(!e.cacheResponse)return d;try{return c.apply(h,[a,d,b,i])}catch(f){throw new h.errors.UnhandledError(f)}})),g.pendingQueries[i])}function e(a,b,c){var e=this.$q.defer(),g=e.promise,h=this;if(c=c||{},this.definitions[a])if(this.utils.isObject(b))if(this.utils.isObject(c)){c.cacheResponse="cacheResponse"in c?!!c.cacheResponse:!0;try{g=g.then(function(){return d.apply(h,[h.utils,a,b,c])}),e.resolve()}catch(i){e.reject(new this.errors.UnhandledError(i))}}else e.reject(new this.errors.IllegalArgumentError(f+"options: Must be an object!",{options:{actual:typeof c,expected:"object"}}));else e.reject(new this.errors.IllegalArgumentError(f+"params: Must be an object!",{params:{actual:typeof b,expected:"object"}}));else e.reject(new this.errors.RuntimeError(f+a+" is not a registered resource!"));return g}var f="DS.findAll(resourceName, params[, options]): ";b.exports=e},{}],33:[function(a,b){b.exports={create:a("./create"),destroy:a("./destroy"),destroyAll:a("./destroyAll"),find:a("./find"),findAll:a("./findAll"),refresh:a("./refresh"),save:a("./save")}},{"./create":28,"./destroy":29,"./destroyAll":30,"./find":31,"./findAll":32,"./refresh":34,"./save":35}],34:[function(a,b){function c(a,b,c){if(c=c||{},this.definitions[a]){if(this.utils.isString(b)||this.utils.isNumber(b)){if(this.utils.isObject(c))return c.bypassCache=!0,b in this.store[a].index?this.find(a,b,c):!1;throw new this.errors.IllegalArgumentError(d+"options: Must be an object!",{options:{actual:typeof c,expected:"object"}})}throw new this.errors.IllegalArgumentError(d+"id: Must be a string or a number!",{id:{actual:typeof b,expected:"string|number"}})}throw new this.errors.RuntimeError(d+a+" is not a registered resource!")}var d="DS.refresh(resourceName, id[, options]): ";b.exports=c},{}],35:[function(a,b){function c(a,b,c){var e=this.$q.defer(),f=e.promise;if(c=c||{},this.definitions[a])if(this.utils.isString(b)||this.utils.isNumber(b))if(this.utils.isObject(c))if(b in this.store[a].index){var g=this.definitions[a],h=this.store[a],i=this;f=f.then(function(b){return i.$q.promisify(g.beforeValidate)(a,b)}).then(function(b){return i.$q.promisify(g.validate)(a,b)}).then(function(b){return i.$q.promisify(g.afterValidate)(a,b)}).then(function(b){return i.$q.promisify(g.beforeUpdate)(a,b)}).then(function(a){return i.adapters[c.adapter||g.defaultAdapter].update(g,b,a,c)}).then(function(b){return i.$q.promisify(g.afterUpdate)(a,b)}).then(function(d){return i.inject(g.name,d,c),h.previousAttributes[b]=i.utils.deepMixIn({},d),h.saved[b]=i.utils.updateTimestamp(h.saved[b]),i.get(a,b)}),e.resolve(h.index[b])}else e.reject(new this.errors.RuntimeError(d+'id: "'+b+'" not found!'));else e.reject(new this.errors.IllegalArgumentError(d+"options: Must be an object!",{options:{actual:typeof c,expected:"object"}}));else e.reject(new this.errors.IllegalArgumentError(d+"id: Must be a string or a number!",{id:{actual:typeof b,expected:"string|number"}}));else e.reject(new this.errors.RuntimeError(d+a+" is not a registered resource!"));return f}var d="DS.save(resourceName, id[, options]): ";b.exports=c},{}],36:[function(a,b){function c(a,b,c){c(null,b)}function d(){}function e(){var b=this.defaults=new d;this.$get=["$rootScope","$log","$q","DSHttpAdapter","DSUtils","DSErrors",function(c,d,e,f,g,h){var i=a("./sync_methods"),j=a("./async_methods"),k={$rootScope:c,$log:d,$q:e,defaults:b,store:{},definitions:{},adapters:{DSHttpAdapter:f},errors:h,utils:g};g.deepFreeze(i),g.deepFreeze(j),g.deepMixIn(k,i),g.deepMixIn(k,j),g.deepFreeze(k.errors),g.deepFreeze(k.utils);var l=c.$new();return l.$watch(function(){return(new Date).getTime()/100|0},function(){k.digest()}),k}]}var f=a("../utils")[0]();d.prototype.idAttribute="id",d.prototype.defaultAdapter="DSHttpAdapter",d.prototype.filter=function(a,b,c){var d=!0;return f.forOwn(b,function(a,b){f.isString(a)?a={"===":a}:f.isNumber(a)&&(a={"==":a}),"=="in a?d=d&&c[b]==a["=="]:"==="in a?d=d&&c[b]===a["==="]:"!="in a?d=d&&c[b]!=a["!="]:">"in a?d=d&&c[b]>a[">"]:">="in a?d=d&&c[b]>=a[">="]:"<"in a?d=d&&c[b]<a["<"]:"<="in a?d=d&&c[b]<=a["<="]:"in"in a&&(d=d&&f.contains(a["in"],c[b]))}),d},d.prototype.baseUrl="",d.prototype.endpoint="",d.prototype.beforeValidate=c,d.prototype.validate=c,d.prototype.afterValidate=c,d.prototype.beforeCreate=c,d.prototype.afterCreate=c,d.prototype.beforeUpdate=c,d.prototype.afterUpdate=c,d.prototype.beforeDestroy=c,d.prototype.afterDestroy=c,b.exports=e},{"../utils":"iWjGJZ","./async_methods":33,"./sync_methods":45}],37:[function(a,b){function c(a,b){if(!this.definitions[a])throw new this.errors.RuntimeError(d+a+" is not a registered resource!");if(!this.utils.isString(b)&&!this.utils.isNumber(b))throw new this.errors.IllegalArgumentError(d+"id: Must be a string or a number!",{id:{actual:typeof b,expected:"string|number"}});try{return angular.copy(this.store[a].changes[b])}catch(c){throw new this.errors.UnhandledError(c)}}var d="DS.changes(resourceName, id): ";b.exports=c},{}],38:[function(a,b){function c(a,b){a.deepMixIn(this,b),this.endpoint="endpoint"in b?b.endpoint:this.name}function d(a){if(this.utils.isString(a)&&(a={name:a}),!this.utils.isObject(a))throw new this.errors.IllegalArgumentError(e+"definition: Must be an object!",{definition:{actual:typeof a,expected:"object"}});if(!this.utils.isString(a.name))throw new this.errors.IllegalArgumentError(e+"definition.name: Must be a string!",{definition:{name:{actual:typeof a.name,expected:"string"}}});if(a.idAttribute&&!this.utils.isString(a.idAttribute))throw new this.errors.IllegalArgumentError(e+"definition.idAttribute: Must be a string!",{definition:{idAttribute:{actual:typeof a.idAttribute,expected:"string"}}});if(a.endpoint&&!this.utils.isString(a.endpoint))throw new this.errors.IllegalArgumentError(e+"definition.endpoint: Must be a string!",{definition:{endpoint:{actual:typeof a.endpoint,expected:"string"}}});if(this.store[a.name])throw new this.errors.RuntimeError(e+a.name+" is already registered!");try{c.prototype=this.defaults,this.definitions[a.name]=new c(this.utils,a),this.store[a.name]={collection:[],completedQueries:{},pendingQueries:{},index:{},changes:{},modified:{},saved:{},previousAttributes:{},observers:{},collectionModified:0}}catch(b){throw delete this.definitions[a.name],delete this.store[a.name],new this.errors.UnhandledError(b)}}var e="DS.defineResource(definition): ";b.exports=d},{}],39:[function(a,b){function c(){try{this.$rootScope.$$phase?d.Platform.performMicrotaskCheckpoint():this.$rootScope.$apply(function(){d.Platform.performMicrotaskCheckpoint()})}catch(a){throw new this.errors.UnhandledError(a)}}var d=a("observejs");b.exports=c},{observejs:"QYwGEY"}],40:[function(a,b){function c(a,b,c){for(var d=!1,e=0;e<b.collection.length;e++)if(b.collection[e][a.idAttribute]==c){d=!0;break}d&&(b.collection.splice(e,1),b.observers[c].close(),delete b.observers[c],delete b.index[c],delete b.changes[c],delete b.previousAttributes[c],delete b.modified[c],delete b.saved[c])}function d(a,b){if(!this.definitions[a])throw new this.errors.RuntimeError(e+a+" is not a registered resource!");if(!this.utils.isString(b)&&!this.utils.isNumber(b))throw new this.errors.IllegalArgumentError(e+"id: Must be a string or a number!",{id:{actual:typeof b,expected:"string|number"}});var d=this.store[a],f=this;try{this.$rootScope.$$phase?(c(f.definitions[a],d,b),d.collectionModified=f.utils.updateTimestamp(d.collectionModified)):this.$rootScope.$apply(function(){c(f.definitions[a],d,b),d.collectionModified=f.utils.updateTimestamp(d.collectionModified)}),delete this.store[a].completedQueries[b]}catch(g){throw new this.errors.UnhandledError(g)}}var e="DS.eject(resourceName, id): ";b.exports=d},{}],41:[function(a,b){function c(a,b,c){for(var d=this.utils.toJson(c),e=this.filter(a.name,c),f=0;f<e.length;f++)this.eject(a.name,e[f][a.idAttribute]);delete b.completedQueries[d]}function d(a,b){if(b=b||{},!this.definitions[a])throw new this.errors.RuntimeError(e+a+" is not a registered resource!");if(!this.utils.isObject(b))throw new this.errors.IllegalArgumentError(e+"params: Must be an object!",{params:{actual:typeof b,expected:"object"}});var d=this.store[a],f=this;try{this.$rootScope.$$phase?(c.apply(f,[f.definitions[a],d,b]),d.collectionModified=this.utils.updateTimestamp(d.collectionModified)):this.$rootScope.$apply(function(){c.apply(f,[f.definitions[a],d,b]),d.collectionModified=f.utils.updateTimestamp(d.collectionModified)})}catch(g){throw new this.errors.UnhandledError(g)}}var e="DS.ejectAll(resourceName[, params]): ";b.exports=d},{}],42:[function(a,b){function c(a,b,c){if(c=c||{},!this.definitions[a])throw new this.errors.RuntimeError(d+a+" is not a registered resource!");if(!this.utils.isObject(b))throw new this.errors.IllegalArgumentError(d+"params: Must be an object!",{params:{actual:typeof b,expected:"object"}});if(!this.utils.isObject(c))throw new this.errors.IllegalArgumentError(d+"options: Must be an object!",{options:{actual:typeof c,expected:"object"}});try{var e=this.definitions[a],f=this.store[a],g=this;b.query=b.query||{};var h=this.utils.toJson(b);h in f.completedQueries||!c.loadFromServer||f.pendingQueries[h]||this.findAll(a,b,c);var i=this.utils.filter(f.collection,function(c){var f=!0,h=b.query.where;if(h){if(!g.utils.isObject(h))throw new g.errors.IllegalArgumentError(d+"params.query.where: Must be an object!",{params:{query:{where:{actual:typeof b.query.where,expected:"object"}}}});f=e.filter(a,h,c)}return f});if(b.query.orderBy){if(this.utils.isString(b.query.orderBy)&&(b.query.orderBy=[[b.query.orderBy,"ASC"]]),!this.utils.isArray(b.query.orderBy))throw new this.errors.IllegalArgumentError(d+"params.query.orderBy: Must be a string or an array!",{params:{query:{orderBy:{actual:typeof b.query.orderBy,expected:"string|array"}}}});for(var j=0;j<b.query.orderBy.length;j++){if(this.utils.isString(b.query.orderBy[j]))b.query.orderBy[j]=[b.query.orderBy[j],"ASC"];else if(!this.utils.isArray(b.query.orderBy[j]))throw new this.errors.IllegalArgumentError(d+"params.query.orderBy["+j+"]: Must be a string or an array!",{params:{query:{"orderBy[i]":{actual:typeof b.query.orderBy[j],expected:"string|array"}}}});i=this.utils.sort(i,function(a,c){var d=a[b.query.orderBy[j][0]],e=c[b.query.orderBy[j][0]];return g.utils.isString(d)&&(d=g.utils.upperCase(d)),g.utils.isString(e)&&(e=g.utils.upperCase(e)),"DESC"===b.query.orderBy[j][1]?d>e?-1:e>d?1:0:e>d?-1:d>e?1:0})}}return this.utils.isNumber(b.query.limit)&&this.utils.isNumber(b.query.skip)?i=this.utils.slice(i,b.query.skip,Math.min(i.length,b.query.skip+b.query.limit)):this.utils.isNumber(b.query.limit)?i=this.utils.slice(i,0,Math.min(i.length,b.query.limit)):this.utils.isNumber(b.query.skip)&&(i=b.query.skip<i.length?this.utils.slice(i,b.query.skip):[]),i}catch(k){throw k instanceof this.errors.IllegalArgumentError?k:new this.errors.UnhandledError(k)}}var d="DS.filter(resourceName, params[, options]): ";b.exports=c},{}],43:[function(a,b){function c(a,b,c){if(c=c||{},!this.definitions[a])throw new this.errors.RuntimeError(d+a+" is not a registered resource!");if(!this.utils.isString(b)&&!this.utils.isNumber(b))throw new this.errors.IllegalArgumentError(d+"id: Must be a string or a number!",{id:{actual:typeof b,expected:"string|number"}});if(!this.utils.isObject(c))throw new this.errors.IllegalArgumentError(d+"options: Must be an object!",{options:{actual:typeof c,expected:"object"}});try{return b in this.store[a].index||!c.loadFromServer||this.find(a,b).then(null,function(a){throw a}),this.store[a].index[b]}catch(e){throw new this.errors.UnhandledError(e)}}var d="DS.get(resourceName, id[, options]): ";b.exports=c},{}],44:[function(a,b){function c(a,b){return!(a.isEmpty(b.added)&&a.isEmpty(b.removed)&&a.isEmpty(b.changed))}function d(a,b){if(!this.definitions[a])throw new this.errors.RuntimeError(e+a+" is not a registered resource!");if(!this.utils.isString(b)&&!this.utils.isNumber(b))throw new this.errors.IllegalArgumentError(e+"id: Must be a string or a number!",{id:{actual:typeof b,expected:"string|number"}});try{return b in this.store[a].changes?c(this.utils,this.store[a].changes[b]):!1}catch(d){throw new this.errors.UnhandledError(d)}}var e="DS.hasChanges(resourceName, id): ";b.exports=d},{}],45:[function(a,b){b.exports={defineResource:a("./defineResource"),eject:a("./eject"),ejectAll:a("./ejectAll"),filter:a("./filter"),get:a("./get"),inject:a("./inject"),lastModified:a("./lastModified"),lastSaved:a("./lastSaved"),digest:a("./digest"),changes:a("./changes"),previous:a("./previous"),hasChanges:a("./hasChanges")}},{"./changes":37,"./defineResource":38,"./digest":39,"./eject":40,"./ejectAll":41,"./filter":42,"./get":43,"./hasChanges":44,"./inject":46,"./lastModified":47,"./lastSaved":48,"./previous":49}],46:[function(a,b){function c(a,b,d){function g(c,d,e,f){try{var g=f(a.idAttribute);b.changes[g]=h.utils.diffObjectFromOldObject(b.index[g],b.previousAttributes[g]),b.modified[g]=h.utils.updateTimestamp(b.modified[g]),b.collectionModified=h.utils.updateTimestamp(b.collectionModified),a.idAttribute in e&&$log.error("Doh! You just changed the primary key of an object! I don't know how to handle this yet, so your data for the \""+a.name+'" resource is now in an undefined (probably broken) state.')}catch(i){throw new h.errors.UnhandledError(i)}}var h=this;if(h.utils.isArray(d))for(var i=0;i<d.length;i++)c.call(h,a,b,d[i]);else{if(!(a.idAttribute in d))throw new h.errors.RuntimeError(f+"attrs: Must contain the property specified by `idAttribute`!");var j=d[a.idAttribute];j in b.index?(h.utils.deepMixIn(b.index[j],d),b.observers[j].deliver()):(b.index[j]={},b.previousAttributes[j]={},h.utils.deepMixIn(b.index[j],d),h.utils.deepMixIn(b.previousAttributes[j],d),b.collection.push(b.index[j]),b.observers[j]=new e.ObjectObserver(b.index[j],g),g({},{},{},function(){return j}))}}function d(a,b,d){if(d=d||{},!this.definitions[a])throw new this.errors.RuntimeError(f+a+" is not a registered resource!");if(!this.utils.isObject(b)&&!this.utils.isArray(b))throw new this.errors.IllegalArgumentError(f+"attrs: Must be an object or an array!",{attrs:{actual:typeof b,expected:"object|array"}});if(!this.utils.isObject(d))throw new this.errors.IllegalArgumentError(f+"options: Must be an object!",{options:{actual:typeof d,expected:"object"}});var e=this.definitions[a],g=this.store[a],h=this;try{return this.$rootScope.$$phase?c.apply(h,[e,g,b]):this.$rootScope.$apply(function(){c.apply(h,[e,g,b])}),b}catch(i){throw i instanceof this.errors.RuntimeError?i:new this.errors.UnhandledError(i)}}var e=a("observejs"),f="DS.inject(resourceName, attrs[, options]): ";b.exports=d},{observejs:"QYwGEY"}],47:[function(a,b){function c(a,b){if(!this.definitions[a])throw new this.errors.RuntimeError(d+a+" is not a registered resource!");if(b&&!this.utils.isString(b)&&!this.utils.isNumber(b))throw new this.errors.IllegalArgumentError(d+"id: Must be a string or a number!",{id:{actual:typeof b,expected:"string|number"}});try{return b?(b in this.store[a].modified||(this.store[a].modified[b]=0),this.store[a].modified[b]):this.store[a].collectionModified}catch(c){throw new this.errors.UnhandledError(c)}}var d="DS.lastModified(resourceName[, id]): ";b.exports=c},{}],48:[function(a,b){function c(a,b){if(!this.definitions[a])throw new this.errors.RuntimeError(d+a+" is not a registered resource!");if(b&&!this.utils.isString(b)&&!this.utils.isNumber(b))throw new this.errors.IllegalArgumentError(d+"id: Must be a string or a number!",{id:{actual:typeof b,expected:"string|number"}});try{return b?(b in this.store[a].saved||(this.store[a].saved[b]=0),this.store[a].saved[b]):this.store[a].collectionModified | ||
}catch(c){throw new this.errors.UnhandledError(c)}}var d="DS.lastSaved(resourceName[, id]): ";b.exports=c},{}],49:[function(a,b){function c(a,b){if(!this.definitions[a])throw new this.errors.RuntimeError(d+a+" is not a registered resource!");if(!this.utils.isString(b)&&!this.utils.isNumber(b))throw new this.errors.IllegalArgumentError(d+"id: Must be a string or a number!",{id:{actual:typeof b,expected:"string|number"}});try{return angular.copy(this.store[a].previousAttributes[b])}catch(c){throw new this.errors.UnhandledError(c)}}var d="DS.previous(resourceName, id): ";b.exports=c},{}],errors:[function(a,b){b.exports=a("ht0wMj")},{}],ht0wMj:[function(a,b){function c(a){Error.call(this),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),a=a||{},this.type=this.constructor.name,this.originalError=a,this.message="UnhandledError: This is an uncaught exception. Please consider submitting an issue at https://github.com/jmdobry/angular-data/issues.\n\nOriginal Uncaught Exception:\n"+(a.stack?a.stack.toString():a.stack),this.stack=this.message}function d(a,b){Error.call(this),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.type=this.constructor.name,this.errors=b||{},this.message=a||"Illegal Argument!"}function e(a,b){Error.call(this),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.type=this.constructor.name,this.errors=b||{},this.message=a||"RuntimeError Error!"}c.prototype=Object.create(Error.prototype),c.prototype.constructor=c,d.prototype=Object.create(Error.prototype),d.prototype.constructor=d,e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,b.exports=[function(){return{UnhandledError:c,IllegalArgumentError:d,RuntimeError:e}}]},{}],52:[function(a){!function(b,c){"use strict";c.module("angular-data.DS",["ng"]).service("DSUtils",a("./utils")).service("DSErrors",a("./errors")).provider("DSHttpAdapter",a("./adapters/http")).provider("DS",a("./datastore")).config(["$provide",function(a){a.decorator("$q",function(a){return a.promisify=function(a,b){var c=this;return function(){var d=c.defer(),e=Array.prototype.slice.apply(arguments);e.push(function(a,b){a?d.reject(a):d.resolve(b)});try{a.apply(b||this,e)}catch(f){d.reject(f)}return d.promise}},a})}])}(window,window.angular)},{"./adapters/http":27,"./datastore":36,"./errors":"ht0wMj","./utils":"iWjGJZ"}],utils:[function(a,b){b.exports=a("iWjGJZ")},{}],iWjGJZ:[function(a,b){b.exports=[function(){return{isString:angular.isString,isArray:angular.isArray,isObject:angular.isObject,isNumber:angular.isNumber,isFunction:angular.isFunction,isEmpty:a("mout/lang/isEmpty"),toJson:angular.toJson,makePath:a("mout/string/makePath"),upperCase:a("mout/string/upperCase"),deepMixIn:a("mout/object/deepMixIn"),forOwn:a("mout/object/forOwn"),contains:a("mout/array/contains"),filter:a("mout/array/filter"),toLookup:a("mout/array/toLookup"),slice:a("mout/array/slice"),sort:a("mout/array/sort"),updateTimestamp:function(a){var b="function"==typeof Date.now?Date.now():(new Date).getTime();return a&&a>=b?a+1:b},deepFreeze:function b(a){if("function"==typeof Object.freeze){var c,d;Object.freeze(a);for(d in a)c=a[d],a.hasOwnProperty(d)&&"object"==typeof c&&!Object.isFrozen(c)&&b(c)}},diffObjectFromOldObject:function(a,b){var c={},d={},e={};for(var f in b){var g=a[f];(void 0===g||g!==b[f])&&(f in a?g!==b[f]&&(e[f]=g):d[f]=void 0)}for(var h in a)h in b||(c[h]=a[h]);return{added:c,removed:d,changed:e}}}}]},{"mout/array/contains":3,"mout/array/filter":4,"mout/array/slice":7,"mout/array/sort":8,"mout/array/toLookup":9,"mout/lang/isEmpty":14,"mout/object/deepMixIn":21,"mout/object/forOwn":23,"mout/string/makePath":25,"mout/string/upperCase":26}]},{},[52]); |
@@ -54,4 +54,4 @@ /* | ||
'* @file angular-data.min.js\n' + | ||
'* @version <%= pkg.version %> - Homepage <http://jmdobry.github.io/angular-data/>\n' + | ||
'* @copyright (c) 2014 Jason Dobry <https://github.com/jmdobry/angular-data>\n' + | ||
'* @version <%= pkg.version %> - Homepage <http://angular-data.codetrain.io/>\n' + | ||
'* @copyright (c) 2014 Jason Dobry <https://github.com/jmdobry/>\n' + | ||
'* @license MIT <https://github.com/jmdobry/angular-data/blob/master/LICENSE>\n' + | ||
@@ -58,0 +58,0 @@ '*\n' + |
{ | ||
"name": "angular-data", | ||
"description": "Data store for Angular.js.", | ||
"version": "0.7.0", | ||
"version": "0.7.1", | ||
"homepage": "http://github.com/jmdobry/angular-data", | ||
@@ -26,3 +26,3 @@ "repository": { | ||
"grunt-contrib-clean": "0.5.0", | ||
"load-grunt-tasks": "0.3.0", | ||
"load-grunt-tasks": "0.4.0", | ||
"grunt-docular": "0.1.2", | ||
@@ -41,9 +41,9 @@ "grunt-contrib-uglify": "0.3.2", | ||
"mocha": "~1.17.1", | ||
"karma-coverage": "~0.1.2", | ||
"karma-coverage": "~0.2.0", | ||
"grunt-contrib-watch": "~0.5.3", | ||
"grunt-karma-coveralls": "~2.3.0", | ||
"grunt-karma-coveralls": "~2.4.0", | ||
"karma-mocha": "~0.1.1", | ||
"karma-sinon": "~1.0.2", | ||
"time-grunt": "~0.2.9", | ||
"browserify": "~3.30.2" | ||
"browserify": "~3.31.2" | ||
}, | ||
@@ -50,0 +50,0 @@ "scripts": { |
@@ -5,3 +5,3 @@ ## angular-data | ||
__Current version:__ 0.6.0 | ||
__Current version:__ 0.7.1 | ||
@@ -8,0 +8,0 @@ Angular-data is in a pre-1.0.0 development stage; the API is fluctuating, not a lot of tests yet, etc. |
@@ -134,7 +134,11 @@ /* jshint loopfunc: true */ | ||
if (this.utils.isNumber(params.query.limit) && this.utils.isNumber(params.query.skip)) { | ||
filtered = this.utils.slice(filtered, params.query.skip, params.query.skip + params.query.limit); | ||
filtered = this.utils.slice(filtered, params.query.skip, Math.min(filtered.length, params.query.skip + params.query.limit)); | ||
} else if (this.utils.isNumber(params.query.limit)) { | ||
filtered = this.utils.slice(filtered, 0, params.query.limit); | ||
filtered = this.utils.slice(filtered, 0, Math.min(filtered.length, params.query.limit)); | ||
} else if (this.utils.isNumber(params.query.skip)) { | ||
filtered = this.utils.slice(filtered, params.query.skip); | ||
if (params.query.skip < filtered.length) { | ||
filtered = this.utils.slice(filtered, params.query.skip); | ||
} else { | ||
filtered = []; | ||
} | ||
} | ||
@@ -141,0 +145,0 @@ |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
284658
6924