Comparing version 3.0.0-alpha.9 to 3.0.0-alpha.10
@@ -0,1 +1,7 @@ | ||
##### 3.0.0-alpha.10 - 09 January 2016 | ||
- (temporarily?) removed relation links | ||
- Added `Collection#modelOpts` option | ||
- Relations can be defined via `DS#defineModel` | ||
##### 3.0.0-alpha.9 - 09 January 2016 | ||
@@ -2,0 +8,0 @@ |
/*! | ||
* js-data | ||
* @version 3.0.0-alpha.9 - Homepage <http://www.js-data.io/> | ||
* @version 3.0.0-alpha.10 - 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.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}); | ||
!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":ne.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":ne.typeof(e))&&"[object String]"===t(e)||!1}function a(e){return e&&"object"===("undefined"==typeof e?"undefined":ne.typeof(e))&&"[object Date]"===t(e)||!1}function u(e){var n="undefined"==typeof e?"undefined":ne.typeof(e);return"number"===n||e&&"object"===n&&"[object Number]"===t(e)||!1}function s(e){return"[object Boolean]"===t(e)}function f(e){return"function"==typeof e||e&&"[object Function]"===t(e)||!1}function l(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=ie.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]&&!f(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 f=void 0;if(re(e)){var l=void 0;for(t.length=0,l=0;l<e.length;l++)f=O(e[l],null,r,o,u),n(e[l])&&(r.push(e[l]),o.push(f)),t.push(f)}else{re(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;f=O(e[c],null,r,o,u),n(e[c])&&(r.push(e[c]),o.push(f)),t[c]=f}}}else t=e,e&&(re(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(ue,"").replace(se,k)}function E(e){return e.split(ae).map(C).join("")}function I(e){return e=E(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 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":ne.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 L(e){return e.replace(ce,"\\$1")}function D(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 K(e,t,n){return e.splice(t,0,n),e}function U(e,t){return e.splice(t,1),e}function T(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=D(t,e[a],n),0===o)return{found:!0,index:a};0>o?i=a:r=a+1}return{found:!1,index:i}}function J(e,t){if(P(this,J),e||(e=[]),!re(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 q(e,t){var r=this;P(r,q),n(e)&&!re(e)&&(t=e,e=[]),e||(e=[]),t||(t={}),r.model=t.model,r.idAttribute=t.idAttribute,r.modelOpts=t.modelOpts||{},r._listeners={},this.onConflict=t.onConflict||"merge";var i=r.modelId();r.index=new J([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&&f(e.on)&&e.on("all",r._onModelEvent,r)})}function z(e,t,n){function r(){var n={name:t};return o(t)?f(e.getModel)?e.getModel(t)||n:n:t}function i(){return n.localField||I(r().name)}function a(){return n.foreignKey||n.localKey||I(r().name)+"Id"}n||(n={});var u={enumerable:void 0!==n.enumerable?!!n.enumerable:!1,get:function(){return this._get("links."+i())},set:function(e){return e?(this._set("links."+i(),e),p(this,a(),e[r().idAttribute]),c(this,i())):void 0}},s=u.get,l=u.set;return n.get&&(u.get=function(){var t=this;return n.get(e,r(),this,function(){return s.call(t)})},delete u.writable),n.set&&(u.set=function(t){var i=this;return n.set(e,r(),this,t,function(e){return l.call(i,void 0===e?t:e)})},delete u.writable),u.get&&(u.set||(u.set=function(){})),Object.defineProperty(e.prototype,i(),u),e.relationList||(e.relationList=[]),e.relationFields||(e.relationFields=[]),n.type="belongsTo",n.name=e.name,n.relation=t.name,n.Relation=t,n.getRelation=r,n.getLocalField=i,n.getForeignKey=a,e.relationList.push(n),e.relationFields.push(i()),e}function $(e,t){return function(n){return n.dbg(ve,e,t),z(n,e,t)}}function B(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 V(e,t,n){function r(){var n={name:t};return o(t)?f(e.getModel)?e.getModel(t)||n:n:t}function i(){return n.localField||I(r().name)+"Collection"}n||(n={});var a=n.foreignKey,u=n.localKeys,s=n.foreignKeys;a||u||s||(a=n.foreignKey=I(e.name)+"Id");var l={enumerable:void 0!==n.enumerable?!!n.enumerable:!1,get:function(){return this._get("links."+i())},set:function(t){var n=this;if(t)return this._set("links."+i(),t),t&&t.length&&!function(){var i=c(n,e.idAttribute);a?t.forEach(function(e){p(e,a,i)}):u?!function(){var e=[];t.forEach(function(t){e.push(c(t,r().idAttribute))}),p(n,u,e)}():s&&t.forEach(function(e){var t=c(e,s);t?-1===t.indexOf(i)&&t.push(i):p(e,s,[i])})}(),c(this,i())}},d=l.get,h=l.set;return n.get&&(l.get=function(){var t=this;return n.get(e,r(),this,function(){return d.call(t)})}),n.set&&(l.set=function(t){var i=this;return n.set(e,r(),this,t,function(e){return h.call(i,void 0===e?t:e)})}),Object.defineProperty(e.prototype,i(),l),e.relationList||(e.relationList=[]),e.relationFields||(e.relationFields=[]),n.type="hasMany",n.name=e.name,n.relation=r().name,n.Relation=r(),n.getRelation=r,n.getLocalField=i,e.relationList.push(n),e.relationFields.push(i()),e}function G(e,t){return function(n){return n.dbg(ge,e,t),V(n,e,t)}}function H(e,t,n){function r(){var n={name:t};return o(t)?f(e.getModel)?e.getModel(t)||n:n:t}function i(){return n.localField||I(r().name)}function a(){return n.foreignKey||n.localKey||I(e.name)+"Id"}n||(n={});var u={enumerable:void 0!==n.enumerable?!!n.enumerable:!1,get:function(){return this._get("links."+i())},set:function(t){return t?(this._set("links."+i(),t),p(t,a(),c(this,e.idAttribute)),c(this,i())):void 0}};return n.get&&!function(){var r=u.get;u.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=u.set;u.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,i(),u),e.relationList||(e.relationList=[]),e.relationFields||(e.relationFields=[]),n.type="hasOne",n.name=e.name,n.relation=t.name,n.Relation=t,n.getRelation=r,n.getLocalField=i,n.getForeignKey=a,e.relationList.push(n),e.relationFields.push(i()),e}function Q(e,t){return function(n){return n.dbg(me,"Model:",e,"opts:",t),H(n,e,t)}}function Z(e,t){var n=[];return v(e,function(e,r){var i=be[r];if(i){var o=i(e,t);o&&n.push(o)}}),n.length?n:void 0}function W(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=Z(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),f=i("changed");n||(f=[]);var l=f.indexOf(t);s!==e&&-1===l&&f.push(t),u!==e?o("changes."+t,e):(a("changes."+t),l>=0&&f.splice(l,1)),f.length||(n=!1,a("changing"),a("changed"),i("eventId")&&(clearTimeout(i("eventId")),a("eventId"))),!n&&f.length&&(o("changed",f),o("changing",!0),o("eventId",setTimeout(function(){if(a("changed"),a("eventId"),a("changing"),!i("silent")){var e=void 0;for(e=0;e<f.length;e++)r.emit("change:"+f[e],r,c(r,f[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 X(e){return e||(e={}),function(t){return t.dbg(Ae,"opts:",e),t.schema||(t.schema={}),B(t.schema,e),v(e,function(e,n){var r=W(t,n,e);r.writable||Object.defineProperty(t.prototype,n,r)}),t}}function Y(e,t,n){return n||(n={}),n.op=xe,function(r){r.dbg(xe,"name:",e,"adapter:",t,"opts:",n),r.getAdapters()[e]=t,(n===!0||n.default)&&(r.defaultAdapter=e)}}function ee(e,t){var n=this;P(n,ee),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 te(e){var t=this;P(t,te),e||(e={}),t.defaults={};for(var n in e)t.defaults[n]=e[n];t.models={},t.collections={}}var ne={};ne.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},ne.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 re=Array.isArray,ie=/^(.+)\.(.+)$/,oe=JSON.stringify,ae=/\s+/,ue=/[^A-Za-z]/g,se=/(\w)(\w*)/g,fe=Object.freeze({isArray:re,isObject:n,isRegExp:i,isString:o,isDate:a,isNumber:u,isBoolean:s,isFunction:f,isSorN:l,get:c,unset:d,set:p,forOwn:v,deepMixIn:g,resolve:m,reject:y,_:b,intersection:A,fillIn:x,isBlacklisted:_,fromJson:w,toJson:oe,copy:O,pascalCase:E,camelCase:I,eventify:R,uuid:j,classCallCheck:P,possibleConstructorReturn:M,addHiddenPropsToTarget:F,extend:S}),le={skip:"",offset:"",where:"",limit:"",orderBy:"",sort:""},ce=/([.*+?^=!:${}()|[\]\/\\])/g,de=/%/g,he=/_/g;N.ops={"==":function(e,t){return e==t},"===":function(e,t){return e===t},"!=":function(e,t){return e!=t},"!==":function(e,t){return e!==t},">":function(e,t){return e>t},">=":function(e,t){return e>=t},"<":function(e,t){return t>e},"<=":function(e,t){return t>=e},isectEmpty:function(e,t){return!A(e||[],t||[]).length},isectNotEmpty:function(e,t){return A(e||[],t||[]).length},in:function(e,t){return-1!==t.indexOf(e)},notIn:function(e,t){return-1===t.indexOf(e)},contains:function(e,t){return-1!==(e||[]).indexOf(t)},notContains:function(e,t){return-1===(e||[]).indexOf(t)}},F(N.prototype,{compare:function(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?this.compare(e,t+1,n,r):0:u>a?-1:a>u?1:t<e.length-1?this.compare(e,t+1,n,r):0},evaluate:function(e,t,n){return N.ops[t]?N.ops[t](e,n):0===t.indexOf("like")?null!==this.like(n,t.substr(4)).exec(e):0===t.indexOf("notLike")?null===this.like(n,t.substr(7)).exec(e):void 0},like:function(e,t){return new RegExp("^"+L(e).replace(de,".*").replace(he,".")+"$",t)},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&&!re(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={}),r.getData(),n(e)?!function(){var t={};n(e.where)&&(t=e.where),v(e,function(e,n){n in le||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 o=!0,u=!0;for(e=0;t>e;e++){var f=a[e],l="|"===f.charAt(0);f=l?f.substr(1):f;var d=r.evaluate(c(n,i[e]),f,s[e]);void 0!==d&&(u=o?d:l?u||d:u&&d),o=!1}return u})}();var f=e.orderBy||e.sort;o(f)&&(f=[[f,"ASC"]]),re(f)||(f=null),f&&!function(){var e=0;f.forEach(function(e,t){o(e)&&(f[t]=[e,"ASC"])}),r.data.sort(function(t,n){return r.compare(f,e,t,n)})}(),u(e.skip)?r.skip(e.skip):u(e.offset)&&r.skip(e.offset),u(e.limit)&&r.limit(e.limit)}():f(e)&&(r.data=r.data.filter(e,t)),r},skip:function(e){if(!u(e))throw new TypeError("skip: Expected number but found "+("undefined"==typeof e?"undefined":ne.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":ne.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 pe={">":1,">=":1,"<":1,"<=":1};F(J.prototype,{set:function(e,t){re(e)||(e=[e]);var n=e.shift()||null,r=T(this.keys,n);if(0===e.length)if(r.found){var i=T(this.values[r.index],t,this.hashCode);i.found||K(this.values[r.index],i.index,t)}else K(this.keys,r.index,n),K(this.values,r.index,[t]);else if(r.found)this.values[r.index].set(e,t);else{K(this.keys,r.index,n);var o=new J([],{hashCode:this.hashCode});o.set(e,t),K(this.values,r.index,o)}},get:function(e){re(e)||(e=[e]);var t=e.shift()||null,n=T(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){pe[t]||(r[t]=e)}),this.between(t,n,r)},between:function(e,t){var n=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];re(e)||(e=[e]),re(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?T(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){re(e)||(e=[e]);var n=e.shift(),r=T(this.keys,n);if(0===e.length){if(r.found){var i=T(this.values[r.index],t,this.hashCode);i.found&&(U(this.values[r.index],i.index),0===this.values[r.index].length&&(U(this.keys,r.index),U(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 f(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&&(U(t.keys,i),U(t.values,i)),n=!0,!1}else{var o=T(r,e,t.hashCode);if(o.found)return U(r,o.index),0===r.length&&(U(t.keys,i),U(t.values,i)),n=!0,!1}}),n?e:void 0},updateRecord:function(e){this.removeRecord(e),this.insertRecord(e)}}),F(q.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 J(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=n.model?n.model.relationList||[]:[],a=(new Date).getTime();re(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":ne.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.getRelation();if(i.idAttribute){var o=i.idAttribute,a=t.foreignKey,u=c(e,t.getLocalField());if(f(t.add))t.add(n,t,e);else if(u&&t.add!==!1)if(re(u))u=u.map(function(e){if(!i.is(e))try{a&&p(e,a,r),e=i.createInstance(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(!i.is(u))try{a&&p(u,t.foreignKey,r),u=i.createInstance(u)}catch(e){throw new Error("Failed to insert "+t.type+' relation: "'+t.relation+'"!')}p(e,t.localField,u)}}),s){var d=t.onConflict||n.onConflict;"merge"===d?g(s,e):"replace"===d&&(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&&f(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&&f(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 t||(t={}),x(t,n.modelOpts),n.model.create(e,t).then(function(e){return n.autoPks[r]&&n.remove(r),n.end(e,t)})},createMany:function(e,t){var n=this;return t||(t={}),x(t,n.modelOpts),n.model.createMany(e,t).then(function(r){return e.forEach(function(e){var t=n.modelId(e);n.autoPks[t]&&n.remove(t)}),n.end(r,t)})},find:function(e,t){var n=this;return t||(t={}),x(t,n.modelOpts),n.model.find(e,t).then(function(e){return n.end(e,t)})},findAll:function(e,t){var n=this;return t||(t={}),x(t,n.modelOpts),n.model.findAll(e,t).then(function(e){return n.end(e,t)})},update:function(e,t,n){var r=this;return n||(n={}),x(n,r.modelOpts),r.model.update(e,t,n).then(function(e){return r.end(e,n)})},updateMany:function(e,t){var n=this;return t||(t={}),x(t,n.modelOpts),n.model.updateMany(e,t).then(function(e){return n.end(e,t)})},updateAll:function(e,t,n){var r=this;return n||(n={}),x(n,r.modelOpts),r.model.updateAll(e,t,n).then(function(e){return r.end(e,n)})},destroy:function(e,t){var n=this;return t||(t={}),x(t,n.modelOpts),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 t||(t={}),x(t,n.modelOpts),n.model.destroyAll(e,t).then(function(r){return t.raw?r.data=n.removeAll(e,t):r=n.removeAll(e,t),r})}}),R(q.prototype,function(){return this._listeners},function(e){this._listeners=e});var ve="belongsTo",ge="hasMany",me="hasOne",ye={array:re,boolean:s,integer:u,number:u,null:function(e){return null===e},object:n,string:o},be={type:function(e,t){if(void 0!==t){o(e)&&(e=[e]);var n=e.map(function(n){var r=ye[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":ne.typeof(t))}},anyOf:function(e,t){var n=!1,r=[];return e.forEach(function(e){var i=Z(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(Z(e,t)||[])}),n.length?void 0:n},oneOf:function(e,t){var n=!1,r=[];return e.forEach(function(e){var i=Z(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}},Ae="setSchema",xe="registerAdapter",_e=m,we=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(ee.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=Z(i,t)||[])}else v(r,function(t,r){n=n.concat(Z(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",_e(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",_e(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",_e(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(f(e.load))return e.load(i,e,r,t);var n=void 0;if("hasMany"===e.type&&e.foreignKey)n=e.Relation.findAll(ne.defineProperty({},e.foreignKey,c(r,i.idAttribute)),t);else if(e.foreignKey){var o=c(r,e.foreignKey);l(o)&&(n=e.Relation.find(o,t))}else e.localKeys?n=e.Relation.findAll(ne.defineProperty({},e.Relation.idAttribute,{in:c(r,e.localKeys)}),t):e.foreignKeys&&(n=e.Relation.findAll(ne.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",_e(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(ee,{_adapters:null,_adaptersOwner:null,_listeners:null,_listenersOwner:null,csp:!1,defaultAdapter:"http",debug:!1,idAttribute:"id",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=re(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&&(re(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:we,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",_e(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",_e(i[n](e,t)).then(function(n){return e=n||e,i.end(e,t)})}))},afterCreate:we,beforeCreateMany:we,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",_e(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",_e(i[n](e,t)).then(function(n){ | ||
return e=n||e,i.end(e,t)})}))},afterCreateMany:we,beforeFind:we,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",_e(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",_e(i[n](e,t)).then(function(n){return e=n||e,i.end(e,t)})})},afterFind:we,beforeFindAll:we,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",_e(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",_e(i[n](r,e,t)).then(function(e){return r=e||r,i.end(r,t)})})},afterFindAll:we,beforeUpdate:we,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",_e(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",_e(o[r](e,t,n)).then(function(e){return t=e||t,o.end(t,n)})})},afterUpdate:we,beforeUpdateMany:we,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",_e(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",_e(i[n](e,t)).then(function(n){return e=n||e,i.end(e,t)})})},afterUpdateMany:we,beforeUpdateAll:we,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",_e(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",_e(o[r](e,t,n)).then(function(e){return t=e||t,o.end(t,n)})})},afterUpdateAll:we,beforeDestroy:we,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",_e(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",_e(i[n](e,t)).then(function(n){return e=n||e,t.raw?(b(t,e),e):e})})},afterDestroy:we,beforeDestroyAll:we,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",_e(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",_e(i[n](r,e,t)).then(function(e){return r=e||r,t.raw?(b(t,r),r):r})})},afterDestroyAll:we,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 $(e,t)(this)},hasMany:function(e,t){return G(e,t)(this)},hasOne:function(e,t){return Q(e,t)(this)},setSchema:function(e){return X(e)(this)},configure:function(e){return B(e)(this)},registerAdapter:function(e,t,n){return Y(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 "+ne.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||I(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}),B(e)(r.prototype),B(t)(r),u&&X(u)(r),r}}),R(ee,function(){return this._events()},function(e){this._events(e)},!0),R(ee.prototype,function(){return this._get("events")},function(e){this._set("events",e)}),F(te.prototype,{defineModel:function(e,t){var r=this;n(e)&&(t=e,e=t.name),t||(t={}),t.relations||(t.relations={}),x(t,r.defaults);var i=t.methods||{};delete t.methods;var o=r.models[t.extends],a=(o||ee).extend(i,t);return r.models[e]=a,a.getModel=function(e){return r.models[e]},v(t.relations,function(e,t){v(e,function(e,i){n(e)&&(e=[e]),e.forEach(function(e){var n=r.models[i]||i;return"belongsTo"===t?a.belongsTo(n,e):"hasOne"===t?a.hasOne(n,e):a.hasMany(n,e)})})}),a},defineCollection:function(e,t,n){var r=this;t||(t={}),o(t.model)&&(t.model=r.models[e]);var i=new(n||q)([],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)})}}),te.prototype.defineResource=te.prototype.defineModel,Promise.prototype.spread||(Promise.prototype.spread=function(e){return this.then(function(t){return e.apply(this,t)})});var Oe=fe,ke={full:"<%= pkg.version %>",major:parseInt("<%= major %>",10),minor:parseInt("<%= minor %>",10),patch:parseInt("<%= patch %>",10),alpha:"<%= alpha %>",beta:"<%= beta %>"};e.utils=Oe,e.version=ke,e.Collection=q,e.Query=N,e.DS=te,e.belongsTo=$,e.configure=B,e.hasMany=G,e.hasOne=Q,e.setSchema=X,e.registerAdapter=Y,e.Model=ee,e.rules=be,e.validate=Z}); | ||
//# sourceMappingURL=dist/js-data.min.map |
{ | ||
"name": "js-data", | ||
"description": "Robust, framework-agnostic in-memory data store.", | ||
"version": "3.0.0-alpha.9", | ||
"version": "3.0.0-alpha.10", | ||
"homepage": "http://www.js-data.io", | ||
@@ -6,0 +6,0 @@ "repository": { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
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
542816
5389