mongoose 6.2.2 → 6.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/dist/browser.umd.js +33 -33
- package/lib/document.js +25 -16
- package/lib/helpers/indexes/decorateDiscriminatorIndexOptions.js +14 -0
- package/lib/helpers/indexes/getRelatedIndexes.js +59 -0
- package/lib/helpers/populate/assignVals.js +4 -0
- package/lib/helpers/query/hasDollarKeys.js +7 -3
- package/lib/helpers/schema/getIndexes.js +6 -2
- package/lib/internal.js +9 -1
- package/lib/model.js +35 -49
- package/lib/schema.js +4 -0
- package/lib/schematype.js +9 -10
- package/lib/types/map.js +1 -1
- package/lib/utils.js +9 -3
- package/package.json +16 -18
- package/types/Error.d.ts +129 -0
- package/types/index.d.ts +21 -132
package/dist/browser.umd.js
CHANGED
|
@@ -36,7 +36,7 @@ e.toCollectionName=function(t,e){return"system.profile"===t||"system.indexes"===
|
|
|
36
36
|
* @return {Boolean}
|
|
37
37
|
* @api private
|
|
38
38
|
*/
|
|
39
|
-
e.deepEqual=function r(n,i){if(n===i)return!0;if("object"!==s(n)
|
|
39
|
+
e.deepEqual=function r(n,i){if(n===i)return!0;if("object"!==s(n)||"object"!==s(i))return n===i;if(n instanceof Date&&i instanceof Date)return n.getTime()===i.getTime();if(v(n,"ObjectID")&&v(i,"ObjectID")||v(n,"Decimal128")&&v(i,"Decimal128"))return n.toString()===i.toString();if(n instanceof RegExp&&i instanceof RegExp)return n.source===i.source&&n.ignoreCase===i.ignoreCase&&n.multiline===i.multiline&&n.global===i.global&&n.dotAll===i.dotAll&&n.unicode===i.unicode&&n.sticky===i.sticky&&n.hasIndices===i.hasIndices;if(null==n||null==i)return!1;if(n.prototype!==i.prototype)return!1;if(n instanceof Map||i instanceof Map)return n instanceof Map&&i instanceof Map&&(r(Array.from(n.keys()),Array.from(i.keys()))&&r(Array.from(n.values()),Array.from(i.values())));if(n instanceof Number&&i instanceof Number)return n.valueOf()===i.valueOf();if(t.isBuffer(n))return e.buffer.areEqual(n,i);if(Array.isArray(n)||Array.isArray(i)){if(!Array.isArray(n)||!Array.isArray(i))return!1;var o=n.length;if(o!==i.length)return!1;for(var a=0;a<o;++a)if(!r(n[a],i[a]))return!1;return!0}null!=n.$__?n=n._doc:w(n)&&(n=n.toObject()),null!=i.$__?i=i._doc:w(i)&&(i=i.toObject());var u=Object.keys(n),h=Object.keys(i),f=u.length;if(f!==h.length)return!1;for(var c=f-1;c>=0;c--)if(u[c]!==h[c])return!1;for(var l=0,d=u;l<d.length;l++){var p=d[l];if(!r(n[p],i[p]))return!1}return!0},
|
|
40
40
|
/*!
|
|
41
41
|
* Get the last element of an array
|
|
42
42
|
*/
|
|
@@ -265,11 +265,11 @@ g.prototype._applySetters=function(t,e,r,n){var i=t;if(r)return i;for(var o=this
|
|
|
265
265
|
/*!
|
|
266
266
|
* ignore
|
|
267
267
|
*/
|
|
268
|
-
g.prototype._castNullish=function(t){return t},g.prototype.applySetters=function(t,e,r,n,i){var o=this._applySetters(t,e,r,n,i);return null==o?this._castNullish(o):o=this.cast(o,e,r,n,i)},g.prototype.applyGetters=function(t,e){var r=t,n=this.getters,i=n.length;if(0===i)return r;for(var o=0;o<i;++o)r=n[o].call(e,r,this);return r},g.prototype.select=function(t){return this.selected=!!t,this},g.prototype.doValidate=function(t,e,r,n){var o=!1,
|
|
268
|
+
g.prototype._castNullish=function(t){return t},g.prototype.applySetters=function(t,e,r,n,i){var o=this._applySetters(t,e,r,n,i);return null==o?this._castNullish(o):o=this.cast(o,e,r,n,i)},g.prototype.applyGetters=function(t,e){var r=t,n=this.getters,i=n.length;if(0===i)return r;for(var o=0;o<i;++o)r=n[o].call(e,r,this);return r},g.prototype.select=function(t){return this.selected=!!t,this},g.prototype.doValidate=function(t,e,r,n){var o=this,s=!1,a=this.path,u=this.validators.filter((function(t){return null!=t&&"object"===i(t)})),h=u.length;if(!h)return e(null);for(var f=function(e,i){var h=u[e];if(s)return"break";var f=h.validator,c=void 0,l=d.clone(h);if(l.path=n&&n.path?n.path:a,l.value=t,f instanceof RegExp)return b(f.test(t),l),"continue";if("function"!=typeof f)return"continue";if(void 0===t&&f!==o.requiredValidator)return b(!0,l),"continue";try{c=l.propsParameter?f.call(r,t,l):f.call(r,t)}catch(t){c=!1,l.reason=t,t.message&&(l.message=t.message)}null!=c&&"function"==typeof c.then?c.then((function(t){b(t,l)}),(function(t){l.reason=t,l.message=t.message,b(c=!1,l)})):b(c,l)},l=0,y=u.length;l<y;++l){var m=f(l);if("break"===m)break}function b(t,r){if(!s)if(void 0===t||t)--h<=0&&c((function(){e(null)}));else{var n=r.ErrorConstructor||v;(s=new n(r))[p]=!0,c((function(){e(s)}))}}},g.prototype.doValidateSync=function(t,e,r){var n=this.path;if(!this.validators.length)return null;var o=this.validators;if(void 0===t){if(0===this.validators.length||"required"!==this.validators[0].type)return null;o=[this.validators[0]]}var s=null,a=0,u=o.length;for(a=0;a<u;++a){var h=o[a];if(null!=h&&"object"===i(h)){var c=h.validator,l=d.clone(h);l.path=r&&r.path?r.path:n,l.value=t;var p=!1;if(!f(c))if(c instanceof RegExp)s=w(c.test(t),l);else if("function"==typeof c){try{p=l.propsParameter?c.call(e,t,l):c.call(e,t)}catch(t){p=!1,l.reason=t}if((null==p||"function"!=typeof p.then)&&(s=w(p,l)))break}}}return s},g._isRef=function(t,e,r,i){var o=i&&t.options&&(t.options.ref||t.options.refPath);if(!o&&r&&null!=r.$__){var s=r.$__fullPath(t.path,!0),a=r.ownerDocument();o=null!=s&&a.$populated(s)||r.$populated(t.path)}return!!o&&(null==e||(!(n.isBuffer(e)||"Binary"===e._bsontype||!d.isObject(e))||i))},
|
|
269
269
|
/*!
|
|
270
270
|
* ignore
|
|
271
271
|
*/
|
|
272
|
-
g.prototype._castRef=function(t,e,r){if(null==t)return t;if(null!=t.$__)return t.$__.wasPopulated
|
|
272
|
+
g.prototype._castRef=function(t,e,r){if(null==t)return t;if(null!=t.$__)return t.$__.wasPopulated=t.$__.wasPopulated||!0,t;if(n.isBuffer(t)||!d.isObject(t)){if(r)return t;throw new b(this.instance,t,this.path,null,this)}var i=e.$__fullPath(this.path,!0),o=e.ownerDocument().$populated(i,!0),s=t;return e.$__.populated&&e.$__.populated[i]&&e.$__.populated[i].options&&e.$__.populated[i].options.options&&e.$__.populated[i].options.options.lean||((s=new o.options[m](t)).$__.wasPopulated=!0),s},g.prototype.$conditionalHandlers={$all:function(t){var e=this;return Array.isArray(t)?t.map((function(t){return e.castForQuery(t)})):[this.castForQuery(t)]},$eq:_,$in:M,$ne:_,$nin:M,$exists:a,$type:u},
|
|
273
273
|
/*!
|
|
274
274
|
* Wraps `castForQuery` to handle context
|
|
275
275
|
*/
|
|
@@ -290,7 +290,7 @@ g.prototype.clone=function(){var t=Object.assign({},this.options),e=new this.con
|
|
|
290
290
|
t.exports=e=g,e.CastError=b,e.ValidatorError=v}).call(this,r(3).Buffer)},function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}t.exports=r,r.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)}},function(t,e,r){"use strict";var n=e,i=r(21),o=r(10),s=r(128);n.assert=o,n.toArray=s.toArray,n.zero2=s.zero2,n.toHex=s.toHex,n.encode=s.encode,n.getNAF=function(t,e,r){var n=new Array(Math.max(t.bitLength(),r)+1);n.fill(0);for(var i=1<<e+1,o=t.clone(),s=0;s<n.length;s++){var a,u=o.andln(i-1);o.isOdd()?(a=u>(i>>1)-1?(i>>1)-u:u,o.isubn(a)):a=0,n[s]=a,o.iushrn(1)}return n},n.getJSF=function(t,e){var r=[[],[]];t=t.clone(),e=e.clone();for(var n,i=0,o=0;t.cmpn(-i)>0||e.cmpn(-o)>0;){var s,a,u=t.andln(3)+i&3,h=e.andln(3)+o&3;3===u&&(u=-1),3===h&&(h=-1),s=0==(1&u)?0:3!==(n=t.andln(7)+i&7)&&5!==n||2!==h?u:-u,r[0].push(s),a=0==(1&h)?0:3!==(n=e.andln(7)+o&7)&&5!==n||2!==u?h:-h,r[1].push(a),2*i===s+1&&(i=1-i),2*o===a+1&&(o=1-o),t.iushrn(1),e.iushrn(1)}return r},n.cachedProperty=function(t,e,r){var n="_"+e;t.prototype[e]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},n.parseBytes=function(t){return"string"==typeof t?n.toArray(t,"hex"):t},n.intFromLE=function(t){return new i(t,"hex","le")}},function(t,e,r){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i,o="object"===("undefined"==typeof Reflect?"undefined":n(Reflect))?Reflect:null,s=o&&"function"==typeof o.apply?o.apply:function(t,e,r){return Function.prototype.apply.call(t,e,r)};i=o&&"function"==typeof o.ownKeys?o.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var a=Number.isNaN||function(t){return t!=t};function u(){u.init.call(this)}t.exports=u,t.exports.once=function(t,e){return new Promise((function(r,n){function i(r){t.removeListener(e,o),n(r)}function o(){"function"==typeof t.removeListener&&t.removeListener("error",i),r([].slice.call(arguments))}v(t,e,o,{once:!0}),"error"!==e&&function(t,e,r){"function"==typeof t.on&&v(t,"error",e,r)}(t,i,{once:!0})}))},u.EventEmitter=u,u.prototype._events=void 0,u.prototype._eventsCount=0,u.prototype._maxListeners=void 0;var h=10;function f(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+n(t))}function c(t){return void 0===t._maxListeners?u.defaultMaxListeners:t._maxListeners}function l(t,e,r,n){var i,o,s,a;if(f(r),void 0===(o=t._events)?(o=t._events=Object.create(null),t._eventsCount=0):(void 0!==o.newListener&&(t.emit("newListener",e,r.listener?r.listener:r),o=t._events),s=o[e]),void 0===s)s=o[e]=r,++t._eventsCount;else if("function"==typeof s?s=o[e]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),(i=c(t))>0&&s.length>i&&!s.warned){s.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=s.length,a=u,console&&console.warn&&console.warn(a)}return t}function d(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=d.bind(n);return i.listener=r,n.wrapFn=i,i}function y(t,e,r){var n=t._events;if(void 0===n)return[];var i=n[e];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}(i):b(i,i.length)}function m(t){var e=this._events;if(void 0!==e){var r=e[t];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function b(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function v(t,e,r,i){if("function"==typeof t.on)i.once?t.once(e,r):t.on(e,r);else{if("function"!=typeof t.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+n(t));t.addEventListener(e,(function n(o){i.once&&t.removeEventListener(e,n),r(o)}))}}Object.defineProperty(u,"defaultMaxListeners",{enumerable:!0,get:function(){return h},set:function(t){if("number"!=typeof t||t<0||a(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");h=t}}),u.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},u.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||a(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},u.prototype.getMaxListeners=function(){return c(this)},u.prototype.emit=function(t){for(var e=[],r=1;r<arguments.length;r++)e.push(arguments[r]);var n="error"===t,i=this._events;if(void 0!==i)n=n&&void 0===i.error;else if(!n)return!1;if(n){var o;if(e.length>0&&(o=e[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var u=i[t];if(void 0===u)return!1;if("function"==typeof u)s(u,this,e);else{var h=u.length,f=b(u,h);for(r=0;r<h;++r)s(f[r],this,e)}return!0},u.prototype.addListener=function(t,e){return l(this,t,e,!1)},u.prototype.on=u.prototype.addListener,u.prototype.prependListener=function(t,e){return l(this,t,e,!0)},u.prototype.once=function(t,e){return f(e),this.on(t,p(this,t,e)),this},u.prototype.prependOnceListener=function(t,e){return f(e),this.prependListener(t,p(this,t,e)),this},u.prototype.removeListener=function(t,e){var r,n,i,o,s;if(f(e),void 0===(n=this._events))return this;if(void 0===(r=n[t]))return this;if(r===e||r.listener===e)0==--this._eventsCount?this._events=Object.create(null):(delete n[t],n.removeListener&&this.emit("removeListener",t,r.listener||e));else if("function"!=typeof r){for(i=-1,o=r.length-1;o>=0;o--)if(r[o]===e||r[o].listener===e){s=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(r,i),1===r.length&&(n[t]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",t,s||e)}return this},u.prototype.off=u.prototype.removeListener,u.prototype.removeAllListeners=function(t){var e,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[t]),this;if(0===arguments.length){var i,o=Object.keys(r);for(n=0;n<o.length;++n)"removeListener"!==(i=o[n])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(e=r[t]))this.removeListener(t,e);else if(void 0!==e)for(n=e.length-1;n>=0;n--)this.removeListener(t,e[n]);return this},u.prototype.listeners=function(t){return y(this,t,!0)},u.prototype.rawListeners=function(t){return y(this,t,!1)},u.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):m.call(t,e)},u.prototype.listenerCount=m,u.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]}},function(t,e,r){"use strict";
|
|
291
291
|
/*!
|
|
292
292
|
* Module dependencies.
|
|
293
|
-
*/function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function i(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return o(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return o(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,s=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw s}}}}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var a,u,h,f=r(12).EventEmitter,c=r(275),l=r(7),d=r(45),p=r(154),y=r(304),m=r(305),b=r(85),v=r(44),g=r(151),w=r(152),_=r(86),M=r(
|
|
293
|
+
*/function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function i(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return o(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return o(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,s=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw s}}}}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var a,u,h,f=r(12).EventEmitter,c=r(275),l=r(7),d=r(45),p=r(154),y=r(304),m=r(305),b=r(85),v=r(44),g=r(151),w=r(152),_=r(86),M=r(343),S=r(53),O=r(167),A=r(91).compile,E=r(91).defineKey,x=r(344).flatten,k=r(345),j=r(14),$=r(347),P=r(348),R=r(171),B=r(42),T=r(92),I=r(349),N=r(8).inspect,D=r(34).internalToObjectOptions,C=r(350),L=r(81),q=r(351),U=r(4),F=r(353),z=U.clone,V=U.deepEqual,K=U.isMongooseObject,H=r(1).arrayAtomicsBackupSymbol,Z=r(1).arrayAtomicsSymbol,W=r(1).documentArrayParent,J=r(1).documentIsModified,Y=r(1).documentModifiedPaths,Q=r(1).documentSchemaSymbol,G=r(1).getSymbol,X=r(1).populateModelSymbol,tt=r(1).scopeSymbol,et=r(55).schemaMixedSymbol,rt=r(354),nt=U.specialProperties;function it(t,e,r,n){if("object"===s(r)&&null!=r&&(r=(n=r).skipId),n=Object.assign({},n),null==this.$__schema){var o=U.isObject(e)&&!e.instanceOfSchema?new b(e):e;this.$__setSchema(o),e=r,r=n,n=arguments[4]||{}}if(this.$__=new c,this.$isNew=!("isNew"in n)||n.isNew,"priorDoc"in n&&(this.$__.priorDoc=n.priorDoc),r&&(this.$__.skipId=r),null!=t&&"object"!==s(t))throw new y(t,"obj","Document");var a=!0;void 0!==n.defaults&&(this.$__.defaults=n.defaults,a=n.defaults);var u=this.$__schema;"boolean"==typeof e||"throw"===e?(this.$__.strictMode=e,e=void 0):(this.$__.strictMode=u.options.strict,void 0!==e&&(this.$__.selected=e));var h,f=u.requiredPaths(!0),l=i(f);try{for(l.s();!(h=l.n()).done;){var d=h.value;this.$__.activePaths.require(d)}}catch(t){l.e(t)}finally{l.f()}var p=null;U.isPOJO(e)&&(p=I(e),this.$__.fields=e,this.$__.exclude=p);var m=!1===p&&e?M(e):{};if(null==this._doc&&(this.$__buildDoc(t,e,r,p,m,!1),a&&st(this,e,p,m,!0,{isNew:this.$isNew})),t&&(this.$__original_set?this.$__original_set(t,void 0,!0):this.$set(t,void 0,!0),t instanceof it&&(this.$isNew=t.$isNew)),n.willInit&&a?n.skipDefaults&&(this.$__.skipDefaults=n.skipDefaults):a&&st(this,e,p,m,!1,n.skipDefaults,this.$isNew),this.$__._id=this._id,!this.$__.strictMode&&t){var v=this,g=Object.keys(this._doc);g.forEach((function(t){t in u.tree||t in u.methods||t in u.virtuals||t.startsWith("$")||E({prop:t,subprops:null,prototype:v})}))}lt(this)}for(var ot in Object.defineProperty(it.prototype,"isNew",{get:function(){return this.$isNew},set:function(t){this.$isNew=t}}),Object.defineProperty(it.prototype,"errors",{get:function(){return this.$errors},set:function(t){this.$errors=t}}),
|
|
294
294
|
/*!
|
|
295
295
|
* Document exposes the NodeJS event emitter API, so you can use
|
|
296
296
|
* `on`, `once`, etc.
|
|
@@ -299,7 +299,7 @@ U.each(["on","once","emit","listeners","removeListener","setMaxListeners","remov
|
|
|
299
299
|
/*!
|
|
300
300
|
* ignore
|
|
301
301
|
*/
|
|
302
|
-
function st(t,e,r,n,i,o){for(var s=Object.keys(t.$__schema.paths),a=s.length,u=0;u<a;++u){var h=void 0,f="",c=s[u];if("_id"!==c||!t.$__.skipId)for(var l=t.$__schema.paths[c],d=l.splitPath(),p=d.length,y=!1,m=t._doc,b=0;b<p&&null!=m;++b){var v=d[b];if(f+=(f.length?".":"")+v,!0===r){if(f in e)break}else if(!1===r&&e&&!y)if(f in e||
|
|
302
|
+
function st(t,e,r,n,i,o){for(var s=Object.keys(t.$__schema.paths),a=s.length,u=0;u<a;++u){var h=void 0,f="",c=s[u];if("_id"!==c||!t.$__.skipId)for(var l=t.$__schema.paths[c],d=l.splitPath(),p=d.length,y=!1,m=t._doc,b=0;b<p&&null!=m;++b){var v=d[b];if(f+=(f.length?".":"")+v,!0===r){if(f in e)break}else if(!1===r&&e&&!y){var g=l.$isSingleNested||l.$isMongooseDocumentArray;if(f in e||g&&n[f])y=!0;else if(!n[f])break}if(b===p-1){if(void 0!==m[v])break;if("function"==typeof l.defaultValue){if(!l.defaultValue.$runBeforeSetters&&i)break;if(l.defaultValue.$runBeforeSetters&&!i)break}else if(!i)continue;if(o&&o[f])break;if(e&&null!==r){if(!0===r){if(c in e)continue;try{h=l.getDefault(t,!1)}catch(e){t.invalidate(c,e);break}void 0!==h&&(m[v]=h,t.$__.activePaths.default(c))}else if(y){try{h=l.getDefault(t,!1)}catch(e){t.invalidate(c,e);break}void 0!==h&&(m[v]=h,t.$__.activePaths.default(c))}}else{try{h=l.getDefault(t,!1)}catch(e){t.invalidate(c,e);break}void 0!==h&&(m[v]=h,t.$__.activePaths.default(c))}}else m=m[v]}}}
|
|
303
303
|
/*!
|
|
304
304
|
* ignore
|
|
305
305
|
*/function at(t,e,r){if(null!=t){k(t);for(var n=Object.keys(r.$__schema.paths),i=n.length,o=-1===e.indexOf(".")?[e]:e.split("."),s=0;s<i;++s){var a="",u=n[s];if(u.startsWith(e+".")){var h=r.$__schema.paths[u],f=h.splitPath().slice(o.length),c=f.length;if(void 0!==h.defaultValue)for(var l=t,d=0;d<c&&null!=l;++d){var p=f[d];if(d===c-1){if(void 0!==l[p])break;try{var y=h.getDefault(r,!1);void 0!==y&&(l[p]=y)}catch(t){r.invalidate(e+"."+a,t);break}break}a+=(a.length?".":"")+p,l[p]=l[p]||{},l=l[p]}}}}}function ut(t){if(null==t)return!0;if("object"!==s(t)||Array.isArray(t))return!1;for(var e=0,r=Object.keys(t);e<r.length;e++){if(!ut(t[r[e]]))return!1}return!0}
|
|
@@ -361,19 +361,19 @@ function t(e,r,n,i,o){o=o||"";var s,a,u,h=Object.keys(r),f=h.length,c=0,l=e.$__.
|
|
|
361
361
|
function(t,e){if(!t.$__.validationError)return;for(var r=Object.keys(t.$__.validationError.errors),n=0,i=r;n<i.length;n++){var o=i[n];o.startsWith(e+".")&&delete t.$__.validationError.errors[o]}0===Object.keys(t.$__.validationError.errors).length&&(t.$__.validationError=null)}
|
|
362
362
|
/*!
|
|
363
363
|
* ignore
|
|
364
|
-
*/(this,t),null!=e&&y&&F.$isSingleNested){e instanceof it&&(e=e.toObject({virtuals:!1,transform:!1}));for(var ft=0,ct=Object.keys(e);ft<ct.length;ft++){var lt=ct[ft];this.$set(t+"."+lt,e[lt],b,o)}return this}var dt=!0;try{var pt,yt=function(){if(null==F.options)return!1;if(!(e instanceof it))return!1;var t=e.constructor,r=F.options.ref;if(null!=r&&(r===t.modelName||r===t.baseModelName))return!0;var n=F.options.refPath;if(null==n)return!1;var i=e.get(n);return i===t.modelName||i===t.baseModelName}(),mt=!1;if(yt&&e instanceof it&&(this.$populated(t,
|
|
364
|
+
*/(this,t),null!=e&&y&&F.$isSingleNested){e instanceof it&&(e=e.toObject({virtuals:!1,transform:!1}));for(var ft=0,ct=Object.keys(e);ft<ct.length;ft++){var lt=ct[ft];this.$set(t+"."+lt,e[lt],b,o)}return this}var dt=!0;try{var pt,yt=function(){if(null==F.options)return!1;if(!(e instanceof it))return!1;var t=e.constructor,r=F.options.ref;if(null!=r&&(r===t.modelName||r===t.baseModelName))return!0;var n=F.options.refPath;if(null==n)return!1;var i=e.get(n);return i===t.modelName||i===t.baseModelName}(),mt=!1;if(yt&&e instanceof it){var bt=F&&F.$isSingleNested?F.cast(e,this):e._id;this.$populated(t,bt,n({},X,e.constructor)),e.$__.wasPopulated={value:bt},mt=!0}if(F.options&&Array.isArray(F.options[g])&&F.options[g].length&&F.options[g][0].ref&&
|
|
365
365
|
/*!
|
|
366
366
|
* ignore
|
|
367
367
|
*/
|
|
368
|
-
function(t,e){if(!Array.isArray(t))return!1;if(0===t.length)return!1;var r,n=i(t);try{for(n.s();!(r=n.n()).done;){var o=r.value;if(!(o instanceof it))return!1;if(null==o.constructor.modelName)return!1;if(o.constructor.modelName!=e&&o.constructor.baseModelName!=e)return!1}}catch(t){n.e(t)}finally{n.f()}return!0}(e,F.options[g][0].ref)){pt=n({},X,e[0].constructor),this.$populated(t,e.map((function(t){return t._id})),pt);var
|
|
368
|
+
function(t,e){if(!Array.isArray(t))return!1;if(0===t.length)return!1;var r,n=i(t);try{for(n.s();!(r=n.n()).done;){var o=r.value;if(!(o instanceof it))return!1;if(null==o.constructor.modelName)return!1;if(o.constructor.modelName!=e&&o.constructor.baseModelName!=e)return!1}}catch(t){n.e(t)}finally{n.f()}return!0}(e,F.options[g][0].ref)){pt=n({},X,e[0].constructor),this.$populated(t,e.map((function(t){return t._id})),pt);var vt,gt=i(e);try{for(gt.s();!(vt=gt.n()).done;){var wt=vt.value;wt.$__.wasPopulated={value:wt._id}}}catch(t){gt.e(t)}finally{gt.f()}mt=!0}if(null!=this.$__schema.singleNestedPaths[t]||yt&&F.$isSingleNested&&e.$__||(e=F.applySetters(e,this,!1,z)),Array.isArray(e)&&!Array.isArray(F)&&F.$isMongooseDocumentArray&&0!==e.length&&null!=e[0]&&null!=e[0].$__&&null!=e[0].$__.populated){for(var _t=Object.keys(e[0].$__.populated),Mt=function(){var r=Ot[St];a.$populated(t+"."+r,e.map((function(t){return t.$populated(r)})),e[0].$__.populated[r].options)},St=0,Ot=_t;St<Ot.length;St++)Mt();mt=!0}if(!mt&&this.$__.populated){if(Array.isArray(e)&&this.$__.populated[t])for(var At=0;At<e.length;++At)e[At]instanceof it&&e.set(At,e[At]._id,!0);delete this.$__.populated[t]}null!=e&&F.$isSingleNested&&function(t,e,r){var n=e.schema;if(null==n)return;for(var i=0,o=Object.keys(n.paths);i<o.length;i++){var s=o[i],a=n.paths[s];if(null!=a.$immutableSetter){var u=null==r?void 0:r.$__getValue(s);a.$immutableSetter.call(t,u)}}}(e,F,z),this.$markValid(t)}catch(r){r instanceof l.StrictModeError&&r.isImmutableError?this.invalidate(t,r):r instanceof l.CastError?(this.invalidate(r.path,r),r.$originalErrorPath&&this.invalidate(t,new l.CastError(F.instance,e,t,r.$originalErrorPath))):this.invalidate(t,new l.CastError(F.instance,e,t,r)),dt=!1}if(dt){var Et=this.$isSubdocument?this.ownerDocument():this,xt=Et.$__.savedState,kt=this.$isSubdocument?this.$__.fullPath+"."+t:t;if(null!=xt){var jt=kt.indexOf("."),$t=-1===jt?kt:kt.slice(0,jt);xt.hasOwnProperty($t)||(xt[$t]=U.clone(Et.$__getValue($t)))}this.$__set(nt,t,o,b,tt,F,e,z),null!=xt&&xt.hasOwnProperty(kt)&&U.deepEqual(e,xt[kt])&&this.unmarkModified(t)}return F.$isSingleNested&&(this.isDirectModified(t)||null==e)&&O(this,t),this},it.prototype.set=it.prototype.$set,it.prototype.$__shouldModify=function(t,e,r,n,i,o,s,a){return!r._skipMarkModified&&(!!this.$isNew||null==this.$__schema.singleNestedPaths[e]&&(void 0===s&&!this.$__isSelected(e)||(void 0!==s||!(e in this.$__.activePaths.states.default))&&(!(this.$populated(e)&&s instanceof it&&V(s._id,a))&&(!V(s,a||U.getValue(e,this))||!(n||null==s||!(e in this.$__.activePaths.states.default)||!V(s,o.getDefault(this,n)))))))},it.prototype.$__set=function(t,e,n,i,o,s,a,f){h=h||r(46);var c=this.$__shouldModify(t,e,n,i,o,s,a,f),l=this;c?(this.markModified(t),u||(u=r(166)),a&&U.isMongooseArray(a)&&(a._registerAtomic("$set",a),U.isMongooseDocumentArray(a)&&a.forEach((function(t){t&&t.__parentArray&&(t.__parentArray=a)})),this.$__.activePaths.forEach((function(t){t.startsWith(e+".")&&l.$__.activePaths.ignore(t)})))):Array.isArray(a)&&Array.isArray(f)&&U.isMongooseArray(a)&&U.isMongooseArray(f)&&(a[Z]=f[Z],a[H]=f[H],U.isMongooseDocumentArray(a)&&a.forEach((function(t){t.isNew=!1})));for(var d=this._doc,p=0,y=o.length,m="";p<y;p++){var b=p+1===y;if(m+=m?"."+o[p]:o[p],nt.has(o[p]))return;b?d instanceof Map?d.set(o[p],a):d[o[p]]=a:(U.isPOJO(d[o[p]])||d[o[p]]&&d[o[p]]instanceof h||d[o[p]]&&!Array.isArray(d[o[p]])&&d[o[p]].$isSingleNested||d[o[p]]&&Array.isArray(d[o[p]])||(d[o[p]]=d[o[p]]||{}),d=d[o[p]])}},it.prototype.$__getValue=function(t){return U.getValue(t,this._doc)},it.prototype.$__setValue=function(t,e){return U.setValue(t,e,this._doc),this},it.prototype.get=function(t,e,r){var n;r=r||{},e&&(n=this.$__schema.interpretAsType(t,e,this.$__schema.options));var i=this.$__path(t);if(null==i&&(i=this.$__schema.virtualpath(t)),i instanceof d){var o=this.$__schema.virtualpath(t);null!=o&&(i=o)}var s=-1===t.indexOf(".")?[t]:t.split("."),a=this._doc;if(i instanceof _)return i.applyGetters(void 0,this);"string"==typeof this.$__schema.aliases[s[0]]&&(s[0]=this.$__schema.aliases[s[0]]);for(var u=0,h=s.length;u<h;u++)a&&a._doc&&(a=a._doc),a=null==a?void 0:a instanceof Map?a.get(s[u],{getters:!1}):u===h-1?U.getValue(s[u],a):a[s[u]];if(n&&(a=n.cast(a)),null!=i&&!1!==r.getters)a=i.applyGetters(a,this);else if(this.$__schema.nested[t]&&r.virtuals)return dt(this,U.clone(a)||{},{path:t});return a},
|
|
369
369
|
/*!
|
|
370
370
|
* ignore
|
|
371
371
|
*/
|
|
372
|
-
it.prototype[G]=it.prototype.get,it.prototype.$get=it.prototype.get,it.prototype.$__path=function(t){var e=this.$__.adhocPaths,r=e&&e.hasOwnProperty(t)?e[t]:null;return r||this.$__schema.path(t)},it.prototype.markModified=function(t,e){this.$__.activePaths.modify(t),null==e||this.$isSubdocument||(this.$__.pathsToScopes=this.$__pathsToScopes||{},this.$__.pathsToScopes[t]=e)},it.prototype.unmarkModified=function(t){this.$__.activePaths.init(t),null!=this.$__.pathsToScopes&&delete this.$__.pathsToScopes[t]},it.prototype.$ignore=function(t){this.$__.activePaths.ignore(t)},it.prototype.directModifiedPaths=function(){return Object.keys(this.$__.activePaths.states.modify)},it.prototype.$isEmpty=function(t){var e={minimize:!0,virtuals:!1,getters:!1,transform:!1};if(0!==arguments.length){var r=this.$get(t);return null==r||"object"===s(r)&&(U.isPOJO(r)?ut(r):0===Object.keys(r.toObject(e)).length)}return 0===Object.keys(this.toObject(e)).length},it.prototype.modifiedPaths=function(t){t=t||{};var e=Object.keys(this.$__.activePaths.states.modify),r=new Set,n=0,i=0,o=e.length;for(n=0;n<o;++n){var a=e[n],u=rt(a),h=u.length;for(i=0;i<h;++i)r.add(u[i]);if(t.includeChildren){var f=0,c=this.$get(a);if("object"===s(c)&&null!==c){c._doc&&(c=c._doc);var l=c.length;if(Array.isArray(c))for(f=0;f<l;++f){var d=a+"."+f;if(!r.has(d)&&(r.add(d),null!=c[f]&&c[f].$__)){var p=c[f].modifiedPaths(),y=0,m=p.length;for(y=0;y<m;++y)r.add(d+"."+p[y])}}else{var b=Object.keys(c),v=0,g=b.length;for(v=0;v<g;++v)r.add(a+"."+b[v])}}}}return Array.from(r)},it.prototype[Y]=it.prototype.modifiedPaths,it.prototype.isModified=function(t,e){if(t){var r=Object.keys(this.$__.activePaths.states.modify);if(0===r.length)return!1;Array.isArray(t)||(t=-1===t.indexOf(" ")?[t]:t.split(" "));var n=e||this[Y]();return t.some((function(t){return!!~n.indexOf(t)}))||t.some((function(t){return r.some((function(e){return e===t||t.startsWith(e+".")}))}))}return this.$__.activePaths.some("modify")},it.prototype.$isModified=it.prototype.isModified,it.prototype[J]=it.prototype.isModified,it.prototype.$isDefault=function(t){var e=this;if(null==t)return this.$__.activePaths.some("default");if("string"==typeof t&&-1===t.indexOf(" "))return this.$__.activePaths.states.default.hasOwnProperty(t);var r=t;return Array.isArray(r)||(r=r.split(" ")),r.some((function(t){return e.$__.activePaths.states.default.hasOwnProperty(t)}))},it.prototype.$isDeleted=function(t){return 0===arguments.length?!!this.$__.isDeleted:(this.$__.isDeleted=!!t,this)},it.prototype.isDirectModified=function(t){var e=this;if(null==t)return this.$__.activePaths.some("modify");if("string"==typeof t&&-1===t.indexOf(" "))return this.$__.activePaths.states.modify.hasOwnProperty(t);var r=t;return Array.isArray(r)||(r=r.split(" ")),r.some((function(t){return e.$__.activePaths.states.modify.hasOwnProperty(t)}))},it.prototype.isInit=function(t){var e=this;if(null==t)return this.$__.activePaths.some("init");if("string"==typeof t&&-1===t.indexOf(" "))return this.$__.activePaths.states.init.hasOwnProperty(t);var r=t;return Array.isArray(r)||(r=r.split(" ")),r.some((function(t){return e.$__.activePaths.states.init.hasOwnProperty(t)}))},it.prototype.isSelected=function(t){var e=this;if(null==this.$__.selected)return!0;if(!t)return!1;if("_id"===t)return 0!==this.$__.selected._id;if(-1!==t.indexOf(" ")&&(t=t.split(" ")),Array.isArray(t))return t.some((function(t){return e.$__isSelected(t)}));var r=Object.keys(this.$__.selected),n=null;if(1===r.length&&"_id"===r[0])return 0===this.$__.selected._id;for(var i=0,o=r;i<o.length;i++){var s=o[i];if("_id"!==s&&T(this.$__.selected[s])){n=!!this.$__.selected[s];break}}if(null===n)return!0;if(t in this.$__.selected)return n;for(var a=t+".",u=0,h=r;u<h.length;u++){var f=h[u];if("_id"!==f){if(f.startsWith(a))return n||f!==a;if(a.startsWith(f+"."))return n}}return!n},it.prototype.$__isSelected=it.prototype.isSelected,it.prototype.isDirectSelected=function(t){var e=this;if(null==this.$__.selected)return!0;if("_id"===t)return 0!==this.$__.selected._id;if(-1!==t.indexOf(" ")&&(t=t.split(" ")),Array.isArray(t))return t.some((function(t){return e.isDirectSelected(t)}));var r=Object.keys(this.$__.selected),n=null;if(1===r.length&&"_id"===r[0])return 0===this.$__.selected._id;for(var i=0,o=r;i<o.length;i++){var s=o[i];if("_id"!==s&&T(this.$__.selected[s])){n=!!this.$__.selected[s];break}}return null===n||(this.$__.selected.hasOwnProperty(t)?n:!n)},it.prototype.validate=function(t,e,r){var n,i=this;if(this.$op="validate",null!=this.$isSubdocument||(this.$__.validating?n=new m(this,{parentStack:e&&e.parentStack,conflictStack:this.$__.validating.stack}):this.$__.validating=new m(this,{parentStack:e&&e.parentStack})),1===arguments.length?"object"!==s(arguments[0])||Array.isArray(arguments[0])?"function"==typeof arguments[0]&&(r=arguments[0],e=null,t=null):(e=arguments[0],r=null,t=null):"function"==typeof t?(r=t,e=null,t=null):"function"==typeof e&&(r=e,e=t,t=null),e&&"string"==typeof e.pathsToSkip){var o=-1===e.pathsToSkip.indexOf(" ");e.pathsToSkip=o?[e.pathsToSkip]:e.pathsToSkip.split(" ")}return S(r,(function(r){if(null!=n)return r(n);i.$__validate(t,e,(function(t){i.$op=null,r(t)}))}),this.constructor.events)},it.prototype.$validate=it.prototype.validate,it.prototype.$__validate=function(t,e,r){var n=this;"function"==typeof t?(r=t,e=null,t=null):"function"==typeof e&&(r=e,e=null);var o,a=e&&"object"===s(e)&&"validateModifiedOnly"in e,u=e&&e.pathsToSkip||null;o=a?!!e.validateModifiedOnly:this.$__schema.options.validateModifiedOnly;var h=this,f=function(){var t=n.$__.validationError;if(n.$__.validationError=void 0,o&&null!=t){for(var e=0,r=Object.keys(t.errors);e<r.length;e++){var i=r[e];n.$isModified(i)||delete t.errors[i]}0===Object.keys(t.errors).length&&(t=void 0)}if(n.$__.cachedRequired={},n.$emit("validate",h),n.constructor.emit("validate",h),t){for(var s in t.errors)!n[W]&&t.errors[s]instanceof l.CastError&&n.invalidate(s,t.errors[s]);return t}},c=ht(this),d=o?c[0].filter((function(t){return n.$isModified(t)})):c[0],p=c[1];if("string"==typeof t&&(t=t.split(" ")),Array.isArray(t)?d=ft(d,t):u&&(d=ct(d,u)),0===d.length)return B((function(){var t=f();if(t)return h.$__schema.s.hooks.execPost("validate:error",h,[h],{error:t},(function(t){r(t)}));r(null,h)}));var y,m={},b=0,v=i(d);try{for(v.s();!(y=v.n()).done;){w(y.value)}}catch(t){v.e(t)}finally{v.f()}function w(t){null==t||m[t]||(m[t]=!0,b++,B((function(){var e=h.$__schema.path(t);if(!e)return--b||_();if(h.$isValid(t)){if(null!=e[et]&&t!==e.path)return--b||_();var r,n=h.$__getValue(t);(r=h.$populated(t))?n=r:null!=n&&null!=n.$__&&n.$__.wasPopulated&&(n=n._id);var i=null!=h.$__.pathsToScopes&&t in h.$__.pathsToScopes?h.$__.pathsToScopes[t]:h,s={skipSchemaValidators:p[t],path:t,validateModifiedOnly:o};e.doValidate(n,(function(r){if(r){if((e.$isSingleNested||e.$isArraySubdocument||e.$isMongooseDocumentArray)&&r instanceof g)return--b||_();h.invalidate(t,r,void 0,!0)}--b||_()}),i,s)}else--b||_()})))}function _(){var t=f();if(t)return h.$__schema.s.hooks.execPost("validate:error",h,[h],{error:t},(function(t){r(t)}));r(null,h)}},it.prototype.validateSync=function(t,e){var r=this,n=this;1!==arguments.length||"object"!==s(arguments[0])||Array.isArray(arguments[0])||(e=arguments[0],t=null);var i,o=e&&"object"===s(e)&&"validateModifiedOnly"in e;i=o?!!e.validateModifiedOnly:this.$__schema.options.validateModifiedOnly;var a=e&&e.pathsToSkip;if("string"==typeof t){var u=-1===t.indexOf(" ");t=u?[t]:t.split(" ")}else"string"==typeof a&&-1!==a.indexOf(" ")&&(a=a.split(" "));var h=ht(this),f=i?h[0].filter((function(t){return r.$isModified(t)})):h[0],c=h[1];Array.isArray(t)?f=ft(f,t):Array.isArray(a)&&(f=ct(f,a));var d={};f.forEach((function(t){if(!d[t]){d[t]=!0;var e=n.$__schema.path(t);if(e&&n.$isValid(t)){var r=n.$__getValue(t),o=e.doValidateSync(r,n,{skipSchemaValidators:c[t],path:t,validateModifiedOnly:i});if(o){if((e.$isSingleNested||e.$isArraySubdocument||e.$isMongooseDocumentArray)&&o instanceof g)return;n.invalidate(t,o,void 0,!0)}}}}));var p=n.$__.validationError;if(n.$__.validationError=void 0,n.$emit("validate",n),n.constructor.emit("validate",n),p)for(var y in p.errors)p.errors[y]instanceof l.CastError&&n.invalidate(y,p.errors[y]);return p},it.prototype.invalidate=function(t,e,r,n){if(this.$__.validationError||(this.$__.validationError=new g(this)),!this.$__.validationError.errors[t])return e&&"string"!=typeof e||(e=new w({path:t,message:e,type:n||"user defined",value:r})),this.$__.validationError===e||this.$__.validationError.addError(t,e),this.$__.validationError},it.prototype.$markValid=function(t){this.$__.validationError&&this.$__.validationError.errors[t]&&(delete this.$__.validationError.errors[t],0===Object.keys(this.$__.validationError.errors).length&&(this.$__.validationError=null))},it.prototype.$isValid=function(t){var e=this;return null==this.$__.validationError||0===Object.keys(this.$__.validationError.errors).length||null!=t&&(-1!==t.indexOf(" ")&&(t=t.split(" ")),Array.isArray(t)?t.some((function(t){return null==e.$__.validationError.errors[t]})):null==this.$__.validationError.errors[t])},it.prototype.$__reset=function(){var t=this;return a||(a=r(27)),this.$__.activePaths.map("init","modify",(function(e){return t.$__getValue(e)})).filter((function(t){return t&&Array.isArray(t)&&U.isMongooseDocumentArray(t)&&t.length})).forEach((function(e){for(var r=e.length;r--;){var n=e[r];n&&n.$__reset()}t.$__.activePaths.init(e.$path()),e[H]=e[Z],e[Z]={}})),this.$__.activePaths.map("init","modify",(function(e){return t.$__getValue(e)})).filter((function(t){return t&&!Array.isArray(t)&&t.$isSingleNested})).forEach((function(e){e.$__reset(),e.$parent()===t?t.$__.activePaths.init(e.$basePath):null!=e.$parent()&&e.$parent().$isSubdocument&&e.$parent().$__reset()})),this.$__dirty().forEach((function(t){var e=t.value;e&&e[Z]&&(e[H]=e[Z],e[Z]={})})),this.$__.backup={},this.$__.backup.activePaths={modify:Object.assign({},this.$__.activePaths.states.modify),default:Object.assign({},this.$__.activePaths.states.default)},this.$__.backup.validationError=this.$__.validationError,this.$__.backup.errors=this.$errors,this.$__.activePaths.clear("modify"),this.$__.activePaths.clear("default"),this.$__.validationError=void 0,this.$errors=void 0,t=this,this.$__schema.requiredPaths().forEach((function(e){t.$__.activePaths.require(e)})),this},
|
|
372
|
+
it.prototype[G]=it.prototype.get,it.prototype.$get=it.prototype.get,it.prototype.$__path=function(t){var e=this.$__.adhocPaths,r=e&&e.hasOwnProperty(t)?e[t]:null;return r||this.$__schema.path(t)},it.prototype.markModified=function(t,e){this.$__.activePaths.modify(t),null==e||this.$isSubdocument||(this.$__.pathsToScopes=this.$__pathsToScopes||{},this.$__.pathsToScopes[t]=e)},it.prototype.unmarkModified=function(t){this.$__.activePaths.init(t),null!=this.$__.pathsToScopes&&delete this.$__.pathsToScopes[t]},it.prototype.$ignore=function(t){this.$__.activePaths.ignore(t)},it.prototype.directModifiedPaths=function(){return Object.keys(this.$__.activePaths.states.modify)},it.prototype.$isEmpty=function(t){var e={minimize:!0,virtuals:!1,getters:!1,transform:!1};if(0!==arguments.length){var r=this.$get(t);return null==r||"object"===s(r)&&(U.isPOJO(r)?ut(r):0===Object.keys(r.toObject(e)).length)}return 0===Object.keys(this.toObject(e)).length},it.prototype.modifiedPaths=function(t){t=t||{};var e=Object.keys(this.$__.activePaths.states.modify),r=new Set,n=0,i=0,o=e.length;for(n=0;n<o;++n){var a=e[n],u=rt(a),h=u.length;for(i=0;i<h;++i)r.add(u[i]);if(t.includeChildren){var f=0,c=this.$get(a);if("object"===s(c)&&null!==c){c._doc&&(c=c._doc);var l=c.length;if(Array.isArray(c))for(f=0;f<l;++f){var d=a+"."+f;if(!r.has(d)&&(r.add(d),null!=c[f]&&c[f].$__)){var p=c[f].modifiedPaths(),y=0,m=p.length;for(y=0;y<m;++y)r.add(d+"."+p[y])}}else{var b=Object.keys(c),v=0,g=b.length;for(v=0;v<g;++v)r.add(a+"."+b[v])}}}}return Array.from(r)},it.prototype[Y]=it.prototype.modifiedPaths,it.prototype.isModified=function(t,e){if(t){var r=Object.keys(this.$__.activePaths.states.modify);if(0===r.length)return!1;Array.isArray(t)||(t=-1===t.indexOf(" ")?[t]:t.split(" "));var n=e||this[Y]();return t.some((function(t){return!!~n.indexOf(t)}))||t.some((function(t){return r.some((function(e){return e===t||t.startsWith(e+".")}))}))}return this.$__.activePaths.some("modify")},it.prototype.$isModified=it.prototype.isModified,it.prototype[J]=it.prototype.isModified,it.prototype.$isDefault=function(t){var e=this;if(null==t)return this.$__.activePaths.some("default");if("string"==typeof t&&-1===t.indexOf(" "))return this.$__.activePaths.states.default.hasOwnProperty(t);var r=t;return Array.isArray(r)||(r=r.split(" ")),r.some((function(t){return e.$__.activePaths.states.default.hasOwnProperty(t)}))},it.prototype.$isDeleted=function(t){return 0===arguments.length?!!this.$__.isDeleted:(this.$__.isDeleted=!!t,this)},it.prototype.isDirectModified=function(t){var e=this;if(null==t)return this.$__.activePaths.some("modify");if("string"==typeof t&&-1===t.indexOf(" "))return this.$__.activePaths.states.modify.hasOwnProperty(t);var r=t;return Array.isArray(r)||(r=r.split(" ")),r.some((function(t){return e.$__.activePaths.states.modify.hasOwnProperty(t)}))},it.prototype.isInit=function(t){var e=this;if(null==t)return this.$__.activePaths.some("init");if("string"==typeof t&&-1===t.indexOf(" "))return this.$__.activePaths.states.init.hasOwnProperty(t);var r=t;return Array.isArray(r)||(r=r.split(" ")),r.some((function(t){return e.$__.activePaths.states.init.hasOwnProperty(t)}))},it.prototype.isSelected=function(t){var e=this;if(null==this.$__.selected)return!0;if(!t)return!1;if("_id"===t)return 0!==this.$__.selected._id;if(-1!==t.indexOf(" ")&&(t=t.split(" ")),Array.isArray(t))return t.some((function(t){return e.$__isSelected(t)}));var r=Object.keys(this.$__.selected),n=null;if(1===r.length&&"_id"===r[0])return 0===this.$__.selected._id;for(var i=0,o=r;i<o.length;i++){var s=o[i];if("_id"!==s&&T(this.$__.selected[s])){n=!!this.$__.selected[s];break}}if(null===n)return!0;if(t in this.$__.selected)return n;for(var a=t+".",u=0,h=r;u<h.length;u++){var f=h[u];if("_id"!==f){if(f.startsWith(a))return n||f!==a;if(a.startsWith(f+"."))return n}}return!n},it.prototype.$__isSelected=it.prototype.isSelected,it.prototype.isDirectSelected=function(t){var e=this;if(null==this.$__.selected)return!0;if("_id"===t)return 0!==this.$__.selected._id;if(-1!==t.indexOf(" ")&&(t=t.split(" ")),Array.isArray(t))return t.some((function(t){return e.isDirectSelected(t)}));var r=Object.keys(this.$__.selected),n=null;if(1===r.length&&"_id"===r[0])return 0===this.$__.selected._id;for(var i=0,o=r;i<o.length;i++){var s=o[i];if("_id"!==s&&T(this.$__.selected[s])){n=!!this.$__.selected[s];break}}return null===n||(this.$__.selected.hasOwnProperty(t)?n:!n)},it.prototype.validate=function(t,e,r){var n,i=this;if(this.$op="validate",null!=this.$isSubdocument||(this.$__.validating?n=new m(this,{parentStack:e&&e.parentStack,conflictStack:this.$__.validating.stack}):this.$__.validating=new m(this,{parentStack:e&&e.parentStack})),1===arguments.length?"object"!==s(arguments[0])||Array.isArray(arguments[0])?"function"==typeof arguments[0]&&(r=arguments[0],e=null,t=null):(e=arguments[0],r=null,t=null):"function"==typeof t?(r=t,e=null,t=null):"function"==typeof e&&(r=e,e=t,t=null),e&&"string"==typeof e.pathsToSkip){var o=-1===e.pathsToSkip.indexOf(" ");e.pathsToSkip=o?[e.pathsToSkip]:e.pathsToSkip.split(" ")}return S(r,(function(r){if(null!=n)return r(n);i.$__validate(t,e,(function(t){i.$op=null,r(t)}))}),this.constructor.events)},it.prototype.$validate=it.prototype.validate,it.prototype.$__validate=function(t,e,r){var n=this;"function"==typeof t?(r=t,e=null,t=null):"function"==typeof e&&(r=e,e=null);var o,a=e&&"object"===s(e)&&"validateModifiedOnly"in e,u=e&&e.pathsToSkip||null;o=a?!!e.validateModifiedOnly:this.$__schema.options.validateModifiedOnly;var h=this,f=function(){var t=n.$__.validationError;if(n.$__.validationError=void 0,o&&null!=t){for(var e=0,r=Object.keys(t.errors);e<r.length;e++){var i=r[e];n.$isModified(i)||delete t.errors[i]}0===Object.keys(t.errors).length&&(t=void 0)}if(n.$__.cachedRequired={},n.$emit("validate",h),n.constructor.emit("validate",h),t){for(var s in t.errors)!n[W]&&t.errors[s]instanceof l.CastError&&n.invalidate(s,t.errors[s]);return t}},c=ht(this),d=o?c[0].filter((function(t){return n.$isModified(t)})):c[0],p=c[1];if("string"==typeof t&&(t=t.split(" ")),Array.isArray(t)?d=ft(d,t):u&&(d=ct(d,u)),0===d.length)return B((function(){var t=f();if(t)return h.$__schema.s.hooks.execPost("validate:error",h,[h],{error:t},(function(t){r(t)}));r(null,h)}));var y,m={},b=0,v=i(d);try{for(v.s();!(y=v.n()).done;){w(y.value)}}catch(t){v.e(t)}finally{v.f()}function w(t){null==t||m[t]||(m[t]=!0,b++,B((function(){var e=h.$__schema.path(t);if(!e)return--b||_();if(h.$isValid(t)){if(null!=e[et]&&t!==e.path)return--b||_();var r,n=h.$__getValue(t);(r=h.$populated(t))?n=r:null!=n&&null!=n.$__&&n.$__.wasPopulated&&(n=n._id);var i=null!=h.$__.pathsToScopes&&t in h.$__.pathsToScopes?h.$__.pathsToScopes[t]:h,s={skipSchemaValidators:p[t],path:t,validateModifiedOnly:o};e.doValidate(n,(function(r){if(r){if((e.$isSingleNested||e.$isArraySubdocument||e.$isMongooseDocumentArray)&&r instanceof g)return--b||_();h.invalidate(t,r,void 0,!0)}--b||_()}),i,s)}else--b||_()})))}function _(){var t=f();if(t)return h.$__schema.s.hooks.execPost("validate:error",h,[h],{error:t},(function(t){r(t)}));r(null,h)}},it.prototype.validateSync=function(t,e){var r=this,n=this;1!==arguments.length||"object"!==s(arguments[0])||Array.isArray(arguments[0])||(e=arguments[0],t=null);var i,o=e&&"object"===s(e)&&"validateModifiedOnly"in e;i=o?!!e.validateModifiedOnly:this.$__schema.options.validateModifiedOnly;var a=e&&e.pathsToSkip;if("string"==typeof t){var u=-1===t.indexOf(" ");t=u?[t]:t.split(" ")}else"string"==typeof a&&-1!==a.indexOf(" ")&&(a=a.split(" "));var h=ht(this),f=i?h[0].filter((function(t){return r.$isModified(t)})):h[0],c=h[1];Array.isArray(t)?f=ft(f,t):Array.isArray(a)&&(f=ct(f,a));for(var d={},p=0,y=f.length;p<y;++p){var m=f[p];if(!d[m]){d[m]=!0;var b=n.$__schema.path(m);if(b&&n.$isValid(m)){var v=n.$__getValue(m),w=b.doValidateSync(v,n,{skipSchemaValidators:c[m],path:m,validateModifiedOnly:i});if(w){var _=b.$isSingleNested||b.$isArraySubdocument||b.$isMongooseDocumentArray;if(_&&w instanceof g)continue;n.invalidate(m,w,void 0,!0)}}}}var M=n.$__.validationError;if(n.$__.validationError=void 0,n.$emit("validate",n),n.constructor.emit("validate",n),M)for(var S in M.errors)M.errors[S]instanceof l.CastError&&n.invalidate(S,M.errors[S]);return M},it.prototype.invalidate=function(t,e,r,n){if(this.$__.validationError||(this.$__.validationError=new g(this)),!this.$__.validationError.errors[t])return e&&"string"!=typeof e||(e=new w({path:t,message:e,type:n||"user defined",value:r})),this.$__.validationError===e||this.$__.validationError.addError(t,e),this.$__.validationError},it.prototype.$markValid=function(t){this.$__.validationError&&this.$__.validationError.errors[t]&&(delete this.$__.validationError.errors[t],0===Object.keys(this.$__.validationError.errors).length&&(this.$__.validationError=null))},it.prototype.$isValid=function(t){var e=this;return null==this.$__.validationError||0===Object.keys(this.$__.validationError.errors).length||null!=t&&(-1!==t.indexOf(" ")&&(t=t.split(" ")),Array.isArray(t)?t.some((function(t){return null==e.$__.validationError.errors[t]})):null==this.$__.validationError.errors[t])},it.prototype.$__reset=function(){var t=this;return a||(a=r(27)),this.$__.activePaths.map("init","modify",(function(e){return t.$__getValue(e)})).filter((function(t){return t&&Array.isArray(t)&&U.isMongooseDocumentArray(t)&&t.length})).forEach((function(e){for(var r=e.length;r--;){var n=e[r];n&&n.$__reset()}t.$__.activePaths.init(e.$path()),e[H]=e[Z],e[Z]={}})),this.$__.activePaths.map("init","modify",(function(e){return t.$__getValue(e)})).filter((function(t){return t&&!Array.isArray(t)&&t.$isSingleNested})).forEach((function(e){e.$__reset(),e.$parent()===t?t.$__.activePaths.init(e.$basePath):null!=e.$parent()&&e.$parent().$isSubdocument&&e.$parent().$__reset()})),this.$__dirty().forEach((function(t){var e=t.value;e&&e[Z]&&(e[H]=e[Z],e[Z]={})})),this.$__.backup={},this.$__.backup.activePaths={modify:Object.assign({},this.$__.activePaths.states.modify),default:Object.assign({},this.$__.activePaths.states.default)},this.$__.backup.validationError=this.$__.validationError,this.$__.backup.errors=this.$errors,this.$__.activePaths.clear("modify"),this.$__.activePaths.clear("default"),this.$__.validationError=void 0,this.$errors=void 0,t=this,this.$__schema.requiredPaths().forEach((function(e){t.$__.activePaths.require(e)})),this},
|
|
373
373
|
/*!
|
|
374
374
|
* ignore
|
|
375
375
|
*/
|
|
376
|
-
it.prototype.$__undoReset=function(){if(null!=this.$__.backup&&null!=this.$__.backup.activePaths){this.$__.activePaths.states.modify=this.$__.backup.activePaths.modify,this.$__.activePaths.states.default=this.$__.backup.activePaths.default,this.$__.validationError=this.$__.backup.validationError,this.$errors=this.$__.backup.errors;var t,e=i(this.$__dirty());try{for(e.s();!(t=e.n()).done;){var r=t.value.value;r&&r[Z]&&r[H]&&(r[Z]=r[H])}}catch(t){e.e(t)}finally{e.f()}var n,o=i(this.$getAllSubdocs());try{for(o.s();!(n=o.n()).done;){n.value.$__undoReset()}}catch(t){o.e(t)}finally{o.f()}}},it.prototype.$__dirty=function(){var t=this,e=this.$__.activePaths.map("modify",(function(e){return{path:e,value:t.$__getValue(e),schema:t.$__path(e)}}));e=e.concat(this.$__.activePaths.map("default",(function(e){if("_id"!==e&&null!=t.$__getValue(e))return{path:e,value:t.$__getValue(e),schema:t.$__path(e)}})));var r=new Map(e.filter((function(t){return null!=t})).map((function(t){return[t.path,t.value]}))),n=[];return e.forEach((function(t){if(t){for(var e=null,i=rt(t.path),o=0;o<i.length-1;o++)if(r.has(i[o])){e=r.get(i[o]);break}null==e?n.push(t):null!=e&&null!=e[Z]&&e.hasAtomics()&&(e[Z]={},e[Z].$set=e)}})),n},it.prototype.$__setSchema=function(t){A(t.tree,this,void 0,t.options);for(var e=0,r=Object.keys(t.virtuals);e<r.length;e++){var n=r[e];t.virtuals[n]._applyDefaultGetters()}null==t.path("schema")&&(this.schema=t),this.$__schema=t,this[Q]=t},it.prototype.$__getArrayPathsToValidate=function(){return a||(a=r(27)),this.$__.activePaths.map("init","modify",function(t){return this.$__getValue(t)}.bind(this)).filter((function(t){return t&&Array.isArray(t)&&U.isMongooseDocumentArray(t)&&t.length})).reduce((function(t,e){return t.concat(e)}),[]).filter((function(t){return t}))},it.prototype.$getAllSubdocs=function(){function t(e,r,n){var i=e,o=!1;if(n&&(e instanceof it&&e[Q].paths[n]?i=e._doc[n]:e instanceof it&&e[Q].nested[n]?(i=e._doc[n],o=!0):i=e[n]),i instanceof h)r.push(i);else if(i instanceof Map)r=Array.from(i.keys()).reduce((function(e,r){return t(i.get(r),e,null)}),r);else if(i&&!Array.isArray(i)&&i.$isSingleNested)(r=Object.keys(i._doc).reduce((function(e,r){return t(i._doc,e,r)}),r)).push(i);else if(i&&U.isMongooseDocumentArray(i))i.forEach((function(e){e&&e._doc&&(r=Object.keys(e._doc).reduce((function(r,n){return t(e._doc,r,n)}),r),e instanceof h&&r.push(e))}));else if(o&&null!=i)for(var s=0,a=Object.keys(i);s<a.length;s++){var u=a[s];t(i,r,u)}return r}a||(a=r(27)),h=h||r(46);for(var e=[],n=0,i=Object.keys(this._doc);n<i.length;n++){t(this,e,i[n])}return e},it.prototype.$__handleReject=function(t){this.$listeners("error").length?this.$emit("error",t):this.constructor.listeners&&this.constructor.listeners("error").length&&this.constructor.emit("error",t)},it.prototype.$toObject=function(t,e){var r,n,i={transform:!0,flattenDecimals:!0},o=e?"toJSON":"toObject",s=this.constructor&&this.constructor.base&&this.constructor.base.options&&j(this.constructor.base.options,o)||{},a=this.$__schema&&this.$__schema.options||{};i=U.options(i,z(s)),i=U.options(i,z(a[o]||{})),(t=U.isPOJO(t)?z(t):{})._calledWithOptions=t._calledWithOptions||z(t),r=null!=t._calledWithOptions.minimize?t.minimize:null!=i.minimize?i.minimize:a.minimize,n=null!=t._calledWithOptions.flattenMaps?t.flattenMaps:null!=i.flattenMaps?i.flattenMaps:a.flattenMaps;var u=Object.assign(U.clone(t),{_isNested:!0,json:e,minimize:r,flattenMaps:n});if(U.hasUserDefinedProperty(t,"getters")&&(u.getters=t.getters),U.hasUserDefinedProperty(t,"virtuals")&&(u.virtuals=t.virtuals),(t.depopulate||t._parentOptions&&t._parentOptions.depopulate||!1)&&t._isNested&&this.$__.wasPopulated)return z(this._id,u);(t=U.options(i,t))._isNested=!0,t.json=e,t.minimize=r,u._parentOptions=t,u._skipSingleNestedGetters=!0;var h=Object.assign({},u);h._skipSingleNestedGetters=!1;var f=t.transform,c=z(this._doc,u)||{};t.getters&&(!function(t,e,r){var n,i,o=t.$__schema,s=Object.keys(o.paths),a=s.length,u=t._doc;if(!u)return e;for(;a--;){var h=(n=s[a]).split("."),f=h.length,c=f-1,l=e,d=void 0;if(u=t._doc,t.$__isSelected(n))for(var p=0;p<f;++p){if(d=h[p],i=u[d],p===c){var y=t.$get(n);l[d]=z(y,r)}else{if(null==i){d in u&&(l[d]=i);break}l=l[d]||(l[d]={})}u=i}}}
|
|
376
|
+
it.prototype.$__undoReset=function(){if(null!=this.$__.backup&&null!=this.$__.backup.activePaths){this.$__.activePaths.states.modify=this.$__.backup.activePaths.modify,this.$__.activePaths.states.default=this.$__.backup.activePaths.default,this.$__.validationError=this.$__.backup.validationError,this.$errors=this.$__.backup.errors;var t,e=i(this.$__dirty());try{for(e.s();!(t=e.n()).done;){var r=t.value.value;r&&r[Z]&&r[H]&&(r[Z]=r[H])}}catch(t){e.e(t)}finally{e.f()}var n,o=i(this.$getAllSubdocs());try{for(o.s();!(n=o.n()).done;){n.value.$__undoReset()}}catch(t){o.e(t)}finally{o.f()}}},it.prototype.$__dirty=function(){var t=this,e=this.$__.activePaths.map("modify",(function(e){return{path:e,value:t.$__getValue(e),schema:t.$__path(e)}}));e=e.concat(this.$__.activePaths.map("default",(function(e){if("_id"!==e&&null!=t.$__getValue(e))return{path:e,value:t.$__getValue(e),schema:t.$__path(e)}})));var r=new Map(e.filter((function(t){return null!=t})).map((function(t){return[t.path,t.value]}))),n=[];return e.forEach((function(t){if(t){for(var e=null,i=rt(t.path),o=0;o<i.length-1;o++)if(r.has(i[o])){e=r.get(i[o]);break}null==e?n.push(t):null!=e&&null!=e[Z]&&e.hasAtomics()&&(e[Z]={},e[Z].$set=e)}})),n},it.prototype.$__setSchema=function(t){A(t.tree,this,void 0,t.options);for(var e=0,r=Object.keys(t.virtuals);e<r.length;e++){var n=r[e];t.virtuals[n]._applyDefaultGetters()}null==t.path("schema")&&(this.schema=t),this.$__schema=t,this[Q]=t},it.prototype.$__getArrayPathsToValidate=function(){return a||(a=r(27)),this.$__.activePaths.map("init","modify",function(t){return this.$__getValue(t)}.bind(this)).filter((function(t){return t&&Array.isArray(t)&&U.isMongooseDocumentArray(t)&&t.length})).reduce((function(t,e){return t.concat(e)}),[]).filter((function(t){return t}))},it.prototype.$getAllSubdocs=function(){function t(e,r,n){var i=e,o=!1;if(n&&(e instanceof it&&e[Q].paths[n]?i=e._doc[n]:e instanceof it&&e[Q].nested[n]?(i=e._doc[n],o=!0):i=e[n]),i instanceof h)r.push(i);else if(i instanceof Map)r=Array.from(i.keys()).reduce((function(e,r){return t(i.get(r),e,null)}),r);else if(i&&!Array.isArray(i)&&i.$isSingleNested)(r=Object.keys(i._doc).reduce((function(e,r){return t(i._doc,e,r)}),r)).push(i);else if(i&&U.isMongooseDocumentArray(i))i.forEach((function(e){e&&e._doc&&(r=Object.keys(e._doc).reduce((function(r,n){return t(e._doc,r,n)}),r),e instanceof h&&r.push(e))}));else if(o&&null!=i)for(var s=0,a=Object.keys(i);s<a.length;s++){var u=a[s];t(i,r,u)}return r}a||(a=r(27)),h=h||r(46);for(var e=[],n=0,i=Object.keys(this._doc);n<i.length;n++){t(this,e,i[n])}return e},it.prototype.$__handleReject=function(t){this.$listeners("error").length?this.$emit("error",t):this.constructor.listeners&&this.constructor.listeners("error").length&&this.constructor.emit("error",t)},it.prototype.$toObject=function(t,e){var r,n,i={transform:!0,flattenDecimals:!0},o=e?"toJSON":"toObject",s=this.constructor&&this.constructor.base&&this.constructor.base.options&&j(this.constructor.base.options,o)||{},a=this.$__schema&&this.$__schema.options||{};i=U.options(i,z(s)),i=U.options(i,z(a[o]||{})),(t=U.isPOJO(t)?z(t):{})._calledWithOptions=t._calledWithOptions||z(t),r=null!=t._calledWithOptions.minimize?t.minimize:null!=i.minimize?i.minimize:a.minimize,n=null!=t._calledWithOptions.flattenMaps?t.flattenMaps:null!=i.flattenMaps?i.flattenMaps:a.flattenMaps;var u=Object.assign(U.clone(t),{_isNested:!0,json:e,minimize:r,flattenMaps:n});if(U.hasUserDefinedProperty(t,"getters")&&(u.getters=t.getters),U.hasUserDefinedProperty(t,"virtuals")&&(u.virtuals=t.virtuals),(t.depopulate||t._parentOptions&&t._parentOptions.depopulate||!1)&&t._isNested&&this.$__.wasPopulated)return z(this.$__.wasPopulated.value||this._id,u);(t=U.options(i,t))._isNested=!0,t.json=e,t.minimize=r,u._parentOptions=t,u._skipSingleNestedGetters=!0;var h=Object.assign({},u);h._skipSingleNestedGetters=!1;var f=t.transform,c=z(this._doc,u)||{};t.getters&&(!function(t,e,r){var n,i,o=t.$__schema,s=Object.keys(o.paths),a=s.length,u=t._doc;if(!u)return e;for(;a--;){var h=(n=s[a]).split("."),f=h.length,c=f-1,l=e,d=void 0;if(u=t._doc,t.$__isSelected(n))for(var p=0;p<f;++p){if(d=h[p],i=u[d],p===c){var y=t.$get(n);l[d]=z(y,r)}else{if(null==i){d in u&&(l[d]=i);break}l=l[d]||(l[d]={})}u=i}}}
|
|
377
377
|
/*!
|
|
378
378
|
* Applies schema type transforms to `json`.
|
|
379
379
|
*
|
|
@@ -438,7 +438,7 @@ n.prototype.hasOwnProperty("valueOf")||(n.prototype.valueOf=function(){return th
|
|
|
438
438
|
*/var n=null;t.exports.get=function(){return n},t.exports.set=function(t){n=t}},function(t,e,r){"use strict";var n=r(47),i=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};t.exports=c;var o=Object.create(r(37));o.inherits=r(0);var s=r(105),a=r(65);o.inherits(c,s);for(var u=i(a.prototype),h=0;h<u.length;h++){var f=u[h];c.prototype[f]||(c.prototype[f]=a.prototype[f])}function c(t){if(!(this instanceof c))return new c(t);s.call(this,t),a.call(this,t),t&&!1===t.readable&&(this.readable=!1),t&&!1===t.writable&&(this.writable=!1),this.allowHalfOpen=!0,t&&!1===t.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",l)}function l(){this.allowHalfOpen||this._writableState.ended||n.nextTick(d,this)}function d(t){t.end()}Object.defineProperty(c.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(c.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(t){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}}),c.prototype._destroy=function(t,e){this.push(null),this.end(),n.nextTick(e,t)}},function(t,e,r){"use strict";
|
|
439
439
|
/*!
|
|
440
440
|
* Module dependencies.
|
|
441
|
-
*/function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var i=r(89),o=r(
|
|
441
|
+
*/function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var i=r(89),o=r(328),s=r(13),a=r(1).arrayAtomicsSymbol,u=r(1).arrayAtomicsBackupSymbol,h=r(1).arrayParentSymbol,f=r(1).arrayPathSymbol,c=r(1).arraySchemaSymbol,l=Array.prototype.push,d=/^\d+$/;
|
|
442
442
|
/*!
|
|
443
443
|
* Module exports.
|
|
444
444
|
*/
|
|
@@ -600,7 +600,7 @@ var n=r(3),i=n.Buffer;function o(t,e){for(var r in t)e[r]=t[r]}function s(t,e,r)
|
|
|
600
600
|
/*!
|
|
601
601
|
* Module dependencies.
|
|
602
602
|
*/
|
|
603
|
-
function i(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function s(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return a(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return a(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return s=t.done,t},e:function(t){u=!0,o=t},f:function(){try{s||null==r.return||r.return()}finally{if(u)throw o}}}}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var u,h=r(12).EventEmitter,f=r(306),c=r(19),l=r(9),d=r(15),p=r(307),y=r(86),m=r(155),b=r(14),v=r(22),g=r(308),w=r(
|
|
603
|
+
function i(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function s(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return a(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return a(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return s=t.done,t},e:function(t){u=!0,o=t},f:function(){try{s||null==r.return||r.return()}finally{if(u)throw o}}}}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var u,h=r(12).EventEmitter,f=r(306),c=r(19),l=r(9),d=r(15),p=r(307),y=r(86),m=r(155),b=r(14),v=r(22),g=r(308),w=r(310),_=r(150),M=r(81),S=r(25).get().ReadPreference,O=r(311),A=r(4),E=r(315),x=r(316).middlewareFunctions,k=r(157).middlewareFunctions,j=x.concat(k).reduce((function(t,e){return t.add(e)}),new Set),$=A.isPOJO,P=0;function R(t,e){if(!(this instanceof R))return new R(t,e);if(this.obj=t,this.paths={},this.aliases={},this.subpaths={},this.virtuals={},this.singleNestedPaths={},this.nested={},this.inherits={},this.callQueue=[],this._indexes=[],this.methods={},this.methodOptions={},this.statics={},this.tree={},this.query={},this.childSchemas=[],this.plugins=[],this.$id=++P,this.mapPaths=[],this.s={hooks:new f},this.options=this.defaultOptions(e),Array.isArray(t)){var r,n=s(t);try{for(n.s();!(r=n.n()).done;){var i=r.value;this.add(i)}}catch(t){n.e(t)}finally{n.f()}}else t&&this.add(t);var o=t&&t._id&&A.isObject(t._id);!this.paths._id&&this.options._id&&!o&&m(this),this.setupTimestamp(this.options.timestamps)}
|
|
604
604
|
/*!
|
|
605
605
|
* Create virtual properties with alias field
|
|
606
606
|
*/
|
|
@@ -632,7 +632,7 @@ function T(t){return/\.\d+/.test(t)?t.replace(/\.\d+\./g,".$.").replace(/\.\d+$/
|
|
|
632
632
|
function N(t,e){var r=e.split(/\.(\d+)\.|\.(\d+)$/).filter(Boolean);if(r.length<2)return t.paths.hasOwnProperty(r[0])?t.paths[r[0]]:"adhocOrUndefined";var n=t.path(r[0]),i=!1;if(!n)return"adhocOrUndefined";for(var o=r.length-1,s=1;s<r.length;++s){i=!1;var a=r[s];if(s===o&&n&&!/\D/.test(a)){n=n.$isMongooseDocumentArray?n.$embeddedSchemaType:n instanceof u.Array?n.caster:void 0;break}if(/\D/.test(a)){if(!n||!n.schema){n=void 0;break}i="nested"===n.schema.pathType(a),n=n.schema.path(a)}else n instanceof u.Array&&s!==o&&(n=n.caster)}return t.subpaths[e]=n,n?"real":i?"nested":"adhocOrUndefined"}
|
|
633
633
|
/*!
|
|
634
634
|
* ignore
|
|
635
|
-
*/B.prototype=B.emit=B.listeners=B.on=B.removeListener=B.collection=B.errors=B.get=B.init=B.isModified=B.isNew=B.populated=B.remove=B.save=B.toObject=B.validate=1,B.collection=1,R.prototype.path=function(t,e){var r=T(t);if(void 0===e){var n=function(t,e,r){if(t.paths.hasOwnProperty(e))return t.paths[e];if(t.subpaths.hasOwnProperty(r))return t.subpaths[r];if(t.singleNestedPaths.hasOwnProperty(r)&&"object"===o(t.singleNestedPaths[r]))return t.singleNestedPaths[r];return null}(this,t,r);if(null!=n)return n;var i=I(this,t);return null!=i?i:null!=(n=this.hasMixedParent(r))?n:/\.\d+\.?.*$/.test(t)?function(t,e){return N(t,e),t.subpaths[e]}(this,t):void 0}var a=t.split(".")[0];if(B[a]&&!this.options.supressReservedKeysWarning){var u="`".concat(a,"` is a reserved schema pathname and may break some functionality. ")+"You are allowed to use it, but use at your own risk. To disable this warning pass `supressReservedKeysWarning` as a schema option.";A.warn(u)}"object"===o(e)&&A.hasUserDefinedProperty(e,"ref")&&E(e.ref,t);var h,f=t.split(/\./),c=f.pop(),d=this.tree,p="",y=s(f);try{for(y.s();!(h=y.n()).done;){var m=h.value;if(p=p+=(p.length>0?".":"")+m,d[m]||(this.nested[p]=!0,d[m]={}),"object"!==o(d[m])){var b="Cannot set nested path `"+t+"`. Parent path `"+p+"` already set to type "+d[m].name+".";throw new Error(b)}d=d[m]}}catch(t){y.e(t)}finally{y.f()}d[c]=A.clone(e),this.paths[t]=this.interpretAsType(t,e,this.options);var v=this.paths[t];if(v.$isSchemaMap){var g=t+".$*";this.paths[g]=v.$__schemaType,this.mapPaths.push(this.paths[g])}if(v.$isSingleNested){for(var w=0,_=Object.keys(v.schema.paths);w<_.length;w++){var M=_[w];this.singleNestedPaths[t+"."+M]=v.schema.paths[M]}for(var S=0,O=Object.keys(v.schema.singleNestedPaths);S<O.length;S++){var x=O[S];this.singleNestedPaths[t+"."+x]=v.schema.singleNestedPaths[x]}for(var k=0,j=Object.keys(v.schema.subpaths);k<j.length;k++){var $=j[k];this.singleNestedPaths[t+"."+$]=v.schema.subpaths[$]}for(var P=0,R=Object.keys(v.schema.nested);P<R.length;P++){var D=R[P];this.singleNestedPaths[t+"."+D]="nested"}Object.defineProperty(v.schema,"base",{configurable:!0,enumerable:!1,writable:!1,value:this.base}),v.caster.base=this.base,this.childSchemas.push({schema:v.schema,model:v.caster})}else v.$isMongooseDocumentArray&&(Object.defineProperty(v.schema,"base",{configurable:!0,enumerable:!1,writable:!1,value:this.base}),v.casterConstructor.base=this.base,this.childSchemas.push({schema:v.schema,model:v.casterConstructor}));if(v.$isMongooseArray&&v.caster instanceof l){for(var C=t,L=v,q=[];L.$isMongooseArray;)C+=".$",L.$isMongooseDocumentArray?(L.$embeddedSchemaType._arrayPath=C,L.$embeddedSchemaType._arrayParentPath=t,L=L.$embeddedSchemaType.clone()):(L.caster._arrayPath=C,L.caster._arrayParentPath=t,L=L.caster.clone()),L.path=C,q.push(L);for(var U=0,F=q;U<F.length;U++){var z=F[U];this.subpaths[z.path]=z}}if(v.$isMongooseDocumentArray){for(var V=0,K=Object.keys(v.schema.paths);V<K.length;V++){var H=K[V],Z=v.schema.paths[H];this.subpaths[t+"."+H]=Z,"object"===o(Z)&&null!=Z&&(Z.$isUnderneathDocArray=!0)}for(var W=0,J=Object.keys(v.schema.subpaths);W<J.length;W++){var Y=J[W],Q=v.schema.subpaths[Y];this.subpaths[t+"."+Y]=Q,"object"===o(Q)&&null!=Q&&(Q.$isUnderneathDocArray=!0)}for(var G=0,X=Object.keys(v.schema.singleNestedPaths);G<X.length;G++){var tt=X[G],et=v.schema.singleNestedPaths[tt];this.subpaths[t+"."+tt]=et,"object"===o(et)&&null!=et&&(et.$isUnderneathDocArray=!0)}}return this},Object.defineProperty(R.prototype,"base",{configurable:!0,enumerable:!1,writable:!0,value:null}),R.prototype.interpretAsType=function(t,e,r){if(e instanceof l){if(e.path===t)return e;var s=e.clone();return s.path=t,s}var a=null!=this.base?this.base.Schema.Types:R.Types;if(!(A.isPOJO(e)||e instanceof d)&&"Object"!==A.getFunctionName(e.constructor)){var u=e;(e={})[r.typeKey]=u}var h,f=e[r.typeKey]&&(e[r.typeKey]instanceof Function||"type"!==r.typeKey||!e.type.type)?e[r.typeKey]:{};if(A.isPOJO(f)||"mixed"===f)return new a.Mixed(t,e);if(Array.isArray(f)||f===Array||"array"===f||f===a.Array){var c=f===Array||"array"===f?e.cast||e.of:f[0];if(c&&c.instanceOfSchema){if(!(c instanceof R))throw new TypeError("Schema for array path `"+t+"` is from a different copy of the Mongoose module. Please make sure you're using the same version of Mongoose everywhere with `npm list mongoose`.");return new a.DocumentArray(t,c,e)}if(c&&c[r.typeKey]&&c[r.typeKey].instanceOfSchema){if(!(c[r.typeKey]instanceof R))throw new TypeError("Schema for array path `"+t+"` is from a different copy of the Mongoose module. Please make sure you're using the same version of Mongoose everywhere with `npm list mongoose`.");return new a.DocumentArray(t,c[r.typeKey],e,c)}if(Array.isArray(c))return new a.Array(t,this.interpretAsType(t,c,r),e);var p=null==c||!c[r.typeKey]||"type"===r.typeKey&&c.type.type?c:c[r.typeKey];if("string"==typeof c)c=a[c.charAt(0).toUpperCase()+c.substring(1)];else if(A.isPOJO(p)){if(Object.keys(p).length){var y={minimize:r.minimize};r.typeKey&&(y.typeKey=r.typeKey),r.hasOwnProperty("strict")&&(y.strict=r.strict),this._userProvidedOptions.hasOwnProperty("_id")?y._id=this._userProvidedOptions._id:null!=R.Types.DocumentArray.defaultOptions._id&&(y._id=R.Types.DocumentArray.defaultOptions._id);var m=new R(p,y);return m.$implicitlyCreated=!0,new a.DocumentArray(t,m,e)}return new a.Array(t,a.Mixed,e)}if(c){if(
|
|
635
|
+
*/B.prototype=B.emit=B.listeners=B.on=B.removeListener=B.collection=B.errors=B.get=B.init=B.isModified=B.isNew=B.populated=B.remove=B.save=B.toObject=B.validate=1,B.collection=1,R.prototype.path=function(t,e){var r=T(t);if(void 0===e){var n=function(t,e,r){if(t.paths.hasOwnProperty(e))return t.paths[e];if(t.subpaths.hasOwnProperty(r))return t.subpaths[r];if(t.singleNestedPaths.hasOwnProperty(r)&&"object"===o(t.singleNestedPaths[r]))return t.singleNestedPaths[r];return null}(this,t,r);if(null!=n)return n;var i=I(this,t);return null!=i?i:null!=(n=this.hasMixedParent(r))?n:/\.\d+\.?.*$/.test(t)?function(t,e){return N(t,e),t.subpaths[e]}(this,t):void 0}var a=t.split(".")[0];if(B[a]&&!this.options.supressReservedKeysWarning){var u="`".concat(a,"` is a reserved schema pathname and may break some functionality. ")+"You are allowed to use it, but use at your own risk. To disable this warning pass `supressReservedKeysWarning` as a schema option.";A.warn(u)}"object"===o(e)&&A.hasUserDefinedProperty(e,"ref")&&E(e.ref,t);var h,f=t.split(/\./),c=f.pop(),d=this.tree,p="",y=s(f);try{for(y.s();!(h=y.n()).done;){var m=h.value;if(p=p+=(p.length>0?".":"")+m,d[m]||(this.nested[p]=!0,d[m]={}),"object"!==o(d[m])){var b="Cannot set nested path `"+t+"`. Parent path `"+p+"` already set to type "+d[m].name+".";throw new Error(b)}d=d[m]}}catch(t){y.e(t)}finally{y.f()}d[c]=A.clone(e),this.paths[t]=this.interpretAsType(t,e,this.options);var v=this.paths[t];if(v.$isSchemaMap){var g=t+".$*";this.paths[g]=v.$__schemaType,this.mapPaths.push(this.paths[g])}if(v.$isSingleNested){for(var w=0,_=Object.keys(v.schema.paths);w<_.length;w++){var M=_[w];this.singleNestedPaths[t+"."+M]=v.schema.paths[M]}for(var S=0,O=Object.keys(v.schema.singleNestedPaths);S<O.length;S++){var x=O[S];this.singleNestedPaths[t+"."+x]=v.schema.singleNestedPaths[x]}for(var k=0,j=Object.keys(v.schema.subpaths);k<j.length;k++){var $=j[k];this.singleNestedPaths[t+"."+$]=v.schema.subpaths[$]}for(var P=0,R=Object.keys(v.schema.nested);P<R.length;P++){var D=R[P];this.singleNestedPaths[t+"."+D]="nested"}Object.defineProperty(v.schema,"base",{configurable:!0,enumerable:!1,writable:!1,value:this.base}),v.caster.base=this.base,this.childSchemas.push({schema:v.schema,model:v.caster})}else v.$isMongooseDocumentArray&&(Object.defineProperty(v.schema,"base",{configurable:!0,enumerable:!1,writable:!1,value:this.base}),v.casterConstructor.base=this.base,this.childSchemas.push({schema:v.schema,model:v.casterConstructor}));if(v.$isMongooseArray&&v.caster instanceof l){for(var C=t,L=v,q=[];L.$isMongooseArray;)C+=".$",L.$isMongooseDocumentArray?(L.$embeddedSchemaType._arrayPath=C,L.$embeddedSchemaType._arrayParentPath=t,L=L.$embeddedSchemaType.clone()):(L.caster._arrayPath=C,L.caster._arrayParentPath=t,L=L.caster.clone()),L.path=C,q.push(L);for(var U=0,F=q;U<F.length;U++){var z=F[U];this.subpaths[z.path]=z}}if(v.$isMongooseDocumentArray){for(var V=0,K=Object.keys(v.schema.paths);V<K.length;V++){var H=K[V],Z=v.schema.paths[H];this.subpaths[t+"."+H]=Z,"object"===o(Z)&&null!=Z&&(Z.$isUnderneathDocArray=!0)}for(var W=0,J=Object.keys(v.schema.subpaths);W<J.length;W++){var Y=J[W],Q=v.schema.subpaths[Y];this.subpaths[t+"."+Y]=Q,"object"===o(Q)&&null!=Q&&(Q.$isUnderneathDocArray=!0)}for(var G=0,X=Object.keys(v.schema.singleNestedPaths);G<X.length;G++){var tt=X[G],et=v.schema.singleNestedPaths[tt];this.subpaths[t+"."+tt]=et,"object"===o(et)&&null!=et&&(et.$isUnderneathDocArray=!0)}}return this},Object.defineProperty(R.prototype,"base",{configurable:!0,enumerable:!1,writable:!0,value:null}),R.prototype.interpretAsType=function(t,e,r){if(e instanceof l){if(e.path===t)return e;var s=e.clone();return s.path=t,s}var a=null!=this.base?this.base.Schema.Types:R.Types;if(!(A.isPOJO(e)||e instanceof d)&&"Object"!==A.getFunctionName(e.constructor)){var u=e;(e={})[r.typeKey]=u}var h,f=e[r.typeKey]&&(e[r.typeKey]instanceof Function||"type"!==r.typeKey||!e.type.type)?e[r.typeKey]:{};if(A.isPOJO(f)||"mixed"===f)return new a.Mixed(t,e);if(Array.isArray(f)||f===Array||"array"===f||f===a.Array){var c=f===Array||"array"===f?e.cast||e.of:f[0];if(c&&c.instanceOfSchema){if(!(c instanceof R))throw new TypeError("Schema for array path `"+t+"` is from a different copy of the Mongoose module. Please make sure you're using the same version of Mongoose everywhere with `npm list mongoose`.");return new a.DocumentArray(t,c,e)}if(c&&c[r.typeKey]&&c[r.typeKey].instanceOfSchema){if(!(c[r.typeKey]instanceof R))throw new TypeError("Schema for array path `"+t+"` is from a different copy of the Mongoose module. Please make sure you're using the same version of Mongoose everywhere with `npm list mongoose`.");return new a.DocumentArray(t,c[r.typeKey],e,c)}if(Array.isArray(c))return new a.Array(t,this.interpretAsType(t,c,r),e);var p=null==c||!c[r.typeKey]||"type"===r.typeKey&&c.type.type?c:c[r.typeKey];if("string"==typeof c)c=a[c.charAt(0).toUpperCase()+c.substring(1)];else if(A.isPOJO(p)){if(Object.keys(p).length){var y={minimize:r.minimize};r.typeKey&&(y.typeKey=r.typeKey),r.hasOwnProperty("strict")&&(y.strict=r.strict),this._userProvidedOptions.hasOwnProperty("_id")?y._id=this._userProvidedOptions._id:null!=R.Types.DocumentArray.defaultOptions._id&&(y._id=R.Types.DocumentArray.defaultOptions._id);var m=new R(p,y);return m.$implicitlyCreated=!0,new a.DocumentArray(t,m,e)}return new a.Array(t,a.Mixed,e)}if(c){if(f=!c[r.typeKey]||"type"===r.typeKey&&c.type.type?c:c[r.typeKey],Array.isArray(f))return new a.Array(t,this.interpretAsType(t,f,r),e);if("ClockDate"===(h="string"==typeof f?f:f.schemaName||A.getFunctionName(f))&&(h="Date"),void 0===h)throw new TypeError("Invalid schema configuration: "+"Could not determine the embedded type for array `".concat(t,"`. ")+"See https://mongoosejs.com/docs/guide.html#definition for more info on supported schema syntaxes.");if(!a.hasOwnProperty(h))throw new TypeError("Invalid schema configuration: "+"`".concat(h,"` is not a valid type within the array `").concat(t,"`.")+"See https://bit.ly/mongoose-schematypes for a list of valid schema types.")}return new a.Array(t,c||a.Mixed,e,r)}if(f&&f.instanceOfSchema)return new a.Subdocument(f,t,e);if((h=n.isBuffer(f)?"Buffer":"function"==typeof f||"object"===o(f)?f.schemaName||A.getFunctionName(f):null==f?""+f:f.toString())&&(h=h.charAt(0).toUpperCase()+h.substring(1)),"ObjectID"===h&&(h="ObjectId"),"ClockDate"===h&&(h="Date"),void 0===h)throw new TypeError("Invalid schema configuration: `".concat(t,"` schematype definition is ")+"invalid. See https://mongoosejs.com/docs/guide.html#definition for more info on supported schema syntaxes.");if(null==a[h])throw new TypeError("Invalid schema configuration: `".concat(h,"` is not ")+"a valid type at path `".concat(t,"`. See ")+"https://bit.ly/mongoose-schematypes for a list of valid schema types.");var b=new a[h](t,e);return b.$isSchemaMap&&
|
|
636
636
|
/*!
|
|
637
637
|
* ignore
|
|
638
638
|
*/
|
|
@@ -675,10 +675,10 @@ s.prototype.clone=function(){var t=new s(this.options,this.path);return t.getter
|
|
|
675
675
|
t.exports=s},function(t,e,r){"use strict";
|
|
676
676
|
/*!
|
|
677
677
|
* Module exports.
|
|
678
|
-
*/e.String=r(
|
|
678
|
+
*/e.String=r(318),e.Number=r(159),e.Boolean=r(321),e.DocumentArray=r(322),e.Subdocument=r(330),e.Array=r(88),e.Buffer=r(332),e.Date=r(334),e.ObjectId=r(337),e.Mixed=r(45),e.Decimal128=e.Decimal=r(339),e.Map=r(341),e.Oid=e.ObjectId,e.Object=e.Mixed,e.Bool=e.Boolean,e.ObjectID=e.ObjectId},function(t,e,r){"use strict";
|
|
679
679
|
/*!
|
|
680
680
|
* Module dependencies.
|
|
681
|
-
*/function n(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return i(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return i(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,s=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw s}}}}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var o,s,a=r(83),u=r(153),h=r(19),f=r(
|
|
681
|
+
*/function n(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return i(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return i(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,s=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw s}}}}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var o,s,a=r(83),u=r(153),h=r(19),f=r(323),c=r(9),l=c.CastError,d=r(45),p=r(324),y=r(325),m=r(164),b=r(8),v=r(4),g=r(56).castToNumber,w=r(165),_=r(57),M=Symbol("mongoose#isNestedArray"),S=Object.freeze({});function O(t,e,n,i){s||(s=r(58).Embedded);var o,a,u="type";if(i&&i.typeKey&&(u=i.typeKey),this.schemaOptions=i,e){var h={};v.isPOJO(e)&&(e[u]?(delete(h=v.clone(e))[u],e=e[u]):e=d),null!=n&&null!=n.ref&&null==h.ref&&(h.ref=n.ref),e===Object&&(e=d);var f="string"==typeof e?e:v.getFunctionName(e),l=r(87),p=l.hasOwnProperty(f)?l[f]:e;if(this.casterConstructor=p,this.casterConstructor instanceof O&&(this.casterConstructor[M]=!0),"function"!=typeof p||p.$isArraySubdocument||p.$isSchemaMap)this.caster=p,this.caster instanceof s||(this.caster.path=t);else{var y=this.caster instanceof s?null:t;this.caster=new p(y,h)}this.$embeddedSchemaType=this.caster}if(this.$isMongooseArray=!0,c.call(this,t,n,"Array"),null!=this.defaultValue&&(o=this.defaultValue,a="function"==typeof o),!("defaultValue"in this)||void 0!==this.defaultValue){var m=function(){return a?o.call(this):null!=o?[].concat(o):[]};m.$runBeforeSetters=!a,this.default(m)}}O.schemaName="Array",O.options={castNonArrays:!0},
|
|
682
682
|
/*!
|
|
683
683
|
* ignore
|
|
684
684
|
*/
|
|
@@ -897,7 +897,7 @@ o.middlewareFunctions=["deleteOne","save","validate","remove","updateOne","init"
|
|
|
897
897
|
*/t.exports=function(t,e){if(null==t)return t;if(t._id&&"string"==typeof t._id)return t._id;if(t.toString&&t.toString!==Object.prototype.toString&&!Array.isArray(t))return t.toString();throw new n("string",t,e)}},function(t,e,r){"use strict";
|
|
898
898
|
/*!
|
|
899
899
|
* Module requirements.
|
|
900
|
-
*/var n=r(7),i=r(
|
|
900
|
+
*/var n=r(7),i=r(320),o=r(9),s=r(160),a=r(161),u=r(4),h=o.CastError;function f(t,e){o.call(this,t,e,"Number")}
|
|
901
901
|
/*!
|
|
902
902
|
* ignore
|
|
903
903
|
*/
|
|
@@ -980,7 +980,7 @@ o.mixin={_subtype:void 0,_markModified:function(){var t=this[a];return t&&t.mark
|
|
|
980
980
|
/*!
|
|
981
981
|
* Module exports.
|
|
982
982
|
*/
|
|
983
|
-
o.Binary=n,t.exports=o}).call(this,r(3).Buffer)},function(t,e,r){"use strict";var n=r(25).get().ObjectId;t.exports=function(t){if(null==t)return t;if(t instanceof n)return t;if(t._id){if(t._id instanceof n)return t._id;if(t._id.toString instanceof Function)return new n(t._id.toString())}return t.toString instanceof Function?new n(t.toString()):new n(t)}},function(t,e,r){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return o(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return o(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,s=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw s}}}}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function s(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function a(){return(a="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=u(t,e);if(n){var i=Object.getOwnPropertyDescriptor(n,e);return i.get?i.get.call(arguments.length<3?t:r):i.value}}).apply(this,arguments)}function u(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=p(t)););return t}function h(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function f(t){var e="function"==typeof Map?new Map:void 0;return(f=function(t){if(null===t||(r=t,-1===Function.toString.call(r).indexOf("[native code]")))return t;var r;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return c(t,arguments,p(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),d(n,t)})(t)}function c(t,e,r){return(c=l()?Reflect.construct:function(t,e,r){var n=[null];n.push.apply(n,e);var i=new(Function.bind.apply(t,n));return r&&d(i,r.prototype),i}).apply(null,arguments)}function l(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function d(t,e){return(d=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function p(t){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var y=r(45),m=r(18),b=r(41),v=r(4).deepEqual,g=r(22),w=r(171),_=r(8),M=r(82),S=r(1).populateModelSymbol,O=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&d(t,e)}(c,t);var e,r,n,o,u,f=(e=c,r=l(),function(){var t,n=p(e);if(r){var i=p(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return h(this,t)});function c(t,e,r,n){var i;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,c),"Object"===g(t)&&(t=Object.keys(t).reduce((function(e,r){return e.concat([[r,t[r]]])}),[])),(i=f.call(this,t)).$__parent=null!=r&&null!=r.$__?r:null,i.$__path=e,i.$__schemaType=null==n?new y(e):n,i.$__runDeferred(),i}return n=c,(o=[{key:"$init",value:function(t,e){A(t),a(p(c.prototype),"set",this).call(this,t,e),null!=e&&e.$isSingleNested&&(e.$basePath=this.$__path+"."+t)}},{key:"$__set",value:function(t,e){a(p(c.prototype),"set",this).call(this,t,e)}},{key:"get",value:function(t,e){return t instanceof m&&(t=t.toString()),!1===(e=e||{}).getters?a(p(c.prototype),"get",this).call(this,t):this.$__schemaType.applyGetters(a(p(c.prototype),"get",this).call(this,t),this.$__parent)}},{key:"set",value:function(t,e){if(t instanceof m&&(t=t.toString()),A(t),e=w(e),null==this.$__schemaType)return this.$__deferred=this.$__deferred||[],void this.$__deferred.push({key:t,value:e});var r=this.$__path+"."+t,n=null!=this.$__parent&&this.$__parent.$__?this.$__parent.$populated(r)||this.$__parent.$populated(this.$__path):null,i=this.get(t);if(null!=n)null==e.$__&&(e=new n.options[S](e)),e.$__.wasPopulated
|
|
983
|
+
o.Binary=n,t.exports=o}).call(this,r(3).Buffer)},function(t,e,r){"use strict";var n=r(25).get().ObjectId;t.exports=function(t){if(null==t)return t;if(t instanceof n)return t;if(t._id){if(t._id instanceof n)return t._id;if(t._id.toString instanceof Function)return new n(t._id.toString())}return t.toString instanceof Function?new n(t.toString()):new n(t)}},function(t,e,r){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return o(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return o(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,s=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw s}}}}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function s(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function a(){return(a="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=u(t,e);if(n){var i=Object.getOwnPropertyDescriptor(n,e);return i.get?i.get.call(arguments.length<3?t:r):i.value}}).apply(this,arguments)}function u(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=p(t)););return t}function h(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function f(t){var e="function"==typeof Map?new Map:void 0;return(f=function(t){if(null===t||(r=t,-1===Function.toString.call(r).indexOf("[native code]")))return t;var r;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return c(t,arguments,p(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),d(n,t)})(t)}function c(t,e,r){return(c=l()?Reflect.construct:function(t,e,r){var n=[null];n.push.apply(n,e);var i=new(Function.bind.apply(t,n));return r&&d(i,r.prototype),i}).apply(null,arguments)}function l(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function d(t,e){return(d=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function p(t){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var y=r(45),m=r(18),b=r(41),v=r(4).deepEqual,g=r(22),w=r(171),_=r(8),M=r(82),S=r(1).populateModelSymbol,O=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&d(t,e)}(c,t);var e,r,n,o,u,f=(e=c,r=l(),function(){var t,n=p(e);if(r){var i=p(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return h(this,t)});function c(t,e,r,n){var i;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,c),"Object"===g(t)&&(t=Object.keys(t).reduce((function(e,r){return e.concat([[r,t[r]]])}),[])),(i=f.call(this,t)).$__parent=null!=r&&null!=r.$__?r:null,i.$__path=e,i.$__schemaType=null==n?new y(e):n,i.$__runDeferred(),i}return n=c,(o=[{key:"$init",value:function(t,e){A(t),a(p(c.prototype),"set",this).call(this,t,e),null!=e&&e.$isSingleNested&&(e.$basePath=this.$__path+"."+t)}},{key:"$__set",value:function(t,e){a(p(c.prototype),"set",this).call(this,t,e)}},{key:"get",value:function(t,e){return t instanceof m&&(t=t.toString()),!1===(e=e||{}).getters?a(p(c.prototype),"get",this).call(this,t):this.$__schemaType.applyGetters(a(p(c.prototype),"get",this).call(this,t),this.$__parent)}},{key:"set",value:function(t,e){if(t instanceof m&&(t=t.toString()),A(t),e=w(e),null==this.$__schemaType)return this.$__deferred=this.$__deferred||[],void this.$__deferred.push({key:t,value:e});var r=this.$__path+"."+t,n=null!=this.$__parent&&this.$__parent.$__?this.$__parent.$populated(r)||this.$__parent.$populated(this.$__path):null,i=this.get(t);if(null!=n)null==e.$__&&(e=new n.options[S](e)),e.$__.wasPopulated={value:n.value};else try{e=this.$__schemaType.applySetters(e,this.$__parent,!1,this.get(t),{path:r})}catch(t){if(null!=this.$__parent&&null!=this.$__parent.$__)return void this.$__parent.invalidate(r,t);throw t}a(p(c.prototype),"set",this).call(this,t,e),null!=e&&e.$isSingleNested&&(e.$basePath=this.$__path+"."+t);var o=this.$__parent;null==o||null==o.$__||v(e,i)||o.markModified(this.$__path+"."+t)}},{key:"clear",value:function(){a(p(c.prototype),"clear",this).call(this);var t=this.$__parent;null!=t&&t.markModified(this.$__path)}},{key:"delete",value:function(t){t instanceof m&&(t=t.toString()),this.set(t,void 0),a(p(c.prototype),"delete",this).call(this,t)}},{key:"toBSON",value:function(){return new Map(this)}},{key:"toObject",value:function(t){if(t&&t.flattenMaps){var e,r={},n=i(this.keys());try{for(n.s();!(e=n.n()).done;){var o=e.value;r[o]=b(this.get(o),t)}}catch(t){n.e(t)}finally{n.f()}return r}return new Map(this)}},{key:"$toObject",value:function(){return this.constructor.prototype.toObject.apply(this,arguments)}},{key:"toJSON",value:function(t){if("boolean"!=typeof(t&&t.flattenMaps)||t.flattenMaps){var e,r={},n=i(this.keys());try{for(n.s();!(e=n.n()).done;){var o=e.value;r[o]=b(this.get(o),t)}}catch(t){n.e(t)}finally{n.f()}return r}return new Map(this)}},{key:"inspect",value:function(){return new Map(this)}},{key:"$__runDeferred",value:function(){if(this.$__deferred){var t,e=i(this.$__deferred);try{for(e.s();!(t=e.n()).done;){var r=t.value;this.set(r.key,r.value)}}catch(t){e.e(t)}finally{e.f()}this.$__deferred=null}}}])&&s(n.prototype,o),u&&s(n,u),Object.defineProperty(n,"prototype",{writable:!1}),c}(f(Map));
|
|
984
984
|
/*!
|
|
985
985
|
* Since maps are stored as objects under the hood, keys must be strings
|
|
986
986
|
* and can't contain any invalid characters
|
|
@@ -1032,7 +1032,7 @@ t.exports=n},function(t,e,r){"use strict";
|
|
|
1032
1032
|
*/t.exports=function(){}},function(t,e,r){"use strict";
|
|
1033
1033
|
/*!
|
|
1034
1034
|
* Module dependencies.
|
|
1035
|
-
*/var n=r(13),i=r(
|
|
1035
|
+
*/var n=r(13),i=r(355),o=!1;t.exports=function(){return o?i:n},
|
|
1036
1036
|
/*!
|
|
1037
1037
|
* ignore
|
|
1038
1038
|
*/
|
|
@@ -1245,26 +1245,26 @@ t.exports=h},function(t,e,r){"use strict";var n=r(44);
|
|
|
1245
1245
|
/*!
|
|
1246
1246
|
* exports
|
|
1247
1247
|
*/
|
|
1248
|
-
t.exports=h},function(t,e,r){"use strict";(function(e){function r(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return n(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return n(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var i=0,o=function(){};return{s:o,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,s=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw s}}}}function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(){this._pres=new Map,this._posts=new Map}function s(t,e,r,n,i,o,s){return o.useErrorHandlers?t.execPost(r,n,i,{error:e},(function(t){return"function"==typeof s&&s(t)})):"function"==typeof s&&s(e)}function a(t,e,r,n){var i;try{i=t.apply(e,r)}catch(t){return n(t)}u(i)&&i.then((function(){return n()}),(function(t){return n(t)}))}function u(t){return null!=t&&"function"==typeof t.then}function h(t){var r=!1,n=this;return function(){var i=arguments;if(!r)return r=!0,e.nextTick((function(){return t.apply(n,i)}))}}o.prototype.execPre=function(t,r,n,i){3===arguments.length&&(i=n,n=[]);var o=this._pres.get(t)||[],s=o.length,f=o.numAsync||0,c=0,l=f,d=!1,p=n;if(!s)return e.nextTick((function(){i(null)}));var y=function t(){if(!(c>=s)){var n=o[c];if(n.isAsync){var f=[h(m),h((function(t){if(t){if(d)return;return d=!0,i(t)}if(0==--l&&c>=s)return i(null)}))];a(n.fn,r,f,f[0])}else if(n.fn.length>0){f=[h(m)];for(var y=arguments.length>=2?arguments:[null].concat(p),b=1;b<y.length;++b)f.push(y[b]);a(n.fn,r,f,f[0])}else{var v=null;try{v=n.fn.call(r)}catch(t){if(null!=t)return i(t)}if(u(v))v.then((function(){return m()}),(function(t){return m(t)}));else{if(++c>=s)return l>0?void 0:e.nextTick((function(){i(null)}));t()}}}};function m(t){if(t){if(d)return;return d=!0,i(t)}if(++c>=s)return l>0?void 0:i(null);y.apply(r,arguments)}y.apply(null,[null].concat(n))},o.prototype.execPreSync=function(t,e,r){for(var n=this._pres.get(t)||[],i=n.length,o=0;o<i;++o)n[o].fn.apply(e,r||[])},o.prototype.execPost=function(t,r,n,i,o){arguments.length<5&&(o=i,i=null);var s=this._posts.get(t)||[],f=s.length,c=0,l=null;if(i&&i.error&&(l=i.error),!f)return e.nextTick((function(){o.apply(null,[l].concat(n))}));var d=function t(){for(var e=s[c].fn,i=0,d=n.length,p=[],y=0;y<d;++y)i+=n[y]&&n[y]._kareemIgnore?0:1,n[y]&&n[y]._kareemIgnore||p.push(n[y]);if(l)if(e.length===i+2){var m=h((function(e){if(e&&(l=e),++c>=f)return o.call(null,l);t()}));a(e,r,[l].concat(p).concat([m]),m)}else{if(++c>=f)return o.call(null,l);t()}else{var b=h((function(e){return e?(l=e,t()):++c>=f?o.apply(null,[null].concat(n)):void t()}));if(e.length===i+2)return++c>=f?o.apply(null,[null].concat(n)):t();if(e.length===i+1)a(e,r,p.concat([b]),b);else{var v,g;try{g=e.apply(r,p)}catch(t){v=t,l=t}if(u(g))return g.then((function(){return b()}),(function(t){return b(t)}));if(++c>=f)return o.apply(null,[v].concat(n));t()}}};d()},o.prototype.execPostSync=function(t,e,r){for(var n=this._posts.get(t)||[],i=n.length,o=0;o<i;++o)n[o].fn.apply(e,r||[])},o.prototype.createWrapperSync=function(t,e){var r=this;return function(){r.execPreSync(t,this,arguments);var n=e.apply(this,arguments);return r.execPostSync(t,this,[n]),n}},o.prototype.wrap=function(t,e,r,n,i){var o=n.length>0?n[n.length-1]:null,a=("function"==typeof o&&n.slice(0,n.length-1),this),u=(i=i||{}).checkForPromise;this.execPre(t,r,n,(function(h){if(h){for(var f=i.numCallbackParams||0,c=i.contextParameter?[r]:[],l=c.length;l<f;++l)c.push(null);return s(a,h,t,r,c,i,o)}var d,p="function"==typeof o?n.length-1:n.length,y=e.length;try{d=e.apply(r,n.slice(0,p).concat(m))}catch(t){return m(t)}if(u){if(null!=d&&"function"==typeof d.then)return d.then((function(t){return m(null,t)}),(function(t){return m(t)}));if(y<p+1)return m(null,d)}function m(){var e=Array.from(arguments);if(e.shift(),i.nullResultByDefault&&0===e.length&&e.push(null),arguments[0])return s(a,arguments[0],t,r,e,i,o);a.execPost(t,r,e,(function(){return arguments[0]?"function"==typeof o?o(arguments[0]):void 0:"function"==typeof o?o.apply(r,arguments):void 0}))}}))},o.prototype.filter=function(t){for(var e=this,r=this.clone(),n=Array.from(r._pres.keys()),i=function(){var n=s[o],i=e._pres.get(n).map((function(t){return Object.assign({},t,{name:n})})).filter(t);if(0===i.length)return r._pres.delete(n),"continue";i.numAsync=i.filter((function(t){return t.isAsync})).length,r._pres.set(n,i)},o=0,s=n;o<s.length;o++)i();for(var a=Array.from(r._posts.keys()),u=function(){var n=f[h],i=e._posts.get(n).map((function(t){return Object.assign({},t,{name:n})})).filter(t);if(0===i.length)return r._posts.delete(n),"continue";r._posts.set(n,i)},h=0,f=a;h<f.length;h++)u();return r},o.prototype.hasHooks=function(t){return this._pres.has(t)||this._posts.has(t)},o.prototype.createWrapper=function(t,r,n,i){var o=this;return this.hasHooks(t)?function(){var e=n||this;o.wrap(t,r,e,Array.from(arguments),i)}:function(){var t=arguments,n=this;e.nextTick((function(){return r.apply(n,t)}))}},o.prototype.pre=function(t,e,r,n,o){var s={};"object"===i(e)&&null!==e?e=(s=e).isAsync:"boolean"!=typeof arguments[1]&&(r=e,e=!1);var a=this._pres.get(t)||[];if(this._pres.set(t,a),e&&(a.numAsync=a.numAsync||0,++a.numAsync),"function"!=typeof r)throw new Error('pre() requires a function, got "'+i(r)+'"');return o?a.unshift(Object.assign({},s,{fn:r,isAsync:e})):a.push(Object.assign({},s,{fn:r,isAsync:e})),this},o.prototype.post=function(t,e,r,n){var o=this._posts.get(t)||[];if("function"==typeof e&&(n=!!r,r=e,e={}),"function"!=typeof r)throw new Error('post() requires a function, got "'+i(r)+'"');return n?o.unshift(Object.assign({},e,{fn:r})):o.push(Object.assign({},e,{fn:r})),this._posts.set(t,o),this},o.prototype.clone=function(){var t,e=new o,n=r(this._pres.keys());try{for(n.s();!(t=n.n()).done;){var i=t.value,s=this._pres.get(i).slice();s.numAsync=this._pres.get(i).numAsync,e._pres.set(i,s)}}catch(t){n.e(t)}finally{n.f()}var a,u=r(this._posts.keys());try{for(u.s();!(a=u.n()).done;){var h=a.value;e._posts.set(h,this._posts.get(h).slice())}}catch(t){u.e(t)}finally{u.f()}return e},o.prototype.merge=function(t,e){var n,i=(e=1===arguments.length||e)?this.clone():this,o=r(t._pres.keys());try{var s=function(){var e=n.value,r=i._pres.get(e)||[],o=t._pres.get(e).filter((function(t){return-1===r.map((function(t){return t.fn})).indexOf(t.fn)})),s=r.concat(o);s.numAsync=r.numAsync||0,s.numAsync+=o.filter((function(t){return t.isAsync})).length,i._pres.set(e,s)};for(o.s();!(n=o.n()).done;)s()}catch(t){o.e(t)}finally{o.f()}var a,u=r(t._posts.keys());try{var h=function(){var e=a.value,r=i._posts.get(e)||[],n=t._posts.get(e).filter((function(t){return-1===r.indexOf(t)}));i._posts.set(e,r.concat(n))};for(u.s();!(a=u.n()).done;)h()}catch(t){u.e(t)}finally{u.f()}return i},t.exports=o}).call(this,r(5))},function(t,e,r){"use strict";function n(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function i(t,e,r){return e&&n(t.prototype,e),r&&n(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}var o=r(16),s=i((function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),Object.assign(this,e),null!=e&&null!=e.options&&(this.options=Object.assign({},e.options))}));Object.defineProperty(s.prototype,"ref",o),Object.defineProperty(s.prototype,"refPath",o),Object.defineProperty(s.prototype,"localField",o),Object.defineProperty(s.prototype,"foreignField",o),Object.defineProperty(s.prototype,"justOne",o),Object.defineProperty(s.prototype,"count",o),Object.defineProperty(s.prototype,"match",o),Object.defineProperty(s.prototype,"options",o),Object.defineProperty(s.prototype,"skip",o),Object.defineProperty(s.prototype,"limit",o),Object.defineProperty(s.prototype,"perDocumentLimit",o),t.exports=s},function(t,e,r){"use strict";var n=r(14),i=r(33);
|
|
1248
|
+
t.exports=h},function(t,e,r){"use strict";(function(e){function r(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return n(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return n(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var i=0,o=function(){};return{s:o,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,s=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw s}}}}function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(){this._pres=new Map,this._posts=new Map}function s(t,e,r,n,i,o,s){return o.useErrorHandlers?t.execPost(r,n,i,{error:e},(function(t){return"function"==typeof s&&s(t)})):"function"==typeof s&&s(e)}function a(t,e,r,n){var i;try{i=t.apply(e,r)}catch(t){return n(t)}u(i)&&i.then((function(){return n()}),(function(t){return n(t)}))}function u(t){return null!=t&&"function"==typeof t.then}function h(t){var r=!1,n=this;return function(){var i=arguments;if(!r)return r=!0,e.nextTick((function(){return t.apply(n,i)}))}}o.prototype.execPre=function(t,r,n,i){3===arguments.length&&(i=n,n=[]);var o=this._pres.get(t)||[],s=o.length,f=o.numAsync||0,c=0,l=f,d=!1,p=n;if(!s)return e.nextTick((function(){i(null)}));var y=function t(){if(!(c>=s)){var n=o[c];if(n.isAsync){var f=[h(m),h((function(t){if(t){if(d)return;return d=!0,i(t)}if(0==--l&&c>=s)return i(null)}))];a(n.fn,r,f,f[0])}else if(n.fn.length>0){f=[h(m)];for(var y=arguments.length>=2?arguments:[null].concat(p),b=1;b<y.length;++b)f.push(y[b]);a(n.fn,r,f,f[0])}else{var v=null;try{v=n.fn.call(r)}catch(t){if(null!=t)return i(t)}if(u(v))v.then((function(){return m()}),(function(t){return m(t)}));else{if(++c>=s)return l>0?void 0:e.nextTick((function(){i(null)}));t()}}}};function m(t){if(t){if(d)return;return d=!0,i(t)}if(++c>=s)return l>0?void 0:i(null);y.apply(r,arguments)}y.apply(null,[null].concat(n))},o.prototype.execPreSync=function(t,e,r){for(var n=this._pres.get(t)||[],i=n.length,o=0;o<i;++o)n[o].fn.apply(e,r||[])},o.prototype.execPost=function(t,r,n,i,o){arguments.length<5&&(o=i,i=null);var s=this._posts.get(t)||[],f=s.length,c=0,l=null;if(i&&i.error&&(l=i.error),!f)return e.nextTick((function(){o.apply(null,[l].concat(n))}));var d=function t(){for(var e=s[c].fn,i=0,d=n.length,p=[],y=0;y<d;++y)i+=n[y]&&n[y]._kareemIgnore?0:1,n[y]&&n[y]._kareemIgnore||p.push(n[y]);if(l)if(e.length===i+2){var m=h((function(e){if(e&&(l=e),++c>=f)return o.call(null,l);t()}));a(e,r,[l].concat(p).concat([m]),m)}else{if(++c>=f)return o.call(null,l);t()}else{var b=h((function(e){return e?(l=e,t()):++c>=f?o.apply(null,[null].concat(n)):void t()}));if(e.length===i+2)return++c>=f?o.apply(null,[null].concat(n)):t();if(e.length===i+1)a(e,r,p.concat([b]),b);else{var v,g;try{g=e.apply(r,p)}catch(t){v=t,l=t}if(u(g))return g.then((function(){return b()}),(function(t){return b(t)}));if(++c>=f)return o.apply(null,[v].concat(n));t()}}};d()},o.prototype.execPostSync=function(t,e,r){for(var n=this._posts.get(t)||[],i=n.length,o=0;o<i;++o)n[o].fn.apply(e,r||[])},o.prototype.createWrapperSync=function(t,e){var r=this;return function(){r.execPreSync(t,this,arguments);var n=e.apply(this,arguments);return r.execPostSync(t,this,[n]),n}},o.prototype.wrap=function(t,e,r,n,i){var o=n.length>0?n[n.length-1]:null,a=("function"==typeof o&&n.slice(0,n.length-1),this),u=(i=i||{}).checkForPromise;this.execPre(t,r,n,(function(h){if(h){for(var f=i.numCallbackParams||0,c=i.contextParameter?[r]:[],l=c.length;l<f;++l)c.push(null);return s(a,h,t,r,c,i,o)}var d,p="function"==typeof o?n.length-1:n.length,y=e.length;try{d=e.apply(r,n.slice(0,p).concat(m))}catch(t){return m(t)}if(u){if(null!=d&&"function"==typeof d.then)return d.then((function(t){return m(null,t)}),(function(t){return m(t)}));if(y<p+1)return m(null,d)}function m(){var e=Array.from(arguments);if(e.shift(),i.nullResultByDefault&&0===e.length&&e.push(null),arguments[0])return s(a,arguments[0],t,r,e,i,o);a.execPost(t,r,e,(function(){return arguments[0]?"function"==typeof o?o(arguments[0]):void 0:"function"==typeof o?o.apply(r,arguments):void 0}))}}))},o.prototype.filter=function(t){for(var e=this,r=this.clone(),n=Array.from(r._pres.keys()),i=function(){var n=s[o],i=e._pres.get(n).map((function(t){return Object.assign({},t,{name:n})})).filter(t);if(0===i.length)return r._pres.delete(n),"continue";i.numAsync=i.filter((function(t){return t.isAsync})).length,r._pres.set(n,i)},o=0,s=n;o<s.length;o++)i();for(var a=Array.from(r._posts.keys()),u=function(){var n=f[h],i=e._posts.get(n).map((function(t){return Object.assign({},t,{name:n})})).filter(t);if(0===i.length)return r._posts.delete(n),"continue";r._posts.set(n,i)},h=0,f=a;h<f.length;h++)u();return r},o.prototype.hasHooks=function(t){return this._pres.has(t)||this._posts.has(t)},o.prototype.createWrapper=function(t,r,n,i){var o=this;return this.hasHooks(t)?function(){var e=n||this;o.wrap(t,r,e,Array.from(arguments),i)}:function(){var t=arguments,n=this;e.nextTick((function(){return r.apply(n,t)}))}},o.prototype.pre=function(t,e,r,n,o){var s={};"object"===i(e)&&null!==e?e=(s=e).isAsync:"boolean"!=typeof arguments[1]&&(r=e,e=!1);var a=this._pres.get(t)||[];if(this._pres.set(t,a),e&&(a.numAsync=a.numAsync||0,++a.numAsync),"function"!=typeof r)throw new Error('pre() requires a function, got "'+i(r)+'"');return o?a.unshift(Object.assign({},s,{fn:r,isAsync:e})):a.push(Object.assign({},s,{fn:r,isAsync:e})),this},o.prototype.post=function(t,e,r,n){var o=this._posts.get(t)||[];if("function"==typeof e&&(n=!!r,r=e,e={}),"function"!=typeof r)throw new Error('post() requires a function, got "'+i(r)+'"');return n?o.unshift(Object.assign({},e,{fn:r})):o.push(Object.assign({},e,{fn:r})),this._posts.set(t,o),this},o.prototype.clone=function(){var t,e=new o,n=r(this._pres.keys());try{for(n.s();!(t=n.n()).done;){var i=t.value,s=this._pres.get(i).slice();s.numAsync=this._pres.get(i).numAsync,e._pres.set(i,s)}}catch(t){n.e(t)}finally{n.f()}var a,u=r(this._posts.keys());try{for(u.s();!(a=u.n()).done;){var h=a.value;e._posts.set(h,this._posts.get(h).slice())}}catch(t){u.e(t)}finally{u.f()}return e},o.prototype.merge=function(t,e){var n,i=(e=1===arguments.length||e)?this.clone():this,o=r(t._pres.keys());try{var s=function(){var e=n.value,r=i._pres.get(e)||[],o=t._pres.get(e).filter((function(t){return-1===r.map((function(t){return t.fn})).indexOf(t.fn)})),s=r.concat(o);s.numAsync=r.numAsync||0,s.numAsync+=o.filter((function(t){return t.isAsync})).length,i._pres.set(e,s)};for(o.s();!(n=o.n()).done;)s()}catch(t){o.e(t)}finally{o.f()}var a,u=r(t._posts.keys());try{var h=function(){var e=a.value,r=i._posts.get(e)||[],n=t._posts.get(e).filter((function(t){return-1===r.indexOf(t)}));i._posts.set(e,r.concat(n))};for(u.s();!(a=u.n()).done;)h()}catch(t){u.e(t)}finally{u.f()}return i},t.exports=o}).call(this,r(5))},function(t,e,r){"use strict";function n(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function i(t,e,r){return e&&n(t.prototype,e),r&&n(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}var o=r(16),s=i((function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),Object.assign(this,e),null!=e&&null!=e.options&&(this.options=Object.assign({},e.options))}));Object.defineProperty(s.prototype,"ref",o),Object.defineProperty(s.prototype,"refPath",o),Object.defineProperty(s.prototype,"localField",o),Object.defineProperty(s.prototype,"foreignField",o),Object.defineProperty(s.prototype,"justOne",o),Object.defineProperty(s.prototype,"count",o),Object.defineProperty(s.prototype,"match",o),Object.defineProperty(s.prototype,"options",o),Object.defineProperty(s.prototype,"skip",o),Object.defineProperty(s.prototype,"limit",o),Object.defineProperty(s.prototype,"perDocumentLimit",o),t.exports=s},function(t,e,r){"use strict";var n=r(14),i=r(33),o=r(309);
|
|
1249
1249
|
/*!
|
|
1250
1250
|
* Gather all indexes defined in the schema, including single nested,
|
|
1251
1251
|
* document arrays, and embedded discriminators.
|
|
1252
1252
|
*/
|
|
1253
|
-
t.exports=function(t){var e=[],r=new WeakMap,
|
|
1253
|
+
t.exports=function(t){var e=[],r=new WeakMap,s=t.constructor.indexTypes,a=new Map;return function t(u,h,f){if(r.has(u))return;r.set(u,!0),h=h||"";for(var c=Object.keys(u.paths),l=0,d=c;l<d.length;l++){var p=d[l],y=u.paths[p];if(null==f||!f.paths[p]){if(y.$isMongooseDocumentArray||y.$isSingleNested){if(!0!==n(y,"options.excludeIndexes")&&!0!==n(y,"schemaOptions.excludeIndexes")&&!0!==n(y,"schema.options.excludeIndexes")&&t(y.schema,h+p+"."),null!=y.schema.discriminators)for(var m=y.schema.discriminators,b=Object.keys(m),v=0,g=b;v<g.length;v++){var w=g[v];t(m[w],h+p+".",y.schema)}if(y.$isMongooseDocumentArray)continue}var _=y._index||y.caster&&y.caster._index;if(!1!==_&&null!=_){var M={},S=i(_),O=S?_:{},A="string"==typeof _?_:!!S&&_.type;if(A&&-1!==s.indexOf(A))M[h+p]=A;else if(O.text)M[h+p]="text",delete O.text;else{var E=-1===Number(_);M[h+p]=E?-1:1}delete O.type,"background"in O||(O.background=!0),null!=u.options.autoIndex&&(O._autoIndex=u.options.autoIndex);var x=O&&O.name;"string"==typeof x&&a.has(x)?Object.assign(a.get(x),M):(e.push([M,O]),a.set(x,M))}}}r.delete(u),h?
|
|
1254
1254
|
/*!
|
|
1255
1255
|
* Checks for indexes added to subdocs using Schema.index().
|
|
1256
1256
|
* These indexes need their paths prefixed properly.
|
|
1257
1257
|
*
|
|
1258
1258
|
* schema._indexes = [ [indexObj, options], [indexObj, options] ..]
|
|
1259
1259
|
*/
|
|
1260
|
-
function(t,r){for(var n=t._indexes,i=n.length,o=0;o<i;++o){for(var s=n[o][0],a=n[o][1],u=Object.keys(s),h=u.length,f={},c=0;c<h;++c){var l=u[c];f[r+l]=s[l]}var d=Object.assign({},a);if(null!=a&&null!=a.partialFilterExpression){d.partialFilterExpression={};for(var p=a.partialFilterExpression,y=0,m=Object.keys(p);y<m.length;y++){var b=m[y];d.partialFilterExpression[r+b]=p[b]}}e.push([f,d])}}(
|
|
1260
|
+
function(t,r){for(var n=t._indexes,i=n.length,o=0;o<i;++o){for(var s=n[o][0],a=n[o][1],u=Object.keys(s),h=u.length,f={},c=0;c<h;++c){var l=u[c];f[r+l]=s[l]}var d=Object.assign({},a);if(null!=a&&null!=a.partialFilterExpression){d.partialFilterExpression={};for(var p=a.partialFilterExpression,y=0,m=Object.keys(p);y<m.length;y++){var b=m[y];d.partialFilterExpression[r+b]=p[b]}}e.push([f,d])}}(u,h):(u._indexes.forEach((function(t){var e=t[1];"background"in e||(e.background=!0),o(u,e)})),e=e.concat(u._indexes))}(t),e}},function(t,e,r){"use strict";t.exports=function(t,e){var r=t.discriminatorMapping&&t.discriminatorMapping.value;if(r&&!("sparse"in e)){var n=t.options.discriminatorKey;e.partialFilterExpression=e.partialFilterExpression||{},e.partialFilterExpression[n]=r}return e}},function(t,e,r){"use strict";
|
|
1261
1261
|
/*!
|
|
1262
1262
|
* ignore
|
|
1263
1263
|
*/
|
|
1264
1264
|
/*!
|
|
1265
1265
|
* Returns this documents _id cast to a string.
|
|
1266
1266
|
*/
|
|
1267
|
-
function n(){return null!=this._id?String(this._id):null}t.exports=function(t){return!t.paths.id&&t.paths._id&&t.options.id?(t.virtual("id").get(n),t):t}},function(t,e,r){"use strict";function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var i=r(
|
|
1267
|
+
function n(){return null!=this._id?String(this._id):null}t.exports=function(t){return!t.paths.id&&t.paths._id&&t.options.id?(t.virtual("id").get(n),t):t}},function(t,e,r){"use strict";function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var i=r(312),o=r(314),s=r(14),a=r(156),u=r(55);t.exports=function(t,e){var r=t.childSchemas.find((function(t){return!!t.schema.options.timestamps}));if(e||r){var h,f=a(e,"createdAt"),c=a(e,"updatedAt"),l=null!=e&&e.hasOwnProperty("currentTime")?e.currentTime:null,d={};if(t.$timestamps={createdAt:f,updatedAt:c},c&&!t.paths[c]&&(d[c]=Date),f&&!t.paths[f])d[f]=(n(h={},t.options.typeKey||"type",Date),n(h,"immutable",!0),h);t.add(d),t.pre("save",(function(t){var e=s(this,"$__.saveOptions.timestamps");if(!1===e)return t();var r=null!=e&&!1===e.updatedAt,n=null!=e&&!1===e.createdAt,i=null!=l?l():this.ownerDocument().constructor.base.now();if(!n&&this.isNew&&f&&!this.$__getValue(f)&&this.$__isSelected(f)&&this.$set(f,i),!r&&c&&(this.isNew||this.$isModified())){var o=i;this.isNew&&null!=f&&(o=this.$__getValue(f)),this.$set(c,o)}t()})),t.methods.initializeTimestamps=function(){var t=null!=l?l():this.constructor.base.now();return f&&!this.get(f)&&this.$set(f,t),c&&!this.get(c)&&this.$set(c,t),this},y[u.builtInMiddleware]=!0;var p={query:!0,model:!1};t.pre("findOneAndReplace",p,y),t.pre("findOneAndUpdate",p,y),t.pre("replaceOne",p,y),t.pre("update",p,y),t.pre("updateOne",p,y),t.pre("updateMany",p,y)}function y(t){var e=null!=l?l():this.model.base.now();"findOneAndReplace"===this.op&&null==this.getUpdate()&&this.setUpdate({}),o(e,f,c,this.getUpdate(),this.options,this.schema),i(e,this.getUpdate(),this.model.schema),t()}}},function(t,e,r){"use strict";function n(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return i(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return i(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,s=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw s}}}}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var o=r(313),s=r(156);
|
|
1268
1268
|
/*!
|
|
1269
1269
|
* ignore
|
|
1270
1270
|
*/
|
|
@@ -1278,7 +1278,7 @@ function a(t,e,r){if(null!=e){if(Object.keys(e).some((function(t){return t.start
|
|
|
1278
1278
|
function(t,e,r,i,o){var s=i,a=s,u=n(o,"overwrite",!1),h=n(o,"timestamps",!0);if(!h||null==s)return i;var f=null!=h&&!1===h.createdAt,c=null!=h&&!1===h.updatedAt;if(u)return i&&i.$set&&(i=i.$set,s.$set={},a=s.$set),c||!r||i[r]||(a[r]=t),f||!e||i[e]||(a[e]=t),s;if(i=i||{},Array.isArray(s))return s.push({$set:(l={},d=r,p=t,d in l?Object.defineProperty(l,d,{value:p,enumerable:!0,configurable:!0,writable:!0}):l[d]=p,l)}),s;var l,d,p;if(s.$set=s.$set||{},!c&&r&&(!i.$currentDate||!i.$currentDate[r])){var y=!1;if(-1!==r.indexOf("."))for(var m=r.split("."),b=1;b<m.length;++b){var v=m.slice(-b).join("."),g=m.slice(0,-b).join(".");if(null!=i[g]){i[g][v]=t,y=!0;break}if(i.$set&&i.$set[g]){i.$set[g][v]=t,y=!0;break}}y||(s.$set[r]=t),s.hasOwnProperty(r)&&delete s[r]}if(!f&&e){i[e]&&delete i[e],i.$set&&i.$set[e]&&delete i.$set[e];var w=!1;if(-1!==e.indexOf("."))for(var _=e.split("."),M=1;M<_.length;++M){var S=_.slice(-M).join("."),O=_.slice(0,-M).join(".");if(null!=i[O]){i[O][S]=t,w=!0;break}if(i.$set&&i.$set[O]){i.$set[O][S]=t,w=!0;break}}w||(s.$setOnInsert=s.$setOnInsert||{},s.$setOnInsert[e]=t)}0===Object.keys(s.$set).length&&delete s.$set;return s}},function(t,e,r){"use strict";var n=r(19),i=r(8);t.exports=function(t,e){if("string"==typeof t)return;if("function"==typeof t)return;throw new n('Invalid ref at path "'+e+'". Got '+i.inspect(t,{depth:0}))}},function(t,e,r){"use strict";
|
|
1279
1279
|
/*!
|
|
1280
1280
|
* ignore
|
|
1281
|
-
*/t.exports=i;var n=r(
|
|
1281
|
+
*/t.exports=i;var n=r(317);
|
|
1282
1282
|
/*!
|
|
1283
1283
|
* ignore
|
|
1284
1284
|
*/
|
|
@@ -1291,7 +1291,7 @@ function(t,e,r,i,o){var s=i,a=s,u=n(o,"overwrite",!1),h=n(o,"timestamps",!0);if(
|
|
|
1291
1291
|
function i(t,e){var r={useErrorHandlers:!0,numCallbackParams:1,nullResultByDefault:!0},n=e.hooks.filter((function(t){var e=function(t){var e={};t.hasOwnProperty("query")&&(e.query=t.query);t.hasOwnProperty("document")&&(e.document=t.document);return e}(t);return"updateOne"===t.name?null==e.query||!!e.query:"deleteOne"===t.name?!!e.query||0===Object.keys(e).length:"validate"===t.name||"remove"===t.name?!!e.query:null==t.query&&null==t.document||!!t.query}));t.prototype._execUpdate=n.createWrapper("update",t.prototype._execUpdate,null,r),t.prototype.__distinct=n.createWrapper("distinct",t.prototype.__distinct,null,r),t.prototype.validate=n.createWrapper("validate",t.prototype.validate,null,r),i.middlewareFunctions.filter((function(t){return"update"!==t&&"distinct"!==t&&"validate"!==t})).forEach((function(e){t.prototype["_".concat(e)]=n.createWrapper(e,t.prototype["_".concat(e)],null,r)}))}i.middlewareFunctions=n.concat(["validate"])},function(t,e,r){"use strict";t.exports=Object.freeze(["count","countDocuments","distinct","estimatedDocumentCount","find","findOne","findOneAndReplace","findOneAndUpdate","replaceOne","update","updateMany","updateOne","deleteMany","deleteOne","findOneAndDelete","findOneAndRemove","remove"])},function(t,e,r){"use strict";
|
|
1292
1292
|
/*!
|
|
1293
1293
|
* Module dependencies.
|
|
1294
|
-
*/function n(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return i(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return i(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,s=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw s}}}}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var o=r(9),s=r(7),a=r(
|
|
1294
|
+
*/function n(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return i(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return i(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,s=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw s}}}}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var o=r(9),s=r(7),a=r(319),u=r(158),h=r(4),f=o.CastError;function c(t,e){this.enumValues=[],this.regExp=null,o.call(this,t,e,"String")}
|
|
1295
1295
|
/*!
|
|
1296
1296
|
* ignore
|
|
1297
1297
|
*/
|
|
@@ -1349,7 +1349,7 @@ a._checkRequired=function(t){return!0===t||!1===t},a.checkRequired=i.checkRequir
|
|
|
1349
1349
|
t.exports=a},function(t,e,r){"use strict";
|
|
1350
1350
|
/*!
|
|
1351
1351
|
* Module dependencies.
|
|
1352
|
-
*/var n,i,o=r(88),s=r(20),a=r(12).EventEmitter,u=r(
|
|
1352
|
+
*/var n,i,o=r(88),s=r(20),a=r(12).EventEmitter,u=r(329),h=r(9),f=r(172),c=r(173),l=r(8),d=r(4),p=r(174),y=r(1).arrayAtomicsSymbol,m=r(1).arrayPathSymbol,b=r(1).documentArrayParent;function v(t,e,r,n){null!=n&&null!=n._id?e=c(e,n):null!=r&&null!=r._id&&(e=c(e,r));var i=g(e,r);i.prototype.$basePath=t,o.call(this,t,i,r),this.schema=e,this.schemaOptions=n||{},this.$isMongooseDocumentArray=!0,this.Constructor=i,i.base=e.base;var s=this.defaultValue;"defaultValue"in this&&void 0===s||this.default((function(){var t=s.call(this);return null==t||Array.isArray(t)||(t=[t]),t}));var a=this;this.$embeddedSchemaType=new h(t+".$",{required:this&&this.schemaOptions&&this.schemaOptions.required||!1}),this.$embeddedSchemaType.cast=function(t,e,r){return a.cast(t,e,r)[0]},this.$embeddedSchemaType.$isMongooseDocumentArrayElement=!0,this.$embeddedSchemaType.caster=this.Constructor,this.$embeddedSchemaType.schema=this.schema}
|
|
1353
1353
|
/*!
|
|
1354
1354
|
* Ignore
|
|
1355
1355
|
*/
|
|
@@ -1389,7 +1389,7 @@ t.exports=v},function(t,e,r){"use strict";function n(t){return(n="function"==typ
|
|
|
1389
1389
|
t.exports=f},function(t,e,r){"use strict";t.exports=function t(e){if(!Array.isArray(e))return{min:0,max:0,containsNonArrayItem:!0};if(0===e.length)return{min:1,max:1,containsNonArrayItem:!1};if(1===e.length&&!Array.isArray(e[0]))return{min:1,max:1,containsNonArrayItem:!1};for(var r=t(e[0]),n=1;n<e.length;++n){var i=t(e[n]);i.min<r.min&&(r.min=i.min),i.max>r.max&&(r.max=i.max),r.containsNonArrayItem=r.containsNonArrayItem||i.containsNonArrayItem}return r.min=r.min+1,r.max=r.max+1,r}},function(t,e,r){"use strict";
|
|
1390
1390
|
/*!
|
|
1391
1391
|
* Module dependencies.
|
|
1392
|
-
*/function n(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return i(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return i(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,s=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw s}}}}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var s=r(20),a=r(44),u=r(87),h=r(
|
|
1392
|
+
*/function n(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return i(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return i(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,s=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw s}}}}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var s=r(20),a=r(44),u=r(87),h=r(326),f=r(327),c=r(14),l=r(22),d=r(162),p=r(164),y=r(8),m=r(33),b=r(52),v=["Polygon","MultiPolygon"];function g(t,e,r){if(Array.isArray(t))t.forEach((function(n,i){if(Array.isArray(n)||m(n))return g(n,e,r);t[i]=e.castForQueryWrapper({val:n,context:r})}));else for(var n=Object.keys(t),i=n.length;i--;){var o=n[i],s=t[o];Array.isArray(s)||m(s)?(g(s,e,r),t[o]=s):t[o]=e.castForQuery({val:s,context:r})}}t.exports=function t(e,r,i,w){if(Array.isArray(r))throw new Error("Query filter must be an object, got an array ",y.inspect(r));if(null==r)return r;null!=e&&null!=e.discriminators&&null!=r[e.options.discriminatorKey]&&(e=d(e,r[e.options.discriminatorKey])||e);var _,M,S,O,A,E,x=Object.keys(r),k=x.length;for(i=i||{};k--;)if(E=r[O=x[k]],"$or"===O||"$nor"===O||"$and"===O){if(!Array.isArray(E))throw new s("Array",E,O);for(var j=0;j<E.length;++j){if(null==E[j]||"object"!==o(E[j]))throw new s("Object",E[j],O+"."+j);E[j]=t(e,E[j],i,w)}}else{if("$where"===O){if("string"!==(A=o(E))&&"function"!==A)throw new Error("Must have a string or function for $where");"function"===A&&(r[O]=E.toString());continue}if("$expr"===O){E=h(E,e);continue}if("$elemMatch"===O)E=t(e,E,i,w);else if("$text"===O)E=f(E,O);else{if(!e)continue;if(!(M=e.path(O)))for(var $=O.split("."),P=$.length;P--;){var R=$.slice(0,P).join("."),B=$.slice(P).join("."),T=e.path(R),I=T&&T.schema&&T.schema.options&&T.schema.options.discriminatorKey;if(null!=T&&null!=(T.schema&&T.schema.discriminators)&&null!=I&&B!==I){var N=c(r,R+"."+I);null!=N&&(M=T.schema.discriminators[N].path(B))}}if(M){if(null==E)continue;if("Object"===l(E))if(Object.keys(E).some(p))for(var D=Object.keys(E),C=void 0,L=D.length;L--;)if(S=E[C=D[L]],"$not"===C){if(S&&M){if((_=Object.keys(S)).length&&p(_[0]))for(var q in S)S[q]=M.castForQueryWrapper({$conditional:q,val:S[q],context:w});else E[C]=M.castForQueryWrapper({$conditional:C,val:S,context:w});continue}}else E[C]=M.castForQueryWrapper({$conditional:C,val:S,context:w});else r[O]=M.castForQueryWrapper({val:E,context:w});else if(Array.isArray(E)&&-1===["Buffer","Array"].indexOf(M.instance)){var U,F=[],z=n(E);try{for(z.s();!(U=z.n()).done;){var V=U.value;F.push(M.castForQueryWrapper({val:V,context:w}))}}catch(t){z.e(t)}finally{z.f()}r[O]={$in:F}}else r[O]=M.castForQueryWrapper({val:E,context:w})}else{for(var K=O.split("."),H=K.length,Z=void 0,W=void 0,J=void 0;H--&&(Z=K.slice(0,H).join("."),!(M=e.path(Z))););if(M){if(M.caster&&M.caster.schema){(J={})[W=K.slice(H).join(".")]=E;var Y=t(M.caster.schema,J,i,w)[W];void 0===Y?delete r[O]:r[O]=Y}else r[O]=E;continue}if(m(E)){var Q="";if(E.$near?Q="$near":E.$nearSphere?Q="$nearSphere":E.$within?Q="$within":E.$geoIntersects?Q="$geoIntersects":E.$geoWithin&&(Q="$geoWithin"),Q){var G=new u.Number("__QueryCasting__"),X=E[Q];if(null!=E.$maxDistance&&(E.$maxDistance=G.castForQueryWrapper({val:E.$maxDistance,context:w})),null!=E.$minDistance&&(E.$minDistance=G.castForQueryWrapper({val:E.$minDistance,context:w})),"$within"===Q){var tt=X.$center||X.$centerSphere||X.$box||X.$polygon;if(!tt)throw new Error("Bad $within parameter: "+JSON.stringify(E));X=tt}else if("$near"===Q&&"string"==typeof X.type&&Array.isArray(X.coordinates))X=X.coordinates;else if(("$near"===Q||"$nearSphere"===Q||"$geoIntersects"===Q)&&X.$geometry&&"string"==typeof X.$geometry.type&&Array.isArray(X.$geometry.coordinates))null!=X.$maxDistance&&(X.$maxDistance=G.castForQueryWrapper({val:X.$maxDistance,context:w})),null!=X.$minDistance&&(X.$minDistance=G.castForQueryWrapper({val:X.$minDistance,context:w})),b(X.$geometry)&&(X.$geometry=X.$geometry.toObject({transform:!1,virtuals:!1})),X=X.$geometry.coordinates;else if("$geoWithin"===Q)if(X.$geometry){b(X.$geometry)&&(X.$geometry=X.$geometry.toObject({virtuals:!1}));var et=X.$geometry.type;if(-1===v.indexOf(et))throw new Error('Invalid geoJSON type for $geoWithin "'+et+'", must be "Polygon" or "MultiPolygon"');X=X.$geometry.coordinates}else X=X.$box||X.$polygon||X.$center||X.$centerSphere,b(X)&&(X=X.toObject({virtuals:!1}));g(X,G,w);continue}}if(e.nested[O])continue;var rt="strict"in i?i.strict:e.options.strict,nt="strictQuery"in i?i.strictQuery:"strict"in i?i.strict:"strict"in e._userProvidedOptions?e._userProvidedOptions.strict:e.options.strictQuery;if(i.upsert&&rt){if("throw"===rt)throw new a(O);throw new a(O,'Path "'+O+'" is not in schema, strict mode is `true`, and upsert is `true`.')}if("throw"===nt)throw new a(O,'Path "'+O+"\" is not in schema and strictQuery is 'throw'.");nt&&delete r[O]}}}return r}},function(t,e,r){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i=r(20),o=r(44),s=r(160),a=new Set(["$and","$or","$not"]),u=new Set(["$cmp","$eq","$lt","$lte","$gt","$gte"]),h=new Set(["$multiply","$divide","$log","$mod","$trunc","$avg","$max","$min","$stdDevPop","$stdDevSamp","$sum"]),f=new Set(["$abs","$exp","$ceil","$floor","$ln","$log10","$round","$sqrt","$sin","$cos","$tan","$asin","$acos","$atan","$atan2","$asinh","$acosh","$atanh","$sinh","$cosh","$tanh","$degreesToRadians","$radiansToDegrees"]),c=new Set(["$arrayElemAt","$first","$last"]),l=new Set(["$year","$month","$week","$dayOfMonth","$dayOfYear","$hour","$minute","$second","$isoDayOfWeek","$isoWeekYear","$isoWeek","$millisecond"]);function d(t,e,r){if(b(t))return t;null!=t.$cond?Array.isArray(t.$cond)?t.$cond=t.$cond.map((function(t){return d(t,e,r)})):(t.$cond.if=d(t.$cond.if,e,r),t.$cond.then=d(t.$cond.then,e,r),t.$cond.else=d(t.$cond.else,e,r)):null!=t.$ifNull?t.$ifNull.map((function(t){return d(t,e,r)})):null!=t.$switch&&(t.branches.map((function(t){return d(t,e,r)})),t.default=d(t.default,e,r));for(var n=0,i=Object.keys(t);n<i.length;n++){var s=i[n];a.has(s)?t[s]=t[s].map((function(t){return d(t,e,r)})):u.has(s)?t[s]=m(t[s],e,r):h.has(s)?t[s]=y(t[s]):f.has(s)&&(t[s]=p(t[s]))}return t.$in&&(t.$in=function(t,e,r){var n=t[1];if(!b(n))return t;var i=t[0],s=e.path(n.slice(1));if(null===s){if(!1===r)return t;if("throw"===r)throw new o("$in");return}if(!s.$isMongooseArray)throw new Error("Path must be an array for $in");return[s.$isMongooseDocumentArray?s.$embeddedSchemaType.cast(i):s.caster.cast(i),n]}(t.$in,e,r)),t.$size&&(t.$size=p(t.$size)),function(t){for(var e=Object.keys(t),r=0,n=e.length;r<n;++r)void 0===t[e[r]]&&delete t[e[r]]}(t),t}function p(t){if(!v(t))return t;try{return s(t)}catch(e){throw new i("Number",t)}}function y(t){if(!Array.isArray(t)){if(!v(t))return t;try{return s(t)}catch(e){throw new i("Number",t)}}return t.map((function(t){if(!v(t))return t;try{return s(t)}catch(e){throw new i("Number",t)}}))}function m(t,e,r){if(!Array.isArray(t)||2!==t.length)throw new Error("Comparison operator must be an array of length 2");t[0]=d(t[0],e,r);var a=t[0];if(v(t[1])){var u=null,h=null,f=null;if(b(a))u=a.slice(1),h=e.path(u);else if("object"===n(a)&&null!=a)for(var p=0,y=Object.keys(a);p<y.length;p++){var m=y[p];l.has(m)&&b(a[m])?(u=a[m].slice(1)+"."+m,f=s):c.has(m)&&b(a[m])&&(u=a[m].slice(1)+"."+m,null!=(h=e.path(a[m].slice(1)))&&(h.$isMongooseDocumentArray?h=h.$embeddedSchemaType:h.$isMongooseArray&&(h=h.caster)))}var g="object"===n(t[1])&&null!=t[1]&&null!=t[1].$literal;if(null!=h)t[1]=g?{$literal:h.cast(t[1].$literal)}:h.cast(t[1]);else if(null!=f)if(g)try{t[1]={$literal:f(t[1].$literal)}}catch(e){throw new i(f.name.replace(/^cast/,""),t[1],u+".$literal")}else try{t[1]=f(t[1])}catch(e){throw new i(f.name.replace(/^cast/,""),t[1],u)}else{if(null!=u&&!0===r)return;if(null!=u&&"throw"===r)throw new o(u)}}else t[1]=d(t[1]);return t}function b(t){return"string"==typeof t&&"$"===t[0]}function v(t){return("string"!=typeof t||"$"!==t[0])&&("object"!==n(t)||null===t||!Object.keys(t).find((function(t){return"$"===t[0]}))||null!=t.$literal)}t.exports=function(t,e,r){if("object"!==n(t)||null===t)throw new Error("`$expr` must be an object");return d(t,e,r)}},function(t,e,r){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i=r(20),o=r(84),s=r(158);
|
|
1393
1393
|
/*!
|
|
1394
1394
|
* Casts val to an object suitable for `$text`. Throws an error if the object
|
|
1395
1395
|
* can't be casted.
|
|
@@ -1429,7 +1429,7 @@ function b(t){var e=t[l];if(e&&null!=e.$__.populated){var r,i=n(Object.keys(e.$_
|
|
|
1429
1429
|
t.exports=f},function(t,e,r){"use strict";
|
|
1430
1430
|
/*!
|
|
1431
1431
|
* Module dependencies.
|
|
1432
|
-
*/function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i,o=r(20),s=r(12).EventEmitter,a=r(154),u=r(
|
|
1432
|
+
*/function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i,o=r(20),s=r(12).EventEmitter,a=r(154),u=r(331),h=r(9),f=r(83),c=r(56).castToNumber,l=r(172),d=r(165),p=r(174),y=r(173),m=r(34).internalToObjectOptions,b=r(4);function v(t,e,r){t=y(t,r),this.caster=g(t),this.caster.path=e,this.caster.prototype.$basePath=e,this.schema=t,this.$isSingleNested=!0,h.call(this,e,r,"Embedded")}
|
|
1433
1433
|
/*!
|
|
1434
1434
|
* ignore
|
|
1435
1435
|
*/
|
|
@@ -1456,7 +1456,7 @@ v.prototype.clone=function(){var t=Object.assign({},this.options),e=new this.con
|
|
|
1456
1456
|
/*!
|
|
1457
1457
|
* Module dependencies.
|
|
1458
1458
|
*/
|
|
1459
|
-
function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i=r(168),o=r(
|
|
1459
|
+
function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i=r(168),o=r(333),s=r(9),a=r(161),u=r(4),h=i.Binary,f=s.CastError;function c(t,e){s.call(this,t,e,"Buffer")}
|
|
1460
1460
|
/*!
|
|
1461
1461
|
* ignore
|
|
1462
1462
|
*/
|
|
@@ -1479,7 +1479,7 @@ t.exports=c}).call(this,r(3).Buffer)},function(t,e,r){"use strict";function n(t)
|
|
|
1479
1479
|
t.exports=f},function(t,e,r){"use strict";
|
|
1480
1480
|
/*!
|
|
1481
1481
|
* Module requirements.
|
|
1482
|
-
*/var n=r(7),i=r(
|
|
1482
|
+
*/var n=r(7),i=r(335),o=r(9),s=r(336),a=r(22),u=r(4),h=o.CastError;function f(t,e){o.call(this,t,e,"Date")}
|
|
1483
1483
|
/*!
|
|
1484
1484
|
* Date Query casting.
|
|
1485
1485
|
*
|
|
@@ -1512,7 +1512,7 @@ t.exports=f},function(t,e,r){"use strict";function n(t){return(n="function"==typ
|
|
|
1512
1512
|
t.exports=f},function(t,e,r){"use strict";var n=r(43);t.exports=function(t){return null==t||""===t?null:t instanceof Date?(n.ok(!isNaN(t.valueOf())),t):(n.ok("boolean"!=typeof t),e=t instanceof Number||"number"==typeof t?new Date(t):"string"==typeof t&&!isNaN(Number(t))&&(Number(t)>=275761||Number(t)<-271820)?new Date(Number(t)):"function"==typeof t.valueOf?new Date(t.valueOf()):new Date(t),isNaN(e.valueOf())?void n.ok(!1):e);var e}},function(t,e,r){"use strict";
|
|
1513
1513
|
/*!
|
|
1514
1514
|
* Module dependencies.
|
|
1515
|
-
*/var n,i=r(
|
|
1515
|
+
*/var n,i=r(338),o=r(9),s=r(169),a=r(22),u=r(18),h=r(4),f=o.CastError;function c(t,e){var r="string"==typeof t&&24===t.length&&/^[a-f0-9]+$/i.test(t),n=e&&e.suppressWarning;!r&&void 0!==t||n||h.warn("mongoose: To create a new ObjectId please try `Mongoose.Types.ObjectId` instead of using `Mongoose.Schema.ObjectId`. Set the `suppressWarning` option if you're trying to create a hex char path in your schema."),o.call(this,t,e,"ObjectID")}
|
|
1516
1516
|
/*!
|
|
1517
1517
|
* ignore
|
|
1518
1518
|
*/
|
|
@@ -1546,7 +1546,7 @@ c._defaultCaster=function(t){if(!(t instanceof u))throw new Error(t+" is not an
|
|
|
1546
1546
|
t.exports=f},function(t,e,r){"use strict";
|
|
1547
1547
|
/*!
|
|
1548
1548
|
* Module dependencies.
|
|
1549
|
-
*/var n=r(9),i=n.CastError,o=r(32),s=r(
|
|
1549
|
+
*/var n=r(9),i=n.CastError,o=r(32),s=r(340),a=r(4);function u(t,e){n.call(this,t,e,"Decimal128")}
|
|
1550
1550
|
/*!
|
|
1551
1551
|
* ignore
|
|
1552
1552
|
*/
|
|
@@ -1574,7 +1574,7 @@ t.exports=u},function(t,e,r){"use strict";(function(e){function n(t){return(n="f
|
|
|
1574
1574
|
/*!
|
|
1575
1575
|
* ignore
|
|
1576
1576
|
*/
|
|
1577
|
-
function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return o(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return o(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,s=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw s}}}}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function s(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function a(){return(a="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=u(t,e);if(n){var i=Object.getOwnPropertyDescriptor(n,e);return i.get?i.get.call(arguments.length<3?t:r):i.value}}).apply(this,arguments)}function u(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=l(t)););return t}function h(t,e){return(h=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function f(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=l(t);if(e){var i=l(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return c(this,r)}}function c(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function l(t){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var d=r(170),p=r(
|
|
1577
|
+
function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return o(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return o(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,s=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw s}}}}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function s(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function a(){return(a="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=u(t,e);if(n){var i=Object.getOwnPropertyDescriptor(n,e);return i.get?i.get.call(arguments.length<3?t:r):i.value}}).apply(this,arguments)}function u(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=l(t)););return t}function h(t,e){return(h=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function f(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=l(t);if(e){var i=l(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return c(this,r)}}function c(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function l(t){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var d=r(170),p=r(342),y=r(9),m=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&h(t,e)}(c,t);var r,n,o,u=f(c);function c(t,e){var r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,c),(r=u.call(this,t,e,"Map")).$isSchemaMap=!0,r}return r=c,(n=[{key:"set",value:function(t,e){return y.set(t,e)}},{key:"cast",value:function(t,r,n){if(t instanceof d)return t;var o=this.path;if(n){var s=new d({},o,r,this.$__schemaType);if(t instanceof e.Map){var a,u=i(t.keys());try{for(u.s();!(a=u.n()).done;){var h=a.value,f=t.get(h);f=null==f?s.$__schemaType._castNullish(f):s.$__schemaType.cast(f,r,!0,null,{path:o+"."+h}),s.$init(h,f)}}catch(t){u.e(t)}finally{u.f()}}else for(var c=0,l=Object.keys(t);c<l.length;c++){var p=l[c],y=t[p];y=null==y?s.$__schemaType._castNullish(y):s.$__schemaType.cast(y,r,!0,null,{path:o+"."+p}),s.$init(p,y)}return s}return new d(t,o,r,this.$__schemaType)}},{key:"clone",value:function(){var t=a(l(c.prototype),"clone",this).call(this);return null!=this.$__schemaType&&(t.$__schemaType=this.$__schemaType.clone()),t}}])&&s(r.prototype,n),o&&s(r,o),Object.defineProperty(r,"prototype",{writable:!1}),c}(y);m.prototype.OptionsConstructor=p,m.defaultOptions={},t.exports=m}).call(this,r(6))},function(t,e,r){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){return(s=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function a(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=h(t);if(e){var i=h(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return u(this,r)}}function u(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var f=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&s(t,e)}(h,t);var e,r,n,u=a(h);function h(){return o(this,h),u.apply(this,arguments)}return e=h,r&&i(e.prototype,r),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(r(15)),c=r(16);Object.defineProperty(f.prototype,"of",c),t.exports=f},function(t,e,r){"use strict";
|
|
1578
1578
|
/*!
|
|
1579
1579
|
* Creates an object that precomputes whether a given path has child fields in
|
|
1580
1580
|
* the projection.
|
|
@@ -1600,7 +1600,7 @@ function u(e){return e&&"object"===n(e)&&!(e instanceof Date)&&!(e instanceof s)
|
|
|
1600
1600
|
function e(r,n,i,o){var s;s=r&&a(r)&&!t.isBuffer(r)?Object.keys(r.toObject({transform:!1,virtuals:!1})||{}):Object.keys(r||{});var h=s.length,f={};n=n?n+".":"";for(var c=0;c<h;++c){var l=s[c],d=r[l];f[n+l]=d;var p=o&&o.path&&o.path(n+l),y=o&&o.nested&&o.nested[n+l];if(!p||"Mixed"!==p.instance){if(u(d)){if(i&&i.skipArrays&&Array.isArray(d))continue;var m=e(d,n+l,i,o);for(var b in m)f[b]=m[b];Array.isArray(d)&&(f[n+l]=d)}if(y)for(var v=Object.keys(o.paths),g=0,w=v;g<w.length;g++){var _=w[g];_.startsWith(n+l+".")&&!f.hasOwnProperty(_)&&(f[_]=void 0)}}}return f}
|
|
1601
1601
|
/*!
|
|
1602
1602
|
* ignore
|
|
1603
|
-
*/,e.modifiedPaths=function e(r,n,i){var o=Object.keys(r||{}),s=o.length;i=i||{},n=n?n+".":"";for(var h=0;h<s;++h){var f=o[h],c=r[f],l=n+f;if(i[l]=!0,-1!==l.indexOf("."))for(var d=l.split("."),p=d[0],y=1;y<d.length;++y)i[p]=!0,p+="."+d[y];!t.isBuffer(c)&&a(c)&&(c=c.toObject({transform:!1,virtuals:!1})),u(c)&&e(c,n+f,i)}return i}}).call(this,r(3).Buffer)},function(t,e,r){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i=r(19),o=r(
|
|
1603
|
+
*/,e.modifiedPaths=function e(r,n,i){var o=Object.keys(r||{}),s=o.length;i=i||{},n=n?n+".":"";for(var h=0;h<s;++h){var f=o[h],c=r[f],l=n+f;if(i[l]=!0,-1!==l.indexOf("."))for(var d=l.split("."),p=d[0],y=1;y<d.length;++y)i[p]=!0,p+="."+d[y];!t.isBuffer(c)&&a(c)&&(c=c.toObject({transform:!1,virtuals:!1})),u(c)&&e(c,n+f,i)}return i}}).call(this,r(3).Buffer)},function(t,e,r){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i=r(19),o=r(346),s=r(8);t.exports=function t(e){if(null!=e&&"object"===n(e)&&!Array.isArray(e)&&!e.$__)for(var r=0,a=Object.keys(e);r<a.length;r++){var u=a[r],h=e[u];if(-1===u.indexOf("."))t(e[u]);else try{delete e[u],o(e,u,h)}catch(t){if(!(t instanceof TypeError))throw t;throw new i('Conflicting dotted paths when setting document path, key: "'.concat(u,'", value: ').concat(s.inspect(h)))}}}},function(t,e,r){"use strict";function n(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return i(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return i(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,s=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw s}}}}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}t.exports=function(t,e,r){if(-1!==e.indexOf(".")){var i,o=e.split("."),s=o.pop(),a=t,u=n(o);try{for(u.s();!(i=u.n()).done;){var h=i.value;null==a[h]&&(a[h]={}),a=a[h]}}catch(t){u.e(t)}finally{u.f()}a[s]=r}else t[e]=r}},function(t,e,r){"use strict";var n=r(14),i=r(162);
|
|
1604
1604
|
/*!
|
|
1605
1605
|
* Like `schema.path()`, except with a document, because impossible to
|
|
1606
1606
|
* determine path type without knowing the embedded discriminator key.
|
|
@@ -1619,7 +1619,7 @@ t.exports=function t(e,r,o){for(var s=(o=o||{}).typeOnly,a=-1===r.indexOf(".")?[
|
|
|
1619
1619
|
*/t.exports=function(t,e){if(null!=t._id&&null!=e&&0!==e.length){var r,i=String(t._id),s=n(e);try{for(s.s();!(r=s.n()).done;){var a=r.value;if(!a.isVirtual)for(var u=a.path.split("."),h=0;h<u.length-1;++h){var f=u.slice(0,h+1).join("."),c=u.slice(h+1).join("."),l=t.get(f);if(null!=l&&o.isMongooseDocumentArray(l)){for(var d=0;d<l.length;++d)l[d].populated(c,null==a._docs[i]?void 0:a._docs[i][d],a);break}}}}catch(t){s.e(t)}finally{s.f()}}}},function(t,e,r){"use strict";
|
|
1620
1620
|
/*!
|
|
1621
1621
|
* Module dependencies
|
|
1622
|
-
*/function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return o(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return o(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,s=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw s}}}}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var s=r(
|
|
1622
|
+
*/function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return o(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return o(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,s=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw s}}}}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var s=r(352),a=r(14),u=r(57),h=r(92),f=r(41);
|
|
1623
1623
|
/*!
|
|
1624
1624
|
* Set each path query option to lean
|
|
1625
1625
|
*
|