|
|
|
|
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.mongoose=e():t.mongoose=e()}("undefined"!=typeof self?self:this,(function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=102)}([function(t,e,r){"use strict";e.arrayAtomicsSymbol=Symbol("mongoose#Array#_atomics"),e.arrayParentSymbol=Symbol("mongoose#Array#_parent"),e.arrayPathSymbol=Symbol("mongoose#Array#_path"),e.arraySchemaSymbol=Symbol("mongoose#Array#_schema"),e.documentArrayParent=Symbol("mongoose:documentArrayParent"),e.documentIsSelected=Symbol("mongoose#Document#isSelected"),e.documentIsModified=Symbol("mongoose#Document#isModified"),e.documentModifiedPaths=Symbol("mongoose#Document#modifiedPaths"),e.documentSchemaSymbol=Symbol("mongoose#Document#schema"),e.getSymbol=Symbol("mongoose#Document#get"),e.modelSymbol=Symbol("mongoose#Model"),e.objectIdSymbol=Symbol("mongoose#ObjectId"),e.populateModelSymbol=Symbol("mongoose.PopulateOptions#Model"),e.schemaTypeSymbol=Symbol("mongoose#schemaType"),e.sessionNewDocuments=Symbol("mongoose:ClientSession#newDocuments"),e.scopeSymbol=Symbol("mongoose#Document#scope"),e.validatorErrorSymbol=Symbol("mongoose:validatorError")},function(t,e,r){"use strict";(function(t){
|
|
|
|
|
/*!
|
|
|
|
|
* Module dependencies.
|
|
|
|
|
*/
|
|
|
|
|
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 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 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)}var s,a=r(120),u=r(51),c=r(65),l=r(66).Buffer,f=r(20),p=r(11),h=r(123),y=r(27),d=r(22),v=r(21),m=r(69),_=r(68),b=r(32),g=r(28),w=r(78),O=r(52);function S(t){if(Array.isArray(t.populate)){var r=[];t.populate.forEach((function(t){if(/[\s]/.test(t.path)){var n=Object.assign({},t);n.path.split(" ").forEach((function(t){n.path=t,r.push(e.populate(n)[0])}))}else r.push(e.populate(t)[0])})),t.populate=e.populate(r)}else null!=t.populate&&"object"===i(t.populate)&&(t.populate=e.populate(t.populate));var o=[],s=t.path.split(" ");null!=t.options&&(t.options=e.clone(t.options));var a,u=n(s);try{for(u.s();!(a=u.n()).done;){var c=a.value;o.push(new h(Object.assign({},t,{path:c})))}}catch(t){u.e(t)}finally{u.f()}return o}
|
|
|
|
|
/*!
|
|
|
|
|
* Return the value of `obj` at the given `path`.
|
|
|
|
|
*
|
|
|
|
|
* @param {String} path
|
|
|
|
|
* @param {Object} obj
|
|
|
|
|
*/e.specialProperties=O,
|
|
|
|
|
/*!
|
|
|
|
|
* Produces a collection name from model `name`. By default, just returns
|
|
|
|
|
* the model name
|
|
|
|
|
*
|
|
|
|
|
* @param {String} name a model name
|
|
|
|
|
* @param {Function} pluralize function that pluralizes the collection name
|
|
|
|
|
* @return {String} a collection name
|
|
|
|
|
* @api private
|
|
|
|
|
*/
|
|
|
|
|
e.toCollectionName=function(t,e){return"system.profile"===t||"system.indexes"===t?t:"function"==typeof e?e(t):t},
|
|
|
|
|
/*!
|
|
|
|
|
* Determines if `a` and `b` are deep equal.
|
|
|
|
|
*
|
|
|
|
|
* Modified from node/lib/assert.js
|
|
|
|
|
*
|
|
|
|
|
* @param {any} a a value to compare to `b`
|
|
|
|
|
* @param {any} b a value to compare to `a`
|
|
|
|
|
* @return {Boolean}
|
|
|
|
|
* @api private
|
|
|
|
|
*/
|
|
|
|
|
e.deepEqual=function t(r,n){if(r===n)return!0;if("object"!==i(r)&&"object"!==i(n))return r===n;if(r instanceof Date&&n instanceof Date)return r.getTime()===n.getTime();if(m(r,"ObjectID")&&m(n,"ObjectID")||m(r,"Decimal128")&&m(n,"Decimal128"))return r.toString()===n.toString();if(r instanceof RegExp&&n instanceof RegExp)return r.source===n.source&&r.ignoreCase===n.ignoreCase&&r.multiline===n.multiline&&r.global===n.global;if(null==r||null==n)return!1;if(r.prototype!==n.prototype)return!1;if(r instanceof Map&&n instanceof Map)return t(Array.from(r.keys()),Array.from(n.keys()))&&t(Array.from(r.values()),Array.from(n.values()));if(r instanceof Number&&n instanceof Number)return r.valueOf()===n.valueOf();if(l.isBuffer(r))return e.buffer.areEqual(r,n);if(Array.isArray(r)&&Array.isArray(n)){var o=r.length;if(o!==n.length)return!1;for(var s=0;s<o;++s)if(!t(r[s],n[s]))return!1;return!0}null!=r.$__?r=r._doc:b(r)&&(r=r.toObject()),null!=n.$__?n=n._doc:b(n)&&(n=n.toObject());var a=Object.keys(r),u=Object.keys(n),c=a.length;if(c!==u.length)return!1;a.sort(),u.sort();for(var f=c-1;f>=0;f--)if(a[f]!==u[f])return!1;for(var p=0,h=a;p<h.length;p++){var y=h[p];if(!t(r[y],n[y]))return!1}return!0},
|
|
|
|
|
/*!
|
|
|
|
|
* Get the last element of an array
|
|
|
|
|
*/
|
|
|
|
|
e.last=function(t){if(t.length>0)return t[t.length-1]},e.clone=y,
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
e.promiseOrCallback=g,
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
e.omit=function(t,e){if(null==e)return Object.assign({},t);Array.isArray(e)||(e=[e]);var r,o=Object.assign({},t),i=n(e);try{for(i.s();!(r=i.n()).done;){delete o[r.value]}}catch(t){i.e(t)}finally{i.f()}return o},
|
|
|
|
|
/*!
|
|
|
|
|
* Shallow copies defaults into options.
|
|
|
|
|
*
|
|
|
|
|
* @param {Object} defaults
|
|
|
|
|
* @param {Object} options
|
|
|
|
|
* @return {Object} the merged object
|
|
|
|
|
* @api private
|
|
|
|
|
*/
|
|
|
|
|
e.options=function(t,e){var r,n=Object.keys(t),o=n.length;for(e=e||{};o--;)(r=n[o])in e||(e[r]=t[r]);return e},
|
|
|
|
|
/*!
|
|
|
|
|
* Generates a random string
|
|
|
|
|
*
|
|
|
|
|
* @api private
|
|
|
|
|
*/
|
|
|
|
|
e.random=function(){return Math.random().toString().substr(3)},
|
|
|
|
|
/*!
|
|
|
|
|
* Merges `from` into `to` without overwriting existing properties.
|
|
|
|
|
*
|
|
|
|
|
* @param {Object} to
|
|
|
|
|
* @param {Object} from
|
|
|
|
|
* @api private
|
|
|
|
|
*/
|
|
|
|
|
e.merge=function t(r,n,o,i){o=o||{};var s,a=Object.keys(n),u=0,c=a.length;i=i||"";for(var l=o.omitNested||{};u<c;)if(s=a[u++],!(o.omit&&o.omit[s]||l[i]||O.has(s)))if(null==r[s])r[s]=n[s];else if(e.isObject(n[s])){if(e.isObject(r[s])||(r[s]={}),null!=n[s]){if(o.isDiscriminatorSchemaMerge&&n[s].$isSingleNested&&r[s].$isMongooseDocumentArray||n[s].$isMongooseDocumentArray&&r[s].$isSingleNested)continue;if(n[s].instanceOfSchema){r[s].instanceOfSchema?w(r[s],n[s].clone(),o.isDiscriminatorSchemaMerge):r[s]=n[s].clone();continue}if(n[s]instanceof p){r[s]=new p(n[s]);continue}}t(r[s],n[s],o,i?i+"."+s:s)}else o.overwrite&&(r[s]=n[s])},
|
|
|
|
|
/*!
|
|
|
|
|
* Applies toObject recursively.
|
|
|
|
|
*
|
|
|
|
|
* @param {Document|Array|Object} obj
|
|
|
|
|
* @return {Object}
|
|
|
|
|
* @api private
|
|
|
|
|
*/
|
|
|
|
|
e.toObject=function t(o){var i;if(s||(s=r(12)),null==o)return o;if(o instanceof s)return o.toObject();if(Array.isArray(o)){i=[];var a,u=n(o);try{for(u.s();!(a=u.n()).done;){var c=a.value;i.push(t(c))}}catch(t){u.e(t)}finally{u.f()}return i}if(e.isPOJO(o)){i={};for(var l=0,f=Object.keys(o);l<f.length;l++){var p=f[l];O.has(p)||(i[p]=t(o[p]))}return i}return o},e.isObject=v,
|
|
|
|
|
/*!
|
|
|
|
|
* Determines if `arg` is a plain old JavaScript object (POJO). Specifically,
|
|
|
|
|
* `arg` must be an object but not an instance of any special class, like String,
|
|
|
|
|
* ObjectId, etc.
|
|
|
|
|
*
|
|
|
|
|
* `Object.getPrototypeOf()` is part of ES5: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getPrototypeOf
|
|
|
|
|
*
|
|
|
|
|
* @param {Object|Array|String|Function|RegExp|any} arg
|
|
|
|
|
* @api private
|
|
|
|
|
* @return {Boolean}
|
|
|
|
|
*/
|
|
|
|
|
e.isPOJO=function(t){if(null==t||"object"!==i(t))return!1;var e=Object.getPrototypeOf(t);return!e||"Object"===e.constructor.name},
|
|
|
|
|
/*!
|
|
|
|
|
* Determines if `obj` is a built-in object like an array, date, boolean,
|
|
|
|
|
* etc.
|
|
|
|
|
*/
|
|
|
|
|
e.isNativeObject=function(t){return Array.isArray(t)||t instanceof Date||t instanceof Boolean||t instanceof Number||t instanceof String},
|
|
|
|
|
/*!
|
|
|
|
|
* Determines if `val` is an object that has no own keys
|
|
|
|
|
*/
|
|
|
|
|
e.isEmptyObject=function(t){return null!=t&&"object"===i(t)&&0===Object.keys(t).length},
|
|
|
|
|
/*!
|
|
|
|
|
* Search if `obj` or any POJOs nested underneath `obj` has a property named
|
|
|
|
|
* `key`
|
|
|
|
|
*/
|
|
|
|
|
e.hasKey=function(t,r){for(var n=0,o=Object.keys(t);n<o.length;n++){var i=o[n];if(i===r)return!0;if(e.isPOJO(t[i])&&e.hasKey(t[i],r))return!0}return!1},
|
|
|
|
|
/*!
|
|
|
|
|
* A faster Array.prototype.slice.call(arguments) alternative
|
|
|
|
|
* @api private
|
|
|
|
|
*/
|
|
|
|
|
e.args=c,
|
|
|
|
|
/*!
|
|
|
|
|
* process.nextTick helper.
|
|
|
|
|
*
|
|
|
|
|
* Wraps `callback` in a try/catch + nextTick.
|
|
|
|
|
*
|
|
|
|
|
* node-mongodb-native has a habit of state corruption when an error is immediately thrown from within a collection callback.
|
|
|
|
|
*
|
|
|
|
|
* @param {Function} callback
|
|
|
|
|
* @api private
|
|
|
|
|
*/
|
|
|
|
|
e.tick=function(t){if("function"==typeof t)return function(){try{t.apply(this,arguments)}catch(t){d((function(){throw t}))}}},
|
|
|
|
|
/*!
|
|
|
|
|
* Returns true if `v` is an object that can be serialized as a primitive in
|
|
|
|
|
* MongoDB
|
|
|
|
|
*/
|
|
|
|
|
e.isMongooseType=function(t){return t instanceof p||t instanceof f||t instanceof l},e.isMongooseObject=b,
|
|
|
|
|
/*!
|
|
|
|
|
* Converts `expires` options of index objects to `expiresAfterSeconds` options for MongoDB.
|
|
|
|
|
*
|
|
|
|
|
* @param {Object} object
|
|
|
|
|
* @api private
|
|
|
|
|
*/
|
|
|
|
|
e.expires=function(t){var e;t&&"Object"===t.constructor.name&&("expires"in t&&(e="string"!=typeof t.expires?t.expires:Math.round(a(t.expires)/1e3),t.expireAfterSeconds=e,delete t.expires))},
|
|
|
|
|
/*!
|
|
|
|
|
* populate helper
|
|
|
|
|
*/
|
|
|
|
|
e.populate=function(t,r,n,o,s,a,u,c){var l=null;if(1===arguments.length){if(t instanceof h)return[t];if(Array.isArray(t)){var f=p(t);return f.map((function(t){return e.populate(t)[0]}))}l=e.isObject(t)?Object.assign({},t):{path:t}}else l="object"===i(n)?{path:t,select:r,match:n,options:o}:{path:t,select:r,model:n,match:o,options:s,populate:a,justOne:u,count:c};if("string"!=typeof l.path)throw new TypeError("utils.populate: invalid path. Expected string. Got typeof `"+i(t)+"`");return S(l);function p(t){var e=[];return t.forEach((function(t){/[\s]/.test(t.path)?t.path.split(" ").forEach((function(r){var n=Object.assign({},t);n.path=r,e.push(n)})):e.push(t)})),e}},e.getValue=function(t,e,r){return u.get(t,e,"_doc",r)},
|
|
|
|
|
/*!
|
|
|
|
|
* Sets the value of `obj` at the given `path`.
|
|
|
|
|
*
|
|
|
|
|
* @param {String} path
|
|
|
|
|
* @param {Anything} val
|
|
|
|
|
* @param {Object} obj
|
|
|
|
|
*/
|
|
|
|
|
e.setValue=function(t,e,r,n,o){u.set(t,e,r,"_doc",n,o)},
|
|
|
|
|
/*!
|
|
|
|
|
* Returns an array of values from object `o`.
|
|
|
|
|
*
|
|
|
|
|
* @param {Object} o
|
|
|
|
|
* @return {Array}
|
|
|
|
|
* @private
|
|
|
|
|
*/
|
|
|
|
|
e.object={},e.object.vals=function(t){for(var e=Object.keys(t),r=e.length,n=[];r--;)n.push(t[e[r]]);return n},
|
|
|
|
|
/*!
|
|
|
|
|
* @see exports.options
|
|
|
|
|
*/
|
|
|
|
|
e.object.shallowCopy=e.options;
|
|
|
|
|
/*!
|
|
|
|
|
* Safer helper for hasOwnProperty checks
|
|
|
|
|
*
|
|
|
|
|
* @param {Object} obj
|
|
|
|
|
* @param {String} prop
|
|
|
|
|
*/
|
|
|
|
|
var j=Object.prototype.hasOwnProperty;e.object.hasOwnProperty=function(t,e){return j.call(t,e)},
|
|
|
|
|
/*!
|
|
|
|
|
* Determine if `val` is null or undefined
|
|
|
|
|
*
|
|
|
|
|
* @return {Boolean}
|
|
|
|
|
*/
|
|
|
|
|
e.isNullOrUndefined=function(t){return null==t},
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
e.array={},
|
|
|
|
|
/*!
|
|
|
|
|
* Flattens an array.
|
|
|
|
|
*
|
|
|
|
|
* [ 1, [ 2, 3, [4] ]] -> [1,2,3,4]
|
|
|
|
|
*
|
|
|
|
|
* @param {Array} arr
|
|
|
|
|
* @param {Function} [filter] If passed, will be invoked with each item in the array. If `filter` returns a falsy value, the item will not be included in the results.
|
|
|
|
|
* @return {Array}
|
|
|
|
|
* @private
|
|
|
|
|
*/
|
|
|
|
|
e.array.flatten=function t(e,r,n){return n||(n=[]),e.forEach((function(e){Array.isArray(e)?t(e,r,n):r&&!r(e)||n.push(e)})),n};
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
var A=Object.prototype.hasOwnProperty;e.hasUserDefinedProperty=function(t,r){if(null==t)return!1;if(Array.isArray(r)){var o,s=n(r);try{for(s.s();!(o=s.n()).done;){var a=o.value;if(e.hasUserDefinedProperty(t,a))return!0}}catch(t){s.e(t)}finally{s.f()}return!1}if(A.call(t,r))return!0;if("object"===i(t)&&r in t){var u=t[r];return u!==Object.prototype[r]&&u!==Array.prototype[r]}return!1};
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
var E=Math.pow(2,32)-1;e.isArrayIndex=function(t){return"number"==typeof t?t>=0&&t<=E:"string"==typeof t&&(!!/^\d+$/.test(t)&&((t=+t)>=0&&t<=E))},
|
|
|
|
|
/*!
|
|
|
|
|
* Removes duplicate values from an array
|
|
|
|
|
*
|
|
|
|
|
* [1, 2, 3, 3, 5] => [1, 2, 3, 5]
|
|
|
|
|
* [ ObjectId("550988ba0c19d57f697dc45e"), ObjectId("550988ba0c19d57f697dc45e") ]
|
|
|
|
|
* => [ObjectId("550988ba0c19d57f697dc45e")]
|
|
|
|
|
*
|
|
|
|
|
* @param {Array} arr
|
|
|
|
|
* @return {Array}
|
|
|
|
|
* @private
|
|
|
|
|
*/
|
|
|
|
|
e.array.unique=function(t){var e,r=new Set,o=new Set,i=[],s=n(t);try{for(s.s();!(e=s.n()).done;){var a=e.value;if("number"==typeof a||"string"==typeof a||null==a){if(r.has(a))continue;i.push(a),r.add(a)}else if(a instanceof p){if(o.has(a.toString()))continue;i.push(a),o.add(a.toString())}else i.push(a)}}catch(t){s.e(t)}finally{s.f()}return i},
|
|
|
|
|
/*!
|
|
|
|
|
* Determines if two buffers are equal.
|
|
|
|
|
*
|
|
|
|
|
* @param {Buffer} a
|
|
|
|
|
* @param {Object} b
|
|
|
|
|
*/
|
|
|
|
|
e.buffer={},e.buffer.areEqual=function(t,e){if(!l.isBuffer(t))return!1;if(!l.isBuffer(e))return!1;if(t.length!==e.length)return!1;for(var r=0,n=t.length;r<n;++r)if(t[r]!==e[r])return!1;return!0},e.getFunctionName=_,
|
|
|
|
|
/*!
|
|
|
|
|
* Decorate buffers
|
|
|
|
|
*/
|
|
|
|
|
e.decorate=function(t,e){for(var r in e)O.has(r)||(t[r]=e[r])},e.mergeClone=function(t,r){b(r)&&(r=r.toObject({transform:!1,virtuals:!1,depopulate:!0,getters:!1,flattenDecimals:!1}));for(var n,o=Object.keys(r),i=o.length,s=0;s<i;)if(n=o[s++],!O.has(n))if(void 0===t[n])t[n]=e.clone(r[n],{transform:!1,virtuals:!1,depopulate:!0,getters:!1,flattenDecimals:!1});else{var a=r[n];if(null==a||!a.valueOf||a instanceof Date||(a=a.valueOf()),e.isObject(a)){var u=a;b(a)&&!a.isMongooseBuffer&&(u=u.toObject({transform:!1,virtuals:!1,depopulate:!0,getters:!1,flattenDecimals:!1})),a.isMongooseBuffer&&(u=l.from(u)),e.mergeClone(t[n],u)}else t[n]=e.clone(a,{flattenDecimals:!1})}},e.each=function(t,e){var r,o=n(t);try{for(o.s();!(r=o.n()).done;){e(r.value)}}catch(t){o.e(t)}finally{o.f()}},
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
e.getOption=function(t){var e,r=Array.prototype.slice.call(arguments,1),o=n(r);try{for(o.s();!(e=o.n()).done;){var i=e.value;if(null!=i[t])return i[t]}}catch(t){o.e(t)}finally{o.f()}return null},
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
e.noop=function(){},e.errorToPOJO=function(t){if(!(t instanceof Error))throw new Error("`error` must be `instanceof Error`.");var e,r={},o=n(Object.getOwnPropertyNames(t));try{for(o.s();!(e=o.n()).done;){var i=e.value;r[i]=t[i]}}catch(t){o.e(t)}finally{o.f()}return r},e.nodeMajorVersion=function(){return parseInt(t.versions.node.split(".")[0],10)}}).call(this,r(10))},function(t,e,r){"use strict";(function(t){
|
|
|
|
|
/*!
|
|
|
|
|
* The buffer module from node.js, for the browser.
|
|
|
|
|
*
|
|
|
|
|
* @author Feross Aboukhadijeh <http://feross.org>
|
|
|
|
|
* @license MIT
|
|
|
|
|
*/
|
|
|
|
|
var n=r(104),o=r(105),i=r(106);function s(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(t,e){if(s()<e)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=u.prototype:(null===t&&(t=new u(e)),t.length=e),t}function u(t,e,r){if(!(u.TYPED_ARRAY_SUPPORT||this instanceof u))return new u(t,e,r);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return f(this,t)}return c(this,t,e,r)}function c(t,e,r,n){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,r,n){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");e=void 0===r&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,r):new Uint8Array(e,r,n);u.TYPED_ARRAY_SUPPORT?(t=e).__proto__=u.prototype:t=p(t,e);return t}(t,e,r,n):"string"==typeof e?function(t,e,r){"string"==typeof r&&""!==r||(r="utf8");if(!u.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|y(e,r),o=(t=a(t,n)).write(e,r);o!==n&&(t=t.slice(0,o));return t}(t,e,r):function(t,e){if(u.isBuffer(e)){var r=0|h(e.length);return 0===(t=a(t,r)).length||e.copy(t,0,0,r),t}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(n=e.length)!=n?a(t,0):p(t,e);if("Buffer"===e.type&&i(e.data))return p(t,e.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function l(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function f(t,e){if(l(e),t=a(t,e<0?0:0|h(e)),!u.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}function p(t,e){var r=e.length<0?0:0|h(e.length);t=a(t,r);for(var n=0;n<r;n+=1)t[n]=255&e[n];return t}function h(t){if(t>=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|t}function y(t,e){if(u.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return U(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return L(t).length;default:if(n)return U(t).length;e=(""+e).toLowerCase(),n=!0}}function d(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return x(this,e,r);case"utf8":case"utf-8":return E(this,e,r);case"ascii":return $(this,e,r);case"latin1":case"binary":return P(this,e,r);case"base64":return A(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function v(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function m(t,e,r,n,o){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(o)return-1;r=t.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof e&&(e=u.from(e,n)),u.isBuffer(e))return 0===e.length?-1:_(t,e,r,n,o);if("number"==typeof e)return e&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):_(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function _(t,e,r,n,o){var i,s=1,a=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"
|
|
|
|
|
/*!
|
|
|
|
|
* Simplified lodash.get to work around the annoying null quirk. See:
|
|
|
|
|
* https://github.com/lodash/lodash/issues/3659
|
|
|
|
|
*/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 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 i(t,e){return null==t?t:t instanceof Map?t.get(e):t[e]}t.exports=function(t,e,r){var o,s=!1;if("string"==typeof e){if(-1===e.indexOf(".")){var a=i(t,e);return null==a?r:a}o=e.split(".")}else if(s=!0,1===(o=e).length){var u=i(t,o[0]);return null==u?r:u}var c,l=e,f=t,p=n(o);try{for(p.s();!(c=p.n()).done;){var h=c.value;if(null==f)return r;if(!s&&null!=f[l])return f[l];f=i(f,h),s||(l=l.substr(h.length+1))}}catch(t){p.e(t)}finally{p.f()}return null==f?r:f}},function(t,e,r){(function(t){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 o=Object.getOwnPropertyDescriptors||function(t){for(var e=Object.keys(t),r={},n=0;n<e.length;n++)r[e[n]]=Object.getOwnPropertyDescriptor(t,e[n]);return r},i=/%[sdj%]/g;e.format=function(t){if(!_(t)){for(var e=[],r=0;r<arguments.length;r++)e.push(u(arguments[r]));return e.join(" ")}r=1;for(var n=arguments,o=n.length,s=String(t).replace(i,(function(t){if("%%"===t)return"%";if(r>=o)return t;switch(t){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(t){return"[Circular]"}default:return t}})),a=n[r];r<o;a=n[++r])v(a)||!w(a)?s+=" "+a:s+=" "+u(a);return s},e.deprecate=function(r,n){if(void 0!==t&&!0===t.noDeprecation)return r;if(void 0===t)return function(){return e.deprecate(r,n).apply(this,arguments)};var o=!1;return function(){if(!o){if(t.throwDeprecation)throw new Error(n);t.traceDeprecation?console.trace(n):console.error(n),o=!0}return r.apply(this,arguments)}};var s,a={};function u(t,r){var n={seen:[],stylize:l};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),d(r)?n.showHidden=r:r&&e._extend(n,r),b(n.showHidden)&&(n.showHidden=!1),b(n.depth)&&(n.depth=2),b(n.colors)&&(n.colors=!1),b(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=c),f(n,t,n.depth)}function c(t,e){var r=u.styles[e];return r?"["+u.colors[r][0]+"m"+t+"["+u.colors[r][1]+"m":t}function l(t,e){return t}function f(t,r,n){if(t.customInspect&&r&&j(r.inspect)&&r.inspect!==e.inspect&&(!r.constructor||r.constructor.prototype!==r)){var o=r.inspect(n,t);return _(o)||(o=f(t,o,n)),o}var i=function(t,e){if(b(e))return t.stylize("undefined","undefined");if(_(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}if(m(e))return t.stylize(""+e,"number");if(d(e))return t.stylize(""+e,"boolean");if(v(e))return t.stylize("null","null")}(t,r);if(i)return i;var s=Object.keys(r),a=function(t){var e={};return t.forEach((function(t,r){e[t]=!0})),e}(s);if(t.showHidden&&(s=Object.getOwnPropertyNames(r)),S(r)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return p(r);if(0===s.length){if(j(r)){var u=r.name?": "+r.name:"";return t.stylize("[Function"+u+"]","special")}if(g(r))return t.stylize(RegExp.prototype.toString.call(r),"regexp");if(O(r))re
|
|
|
|
|
/*!
|
|
|
|
|
* Module exports.
|
|
|
|
|
*/t.exports=n,n.messages=r(147),n.Messages=n.messages,n.DocumentNotFoundError=r(148),n.CastError=r(13),n.ValidationError=r(34),n.ValidatorError=r(79),n.VersionError=r(149),n.ParallelSaveError=r(150),n.OverwriteModelError=r(151),n.MissingSchemaError=r(152),n.DivergentArrayError=r(153),n.StrictModeError=r(35)},function(t,e,r){"use strict";(function(n){
|
|
|
|
|
/*!
|
|
|
|
|
* Module dependencies.
|
|
|
|
|
*/
|
|
|
|
|
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 i=r(5),s=r(7),a=r(54),u=r(80),c=r(3),l=r(154),f=r(22),p=r(0).schemaTypeSymbol,h=r(4),y=r(1),d=r(0).validatorErrorSymbol,v=r(0).documentIsModified,m=r(0).populateModelSymbol,_=i.CastError,b=i.ValidatorError;function g(t,e,r){this[p]=!0,this.path=t,this.instance=r,this.validators=[],this.getters=this.constructor.hasOwnProperty("getters")?this.constructor.getters.slice():[],this.setters=[],this.splitPath(),e=e||{};for(var n=this.constructor.defaultOptions||{},i=0,a=Object.keys(n);i<a.length;i++){var u=a[i];n.hasOwnProperty(u)&&!e.hasOwnProperty(u)&&(e[u]=n[u])}null==e.select&&delete e.select;var c=this.OptionsConstructor||s;this.options=new c(e),this._index=null,y.hasUserDefinedProperty(this.options,"immutable")&&(this.$immutable=this.options.immutable,l(this));for(var f=0,h=Object.keys(this.options);f<h.length;f++){var d=h[f];if("cast"!==d){if(y.hasUserDefinedProperty(this.options,d)&&"function"==typeof this[d]){if("index"===d&&this._index){if(!1===e.index){var v=this._index;if("object"===o(v)&&null!=v){if(v.unique)throw new Error('Path "'+this.path+'" may not have `index` set to false and `unique` set to true');if(v.sparse)throw new Error('Path "'+this.path+'" may not have `index` set to false and `sparse` set to true')}this._index=!1}continue}var m=e[d];if("default"===d){this.default(m);continue}var _=Array.isArray(m)?m:[m];this[d].apply(this,_)}}else this.castFunction(this.options[d])}Object.defineProperty(this,"$$context",{enumerable:!1,configurable:!1,writable:!0,value:null})}
|
|
|
|
|
/*!
|
|
|
|
|
* The class that Mongoose uses internally to instantiate this SchemaType's `options` property.
|
|
|
|
|
*/g.prototype.OptionsConstructor=s,
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
g.prototype.splitPath=function(){return null!=this._presplitPath?this._presplitPath:null!=this.path?(this._presplitPath=-1===this.path.indexOf(".")?[this.path]:this.path.split("."),this._presplitPath):void 0},g.cast=function(t){return 0===arguments.length||(!1===t&&(t=function(t){return t}),this._cast=t),this._cast},g.prototype.castFunction=function(t){return 0===arguments.length||(!1===t&&(t=this.constructor._defaultCaster||function(t){return t}),this._castFunction=t),this._castFunction},g.prototype.cast=function(){throw new Error("Base SchemaType class does not implement a `cast()` function")},g.set=function(t,e){this.hasOwnProperty("defaultOptions")||(this.defaultOptions=Object.assign({},this.defaultOptions)),this.defaultOptions[t]=e},g.get=function(t){this.getters=this.hasOwnProperty("getters")?this.getters:[],this.getters.push(t)},g.prototype.default=function(t){if(1===arguments.length){if(void 0===t)return void(this.defaultValue=void 0);if(null!=t&&t.instanceOfSchema)throw new i("Cannot set default value of path `"+this.path+"` to a mongoose Schema instance.");return this.defaultValue=t,this.defaultValue}return arguments.length>1&&(this.defaultValue=y.args(arguments)),this.defaultValue},g.prototype.index=function(t){return this._index=t,y.expires(this._index),this},g.prototype.unique=function(t){if(!1===this._index){if(!t)return;throw new Error('Path "'+this.path+'" may not have `index` set to false and `unique` set to true')}return null==this._index||!0===this._index?this._index={}:"string"==typeof this._index&&(this._index={type:this._index}),this._index.unique=t,this},g.prototype.text=function(t){if(!1===this._index){if(!t)return;throw new Error('Path "'+this.path+'" may not have `index` set to false and `text` set to true')}return null===this._index||void 0===this._index||"boolean"==typeof this._index?this._index={}:"string"==typeof this._index&&(this._index={type:this._index}),this._index.text=t,this},g.prototype.sparse=function(t){if(!1===this._index){if(!t)return;throw new Error('Path "'+this.path+'" may not have `index` set to false and `sparse` set to true')}return null==this._index||"boolean"==typeof this._index?this._index={}:"string"==typeof this._index&&(this._index={type:this._index}),this._index.sparse=t,this},g.prototype.immutable=function(t){return this.$immutable=t,l(this),this},g.prototype.transform=function(t){return this.options.transform=t,this},g.prototype.set=function(t){if("function"!=typeof t)throw new TypeError("A setter must be a function.");return this.setters.push(t),this},g.prototype.get=function(t){if("function"!=typeof t)throw new TypeError("A getter must be a function.");return this.getters.push(t),this},g.prototype.validate=function(t,e,r){var n,s,a,u;if("function"==typeof t||t&&"RegExp"===y.getFunctionName(t.constructor))return"function"==typeof e?(n={validator:t,message:e}).type=r||"user defined":e instanceof Object&&!r?((n=y.clone(e)).message||(n.message=n.msg),n.validator=t,n.type=n.type||"user defined"):(null==e&&(e=i.messages.general.default),r||(r="user defined"),n={message:e,type:r,validator:t}),n.isAsync&&w(),this.validators.push(n),this;for(s=0,a=arguments.length;s<a;s++){if(u=arguments[s],!y.isPOJO(u)){var c="Invalid validator. Received ("+o(u)+") "+u+". See http://mongoosejs.com/docs/api.html#schematype_SchemaType-validate";throw new Error(c)}this.validate(u.validator,u)}return this};
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
var w=h.deprecate((function(){}),"Mongoose: the `isAsync` option for custom validators is deprecated. Make your async validators return a promise instead: https://mongoosejs.com/docs/validation.html#async-custom-validators");
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
function O(t){return this.castForQuery(t)}
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
/*!
|
|
|
|
|
* Just like handleArray, except also allows `[]` because surprisingly
|
|
|
|
|
* `$in: [1, []]` works fine
|
|
|
|
|
*/
|
|
|
|
|
function S(t){var e=this;return Array.isArray(t)?t.map((function(t){return Array.isArray(t)&&0===t.length?t:e.castForQuery(t)})):[this.castForQuery(t)]}
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/g.prototype.required=function(t,e){var r={};if(arguments.length>0&&null==t)return this.validators=this.validators.filter((function(t){return t.validator!==this.requiredValidator}),this),this.isRequired=!1,delete this.originalRequiredValue,this;if("object"===o(t)&&(e=(r=t).message||e,t=t.isRequired),!1===t)return this.validators=this.validators.filter((function(t){return t.validator!==this.requiredValidator}),this),this.isRequired=!1,delete this.originalRequiredValue,this;var n=this;this.isRequired=!0,this.requiredValidator=function(e){var r=c(this,"$__.cachedRequired");if(null!=r&&!this.$__isSelected(n.path)&&!this[v](n.path))return!0;if(null!=r&&n.path in r){var o=!r[n.path]||n.checkRequired(e,this);return delete r[n.path],o}return"function"==typeof t&&!t.apply(this)||n.checkRequired(e,this)},this.originalRequiredValue=t,"string"==typeof t&&(e=t,t=void 0);var s=e||i.messages.general.required;return this.validators.unshift(Object.assign({},r,{validator:this.requiredValidator,message:s,type:"required"})),this},g.prototype.ref=function(t){return this.options.ref=t,this},g.prototype.getDefault=function(t,e){var r="function"==typeof this.defaultValue?this.defaultValue.call(t):this.defaultValue;if(null!=r){"object"!==o(r)||this.options&&this.options.shared||(r=y.clone(r));var n=this.applySetters(r,t,e);return n&&n.$isSingleNested&&(n.$__parent=t),n}return r},
|
|
|
|
|
/*!
|
|
|
|
|
* Applies setters without casting
|
|
|
|
|
*
|
|
|
|
|
* @api private
|
|
|
|
|
*/
|
|
|
|
|
g.prototype._applySetters=function(t,e,r){var n=t;if(r)return n;for(var o=this.setters,i=o.length-1;i>=0;i--)n=o[i].call(e,n,this);return n},
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
g.prototype._castNullish=function(t){return t},g.prototype.applySetters=function(t,e,r,n,o){var i=this._applySetters(t,e,r,n,o);return null==i?this._castNullish(i):i=this.cast(i,e,r,n,o)},g.prototype.applyGetters=function(t,e){var r=t,n=this.getters,o=n.length;if(0===o)return r;for(var i=0;i<o;++i)r=n[i].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 i=!1,s=this.path,a=this.validators.filter((function(t){return null!=t&&"object"===o(t)})),u=a.length;if(!u)return e(null);var c=this;function l(t,r){if(!i)if(void 0===t||t)--u<=0&&f((function(){e(null)}));else{var n=r.ErrorConstructor||b;(i=new n(r))[d]=!0,f((function(){e(i)}))}}a.forEach((function(e){if(!i){var o,a=e.validator,u=y.clone(e);if(u.path=n&&n.path?n.path:s,u.value=t,a instanceof RegExp)l(a.test(t),u);else if("function"==typeof a)if(void 0!==t||a===c.requiredValidator)if(u.isAsync)!
|
|
|
|
|
/*!
|
|
|
|
|
* Handle async validators
|
|
|
|
|
*/
|
|
|
|
|
function(t,e,r,n,o){var i=!1,s=t.call(e,r,(function(t,e){i||(i=!0,e&&(n.message=e),o(t,n))}));"boolean"==typeof s?(i=!0,o(s,n)):s&&"function"==typeof s.then&&s.then((function(t){i||(i=!0,o(t,n))}),(function(t){i||(i=!0,n.reason=t,n.message=t.message,o(!1,n))}))}(a,r,t,u,l);else{try{o=u.propsParameter?a.call(r,t,u):a.call(r,t)}catch(t){o=!1,u.reason=t,t.message&&(u.message=t.message)}null!=o&&"function"==typeof o.then?o.then((function(t){l(t,u)}),(function(t){u.reason=t,u.message=t.message,l(o=!1,u)})):l(o,u)}else l(!0,u)}}))},g.prototype.doValidateSync=function(t,e,r){var n=this.path;if(!this.validators.length)return null;var i=this.validators;if(void 0===t){if(!(this.validators.length>0&&"required"===this.validators[0].type))return null;i=[this.validators[0]]}var s=null;return i.forEach((function(i){if(!s&&null!=i&&"object"===o(i)){var u,c=i.validator,l=y.clone(i);if(l.path=r&&r.path?r.path:n,l.value=t,!c.isAsync)if(c instanceof RegExp)a(c.test(t),l);else if("function"==typeof c){try{u=l.propsParameter?c.call(e,t,l):c.call(e,t)}catch(t){u=!1,l.reason=t}null!=u&&"function"==typeof u.then||a(u,l)}}})),s;function a(t,e){if(!s&&void 0!==t&&!t){var r=e.ErrorConstructor||b;(s=new r(e))[d]=!0}}},g._isRef=function(t,e,r,o){var i=o&&t.options&&(t.options.ref||t.options.refPath);if(!i&&r&&null!=r.$__){var s=r.$__fullPath(t.path);i=(r.ownerDocument?r.ownerDocument():r).populated(s)||r.populated(t.path)}return!!i&&(null==e||(!(n.isBuffer(e)||"Binary"===e._bsontype||!y.isObject(e))||o))},
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
g.prototype._castRef=function(t,e,r){if(null==t)return t;if(null!=t.$__)return t.$__.wasPopulated=!0,t;if(n.isBuffer(t)||!y.isObject(t)){if(r)return t;throw new _(this.instance,t,this.path,null,this)}var o=e.$__fullPath(this.path),i=(e.ownerDocument?e.ownerDocument():e).populated(o,!0),s=t;return e.$__.populated&&e.$__.populated[o]&&e.$__.populated[o].options&&e.$__.populated[o].options.options&&e.$__.populated[o].options.options.lean||((s=new i.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:O,$in:S,$ne:O,$nin:S,$exists:a,$type:u},
|
|
|
|
|
/*!
|
|
|
|
|
* Wraps `castForQuery` to handle context
|
|
|
|
|
*/
|
|
|
|
|
g.prototype.castForQueryWrapper=function(t){if(this.$$context=t.context,"$conditional"in t){var e=this.castForQuery(t.$conditional,t.val);return this.$$context=null,e}if(t.$skipQueryCastForUpdate||t.$applySetters){var r=this._castForQuery(t.val);return this.$$context=null,r}var n=this.castForQuery(t.val);return this.$$context=null,n},g.prototype.castForQuery=function(t,e){var r;if(2===arguments.length){if(!(r=this.$conditionalHandlers[t]))throw new Error("Can't use "+t);return r.call(this,e)}return e=t,this._castForQuery(e)},
|
|
|
|
|
/*!
|
|
|
|
|
* Internal switch for runSetters
|
|
|
|
|
*
|
|
|
|
|
* @api private
|
|
|
|
|
*/
|
|
|
|
|
g.prototype._castForQuery=function(t){return this.applySetters(t,this.$$context)},g.checkRequired=function(t){return arguments.length>0&&(this._checkRequired=t),this._checkRequired},g.prototype.checkRequired=function(t){return null!=t},
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
g.prototype.clone=function(){var t=Object.assign({},this.options),e=new this.constructor(this.path,t,this.instance);return e.validators=this.validators.slice(),void 0!==this.requiredValidator&&(e.requiredValidator=this.requiredValidator),void 0!==this.defaultValue&&(e.defaultValue=this.defaultValue),void 0!==this.$immutable&&void 0===this.options.immutable&&(e.$immutable=this.$immutable,l(e)),void 0!==this._index&&(e._index=this._index),void 0!==this.selected&&(e.selected=this.selected),void 0!==this.isRequired&&(e.isRequired=this.isRequired),void 0!==this.originalRequiredValue&&(e.originalRequiredValue=this.originalRequiredValue),e.getters=this.getters.slice(),e.setters=this.setters.slice(),e},
|
|
|
|
|
/*!
|
|
|
|
|
* Module exports.
|
|
|
|
|
*/
|
|
|
|
|
t.exports=e=g,e.CastError=_,e.ValidatorError=b}).call(this,r(2).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)}function o(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,s(n.key),n)}}function i(t,e,r){return e&&o(t.prototype,e),r&&o(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function s(t){var e=function(t,e){if("object"!=n(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==n(e)?e:String(e)}var a=r(27),u=i((function t(e){if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),null==e)return this;Object.assign(this,a(e))})),c=r(8);Object.defineProperty(u.prototype,"type",c),Object.defineProperty(u.prototype,"validate",c),Object.defineProperty(u.prototype,"cast",c),Object.defineProperty(u.prototype,"required",c),Object.defineProperty(u.prototype,"default",c),Object.defineProperty(u.prototype,"ref",c),Object.defineProperty(u.prototype,"select",c),Object.defineProperty(u.prototype,"index",c),Object.defineProperty(u.prototype,"unique",c),Object.defineProperty(u.prototype,"immutable",c),Object.defineProperty(u.prototype,"sparse",c),Object.defineProperty(u.prototype,"text",c),Object.defineProperty(u.prototype,"transform",c),t.exports=u},function(t,e,r){"use strict";t.exports=Object.freeze({enumerable:!0,configurable:!0,writable:!0,value:void 0})},function(t,e){function r(t){return(r="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 n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"===("undefined"==typeof window?"undefined":r(window))&&(n=window)}t.exports=n},function(t,e){var r,n,o=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(t){if(r===setTimeout)return setTimeout(t,0);if((r===i||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:i}catch(t){r=i}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(t){n=s}}();var u,c=[],l=!1,f=-1;function p(){l&&u&&(l=!1,u.length?c=u.concat(c):f=-1,c.length&&h())}function h(){if(!l){var t=a(p);l=!0;for(var e=c.length;e;){for(u=c,c=[];++f<e;)u&&u[f].run();f=-1,e=c.length}u=null,l=!1,function(t){if(n===clearTimeout)return clearTimeout(t);if((n===s||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(t);try{n(t)}catch(e){try{return n.call(null,t)}catch(e){return n.call(this,t)}}}(t)}}function y(t,e){this.fun=t,this.array=e}function d(){}o.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];c.push(new y(t,e)),1!==c.length||l||a(h)},y.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=d,o.addListener=d,o.once=d,o.off=d,o.removeListener=d,o.removeAllListeners=d,o.emit=d,o.prependListener=d,o.prependOnceListener=d,o.listeners=function(t){return[]},o.binding=function(t){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(t){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(t,e,r){"use strict";var n=r(15).get().ObjectId,o=r(0).objectIdSymbol;
|
|
|
|
|
/*!
|
|
|
|
|
* Getter for convenience with populate, see gh-6115
|
|
|
|
|
*/
|
|
|
|
|
Object.defineProperty(n.prototype,"_id",{enumerable:!1,configurable:!0,get:function(){return this}}),n.prototype[o]=!0,t.exports=n},function(t,e,r){"use strict";(function(e){
|
|
|
|
|
/*!
|
|
|
|
|
* Module dependencies.
|
|
|
|
|
*/
|
|
|
|
|
function n(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=s(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=s(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==s(e)?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function o(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 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,c,l=r(19).EventEmitter,f=r(118),p=r(5),h=r(29),y=r(81),d=r(155),v=r(156),m=r(56),_=r(35),b=r(34),g=r(79),w=r(57),O=r(28),S=r(93),j=r(60).compile,A=r(60).defineKey,E=r(191).flatten,$=r(3),P=r(192),x=r(97),T=r(193),N=r(22),k=r(61),B=r(194),R=r(4).inspect,C=r(17).internalToObjectOptions,D=r(51),M=r(195),I=r(1),F=r(197),U=I.clone,L=I.deepEqual,V=I.isMongooseObject,q=Symbol("mongoose.Array#atomicsBackup"),W=r(0).arrayAtomicsSymbol,H=r(0).documentArrayParent,Y=r(0).documentIsModified,K=r(0).documentModifiedPaths,z=r(0).documentSchemaSymbol,Q=r(0).getSymbol,J=r(0).populateModelSymbol,G=r(0).scopeSymbol,X=r(36).schemaMixedSymbol,Z=I.specialProperties;function tt(t,e,r,n){var i=this;"object"===s(r)&&null!=r&&(r=(n=r).skipId),n=Object.assign({},n);var a=$(n,"defaults",!0);if(n.defaults=a,null==this.$__schema){var u=I.isObject(e)&&!e.instanceOfSchema?new m(e):e;this.$__setSchema(u),e=r,r=n,n=arguments[4]||{}}if(this.$__=new f,this.$__.emitter=new l,this.isNew=!("isNew"in n)||n.isNew,this.errors=void 0,this.$__.$options=n||{},this.$locals={},this.$op=null,null!=t&&"object"!==s(t))throw new d(t,"obj","Document");var c=this.$__schema;"boolean"==typeof e||"throw"===e?(this.$__.strictMode=e,e=void 0):(this.$__.strictMode=c.options.strict,this.$__.selected=e);var p,h=c.requiredPaths(!0),y=o(h);try{for(y.s();!(p=y.n()).done;){var v=p.value;this.$__.activePaths.require(v)}}catch(t){y.e(t)}finally{y.f()}this.$__.emitter.setMaxListeners(0);var _=null;I.isPOJO(e)&&(_=B(e));var b=!1===_&&e?rt(e):{};if(null==this._doc&&(this.$__buildDoc(t,e,r,_,b,!1),a&&nt(this,e,r,_,b,!0,{isNew:this.isNew})),t&&(this.$__original_set?this.$__original_set(t,void 0,!0):this.$set(t,void 0,!0),t instanceof tt&&(this.isNew=t.isNew)),n.willInit&&a?l.prototype.once.call(this,"init",(function(){nt(i,e,r,_,b,!1,n.skipDefaults,i.isNew)})):a&&nt(this,e,r,_,b,!1,n.skipDefaults,this.isNew),this.$__._id=this._id,!this.$__.strictMode&&t){var g=this,w=Object.keys(this._doc);w.forEach((function(t){t in c.tree||A(t,null,g)}))}ut(this)}
|
|
|
|
|
/*!
|
|
|
|
|
* Document exposes the NodeJS event emitter API, so you can use
|
|
|
|
|
* `on`, `once`, etc.
|
|
|
|
|
*/for(var et in I.each(["on","once","emit","listeners","removeListener","setMaxListeners","removeAllListeners","addListener"],(function(t){tt.prototype[t]=function(){return this.$__.emitter[t].apply(this.$__.emitter,arguments)}})),tt.prototype.constructor=tt,l.prototype)tt[et]=l.prototype[et];
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
function rt(t){for(var e={},r=0,n=Object.keys(t);r<n.length;r++){var i,s=[],a=o(n[r].split("."));try{for(a.s();!(i=a.n()).done;){var u=i.value;s.push(u),e[s.join(".")]=1}}catch(t){a.e(t)}finally{a.f()}}return e}
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/function nt(t,e,r,n,o,i,s){for(var a=Object.keys(t.$__schema.paths),u=a.length,c=0;c<u;++c){var l=void 0,f="",p=a[c];if("_id"!==p||!r)for(var h=t.$__schema.paths[p],y=h.splitPath(),d=y.length,v=!1,m=t._doc,_=0;_<d&&null!=m;++_){var b=y[_];if(f+=(f.length?".":"")+b,!0===n){if(f in e)break}else if(!1===n&&e&&!v)if(f in e)v=!0;else if(!o[f])break;if(_===d-1){if(void 0!==m[b])break;if("function"==typeof h.defaultValue){if(!h.defaultValue.$runBeforeSetters&&i)break;if(h.defaultValue.$runBeforeSetters&&!i)break}else if(!i)continue;if(s&&s[f])break;if(e&&null!==n){if(!0===n){if(p in e)continue;try{l=h.getDefault(t,!1)}catch(e){t.invalidate(p,e);break}void 0!==l&&(m[b]=l,t.$__.activePaths.default(p))}else if(v){try{l=h.getDefault(t,!1)}catch(e){t.invalidate(p,e);break}void 0!==l&&(m[b]=l,t.$__.activePaths.default(p))}}else{try{l=h.getDefault(t,!1)}catch(e){t.invalidate(p,e);break}void 0!==l&&(m[b]=l,t.$__.activePaths.default(p))}}else m=m[b]}}}function ot(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(!ot(t[r[e]]))return!1}return!0}
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
function it(t){var e={};!
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
function(t){Object.keys(t.$__.activePaths.states.require).forEach((function(e){var r=t.$__schema.path(e);null!=r&&"function"==typeof r.originalRequiredValue&&(t.$__.cachedRequired[e]=r.originalRequiredValue.call(t,t))}))}(t);var r=new Set(Object.keys(t.$__.activePaths.states.require).filter((function(e){return!(!t.$__isSelected(e)&&!t.isModified(e))&&(!(e in t.$__.cachedRequired)||t.$__.cachedRequired[e])})));function n(t){r.add(t)}Object.keys(t.$__.activePaths.states.init).forEach(n),Object.keys(t.$__.activePaths.states.modify).forEach(n),Object.keys(t.$__.activePaths.states.default).forEach(n);var i,s=t.$getAllSubdocs(),a=t.modifiedPaths(),u=o(s);try{for(u.s();!(i=u.n()).done;){var c=i.value;if(c.$basePath){var l,f=o(r);try{for(f.s();!(l=f.n()).done;){var p=l.value;(null===p||p.startsWith(c.$basePath+"."))&&r.delete(p)}}catch(t){f.e(t)}finally{f.f()}!t.isModified(c.$basePath,a)||t.isDirectModified(c.$basePath)||t.$isDefault(c.$basePath)||(r.add(c.$basePath),e[c.$basePath]=!0)}}}catch(t){u.e(t)}finally{u.f()}var h,y=o(r);try{for(y.s();!(h=y.n()).done;){var d=h.value,v=t.$__schema.path(d);if(v&&v.$isMongooseArray&&(!v.$isMongooseDocumentArray||$(v,"schemaOptions.required")))m(t.$__getValue(d),r,d)}}catch(t){y.e(t)}finally{y.f()}function m(t,e,r){if(null!=t)for(var n=t.length,o=0;o<n;++o)Array.isArray(t[o])?m(t[o],e,r+"."+o):e.add(r+"."+o)}var _,b={skipArrays:!0},g=o(r);try{for(g.s();!(_=g.n()).done;){var w=_.value;if(t.$__schema.nested[w]){var O=t.$__getValue(w);V(O)&&(O=O.toObject({transform:!1}));var S=E(O,w,b,t.$__schema);Object.keys(S).forEach(n)}}}catch(t){g.e(t)}finally{g.f()}var j,A=o(r);try{for(A.s();!(j=A.n()).done;){var P=j.value;if(t.$__schema.singleNestedPaths.hasOwnProperty(P))r.delete(P);else{var x=t.$__schema.path(P);if(x&&x.$isSchemaMap){var T=t.$__getValue(P);if(null!=T){var N,k=o(T.keys());try{for(k.s();!(N=k.n()).done;){var B=N.value;r.add(P+"."+B)}}catch(t){k.e(t)}finally{k.f()}}}}}}catch(t){A.e(t)}finally{A.f()}return[r=Array.from(r),e]}
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
function st(t,e){var r,n=new Set(e),i=new Map([]),s=o(e);try{for(s.s();!(r=s.n()).done;){var a=r.value;if(-1!==a.indexOf("."))for(var u=a.split("."),c=u[0],l=1;l<u.length;++l)i.set(c,a),c=c+"."+u[l]}}catch(t){s.e(t)}finally{s.f()}var f,p=[],h=o(t);try{for(h.s();!(f=h.n()).done;){var y=f.value;n.has(y)?p.push(y):i.has(y)&&p.push(i.get(y))}}catch(t){h.e(t)}finally{h.f()}return p}
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/function at(t,e){return e=new Set(e),t=t.filter((function(t){return!e.has(t)}))}
|
|
|
|
|
/*!
|
|
|
|
|
* Runs queued functions
|
|
|
|
|
*/
|
|
|
|
|
function ut(t){var e=t.$__schema&&t.$__schema.callQueue;if(e.length){var r,n=o(e);try{for(n.s();!(r=n.n()).done;){var i=r.value;"pre"!==i[0]&&"post"!==i[0]&&"on"!==i[0]&&t[i[0]].apply(t,i[1])}}catch(t){n.e(t)}finally{n.f()}}}
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
/*!
|
|
|
|
|
* Applies virtuals properties to `json`.
|
|
|
|
|
*/
|
|
|
|
|
function ct(t,e,r,n){var o,i,s,a=t.$__schema,u=Object.keys(a.virtuals),c=u.length,l=c,f=t._doc,p=$(n,"aliases",!0),h=null;if(Array.isArray(r.virtuals))h=new Set(r.virtuals);else if(r.virtuals&&r.virtuals.pathsToSkip){h=new Set(u);for(var y=0;y<r.virtuals.pathsToSkip.length;y++)h.has(r.virtuals.pathsToSkip[y])&&h.delete(r.virtuals.pathsToSkip[y])}if(!f)return e;for(r=r||{},c=0;c<l;++c)if(o=u[c],(null==h||h.has(o))&&(p||!a.aliases.hasOwnProperty(o))){if(i=o,null!=r.path){if(!o.startsWith(r.path+"."))continue;i=o.substr(r.path.length+1)}var d=i.split(".");if(void 0!==(s=U(t.get(o),r))){var v=d.length;f=e;for(var m=0;m<v-1;++m)f[d[m]]=f[d[m]]||{},f=f[d[m]];f[d[v-1]]=s}}return e}
|
|
|
|
|
/*!
|
|
|
|
|
* Applies virtuals properties to `json`.
|
|
|
|
|
*
|
|
|
|
|
* @param {Document} self
|
|
|
|
|
* @param {Object} json
|
|
|
|
|
* @return {Object} `json`
|
|
|
|
|
*/function lt(t,e){if(F(e))throw new Error("`transform` function must be synchronous, but the transform on path `"+t+"` returned a promise.")}
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/tt.prototype.$__schema,tt.prototype.schema,Object.defineProperty(tt.prototype,"$locals",{configurable:!1,enumerable:!1,writable:!0}),tt.prototype.isNew,Object.defineProperty(tt.prototype,"$where",{configurable:!1,enumerable:!1,writable:!0}),tt.prototype.id,tt.prototype.errors,tt.prototype.$op,tt.prototype.$__buildDoc=function(t,e,r,n,o){for(var i={},s=Object.keys(this.$__schema.paths).filter((function(t){return!t.includes("$*")})),a=s.length,u=0;u<a;++u){var c=s[u];if("_id"===c){if(r)continue;if(t&&"_id"in t)continue}for(var l=this.$__schema.paths[c].splitPath(),f=l.length,p=f-1,h="",y=i,d=!1,v=0;v<f;++v){var m=l[v];if(h+=(h.length?".":"")+m,!0===n){if(h in e)break}else if(!1===n&&e&&!d)if(h in e)d=!0;else if(!o[h])break;v<p&&(y=y[m]||(y[m]={}))}}this._doc=i},
|
|
|
|
|
/*!
|
|
|
|
|
* Converts to POJO when you use the document for querying
|
|
|
|
|
*/
|
|
|
|
|
tt.prototype.toBSON=function(){return this.toObject(C)},tt.prototype.init=function(t,e,r){return"function"==typeof e&&(r=e,e=null),this.$__init(t,e),r&&r(null,this),this},
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
tt.prototype.$__init=function(t,e){if(this.isNew=!1,this.$init=!0,e=e||{},null!=t._id&&e.populated&&e.populated.length){var r,n=String(t._id),i=o(e.populated);try{for(i.s();!(r=i.n()).done;){var s=r.value;if(s.isVirtual?this.populated(s.path,I.getValue(s.path,t),s):this.populated(s.path,s._docs[n],s),null!=s._childDocs){var a,u=o(s._childDocs);try{for(u.s();!(a=u.n()).done;){var c=a.value;null!=c&&null!=c.$__&&(c.$__.parent=this)}}catch(t){u.e(t)}finally{u.f()}s._childDocs=[]}}}catch(t){i.e(t)}finally{i.f()}}
|
|
|
|
|
/*!
|
|
|
|
|
* Init helper.
|
|
|
|
|
*
|
|
|
|
|
* @param {Object} self document instance
|
|
|
|
|
* @param {Object} obj raw mongodb doc
|
|
|
|
|
* @param {Object} doc object we are initializing
|
|
|
|
|
* @api private
|
|
|
|
|
*/
|
|
|
|
|
return function t(e,r,n,o,i){i=i||"";var s,a,u,c=Object.keys(r),l=c.length,f=0;for(;f<l;)p(f++);function p(l){if("__proto__"!==(u=c[l])&&"constructor"!==u&&(a=i+u,s=e.$__schema.path(a),!e.$__schema.$isRootDiscriminator||e.$__isSelected(a)))if(!s&&I.isPOJO(r[u]))n[u]||(n[u]={}),t(e,r[u],n[u],o,a+".");else if(s){if(null===r[u])n[u]=s._castNullish(null);else if(void 0!==r[u]){var f=(r[u].$__||{}).wasPopulated||null;if(s&&!f)try{n[u]=s.cast(r[u],e,!0)}catch(t){e.invalidate(t.path,new g({path:t.path,message:t.message,type:"cast",value:t.value,reason:t}))}else n[u]=r[u]}e.isModified(a)||e.$__.activePaths.init(a)}else n[u]=r[u]}}(this,t,this._doc,e),
|
|
|
|
|
/*!
|
|
|
|
|
* If populating a path within a document array, make sure each
|
|
|
|
|
* subdoc within the array knows its subpaths are populated.
|
|
|
|
|
*
|
|
|
|
|
* ####Example:
|
|
|
|
|
* const doc = await Article.findOne().populate('comments.author');
|
|
|
|
|
* doc.comments[0].populated('author'); // Should be set
|
|
|
|
|
*/
|
|
|
|
|
function(t,e){if(null==t._id||null==e||0===e.length)return;var r,n=String(t._id),i=o(e);try{for(i.s();!(r=i.n()).done;){var s=r.value;if(!s.isVirtual)for(var a=s.path.split("."),u=0;u<a.length-1;++u){var c=a.slice(0,u+1).join("."),l=a.slice(u+1).join("."),f=t.get(c);if(null!=f&&f.isMongooseDocumentArray){for(var p=0;p<f.length;++p)f[p].populated(l,null==s._docs[n]?[]:s._docs[n][p],s);break}}}}catch(t){i.e(t)}finally{i.f()}}(this,e.populated),this.emit("init",this),this.constructor.emit("init",this),this.$__._id=this._id,this},tt.prototype.update=function(){var t=I.args(arguments);t.unshift({_id:this._id});var e=this.constructor.update.apply(this.constructor,t);return null!=this.$session()&&("session"in e.options||(e.options.session=this.$session())),e},tt.prototype.updateOne=function(t,e,r){var n=this,o=this.constructor.updateOne({_id:this._id},t,e);return o.pre((function(t){n.constructor._middleware.execPre("updateOne",n,[n],t)})),o.post((function(t){n.constructor._middleware.execPost("updateOne",n,[n],{},t)})),null!=this.$session()&&("session"in o.options||(o.options.session=this.$session())),null!=r?o.exec(r):o},tt.prototype.replaceOne=function(){var t=I.args(arguments);return t.unshift({_id:this._id}),this.constructor.replaceOne.apply(this.constructor,t)},tt.prototype.$session=function(t){if(0===arguments.length)return null!=this.$__.session&&this.$__.session.hasEnded?(this.$__.session=null,null):this.$__.session;if(null!=t&&t.hasEnded)throw new p("Cannot set a document's session to a session that has ended. Make sure you haven't called `endSession()` on the session you are passing to `$session()`.");if(this.$__.session=t,!this.ownerDocument){var e,r=this.$getAllSubdocs(),n=o(r);try{for(n.s();!(e=n.n()).done;){var i=e.value;i.$session(t)}}catch(t){n.e(t)}finally{n.f()}}return t},tt.prototype.overwrite=function(t){for(var e=0,r=Array.from(new Set(Object.keys(this._doc).concat(Object.keys(t))));e<r.length;e++){var n=r[e];"_id"!==n&&(this.$__schema.options.versionKey&&n===this.$__schema.options.versionKey||this.$__schema.options.discriminatorKey&&n===this.$__schema.options.discriminatorKey||this.$set(n,t[n]))}return this},tt.prototype.$set=function(t,e,r,i){var a=this;I.isPOJO(r)&&(i=r,r=void 0);var u,c,l,f,d=(i=i||{}).merge,v=r&&!0!==r,m=!0===r,b=this.$__schema.options.typeKey,g=0,w="strict"in i?i.strict:this.$__.strictMode;if(v&&((this.$__.adhocPaths||(this.$__.adhocPaths={}))[t]=this.$__schema.interpretAsType(t,r,this.$__schema.options)),null==t){var O=t;t=e,e=O}else{if("string"!=typeof t){if(t instanceof tt&&(t=t.$__isNested?t.toObject():t._doc),null==t){var j=t;t=e,e=j}f=e?e+".":"";var A=(u=Object.keys(t)).length,E=$(i,"_skipMinimizeTopLevel",!1);if(0===A&&E)return delete i._skipMinimizeTopLevel,e&&this.$set(e,{}),this;for(var T=0;T<A;++T){var N=f+(l=u[T]);if(c=this.$__schema.pathType(N),!0!==r||f||null==t[l]||"nested"!==c||null==this._doc[l]||0!==Object.keys(this._doc[l]).length?i=Object.assign({},i,{_skipMinimizeTopLevel:!1}):(delete this._doc[l],i=Object.assign({},i,{_skipMinimizeTopLevel:!0})),!("object"!==s(t[l])||I.isNativeObject(t[l])||I.isMongooseType(t[l])||null==t[l]||"virtual"===c||"real"===c||"adhocOrUndefined"===c||this.$__path(N)instanceof h||this.$__schema.paths[N]&&this.$__schema.paths[N].options&&this.$__schema.paths[N].options.ref))this.$__.$setCalled.add(f+l),this.$set(t[l],f+l,m,i);else if(w){if(m&&void 0===t[l]&&void 0!==this.get(N))continue;if("adhocOrUndefined"===c&&(c=P(this,N,{typeOnly:!0})),"real"===c||"virtual"===c){var k=t[l];this.$__schema.paths[N]&&this.$__schema.paths[N].$isSingleNested&&t[l]instanceof tt&&(k=k.toObject({virtuals:!1,transform:!1})),this.$set(f+l,k,m,i)}else if("nested"===c&&t[l]instanceof tt)this.$set(f+l,t[l].toObject({transform:!1}),m,i);else{if("throw"===w)throw"nested"===c?new y(l,t[l]):new _(l);"nested"===c&&null==t[l]&&this.$set(N,t[l],m,i)}}else void 0!==t[l]&&this.$set(f+l,t[l],m,i)}return this}this.$__.$setCalled.add(t)}var B,R=this.$__schema.pathType(t);if("adhocOrUndefined"===R&&(R=P(this,t,{typeOnly:!0})),e=x(e),"nested"===R&&e){if("object"===s(e)&&null!=
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
function(t,e){if(!t.$__.validationError)return;for(var r=Object.keys(t.$__.validationError.errors),n=0,o=r;n<o.length;n++){var i=o[n];i.startsWith(e+".")&&delete t.$__.validationError.errors[i]}0===Object.keys(t.$__.validationError.errors).length&&(t.$__.validationError=null)}
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/(this,t),B.$isSingleNested&&null!=e&&d){e instanceof tt&&(e=e.toObject({virtuals:!1,transform:!1}));for(var rt=0,nt=Object.keys(e);rt<nt.length;rt++){var ot=nt[rt];this.$set(t+"."+ot,e[ot],m,i)}return this}var it=!0;try{var st,at=function(){if(null==B.options)return!1;if(!(e instanceof tt))return!1;var t=e.constructor,r=B.options.ref;if(null!=r&&(r===t.modelName||r===t.baseModelName))return!0;var n=B.options.refPath;if(null==n)return!1;var o=e.get(n);return o===t.modelName||o===t.baseModelName}(),ut=!1;if(at&&e instanceof tt&&(this.populated(t,e._id,n({},J,e.constructor)),e.$__.wasPopulated=!0,ut=!0),B.options&&Array.isArray(B.options[b])&&B.options[b].length&&B.options[b][0].ref&&
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
function(t,e){if(!Array.isArray(t))return!1;if(0===t.length)return!1;var r,n=o(t);try{for(n.s();!(r=n.n()).done;){var i=r.value;if(!(i instanceof tt))return!1;if(null==i.constructor.modelName)return!1;if(i.constructor.modelName!=e&&i.constructor.baseModelName!=e)return!1}}catch(t){n.e(t)}finally{n.f()}return!0}(e,B.options[b][0].ref)){st=n({},J,e[0].constructor),this.populated(t,e.map((function(t){return t._id})),st);var ct,lt=o(e);try{for(lt.s();!(ct=lt.n()).done;){ct.value.$__.wasPopulated=!0}}catch(t){lt.e(t)}finally{lt.f()}ut=!0}if(null==this.$__schema.singleNestedPaths[t]&&(e=B.applySetters(e,this,!1,et)),B.$isMongooseDocumentArray&&Array.isArray(e)&&e.length>0&&null!=e[0]&&null!=e[0].$__&&null!=e[0].$__.populated){for(var ft=Object.keys(e[0].$__.populated),pt=function(){var r=yt[ht];a.populated(t+"."+r,e.map((function(t){return t.populated(r)})),e[0].$__.populated[r].options)},ht=0,yt=ft;ht<yt.length;ht++)pt();ut=!0}if(!ut&&this.$__.populated){if(Array.isArray(e)&&this.$__.populated[t])for(var dt=0;dt<e.length;++dt)e[dt]instanceof tt&&(e[dt]=e[dt]._id);delete this.$__.populated[t]}B.$isSingleNested&&null!=e&&function(t,e,r){var n=e.schema;if(null==n)return;for(var o=0,i=Object.keys(n.paths);o<i.length;o++){var s=i[o],a=n.paths[s];if(null!=a.$immutableSetter){var u=null==r?void 0:r.$__getValue(s);a.$immutableSetter.call(t,u)}}}(e,B,et),this.$markValid(t)}catch(r){r instanceof p.StrictModeError&&r.isImmutableError?this.invalidate(t,r):r instanceof p.CastError?(this.invalidate(r.path,r),r.$originalErrorPath&&this.invalidate(t,new p.CastError(B.instance,e,t,r.$originalErrorPath))):this.invalidate(t,new p.CastError(B.instance,e,t,r)),it=!1}return it&&(this.$__set(Q,t,m,Y,B,e,et),null!=this.$__.savedState&&(this.isNew||this.$__.savedState.hasOwnProperty(t)?this.$__.savedState.hasOwnProperty(t)&&I.deepEqual(e,this.$__.savedState[t])&&this.unmarkModified(t):this.$__.savedState[t]=et)),B.$isSingleNested&&(this.isDirectModified(t)||null==e)&&S(this,t),this},tt.prototype.set=tt.prototype.$set,tt.prototype.$__shouldModify=function(t,e,r,n,o,i,s){return!!this.isNew||null==this.$__schema.singleNestedPaths[e]&&(void 0===i&&!this.$__isSelected(e)||(void 0!==i||!(e in this.$__.activePaths.states.default))&&(!(this.populated(e)&&i instanceof tt&&L(i._id,s))&&(!L(i,s||I.getValue(e,this))||!(r||null==i||!(e in this.$__.activePaths.states.default)||!L(i,o.getDefault(this,r))))))},tt.prototype.$__set=function(t,e,n,o,i,s,a){c=c||r(30);var l=this.$__shouldModify(t,e,n,o,i,s,a),f=this;l&&(this.markModified(t),u||(u=r(91)),s&&s.isMongooseArray&&(s._registerAtomic("$set",s),s.isMongooseDocumentArray&&s.forEach((function(t){t&&t.__parentArray&&(t.__parentArray=s)})),this.$__.activePaths.forEach((function(t){t.startsWith(e+".")&&f.$__.activePaths.ignore(t)}))));for(var p=this._doc,h=0,y=o.length,d="";h<y;h++){var v=h+1===y;if(d+=d?"."+o[h]:o[h],Z.has(o[h]))return;v?p instanceof Map?p.set(o[h],s):p[o[h]]=s:(I.isPOJO(p[o[h]])||p[o[h]]&&p[o[h]]instanceof c||p[o[h]]&&p[o[h]].$isSingleNested||p[o[h]]&&Array.isArray(p[o[h]])||(p[o[h]]=p[o[h]]||{}),p=p[o[h]])}},tt.prototype.$__getValue=function(t){return I.getValue(t,this._doc)},tt.prototype.$__setValue=function(t,e){return I.setValue(t,e,this._doc),this},tt.prototype.get=function(t,e,r){var n;r=r||{},e&&(n=this.$__schema.interpretAsType(t,e,this.$__schema.options));var o=this.$__path(t);if(null==o&&(o=this.$__schema.virtualpath(t)),o instanceof h){var i=this.$__schema.virtualpath(t);null!=i&&(o=i)}var s=-1===t.indexOf(".")?[t]:t.split("."),a=this._doc;if(o instanceof w)return o.applyGetters(void 0,this);"string"==typeof this.$__schema.aliases[s[0]]&&(s[0]=this.$__schema.aliases[s[0]]);for(var u=0,c=s.length;u<c;u++)a&&a._doc&&(a=a._doc),a=null==a?void 0:a instanceof Map?a.get(s[u],{getters:!1}):u===c-1?I.getValue(s[u],a):a[s[u]];if(n&&(a=n.cast(a)),null!=o&&!1!==r.getters)a=o.applyGetters(a,this);else if(this.$__schema.nested[t]&&r.virtuals)return ct(this,I.clone(a)||{},{path:t});return a},
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
tt.prototype[Q]=tt.prototype.get,tt.prototype.$__path=function(t){var e=this.$__.adhocPaths,r=e&&e.hasOwnProperty(t)?e[t]:null;return r||this.$__schema.path(t)},tt.prototype.markModified=function(t,e){this.$__.activePaths.modify(t),null==e||this.ownerDocument||(this.$__.pathsToScopes[t]=e)},tt.prototype.unmarkModified=function(t){this.$__.activePaths.init(t),delete this.$__.pathsToScopes[t]},tt.prototype.$ignore=function(t){this.$__.activePaths.ignore(t)},tt.prototype.directModifiedPaths=function(){return Object.keys(this.$__.activePaths.states.modify)},tt.prototype.$isEmpty=function(t){var e={minimize:!0,virtuals:!1,getters:!1,transform:!1};if(arguments.length>0){var r=this.get(t);return null==r||"object"===s(r)&&(I.isPOJO(r)?ot(r):0===Object.keys(r.toObject(e)).length)}return 0===Object.keys(this.toObject(e)).length},tt.prototype.modifiedPaths=function(t){t=t||{};var e=Object.keys(this.$__.activePaths.states.modify),r=this;return e.reduce((function(e,n){var i=n.split(".");if(e=e.concat(i.reduce((function(t,e,r){return t.concat(i.slice(0,r).concat(e).join("."))}),[]).filter((function(t){return-1===e.indexOf(t)}))),!t.includeChildren)return e;var a=r.get(n);if(null!=a&&"object"===s(a))if(a._doc&&(a=a._doc),Array.isArray(a)){for(var u=a.length,c=0;c<u;++c)if(-1===e.indexOf(n+"."+c)&&(e.push(n+"."+c),null!=a[c]&&a[c].$__)){var l,f=o(a[c].modifiedPaths());try{for(f.s();!(l=f.n()).done;){var p=l.value;e.push(n+"."+c+"."+p)}}catch(t){f.e(t)}finally{f.f()}}}else Object.keys(a).filter((function(t){return-1===e.indexOf(n+"."+t)})).forEach((function(t){e.push(n+"."+t)}));return e}),[])},tt.prototype[K]=tt.prototype.modifiedPaths,tt.prototype.isModified=function(t,e){if(t){Array.isArray(t)||(t=t.split(" "));var r=e||this[K](),n=Object.keys(this.$__.activePaths.states.modify);return t.some((function(t){return!!~r.indexOf(t)}))||t.some((function(t){return n.some((function(e){return e===t||t.startsWith(e+".")}))}))}return this.$__.activePaths.some("modify")},tt.prototype[Y]=tt.prototype.isModified,tt.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)}))},tt.prototype.$isDeleted=function(t){return 0===arguments.length?!!this.$__.isDeleted:(this.$__.isDeleted=!!t,this)},tt.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)}))},tt.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)}))},tt.prototype.isSelected=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.$__isSelected(t)}));var r=Object.keys(this.$__.selected),n=null;if(1===r.length&&"_id"===r[0])return 0===this.$__.selected._id;for(var o=0,i=r;o<i.length;o++){var s=i[o];if("_id"!==s&&k(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,c=r;u<c.length;u++){var l=c[u];if("_id"!==l){if(l.startsWith(a))return n||l!==a;if(a.startsWith(l+"."))return n}}return!n},tt.prototype.$__isSelected=tt.prototype.isSelected,tt.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.isDirectSele
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
tt.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=o(this.$__dirty());try{for(e.s();!(t=e.n()).done;){var r=t.value.value;r&&r[W]&&r[q]&&(r[W]=r[q])}}catch(t){e.e(t)}finally{e.f()}var n,i=o(this.$getAllSubdocs());try{for(i.s();!(n=i.n()).done;){n.value.$__undoReset()}}catch(t){i.e(t)}finally{i.f()}}},tt.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)}})))).sort((function(t,e){return t.path<e.path?-1:t.path>e.path?1:0}));var r,n,o=[];return e.forEach((function(t){t&&(null==r||0!==t.path.indexOf(r)?(r=t.path+".",o.push(t),n=t):null!=n&&null!=n.value&&null!=n.value[W]&&n.value.hasAtomics()&&(n.value[W]={},n.value[W].$set=n.value))})),n=r=null,o},tt.prototype.$__setSchema=function(t){t.plugin(T,{deduplicate:!0}),j(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[z]=t},tt.prototype.$__getArrayPathsToValidate=function(){return a||(a=r(18)),this.$__.activePaths.map("init","modify",function(t){return this.$__getValue(t)}.bind(this)).filter((function(t){return t&&t instanceof Array&&t.isMongooseDocumentArray&&t.length})).reduce((function(t,e){return t.concat(e)}),[]).filter((function(t){return t}))},tt.prototype.$getAllSubdocs=function(){function t(e,r,n){var o=e,i=!1;if(n&&(e instanceof tt&&e[z].paths[n]?o=e._doc[n]:e instanceof tt&&e[z].nested[n]?(o=e._doc[n],i=!0):o=e[n]),o instanceof c)r.push(o);else if(o instanceof Map)r=Array.from(o.keys()).reduce((function(e,r){return t(o.get(r),e,null)}),r);else if(o&&o.$isSingleNested)(r=Object.keys(o._doc).reduce((function(e,r){return t(o._doc,e,r)}),r)).push(o);else if(o&&o.isMongooseDocumentArray)o.forEach((function(e){e&&e._doc&&(r=Object.keys(e._doc).reduce((function(r,n){return t(e._doc,r,n)}),r),e instanceof c&&r.push(e))}));else if(i&&null!=o)for(var s=0,a=Object.keys(o);s<a.length;s++){var u=a[s];t(o,r,u)}return r}a||(a=r(18)),c=c||r(30);for(var e=[],n=0,o=Object.keys(this._doc);n<o.length;n++){t(this,e,o[n])}return e},tt.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)},tt.prototype.$toObject=function(t,r){var n,o,i={transform:!0,flattenDecimals:!0},s=r?"toJSON":"toObject",a=$(this,"constructor.base.options."+s,{}),u=$(this,"$__schema.options",{});i=I.options(i,U(a)),i=I.options(i,U(u[s]||{})),(t=I.isPOJO(t)?U(t):{})._calledWithOptions=t._calledWithOptions||U(t),n=null!=t._calledWithOptions.minimize?t.minimize:null!=i.minimize?i.minimize:u.minimize,o=null!=t._calledWithOptions.flattenMaps?t.flattenMaps:null!=i.flattenMaps?i.flattenMaps:u.flattenMaps;var c=Object.assign(I.clone(t),{_isNested:!0,json:r,minimize:n,flattenMaps:o});if(I.hasUserDefinedProperty(t,"getters")&&(c.getters=t.getters),I.hasUserDefinedProperty(t,"virtuals")&&(c.virtuals=t.virtuals),(t.depopulate||$(t,"_parentOptions.depopulate",!1))&&t._isNested&&this.$__.wasPopulated)return U(this._id,c);(t=I.options(i,t))._isNested=!0,t.json=r,t.minimize=n,c._parentOptions=t,c._skipSingleNestedGetters=!0;var l=Object.assign({},c);l._skipSingleNestedGetters=!1;var f=t.transform,p=U(this._doc,c)||{};t.getters&&(!function(t,e,r){var n,o,i=t.$__schema,s=Object.keys(i.paths),a=s.length,u=t._doc;if(!u)return e;for(;a--;){var c=(n=s[a]).split("."),l=c.length,f=l-1,p=e,h=void 0;if(u=t._doc,t.$__isSelected(n))for(var y=0;y<l;++y){if(h=c[y],o=u[h],y===f){var d=t.get(n);p[h]=U(d,r)}else{if(null==o){h in u&&(p[h
|
|
|
|
|
/*!
|
|
|
|
|
* Applies schema type transforms to `json`.
|
|
|
|
|
*
|
|
|
|
|
* @param {Document} self
|
|
|
|
|
* @param {Object} json
|
|
|
|
|
* @return {Object} `json`
|
|
|
|
|
*/(this,p,l),t.minimize&&(p=
|
|
|
|
|
/*!
|
|
|
|
|
* Minimizes an object, removing undefined values and empty objects
|
|
|
|
|
*
|
|
|
|
|
* @param {Object} object to minimize
|
|
|
|
|
* @return {Object}
|
|
|
|
|
*/
|
|
|
|
|
function t(r){var n,o,i,s=Object.keys(r),a=s.length;for(;a--;)o=s[a],i=r[o],I.isObject(i)&&!e.isBuffer(i)&&(r[o]=t(i)),void 0!==r[o]?n=!0:delete r[o];return n?r:void 0}(p)||{})),(t.virtuals||t.getters&&!1!==t.virtuals)&&ct(this,p,l,t),!1===t.versionKey&&this.$__schema.options.versionKey&&delete p[this.$__schema.options.versionKey];var h=t.transform;if(h&&function(t,e){var r=t.$__schema,n=Object.keys(r.paths||{});if(!t._doc)return e;for(var o=0,i=n;o<i.length;o++){var s=i[o],a=r.paths[s];if("function"==typeof a.options.transform){var u=t.get(s),c=a.options.transform.call(t,u);lt(s,c),I.setValue(s,c,e)}else if(null!=a.$embeddedSchemaType&&"function"==typeof a.$embeddedSchemaType.options.transform){for(var l=[].concat(t.get(s)),f=a.$embeddedSchemaType.options.transform,p=0;p<l.length;++p){var h=f.call(t,l[p]);l[p]=h,lt(s,h)}e[s]=l}}}(this,p),t.useProjection&&function(t,e){var r=t.$__schema,n=Object.keys(r.paths||{});if(!t._doc)return e;var o=t.$__.selected;void 0===o&&(o={},M.applyPaths(o,r));if(null==o||0===Object.keys(o).length)return e;for(var i=0,s=n;i<s.length;i++){var a=s[i];null==o[a]||o[a]||delete e[a]}}(this,p),!0===h||u.toObject&&h){var y=t.json?u.toJSON:u.toObject;y&&(h="function"==typeof t.transform?t.transform:y.transform)}else t.transform=f;if("function"==typeof h){var d=h(this,p,t);void 0!==d&&(p=d)}return p},tt.prototype.toObject=function(t){return this.$toObject(t)},tt.prototype.toJSON=function(t){return this.$toObject(t,!0)},tt.prototype.parent=function(){return this.$__.parent},tt.prototype.$parent=tt.prototype.parent,tt.prototype.inspect=function(t){var e;I.isPOJO(t)&&((e=t).minimize=!1);var r=this.toObject(e);return null==r?"MongooseDocument { "+r+" }":r},R.custom&&(
|
|
|
|
|
/*!
|
|
|
|
|
* Avoid Node deprecation warning DEP0079
|
|
|
|
|
*/
|
|
|
|
|
tt.prototype[R.custom]=tt.prototype.inspect),tt.prototype.toString=function(){var t=this.inspect();return"string"==typeof t?t:R(t)},tt.prototype.equals=function(t){if(!t)return!1;var e=this.$__getValue("_id"),r=null!=t.$__?t.$__getValue("_id"):t;return e||r?e&&e.equals?e.equals(r):e===r:L(this,t)},tt.prototype.populate=function(){if(0===arguments.length)return this;var t,e=this.$__.populate||(this.$__.populate={}),r=I.args(arguments);if("function"==typeof r[r.length-1]&&(t=r.pop()),r.length){var n,i=I.populate.apply(null,r),s=o(i);try{for(s.s();!(n=s.n()).done;){var a=n.value;e[a.path]=a}}catch(t){s.e(t)}finally{s.f()}}if(t){var u=I.object.vals(e);this.$__.populate=void 0;var c=this.constructor;if(this.$__isNested){c=this.$__[G].constructor;var l=this.$__.nestedPath;u.forEach((function(t){t.path=l+"."+t.path}))}if(null!=this.$session()){var f=this.$session();u.forEach((function(t){null!=t.options?"session"in t.options||(t.options.session=f):t.options={session:f}}))}c.populate(this,u,t)}return this},tt.prototype.$getPopulatedDocs=function(){var t=[];null!=this.$__.populated&&(t=t.concat(Object.keys(this.$__.populated))),null!=this.$$populatedVirtuals&&(t=t.concat(Object.keys(this.$$populatedVirtuals)));var e,r=[],n=o(t);try{for(n.s();!(e=n.n()).done;){var i=e.value,s=this.get(i);Array.isArray(s)?r=r.concat(s):s instanceof tt&&r.push(s)}}catch(t){n.e(t)}finally{n.f()}return r},tt.prototype.execPopulate=function(t){var e=this,r=null!=t&&"function"!=typeof t;return r?this.populate.apply(this,arguments).execPopulate():O(t,(function(t){e.populate(t)}),this.constructor.events)},tt.prototype.populated=function(t,e,r){if(null==e||!0===e){if(!this.$__.populated)return;var n=t.endsWith(".$*")?t.replace(/\.\$\*$/,""):t,o=this.$__.populated[n];return o?!0===e?o:o.value:void 0}this.$__.populated||(this.$__.populated={}),this.$__.populated[t]={value:e,options:r};for(var i=t.split("."),s=0;s<i.length-1;++s){var a=i.slice(0,s+1).join("."),u=this.get(a);if(null!=u&&null!=u.$__&&this.populated(a)){var c=i.slice(s+1).join(".");u.populated(c,e,r);break}}return e},tt.prototype.depopulate=function(t){var e;"string"==typeof t&&(t=t.split(" "));var r=this.$$populatedVirtuals?Object.keys(this.$$populatedVirtuals):[],n=$(this,"$__.populated",{});if(0===arguments.length){var i,s=o(r);try{for(s.s();!(i=s.n()).done;){var a=i.value;delete this.$$populatedVirtuals[a],delete this._doc[a],delete n[a]}}catch(t){s.e(t)}finally{s.f()}for(var u=Object.keys(n),c=0,l=u;c<l.length;c++){var f=l[c];(e=this.populated(f))&&(delete n[f],I.setValue(f,e,this._doc))}return this}var p,h=o(t);try{for(h.s();!(p=h.n()).done;){var y=p.value;e=this.populated(y),delete n[y],-1!==r.indexOf(y)?(delete this.$$populatedVirtuals[y],delete this._doc[y]):e&&I.setValue(y,e,this._doc)}}catch(t){h.e(t)}finally{h.f()}return this},tt.prototype.$__fullPath=function(t){return t||""},tt.prototype.getChanges=function(){var t=this.$__delta();return t?t[1]:{}},
|
|
|
|
|
/*!
|
|
|
|
|
* Module exports.
|
|
|
|
|
*/
|
|
|
|
|
tt.ValidationError=b,t.exports=tt}).call(this,r(2).Buffer)},function(t,e,r){"use strict";
|
|
|
|
|
/*!
|
|
|
|
|
* Module dependencies.
|
|
|
|
|
*/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 o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}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,s(n.key),n)}}function s(t){var e=function(t,e){if("object"!=n(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==n(e)?e:String(e)}function a(t,e){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function u(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 o=l(this).constructor;r=Reflect.construct(n,arguments,o)}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.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var f=r(14),p=r(3),h=r(4),y=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&&a(t,e)}(l,t);var e,r,n,s=u(l);function l(t,e,r,n,i){var a;if(o(this,l),arguments.length>0){var u=d(e),f=v(e),p=m(i),h=_(null,t,u,r,p,f);(a=s.call(this,h)).init(t,e,r,n,i)}else a=s.call(this,_());return c(a)}return e=l,(r=[{key:"toJSON",value:function(){return{stringValue:this.stringValue,valueType:this.valueType,kind:this.kind,value:this.value,path:this.path,reason:this.reason,name:this.name,message:this.message}}
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/},{key:"init",value:function(t,e,r,n,o){this.stringValue=d(e),this.messageFormat=m(o),this.kind=t,this.value=e,this.path=r,this.reason=n,this.valueType=v(e)}
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
* @param {Readonly<CastError>} other
|
|
|
|
|
*/},{key:"copy",value:function(t){this.messageFormat=t.messageFormat,this.stringValue=t.stringValue,this.kind=t.kind,this.value=t.value,this.path=t.path,this.reason=t.reason,this.message=t.message,this.valueType=t.valueType}
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/},{key:"setModel",value:function(t){this.model=t,this.message=_(t,this.kind,this.stringValue,this.path,this.messageFormat,this.valueType)}}])&&i(e.prototype,r),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),l}(f);function d(t){var e=h.inspect(t);return(e=e.replace(/^'|'$/g,'"')).startsWith('"')||(e='"'+e+'"'),e}function v(t){if(null==t)return""+t;var e=n(t);return"object"!==e||"function"!=typeof t.constructor?e:t.constructor.name}function m(t){var e=p(t,"options.cast",null);if("string"==typeof e)return e}
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/function _(t,e,r,n,o,i){if(null!=o){var s=o.replace("{KIND}",e).replace("{VALUE}",r).replace("{PATH}",n);return null!=t&&(s=s.replace("{MODEL}",t.modelName)),s}var a="Cast to "+e+" failed for value "+r+(i?" (type "+i+")":"")+' at path "'+n+'"';return null!=t&&(a+=' for model "'+t.modelName+'"'),a}
|
|
|
|
|
/*!
|
|
|
|
|
* exports
|
|
|
|
|
*/Object.defineProperty(y.prototype,"name",{value:"CastError"}),t.exports=y},function(t,e,r){"use strict";
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/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 o(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,i(n.key),n)}}function i(t){var e=function(t,e){if("object"!=n(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==n(e)?e:String(e)}function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(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 u(t){var e="function"==typeof Map?new Map:void 0;return(u=function(t){if(null===t||!function(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"==typeof t}}(t))return t;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,r)}function r(){return c(t,arguments,p(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),f(r,t)})(t)}function c(t,e,r){return(c=l()?Reflect.construct.bind():function(t,e,r){var n=[null];n.push.apply(n,e);var o=new(Function.bind.apply(t,n));return r&&f(o,r.prototype),o}).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 f(t,e){return(f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function p(t){return(p=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var h=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&&f(t,e)}(h,t);var e,r,n,i,u,c=(e=h,r=l(),function(){var t,n=p(e);if(r){var o=p(this).constructor;t=Reflect.construct(n,arguments,o)}else t=n.apply(this,arguments);return a(this,t)});function h(){return s(this,h),c.apply(this,arguments)}return n=h,i&&o(n.prototype,i),u&&o(n,u),Object.defineProperty(n,"prototype",{writable:!1}),n}(u(Error));Object.defineProperty(h.prototype,"name",{value:"MongooseError"}),t.exports=h},function(t,e,r){"use strict";
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/var n=null;t.exports.get=function(){return n},t.exports.set=function(t){n=t}},function(t,e,r){"use strict";(function(e){function r(t,r){return new e(t,r)}t.exports={normalizedFunctionString:function(t){return t.toString().replace(/function *\(/,"function (")},allocBuffer:"function"==typeof e.alloc?function(){return e.alloc.apply(e,arguments)}:r,toBuffer:"function"==typeof e.from?function(){return e.from.apply(e,arguments)}:r}}).call(this,r(2).Buffer)},function(t,e,r){"use strict";
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/e.internalToObjectOptions={transform:!1,virtuals:!1,getters:!1,_skipDepopulateTopLevel:!0,depopulate:!0,flattenDecimals:!1,useProjection:!1}},function(t,e,r){"use strict";(function(e){
|
|
|
|
|
/*!
|
|
|
|
|
* Module dependencies.
|
|
|
|
|
*/
|
|
|
|
|
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 o(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 s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(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,u(n.key),n)}}function u(t){var e=function(t,e){if("object"!=n(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==n(e)?e:String(e)}function c(){return(c="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,r){var n=l(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(arguments.length<3?t:r):o.value}}).apply(this,arguments)}function l(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=y(t)););return t}function f(t,e){return(f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function p(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=y(t);if(e){var o=y(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return h(this,r)}}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 y(t){return(y=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var d=r(92),v=r(12),m=r(11),_=r(95),b=r(38),g=r(17).internalToObjectOptions,w=r(4),O=r(1),S=r(0).arrayAtomicsSymbol,j=r(0).arrayParentSymbol,A=r(0).arrayPathSymbol,E=r(0).arraySchemaSymbol,$=r(0).documentArrayParent,P=Array.prototype.push,x=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&&f(t,e)}(n,t);var r=p(n);function n(){return s(this,n),r.apply(this,arguments)}return function(t,e,r){e&&a(t.prototype,e),r&&a(t,r),Object.defineProperty(t,"prototype",{writable:!1})}(n,[{key:"isMongooseDocumentArray",get:function(){return!0}
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/},{key:"toBSON",value:function(){return this.toObject(g)}
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/},{key:"map",value:function(){var t=c(y(n.prototype),"map",this).apply(this,arguments);return t[E]=null,t[A]=null,t[j]=null,t}},{key:"_cast",value:function(t,r){if(null==this[E])return t;var n=this[E].casterConstructor;if((n.$isMongooseDocumentArray?t&&t.isMongooseDocumentArray:t instanceof n)||t&&t.constructor&&t.constructor.baseCasterConstructor===n)return t[$]&&t.__parentArray||(t[$]=this[j],t.__parentArray=this),t.$setIndex(r),t;if(null==t)return null;if((e.isBuffer(t)||t instanceof m||!O.isObject(t))&&(t={_id:t}),t&&n.discriminators&&n.schema&&n.schema.options&&n.schema.options.discriminatorKey)if("string"==typeof t[n.schema.options.discriminatorKey]&&n.discriminators[t[n.schema.options.discriminatorKey]])n=n.discriminators[t[n.schema.options.discriminatorKey]];else{var o=b(n.discriminators,t[n.schema.options.discriminatorKey]);o&&(n=o)}return n.$isMongooseDocumentArray?n.cast(t,this,void 0,void 0,r):new n(t,this,void 0,void 0,r)}},{key:"id",value:function(t){var e,r,n;try{e=_(t).toString()}catch(t){e=null}var i,s=o(this);try{for(s.s();!(i=s.n()).done;){var a=i.value;if(a&&null!=(n=a.get("_id")))if(n instanceof v){if(r||(r=String(t)),r==n._id)return a}else if(t instanceof m||n instanceof m){if(e==n)return a}else if(t==n||O.deepEqual(t,n))return a}}catch(t){s.e(t)}finally{s.f()}return null}},{key:"toObject",value:function(t){return[].concat(this.map((function(e){return null==e?null:"function"!=typeof e.toObject?e:e.toObject(t)})))}},{key:"slice",value:function(){var t=c(y(n.prototype),"slice",this).apply(this,arguments);return t[j]=this[j],t[A]=this[A],t}},{key:"push",value:function(){var t=c(y(n.prototype),"push",this).apply(this,arguments);return T(this),t}},{key:"pull",value:function(){var t=c(y(n.prototype),"pull",this).apply(this,arguments);return T(this),t}},{key:"shift",value:function(){var t=c(y(n.prototype),"shift",this).apply(this,arguments);return T(this),t}},{key:"splice",value:function(){var t=c(y(n.prototype),"splice",this).apply(this,arguments);return T(this),t}},{key:"inspect",value:function(){return this.toObject()}},{key:"create",value:function(t){var e=this[E].casterConstructor;if(t&&e.discriminators&&e.schema&&e.schema.options&&e.schema.options.discriminatorKey)if("string"==typeof t[e.schema.options.discriminatorKey]&&e.discriminators[t[e.schema.options.discriminatorKey]])e=e.discriminators[t[e.schema.options.discriminatorKey]];else{var r=b(e.discriminators,t[e.schema.options.discriminatorKey]);r&&(e=r)}return new e(t,this)}
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/},{key:"notify",value:function(t){var e=this;return function r(n,o){for(var i=(o=o||e).length;i--;)if(null!=o[i]){switch(t){case"save":n=e[i]}o[i].isMongooseArray?r(n,o[i]):o[i]&&o[i].emit(t,n)}}}},{key:"_markModified",value:function(t,e){var r,n=this[j];if(n){if(r=this[A],arguments.length)if(null!=e){var o=t.__index;r=r+"."+o+"."+e}else r=r+"."+t;if(null!=r&&r.endsWith(".$"))return this;n.markModified(r,arguments.length>0?t:n)}return this}}]),n}(d);
|
|
|
|
|
/*!
|
|
|
|
|
* If this is a document array, each element may contain single
|
|
|
|
|
* populated paths, so we need to modify the top-level document's
|
|
|
|
|
* populated cache. See gh-8247, gh-8265.
|
|
|
|
|
*/
|
|
|
|
|
function T(t){var e=t[j];if(e&&null!=e.$__.populated){var r,n=o(Object.keys(e.$__.populated).filter((function(e){return e.startsWith(t[A]+".")})));try{var i=function(){var n=r.value,o=n.slice((t[A]+".").length);if(!Array.isArray(e.$__.populated[n].value))return 1;e.$__.populated[n].value=t.map((function(t){return t.populated(o)}))};for(n.s();!(r=n.n()).done;)i()}catch(t){n.e(t)}finally{n.f()}}}w.inspect.custom&&(x.prototype[w.inspect.custom]=x.prototype.inspect),
|
|
|
|
|
/*!
|
|
|
|
|
* Module exports.
|
|
|
|
|
*/
|
|
|
|
|
t.exports=function(t,e,r){var n=new x;if(n[S]={},n[E]=void 0,Array.isArray(t)&&(t[A]===e&&t[j]===r&&(n[S]=Object.assign({},t[S])),t.forEach((function(t){P.call(n,t)}))),n[A]=e,r&&r instanceof v)for(n[j]=r,n[E]=r.schema.path(e);null!=n&&null!=n[E]&&n[E].$isMongooseArray&&!n[E].$isMongooseDocumentArray;)n[E]=n[E].casterConstructor;return n}}).call(this,r(2).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 o,i="object"===("undefined"==typeof Reflect?"undefined":n(Reflect))?Reflect:null,s=i&&"function"==typeof i.apply?i.apply:function(t,e,r){return Function.prototype.apply.call(t,e,r)};o=i&&"function"==typeof i.ownKeys?i.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 o(r){t.removeListener(e,i),n(r)}function i(){"function"==typeof t.removeListener&&t.removeListener("error",o),r([].slice.call(arguments))}_(t,e,i,{once:!0}),"error"!==e&&function(t,e,r){"function"==typeof t.on&&_(t,"error",e,r)}(t,o,{once:!0})}))},u.EventEmitter=u,u.prototype._events=void 0,u.prototype._eventsCount=0,u.prototype._maxListeners=void 0;var c=10;function l(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+n(t))}function f(t){return void 0===t._maxListeners?u.defaultMaxListeners:t._maxListeners}function p(t,e,r,n){var o,i,s,a;if(l(r),void 0===(i=t._events)?(i=t._events=Object.create(null),t._eventsCount=0):(void 0!==i.newListener&&(t.emit("newListener",e,r.listener?r.listener:r),i=t._events),s=i[e]),void 0===s)s=i[e]=r,++t._eventsCount;else if("function"==typeof s?s=i[e]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),(o=f(t))>0&&s.length>o&&!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 h(){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 y(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},o=h.bind(n);return o.listener=r,n.wrapFn=o,o}function d(t,e,r){var n=t._events;if(void 0===n)return[];var o=n[e];return void 0===o?[]:"function"==typeof o?r?[o.listener||o]:[o]: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}(o):m(o,o.length)}function v(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 m(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function _(t,e,r,o){if("function"==typeof t.on)o.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(i){o.once&&t.removeEventListener(e,n),r(i)}))}}Object.defineProperty(u,"defaultMaxListeners",{enumerable:!0,get:function(){return c},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+".");c=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 numbe
|
|
|
|
|
/*!
|
|
|
|
|
* Determines if `arg` is an object.
|
|
|
|
|
*
|
|
|
|
|
* @param {Object|Array|String|Function|RegExp|any} arg
|
|
|
|
|
* @api private
|
|
|
|
|
* @return {Boolean}
|
|
|
|
|
*/
|
|
|
|
|
t.exports=function(t){return!!e.isBuffer(t)||"[object Object]"===Object.prototype.toString.call(t)}}).call(this,r(2).Buffer)},function(t,e,r){"use strict";(function(e){
|
|
|
|
|
/*!
|
|
|
|
|
* Centralize this so we can more easily work around issues with people
|
|
|
|
|
* stubbing out `process.nextTick()` in tests using sinon:
|
|
|
|
|
* https://github.com/sinonjs/lolex#automatically-incrementing-mocked-time
|
|
|
|
|
* See gh-6074
|
|
|
|
|
*/
|
|
|
|
|
var r=e.nextTick.bind(e);t.exports=function(t){return r(t)}}).call(this,r(10))},function(t,e,r){"use strict";(function(e){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 o=r(124)();
|
|
|
|
|
/*!
|
|
|
|
|
* The buffer module from node.js, for the browser.
|
|
|
|
|
*
|
|
|
|
|
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
|
|
|
|
|
* @license MIT
|
|
|
|
|
*/function i(t,e){if(t===e)return 0;for(var r=t.length,n=e.length,o=0,i=Math.min(r,n);o<i;++o)if(t[o]!==e[o]){r=t[o],n=e[o];break}return r<n?-1:n<r?1:0}function s(t){return e.Buffer&&"function"==typeof e.Buffer.isBuffer?e.Buffer.isBuffer(t):!(null==t||!t._isBuffer)}var a=r(4),u=Object.prototype.hasOwnProperty,c=Array.prototype.slice,l="foo"===function(){}.name;function f(t){return Object.prototype.toString.call(t)}function p(t){return!s(t)&&("function"==typeof e.ArrayBuffer&&("function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(t):!!t&&(t instanceof DataView||!!(t.buffer&&t.buffer instanceof ArrayBuffer))))}var h=t.exports=b,y=/\s*function\s+([^\(\s]*)\s*/;function d(t){if(a.isFunction(t)){if(l)return t.name;var e=t.toString().match(y);return e&&e[1]}}function v(t,e){return"string"==typeof t?t.length<e?t:t.slice(0,e):t}function m(t){if(l||!a.isFunction(t))return a.inspect(t);var e=d(t);return"[Function"+(e?": "+e:"")+"]"}function _(t,e,r,n,o){throw new h.AssertionError({message:r,actual:t,expected:e,operator:n,stackStartFunction:o})}function b(t,e){t||_(t,!0,e,"==",h.ok)}function g(t,e,r,o){if(t===e)return!0;if(s(t)&&s(e))return 0===i(t,e);if(a.isDate(t)&&a.isDate(e))return t.getTime()===e.getTime();if(a.isRegExp(t)&&a.isRegExp(e))return t.source===e.source&&t.global===e.global&&t.multiline===e.multiline&&t.lastIndex===e.lastIndex&&t.ignoreCase===e.ignoreCase;if(null!==t&&"object"===n(t)||null!==e&&"object"===n(e)){if(p(t)&&p(e)&&f(t)===f(e)&&!(t instanceof Float32Array||t instanceof Float64Array))return 0===i(new Uint8Array(t.buffer),new Uint8Array(e.buffer));if(s(t)!==s(e))return!1;var u=(o=o||{actual:[],expected:[]}).actual.indexOf(t);return-1!==u&&u===o.expected.indexOf(e)||(o.actual.push(t),o.expected.push(e),function(t,e,r,n){if(null==t||null==e)return!1;if(a.isPrimitive(t)||a.isPrimitive(e))return t===e;if(r&&Object.getPrototypeOf(t)!==Object.getPrototypeOf(e))return!1;var o=w(t),i=w(e);if(o&&!i||!o&&i)return!1;if(o)return t=c.call(t),e=c.call(e),g(t,e,r);var s,u,l=j(t),f=j(e);if(l.length!==f.length)return!1;for(l.sort(),f.sort(),u=l.length-1;u>=0;u--)if(l[u]!==f[u])return!1;for(u=l.length-1;u>=0;u--)if(s=l[u],!g(t[s],e[s],r,n))return!1;return!0}(t,e,r,o))}return r?t===e:t==e}function w(t){return"[object Arguments]"==Object.prototype.toString.call(t)}function O(t,e){if(!t||!e)return!1;if("[object RegExp]"==Object.prototype.toString.call(e))return e.test(t);try{if(t instanceof e)return!0}catch(t){}return!Error.isPrototypeOf(e)&&!0===e.call({},t)}function S(t,e,r,n){var o;if("function"!=typeof e)throw new TypeError('"block" argument must be a function');"string"==typeof r&&(n=r,r=null),o=function(t){var e;try{t()}catch(t){e=t}return e}(e),n=(r&&r.name?" ("+r.name+").":".")+(n?" "+n:"."),t&&!o&&_(o,r,"Missing expected exception"+n);var i="string"==typeof n,s=!t&&o&&!r;if((!t&&a.isError(o)&&i&&O(o,r)||s)&&_(o,r,"Got unwanted exception"+n),t&&o&&r&&!O(o,r)||!t&&o)throw o}h.AssertionError=function(t){this.name="AssertionError",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,t.message?(this.message=t.message,this.generatedMessage=!1):(this.message=function(t){return v(m(t.actual),128)+" "+t.operator+" "+v(m(t.expected),128)}(this),this.generatedMessage=!0);var e=t.stackStartFunction||_;if(Error.captureStackTrace)Error.captureStackTrace(this,e);else{var r=new Error;if(r.stack){var n=r.stack,o=d(e),i=n.indexOf("\n"+o);if(i>=0){var s=n.indexOf("\n",i+1);n=n.substring(s+1)}this.stack=n}}},a.inherits(h.AssertionError,Error),h.fail=_,h.ok=b,h.equal=function(t,e,r){t!=e&&_(t,e,r,"==",h.equal)},h.notEqual=function(t,e,r){t==e&&_(t,e,r,"!=",h.notEqual)},h.deepEqual=function(t,e,r){g(t,e,!1)||_(t,e,r,"deepEqual",h.deepEqual)},h.deepStrictEqual=function(t,e,r){g(t,e,!0)||_(t,e,r,"deepStrictEqual",h.deepStrictEqual)},h.notDeepEqual=function(t,e,r){g(t,e,!1)&&_(t,e,r,"notDeepEqual",h.notDeepEqual)},h.notDeepStrictEqual=function t(e,r,n){g(e,r,!0)&&_(e,r,n,"notDeepStrictEqual",t)},h.strictEqual=function(t,e,r){t!==e&&_(t,e,r,"===",h.strictEqual)},h.notStrictEqual=function(t,e,r){t===e&&_(t,e,r,"!==",h.notS
|
|
|
|
|
/*!
|
|
|
|
|
* If `val` is an object, returns constructor name, if possible. Otherwise returns undefined.
|
|
|
|
|
*/t.exports=function(t){if(null!=t&&"function"==typeof t.constructor)return t.constructor.name}},function(t,e){function r(t,e){if(!(this instanceof r))return new r(t,e);this._bsontype="Long",this.low_=0|t,this.high_=0|e}r.prototype.toInt=function(){return this.low_},r.prototype.toNumber=function(){return this.high_*r.TWO_PWR_32_DBL_+this.getLowBitsUnsigned()},r.prototype.toBigInt=function(){return BigInt(this.toString())},r.prototype.toJSON=function(){return this.toString()},r.prototype.toString=function(t){var e=t||10;if(e<2||36<e)throw Error("radix out of range: "+e);if(this.isZero())return"0";if(this.isNegative()){if(this.equals(r.MIN_VALUE)){var n=r.fromNumber(e),o=this.div(n),i=o.multiply(n).subtract(this);return o.toString(e)+i.toInt().toString(e)}return"-"+this.negate().toString(e)}var s=r.fromNumber(Math.pow(e,6));i=this;for(var a="";!i.isZero();){var u=i.div(s),c=i.subtract(u.multiply(s)).toInt().toString(e);if((i=u).isZero())return c+a;for(;c.length<6;)c="0"+c;a=""+c+a}},r.prototype.getHighBits=function(){return this.high_},r.prototype.getLowBits=function(){return this.low_},r.prototype.getLowBitsUnsigned=function(){return this.low_>=0?this.low_:r.TWO_PWR_32_DBL_+this.low_},r.prototype.getNumBitsAbs=function(){if(this.isNegative())return this.equals(r.MIN_VALUE)?64:this.negate().getNumBitsAbs();for(var t=0!==this.high_?this.high_:this.low_,e=31;e>0&&0==(t&1<<e);e--);return 0!==this.high_?e+33:e+1},r.prototype.isZero=function(){return 0===this.high_&&0===this.low_},r.prototype.isNegative=function(){return this.high_<0},r.prototype.isOdd=function(){return 1==(1&this.low_)},r.prototype.equals=function(t){return this.high_===t.high_&&this.low_===t.low_},r.prototype.notEquals=function(t){return this.high_!==t.high_||this.low_!==t.low_},r.prototype.lessThan=function(t){return this.compare(t)<0},r.prototype.lessThanOrEqual=function(t){return this.compare(t)<=0},r.prototype.greaterThan=function(t){return this.compare(t)>0},r.prototype.greaterThanOrEqual=function(t){return this.compare(t)>=0},r.prototype.compare=function(t){if(this.equals(t))return 0;var e=this.isNegative(),r=t.isNegative();return e&&!r?-1:!e&&r?1:this.subtract(t).isNegative()?-1:1},r.prototype.negate=function(){return this.equals(r.MIN_VALUE)?r.MIN_VALUE:this.not().add(r.ONE)},r.prototype.add=function(t){var e=this.high_>>>16,n=65535&this.high_,o=this.low_>>>16,i=65535&this.low_,s=t.high_>>>16,a=65535&t.high_,u=t.low_>>>16,c=0,l=0,f=0,p=0;return f+=(p+=i+(65535&t.low_))>>>16,p&=65535,l+=(f+=o+u)>>>16,f&=65535,c+=(l+=n+a)>>>16,l&=65535,c+=e+s,c&=65535,r.fromBits(f<<16|p,c<<16|l)},r.prototype.subtract=function(t){return this.add(t.negate())},r.prototype.multiply=function(t){if(this.isZero())return r.ZERO;if(t.isZero())return r.ZERO;if(this.equals(r.MIN_VALUE))return t.isOdd()?r.MIN_VALUE:r.ZERO;if(t.equals(r.MIN_VALUE))return this.isOdd()?r.MIN_VALUE:r.ZERO;if(this.isNegative())return t.isNegative()?this.negate().multiply(t.negate()):this.negate().multiply(t).negate();if(t.isNegative())return this.multiply(t.negate()).negate();if(this.lessThan(r.TWO_PWR_24_)&&t.lessThan(r.TWO_PWR_24_))return r.fromNumber(this.toNumber()*t.toNumber());var e=this.high_>>>16,n=65535&this.high_,o=this.low_>>>16,i=65535&this.low_,s=t.high_>>>16,a=65535&t.high_,u=t.low_>>>16,c=65535&t.low_,l=0,f=0,p=0,h=0;return p+=(h+=i*c)>>>16,h&=65535,f+=(p+=o*c)>>>16,p&=65535,f+=(p+=i*u)>>>16,p&=65535,l+=(f+=n*c)>>>16,f&=65535,l+=(f+=o*u)>>>16,f&=65535,l+=(f+=i*a)>>>16,f&=65535,l+=e*c+n*u+o*a+i*s,l&=65535,r.fromBits(p<<16|h,l<<16|f)},r.prototype.div=function(t){if(t.isZero())throw Error("division by zero");if(this.isZero())return r.ZERO;if(this.equals(r.MIN_VALUE)){if(t.equals(r.ONE)||t.equals(r.NEG_ONE))return r.MIN_VALUE;if(t.equals(r.MIN_VALUE))return r.ONE;var e=this.shiftRight(1).div(t).shiftLeft(1);if(e.equals(r.ZERO))return t.isNegative()?r.ONE:r.NEG_ONE;var n=this.subtract(t.multiply(e));return e.add(n.div(t))}if(t.equals(r.MIN_VALUE))return r.ZERO;if(this.isNegative())return t.isNegative()?this.negate().div(t.negate()):this.negate().div(t).negate();if(t.isNegative())return this.
|
|
|
|
|
/*!
|
|
|
|
|
* Object clone with Mongoose natives support.
|
|
|
|
|
*
|
|
|
|
|
* If options.minimize is true, creates a minimal data object. Empty objects and undefined values will not be cloned. This makes the data payload sent to MongoDB as small as possible.
|
|
|
|
|
*
|
|
|
|
|
* Functions are never cloned.
|
|
|
|
|
*
|
|
|
|
|
* @param {Object} obj the object to clone
|
|
|
|
|
* @param {Object} options
|
|
|
|
|
* @param {Boolean} isArrayChild true if cloning immediately underneath an array. Special case for minimize.
|
|
|
|
|
* @return {Object} the cloned object
|
|
|
|
|
* @api private
|
|
|
|
|
*/
|
|
|
|
|
function d(t,e,r){if(null==t)return t;if(Array.isArray(t))return function(t,e){var r,o=[],i=n(t);try{for(i.s();!(r=i.n()).done;){var s=r.value;o.push(d(s,e,!0))}}catch(t){i.e(t)}finally{i.f()}return o}(t,e);if(c(t))return e&&e._skipSingleNestedGetters&&t.$isSingleNested&&(e=Object.assign({},e,{getters:!1})),y.isPOJO(t)&&null!=t.$__&&null!=t._doc?t._doc:e&&e.json&&"function"==typeof t.toJSON?t.toJSON(e):t.toObject(e);if(t.constructor)switch(l(t.constructor)){case"Object":return v(t,e,r);case"Date":return new t.constructor(+t);case"RegExp":return i(t)}return t instanceof a?new a(t.id):f(t,"Decimal128")?e&&e.flattenDecimals?t.toJSON():s.fromString(t.toString()):!t.constructor&&p(t)?v(t,e,r):t[h.schemaTypeSymbol]?t.clone():e&&e.bson&&"function"==typeof t.toBSON?t:null!=t.valueOf?t.valueOf():v(t,e,r)}
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
function v(t,e,r){for(var n,o=e&&e.minimize,i={},s=0,a=Object.keys(t);s<a.length;s++){var c=a[s];if(!u.has(c)){var l=d(t[c],e);o&&void 0===l||(!1===o&&void 0===l?delete i[c]:(n||(n=!0),i[c]=l))}}return o&&!r?n&&i:i}t.exports=d},function(t,e,r){"use strict";var n=r(70),o=r(22),i=Symbol("mongoose:emitted");t.exports=function(t,e,r,s){return"function"==typeof t?e((function(e){if(null==e)t.apply(this,arguments);else{null!=r&&null!=r.listeners&&r.listeners("error").length>0&&!e[i]&&(e[i]=!0,r.emit("error",e));try{t(e)}catch(e){return o((function(){throw e}))}}})):new(s=s||n.get())((function(t,n){e((function(e,o){return null!=e?(null!=r&&null!=r.listeners&&r.listeners("error").length>0&&!e[i]&&(e[i]=!0,r.emit("error",e)),n(e)):arguments.length>2?t(Array.prototype.slice.call(arguments,1)):void t(o)}))}))}},function(t,e,r){"use strict";
|
|
|
|
|
/*!
|
|
|
|
|
* Module dependencies.
|
|
|
|
|
*/var n=r(6),o=r(36),i=r(21),s=r(1);function a(t,e){if(e&&e.default){var r=e.default;Array.isArray(r)&&0===r.length?e.default=Array:!e.shared&&i(r)&&0===Object.keys(r).length&&(e.default=function(){return{}})}n.call(this,t,e,"Mixed"),this[o.schemaMixedSymbol]=!0}a.schemaName="Mixed",a.defaultOptions={},
|
|
|
|
|
/*!
|
|
|
|
|
* Inherits from SchemaType.
|
|
|
|
|
*/
|
|
|
|
|
a.prototype=Object.create(n.prototype),a.prototype.constructor=a,a.get=n.get,a.set=n.set,a.prototype.cast=function(t){return t instanceof Error?s.errorToPOJO(t):t},a.prototype.castForQuery=function(t,e){return 2===arguments.length?e:t},
|
|
|
|
|
/*!
|
|
|
|
|
* Module exports.
|
|
|
|
|
*/
|
|
|
|
|
t.exports=a},function(t,e,r){"use strict";
|
|
|
|
|
/*!
|
|
|
|
|
* Module dependencies.
|
|
|
|
|
*/var n=r(64)(),o=r(19).EventEmitter,i=r(34),s=r(22),a=r(17).internalToObjectOptions,u=r(3),c=r(28),l=r(4),f=r(0).documentArrayParent,p=r(0).validatorErrorSymbol;function h(t,e,r,o,i){var s={};null!=e&&e.isMongooseDocumentArray?(this.__parentArray=e,this[f]=e.$parent()):(this.__parentArray=void 0,this[f]=void 0),this.$setIndex(i),this.$isDocumentArrayElement=!0,null!=this[f]&&(s.defaults=this[f].$__.$options.defaults),n.call(this,t,o,r,s);var a=this;this.on("isNew",(function(t){a.isNew=t})),a.on("save",(function(){a.constructor.emit("save",a)}))}
|
|
|
|
|
/*!
|
|
|
|
|
* Inherit from Document
|
|
|
|
|
*/for(var y in h.prototype=Object.create(n.prototype),h.prototype.constructor=h,o.prototype)h[y]=o.prototype[y];h.prototype.toBSON=function(){return this.toObject(a)},
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
h.prototype.$setIndex=function(t){if(this.__index=t,null!=u(this,"$__.validationError",null))for(var e=0,r=Object.keys(this.$__.validationError.errors);e<r.length;e++){var n=r[e];this.invalidate(n,this.$__.validationError.errors[n])}},h.prototype.markModified=function(t){if(this.$__.activePaths.modify(t),this.__parentArray){var e=this.__parentArray.$path()+".0."+t;this.isNew&&this.ownerDocument().$__isSelected(e)?this.__parentArray._markModified():this.__parentArray._markModified(this,t)}},
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
h.prototype.populate=function(){throw new Error('Mongoose does not support calling populate() on nested docs. Instead of `doc.arr[0].populate("path")`, use `doc.populate("arr.0.path")`')},h.prototype.save=function(t,e){var r=this;return"function"==typeof t&&(e=t,t={}),(t=t||{}).suppressWarning||console.warn("mongoose: calling `save()` on a subdoc does **not** save the document to MongoDB, it only runs save middleware. Use `subdoc.save({ suppressWarning: true })` to hide this warning if you're sure this behavior is right for your app."),c(e,(function(t){r.$__save(t)}))},h.prototype.$__save=function(t){var e=this;return s((function(){return t(null,e)}))},
|
|
|
|
|
/*!
|
|
|
|
|
* no-op for hooks
|
|
|
|
|
*/
|
|
|
|
|
h.prototype.$__remove=function(t){if(null!=t)return t(null,this)},h.prototype.remove=function(t,e){if("function"!=typeof t||e||(e=t,t=void 0),!this.__parentArray||t&&t.noop)return this.$__remove(e),this;var r;if(!this.willRemove){if(!(r=this._doc._id))throw new Error("For your own good, Mongoose does not know how to remove an EmbeddedDocument that has no _id");this.__parentArray.pull({_id:r}),this.willRemove=!0,
|
|
|
|
|
/*!
|
|
|
|
|
* Registers remove event listeners for triggering
|
|
|
|
|
* on subdocuments.
|
|
|
|
|
*
|
|
|
|
|
* @param {EmbeddedDocument} sub
|
|
|
|
|
* @api private
|
|
|
|
|
*/
|
|
|
|
|
function(t){var e=t.ownerDocument();function r(){e.removeListener("save",r),e.removeListener("remove",r),t.emit("remove",t),t.constructor.emit("remove",t),e=t=null}e.on("save",r),e.on("remove",r)}(this)}return this.$__remove(e),this},h.prototype.update=function(){throw new Error("The #update method is not available on EmbeddedDocuments")},h.prototype.inspect=function(){return this.toObject({transform:!1,virtuals:!1,flattenDecimals:!1})},l.inspect.custom&&(
|
|
|
|
|
/*!
|
|
|
|
|
* Avoid Node deprecation warning DEP0079
|
|
|
|
|
*/
|
|
|
|
|
h.prototype[l.inspect.custom]=h.prototype.inspect),h.prototype.invalidate=function(t,e,r){if(n.prototype.invalidate.call(this,t,e,r),!this[f]||null==this.__index){if(e[p]||e instanceof i)return this.ownerDocument().$__.validationError;throw e}var o=this.__index,s=[this.__parentArray.$path(),o,t].join(".");return this[f].invalidate(s,e,r),this.ownerDocument().$__.validationError},h.prototype.$markValid=function(t){if(this[f]){var e=this.__index;if(void 0!==e){var r=[this.__parentArray.$path(),e,t].join(".");this[f].$markValid(r)}}},
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
h.prototype.$ignore=function(t){if(n.prototype.$ignore.call(this,t),this[f]){var e=this.__index;if(void 0!==e){var r=[this.__parentArray.$path(),e,t].join(".");this[f].$ignore(r)}}},h.prototype.$isValid=function(t){return void 0===this.__index||!this[f]||(!this[f].$__.validationError||!this[f].$__.validationError.errors[this.$__fullPath(t)])},h.prototype.ownerDocument=function(){if(this.$__.ownerDocument)return this.$__.ownerDocument;var t=this[f];if(!t)return this;for(;t[f]||t.$__parent;)t=t[f]||t.$__parent;return this.$__.ownerDocument=t,this.$__.ownerDocument},h.prototype.$__fullPath=function(t){if(!this.$__.fullPath){var e=this;if(!e[f])return t;for(var r=[];e[f]||e.$__parent;)e[f]?r.unshift(e.__parentArray.$path()):r.unshift(e.$basePath),e=e[f]||e.$__parent;this.$__.fullPath=r.join("."),this.$__.ownerDocument||(this.$__.ownerDocument=e)}return t?this.$__.fullPath+"."+t:this.$__.fullPath},h.prototype.parent=function(){return this[f]},h.prototype.$parent=h.prototype.parent,h.prototype.parentArray=function(){return this.__parentArray},
|
|
|
|
|
/*!
|
|
|
|
|
* Module exports.
|
|
|
|
|
*/
|
|
|
|
|
t.exports=h},function(t,e,r){(function(e){if(void 0!==e)var n=r(2).Buffer;var o=r(16);function i(t,e){if(!(this instanceof i))return new i(t,e);if(!(null==t||"string"==typeof t||n.isBuffer(t)||t instanceof Uint8Array||Array.isArray(t)))throw new Error("only String, Buffer, Uint8Array or Array accepted");if(this._bsontype="Binary",t instanceof Number?(this.sub_type=t,this.position=0):(this.sub_type=null==e?s:e,this.position=0),null==t||t instanceof Number)void 0!==n?this.buffer=o.allocBuffer(i.BUFFER_SIZE):"undefined"!=typeof Uint8Array?this.buffer=new Uint8Array(new ArrayBuffer(i.BUFFER_SIZE)):this.buffer=new Array(i.BUFFER_SIZE),this.position=0;else{if("string"==typeof t)if(void 0!==n)this.buffer=o.toBuffer(t);else{if("undefined"==typeof Uint8Array&&"[object Array]"!==Object.prototype.toString.call(t))throw new Error("only String, Buffer, Uint8Array or Array accepted");this.buffer=a(t)}else this.buffer=t;this.position=t.length}}i.prototype.put=function(t){if(null!=t.length&&"number"!=typeof t&&1!==t.length)throw new Error("only accepts single character String, Uint8Array or Array");if("number"!=typeof t&&t<0||t>255)throw new Error("only accepts number in a valid unsigned byte range 0-255");var e=null;if(e="string"==typeof t?t.charCodeAt(0):null!=t.length?t[0]:t,this.buffer.length>this.position)this.buffer[this.position++]=e;else if(void 0!==n&&n.isBuffer(this.buffer)){var r=o.allocBuffer(i.BUFFER_SIZE+this.buffer.length);this.buffer.copy(r,0,0,this.buffer.length),this.buffer=r,this.buffer[this.position++]=e}else{r=null,r="[object Uint8Array]"===Object.prototype.toString.call(this.buffer)?new Uint8Array(new ArrayBuffer(i.BUFFER_SIZE+this.buffer.length)):new Array(i.BUFFER_SIZE+this.buffer.length);for(var s=0;s<this.buffer.length;s++)r[s]=this.buffer[s];this.buffer=r,this.buffer[this.position++]=e}},i.prototype.write=function(t,e){if(e="number"==typeof e?e:this.position,this.buffer.length<e+t.length){var r=null;if(void 0!==n&&n.isBuffer(this.buffer))r=o.allocBuffer(this.buffer.length+t.length),this.buffer.copy(r,0,0,this.buffer.length);else if("[object Uint8Array]"===Object.prototype.toString.call(this.buffer)){r=new Uint8Array(new ArrayBuffer(this.buffer.length+t.length));for(var i=0;i<this.position;i++)r[i]=this.buffer[i]}this.buffer=r}if(void 0!==n&&n.isBuffer(t)&&n.isBuffer(this.buffer))t.copy(this.buffer,e,0,t.length),this.position=e+t.length>this.position?e+t.length:this.position;else if(void 0!==n&&"string"==typeof t&&n.isBuffer(this.buffer))this.buffer.write(t,e,"binary"),this.position=e+t.length>this.position?e+t.length:this.position;else if("[object Uint8Array]"===Object.prototype.toString.call(t)||"[object Array]"===Object.prototype.toString.call(t)&&"string"!=typeof t){for(i=0;i<t.length;i++)this.buffer[e++]=t[i];this.position=e>this.position?e:this.position}else if("string"==typeof t){for(i=0;i<t.length;i++)this.buffer[e++]=t.charCodeAt(i);this.position=e>this.position?e:this.position}},i.prototype.read=function(t,e){if(e=e&&e>0?e:this.position,this.buffer.slice)return this.buffer.slice(t,t+e);for(var r="undefined"!=typeof Uint8Array?new Uint8Array(new ArrayBuffer(e)):new Array(e),n=0;n<e;n++)r[n]=this.buffer[t++];return r},i.prototype.value=function(t){if((t=null!=t&&t)&&void 0!==n&&n.isBuffer(this.buffer)&&this.buffer.length===this.position)return this.buffer;if(void 0!==n&&n.isBuffer(this.buffer))return t?this.buffer.slice(0,this.position):this.buffer.toString("binary",0,this.position);if(t){if(null!=this.buffer.slice)return this.buffer.slice(0,this.position);for(var e="[object Uint8Array]"===Object.prototype.toString.call(this.buffer)?new Uint8Array(new ArrayBuffer(this.position)):new Array(this.position),r=0;r<this.position;r++)e[r]=this.buffer[r];return e}return u(this.buffer,0,this.position)},i.prototype.length=function(){return this.position},i.prototype.toJSON=function(){return null!=this.buffer?this.buffer.toString("base64"):""},i.prototype.toString=function(t){return null!=this.buffer?this.buffer.slice(0,this.position).toString(t):""};var s=0,a=function(t){for(var e="undefined"!=typeof Uint8Array?
|
|
|
|
|
/*!
|
|
|
|
|
* Returns if `v` is a mongoose object that has a `toObject()` method we can use.
|
|
|
|
|
*
|
|
|
|
|
* This is for compatibility with libs like Date.js which do foolish things to Natives.
|
|
|
|
|
*
|
|
|
|
|
* @param {any} v
|
|
|
|
|
* @api private
|
|
|
|
|
*/t.exports=function(t){return null!=t&&(null!=t.$__||t.isMongooseArray||t.isMongooseBuffer||t.$isMongooseMap)}},function(t,e,r){"use strict";var n=["find","findOne","update","updateMany","updateOne","replaceOne","remove","count","distinct","findAndModify","aggregate","findStream","deleteOne","deleteMany"];function o(){}for(var i=0,s=n.length;i<s;++i){var a=n[i];o.prototype[a]=u(a)}function u(t){return function(){throw new Error("collection."+t+" not implemented")}}t.exports=o,o.methods=n},function(t,e,r){"use strict";
|
|
|
|
|
/*!
|
|
|
|
|
* Module requirements
|
|
|
|
|
*/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 o(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,i(n.key),n)}}function i(t){var e=function(t,e){if("object"!=n(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==n(e)?e:String(e)}function s(t,e){return(s=Object.setPrototypeOf?Object.setPrototypeOf.bind():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=c(t);if(e){var o=c(this).constructor;r=Reflect.construct(n,arguments,o)}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 c(t){return(c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var l=r(14),f=r(25),p=r(4),h=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)}(u,t);var e,r,n,i=a(u);function u(t){var e,r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,u),r="model"===f(t)?t.constructor.modelName+" validation failed":"Validation failed",(e=i.call(this,r)).errors={},e._message=r,t&&(t.errors=e.errors),e}return e=u,(r=[{key:"toString",value:function(){return this.name+": "+y(this)}
|
|
|
|
|
/*!
|
|
|
|
|
* inspect helper
|
|
|
|
|
*/},{key:"inspect",value:function(){return Object.assign(new Error(this.message),this)}
|
|
|
|
|
/*!
|
|
|
|
|
* add message
|
|
|
|
|
*/},{key:"addError",value:function(t,e){this.errors[t]=e,this.message=this._message+": "+y(this)}}])&&o(e.prototype,r),n&&o(e,n),Object.defineProperty(e,"prototype",{writable:!1}),u}(l);
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
function y(t){for(var e,r=Object.keys(t.errors||{}),n=r.length,o=[],i=0;i<n;++i)e=r[i],t!==t.errors[e]&&o.push(e+": "+t.errors[e].message);return o.join(", ")}
|
|
|
|
|
/*!
|
|
|
|
|
* Module exports
|
|
|
|
|
*/p.inspect.custom&&(
|
|
|
|
|
/*!
|
|
|
|
|
* Avoid Node deprecation warning DEP0079
|
|
|
|
|
*/
|
|
|
|
|
h.prototype[p.inspect.custom]=h.prototype.inspect)
|
|
|
|
|
/*!
|
|
|
|
|
* Helper for JSON.stringify
|
|
|
|
|
* Ensure `name` and `message` show up in toJSON output re: gh-9847
|
|
|
|
|
*/,Object.defineProperty(h.prototype,"toJSON",{enumerable:!1,writable:!1,configurable:!0,value:function(){return Object.assign({},this,{name:this.name,message:this.message})}}),Object.defineProperty(h.prototype,"name",{value:"ValidationError"}),t.exports=h},function(t,e,r){"use strict";
|
|
|
|
|
/*!
|
|
|
|
|
* Module dependencies.
|
|
|
|
|
*/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 o(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,i(n.key),n)}}function i(t){var e=function(t,e){if("object"!=n(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==n(e)?e:String(e)}function s(t,e){return(s=Object.setPrototypeOf?Object.setPrototypeOf.bind():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=c(t);if(e){var o=c(this).constructor;r=Reflect.construct(n,arguments,o)}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 c(t){return(c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var l=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)}(u,t);var e,r,n,i=a(u);function u(t,e,r){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,u),e=e||"Field `"+t+"` is not in schema and strict mode is set to throw.",(n=i.call(this,e)).isImmutableError=!!r,n.path=t,n}return e=u,r&&o(e.prototype,r),n&&o(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(r(5));Object.defineProperty(l.prototype,"name",{value:"StrictModeError"}),t.exports=l},function(t,e,r){"use strict";e.schemaMixedSymbol=Symbol.for("mongoose:schema_mixed"),e.builtInMiddleware=Symbol.for("mongoose:built-in-middleware")},function(t,e,r){"use strict";
|
|
|
|
|
/*!
|
|
|
|
|
* Module requirements.
|
|
|
|
|
*/var n=r(86);
|
|
|
|
|
/*!
|
|
|
|
|
* @ignore
|
|
|
|
|
*/
|
|
|
|
|
/*!
|
|
|
|
|
* @ignore
|
|
|
|
|
*/
|
|
|
|
|
function o(t){return n.cast()(t)}e.castToNumber=o,e.castArraysOfNumbers=function t(e,r){e.forEach((function(n,i){Array.isArray(n)?t(n,r):e[i]=o.call(r,n)}))}},function(t,e,r){"use strict";var n=r(88);
|
|
|
|
|
/*!
|
|
|
|
|
* returns discriminator by discriminatorMapping.value
|
|
|
|
|
*
|
|
|
|
|
* @param {Model} model
|
|
|
|
|
* @param {string} value
|
|
|
|
|
*/t.exports=function(t,e){if(null==t)return null;for(var r=0,o=Object.keys(t);r<o.length;r++){var i=t[o[r]];if(i.schema&&i.schema.discriminatorMapping&&n(i.schema.discriminatorMapping.value,e))return i}return null}},function(t,e,r){"use strict";
|
|
|
|
|
/*!
|
|
|
|
|
* Module exports.
|
|
|
|
|
*/e.Array=r(91),e.Buffer=r(94),e.Document=e.Embedded=r(30),e.DocumentArray=r(18),e.Decimal128=r(20),e.ObjectId=r(11),e.Map=r(96),e.Subdocument=r(98)},function(t,e,r){"use strict";var n=r(62),o=r(26),i=r(41),s=r(42),a=r(43),u=r(44),c=r(45),l=r(63),f=r(46),p=r(47),h=r(48),y=r(49),d=r(50),v=r(31),m=r(111),_=r(112),b=r(114),g=r(16),w=g.allocBuffer(17825792),O=function(){};O.prototype.serialize=function(t,e){var r="boolean"==typeof(e=e||{}).checkKeys&&e.checkKeys,n="boolean"==typeof e.serializeFunctions&&e.serializeFunctions,o="boolean"!=typeof e.ignoreUndefined||e.ignoreUndefined,i="number"==typeof e.minInternalBufferSize?e.minInternalBufferSize:17825792;w.length<i&&(w=g.allocBuffer(i));var s=_(w,t,r,0,0,n,o,[]),a=g.allocBuffer(s);return w.copy(a,0,0,a.length),a},O.prototype.serializeWithBufferAndIndex=function(t,e,r){var n="boolean"==typeof(r=r||{}).checkKeys&&r.checkKeys,o="boolean"==typeof r.serializeFunctions&&r.serializeFunctions,i="boolean"!=typeof r.ignoreUndefined||r.ignoreUndefined,s="number"==typeof r.index?r.index:0;return _(e,t,n,s||0,0,o,i)-1},O.prototype.deserialize=function(t,e){return m(t,e)},O.prototype.calculateObjectSize=function(t,e){var r="boolean"==typeof(e=e||{}).serializeFunctions&&e.serializeFunctions,n="boolean"!=typeof e.ignoreUndefined||e.ignoreUndefined;return b(t,r,n)},O.prototype.deserializeStream=function(t,e,r,n,o,i){i=null!=i?i:{};for(var s=e,a=0;a<r;a++){var u=t[s]|t[s+1]<<8|t[s+2]<<16|t[s+3]<<24;i.index=s,n[o+a]=this.deserialize(t,i),s+=u}return s},O.BSON_INT32_MAX=2147483647,O.BSON_INT32_MIN=-2147483648,O.BSON_INT64_MAX=Math.pow(2,63)-1,O.BSON_INT64_MIN=-Math.pow(2,63),O.JS_INT_MAX=9007199254740992,O.JS_INT_MIN=-9007199254740992,O.BSON_DATA_NUMBER=1,O.BSON_DATA_STRING=2,O.BSON_DATA_OBJECT=3,O.BSON_DATA_ARRAY=4,O.BSON_DATA_BINARY=5,O.BSON_DATA_OID=7,O.BSON_DATA_BOOLEAN=8,O.BSON_DATA_DATE=9,O.BSON_DATA_NULL=10,O.BSON_DATA_REGEXP=11,O.BSON_DATA_CODE=13,O.BSON_DATA_SYMBOL=14,O.BSON_DATA_CODE_W_SCOPE=15,O.BSON_DATA_INT=16,O.BSON_DATA_TIMESTAMP=17,O.BSON_DATA_LONG=18,O.BSON_DATA_MIN_KEY=255,O.BSON_DATA_MAX_KEY=127,O.BSON_BINARY_SUBTYPE_DEFAULT=0,O.BSON_BINARY_SUBTYPE_FUNCTION=1,O.BSON_BINARY_SUBTYPE_BYTE_ARRAY=2,O.BSON_BINARY_SUBTYPE_UUID=3,O.BSON_BINARY_SUBTYPE_MD5=4,O.BSON_BINARY_SUBTYPE_USER_DEFINED=128,t.exports=O,t.exports.Code=f,t.exports.Map=n,t.exports.Symbol=c,t.exports.BSON=O,t.exports.DBRef=d,t.exports.Binary=v,t.exports.ObjectID=a,t.exports.Long=o,t.exports.Timestamp=s,t.exports.Double=i,t.exports.Int32=l,t.exports.MinKey=h,t.exports.MaxKey=y,t.exports.BSONRegExp=u,t.exports.Decimal128=p},function(t,e){function r(t){if(!(this instanceof r))return new r(t);this._bsontype="Double",this.value=t}r.prototype.valueOf=function(){return this.value},r.prototype.toJSON=function(){return this.value},t.exports=r,t.exports.Double=r},function(t,e){function r(t,e){if(!(this instanceof r))return new r(t,e);this._bsontype="Timestamp",this.low_=0|t,this.high_=0|e}r.prototype.toInt=function(){return this.low_},r.prototype.toNumber=function(){return this.high_*r.TWO_PWR_32_DBL_+this.getLowBitsUnsigned()},r.prototype.toJSON=function(){return this.toString()},r.prototype.toString=function(t){var e=t||10;if(e<2||36<e)throw Error("radix out of range: "+e);if(this.isZero())return"0";if(this.isNegative()){if(this.equals(r.MIN_VALUE)){var n=r.fromNumber(e),o=this.div(n),i=o.multiply(n).subtract(this);return o.toString(e)+i.toInt().toString(e)}return"-"+this.negate().toString(e)}var s=r.fromNumber(Math.pow(e,6));i=this;for(var a="";!i.isZero();){var u=i.div(s),c=i.subtract(u.multiply(s)).toInt().toString(e);if((i=u).isZero())return c+a;for(;c.length<6;)c="0"+c;a=""+c+a}},r.prototype.getHighBits=function(){return this.high_},r.prototype.getLowBits=function(){return this.low_},r.prototype.getLowBitsUnsigned=function(){return this.low_>=0?this.low_:r.TWO_PWR_32_DBL_+this.low_},r.prototype.getNumBitsAbs=function(){if(this.isNegative())return this.equals(r.MIN_VALUE)?64:this.negate().getNumBitsAbs();for(var t=0!==this.high_?this.high_:this.low_,e=31;e>0&&0==(t&1<<e);e--);return 0!==this.high_?e+33:e+1},r.prototyp
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/t.exports=function(t){var e=null!=this?this.path:null;return n(t,e)}},function(t,e,r){"use strict";var n=r(13);
|
|
|
|
|
/*!
|
|
|
|
|
* Given a value, cast it to a boolean, or throw a `CastError` if the value
|
|
|
|
|
* cannot be casted. `null` and `undefined` are considered valid.
|
|
|
|
|
*
|
|
|
|
|
* @param {Any} value
|
|
|
|
|
* @param {String} [path] optional the path to set on the CastError
|
|
|
|
|
* @return {Boolean|null|undefined}
|
|
|
|
|
* @throws {CastError} if `value` is not one of the allowed values
|
|
|
|
|
* @api private
|
|
|
|
|
*/t.exports=function(e,r){if(t.exports.convertToTrue.has(e))return!0;if(t.exports.convertToFalse.has(e))return!1;if(null==e)return e;throw new n("boolean",e,r)},t.exports.convertToTrue=new Set([!0,"true",1,"1","yes"]),t.exports.convertToFalse=new Set([!1,"false",0,"0","no"])},function(t,e,r){"use strict";(function(n){
|
|
|
|
|
/*!
|
|
|
|
|
* Module dependencies.
|
|
|
|
|
*/
|
|
|
|
|
function o(t,e,r){var n;return n=function(t,e){if("object"!=i(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=i(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(e,"string"),(e="symbol"==i(n)?n:String(n))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}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 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,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 i,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,i=t},f:function(){try{s||null==r.return||r.return()}finally{if(u)throw i}}}}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,c=r(19).EventEmitter,l=r(157),f=r(14),p=r(6),h=r(7),y=r(158),d=r(57),v=r(82),m=r(0).arrayParentSymbol,_=r(3),b=r(25),g=r(159),w=r(78),O=r(51),S=r(15).get().ReadPreference,j=r(160),A=r(4),E=r(1),$=r(164),P=/\.\d+(\.|$)/,x=r(165).middlewareFunctions,T=r(84).middlewareFunctions,N=x.concat(T).reduce((function(t,e){return t.add(e)}),new Set),k=0;function B(t,e){if(!(this instanceof B))return new B(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=++k,this.mapPaths=[],this.s={hooks:new l},this.options=this.defaultOptions(e),Array.isArray(t)){var r,n=s(t);try{for(n.s();!(r=n.n()).done;){var o=r.value;this.add(o)}}catch(t){n.e(t)}finally{n.f()}}else t&&this.add(t);var i=t&&t._id&&E.isObject(t._id);!this.paths._id&&!this.options.noId&&this.options._id&&!i&&v(this),this.setupTimestamp(this.options.timestamps)}
|
|
|
|
|
/*!
|
|
|
|
|
* Create virtual properties with alias field
|
|
|
|
|
*/
|
|
|
|
|
/*!
|
|
|
|
|
* Inherit from EventEmitter.
|
|
|
|
|
*/
|
|
|
|
|
B.prototype=Object.create(c.prototype),B.prototype.constructor=B,B.prototype.instanceOfSchema=!0,
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
Object.defineProperty(B.prototype,"$schemaType",{configurable:!1,enumerable:!1,writable:!0}),Object.defineProperty(B.prototype,"childSchemas",{configurable:!1,enumerable:!0,writable:!0}),B.prototype.obj,B.prototype.paths,B.prototype.tree,B.prototype.clone=function(){var t=this,e=new(null==this.base?B:this.base.Schema)({},this._userProvidedOptions);return e.base=this.base,e.obj=this.obj,e.options=E.clone(this.options),e.callQueue=this.callQueue.map((function(t){return t})),e.methods=E.clone(this.methods),e.methodOptions=E.clone(this.methodOptions),e.statics=E.clone(this.statics),e.query=E.clone(this.query),e.plugins=Array.prototype.slice.call(this.plugins),e._indexes=E.clone(this._indexes),e.s.hooks=this.s.hooks.clone(),e.tree=E.clone(this.tree),e.paths=E.clone(this.paths),e.nested=E.clone(this.nested),e.subpaths=E.clone(this.subpaths),e.singleNestedPaths=E.clone(this.singleNestedPaths),e.childSchemas=
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
function(t){for(var e=[],r=0,n=Object.keys(t.paths);r<n.length;r++){var o=n[r],i=t.paths[o];(i.$isMongooseDocumentArray||i.$isSingleNested)&&e.push({schema:i.schema,model:i.caster})}return e}
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/(e),e.virtuals=E.clone(this.virtuals),e.$globalPluginsApplied=this.$globalPluginsApplied,e.$isRootDiscriminator=this.$isRootDiscriminator,e.$implicitlyCreated=this.$implicitlyCreated,e.mapPaths=[].concat(this.mapPaths),null!=this.discriminatorMapping&&(e.discriminatorMapping=Object.assign({},this.discriminatorMapping)),null!=this.discriminators&&(e.discriminators=Object.assign({},this.discriminators)),e.aliases=Object.assign({},this.aliases),e.on("init",(function(e){return t.emit("init",e)})),e},B.prototype.pick=function(t,e){var r=new B({},e||this.options);if(!Array.isArray(t))throw new f('Schema#pick() only accepts an array argument, got "'+i(t)+'"');var n,a=s(t);try{for(a.s();!(n=a.n()).done;){var u=n.value;if(this.nested[u])r.add(o({},u,_(this.tree,u)));else{var c=this.path(u);if(null==c)throw new f("Path `"+u+"` is not in the schema");r.add(o({},u,c))}}}catch(t){a.e(t)}finally{a.f()}return r},B.prototype.defaultOptions=function(t){t&&!1===t.safe&&(t.safe={w:0}),t&&t.safe&&0===t.safe.w&&(t.versionKey=!1),this._userProvidedOptions=null==t?{}:E.clone(t);var e=_(this,"base.options",{});if((t=E.options({strict:!("strict"in e)||e.strict,strictQuery:"strictQuery"in e&&e.strictQuery,bufferCommands:!0,capped:!1,versionKey:"__v",optimisticConcurrency:!1,discriminatorKey:"__t",minimize:!0,autoIndex:null,shardKey:null,read:null,validateBeforeSave:!0,noId:!1,_id:!0,noVirtualId:!1,id:!0,typeKey:"type",typePojoToMixed:!("typePojoToMixed"in e)||e.typePojoToMixed},E.clone(t))).read&&(t.read=S(t.read)),t.optimisticConcurrency&&!t.versionKey)throw new f("Must set `versionKey` if using `optimisticConcurrency`");return t},B.prototype.add=function(t,e){if(t instanceof B||null!=t&&t.instanceOfSchema)return w(this,t),this;if(!1===t._id&&null==e&&(this.options._id=!1),"__proto__."===(e=e||"")||"constructor."===e||"prototype."===e)return this;for(var r=0,n=Object.keys(t);r<n.length;r++){var i=n[r];if(!E.specialProperties.has(i)){var a=e+i;if(null==t[i])throw new TypeError("Invalid value for schema path `"+a+'`, got value "'+t[i]+'"');if("_id"!==i||!1!==t[i])if(t[i]instanceof d||"VirtualType"===_(t[i],"constructor.name",null))this.virtual(t[i]);else{if(Array.isArray(t[i])&&1===t[i].length&&null==t[i][0])throw new TypeError("Invalid value for schema Array path `"+a+'`, got value "'+t[i][0]+'"');if(E.isPOJO(t[i])||t[i]instanceof h)if(Object.keys(t[i]).length<1)e&&(this.nested[e.substr(0,e.length-1)]=!0),this.path(a,t[i]);else if(!t[i][this.options.typeKey]||"type"===this.options.typeKey&&t[i].type.type)this.nested[a]=!0,this.add(t[i],a+".");else if(!this.options.typePojoToMixed&&E.isPOJO(t[i][this.options.typeKey])){e&&(this.nested[e.substr(0,e.length-1)]=!0);var u=new B(t[i][this.options.typeKey],{typePojoToMixed:!1}),c=Object.assign({},t[i],o({},this.options.typeKey,u));this.path(e+i,c)}else e&&(this.nested[e.substr(0,e.length-1)]=!0),this.path(e+i,t[i]);else e&&(this.nested[e.substr(0,e.length-1)]=!0),this.path(e+i,t[i])}}}return function(t,e){var r,n=s(e=e||Object.keys(t.paths));try{for(n.s();!(r=n.n()).done;){var o=r.value,i=_(t.paths[o],"options");if(null!=i){var a=t.paths[o].path,u=i.alias;if(u){if("string"!=typeof u)throw new Error("Invalid value for alias option on "+a+", got "+u);t.aliases[u]=a,t.virtual(u).get(function(t){return function(){return"function"==typeof this.get?this.get(t):this[t]}}(a)).set(function(t){return function(e){return this.$set(t,e)}}(a))}}}}catch(t){n.e(t)}finally{n.f()}}(this,Object.keys(t).map((function(t){return e?e+t:t}))),this},B.reserved=Object.create(null),B.prototype.reserved=B.reserved;var R=B.reserved;
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
function C(t){return/\.\d+/.test(t)?t.replace(/\.\d+\./g,".$.").replace(/\.\d+$/,".$"):t}
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/function D(t,e){if(0===t.mapPaths.length)return null;var r,n=s(t.mapPaths);try{for(n.s();!(r=n.n()).done;){var o=r.value.path;if(new RegExp("^"+o.replace(/\.\$\*/g,"\\.[^.]+")+"$").test(e))return t.paths[o]}}catch(t){n.e(t)}finally{n.f()}return null}
|
|
|
|
|
/*!
|
|
|
|
|
* ignore. Deprecated re: #6405
|
|
|
|
|
*/
|
|
|
|
|
function M(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]),o=!1;if(!n)return"adhocOrUndefined";for(var i=r.length-1,s=1;s<r.length;++s){o=!1;var a=r[s];if(s===i&&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}o="nested"===n.schema.pathType(a),n=n.schema.path(a)}else n instanceof u.Array&&s!==i&&(n=n.caster)}return t.subpaths[e]=n,n?"real":o?"nested":"adhocOrUndefined"}
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/R.prototype=R.emit=R.listeners=R.on=R.removeListener=R.collection=R.errors=R.get=R.init=R.isModified=R.isNew=R.populated=R.remove=R.save=R.toObject=R.validate=1,B.prototype.path=function(t,e){var r=C(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"===i(t.singleNestedPaths[r]))return t.singleNestedPaths[r];return null}(this,t,r);if(null!=n)return n;var o=D(this,t);return null!=o?o:null!=(n=this.hasMixedParent(r))?n:P.test(t)?function(t,e){return M(t,e),t.subpaths[e]}(this,t):void 0}var a=t.split(".")[0];if(R[a])throw new Error("`"+a+"` may not be used as a schema pathname");"object"===i(e)&&E.hasUserDefinedProperty(e,"ref")&&$(e.ref,t);var u,c=t.split(/\./),l=c.pop(),f=this.tree,h="",y=s(c);try{for(y.s();!(u=y.n()).done;){var d=u.value;if(E.specialProperties.has(d))throw new Error("Cannot set special property `"+d+"` on a schema");if(h=h+=(h.length>0?".":"")+d,f[d]||(this.nested[h]=!0,f[d]={}),"object"!==i(f[d])){var v="Cannot set nested path `"+t+"`. Parent path `"+h+"` already set to type "+f[d].name+".";throw new Error(v)}f=f[d]}}catch(t){y.e(t)}finally{y.f()}f[l]=E.clone(e),this.paths[t]=this.interpretAsType(t,e,this.options);var m=this.paths[t];if(m.$isSchemaMap){var _=t+".$*",b={type:{}};if(E.hasUserDefinedProperty(e,"of"))b=E.isPOJO(e.of)&&Object.keys(e.of).length>0&&!E.hasUserDefinedProperty(e.of,this.options.typeKey)?new B(e.of):e.of;E.hasUserDefinedProperty(e,"ref")&&(b={type:b,ref:e.ref}),this.paths[_]=this.interpretAsType(_,b,this.options),this.mapPaths.push(this.paths[_]),m.$__schemaType=this.paths[_]}if(m.$isSingleNested){for(var g=0,w=Object.keys(m.schema.paths);g<w.length;g++){var O=w[g];this.singleNestedPaths[t+"."+O]=m.schema.paths[O]}for(var S=0,j=Object.keys(m.schema.singleNestedPaths);S<j.length;S++){var A=j[S];this.singleNestedPaths[t+"."+A]=m.schema.singleNestedPaths[A]}for(var x=0,T=Object.keys(m.schema.subpaths);x<T.length;x++){var N=T[x];this.singleNestedPaths[t+"."+N]=m.schema.subpaths[N]}for(var k=0,I=Object.keys(m.schema.nested);k<I.length;k++){var F=I[k];this.singleNestedPaths[t+"."+F]="nested"}Object.defineProperty(m.schema,"base",{configurable:!0,enumerable:!1,writable:!1,value:this.base}),m.caster.base=this.base,this.childSchemas.push({schema:m.schema,model:m.caster})}else m.$isMongooseDocumentArray&&(Object.defineProperty(m.schema,"base",{configurable:!0,enumerable:!1,writable:!1,value:this.base}),m.casterConstructor.base=this.base,this.childSchemas.push({schema:m.schema,model:m.casterConstructor}));if(m.$isMongooseArray&&m.caster instanceof p){for(var U=t,L=m,V=[];L.$isMongooseArray;)U+=".$",L.$isMongooseDocumentArray?(L.$embeddedSchemaType._arrayPath=U,L.$embeddedSchemaType._arrayParentPath=t,L=L.$embeddedSchemaType.clone()):(L.caster._arrayPath=U,L.caster._arrayParentPath=t,L=L.caster.clone()),L.path=U,V.push(L);for(var q=0,W=V;q<W.length;q++){var H=W[q];this.subpaths[H.path]=H}}if(m.$isMongooseDocumentArray){for(var Y=0,K=Object.keys(m.schema.paths);Y<K.length;Y++){var z=K[Y],Q=m.schema.paths[z];this.subpaths[t+"."+z]=Q,"object"===i(Q)&&null!=Q&&(Q.$isUnderneathDocArray=!0)}for(var J=0,G=Object.keys(m.schema.subpaths);J<G.length;J++){var X=G[J],Z=m.schema.subpaths[X];this.subpaths[t+"."+X]=Z,"object"===i(Z)&&null!=Z&&(Z.$isUnderneathDocArray=!0)}for(var tt=0,et=Object.keys(m.schema.singleNestedPaths);tt<et.length;tt++){var rt=et[tt],nt=m.schema.singleNestedPaths[rt];this.subpaths[t+"."+rt]=nt,"object"===i(nt)&&null!=nt&&(nt.$isUnderneathDocArray=!0)}}return this},Object.defineProperty(B.prototype,"base",{configurable:!0,enumerable:!1,writable:!0,value:null}),B.prototype.interpretAsType=function(t,e,r){if(e instanceof p){if(e.path===t)return e;var o=e.clone();return o.path=t,o}var s=null!=this.base?this.base.Schema.Types:B.Types;if(!(E.isPOJO(e)||e instanceof h)&&"Object"!==E.getFunctionName(e.constructor)){var a=e;(e={})[r.typeKey]=a}var u,c=!e[r.typeKey]||"type"===r.typeKey&&e.type.type?{}:e[r.typeKey];if(E.isPOJO(c)||"mixed"===c)return new
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
var I=A.deprecate((function(t,e){t.safe=!1===e?{w:0}:e}),"Mongoose: The `safe` option for schemas is deprecated. Use the `writeConcern` option instead: http://bit.ly/mongoose-write-concern");B.prototype.get=function(t){return this.options[t]};var F="2d 2dsphere hashed text".split(" ");
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
function U(t,e){var r,n=e.split("."),o=n.pop(),i=t.tree,a=s(n);try{for(a.s();!(r=a.n()).done;){i=i[r.value]}}catch(t){a.e(t)}finally{a.f()}delete i[o]}
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
function L(t){return t.startsWith("$[")&&t.endsWith("]")}
|
|
|
|
|
/*!
|
|
|
|
|
* Module exports.
|
|
|
|
|
*/Object.defineProperty(B,"indexTypes",{get:function(){return F},set:function(){throw new Error("Cannot overwrite Schema.indexTypes")}}),B.prototype.indexes=function(){return g(this)},B.prototype.virtual=function(t,e){var r=this;if(t instanceof d||"VirtualType"===b(t))return this.virtual(t.path,t.options);if(e=new y(e),E.hasUserDefinedProperty(e,["ref","refPath"])){if(null==e.localField)throw new Error("Reference virtuals require `localField` option");if(null==e.foreignField)throw new Error("Reference virtuals require `foreignField` option");this.pre("init",(function(r){if(O.has(t,r)){var n=O.get(t,r);this.$$populatedVirtuals||(this.$$populatedVirtuals={}),e.justOne||e.count?this.$$populatedVirtuals[t]=Array.isArray(n)?n[0]:n:this.$$populatedVirtuals[t]=Array.isArray(n)?n:null==n?[]:[n],O.unset(t,r)}}));var n=this.virtual(t);return n.options=e,n.set((function(r){this.$$populatedVirtuals||(this.$$populatedVirtuals={}),e.justOne||e.count?(this.$$populatedVirtuals[t]=Array.isArray(r)?r[0]:r,"object"!==i(this.$$populatedVirtuals[t])&&(this.$$populatedVirtuals[t]=e.count?r:null)):(this.$$populatedVirtuals[t]=Array.isArray(r)?r:null==r?[]:[r],this.$$populatedVirtuals[t]=this.$$populatedVirtuals[t].filter((function(t){return t&&"object"===i(t)})))})),"function"==typeof e.get&&n.get(e.get),n}var o=this.virtuals,s=t.split(".");if("real"===this.pathType(t))throw new Error('Virtual path "'+t+'" conflicts with a real path in the schema');o[t]=s.reduce((function(r,n,o){return r[n]||(r[n]=o===s.length-1?new d(e,t):{}),r[n]}),this.tree);for(var a=s[0],u=function(){if(null!=r.paths[a]&&r.paths[a].$isMongooseDocumentArray){var t=s.slice(c+1).join(".");return r.paths[a].schema.virtual(t).get((function(e,r,n){var o=n.__parentArray[m],i=a+"."+n.__index+"."+t;return o.get(i)})),1}a+="."+s[c+1]},c=0;c<s.length-1&&!u();++c);return o[t]},B.prototype.virtualpath=function(t){return this.virtuals.hasOwnProperty(t)?this.virtuals[t]:null},B.prototype.remove=function(t){return"string"==typeof t&&(t=[t]),Array.isArray(t)&&t.forEach((function(t){if(null!=this.path(t)||this.nested[t]){if(this.nested[t]){var e,r=s(Object.keys(this.paths).concat(Object.keys(this.nested)));try{for(r.s();!(e=r.n()).done;){var n=e.value;n.startsWith(t+".")&&(delete this.paths[n],delete this.nested[n],U(this,n))}}catch(t){r.e(t)}finally{r.f()}return delete this.nested[t],void U(this,t)}delete this.paths[t],U(this,t)}}),this),this},B.prototype.loadClass=function(t,e){return t===Object.prototype||t===Function.prototype||t.prototype.hasOwnProperty("$isMongooseModelPrototype")||(this.loadClass(Object.getPrototypeOf(t),e),e||Object.getOwnPropertyNames(t).forEach((function(e){if(!e.match(/^(length|name|prototype|constructor|__proto__)$/)){var r=Object.getOwnPropertyDescriptor(t,e);r.hasOwnProperty("value")&&this.static(e,r.value)}}),this),Object.getOwnPropertyNames(t.prototype).forEach((function(r){if(!r.match(/^(constructor)$/)){var n=Object.getOwnPropertyDescriptor(t.prototype,r);e||"function"==typeof n.value&&this.method(r,n.value),"function"==typeof n.get&&(this.virtuals[r]&&(this.virtuals[r].getters=[]),this.virtual(r).get(n.get)),"function"==typeof n.set&&(this.virtuals[r]&&(this.virtuals[r].setters=[]),this.virtual(r).set(n.set))}}),this)),this},
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
B.prototype._getSchema=function(t){var e=this.path(t),r=[];if(e)return e.$fullPath=t,e;for(var n=t.split("."),o=0;o<n.length;++o)("$"===n[o]||L(n[o]))&&(n[o]="0");return function t(e,n){for(var o,i,s=e.length+1;s--;)if(i=e.slice(0,s).join("."),o=n.path(i)){if(r.push(i),o.caster){if(o.caster instanceof u.Mixed)return o.caster.$fullPath=r.join("."),o.caster;if(s!==e.length&&o.schema){var a=void 0;return"$"===e[s]||L(e[s])?s+1===e.length?o:((a=t(e.slice(s+1),o.schema))&&(a.$isUnderneathDocArray=a.$isUnderneathDocArray||!o.schema.$isSingleNested),a):((a=t(e.slice(s),o.schema))&&(a.$isUnderneathDocArray=a.$isUnderneathDocArray||!o.schema.$isSingleNested),a)}}else if(o.$isSchemaMap){return s+1>=e.length?o:t(e.slice(s+1),o.$__schemaType.schema)}return o.$fullPath=r.join("."),o}}(n,this)},
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
B.prototype._getPathType=function(t){if(this.path(t))return"real";return function t(e,r){for(var n,o,i=e.length+1;i--;){if(o=e.slice(0,i).join("."),n=r.path(o))return n.caster?n.caster instanceof u.Mixed?{schema:n,pathType:"mixed"}:i!==e.length&&n.schema?"$"===e[i]||L(e[i])?i===e.length-1?{schema:n,pathType:"nested"}:t(e.slice(i+1),n.schema):t(e.slice(i),n.schema):{schema:n,pathType:n.$isSingleNested?"nested":"array"}:{schema:n,pathType:"real"};if(i===e.length&&r.nested[o])return{schema:r,pathType:"nested"}}return{schema:n||r,pathType:"undefined"}}(t.split("."),this)},t.exports=e=B,B.Types=u=r(58),
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
e.ObjectId=u.ObjectId}).call(this,r(2).Buffer)},function(t,e,r){"use strict";var n=r(1);function o(t,e){this.path=e,this.getters=[],this.setters=[],this.options=Object.assign({},t)}o.prototype._applyDefaultGetters=function(){if(!(this.getters.length>0||this.setters.length>0)){var t="$"+this.path;this.getters.push((function(){return this[t]})),this.setters.push((function(e){this[t]=e}))}},
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
o.prototype.clone=function(){var t=new o(this.options,this.path);return t.getters=[].concat(this.getters),t.setters=[].concat(this.setters),t},o.prototype.get=function(t){return this.getters.push(t),this},o.prototype.set=function(t){return this.setters.push(t),this},o.prototype.applyGetters=function(t,e){n.hasUserDefinedProperty(this.options,["ref","refPath"])&&e.$$populatedVirtuals&&e.$$populatedVirtuals.hasOwnProperty(this.path)&&(t=e.$$populatedVirtuals[this.path]);for(var r=t,o=this.getters.length-1;o>=0;o--)r=this.getters[o].call(e,r,this,e);return r},o.prototype.applySetters=function(t,e){for(var r=t,n=this.setters.length-1;n>=0;n--)r=this.setters[n].call(e,r,this,e);return r},
|
|
|
|
|
/*!
|
|
|
|
|
* exports
|
|
|
|
|
*/
|
|
|
|
|
t.exports=o},function(t,e,r){"use strict";
|
|
|
|
|
/*!
|
|
|
|
|
* Module exports.
|
|
|
|
|
*/e.String=r(166),e.Number=r(86),e.Boolean=r(170),e.DocumentArray=r(171),e.Embedded=r(178),e.Array=r(59),e.Buffer=r(180),e.Date=r(182),e.ObjectId=r(185),e.Mixed=r(29),e.Decimal128=e.Decimal=r(187),e.Map=r(189),e.Oid=e.ObjectId,e.Object=e.Mixed,e.Bool=e.Boolean,e.ObjectID=e.ObjectId},function(t,e,r){"use strict";
|
|
|
|
|
/*!
|
|
|
|
|
* Module dependencies.
|
|
|
|
|
*/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 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 i,s,a=r(54),u=r(80),c=r(14),l=r(172),f=r(6),p=f.CastError,h=r(29),y=r(173),d=r(174),v=r(3),m=r(89),_=r(4),b=r(1),g=r(37).castToNumber,w=r(90),O=r(38),S=Symbol("mongoose#isNestedArray"),j=Object.freeze({});function A(t,e,n,o){s||(s=r(39).Embedded);var i,a,u="type";if(o&&o.typeKey&&(u=o.typeKey),this.schemaOptions=o,e){var c={};b.isPOJO(e)&&(e[u]?(delete(c=b.clone(e))[u],e=e[u]):e=h),null!=n&&null!=n.ref&&null==c.ref&&(c.ref=n.ref),e===Object&&(e=h);var l="string"==typeof e?e:b.getFunctionName(e),p=r(58),y=p.hasOwnProperty(l)?p[l]:e;if(this.casterConstructor=y,this.casterConstructor instanceof A&&(this.casterConstructor[S]=!0),"function"!=typeof y||y.$isArraySubdocument||y.$isSchemaMap)this.caster=y,this.caster instanceof s||(this.caster.path=t);else{var d=this.caster instanceof s?null:t;this.caster=new y(d,c)}this.$embeddedSchemaType=this.caster}if(this.$isMongooseArray=!0,f.call(this,t,n,"Array"),null!=this.defaultValue&&(i=this.defaultValue,a="function"==typeof i),!("defaultValue"in this)||void 0!==this.defaultValue){var v=function(){var t=[];return a?t=i.call(this):null!=i&&(t=t.concat(i)),t};v.$runBeforeSetters=!a,this.default(v)}}A.schemaName="Array",A.options={castNonArrays:!0},
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
A.defaultOptions={},A.set=f.set,
|
|
|
|
|
/*!
|
|
|
|
|
* Inherits from SchemaType.
|
|
|
|
|
*/
|
|
|
|
|
A.prototype=Object.create(f.prototype),A.prototype.constructor=A,A.prototype.OptionsConstructor=l,
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
A._checkRequired=f.prototype.checkRequired,A.checkRequired=f.checkRequired,A.prototype.checkRequired=function(t,e){return f._isRef(this,t,e,!0)?!!t:("function"==typeof this.constructor.checkRequired?this.constructor.checkRequired():A.checkRequired())(t)},A.prototype.enum=function(){for(var t=this;;){var e=v(t,"caster.instance");if("Array"!==e){if("String"!==e&&"Number"!==e)throw new Error("`enum` can only be set on an array of strings or numbers , not "+e);break}t=t.caster}var r=arguments;return!Array.isArray(arguments)&&b.isObject(arguments)&&(r=b.object.vals(r)),t.caster.enum.apply(t.caster,r),this},A.prototype.applyGetters=function(t,e){if(null!=e&&null!=e.$__&&e.populated(this.path))return t;var r=f.prototype.applyGetters.call(this,t,e);if(Array.isArray(r))for(var n=r.length,o=0;o<n;++o)r[o]=this.caster.applyGetters(r[o],e);return r},A.prototype._applySetters=function(t,e,r,n){if(this.casterConstructor.$isMongooseArray&&A.options.castNonArrays&&!this[S]){for(var o=0,i=this;null!=i&&i.$isMongooseArray&&!i.$isMongooseDocumentArray;)++o,i=i.casterConstructor;if(null!=t&&t.length>0){var s=y(t);if(s.min===s.max&&s.max<o&&s.containsNonArrayItem)for(var a=s.max;a<o;++a)t=[t]}}return f.prototype._applySetters.call(this,t,e,r,n)},A.prototype.cast=function(t,e,n,o,s){var a,u;if(i||(i=r(39).Array),Array.isArray(t)){var l=t.length;if(!l&&e){var f=e.schema.indexedPaths(),y=this.path;for(a=0,u=f.length;a<u;++a){var d=f[a][0][y];if("2dsphere"===d||"2d"===d)return}var v=this.path.endsWith(".coordinates")?this.path.substr(0,this.path.lastIndexOf(".")):null;if(null!=v)for(a=0,u=f.length;a<u;++a){if("2dsphere"===f[a][0][v])return}}if(t=i(t,(s=s||j).path||this._arrayPath||this.path,e,this),n&&null!=e&&null!=e.$__&&e.populated(this.path))return t;var m=this.caster,b=m.$isMongooseArray,g="Number"===m.instance;if(m&&this.casterConstructor!==h)try{for(a=0;a<l;a++){if(g&&void 0===t[a])throw new c("Mongoose number arrays disallow storing undefined");var w={};b&&(null!=s.arrayPath||null!=m._arrayParentPath)&&(w.arrayPathIndex=a),t[a]=m.applySetters(t[a],e,n,void 0,w)}}catch(e){throw new p("["+e.kind+"]",_.inspect(t),this.path+"."+a,e,this)}return t}if(n||A.options.castNonArrays)return e&&n&&e.markModified(this.path),this.cast([t],e,n);throw new p("Array",_.inspect(t),this.path,null,this)},
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
A.prototype._castForPopulate=function(t,e){if(i||(i=r(39).Array),Array.isArray(t)){var n,o=t.length,s=this.caster;if(s&&this.casterConstructor!==h)try{for(n=0;n<o;n++){var a={};s.$isMongooseArray&&null!=s._arrayParentPath&&(a.arrayPathIndex=n),t[n]=s.cast(t[n],e,!1,void 0,a)}}catch(e){throw new p("["+e.kind+"]",_.inspect(t),this.path+"."+n,e,this)}return t}throw new p("Array",_.inspect(t),this.path,null,this)},
|
|
|
|
|
/*!
|
|
|
|
|
* Ignore
|
|
|
|
|
*/
|
|
|
|
|
A.prototype.discriminator=function(t,e){for(var r=this;r.$isMongooseArray&&!r.$isMongooseDocumentArray;)if(null==(r=r.casterConstructor)||"function"==typeof r)throw new c("You can only add an embedded discriminator on a document array, "+this.path+" is a plain array");return r.discriminator(t,e)},
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
A.prototype.clone=function(){var t=Object.assign({},this.options),e=new this.constructor(this.path,this.caster,t,this.schemaOptions);return e.validators=this.validators.slice(),void 0!==this.requiredValidator&&(e.requiredValidator=this.requiredValidator),e},A.prototype.castForQuery=function(t,e){var r,n,o=this;if(2===arguments.length){if(!(r=this.$conditionalHandlers[t]))throw new Error("Can't use "+t+" with Array.");n=r.call(this,e)}else{n=t;var i=this.casterConstructor;if(n&&i.discriminators&&i.schema&&i.schema.options&&i.schema.options.discriminatorKey)if("string"==typeof n[i.schema.options.discriminatorKey]&&i.discriminators[n[i.schema.options.discriminatorKey]])i=i.discriminators[n[i.schema.options.discriminatorKey]];else{var s=O(i.discriminators,n[i.schema.options.discriminatorKey]);s&&(i=s)}var a=this.casterConstructor.prototype,u=a&&(a.castForQuery||a.cast);!u&&i.castForQuery&&(u=i.castForQuery);var c=this.caster;Array.isArray(n)?(this.setters.reverse().forEach((function(t){n=t.call(o,n,o)})),n=n.map((function(t){return b.isObject(t)&&t.$elemMatch?t:u?t=u.call(c,t):null!=t?t=new i(t):t}))):u?n=u.call(c,n):null!=n&&(n=new i(n))}return n};var E=A.prototype.$conditionalHandlers={};function $(t){return function(e){if(!Array.isArray(e))throw new TypeError("conditional "+t+" requires an array");var r,o=[],i=n(e);try{for(i.s();!(r=i.n()).done;){var s=r.value;o.push(d(this.casterConstructor.schema,s))}}catch(t){i.e(t)}finally{i.f()}return o}}E.$all=function(t){return Array.isArray(t)||(t=[t]),t=t.map((function(t){if(b.isObject(t)){var e={};return e[this.path]=t,d(this.casterConstructor.schema,e)[this.path]}return t}),this),this.castForQuery(t)},E.$options=String,E.$elemMatch=function(t){for(var e=Object.keys(t),r=e.length,n=0;n<r;++n){var o=e[n],i=t[o];m(o)&&null!=i&&(t[o]=this.castForQuery(o,i))}var s=v(this,"casterConstructor.schema.options.discriminatorKey"),a=v(this,"casterConstructor.schema.discriminators",{});return null!=s&&null!=t[s]&&null!=a[t[s]]?d(a[t[s]],t):d(this.casterConstructor.schema,t)},E.$geoIntersects=w.cast$geoIntersects,E.$or=$("$or"),E.$and=$("$and"),E.$nor=$("$nor"),E.$near=E.$nearSphere=w.cast$near,E.$within=E.$geoWithin=w.cast$within,E.$size=E.$minDistance=E.$maxDistance=g,E.$exists=a,E.$type=u,E.$eq=E.$gt=E.$gte=E.$lt=E.$lte=E.$ne=E.$regex=A.prototype.castForQuery,E.$nin=f.prototype.$conditionalHandlers.$nin,E.$in=f.prototype.$conditionalHandlers.$in,
|
|
|
|
|
/*!
|
|
|
|
|
* Module exports.
|
|
|
|
|
*/
|
|
|
|
|
t.exports=A},function(t,e,r){"use strict";var n,o=r(0).documentSchemaSymbol,i=r(3),s=r(17).internalToObjectOptions,a=r(1),u=r(0).getSymbol,c=r(0).scopeSymbol;
|
|
|
|
|
/*!
|
|
|
|
|
* Compiles schemas.
|
|
|
|
|
*/
|
|
|
|
|
function l(t,e,o,i){n=n||r(12);for(var s,u,c=Object.keys(t),l=c.length,p=0;p<l;++p){s=t[u=c[p]],f(u,a.isPOJO(s)&&Object.keys(s).length&&(!s[i.typeKey]||"type"===i.typeKey&&s.type.type)?s:null,e,o,c,i)}}
|
|
|
|
|
/*!
|
|
|
|
|
* Defines the accessor named prop on the incoming prototype.
|
|
|
|
|
*/function f(t,e,f,p,h,y){n=n||r(12);var d=(p?p+".":"")+t;p=p||"",e?Object.defineProperty(f,t,{enumerable:!0,configurable:!0,get:function(){var t,r,s=this;if(this.$__.getters||(this.$__.getters={}),!this.$__.getters[d]){var u=Object.create(n.prototype,(t=this,r={},Object.getOwnPropertyNames(t).forEach((function(e){-1===["isNew","$__","errors","_doc","$locals","$op","__parentArray","__index","$isDocumentArrayElement"].indexOf(e)||(r[e]=Object.getOwnPropertyDescriptor(t,e),r[e].enumerable=!1)})),r));p||(u.$__[c]=this),u.$__.nestedPath=d,Object.defineProperty(u,"schema",{enumerable:!1,configurable:!0,writable:!1,value:f.schema}),Object.defineProperty(u,"$__schema",{enumerable:!1,configurable:!0,writable:!1,value:f.schema}),Object.defineProperty(u,o,{enumerable:!1,configurable:!0,writable:!1,value:f.schema}),Object.defineProperty(u,"toObject",{enumerable:!1,configurable:!0,writable:!1,value:function(){return a.clone(s.get(d,null,{virtuals:i(this,"schema.options.toObject.virtuals",null)}))}}),Object.defineProperty(u,"$__get",{enumerable:!1,configurable:!0,writable:!1,value:function(){return s.get(d,null,{virtuals:i(this,"schema.options.toObject.virtuals",null)})}}),Object.defineProperty(u,"toJSON",{enumerable:!1,configurable:!0,writable:!1,value:function(){return s.get(d,null,{virtuals:i(s,"schema.options.toJSON.virtuals",null)})}}),Object.defineProperty(u,"$__isNested",{enumerable:!1,configurable:!0,writable:!1,value:!0});var h=Object.freeze({minimize:!0,virtuals:!1,getters:!1,transform:!1});Object.defineProperty(u,"$isEmpty",{enumerable:!1,configurable:!0,writable:!1,value:function(){return 0===Object.keys(this.get(d,null,h)||{}).length}}),Object.defineProperty(u,"$__parent",{enumerable:!1,configurable:!0,writable:!1,value:this}),l(e,u,d,y),this.$__.getters[d]=u}return this.$__.getters[d]},set:function(t){null!=t&&t.$__isNested?t=t.$__get():t instanceof n&&!t.$__isNested&&(t=t.toObject(s)),(this.$__[c]||this).$set(d,t)}}):Object.defineProperty(f,t,{enumerable:!0,configurable:!0,get:function(){return this[u].call(this.$__[c]||this,d)},set:function(t){this.$set.call(this.$__[c]||this,d,t)}})}
|
|
|
|
|
/*!
|
|
|
|
|
* exports
|
|
|
|
|
*/
|
|
|
|
|
e.compile=l,e.defineKey=f},function(t,e,r){"use strict";
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/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)}t.exports=function(t){return null==t||("object"!==n(t)||!("$meta"in t)&&!("$slice"in t))}},function(t,e,r){"use strict";(function(e){if(void 0!==e.Map)t.exports=e.Map,t.exports.Map=e.Map;else{var r=function(t){this._keys=[],this._values={};for(var e=0;e<t.length;e++)if(null!=t[e]){var r=t[e],n=r[0],o=r[1];this._keys.push(n),this._values[n]={v:o,i:this._keys.length-1}}};r.prototype.clear=function(){this._keys=[],this._values={}},r.prototype.delete=function(t){var e=this._values[t];return null!=e&&(delete this._values[t],this._keys.splice(e.i,1),!0)},r.prototype.entries=function(){var t=this,e=0;return{next:function(){var r=t._keys[e++];return{value:void 0!==r?[r,t._values[r].v]:void 0,done:void 0===r}}}},r.prototype.forEach=function(t,e){e=e||this;for(var r=0;r<this._keys.length;r++){var n=this._keys[r];t.call(e,this._values[n].v,n,e)}},r.prototype.get=function(t){return this._values[t]?this._values[t].v:void 0},r.prototype.has=function(t){return null!=this._values[t]},r.prototype.keys=function(){var t=this,e=0;return{next:function(){var r=t._keys[e++];return{value:void 0!==r?r:void 0,done:void 0===r}}}},r.prototype.set=function(t,e){return this._values[t]?(this._values[t].v=e,this):(this._keys.push(t),this._values[t]={v:e,i:this._keys.length-1},this)},r.prototype.values=function(){var t=this,e=0;return{next:function(){var r=t._keys[e++];return{value:void 0!==r?t._values[r].v:void 0,done:void 0===r}}}},Object.defineProperty(r.prototype,"size",{enumerable:!0,get:function(){return this._keys.length}}),t.exports=r,t.exports.Map=r}}).call(this,r(9))},function(t,e){var r=function t(e){if(!(this instanceof t))return new t(e);this._bsontype="Int32",this.value=e};r.prototype.valueOf=function(){return this.value},r.prototype.toJSON=function(){return this.value},t.exports=r,t.exports.Int32=r},function(t,e,r){"use strict";
|
|
|
|
|
/*!
|
|
|
|
|
* Module dependencies.
|
|
|
|
|
*/var n=r(12),o=r(198),i=!1;t.exports=function(){return i?o:n},
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
t.exports.setBrowser=function(t){i=t}},function(t,e){t.exports=function(t,e,r){var n=[],o=t.length;if(0===o)return n;var i=e<0?Math.max(0,e+o):e||0;for(void 0!==r&&(o=r<0?r+o:r);o-- >i;)n[o-i]=t[o];return n}},function(t,e,r){
|
|
|
|
|
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
|
|
|
var n=r(2),o=n.Buffer;function i(t,e){for(var r in t)e[r]=t[r]}function s(t,e,r){return o(t,e,r)}o.from&&o.alloc&&o.allocUnsafe&&o.allocUnsafeSlow?t.exports=n:(i(n,e),e.Buffer=s),s.prototype=Object.create(o.prototype),i(o,s),s.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return o(t,e,r)},s.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var n=o(t);return void 0!==e?"string"==typeof r?n.fill(e,r):n.fill(e):n.fill(0),n},s.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return o(t)},s.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n.SlowBuffer(t)}},function(t,e){function r(t){return(r="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 n=Object.prototype.toString;t.exports=function(t){if("object"!=r(e=t)||"[object RegExp]"!=n.call(e))throw new TypeError("Not a RegExp");var e,o=[];t.global&&o.push("g"),t.multiline&&o.push("m"),t.ignoreCase&&o.push("i"),t.dotAll&&o.push("s"),t.unicode&&o.push("u"),t.sticky&&o.push("y");var i=new RegExp(t.source,o.join(""));return"number"==typeof t.lastIndex&&(i.lastIndex=t.lastIndex),i}},function(t,e,r){"use strict";t.exports=function(t){return t.name?t.name:(t.toString().trim().match(/^function\s*([^\s(]+)/)||[])[1]}},function(t,e,r){"use strict";var n=r(3);
|
|
|
|
|
/*!
|
|
|
|
|
* Get the bson type, if it exists
|
|
|
|
|
*/t.exports=function(t,e){return n(t,"_bsontype",void 0)===e}},function(t,e,r){"use strict";(function(e){
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
var n=r(23),o=r(136),i={_promise:null,get:function(){return i._promise},set:function(t){n.ok("function"==typeof t,"mongoose.Promise must be a function, got ".concat(t)),i._promise=t,o.Promise=t}};
|
|
|
|
|
/*!
|
|
|
|
|
* Use native promises by default
|
|
|
|
|
*/
|
|
|
|
|
i.set(e.Promise),t.exports=i}).call(this,r(9))},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 o=Object.prototype.toString;t.exports=function(t){var e=o.call(t),r="[object Arguments]"===e;return r||(r="[object Array]"!==e&&null!==t&&"object"===n(t)&&"number"==typeof t.length&&t.length>=0&&"[object Function]"===o.call(t.callee)),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)}t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"===n(Symbol.iterator))return!0;var t={},e=Symbol("test"),r=Object(e);if("string"==typeof e)return!1;if("[object Symbol]"!==Object.prototype.toString.call(e))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(e in t[e]=42,t)return!1;if("function"==typeof Object.keys&&0!==Object.keys(t).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(t).length)return!1;var o=Object.getOwnPropertySymbols(t);if(1!==o.length||o[0]!==e)return!1;if(!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var i=Object.getOwnPropertyDescriptor(t,e);if(42!==i.value||!0!==i.enumerable)return!1}return!0}},function(t,e,r){"use strict";var n=r(24)("%Object.defineProperty%",!0),o=function(){if(n)try{return n({},"a",{value:1}),!0}catch(t){return!1}return!1};o.hasArrayLengthDefineBug=function(){if(!o())return null;try{return 1!==n([],"length",{value:1}).length}catch(t){return!0}},t.exports=o},function(t,e,r){"use strict";var n=r(24)("%Object.getOwnPropertyDescriptor%",!0);if(n)try{n([],"length")}catch(t){n=null}t.exports=n},function(t,e,r){"use strict";(function(t,n){
|
|
|
|
|
/*!
|
|
|
|
|
* Module dependencies.
|
|
|
|
|
*/
|
|
|
|
|
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 i=r(138).Buffer,s=r(67),a=["__proto__","constructor","prototype"],u=e.clone=function t(r,n){if(null==r)return r;if(Array.isArray(r))return e.cloneArray(r,n);if(r.constructor){if(/ObjectI[dD]$/.test(r.constructor.name))return"function"==typeof r.clone?r.clone():new r.constructor(r.id);if("ReadPreference"===r.constructor.name)return new r.constructor(r.mode,t(r.tags,n));if("Binary"==r._bsontype&&r.buffer&&r.value)return"function"==typeof r.clone?r.clone():new r.constructor(r.value(!0),r.sub_type);if("Date"===r.constructor.name||"Function"===r.constructor.name)return new r.constructor(+r);if("RegExp"===r.constructor.name)return s(r);if("Buffer"===r.constructor.name)return e.cloneBuffer(r)}return l(r)?e.cloneObject(r,n):r.valueOf?r.valueOf():void 0};
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
e.cloneObject=function(t,e){for(var r,n,o=e&&e.minimize,i={},s=0,c=Object.keys(t);s<c.length;s++){var l=c[s];-1===a.indexOf(l)&&(n=u(t[l],e),o&&void 0===n||(r||(r=!0),i[l]=n))}return o?r&&i:i},e.cloneArray=function(t,e){for(var r=[],n=0,o=t.length;n<o;n++)r.push(u(t[n],e));return r},e.tick=function(t){if("function"==typeof t)return function(){var e=arguments;f((function(){t.apply(this,e)}))}},e.merge=function t(r,n){for(var o,i=Object.keys(n),s=i.length;s--;)o=i[s],-1===a.indexOf(o)&&(void 0===r[o]?r[o]=n[o]:e.isObject(n[o])?t(r[o],n[o]):r[o]=n[o])},e.mergeClone=function t(r,n){for(var o,i=Object.keys(n),s=i.length;s--;)o=i[s],-1===a.indexOf(o)&&(void 0===r[o]?r[o]=u(n[o]):e.isObject(n[o])?t(r[o],n[o]):r[o]=u(n[o]))},e.readPref=function(t){switch(t){case"p":t="primary";break;case"pp":t="primaryPreferred";break;case"s":t="secondary";break;case"sp":t="secondaryPreferred";break;case"n":t="nearest"}return t},e.readConcern=function(t){if("string"==typeof t){switch(t){case"l":t="local";break;case"a":t="available";break;case"m":t="majority";break;case"lz":t="linearizable";break;case"s":t="snapshot"}t={level:t}}return t};var c=Object.prototype.toString;e.toString=function(t){return c.call(t)};var l=e.isObject=function(t){return"[object Object]"==e.toString(t)};e.isArray=function(t){return Array.isArray(t)||"object"==o(t)&&"[object Array]"==e.toString(t)},e.keys=Object.keys,e.create="function"==typeof Object.create?Object.create:function(t){if(arguments.length>1)throw new Error("Adding properties is not supported");function e(){}return e.prototype=t,new e},e.inherits=function(t,r){t.prototype=e.create(r.prototype),t.prototype.constructor=t};var f=e.soon="function"==typeof t?t:n.nextTick;e.cloneBuffer=function(t){var e=i.alloc(t.length);return t.copy(e,0,0,t.length),e},e.isArgumentsObject=function(t){return"[object Arguments]"===Object.prototype.toString.call(t)}}).call(this,r(76).setImmediate,r(10))},function(t,e,r){(function(t){var n=void 0!==t&&t||"undefined"!=typeof self&&self||window,o=Function.prototype.apply;function i(t,e){this._id=t,this._clearFn=e}e.setTimeout=function(){return new i(o.call(setTimeout,n,arguments),clearTimeout)},e.setInterval=function(){return new i(o.call(setInterval,n,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},i.prototype.unref=i.prototype.ref=function(){},i.prototype.close=function(){this._clearFn.call(n,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout((function(){t._onTimeout&&t._onTimeout()}),e))},r(137),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,r(9))},function(t,e,r){"use strict";(function(t,r,n,o){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)}e.isNode=void 0!==t&&"object"==i(r)&&"object"==(void 0===n?"undefined":i(n))&&"function"==typeof o&&t.argv,e.isMongo=!e.isNode&&"function"==typeof printjson&&"function"==typeof ObjectId&&"function"==typeof rs&&"function"==typeof sh,e.isBrowser=!e.isNode&&!e.isMongo&&"undefined"!=typeof window,e.type=e.isNode?"node":e.isMongo?"mongo":e.isBrowser?"browser":"unknown"}).call(this,r(10),r(143)(t),r(9),r(2).Buffer)},function(t,e,r){"use strict";t.exports=function(t,e,r){for(var n={},o=0,i=Object.keys(e.tree);o<i.length;o++){var s=i[o];r&&(t.paths[s]||t.nested[s]||t.singleNestedPaths[s])||(n[s]=e.tree[s])}for(var a in t.add(n),t.callQueue=t.callQueue.concat(e.callQueue),t.method(e.methods),t.static(e.statics),e.query)t.query[a]=e.query[a];for(var u in e.virtuals)t.virtuals[u]=e.virtuals[u].clone();t._indexes=t._indexes.co
|
|
|
|
|
/*!
|
|
|
|
|
* Module dependencies.
|
|
|
|
|
*/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 o(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,i(n.key),n)}}function i(t){var e=function(t,e){if("object"!=n(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==n(e)?e:String(e)}function s(t,e){return(s=Object.setPrototypeOf?Object.setPrototypeOf.bind():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=c(t);if(e){var o=c(this).constructor;r=Reflect.construct(n,arguments,o)}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 c(t){return(c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var l=r(5),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)}(u,t);var e,r,n,i=a(u);function u(t){var e;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,u);var r=t.message;r||(r=l.messages.general.default);var n=p(r,t);return e=i.call(this,n),t=Object.assign({},t,{message:n}),e.properties=t,e.kind=t.type,e.path=t.path,e.value=t.value,e.reason=t.reason,e}
|
|
|
|
|
/*!
|
|
|
|
|
* toString helper
|
|
|
|
|
* TODO remove? This defaults to `${this.name}: ${this.message}`
|
|
|
|
|
*/return e=u,(r=[{key:"toString",value:function(){return this.message}
|
|
|
|
|
/*!
|
|
|
|
|
* Ensure `name` and `message` show up in toJSON output re: gh-9296
|
|
|
|
|
*/},{key:"toJSON",value:function(){return Object.assign({name:this.name,message:this.message},this)}}])&&o(e.prototype,r),n&&o(e,n),Object.defineProperty(e,"prototype",{writable:!1}),u}(l);
|
|
|
|
|
/*!
|
|
|
|
|
* Formats error messages
|
|
|
|
|
*/
|
|
|
|
|
function p(t,e){if("function"==typeof t)return t(e);for(var r=0,n=Object.keys(e);r<n.length;r++){var o=n[r];"message"!==o&&(t=t.replace("{"+o.toUpperCase()+"}",e[o]))}return t}
|
|
|
|
|
/*!
|
|
|
|
|
* exports
|
|
|
|
|
*/Object.defineProperty(f.prototype,"name",{value:"ValidatorError"}),
|
|
|
|
|
/*!
|
|
|
|
|
* The object used to define this validator. Not enumerable to hide
|
|
|
|
|
* it from `require('util').inspect()` output re: gh-3925
|
|
|
|
|
*/
|
|
|
|
|
Object.defineProperty(f.prototype,"properties",{enumerable:!1,writable:!0,value:null}),f.prototype.formatMessage=p,t.exports=f},function(t,e,r){"use strict";
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/t.exports=function(t){if(Array.isArray(t)){if(!t.every((function(t){return"number"==typeof t||"string"==typeof t})))throw new Error("$type array values must be strings or numbers");return t}if("number"!=typeof t&&"string"!=typeof t)throw new Error("$type parameter must be number, string, or array of numbers and strings");return t}},function(t,e,r){"use strict";
|
|
|
|
|
/*!
|
|
|
|
|
* Module dependencies.
|
|
|
|
|
*/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 o(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,i(n.key),n)}}function i(t){var e=function(t,e){if("object"!=n(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==n(e)?e:String(e)}function s(t,e){return(s=Object.setPrototypeOf?Object.setPrototypeOf.bind():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=c(t);if(e){var o=c(this).constructor;r=Reflect.construct(n,arguments,o)}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 c(t){return(c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var l=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)}(u,t);var e,r,n,i=a(u);function u(t,e){var r;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,u);var n=Array.isArray(e)?"array":"primitive value";return(r=i.call(this,"Tried to set nested object field `"+t+"` to ".concat(n," `")+e+"` and strict mode is set to throw.")).path=t,r}return e=u,r&&o(e.prototype,r),n&&o(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(r(5));Object.defineProperty(l.prototype,"name",{value:"ObjectExpectedError"}),t.exports=l},function(t,e,r){"use strict";t.exports=function(t){var e={_id:{auto:!0}};e._id[t.options.typeKey]="ObjectId",t.add(e)}},function(t,e,r){"use strict";t.exports=
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
function(t,e){if(null==t)return null;if("boolean"==typeof t)return e;if("boolean"==typeof t[e])return t[e]?e:null;if(!(e in t))return e;return t[e]}},function(t,e,r){"use strict";var n=r(36),o=r(28);
|
|
|
|
|
/*!
|
|
|
|
|
* Register hooks for this model
|
|
|
|
|
*
|
|
|
|
|
* @param {Model} model
|
|
|
|
|
* @param {Schema} schema
|
|
|
|
|
*/
|
|
|
|
|
function i(t,e,r){var s={useErrorHandlers:!0,numCallbackParams:1,nullResultByDefault:!0,contextParameter:!0},a=(r=r||{}).decorateDoc?t:t.prototype;t.$appliedHooks=!0;for(var u=0,c=Object.keys(e.paths);u<c.length;u++){var l=c[u],f=e.paths[l],p=null;if(f.$isSingleNested)p=f.caster;else{if(!f.$isMongooseDocumentArray)continue;p=f.Constructor}if(!p.$appliedHooks&&(i(p,f.schema,r),null!=p.discriminators))for(var h=0,y=Object.keys(p.discriminators);h<y.length;h++){var d=y[h];i(p.discriminators[d],p.discriminators[d].schema,r)}}var v=e.s.hooks.filter((function(t){return"updateOne"===t.name||"deleteOne"===t.name?!!t.document:"remove"===t.name||"init"===t.name?null==t.document||!!t.document:null==t.query&&null==t.document||!1!==t.document})).filter((function(t){return!e.methods[t.name]||!t.fn[n.builtInMiddleware]}));t._middleware=v,a.$__originalValidate=a.$__originalValidate||a.$__validate;for(var m=0,_=["save","validate","remove","deleteOne"];m<_.length;m++){var b=_[m],g="validate"===b?"$__originalValidate":"$__".concat(b),w=v.createWrapper(b,a[g],null,s);a["$__".concat(b)]=w}a.$__init=v.createWrapperSync("init",a.$__init,null,s);for(var O=Object.keys(e.methods),S=Object.assign({},s,{checkForPromise:!0}),j=function(){var e=E[A];if(!v.hasHooks(e))return 1;var r=a[e];a[e]=function(){var r=this,n=Array.prototype.slice.call(arguments),i=n.slice(-1).pop(),s="function"==typeof i?n.slice(0,n.length-1):n;return o(i,(function(t){return r["$__".concat(e)].apply(r,s.concat([t]))}),t.events)},a["$__".concat(e)]=v.createWrapper(e,r,null,S)},A=0,E=O;A<E.length;A++)j()}
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
t.exports=i,
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
i.middlewareFunctions=["deleteOne","save","validate","remove","updateOne","init"]},function(t,e,r){"use strict";var n=r(13);
|
|
|
|
|
/*!
|
|
|
|
|
* Given a value, cast it to a string, or throw a `CastError` if the value
|
|
|
|
|
* cannot be casted. `null` and `undefined` are considered valid.
|
|
|
|
|
*
|
|
|
|
|
* @param {Any} value
|
|
|
|
|
* @param {String} [path] optional the path to set on the CastError
|
|
|
|
|
* @return {string|null|undefined}
|
|
|
|
|
* @throws {CastError}
|
|
|
|
|
* @api private
|
|
|
|
|
*/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";
|
|
|
|
|
/*!
|
|
|
|
|
* Module requirements.
|
|
|
|
|
*/var n=r(5),o=r(168),i=r(6),s=r(169),a=r(87),u=r(1),c=i.CastError;function l(t,e){i.call(this,t,e,"Number")}
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
function f(t){return this.cast(t)}l.get=i.get,l.set=i.set,
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
l._cast=s,l.cast=function(t){return 0===arguments.length||(!1===t&&(t=this._defaultCaster),this._cast=t),this._cast},
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
l._defaultCaster=function(t){if("number"!=typeof t)throw new Error;return t},l.schemaName="Number",l.defaultOptions={},
|
|
|
|
|
/*!
|
|
|
|
|
* Inherits from SchemaType.
|
|
|
|
|
*/
|
|
|
|
|
l.prototype=Object.create(i.prototype),l.prototype.constructor=l,l.prototype.OptionsConstructor=o,
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
l._checkRequired=function(t){return"number"==typeof t||t instanceof Number},l.checkRequired=i.checkRequired,l.prototype.checkRequired=function(t,e){return i._isRef(this,t,e,!0)?!!t:("function"==typeof this.constructor.checkRequired?this.constructor.checkRequired():l.checkRequired())(t)},l.prototype.min=function(t,e){if(this.minValidator&&(this.validators=this.validators.filter((function(t){return t.validator!==this.minValidator}),this)),null!=t){var r=e||n.messages.Number.min;r=r.replace(/{MIN}/,t),this.validators.push({validator:this.minValidator=function(e){return null==e||e>=t},message:r,type:"min",min:t})}return this},l.prototype.max=function(t,e){if(this.maxValidator&&(this.validators=this.validators.filter((function(t){return t.validator!==this.maxValidator}),this)),null!=t){var r=e||n.messages.Number.max;r=r.replace(/{MAX}/,t),this.validators.push({validator:this.maxValidator=function(e){return null==e||e<=t},message:r,type:"max",max:t})}return this},l.prototype.enum=function(t,e){return this.enumValidator&&(this.validators=this.validators.filter((function(t){return t.validator!==this.enumValidator}),this)),Array.isArray(t)||(t=u.isObject(t)?u.object.vals(t):Array.prototype.slice.call(arguments),e=n.messages.Number.enum),e=null==e?n.messages.Number.enum:e,this.enumValidator=function(e){return null==e||-1!==t.indexOf(e)},this.validators.push({validator:this.enumValidator,message:e,type:"enum",enumValues:t}),this},l.prototype.cast=function(t,e,r){if(i._isRef(this,t,e,r))return"number"==typeof t?t:this._castRef(t,e,r);var n,o=t&&void 0!==t._id?t._id:t;n="function"==typeof this._castFunction?this._castFunction:"function"==typeof this.constructor.cast?this.constructor.cast():l.cast();try{return n(o)}catch(t){throw new c("Number",o,this.path,t,this)}},l.prototype.$conditionalHandlers=u.options(i.prototype.$conditionalHandlers,{$bitsAllClear:a,$bitsAnyClear:a,$bitsAllSet:a,$bitsAnySet:a,$gt:f,$gte:f,$lt:f,$lte:f,$mod:function(t){var e=this;return Array.isArray(t)?t.map((function(t){return e.cast(t)})):[this.cast(t)]}}),l.prototype.castForQuery=function(t,e){var r;if(2===arguments.length){if(!(r=this.$conditionalHandlers[t]))throw new c("number",e,this.path,null,this);return r.call(this,e)}return e=this._castForQuery(t)},
|
|
|
|
|
/*!
|
|
|
|
|
* Module exports.
|
|
|
|
|
*/
|
|
|
|
|
t.exports=l},function(t,e,r){"use strict";(function(e){
|
|
|
|
|
/*!
|
|
|
|
|
* Module requirements.
|
|
|
|
|
*/
|
|
|
|
|
var n=r(13);
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
function o(t,e){var r=Number(e);if(isNaN(r))throw new n("number",e,t);return r}t.exports=function(t){var r=this;return Array.isArray(t)?t.map((function(t){return o(r.path,t)})):e.isBuffer(t)?t:o(r.path,t)}}).call(this,r(2).Buffer)},function(t,e,r){"use strict";var n=r(11);t.exports=function(t,e){return"string"==typeof t&&"string"==typeof e||"number"==typeof t&&"number"==typeof e?t===e:t instanceof n&&e instanceof n&&t.toString()===e.toString()}},function(t,e,r){"use strict";var n=new Set(["$ref","$id","$db"]);t.exports=function(t){return t.startsWith("$")&&!n.has(t)}},function(t,e,r){"use strict";
|
|
|
|
|
/*!
|
|
|
|
|
* Module requirements.
|
|
|
|
|
*/var n=r(37).castArraysOfNumbers,o=r(37).castToNumber;function i(t,e){switch(t.$geometry.type){case"Polygon":case"LineString":case"Point":n(t.$geometry.coordinates,e)}return s(e,t),t}function s(t,e){e.$maxDistance&&(e.$maxDistance=o.call(t,e.$maxDistance)),e.$minDistance&&(e.$minDistance=o.call(t,e.$minDistance))}
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
e.cast$geoIntersects=function(t){if(!t.$geometry)return;return i(t,this),t},e.cast$near=function(t){var e=r(59);if(Array.isArray(t))return n(t,this),t;if(s(this,t),t&&t.$geometry)return i(t,this);if(!Array.isArray(t))throw new TypeError("$near must be either an array or an object with a $geometry property");return e.prototype.castForQuery.call(this,t)},e.cast$within=function(t){var e=this;if(s(this,t),t.$box||t.$polygon){var r=t.$box?"$box":"$polygon";t[r].forEach((function(t){if(!Array.isArray(t))throw new TypeError("Invalid $within $box argument. Expected an array, received "+t);t.forEach((function(r,n){t[n]=o.call(e,r)}))}))}else if(t.$center||t.$centerSphere){var n=t.$center?"$center":"$centerSphere";t[n].forEach((function(r,i){Array.isArray(r)?r.forEach((function(t,n){r[n]=o.call(e,t)})):t[n][i]=o.call(e,r)}))}else t.$geometry&&i(t,this);return t}},function(t,e,r){"use strict";
|
|
|
|
|
/*!
|
|
|
|
|
* Module dependencies.
|
|
|
|
|
*/var n=r(92),o=r(0).arrayAtomicsSymbol,i=r(0).arrayParentSymbol,s=r(0).arrayPathSymbol,a=r(0).arraySchemaSymbol,u=Array.prototype.push;
|
|
|
|
|
/*!
|
|
|
|
|
* Module exports.
|
|
|
|
|
*/
|
|
|
|
|
t.exports=function(t,e,r,c){var l;if(Array.isArray(t)){var f=t.length;if(0===f)l=new n;else if(1===f)(l=new n(1))[0]=t[0];else if(f<1e4)l=new n,u.apply(l,t);else{l=new n;for(var p=0;p<f;++p)u.call(l,t[p])}null!=t[o]&&(l[o]=t[o])}else l=new n;return l[s]=e,null!=r&&null!=r.$__&&(l[i]=r,l[a]=c||r.schema.path(e)),l}},function(t,e,r){"use strict";(function(e){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 o(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 s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(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,u(n.key),n)}}function u(t){var e=function(t,e){if("object"!=n(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==n(e)?e:String(e)}function c(){return(c="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,r){var n=l(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(arguments.length<3?t:r):o.value}}).apply(this,arguments)}function l(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=v(t)););return t}function f(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 p(t){var e="function"==typeof Map?new Map:void 0;return(p=function(t){if(null===t||!function(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"==typeof t}}(t))return t;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,r)}function r(){return h(t,arguments,v(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),d(r,t)})(t)}function h(t,e,r){return(h=y()?Reflect.construct.bind():function(t,e,r){var n=[null];n.push.apply(n,e);var o=new(Function.bind.apply(t,n));return r&&d(o,r.prototype),o}).apply(null,arguments)}function y(){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?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function v(t){return(v=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/},{key:"$atomics",value:function(){return this[E]||{}}
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/},{key:"$parent",value:function(){return this[$]}
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/},{key:"$path",value:function(){return this[P]}},{key:"$shift",value:function(){if(this._registerAtomic("$pop",-1),this._markModified(),!this._shifted)return this._shifted=!0,[].shift.call(this)}},{key:"$pop",value:function(){if(this._registerAtomic("$pop",1),this._markModified(),!this._popped)return this._popped=!0,[].pop.call(this)}
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/},{key:"$schema",value:function(){return this[x]}},{key:"_cast",value:function(t){var r,n=!1;return this[$]&&(n=this[$].populated(this[P],!0)),n&&null!=t?(r=n.options[T],(e.isBuffer(t)||t instanceof g||!j.isObject(t))&&(t={_id:t}),t.$__schema&&t.$__schema.discriminatorMapping&&void 0!==t.$__schema.discriminatorMapping.key||(t=new r(t)),this[x].caster.applySetters(t,this[$],!0)):this[x].caster.applySetters(t,this[$],!1)}},{key:"_mapCast",value:function(t,e){return this._cast(t,this.length+e)}},{key:"_markModified",value:function(t){var e,r=this[$];if(r){if(e=this[P],arguments.length&&(e=e+"."+t),null!=e&&e.endsWith(".$"))return this;r.markModified(e,arguments.length>0?t:r)}return this}},{key:"_registerAtomic",value:function(t,e){if(!this[N]){if("$set"===t)return this[E]={$set:e},w(this[$],this[P]),this._markModified(),this;this[E]||(this[E]={});var r,n=this[E];if("$pop"===t&&!("$pop"in n)){var o=this;this[$].once("save",(function(){o._popped=o._shifted=null}))}if(this[E].$set||Object.keys(n).length&&!(t in n))return this[E]={$set:this},this;if("$pullAll"===t||"$addToSet"===t)n[t]||(n[t]=[]),n[t]=n[t].concat(e);else if("$pullDocs"===t){var i=n.$pull||(n.$pull={});e[0]instanceof _?(r=i.$or||(i.$or=[]),Array.prototype.push.apply(r,e.map((function(t){return t.toObject({transform:!1,virtuals:!1})})))):(r=i._id||(i._id={$in:[]})).$in=r.$in.concat(e)}else"$push"===t?(n.$push=n.$push||{$each:[]},null!=e&&j.hasUserDefinedProperty(e,"$each")?n.$push=e:n.$push.$each=n.$push.$each.concat(e)):n[t]=e;return this}}},{key:"addToSet",value:function(){C(this,arguments);var t=[].map.call(arguments,this._mapCast,this);t=this[x].applySetters(t,this[$]);var e=[],r="";return t[0]instanceof _?r="doc":t[0]instanceof Date&&(r="date"),t.forEach((function(t){var n,o=+t;switch(r){case"doc":n=this.some((function(e){return e.equals(t)}));break;case"date":n=this.some((function(t){return+t===o}));break;default:n=~this.indexOf(t)}n||([].push.call(this,t),this._registerAtomic("$addToSet",t),this._markModified(),[].push.call(e,t))}),this),e}},{key:"hasAtomics",value:function(){return j.isPOJO(this[E])?Object.keys(this[E]).length:0}},{key:"includes",value:function(t,e){return-1!==this.indexOf(t,e)}},{key:"indexOf",value:function(t,e){t instanceof g&&(t=t.toString()),e=null==e?0:e;for(var r=this.length,n=e;n<r;++n)if(t==this[n])return n;return-1}},{key:"inspect",value:function(){return JSON.stringify(this)}},{key:"nonAtomicPush",value:function(){var t=[].map.call(arguments,this._mapCast,this),e=[].push.apply(this,t);return this._registerAtomic("$set",this),this._markModified(),e}},{key:"pop",value:function(){var t=[].pop.call(this);return this._registerAtomic("$set",this),this._markModified(),t}},{key:"pull",value:function(){for(var t,e=[].map.call(arguments,this._cast,this),r=this[$].get(this[P]),n=r.length;n--;)if((t=r[n])instanceof m){var o=e.some((function(e){return t.equals(e)}));o&&[].splice.call(r,n,1)}else~r.indexOf.call(e,t)&&[].splice.call(r,n,1);return e[0]instanceof _?this._registerAtomic("$pullDocs",e.map((function(t){return t.$__getValue("_id")||t}))):this._registerAtomic("$pullAll",e),this._markModified(),w(this[$],this[P])>0&&this._registerAtomic("$set",this),this}},{key:"push",value:function(){var t=arguments,e=t,r=null!=t[0]&&j.hasUserDefinedProperty(t[0],"$each");if(r&&(e=t[0],t=t[0].$each),null==this[x])return k.apply(this,t);C(this,t);var n,o=this[$];t=[].map.call(t,this._mapCast,this),t=this[x].applySetters(t,o,void 0,void 0,{skipDocumentArrayCast:!0});var i=this[E];if(r){if(e.$each=t,O(i,"$push.$each.length",0)>0&&i.$push.$position!=i.$position)throw new b("Cannot call `Array#push()` multiple times with different `$position`");null!=e.$position?([].splice.apply(this,[e.$position,0].concat(t)),n=this.length):n=[].push.apply(this,t)}else{if(O(i,"$push.$each.length",0)>0&&null!=i.$push.$position)throw new b("Cannot call `Array#push()` multiple times with different `$position`");e=t,n=[].push.apply(this,t)}return this._registerAtomic("$push",e),this._markModified(),n}},{key:"remove",value:function(){return this.pull.apply(this,argum
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/},{key:"slice",value:function(){var t=c(v(p.prototype),"slice",this).apply(this,arguments);return t[$]=this[$],t[x]=this[x],t[E]=this[E],t[P]=this[P],t[N]=!0,t}
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/},{key:"filter",value:function(){var t=c(v(p.prototype),"filter",this).apply(this,arguments);return t[$]=this[$],t[x]=this[x],t[E]=this[E],t[P]=this[P],t}
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/},{key:"toBSON",value:function(){return this.toObject(S)}},{key:"toObject",value:function(t){return t&&t.depopulate?((t=j.clone(t))._isNested=!0,[].concat(this).map((function(e){return e instanceof m?e.toObject(t):e}))):[].concat(this)}},{key:"unshift",value:function(){var t;return C(this,arguments),null==this[x]?t=arguments:(t=[].map.call(arguments,this._cast,this),t=this[x].applySetters(t,this[$])),[].unshift.apply(this,t),this._registerAtomic("$set",this),this._markModified(),this.length}}])&&a(o.prototype,i),u&&a(o,u),Object.defineProperty(o,"prototype",{writable:!1}),p}(p(Array));
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
function C(t,e){var r,n,i,s=null==t?null:O(t[x],"caster.options.ref",null);0===t.length&&e.length>0&&
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
function(t,e){if(!e)return!1;var r,n=o(t);try{for(n.s();!(r=n.n()).done;){var i=r.value;if(null==i)return!1;var s=i.constructor;if(!(i instanceof m)||s.modelName!==e&&s.baseModelName!==e)return!1}}catch(t){n.e(t)}finally{n.f()}return!0}(e,s)&&t[$].populated(t[P],[],(r={},n=T,i=e[0].constructor,(n=u(n))in r?Object.defineProperty(r,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[n]=i,r))}A.inspect.custom&&(R.prototype[A.inspect.custom]=R.prototype.inspect),t.exports=R}).call(this,r(2).Buffer)},function(t,e,r){"use strict";
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/t.exports=function(t,e,r){var n=(r=r||{}).skipDocArrays,o=0;if(!t)return o;for(var i=0,s=Object.keys(t.$__.activePaths.states.modify);i<s.length;i++){var a=s[i];if(n){var u=t.$__schema.path(a);if(u&&u.$isMongooseDocumentArray)continue}a.startsWith(e+".")&&(delete t.$__.activePaths.states.modify[a],++o)}return o}},function(t,e,r){"use strict";
|
|
|
|
|
/*!
|
|
|
|
|
* Module dependencies.
|
|
|
|
|
*/var n=r(15).get().Binary,o=r(1),i=r(66).Buffer;function s(t,e,r){var n,a,c,l,f,p=arguments.length;return n=0===p||null==arguments[0]?0:t,Array.isArray(e)?(c=e[0],l=e[1]):a=e,f="number"==typeof n||n instanceof Number?i.alloc(n):i.from(n,a,r),o.decorate(f,s.mixin),f.isMongooseBuffer=!0,f[s.pathSymbol]=c,f[u]=l,f._subtype=0,f}var a=Symbol.for("mongoose#Buffer#_path"),u=Symbol.for("mongoose#Buffer#_parent");s.pathSymbol=a,
|
|
|
|
|
/*!
|
|
|
|
|
* Inherit from Buffer.
|
|
|
|
|
*/
|
|
|
|
|
s.mixin={_subtype:void 0,_markModified:function(){var t=this[u];return t&&t.markModified(this[s.pathSymbol]),this},write:function(){var t=i.prototype.write.apply(this,arguments);return t>0&&this._markModified(),t},copy:function(t){var e=i.prototype.copy.apply(this,arguments);return t&&t.isMongooseBuffer&&t._markModified(),e}},
|
|
|
|
|
/*!
|
|
|
|
|
* Compile other Buffer methods marking this buffer as modified.
|
|
|
|
|
*/
|
|
|
|
|
"writeUInt8 writeUInt16 writeUInt32 writeInt8 writeInt16 writeInt32 writeFloat writeDouble fill utf8Write binaryWrite asciiWrite set writeUInt16LE writeUInt16BE writeUInt32LE writeUInt32BE writeInt16LE writeInt16BE writeInt32LE writeInt32BE writeFloatLE writeFloatBE writeDoubleLE writeDoubleBE".split(" ").forEach((function(t){i.prototype[t]&&(s.mixin[t]=function(){var e=i.prototype[t].apply(this,arguments);return this._markModified(),e})})),s.mixin.toObject=function(t){var e="number"==typeof t?t:this._subtype||0;return new n(i.from(this),e)},s.mixin.toBSON=function(){return new n(this,this._subtype||0)},s.mixin.equals=function(t){if(!i.isBuffer(t))return!1;if(this.length!==t.length)return!1;for(var e=0;e<this.length;++e)if(this[e]!==t[e])return!1;return!0},s.mixin.subtype=function(t){if("number"!=typeof t)throw new TypeError("Invalid subtype. Expected a number");this._subtype!==t&&this._markModified(),this._subtype=t},
|
|
|
|
|
/*!
|
|
|
|
|
* Module exports.
|
|
|
|
|
*/
|
|
|
|
|
s.Binary=n,t.exports=s},function(t,e,r){"use strict";var n=r(15).get().ObjectId,o=r(23);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())}if(t.toString instanceof Function)return new n(t.toString());o.ok(!1)}},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 o(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 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,a(n.key),n)}}function a(t){var e=function(t,e){if("object"!=n(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==n(e)?e:String(e)}function u(){return(u="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,r){var n=c(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(arguments.length<3?t:r):o.value}}).apply(this,arguments)}function c(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=d(t)););return t}function l(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||!function(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"==typeof t}}(t))return t;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,r)}function r(){return p(t,arguments,d(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),y(r,t)})(t)}function p(t,e,r){return(p=h()?Reflect.construct.bind():function(t,e,r){var n=[null];n.push.apply(n,e);var o=new(Function.bind.apply(t,n));return r&&y(o,r.prototype),o}).apply(null,arguments)}function h(){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 y(t,e){return(y=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function d(t){return(d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var v=r(29),m=r(11),_=r(27),b=r(1).deepEqual,g=r(3),w=r(25),O=r(97),S=r(4),j=r(5
|
|
|
|
|
/*!
|
|
|
|
|
* Since maps are stored as objects under the hood, keys must be strings
|
|
|
|
|
* and can't contain any invalid characters
|
|
|
|
|
*/
|
|
|
|
|
function $(t){var e=n(t);if("string"!==e)throw new TypeError("Mongoose maps only support string keys, got ".concat(e));if(t.startsWith("$"))throw new Error('Mongoose maps do not support keys that start with "$", got "'.concat(t,'"'));if(t.includes("."))throw new Error('Mongoose maps do not support keys that contain ".", got "'.concat(t,'"'));if(j.has(t))throw new Error('Mongoose maps do not support reserved key name "'.concat(t,'"'))}S.inspect.custom&&Object.defineProperty(E.prototype,S.inspect.custom,{enumerable:!1,writable:!1,configurable:!1,value:E.prototype.inspect}),Object.defineProperty(E.prototype,"$__set",{enumerable:!1,writable:!0,configurable:!1}),Object.defineProperty(E.prototype,"$__parent",{enumerable:!1,writable:!0,configurable:!1}),Object.defineProperty(E.prototype,"$__path",{enumerable:!1,writable:!0,configurable:!1}),Object.defineProperty(E.prototype,"$__schemaType",{enumerable:!1,writable:!0,configurable:!1}),Object.defineProperty(E.prototype,"$isMongooseMap",{enumerable:!1,writable:!1,configurable:!1,value:!0}),Object.defineProperty(E.prototype,"$__deferredCalls",{enumerable:!1,writable:!1,configurable:!1,value:!0}),t.exports=E},function(t,e,r){"use strict";var n=r(1);t.exports=function(t){return n.isPOJO(t)&&null!=t.$__&&null!=t._doc?t._doc: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 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 i=r(12),s=r(22),a=r(17).internalToObjectOptions,u=r(28),c=r(0).documentArrayParent;function l(t,e,r,o,s){var a=this;this.$isSingleNested=!0,null!=s&&null!=s.path&&(this.$basePath=s.path);var u=null!=s&&s.priorDoc,c=null;if(u&&(this._doc=Object.assign({},s.priorDoc._doc),delete this._doc[this.$__schema.options.discriminatorKey],c=Object.keys(s.priorDoc._doc||{}).filter((function(t){return t!==a.$__schema.options.discriminatorKey}))),null!=r&&(s=Object.assign({},s,{isNew:r.isNew,defaults:r.$__.$options.defaults})),i.call(this,t,e,o,s),u){var l,f=n(c);try{for(f.s();!(l=f.n()).done;){var p=l.value;if(!this.$__.activePaths.states.modify[p]&&!this.$__.activePaths.states.default[p]&&!this.$__.$setCalled.has(p)){var h=this.$__schema.path(p),y=null==h?void 0:h.getDefault(this);void 0===y?delete this._doc[p]:(this._doc[p]=y,this.$__.activePaths.default(p))}}}catch(t){f.e(t)}finally{f.f()}delete s.priorDoc,delete this.$__.$options.priorDoc}}t.exports=l,l.prototype=Object.create(i.prototype),l.prototype.toBSON=function(){return this.toObject(a)},l.prototype.save=function(t,e){var r=this;return"function"==typeof t&&(e=t,t={}),(t=t||{}).suppressWarning||console.warn("mongoose: calling `save()` on a subdoc does **not** save the document to MongoDB, it only runs save middleware. Use `subdoc.save({ suppressWarning: true })` to hide this warning if you're sure this behavior is right for your app."),u(e,(function(t){r.$__save(t)}))},l.prototype.$__save=function(t){var e=this;return s((function(){return t(null,e)}))},l.prototype.$isValid=function(t){return this.$__parent&&this.$basePath?this.$__parent.$isValid([this.$basePath,t].join(".")):i.prototype.$isValid.call(this,t)},l.prototype.markModified=function(t){if(i.prototyp
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
l.prototype.invalidate=function(t,e,r){if(e!==this.ownerDocument().$__.validationError&&i.prototype.invalidate.call(this,t,e,r),this.$__parent&&this.$basePath)this.$__parent.invalidate([this.$basePath,t].join("."),e,r);else if("cast"===e.kind||"CastError"===e.name)throw e;return this.ownerDocument().$__.validationError},
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
l.prototype.$ignore=function(t){i.prototype.$ignore.call(this,t),this.$__parent&&this.$basePath&&this.$__parent.$ignore([this.$basePath,t].join("."))},l.prototype.ownerDocument=function(){if(this.$__.ownerDocument)return this.$__.ownerDocument;var t=this.$__parent;if(!t)return this;for(;t.$__parent||t[c];)t=t.$__parent||t[c];return this.$__.ownerDocument=t,this.$__.ownerDocument},l.prototype.parent=function(){return this.$__parent},l.prototype.$parent=l.prototype.parent,
|
|
|
|
|
/*!
|
|
|
|
|
* no-op for hooks
|
|
|
|
|
*/
|
|
|
|
|
l.prototype.$__remove=function(t){return t(null,this)},l.prototype.remove=function(t,e){"function"==typeof t&&(e=t,t=null),
|
|
|
|
|
/*!
|
|
|
|
|
* Registers remove event listeners for triggering
|
|
|
|
|
* on subdocuments.
|
|
|
|
|
*
|
|
|
|
|
* @param {Subdocument} sub
|
|
|
|
|
* @api private
|
|
|
|
|
*/
|
|
|
|
|
function(t){var e=t.ownerDocument();function r(){e.removeListener("save",r),e.removeListener("remove",r),t.emit("remove",t),t.constructor.emit("remove",t),e=t=null}e.on("save",r),e.on("remove",r)}(this),t&&t.noop||this.$__parent.set(this.$basePath,null),"function"==typeof e&&e(null)},
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
l.prototype.populate=function(){throw new Error('Mongoose does not support calling populate() on nested docs. Instead of `doc.nested.populate("path")`, use `doc.populate("nested.path")`')}},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 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 i=r(29),s=r(60).defineKey,a=r(3),u=r(1),c={toJSON:!0,toObject:!0,_id:!0,id:!0};
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
t.exports=function(t,e,r,o,l){if(!r||!r.instanceOfSchema)throw new Error("You must pass a valid discriminator Schema");if(t.schema.discriminatorMapping&&!t.schema.discriminatorMapping.isRoot)throw new Error('Discriminator "'+e+'" can only be a discriminator of the root model');if(l){var f=a(t.base,"options.applyPluginsToDiscriminators",!1);t.base._applyPlugins(r,{skipTopLevel:!f})}var p=t.schema.options.discriminatorKey,h=t.schema.path(p);if(null!=h)u.hasUserDefinedProperty(h.options,"select")||(h.options.select=!0),h.options.$skipDiscriminatorCheck=!0;else{var y={};y[p]={default:void 0,select:!0,$skipDiscriminatorCheck:!0},y[p][t.schema.options.typeKey]=String,t.schema.add(y),s(p,null,t.prototype,null,[p],t.schema.options)}if(r.path(p)&&!0!==r.path(p).options.$skipDiscriminatorCheck)throw new Error('Discriminator "'+e+'" cannot have field with name "'+p+'"');var d=e;if(("string"==typeof o&&o.length||null!=o)&&(d=o),function(e,r){e._baseSchema=r,r.paths._id&&r.paths._id.options&&!r.paths._id.options.auto&&e.remove("_id");for(var o=[],s=0,a=Object.keys(r.paths);s<a.length;s++){var l=a[s];if(e.nested[l])o.push(l);else if(-1!==l.indexOf(".")){var f,y="",v=n(l.split(".").slice(0,-1));try{for(v.s();!(f=v.n()).done;){var m=f.value;y+=(y.length?".":"")+m,(e.paths[y]instanceof i||e.singleNestedPaths[y]instanceof i)&&o.push(l)}}catch(t){v.e(t)}finally{v.f()}}}u.merge(e,r,{isDiscriminatorSchemaMerge:!0,omit:{discriminators:!0,base:!0},omitNested:o.reduce((function(t,e){return t["tree."+e]=!0,t}),{})});for(var _=0,b=o;_<b.length;_++){var g=b[_];delete e.paths[g]}e.childSchemas.forEach((function(t){t.model.prototype.$__setSchema(t.schema)}));var w={};w[p]={default:d,select:!0,set:function(t){if(t===d||Array.isArray(d)&&u.deepEqual(t,d))return d;throw new Error("Can't set discriminator key \""+p+'"')},$skipDiscriminatorCheck:!0},w[p][e.options.typeKey]=h?h.options[e.options.typeKey]:String,e.add(w),e.discriminatorMapping={key:p,value:d,isRoot:!1},r.options.collection&&(e.options.collection=r.options.collection);var O=e.options.toJSON,S=e.options.toObject,j=e.options._id,A=e.options.id,E=Object.keys(e.options);e.options.discriminatorKey=r.options.discriminatorKey;for(var $=0,P=E;$<P.length;$++){var x=P[$];if(!c[x]){if("pluralization"===x&&1==e.options[x]&&null==r.options[x])continue;if(!u.deepEqual(e.options[x],r.options[x]))throw new Error("Can't customize discriminator option "+x+" (can only modify "+Object.keys(c).join(", ")+")")}}e.options=u.clone(r.options),O&&(e.options.toJSON=O),S&&(e.options.toObject=S),void 0!==j&&(e.options._id=j),e.options.id=A,e.s.hooks=t.schema.s.hooks.merge(e.s.hooks),e.plugins=Array.prototype.slice.call(r.plugins),e.callQueue=r.callQueue.concat(e.callQueue),delete e._requiredpaths}(r,t.schema),t.discriminators||(t.discriminators={}),t.schema.discriminatorMapping||(t.schema.discriminatorMapping={key:p,value:null,isRoot:!0}),t.schema.discriminators||(t.schema.discriminators={}),t.schema.discriminators[e]=r,t.discriminators[e])throw new Error('Discriminator with name "'+e+'" already exists');return r}},function(t,e,r){"use strict";var n=r(82);t.exports=function(t,e){return null==e||null==e._id||(t=t.clone(),e._id?t.paths._id||(n(t),t.options._id=!0):(t.remove("_id"),t.options._id=!1)),t}},function(t,e,r){"use strict";var n=r(38);
|
|
|
|
|
/*!
|
|
|
|
|
* Find the correct constructor, taking into account discriminators
|
|
|
|
|
*/t.exports=function(t,e){var r=t.schema.options.discriminatorKey;if(null!=e&&t.discriminators&&null!=e[r])if(t.discriminators[e[r]])t=t.discriminators[e[r]];else{var o=n(t.discriminators,e[r]);o&&(t=o)}return t}},function(t,e,r){"use strict";t.exports=r(103)},function(t,e,r){"use strict";(function(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)}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,s(n.key),n)}}function s(t){var e=function(t,e){if("object"!=o(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=o(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==o(e)?e:String(e)}function a(t,e){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function u(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 o=l(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return c(this,r)}}function c(t,e){if(e&&("object"===o(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.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}r(15).set(r(107));var f=r(64),p=r(70);f.setBrowser(!0),Object.defineProperty(e,"Promise",{get:function(){return p.get()},set:function(t){p.set(t)}}),e.PromiseProvider=p,e.Error=r(5),e.Schema=r(56),e.Types=r(39),e.VirtualType=r(57),e.SchemaType=r(6),e.utils=r(1),e.Document=f(),e.model=function(t,r){var n=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&&a(t,e)}(c,t);var e,n,o,s=u(c);function c(t,e){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,c),s.call(this,t,r,e)}return e=c,n&&i(e.prototype,n),o&&i(e,o),Object.defineProperty(e,"prototype",{writable:!1}),e}(e.Document);return n.modelName=t,n},
|
|
|
|
|
/*!
|
|
|
|
|
* Module exports.
|
|
|
|
|
*/
|
|
|
|
|
"undefined"!=typeof window&&(window.mongoose=t.exports,window.Buffer=n)}).call(this,r(2).Buffer)},function(t,e,r){"use strict";e.byteLength=function(t){var e=c(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){var e,r,n=c(t),s=n[0],a=n[1],u=new i(function(t,e,r){return 3*(e+r)/4-r}(0,s,a)),l=0,f=a>0?s-4:s;for(r=0;r<f;r+=4)e=o[t.charCodeAt(r)]<<18|o[t.charCodeAt(r+1)]<<12|o[t.charCodeAt(r+2)]<<6|o[t.charCodeAt(r+3)],u[l++]=e>>16&255,u[l++]=e>>8&255,u[l++]=255&e;2===a&&(e=o[t.charCodeAt(r)]<<2|o[t.charCodeAt(r+1)]>>4,u[l++]=255&e);1===a&&(e=o[t.charCodeAt(r)]<<10|o[t.charCodeAt(r+1)]<<4|o[t.charCodeAt(r+2)]>>2,u[l++]=e>>8&255,u[l++]=255&e);return u},e.fromByteArray=function(t){for(var e,r=t.length,o=r%3,i=[],s=0,a=r-o;s<a;s+=16383)i.push(l(t,s,s+16383>a?a:s+16383));1===o?(e=t[r-1],i.push(n[e>>2]+n[e<<4&63]+"==")):2===o&&(e=(t[r-2]<<8)+t[r-1],i.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return i.join("")};for(var n=[],o=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,u=s.length;a<u;++a)n[a]=s[a],o[s.charCodeAt(a)]=a;function c(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function l(t,e,r){for(var o,i,s=[],a=e;a<r;a+=3)o=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(255&t[a+2]),s.push(n[(i=o)>>18&63]+n[i>>12&63]+n[i>>6&63]+n[63&i]);return s.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},function(t,e){
|
|
|
|
|
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
|
|
|
e.read=function(t,e,r,n,o){var i,s,a=8*o-n-1,u=(1<<a)-1,c=u>>1,l=-7,f=r?o-1:0,p=r?-1:1,h=t[e+f];for(f+=p,i=h&(1<<-l)-1,h>>=-l,l+=a;l>0;i=256*i+t[e+f],f+=p,l-=8);for(s=i&(1<<-l)-1,i>>=-l,l+=n;l>0;s=256*s+t[e+f],f+=p,l-=8);if(0===i)i=1-c;else{if(i===u)return s?NaN:1/0*(h?-1:1);s+=Math.pow(2,n),i-=c}return(h?-1:1)*s*Math.pow(2,i-n)},e.write=function(t,e,r,n,o,i){var s,a,u,c=8*i-o-1,l=(1<<c)-1,f=l>>1,p=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:i-1,y=n?1:-1,d=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=l):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+f>=1?p/u:p*Math.pow(2,1-f))*u>=2&&(s++,u/=2),s+f>=l?(a=0,s=l):s+f>=1?(a=(e*u-1)*Math.pow(2,o),s+=f):(a=e*Math.pow(2,f-1)*Math.pow(2,o),s=0));o>=8;t[r+h]=255&a,h+=y,a/=256,o-=8);for(s=s<<o|a,c+=o;c>0;t[r+h]=255&s,h+=y,s/=256,c-=8);t[r+h-y]|=128*d}},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},function(t,e,r){"use strict";
|
|
|
|
|
/*!
|
|
|
|
|
* Module exports.
|
|
|
|
|
*/e.Binary=r(108),e.Collection=function(){throw new Error("Cannot create a collection from browser library")},e.getConnection=function(){return function(){throw new Error("Cannot create a connection from browser library")}},e.Decimal128=r(115),e.ObjectId=r(116),e.ReadPreference=r(117)},function(t,e,r){"use strict";
|
|
|
|
|
/*!
|
|
|
|
|
* Module dependencies.
|
|
|
|
|
*/var n=r(40).Binary;
|
|
|
|
|
/*!
|
|
|
|
|
* Module exports.
|
|
|
|
|
*/t.exports=n},function(t,e){function r(t){return(r="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)}t.exports=function(t){return t&&"object"===r(t)&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},function(t,e){"function"==typeof Object.create?t.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}},function(module,exports,__webpack_require__){"use strict";var Long=__webpack_require__(26).Long,Double=__webpack_require__(41).Double,Timestamp=__webpack_require__(42).Timestamp,ObjectID=__webpack_require__(43).ObjectID,_Symbol=__webpack_require__(45).Symbol,Code=__webpack_require__(46).Code,MinKey=__webpack_require__(48).MinKey,MaxKey=__webpack_require__(49).MaxKey,Decimal128=__webpack_require__(47),Int32=__webpack_require__(63),DBRef=__webpack_require__(50).DBRef,BSONRegExp=__webpack_require__(44).BSONRegExp,Binary=__webpack_require__(31).Binary,utils=__webpack_require__(16),deserialize=function(t,e,r){var n=(e=null==e?{}:e)&&e.index?e.index:0,o=t[n]|t[n+1]<<8|t[n+2]<<16|t[n+3]<<24;if(o<5||t.length<o||o+n>t.length)throw new Error("corrupt bson message");if(0!==t[n+o-1])throw new Error("One object, sized correctly, with a spot for an EOO, but the EOO isn't 0x00");return deserializeObject(t,n,e,r)},deserializeObject=function t(e,r,n,o){var i=null!=n.evalFunctions&&n.evalFunctions,s=null!=n.cacheFunctions&&n.cacheFunctions,a=null!=n.cacheFunctionsCrc32&&n.cacheFunctionsCrc32;if(!a)var u=null;var c=null==n.fieldsAsRaw?null:n.fieldsAsRaw,l=null!=n.raw&&n.raw,f="boolean"==typeof n.bsonRegExp&&n.bsonRegExp,p=null!=n.promoteBuffers&&n.promoteBuffers,h=null==n.promoteLongs||n.promoteLongs,y=null==n.promoteValues||n.promoteValues,d=r;if(e.length<5)throw new Error("corrupt bson message < 5 bytes long");var v=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24;if(v<5||v>e.length)throw new Error("corrupt bson message");for(var m=o?[]:{},_=0;;){var b=e[r++];if(0===b)break;for(var g=r;0!==e[g]&&g<e.length;)g++;if(g>=e.length)throw new Error("Bad BSON Document: illegal CString");var w=o?_++:e.toString("utf8",r,g);if(r=g+1,b===BSON.BSON_DATA_STRING){var O=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24;if(O<=0||O>e.length-r||0!==e[r+O-1])throw new Error("bad string length in bson");m[w]=e.toString("utf8",r,r+O-1),r+=O}else if(b===BSON.BSON_DATA_OID){var S=utils.allocBuffer(12);e.copy(S,0,r,r+12),m[w]=new ObjectID(S),r+=12}else if(b===BSON.BSON_DATA_INT&&!1===y)m[w]=new Int32(e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24);else if(b===BSON.BSON_DATA_INT)m[w]=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24;else if(b===BSON.BSON_DATA_NUMBER&&!1===y)m[w]=new Double(e.readDoubleLE(r)),r+=8;else if(b===BSON.BSON_DATA_NUMBER)m[w]=e.readDoubleLE(r),r+=8;else if(b===BSON.BSON_DATA_DATE){var j=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24,A=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24;m[w]=new Date(new Long(j,A).toNumber())}else if(b===BSON.BSON_DATA_BOOLEAN){if(0!==e[r]&&1!==e[r])throw new Error("illegal boolean type value");m[w]=1===e[r++]}else if(b===BSON.BSON_DATA_OBJECT){var E=r,$=e[r]|e[r+1]<<8|e[r+2]<<16|e[r+3]<<24;if($<=0||$>e.length-r)throw new Error("bad embedded document length in bson");m[w]=l?e.slice(r,r+$):t(e,E,n,!1),r+=$}else if(b===BSON.BSON_DATA_ARRAY){E=r;var P=n,x=r+($=e[r]|e[r+1]<<8|e[r+2]<<16|e[r+3]<<24);if(c&&c[w]){for(var T in P={},n)P[T]=n[T];P.raw=!0}if(m[w]=t(e,E,P,!0),0!==e[(r+=$)-1])throw new Error("invalid array terminator byte");if(r!==x)throw new Error("corrupted array bson")}else if(b===BSON.BSON_DATA_UNDEFINED)m[w]=void 0;else if(b===BSON.BSON_DATA_NULL)m[w]=null;else if(b===BSON.BSON_DATA_LONG){j=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24,A=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24;var N=new Long(j,A);m[w]=h&&!0===y&&N.lessThanOrEqual(JS_INT_MAX_LONG)&&N.greaterThanOrEqual(J
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/t.exports=r(40).Decimal128},function(t,e,r){"use strict";
|
|
|
|
|
/*!
|
|
|
|
|
* [node-mongodb-native](https://github.com/mongodb/node-mongodb-native) ObjectId
|
|
|
|
|
* @constructor NodeMongoDbObjectId
|
|
|
|
|
* @see ObjectId
|
|
|
|
|
*/var n=r(40).ObjectID;
|
|
|
|
|
/*!
|
|
|
|
|
* Getter for convenience with populate, see gh-6115
|
|
|
|
|
*/Object.defineProperty(n.prototype,"_id",{enumerable:!1,configurable:!0,get:function(){return this}}),
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
t.exports=n},function(t,e,r){"use strict";
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/t.exports=function(){}},function(t,e,r){"use strict";
|
|
|
|
|
/*!
|
|
|
|
|
* Dependencies
|
|
|
|
|
*/var n=r(119).ctor("require","modify","init","default","ignore");t.exports=function(){this.strictMode=void 0,this.selected=void 0,this.shardval=void 0,this.saveError=void 0,this.validationError=void 0,this.adhocPaths=void 0,this.removing=void 0,this.inserting=void 0,this.saving=void 0,this.version=void 0,this.getters={},this._id=void 0,this.populate=void 0,this.populated=void 0,this.wasPopulated=!1,this.scope=void 0,this.activePaths=new n,this.pathsToScopes={},this.cachedRequired={},this.session=null,this.$setCalled=new Set,this.ownerDocument=void 0,this.fullPath=void 0}},function(t,e,r){"use strict";
|
|
|
|
|
/*!
|
|
|
|
|
* Module dependencies.
|
|
|
|
|
*/var n=r(1),o=t.exports=function(){};
|
|
|
|
|
/*!
|
|
|
|
|
* StateMachine represents a minimal `interface` for the
|
|
|
|
|
* constructors it builds via StateMachine.ctor(...).
|
|
|
|
|
*
|
|
|
|
|
* @api private
|
|
|
|
|
*/
|
|
|
|
|
/*!
|
|
|
|
|
* StateMachine.ctor('state1', 'state2', ...)
|
|
|
|
|
* A factory method for subclassing StateMachine.
|
|
|
|
|
* The arguments are a list of states. For each state,
|
|
|
|
|
* the constructor's prototype gets state transition
|
|
|
|
|
* methods named after each state. These transition methods
|
|
|
|
|
* place their path argument into the given state.
|
|
|
|
|
*
|
|
|
|
|
* @param {String} state
|
|
|
|
|
* @param {String} [state]
|
|
|
|
|
* @return {Function} subclass constructor
|
|
|
|
|
* @private
|
|
|
|
|
*/
|
|
|
|
|
o.ctor=function(){var t=n.args(arguments),e=function(){o.apply(this,arguments),this.paths={},this.states={},this.stateNames=t;for(var e,r=t.length;r--;)e=t[r],this.states[e]={}};return e.prototype=new o,t.forEach((function(t){e.prototype[t]=function(e){this._changeState(e,t)}})),e},
|
|
|
|
|
/*!
|
|
|
|
|
* This function is wrapped by the state change functions:
|
|
|
|
|
*
|
|
|
|
|
* - `require(path)`
|
|
|
|
|
* - `modify(path)`
|
|
|
|
|
* - `init(path)`
|
|
|
|
|
*
|
|
|
|
|
* @api private
|
|
|
|
|
*/
|
|
|
|
|
o.prototype._changeState=function(t,e){var r=this.states[this.paths[t]];r&&delete r[t],this.paths[t]=e,this.states[e][t]=!0},
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
o.prototype.clear=function(t){for(var e,r=Object.keys(this.states[t]),n=r.length;n--;)e=r[n],delete this.states[t][e],delete this.paths[e]},
|
|
|
|
|
/*!
|
|
|
|
|
* Checks to see if at least one path is in the states passed in via `arguments`
|
|
|
|
|
* e.g., this.some('required', 'inited')
|
|
|
|
|
*
|
|
|
|
|
* @param {String} state that we want to check for.
|
|
|
|
|
* @private
|
|
|
|
|
*/
|
|
|
|
|
o.prototype.some=function(){var t=this,e=arguments.length?arguments:this.stateNames;return Array.prototype.some.call(e,(function(e){return Object.keys(t.states[e]).length}))},
|
|
|
|
|
/*!
|
|
|
|
|
* This function builds the functions that get assigned to `forEach` and `map`,
|
|
|
|
|
* since both of those methods share a lot of the same logic.
|
|
|
|
|
*
|
|
|
|
|
* @param {String} iterMethod is either 'forEach' or 'map'
|
|
|
|
|
* @return {Function}
|
|
|
|
|
* @api private
|
|
|
|
|
*/
|
|
|
|
|
o.prototype._iter=function(t){return function(){var e=arguments.length,r=n.args(arguments,0,e-1),o=arguments[e-1];r.length||(r=this.stateNames);var i=this,s=r.reduce((function(t,e){return t.concat(Object.keys(i.states[e]))}),[]);return s[t]((function(t,e,r){return o(t,e,r)}))}},
|
|
|
|
|
/*!
|
|
|
|
|
* Iterates over the paths that belong to one of the parameter states.
|
|
|
|
|
*
|
|
|
|
|
* The function profile can look like:
|
|
|
|
|
* this.forEach(state1, fn); // iterates over all paths in state1
|
|
|
|
|
* this.forEach(state1, state2, fn); // iterates over all paths in state1 or state2
|
|
|
|
|
* this.forEach(fn); // iterates over all paths in all states
|
|
|
|
|
*
|
|
|
|
|
* @param {String} [state]
|
|
|
|
|
* @param {String} [state]
|
|
|
|
|
* @param {Function} callback
|
|
|
|
|
* @private
|
|
|
|
|
*/
|
|
|
|
|
o.prototype.forEach=function(){return this.forEach=this._iter("forEach"),this.forEach.apply(this,arguments)},
|
|
|
|
|
/*!
|
|
|
|
|
* Maps over the paths that belong to one of the parameter states.
|
|
|
|
|
*
|
|
|
|
|
* The function profile can look like:
|
|
|
|
|
* this.forEach(state1, fn); // iterates over all paths in state1
|
|
|
|
|
* this.forEach(state1, state2, fn); // iterates over all paths in state1 or state2
|
|
|
|
|
* this.forEach(fn); // iterates over all paths in all states
|
|
|
|
|
*
|
|
|
|
|
* @param {String} [state]
|
|
|
|
|
* @param {String} [state]
|
|
|
|
|
* @param {Function} callback
|
|
|
|
|
* @return {Array}
|
|
|
|
|
* @private
|
|
|
|
|
*/
|
|
|
|
|
o.prototype.map=function(){return this.map=this._iter("map"),this.map.apply(this,arguments)}},function(t,e){function r(t){return(r="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 n=1e3,o=6e4,i=60*o,s=24*i;function a(t,e,r,n){var o=e>=1.5*r;return Math.round(t/r)+" "+n+(o?"s":"")}t.exports=function(t,e){e=e||{};var u=r(t);if("string"===u&&t.length>0)return function(t){if((t=String(t)).length>100)return;var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(!e)return;var r=parseFloat(e[1]);switch((e[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*r;case"weeks":case"week":case"w":return 6048e5*r;case"days":case"day":case"d":return r*s;case"hours":case"hour":case"hrs":case"hr":case"h":return r*i;case"minutes":case"minute":case"mins":case"min":case"m":return r*o;case"seconds":case"second":case"secs":case"sec":case"s":return r*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}(t);if("number"===u&&isFinite(t))return e.long?function(t){var e=Math.abs(t);if(e>=s)return a(t,e,s,"day");if(e>=i)return a(t,e,i,"hour");if(e>=o)return a(t,e,o,"minute");if(e>=n)return a(t,e,n,"second");return t+" ms"}(t):function(t){var e=Math.abs(t);if(e>=s)return Math.round(t/s)+"d";if(e>=i)return Math.round(t/i)+"h";if(e>=o)return Math.round(t/o)+"m";if(e>=n)return Math.round(t/n)+"s";return t+"ms"}(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))}},function(t,e,r){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 o=r(122),i=["__proto__","constructor","prototype"];
|
|
|
|
|
/*!
|
|
|
|
|
* Returns the value passed to it.
|
|
|
|
|
*/
|
|
|
|
|
function s(t){return t}e.get=function(t,r,i,a){var u;"function"==typeof i&&(i.length<2?(a=i,i=void 0):(u=i,i=void 0)),a||(a=s);var c="string"==typeof t?o(t):t;if(!Array.isArray(c))throw new TypeError("Invalid `path`. Must be either string or array");for(var l,f=r,p=0;p<c.length;++p){if(l=c[p],"string"!=typeof c[p]&&"number"!=typeof c[p])throw new TypeError("Each segment of path to `get()` must be a string or number, got "+n(c[p]));if(Array.isArray(f)&&!/^\d+$/.test(l)){var h=c.slice(p);return[].concat(f).map((function(t){return t?e.get(h,t,i||u,a):a(void 0)}))}if(u)f=u(f,l);else{var y=i&&f[i]?f[i]:f;f=y instanceof Map?y.get(l):y[l]}if(!f)return a(f)}return a(f)},e.has=function(t,e){var r="string"==typeof t?o(t):t;if(!Array.isArray(r))throw new TypeError("Invalid `path`. Must be either string or array");for(var i=r.length,s=e,a=0;a<i;++a){if("string"!=typeof r[a]&&"number"!=typeof r[a])throw new TypeError("Each segment of path to `has()` must be a string or number, got "+n(r[a]));if(null==s||"object"!==n(s)||!(r[a]in s))return!1;s=s[r[a]]}return!0},e.unset=function(t,e){var r="string"==typeof t?o(t):t;if(!Array.isArray(r))throw new TypeError("Invalid `path`. Must be either string or array");for(var s=r.length,a=e,u=0;u<s;++u){if(null==a||"object"!==n(a)||!(r[u]in a))return!1;if("string"!=typeof r[u]&&"number"!=typeof r[u])throw new TypeError("Each segment of path to `unset()` must be a string or number, got "+n(r[u]));if(-1!==i.indexOf(r[u]))return!1;if(u===s-1)return delete a[r[u]],!0;a=a instanceof Map?a.get(r[u]):a[r[u]]}return!0},e.set=function(t,r,a,u,c,l){var f;"function"==typeof u&&(u.length<2?(c=u,u=void 0):(f=u,u=void 0)),c||(c=s);var p="string"==typeof t?o(t):t;if(!Array.isArray(p))throw new TypeError("Invalid `path`. Must be either string or array");if(null!=a){for(var h=0;h<p.length;++h){if("string"!=typeof p[h]&&"number"!=typeof p[h])throw new TypeError("Each segment of path to `set()` must be a string or number, got "+n(p[h]));if(-1!==i.indexOf(p[h]))return}for(var y,d=l||/\$/.test(t)&&!1!==l,v=a,m=(h=0,p.length-1);h<m;++h)if("$"!=(y=p[h])){if(Array.isArray(v)&&!/^\d+$/.test(y)){var _=p.slice(h);if(!d&&Array.isArray(r))for(var b=0;b<v.length&&b<r.length;++b)e.set(_,r[b],v[b],u||f,c,d);else for(b=0;b<v.length;++b)e.set(_,r,v[b],u||f,c,d);return}if(f)v=f(v,y);else{var g=u&&v[u]?v[u]:v;v=g instanceof Map?g.get(y):g[y]}if(!v)return}else if(h==m-1)break;if(y=p[m],u&&v[u]&&(v=v[u]),Array.isArray(v)&&!/^\d+$/.test(y))if(!d&&Array.isArray(r))!
|
|
|
|
|
/*!
|
|
|
|
|
* Recursively set nested arrays
|
|
|
|
|
*/
|
|
|
|
|
function t(e,r,n,o,i,s){for(var a,u=0;u<e.length&&u<r.length;++u)a=e[u],Array.isArray(a)&&Array.isArray(r[u])?t(a,r[u],n,o,i,s):a&&(o?o(a,n,s(r[u])):(a[i]&&(a=a[i]),a[n]=s(r[u])))}(v,r,y,f,u,c);else for(b=0;b<v.length;++b){var w=v[b];w&&(f?f(w,y,c(r)):(w[u]&&(w=w[u]),w[y]=c(r)))}else f?f(v,y,c(r)):v instanceof Map?v.set(y,c(r)):v[y]=c(r)}}},function(t,e,r){"use strict";t.exports=function(t){for(var e=[],r="",n="DEFAULT",o=0;o<t.length;++o)"IN_SQUARE_BRACKETS"!==n||/\d/.test(t[o])||"]"===t[o]||(n="DEFAULT",r=e[e.length-1]+"["+r,e.splice(e.length-1,1)),"["===t[o]?("IMMEDIATELY_AFTER_SQUARE_BRACKETS"!==n&&(e.push(r),r=""),n="IN_SQUARE_BRACKETS"):"]"===t[o]?"IN_SQUARE_BRACKETS"===n?(n="IMMEDIATELY_AFTER_SQUARE_BRACKETS",e.push(r),r=""):(n="DEFAULT",r+=t[o]):"."===t[o]?("IMMEDIATELY_AFTER_SQUARE_BRACKETS"!==n&&(e.push(r),r=""),n="DEFAULT"):r+=t[o];return"IMMEDIATELY_AFTER_SQUARE_BRACKETS"!==n&&e.push(r),e}},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 o(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,s(n.key),n)}}function i(t,e,r){return e&&o(t.prototype,e),r&&o(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function s(t){var e=function(t,e){if("object"!=n(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==n(e)?e:String(e)}var a=r(27),u=i((function t(e){if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._docs={},this._childDocs=[],null!=e&&(e=a(e),Object.assign(this,e),"object"===n(e.subPopulate)&&(this.populate=e.subPopulate),null!=e.perDocumentLimit&&null!=e.limit))throw new Error("Can not use `limit` and `perDocumentLimit` at the same time. Path: `"+e.path+"`.")}));t.exports=u},function(t,e,r){"use strict";var n=r(125);t.exports=function(){return Object.assign?function(){if(!Object.assign)return!1;for(var t="abcdefghijklmnopqrst",e=t.split(""),r={},n=0;n<e.length;++n)r[e[n]]=e[n];var o=Object.assign({},r),i="";for(var s in o)i+=s;return t!==i}()||function(){if(!Object.assign||!Object.preventExtensions)return!1;var t=Object.preventExtensions({1:2});try{Object.assign(t,"xy")}catch(e){return"y"===t[1]}return!1}()?n:Object.assign:n}},function(t,e,r){"use strict";var n=r(126),o=r(72)(),i=r(128),s=Object,a=i("Array.prototype.push"),u=i("Object.prototype.propertyIsEnumerable"),c=o?Object.getOwnPropertySymbols:null;t.exports=function(t,e){if(null==t)throw new TypeError("target must be an object");var r=s(t);if(1===arguments.length)return r;for(var i=1;i<arguments.length;++i){var l=s(arguments[i]),f=n(l),p=o&&(Object.getOwnPropertySymbols||c);if(p)for(var h=p(l),y=0;y<h.length;++y){var d=h[y];u(l,d)&&a(f,d)}for(var v=0;v<f.length;++v){var m=f[v];if(u(l,m)){var _=l[m];r[m]=_}}}return r}},function(t,e,r){"use strict";var n=Array.prototype.slice,o=r(71),i=Object.keys,s=i?function(t){return i(t)}:r(127),a=Object.keys;s.shim=function(){Object.keys?function(){var t=Object.keys(arguments);return t&&t.length===arguments.length}(1,2)||(Object.keys=function(t){return o(t)?a(n.call(t)):a(t)}):Object.keys=s;return Object.keys||s},t.exports=s},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 o;if(!Object.keys){var i=Object.prototype.hasOwnProperty,s=Object.prototype.toString,a=r(71),u=Object.prototype.propertyIsEnumerable,c=!u.call({toString:null},"toString"),l=u.call((function(){}),"prototype"),f=["toString","toLocaleString","valueOf","hasOwnProperty","isPro
|
|
|
|
|
/*!
|
|
|
|
|
* gt, gte, lt, lte, ne, in, nin, all, regex, size, maxDistance
|
|
|
|
|
*
|
|
|
|
|
* Thing.where('type').nin(array)
|
|
|
|
|
*/
|
|
|
|
|
"gt gte lt lte ne in nin all regex size maxDistance minDistance".split(" ").forEach((function(t){c.prototype[t]=function(){var e,r;1===arguments.length?(this._ensurePath(t),r=arguments[0],e=this._path):(r=arguments[1],e=arguments[0]);var o=null===this._conditions[e]||"object"===n(this._conditions[e])?this._conditions[e]:this._conditions[e]={};return o["$"+t]=r,this}})),c.prototype.mod=function(){var t,e;1===arguments.length?(this._ensurePath("mod"),t=arguments[0],e=this._path):2!==arguments.length||a.isArray(arguments[1])?3===arguments.length?(t=o(arguments,1),e=arguments[0]):(t=arguments[1],e=arguments[0]):(this._ensurePath("mod"),t=o(arguments),e=this._path);var r=this._conditions[e]||(this._conditions[e]={});return r.$mod=t,this},c.prototype.exists=function(){var t,e;0===arguments.length?(this._ensurePath("exists"),t=this._path,e=!0):1===arguments.length?"boolean"==typeof arguments[0]?(this._ensurePath("exists"),t=this._path,e=arguments[0]):(t=arguments[0],e=!0):2===arguments.length&&(t=arguments[0],e=arguments[1]);var r=this._conditions[t]||(this._conditions[t]={});return r.$exists=e,this},c.prototype.elemMatch=function(){if(null==arguments[0])throw new TypeError("Invalid argument");var t,e,r;if("function"==typeof arguments[0])this._ensurePath("elemMatch"),e=this._path,t=arguments[0];else if(a.isObject(arguments[0]))this._ensurePath("elemMatch"),e=this._path,r=arguments[0];else if("function"==typeof arguments[1])e=arguments[0],t=arguments[1];else{if(!arguments[1]||!a.isObject(arguments[1]))throw new TypeError("Invalid argument");e=arguments[0],r=arguments[1]}t&&(t(r=new c),r=r._conditions);var n=this._conditions[e]||(this._conditions[e]={});return n.$elemMatch=r,this},c.prototype.within=function(){if(this._ensurePath("within"),this._geoComparison=l,0===arguments.length)return this;if(2===arguments.length)return this.box.apply(this,arguments);if(2<arguments.length)return this.polygon.apply(this,arguments);var t=arguments[0];if(!t)throw new TypeError("Invalid argument");if(t.center)return this.circle(t);if(t.box)return this.box.apply(this,t.box);if(t.polygon)return this.polygon.apply(this,t.polygon);if(t.type&&t.coordinates)return this.geometry(t);throw new TypeError("Invalid argument")},c.prototype.box=function(){var t,e;if(3===arguments.length)t=arguments[0],e=[arguments[1],arguments[2]];else{if(2!==arguments.length)throw new TypeError("Invalid argument");this._ensurePath("box"),t=this._path,e=[arguments[0],arguments[1]]}var r=this._conditions[t]||(this._conditions[t]={});return r[this._geoComparison||l]={$box:e},this},c.prototype.polygon=function(){var t,e;"string"==typeof arguments[0]?(e=arguments[0],t=o(arguments,1)):(this._ensurePath("polygon"),e=this._path,t=o(arguments));var r=this._conditions[e]||(this._conditions[e]={});return r[this._geoComparison||l]={$polygon:t},this},c.prototype.circle=function(){var t,e;if(1===arguments.length)this._ensurePath("circle"),t=this._path,e=arguments[0];else{if(2!==arguments.length)throw new TypeError("Invalid argument");t=arguments[0],e=arguments[1]}if(!("radius"in e)||!e.center)throw new Error("center and radius are required");var r=this._conditions[t]||(this._conditions[t]={}),n=e.spherical?"$centerSphere":"$center",o=this._geoComparison||l;return r[o]={},r[o][n]=[e.center,e.radius],"unique"in e&&(r[o].$uniqueDocs=!!e.unique),this},c.prototype.near=function(){var t,e;if(this._geoComparison="$near",0===arguments.length)return this;if(1===arguments.length)this._ensurePath("near"),t=this._path,e=arguments[0];else{if(2!==arguments.length)throw new TypeError("Invalid argument");t=arguments[0],e=arguments[1]}if(!e.center)throw new Error("center is required");var r=this._conditions[t]||(this._conditions[t]={}),n=e.spherical?"$nearSphere":"$near";if(Array.isArray(e.center)){r[n]=e.center;var o="maxDistance"in e?e.maxDistance:null;null!=o&&(r.$maxDistance=o),null!=e.minDistance&&(r.$minDistance=e.minDistance)}else{if("Point"!=e.center.type||!Array.isArray(e.center.coordinates))throw new Error(s.format("Invalid GeoJSON specified for %s",n));r[n]={$geometry:e.center},"maxDistance"in
|
|
|
|
|
/*!
|
|
|
|
|
* @ignore
|
|
|
|
|
*/
|
|
|
|
|
var f={1:1,"-1":-1,asc:1,ascending:1,desc:-1,descending:-1};function p(t,e,r){if(Array.isArray(t.sort))throw new TypeError("Can't mix sort syntaxes. Use either array or object:\n- `.sort([['field', 1], ['test', -1]])`\n- `.sort({ field: 1, test: -1 })`");var n;if(r&&r.$meta)(n=t.sort||(t.sort={}))[e]={$meta:r.$meta};else{n=t.sort||(t.sort={});var o=String(r||1).toLowerCase();if(!(o=f[o]))throw new TypeError("Invalid sort value: { "+e+": "+r+" }");n[e]=o}}function h(t,e,r){if(t.sort=t.sort||[],!Array.isArray(t.sort))throw new TypeError("Can't mix sort syntaxes. Use either array or object:\n- `.sort([['field', 1], ['test', -1]])`\n- `.sort({ field: 1, test: -1 })`");var n=String(r||1).toLowerCase();if(!(n=f[n]))throw new TypeError("Invalid sort value: [ "+e+", "+r+" ]");t.sort.push([e,n])}function y(t,e){if(t.sort=t.sort||new Map,!(t.sort instanceof Map))throw new TypeError("Can't mix sort syntaxes. Use either array or object or map consistently");e.forEach((function(e,r){var n=String(e||1).toLowerCase();if(!(n=f[n]))throw new TypeError("Invalid sort value: < "+r+": "+e+" >");t.sort.set(r,n)}))}
|
|
|
|
|
/*!
|
|
|
|
|
* limit, skip, maxScan, batchSize, comment
|
|
|
|
|
*
|
|
|
|
|
* Sets these associated options.
|
|
|
|
|
*
|
|
|
|
|
* query.comment('feed query');
|
|
|
|
|
*/
|
|
|
|
|
/*!
|
|
|
|
|
* Internal helper for update, updateMany, updateOne
|
|
|
|
|
*/
|
|
|
|
|
function d(t,e,r,n,o,i,s){return t.op=e,c.canMerge(r)&&t.merge(r),n&&t._mergeUpdate(n),a.isObject(o)&&t.setOptions(o),i||s?!t._update||!t.options.overwrite&&0===a.keys(t._update).length?(s&&a.soon(s.bind(null,null,0)),t):(o=t._optionsForExec(),s||(o.safe=!1),r=t._conditions,n=t._updateForExec(),u("update",t._collection.collectionName,r,n,o),s=t._wrapCallback(e,s,{conditions:r,doc:n,options:o}),t._collection[e](r,n,o,a.tick(s)),t):t}["limit","skip","maxScan","batchSize","comment"].forEach((function(t){c.prototype[t]=function(e){return this._validate(t),this.options[t]=e,this}})),c.prototype.maxTime=c.prototype.maxTimeMS=function(t){return this._validate("maxTime"),this.options.maxTimeMS=t,this},c.prototype.snapshot=function(){return this._validate("snapshot"),this.options.snapshot=!arguments.length||!!arguments[0],this},c.prototype.hint=function(){if(0===arguments.length)return this;this._validate("hint");var t=arguments[0];if(a.isObject(t)){var e=this.options.hint||(this.options.hint={});for(var r in t)e[r]=t[r];return this}if("string"==typeof t)return this.options.hint=t,this;throw new TypeError("Invalid hint. "+t)},c.prototype.j=function(t){return this.options.j=t,this},c.prototype.slaveOk=function(t){return this.options.slaveOk=!arguments.length||!!t,this},c.prototype.read=c.prototype.setReadPreference=function(t){return arguments.length>1&&!c.prototype.read.deprecationWarningIssued&&(console.error("Deprecation warning: 'tags' argument is not supported anymore in Query.read() method. Please use mongodb.ReadPreference object instead."),c.prototype.read.deprecationWarningIssued=!0),this.options.readPreference=a.readPref(t),this},c.prototype.readConcern=c.prototype.r=function(t){return this.options.readConcern=a.readConcern(t),this},c.prototype.tailable=function(){return this._validate("tailable"),this.options.tailable=!arguments.length||!!arguments[0],this},c.prototype.writeConcern=c.prototype.w=function(t){return"object"===n(t)?(void 0!==t.j&&(this.options.j=t.j),void 0!==t.w&&(this.options.w=t.w),void 0!==t.wtimeout&&(this.options.wtimeout=t.wtimeout)):this.options.w="m"===t?"majority":t,this},c.prototype.wtimeout=c.prototype.wTimeout=function(t){return this.options.wtimeout=t,this},c.prototype.merge=function(t){if(!t)return this;if(!c.canMerge(t))throw new TypeError("Invalid argument. Expected instanceof mquery or plain object");return t instanceof c?(t._conditions&&a.merge(this._conditions,t._conditions),t._fields&&(this._fields||(this._fields={}),a.merge(this._fields,t._fields)),t.options&&(this.options||(this.options={}),a.merge(this.options,t.options)),t._update&&(this._update||(this._update={}),a.mergeClone(this._update,t._update)),t._distinct&&(this._distinct=t._distinct),this):(a.merge(this._conditions,t),this)},c.prototype.find=function(t,e){if(this.op="find","function"==typeof t?(e=t,t=void 0):c.canMerge(t)&&this.merge(t),!e)return this;var r=this._conditions,n=this._optionsForExec();return this.$useProjection?n.projection=this._fieldsForExec():n.fields=this._fieldsForExec(),u("find",this._collection.collectionName,r,n),e=this._wrapCallback("find",e,{conditions:r,options:n}),this._collection.find(r,n,a.tick(e)),this},c.prototype.cursor=function(t){if(this.op){if("find"!==this.op)throw new TypeError(".cursor only support .find method")}else this.find(t);var e=this._conditions,r=this._optionsForExec();return this.$useProjection?r.projection=this._fieldsForExec():r.fields=this._fieldsForExec(),u("findCursor",this._collection.collectionName,e,r),this._collection.findCursor(e,r)},c.prototype.findOne=function(t,e){if(this.op="findOne","function"==typeof t?(e=t,t=void 0):c.canMerge(t)&&this.merge(t),!e)return this;var r=this._conditions,n=this._optionsForExec();return this.$useProjection?n.projection=this._fieldsForExec():n.fields=this._fieldsForExec(),u("findOne",this._collection.collectionName,r,n),e=this._wrapCallback("findOne",e,{conditions:r,options:n}),this._collection.findOne(r,n,a.tick(e)),this},c.prototype.count=function(t,e){if(this.op="count",this._validate(),"function"==typeof t?(e=t,t=void 0):c.canMer
|
|
|
|
|
/*!
|
|
|
|
|
* Permissions
|
|
|
|
|
*/
|
|
|
|
|
c.permissions=r(142),c._isPermitted=function(t,e){var r=c.permissions[e];return!r||!0!==r[t]},c.prototype._validate=function(t){var e,r;if(void 0===t){if("function"!=typeof(r=c.permissions[this.op]))return!0;e=r(this)}else c._isPermitted(t,this.op)||(e=t);if(e)throw new Error(e+" cannot be used with "+this.op)},c.canMerge=function(t){return t instanceof c||a.isObject(t)},c.setGlobalTraceFunction=function(t){c.traceFunction=t},
|
|
|
|
|
/*!
|
|
|
|
|
* Exports.
|
|
|
|
|
*/
|
|
|
|
|
c.utils=a,c.env=r(77),c.Collection=r(144),c.BaseCollection=r(33),c.Promise=r(146),t.exports=c},function(t,e,r){(function(t,e){!function(t,r){"use strict";if(!t.setImmediate){var n,o,i,s,a,u=1,c={},l=!1,f=t.document,p=Object.getPrototypeOf&&Object.getPrototypeOf(t);p=p&&p.setTimeout?p:t,"[object process]"==={}.toString.call(t.process)?n=function(t){e.nextTick((function(){y(t)}))}:!function(){if(t.postMessage&&!t.importScripts){var e=!0,r=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=r,e}}()?t.MessageChannel?((i=new MessageChannel).port1.onmessage=function(t){y(t.data)},n=function(t){i.port2.postMessage(t)}):f&&"onreadystatechange"in f.createElement("script")?(o=f.documentElement,n=function(t){var e=f.createElement("script");e.onreadystatechange=function(){y(t),e.onreadystatechange=null,o.removeChild(e),e=null},o.appendChild(e)}):n=function(t){setTimeout(y,0,t)}:(s="setImmediate$"+Math.random()+"$",a=function(e){e.source===t&&"string"==typeof e.data&&0===e.data.indexOf(s)&&y(+e.data.slice(s.length))},t.addEventListener?t.addEventListener("message",a,!1):t.attachEvent("onmessage",a),n=function(e){t.postMessage(s+e,"*")}),p.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),r=0;r<e.length;r++)e[r]=arguments[r+1];var o={callback:t,args:e};return c[u]=o,n(u),u++},p.clearImmediate=h}function h(t){delete c[t]}function y(t){if(l)setTimeout(y,0,t);else{var e=c[t];if(e){l=!0;try{!function(t){var e=t.callback,r=t.args;switch(r.length){case 0:e();break;case 1:e(r[0]);break;case 2:e(r[0],r[1]);break;case 3:e(r[0],r[1],r[2]);break;default:e.apply(void 0,r)}}(e)}finally{h(t),l=!1}}}}}("undefined"==typeof self?void 0===t?this:t:self)}).call(this,r(9),r(10))},function(t,e,r){var n=r(2),o=n.Buffer;function i(t,e){for(var r in t)e[r]=t[r]}function s(t,e,r){return o(t,e,r)}o.from&&o.alloc&&o.allocUnsafe&&o.allocUnsafeSlow?t.exports=n:(i(n,e),e.Buffer=s),i(o,s),s.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return o(t,e,r)},s.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var n=o(t);return void 0!==e?"string"==typeof r?n.fill(e,r):n.fill(e):n.fill(0),n},s.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return o(t)},s.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n.SlowBuffer(t)}},function(t,e,r){(function(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)}function i(){var t;try{t=e.storage.debug}catch(t){}return!t&&void 0!==n&&"env"in n&&(t=n.env.DEBUG),t}(e=t.exports=r(140)).log=function(){return"object"===("undefined"==typeof console?"undefined":o(console))&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},e.formatArgs=function(t){var r=this.useColors;if(t[0]=(r?"%c":"")+this.namespace+(r?" %c":" ")+t[0]+(r?"%c ":" ")+"+"+e.humanize(this.diff),!r)return;var n="color: "+this.color;t.splice(1,0,n,"color: inherit");var o=0,i=0;t[0].replace(/%[a-zA-Z%]/g,(function(t){"%%"!==t&&(o++,"%c"===t&&(i=o))})),t.splice(i,0,n)},e.save=function(t){try{null==t?e.storage.removeItem("debug"):e.storage.debug=t}catch(t){}},e.load=i,e.useColors=function(){if("undefined"!=typeof window&&window.process&&"renderer"===window.process.type)return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"u
|
|
|
|
|
/* @preserve
|
|
|
|
|
* The MIT License (MIT)
|
|
|
|
|
*
|
|
|
|
|
* Copyright (c) 2013-2017 Petka Antonov
|
|
|
|
|
*
|
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
|
* of this software and associated documentation files (the "Software"), to deal
|
|
|
|
|
* in the Software without restriction, including without limitation the rights
|
|
|
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
|
* copies of the Software, and to permit persons to whom the Software is
|
|
|
|
|
* furnished to do so, subject to the following conditions:
|
|
|
|
|
*
|
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
|
* all copies or substantial portions of the Software.
|
|
|
|
|
*
|
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
|
* THE SOFTWARE.
|
|
|
|
|
*
|
|
|
|
|
*/u=function(){var t,e,i;return function t(e,r,n){function o(s,a){if(!r[s]){if(!e[s]){var u="function"==typeof _dereq_&&_dereq_;if(!a&&u)return u(s,!0);if(i)return i(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var l=r[s]={exports:{}};e[s][0].call(l.exports,(function(t){var r=e[s][1][t];return o(r||t)}),l,l.exports,t,e,r,n)}return r[s].exports}for(var i="function"==typeof _dereq_&&_dereq_,s=0;s<n.length;s++)o(n[s]);return o}({1:[function(t,e,r){"use strict";e.exports=function(t){var e=t._SomePromiseArray;function r(t){var r=new e(t),n=r.promise();return r.setHowMany(1),r.setUnwrap(),r.init(),n}t.any=function(t){return r(t)},t.prototype.any=function(){return r(this)}}},{}],2:[function(t,e,n){"use strict";var o;try{throw new Error}catch(t){o=t}var i=t("./schedule"),s=t("./queue"),a=t("./util");function u(){this._customScheduler=!1,this._isTickUsed=!1,this._lateQueue=new s(16),this._normalQueue=new s(16),this._haveDrainedQueues=!1,this._trampolineEnabled=!0;var t=this;this.drainQueues=function(){t._drainQueues()},this._schedule=i}function c(t,e,r){this._lateQueue.push(t,e,r),this._queueTick()}function l(t,e,r){this._normalQueue.push(t,e,r),this._queueTick()}function f(t){this._normalQueue._pushOne(t),this._queueTick()}u.prototype.setScheduler=function(t){var e=this._schedule;return this._schedule=t,this._customScheduler=!0,e},u.prototype.hasCustomScheduler=function(){return this._customScheduler},u.prototype.enableTrampoline=function(){this._trampolineEnabled=!0},u.prototype.disableTrampolineIfNecessary=function(){a.hasDevTools&&(this._trampolineEnabled=!1)},u.prototype.haveItemsQueued=function(){return this._isTickUsed||this._haveDrainedQueues},u.prototype.fatalError=function(t,e){e?(r.stderr.write("Fatal "+(t instanceof Error?t.stack:t)+"\n"),r.exit(2)):this.throwLater(t)},u.prototype.throwLater=function(t,e){if(1===arguments.length&&(e=t,t=function(){throw e}),"undefined"!=typeof setTimeout)setTimeout((function(){t(e)}),0);else try{this._schedule((function(){t(e)}))}catch(t){throw new Error("No async scheduler available\n\n See http://goo.gl/MqrFmX\n")}},a.hasDevTools?(u.prototype.invokeLater=function(t,e,r){this._trampolineEnabled?c.call(this,t,e,r):this._schedule((function(){setTimeout((function(){t.call(e,r)}),100)}))},u.prototype.invoke=function(t,e,r){this._trampolineEnabled?l.call(this,t,e,r):this._schedule((function(){t.call(e,r)}))},u.prototype.settlePromises=function(t){this._trampolineEnabled?f.call(this,t):this._schedule((function(){t._settlePromises()}))}):(u.prototype.invokeLater=c,u.prototype.invoke=l,u.prototype.settlePromises=f),u.prototype._drainQueue=function(t){for(;t.length()>0;){var e=t.shift();if("function"==typeof e){var r=t.shift(),n=t.shift();e.call(r,n)}else e._settlePromises()}},u.prototype._drainQueues=function(){this._drainQueue(this._normalQueue),this._reset(),this._haveDrainedQueues=!0,this._drainQueue(this._lateQueue)},u.prototype._queueTick=function(){this._isTickUsed||(this._isTickUsed=!0,this._schedule(this.drainQueues))},u.prototype._reset=function(){this._isTickUsed=!1},e.exports=u,e.exports.firstLineError=o},{"./queue":26,"./schedule":29,"./util":36}],3:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){var o=!1,i=function(t,e){this._reject(e)},s=function(t,e){e.promiseRejectionQueued=!0,e.bindingPromise._then(i,i,null,this,t)},a=function(t,e){0==(50397184&this._bitField)&&this._resolveCallback(e.target)},u=function(t,e){e.promiseRejectionQueued||this._reject(t)};t.prototype.bind=function(i){o||(o=!0,t.prototype._propagateFrom=n.propagateFromFunction(),t.prototype._boundValue=n.boundValueFunction());var c=r(i),l=new t(e);l._propagateFrom(this,1);var f=this._target();if(l._setBoundTo(c),c instanceof t){var p={promiseRejectionQueued:!1,promise:l,target:f,bindingPromise:c};f._then(e,s,void 0,l,p),c._then(a,u,void 0,l,p),l._setOnCancel(c)}else l._resolveCallback(f);return l},t.prototype._setBoundTo=function(t){void 0!==t?(this._bitField=2097152|this._bitField,this._boundTo=t):this._bitField=-2097153&this._bitField},t.prototype._isBound
|
|
|
|
|
/*!
|
|
|
|
|
* Module dependencies.
|
|
|
|
|
*/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 o(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,i(n.key),n)}}function i(t){var e=function(t,e){if("object"!=n(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==n(e)?e:String(e)}function s(t,e){return(s=Object.setPrototypeOf?Object.setPrototypeOf.bind():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=c(t);if(e){var o=c(this).constructor;r=Reflect.construct(n,arguments,o)}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 c(t){return(c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var l=r(5),f=r(4),p=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)}(u,t);var e,r,n,i=a(u);
|
|
|
|
|
/*!
|
|
|
|
|
* OverwriteModel Error constructor.
|
|
|
|
|
*/function u(t,e,r,n){var o,s;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,u);var a=l.messages;return s=null!=a.DocumentNotFoundError?"function"==typeof a.DocumentNotFoundError?a.DocumentNotFoundError(t,e):a.DocumentNotFoundError:'No document found for query "'+f.inspect(t)+'" on model "'+e+'"',(o=i.call(this,s)).result=n,o.numAffected=r,o.filter=t,o.query=t,o}return e=u,r&&o(e.prototype,r),n&&o(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(l);Object.defineProperty(p.prototype,"name",{value:"DocumentNotFoundError"}),
|
|
|
|
|
/*!
|
|
|
|
|
* exports
|
|
|
|
|
*/
|
|
|
|
|
t.exports=p},function(t,e,r){"use strict";
|
|
|
|
|
/*!
|
|
|
|
|
* Module dependencies.
|
|
|
|
|
*/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 o(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,i(n.key),n)}}function i(t){var e=function(t,e){if("object"!=n(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==n(e)?e:String(e)}function s(t,e){return(s=Object.setPrototypeOf?Object.setPrototypeOf.bind():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=c(t);if(e){var o=c(this).constructor;r=Reflect.construct(n,arguments,o)}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 c(t){return(c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var l=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)}(u,t);var e,r,n,i=a(u);function u(t,e,r){var n;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,u);var o=r.join(", ");return(n=i.call(this,'No matching document found for id "'+t._id+'" version '+e+' modifiedPaths "'+o+'"')).version=e,n.modifiedPaths=r,n}return e=u,r&&o(e.prototype,r),n&&o(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(r(5));Object.defineProperty(l.prototype,"name",{value:"VersionError"}),
|
|
|
|
|
/*!
|
|
|
|
|
* exports
|
|
|
|
|
*/
|
|
|
|
|
t.exports=l},function(t,e,r){"use strict";
|
|
|
|
|
/*!
|
|
|
|
|
* Module dependencies.
|
|
|
|
|
*/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 o(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,i(n.key),n)}}function i(t){var e=function(t,e){if("object"!=n(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==n(e)?e:String(e)}function s(t,e){return(s=Object.setPrototypeOf?Object.setPrototypeOf.bind():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=c(t);if(e){var o=c(this).constructor;r=Reflect.construct(n,arguments,o)}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 c(t){return(c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var l=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)}(u,t);var e,r,n,i=a(u);function u(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,u);return i.call(this,"Can't save() the same doc multiple times in parallel. Document: "+t._id)}return e=u,r&&o(e.prototype,r),n&&o(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(r(5));Object.defineProperty(l.prototype,"name",{value:"ParallelSaveError"}),
|
|
|
|
|
/*!
|
|
|
|
|
* exports
|
|
|
|
|
*/
|
|
|
|
|
t.exports=l},function(t,e,r){"use strict";
|
|
|
|
|
/*!
|
|
|
|
|
* Module dependencies.
|
|
|
|
|
*/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 o(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,i(n.key),n)}}function i(t){var e=function(t,e){if("object"!=n(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==n(e)?e:String(e)}function s(t,e){return(s=Object.setPrototypeOf?Object.setPrototypeOf.bind():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=c(t);if(e){var o=c(this).constructor;r=Reflect.construct(n,arguments,o)}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 c(t){return(c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var l=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)}(u,t);var e,r,n,i=a(u);
|
|
|
|
|
/*!
|
|
|
|
|
* OverwriteModel Error constructor.
|
|
|
|
|
* @param {String} name
|
|
|
|
|
*/function u(t){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,u),i.call(this,"Cannot overwrite `"+t+"` model once compiled.")}return e=u,r&&o(e.prototype,r),n&&o(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(r(5));Object.defineProperty(l.prototype,"name",{value:"OverwriteModelError"}),
|
|
|
|
|
/*!
|
|
|
|
|
* exports
|
|
|
|
|
*/
|
|
|
|
|
t.exports=l},function(t,e,r){"use strict";
|
|
|
|
|
/*!
|
|
|
|
|
* Module dependencies.
|
|
|
|
|
*/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 o(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,i(n.key),n)}}function i(t){var e=function(t,e){if("object"!=n(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==n(e)?e:String(e)}function s(t,e){return(s=Object.setPrototypeOf?Object.setPrototypeOf.bind():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=c(t);if(e){var o=c(this).constructor;r=Reflect.construct(n,arguments,o)}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 c(t){return(c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var l=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)}(u,t);var e,r,n,i=a(u);
|
|
|
|
|
/*!
|
|
|
|
|
* MissingSchema Error constructor.
|
|
|
|
|
* @param {String} name
|
|
|
|
|
*/function u(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,u);var e="Schema hasn't been registered for model \""+t+'".\nUse mongoose.model(name, schema)';return i.call(this,e)}return e=u,r&&o(e.prototype,r),n&&o(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(r(5));Object.defineProperty(l.prototype,"name",{value:"MissingSchemaError"}),
|
|
|
|
|
/*!
|
|
|
|
|
* exports
|
|
|
|
|
*/
|
|
|
|
|
t.exports=l},function(t,e,r){"use strict";
|
|
|
|
|
/*!
|
|
|
|
|
* Module dependencies.
|
|
|
|
|
*/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 o(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,i(n.key),n)}}function i(t){var e=function(t,e){if("object"!=n(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==n(e)?e:String(e)}function s(t,e){return(s=Object.setPrototypeOf?Object.setPrototypeOf.bind():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=c(t);if(e){var o=c(this).constructor;r=Reflect.construct(n,arguments,o)}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 c(t){return(c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var l=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)}(u,t);var e,r,n,i=a(u);
|
|
|
|
|
/*!
|
|
|
|
|
* DivergentArrayError constructor.
|
|
|
|
|
* @param {Array<String>} paths
|
|
|
|
|
*/function u(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,u);var e="For your own good, using `document.save()` to update an array which was selected using an $elemMatch projection OR populated using skip, limit, query conditions, or exclusion of the _id field when the operation results in a $pop or $set of the entire array is not supported. The following path(s) would have been modified unsafely:\n "+t.join("\n ")+"\nUse Model.update() to update these arrays instead.";return i.call(this,e)}return e=u,r&&o(e.prototype,r),n&&o(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(r(5));Object.defineProperty(l.prototype,"name",{value:"DivergentArrayError"}),
|
|
|
|
|
/*!
|
|
|
|
|
* exports
|
|
|
|
|
*/
|
|
|
|
|
t.exports=l},function(t,e,r){"use strict";var n=r(35);
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/t.exports=function(t){var e,r;t.$immutable?(t.$immutableSetter=(e=t.path,r=t.options.immutable,function(t){if(null==this||null==this.$__)return t;if(this.isNew)return t;if(!("function"==typeof r?r.call(this,this):r))return t;var o=this.$__getValue(e);if("throw"===this.$__.strictMode&&t!==o)throw new n(e,"Path `"+e+"` is immutable and strict mode is set to throw.",!0);return o}),t.set(t.$immutableSetter)):t.$immutableSetter&&(t.setters=t.setters.filter((function(e){return e!==t.$immutableSetter})),delete t.$immutableSetter)}},function(t,e,r){"use strict";
|
|
|
|
|
/*!
|
|
|
|
|
* Module dependencies.
|
|
|
|
|
*/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 o(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,i(n.key),n)}}function i(t){var e=function(t,e){if("object"!=n(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==n(e)?e:String(e)}function s(t,e){return(s=Object.setPrototypeOf?Object.setPrototypeOf.bind():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=c(t);if(e){var o=c(this).constructor;r=Reflect.construct(n,arguments,o)}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 c(t){return(c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var l=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)}(u,t);var e,r,n,i=a(u);function u(t,e,r){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,u),i.call(this,'Parameter "'+e+'" to '+r+"() must be an object, got "+t.toString())}return e=u,r&&o(e.prototype,r),n&&o(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(r(5));Object.defineProperty(l.prototype,"name",{value:"ObjectParameterError"}),t.exports=l},function(t,e,r){"use strict";
|
|
|
|
|
/*!
|
|
|
|
|
* Module dependencies.
|
|
|
|
|
*/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 o(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,i(n.key),n)}}function i(t){var e=function(t,e){if("object"!=n(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==n(e)?e:String(e)}function s(t,e){return(s=Object.setPrototypeOf?Object.setPrototypeOf.bind():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=c(t);if(e){var o=c(this).constructor;r=Reflect.construct(n,arguments,o)}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 c(t){return(c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var l=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)}(u,t);var e,r,n,i=a(u);function u(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,u);return i.call(this,"Can't validate() the same doc multiple times in parallel. Document: "+t._id)}return e=u,r&&o(e.prototype,r),n&&o(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(r(14));Object.defineProperty(l.prototype,"name",{value:"ParallelValidateError"}),
|
|
|
|
|
/*!
|
|
|
|
|
* exports
|
|
|
|
|
*/
|
|
|
|
|
t.exports=l},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 o=0,i=function(){};return{s:i,n:function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}},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 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 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 i(){this._pres=new Map,this._posts=new Map}function s(t,e,r,n,o,i,s){if(i.useErrorHandlers){var a={error:e};return t.execPost(r,n,o,a,(function(t){return"function"==typeof s&&s(t)}))}return"function"==typeof s?s(e):void 0}function a(t,e,r){return t.has(e)?t.get(e):r}function u(t,e,r,n){var o;try{o=t.apply(e,r)}catch(t){return n(t)}c(o)&&o.then((function(){return n()}),(function(t){return n(t)}))}function c(t){return null!=t&&"function"==typeof t.then}function l(t){var r=!1,n=this;return function(){var o=arguments;if(!r)return r=!0,e.nextTick((function(){return t.apply(n,o)}))}}i.prototype.execPre=function(t,r,n,o){3===arguments.length&&(o=n,n=[]);var i=a(this._pres,t,[]),s=i.length,f=i.numAsync||0,p=0,h=f,y=!1,d=n;if(!s)return e.nextTick((function(){o(null)}));var v=function t(){if(!(p>=s)){var n=i[p];if(n.isAsync){var a=[l(m),l((function(t){if(t){if(y)return;return y=!0,o(t)}if(0==--h&&p>=s)return o(null)}))];u(n.fn,r,a,a[0])}else if(n.fn.length>0){a=[l(m)];for(var f=arguments.length>=2?arguments:[null].concat(d),v=1;v<f.length;++v)a.push(f[v]);u(n.fn,r,a,a[0])}else{var _=null;try{_=n.fn.call(r)}catch(t){if(null!=t)return o(t)}if(c(_))_.then((function(){return m()}),(function(t){return m(t)}));else{if(++p>=s)return h>0?void 0:e.nextTick((function(){o(null)}));t()}}}};function m(t){if(t){if(y)return;return y=!0,o(t)}if(++p>=s)return h>0?void 0:o(null);v.apply(r,arguments)}v.apply(null,[null].concat(n))},i.prototype.execPreSync=function(t,e,r){for(var n=a(this._pres,t,[]),o=n.length,i=0;i<o;++i)n[i].fn.apply(e,r||[])},i.prototype.execPost=function(t,r,n,o,i){arguments.length<5&&(i=o,o=null);var s=a(this._posts,t,[]),f=s.length,p=0,h=null;if(o&&o.error&&(h=o.error),!f)return e.nextTick((function(){i.apply(null,[h].concat(n))}));var y=function t(){for(var e=s[p].fn,o=0,a=n.length,y=[],d=0;d<a;++d)o+=n[d]&&n[d]._kareemIgnore?0:1,n[d]&&n[d]._kareemIgnore||y.push(n[d]);if(h)if(e.length===o+2){var v=l((function(e){if(e&&(h=e),++p>=f)return i.call(null,h);t()}));u(e,r,[h].concat(y).concat([v]),v)}else{if(++p>=f)return i.call(null,h);t()}else{var m=l((function(e){return e?(h=e,t()):++p>=f?i.apply(null,[null].concat(n)):void t()}));if(e.length===o+2)return++p>=f?i.apply(null,[null].concat(n)):t();if(e.length===o+1)u(e,r,y.concat([m]),m);else{var _,b;try{b=e.apply(r,y)}catch(t){_=t,h=t}if(c(b))return b.then((function(){return m()}),(function(t){return m(t)}));if(++p>=f)return i.apply(null,[_].concat(n));t()}}};y()},i.prototype.execPostSync=function(t,e,r){for(var n=a(this._posts,t,[]),o=n.length,i=0;i<o;++i)n[i].fn.apply(e,r||[])},i.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}},i.prototype.wrap=fu
|
|
|
|
|
/*!
|
|
|
|
|
* Gather all indexes defined in the schema, including single nested,
|
|
|
|
|
* document arrays, and embedded discriminators.
|
|
|
|
|
*/
|
|
|
|
|
t.exports=function(t){var e=[],r=new WeakMap,i=t.constructor.indexTypes,s=new Map;return function t(a,u,c){if(r.has(a))return;r.set(a,!0),u=u||"";for(var l=Object.keys(a.paths),f=0,p=l;f<p.length;f++){var h=p[f],y=a.paths[h];if(null==c||!c.paths[h]){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,u+h+"."),null!=y.schema.discriminators)for(var d=y.schema.discriminators,v=Object.keys(d),m=0,_=v;m<_.length;m++){var b=_[m];t(d[b],u+h+".",y.schema)}if(y.$isMongooseDocumentArray)continue}var g=y._index||y.caster&&y.caster._index;if(!1!==g&&null!=g){var w={},O=o(g),S=O?g:{},j="string"==typeof g?g:!!O&&g.type;if(j&&-1!==i.indexOf(j))w[u+h]=j;else if(S.text)w[u+h]="text",delete S.text;else{var A=-1===Number(g);w[u+h]=A?-1:1}delete S.type,"background"in S||(S.background=!0),null!=a.options.autoIndex&&(S._autoIndex=a.options.autoIndex);var E=S&&S.name;"string"==typeof E&&s.has(E)?Object.assign(s.get(E),w):(e.push([w,S]),s.set(E,w))}}}r.delete(a),u?
|
|
|
|
|
/*!
|
|
|
|
|
* Checks for indexes added to subdocs using Schema.index().
|
|
|
|
|
* These indexes need their paths prefixed properly.
|
|
|
|
|
*
|
|
|
|
|
* schema._indexes = [ [indexObj, options], [indexObj, options] ..]
|
|
|
|
|
*/
|
|
|
|
|
function(t,r){for(var n=t._indexes,o=n.length,i=0;i<o;++i){for(var s=n[i][0],a=n[i][1],u=Object.keys(s),c=u.length,l={},f=0;f<c;++f){var p=u[f];l[r+p]=s[p]}var h=Object.assign({},a);if(null!=a&&null!=a.partialFilterExpression){h.partialFilterExpression={};for(var y=a.partialFilterExpression,d=0,v=Object.keys(y);d<v.length;d++){var m=v[d];h.partialFilterExpression[r+m]=y[m]}}e.push([l,h])}}(a,u):(a._indexes.forEach((function(t){"background"in t[1]||(t[1].background=!0)})),e=e.concat(a._indexes))}(t),e}},function(t,e,r){"use strict";var n=r(161),o=r(163),i=r(3),s=r(83),a=r(36);t.exports=function(t,e){var r=t.childSchemas.find((function(t){return!!t.schema.options.timestamps}));if(e||r){var u=s(e,"createdAt"),c=s(e,"updatedAt"),l=null!=e&&e.hasOwnProperty("currentTime")?e.currentTime:null,f={};t.$timestamps={createdAt:u,updatedAt:c},c&&!t.paths[c]&&(f[c]=Date),u&&!t.paths[u]&&(f[u]=Date),t.add(f),t.pre("save",(function(t){var e=i(this,"$__.saveOptions.timestamps");if(!1===e)return t();var r=null!=e&&!1===e.updatedAt,n=null!=e&&!1===e.createdAt,o=null!=l?l():(this.ownerDocument?this.ownerDocument():this).constructor.base.now(),s=this._id&&this._id.auto;if(!n&&this.isNew&&u&&!this.get(u)&&this.$__isSelected(u)&&this.$set(u,s?this._id.getTimestamp():o),!r&&c&&(this.isNew||this.isModified())){var a=o;this.isNew&&(null!=u?a=this.$__getValue(u):s&&(a=this._id.getTimestamp())),this.$set(c,a)}t()})),t.methods.initializeTimestamps=function(){var t=null!=l?l():this.constructor.base.now();return u&&!this.get(u)&&this.$set(u,t),c&&!this.get(c)&&this.$set(c,t),this},h[a.builtInMiddleware]=!0;var p={query:!0,model:!1};t.pre("findOneAndReplace",p,h),t.pre("findOneAndUpdate",p,h),t.pre("replaceOne",p,h),t.pre("update",p,h),t.pre("updateOne",p,h),t.pre("updateMany",p,h)}function h(t){var e=null!=l?l():this.model.base.now();"findOneAndReplace"===this.op&&null==this.getUpdate()&&this.setUpdate({}),o(e,u,c,this.getUpdate(),this.options,this.schema),n(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 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 i=r(162),s=r(83);
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
function a(t,e,r){if(null!=e){if(Object.keys(e).some((function(t){return t.startsWith("$")}))){if(e.$push&&d(e.$push),e.$addToSet&&d(e.$addToSet),null!=e.$set)for(var o=0,i=Object.keys(e.$set);o<i.length;o++){var a=i[o];u(r,a,e.$set,t)}if(null!=e.$setOnInsert)for(var c=0,l=Object.keys(e.$setOnInsert);c<l.length;c++){var f=l[c];u(r,f,e.$setOnInsert,t)}}var p,h=n(Object.keys(e).filter((function(t){return!t.startsWith("$")})));try{for(h.s();!(p=h.n()).done;){var y=p.value;u(r,y,e,t)}}catch(t){h.e(t)}finally{h.f()}}function d(e){for(var n=function(){var n=i[o],a=r.path(n.replace(/\.\$\./i,".").replace(/.\$$/,""));if(e[n]&&a&&a.$isMongooseDocumentArray&&a.schema.options.timestamps){var u=a.schema.options.timestamps,c=s(u,"createdAt"),l=s(u,"updatedAt");e[n].$each?e[n].$each.forEach((function(e){null!=l&&(e[l]=t),null!=c&&(e[c]=t)})):(null!=l&&(e[n][l]=t),null!=c&&(e[n][c]=t))}},o=0,i=Object.keys(e);o<i.length;o++)n()}}function u(t,e,r,o){var u=i(e),c=t.path(u);if(c){for(var l=[],f=u.split("."),p=f.length-1;p>0;--p){var h=t.path(f.slice(0,p).join("."));null!=h&&(h.$isMongooseDocumentArray||h.$isSingleNested)&&l.push({parentPath:e.split(".").slice(0,p).join("."),parentSchemaType:h})}if(Array.isArray(r[e])&&c.$isMongooseDocumentArray)!function(t,e,r){var n=e.schema.options.timestamps;if(n)for(var o=t.length,i=s(n,"createdAt"),u=s(n,"updatedAt"),c=0;c<o;++c)null!=u&&(t[c][u]=r),null!=i&&(t[c][i]=r),a(r,t[c],e.schema)}(r[e],c,o);else if(r[e]&&c.$isSingleNested)!function(t,e,r){var n=e.schema.options.timestamps;if(n){var o=s(n,"createdAt"),i=s(n,"updatedAt");null!=i&&(t[i]=r),null!=o&&(t[o]=r),a(r,t,e.schema)}}(r[e],c,o);else if(l.length>0){var y,d=n(l);try{for(d.s();!(y=d.n()).done;){var v=y.value,m=v.parentPath,_=v.parentSchemaType,b=_.schema.options.timestamps,g=s(b,"updatedAt");if(b&&null!=g)if(_.$isSingleNested)r[m+"."+g]=o;else if(_.$isMongooseDocumentArray){var w=e.substr(m.length+1);if(/^\d+$/.test(w)){r[m+"."+w][g]=o;continue}var O=w.indexOf(".");r[m+"."+(w=-1!==O?w.substr(0,O):w)+"."+g]=o}}}catch(t){d.e(t)}finally{d.f()}}else if(null!=c.schema&&c.schema!=t&&r[e]){var S=c.schema.options.timestamps,j=s(S,"createdAt"),A=s(S,"updatedAt");if(!S)return;null!=A&&(r[e][A]=o),null!=j&&(r[e][j]=o)}}}t.exports=a},function(t,e,r){"use strict";t.exports=function(t){return t.replace(/\.\$(\[[^\]]*\])?(?=\.)/g,".0").replace(/\.\$(\[[^\]]*\])?$/g,".0")}},function(t,e,r){"use strict";
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/var n=r(3);t.exports=
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
function(t,e,r,o,i){var s=o,a=s,u=n(i,"overwrite",!1),c=n(i,"timestamps",!0);if(!c||null==s)return o;var l=null!=c&&!1===c.createdAt,f=null!=c&&!1===c.updatedAt;if(u)return o&&o.$set&&(o=o.$set,s.$set={},a=s.$set),f||!r||o[r]||(a[r]=t),l||!e||o[e]||(a[e]=t),s;if(o=o||{},Array.isArray(s))return s.push({$set:{updatedAt:t}}),s;if(s.$set=s.$set||{},!f&&r&&(!o.$currentDate||!o.$currentDate[r])){var p=!1;if(-1!==r.indexOf("."))for(var h=r.split("."),y=1;y<h.length;++y){var d=h.slice(-y).join("."),v=h.slice(0,-y).join(".");if(null!=o[v]){o[v][d]=t,p=!0;break}if(o.$set&&o.$set[v]){o.$set[v][d]=t,p=!0;break}}p||(s.$set[r]=t),s.hasOwnProperty(r)&&delete s[r]}if(!l&&e){o[e]&&delete o[e],o.$set&&o.$set[e]&&delete o.$set[e];var m=!1;if(-1!==e.indexOf("."))for(var _=e.split("."),b=1;b<_.length;++b){var g=_.slice(-b).join("."),w=_.slice(0,-b).join(".");if(null!=o[w]){o[w][g]=t,m=!0;break}if(o.$set&&o.$set[w]){o.$set[w][g]=t,m=!0;break}}m||(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(14),o=r(4);t.exports=function(t,e){if("string"==typeof t)return;if("function"==typeof t)return;throw new n('Invalid ref at path "'+e+'". Got '+o.inspect(t,{depth:0}))}},function(t,e,r){"use strict";
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
/*!
|
|
|
|
|
* Apply query middleware
|
|
|
|
|
*
|
|
|
|
|
* @param {Query} query constructor
|
|
|
|
|
* @param {Model} model
|
|
|
|
|
*/
|
|
|
|
|
function n(t,e){var r={useErrorHandlers:!0,numCallbackParams:1,nullResultByDefault:!0},o=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=o.createWrapper("update",t.prototype._execUpdate,null,r),t.prototype.__distinct=o.createWrapper("distinct",t.prototype.__distinct,null,r),t.prototype.validate=o.createWrapper("validate",t.prototype.validate,null,r),n.middlewareFunctions.filter((function(t){return"update"!==t&&"distinct"!==t&&"validate"!==t})).forEach((function(e){t.prototype["_".concat(e)]=o.createWrapper(e,t.prototype["_".concat(e)],null,r)}))}t.exports=n,
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
n.middlewareFunctions=["count","countDocuments","deleteMany","deleteOne","distinct","estimatedDocumentCount","find","findOne","findOneAndDelete","findOneAndRemove","findOneAndReplace","findOneAndUpdate","remove","replaceOne","update","updateMany","updateOne","validate"]},function(t,e,r){"use strict";
|
|
|
|
|
/*!
|
|
|
|
|
* Module dependencies.
|
|
|
|
|
*/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 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 i=r(6),s=r(5),a=r(167),u=r(85),c=r(1),l=i.CastError;function f(t,e){this.enumValues=[],this.regExp=null,i.call(this,t,e,"String")}
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
function p(t){return this.castForQuery(t)}f.schemaName="String",f.defaultOptions={},
|
|
|
|
|
/*!
|
|
|
|
|
* Inherits from SchemaType.
|
|
|
|
|
*/
|
|
|
|
|
f.prototype=Object.create(i.prototype),f.prototype.constructor=f,Object.defineProperty(f.prototype,"OptionsConstructor",{configurable:!1,enumerable:!1,writable:!1,value:a}),
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
f._cast=u,f.cast=function(t){return 0===arguments.length||(!1===t&&(t=this._defaultCaster),this._cast=t),this._cast},
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
f._defaultCaster=function(t){if(null!=t&&"string"!=typeof t)throw new Error;return t},f.get=i.get,f.set=i.set,
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
f._checkRequired=function(t){return(t instanceof String||"string"==typeof t)&&t.length},f.checkRequired=i.checkRequired,f.prototype.enum=function(){if(this.enumValidator&&(this.validators=this.validators.filter((function(t){return t.validator!==this.enumValidator}),this),this.enumValidator=!1),void 0===arguments[0]||!1===arguments[0])return this;var t,e;c.isObject(arguments[0])?Array.isArray(arguments[0].values)?(t=arguments[0].values,e=arguments[0].message):(t=c.object.vals(arguments[0]),e=s.messages.String.enum):(t=arguments,e=s.messages.String.enum);var r,o=n(t);try{for(o.s();!(r=o.n()).done;){var i=r.value;void 0!==i&&this.enumValues.push(this.cast(i))}}catch(t){o.e(t)}finally{o.f()}var a=this.enumValues;return this.enumValidator=function(t){return void 0===t||~a.indexOf(t)},this.validators.push({validator:this.enumValidator,message:e,type:"enum",enumValues:a}),this},f.prototype.lowercase=function(t){return arguments.length>0&&!t?this:this.set((function(t,e){return"string"!=typeof t&&(t=e.cast(t)),t?t.toLowerCase():t}))},f.prototype.uppercase=function(t){return arguments.length>0&&!t?this:this.set((function(t,e){return"string"!=typeof t&&(t=e.cast(t)),t?t.toUpperCase():t}))},f.prototype.trim=function(t){return arguments.length>0&&!t?this:this.set((function(t,e){return"string"!=typeof t&&(t=e.cast(t)),t?t.trim():t}))},f.prototype.minlength=function(t,e){if(this.minlengthValidator&&(this.validators=this.validators.filter((function(t){return t.validator!==this.minlengthValidator}),this)),null!=t){var r=e||s.messages.String.minlength;r=r.replace(/{MINLENGTH}/,t),this.validators.push({validator:this.minlengthValidator=function(e){return null===e||e.length>=t},message:r,type:"minlength",minlength:t})}return this},f.prototype.minLength=f.prototype.minlength,f.prototype.maxlength=function(t,e){if(this.maxlengthValidator&&(this.validators=this.validators.filter((function(t){return t.validator!==this.maxlengthValidator}),this)),null!=t){var r=e||s.messages.String.maxlength;r=r.replace(/{MAXLENGTH}/,t),this.validators.push({validator:this.maxlengthValidator=function(e){return null===e||e.length<=t},message:r,type:"maxlength",maxlength:t})}return this},f.prototype.maxLength=f.prototype.maxlength,f.prototype.match=function(t,e){var r=e||s.messages.String.match;return this.validators.push({validator:function(e){return!!t&&(t.lastIndex=0,null==e||""===e||t.test(e))},message:r,type:"regexp",regexp:t}),this},f.prototype.checkRequired=function(t,e){return i._isRef(this,t,e,!0)?!!t:("function"==typeof this.constructor.checkRequired?this.constructor.checkRequired():f.checkRequired())(t)},f.prototype.cast=function(t,e,r){if(i._isRef(this,t,e,r))return"string"==typeof t?t:this._castRef(t,e,r);var n;n="function"==typeof this._castFunction?this._castFunction:"function"==typeof this.constructor.cast?this.constructor.cast():f.cast();try{return n(t)}catch(e){throw new l("string",t,this.path,null,this)}};var h=c.options(i.prototype.$conditionalHandlers,{$all:function(t){var e=this;return Array.isArray(t)?t.map((function(t){return e.castForQuery(t)})):[this.castForQuery(t)]},$gt:p,$gte:p,$lt:p,$lte:p,$options:String,$regex:p,$not:p});Object.defineProperty(f.prototype,"$conditionalHandlers",{configurable:!1,enumerable:!1,writable:!1,value:Object.freeze(h)}),f.prototype.castForQuery=function(t,e){var r;if(2===arguments.length){if(!(r=this.$conditionalHandlers[t]))throw new Error("Can't use "+t+" with String.");return r.call(this,e)}return e=t,"[object RegExp]"===Object.prototype.toString.call(e)?e:this._castForQuery(e)},
|
|
|
|
|
/*!
|
|
|
|
|
* Module exports.
|
|
|
|
|
*/
|
|
|
|
|
t.exports=f},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 o(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,i(n.key),n)}}function i(t){var e=function(t,e){if("object"!=n(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==n(e)?e:String(e)}function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function u(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 o=l(this).constructor;r=Reflect.construct(n,arguments,o)}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.bind():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&&a(t,e)}(c,t);var e,r,n,i=u(c);function c(){return s(this,c),i.apply(this,arguments)}return e=c,r&&o(e.prototype,r),n&&o(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(r(7)),p=r(8);Object.defineProperty(f.prototype,"enum",p),Object.defineProperty(f.prototype,"match",p),Object.defineProperty(f.prototype,"lowercase",p),Object.defineProperty(f.prototype,"trim",p),Object.defineProperty(f.prototype,"uppercase",p),Object.defineProperty(f.prototype,"minLength",p),Object.defineProperty(f.prototype,"minlength",p),Object.defineProperty(f.prototype,"maxLength",p),Object.defineProperty(f.prototype,"maxlength",p),Object.defineProperty(f.prototype,"populate",p),
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
t.exports=f},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 o(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,i(n.key),n)}}function i(t){var e=function(t,e){if("object"!=n(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==n(e)?e:String(e)}function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function u(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 o=l(this).constructor;r=Reflect.construct(n,arguments,o)}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.bind():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&&a(t,e)}(c,t);var e,r,n,i=u(c);function c(){return s(this,c),i.apply(this,arguments)}return e=c,r&&o(e.prototype,r),n&&o(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(r(7)),p=r(8);Object.defineProperty(f.prototype,"min",p),Object.defineProperty(f.prototype,"max",p),Object.defineProperty(f.prototype,"enum",p),Object.defineProperty(f.prototype,"populate",p),
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
t.exports=f},function(t,e,r){"use strict";var n=r(23);
|
|
|
|
|
/*!
|
|
|
|
|
* Given a value, cast it to a number, or throw a `CastError` if the value
|
|
|
|
|
* cannot be casted. `null` and `undefined` are considered valid.
|
|
|
|
|
*
|
|
|
|
|
* @param {Any} value
|
|
|
|
|
* @param {String} [path] optional the path to set on the CastError
|
|
|
|
|
* @return {Boolean|null|undefined}
|
|
|
|
|
* @throws {Error} if `value` is not one of the allowed values
|
|
|
|
|
* @api private
|
|
|
|
|
*/t.exports=function(t){return null==t?t:""===t?null:("string"!=typeof t&&"boolean"!=typeof t||(t=Number(t)),n.ok(!isNaN(t)),t instanceof Number?t.valueOf():"number"==typeof t?t:Array.isArray(t)||"function"!=typeof t.valueOf?t.toString&&!Array.isArray(t)&&t.toString()==Number(t)?Number(t):void n.ok(!1):Number(t.valueOf()))}},function(t,e,r){"use strict";
|
|
|
|
|
/*!
|
|
|
|
|
* Module dependencies.
|
|
|
|
|
*/var n=r(13),o=r(6),i=r(55),s=r(1);function a(t,e){o.call(this,t,e,"Boolean")}a.schemaName="Boolean",a.defaultOptions={},
|
|
|
|
|
/*!
|
|
|
|
|
* Inherits from SchemaType.
|
|
|
|
|
*/
|
|
|
|
|
a.prototype=Object.create(o.prototype),a.prototype.constructor=a,
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
a._cast=i,a.set=o.set,a.cast=function(t){return 0===arguments.length||(!1===t&&(t=this._defaultCaster),this._cast=t),this._cast},
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
a._defaultCaster=function(t){if(null!=t&&"boolean"!=typeof t)throw new Error;return t},
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
a._checkRequired=function(t){return!0===t||!1===t},a.checkRequired=o.checkRequired,a.prototype.checkRequired=function(t){return this.constructor._checkRequired(t)},Object.defineProperty(a,"convertToTrue",{get:function(){return i.convertToTrue},set:function(t){i.convertToTrue=t}}),Object.defineProperty(a,"convertToFalse",{get:function(){return i.convertToFalse},set:function(t){i.convertToFalse=t}}),a.prototype.cast=function(t){var e;e="function"==typeof this._castFunction?this._castFunction:"function"==typeof this.constructor.cast?this.constructor.cast():a.cast();try{return e(t)}catch(e){throw new n("Boolean",t,this.path,e,this)}},a.$conditionalHandlers=s.options(o.prototype.$conditionalHandlers,{}),a.prototype.castForQuery=function(t,e){var r;return 2===arguments.length?(r=a.$conditionalHandlers[t])?r.call(this,e):this._castForQuery(e):this._castForQuery(t)},a.prototype._castNullish=function(t){if(void 0===t&&null!=this.$$context&&null!=this.$$context._mongooseOptions&&this.$$context._mongooseOptions.omitUndefined)return t;var e="function"==typeof this.constructor.cast?this.constructor.cast():a.cast();return null==e?t:!(e.convertToFalse instanceof Set&&e.convertToFalse.has(t))&&(!!(e.convertToTrue instanceof Set&&e.convertToTrue.has(t))||t)},
|
|
|
|
|
/*!
|
|
|
|
|
* Module exports.
|
|
|
|
|
*/
|
|
|
|
|
t.exports=a},function(t,e,r){"use strict";
|
|
|
|
|
/*!
|
|
|
|
|
* Module dependencies.
|
|
|
|
|
*/var n,o,i=r(59),s=r(13),a=r(19).EventEmitter,u=r(177),c=r(6),l=r(34),f=r(99),p=r(3),h=r(100),y=r(4),d=r(1),v=r(101),m=r(0).arrayAtomicsSymbol,_=r(0).arrayPathSymbol,b=r(0).documentArrayParent;function g(t,e,r,n){null!=n&&null!=n._id?e=h(e,n):null!=r&&null!=r._id&&(e=h(e,r));var o=w(e,r);o.prototype.$basePath=t,i.call(this,t,o,r),this.schema=e,this.schemaOptions=n||{},this.$isMongooseDocumentArray=!0,this.Constructor=o,o.base=e.base;var s=this.defaultValue;"defaultValue"in this&&void 0===s||this.default((function(){var t=s.call(this);return Array.isArray(t)||(t=[t]),t}));var a=this;this.$embeddedSchemaType=new c(t+".$",{required:p(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}
|
|
|
|
|
/*!
|
|
|
|
|
* Ignore
|
|
|
|
|
*/
|
|
|
|
|
function w(t,e,n){function i(){o.apply(this,arguments),this.$session(this.ownerDocument().$session())}o||(o=r(30));var s=null!=n?n.prototype:o.prototype;for(var u in i.prototype=Object.create(s),i.prototype.$__setSchema(t),i.schema=t,i.prototype.constructor=i,i.$isArraySubdocument=!0,i.events=new a,t.methods)i.prototype[u]=t.methods[u];for(var c in t.statics)i[c]=t.statics[c];for(var l in a.prototype)i[l]=a.prototype[l];return i.options=e,i}
|
|
|
|
|
/*!
|
|
|
|
|
* Scopes paths selected in a query to this array.
|
|
|
|
|
* Necessary for proper default application of subdocument values.
|
|
|
|
|
*
|
|
|
|
|
* @param {DocumentArrayPath} array - the array to scope `fields` paths
|
|
|
|
|
* @param {Object|undefined} fields - the root fields selected in the query
|
|
|
|
|
* @param {Boolean|undefined} init - if we are being created part of a query result
|
|
|
|
|
*/
|
|
|
|
|
function O(t,e,r){if(r&&e){for(var n,o,i,s=t.path+".",a=Object.keys(e),u=a.length,c={};u--;)if((o=a[u]).startsWith(s)){if("$"===(i=o.substring(s.length)))continue;i.startsWith("$.")&&(i=i.substr(2)),n||(n=!0),c[i]=e[o]}return n&&c||void 0}}g.schemaName="DocumentArray",g.options={castNonArrays:!0},
|
|
|
|
|
/*!
|
|
|
|
|
* Inherits from ArrayType.
|
|
|
|
|
*/
|
|
|
|
|
g.prototype=Object.create(i.prototype),g.prototype.constructor=g,g.prototype.OptionsConstructor=u,g.prototype.discriminator=function(t,e,r){"function"==typeof t&&(t=d.getFunctionName(t));var n=w(e=f(this.casterConstructor,t,e,r),null,this.casterConstructor);n.baseCasterConstructor=this.casterConstructor;try{Object.defineProperty(n,"name",{value:t})}catch(t){}return this.casterConstructor.discriminators[t]=n,this.casterConstructor.discriminators[t]},g.prototype.doValidate=function(t,e,i,s){n||(n=r(18));var a=this;try{c.prototype.doValidate.call(this,t,(function(r){if(r)return r.$isArrayValidatorError=!0,e(r);var u,c=t&&t.length;if(!c)return e();if(s&&s.updateValidator)return e();t.isMongooseDocumentArray||(t=new n(t,a.path,i));function f(t){null!=t&&((u=t)instanceof l||(u.$isArrayValidatorError=!0)),--c||e(u)}for(var p=0,h=c;p<h;++p){var y=t[p];if(null!=y){if(!(y instanceof o)){var d=v(a.casterConstructor,t[p]);y=t[p]=new d(y,t,void 0,void 0,p)}null==s||!s.validateModifiedOnly||y.isModified()?y.$__validate(f):--c||e(u)}else--c||e(u)}}),i)}catch(t){return t.$isArrayValidatorError=!0,e(t)}},g.prototype.doValidateSync=function(t,e,r){var n=c.prototype.doValidateSync.call(this,t,e);if(null!=n)return n.$isArrayValidatorError=!0,n;var i=t&&t.length,s=null;if(i){for(var a=0,u=i;a<u;++a){var l=t[a];if(l){if(!(l instanceof o)){var f=v(this.casterConstructor,t[a]);l=t[a]=new f(l,t,void 0,void 0,a)}if(null==r||!r.validateModifiedOnly||l.isModified()){var p=l.validateSync();p&&null==s&&(s=p)}}}return s}},
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
g.prototype.getDefault=function(t){var e="function"==typeof this.defaultValue?this.defaultValue.call(t):this.defaultValue;if(null==e)return e;n||(n=r(18)),Array.isArray(e)||(e=[e]),e=new n(e,this.path,t);for(var o=0;o<e.length;++o){var i=new(v(this.casterConstructor,e[o]))({},e,void 0,void 0,o);i.init(e[o]),i.isNew=!0,Object.assign(i.$__.activePaths.default,i.$__.activePaths.init),i.$__.activePaths.init={},e[o]=i}return e},g.prototype.cast=function(t,e,i,a,u){if(n||(n=r(18)),null!=t&&null!=t[_]&&t===a)return t;var c,l,f={transform:!1,virtuals:!1};if(u=u||{},!Array.isArray(t)){if(!i&&!g.options.castNonArrays)throw new s("DocumentArray",y.inspect(t),this.path,null,this);return e&&i&&e.markModified(this.path),this.cast([t],e,i,a,u)}t&&t.isMongooseDocumentArray||u.skipDocumentArrayCast?t&&t.isMongooseDocumentArray&&(t=new n(t,this.path,e)):t=new n(t,this.path,e),null!=a&&(t[m]=a[m]||{}),null!=u.arrayPathIndex&&(t[_]=this.path+"."+u.arrayPathIndex);for(var p=t.length,h={skipId:!0,willInit:!0},w=0;w<p;++w)if(t[w]){var S=v(this.casterConstructor,t[w]);if(!t[w].$__||t[w]instanceof S&&t[w][b]===e||(t[w]=t[w].toObject({transform:!1,virtuals:t[w].schema===S.schema})),t[w]instanceof o)null==t[w].__index&&t[w].$setIndex(w);else if(null!=t[w])if(i)e?c||(c=O(this,e.$__.selected,i)):c=!0,l=new S(null,t,h,c,w),t[w]=l.init(t[w]);else if(a&&"function"==typeof a.id&&(l=a.id(t[w]._id)),a&&l&&d.deepEqual(l.toObject(f),t[w]))l.set(t[w]),t[w]=l;else try{l=new S(t[w],t,void 0,void 0,w),t[w]=l}catch(e){var j=y.inspect(t[w]);throw new s("embedded",j,t[_],e,this)}}return t},
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
g.prototype.clone=function(){var t=Object.assign({},this.options),e=new this.constructor(this.path,this.schema,t,this.schemaOptions);return e.validators=this.validators.slice(),void 0!==this.requiredValidator&&(e.requiredValidator=this.requiredValidator),e.Constructor.discriminators=Object.assign({},this.Constructor.discriminators),e},
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
g.prototype.applyGetters=function(t,e){return c.prototype.applyGetters.call(this,t,e)},g.defaultOptions={},g.set=c.set,
|
|
|
|
|
/*!
|
|
|
|
|
* Module exports.
|
|
|
|
|
*/
|
|
|
|
|
t.exports=g},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 o(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,i(n.key),n)}}function i(t){var e=function(t,e){if("object"!=n(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==n(e)?e:String(e)}function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function u(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 o=l(this).constructor;r=Reflect.construct(n,arguments,o)}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.bind():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&&a(t,e)}(c,t);var e,r,n,i=u(c);function c(){return s(this,c),i.apply(this,arguments)}return e=c,r&&o(e.prototype,r),n&&o(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(r(7)),p=r(8);Object.defineProperty(f.prototype,"enum",p),Object.defineProperty(f.prototype,"of",p),
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
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 o=t(e[n]);o.min<r.min&&(r.min=o.min),o.max>r.max&&(r.max=o.max),r.containsNonArrayItem=r.containsNonArrayItem||o.containsNonArrayItem}return r.min=r.min+1,r.max=r.max+1,r}},function(t,e,r){"use strict";
|
|
|
|
|
/*!
|
|
|
|
|
* Module dependencies.
|
|
|
|
|
*/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 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 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)}var s=r(13),a=r(35),u=r(58),c=r(175),l=r(3),f=r(25),p=r(176),h=r(89),y=r(4),d=r(21),v=r(32),m=["Polygon","MultiPolygon"];function _(t,e,r){if(Array.isArray(t))t.forEach((function(n,o){if(Array.isArray(n)||d(n))return _(n,e,r);t[o]=e.castForQueryWrapper({val:n,context:r})}));else for(var n=Object.keys(t),o=n.length;o--;){var i=n[o],s=t[i];Array.isArray(s)||d(s)?(_(s,e,r),t[i]=s):t[i]=e.castForQuery({val:s,context:r})}}t.exports=function t(e,r,o,b){if(Array.isArray(r))throw new Error("Query filter must be an object, got an array ",y.inspect(r));if(null==r)return r;r.hasOwnProperty("_bsontype")&&"ObjectID"!==r._bsontype&&delete r._bsontype,null!=e&&null!=e.discriminators&&null!=r[e.options.discriminatorKey]&&(e=p(e,r[e.options.discriminatorKey])||e);var g,w,O,S,j,A,E=Object.keys(r),$=E.length;for(o=o||{};$--;)if(A=r[S=E[$]],"$or"===S||"$nor"===S||"$and"===S){if(!Array.isArray(A))throw new s("Array",A,S);for(var P=0;P<A.length;++P){if(null==A[P]||"object"!==i(A[P]))throw new s("Object",A[P],S+"."+P);A[P]=t(e,A[P],o,b)}}else{if("$where"===S){if("string"!==(j=i(A))&&"function"!==j)throw new Error("Must have a string or function for $where");"function"===j&&(r[S]=A.toString());continue}if("$elemMatch"===S)A=t(e,A,o,b);else if("$text"===S)A=c(A,S);else{if(!e)continue;if(!(w=e.path(S)))for(var x=S.split("."),T=x.length;T--;){var N=x.slice(0,T).join("."),k=x.slice(T).join("."),B=e.path(N),R=l(B,"schema.options.discriminatorKey");if(null!=B&&null!=l(B,"schema.discriminators")&&null!=R&&k!==R){var C=l(r,N+"."+R);null!=C&&(w=B.schema.discriminators[C].path(k))}}if(w){if(null==A)continue;if("Object"===f(A))if(Object.keys(A).some(h))for(var D=Object.keys(A),M=void 0,I=D.length;I--;)if(O=A[M=D[I]],"$not"===M){if(O&&w&&!w.caster){if((g=Object.keys(O)).length&&h(g[0]))for(var F in O)O[F]=w.castForQueryWrapper({$conditional:F,val:O[F],context:b});else A[M]=w.castForQueryWrapper({$conditional:M,val:O,context:b});continue}t(w.caster?w.caster.schema:e,O,o,b)}else A[M]=w.castForQueryWrapper({$conditional:M,val:O,context:b});else r[S]=w.castForQueryWrapper({val:A,context:b});else if(Array.isArray(A)&&-1===["Buffer","Array"].indexOf(w.instance)){var U,L=[],V=n(A);try{for(V.s();!(U=V.n()).done;){var q=U.value;L.push(w.castForQueryWrapper({val:q,context:b}))}}catch(t){V.e(t)}finally{V.f()}r[S]={$in:L}}else r[S]=w.castForQueryWrapper({val:A,context:b})}else{for(var W=S.split("."),H=W.length,Y=void 0,K=void 0,z=void 0;H--&&(Y=W.slice(0,H).join("."),!(w=e.path(Y))););if(w){w.caster&&w.caster.schema?((z={})[K=W.slice(H).join(".")]=A,r[S]=t(w.caster.schema,z,o,b)[K]):r[S]=A;continue}if(d(A)){var Q="";if(A.$near?Q="$near":A.$nearSphere?Q="$nearSphere":A.$within?Q="$within":A.$geoIntersects?Q="$geoIntersects":A.$geoWithin&&(Q="$geoWithin"),Q){var J=new u.Number("__QueryCasting__"),G=A[Q];if(null!=A.$ma
|
|
|
|
|
/*!
|
|
|
|
|
* Casts val to an object suitable for `$text`. Throws an error if the object
|
|
|
|
|
* can't be casted.
|
|
|
|
|
*
|
|
|
|
|
* @param {Any} val value to cast
|
|
|
|
|
* @param {String} [path] path to associate with any errors that occured
|
|
|
|
|
* @return {Object} casted object
|
|
|
|
|
* @see https://docs.mongodb.com/manual/reference/operator/query/text/
|
|
|
|
|
* @api private
|
|
|
|
|
*/
|
|
|
|
|
t.exports=function(t,e){if(null==t||"object"!==n(t))throw new o("$text",t,e);return null!=t.$search&&(t.$search=s(t.$search,e+".$search")),null!=t.$language&&(t.$language=s(t.$language,e+".$language")),null!=t.$caseSensitive&&(t.$caseSensitive=i(t.$caseSensitive,e+".$castSensitive")),null!=t.$diacriticSensitive&&(t.$diacriticSensitive=i(t.$diacriticSensitive,e+".$diacriticSensitive")),t}},function(t,e,r){"use strict";var n=r(88);
|
|
|
|
|
/*!
|
|
|
|
|
* returns discriminator by discriminatorMapping.value
|
|
|
|
|
*
|
|
|
|
|
* @param {Schema} schema
|
|
|
|
|
* @param {string} value
|
|
|
|
|
*/t.exports=function(t,e){if(null==t||null==t.discriminators)return null;for(var r=0,o=Object.keys(t.discriminators);r<o.length;r++){var i=o[r],s=t.discriminators[i];if(null!=s.discriminatorMapping&&n(s.discriminatorMapping.value,e))return s}return null}},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 o(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,i(n.key),n)}}function i(t){var e=function(t,e){if("object"!=n(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==n(e)?e:String(e)}function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function u(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 o=l(this).constructor;r=Reflect.construct(n,arguments,o)}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.bind():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&&a(t,e)}(c,t);var e,r,n,i=u(c);function c(){return s(this,c),i.apply(this,arguments)}return e=c,r&&o(e.prototype,r),n&&o(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(r(7)),p=r(8);Object.defineProperty(f.prototype,"excludeIndexes",p),Object.defineProperty(f.prototype,"_id",p),
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
t.exports=f},function(t,e,r){"use strict";
|
|
|
|
|
/*!
|
|
|
|
|
* Module dependencies.
|
|
|
|
|
*/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 o,i=r(13),s=r(19).EventEmitter,a=r(81),u=r(179),c=r(6),l=r(54),f=r(37).castToNumber,p=r(99),h=r(90),y=r(3),d=r(101),v=r(100),m=r(17).internalToObjectOptions;function _(t,e,r){t=v(t,r),this.caster=b(t),this.caster.path=e,this.caster.prototype.$basePath=e,this.schema=t,this.$isSingleNested=!0,c.call(this,e,r,"Embedded")}
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
function b(t,e){o||(o=r(98));var n=function(t,e,r){var n=this;this.$__parent=r,o.apply(this,arguments),this.$session(this.ownerDocument().$session()),r&&(r.on("save",(function(){n.emit("save",n),n.constructor.emit("save",n)})),r.on("isNew",(function(t){n.isNew=t,n.emit("isNew",t),n.constructor.emit("isNew",t)})))},i=null!=e?e.prototype:o.prototype;for(var a in(n.prototype=Object.create(i)).$__setSchema(t),n.prototype.constructor=n,n.schema=t,n.$isSingleNested=!0,n.events=new s,n.prototype.toBSON=function(){return this.toObject(m)},t.methods)n.prototype[a]=t.methods[a];for(var u in t.statics)n[u]=t.statics[u];for(var c in s.prototype)n[c]=s.prototype[c];return n}
|
|
|
|
|
/*!
|
|
|
|
|
* Special case for when users use a common location schema to represent
|
|
|
|
|
* locations for use with $geoWithin.
|
|
|
|
|
* https://docs.mongodb.org/manual/reference/operator/query/geoWithin/
|
|
|
|
|
*
|
|
|
|
|
* @param {Object} val
|
|
|
|
|
* @api private
|
|
|
|
|
*/t.exports=_,_.prototype=Object.create(c.prototype),_.prototype.constructor=_,_.prototype.OptionsConstructor=u,_.prototype.$conditionalHandlers.$geoWithin=function(t){return{$geometry:this.castForQuery(t.$geometry)}},
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
_.prototype.$conditionalHandlers.$near=_.prototype.$conditionalHandlers.$nearSphere=h.cast$near,_.prototype.$conditionalHandlers.$within=_.prototype.$conditionalHandlers.$geoWithin=h.cast$within,_.prototype.$conditionalHandlers.$geoIntersects=h.cast$geoIntersects,_.prototype.$conditionalHandlers.$minDistance=f,_.prototype.$conditionalHandlers.$maxDistance=f,_.prototype.$conditionalHandlers.$exists=l,_.prototype.cast=function(t,e,r,o,i){if(t&&t.$isSingleNested&&t.parent===e)return t;if(null!=t&&("object"!==n(t)||Array.isArray(t)))throw new a(this.path,t);var s,u=d(this.caster,t),c=y(e,"$__.selected",{}),l=this.path,f=Object.keys(c).reduce((function(t,e){return e.startsWith(l+".")&&(t[e.substr(l.length+1)]=c[e]),t}),{});return i=Object.assign({},i,{priorDoc:o}),r?((s=new u(void 0,f,e)).init(t),s):0===Object.keys(t).length?new u({},f,e,void 0,i):new u(t,f,e,void 0,i)},_.prototype.castForQuery=function(t,e,r){var n;if(2===arguments.length){if(!(n=this.$conditionalHandlers[t]))throw new Error("Can't use "+t);return n.call(this,e)}if(null==(e=t))return e;this.options.runSetters&&(e=this._applySetters(e));var o=d(this.caster,e),s=null!=r&&null!=r.strict?r.strict:void 0;try{e=new o(e,s)}catch(t){if(!(t instanceof i))throw new i("Embedded",e,this.path,t,this);throw t}return e},_.prototype.doValidate=function(t,e,r,n){var o=d(this.caster,t);if(n&&n.skipSchemaValidators)return t instanceof o||(t=new o(t,null,r)),t.validate(e);c.prototype.doValidate.call(this,t,(function(r){return r?e(r):t?void t.validate(e):e(null)}),r,n)},_.prototype.doValidateSync=function(t,e,r){if(!r||!r.skipSchemaValidators){var n=c.prototype.doValidateSync.call(this,t,e);if(n)return n}if(t)return t.validateSync()},_.prototype.discriminator=function(t,e,r){return e=p(this.caster,t,e,r),this.caster.discriminators[t]=b(e,this.caster),this.caster.discriminators[t]},_.defaultOptions={},_.set=c.set,
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
_.prototype.clone=function(){var t=Object.assign({},this.options),e=new this.constructor(this.schema,this.path,t);return e.validators=this.validators.slice(),void 0!==this.requiredValidator&&(e.requiredValidator=this.requiredValidator),e.caster.discriminators=Object.assign({},this.caster.discriminators),e}},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 o(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,i(n.key),n)}}function i(t){var e=function(t,e){if("object"!=n(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==n(e)?e:String(e)}function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function u(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 o=l(this).constructor;r=Reflect.construct(n,arguments,o)}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.bind():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&&a(t,e)}(c,t);var e,r,n,i=u(c);function c(){return s(this,c),i.apply(this,arguments)}return e=c,r&&o(e.prototype,r),n&&o(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(r(7)),p=r(8);Object.defineProperty(f.prototype,"_id",p),t.exports=f},function(t,e,r){"use strict";(function(e){
|
|
|
|
|
/*!
|
|
|
|
|
* Module dependencies.
|
|
|
|
|
*/
|
|
|
|
|
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 o=r(94),i=r(181),s=r(6),a=r(87),u=r(1),c=o.Binary,l=s.CastError;function f(t,e){s.call(this,t,e,"Buffer")}
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
function p(t){return this.castForQuery(t)}f.schemaName="Buffer",f.defaultOptions={},
|
|
|
|
|
/*!
|
|
|
|
|
* Inherits from SchemaType.
|
|
|
|
|
*/
|
|
|
|
|
f.prototype=Object.create(s.prototype),f.prototype.constructor=f,f.prototype.OptionsConstructor=i,
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
f._checkRequired=function(t){return!(!t||!t.length)},f.set=s.set,f.checkRequired=s.checkRequired,f.prototype.checkRequired=function(t,e){return s._isRef(this,t,e,!0)?!!t:this.constructor._checkRequired(t)},f.prototype.cast=function(t,r,i){var a;if(s._isRef(this,t,r,i)){if(t&&t.isMongooseBuffer)return t;if(e.isBuffer(t))return t&&t.isMongooseBuffer||(t=new o(t,[this.path,r]),null!=this.options.subtype&&(t._subtype=this.options.subtype)),t;if(t instanceof c){if(a=new o(t.value(!0),[this.path,r]),"number"!=typeof t.sub_type)throw new l("Buffer",t,this.path,null,this);return a._subtype=t.sub_type,a}return this._castRef(t,r,i)}if(t&&t._id&&(t=t._id),t&&t.isMongooseBuffer)return t;if(e.isBuffer(t))return t&&t.isMongooseBuffer||(t=new o(t,[this.path,r]),null!=this.options.subtype&&(t._subtype=this.options.subtype)),t;if(t instanceof c){if(a=new o(t.value(!0),[this.path,r]),"number"!=typeof t.sub_type)throw new l("Buffer",t,this.path,null,this);return a._subtype=t.sub_type,a}if(null===t)return t;var u=n(t);if("string"===u||"number"===u||Array.isArray(t)||"object"===u&&"Buffer"===t.type&&Array.isArray(t.data))return"number"===u&&(t=[t]),a=new o(t,[this.path,r]),null!=this.options.subtype&&(a._subtype=this.options.subtype),a;throw new l("Buffer",t,this.path,null,this)},f.prototype.subtype=function(t){return this.options.subtype=t,this},f.prototype.$conditionalHandlers=u.options(s.prototype.$conditionalHandlers,{$bitsAllClear:a,$bitsAnyClear:a,$bitsAllSet:a,$bitsAnySet:a,$gt:p,$gte:p,$lt:p,$lte:p}),f.prototype.castForQuery=function(t,e){var r;if(2===arguments.length){if(!(r=this.$conditionalHandlers[t]))throw new Error("Can't use "+t+" with Buffer.");return r.call(this,e)}e=t;var n=this._castForQuery(e);return n?n.toObject({transform:!1,virtuals:!1}):n},
|
|
|
|
|
/*!
|
|
|
|
|
* Module exports.
|
|
|
|
|
*/
|
|
|
|
|
t.exports=f}).call(this,r(2).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)}function o(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,i(n.key),n)}}function i(t){var e=function(t,e){if("object"!=n(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==n(e)?e:String(e)}function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function u(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 o=l(this).constructor;r=Reflect.construct(n,arguments,o)}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.bind():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&&a(t,e)}(c,t);var e,r,n,i=u(c);function c(){return s(this,c),i.apply(this,arguments)}return e=c,r&&o(e.prototype,r),n&&o(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(r(7)),p=r(8);Object.defineProperty(f.prototype,"subtype",p),
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
t.exports=f},function(t,e,r){"use strict";
|
|
|
|
|
/*!
|
|
|
|
|
* Module requirements.
|
|
|
|
|
*/var n=r(5),o=r(183),i=r(6),s=r(184),a=r(25),u=r(1),c=i.CastError;function l(t,e){i.call(this,t,e,"Date")}
|
|
|
|
|
/*!
|
|
|
|
|
* Date Query casting.
|
|
|
|
|
*
|
|
|
|
|
* @api private
|
|
|
|
|
*/
|
|
|
|
|
function f(t){return this.cast(t)}l.schemaName="Date",l.defaultOptions={},
|
|
|
|
|
/*!
|
|
|
|
|
* Inherits from SchemaType.
|
|
|
|
|
*/
|
|
|
|
|
l.prototype=Object.create(i.prototype),l.prototype.constructor=l,l.prototype.OptionsConstructor=o,
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
l._cast=s,l.set=i.set,l.cast=function(t){return 0===arguments.length||(!1===t&&(t=this._defaultCaster),this._cast=t),this._cast},
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
l._defaultCaster=function(t){if(null!=t&&!(t instanceof Date))throw new Error;return t},l.prototype.expires=function(t){return"Object"!==a(this._index)&&(this._index={}),this._index.expires=t,u.expires(this._index),this},
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
l._checkRequired=function(t){return t instanceof Date},l.checkRequired=i.checkRequired,l.prototype.checkRequired=function(t,e){return i._isRef(this,t,e,!0)?!!t:("function"==typeof this.constructor.checkRequired?this.constructor.checkRequired():l.checkRequired())(t)},l.prototype.min=function(t,e){if(this.minValidator&&(this.validators=this.validators.filter((function(t){return t.validator!==this.minValidator}),this)),t){var r=e||n.messages.Date.min;"string"==typeof r&&(r=r.replace(/{MIN}/,t===Date.now?"Date.now()":t.toString()));var o=this;this.validators.push({validator:this.minValidator=function(e){var r=t;"function"==typeof t&&t!==Date.now&&(r=r.call(this));var n=r===Date.now?r():o.cast(r);return null===e||e.valueOf()>=n.valueOf()},message:r,type:"min",min:t})}return this},l.prototype.max=function(t,e){if(this.maxValidator&&(this.validators=this.validators.filter((function(t){return t.validator!==this.maxValidator}),this)),t){var r=e||n.messages.Date.max;"string"==typeof r&&(r=r.replace(/{MAX}/,t===Date.now?"Date.now()":t.toString()));var o=this;this.validators.push({validator:this.maxValidator=function(e){var r=t;"function"==typeof r&&r!==Date.now&&(r=r.call(this));var n=r===Date.now?r():o.cast(r);return null===e||e.valueOf()<=n.valueOf()},message:r,type:"max",max:t})}return this},l.prototype.cast=function(t){var e;e="function"==typeof this._castFunction?this._castFunction:"function"==typeof this.constructor.cast?this.constructor.cast():l.cast();try{return e(t)}catch(e){throw new c("date",t,this.path,e,this)}},l.prototype.$conditionalHandlers=u.options(i.prototype.$conditionalHandlers,{$gt:f,$gte:f,$lt:f,$lte:f}),l.prototype.castForQuery=function(t,e){if(2!==arguments.length)return this._castForQuery(t);var r=this.$conditionalHandlers[t];if(!r)throw new Error("Can't use "+t+" with Date.");return r.call(this,e)},
|
|
|
|
|
/*!
|
|
|
|
|
* Module exports.
|
|
|
|
|
*/
|
|
|
|
|
t.exports=l},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 o(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,i(n.key),n)}}function i(t){var e=function(t,e){if("object"!=n(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==n(e)?e:String(e)}function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function u(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 o=l(this).constructor;r=Reflect.construct(n,arguments,o)}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.bind():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&&a(t,e)}(c,t);var e,r,n,i=u(c);function c(){return s(this,c),i.apply(this,arguments)}return e=c,r&&o(e.prototype,r),n&&o(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(r(7)),p=r(8);Object.defineProperty(f.prototype,"min",p),Object.defineProperty(f.prototype,"max",p),Object.defineProperty(f.prototype,"expires",p),
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
t.exports=f},function(t,e,r){"use strict";var n=r(23);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";
|
|
|
|
|
/*!
|
|
|
|
|
* Module dependencies.
|
|
|
|
|
*/var n,o=r(186),i=r(6),s=r(95),a=r(25),u=r(11),c=r(1),l=i.CastError;function f(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||(console.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."),console.trace()),i.call(this,t,e,"ObjectID")}
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
function p(t){return this.cast(t)}
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
function h(){return new u}function y(t){if(n||(n=r(12)),this instanceof n){if(void 0===t){var e=new u;return this.$__._id=e,e}this.$__._id=t}return t}
|
|
|
|
|
/*!
|
|
|
|
|
* Module exports.
|
|
|
|
|
*/f.schemaName="ObjectId",f.defaultOptions={},
|
|
|
|
|
/*!
|
|
|
|
|
* Inherits from SchemaType.
|
|
|
|
|
*/
|
|
|
|
|
f.prototype=Object.create(i.prototype),f.prototype.constructor=f,f.prototype.OptionsConstructor=o,f.get=i.get,f.set=i.set,f.prototype.auto=function(t){return t&&(this.default(h),this.set(y)),this},
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
f._checkRequired=function(t){return t instanceof u},
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
f._cast=s,f.cast=function(t){return 0===arguments.length||(!1===t&&(t=this._defaultCaster),this._cast=t),this._cast},
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
f._defaultCaster=function(t){if(!(t instanceof u))throw new Error(t+" is not an instance of ObjectId");return t},f.checkRequired=i.checkRequired,f.prototype.checkRequired=function(t,e){return i._isRef(this,t,e,!0)?!!t:("function"==typeof this.constructor.checkRequired?this.constructor.checkRequired():f.checkRequired())(t)},f.prototype.cast=function(t,e,r){if(i._isRef(this,t,e,r))return t instanceof u?t:"objectid"===(a(t)||"").toLowerCase()?new u(t.toHexString()):this._castRef(t,e,r);var n;n="function"==typeof this._castFunction?this._castFunction:"function"==typeof this.constructor.cast?this.constructor.cast():f.cast();try{return n(t)}catch(e){throw new l("ObjectId",t,this.path,e,this)}},f.prototype.$conditionalHandlers=c.options(i.prototype.$conditionalHandlers,{$gt:p,$gte:p,$lt:p,$lte:p}),h.$runBeforeSetters=!0,t.exports=f},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 o(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,i(n.key),n)}}function i(t){var e=function(t,e){if("object"!=n(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==n(e)?e:String(e)}function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function u(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 o=l(this).constructor;r=Reflect.construct(n,arguments,o)}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.bind():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&&a(t,e)}(c,t);var e,r,n,i=u(c);function c(){return s(this,c),i.apply(this,arguments)}return e=c,r&&o(e.prototype,r),n&&o(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(r(7)),p=r(8);Object.defineProperty(f.prototype,"auto",p),Object.defineProperty(f.prototype,"populate",p),
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
t.exports=f},function(t,e,r){"use strict";
|
|
|
|
|
/*!
|
|
|
|
|
* Module dependencies.
|
|
|
|
|
*/var n=r(6),o=n.CastError,i=r(20),s=r(188),a=r(1);function u(t,e){n.call(this,t,e,"Decimal128")}
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
function c(t){return this.cast(t)}u.schemaName="Decimal128",u.defaultOptions={},
|
|
|
|
|
/*!
|
|
|
|
|
* Inherits from SchemaType.
|
|
|
|
|
*/
|
|
|
|
|
u.prototype=Object.create(n.prototype),u.prototype.constructor=u,
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
u._cast=s,u.set=n.set,u.cast=function(t){return 0===arguments.length||(!1===t&&(t=this._defaultCaster),this._cast=t),this._cast},
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
u._defaultCaster=function(t){if(null!=t&&!(t instanceof i))throw new Error;return t},
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
u._checkRequired=function(t){return t instanceof i},u.checkRequired=n.checkRequired,u.prototype.checkRequired=function(t,e){return n._isRef(this,t,e,!0)?!!t:("function"==typeof this.constructor.checkRequired?this.constructor.checkRequired():u.checkRequired())(t)},u.prototype.cast=function(t,e,r){if(n._isRef(this,t,e,r))return t instanceof i?t:this._castRef(t,e,r);var s;s="function"==typeof this._castFunction?this._castFunction:"function"==typeof this.constructor.cast?this.constructor.cast():u.cast();try{return s(t)}catch(e){throw new o("Decimal128",t,this.path,e,this)}},u.prototype.$conditionalHandlers=a.options(n.prototype.$conditionalHandlers,{$gt:c,$gte:c,$lt:c,$lte:c}),
|
|
|
|
|
/*!
|
|
|
|
|
* Module exports.
|
|
|
|
|
*/
|
|
|
|
|
t.exports=u},function(t,e,r){"use strict";(function(e){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 o=r(20),i=r(23);t.exports=function(t){return null==t?t:"object"===n(t)&&"string"==typeof t.$numberDecimal?o.fromString(t.$numberDecimal):t instanceof o?t:"string"==typeof t?o.fromString(t):e.isBuffer(t)?new o(t):"number"==typeof t?o.fromString(String(t)):"function"==typeof t.valueOf&&"string"==typeof t.valueOf()?o.fromString(t.valueOf()):void i.ok(!1)}}).call(this,r(2).Buffer)},function(t,e,r){"use strict";(function(e){
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
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 o(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 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,a(n.key),n)}}function a(t){var e=function(t,e){if("object"!=n(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==n(e)?e:String(e)}function u(){return(u="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,r){var n=c(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(arguments.length<3?t:r):o.value}}).apply(this,arguments)}function c(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=h(t)););return t}function l(t,e){return(l=Object.setPrototypeOf?Object.setPrototypeOf.bind():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=h(t);if(e){var o=h(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return p(this,r)}}function p(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.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var y=r(96),d=r(190),v=r(6),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&&l(t,e)}(c,t);var r,n,i,a=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=a.call(this,t,e,"Map")).$isSchemaMap=!0,r}return r=c,(n=[{key:"set",value:function(t,e){return v.set(t,e)}},{key:"cast",value:function(t,r,n){if(t instanceof y)return t;var i=this.path;if(n){var s=new y({},i,r,this.$__schemaType);if(t instanceof e.Map){var a,u=o(t.keys());try{for(u.s();!(a=u.n()).done;){var c=a.value,l=t.get(c);l=null==l?s.$__schemaType._castNullish(l):s.$__schemaType.cast(l,r,!0,null,{path:i+"."+c}),s.$init(c,l)}}catch(t){u.e(t)}finally{u.f()}}else for(var f=0,p=Object.keys(t);f<p.length;f++){var h=p[f],d=t[h];d=null==d?s.$__sch
|
|
|
|
|
/*!
|
|
|
|
|
* Module dependencies.
|
|
|
|
|
*/
|
|
|
|
|
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 o=r(15).get().Binary,i=r(20),s=r(11),a=r(32);
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
function u(e){return e&&"object"===n(e)&&!(e instanceof Date)&&!(e instanceof s)&&(!Array.isArray(e)||e.length>0)&&!(e instanceof t)&&!(e instanceof i)&&!(e instanceof o)}e.flatten=
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
function e(r,n,o,i){var s;s=r&&a(r)&&!t.isBuffer(r)?Object.keys(r.toObject({transform:!1,virtuals:!1})):Object.keys(r||{});var c=s.length,l={};n=n?n+".":"";for(var f=0;f<c;++f){var p=s[f],h=r[p];l[n+p]=h;var y=i&&i.path&&i.path(n+p),d=i&&i.nested&&i.nested[n+p];if(!y||"Mixed"!==y.instance){if(u(h)){if(o&&o.skipArrays&&Array.isArray(h))continue;var v=e(h,n+p,o,i);for(var m in v)l[m]=v[m];Array.isArray(h)&&(l[n+p]=h)}if(d)for(var _=Object.keys(i.paths),b=0,g=_;b<g.length;b++){var w=g[b];w.startsWith(n+p+".")&&!l.hasOwnProperty(w)&&(l[w]=void 0)}}}return l}
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/,e.modifiedPaths=function e(r,n,o){var i=Object.keys(r||{}),s=i.length;o=o||{},n=n?n+".":"";for(var c=0;c<s;++c){var l=i[c],f=r[l];o[n+l]=!0,a(f)&&!t.isBuffer(f)&&(f=f.toObject({transform:!1,virtuals:!1})),u(f)&&e(f,n+l,o)}return o}}).call(this,r(2).Buffer)},function(t,e,r){"use strict";var n=r(3);
|
|
|
|
|
/*!
|
|
|
|
|
* Like `schema.path()`, except with a document, because impossible to
|
|
|
|
|
* determine path type without knowing the embedded discriminator key.
|
|
|
|
|
*/t.exports=function t(e,r,o){for(var i=(o=o||{}).typeOnly,s=r.split("."),a=null,u="adhocOrUndefined",c=0;c<s.length;++c){var l=s.slice(0,c+1).join(".");if(null!=(a=e.schema.path(l))){if("Mixed"===a.instance)return i?"real":a;if(u=e.schema.pathType(l),(a.$isSingleNested||a.$isMongooseDocumentArrayElement)&&null!=a.schema.discriminators){var f=a.schema.discriminators,p=e.get(l+"."+n(a,"schema.options.discriminatorKey"));if(null==p||null==f[p])continue;var h=s.slice(c+1).join(".");return t(e.get(l),h,o)}}else u="adhocOrUndefined"}return i?u:a}},function(t,e,r){"use strict";
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
/*!
|
|
|
|
|
* Returns this documents _id cast to a string.
|
|
|
|
|
*/
|
|
|
|
|
function n(){return null!=this._id?String(this._id):null}t.exports=function(t){!t.paths.id&&!t.options.noVirtualId&&t.options.id&&t.virtual("id").get(n)}},function(t,e,r){"use strict";var n=r(61);
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/t.exports=function(t){if(null==t)return null;var e=Object.keys(t),r=e.length,o=null;if(1===r&&"_id"===e[0])o=!!t[e[r]];else for(;r--;)if("_id"!==e[r]&&n(t[e[r]])){o=!t[e[r]];break}return o}},function(t,e,r){"use strict";
|
|
|
|
|
/*!
|
|
|
|
|
* Module dependencies
|
|
|
|
|
*/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 o(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 s=r(196),a=r(3),u=r(38),c=r(61),l=r(27);
|
|
|
|
|
/*!
|
|
|
|
|
* Set each path query option to lean
|
|
|
|
|
*
|
|
|
|
|
* @param {Object} option
|
|
|
|
|
*/
|
|
|
|
|
function f(t){return function(e){e.options||(e.options={}),null!=t&&Array.isArray(t.virtuals)&&((t=Object.assign({},t)).virtuals=t.virtuals.filter((function(t){return"string"==typeof t&&t.startsWith(e.path+".")})).map((function(t){return t.slice(e.path.length+1)}))),e.options.lean=t}}
|
|
|
|
|
/*!
|
|
|
|
|
* Handle the `WriteOpResult` from the server
|
|
|
|
|
*/
|
|
|
|
|
/*!
|
|
|
|
|
* Prepare a set of path options for query population.
|
|
|
|
|
*
|
|
|
|
|
* @param {Query} query
|
|
|
|
|
* @param {Object} options
|
|
|
|
|
* @return {Array}
|
|
|
|
|
*/
|
|
|
|
|
e.preparePopulationOptions=function(t,e){var r=t.options.populate,n=Object.keys(r).reduce((function(t,e){return t.concat([r[e]])}),[]);return null!=e.lean&&n.filter((function(t){return null==a(t,"options.lean")})).forEach(f(e.lean)),n.forEach((function(e){e._localModel=t.model})),n},
|
|
|
|
|
/*!
|
|
|
|
|
* Prepare a set of path options for query population. This is the MongooseQuery
|
|
|
|
|
* version
|
|
|
|
|
*
|
|
|
|
|
* @param {Query} query
|
|
|
|
|
* @param {Object} options
|
|
|
|
|
* @return {Array}
|
|
|
|
|
*/
|
|
|
|
|
e.preparePopulationOptionsMQ=function(t,e){var r=t._mongooseOptions.populate,n=Object.keys(r).reduce((function(t,e){return t.concat([r[e]])}),[]);null!=e.lean&&n.filter((function(t){return null==a(t,"options.lean")})).forEach(f(e.lean));var o=a(t,"options.session",null);null!=o&&n.forEach((function(t){null!=t.options?"session"in t.options||(t.options.session=o):t.options={session:o}}));var i=t._fieldsForExec();return n.forEach((function(t){t._queryProjection=i})),n.forEach((function(e){e._localModel=t.model})),n},
|
|
|
|
|
/*!
|
|
|
|
|
* If the document is a mapped discriminator type, it returns a model instance for that type, otherwise,
|
|
|
|
|
* it returns an instance of the given model.
|
|
|
|
|
*
|
|
|
|
|
* @param {Model} model
|
|
|
|
|
* @param {Object} doc
|
|
|
|
|
* @param {Object} fields
|
|
|
|
|
*
|
|
|
|
|
* @return {Document}
|
|
|
|
|
*/
|
|
|
|
|
e.createModel=function(t,r,n,o,i){t.hooks.execPreSync("createModel",r);var s=t.schema?t.schema.discriminatorMapping:null,a=s&&s.isRoot?s.key:null,c=r[a];if(a&&c&&t.discriminators){var f=t.discriminators[c]||u(t.discriminators,c);if(f){var p=l(o);return e.applyPaths(p,f.schema),new f(void 0,p,!0)}}return void 0===i&&((i={}).defaults=!0),new t(void 0,n,{skipId:!0,isNew:!1,willInit:!0,defaults:i.defaults})},
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
e.applyPaths=function(t,e){var r,i,u;if(t)for(u=(i=Object.keys(t)).length;u--;)if("+"!==i[u][0]){var l=t[i[u]];if(c(l)){r=!l;break}}var f=[],p=[],h=[];switch(function e(n,o){if(o||(o=""),-1!==h.indexOf(n))return[];h.push(n);var i=[];return n.eachPath((function(n,a){o&&(n=o+"."+n);var u=E(n,a);if(null==u&&a.$isMongooseArray&&!a.$isMongooseDocumentArray&&(u=E(n,a.caster)),null!=u&&i.push(u),a.schema){var c=e(a.schema,n);!1===r&&s(t,n,a.schema,f,c)}})),h.pop(),i}(e),r){case!0:var y,d=o(p);try{for(d.s();!(y=d.n()).done;){var v=y.value;t[v]=0}}catch(t){d.e(t)}finally{d.f()}break;case!1:e&&e.paths._id&&e.paths._id.options&&!1===e.paths._id.options.select&&(t._id=0);var m,_=o(f);try{for(_.s();!(m=_.n()).done;){var b=m.value;t[b]=t[b]||1}}catch(t){_.e(t)}finally{_.f()}break;case void 0:if(null==t)break;for(var g=0,w=Object.keys(t||{});g<w.length;g++){var O=w[g];O.startsWith("+")&&delete t[O]}var S,j=o(p);try{for(j.s();!(S=j.n()).done;){var A=S.value;t[A]=0}}catch(t){j.e(t)}finally{j.f()}}function E(e,o){var s="+"+e,u=t&&s in t;if(u&&delete t[s],"boolean"==typeof o.selected){if(u)return delete t[s],void(!1===r&&i.length>1&&!~i.indexOf(e)&&(t[e]=1));for(var c=e.split("."),l="",h=0;h<c.length;++h)if(l+=l.length?"."+c[h]:c[h],-1!==p.indexOf(l))return;if(!r&&a(o,"options.$skipDiscriminatorCheck",!1))for(var y="",d=0;d<c.length;++d){y+=(0===y.length?"":".")+c[d];var v=a(t,y,!1)||a(t,y+".$",!1);if(v&&"object"!==n(v))return}return(o.selected?f:p).push(e),e}}},e.handleDeleteWriteOpResult=function(t){return function(e,r){if(e)return t(e);var n=Object.assign({},r.result);return null!=a(r,"result.n",null)&&(n.deletedCount=r.result.n),null!=r.deletedCount&&(n.deletedCount=r.deletedCount),t(null,n)}}},function(t,e,r){"use strict";t.exports=function(t,e,r,n,o){var i=Object.keys(t).reduce((function(t,r){return t||r.startsWith(e+".")}),!1),s=e+"."+r.options.discriminatorKey;i||1!==o.length||o[0]!==s||n.splice(n.indexOf(s),1)}},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)}t.exports=function(t){return!!t&&("object"===n(t)||"function"==typeof t)&&"function"==typeof t.then}},function(t,e,r){"use strict";
|
|
|
|
|
/*!
|
|
|
|
|
* Module dependencies.
|
|
|
|
|
*/var n=r(12),o=r(19).EventEmitter,i=r(5),s=r(56),a=r(11),u=i.ValidationError,c=r(84),l=r(21);function f(t,e,r,o,u){if(!(this instanceof f))return new f(t,e,r,o,u);if(l(e)&&!e.instanceOfSchema&&(e=new s(e)),e=this.schema||e,!this.schema&&e.options._id&&void 0===(t=t||{})._id&&(t._id=new a),!e)throw new i.MissingSchemaError;for(var p in this.$__setSchema(e),n.call(this,t,r,o,u),c(this,e,{decorateDoc:!0}),e.methods)this[p]=e.methods[p];for(var h in e.statics)this[h]=e.statics[h]}
|
|
|
|
|
/*!
|
|
|
|
|
* Inherit from the NodeJS document
|
|
|
|
|
*/f.prototype=Object.create(n.prototype),f.prototype.constructor=f,
|
|
|
|
|
/*!
|
|
|
|
|
* ignore
|
|
|
|
|
*/
|
|
|
|
|
f.events=new o,
|
|
|
|
|
/*!
|
|
|
|
|
* Browser doc exposes the event emitter API
|
|
|
|
|
*/
|
|
|
|
|
f.$emitter=new o,["on","once","emit","listeners","removeListener","setMaxListeners","removeAllListeners","addListener"].forEach((function(t){f[t]=function(){return f.$emitter[t].apply(f.$emitter,arguments)}})),
|
|
|
|
|
/*!
|
|
|
|
|
* Module exports.
|
|
|
|
|
*/
|
|
|
|
|
f.ValidationError=u,t.exports=f}])}));
|