Comparing version 3.0.0-alpha.8 to 3.0.0-alpha.9
@@ -0,1 +1,6 @@ | ||
##### 3.0.0-alpha.9 - 09 January 2016 | ||
###### Backwards compatible bug fixes | ||
- Fixed a bug in IE where Object.prototype.toString !== window.toString | ||
##### 3.0.0-alpha.8 - 09 January 2016 | ||
@@ -2,0 +7,0 @@ |
/*! | ||
* js-data | ||
* @version 3.0.0-alpha.8 - Homepage <http://www.js-data.io/> | ||
* @version 3.0.0-alpha.9 - Homepage <http://www.js-data.io/> | ||
* @author Jason Dobry <jason.dobry@gmail.com> | ||
@@ -10,4 +10,4 @@ * @copyright (c) 2014-2015 Jason Dobry | ||
*/ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.JSData={})}(this,function(e){"use strict";function t(e){return"[object Object]"===toString.call(e)||!1}function n(e){return!!e&&"object"===("undefined"==typeof e?"undefined":ie.typeof(e))&&e.constructor===Object}function r(e){return"[object RegExp]"===toString.call(e)||!1}function i(e){return"string"==typeof e||e&&"object"===("undefined"==typeof e?"undefined":ie.typeof(e))&&"[object String]"===toString.call(e)||!1}function o(e){return e&&"object"===("undefined"==typeof e?"undefined":ie.typeof(e))&&"[object Date]"===toString.call(e)||!1}function a(e){var t="undefined"==typeof e?"undefined":ie.typeof(e);return"number"===t||e&&"object"===t&&"[object Number]"===toString.call(e)||!1}function u(e){return"[object Boolean]"===toString.call(e)}function s(e){return"function"==typeof e||e&&"[object Function]"===toString.call(e)||!1}function l(e){return i(e)||a(e)}function f(e,t){if(t){for(var n=t.split("."),r=n.pop();t=n.shift();)if(e=e[t],null==e)return;return e[r]}}function c(e,t){for(var n=t.split("."),r=n.pop();t=n.shift();)if(e=e[t],null==e)return;e[r]=void 0,delete e[r]}function d(e,t){if(!t)return e;var n=t.split(".");return n.forEach(function(t){e[t]||(e[t]={}),e=e[t]}),e}function h(e,n,r){if(t(n))p(n,function(t,n){h(e,n,t)});else{var i=ae.exec(n);i?d(e,i[1])[i[2]]=r:e[n]=r}}function p(e,t,n){var r=Object.keys(e),i=r.length,o=void 0;for(o=0;i>o;o++)t.call(n,e[r[o]],r[o],e)}function v(e,t){return t&&p(t,function(e,t){var r=this[t];n(e)&&n(r)?v(r,e):this[t]=e},e),e}function g(e){return Promise.resolve(e)}function m(e){return Promise.reject(e)}function y(e,t){for(var n in e){var r=e[n];void 0===t[n]&&!s(r)&&n&&0!==n.indexOf("_")&&(t[n]=r)}}function b(e,t){if(!e||!t)return[];var n=[],r=void 0,i=void 0,o=e.length;for(i=0;o>i;i++)r=e[i],-1===n.indexOf(r)&&-1!==t.indexOf(r)&&n.push(r);return n}function A(e,t){p(t,function(t,n){void 0===e[n]&&(e[n]=t)})}function x(e,t){if(!t||!t.length)return!1;for(var n=void 0,r=0;r<t.length;r++)if("[object RegExp]"===Object.prototype.toString.call(t[r])&&t[r].test(e)||t[r]===e)return n=e;return!!n}function _(e){return i(e)?JSON.parse(e):e}function w(e,n,i,a,u){if(n){if(e===n)throw new Error("Cannot copy! Source and destination are identical.");if(i=i||[],a=a||[],t(e)){var s=i.indexOf(e);if(-1!==s)return a[s];i.push(e),a.push(n)}var l=void 0;if(oe(e)){var f=void 0;for(n.length=0,f=0;f<e.length;f++)l=w(e[f],null,i,a,u),t(e[f])&&(i.push(e[f]),a.push(l)),n.push(l)}else{oe(n)?n.length=0:p(n,function(e,t){delete n[t]});for(var c in e)if(e.hasOwnProperty(c)){if(x(c,u))continue;l=w(e[c],null,i,a,u),t(e[c])&&(i.push(e[c]),a.push(l)),n[c]=l}}}else n=e,e&&(oe(e)?n=w(e,[],i,a,u):o(e)?n=new Date(e.getTime()):r(e)?(n=new RegExp(e.source,e.toString().match(/[^\/]*$/)[0]),n.lastIndex=e.lastIndex):t(e)&&(n=w(e,Object.create(Object.getPrototypeOf(e)),i,a,u)));return n}function O(e,t,n){return""+t.toUpperCase()+n.toLowerCase()}function k(e){return e.replace(le,"").replace(fe,O)}function C(e){return e.split(se).map(k).join("")}function E(e){return e=C(e),e?e.charAt(0).toLowerCase()+e.slice(1):e}function R(e,t,n,r){e=e||this;var i={};t||n||(t=function(){return i},n=function(e){i=e}),Object.defineProperties(e,{on:{enumerable:!!r,value:function(e,r,i){t.call(this)||n.call(this,{});var o=t.call(this);o[e]=o[e]||[],o[e].push({f:r,c:i})}},off:{enumerable:!!r,value:function(e,r){var i=t.call(this),o=i[e];if(o)if(r){for(var a=0;a<o.length;a++)if(o[a].f===r){o.splice(a,1);break}}else o.splice(0,o.length);else n.call(this,{})}},emit:{enumerable:!!r,value:function(){for(var e=t.call(this)||{},n=arguments.length,r=Array(n),i=0;n>i;i++)r[i]=arguments[i];var o=r.shift(),a=e[o]||[],u=void 0;for(u=0;u<a.length;u++)a[u].f.apply(a[u].c,r);for(a=e.all||[],r.unshift(o),u=0;u<a.length;u++)a[u].f.apply(a[u].c,r)}}})}function I(e,t){for(t=e="";e++<36;t+=51*e&52?(15^e?8^Math.random()*(20^e?16:4):4).toString(16):"-");return t}function j(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function P(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==("undefined"==typeof t?"undefined":ie.typeof(t))&&"function"!=typeof t?e:t}function S(e,t){p(t,function(e,n){t[n]={value:e}}),Object.defineProperties(e,t)}function M(e,t){var n=this,r=void 0;return e||(e={}),t||(t={}),e.hasOwnProperty("constructor")?(r=e.constructor,delete e.constructor):r=function(){j(this,r);for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];var i=P(this,(r.__super__||Object.getPrototypeOf(r)).apply(this,t));return i},r.prototype=Object.create(n&&n.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(r,n):t.strictEs6Class?r.__proto__=n:p(n,function(e,t){r[t]=e}),Object.defineProperty(r,"__super__",{configurable:!0,value:n}),v(r.prototype,e),v(r,t),r}function F(e){j(this,F),this.collection=e,this.data=null}function N(e,t,n,r){var o=e[t],a=f(n,o[0]),u=f(r,o[0]);return a&&i(a)&&(a=a.toUpperCase()),u&&i(u)&&(u=u.toUpperCase()),n||(n=null),r||(r=null),"DESC"===o[1]?a>u?-1:u>a?1:t<e.length-1?N(e,t+1,n,r):0:u>a?-1:a>u?1:t<e.length-1?N(e,t+1,n,r):0}function D(e){return e.replace(he,"\\$1")}function L(e,t){return new RegExp("^"+D(e).replace(pe,".*").replace(ve,".")+"$",t)}function K(e,t,n){switch(t){case"==":return e==n;case"===":return e===n;case"!=":return e!=n;case"!==":return e!==n;case">":return e>n;case">=":return e>=n;case"<":return n>e;case"<=":return n>=e;case"isectEmpty":return!b(e||[],n||[]).length;case"isectNotEmpty":return b(e||[],n||[]).length;case"in":return-1!==n.indexOf(e);case"notIn":return-1===n.indexOf(e);case"contains":return-1!==(e||[]).indexOf(n);case"notContains":return-1===(e||[]).indexOf(n);default:if(0===t.indexOf("like"))return null!==L(n,t.substr(4)).exec(e);if(0===t.indexOf("notLike"))return null===L(n,t.substr(7)).exec(e)}}function U(e,t,n){return e===t?0:(n&&(e=n(e),t=n(t)),null===e&&null===t?0:null===e?-1:null===t?1:t>e?-1:e>t?1:0)}function T(e,t,n){return e.splice(t,0,n),e}function J(e,t){return e.splice(t,1),e}function q(e,t,n){for(var r=0,i=e.length,o=void 0,a=void 0;i>r;){if(a=(r+i)/2|0,o=U(t,e[a],n),0===o)return{found:!0,index:a};0>o?i=a:r=a+1}return{found:!1,index:i}}function z(e,t){if(j(this,z),e||(e=[]),!oe(e))throw new Error("fieldList must be an array.");t||(t={}),this.fieldList=e,this.fieldGetter=t.fieldGetter,this.hashCode=t.hashCode,this.isIndex=!0,this.keys=[],this.values=[]}function $(e,n){var r=this;j(r,$),t(e)&&!oe(e)&&(n=e,e=[]),e||(e=[]),n||(n={}),r.model=n.model,r.idAttribute=n.idAttribute,r._listeners={},this.onConflict=n.onConflict||"merge";var i=r.modelId();r.index=new z([i],{hashCode:function(e){return f(e,i)}}),r.indexes={},r.added={},r.autoPks={},r.createIndex("addedTimestamps",["$"],{fieldGetter:function(e){return r.added[f(e,i)]}}),e.forEach(function(e){r.index.insertRecord(e),e&&s(e.on)&&e.on("all",r._onModelEvent,r)})}function B(e,t,n){n||(n={});var r=n.localField=n.localField||t.name.toLowerCase(),i=n.foreignKey=n.localKey||n.foreignKey||t.name.toLowerCase()+"_id",o={enumerable:void 0!==n.enumerable?!!n.enumerable:!1,get:function(){return this._get("links."+r)},set:function(e){return this._set("links."+r,e),h(this,i,e[t.idAttribute]),f(this,r)}},a=o.get,u=o.set;return(n.link===!1||void 0===n.link&&!e.linkRelations)&&(delete o.get,delete o.set,o.writable=!0),n.get&&(o.get=function(){var r=this;return n.get(e,t,this,function(){return a.call(r)})},delete o.writable),n.set&&(o.set=function(r){var i=this;return n.set(e,t,this,r,function(e){return u.call(i,void 0===e?r:e)})},delete o.writable),o.get&&(o.set||(o.set=function(){})),Object.defineProperty(e.prototype,r,o),e.relationList||(e.relationList=[]),e.relationFields||(e.relationFields=[]),n.type="belongsTo",n.name=e.name,n.relation=t.name,n.Relation=t,e.relationList.push(n),e.relationFields.push(r),e}function V(e,t){return function(n){return n.dbg(me,"Model:",e,"opts:",t),B(n,e,t)}}function G(e){var t=arguments.length<=1||void 0===arguments[1]?!0:arguments[1];return e=e||{},function(n){return p(e,function(e,r){(void 0===n[r]||t)&&(n[r]=w(e))}),n}}function H(e,t,n){n||(n={});var r=n.localField=n.localField||E(t.name)+"_collection",i=n.foreignKey,o=n.localKeys,a=n.foreignKeys;i||o||a||(i=n.foreignKey=E(e.name)+"_id");var u={enumerable:void 0!==n.enumerable?!!n.enumerable:!1,get:function(){return this._get("links."+r)},set:function(n){var u=this;return this._set("links."+r,n),n&&n.length&&!function(){var r=f(u,e.idAttribute);i?n.forEach(function(e){h(e,i,r)}):o?!function(){var e=[];n.forEach(function(n){e.push(f(n,t.idAttribute))}),h(u,o,e)}():a&&n.forEach(function(e){var t=f(e,a);t?-1===t.indexOf(r)&&t.push(r):h(e,a,[r])})}(),f(this,r)}},s=u.get,l=u.set;return(n.link===!1||void 0===n.link&&!e.linkRelations)&&(delete u.get,delete u.set,u.writable=!0),n.get&&(u.get=function(){var r=this;return n.get(e,t,this,function(){return s.call(r)})}),n.set&&(u.set=function(r){var i=this;return n.set(e,t,this,r,function(e){return l.call(i,void 0===e?r:e)})}),Object.defineProperty(e.prototype,r,u),e.relationList||(e.relationList=[]),e.relationFields||(e.relationFields=[]),n.type="hasMany",n.name=e.name,n.relation=t.name,n.Relation=t,e.relationList.push(n),e.relationFields.push(r),e}function Q(e,t){return function(n){return n.dbg(ye,"Model:",e,"opts:",t),H(n,e,t)}}function Z(e,t,n){n||(n={});var r=n.localField=n.localField||E(t.name),i=n.foreignKey=n.foreignKey||E(e.name)+"Id",o={enumerable:void 0!==n.enumerable?!!n.enumerable:!1,get:function(){return this._get("links."+r)},set:function(t){return this._set("links."+r,t),h(t,i,f(this,e.idAttribute)),f(this,r)}};return(n.link===!1||void 0===n.link&&!e.linkRelations)&&(delete o.get,delete o.set),n.get&&!function(){var r=o.get;o.get=function(){var i=this;return n.get(e,t,this,r?function(){for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];return r.apply(i,t)}:void 0)}}(),n.set&&!function(){var r=o.set;o.set=function(i){var o=this;return n.set(e,t,this,i,r?function(){for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];return r.apply(o,t)}:void 0)}}(),Object.defineProperty(e.prototype,r,o),e.relationList||(e.relationList=[]),e.relationFields||(e.relationFields=[]),n.type="hasOne",n.name=e.name,n.relation=t.name,n.Relation=t,e.relationList.push(n),e.relationFields.push(r),e}function W(e,t){return function(n){return n.dbg(be,"Model:",e,"opts:",t),Z(n,e,t)}}function X(e,t){var n=[];return p(e,function(e,r){var i=xe[r];if(i){var o=i(e,t);o&&n.push(o)}}),n.length?n:void 0}function Y(e,t,n){var r={enumerable:void 0!==n.enumerable?n.enumerable:!0};return r.get=function(){return this._get("props."+t)},r.set=function(e){var r=this,i=this._get,o=this._set,a=this._unset;if(!i("noValidate")){var u=X(n,e);if(u)throw new Error(u.join(", "))}return n.track&&!i("creating")&&!function(){var n=i("changing"),u=i("previous."+t),s=i("props."+t),l=i("changed");n||(l=[]);var c=l.indexOf(t);s!==e&&-1===c&&l.push(t),u!==e?o("changes."+t,e):(a("changes."+t),c>=0&&l.splice(c,1)),l.length||(n=!1,a("changing"),a("changed"),i("eventId")&&(clearTimeout(i("eventId")),a("eventId"))),!n&&l.length&&(o("changed",l),o("changing",!0),o("eventId",setTimeout(function(){if(a("changed"),a("eventId"),a("changing"),!i("silent")){var e=void 0;for(e=0;e<l.length;e++)r.emit("change:"+l[e],r,f(r,l[e]));r.emit("change",r,i("changes"))}a("silent")},0)))}(),o("props."+t,e),e},n.get&&(r.get?!function(){var e=r.get;r.get=function(){return n.get.call(this,e)}}():r.get=n.get),n.set&&(r.set?!function(){var e=r.set;r.set=function(t){return n.set.call(this,t,e)}}():r.set=n.set),r}function ee(e){return e||(e={}),function(t){return t.dbg(_e,"opts:",e),t.schema||(t.schema={}),G(t.schema,e),p(e,function(e,n){var r=Y(t,n,e);r.writable||Object.defineProperty(t.prototype,n,r)}),t}}function te(e,t,n){return n||(n={}),n.op=we,function(r){r.dbg(we,"name:",e,"adapter:",t,"opts:",n),r.getAdapters()[e]=t,(n===!0||n.default)&&(r.defaultAdapter=e)}}function ne(e,t){var n=this;j(n,ne),e||(e={}),t||(t={});var r={};Object.defineProperties(n,{_get:{value:function(e){return f(r,e)}},_set:{value:function(e,t){return h(r,e,t)}},_unset:{value:function(e){return c(r,e)}}}),n._set("creating",!0),t.noValidate&&n._set("noValidate",!0),A(n,e),n._unset("creating"),n._set("changes",{}),n._unset("noValidate"),n._set("previous",w(e))}function re(e){var t=this;j(t,re),e||(e={}),t.defaults={};for(var n in e)t.defaults[n]=e[n];t.models={},t.collections={}}var ie={};ie.typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},ie.defineProperty=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e};var oe=Array.isArray,ae=/^(.+)\.(.+)$/,ue=JSON.stringify,se=/\s+/,le=/[^A-Za-z]/g,fe=/(\w)(\w*)/g,ce=Object.freeze({isArray:oe,isObject:t,isRegExp:r,isString:i,isDate:o,isNumber:a,isBoolean:u,isFunction:s,isSorN:l,get:f,unset:c,set:h,forOwn:p,deepMixIn:v,resolve:g,reject:m,_:y,intersection:b,fillIn:A,isBlacklisted:x,fromJson:_,toJson:ue,copy:w,pascalCase:C,camelCase:E,eventify:R,uuid:I,classCallCheck:j,possibleConstructorReturn:P,addHiddenPropsToTarget:S,extend:M}),de={skip:"",offset:"",where:"",limit:"",orderBy:"",sort:""},he=/([.*+?^=!:${}()|[\]\/\\])/g,pe=/%/g,ve=/_/g;S(F.prototype,{getData:function(){return this.data||(this.data=this.collection.index.getAll()),this.data},between:function(e,t,n){n||(n={});var r=this.collection,i=n.index?r.indexes[n.index]:r.index;if(this.data)throw new Error("Cannot access index after first operation!");return this.data=i.between(e,t,n),this},get:function(){var e=arguments.length<=0||void 0===arguments[0]?[]:arguments[0],t=arguments[1];if(t||(t={}),this.data)throw new Error("Cannot access index after first operation!");if(e&&!oe(e)&&(e=[e]),!e.length)return this.getData(),this;var n=this.collection,r=t.index?n.indexes[t.index]:n.index;return this.data=r.get(e),this},getAll:function(){var e=this,n={};if(this.data)throw new Error("Cannot access index after first operation!");for(var r=arguments.length,i=Array(r),o=0;r>o;o++)i[o]=arguments[o];if(!i.length||1===i.length&&t(i[0]))return this.getData(),this;i.length&&t(i[i.length-1])&&(n=i[i.length-1],i.pop());var a=this.collection,u=n.index?a.indexes[n.index]:a.index;return this.data=[],i.forEach(function(t){e.data=e.data.concat(u.get(t))}),this},filter:function(e,n){var r=this;return e||(e={}),this.getData(),t(e)?!function(){var n={};t(e.where)&&(n=e.where),p(e,function(e,t){t in de||t in n||(n[t]={"==":e})});var o=[],u=[],s=[];p(n,function(e,n){t(e)||(e={"==":e}),p(e,function(e,t){o.push(n),u.push(t),s.push(e)})}),o.length&&!function(){var e=void 0,t=o.length;r.data=r.data.filter(function(n){var r=!0,i=!0;for(e=0;t>e;e++){var a=u[e],l="|"===a.charAt(0);a=l?a.substr(1):a;var c=K(f(n,o[e]),a,s[e]);void 0!==c&&(i=r?c:l?i||c:i&&c),r=!1}return i})}();var l=e.orderBy||e.sort;i(l)&&(l=[[l,"ASC"]]),oe(l)||(l=null),l&&!function(){var e=0;l.forEach(function(e,t){i(e)&&(l[t]=[e,"ASC"])}),r.data.sort(function(t,n){return N(l,e,t,n)})}(),a(e.skip)?r.skip(e.skip):a(e.offset)&&r.skip(e.offset),a(e.limit)&&r.limit(e.limit)}():s(e)&&(this.data=this.data.filter(e,n)),this},skip:function(e){if(!a(e))throw new TypeError("skip: Expected number but found "+("undefined"==typeof e?"undefined":ie.typeof(e))+"!");var t=this.getData();return e<t.length?this.data=t.slice(e):this.data=[],this},limit:function(e){if(!a(e))throw new TypeError("limit: Expected number but found "+("undefined"==typeof e?"undefined":ie.typeof(e))+"!");var t=this.getData();return this.data=t.slice(0,Math.min(t.length,e)),this},forEach:function(e,t){return this.getData().forEach(e,t),this},map:function(e,t){return this.data=this.getData().map(e,t),this},mapCall:function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;t>r;r++)n[r-1]=arguments[r];return this.data=this.getData().map(function(t){return t[e].apply(t,n)}),this},run:function(){var e=this.data;return this.data=null,e}});var ge={">":1,">=":1,"<":1,"<=":1};S(z.prototype,{set:function(e,t){oe(e)||(e=[e]);var n=e.shift()||null,r=q(this.keys,n);if(0===e.length)if(r.found){var i=q(this.values[r.index],t,this.hashCode);i.found||T(this.values[r.index],i.index,t)}else T(this.keys,r.index,n),T(this.values,r.index,[t]);else if(r.found)this.values[r.index].set(e,t);else{T(this.keys,r.index,n);var o=new z([],{hashCode:this.hashCode});o.set(e,t),T(this.values,r.index,o)}},get:function(e){oe(e)||(e=[e]);var t=e.shift()||null,n=q(this.keys,t);return 0===e.length?n.found?this.values[n.index].isIndex?this.values[n.index].getAll():this.values[n.index]:[]:n.found?this.values[n.index].get(e):[]},getAll:function(){var e=[];return this.values.forEach(function(t){e=t.isIndex?e.concat(t.getAll()):e.concat(t)}),e},visitAll:function(e,t){this.values.forEach(function(n){n.isIndex?n.visitAll(e,t):n.forEach(e,t)})},query:function(e){var t=void 0,n=void 0;if(e[">"]?(t=e[">"],e.leftInclusive=!1):e[">="]&&(t=e[">="],e.leftInclusive=!0),e["<"]?(n=e["<"],e.rightInclusive=!1):e["<="]&&(n=e["<="],e.rightInclusive=!0),t.length!==n.length)throw new Error("Key arrays must be same length");var r={};return p(e,function(e,t){ge[t]||(r[t]=e)}),this.between(t,n,r)},between:function(e,t){var n=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];oe(e)||(e=[e]),oe(t)||(t=[t]),A(n,{leftInclusive:!0,rightInclusive:!1,limit:void 0,offset:0});var r=this._between(e,t,n);return n.limit?r.slice(n.offset,n.limit+n.offset):r.slice(n.offset)},_between:function(e,t,n){var r=[],i=e.shift(),o=t.shift(),a=void 0;if(a=void 0!==i?q(this.keys,i):{found:!1,index:0},0===e.length){a.found&&n.leftInclusive===!1&&(a.index+=1);for(var u=a.index;u<this.keys.length;u+=1){if(void 0!==o)if(n.rightInclusive){if(this.keys[u]>o)break}else if(this.keys[u]>=o)break;if(r=this.values[u].isIndex?r.concat(this.values[u].getAll()):r.concat(this.values[u]),n.limit&&r.length>=n.limit+n.offset)break}}else for(var u=a.index;u<this.keys.length;u+=1){var s=this.keys[u];if(s>o)break;if(r=this.values[u].isIndex?s===i?r.concat(this.values[u]._between(w(e),t.map(function(){}),n)):s===o?r.concat(this.values[u]._between(e.map(function(){}),w(t),n)):r.concat(this.values[u].getAll()):r.concat(this.values[u]),n.limit&&r.length>=n.limit+n.offset)break}return n.limit?r.slice(0,n.limit+n.offset):r},peek:function(){return this.values.length?this.values[0].isIndex?this.values[0].peek():this.values[0]:[]},remove:function(e,t){oe(e)||(e=[e]);var n=e.shift(),r=q(this.keys,n);if(0===e.length){if(r.found){var i=q(this.values[r.index],t,this.hashCode);i.found&&(J(this.values[r.index],i.index),0===this.values[r.index].length&&(J(this.keys,r.index),J(this.values,r.index)))}}else r.found&&this.values[r.index].delete(e,t)},clear:function(){this.keys=[],this.values=[]},insertRecord:function(e){var t=this.fieldList.map(function(t){return s(t)?t(e)||null:e[t]||null});this.set(t,e)},removeRecord:function(e){var t=this,n=void 0;return this.values.forEach(function(r,i){if(r.isIndex){if(r.removeRecord(e))return 0===r.keys.length&&(J(t.keys,i),J(t.values,i)),n=!0,!1}else{var o=q(r,e,t.hashCode);if(o.found)return J(r,o.index),0===r.length&&(J(t.keys,i),J(t.values,i)),n=!0,!1}}),n?e:void 0},updateRecord:function(e){this.removeRecord(e),this.insertRecord(e)}}),S($.prototype,{_onModelEvent:function(){this.emit.apply(this,arguments)},modelId:function(e){var t=this;return e?f(e,t.modelId()):t.model?t.model.idAttribute:t.idAttribute||"id"},createIndex:function(e,t,n){var r=this;i(e)&&void 0===t&&(t=[e]),n||(n={}),n.hashCode=n.hashCode||function(e){return r.modelId(e)};var o=r.indexes[e]=new z(t,n);return r.index.visitAll(o.insertRecord,o),r},getAutoPkItems:function(){var e=this;return e.getAll().filter(function(t){return e.autoPks[e.modelId(t)]})},query:function(){return new F(this)},between:function(e,t,n){return this.query().between(e,t,n).run()},get:function(e){var t=this.query().get(e).run();return t.length?t[0]:void 0},getAll:function(){var e;return(e=this.query()).getAll.apply(e,arguments).run()},filter:function(e,t){return this.query().filter(e,t).run()},skip:function(e){return this.query().skip(e).run()},limit:function(e){return this.query().limit(e).run()},forEach:function(e,t){this.index.visitAll(e,t)},reduce:function(e,t){var n=this.getAll();return n.reduce(e,t)},map:function(e,t){var n=[];return this.index.visitAll(function(r){n.push(e.call(t,r))}),n},beforeAdd:function(){},add:function(e,t){var n=this;t||(t={}),y(n,t),e=n.beforeAdd(e,t)||e;var r=!1,i=n.modelId(),o=[],a=(new Date).getTime();oe(e)||(e=[e],r=!0),e=e.map(function(e){var r=n.modelId(e),u=!1;if(!l(r)){if(!t.autoPk)throw new TypeError(i+": Expected string or number, found "+("undefined"==typeof r?"undefined":ie.typeof(r))+"!");r=I(),h(e,i,r),u=!0}var d=n.get(r);if(e===d)return d;if(o.forEach(function(t){var i=t.Relation,o=i.idAttribute,a=t.foreignKey,u=f(e,t.localField);if(s(t.insert))t.insert(n,t,e);else if(u&&t.insert!==!1)if(oe(u))u=u.map(function(e){if(e!==i.get(f(e,o)))try{a&&h(e,a,r),e=i.add(e)}catch(e){throw new Error("Failed to insert "+t.type+' relation: "'+t.relation+'"! '+e.message)}return e}),t.localKeys&&h(e,t.localKeys,u.map(function(e){return f(e,o)}));else if(u!==i.get(f(u,o)))try{t.foreignKey&&h(e,t.foreignKey,f(u,i.idAttribute)),a&&h(u,t.foreignKey,r),u=i.add(u)}catch(e){throw new Error("Failed to insert "+t.type+' relation: "'+t.relation+'"!')}t.link||void 0===t.link&&n.linkRelations?c(e,t.localField):h(e,t.localField,u)}),d){var g=t.onConflict||n.onConflict;"merge"===g?v(d,e):"replace"===g&&(p(d,function(t,n){n===i||e.hasOwnProperty(n)||delete d[n]}),d.set(e)),e=d,n.updateIndexes(e)}else e=n.model?n.model.createInstance(e):e,n.index.insertRecord(e),p(n.indexes,function(t,n){t.insertRecord(e)}),e&&s(e.on)&&(e.on("all",n._onModelEvent,n),n.emit("add",e));return n.added[r]=a,u&&(n.autoPks[r]=e),e});var u=r?e.length?e[0]:void 0:e;return n.afterAdd(u,t),u},afterAdd:function(){},beforeRemove:function(){},remove:function(e,t){var n=this;t||(t={}),n.beforeRemove(e,t);var r=n.get(e);return r&&(delete n.added[e],delete n.autoPks[e],n.index.removeRecord(r),p(n.indexes,function(e,t){e.removeRecord(r)}),r&&s(r.off)&&(r.off("all",n._onModelEvent,n),n.emit("remove",r))),n.afterRemove(r,t),r},afterRemove:function(){},beforeRemoveAll:function(){},removeAll:function(e,t){var n=this;t||(t={}),n.beforeRemoveAll(e,t);var r=n.filter(e);return r.forEach(function(e){n.remove(n.modelId(e))}),n.afterRemoveAll(r,e,t),r},afterRemoveAll:function(){},updateIndex:function(e,t){t||(t={});var n=t.index?this.indexes[t.index]:this.index;n.updateRecord(e)},updateIndexes:function(e){var t=this;t.index.updateRecord(e),p(t.indexes,function(t,n){t.updateRecord(e)})},mapCall:function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;t>r;r++)n[r-1]=arguments[r];var i=[];return this.index.visitAll(function(t){i.push(t[e].apply(t,n))}),i},toJSON:function(e){return this.mapCall("toJSON",e)},end:function(e,t){var n=this;return t.raw?(t.autoAdd&&(e.data=n.add(e.data,t)),e):(t.autoAdd&&(e=n.add(e,t)),e)},create:function(e,t){var n=this,r=n.modelId(e);return n.model.create(e,t).then(function(e){return n.autoPks[r]&&n.remove(r),n.end(e)})},createMany:function(e,t){var n=this;return n.model.createMany(e,t).then(function(t){return e.forEach(function(e){var t=n.modelId(e);n.autoPks[t]&&n.remove(t)}),n.end(t)})},find:function(e,t){var n=this;return n.model.find(e,t).then(function(e){return n.end(e)})},findAll:function(e,t){var n=this;return n.model.findAll(e,t).then(function(e){return n.end(e)})},update:function(e,t,n){var r=this;return r.model.update(e,t,n).then(function(e){return r.end(e)})},updateMany:function(e,t){var n=this;return n.model.updateMany(e,t).then(function(e){return n.end(e)})},updateAll:function(e,t,n){var r=this;return r.model.updateAll(e,t,n).then(function(e){return r.end(e)})},destroy:function(e,t){var n=this;return n.model.destroy(e,t).then(function(r){return t.raw?r.data=n.remove(e,t):r=n.remove(e,t),r})},destroyAll:function(e,t){var n=this;return n.model.destroyAll(e,t).then(function(r){return t.raw?r.data=n.removeAll(e,t):r=n.removeAll(e,t),r})}}),R($.prototype,function(){return this._listeners},function(e){this._listeners=e});var me="belongsTo",ye="hasMany",be="hasOne",Ae={array:oe,boolean:u,integer:a,number:a,null:function(e){return null===e},object:t,string:i},xe={type:function(e,t){if(void 0!==t){i(e)&&(e=[e]);var n=e.map(function(n){var r=Ae[n];return r?r(t)?void 0:1:"type: Unknown type "+e});return-1!==n.indexOf(void 0)?void 0:"type: Expected: "+e.join(" or ")+". Actual: "+("undefined"==typeof t?"undefined":ie.typeof(t))}},anyOf:function(e,t){var n=!1,r=[];return e.forEach(function(e){var i=X(e,t);i?r=r.concat(i):n=!0}),n?void 0:r},allOf:function(e,t){var n=[];return e.forEach(function(e){n=n.concat(X(e,t)||[])}),n.length?void 0:n},oneOf:function(e,t){var n=!1,r=[];return e.forEach(function(e){var i=X(e,t);if(i)r=r.concat(i);else{if(n)return r=["more than one schema validated"],n=!1,!1;n=!0}}),n?void 0:r}},_e="setSchema",we="registerAdapter",Oe=g,ke=function(){for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];var r=this,i=t.pop();r.dbg.apply(r,[i.op].concat(t)),(i.notify||void 0===i.notify&&r.notify)&&setTimeout(function(){r.emit.apply(r,[i.op].concat(t))})};S(ne.prototype,{schema:function(e){var t=this.constructor.schema;return e?t[e]:t},validate:function(e,t){var n=[],r=this.schema();if(e)if(i(e)){var o=r[e];o&&(n=X(o,t)||[])}else p(r,function(t,r){n=n.concat(X(t,f(e,r))||[])});else e=this;return n.length?n:void 0},create:function(e){return this.constructor.create(this,e)},beforeSave:function(){},save:function(e){var t=void 0,n=void 0,r=this,i=r.constructor;return e||(e={}),y(r,e),n=e.adapter=r.getAdapterName(e),t=e.op="beforeSave",Oe(r[t](e)).then(function(){return t=e.op="save",i.dbg(t,r,e),r.getAdapter(n)[t](i,r,e)}).then(function(n){return t=e.op="afterSave",Oe(r[t](n,e)).then(function(t){return n=t||n,e.raw?(r.set(n.data),n.data=r):r.set(n),i.end(n,e)})})},afterSave:function(){},beforeLoadRelations:function(){},loadRelations:function(e,t){var n=void 0,r=this,o=r.constructor,a=o.relationList||[];return e||(e=[]),t||(t={}),y(o,t),t.adapter=o.getAdapterName(t),n=t.op="beforeLoadRelations",Oe(r[n](e,t)).then(function(){return i(e)&&(e=[e]),n=t.op="loadRelations",o.dbg(n,r,e,t),Promise.all(a.map(function(e){if(s(e.load))return e.load(o,e,r,t);var n=void 0;if("hasMany"===e.type&&e.foreignKey)n=e.Relation.findAll(ie.defineProperty({},e.foreignKey,f(r,o.idAttribute)),t);else if(e.foreignKey){var i=f(r,e.foreignKey);l(i)&&(n=e.Relation.find(i,t))}else e.localKeys?n=e.Relation.findAll(ie.defineProperty({},e.Relation.idAttribute,{in:f(r,e.localKeys)}),t):e.foreignKeys&&(n=e.Relation.findAll(ie.defineProperty({},e.Relation.idAttribute,{contains:f(r,o.idAttribute)}),t));return n&&(n=n.then(function(n){t.raw&&(n=n.data),h(r,e.localField,"hasOne"===e.type?n.length?n[0]:void 0:n)})),n}))}).then(function(){return n=t.op="afterLoadRelations",Oe(r[n](e,t)).then(function(){return r})})},afterLoadRelations:function(){},destroy:function(e){var t=this.constructor;return t.destroy(f(this,t.idAttribute),e)},get:function(e){return f(this,e)},set:function(e,n,r){var i=this;t(e)&&(r=n),r||(r={}),r.silent&&i._set("silent",!0),h(i,e,n),i._get("eventId")||i._unset("silent")},unset:function(e,t){t||(t={}),t.silent&&this._set("silent",!0),c(this,e),this._get("eventId")||this._unset("silent")},hashCode:function(){return f(this,this.constructor.idAttribute)},changes:function(e){return e?this._get("changes."+e):this._get("changes")},hasChanges:function(){return!!(this._get("changed")||[]).length},commit:function(){return this._unset("changed"),this._set("changes",{}),this._set("previous",w(this)),this},previous:function(e){return e?this._get("previous."+e):this._get("previous")},revert:function(e){var t=this,n=this._get("previous")||{};return e||(e={}),e.preserve||(e.preserve=[]),p(this,function(r,i){i!==t.constructor.idAttribute&&!n.hasOwnProperty(i)&&t.hasOwnProperty(i)&&-1===e.preserve.indexOf(i)&&delete t[i]}),p(n,function(n,r){-1===e.preserve.indexOf(r)&&(t[r]=n)}),this.commit(),this},toJSON:function(e){return this.constructor.toJSON(this,e)}}),A(ne,{_adapters:null,_adaptersOwner:null,_listeners:null,_listenersOwner:null,csp:!1,defaultAdapter:"http",debug:!1,idAttribute:"id",linkRelations:!0,notify:!0,pojo:!1,relationsEnumerable:!1,raw:!1,upsert:!0,_events:function(e){return e?this._listeners=e:this._listenersOwner!==this&&(this._listeners={},this._listenersOwner=this),this._listeners},end:function(e,t){var n=this;if(t.raw&&y(t,e),!t.pojo){var r=t.raw?e.data:e;r=oe(r)?r.map(function(e){return n.createInstance(e)}):n.createInstance(r),t.raw?e.data=r:e=r}return t.notify&&setTimeout(function(){n.emit(t.op,e,t)}),e},createInstance:function(e,t){var n=this;return e instanceof n?e:new n(e,t)},is:function(e,t){var n=this;return n.instanceClass&&!t?e instanceof n.instanceClass:e instanceof n},toJSON:function(e,t){var n=this;t||(t={});var r=e;if(n.is(e)){r={};for(var o in e)r[o]=e[o];n&&n.relationList&&t.with&&(i(t.with)&&(t.with=[t.with]),n.relationList.forEach(function(n){var i=void 0;-1!==t.with.indexOf(n.relation)?i=n.relation:-1!==t.with.indexOf(n.localField)&&(i=n.localField),i&&!function(){var o={with:t.with.slice()};o.with.splice(o.with.indexOf(i),1),o.with.forEach(function(e,t){e&&0===e.indexOf(i)&&e.length>=i.length&&"."===e[i.length]?o.with[t]=e.substr(i.length+1):o.with[t]=""});var a=f(e,n.localField);a&&(oe(a)?h(r,n.localField,a.map(function(e){return n.Relation.toJSON(e,o)})):h(r,n.localField,n.Relation.toJSON(a,o)))}()}))}return r},getAdapter:function(e){this.dbg("getAdapter","name:",e);var t=this.getAdapterName(e);if(!t)throw new ReferenceError(t+" not found!");return this.getAdapters()[t]},getAdapterName:function(e){return e||(e={}),i(e)&&(e={adapter:e}),e.adapter||e.defaultAdapter},getAdapters:function(){if(this._adaptersOwner!==this){var e=this._adapters;this._adapters={},e&&A(this._adapters,e),this._adaptersOwner=this}return this._adapters},beforeCreate:ke,checkUpsertCreate:function(e,t){var n=this;return(t.upsert||void 0===t.upsert&&n.upsert)&&f(e,n.idAttribute)},create:function(e,t){var n=void 0,r=void 0,i=this;return e||(e={}),t||(t={}),i.checkUpsertCreate(e,t)?i.update(f(e,i.idAttribute),e,t):(y(i,t),r=t.adapter=i.getAdapterName(t),n=t.op="beforeCreate",Oe(i[n](e,t)).then(function(o){e=o||e,n=t.op="create";var a=i.toJSON(e,t);return i.dbg(n,a,t),i.getAdapter(r)[n](i,a,t)}).then(function(e){return n=t.op="afterCreate",Oe(i[n](e,t)).then(function(n){return e=n||e,i.end(e,t)})}))},afterCreate:ke,beforeCreateMany:ke,checkUpsertCreateMany:function(e,t){var n=this;return t.upsert||void 0===t.upsert&&n.upsert?e.reduce(function(e,t){return e&&f(t,n.idAttribute)},!0):void 0},createMany:function(e,t){var n=void 0,r=void 0,i=this;return e||(e=[]),t||(t={}),i.checkUpsertCreateMany(e,t)?i.updateMany(e,t):(y(i,t),r=t.adapter=i.getAdapterName(t),n=t.op="beforeCreateMany",Oe(i[n](e,t)).then(function(o){e=o||e,n=t.op="createMany";var a=e.map(function(e){return i.toJSON(e,t)});return i.dbg(n,a,t),i.getAdapter(r)[n](i,a,t)}).then(function(e){return n=t.op="afterCreateMany",Oe(i[n](e,t)).then(function(n){return e=n||e,i.end(e,t)})}))},afterCreateMany:ke,beforeFind:ke,find:function(e,t){var n=void 0,r=void 0,i=this;return t||(t={}),y(i,t),r=t.adapter=i.getAdapterName(t),n=t.op="beforeFind",Oe(i[n](e,t)).then(function(o){return e=void 0===o?e:o,n=t.op="find",i.dbg(n,e,t),i.getAdapter(r)[n](i,e,t)}).then(function(e){return n=t.op="afterFind",Oe(i[n](e,t)).then(function(n){return e=n||e,i.end(e,t)})})},afterFind:ke,beforeFindAll:ke,findAll:function(e,t){var n=void 0,r=void 0,i=this;return e||(e={}),t||(t={}),y(i,t),r=t.adapter=i.getAdapterName(t), | ||
n=t.op="beforeFindAll",Oe(i[n](e,t)).then(function(o){return e=o||e,n=t.op="findAll",i.dbg(n,e,t),i.getAdapter(r)[n](i,e,t)}).then(function(r){return n=t.op="afterFindAll",Oe(i[n](r,e,t)).then(function(e){return r=e||r,i.end(r,t)})})},afterFindAll:ke,beforeUpdate:ke,update:function(e,t,n){var r=void 0,i=void 0,o=this;return t||(t={}),n||(n={}),y(o,n),i=n.adapter=o.getAdapterName(n),r=n.op="beforeUpdate",Oe(o[r](e,t,n)).then(function(a){t=a||t,r=n.op="update";var u=o.toJSON(t,n);return o.dbg(r,e,u,n),o.getAdapter(i)[r](o,e,u,n)}).then(function(t){return r=n.op="afterUpdate",Oe(o[r](e,t,n)).then(function(e){return t=e||t,o.end(t,n)})})},afterUpdate:ke,beforeUpdateMany:ke,updateMany:function(e,t){var n=void 0,r=void 0,i=this;return e||(e=[]),t||(t={}),y(i,t),r=t.adapter=i.getAdapterName(t),n=t.op="beforeUpdateMany",Oe(i[n](e,t)).then(function(o){e=o||e,n=t.op="updateMany";var a=e.map(function(e){return i.toJSON(e,t)});return i.dbg(n,a,t),i.getAdapter(r)[n](i,a,t)}).then(function(e){return n=t.op="afterUpdateMany",Oe(i[n](e,t)).then(function(n){return e=n||e,i.end(e,t)})})},afterUpdateMany:ke,beforeUpdateAll:ke,updateAll:function(e,t,n){var r=void 0,i=void 0,o=this;return e||(e={}),t||(t={}),n||(n={}),y(o,n),i=n.adapter=o.getAdapterName(n),r=n.op="beforeUpdateAll",Oe(o[r](e,t,n)).then(function(a){t=a||t,r=n.op="updateAll";var u=o.toJSON(t,n);return o.dbg(r,e,u,n),o.getAdapter(i)[r](o,e,u,n)}).then(function(t){return r=n.op="afterUpdateAll",Oe(o[r](e,t,n)).then(function(e){return t=e||t,o.end(t,n)})})},afterUpdateAll:ke,beforeDestroy:ke,destroy:function(e,t){var n=void 0,r=void 0,i=this;return t||(t={}),y(i,t),r=t.adapter=i.getAdapterName(t),n=t.op="beforeDestroy",Oe(i[n](e,t)).then(function(o){return e=void 0===o?e:o,n=t.op="destroy",i.dbg(n,e,t),i.getAdapter(r)[n](i,e,t)}).then(function(e){return n=t.op="afterDestroy",Oe(i[n](e,t)).then(function(n){return e=n||e,t.raw?(y(t,e),e):e})})},afterDestroy:ke,beforeDestroyAll:ke,destroyAll:function(e,t){var n=void 0,r=void 0,i=this;return e||(e={}),t||(t={}),y(i,t),r=t.adapter=i.getAdapterName(t),n=t.op="beforeDestroyAll",Oe(i[n](e,t)).then(function(o){return e=o||e,n=t.op="destroyAll",i.dbg(n,e,t),i.getAdapter(r)[n](i,e,t)}).then(function(r){return n=t.op="afterDestroyAll",Oe(i[n](r,e,t)).then(function(e){return r=e||r,t.raw?(y(t,r),r):r})})},afterDestroyAll:ke,log:function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;t>r;r++)n[r-1]=arguments[r];if(e&&!n.length&&(n.push(e),e="debug"),"debug"!==e||this.debug){var i=e.toUpperCase()+": ("+this.name+")";if(console[e]){var o;(o=console)[e].apply(o,[i].concat(n))}else{var a;(a=console).log.apply(a,[i].concat(n))}}},dbg:function(){for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];this.log.apply(this,["debug"].concat(t))},belongsTo:function(e,t){return V(e,t)(this)},hasMany:function(e,t){return Q(e,t)(this)},hasOne:function(e,t){return W(e,t)(this)},setSchema:function(e){return ee(e)(this)},configure:function(e){return G(e)(this)},registerAdapter:function(e,t,n){return te(e,t,n)(this)},extend:function(e,t){var n=this,r=void 0;n.dbg("extend","props:",e,"classProps:",t),e||(e={}),t||(t={});var i=e.initialize;if(delete e.initialize,e.hasOwnProperty("constructor"))r=e.constructor,delete e.constructor;else{if(!t.name)throw new TypeError("name: Expected string, found "+ie.typeof(t.name)+"!");if(t.csp)r=function(){j(this,r);for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];var o=P(this,(r.__super__||Object.getPrototypeOf(r)).apply(this,t));return i&&i.apply(o,t),o};else{var o=C(t.name),a="return function "+o+"() {\n classCallCheck(this, "+o+")\n for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n var _this = possibleConstructorReturn(this, ("+o+".__super__ || Object.getPrototypeOf("+o+")).apply(this, args));\n if (initialize) {\n initialize.apply(_this, arguments)\n }\n return _this\n }";r=new Function("classCallCheck","possibleConstructorReturn","Parent","initialize",a)(j,P,n,i)}}t.shortname=t.shortname||E(r.name||t.name),delete t.name;var u=t.schema;return delete t.schema,r.prototype=Object.create(n&&n.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(r,n):t.strictEs6Class?r.__proto__=n:p(n,function(e,t){r[t]=e}),Object.defineProperty(r,"__super__",{configurable:!0,value:n}),G(e)(r.prototype),G(t)(r),u&&ee(u)(r),r}}),R(ne,function(){return this._events()},function(e){this._events(e)},!0),R(ne.prototype,function(){return this._get("events")},function(e){this._set("events",e)}),S(re.prototype,{defineModel:function(e,n){var r=this;t(e)&&(n=e,e=n.name),n||(n={}),A(n,r.defaults);var i=n.methods||{};delete n.methods;var o=r.models[n.extends],a=(o||ne).extend(i,n);return r.models[e]=a,a.getModel=function(e){return r.models[e]},a},defineCollection:function(e,t,n){var r=this;t||(t={}),i(t.model)&&(t.model=r.models[e]);var o=new(n||$)([],t);return r.collection[e]=o,o},model:function(e){return this.models[e]},collection:function(e){return this.collections[e]},registerAdapter:function(){for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];p(this.models,function(e){e.registerAdapter.apply(e,t)})}}),re.prototype.defineResource=re.prototype.defineModel,Promise.prototype.spread||(Promise.prototype.spread=function(e){return this.then(function(t){return e.apply(this,t)})});var Ce=ce,Ee={full:"<%= pkg.version %>",major:parseInt("<%= major %>",10),minor:parseInt("<%= minor %>",10),patch:parseInt("<%= patch %>",10),alpha:"<%= alpha %>",beta:"<%= beta %>"};e.utils=Ce,e.version=Ee,e.Collection=$,e.Query=F,e.DS=re,e.belongsTo=V,e.configure=G,e.hasMany=Q,e.hasOne=W,e.setSchema=ee,e.registerAdapter=te,e.Model=ne,e.rules=xe,e.validate=X}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.JSData={})}(this,function(e){"use strict";function t(e){return Object.prototype.toString.call(e)}function n(e){return"[object Object]"===t(e)||!1}function r(e){return!!e&&"object"===("undefined"==typeof e?"undefined":oe.typeof(e))&&e.constructor===Object}function i(e){return"[object RegExp]"===t(e)||!1}function o(e){return"string"==typeof e||e&&"object"===("undefined"==typeof e?"undefined":oe.typeof(e))&&"[object String]"===t(e)||!1}function a(e){return e&&"object"===("undefined"==typeof e?"undefined":oe.typeof(e))&&"[object Date]"===t(e)||!1}function u(e){var n="undefined"==typeof e?"undefined":oe.typeof(e);return"number"===n||e&&"object"===n&&"[object Number]"===t(e)||!1}function s(e){return"[object Boolean]"===t(e)}function l(e){return"function"==typeof e||e&&"[object Function]"===t(e)||!1}function f(e){return o(e)||u(e)}function c(e,t){if(t){for(var n=t.split("."),r=n.pop();t=n.shift();)if(e=e[t],null==e)return;return e[r]}}function d(e,t){for(var n=t.split("."),r=n.pop();t=n.shift();)if(e=e[t],null==e)return;e[r]=void 0,delete e[r]}function h(e,t){if(!t)return e;var n=t.split(".");return n.forEach(function(t){e[t]||(e[t]={}),e=e[t]}),e}function p(e,t,r){if(n(t))v(t,function(t,n){p(e,n,t)});else{var i=ue.exec(t);i?h(e,i[1])[i[2]]=r:e[t]=r}}function v(e,t,n){var r=Object.keys(e),i=r.length,o=void 0;for(o=0;i>o;o++)t.call(n,e[r[o]],r[o],e)}function g(e,t){return t&&v(t,function(e,t){var n=this[t];r(e)&&r(n)?g(n,e):this[t]=e},e),e}function m(e){return Promise.resolve(e)}function y(e){return Promise.reject(e)}function b(e,t){for(var n in e){var r=e[n];void 0===t[n]&&!l(r)&&n&&0!==n.indexOf("_")&&(t[n]=r)}}function A(e,t){if(!e||!t)return[];var n=[],r=void 0,i=void 0,o=e.length;for(i=0;o>i;i++)r=e[i],-1===n.indexOf(r)&&-1!==t.indexOf(r)&&n.push(r);return n}function x(e,t){v(t,function(t,n){void 0===e[n]&&(e[n]=t)})}function _(e,n){if(!n||!n.length)return!1;for(var r=void 0,i=0;i<n.length;i++)if("[object RegExp]"===t(n[i])&&n[i].test(e)||n[i]===e)return r=e;return!!r}function w(e){return o(e)?JSON.parse(e):e}function O(e,t,r,o,u){if(t){if(e===t)throw new Error("Cannot copy! Source and destination are identical.");if(r=r||[],o=o||[],n(e)){var s=r.indexOf(e);if(-1!==s)return o[s];r.push(e),o.push(t)}var l=void 0;if(ae(e)){var f=void 0;for(t.length=0,f=0;f<e.length;f++)l=O(e[f],null,r,o,u),n(e[f])&&(r.push(e[f]),o.push(l)),t.push(l)}else{ae(t)?t.length=0:v(t,function(e,n){delete t[n]});for(var c in e)if(e.hasOwnProperty(c)){if(_(c,u))continue;l=O(e[c],null,r,o,u),n(e[c])&&(r.push(e[c]),o.push(l)),t[c]=l}}}else t=e,e&&(ae(e)?t=O(e,[],r,o,u):a(e)?t=new Date(e.getTime()):i(e)?(t=new RegExp(e.source,e.toString().match(/[^\/]*$/)[0]),t.lastIndex=e.lastIndex):n(e)&&(t=O(e,Object.create(Object.getPrototypeOf(e)),r,o,u)));return t}function k(e,t,n){return""+t.toUpperCase()+n.toLowerCase()}function C(e){return e.replace(fe,"").replace(ce,k)}function E(e){return e.split(le).map(C).join("")}function R(e){return e=E(e),e?e.charAt(0).toLowerCase()+e.slice(1):e}function I(e,t,n,r){e=e||this;var i={};t||n||(t=function(){return i},n=function(e){i=e}),Object.defineProperties(e,{on:{enumerable:!!r,value:function(e,r,i){t.call(this)||n.call(this,{});var o=t.call(this);o[e]=o[e]||[],o[e].push({f:r,c:i})}},off:{enumerable:!!r,value:function(e,r){var i=t.call(this),o=i[e];if(o)if(r){for(var a=0;a<o.length;a++)if(o[a].f===r){o.splice(a,1);break}}else o.splice(0,o.length);else n.call(this,{})}},emit:{enumerable:!!r,value:function(){for(var e=t.call(this)||{},n=arguments.length,r=Array(n),i=0;n>i;i++)r[i]=arguments[i];var o=r.shift(),a=e[o]||[],u=void 0;for(u=0;u<a.length;u++)a[u].f.apply(a[u].c,r);for(a=e.all||[],r.unshift(o),u=0;u<a.length;u++)a[u].f.apply(a[u].c,r)}}})}function j(e,t){for(t=e="";e++<36;t+=51*e&52?(15^e?8^Math.random()*(20^e?16:4):4).toString(16):"-");return t}function P(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function M(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==("undefined"==typeof t?"undefined":oe.typeof(t))&&"function"!=typeof t?e:t}function F(e,t){v(t,function(e,n){t[n]={value:e}}),Object.defineProperties(e,t)}function S(e,t){var n=this,r=void 0;return e||(e={}),t||(t={}),e.hasOwnProperty("constructor")?(r=e.constructor,delete e.constructor):r=function(){P(this,r);for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];var i=M(this,(r.__super__||Object.getPrototypeOf(r)).apply(this,t));return i},r.prototype=Object.create(n&&n.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(r,n):t.strictEs6Class?r.__proto__=n:v(n,function(e,t){r[t]=e}),Object.defineProperty(r,"__super__",{configurable:!0,value:n}),g(r.prototype,e),g(r,t),r}function N(e){P(this,N),this.collection=e,this.data=null}function D(e,t,n,r){var i=e[t],a=c(n,i[0]),u=c(r,i[0]);return a&&o(a)&&(a=a.toUpperCase()),u&&o(u)&&(u=u.toUpperCase()),n||(n=null),r||(r=null),"DESC"===i[1]?a>u?-1:u>a?1:t<e.length-1?D(e,t+1,n,r):0:u>a?-1:a>u?1:t<e.length-1?D(e,t+1,n,r):0}function L(e){return e.replace(pe,"\\$1")}function K(e,t){return new RegExp("^"+L(e).replace(ve,".*").replace(ge,".")+"$",t)}function U(e,t,n){switch(t){case"==":return e==n;case"===":return e===n;case"!=":return e!=n;case"!==":return e!==n;case">":return e>n;case">=":return e>=n;case"<":return n>e;case"<=":return n>=e;case"isectEmpty":return!A(e||[],n||[]).length;case"isectNotEmpty":return A(e||[],n||[]).length;case"in":return-1!==n.indexOf(e);case"notIn":return-1===n.indexOf(e);case"contains":return-1!==(e||[]).indexOf(n);case"notContains":return-1===(e||[]).indexOf(n);default:if(0===t.indexOf("like"))return null!==K(n,t.substr(4)).exec(e);if(0===t.indexOf("notLike"))return null===K(n,t.substr(7)).exec(e)}}function T(e,t,n){return e===t?0:(n&&(e=n(e),t=n(t)),null===e&&null===t?0:null===e?-1:null===t?1:t>e?-1:e>t?1:0)}function J(e,t,n){return e.splice(t,0,n),e}function q(e,t){return e.splice(t,1),e}function z(e,t,n){for(var r=0,i=e.length,o=void 0,a=void 0;i>r;){if(a=(r+i)/2|0,o=T(t,e[a],n),0===o)return{found:!0,index:a};0>o?i=a:r=a+1}return{found:!1,index:i}}function $(e,t){if(P(this,$),e||(e=[]),!ae(e))throw new Error("fieldList must be an array.");t||(t={}),this.fieldList=e,this.fieldGetter=t.fieldGetter,this.hashCode=t.hashCode,this.isIndex=!0,this.keys=[],this.values=[]}function B(e,t){var r=this;P(r,B),n(e)&&!ae(e)&&(t=e,e=[]),e||(e=[]),t||(t={}),r.model=t.model,r.idAttribute=t.idAttribute,r._listeners={},this.onConflict=t.onConflict||"merge";var i=r.modelId();r.index=new $([i],{hashCode:function(e){return c(e,i)}}),r.indexes={},r.added={},r.autoPks={},r.createIndex("addedTimestamps",["$"],{fieldGetter:function(e){return r.added[c(e,i)]}}),e.forEach(function(e){r.index.insertRecord(e),e&&l(e.on)&&e.on("all",r._onModelEvent,r)})}function V(e,t,n){n||(n={});var r=n.localField=n.localField||t.name.toLowerCase(),i=n.foreignKey=n.localKey||n.foreignKey||t.name.toLowerCase()+"_id",o={enumerable:void 0!==n.enumerable?!!n.enumerable:!1,get:function(){return this._get("links."+r)},set:function(e){return this._set("links."+r,e),p(this,i,e[t.idAttribute]),c(this,r)}},a=o.get,u=o.set;return(n.link===!1||void 0===n.link&&!e.linkRelations)&&(delete o.get,delete o.set,o.writable=!0),n.get&&(o.get=function(){var r=this;return n.get(e,t,this,function(){return a.call(r)})},delete o.writable),n.set&&(o.set=function(r){var i=this;return n.set(e,t,this,r,function(e){return u.call(i,void 0===e?r:e)})},delete o.writable),o.get&&(o.set||(o.set=function(){})),Object.defineProperty(e.prototype,r,o),e.relationList||(e.relationList=[]),e.relationFields||(e.relationFields=[]),n.type="belongsTo",n.name=e.name,n.relation=t.name,n.Relation=t,e.relationList.push(n),e.relationFields.push(r),e}function G(e,t){return function(n){return n.dbg(ye,"Model:",e,"opts:",t),V(n,e,t)}}function H(e){var t=arguments.length<=1||void 0===arguments[1]?!0:arguments[1];return e=e||{},function(n){return v(e,function(e,r){(void 0===n[r]||t)&&(n[r]=O(e))}),n}}function Q(e,t,n){n||(n={});var r=n.localField=n.localField||R(t.name)+"_collection",i=n.foreignKey,o=n.localKeys,a=n.foreignKeys;i||o||a||(i=n.foreignKey=R(e.name)+"_id");var u={enumerable:void 0!==n.enumerable?!!n.enumerable:!1,get:function(){return this._get("links."+r)},set:function(n){var u=this;return this._set("links."+r,n),n&&n.length&&!function(){var r=c(u,e.idAttribute);i?n.forEach(function(e){p(e,i,r)}):o?!function(){var e=[];n.forEach(function(n){e.push(c(n,t.idAttribute))}),p(u,o,e)}():a&&n.forEach(function(e){var t=c(e,a);t?-1===t.indexOf(r)&&t.push(r):p(e,a,[r])})}(),c(this,r)}},s=u.get,l=u.set;return(n.link===!1||void 0===n.link&&!e.linkRelations)&&(delete u.get,delete u.set,u.writable=!0),n.get&&(u.get=function(){var r=this;return n.get(e,t,this,function(){return s.call(r)})}),n.set&&(u.set=function(r){var i=this;return n.set(e,t,this,r,function(e){return l.call(i,void 0===e?r:e)})}),Object.defineProperty(e.prototype,r,u),e.relationList||(e.relationList=[]),e.relationFields||(e.relationFields=[]),n.type="hasMany",n.name=e.name,n.relation=t.name,n.Relation=t,e.relationList.push(n),e.relationFields.push(r),e}function Z(e,t){return function(n){return n.dbg(be,"Model:",e,"opts:",t),Q(n,e,t)}}function W(e,t,n){n||(n={});var r=n.localField=n.localField||R(t.name),i=n.foreignKey=n.foreignKey||R(e.name)+"Id",o={enumerable:void 0!==n.enumerable?!!n.enumerable:!1,get:function(){return this._get("links."+r)},set:function(t){return this._set("links."+r,t),p(t,i,c(this,e.idAttribute)),c(this,r)}};return(n.link===!1||void 0===n.link&&!e.linkRelations)&&(delete o.get,delete o.set),n.get&&!function(){var r=o.get;o.get=function(){var i=this;return n.get(e,t,this,r?function(){for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];return r.apply(i,t)}:void 0)}}(),n.set&&!function(){var r=o.set;o.set=function(i){var o=this;return n.set(e,t,this,i,r?function(){for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];return r.apply(o,t)}:void 0)}}(),Object.defineProperty(e.prototype,r,o),e.relationList||(e.relationList=[]),e.relationFields||(e.relationFields=[]),n.type="hasOne",n.name=e.name,n.relation=t.name,n.Relation=t,e.relationList.push(n),e.relationFields.push(r),e}function X(e,t){return function(n){return n.dbg(Ae,"Model:",e,"opts:",t),W(n,e,t)}}function Y(e,t){var n=[];return v(e,function(e,r){var i=_e[r];if(i){var o=i(e,t);o&&n.push(o)}}),n.length?n:void 0}function ee(e,t,n){var r={enumerable:void 0!==n.enumerable?n.enumerable:!0};return r.get=function(){return this._get("props."+t)},r.set=function(e){var r=this,i=this._get,o=this._set,a=this._unset;if(!i("noValidate")){var u=Y(n,e);if(u)throw new Error(u.join(", "))}return n.track&&!i("creating")&&!function(){var n=i("changing"),u=i("previous."+t),s=i("props."+t),l=i("changed");n||(l=[]);var f=l.indexOf(t);s!==e&&-1===f&&l.push(t),u!==e?o("changes."+t,e):(a("changes."+t),f>=0&&l.splice(f,1)),l.length||(n=!1,a("changing"),a("changed"),i("eventId")&&(clearTimeout(i("eventId")),a("eventId"))),!n&&l.length&&(o("changed",l),o("changing",!0),o("eventId",setTimeout(function(){if(a("changed"),a("eventId"),a("changing"),!i("silent")){var e=void 0;for(e=0;e<l.length;e++)r.emit("change:"+l[e],r,c(r,l[e]));r.emit("change",r,i("changes"))}a("silent")},0)))}(),o("props."+t,e),e},n.get&&(r.get?!function(){var e=r.get;r.get=function(){return n.get.call(this,e)}}():r.get=n.get),n.set&&(r.set?!function(){var e=r.set;r.set=function(t){return n.set.call(this,t,e)}}():r.set=n.set),r}function te(e){return e||(e={}),function(t){return t.dbg(we,"opts:",e),t.schema||(t.schema={}),H(t.schema,e),v(e,function(e,n){var r=ee(t,n,e);r.writable||Object.defineProperty(t.prototype,n,r)}),t}}function ne(e,t,n){return n||(n={}),n.op=Oe,function(r){r.dbg(Oe,"name:",e,"adapter:",t,"opts:",n),r.getAdapters()[e]=t,(n===!0||n.default)&&(r.defaultAdapter=e)}}function re(e,t){var n=this;P(n,re),e||(e={}),t||(t={});var r={};Object.defineProperties(n,{_get:{value:function(e){return c(r,e)}},_set:{value:function(e,t){return p(r,e,t)}},_unset:{value:function(e){return d(r,e)}}}),n._set("creating",!0),t.noValidate&&n._set("noValidate",!0),x(n,e),n._unset("creating"),n._set("changes",{}),n._unset("noValidate"),n._set("previous",O(e))}function ie(e){var t=this;P(t,ie),e||(e={}),t.defaults={};for(var n in e)t.defaults[n]=e[n];t.models={},t.collections={}}var oe={};oe.typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},oe.defineProperty=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e};var ae=Array.isArray,ue=/^(.+)\.(.+)$/,se=JSON.stringify,le=/\s+/,fe=/[^A-Za-z]/g,ce=/(\w)(\w*)/g,de=Object.freeze({isArray:ae,isObject:n,isRegExp:i,isString:o,isDate:a,isNumber:u,isBoolean:s,isFunction:l,isSorN:f,get:c,unset:d,set:p,forOwn:v,deepMixIn:g,resolve:m,reject:y,_:b,intersection:A,fillIn:x,isBlacklisted:_,fromJson:w,toJson:se,copy:O,pascalCase:E,camelCase:R,eventify:I,uuid:j,classCallCheck:P,possibleConstructorReturn:M,addHiddenPropsToTarget:F,extend:S}),he={skip:"",offset:"",where:"",limit:"",orderBy:"",sort:""},pe=/([.*+?^=!:${}()|[\]\/\\])/g,ve=/%/g,ge=/_/g;F(N.prototype,{getData:function(){return this.data||(this.data=this.collection.index.getAll()),this.data},between:function(e,t,n){n||(n={});var r=this.collection,i=n.index?r.indexes[n.index]:r.index;if(this.data)throw new Error("Cannot access index after first operation!");return this.data=i.between(e,t,n),this},get:function(){var e=arguments.length<=0||void 0===arguments[0]?[]:arguments[0],t=arguments[1];if(t||(t={}),this.data)throw new Error("Cannot access index after first operation!");if(e&&!ae(e)&&(e=[e]),!e.length)return this.getData(),this;var n=this.collection,r=t.index?n.indexes[t.index]:n.index;return this.data=r.get(e),this},getAll:function(){var e=this,t={};if(this.data)throw new Error("Cannot access index after first operation!");for(var r=arguments.length,i=Array(r),o=0;r>o;o++)i[o]=arguments[o];if(!i.length||1===i.length&&n(i[0]))return this.getData(),this;i.length&&n(i[i.length-1])&&(t=i[i.length-1],i.pop());var a=this.collection,u=t.index?a.indexes[t.index]:a.index;return this.data=[],i.forEach(function(t){e.data=e.data.concat(u.get(t))}),this},filter:function(e,t){var r=this;return e||(e={}),this.getData(),n(e)?!function(){var t={};n(e.where)&&(t=e.where),v(e,function(e,n){n in he||n in t||(t[n]={"==":e})});var i=[],a=[],s=[];v(t,function(e,t){n(e)||(e={"==":e}),v(e,function(e,n){i.push(t),a.push(n),s.push(e)})}),i.length&&!function(){var e=void 0,t=i.length;r.data=r.data.filter(function(n){var r=!0,o=!0;for(e=0;t>e;e++){var u=a[e],l="|"===u.charAt(0);u=l?u.substr(1):u;var f=U(c(n,i[e]),u,s[e]);void 0!==f&&(o=r?f:l?o||f:o&&f),r=!1}return o})}();var l=e.orderBy||e.sort;o(l)&&(l=[[l,"ASC"]]),ae(l)||(l=null),l&&!function(){var e=0;l.forEach(function(e,t){o(e)&&(l[t]=[e,"ASC"])}),r.data.sort(function(t,n){return D(l,e,t,n)})}(),u(e.skip)?r.skip(e.skip):u(e.offset)&&r.skip(e.offset),u(e.limit)&&r.limit(e.limit)}():l(e)&&(this.data=this.data.filter(e,t)),this},skip:function(e){if(!u(e))throw new TypeError("skip: Expected number but found "+("undefined"==typeof e?"undefined":oe.typeof(e))+"!");var t=this.getData();return e<t.length?this.data=t.slice(e):this.data=[],this},limit:function(e){if(!u(e))throw new TypeError("limit: Expected number but found "+("undefined"==typeof e?"undefined":oe.typeof(e))+"!");var t=this.getData();return this.data=t.slice(0,Math.min(t.length,e)),this},forEach:function(e,t){return this.getData().forEach(e,t),this},map:function(e,t){return this.data=this.getData().map(e,t),this},mapCall:function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;t>r;r++)n[r-1]=arguments[r];return this.data=this.getData().map(function(t){return t[e].apply(t,n)}),this},run:function(){var e=this.data;return this.data=null,e}});var me={">":1,">=":1,"<":1,"<=":1};F($.prototype,{set:function(e,t){ae(e)||(e=[e]);var n=e.shift()||null,r=z(this.keys,n);if(0===e.length)if(r.found){var i=z(this.values[r.index],t,this.hashCode);i.found||J(this.values[r.index],i.index,t)}else J(this.keys,r.index,n),J(this.values,r.index,[t]);else if(r.found)this.values[r.index].set(e,t);else{J(this.keys,r.index,n);var o=new $([],{hashCode:this.hashCode});o.set(e,t),J(this.values,r.index,o)}},get:function(e){ae(e)||(e=[e]);var t=e.shift()||null,n=z(this.keys,t);return 0===e.length?n.found?this.values[n.index].isIndex?this.values[n.index].getAll():this.values[n.index]:[]:n.found?this.values[n.index].get(e):[]},getAll:function(){var e=[];return this.values.forEach(function(t){e=t.isIndex?e.concat(t.getAll()):e.concat(t)}),e},visitAll:function(e,t){this.values.forEach(function(n){n.isIndex?n.visitAll(e,t):n.forEach(e,t)})},query:function(e){var t=void 0,n=void 0;if(e[">"]?(t=e[">"],e.leftInclusive=!1):e[">="]&&(t=e[">="],e.leftInclusive=!0),e["<"]?(n=e["<"],e.rightInclusive=!1):e["<="]&&(n=e["<="],e.rightInclusive=!0),t.length!==n.length)throw new Error("Key arrays must be same length");var r={};return v(e,function(e,t){me[t]||(r[t]=e)}),this.between(t,n,r)},between:function(e,t){var n=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];ae(e)||(e=[e]),ae(t)||(t=[t]),x(n,{leftInclusive:!0,rightInclusive:!1,limit:void 0,offset:0});var r=this._between(e,t,n);return n.limit?r.slice(n.offset,n.limit+n.offset):r.slice(n.offset)},_between:function(e,t,n){var r=[],i=e.shift(),o=t.shift(),a=void 0;if(a=void 0!==i?z(this.keys,i):{found:!1,index:0},0===e.length){a.found&&n.leftInclusive===!1&&(a.index+=1);for(var u=a.index;u<this.keys.length;u+=1){if(void 0!==o)if(n.rightInclusive){if(this.keys[u]>o)break}else if(this.keys[u]>=o)break;if(r=this.values[u].isIndex?r.concat(this.values[u].getAll()):r.concat(this.values[u]),n.limit&&r.length>=n.limit+n.offset)break}}else for(var u=a.index;u<this.keys.length;u+=1){var s=this.keys[u];if(s>o)break;if(r=this.values[u].isIndex?s===i?r.concat(this.values[u]._between(O(e),t.map(function(){}),n)):s===o?r.concat(this.values[u]._between(e.map(function(){}),O(t),n)):r.concat(this.values[u].getAll()):r.concat(this.values[u]),n.limit&&r.length>=n.limit+n.offset)break}return n.limit?r.slice(0,n.limit+n.offset):r},peek:function(){return this.values.length?this.values[0].isIndex?this.values[0].peek():this.values[0]:[]},remove:function(e,t){ae(e)||(e=[e]);var n=e.shift(),r=z(this.keys,n);if(0===e.length){if(r.found){var i=z(this.values[r.index],t,this.hashCode);i.found&&(q(this.values[r.index],i.index),0===this.values[r.index].length&&(q(this.keys,r.index),q(this.values,r.index)))}}else r.found&&this.values[r.index].delete(e,t)},clear:function(){this.keys=[],this.values=[]},insertRecord:function(e){var t=this.fieldList.map(function(t){return l(t)?t(e)||null:e[t]||null});this.set(t,e)},removeRecord:function(e){var t=this,n=void 0;return this.values.forEach(function(r,i){if(r.isIndex){if(r.removeRecord(e))return 0===r.keys.length&&(q(t.keys,i),q(t.values,i)),n=!0,!1}else{var o=z(r,e,t.hashCode);if(o.found)return q(r,o.index),0===r.length&&(q(t.keys,i),q(t.values,i)),n=!0,!1}}),n?e:void 0},updateRecord:function(e){this.removeRecord(e),this.insertRecord(e)}}),F(B.prototype,{_onModelEvent:function(){this.emit.apply(this,arguments)},modelId:function(e){var t=this;return e?c(e,t.modelId()):t.model?t.model.idAttribute:t.idAttribute||"id"},createIndex:function(e,t,n){var r=this;o(e)&&void 0===t&&(t=[e]),n||(n={}),n.hashCode=n.hashCode||function(e){return r.modelId(e)};var i=r.indexes[e]=new $(t,n);return r.index.visitAll(i.insertRecord,i),r},getAutoPkItems:function(){var e=this;return e.getAll().filter(function(t){return e.autoPks[e.modelId(t)]})},query:function(){return new N(this)},between:function(e,t,n){return this.query().between(e,t,n).run()},get:function(e){var t=this.query().get(e).run();return t.length?t[0]:void 0},getAll:function(){var e;return(e=this.query()).getAll.apply(e,arguments).run()},filter:function(e,t){return this.query().filter(e,t).run()},skip:function(e){return this.query().skip(e).run()},limit:function(e){return this.query().limit(e).run()},forEach:function(e,t){this.index.visitAll(e,t)},reduce:function(e,t){var n=this.getAll();return n.reduce(e,t)},map:function(e,t){var n=[];return this.index.visitAll(function(r){n.push(e.call(t,r))}),n},beforeAdd:function(){},add:function(e,t){var n=this;t||(t={}),b(n,t),e=n.beforeAdd(e,t)||e;var r=!1,i=n.modelId(),o=[],a=(new Date).getTime();ae(e)||(e=[e],r=!0),e=e.map(function(e){var r=n.modelId(e),u=!1;if(!f(r)){if(!t.autoPk)throw new TypeError(i+": Expected string or number, found "+("undefined"==typeof r?"undefined":oe.typeof(r))+"!");r=j(),p(e,i,r),u=!0}var s=n.get(r);if(e===s)return s;if(o.forEach(function(t){var i=t.Relation,o=i.idAttribute,a=t.foreignKey,u=c(e,t.localField);if(l(t.insert))t.insert(n,t,e);else if(u&&t.insert!==!1)if(ae(u))u=u.map(function(e){if(e!==i.get(c(e,o)))try{a&&p(e,a,r),e=i.add(e)}catch(e){throw new Error("Failed to insert "+t.type+' relation: "'+t.relation+'"! '+e.message)}return e}),t.localKeys&&p(e,t.localKeys,u.map(function(e){return c(e,o)}));else if(u!==i.get(c(u,o)))try{t.foreignKey&&p(e,t.foreignKey,c(u,i.idAttribute)),a&&p(u,t.foreignKey,r),u=i.add(u)}catch(e){throw new Error("Failed to insert "+t.type+' relation: "'+t.relation+'"!')}t.link||void 0===t.link&&n.linkRelations?d(e,t.localField):p(e,t.localField,u)}),s){var h=t.onConflict||n.onConflict;"merge"===h?g(s,e):"replace"===h&&(v(s,function(t,n){n===i||e.hasOwnProperty(n)||delete s[n]}),s.set(e)),e=s,n.updateIndexes(e)}else e=n.model?n.model.createInstance(e):e,n.index.insertRecord(e),v(n.indexes,function(t,n){t.insertRecord(e)}),e&&l(e.on)&&(e.on("all",n._onModelEvent,n),n.emit("add",e));return n.added[r]=a,u&&(n.autoPks[r]=e),e});var u=r?e.length?e[0]:void 0:e;return n.afterAdd(u,t),u},afterAdd:function(){},beforeRemove:function(){},remove:function(e,t){var n=this;t||(t={}),n.beforeRemove(e,t);var r=n.get(e);return r&&(delete n.added[e],delete n.autoPks[e],n.index.removeRecord(r),v(n.indexes,function(e,t){e.removeRecord(r)}),r&&l(r.off)&&(r.off("all",n._onModelEvent,n),n.emit("remove",r))),n.afterRemove(r,t),r},afterRemove:function(){},beforeRemoveAll:function(){},removeAll:function(e,t){var n=this;t||(t={}),n.beforeRemoveAll(e,t);var r=n.filter(e);return r.forEach(function(e){n.remove(n.modelId(e))}),n.afterRemoveAll(r,e,t),r},afterRemoveAll:function(){},updateIndex:function(e,t){t||(t={});var n=t.index?this.indexes[t.index]:this.index;n.updateRecord(e)},updateIndexes:function(e){var t=this;t.index.updateRecord(e),v(t.indexes,function(t,n){t.updateRecord(e)})},mapCall:function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;t>r;r++)n[r-1]=arguments[r];var i=[];return this.index.visitAll(function(t){i.push(t[e].apply(t,n))}),i},toJSON:function(e){return this.mapCall("toJSON",e)},end:function(e,t){var n=this;return t.raw?(t.autoAdd&&(e.data=n.add(e.data,t)),e):(t.autoAdd&&(e=n.add(e,t)),e)},create:function(e,t){var n=this,r=n.modelId(e);return n.model.create(e,t).then(function(e){return n.autoPks[r]&&n.remove(r),n.end(e)})},createMany:function(e,t){var n=this;return n.model.createMany(e,t).then(function(t){return e.forEach(function(e){var t=n.modelId(e);n.autoPks[t]&&n.remove(t)}),n.end(t)})},find:function(e,t){var n=this;return n.model.find(e,t).then(function(e){return n.end(e)})},findAll:function(e,t){var n=this;return n.model.findAll(e,t).then(function(e){return n.end(e)})},update:function(e,t,n){var r=this;return r.model.update(e,t,n).then(function(e){return r.end(e)})},updateMany:function(e,t){var n=this;return n.model.updateMany(e,t).then(function(e){return n.end(e)})},updateAll:function(e,t,n){var r=this;return r.model.updateAll(e,t,n).then(function(e){return r.end(e)})},destroy:function(e,t){var n=this;return n.model.destroy(e,t).then(function(r){return t.raw?r.data=n.remove(e,t):r=n.remove(e,t),r})},destroyAll:function(e,t){var n=this;return n.model.destroyAll(e,t).then(function(r){return t.raw?r.data=n.removeAll(e,t):r=n.removeAll(e,t),r})}}),I(B.prototype,function(){return this._listeners},function(e){this._listeners=e});var ye="belongsTo",be="hasMany",Ae="hasOne",xe={array:ae,boolean:s,integer:u,number:u,null:function(e){return null===e},object:n,string:o},_e={type:function(e,t){if(void 0!==t){o(e)&&(e=[e]);var n=e.map(function(n){var r=xe[n];return r?r(t)?void 0:1:"type: Unknown type "+e});return-1!==n.indexOf(void 0)?void 0:"type: Expected: "+e.join(" or ")+". Actual: "+("undefined"==typeof t?"undefined":oe.typeof(t))}},anyOf:function(e,t){var n=!1,r=[];return e.forEach(function(e){var i=Y(e,t);i?r=r.concat(i):n=!0}),n?void 0:r},allOf:function(e,t){var n=[];return e.forEach(function(e){n=n.concat(Y(e,t)||[])}),n.length?void 0:n},oneOf:function(e,t){var n=!1,r=[];return e.forEach(function(e){var i=Y(e,t);if(i)r=r.concat(i);else{if(n)return r=["more than one schema validated"],n=!1,!1;n=!0}}),n?void 0:r}},we="setSchema",Oe="registerAdapter",ke=m,Ce=function(){for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];var r=this,i=t.pop();r.dbg.apply(r,[i.op].concat(t)),(i.notify||void 0===i.notify&&r.notify)&&setTimeout(function(){r.emit.apply(r,[i.op].concat(t))})};F(re.prototype,{schema:function(e){var t=this.constructor.schema;return e?t[e]:t},validate:function(e,t){var n=[],r=this.schema();if(e)if(o(e)){var i=r[e];i&&(n=Y(i,t)||[])}else v(r,function(t,r){n=n.concat(Y(t,c(e,r))||[])});else e=this;return n.length?n:void 0},create:function(e){return this.constructor.create(this,e)},beforeSave:function(){},save:function(e){var t=void 0,n=void 0,r=this,i=r.constructor;return e||(e={}),b(r,e),n=e.adapter=r.getAdapterName(e),t=e.op="beforeSave",ke(r[t](e)).then(function(){return t=e.op="save",i.dbg(t,r,e),r.getAdapter(n)[t](i,r,e)}).then(function(n){return t=e.op="afterSave",ke(r[t](n,e)).then(function(t){return n=t||n,e.raw?(r.set(n.data),n.data=r):r.set(n),i.end(n,e)})})},afterSave:function(){},beforeLoadRelations:function(){},loadRelations:function(e,t){var n=void 0,r=this,i=r.constructor,a=i.relationList||[];return e||(e=[]),t||(t={}),b(i,t),t.adapter=i.getAdapterName(t),n=t.op="beforeLoadRelations",ke(r[n](e,t)).then(function(){return o(e)&&(e=[e]),n=t.op="loadRelations",i.dbg(n,r,e,t),Promise.all(a.map(function(e){if(l(e.load))return e.load(i,e,r,t);var n=void 0;if("hasMany"===e.type&&e.foreignKey)n=e.Relation.findAll(oe.defineProperty({},e.foreignKey,c(r,i.idAttribute)),t);else if(e.foreignKey){var o=c(r,e.foreignKey);f(o)&&(n=e.Relation.find(o,t))}else e.localKeys?n=e.Relation.findAll(oe.defineProperty({},e.Relation.idAttribute,{in:c(r,e.localKeys)}),t):e.foreignKeys&&(n=e.Relation.findAll(oe.defineProperty({},e.Relation.idAttribute,{contains:c(r,i.idAttribute)}),t));return n&&(n=n.then(function(n){t.raw&&(n=n.data),p(r,e.localField,"hasOne"===e.type?n.length?n[0]:void 0:n)})),n}))}).then(function(){return n=t.op="afterLoadRelations",ke(r[n](e,t)).then(function(){return r})})},afterLoadRelations:function(){},destroy:function(e){var t=this.constructor;return t.destroy(c(this,t.idAttribute),e)},get:function(e){return c(this,e)},set:function(e,t,r){var i=this;n(e)&&(r=t),r||(r={}),r.silent&&i._set("silent",!0),p(i,e,t),i._get("eventId")||i._unset("silent")},unset:function(e,t){t||(t={}),t.silent&&this._set("silent",!0),d(this,e),this._get("eventId")||this._unset("silent")},hashCode:function(){return c(this,this.constructor.idAttribute)},changes:function(e){return e?this._get("changes."+e):this._get("changes")},hasChanges:function(){return!!(this._get("changed")||[]).length},commit:function(){return this._unset("changed"),this._set("changes",{}),this._set("previous",O(this)),this},previous:function(e){return e?this._get("previous."+e):this._get("previous")},revert:function(e){var t=this,n=this._get("previous")||{};return e||(e={}),e.preserve||(e.preserve=[]),v(this,function(r,i){i!==t.constructor.idAttribute&&!n.hasOwnProperty(i)&&t.hasOwnProperty(i)&&-1===e.preserve.indexOf(i)&&delete t[i]}),v(n,function(n,r){-1===e.preserve.indexOf(r)&&(t[r]=n)}),this.commit(),this},toJSON:function(e){return this.constructor.toJSON(this,e)}}),x(re,{_adapters:null,_adaptersOwner:null,_listeners:null,_listenersOwner:null,csp:!1,defaultAdapter:"http",debug:!1,idAttribute:"id",linkRelations:!0,notify:!0,pojo:!1,relationsEnumerable:!1,raw:!1,upsert:!0,_events:function(e){return e?this._listeners=e:this._listenersOwner!==this&&(this._listeners={},this._listenersOwner=this),this._listeners},end:function(e,t){var n=this;if(t.raw&&b(t,e),!t.pojo){var r=t.raw?e.data:e;r=ae(r)?r.map(function(e){return n.createInstance(e)}):n.createInstance(r),t.raw?e.data=r:e=r}return t.notify&&setTimeout(function(){n.emit(t.op,e,t)}),e},createInstance:function(e,t){var n=this;return e instanceof n?e:new n(e,t)},is:function(e,t){var n=this;return n.instanceClass&&!t?e instanceof n.instanceClass:e instanceof n},toJSON:function(e,t){var n=this;t||(t={});var r=e;if(n.is(e)){r={};for(var i in e)r[i]=e[i];n&&n.relationList&&t.with&&(o(t.with)&&(t.with=[t.with]),n.relationList.forEach(function(n){var i=void 0;-1!==t.with.indexOf(n.relation)?i=n.relation:-1!==t.with.indexOf(n.localField)&&(i=n.localField),i&&!function(){var o={with:t.with.slice()};o.with.splice(o.with.indexOf(i),1),o.with.forEach(function(e,t){e&&0===e.indexOf(i)&&e.length>=i.length&&"."===e[i.length]?o.with[t]=e.substr(i.length+1):o.with[t]=""});var a=c(e,n.localField);a&&(ae(a)?p(r,n.localField,a.map(function(e){return n.Relation.toJSON(e,o)})):p(r,n.localField,n.Relation.toJSON(a,o)))}()}))}return r},getAdapter:function(e){this.dbg("getAdapter","name:",e);var t=this.getAdapterName(e);if(!t)throw new ReferenceError(t+" not found!");return this.getAdapters()[t]},getAdapterName:function(e){return e||(e={}),o(e)&&(e={adapter:e}),e.adapter||e.defaultAdapter},getAdapters:function(){if(this._adaptersOwner!==this){var e=this._adapters;this._adapters={},e&&x(this._adapters,e),this._adaptersOwner=this}return this._adapters},beforeCreate:Ce,checkUpsertCreate:function(e,t){var n=this;return(t.upsert||void 0===t.upsert&&n.upsert)&&c(e,n.idAttribute)},create:function(e,t){var n=void 0,r=void 0,i=this;return e||(e={}),t||(t={}),i.checkUpsertCreate(e,t)?i.update(c(e,i.idAttribute),e,t):(b(i,t),r=t.adapter=i.getAdapterName(t),n=t.op="beforeCreate",ke(i[n](e,t)).then(function(o){e=o||e,n=t.op="create";var a=i.toJSON(e,t);return i.dbg(n,a,t),i.getAdapter(r)[n](i,a,t)}).then(function(e){return n=t.op="afterCreate",ke(i[n](e,t)).then(function(n){return e=n||e,i.end(e,t)})}))},afterCreate:Ce,beforeCreateMany:Ce,checkUpsertCreateMany:function(e,t){var n=this;return t.upsert||void 0===t.upsert&&n.upsert?e.reduce(function(e,t){return e&&c(t,n.idAttribute)},!0):void 0},createMany:function(e,t){var n=void 0,r=void 0,i=this;return e||(e=[]),t||(t={}),i.checkUpsertCreateMany(e,t)?i.updateMany(e,t):(b(i,t),r=t.adapter=i.getAdapterName(t),n=t.op="beforeCreateMany",ke(i[n](e,t)).then(function(o){e=o||e,n=t.op="createMany";var a=e.map(function(e){return i.toJSON(e,t)});return i.dbg(n,a,t),i.getAdapter(r)[n](i,a,t)}).then(function(e){return n=t.op="afterCreateMany",ke(i[n](e,t)).then(function(n){return e=n||e,i.end(e,t)})}))},afterCreateMany:Ce,beforeFind:Ce,find:function(e,t){var n=void 0,r=void 0,i=this;return t||(t={}),b(i,t),r=t.adapter=i.getAdapterName(t),n=t.op="beforeFind",ke(i[n](e,t)).then(function(o){return e=void 0===o?e:o,n=t.op="find",i.dbg(n,e,t),i.getAdapter(r)[n](i,e,t)}).then(function(e){return n=t.op="afterFind",ke(i[n](e,t)).then(function(n){return e=n||e,i.end(e,t)})})},afterFind:Ce,beforeFindAll:Ce,findAll:function(e,t){var n=void 0,r=void 0,i=this;return e||(e={}),t||(t={}),b(i,t),r=t.adapter=i.getAdapterName(t),n=t.op="beforeFindAll",ke(i[n](e,t)).then(function(o){ | ||
return e=o||e,n=t.op="findAll",i.dbg(n,e,t),i.getAdapter(r)[n](i,e,t)}).then(function(r){return n=t.op="afterFindAll",ke(i[n](r,e,t)).then(function(e){return r=e||r,i.end(r,t)})})},afterFindAll:Ce,beforeUpdate:Ce,update:function(e,t,n){var r=void 0,i=void 0,o=this;return t||(t={}),n||(n={}),b(o,n),i=n.adapter=o.getAdapterName(n),r=n.op="beforeUpdate",ke(o[r](e,t,n)).then(function(a){t=a||t,r=n.op="update";var u=o.toJSON(t,n);return o.dbg(r,e,u,n),o.getAdapter(i)[r](o,e,u,n)}).then(function(t){return r=n.op="afterUpdate",ke(o[r](e,t,n)).then(function(e){return t=e||t,o.end(t,n)})})},afterUpdate:Ce,beforeUpdateMany:Ce,updateMany:function(e,t){var n=void 0,r=void 0,i=this;return e||(e=[]),t||(t={}),b(i,t),r=t.adapter=i.getAdapterName(t),n=t.op="beforeUpdateMany",ke(i[n](e,t)).then(function(o){e=o||e,n=t.op="updateMany";var a=e.map(function(e){return i.toJSON(e,t)});return i.dbg(n,a,t),i.getAdapter(r)[n](i,a,t)}).then(function(e){return n=t.op="afterUpdateMany",ke(i[n](e,t)).then(function(n){return e=n||e,i.end(e,t)})})},afterUpdateMany:Ce,beforeUpdateAll:Ce,updateAll:function(e,t,n){var r=void 0,i=void 0,o=this;return e||(e={}),t||(t={}),n||(n={}),b(o,n),i=n.adapter=o.getAdapterName(n),r=n.op="beforeUpdateAll",ke(o[r](e,t,n)).then(function(a){t=a||t,r=n.op="updateAll";var u=o.toJSON(t,n);return o.dbg(r,e,u,n),o.getAdapter(i)[r](o,e,u,n)}).then(function(t){return r=n.op="afterUpdateAll",ke(o[r](e,t,n)).then(function(e){return t=e||t,o.end(t,n)})})},afterUpdateAll:Ce,beforeDestroy:Ce,destroy:function(e,t){var n=void 0,r=void 0,i=this;return t||(t={}),b(i,t),r=t.adapter=i.getAdapterName(t),n=t.op="beforeDestroy",ke(i[n](e,t)).then(function(o){return e=void 0===o?e:o,n=t.op="destroy",i.dbg(n,e,t),i.getAdapter(r)[n](i,e,t)}).then(function(e){return n=t.op="afterDestroy",ke(i[n](e,t)).then(function(n){return e=n||e,t.raw?(b(t,e),e):e})})},afterDestroy:Ce,beforeDestroyAll:Ce,destroyAll:function(e,t){var n=void 0,r=void 0,i=this;return e||(e={}),t||(t={}),b(i,t),r=t.adapter=i.getAdapterName(t),n=t.op="beforeDestroyAll",ke(i[n](e,t)).then(function(o){return e=o||e,n=t.op="destroyAll",i.dbg(n,e,t),i.getAdapter(r)[n](i,e,t)}).then(function(r){return n=t.op="afterDestroyAll",ke(i[n](r,e,t)).then(function(e){return r=e||r,t.raw?(b(t,r),r):r})})},afterDestroyAll:Ce,log:function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;t>r;r++)n[r-1]=arguments[r];if(e&&!n.length&&(n.push(e),e="debug"),"debug"!==e||this.debug){var i=e.toUpperCase()+": ("+this.name+")";if(console[e]){var o;(o=console)[e].apply(o,[i].concat(n))}else{var a;(a=console).log.apply(a,[i].concat(n))}}},dbg:function(){for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];this.log.apply(this,["debug"].concat(t))},belongsTo:function(e,t){return G(e,t)(this)},hasMany:function(e,t){return Z(e,t)(this)},hasOne:function(e,t){return X(e,t)(this)},setSchema:function(e){return te(e)(this)},configure:function(e){return H(e)(this)},registerAdapter:function(e,t,n){return ne(e,t,n)(this)},extend:function(e,t){var n=this,r=void 0;n.dbg("extend","props:",e,"classProps:",t),e||(e={}),t||(t={});var i=e.initialize;if(delete e.initialize,e.hasOwnProperty("constructor"))r=e.constructor,delete e.constructor;else{if(!t.name)throw new TypeError("name: Expected string, found "+oe.typeof(t.name)+"!");if(t.csp)r=function(){P(this,r);for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];var o=M(this,(r.__super__||Object.getPrototypeOf(r)).apply(this,t));return i&&i.apply(o,t),o};else{var o=E(t.name),a="return function "+o+"() {\n classCallCheck(this, "+o+")\n for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n var _this = possibleConstructorReturn(this, ("+o+".__super__ || Object.getPrototypeOf("+o+")).apply(this, args));\n if (initialize) {\n initialize.apply(_this, arguments)\n }\n return _this\n }";r=new Function("classCallCheck","possibleConstructorReturn","Parent","initialize",a)(P,M,n,i)}}t.shortname=t.shortname||R(r.name||t.name),delete t.name;var u=t.schema;return delete t.schema,r.prototype=Object.create(n&&n.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(r,n):t.strictEs6Class?r.__proto__=n:v(n,function(e,t){r[t]=e}),Object.defineProperty(r,"__super__",{configurable:!0,value:n}),H(e)(r.prototype),H(t)(r),u&&te(u)(r),r}}),I(re,function(){return this._events()},function(e){this._events(e)},!0),I(re.prototype,function(){return this._get("events")},function(e){this._set("events",e)}),F(ie.prototype,{defineModel:function(e,t){var r=this;n(e)&&(t=e,e=t.name),t||(t={}),x(t,r.defaults);var i=t.methods||{};delete t.methods;var o=r.models[t.extends],a=(o||re).extend(i,t);return r.models[e]=a,a.getModel=function(e){return r.models[e]},a},defineCollection:function(e,t,n){var r=this;t||(t={}),o(t.model)&&(t.model=r.models[e]);var i=new(n||B)([],t);return r.collection[e]=i,i},model:function(e){return this.models[e]},collection:function(e){return this.collections[e]},registerAdapter:function(){for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];v(this.models,function(e){e.registerAdapter.apply(e,t)})}}),ie.prototype.defineResource=ie.prototype.defineModel,Promise.prototype.spread||(Promise.prototype.spread=function(e){return this.then(function(t){return e.apply(this,t)})});var Ee=de,Re={full:"<%= pkg.version %>",major:parseInt("<%= major %>",10),minor:parseInt("<%= minor %>",10),patch:parseInt("<%= patch %>",10),alpha:"<%= alpha %>",beta:"<%= beta %>"};e.utils=Ee,e.version=Re,e.Collection=B,e.Query=N,e.DS=ie,e.belongsTo=G,e.configure=H,e.hasMany=Z,e.hasOne=X,e.setSchema=te,e.registerAdapter=ne,e.Model=re,e.rules=_e,e.validate=Y}); | ||
//# sourceMappingURL=dist/js-data.min.map |
{ | ||
"name": "js-data", | ||
"description": "Robust, framework-agnostic in-memory data store.", | ||
"version": "3.0.0-alpha.8", | ||
"version": "3.0.0-alpha.9", | ||
"homepage": "http://www.js-data.io", | ||
@@ -12,3 +12,3 @@ "repository": { | ||
"license": "MIT", | ||
"main": "./dist/js-data-debug.js", | ||
"main": "./dist/js-data.js", | ||
"keywords": [ | ||
@@ -51,7 +51,6 @@ "orm", | ||
"min": "uglifyjs dist/js-data.js -o dist/js-data.min.js --source-map dist/js-data.min.map -v -m -c --screw-ie8", | ||
"debug": "node scripts/debug.js", | ||
"version": "node scripts/version.js", | ||
"banner": "node scripts/banner.js", | ||
"gzip": "echo gzipped size: $(cat dist/js-data.min.js | gzip -f9 | wc -c)kb", | ||
"build": "npm run lint && npm run rollup && npm run debug && npm run min && npm run version && npm run banner", | ||
"build": "npm run lint && npm run rollup && npm run min && npm run version && npm run banner", | ||
"karma": "karma start", | ||
@@ -58,0 +57,0 @@ "mocha": "mocha -t 20000 -R spec -r source-map-support/register mocha.start.js", |
@@ -5,4 +5,4 @@ import babel from 'rollup-plugin-babel' | ||
entry: 'src/index.js', | ||
dest: 'dist/js-data-debug.js', | ||
sourceMap: 'dist/js-data-debug.js.map', | ||
dest: 'dist/js-data.js', | ||
sourceMap: 'dist/js-data.js.map', | ||
format: 'umd', | ||
@@ -9,0 +9,0 @@ moduleName: 'JSData', |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
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
539251
15
5351