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.17 to 3.0.0-alpha.18

7

CHANGELOG.md

@@ -0,1 +1,8 @@

##### 3.0.0-alpha.18 - 12 March 2016
###### Backwards compatible API changes
- Improved forEachRelation utility function to support filtering on "with" sub queries
- Added deepFillIn utility function
- Made some Mapper instance properties non-enumerable
##### 3.0.0-alpha.17 - 10 March 2016

@@ -2,0 +9,0 @@

6

dist/js-data.min.js
/*!
* js-data
* @version 3.0.0-alpha.17 - Homepage <http://www.js-data.io/>
* @version 3.0.0-alpha.18 - Homepage <http://www.js-data.io/>
* @author js-data project authors

@@ -10,4 +10,4 @@ * @copyright (c) 2014-2016 js-data project authors

*/
!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=[]),!j(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)&&!j(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 J(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===xe))throw new Error("foreignKey is required");var o=t.localKeys,a=t.foreignKeys;if(!i&&!o&&!a&&t.type===_e)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 J(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]",_="[object Function]",x="[object Number]",A="[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},j=Array.isArray,M=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)===_},k=function(e){return E(e)===x&&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)===x},P=function(e){return E(e)===A},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},J=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]}},U=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?U(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(j(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{j(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&&(j(t)?n=e(t,[],r,i,o,a):M(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:j,isDate:M,isFunction:L,isInteger:k,isNull:S,isNumber:K,isObject:P,isRegExp:N,isSorN:D,isString:T,isUndefined:Q,isBoolean:q,get:J,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=J(n,i[0]),a=J(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&&!j(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(J(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"]]),j(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){j(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){j(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];j(e)||(e=[e]),j(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 f=a.index;f<this.keys.length;f+=1){var s=this.keys[f];if(s>o)break;if(r=this.values[f].isIndex?s===i?r.concat(this.values[f]._between(re(e),t.map(function(){}),n)):s===o?r.concat(this.values[f]._between(e.map(function(){}),re(t),n)):r.concat(this.values[f].getAll()):r.concat(this.values[f]),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)&&!j(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 J(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",_e="hasMany",xe="hasOne";ce(s.prototype,{getRelation:function(){return this.relatedMapper},getLocalKeys:function(e){},getForeignKey:function(e){return this.type===be?J(e,this.foreignKey):J(e,this.mapper.idAttribute)},setForeignKey:function(e,t){var n=this;e&&t&&(n.type===be?B(e,n.foreignKey,J(t,n.getRelation().idAttribute)):!function(){var r=n.mapper.idAttribute;j(t)?t.forEach(function(t){B(t,n.foreignKey,J(e,r))}):B(t,n.foreignKey,J(e,r))}())},getLocalField:function(e){return J(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 s(t,n);e.relationList||Object.defineProperty(e,"relationList",{value:[]}),e.relationFields||Object.defineProperty(e,"relationFields",{value:[]}),e.relationList.push(r),e.relationFields.push(r.localField)},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=_e,function(n){Ae(n,e,t)}},Re=function(e,t){return t||(t={}),t.type=xe,function(n){Ae(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 J(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 J(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,J(r,i.idAttribute)),t);else if(e.foreignKey){var o=J(r,e.foreignKey);D(o)&&(n=e.getRelation().find(o,t))}else e.localKeys?n=e.getRelation().findAll(v.defineProperty({},e.getRelation().idAttribute,{in:J(r,e.localKeys)}),t):e.foreignKeys&&(n=e.getRelation().findAll(v.defineProperty({},e.getRelation().idAttribute,{contains:J(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(J(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:j,boolean:q,integer:k,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},je=function(e){e||(e={});var t="",n=e.path||[];return n.forEach(function(e){t+=Ie(e,t)}),t+=Ie(e.prop,t)},Me=function(e,t,n){return{expected:t,actual:""+e,path:je(n)}},Le=function(e,t,n,r){r.push(Me(e,t,n))},ke=function(e,t,n,r){var i=n[e];return t.length>i?Me(t.length,"length no more than "+i,r):void 0},Se=function(e,t,n,r){var i=n[e];return t.length<i?Me(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"],Je=function(e,t,n){return Pe(Ne,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&&Le(t,"a value",r,i),o&&(r.path.pop(),r.prop=a),i.length?i:void 0):(i=i.concat(Je(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=Ue,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(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=j(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 ke("maxItems",e,t,n)},maxLength:function(e,t,n){return ke("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 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?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&&Le("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(J(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 Me(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 Me(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,J(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:C,raw:!1,RecordClass:void 0,schema:null};ce(p.prototype,{_end:function(e,t){var n=this;t.raw&&X(t,e);var r=t.raw?e.data:e;return j(r)&&r.length&&P(r[0])?r=r.map(function(e){return n.createRecord(e)}):P(r)&&(r=n.createRecord(r)),t.raw?e.data=r:e=r,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);j(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&&(j(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,create: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="beforeCreate",H(i[n](e,t)).then(function(o){e=Q(o)?e:o;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===_e?(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===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 r=i._end(r,t),n=t.op="afterCreate",H(i[n](e,t,r)).then(function(e){return Q(e)?r:e})})},afterCreate:et,beforeCreateMany:Ze,createMany: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="beforeCreateMany",H(i[n](e,t)).then(function(o){e=Q(o)?e:o;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===_e?i.log("warn","deep createMany of hasMany type not supported!"):n.type===xe?(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(r){return r=i._end(r,t),n=t.op="afterCreateMany",H(i[n](e,t,r)).then(function(e){return Q(e)?r:e})})},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(){return n=t.op="find",i.dbg(n,e,t),H(i.getAdapter(r)[n](i,e,t))}).then(function(r){return r=i._end(r,t),n=t.op="afterFind",H(i[n](e,t,r)).then(function(e){return Q(e)?r:e})})},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(){return n=t.op="findAll",i.dbg(n,e,t),H(i.getAdapter(r)[n](i,e,t))}).then(function(r){return r=i._end(r,t),n=t.op="afterFindAll",H(i[n](e,t,r)).then(function(e){return Q(e)?r:e})})},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=Q(a)?t:a,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(i){return i=o._end(i,n),r=n.op="afterUpdate",H(o[r](e,t,n,i)).then(function(e){return Q(e)?i:e})})},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=Q(o)?e:o,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(r){return r=i._end(r,t),n=t.op="afterUpdateMany",H(i[n](e,t,r)).then(function(e){return Q(e)?r:e})})},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){e=Q(a)?e:a,r=n.op="updateAll";var u=o.toJSON(e,n);return o.dbg(r,u,t,n),H(o.getAdapter(i)[r](o,u,t,n))}).then(function(i){return i=o._end(i,n),r=n.op="afterUpdateAll",H(o[r](e,t,n,i)).then(function(e){return Q(e)?i:e})})},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(){return n=t.op="destroy",i.dbg(n,e,t),H(i.getAdapter(r)[n](i,e,t))}).then(function(r){return t.raw&&X(t,r),n=t.op="afterDestroy",H(i[n](e,t,r)).then(function(e){return Q(e)?r:e})})},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(){return n=t.op="destroyAll",i.dbg(n,e,t),H(i.getAdapter(r)[n](i,e,t))}).then(function(r){return t.raw&&X(t,r),n=t.op="afterDestroyAll",H(i[n](e,t,r)).then(function(e){return Q(e)?r:e})})},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===xe?i.hasOne(o,e):t===_e&&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)&&!j(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===_e,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 J(e,o)}));else{var n=J(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||Object.defineProperty(r,"relationList",{value:[]});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===_e?!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=J(i,r)||[],p=j(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),j(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=J(e,o);t?-1===t.indexOf(s)&&t.push(s):B(e,o,[s])}),e.getLocalField(f)}}}():f===xe&&(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:"3.0.0-alpha.17",major:parseInt("3",10),minor:parseInt("0",10),patch:parseInt("0",10),alpha:"17",beta:"false"},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=_e,e.hasOneType=xe,e.belongsTo=we,e.hasMany=Oe,e.hasOne=Re});
!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){ae(this,t),this.collection=e,this.data=null}function n(e){return e.replace(ye,"\\$1")}function r(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 i(e,t,n){return e.splice(t,0,n),e}function o(e,t){return e.splice(t,1),e}function a(e,t,n){for(var i=0,o=e.length,a=void 0,u=void 0;o>i;){if(u=(i+o)/2|0,a=r(t,e[u],n),0===a)return{found:!0,index:u};0>a?o=u:i=u+1}return{found:!1,index:o}}function u(e,t){if(ae(this,u),e||(e=[]),!I(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 c(e,t){var n=this;ae(n,c),P(e)&&!I(e)&&(t=e,e=[]),D(t)&&(t={idAttribute:t}),e||(e=[]),t||(t={}),t.recordOpts||(t.recordOpts={}),Z(n,t),Z(n,_e),n._listeners={};var r=n.recordId();n.index=new u([r],{hashCode:function(e){return q(e,r)}}),n.indexes={},e.forEach(function(e){e=n.mapper?n.mapper.createRecord(e,n.recordOpts):e,n.index.insertRecord(e),e&&M(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===xe||t.type===we))throw new Error("foreignKey is required");var o=t.localKeys,a=t.foreignKeys;if(!i&&!o&&!a&&t.type===Ae)throw new Error("one of (foreignKey, localKeys, foreignKeys) is required");if(D(e)){if(t.relation=e,!M(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 s(e,t){var n=this;ae(n,s),e||(e={}),t||(t={});var r={};Object.defineProperties(n,{_get:{value:function(e){return q(r,e)}},_set:{value:function(e,t){return $(r,e,t)}},_unset:{value:function(e){return B(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 l(e){e||(e={}),Z(this,e),e.properties&&V(e.properties,function(t,n){t instanceof l||(e.properties[n]=new l(t))})}function d(e){var t=this;if(ae(t,d),e||(e={}),Object.defineProperty(t,"_adapters",{value:void 0,writable:!0}),Object.defineProperty(t,"_listeners",{value:void 0,writable:!0}),Object.defineProperty(t,"RecordClass",{value:void 0,writable:!0}),Z(t,e),Z(t,re(rt)),!t.name)throw new Error("mapper cannot function without a name!");t._adapters||(t._adapters={}),t._listeners||(t._listeners={}),t.schema instanceof l||(t.schema=new l(t.schema||{})),T(t.RecordClass)&&(t.RecordClass=s.extend()),t.RecordClass&&(t.RecordClass.Mapper=t,se(t.RecordClass,!0)===s&&t.applySchema&&et(t.schema,t.RecordClass.prototype))}function p(e){var t=this;ae(t,p),e||(e={}),Z(t,e),t.mapperDefaults=t.mapperDefaults||{},t.MapperClass=t.MapperClass||d,t._adapters={},t._mappers={}}var h={};h.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},h.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 v=1/0,g=1.7976931348623157e308,y="[object Boolean]",m="[object Date]",b="[object Function]",_="[object Number]",x="[object Object]",A="[object RegExp]",w="[object String]",O=Object.prototype.toString,R=void 0;try{R=!!window}catch(e){R=!1}var C=function(e){return O.call(e)},E=function(e){if(!e)return 0===e?e:0;if(e=+e,e===v||e===-v){var t=0>e?-1:1;return t*g}var n=e%1;return e===e?n?e-n:e:0},F=function(e){return!!e&&"object"===("undefined"==typeof e?"undefined":h.typeof(e))&&e.constructor===Object},I=Array.isArray,j=function(e){return e&&"object"===("undefined"==typeof e?"undefined":h.typeof(e))&&C(e)===m},M=function(e){return"function"==typeof e||e&&C(e)===b},L=function(e){return C(e)===_&&e==E(e)},k=function(e){return null===e},S=function(e){var t="undefined"==typeof e?"undefined":h.typeof(e);return"number"===t||e&&"object"===t&&C(e)===_},P=function(e){return C(e)===x},K=function(e){return C(e)===A},N=function(e){return D(e)||S(e)},D=function(e){return"string"==typeof e||e&&"object"===("undefined"==typeof e?"undefined":h.typeof(e))&&C(e)===w},T=function(e){return void 0===e},Q=function(e){return C(e)===y},q=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},U=/^(.+)\.(.+)$/,$=function e(t,n,r){if(P(n))V(n,function(n,r){e(t,r,n)});else{var i=U.exec(n);i?J(t,i[1])[i[2]]=r:t[n]=r}},B=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]},V=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)},G=function e(t,n){return n&&V(n,function(t,n){var r=this[n];F(t)&&F(r)?e(r,t):this[n]=t},t),t},z=function e(t,n){return n&&V(n,function(t,n){var r=this[n];F(t)&&F(r)?e(r,t):this.hasOwnProperty(n)&&void 0!==this[n]||(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]&&!M(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){V(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]"===C(t[r])&&t[r].test(e)||t[r]===e)return n=e;return!!n},te=function(e){return D(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(I(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{I(n)?n.length=0:V(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&&(I(t)?n=e(t,[],r,i,o,a):j(t)?n=new Date(t.getTime()):K(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":h.typeof(t))&&"function"!=typeof t?e:t},ce=function(e,t){V(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:V(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,t){var n=-1;return e.forEach(function(e,r){return e===t?(n=r,!1):P(e)&&e.relation===t?(n=r,!1):void 0}),n},de=function(e,t,n,r){var i=t.relation,o=null,a=void 0;if(e||(e={}),e.with||(e.with=[]),(a=le(e.with,i))>=0?o=i:(a=le(e.with,t.localField))>=0&&(o=t.localField),e.withAll)return void n.call(r,t,{});if(o){var u={};Z(u,t.getRelation()),Z(u,e),u.with=e.with.slice(),u._activeWith=u.with.splice(a,1)[0],u.with.forEach(function(e,t){e&&0===e.indexOf(o)&&e.length>=o.length&&"."===e[o.length]?u.with[t]=e.substr(o.length+1):u.with[t]=""}),n.call(r,t,u)}},pe=function(e,t,n,r){var i=e.relationList||[];i.length&&i.forEach(function(e){de(t,e,n,r)})},he=function(e,t){var n={};return V(e,function(e,r){-1===t.indexOf(r)&&(n[r]=e)}),n},ve=Object.freeze({get isBrowser(){return R},isArray:I,isDate:j,isFunction:M,isInteger:L,isNull:k,isNumber:S,isObject:P,isRegExp:K,isSorN:N,isString:D,isUndefined:T,isBoolean:Q,get:q,set:$,unset:B,forOwn:V,deepMixIn:G,deepFillIn: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:pe,omit:he});t.extend=fe;var ge={skip:"",offset:"",where:"",limit:"",orderBy:"",sort:""},ye=/([.*+?^=!:${}()|[\]\/\\])/g,me=/%/g,be=/_/g;t.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(t.prototype,{compare:function(e,t,n,r){var i=e[t],o=q(n,i[0]),a=q(r,i[0]);return o&&D(o)&&(o=o.toUpperCase()),a&&D(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,n,r){return t.ops[n]?t.ops[n](e,r):0===n.indexOf("like")?!k(this.like(r,n.substr(4)).exec(e)):0===n.indexOf("notLike")?k(this.like(r,n.substr(7)).exec(e)):void 0},like:function(e,t){return new RegExp("^"+n(e).replace(me,".*").replace(be,".")+"$",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&&!I(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),V(e,function(e,n){n in ge||n in t||(t[n]={"==":e})});var r=[],i=[],o=[];V(t,function(e,t){P(e)||(e={"==":e}),V(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(q(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;D(a)&&(a=[[a,"ASC"]]),I(a)||(a=null),a&&!function(){var e=0;a.forEach(function(e,t){D(e)&&(a[t]=[e,"ASC"])}),n.data.sort(function(t,r){return n.compare(a,e,t,r)})}(),S(e.skip)?n.skip(e.skip):S(e.offset)&&n.skip(e.offset),S(e.limit)&&n.limit(e.limit)}():M(e)&&(n.data=n.data.filter(e,t)),n},skip:function(e){if(!S(e))throw new TypeError("skip: Expected number but found "+("undefined"==typeof e?"undefined":h.typeof(e))+"!");var t=this.getData();return e<t.length?this.data=t.slice(e):this.data=[],this},limit:function(e){if(!S(e))throw new TypeError("limit: Expected number but found "+("undefined"==typeof e?"undefined":h.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(u.prototype,{set:function(e,t){I(e)||(e=[e]);var n=e.shift()||null,r=a(this.keys,n);if(0===e.length)if(r.found){var o=a(this.values[r.index],t,this.hashCode);o.found||i(this.values[r.index],o.index,t)}else i(this.keys,r.index,n),i(this.values,r.index,[t]);else if(r.found)this.values[r.index].set(e,t);else{i(this.keys,r.index,n);var c=new u([],{hashCode:this.hashCode});c.set(e,t),i(this.values,r.index,c)}},get:function(e){I(e)||(e=[e]);var t=e.shift()||null,n=a(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];I(e)||(e=[e]),I(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(),u=void 0;if(u=void 0!==i?a(this.keys,i):{found:!1,index:0},0===e.length){u.found&&n.leftInclusive===!1&&(u.index+=1);for(var c=u.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 f=u.index;f<this.keys.length;f+=1){var s=this.keys[f];if(s>o)break;if(r=this.values[f].isIndex?s===i?r.concat(this.values[f]._between(re(e),t.map(function(){}),n)):s===o?r.concat(this.values[f]._between(e.map(function(){}),re(t),n)):r.concat(this.values[f].getAll()):r.concat(this.values[f]),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 M(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&&(o(t.keys,i),o(t.values,i)),n=!0,!1}else{var u=a(r,e,t.hashCode);if(u.found)return o(r,u.index),0===r.length&&(o(t.keys,i),o(t.values,i)),n=!0,!1}}),n?e:void 0},updateRecord:function(e){this.removeRecord(e),this.insertRecord(e)}});var _e={idAttribute:"id",mapper:null,onConflict:"merge",recordOpts:null};c.extend=fe,ce(c.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)&&!I(e)&&(e=[e],r=!0),e=e.map(function(e){var r=n.recordId(e);if(!N(r))throw new TypeError(i+": Expected string or number, found "+("undefined"==typeof r?"undefined":h.typeof(r))+"!");var o=n.get(r);if(e===o)return o;if(o){var a=t.onConflict||n.onConflict;"merge"===a?G(o,e):"replace"===a&&(V(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),V(n.indexes,function(t,n){t.insertRecord(e)}),e&&M(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;D(e)&&void 0===t&&(t=[e]),n||(n={}),n.hashCode=n.hashCode||function(e){return r.recordId(e)};var i=r.indexes[e]=new u(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 q(e,this.recordId());var t=this;return t.mapper?t.mapper.idAttribute:t.idAttribute||"id"},query:function(){return new t(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),V(n.indexes,function(e,t){e.removeRecord(r)}),r&&M(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),V(t.indexes,function(t,n){t.updateRecord(e)})}}),oe(c.prototype,function(){return this._listeners},function(e){this._listeners=e});var xe="belongsTo",Ae="hasMany",we="hasOne";ce(f.prototype,{getRelation:function(){return this.relatedMapper},getLocalKeys:function(e){},getForeignKey:function(e){return this.type===xe?q(e,this.foreignKey):q(e,this.mapper.idAttribute)},setForeignKey:function(e,t){var n=this;e&&t&&(n.type===xe?$(e,n.foreignKey,q(t,n.getRelation().idAttribute)):!function(){var r=n.mapper.idAttribute;I(t)?t.forEach(function(t){$(t,n.foreignKey,q(e,r))}):$(t,n.foreignKey,q(e,r))}())},getLocalField:function(e){return q(e,this.localField)},setLocalField:function(e,t){return $(e,this.localField,t)}});var Oe=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||Object.defineProperty(e,"relationList",{value:[]}),e.relationFields||Object.defineProperty(e,"relationFields",{value:[]}),e.relationList.push(r),e.relationFields.push(r.localField)},Re=function(e,t){return t||(t={}),t.type=xe,function(n){Oe(n,e,t)}},Ce=function(e,t){return t||(t={}),t.type=Ae,function(n){Oe(n,e,t)}},Ee=function(e,t){return t||(t={}),t.type=we,function(n){Oe(n,e,t)}};s.extend=fe,ce(s.prototype,{_mapper:function(){if(!this.constructor.Mapper)throw new Error("This RecordClass has no Mapper!");return this.constructor.Mapper},get:function(e){return q(this,e)},set:function(e,t,n){var r=this;P(e)&&(n=t),n||(n={}),n.silent&&r._set("silent",!0),$(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 q(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=[]),V(t,function(r,i){i!==t._mapper().idAttribute&&!n.hasOwnProperty(i)&&t.hasOwnProperty(i)&&-1===e.preserve.indexOf(i)&&delete t[i]}),V(n,function(n,r){-1===e.preserve.indexOf(r)&&(t[r]=n)}),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 D(e)&&(e=[e]),n=t.op="loadRelations",i.dbg(n,r,e,t),Promise.all(o.map(function(e){if(M(e.load))return e.load(i,e,r,t);var n=void 0;if("hasMany"===e.type&&e.foreignKey)n=e.getRelation().findAll(h.defineProperty({},e.foreignKey,q(r,i.idAttribute)),t);else if(e.foreignKey){var o=q(r,e.foreignKey);N(o)&&(n=e.getRelation().find(o,t))}else e.localKeys?n=e.getRelation().findAll(h.defineProperty({},e.getRelation().idAttribute,{in:q(r,e.localKeys)}),t):e.foreignKeys&&(n=e.getRelation().findAll(h.defineProperty({},e.getRelation().idAttribute,{contains:q(r,i.idAttribute)}),t));return n&&(n=n.then(function(n){t.raw&&(n=n.data),$(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(q(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 V(t,function(t,n){e[n]=re(t)}),{v:e}}();return"object"===("undefined"==typeof r?"undefined":h.typeof(r))?r.v:void 0}}),oe(s.prototype,function(){return this._get("events")},function(e){this._set("events",e)}),l.extend=fe;var Fe={array:I,boolean:Q,integer:L,null:k,number:S,object:P,string:D},Ie={},je={},Me=function(e,t){var n="";return e&&(n+=S(e)?"["+e+"]":t?"."+e:""+e),n},Le=function(e){e||(e={});var t="",n=e.path||[];return n.forEach(function(e){t+=Me(e,t)}),t+=Me(e.prop,t)},ke=function(e,t,n){return{expected:t,actual:""+e,path:Le(n)}},Se=function(e,t,n,r){r.push(ke(e,t,n))},Pe=function(e,t,n,r){var i=n[e];return t.length>i?ke(t.length,"length no more than "+i,r):void 0},Ke=function(e,t,n,r){var i=n[e];return t.length<i?ke(t.length,"length no less than "+i,r):void 0},Ne=function(e,t,n,r){return!T(n[e])&&je[e](t,n,r)},De=function(e,t,n,r){var i=[];return e.forEach(function(e){i=i.concat(Ne(e,t,n,r)||[])}),i.length?i:void 0},Te=["enum","type","allOf","anyOf","oneOf","not"],Qe=["items","maxItems","minItems","uniqueItems"],qe=["multipleOf","maximum","minimum"],Je=["maxProperties","minProperties","required","properties","dependencies"],Ue=["maxLength","minLength","pattern"],$e=function(e,t,n){return De(Te,e,t,n)},Be=function e(t,n,r){var i=[];r||(r={});var o=void 0,a=r.prop;if(!T(n)){if(!P(n))throw new Error('Invalid schema at path: "'+r.path+'"');return T(r.path)&&(r.path=[]),T(r.prop)||(o=!0,r.path.push(r.prop),r.prop=void 0),n.extends&&(i=M(n.extends.validate)?i.concat(n.extends.validate(t,r)||[]):i.concat(e(t,n.extends,r)||[])),T(t)?(n.required===!0&&Se(t,"a value",r,i),o&&(r.path.pop(),r.prop=a),i.length?i:void 0):(i=i.concat($e(t,n,r)||[]),o&&(r.path.pop(),r.prop=a),i.length?i:void 0)}};l.types=Fe,l.typeGroupValidators=Ie,l.validationKeywords=je,l.validate=Be,l.prototype.validate=function(e,t){return l.validate(e,this,t)},Z(je,{allOf:function(e,t,n){var r=[];return t.allOf.forEach(function(t){r=r.concat(Be(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=Be(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=I(e),a=t.length,u=0;a>u;u++)o&&(e=n.items[u]),r.prop=u,i=i.concat(Be(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":h.typeof(t))===("undefined"==typeof e?"undefined":h.typeof(e))&&(i?t>e:t>=e)?ke(t,"no more than "+e,r):void 0},maxItems:function(e,t,n){return Pe("maxItems",e,t,n)},maxLength:function(e,t,n){return Pe("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":h.typeof(t))===("undefined"==typeof e?"undefined":h.typeof(e))&&(i?e>t:e>=t)?ke(t,"no less than "+e,r):void 0},minItems:function(e,t,n){return Ke("minItems",e,t,n)},minLength:function(e,t,n){return Ke("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 Be(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=Be(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 D(t)&&!t.match(e)?ke(t,e,r):void 0},properties:function e(t,n,r){r||(r={});var i=T(n.additionalProperties)?!0:n.additionalProperties,o={},e=n.properties||{},a=n.patternProperties||{},u=[];V(t,function(e,t){o[t]=void 0}),V(e||{},function(e,n){T(t[n])&&!T(e.default)&&(t[n]=re(e.default)),r.prop=n,u=u.concat(Be(t[n],e,r)||[]),delete o[n]}),V(a,function(e,n){V(o,function(i,a){a.match(n)&&(r.prop=a,u=u.concat(Be(t[a],e,r)||[]),delete o[a])})});var c=Object.keys(o);return i===!1?c.length&&Se("extra fields: "+c.join(", "),"no extra fields",r,u):P(i)&&c.forEach(function(e){r.prop=e,u=u.concat(Be(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(T(q(t,e))){var n=r.prop;r.prop=e,Se(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(D(e)&&(e=[e]),e.forEach(function(e){return Fe[e](t,n,r)?(i=e,!1):void 0}),!i)return ke(t?"undefined"==typeof t?"undefined":h.typeof(t):""+t,"one of ("+e.join(", ")+")",r);var o=Ie[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(Ie,{array:function(e,t,n){return De(Qe,e,t,n)},integer:function(e,t,n){return Ie.numeric(e,t,n)},number:function(e,t,n){return Ie.numeric(e,t,n)},numeric:function(e,t,n){return De(qe,e,t,n)},object:function(e,t,n){return De(Je,e,t,n)},string:function(e,t,n){return De(Ue,e,t,n)}});var Ve="changing",Ge="changed",ze="creating",He="eventId",We="noValidate",Xe="silent",Ye="validation failed",Ze=function(e,t){var n={enumerable:T(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(We)){var s=t.validate(n);if(s){var l=new Error(Ye);throw l.errors=s,l}}return t.track&&!u(ze)&&!function(){var t=u(i),s=u(r),l=u(Ve),d=u(Ge);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(Ve),f(Ge),u(He)&&(clearTimeout(u(He)),f(He))),!l&&d.length&&(c(Ge,d),c(Ve,!0),c(He,setTimeout(function(){if(f(Ge),f(He),f(Ve),!u(Xe)){var e=void 0;for(e=0;e<d.length;e++)a.emit("change:"+d[e],a,q(a,d[e]));a.emit("change",a,u("changes"))}f(Xe)},0)))}(),c(r,n),n},n},et=function(e,t){var n=e.properties||{};V(n,function(e,n){Object.defineProperty(t,n,Ze(n,e))})},tt=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))})},nt=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))})},rt={applySchema:!0,defaultAdapter:"http",debug:!1,idAttribute:"id",name:null,notify:R,raw:!1,schema:null};ce(d.prototype,{_end:function(e,t){var n=this;t.raw&&X(t,e);var r=t.raw?e.data:e;return I(r)&&r.length&&P(r[0])?r=r.map(function(e){return n.createRecord(e)}):P(r)&&(r=n.createRecord(r)),t.raw?e.data=r:e=r,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);I(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||{},V(o,function(t,n){i[n]=ie(e[n])})),o||(o={}),t.strict||V(e,function(e,t){o[t]||-1!==r.indexOf(t)||(i[t]=ie(e))}),n&&t.withAll&&(t.with=r.slice()),n&&t.with&&(D(t.with)&&(t.with=[t.with]),pe(n,t,function(t,n){var r=t.getLocalField(e);r&&(I(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={}),D(e)&&(e={adapter:e}),e.adapter||e.defaultAdapter},getAdapters:function(){return this._adapters},getSchema:function(){return this.schema},beforeCreate:tt,create: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="beforeCreate",H(i[n](e,t)).then(function(o){e=T(o)?e:o;var a={};t.with||(t.with=[]);var u=[];return pe(i,t,function(t,n){var r=t.getLocalField(e);t.type===xe&&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=[],pe(i,t,function(n,i){var o=n.getLocalField(e);if(o){var c=void 0;n.type===Ae?(n.setForeignKey(r,o),c=n.getRelation().createMany(o,i).then(function(e){n.setLocalField(r,t.raw?e.data:e)})):n.type===we?(n.setForeignKey(r,o),c=n.getRelation().create(o,i).then(function(e){n.setLocalField(r,t.raw?e.data:e)})):n.type===xe&&n.getLocalField(a)&&n.setLocalField(r,n.getLocalField(a)),c&&u.push(c)}}),Promise.all(u).then(function(){return n})})}).then(function(r){return r=i._end(r,t),n=t.op="afterCreate",H(i[n](e,t,r)).then(function(e){return T(e)?r:e})})},afterCreate:nt,beforeCreateMany:tt,createMany: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="beforeCreateMany",H(i[n](e,t)).then(function(o){e=T(o)?e:o;var a={};t.with||(t.with=[]);var u=[];return pe(i,t,function(t,n){var r=e.map(function(e){return t.getLocalField(e)}).filter(function(e){return e});t.type===xe&&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=[],pe(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===Ae?i.log("warn","deep createMany of hasMany type not supported!"):n.type===we?(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===xe&&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(r){return r=i._end(r,t),n=t.op="afterCreateMany",H(i[n](e,t,r)).then(function(e){return T(e)?r:e})})},afterCreateMany:nt,beforeFind:tt,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(){return n=t.op="find",i.dbg(n,e,t),H(i.getAdapter(r)[n](i,e,t))}).then(function(r){return r=i._end(r,t),n=t.op="afterFind",H(i[n](e,t,r)).then(function(e){return T(e)?r:e})})},afterFind:nt,beforeFindAll:tt,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(){return n=t.op="findAll",i.dbg(n,e,t),H(i.getAdapter(r)[n](i,e,t))}).then(function(r){return r=i._end(r,t),n=t.op="afterFindAll",H(i[n](e,t,r)).then(function(e){return T(e)?r:e})})},afterFindAll:nt,beforeUpdate:tt,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=T(a)?t:a,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(i){return i=o._end(i,n),r=n.op="afterUpdate",H(o[r](e,t,n,i)).then(function(e){return T(e)?i:e})})},afterUpdate:nt,beforeUpdateMany:tt,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=T(o)?e:o,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(r){return r=i._end(r,t),n=t.op="afterUpdateMany",H(i[n](e,t,r)).then(function(e){return T(e)?r:e})})},afterUpdateMany:nt,beforeUpdateAll:tt,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){e=T(a)?e:a,r=n.op="updateAll";var u=o.toJSON(e,n);return o.dbg(r,u,t,n),H(o.getAdapter(i)[r](o,u,t,n))}).then(function(i){return i=o._end(i,n),r=n.op="afterUpdateAll",H(o[r](e,t,n,i)).then(function(e){return T(e)?i:e})})},afterUpdateAll:nt,beforeDestroy:tt,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(){return n=t.op="destroy",i.dbg(n,e,t),H(i.getAdapter(r)[n](i,e,t))}).then(function(r){return t.raw&&X(t,r),n=t.op="afterDestroy",H(i[n](e,t,r)).then(function(e){return T(e)?r:e})})},afterDestroy:nt,beforeDestroyAll:tt,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(){return n=t.op="destroyAll",i.dbg(n,e,t),H(i.getAdapter(r)[n](i,e,t))}).then(function(r){return t.raw&&X(t,r),n=t.op="afterDestroyAll",H(i[n](e,t,r)).then(function(e){return T(e)?r:e})})},afterDestroyAll:nt,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 Re(e,t)(this)},hasMany:function(e,t){return Ce(e,t)(this)},hasOne:function(e,t){return Ee(e,t)(this)},registerAdapter:function(e,t,n){var r=this;n||(n={}),r.getAdapters()[e]=t,(n===!0||n.default)&&(r.defaultAdapter=e)}}),d.extend=fe,oe(d.prototype,function(){return this._listeners},function(e){this._listeners=e});var it=["create","createMany","createRecord","destroy","destroyAll","find","findAll","is","update","updateAll","updateMany"];p.extend=fe,ce(p.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(!D(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(),V(i.relations,function(e,t){V(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===xe?i.belongsTo(o,e):t===we?i.hasOne(o,e):t===Ae&&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={}),D(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,V(r._mappers,function(t){t.defaultAdapter=e}))}});var ot={};it.forEach(function(e){ot[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(p.prototype,ot);var at=c.extend({constructor:function(e,t){var n=this;if(ae(n,at),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];D(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)&&!I(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===Ae,s=T(t.add)?!0:!!t.add,l=void 0;e.forEach(function(e){if(l=t.getLocalField(e),M(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&&$(e,t.localKeys,l.map(function(e){return q(e,o)}));else{var n=q(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}});at.extend=fe;var ut={linkRelations:R},ct=p.extend({constructor:function(e){var t=this;return ae(t,ct),se(t).call(t,e),t.CollectionClass=t.CollectionClass||at,t._collections={},Z(t,ut),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||Object.defineProperty(r,"relationList",{value:[]});var i=n._collections[e]=new n.CollectionClass(null,{_added:{},datastore:n,mapper:r}),o=r.schema||{},a=o.properties||{};V(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=T(e.link)?u:e.link,l={index:c},d=void 0;f===xe?(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=T(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===Ae?!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=q(i,r)||[],p=I(d)?d:Object.keys(d);f=l.getAll.apply(l,p)}else if(o){var h={};$(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),I(u)&&u.forEach(function(e){d.updateIndex(e,l)})),r?$(f,r,u.map(function(e){return d.recordId(e)})):o&&u.forEach(function(e){var t=q(e,o);t?-1===t.indexOf(s)&&t.push(s):$(e,o,[s])}),e.getLocalField(f)}}}():f===we&&(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=T(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)})}});ct.prototype.defineResource=ct.prototype.defineMapper,ct.extend=fe;var ft=["add","between","createIndex","filter","get","getAll","query","remove","removeAll","toJson"],st={};ft.forEach(function(e){st[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)}}),st.inject=function(){return console.warn("deprecated"),this.add.apply(this,arguments)},ce(ct.prototype,st);var lt={full:"3.0.0-alpha.18",major:parseInt("3",10),minor:parseInt("0",10),patch:parseInt("0",10),alpha:"18",beta:"false"},dt=ct;e.Collection=c,e.Container=p,e.DataStore=ct,e.DS=dt,e.LinkedCollection=at,e.Mapper=d,e.Query=t,e.Record=s,e.Schema=l,e.utils=ve,e.version=lt,e.belongsToType=xe,e.hasManyType=Ae,e.hasOneType=we,e.belongsTo=Re,e.hasMany=Ce,e.hasOne=Ee});
//# sourceMappingURL=dist/js-data.min.map
{
"name": "js-data",
"description": "Robust, framework-agnostic in-memory data store.",
"version": "3.0.0-alpha.17",
"version": "3.0.0-alpha.18",
"homepage": "http://www.js-data.io",

@@ -6,0 +6,0 @@ "repository": {

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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