Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

js-data

Package Overview
Dependencies
Maintainers
1
Versions
144
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

js-data - npm Package Compare versions

Comparing version 3.0.0-alpha.15 to 3.0.0-alpha.16

CONTRIBUTORS

10

CHANGELOG.md

@@ -1,3 +0,11 @@

##### 3.0.0-alpha.14 -13 February 2016
##### 3.0.0-alpha.16 - 21 February 2016
- Added "omit" utility method
##### 3.0.0-alpha.15 - 21 February 2016
- Couple of fixes
##### 3.0.0-alpha.14 - 13 February 2016
- Added utility for recursively visiting relations based on `opts.with`

@@ -4,0 +12,0 @@

8

conf.json

@@ -17,8 +17,12 @@ {

"systemName": "js-data",
"copyright": "js-data Copyright © 2014-2016 Jason Dobry",
"copyright": "js-data Copyright © 2014-2016 js-data project authors",
"outputSourceFiles": true,
"syntaxTheme": "dark",
"linenums": true,
"footer": "<div style=\"text-align:center\">Back to <a href=\"http://js-data.io\">js-data.io</a></div>"
"footer": "<div style=\"text-align:center\">Back to <a href=\"http://js-data.io\">js-data.io</a></div>",
"analytics": {
"ua": "UA-55528236-2",
"domain": "api.js-data.io"
}
}
}
/*!
* js-data
* @version 3.0.0-alpha.15 - Homepage <http://www.js-data.io/>
* @author js-data Project Authors
* @copyright (c) 2014-2016 js-data Project Authors
* @version 3.0.0-alpha.16 - Homepage <http://www.js-data.io/>
* @author js-data project authors
* @copyright (c) 2014-2016 js-data project authors
* @license MIT <https://github.com/js-data/js-data/blob/master/LICENSE>

@@ -10,4 +10,4 @@ *

*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.JSData=e.JSData||{})}(this,function(e){"use strict";function t(e,t,n,r){var i=t.relation,o=null;if(e||(e={}),e.with||(e.with=[]),e.withAll)return void n.call(r,t,{});if(-1!==e.with.indexOf(i)?o=i:-1!==e.with.indexOf(t.localField)&&(o=t.localField),o){var a=re(e);a.with=e.with.slice(),Z(a,t.getRelation());var u=a.with.indexOf(o);u>=0&&a.with.splice(u,1),a.with.forEach(function(e,t){e&&0===e.indexOf(o)&&e.length>=o.length&&"."===e[o.length]?a.with[t]=e.substr(o.length+1):a.with[t]=""}),n.call(r,t,a)}}function n(e){ae(this,n),this.collection=e,this.data=null}function r(e){return e.replace(he,"\\$1")}function i(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 o(e,t,n){return e.splice(t,0,n),e}function a(e,t){return e.splice(t,1),e}function u(e,t,n){for(var r=0,o=e.length,a=void 0,u=void 0;o>r;){if(u=(r+o)/2|0,a=i(t,e[u],n),0===a)return{found:!0,index:u};0>a?o=u:r=u+1}return{found:!1,index:o}}function c(e,t){if(ae(this,c),e||(e=[]),!M(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 s(e,t){var n=this;ae(n,s),P(e)&&!M(e)&&(t=e,e=[]),T(t)&&(t={idAttribute:t}),e||(e=[]),t||(t={}),t.recordOpts||(t.recordOpts={}),Z(n,t),Z(n,me),n._listeners={};var r=n.recordId();n.index=new c([r],{hashCode:function(e){return U(e,r)}}),n.indexes={},e.forEach(function(e){e=n.mapper?n.mapper.createRecord(e,n.recordOpts):e,n.index.insertRecord(e),e&&L(e.on)&&e.on("all",n._onRecordEvent,n)})}function f(e,t){var n=this;t||(t={});var r=t.localField;if(!r)throw new Error("localField is required");var i=t.foreignKey=t.foreignKey||t.localKey;if(!i&&(t.type===ye||t.type===xe))throw new Error("foreignKey is required");var o=t.localKeys,a=t.foreignKeys;if(!i&&!o&&!a&&t.type===be)throw new Error("one of (foreignKey, localKeys, foreignKeys) is required");if(T(e)){if(t.relation=e,!L(t.getRelation))throw new Error("you must provide a reference to the related mapper!")}else e&&(t.relation=e.name,Object.defineProperty(n,"relatedMapper",{value:e}));Z(n,t)}function l(e,t){var n=this;ae(n,l),e||(e={}),t||(t={});var r={};Object.defineProperties(n,{_get:{value:function(e){return U(r,e)}},_set:{value:function(e,t){return B(r,e,t)}},_unset:{value:function(e){return V(r,e)}}});var i=n._set;i("creating",!0),t.noValidate&&i("noValidate",!0),Z(n,e),i("creating"),i("changes",{}),i("noValidate"),i("previous",re(e))}function d(e){e||(e={}),Z(this,e),e.properties&&G(e.properties,function(t,n){t instanceof d||(e.properties[n]=new d(t))})}function p(e){var t=this;if(ae(t,p),e||(e={}),Z(t,e),Z(t,re(et)),!t.name)throw new Error("mapper cannot function without a name!");t._adapters||(t._adapters={}),t._listeners||(t._listeners={}),t.schema instanceof d||(t.schema=new d(t.schema||{})),Q(t.RecordClass)&&(t.RecordClass=l.extend()),t.RecordClass&&(t.RecordClass.Mapper=t,fe(t.RecordClass,!0)===l&&t.applySchema&&Xe(t.schema,t.RecordClass.prototype))}function h(e){var t=this;ae(t,h),e||(e={}),Z(t,e),t.mapperDefaults=t.mapperDefaults||{},t.MapperClass=t.MapperClass||p,t._adapters={},t._mappers={}}var v={};v.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},v.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 g=1/0,m=1.7976931348623157e308,y="[object Boolean]",b="[object Date]",x="[object Function]",A="[object Number]",_="[object Object]",w="[object RegExp]",O="[object String]",R=Object.prototype.toString,C=void 0;try{C=!!window}catch(e){C=!1}var E=function(e){return R.call(e)},F=function(e){if(!e)return 0===e?e:0;if(e=+e,e===g||e===-g){var t=0>e?-1:1;return t*m}var n=e%1;return e===e?n?e-n:e:0},I=function(e){return!!e&&"object"===("undefined"==typeof e?"undefined":v.typeof(e))&&e.constructor===Object},M=Array.isArray,k=function(e){return e&&"object"===("undefined"==typeof e?"undefined":v.typeof(e))&&E(e)===b},L=function(e){return"function"==typeof e||e&&E(e)===x},j=function(e){return E(e)===A&&e==F(e)},S=function(e){return null===e},K=function(e){var t="undefined"==typeof e?"undefined":v.typeof(e);return"number"===t||e&&"object"===t&&E(e)===A},P=function(e){return E(e)===_},N=function(e){return E(e)===w},D=function(e){return T(e)||K(e)},T=function(e){return"string"==typeof e||e&&"object"===("undefined"==typeof e?"undefined":v.typeof(e))&&E(e)===O},Q=function(e){return void 0===e},q=function(e){return E(e)===y},U=function(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]}},J=function(e,t){if(!t)return e;var n=t.split(".");return n.forEach(function(t){e[t]||(e[t]={}),e=e[t]}),e},$=/^(.+)\.(.+)$/,B=function e(t,n,r){if(P(n))G(n,function(n,r){e(t,r,n)});else{var i=$.exec(n);i?J(t,i[1])[i[2]]=r:t[n]=r}},V=function(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]},G=function(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)},z=function e(t,n){return n&&G(n,function(t,n){var r=this[n];I(t)&&I(r)?e(r,t):this[n]=t},t),t},H=function(e){return Promise.resolve(e)},W=function(e){return Promise.reject(e)},X=function(e,t){for(var n in e){var r=e[n];void 0===t[n]&&!L(r)&&n&&0!==n.indexOf("_")&&(t[n]=r)}},Y=function(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},Z=function(e,t){G(t,function(t,n){e.hasOwnProperty(n)&&void 0!==e[n]||(e[n]=t)})},ee=function(e,t){if(!t||!t.length)return!1;for(var n=void 0,r=0;r<t.length;r++)if("[object RegExp]"===E(t[r])&&t[r].test(e)||t[r]===e)return n=e;return!!n},te=function(e){return T(e)?JSON.parse(e):e},ne=JSON.stringify,re=function e(t,n,r,i,o,a){if(n){if(t===n)throw new Error("Cannot copy! Source and destination are identical.");if(r=r||[],i=i||[],P(t)){var u=r.indexOf(t);if(-1!==u)return i[u];r.push(t),i.push(n)}var c=void 0;if(M(t)){var s=void 0;for(n.length=0,s=0;s<t.length;s++)c=e(t[s],null,r,i,o,a),P(t[s])&&(r.push(t[s]),i.push(c)),n.push(c)}else{M(n)?n.length=0:G(n,function(e,t){delete n[t]});for(var f in t)if(t.hasOwnProperty(f)){if(ee(f,o))continue;c=e(t[f],null,r,i,o,a),P(t[f])&&(r.push(t[f]),i.push(c)),n[f]=c}}}else n=t,t&&(M(t)?n=e(t,[],r,i,o,a):k(t)?n=new Date(t.getTime()):N(t)?(n=new RegExp(t.source,t.toString().match(/[^\/]*$/)[0]),n.lastIndex=t.lastIndex):P(t)&&(n=a?e(t,{},r,i,o,a):e(t,Object.create(Object.getPrototypeOf(t)),r,i,o,a)));return n},ie=function(e){return re(e,void 0,void 0,void 0,void 0,!0)},oe=function(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)}}})},ae=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},ue=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==("undefined"==typeof t?"undefined":v.typeof(t))&&"function"!=typeof t?e:t},ce=function(e,t){G(t,function(e,n){t[n]={writable:!0,value:e}}),Object.defineProperties(e,t)},se=function(e,t){var n=this,r=void 0;return e||(e={}),t||(t={}),e.hasOwnProperty("constructor")?(r=e.constructor,delete e.constructor):r=function(){ae(this,r);for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];var i=ue(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:G(n,function(e,t){r[t]=e}),Object.defineProperty(r,"__super__",{configurable:!0,value:n}),ce(r.prototype,e),Z(r,t),r},fe=function(e,t){var n=t?e:e.constructor;return n.__super__||Object.getPrototypeOf(n)||n.__proto__},le=function(e,n,r,i){var o=e.relationList||[];o.length&&o.forEach(function(e){t(n,e,r,i)})},de=Object.freeze({get isBrowser(){return C},isArray:M,isDate:k,isFunction:L,isInteger:j,isNull:S,isNumber:K,isObject:P,isRegExp:N,isSorN:D,isString:T,isUndefined:Q,isBoolean:q,get:U,set:B,unset:V,forOwn:G,deepMixIn:z,resolve:H,reject:W,_:X,intersection:Y,fillIn:Z,isBlacklisted:ee,fromJson:te,toJson:ne,copy:re,plainCopy:ie,eventify:oe,classCallCheck:ae,possibleConstructorReturn:ue,addHiddenPropsToTarget:ce,extend:se,getSuper:fe,forEachRelation:le});n.extend=se;var pe={skip:"",offset:"",where:"",limit:"",orderBy:"",sort:""},he=/([.*+?^=!:${}()|[\]\/\\])/g,ve=/%/g,ge=/_/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!Y(e||[],t||[]).length},isectNotEmpty:function(e,t){return Y(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)}},ce(n.prototype,{compare:function(e,t,n,r){var i=e[t],o=U(n,i[0]),a=U(r,i[0]);return o&&T(o)&&(o=o.toUpperCase()),a&&T(a)&&(a=a.toUpperCase()),n||(n=null),r||(r=null),"DESC"===i[1]?o>a?-1:a>o?1:t<e.length-1?this.compare(e,t+1,n,r):0:a>o?-1:o>a?1:t<e.length-1?this.compare(e,t+1,n,r):0},evaluate:function(e,t,r){return n.ops[t]?n.ops[t](e,r):0===t.indexOf("like")?!S(this.like(r,t.substr(4)).exec(e)):0===t.indexOf("notLike")?S(this.like(r,t.substr(7)).exec(e)):void 0},like:function(e,t){return new RegExp("^"+r(e).replace(ve,".*").replace(ge,".")+"$",t)},getData:function(){var e=this;return e.data||(e.data=e.collection.index.getAll()),e.data},between:function(e,t,n){var r=this;if(n||(n={}),r.data)throw new Error("Cannot access index after first operation!");return r.data=r.collection.getIndex(n.index).between(e,t,n),r},get:function(){var e=arguments.length<=0||void 0===arguments[0]?[]:arguments[0],t=arguments[1],n=this;if(t||(t={}),n.data)throw new Error("Cannot access index after first operation!");return e&&!M(e)&&(e=[e]),e.length?(n.data=n.collection.getIndex(t.index).get(e),n):(n.getData(),n)},getAll:function(){var e=this,t={};if(e.data)throw new Error("Cannot access index after first operation!");for(var n=arguments.length,r=Array(n),i=0;n>i;i++)r[i]=arguments[i];if(!r.length||1===r.length&&P(r[0]))return e.getData(),e;r.length&&P(r[r.length-1])&&(t=r[r.length-1],r.pop());var o=e.collection,a=o.getIndex(t.index);return e.data=[],r.forEach(function(t){e.data=e.data.concat(a.get(t))}),e},filter:function(e,t){var n=this;return e||(e={}),n.getData(),P(e)?!function(){var t={};P(e.where)&&(t=e.where),G(e,function(e,n){n in pe||n in t||(t[n]={"==":e})});var r=[],i=[],o=[];G(t,function(e,t){P(e)||(e={"==":e}),G(e,function(e,n){r.push(t),i.push(n),o.push(e)})}),r.length&&!function(){var e=void 0,t=r.length;n.data=n.data.filter(function(a){var u=!0,c=!0;for(e=0;t>e;e++){var s=i[e],f="|"===s.charAt(0);s=f?s.substr(1):s;var l=n.evaluate(U(a,r[e]),s,o[e]);void 0!==l&&(c=u?l:f?c||l:c&&l),u=!1}return c})}();var a=e.orderBy||e.sort;T(a)&&(a=[[a,"ASC"]]),M(a)||(a=null),a&&!function(){var e=0;a.forEach(function(e,t){T(e)&&(a[t]=[e,"ASC"])}),n.data.sort(function(t,r){return n.compare(a,e,t,r)})}(),K(e.skip)?n.skip(e.skip):K(e.offset)&&n.skip(e.offset),K(e.limit)&&n.limit(e.limit)}():L(e)&&(n.data=n.data.filter(e,t)),n},skip:function(e){if(!K(e))throw new TypeError("skip: Expected number but found "+("undefined"==typeof e?"undefined":v.typeof(e))+"!");var t=this.getData();return e<t.length?this.data=t.slice(e):this.data=[],this},limit:function(e){if(!K(e))throw new TypeError("limit: Expected number but found "+("undefined"==typeof e?"undefined":v.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}}),ce(c.prototype,{set:function(e,t){M(e)||(e=[e]);var n=e.shift()||null,r=u(this.keys,n);if(0===e.length)if(r.found){var i=u(this.values[r.index],t,this.hashCode);i.found||o(this.values[r.index],i.index,t)}else o(this.keys,r.index,n),o(this.values,r.index,[t]);else if(r.found)this.values[r.index].set(e,t);else{o(this.keys,r.index,n);var a=new c([],{hashCode:this.hashCode});a.set(e,t),o(this.values,r.index,a)}},get:function(e){M(e)||(e=[e]);var t=e.shift()||null,n=u(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)})},between:function(e,t){var n=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];M(e)||(e=[e]),M(t)||(t=[t]),Z(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?u(this.keys,i):{found:!1,index:0},0===e.length){a.found&&n.leftInclusive===!1&&(a.index+=1);for(var c=a.index;c<this.keys.length;c+=1){if(void 0!==o)if(n.rightInclusive){if(this.keys[c]>o)break}else if(this.keys[c]>=o)break;if(r=this.values[c].isIndex?r.concat(this.values[c].getAll()):r.concat(this.values[c]),n.limit&&r.length>=n.limit+n.offset)break}}else for(var c=a.index;c<this.keys.length;c+=1){var s=this.keys[c];if(s>o)break;if(r=this.values[c].isIndex?s===i?r.concat(this.values[c]._between(re(e),t.map(function(){}),n)):s===o?r.concat(this.values[c]._between(e.map(function(){}),re(t),n)):r.concat(this.values[c].getAll()):r.concat(this.values[c]),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]:[]},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&&(a(t.keys,i),a(t.values,i)),n=!0,!1}else{var o=u(r,e,t.hashCode);if(o.found)return a(r,o.index),0===r.length&&(a(t.keys,i),a(t.values,i)),n=!0,!1}}),n?e:void 0},updateRecord:function(e){this.removeRecord(e),this.insertRecord(e)}});var me={idAttribute:"id",mapper:null,onConflict:"merge",recordOpts:null};s.extend=se,ce(s.prototype,{_onRecordEvent:function(){this.emit.apply(this,arguments)},add:function(e,t){var n=this;t||(t={}),X(n,t),e=n.beforeAdd(e,t)||e;var r=!1,i=n.recordId();P(e)&&!M(e)&&(e=[e],r=!0),e=e.map(function(e){var r=n.recordId(e);if(!D(r))throw new TypeError(i+": Expected string or number, found "+("undefined"==typeof r?"undefined":v.typeof(r))+"!");var o=n.get(r);if(e===o)return o;if(o){var a=t.onConflict||n.onConflict;"merge"===a?z(o,e):"replace"===a&&(G(o,function(t,n){n===i||e.hasOwnProperty(n)||delete o[n]}),o.set(e)),e=o,n.updateIndexes(e)}else e=n.mapper?n.mapper.createRecord(e,n.recordOpts):e,n.index.insertRecord(e),G(n.indexes,function(t,n){t.insertRecord(e)}),e&&L(e.on)&&e.on("all",n._onRecordEvent,n);return e});var o=r?e.length?e[0]:void 0:e;return n.emit("add",o),n.afterAdd(e,t,o)||o},afterAdd:function(){},afterRemove:function(){},afterRemoveAll:function(){},beforeAdd:function(){},beforeRemove:function(){},beforeRemoveAll:function(){},between:function(e,t,n){return this.query().between(e,t,n).run()},createIndex:function(e,t,n){var r=this;T(e)&&void 0===t&&(t=[e]),n||(n={}),n.hashCode=n.hashCode||function(e){return r.recordId(e)};var i=r.indexes[e]=new c(t,n);return r.index.visitAll(i.insertRecord,i),r},filter:function(e,t){return this.query().filter(e,t).run()},forEach:function(e,t){this.index.visitAll(e,t)},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()},getIndex:function(e){var t=e?this.indexes[e]:this.index;if(!t)throw new Error("Index "+e+" does not exist!");return t},limit:function(e){return this.query().limit(e).run()},map:function(e,t){var n=[];return this.index.visitAll(function(r){n.push(e.call(t,r))}),n},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},recordId:function(e){if(e)return U(e,this.recordId());var t=this;return t.mapper?t.mapper.idAttribute:t.idAttribute||"id"},query:function(){return new n(this)},reduce:function(e,t){var n=this.getAll();return n.reduce(e,t)},remove:function(e,t){var n=this;t||(t={}),n.beforeRemove(e,t);var r=n.get(e);return r&&(n.index.removeRecord(r),G(n.indexes,function(e,t){e.removeRecord(r)}),r&&L(r.off)&&(r.off("all",n._onRecordEvent,n),n.emit("remove",r))),n.afterRemove(e,t,r)||r},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.recordId(e),t)}),n.afterRemoveAll(e,t,r)||r},skip:function(e){return this.query().skip(e).run()},toJSON:function(e){return this.mapCall("toJSON",e)},updateIndex:function(e,t){t||(t={}),this.getIndex(t.index).updateRecord(e)},updateIndexes:function(e){var t=this;t.index.updateRecord(e),G(t.indexes,function(t,n){t.updateRecord(e)})}}),oe(s.prototype,function(){return this._listeners},function(e){this._listeners=e});var ye="belongsTo",be="hasMany",xe="hasOne";ce(f.prototype,{getRelation:function(){return this.relatedMapper},getLocalKeys:function(e){},getForeignKey:function(e){return this.type===ye?U(e,this.foreignKey):U(e,this.mapper.idAttribute)},setForeignKey:function(e,t){var n=this;e&&t&&(n.type===ye?B(e,n.foreignKey,U(t,n.getRelation().idAttribute)):!function(){var r=n.mapper.idAttribute;M(t)?t.forEach(function(t){B(t,n.foreignKey,U(e,r))}):B(t,n.foreignKey,U(e,r))}())},getLocalField:function(e){return U(e,this.localField)},setLocalField:function(e,t){return B(e,this.localField,t)}});var Ae=function(e,t,n){if(n||(n={}),!n.type)throw new Error("must specify relation type!");n.mapper=e,n.name=e.name;var r=new f(t,n);e.relationList||(e.relationList=[]),e.relationFields||(e.relationFields=[]),e.relationList.push(r),e.relationFields.push(r.localField)},_e=function(e,t){return t||(t={}),t.type=ye,function(n){Ae(n,e,t)}},we=function(e,t){return t||(t={}),t.type=be,function(n){Ae(n,e,t)}},Oe=function(e,t){return t||(t={}),t.type=xe,function(n){Ae(n,e,t)}};l.extend=se,ce(l.prototype,{_mapper:function(){if(!this.constructor.Mapper)throw new Error("This RecordClass has no Mapper!");return this.constructor.Mapper},get:function(e){return U(this,e)},set:function(e,t,n){var r=this;P(e)&&(n=t),n||(n={}),n.silent&&r._set("silent",!0),B(r,e,t),r._get("eventId")||r._set("silent")},unset:function(e,t){this.set(e,void 0,t)},hashCode:function(){var e=this;return U(e,e._mapper().idAttribute)},changes:function(e){var t=this;return e?t._get("changes."+e):t._get("changes")},hasChanges:function(){return!!(this._get("changed")||[]).length},commit:function(){var e=this;return e._set("changed"),e._set("changes",{}),e._set("previous",re(e)),e},previous:function(e){var t=this;return e?t._get("previous."+e):t._get("previous")},revert:function(e){var t=this,n=t._get("previous")||{};return e||(e={}),e.preserve||(e.preserve=[]),G(t,function(r,i){i!==t._mapper().idAttribute&&!n.hasOwnProperty(i)&&t.hasOwnProperty(i)&&-1===e.preserve.indexOf(i)&&delete t[i]}),G(n,function(n,r){-1===e.preserve.indexOf(r)&&(t[r]=n)}),t.commit(),t},schema:function(e){var t=this._mapper().schema;return e?t[e]:t},create:function(e){return this._mapper().create(this,e)},beforeSave:function(){},save:function(e){var t=void 0,n=void 0,r=this,i=r._mapper();return e||(e={}),X(r,e),n=e.adapter=r.getAdapterName(e),t=e.op="beforeSave",H(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",H(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._mapper(),o=i.relationList||[];return e||(e=[]),t||(t={}),X(i,t),t.adapter=i.getAdapterName(t),n=t.op="beforeLoadRelations",H(r[n](e,t)).then(function(){return T(e)&&(e=[e]),n=t.op="loadRelations",i.dbg(n,r,e,t),Promise.all(o.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.getRelation().findAll(v.defineProperty({},e.foreignKey,U(r,i.idAttribute)),t);else if(e.foreignKey){var o=U(r,e.foreignKey);D(o)&&(n=e.getRelation().find(o,t))}else e.localKeys?n=e.getRelation().findAll(v.defineProperty({},e.getRelation().idAttribute,{in:U(r,e.localKeys)}),t):e.foreignKeys&&(n=e.getRelation().findAll(v.defineProperty({},e.getRelation().idAttribute,{contains:U(r,i.idAttribute)}),t));return n&&(n=n.then(function(n){t.raw&&(n=n.data),B(r,e.localField,"hasOne"===e.type?n.length?n[0]:void 0:n)})),n}))}).then(function(){return n=t.op="afterLoadRelations",H(r[n](e,t)).then(function(){return r})})},afterLoadRelations:function(){},destroy:function(e){var t=this._mapper();return t.destroy(U(this,t.idAttribute),e)},toJSON:function(e){var t=this,n=this.constructor.Mapper;if(n)return n.toJSON(this,e);var r=function(){var e={};return G(t,function(t,n){e[n]=re(t)}),{v:e}}();return"object"===("undefined"==typeof r?"undefined":v.typeof(r))?r.v:void 0}}),oe(l.prototype,function(){return this._get("events")},function(e){this._set("events",e)}),d.extend=se;var Re={array:M,boolean:q,integer:j,null:S,number:K,object:P,string:T},Ce={},Ee={},Fe=function(e,t){var n="";return e&&(n+=K(e)?"["+e+"]":t?"."+e:""+e),n},Ie=function(e){e||(e={});var t="",n=e.path||[];return n.forEach(function(e){t+=Fe(e,t)}),t+=Fe(e.prop,t)},Me=function(e,t,n){return{expected:t,actual:""+e,path:Ie(n)}},ke=function(e,t,n,r){r.push(Me(e,t,n))},Le=function(e,t,n,r){var i=n[e];return t.length>i?Me(t.length,"length no more than "+i,r):void 0},je=function(e,t,n,r){var i=n[e];return t.length<i?Me(t.length,"length no less than "+i,r):void 0},Se=function(e,t,n,r){return!Q(n[e])&&Ee[e](t,n,r)},Ke=function(e,t,n,r){var i=[];return e.forEach(function(e){i=i.concat(Se(e,t,n,r)||[])}),i.length?i:void 0},Pe=["enum","type","allOf","anyOf","oneOf","not"],Ne=["items","maxItems","minItems","uniqueItems"],De=["multipleOf","maximum","minimum"],Te=["maxProperties","minProperties","required","properties","dependencies"],Qe=["maxLength","minLength","pattern"],qe=function(e,t,n){return Ke(Pe,e,t,n)},Ue=function e(t,n,r){var i=[];r||(r={});var o=void 0,a=r.prop;if(!Q(n)){if(!P(n))throw new Error('Invalid schema at path: "'+r.path+'"');return Q(r.path)&&(r.path=[]),Q(r.prop)||(o=!0,r.path.push(r.prop),r.prop=void 0),n.extends&&(i=L(n.extends.validate)?i.concat(n.extends.validate(t,r)||[]):i.concat(e(t,n.extends,r)||[])),Q(t)?(n.required===!0&&ke(t,"a value",r,i),o&&(r.path.pop(),r.prop=a),i.length?i:void 0):(i=i.concat(qe(t,n,r)||[]),o&&(r.path.pop(),r.prop=a),i.length?i:void 0)}};d.types=Re,d.typeGroupValidators=Ce,d.validationKeywords=Ee,d.validate=Ue,d.prototype.validate=function(e,t){return d.validate(e,this,t)},Z(Ee,{allOf:function(e,t,n){var r=[];return t.allOf.forEach(function(t){r=r.concat(Ue(e,t,n)||[])}),r.length?void 0:r},anyOf:function(e,t,n){var r=!1,i=[];return t.anyOf.forEach(function(t){var o=Ue(e,t,n);o?i=i.concat(o):r=!0}),r?void 0:i},dependencies:function(e,t,n){},enum:function(e,t,n){var r=t.enum;return-1===r.indexOf(e)?Me(e,"one of ("+r.join(", ")+")",n):void 0},items:function e(t,n,r){r||(r={});for(var e=n.items,i=[],o=M(e),a=t.length,u=0;a>u;u++)o&&(e=n.items[u]),r.prop=u,i=i.concat(Ue(t[u],e,r)||[]);return i.length?i:void 0},maximum:function e(t,n,r){var e=n.maximum,i=n.exclusiveMaximum;return("undefined"==typeof t?"undefined":v.typeof(t))===("undefined"==typeof e?"undefined":v.typeof(e))&&(i?t>e:t>=e)?Me(t,"no more than "+e,r):void 0},maxItems:function(e,t,n){return Le("maxItems",e,t,n)},maxLength:function(e,t,n){return Le("maxLength",e,t,n)},maxProperties:function e(t,n,r){var e=n.maxProperties,i=Object.keys(t).length;return i>e?Me(i,"no more than "+e+" properties",r):void 0},minimum:function e(t,n,r){var e=n.minimum,i=n.exclusiveMinimum;return("undefined"==typeof t?"undefined":v.typeof(t))===("undefined"==typeof e?"undefined":v.typeof(e))&&(i?e>t:e>=t)?Me(t,"no less than "+e,r):void 0},minItems:function(e,t,n){return je("minItems",e,t,n)},minLength:function(e,t,n){return je("minLength",e,t,n)},minProperties:function e(t,n,r){var e=n.minProperties,i=Object.keys(t).length;return e>i?Me(i,"no more than "+e+" properties",r):void 0},multipleOf:function(e,t,n){},not:function(e,t,n){return Ue(e,t.not,n)?void 0:Me("succeeded","should have failed",n)},oneOf:function(e,t,n){var r=!1,i=[];return t.oneOf.forEach(function(t){var o=Ue(e,t,n);if(o)i=i.concat(o);else{if(r)return i=[Me("valid against more than one","valid against only one",n)],r=!1,!1;r=!0}}),r?void 0:i},pattern:function e(t,n,r){var e=n.pattern;return T(t)&&!t.match(e)?Me(t,e,r):void 0},properties:function e(t,n,r){r||(r={});var i=Q(n.additionalProperties)?!0:n.additionalProperties,o={},e=n.properties||{},a=n.patternProperties||{},u=[];G(t,function(e,t){o[t]=void 0}),G(e||{},function(e,n){Q(t[n])&&!Q(e.default)&&(t[n]=re(e.default)),r.prop=n,u=u.concat(Ue(t[n],e,r)||[]),delete o[n]}),G(a,function(e,n){G(o,function(i,a){a.match(n)&&(r.prop=a,u=u.concat(Ue(t[a],e,r)||[]),delete o[a])})});var c=Object.keys(o);return i===!1?c.length&&ke("extra fields: "+c.join(", "),"no extra fields",r,u):P(i)&&c.forEach(function(e){r.prop=e,u=u.concat(Ue(t[e],i,r)||[])}),u.length?u:void 0},required:function e(t,n,r){var e=n.required,i=[];return r.existingOnly||e.forEach(function(e){if(Q(U(t,e))){var n=r.prop;r.prop=e,ke(void 0,"a value",r,i),r.prop=n}}),i.length?i:void 0},type:function e(t,n,r){var e=n.type,i=void 0;if(T(e)&&(e=[e]),e.forEach(function(e){return Re[e](t,n,r)?(i=e,!1):void 0}),!i)return Me(t?"undefined"==typeof t?"undefined":v.typeof(t):""+t,"one of ("+e.join(", ")+")",r);var o=Ce[i];return o?o(t,n,r):void 0},uniqueItems:function(e,t,n){if(e&&e.length&&t.uniqueItems){var r=e.length,i=void 0,o=void 0,a=void 0;for(o=r-1;o>0;o--)for(i=e[o],a=o-1;a>=0;a--)if(i===e[a])return Me(i,"no duplicates",n)}}}),Z(Ce,{array:function(e,t,n){return Ke(Ne,e,t,n)},integer:function(e,t,n){return Ce.numeric(e,t,n)},number:function(e,t,n){return Ce.numeric(e,t,n)},numeric:function(e,t,n){return Ke(De,e,t,n)},object:function(e,t,n){return Ke(Te,e,t,n)},string:function(e,t,n){return Ke(Qe,e,t,n)}});var Je="changing",$e="changed",Be="creating",Ve="eventId",Ge="noValidate",ze="silent",He="validation failed",We=function(e,t){var n={enumerable:Q(t.enumerable)?!0:!!t.enumerable},r="props."+e,i="previous."+e,o="changes."+e;return n.get=function(){return this._get(r)},n.set=function(n){var a=this,u=a._get,c=a._set,s=a._unset;if(!u(Ge)){var f=t.validate(n);if(f){var l=new Error(He);throw l.errors=f,l}}return t.track&&!u(Be)&&!function(){var t=u(i),f=u(r),l=u(Je),d=u($e);l||(d=[]);var p=d.indexOf(e);f!==n&&-1===p&&d.push(e),t!==n?c(o,n):(s(o),p>=0&&d.splice(p,1)),d.length||(l=!1,s(Je),s($e),u(Ve)&&(clearTimeout(u(Ve)),s(Ve))),!l&&d.length&&(c($e,d),c(Je,!0),c(Ve,setTimeout(function(){if(s($e),s(Ve),s(Je),!u(ze)){var e=void 0;for(e=0;e<d.length;e++)a.emit("change:"+d[e],a,U(a,d[e]));a.emit("change",a,u("changes"))}s(ze)},0)))}(),c(r,n),n},n},Xe=function(e,t){var n=e.properties||{};G(n,function(e,n){Object.defineProperty(t,n,We(n,e))})},Ye=function(){for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];var r=this,i=t[t.length-1];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))})},Ze=function(){for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];var r=this,i=t[t.length-2];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))})},et={_adapters:null,_listeners:null,applySchema:!0,defaultAdapter:"http",debug:!1,idAttribute:"id",name:null,notify:!0,raw:!1,RecordClass:void 0,schema:null,upsert:!0};ce(p.prototype,{end:function(e,t){var n=this;t.raw&&X(t,e);var r=t.raw?e.data:e;return r=M(r)?r.map(function(e){return n.createRecord(e)}):n.createRecord(r),t.raw?e.data=r:e=r,t.notify&&setTimeout(function(){n.emit(t.op,e,t)}),e},createRecord:function(e,t){var n=this,r=n.RecordClass,i=n.relationList||[];return i.forEach(function(t){var n=t.getRelation(),r=t.getLocalField(e);M(r)&&r.length&&!n.is(r[0])?t.setLocalField(e,r.map(function(e){return t.getRelation().createRecord(e)})):P(r)&&!n.is(r)&&t.setLocalField(e,t.getRelation().createRecord(r))}),r?e instanceof r?e:new r(e,t):e},is:function(e){var t=this.RecordClass;return t?e instanceof t:!1},toJSON:function(e,t){var n=this;t||(t={});var r=(n?n.relationFields:[])||[],i={},o=void 0;return n&&n.schema&&(o=n.schema.properties||{},G(o,function(t,n){i[n]=ie(e[n])})),o||(o={}),t.strict||G(e,function(e,t){o[t]||-1!==r.indexOf(t)||(i[t]=ie(e))}),n&&t.withAll&&(t.with=r.slice()),n&&t.with&&(T(t.with)&&(t.with=[t.with]),le(n,t,function(t,n){var r=t.getLocalField(e);r&&(M(r)?t.setLocalField(i,r.map(function(e){return t.getRelation().toJSON(e,n)})):t.setLocalField(i,t.getRelation().toJSON(r,n)))})),i},getAdapter:function(e){var t=this;t.dbg("getAdapter","name:",e);var n=t.getAdapterName(e);if(!n)throw new ReferenceError(n+" not found!");return t.getAdapters()[n]},getAdapterName:function(e){return e||(e={}),T(e)&&(e={adapter:e}),e.adapter||e.defaultAdapter},getAdapters:function(){return this._adapters},getSchema:function(){return this.schema},beforeCreate:Ye,checkUpsertCreate:function(e,t){var n=this;return(t.upsert||void 0===t.upsert&&n.upsert)&&U(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(U(e,i.idAttribute),e,t):(X(i,t),r=t.adapter=i.getAdapterName(t),n=t.op="beforeCreate",H(i[n](e,t)).then(function(o){e=o||e;var a={};t.with||(t.with=[]);var u=[];return le(i,t,function(t,n){var r=t.getLocalField(e);t.type===ye&&r&&u.push(t.getRelation().create(r,n).then(function(r){var i=n.raw?r.data:r;t.setLocalField(a,i),t.setForeignKey(e,i)}))}),Promise.all(u).then(function(){return n=t.op="create",i.dbg(n,e,t),H(i.getAdapter(r)[n](i,i.toJSON(e,{with:t.pass||[]}),t))}).then(function(n){var r=t.raw?n.data:n;return u=[],le(i,t,function(n,i){var o=n.getLocalField(e);if(o){var c=void 0;n.type===be?(n.setForeignKey(r,o),c=n.getRelation().createMany(o,i).then(function(e){n.setLocalField(r,t.raw?e.data:e)})):n.type===xe?(n.setForeignKey(r,o),c=n.getRelation().create(o,i).then(function(e){
n.setLocalField(r,t.raw?e.data:e)})):n.type===ye&&n.getLocalField(a)&&n.setLocalField(r,n.getLocalField(a)),c&&u.push(c)}}),Promise.all(u).then(function(){return n})})}).then(function(r){return n=t.op="afterCreate",H(i[n](e,t,r)).then(function(e){return r=e||r,i.end(r,t)})}))},afterCreate:Ze,beforeCreateMany:Ye,checkUpsertCreateMany:function(e,t){var n=this;return t.upsert||void 0===t.upsert&&n.upsert?e.reduce(function(e,t){return e&&U(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):(X(i,t),r=t.adapter=i.getAdapterName(t),n=t.op="beforeCreateMany",H(i[n](e,t)).then(function(o){e=o||e;var a={};t.with||(t.with=[]);var u=[];return le(i,t,function(t,n){var r=e.map(function(e){return t.getLocalField(e)}).filter(function(e){return e});t.type===ye&&r.length===e.length&&u.push(t.getRelation().createMany(r,n).then(function(r){var i=n.raw?r.data:r;t.setLocalField(a,i),e.forEach(function(e,n){t.setForeignKey(e,i[n])})}))}),Promise.all(u).then(function(){n=t.op="createMany";var o=e.map(function(e){return i.toJSON(e,{with:t.pass||[]})});return i.dbg(n,e,t),H(i.getAdapter(r)[n](i,o,t))}).then(function(n){var r=t.raw?n.data:n;return u=[],le(i,t,function(n,o){var c=e.map(function(e){return n.getLocalField(e)}).filter(function(e){return e});if(c.length===e.length){var s=n.getLocalField(a),f=void 0;n.type===be?i.log("warn","deep createMany of hasMany type not supported!"):n.type===xe?(r.forEach(function(e,t){n.setForeignKey(e,c[t])}),f=n.getRelation().createMany(c,o).then(function(e){var i=t.raw?e.data:e;r.forEach(function(e,t){n.setLocalField(e,i[t])})})):n.type===ye&&s&&s.length===r.length&&r.forEach(function(e,t){n.setLocalField(e,s[t])}),f&&u.push(f)}}),Promise.all(u).then(function(){return n})})}).then(function(e){return n=t.op="afterCreateMany",H(i[n](e,t)).then(function(n){return e=n||e,i.end(e,t)})}))},afterCreateMany:Ze,beforeFind:Ye,find:function(e,t){var n=void 0,r=void 0,i=this;return t||(t={}),X(i,t),r=t.adapter=i.getAdapterName(t),n=t.op="beforeFind",H(i[n](e,t)).then(function(o){return e=void 0===o?e:o,n=t.op="find",i.dbg(n,e,t),H(i.getAdapter(r)[n](i,e,t))}).then(function(e){return n=t.op="afterFind",H(i[n](e,t)).then(function(n){return e=n||e,i.end(e,t)})})},afterFind:Ze,beforeFindAll:Ye,findAll:function(e,t){var n=void 0,r=void 0,i=this;return e||(e={}),t||(t={}),X(i,t),r=t.adapter=i.getAdapterName(t),n=t.op="beforeFindAll",H(i[n](e,t)).then(function(o){return e=o||e,n=t.op="findAll",i.dbg(n,e,t),H(i.getAdapter(r)[n](i,e,t))}).then(function(r){return n=t.op="afterFindAll",H(i[n](r,e,t)).then(function(e){return r=e||r,i.end(r,t)})})},afterFindAll:Ze,beforeUpdate:Ye,update:function(e,t,n){var r=void 0,i=void 0,o=this;return t||(t={}),n||(n={}),X(o,n),i=n.adapter=o.getAdapterName(n),r=n.op="beforeUpdate",H(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),H(o.getAdapter(i)[r](o,e,u,n))}).then(function(t){return r=n.op="afterUpdate",H(o[r](e,t,n)).then(function(e){return t=e||t,o.end(t,n)})})},afterUpdate:Ze,beforeUpdateMany:Ye,updateMany:function(e,t){var n=void 0,r=void 0,i=this;return e||(e=[]),t||(t={}),X(i,t),r=t.adapter=i.getAdapterName(t),n=t.op="beforeUpdateMany",H(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),H(i.getAdapter(r)[n](i,a,t))}).then(function(e){return n=t.op="afterUpdateMany",H(i[n](e,t)).then(function(n){return e=n||e,i.end(e,t)})})},afterUpdateMany:Ze,beforeUpdateAll:Ye,updateAll:function(e,t,n){var r=void 0,i=void 0,o=this;return e||(e={}),t||(t={}),n||(n={}),X(o,n),i=n.adapter=o.getAdapterName(n),r=n.op="beforeUpdateAll",H(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),H(o.getAdapter(i)[r](o,e,u,n))}).then(function(t){return r=n.op="afterUpdateAll",H(o[r](e,t,n)).then(function(e){return t=e||t,o.end(t,n)})})},afterUpdateAll:Ze,beforeDestroy:Ye,destroy:function(e,t){var n=void 0,r=void 0,i=this;return t||(t={}),X(i,t),r=t.adapter=i.getAdapterName(t),n=t.op="beforeDestroy",H(i[n](e,t)).then(function(o){return e=void 0===o?e:o,n=t.op="destroy",i.dbg(n,e,t),H(i.getAdapter(r)[n](i,e,t))}).then(function(r){return n=t.op="afterDestroy",H(i[n](e,t,r)).then(function(e){return r=e||r,t.raw?(X(t,r),r):r})})},afterDestroy:Ze,beforeDestroyAll:Ye,destroyAll:function(e,t){var n=void 0,r=void 0,i=this;return e||(e={}),t||(t={}),X(i,t),r=t.adapter=i.getAdapterName(t),n=t.op="beforeDestroyAll",H(i[n](e,t)).then(function(o){return e=o||e,n=t.op="destroyAll",i.dbg(n,e,t),H(i.getAdapter(r)[n](i,e,t))}).then(function(r){return n=t.op="afterDestroyAll",H(i[n](e,t,r)).then(function(e){return r=e||r,t.raw?(X(t,r),r):r})})},afterDestroyAll:Ze,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||"mapper")+")";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(e,t)(this)},hasMany:function(e,t){return we(e,t)(this)},hasOne:function(e,t){return Oe(e,t)(this)},registerAdapter:function(e,t,n){var r=this;n||(n={}),r.getAdapters()[e]=t,(n===!0||n.default)&&(r.defaultAdapter=e)}}),p.extend=se,oe(p.prototype,function(){return this._listeners},function(e){this._listeners=e});var tt=["create","createMany","createRecord","destroy","destroyAll","find","findAll","is","update","updateAll","updateMany"];h.extend=se,ce(h.prototype,{defineMapper:function(e,t){var n=this;if(P(e)){if(t=e,!t.name)throw new Error("name is required!");e=t.name}else if(!T(e))throw new Error("name is required!");t||(t={}),t.name=e,t.relations||(t.relations={});var r=t.MapperClass||n.MapperClass;delete t.MapperClass,Z(t,n.mapperDefaults);var i=n._mappers[e]=new r(t);return i.name=e,i._adapters=n.getAdapters(),G(i.relations,function(e,t){G(e,function(e,r){P(e)&&(e=[e]),e.forEach(function(e){e.getRelation=function(){return n.getMapper(r)};var o=n._mappers[r]||r;t===ye?i.belongsTo(o,e):t===xe?i.hasOne(o,e):t===be&&i.hasMany(o,e)})})}),i},getAdapter:function(e){var t=this,n=t.getAdapterName(e);if(!n)throw new ReferenceError(n+" not found!");return t.getAdapters()[n]},getAdapterName:function(e){return e||(e={}),T(e)&&(e={adapter:e}),e.adapter||this.mapperDefaults.defaultAdapter},getAdapters:function(){return this._adapters},getMapper:function(e){var t=this._mappers[e];if(!t)throw new ReferenceError(e+" is not a registered mapper!");return t},registerAdapter:function(e,t,n){var r=this;n||(n={}),r.getAdapters()[e]=t,(n===!0||n.default)&&(r.mapperDefaults.defaultAdapter=e,G(r._mappers,function(t){t.defaultAdapter=e}))}});var nt={};tt.forEach(function(e){nt[e]=function(t){for(var n,r=arguments.length,i=Array(r>1?r-1:0),o=1;r>o;o++)i[o-1]=arguments[o];return(n=this.getMapper(t))[e].apply(n,i)}}),ce(h.prototype,nt);var rt=s.extend({constructor:function(e,t){var n=this;if(ae(n,rt),fe(n).call(n,e,t),n._added={},!n.datastore)throw new Error("This collection must have a datastore!");return n},_onRecordEvent:function(){for(var e=this,t=arguments.length,n=Array(t),r=0;t>r;r++)n[r]=arguments[r];fe(e).prototype._onRecordEvent.apply(e,n);var i=n[0];T(i)&&0===i.indexOf("change")&&e.updateIndexes(n[1])},add:function(e,t){var n=this,r=n.datastore,i=n.mapper,o=i.relationList||[],a=(new Date).getTime(),u=!!i.RecordClass,c=void 0;return P(e)&&!M(e)&&(c=!0,e=[e]),o.length&&e.length&&i.relationList.forEach(function(t){var n=t.relation,i=r.getMapper(n),o=i.idAttribute,a=t.foreignKey,u=r.getCollection(n),c=t.type,s=c===be,f=Q(t.add)?!0:!!t.add,l=void 0;e.forEach(function(e){if(l=t.getLocalField(e),L(t.add))t.add(r,t,e);else if(l){if(s)l=l.map(function(n){return n!==u.get(u.recordId(n))&&(a&&t.setForeignKey(e,n),f&&(n=u.add(n))),n}),t.localKeys&&B(e,t.localKeys,l.map(function(e){return U(e,o)}));else{var n=U(l,o);l!==u.get(n)&&(t.setForeignKey(e,l),f&&(l=u.add(l)))}t.setLocalField(e,l)}})}),e=fe(n).prototype.add.call(n,e,t),e.forEach(function(e){n._added[n.recordId(e)]=a,u&&e._set("$",a)}),c?e[0]:e},remove:function(e,t){var n=this;delete n._added[e];var r=fe(n).prototype.remove.call(n,e,t);if(r){var i=n.mapper;i.RecordClass&&r._set("$")}return r},removeAll:function(e,t){var n=this,r=fe(n).prototype.removeAll.call(n,e,t);return r.forEach(function(e){delete n._added[n.recordId(e)]}),r}});rt.extend=se;var it={linkRelations:C},ot=h.extend({constructor:function(e){var t=this;return ae(t,ot),fe(t).call(t,e),t.CollectionClass=t.CollectionClass||rt,t._collections={},Z(t,it),t._pendingQueries={},t._completedQueries={},t},_callSuper: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 fe(this).prototype[e].apply(this,n)},_end:function(e,t,n){return n.raw?(t.data=this.getCollection(e).add(t.data,n),t):t=this.getCollection(e).add(t,n)},create:function(e,t,n){var r=this;return n||(n={}),r._callSuper("create",e,t,n).then(function(t){return r._end(e,t,n)})},createMany:function(e,t,n){var r=this;return n||(n={}),r._callSuper("createMany",e,t,n).then(function(t){return r._end(e,t,n)})},defineMapper:function(e,t){var n=this,r=fe(n).prototype.defineMapper.call(n,e,t);n._pendingQueries[e]={},n._completedQueries[e]={},r.relationList=r.relationList||[];var i=n._collections[e]=new n.CollectionClass(null,{_added:{},datastore:n,mapper:r}),o=r.schema||{},a=o.properties||{};G(a,function(e,t){e.indexed&&i.createIndex(t)}),i.createIndex("addedTimestamps",["$"],{fieldGetter:function(e){return i._added[i.recordId(e)]}});var u=n.linkRelations;return u&&r.relationList.forEach(function(e){var t=e.relation,o=e.localField,a="links."+o,c=e.foreignKey,s=e.type,f=Q(e.link)?u:e.link,l={index:c},d=void 0;s===ye?(i.indexes[c]||i.createIndex(c),d={get:function(){var r=this;if(!r._get("$")||!f)return r._get(a);var i=e.getForeignKey(r),o=Q(i)?void 0:n.getCollection(t).get(i);return r._set(a,o),o},set:function(t){var n=this;return n._set(a,t),e.setForeignKey(n,t),i.updateIndex(n,l),e.getLocalField(n)}}):s===be?!function(){var r=e.localKeys,o=e.foreignKeys;n._collections[t]&&c&&!n.getCollection(t).indexes[c]&&n.getCollection(t).createIndex(c),d={get:function(){var i=this;if(!i._get("$")||!f)return i._get(a);var u=e.getForeignKey(i),s=void 0,l=n.getCollection(t);if(c)s=l.getAll(u,{index:c});else if(r){var d=U(i,r)||[],p=M(d)?d:Object.keys(d);s=l.getAll.apply(l,p)}else if(o){var h={};B(h,"where."+o+".contains",u),s=l.filter(h)}return i._set(a,s),s},set:function(u){var s=this,f=i.recordId(s),d=n.getCollection(t);return s._set(a,u),c&&(e.setForeignKey(s,u),M(u)&&u.forEach(function(e){d.updateIndex(e,l)})),r?B(s,r,u.map(function(e){return d.recordId(e)})):o&&u.forEach(function(e){var t=U(e,o);t?-1===t.indexOf(f)&&t.push(f):B(e,o,[f])}),e.getLocalField(s)}}}():s===xe&&(d={get:function(){var r=this;if(!r._get("$")||!f)return r._get(a);var i=e.getForeignKey(r),o=n.getCollection(t).getAll(i,{index:c}),u=o.length?o[0]:void 0;return r._set(a,u),u},set:function(r){var i=this;return i._set(a,r),e.setForeignKey(i,r),n.getCollection(t).updateIndex(r,l),e.getLocalField(i)}}),d&&(d.enumerable=Q(e.enumerable)?!0:e.enumerable,e.get&&!function(){var t=d.get;d.get=function(){var n=this;return e.get(e,this,function(){for(var e=arguments.length,r=Array(e),i=0;e>i;i++)r[i]=arguments[i];return t.apply(n,r)})}}(),e.set&&!function(){var t=d.set;d.set=function(n){var r=this;return e.set(e,this,n,function(e){return t.call(r,void 0===e?n:e)})}}(),Object.defineProperty(r.RecordClass.prototype,o,d))}),r},destroy:function(e,t,n){var r=this;return n||(n={}),r._callSuper("destroy",e,t,n).then(function(i){return n.raw?i.data=r.getCollection(e).remove(t,n):i=r.getCollection(e).remove(t,n),delete r._pendingQueries[e][t],delete r._completedQueries[e][t],i})},destroyAll:function(e,t,n){var r=this;return n||(n={}),r._callSuper("destroyAll",e,t,n).then(function(i){n.raw?i.data=r.getCollection(e).removeAll(t,n):i=r.getCollection(e).removeAll(t,n);var o=r.hashQuery(e,t,n);return delete r._pendingQueries[e][o],delete r._completedQueries[e][o],i})},find:function(e,t,n){var r=this;n||(n={});var i=r._pendingQueries[e][t];if(Z(n,r.getMapper(e)),i)return i;var o=r.cachedFind(e,t,n),a=void 0;return a=n.force||!o?r._pendingQueries[e][t]=r._callSuper("find",e,t,n).then(function(i){return delete r._pendingQueries[e][t],r._end(e,i,n)},function(n){return delete r._pendingQueries[e][t],W(n)}).then(function(n){return r._completedQueries[e][t]=(new Date).getTime(),n}):H(o)},findAll:function(e,t,n){var r=this;n||(n={});var i=r.hashQuery(e,t,n),o=r._pendingQueries[e][i];if(Z(n,r.getMapper(e)),o)return o;var a=r.cachedFindAll(e,t,n),u=void 0;return u=n.force||!a?r._pendingQueries[e][i]=r._callSuper("findAll",e,t,n).then(function(t){return delete r._pendingQueries[e][i],r._end(e,t,n)},function(t){return delete r._pendingQueries[e][i],W(t)}).then(function(t){return r._completedQueries[e][i]=(new Date).getTime(),t}):H(a)},cachedFind:function(e,t,n){return this.get(e,t,n)},cachedFindAll:function(e,t,n){var r=this;return r._completedQueries[e][r.hashQuery(e,t,n)]?r.filter(e,t,n):void 0},hashQuery:function(e,t,n){return ne(t)},getCollection:function(e){var t=this._collections[e];if(!t)throw new ReferenceError(e+" is not a registered collection!");return t},update:function(e,t,n,r){var i=this;return r||(r={}),i._callSuper("update",e,t,n,r).then(function(t){return i._end(e,t,r)})},updateAll:function(e,t,n,r){var i=this;return r||(r={}),i._callSuper("updateAll",e,t,n,r).then(function(t){return i._end(e,t,r)})},updateMany:function(e,t,n){var r=this;return n||(n={}),r._callSuper("updateMany",e,t,n).then(function(t){return r._end(e,t,n)})}});ot.prototype.defineResource=ot.prototype.defineMapper,ot.extend=se;var at=["add","between","createIndex","filter","get","getAll","query","remove","removeAll","toJson"],ut={};at.forEach(function(e){ut[e]=function(t){for(var n,r=arguments.length,i=Array(r>1?r-1:0),o=1;r>o;o++)i[o-1]=arguments[o];return(n=this.getCollection(t))[e].apply(n,i)}}),ut.inject=function(){return console.warn("deprecated"),this.add.apply(this,arguments)},ce(ot.prototype,ut);var ct={full:"<%= pkg.version %>",major:parseInt("<%= major %>",10),minor:parseInt("<%= minor %>",10),patch:parseInt("<%= patch %>",10),alpha:"<%= alpha %>",beta:"<%= beta %>"},st=ot;e.Collection=s,e.Container=h,e.DataStore=ot,e.DS=st,e.LinkedCollection=rt,e.Mapper=p,e.Query=n,e.Record=l,e.Schema=d,e.utils=de,e.version=ct,e.belongsToType=ye,e.hasManyType=be,e.hasOneType=xe,e.belongsTo=_e,e.hasMany=we,e.hasOne=Oe});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define("js-data",["exports"],t):t(e.JSData=e.JSData||{})}(this,function(e){"use strict";function t(e,t,n,r){var i=t.relation,o=null;if(e||(e={}),e.with||(e.with=[]),e.withAll)return void n.call(r,t,{});if(-1!==e.with.indexOf(i)?o=i:-1!==e.with.indexOf(t.localField)&&(o=t.localField),o){var a=re(e);a.with=e.with.slice(),Z(a,t.getRelation());var u=a.with.indexOf(o);u>=0&&a.with.splice(u,1),a.with.forEach(function(e,t){e&&0===e.indexOf(o)&&e.length>=o.length&&"."===e[o.length]?a.with[t]=e.substr(o.length+1):a.with[t]=""}),n.call(r,t,a)}}function n(e){ae(this,n),this.collection=e,this.data=null}function r(e){return e.replace(ve,"\\$1")}function i(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 o(e,t,n){return e.splice(t,0,n),e}function a(e,t){return e.splice(t,1),e}function u(e,t,n){for(var r=0,o=e.length,a=void 0,u=void 0;o>r;){if(u=(r+o)/2|0,a=i(t,e[u],n),0===a)return{found:!0,index:u};0>a?o=u:r=u+1}return{found:!1,index:o}}function c(e,t){if(ae(this,c),e||(e=[]),!M(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 f(e,t){var n=this;ae(n,f),P(e)&&!M(e)&&(t=e,e=[]),T(t)&&(t={idAttribute:t}),e||(e=[]),t||(t={}),t.recordOpts||(t.recordOpts={}),Z(n,t),Z(n,me),n._listeners={};var r=n.recordId();n.index=new c([r],{hashCode:function(e){return U(e,r)}}),n.indexes={},e.forEach(function(e){e=n.mapper?n.mapper.createRecord(e,n.recordOpts):e,n.index.insertRecord(e),e&&L(e.on)&&e.on("all",n._onRecordEvent,n)})}function s(e,t){var n=this;t||(t={});var r=t.localField;if(!r)throw new Error("localField is required");var i=t.foreignKey=t.foreignKey||t.localKey;if(!i&&(t.type===be||t.type===Ae))throw new Error("foreignKey is required");var o=t.localKeys,a=t.foreignKeys;if(!i&&!o&&!a&&t.type===xe)throw new Error("one of (foreignKey, localKeys, foreignKeys) is required");if(T(e)){if(t.relation=e,!L(t.getRelation))throw new Error("you must provide a reference to the related mapper!")}else e&&(t.relation=e.name,Object.defineProperty(n,"relatedMapper",{value:e}));Z(n,t)}function l(e,t){var n=this;ae(n,l),e||(e={}),t||(t={});var r={};Object.defineProperties(n,{_get:{value:function(e){return U(r,e)}},_set:{value:function(e,t){return B(r,e,t)}},_unset:{value:function(e){return V(r,e)}}});var i=n._set;i("creating",!0),t.noValidate&&i("noValidate",!0),Z(n,e),i("creating"),i("changes",{}),i("noValidate"),i("previous",re(e))}function d(e){e||(e={}),Z(this,e),e.properties&&G(e.properties,function(t,n){t instanceof d||(e.properties[n]=new d(t))})}function p(e){var t=this;if(ae(t,p),e||(e={}),Z(t,e),Z(t,re(tt)),!t.name)throw new Error("mapper cannot function without a name!");t._adapters||(t._adapters={}),t._listeners||(t._listeners={}),t.schema instanceof d||(t.schema=new d(t.schema||{})),Q(t.RecordClass)&&(t.RecordClass=l.extend()),t.RecordClass&&(t.RecordClass.Mapper=t,se(t.RecordClass,!0)===l&&t.applySchema&&Ye(t.schema,t.RecordClass.prototype))}function h(e){var t=this;ae(t,h),e||(e={}),Z(t,e),t.mapperDefaults=t.mapperDefaults||{},t.MapperClass=t.MapperClass||p,t._adapters={},t._mappers={}}var v={};v.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},v.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 g=1/0,y=1.7976931348623157e308,m="[object Boolean]",b="[object Date]",x="[object Function]",A="[object Number]",_="[object Object]",w="[object RegExp]",O="[object String]",R=Object.prototype.toString,C=void 0;try{C=!!window}catch(e){C=!1}var E=function(e){return R.call(e)},F=function(e){if(!e)return 0===e?e:0;if(e=+e,e===g||e===-g){var t=0>e?-1:1;return t*y}var n=e%1;return e===e?n?e-n:e:0},I=function(e){return!!e&&"object"===("undefined"==typeof e?"undefined":v.typeof(e))&&e.constructor===Object},M=Array.isArray,k=function(e){return e&&"object"===("undefined"==typeof e?"undefined":v.typeof(e))&&E(e)===b},L=function(e){return"function"==typeof e||e&&E(e)===x},j=function(e){return E(e)===A&&e==F(e)},S=function(e){return null===e},K=function(e){var t="undefined"==typeof e?"undefined":v.typeof(e);return"number"===t||e&&"object"===t&&E(e)===A},P=function(e){return E(e)===_},N=function(e){return E(e)===w},D=function(e){return T(e)||K(e)},T=function(e){return"string"==typeof e||e&&"object"===("undefined"==typeof e?"undefined":v.typeof(e))&&E(e)===O},Q=function(e){return void 0===e},q=function(e){return E(e)===m},U=function(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]}},J=function(e,t){if(!t)return e;var n=t.split(".");return n.forEach(function(t){e[t]||(e[t]={}),e=e[t]}),e},$=/^(.+)\.(.+)$/,B=function e(t,n,r){if(P(n))G(n,function(n,r){e(t,r,n)});else{var i=$.exec(n);i?J(t,i[1])[i[2]]=r:t[n]=r}},V=function(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]},G=function(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)},z=function e(t,n){return n&&G(n,function(t,n){var r=this[n];I(t)&&I(r)?e(r,t):this[n]=t},t),t},H=function(e){return Promise.resolve(e)},W=function(e){return Promise.reject(e)},X=function(e,t){for(var n in e){var r=e[n];void 0===t[n]&&!L(r)&&n&&0!==n.indexOf("_")&&(t[n]=r)}},Y=function(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},Z=function(e,t){G(t,function(t,n){e.hasOwnProperty(n)&&void 0!==e[n]||(e[n]=t)})},ee=function(e,t){if(!t||!t.length)return!1;for(var n=void 0,r=0;r<t.length;r++)if("[object RegExp]"===E(t[r])&&t[r].test(e)||t[r]===e)return n=e;return!!n},te=function(e){return T(e)?JSON.parse(e):e},ne=JSON.stringify,re=function e(t,n,r,i,o,a){if(n){if(t===n)throw new Error("Cannot copy! Source and destination are identical.");if(r=r||[],i=i||[],P(t)){var u=r.indexOf(t);if(-1!==u)return i[u];r.push(t),i.push(n)}var c=void 0;if(M(t)){var f=void 0;for(n.length=0,f=0;f<t.length;f++)c=e(t[f],null,r,i,o,a),P(t[f])&&(r.push(t[f]),i.push(c)),n.push(c)}else{M(n)?n.length=0:G(n,function(e,t){delete n[t]});for(var s in t)if(t.hasOwnProperty(s)){if(ee(s,o))continue;c=e(t[s],null,r,i,o,a),P(t[s])&&(r.push(t[s]),i.push(c)),n[s]=c}}}else n=t,t&&(M(t)?n=e(t,[],r,i,o,a):k(t)?n=new Date(t.getTime()):N(t)?(n=new RegExp(t.source,t.toString().match(/[^\/]*$/)[0]),n.lastIndex=t.lastIndex):P(t)&&(n=a?e(t,{},r,i,o,a):e(t,Object.create(Object.getPrototypeOf(t)),r,i,o,a)));return n},ie=function(e){return re(e,void 0,void 0,void 0,void 0,!0)},oe=function(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)}}})},ae=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},ue=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==("undefined"==typeof t?"undefined":v.typeof(t))&&"function"!=typeof t?e:t},ce=function(e,t){G(t,function(e,n){t[n]={writable:!0,value:e}}),Object.defineProperties(e,t)},fe=function(e,t){var n=this,r=void 0;return e||(e={}),t||(t={}),e.hasOwnProperty("constructor")?(r=e.constructor,delete e.constructor):r=function(){ae(this,r);for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];var i=ue(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:G(n,function(e,t){r[t]=e}),Object.defineProperty(r,"__super__",{configurable:!0,value:n}),ce(r.prototype,e),Z(r,t),r},se=function(e,t){var n=t?e:e.constructor;return n.__super__||Object.getPrototypeOf(n)||n.__proto__},le=function(e,n,r,i){var o=e.relationList||[];o.length&&o.forEach(function(e){t(n,e,r,i)})},de=function(e,t){var n={};return G(e,function(e,r){-1===t.indexOf(r)&&(n[r]=e)}),n},pe=Object.freeze({get isBrowser(){return C},isArray:M,isDate:k,isFunction:L,isInteger:j,isNull:S,isNumber:K,isObject:P,isRegExp:N,isSorN:D,isString:T,isUndefined:Q,isBoolean:q,get:U,set:B,unset:V,forOwn:G,deepMixIn:z,resolve:H,reject:W,_:X,intersection:Y,fillIn:Z,isBlacklisted:ee,fromJson:te,toJson:ne,copy:re,plainCopy:ie,eventify:oe,classCallCheck:ae,possibleConstructorReturn:ue,addHiddenPropsToTarget:ce,extend:fe,getSuper:se,forEachRelation:le,omit:de});n.extend=fe;var he={skip:"",offset:"",where:"",limit:"",orderBy:"",sort:""},ve=/([.*+?^=!:${}()|[\]\/\\])/g,ge=/%/g,ye=/_/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!Y(e||[],t||[]).length},isectNotEmpty:function(e,t){return Y(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)}},ce(n.prototype,{compare:function(e,t,n,r){var i=e[t],o=U(n,i[0]),a=U(r,i[0]);return o&&T(o)&&(o=o.toUpperCase()),a&&T(a)&&(a=a.toUpperCase()),n||(n=null),r||(r=null),"DESC"===i[1]?o>a?-1:a>o?1:t<e.length-1?this.compare(e,t+1,n,r):0:a>o?-1:o>a?1:t<e.length-1?this.compare(e,t+1,n,r):0},evaluate:function(e,t,r){return n.ops[t]?n.ops[t](e,r):0===t.indexOf("like")?!S(this.like(r,t.substr(4)).exec(e)):0===t.indexOf("notLike")?S(this.like(r,t.substr(7)).exec(e)):void 0},like:function(e,t){return new RegExp("^"+r(e).replace(ge,".*").replace(ye,".")+"$",t)},getData:function(){var e=this;return e.data||(e.data=e.collection.index.getAll()),e.data},between:function(e,t,n){var r=this;if(n||(n={}),r.data)throw new Error("Cannot access index after first operation!");return r.data=r.collection.getIndex(n.index).between(e,t,n),r},get:function(){var e=arguments.length<=0||void 0===arguments[0]?[]:arguments[0],t=arguments[1],n=this;if(t||(t={}),n.data)throw new Error("Cannot access index after first operation!");return e&&!M(e)&&(e=[e]),e.length?(n.data=n.collection.getIndex(t.index).get(e),n):(n.getData(),n)},getAll:function(){var e=this,t={};if(e.data)throw new Error("Cannot access index after first operation!");for(var n=arguments.length,r=Array(n),i=0;n>i;i++)r[i]=arguments[i];if(!r.length||1===r.length&&P(r[0]))return e.getData(),e;r.length&&P(r[r.length-1])&&(t=r[r.length-1],r.pop());var o=e.collection,a=o.getIndex(t.index);return e.data=[],r.forEach(function(t){e.data=e.data.concat(a.get(t))}),e},filter:function(e,t){var n=this;return e||(e={}),n.getData(),P(e)?!function(){var t={};P(e.where)&&(t=e.where),G(e,function(e,n){n in he||n in t||(t[n]={"==":e})});var r=[],i=[],o=[];G(t,function(e,t){P(e)||(e={"==":e}),G(e,function(e,n){r.push(t),i.push(n),o.push(e)})}),r.length&&!function(){var e=void 0,t=r.length;n.data=n.data.filter(function(a){var u=!0,c=!0;for(e=0;t>e;e++){var f=i[e],s="|"===f.charAt(0);f=s?f.substr(1):f;var l=n.evaluate(U(a,r[e]),f,o[e]);void 0!==l&&(c=u?l:s?c||l:c&&l),u=!1}return c})}();var a=e.orderBy||e.sort;T(a)&&(a=[[a,"ASC"]]),M(a)||(a=null),a&&!function(){var e=0;a.forEach(function(e,t){T(e)&&(a[t]=[e,"ASC"])}),n.data.sort(function(t,r){return n.compare(a,e,t,r)})}(),K(e.skip)?n.skip(e.skip):K(e.offset)&&n.skip(e.offset),K(e.limit)&&n.limit(e.limit)}():L(e)&&(n.data=n.data.filter(e,t)),n},skip:function(e){if(!K(e))throw new TypeError("skip: Expected number but found "+("undefined"==typeof e?"undefined":v.typeof(e))+"!");var t=this.getData();return e<t.length?this.data=t.slice(e):this.data=[],this},limit:function(e){if(!K(e))throw new TypeError("limit: Expected number but found "+("undefined"==typeof e?"undefined":v.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}}),ce(c.prototype,{set:function(e,t){M(e)||(e=[e]);var n=e.shift()||null,r=u(this.keys,n);if(0===e.length)if(r.found){var i=u(this.values[r.index],t,this.hashCode);i.found||o(this.values[r.index],i.index,t)}else o(this.keys,r.index,n),o(this.values,r.index,[t]);else if(r.found)this.values[r.index].set(e,t);else{o(this.keys,r.index,n);var a=new c([],{hashCode:this.hashCode});a.set(e,t),o(this.values,r.index,a)}},get:function(e){M(e)||(e=[e]);var t=e.shift()||null,n=u(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)})},between:function(e,t){var n=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];M(e)||(e=[e]),M(t)||(t=[t]),Z(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?u(this.keys,i):{found:!1,index:0},0===e.length){a.found&&n.leftInclusive===!1&&(a.index+=1);for(var c=a.index;c<this.keys.length;c+=1){if(void 0!==o)if(n.rightInclusive){if(this.keys[c]>o)break}else if(this.keys[c]>=o)break;if(r=this.values[c].isIndex?r.concat(this.values[c].getAll()):r.concat(this.values[c]),n.limit&&r.length>=n.limit+n.offset)break}}else for(var c=a.index;c<this.keys.length;c+=1){var f=this.keys[c];if(f>o)break;if(r=this.values[c].isIndex?f===i?r.concat(this.values[c]._between(re(e),t.map(function(){}),n)):f===o?r.concat(this.values[c]._between(e.map(function(){}),re(t),n)):r.concat(this.values[c].getAll()):r.concat(this.values[c]),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]:[]},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&&(a(t.keys,i),a(t.values,i)),n=!0,!1}else{var o=u(r,e,t.hashCode);if(o.found)return a(r,o.index),0===r.length&&(a(t.keys,i),a(t.values,i)),n=!0,!1}}),n?e:void 0},updateRecord:function(e){this.removeRecord(e),this.insertRecord(e)}});var me={idAttribute:"id",mapper:null,onConflict:"merge",recordOpts:null};f.extend=fe,ce(f.prototype,{_onRecordEvent:function(){this.emit.apply(this,arguments)},add:function(e,t){var n=this;t||(t={}),X(n,t),e=n.beforeAdd(e,t)||e;var r=!1,i=n.recordId();P(e)&&!M(e)&&(e=[e],r=!0),e=e.map(function(e){var r=n.recordId(e);if(!D(r))throw new TypeError(i+": Expected string or number, found "+("undefined"==typeof r?"undefined":v.typeof(r))+"!");var o=n.get(r);if(e===o)return o;if(o){var a=t.onConflict||n.onConflict;"merge"===a?z(o,e):"replace"===a&&(G(o,function(t,n){n===i||e.hasOwnProperty(n)||delete o[n]}),o.set(e)),e=o,n.updateIndexes(e)}else e=n.mapper?n.mapper.createRecord(e,n.recordOpts):e,n.index.insertRecord(e),G(n.indexes,function(t,n){t.insertRecord(e)}),e&&L(e.on)&&e.on("all",n._onRecordEvent,n);return e});var o=r?e.length?e[0]:void 0:e;return n.emit("add",o),n.afterAdd(e,t,o)||o},afterAdd:function(){},afterRemove:function(){},afterRemoveAll:function(){},beforeAdd:function(){},beforeRemove:function(){},beforeRemoveAll:function(){},between:function(e,t,n){return this.query().between(e,t,n).run()},createIndex:function(e,t,n){var r=this;T(e)&&void 0===t&&(t=[e]),n||(n={}),n.hashCode=n.hashCode||function(e){return r.recordId(e)};var i=r.indexes[e]=new c(t,n);return r.index.visitAll(i.insertRecord,i),r},filter:function(e,t){return this.query().filter(e,t).run()},forEach:function(e,t){this.index.visitAll(e,t)},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()},getIndex:function(e){var t=e?this.indexes[e]:this.index;if(!t)throw new Error("Index "+e+" does not exist!");return t},limit:function(e){return this.query().limit(e).run()},map:function(e,t){var n=[];return this.index.visitAll(function(r){n.push(e.call(t,r))}),n},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},recordId:function(e){if(e)return U(e,this.recordId());var t=this;return t.mapper?t.mapper.idAttribute:t.idAttribute||"id"},query:function(){return new n(this)},reduce:function(e,t){var n=this.getAll();return n.reduce(e,t)},remove:function(e,t){var n=this;t||(t={}),n.beforeRemove(e,t);var r=n.get(e);return r&&(n.index.removeRecord(r),G(n.indexes,function(e,t){e.removeRecord(r)}),r&&L(r.off)&&(r.off("all",n._onRecordEvent,n),n.emit("remove",r))),n.afterRemove(e,t,r)||r},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.recordId(e),t)}),n.afterRemoveAll(e,t,r)||r},skip:function(e){return this.query().skip(e).run()},toJSON:function(e){return this.mapCall("toJSON",e)},updateIndex:function(e,t){t||(t={}),this.getIndex(t.index).updateRecord(e)},updateIndexes:function(e){var t=this;t.index.updateRecord(e),G(t.indexes,function(t,n){t.updateRecord(e)})}}),oe(f.prototype,function(){return this._listeners},function(e){this._listeners=e});var be="belongsTo",xe="hasMany",Ae="hasOne";ce(s.prototype,{getRelation:function(){return this.relatedMapper},getLocalKeys:function(e){},getForeignKey:function(e){return this.type===be?U(e,this.foreignKey):U(e,this.mapper.idAttribute)},setForeignKey:function(e,t){var n=this;e&&t&&(n.type===be?B(e,n.foreignKey,U(t,n.getRelation().idAttribute)):!function(){var r=n.mapper.idAttribute;M(t)?t.forEach(function(t){B(t,n.foreignKey,U(e,r))}):B(t,n.foreignKey,U(e,r))}())},getLocalField:function(e){return U(e,this.localField)},setLocalField:function(e,t){return B(e,this.localField,t)}});var _e=function(e,t,n){if(n||(n={}),!n.type)throw new Error("must specify relation type!");n.mapper=e,n.name=e.name;var r=new s(t,n);e.relationList||(e.relationList=[]),e.relationFields||(e.relationFields=[]),e.relationList.push(r),e.relationFields.push(r.localField)},we=function(e,t){return t||(t={}),t.type=be,function(n){_e(n,e,t)}},Oe=function(e,t){return t||(t={}),t.type=xe,function(n){_e(n,e,t)}},Re=function(e,t){return t||(t={}),t.type=Ae,function(n){_e(n,e,t)}};l.extend=fe,ce(l.prototype,{_mapper:function(){if(!this.constructor.Mapper)throw new Error("This RecordClass has no Mapper!");return this.constructor.Mapper},get:function(e){return U(this,e)},set:function(e,t,n){var r=this;P(e)&&(n=t),n||(n={}),n.silent&&r._set("silent",!0),B(r,e,t),r._get("eventId")||r._set("silent")},unset:function(e,t){this.set(e,void 0,t)},hashCode:function(){var e=this;return U(e,e._mapper().idAttribute)},changes:function(e){var t=this;return e?t._get("changes."+e):t._get("changes")},hasChanges:function(){return!!(this._get("changed")||[]).length},commit:function(){var e=this;return e._set("changed"),e._set("changes",{}),e._set("previous",re(e)),e},previous:function(e){var t=this;return e?t._get("previous."+e):t._get("previous")},revert:function(e){var t=this,n=t._get("previous")||{};return e||(e={}),e.preserve||(e.preserve=[]),G(t,function(r,i){i!==t._mapper().idAttribute&&!n.hasOwnProperty(i)&&t.hasOwnProperty(i)&&-1===e.preserve.indexOf(i)&&delete t[i]}),G(n,function(n,r){-1===e.preserve.indexOf(r)&&(t[r]=n)}),t.commit(),t},schema:function(e){var t=this._mapper().schema;return e?t[e]:t},create:function(e){return this._mapper().create(this,e)},beforeSave:function(){},save:function(e){var t=void 0,n=void 0,r=this,i=r._mapper();return e||(e={}),X(r,e),n=e.adapter=r.getAdapterName(e),t=e.op="beforeSave",H(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",H(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._mapper(),o=i.relationList||[];return e||(e=[]),t||(t={}),X(i,t),t.adapter=i.getAdapterName(t),n=t.op="beforeLoadRelations",H(r[n](e,t)).then(function(){return T(e)&&(e=[e]),n=t.op="loadRelations",i.dbg(n,r,e,t),Promise.all(o.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.getRelation().findAll(v.defineProperty({},e.foreignKey,U(r,i.idAttribute)),t);else if(e.foreignKey){var o=U(r,e.foreignKey);D(o)&&(n=e.getRelation().find(o,t))}else e.localKeys?n=e.getRelation().findAll(v.defineProperty({},e.getRelation().idAttribute,{in:U(r,e.localKeys)}),t):e.foreignKeys&&(n=e.getRelation().findAll(v.defineProperty({},e.getRelation().idAttribute,{contains:U(r,i.idAttribute)}),t));return n&&(n=n.then(function(n){t.raw&&(n=n.data),B(r,e.localField,"hasOne"===e.type?n.length?n[0]:void 0:n)})),n}))}).then(function(){return n=t.op="afterLoadRelations",H(r[n](e,t)).then(function(){return r})})},afterLoadRelations:function(){},destroy:function(e){var t=this._mapper();return t.destroy(U(this,t.idAttribute),e)},toJSON:function(e){var t=this,n=this.constructor.Mapper;if(n)return n.toJSON(this,e);var r=function(){var e={};return G(t,function(t,n){e[n]=re(t)}),{v:e}}();return"object"===("undefined"==typeof r?"undefined":v.typeof(r))?r.v:void 0}}),oe(l.prototype,function(){return this._get("events")},function(e){this._set("events",e)}),d.extend=fe;var Ce={array:M,boolean:q,integer:j,null:S,number:K,object:P,string:T},Ee={},Fe={},Ie=function(e,t){var n="";return e&&(n+=K(e)?"["+e+"]":t?"."+e:""+e),n},Me=function(e){e||(e={});var t="",n=e.path||[];return n.forEach(function(e){t+=Ie(e,t)}),t+=Ie(e.prop,t)},ke=function(e,t,n){return{expected:t,actual:""+e,path:Me(n)}},Le=function(e,t,n,r){r.push(ke(e,t,n))},je=function(e,t,n,r){var i=n[e];return t.length>i?ke(t.length,"length no more than "+i,r):void 0},Se=function(e,t,n,r){var i=n[e];return t.length<i?ke(t.length,"length no less than "+i,r):void 0},Ke=function(e,t,n,r){return!Q(n[e])&&Fe[e](t,n,r)},Pe=function(e,t,n,r){var i=[];return e.forEach(function(e){i=i.concat(Ke(e,t,n,r)||[])}),i.length?i:void 0},Ne=["enum","type","allOf","anyOf","oneOf","not"],De=["items","maxItems","minItems","uniqueItems"],Te=["multipleOf","maximum","minimum"],Qe=["maxProperties","minProperties","required","properties","dependencies"],qe=["maxLength","minLength","pattern"],Ue=function(e,t,n){return Pe(Ne,e,t,n)},Je=function e(t,n,r){var i=[];r||(r={});var o=void 0,a=r.prop;if(!Q(n)){if(!P(n))throw new Error('Invalid schema at path: "'+r.path+'"');return Q(r.path)&&(r.path=[]),Q(r.prop)||(o=!0,r.path.push(r.prop),r.prop=void 0),n.extends&&(i=L(n.extends.validate)?i.concat(n.extends.validate(t,r)||[]):i.concat(e(t,n.extends,r)||[])),Q(t)?(n.required===!0&&Le(t,"a value",r,i),o&&(r.path.pop(),r.prop=a),i.length?i:void 0):(i=i.concat(Ue(t,n,r)||[]),o&&(r.path.pop(),r.prop=a),i.length?i:void 0)}};d.types=Ce,d.typeGroupValidators=Ee,d.validationKeywords=Fe,d.validate=Je,d.prototype.validate=function(e,t){return d.validate(e,this,t)},Z(Fe,{allOf:function(e,t,n){var r=[];return t.allOf.forEach(function(t){r=r.concat(Je(e,t,n)||[])}),r.length?void 0:r},anyOf:function(e,t,n){var r=!1,i=[];return t.anyOf.forEach(function(t){var o=Je(e,t,n);o?i=i.concat(o):r=!0}),r?void 0:i},dependencies:function(e,t,n){},enum:function(e,t,n){var r=t.enum;return-1===r.indexOf(e)?ke(e,"one of ("+r.join(", ")+")",n):void 0},items:function e(t,n,r){r||(r={});for(var e=n.items,i=[],o=M(e),a=t.length,u=0;a>u;u++)o&&(e=n.items[u]),r.prop=u,i=i.concat(Je(t[u],e,r)||[]);return i.length?i:void 0},maximum:function e(t,n,r){var e=n.maximum,i=n.exclusiveMaximum;return("undefined"==typeof t?"undefined":v.typeof(t))===("undefined"==typeof e?"undefined":v.typeof(e))&&(i?t>e:t>=e)?ke(t,"no more than "+e,r):void 0},maxItems:function(e,t,n){return je("maxItems",e,t,n)},maxLength:function(e,t,n){return je("maxLength",e,t,n)},maxProperties:function e(t,n,r){var e=n.maxProperties,i=Object.keys(t).length;return i>e?ke(i,"no more than "+e+" properties",r):void 0},minimum:function e(t,n,r){var e=n.minimum,i=n.exclusiveMinimum;return("undefined"==typeof t?"undefined":v.typeof(t))===("undefined"==typeof e?"undefined":v.typeof(e))&&(i?e>t:e>=t)?ke(t,"no less than "+e,r):void 0},minItems:function(e,t,n){return Se("minItems",e,t,n)},minLength:function(e,t,n){return Se("minLength",e,t,n)},minProperties:function e(t,n,r){var e=n.minProperties,i=Object.keys(t).length;return e>i?ke(i,"no more than "+e+" properties",r):void 0},multipleOf:function(e,t,n){},not:function(e,t,n){return Je(e,t.not,n)?void 0:ke("succeeded","should have failed",n)},oneOf:function(e,t,n){var r=!1,i=[];return t.oneOf.forEach(function(t){var o=Je(e,t,n);if(o)i=i.concat(o);else{if(r)return i=[ke("valid against more than one","valid against only one",n)],r=!1,!1;r=!0}}),r?void 0:i},pattern:function e(t,n,r){var e=n.pattern;return T(t)&&!t.match(e)?ke(t,e,r):void 0},properties:function e(t,n,r){r||(r={});var i=Q(n.additionalProperties)?!0:n.additionalProperties,o={},e=n.properties||{},a=n.patternProperties||{},u=[];G(t,function(e,t){o[t]=void 0}),G(e||{},function(e,n){Q(t[n])&&!Q(e.default)&&(t[n]=re(e.default)),r.prop=n,u=u.concat(Je(t[n],e,r)||[]),delete o[n]}),G(a,function(e,n){G(o,function(i,a){a.match(n)&&(r.prop=a,u=u.concat(Je(t[a],e,r)||[]),delete o[a])})});var c=Object.keys(o);return i===!1?c.length&&Le("extra fields: "+c.join(", "),"no extra fields",r,u):P(i)&&c.forEach(function(e){r.prop=e,u=u.concat(Je(t[e],i,r)||[])}),u.length?u:void 0},required:function e(t,n,r){var e=n.required,i=[];return r.existingOnly||e.forEach(function(e){if(Q(U(t,e))){var n=r.prop;r.prop=e,Le(void 0,"a value",r,i),r.prop=n}}),i.length?i:void 0},type:function e(t,n,r){var e=n.type,i=void 0;if(T(e)&&(e=[e]),e.forEach(function(e){return Ce[e](t,n,r)?(i=e,!1):void 0}),!i)return ke(t?"undefined"==typeof t?"undefined":v.typeof(t):""+t,"one of ("+e.join(", ")+")",r);var o=Ee[i];return o?o(t,n,r):void 0},uniqueItems:function(e,t,n){if(e&&e.length&&t.uniqueItems){var r=e.length,i=void 0,o=void 0,a=void 0;for(o=r-1;o>0;o--)for(i=e[o],a=o-1;a>=0;a--)if(i===e[a])return ke(i,"no duplicates",n)}}}),Z(Ee,{array:function(e,t,n){return Pe(De,e,t,n)},integer:function(e,t,n){return Ee.numeric(e,t,n)},number:function(e,t,n){return Ee.numeric(e,t,n)},numeric:function(e,t,n){return Pe(Te,e,t,n)},object:function(e,t,n){return Pe(Qe,e,t,n)},string:function(e,t,n){return Pe(qe,e,t,n)}});var $e="changing",Be="changed",Ve="creating",Ge="eventId",ze="noValidate",He="silent",We="validation failed",Xe=function(e,t){var n={enumerable:Q(t.enumerable)?!0:!!t.enumerable},r="props."+e,i="previous."+e,o="changes."+e;return n.get=function(){return this._get(r)},n.set=function(n){var a=this,u=a._get,c=a._set,f=a._unset;if(!u(ze)){var s=t.validate(n);if(s){var l=new Error(We);throw l.errors=s,l}}return t.track&&!u(Ve)&&!function(){var t=u(i),s=u(r),l=u($e),d=u(Be);l||(d=[]);var p=d.indexOf(e);s!==n&&-1===p&&d.push(e),t!==n?c(o,n):(f(o),p>=0&&d.splice(p,1)),d.length||(l=!1,f($e),f(Be),u(Ge)&&(clearTimeout(u(Ge)),f(Ge))),!l&&d.length&&(c(Be,d),c($e,!0),c(Ge,setTimeout(function(){if(f(Be),f(Ge),f($e),!u(He)){var e=void 0;for(e=0;e<d.length;e++)a.emit("change:"+d[e],a,U(a,d[e]));a.emit("change",a,u("changes"))}f(He)},0)))}(),c(r,n),n},n},Ye=function(e,t){var n=e.properties||{};G(n,function(e,n){Object.defineProperty(t,n,Xe(n,e))})},Ze=function(){for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];var r=this,i=t[t.length-1];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))})},et=function(){for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];var r=this,i=t[t.length-2];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))})},tt={_adapters:null,_listeners:null,applySchema:!0,defaultAdapter:"http",debug:!1,idAttribute:"id",name:null,notify:!0,raw:!1,RecordClass:void 0,schema:null,upsert:!0};ce(p.prototype,{end:function(e,t){var n=this;t.raw&&X(t,e);var r=t.raw?e.data:e;return r=M(r)?r.map(function(e){return n.createRecord(e)}):n.createRecord(r),t.raw?e.data=r:e=r,t.notify&&setTimeout(function(){n.emit(t.op,e,t)}),e},createRecord:function(e,t){var n=this,r=n.RecordClass,i=n.relationList||[];return i.forEach(function(t){var n=t.getRelation(),r=t.getLocalField(e);M(r)&&r.length&&!n.is(r[0])?t.setLocalField(e,r.map(function(e){return t.getRelation().createRecord(e)})):P(r)&&!n.is(r)&&t.setLocalField(e,t.getRelation().createRecord(r))}),r?e instanceof r?e:new r(e,t):e},is:function(e){var t=this.RecordClass;return t?e instanceof t:!1},toJSON:function(e,t){var n=this;t||(t={});var r=(n?n.relationFields:[])||[],i={},o=void 0;return n&&n.schema&&(o=n.schema.properties||{},G(o,function(t,n){i[n]=ie(e[n])})),o||(o={}),t.strict||G(e,function(e,t){o[t]||-1!==r.indexOf(t)||(i[t]=ie(e))}),n&&t.withAll&&(t.with=r.slice()),n&&t.with&&(T(t.with)&&(t.with=[t.with]),le(n,t,function(t,n){var r=t.getLocalField(e);r&&(M(r)?t.setLocalField(i,r.map(function(e){return t.getRelation().toJSON(e,n)})):t.setLocalField(i,t.getRelation().toJSON(r,n)))})),i},getAdapter:function(e){var t=this;t.dbg("getAdapter","name:",e);var n=t.getAdapterName(e);if(!n)throw new ReferenceError(n+" not found!");return t.getAdapters()[n]},getAdapterName:function(e){return e||(e={}),T(e)&&(e={adapter:e}),e.adapter||e.defaultAdapter},getAdapters:function(){return this._adapters},getSchema:function(){return this.schema},beforeCreate:Ze,checkUpsertCreate:function(e,t){var n=this;return(t.upsert||void 0===t.upsert&&n.upsert)&&U(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(U(e,i.idAttribute),e,t):(X(i,t),r=t.adapter=i.getAdapterName(t),n=t.op="beforeCreate",H(i[n](e,t)).then(function(o){e=o||e;var a={};t.with||(t.with=[]);var u=[];return le(i,t,function(t,n){var r=t.getLocalField(e);t.type===be&&r&&u.push(t.getRelation().create(r,n).then(function(r){var i=n.raw?r.data:r;t.setLocalField(a,i),t.setForeignKey(e,i)}))}),Promise.all(u).then(function(){return n=t.op="create",i.dbg(n,e,t),H(i.getAdapter(r)[n](i,i.toJSON(e,{with:t.pass||[]}),t))}).then(function(n){var r=t.raw?n.data:n;return u=[],le(i,t,function(n,i){var o=n.getLocalField(e);if(o){var c=void 0;n.type===xe?(n.setForeignKey(r,o),c=n.getRelation().createMany(o,i).then(function(e){
n.setLocalField(r,t.raw?e.data:e)})):n.type===Ae?(n.setForeignKey(r,o),c=n.getRelation().create(o,i).then(function(e){n.setLocalField(r,t.raw?e.data:e)})):n.type===be&&n.getLocalField(a)&&n.setLocalField(r,n.getLocalField(a)),c&&u.push(c)}}),Promise.all(u).then(function(){return n})})}).then(function(r){return n=t.op="afterCreate",H(i[n](e,t,r)).then(function(e){return r=e||r,i.end(r,t)})}))},afterCreate:et,beforeCreateMany:Ze,checkUpsertCreateMany:function(e,t){var n=this;return t.upsert||void 0===t.upsert&&n.upsert?e.reduce(function(e,t){return e&&U(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):(X(i,t),r=t.adapter=i.getAdapterName(t),n=t.op="beforeCreateMany",H(i[n](e,t)).then(function(o){e=o||e;var a={};t.with||(t.with=[]);var u=[];return le(i,t,function(t,n){var r=e.map(function(e){return t.getLocalField(e)}).filter(function(e){return e});t.type===be&&r.length===e.length&&u.push(t.getRelation().createMany(r,n).then(function(r){var i=n.raw?r.data:r;t.setLocalField(a,i),e.forEach(function(e,n){t.setForeignKey(e,i[n])})}))}),Promise.all(u).then(function(){n=t.op="createMany";var o=e.map(function(e){return i.toJSON(e,{with:t.pass||[]})});return i.dbg(n,e,t),H(i.getAdapter(r)[n](i,o,t))}).then(function(n){var r=t.raw?n.data:n;return u=[],le(i,t,function(n,o){var c=e.map(function(e){return n.getLocalField(e)}).filter(function(e){return e});if(c.length===e.length){var f=n.getLocalField(a),s=void 0;n.type===xe?i.log("warn","deep createMany of hasMany type not supported!"):n.type===Ae?(r.forEach(function(e,t){n.setForeignKey(e,c[t])}),s=n.getRelation().createMany(c,o).then(function(e){var i=t.raw?e.data:e;r.forEach(function(e,t){n.setLocalField(e,i[t])})})):n.type===be&&f&&f.length===r.length&&r.forEach(function(e,t){n.setLocalField(e,f[t])}),s&&u.push(s)}}),Promise.all(u).then(function(){return n})})}).then(function(e){return n=t.op="afterCreateMany",H(i[n](e,t)).then(function(n){return e=n||e,i.end(e,t)})}))},afterCreateMany:et,beforeFind:Ze,find:function(e,t){var n=void 0,r=void 0,i=this;return t||(t={}),X(i,t),r=t.adapter=i.getAdapterName(t),n=t.op="beforeFind",H(i[n](e,t)).then(function(o){return e=void 0===o?e:o,n=t.op="find",i.dbg(n,e,t),H(i.getAdapter(r)[n](i,e,t))}).then(function(e){return n=t.op="afterFind",H(i[n](e,t)).then(function(n){return e=n||e,i.end(e,t)})})},afterFind:et,beforeFindAll:Ze,findAll:function(e,t){var n=void 0,r=void 0,i=this;return e||(e={}),t||(t={}),X(i,t),r=t.adapter=i.getAdapterName(t),n=t.op="beforeFindAll",H(i[n](e,t)).then(function(o){return e=o||e,n=t.op="findAll",i.dbg(n,e,t),H(i.getAdapter(r)[n](i,e,t))}).then(function(r){return n=t.op="afterFindAll",H(i[n](r,e,t)).then(function(e){return r=e||r,i.end(r,t)})})},afterFindAll:et,beforeUpdate:Ze,update:function(e,t,n){var r=void 0,i=void 0,o=this;return t||(t={}),n||(n={}),X(o,n),i=n.adapter=o.getAdapterName(n),r=n.op="beforeUpdate",H(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),H(o.getAdapter(i)[r](o,e,u,n))}).then(function(t){return r=n.op="afterUpdate",H(o[r](e,t,n)).then(function(e){return t=e||t,o.end(t,n)})})},afterUpdate:et,beforeUpdateMany:Ze,updateMany:function(e,t){var n=void 0,r=void 0,i=this;return e||(e=[]),t||(t={}),X(i,t),r=t.adapter=i.getAdapterName(t),n=t.op="beforeUpdateMany",H(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),H(i.getAdapter(r)[n](i,a,t))}).then(function(e){return n=t.op="afterUpdateMany",H(i[n](e,t)).then(function(n){return e=n||e,i.end(e,t)})})},afterUpdateMany:et,beforeUpdateAll:Ze,updateAll:function(e,t,n){var r=void 0,i=void 0,o=this;return e||(e={}),t||(t={}),n||(n={}),X(o,n),i=n.adapter=o.getAdapterName(n),r=n.op="beforeUpdateAll",H(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),H(o.getAdapter(i)[r](o,e,u,n))}).then(function(t){return r=n.op="afterUpdateAll",H(o[r](e,t,n)).then(function(e){return t=e||t,o.end(t,n)})})},afterUpdateAll:et,beforeDestroy:Ze,destroy:function(e,t){var n=void 0,r=void 0,i=this;return t||(t={}),X(i,t),r=t.adapter=i.getAdapterName(t),n=t.op="beforeDestroy",H(i[n](e,t)).then(function(o){return e=void 0===o?e:o,n=t.op="destroy",i.dbg(n,e,t),H(i.getAdapter(r)[n](i,e,t))}).then(function(r){return n=t.op="afterDestroy",H(i[n](e,t,r)).then(function(e){return r=e||r,t.raw?(X(t,r),r):r})})},afterDestroy:et,beforeDestroyAll:Ze,destroyAll:function(e,t){var n=void 0,r=void 0,i=this;return e||(e={}),t||(t={}),X(i,t),r=t.adapter=i.getAdapterName(t),n=t.op="beforeDestroyAll",H(i[n](e,t)).then(function(o){return e=o||e,n=t.op="destroyAll",i.dbg(n,e,t),H(i.getAdapter(r)[n](i,e,t))}).then(function(r){return n=t.op="afterDestroyAll",H(i[n](e,t,r)).then(function(e){return r=e||r,t.raw?(X(t,r),r):r})})},afterDestroyAll:et,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||"mapper")+")";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 we(e,t)(this)},hasMany:function(e,t){return Oe(e,t)(this)},hasOne:function(e,t){return Re(e,t)(this)},registerAdapter:function(e,t,n){var r=this;n||(n={}),r.getAdapters()[e]=t,(n===!0||n.default)&&(r.defaultAdapter=e)}}),p.extend=fe,oe(p.prototype,function(){return this._listeners},function(e){this._listeners=e});var nt=["create","createMany","createRecord","destroy","destroyAll","find","findAll","is","update","updateAll","updateMany"];h.extend=fe,ce(h.prototype,{defineMapper:function(e,t){var n=this;if(P(e)){if(t=e,!t.name)throw new Error("name is required!");e=t.name}else if(!T(e))throw new Error("name is required!");t||(t={}),t.name=e,t.relations||(t.relations={});var r=t.MapperClass||n.MapperClass;delete t.MapperClass,Z(t,n.mapperDefaults);var i=n._mappers[e]=new r(t);return i.name=e,i._adapters=n.getAdapters(),G(i.relations,function(e,t){G(e,function(e,r){P(e)&&(e=[e]),e.forEach(function(e){e.getRelation=function(){return n.getMapper(r)};var o=n._mappers[r]||r;t===be?i.belongsTo(o,e):t===Ae?i.hasOne(o,e):t===xe&&i.hasMany(o,e)})})}),i},getAdapter:function(e){var t=this,n=t.getAdapterName(e);if(!n)throw new ReferenceError(n+" not found!");return t.getAdapters()[n]},getAdapterName:function(e){return e||(e={}),T(e)&&(e={adapter:e}),e.adapter||this.mapperDefaults.defaultAdapter},getAdapters:function(){return this._adapters},getMapper:function(e){var t=this._mappers[e];if(!t)throw new ReferenceError(e+" is not a registered mapper!");return t},registerAdapter:function(e,t,n){var r=this;n||(n={}),r.getAdapters()[e]=t,(n===!0||n.default)&&(r.mapperDefaults.defaultAdapter=e,G(r._mappers,function(t){t.defaultAdapter=e}))}});var rt={};nt.forEach(function(e){rt[e]=function(t){for(var n,r=arguments.length,i=Array(r>1?r-1:0),o=1;r>o;o++)i[o-1]=arguments[o];return(n=this.getMapper(t))[e].apply(n,i)}}),ce(h.prototype,rt);var it=f.extend({constructor:function(e,t){var n=this;if(ae(n,it),se(n).call(n,e,t),n._added={},!n.datastore)throw new Error("This collection must have a datastore!");return n},_onRecordEvent:function(){for(var e=this,t=arguments.length,n=Array(t),r=0;t>r;r++)n[r]=arguments[r];se(e).prototype._onRecordEvent.apply(e,n);var i=n[0];T(i)&&0===i.indexOf("change")&&e.updateIndexes(n[1])},add:function(e,t){var n=this,r=n.datastore,i=n.mapper,o=i.relationList||[],a=(new Date).getTime(),u=!!i.RecordClass,c=void 0;return P(e)&&!M(e)&&(c=!0,e=[e]),o.length&&e.length&&i.relationList.forEach(function(t){var n=t.relation,i=r.getMapper(n),o=i.idAttribute,a=t.foreignKey,u=r.getCollection(n),c=t.type,f=c===xe,s=Q(t.add)?!0:!!t.add,l=void 0;e.forEach(function(e){if(l=t.getLocalField(e),L(t.add))t.add(r,t,e);else if(l){if(f)l=l.map(function(n){return n!==u.get(u.recordId(n))&&(a&&t.setForeignKey(e,n),s&&(n=u.add(n))),n}),t.localKeys&&B(e,t.localKeys,l.map(function(e){return U(e,o)}));else{var n=U(l,o);l!==u.get(n)&&(t.setForeignKey(e,l),s&&(l=u.add(l)))}t.setLocalField(e,l)}})}),e=se(n).prototype.add.call(n,e,t),e.forEach(function(e){n._added[n.recordId(e)]=a,u&&e._set("$",a)}),c?e[0]:e},remove:function(e,t){var n=this;delete n._added[e];var r=se(n).prototype.remove.call(n,e,t);if(r){var i=n.mapper;i.RecordClass&&r._set("$")}return r},removeAll:function(e,t){var n=this,r=se(n).prototype.removeAll.call(n,e,t);return r.forEach(function(e){delete n._added[n.recordId(e)]}),r}});it.extend=fe;var ot={linkRelations:C},at=h.extend({constructor:function(e){var t=this;return ae(t,at),se(t).call(t,e),t.CollectionClass=t.CollectionClass||it,t._collections={},Z(t,ot),t._pendingQueries={},t._completedQueries={},t},_callSuper: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 se(this).prototype[e].apply(this,n)},_end:function(e,t,n){return n.raw?(t.data=this.getCollection(e).add(t.data,n),t):t=this.getCollection(e).add(t,n)},create:function(e,t,n){var r=this;return n||(n={}),r._callSuper("create",e,t,n).then(function(t){return r._end(e,t,n)})},createMany:function(e,t,n){var r=this;return n||(n={}),r._callSuper("createMany",e,t,n).then(function(t){return r._end(e,t,n)})},defineMapper:function(e,t){var n=this,r=se(n).prototype.defineMapper.call(n,e,t);n._pendingQueries[e]={},n._completedQueries[e]={},r.relationList=r.relationList||[];var i=n._collections[e]=new n.CollectionClass(null,{_added:{},datastore:n,mapper:r}),o=r.schema||{},a=o.properties||{};G(a,function(e,t){e.indexed&&i.createIndex(t)}),i.createIndex("addedTimestamps",["$"],{fieldGetter:function(e){return i._added[i.recordId(e)]}});var u=n.linkRelations;return u&&r.relationList.forEach(function(e){var t=e.relation,o=e.localField,a="links."+o,c=e.foreignKey,f=e.type,s=Q(e.link)?u:e.link,l={index:c},d=void 0;f===be?(i.indexes[c]||i.createIndex(c),d={get:function(){var r=this;if(!r._get("$")||!s)return r._get(a);var i=e.getForeignKey(r),o=Q(i)?void 0:n.getCollection(t).get(i);return r._set(a,o),o},set:function(t){var n=this;return n._set(a,t),e.setForeignKey(n,t),i.updateIndex(n,l),e.getLocalField(n)}}):f===xe?!function(){var r=e.localKeys,o=e.foreignKeys;n._collections[t]&&c&&!n.getCollection(t).indexes[c]&&n.getCollection(t).createIndex(c),d={get:function(){var i=this;if(!i._get("$")||!s)return i._get(a);var u=e.getForeignKey(i),f=void 0,l=n.getCollection(t);if(c)f=l.getAll(u,{index:c});else if(r){var d=U(i,r)||[],p=M(d)?d:Object.keys(d);f=l.getAll.apply(l,p)}else if(o){var h={};B(h,"where."+o+".contains",u),f=l.filter(h)}return i._set(a,f),f},set:function(u){var f=this,s=i.recordId(f),d=n.getCollection(t);return f._set(a,u),c&&(e.setForeignKey(f,u),M(u)&&u.forEach(function(e){d.updateIndex(e,l)})),r?B(f,r,u.map(function(e){return d.recordId(e)})):o&&u.forEach(function(e){var t=U(e,o);t?-1===t.indexOf(s)&&t.push(s):B(e,o,[s])}),e.getLocalField(f)}}}():f===Ae&&(d={get:function(){var r=this;if(!r._get("$")||!s)return r._get(a);var i=e.getForeignKey(r),o=n.getCollection(t).getAll(i,{index:c}),u=o.length?o[0]:void 0;return r._set(a,u),u},set:function(r){var i=this;return i._set(a,r),e.setForeignKey(i,r),n.getCollection(t).updateIndex(r,l),e.getLocalField(i)}}),d&&(d.enumerable=Q(e.enumerable)?!0:e.enumerable,e.get&&!function(){var t=d.get;d.get=function(){var n=this;return e.get(e,this,function(){for(var e=arguments.length,r=Array(e),i=0;e>i;i++)r[i]=arguments[i];return t.apply(n,r)})}}(),e.set&&!function(){var t=d.set;d.set=function(n){var r=this;return e.set(e,this,n,function(e){return t.call(r,void 0===e?n:e)})}}(),Object.defineProperty(r.RecordClass.prototype,o,d))}),r},destroy:function(e,t,n){var r=this;return n||(n={}),r._callSuper("destroy",e,t,n).then(function(i){return n.raw?i.data=r.getCollection(e).remove(t,n):i=r.getCollection(e).remove(t,n),delete r._pendingQueries[e][t],delete r._completedQueries[e][t],i})},destroyAll:function(e,t,n){var r=this;return n||(n={}),r._callSuper("destroyAll",e,t,n).then(function(i){n.raw?i.data=r.getCollection(e).removeAll(t,n):i=r.getCollection(e).removeAll(t,n);var o=r.hashQuery(e,t,n);return delete r._pendingQueries[e][o],delete r._completedQueries[e][o],i})},find:function(e,t,n){var r=this;n||(n={});var i=r._pendingQueries[e][t];if(Z(n,r.getMapper(e)),i)return i;var o=r.cachedFind(e,t,n),a=void 0;return a=n.force||!o?r._pendingQueries[e][t]=r._callSuper("find",e,t,n).then(function(i){return delete r._pendingQueries[e][t],r._end(e,i,n)},function(n){return delete r._pendingQueries[e][t],W(n)}).then(function(n){return r._completedQueries[e][t]=(new Date).getTime(),n}):H(o)},findAll:function(e,t,n){var r=this;n||(n={});var i=r.hashQuery(e,t,n),o=r._pendingQueries[e][i];if(Z(n,r.getMapper(e)),o)return o;var a=r.cachedFindAll(e,t,n),u=void 0;return u=n.force||!a?r._pendingQueries[e][i]=r._callSuper("findAll",e,t,n).then(function(t){return delete r._pendingQueries[e][i],r._end(e,t,n)},function(t){return delete r._pendingQueries[e][i],W(t)}).then(function(t){return r._completedQueries[e][i]=(new Date).getTime(),t}):H(a)},cachedFind:function(e,t,n){return this.get(e,t,n)},cachedFindAll:function(e,t,n){var r=this;return r._completedQueries[e][r.hashQuery(e,t,n)]?r.filter(e,t,n):void 0},hashQuery:function(e,t,n){return ne(t)},getCollection:function(e){var t=this._collections[e];if(!t)throw new ReferenceError(e+" is not a registered collection!");return t},update:function(e,t,n,r){var i=this;return r||(r={}),i._callSuper("update",e,t,n,r).then(function(t){return i._end(e,t,r)})},updateAll:function(e,t,n,r){var i=this;return r||(r={}),i._callSuper("updateAll",e,t,n,r).then(function(t){return i._end(e,t,r)})},updateMany:function(e,t,n){var r=this;return n||(n={}),r._callSuper("updateMany",e,t,n).then(function(t){return r._end(e,t,n)})}});at.prototype.defineResource=at.prototype.defineMapper,at.extend=fe;var ut=["add","between","createIndex","filter","get","getAll","query","remove","removeAll","toJson"],ct={};ut.forEach(function(e){ct[e]=function(t){for(var n,r=arguments.length,i=Array(r>1?r-1:0),o=1;r>o;o++)i[o-1]=arguments[o];return(n=this.getCollection(t))[e].apply(n,i)}}),ct.inject=function(){return console.warn("deprecated"),this.add.apply(this,arguments)},ce(at.prototype,ct);var ft={full:"<%= pkg.version %>",major:parseInt("<%= major %>",10),minor:parseInt("<%= minor %>",10),patch:parseInt("<%= patch %>",10),alpha:"<%= alpha %>",beta:"<%= beta %>"},st=at;e.Collection=f,e.Container=h,e.DataStore=at,e.DS=st,e.LinkedCollection=it,e.Mapper=p,e.Query=n,e.Record=l,e.Schema=d,e.utils=pe,e.version=ft,e.belongsToType=be,e.hasManyType=xe,e.hasOneType=Ae,e.belongsTo=we,e.hasMany=Oe,e.hasOne=Re});
//# sourceMappingURL=dist/js-data.min.map
{
"name": "js-data",
"description": "Robust, framework-agnostic in-memory data store.",
"version": "3.0.0-alpha.15",
"version": "3.0.0-alpha.16",
"homepage": "http://www.js-data.io",

@@ -10,3 +10,3 @@ "repository": {

},
"author": "js-data Project Authors",
"author": "js-data project authors",
"license": "MIT",

@@ -43,3 +43,3 @@ "main": "./dist/js-data.js",

"doc": "jsdoc -c conf.json src && node scripts/cleanup.js",
"lint": "standard src/**/*.js test/**/*.js",
"lint": "standard src/**/*.js test/**/*.js scripts/*.js",
"helpers": "node scripts/helpers.js",

@@ -62,7 +62,7 @@ "min": "uglifyjs dist/js-data.js -o dist/js-data.min.js --source-map dist/js-data.min.map -v -m -c --screw-ie8",

"devDependencies": {
"babel-core": "6.5.2",
"babel-core": "6.6.4",
"babel-eslint": "5.0.0",
"babel-plugin-syntax-async-functions": "6.5.0",
"babel-plugin-transform-regenerator": "6.5.2",
"babel-polyfill": "6.5.0",
"babel-plugin-transform-regenerator": "6.6.0",
"babel-polyfill": "6.6.1",
"babel-preset-es2015-rollup": "1.1.1",

@@ -72,4 +72,4 @@ "babel-preset-stage-0": "6.5.0",

"codacy-coverage": "1.1.3",
"coveralls": "2.11.6",
"ink-docstrap": "1.1.2",
"coveralls": "2.11.8",
"ink-docstrap": "1.1.4",
"istanbul": "0.4.2",

@@ -79,9 +79,9 @@ "jsdoc": "3.4.0",

"rollup": "0.25.4",
"rollup-plugin-babel": "2.3.9",
"rollup-plugin-babel": "2.4.0",
"sinon": "1.17.3",
"source-map-support": "0.4.0",
"standard": "6.0.7",
"uglify-js": "2.6.1"
"uglify-js": "2.6.2"
},
"dependencies": {}
}

@@ -206,5 +206,6 @@ <img src="https://raw.githubusercontent.com/js-data/js-data/master/js-data.png" alt="js-data logo" title="js-data" align="right" width="96" height="96" />

Copyright (c) 2014-2016 js-data Project Authors
Copyright (c) 2014-2016 js-data project authors
* [LICENSE](https://github.com/js-data/js-data/blob/master/LICENSE)
* [AUTHORS](https://github.com/js-data/js-data/blob/master/AUTHORS)
* [CONTRIBUTORS](https://github.com/js-data/js-data/blob/master/CONTRIBUTORS)

@@ -9,6 +9,7 @@ import babel from 'rollup-plugin-babel'

moduleName: 'JSDataTests',
external: 'chai:chai',
plugins: [
babel()
babel({
exclude: 'node_modules/**'
})
]
}

@@ -9,5 +9,8 @@ import babel from 'rollup-plugin-babel'

moduleName: 'JSData',
moduleId: 'js-data',
plugins: [
babel()
babel({
exclude: 'node_modules/**'
})
]
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc