mongoose 6.2.2 → 6.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.lgtm.yml +3 -0
- package/CHANGELOG.md +53 -0
- package/dist/browser.umd.js +78 -74
- package/lib/document.js +31 -26
- package/lib/helpers/document/cleanModifiedSubpaths.js +1 -0
- package/lib/helpers/indexes/decorateDiscriminatorIndexOptions.js +14 -0
- package/lib/helpers/indexes/getRelatedIndexes.js +59 -0
- package/lib/helpers/isAsyncFunction.js +6 -7
- package/lib/helpers/isSimpleValidator.js +22 -0
- package/lib/helpers/populate/assignVals.js +15 -3
- package/lib/helpers/populate/getModelsMapForPopulate.js +1 -1
- package/lib/helpers/query/castUpdate.js +21 -6
- package/lib/helpers/query/hasDollarKeys.js +7 -3
- package/lib/helpers/schema/getIndexes.js +6 -2
- package/lib/index.js +38 -2
- package/lib/internal.js +9 -1
- package/lib/model.js +41 -55
- package/lib/query.js +11 -11
- package/lib/queryhelpers.js +0 -20
- package/lib/schema/SubdocumentPath.js +1 -1
- package/lib/schema/array.js +1 -0
- package/lib/schema/documentarray.js +5 -4
- package/lib/schema.js +4 -0
- package/lib/schematype.js +23 -23
- package/lib/types/ArraySubdocument.js +1 -1
- package/lib/types/map.js +1 -1
- package/lib/utils.js +9 -3
- package/package.json +16 -18
- package/types/connection.d.ts +212 -0
- package/types/cursor.ts +48 -0
- package/types/error.d.ts +129 -0
- package/types/index.d.ts +65 -583
- package/types/{PipelineStage.d.ts → pipelinestage.d.ts} +0 -0
- package/types/schemaoptions.d.ts +183 -0
package/dist/browser.umd.js
CHANGED
|
@@ -36,7 +36,7 @@ e.toCollectionName=function(t,e){return"system.profile"===t||"system.indexes"===
|
|
|
36
36
|
* @return {Boolean}
|
|
37
37
|
* @api private
|
|
38
38
|
*/
|
|
39
|
-
e.deepEqual=function r(n,i){if(n===i)return!0;if("object"!==s(n)
|
|
39
|
+
e.deepEqual=function r(n,i){if(n===i)return!0;if("object"!==s(n)||"object"!==s(i))return n===i;if(n instanceof Date&&i instanceof Date)return n.getTime()===i.getTime();if(v(n,"ObjectID")&&v(i,"ObjectID")||v(n,"Decimal128")&&v(i,"Decimal128"))return n.toString()===i.toString();if(n instanceof RegExp&&i instanceof RegExp)return n.source===i.source&&n.ignoreCase===i.ignoreCase&&n.multiline===i.multiline&&n.global===i.global&&n.dotAll===i.dotAll&&n.unicode===i.unicode&&n.sticky===i.sticky&&n.hasIndices===i.hasIndices;if(null==n||null==i)return!1;if(n.prototype!==i.prototype)return!1;if(n instanceof Map||i instanceof Map)return n instanceof Map&&i instanceof Map&&(r(Array.from(n.keys()),Array.from(i.keys()))&&r(Array.from(n.values()),Array.from(i.values())));if(n instanceof Number&&i instanceof Number)return n.valueOf()===i.valueOf();if(t.isBuffer(n))return e.buffer.areEqual(n,i);if(Array.isArray(n)||Array.isArray(i)){if(!Array.isArray(n)||!Array.isArray(i))return!1;var o=n.length;if(o!==i.length)return!1;for(var a=0;a<o;++a)if(!r(n[a],i[a]))return!1;return!0}null!=n.$__?n=n._doc:w(n)&&(n=n.toObject()),null!=i.$__?i=i._doc:w(i)&&(i=i.toObject());var u=Object.keys(n),h=Object.keys(i),f=u.length;if(f!==h.length)return!1;for(var c=f-1;c>=0;c--)if(u[c]!==h[c])return!1;for(var l=0,d=u;l<d.length;l++){var p=d[l];if(!r(n[p],i[p]))return!1}return!0},
|
|
40
40
|
/*!
|
|
41
41
|
* Get the last element of an array
|
|
42
42
|
*/
|
|
@@ -229,18 +229,18 @@ e.noop=function(){},e.errorToPOJO=function(t){if(!(t instanceof Error))throw new
|
|
|
229
229
|
e.warn=function(t){return n.emitWarning(t,{code:"MONGOOSE"})}}).call(this,r(3).Buffer,r(5))},function(t,e){var r,n,i=t.exports={};function o(){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===o||!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:o}catch(t){r=o}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(t){n=s}}();var u,h=[],f=!1,c=-1;function l(){f&&u&&(f=!1,u.length?h=u.concat(h):c=-1,h.length&&d())}function d(){if(!f){var t=a(l);f=!0;for(var e=h.length;e;){for(u=h,h=[];++c<e;)u&&u[c].run();c=-1,e=h.length}u=null,f=!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 p(t,e){this.fun=t,this.array=e}function y(){}i.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];h.push(new p(t,e)),1!==h.length||f||a(d)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=y,i.addListener=y,i.once=y,i.off=y,i.removeListener=y,i.removeAllListeners=y,i.emit=y,i.prependListener=y,i.prependOnceListener=y,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 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,r){"use strict";var n=r(19);
|
|
230
230
|
/*!
|
|
231
231
|
* Module exports.
|
|
232
|
-
*/t.exports=n,n.messages=r(291),n.Messages=n.messages,n.DocumentNotFoundError=r(292),n.CastError=r(20),n.ValidationError=r(151),n.ValidatorError=r(152),n.VersionError=r(293),n.ParallelSaveError=r(294),n.OverwriteModelError=r(295),n.MissingSchemaError=r(296),n.MongooseServerSelectionError=r(297),n.DivergentArrayError=r(301),n.StrictModeError=r(44)},function(t,e,r){
|
|
232
|
+
*/t.exports=n,n.messages=r(291),n.Messages=n.messages,n.DocumentNotFoundError=r(292),n.CastError=r(20),n.ValidationError=r(151),n.ValidatorError=r(152),n.VersionError=r(293),n.ParallelSaveError=r(294),n.OverwriteModelError=r(295),n.MissingSchemaError=r(296),n.MongooseServerSelectionError=r(297),n.DivergentArrayError=r(301),n.StrictModeError=r(44)},function(t,e,r){"use strict";(function(n){
|
|
233
233
|
/*!
|
|
234
234
|
* Module dependencies.
|
|
235
235
|
*/
|
|
236
|
-
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 o=r(7),s=r(15),a=r(83),u=r(153),h=r(302),f=r(303),c=r(
|
|
236
|
+
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 o=r(7),s=r(15),a=r(83),u=r(153),h=r(302),f=r(303),c=r(304),l=r(42),d=r(1).schemaTypeSymbol,p=r(4),y=r(1).validatorErrorSymbol,m=r(1).documentIsModified,b=r(1).populateModelSymbol,v=o.CastError,g=o.ValidatorError;function w(t,e,r){this[d]=!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||{},o=0,a=Object.keys(n);o<a.length;o++){var u=a[o];n.hasOwnProperty(u)&&!e.hasOwnProperty(u)&&(e[u]=n[u])}null==e.select&&delete e.select;var f=this.OptionsConstructor||s;this.options=new f(e),this._index=null,p.hasUserDefinedProperty(this.options,"immutable")&&(this.$immutable=this.options.immutable,h(this));for(var c=0,l=Object.keys(this.options);c<l.length;c++){var y=l[c];if("cast"!==y){if(p.hasUserDefinedProperty(this.options,y)&&"function"==typeof this[y]){if("index"===y&&this._index){if(!1===e.index){var m=this._index;if("object"===i(m)&&null!=m){if(m.unique)throw new Error('Path "'+this.path+'" may not have `index` set to false and `unique` set to true');if(m.sparse)throw new Error('Path "'+this.path+'" may not have `index` set to false and `sparse` set to true')}this._index=!1}continue}var b=e[y];if("default"===y){this.default(b);continue}var v=Array.isArray(b)?b:[b];this[y].apply(this,v)}}else this.castFunction(this.options[y])}Object.defineProperty(this,"$$context",{enumerable:!1,configurable:!1,writable:!0,value:null})}
|
|
237
237
|
/*!
|
|
238
238
|
* The class that Mongoose uses internally to instantiate this SchemaType's `options` property.
|
|
239
|
-
*/function
|
|
239
|
+
*/function _(t,e){if(void 0!==t&&!t){var r=new(e.ErrorConstructor||g)(e);return r[y]=!0,r}}
|
|
240
240
|
/*!
|
|
241
241
|
* ignore
|
|
242
242
|
*/
|
|
243
|
-
function
|
|
243
|
+
function M(t){return this.castForQuery(t)}
|
|
244
244
|
/*!
|
|
245
245
|
* ignore
|
|
246
246
|
*/
|
|
@@ -248,49 +248,49 @@ function _(t){return this.castForQuery(t)}
|
|
|
248
248
|
* Just like handleArray, except also allows `[]` because surprisingly
|
|
249
249
|
* `$in: [1, []]` works fine
|
|
250
250
|
*/
|
|
251
|
-
function
|
|
251
|
+
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)]}
|
|
252
252
|
/*!
|
|
253
253
|
* ignore
|
|
254
|
-
*/
|
|
254
|
+
*/w.prototype.OptionsConstructor=s,w.prototype.path,w.prototype.validators,w.prototype.validators,
|
|
255
255
|
/*!
|
|
256
256
|
* ignore
|
|
257
257
|
*/
|
|
258
|
-
|
|
258
|
+
w.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},w.cast=function(t){return 0===arguments.length||(!1===t&&(t=function(t){return t}),this._cast=t),this._cast},w.prototype.castFunction=function(t){return 0===arguments.length||(!1===t&&(t=this.constructor._defaultCaster||function(t){return t}),this._castFunction=t),this._castFunction},w.prototype.cast=function(){throw new Error("Base SchemaType class does not implement a `cast()` function")},w.set=function(t,e){this.hasOwnProperty("defaultOptions")||(this.defaultOptions=Object.assign({},this.defaultOptions)),this.defaultOptions[t]=e},w.get=function(t){this.getters=this.hasOwnProperty("getters")?this.getters:[],this.getters.push(t)},w.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 o("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=Array.prototype.slice.call(arguments)),this.defaultValue},w.prototype.index=function(t){return this._index=t,p.expires(this._index),this},w.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 this.options.hasOwnProperty("index")||!1!==t?(null==this._index||!0===this._index?this._index={}:"string"==typeof this._index&&(this._index={type:this._index}),this._index.unique=t,this):this},w.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 this.options.hasOwnProperty("index")||!1!==t?(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):this},w.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 this.options.hasOwnProperty("index")||!1!==t?(null==this._index||"boolean"==typeof this._index?this._index={}:"string"==typeof this._index&&(this._index={type:this._index}),this._index.sparse=t,this):this},w.prototype.immutable=function(t){return this.$immutable=t,h(this),this},w.prototype.transform=function(t){return this.options.transform=t,this},w.prototype.set=function(t){if("function"!=typeof t)throw new TypeError("A setter must be a function.");return this.setters.push(t),this},w.prototype.get=function(t){if("function"!=typeof t)throw new TypeError("A getter must be a function.");return this.getters.push(t),this},w.prototype.validate=function(t,e,r){var n,s,a,u;if("function"==typeof t||t&&"RegExp"===p.getFunctionName(t.constructor))return"function"==typeof e?(n={validator:t,message:e}).type=r||"user defined":e instanceof Object&&!r?((n=c(e)?Object.assign({},e):p.clone(e)).message||(n.message=n.msg),n.validator=t,n.type=n.type||"user defined"):(null==e&&(e=o.messages.general.default),r||(r="user defined"),n={message:e,type:r,validator:t}),this.validators.push(n),this;for(s=0,a=arguments.length;s<a;s++){if(u=arguments[s],!p.isPOJO(u)){var h="Invalid validator. Received ("+i(u)+") "+u+". See https://mongoosejs.com/docs/api.html#schematype_SchemaType-validate";throw new Error(h)}this.validate(u.validator,u)}return this},w.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"===i(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=this&&this.$__&&this.$__.cachedRequired;if(null!=r&&!this.$__isSelected(n.path)&&!this[m](n.path))return!0;if(null!=r&&n.path in r){var i=!r[n.path]||n.checkRequired(e,this);return delete r[n.path],i}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||o.messages.general.required;return this.validators.unshift(Object.assign({},r,{validator:this.requiredValidator,message:s,type:"required"})),this},w.prototype.ref=function(t){return this.options.ref=t,this},w.prototype.getDefault=function(t,e){var r;if(null!=(r="function"==typeof this.defaultValue?this.defaultValue===Date.now||this.defaultValue===Array||"objectid"===this.defaultValue.name.toLowerCase()?this.defaultValue.call(t):this.defaultValue.call(t,t):this.defaultValue)){"object"!==i(r)||this.options&&this.options.shared||(r=p.clone(r));var n=this.applySetters(r,t,e);return n&&!Array.isArray(n)&&n.$isSingleNested&&(n.$__parent=t),n}return r},
|
|
259
259
|
/*!
|
|
260
260
|
* Applies setters without casting
|
|
261
261
|
*
|
|
262
262
|
* @api private
|
|
263
263
|
*/
|
|
264
|
-
|
|
264
|
+
w.prototype._applySetters=function(t,e,r,n){var i=t;if(r)return i;for(var o=this.setters,s=o.length-1;s>=0;s--)i=o[s].call(e,i,n,this);return i},
|
|
265
265
|
/*!
|
|
266
266
|
* ignore
|
|
267
267
|
*/
|
|
268
|
-
|
|
268
|
+
w.prototype._castNullish=function(t){return t},w.prototype.applySetters=function(t,e,r,n,i){var o=this._applySetters(t,e,r,n,i);return null==o?this._castNullish(o):o=this.cast(o,e,r,n,i)},w.prototype.applyGetters=function(t,e){var r=t,n=this.getters,i=n.length;if(0===i)return r;for(var o=0;o<i;++o)r=n[o].call(e,r,this);return r},w.prototype.select=function(t){return this.selected=!!t,this},w.prototype.doValidate=function(t,e,r,n){var o=this,s=!1,a=this.path,u=this.validators.filter((function(t){return"object"===i(t)&&null!==t})),h=u.length;if(!h)return e(null);for(var f=function(e,i){if(s)return"break";var h=u[e],f=h.validator,l=void 0,d=c(h)?Object.assign({},h):p.clone(h);if(d.path=n&&n.path?n.path:a,d.value=t,f instanceof RegExp)return v(f.test(t),d),"continue";if("function"!=typeof f)return"continue";if(void 0===t&&f!==o.requiredValidator)return v(!0,d),"continue";try{l=d.propsParameter?f.call(r,t,d):f.call(r,t)}catch(t){l=!1,d.reason=t,t.message&&(d.message=t.message)}null!=l&&"function"==typeof l.then?l.then((function(t){v(t,d)}),(function(t){d.reason=t,d.message=t.message,v(l=!1,d)})):v(l,d)},d=0,m=u.length;d<m;++d){var b=f(d);if("break"===b)break}function v(t,r){if(!s)if(void 0===t||t)--h<=0&&l((function(){e(null)}));else{var n=r.ErrorConstructor||g;(s=new n(r))[y]=!0,l((function(){e(s)}))}}},w.prototype.doValidateSync=function(t,e,r){var n=this.path;if(!this.validators.length)return null;var o=this.validators;if(void 0===t){if(0===this.validators.length||"required"!==this.validators[0].type)return null;o=[this.validators[0]]}var s=null,a=0,u=o.length;for(a=0;a<u;++a){var h=o[a];if(null!==h&&"object"===i(h)){var l=h.validator,d=c(h)?Object.assign({},h):p.clone(h);d.path=r&&r.path?r.path:n,d.value=t;var y=!1;if(!f(l))if(l instanceof RegExp)s=_(l.test(t),d);else if("function"==typeof l){try{y=d.propsParameter?l.call(e,t,d):l.call(e,t)}catch(t){y=!1,d.reason=t}if((null==y||"function"!=typeof y.then)&&(s=_(y,d)))break}}}return s},w._isRef=function(t,e,r,i){var o=i&&t.options&&(t.options.ref||t.options.refPath);if(!o&&r&&null!=r.$__){var s=r.$__fullPath(t.path,!0),a=r.ownerDocument();o=null!=s&&a.$populated(s)||r.$populated(t.path)}return!!o&&(null==e||(!(n.isBuffer(e)||"Binary"===e._bsontype||!p.isObject(e))||i))},
|
|
269
269
|
/*!
|
|
270
270
|
* ignore
|
|
271
271
|
*/
|
|
272
|
-
|
|
272
|
+
w.prototype._castRef=function(t,e,r){if(null==t)return t;if(null!=t.$__)return t.$__.wasPopulated=t.$__.wasPopulated||!0,t;if(n.isBuffer(t)||!p.isObject(t)){if(r)return t;throw new v(this.instance,t,this.path,null,this)}var i=e.$__fullPath(this.path,!0),o=e.ownerDocument().$populated(i,!0),s=t;return e.$__.populated&&e.$__.populated[i]&&e.$__.populated[i].options&&e.$__.populated[i].options.options&&e.$__.populated[i].options.options.lean||((s=new o.options[b](t)).$__.wasPopulated=!0),s},w.prototype.$conditionalHandlers={$all:function(t){var e=this;return Array.isArray(t)?t.map((function(t){return e.castForQuery(t)})):[this.castForQuery(t)]},$eq:M,$in:S,$ne:M,$nin:S,$exists:a,$type:u},
|
|
273
273
|
/*!
|
|
274
274
|
* Wraps `castForQuery` to handle context
|
|
275
275
|
*/
|
|
276
|
-
|
|
276
|
+
w.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},w.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)},
|
|
277
277
|
/*!
|
|
278
278
|
* Internal switch for runSetters
|
|
279
279
|
*
|
|
280
280
|
* @api private
|
|
281
281
|
*/
|
|
282
|
-
|
|
282
|
+
w.prototype._castForQuery=function(t){return this.applySetters(t,this.$$context)},w.checkRequired=function(t){return 0!==arguments.length&&(this._checkRequired=t),this._checkRequired},w.prototype.checkRequired=function(t){return null!=t},
|
|
283
283
|
/*!
|
|
284
284
|
* ignore
|
|
285
285
|
*/
|
|
286
|
-
|
|
286
|
+
w.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,h(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},
|
|
287
287
|
/*!
|
|
288
288
|
* Module exports.
|
|
289
289
|
*/
|
|
290
|
-
t.exports=e=g,e.CastError=b,e.ValidatorError=v}).call(this,r(3).Buffer)},function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}t.exports=r,r.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)}},function(t,e,r){"use strict";var n=e,i=r(21),o=r(10),s=r(128);n.assert=o,n.toArray=s.toArray,n.zero2=s.zero2,n.toHex=s.toHex,n.encode=s.encode,n.getNAF=function(t,e,r){var n=new Array(Math.max(t.bitLength(),r)+1);n.fill(0);for(var i=1<<e+1,o=t.clone(),s=0;s<n.length;s++){var a,u=o.andln(i-1);o.isOdd()?(a=u>(i>>1)-1?(i>>1)-u:u,o.isubn(a)):a=0,n[s]=a,o.iushrn(1)}return n},n.getJSF=function(t,e){var r=[[],[]];t=t.clone(),e=e.clone();for(var n,i=0,o=0;t.cmpn(-i)>0||e.cmpn(-o)>0;){var s,a,u=t.andln(3)+i&3,h=e.andln(3)+o&3;3===u&&(u=-1),3===h&&(h=-1),s=0==(1&u)?0:3!==(n=t.andln(7)+i&7)&&5!==n||2!==h?u:-u,r[0].push(s),a=0==(1&h)?0:3!==(n=e.andln(7)+o&7)&&5!==n||2!==u?h:-h,r[1].push(a),2*i===s+1&&(i=1-i),2*o===a+1&&(o=1-o),t.iushrn(1),e.iushrn(1)}return r},n.cachedProperty=function(t,e,r){var n="_"+e;t.prototype[e]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},n.parseBytes=function(t){return"string"==typeof t?n.toArray(t,"hex"):t},n.intFromLE=function(t){return new i(t,"hex","le")}},function(t,e,r){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i,o="object"===("undefined"==typeof Reflect?"undefined":n(Reflect))?Reflect:null,s=o&&"function"==typeof o.apply?o.apply:function(t,e,r){return Function.prototype.apply.call(t,e,r)};i=o&&"function"==typeof o.ownKeys?o.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var a=Number.isNaN||function(t){return t!=t};function u(){u.init.call(this)}t.exports=u,t.exports.once=function(t,e){return new Promise((function(r,n){function i(r){t.removeListener(e,o),n(r)}function o(){"function"==typeof t.removeListener&&t.removeListener("error",i),r([].slice.call(arguments))}v(t,e,o,{once:!0}),"error"!==e&&function(t,e,r){"function"==typeof t.on&&v(t,"error",e,r)}(t,i,{once:!0})}))},u.EventEmitter=u,u.prototype._events=void 0,u.prototype._eventsCount=0,u.prototype._maxListeners=void 0;var h=10;function f(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+n(t))}function c(t){return void 0===t._maxListeners?u.defaultMaxListeners:t._maxListeners}function l(t,e,r,n){var i,o,s,a;if(f(r),void 0===(o=t._events)?(o=t._events=Object.create(null),t._eventsCount=0):(void 0!==o.newListener&&(t.emit("newListener",e,r.listener?r.listener:r),o=t._events),s=o[e]),void 0===s)s=o[e]=r,++t._eventsCount;else if("function"==typeof s?s=o[e]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),(i=c(t))>0&&s.length>i&&!s.warned){s.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=s.length,a=u,console&&console.warn&&console.warn(a)}return t}function d(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=d.bind(n);return i.listener=r,n.wrapFn=i,i}function y(t,e,r){var n=t._events;if(void 0===n)return[];var i=n[e];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}(i):b(i,i.length)}function m(t){var e=this._events;if(void 0!==e){var r=e[t];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function b(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function v(t,e,r,i){if("function"==typeof t.on)i.once?t.once(e,r):t.on(e,r);else{if("function"!=typeof t.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+n(t));t.addEventListener(e,(function n(o){i.once&&t.removeEventListener(e,n),r(o)}))}}Object.defineProperty(u,"defaultMaxListeners",{enumerable:!0,get:function(){return h},set:function(t){if("number"!=typeof t||t<0||a(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");h=t}}),u.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},u.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||a(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},u.prototype.getMaxListeners=function(){return c(this)},u.prototype.emit=function(t){for(var e=[],r=1;r<arguments.length;r++)e.push(arguments[r]);var n="error"===t,i=this._events;if(void 0!==i)n=n&&void 0===i.error;else if(!n)return!1;if(n){var o;if(e.length>0&&(o=e[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var u=i[t];if(void 0===u)return!1;if("function"==typeof u)s(u,this,e);else{var h=u.length,f=b(u,h);for(r=0;r<h;++r)s(f[r],this,e)}return!0},u.prototype.addListener=function(t,e){return l(this,t,e,!1)},u.prototype.on=u.prototype.addListener,u.prototype.prependListener=function(t,e){return l(this,t,e,!0)},u.prototype.once=function(t,e){return f(e),this.on(t,p(this,t,e)),this},u.prototype.prependOnceListener=function(t,e){return f(e),this.prependListener(t,p(this,t,e)),this},u.prototype.removeListener=function(t,e){var r,n,i,o,s;if(f(e),void 0===(n=this._events))return this;if(void 0===(r=n[t]))return this;if(r===e||r.listener===e)0==--this._eventsCount?this._events=Object.create(null):(delete n[t],n.removeListener&&this.emit("removeListener",t,r.listener||e));else if("function"!=typeof r){for(i=-1,o=r.length-1;o>=0;o--)if(r[o]===e||r[o].listener===e){s=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(r,i),1===r.length&&(n[t]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",t,s||e)}return this},u.prototype.off=u.prototype.removeListener,u.prototype.removeAllListeners=function(t){var e,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[t]),this;if(0===arguments.length){var i,o=Object.keys(r);for(n=0;n<o.length;++n)"removeListener"!==(i=o[n])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(e=r[t]))this.removeListener(t,e);else if(void 0!==e)for(n=e.length-1;n>=0;n--)this.removeListener(t,e[n]);return this},u.prototype.listeners=function(t){return y(this,t,!0)},u.prototype.rawListeners=function(t){return y(this,t,!1)},u.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):m.call(t,e)},u.prototype.listenerCount=m,u.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]}},function(t,e,r){"use strict";
|
|
290
|
+
t.exports=e=w,e.CastError=v,e.ValidatorError=g}).call(this,r(3).Buffer)},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 i=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},o=/%[sdj%]/g;e.format=function(t){if(!v(t)){for(var e=[],r=0;r<arguments.length;r++)e.push(u(arguments[r]));return e.join(" ")}r=1;for(var n=arguments,i=n.length,s=String(t).replace(o,(function(t){if("%%"===t)return"%";if(r>=i)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<i;a=n[++r])m(a)||!_(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 i=!1;return function(){if(!i){if(t.throwDeprecation)throw new Error(n);t.traceDeprecation?console.trace(n):console.error(n),i=!0}return r.apply(this,arguments)}};var s,a={};function u(t,r){var n={seen:[],stylize:f};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),y(r)?n.showHidden=r:r&&e._extend(n,r),g(n.showHidden)&&(n.showHidden=!1),g(n.depth)&&(n.depth=2),g(n.colors)&&(n.colors=!1),g(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=h),c(n,t,n.depth)}function h(t,e){var r=u.styles[e];return r?"["+u.colors[r][0]+"m"+t+"["+u.colors[r][1]+"m":t}function f(t,e){return t}function c(t,r,n){if(t.customInspect&&r&&O(r.inspect)&&r.inspect!==e.inspect&&(!r.constructor||r.constructor.prototype!==r)){var i=r.inspect(n,t);return v(i)||(i=c(t,i,n)),i}var o=function(t,e){if(g(e))return t.stylize("undefined","undefined");if(v(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}if(b(e))return t.stylize(""+e,"number");if(y(e))return t.stylize(""+e,"boolean");if(m(e))return t.stylize("null","null")}(t,r);if(o)return o;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 l(r);if(0===s.length){if(O(r)){var u=r.name?": "+r.name:"";return t.stylize("[Function"+u+"]","special")}if(w(r))return t.stylize(RegExp.prototype.toString.call(r),"regexp");if(M(r))return t.stylize(Date.prototype.toString.call(r),"date");if(S(r))return l(r)}var h,f="",_=!1,A=["{","}"];(p(r)&&(_=!0,A=["[","]"]),O(r))&&(f=" [Function"+(r.name?": "+r.name:"")+"]");return w(r)&&(f=" "+RegExp.prototype.toString.call(r)),M(r)&&(f=" "+Date.prototype.toUTCString.call(r)),S(r)&&(f=" "+l(r)),0!==s.length||_&&0!=r.length?n<0?w(r)?t.stylize(RegExp.prototype.toString.call(r),"regexp"):t.stylize("[Object]","special"):(t.seen.push(r),h=_?function(t,e,r,n,i){for(var o=[],s=0,a=e.length;s<a;++s)j(e,String(s))?o.push(d(t,e,r,n,String(s),!0)):o.push("");return i.forEach((function(i){i.match(/^\d+$/)||o.push(d(t,e,r,n,i,!0))})),o}(t,r,n,a,s):s.map((function(e){return d(t,r,n,a,e,_)})),t.seen.pop(),function(t,e,r){if(t.reduce((function(t,e){return e.indexOf("\n")>=0&&0,t+e.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60)return r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+r[1];return r[0]+e+" "+t.join(", ")+" "+r[1]}(h,f,A)):A[0]+f+A[1]}function l(t){return"["+Error.prototype.toString.call(t)+"]"}function d(t,e,r,n,i,o){var s,a,u;if((u=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]}).get?a=u.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):u.set&&(a=t.stylize("[Setter]","special")),j(n,i)||(s="["+i+"]"),a||(t.seen.indexOf(u.value)<0?(a=m(r)?c(t,u.value,null):c(t,u.value,r-1)).indexOf("\n")>-1&&(a=o?a.split("\n").map((function(t){return" "+t})).join("\n").substr(2):"\n"+a.split("\n").map((function(t){return" "+t})).join("\n")):a=t.stylize("[Circular]","special")),g(s)){if(o&&i.match(/^\d+$/))return a;(s=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=t.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=t.stylize(s,"string"))}return s+": "+a}function p(t){return Array.isArray(t)}function y(t){return"boolean"==typeof t}function m(t){return null===t}function b(t){return"number"==typeof t}function v(t){return"string"==typeof t}function g(t){return void 0===t}function w(t){return _(t)&&"[object RegExp]"===A(t)}function _(t){return"object"===n(t)&&null!==t}function M(t){return _(t)&&"[object Date]"===A(t)}function S(t){return _(t)&&("[object Error]"===A(t)||t instanceof Error)}function O(t){return"function"==typeof t}function A(t){return Object.prototype.toString.call(t)}function E(t){return t<10?"0"+t.toString(10):t.toString(10)}e.debuglog=function(r){if(g(s)&&(s=t.env.NODE_DEBUG||""),r=r.toUpperCase(),!a[r])if(new RegExp("\\b"+r+"\\b","i").test(s)){var n=t.pid;a[r]=function(){var t=e.format.apply(e,arguments);console.error("%s %d: %s",r,n,t)}}else a[r]=function(){};return a[r]},e.inspect=u,u.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},u.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},e.isArray=p,e.isBoolean=y,e.isNull=m,e.isNullOrUndefined=function(t){return null==t},e.isNumber=b,e.isString=v,e.isSymbol=function(t){return"symbol"===n(t)},e.isUndefined=g,e.isRegExp=w,e.isObject=_,e.isDate=M,e.isError=S,e.isFunction=O,e.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"===n(t)||void 0===t},e.isBuffer=r(282);var x=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function k(){var t=new Date,e=[E(t.getHours()),E(t.getMinutes()),E(t.getSeconds())].join(":");return[t.getDate(),x[t.getMonth()],e].join(" ")}function j(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.log=function(){console.log("%s - %s",k(),e.format.apply(e,arguments))},e.inherits=r(283),e._extend=function(t,e){if(!e||!_(e))return t;for(var r=Object.keys(e),n=r.length;n--;)t[r[n]]=e[r[n]];return t};var $="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function P(t,e){if(!t){var r=new Error("Promise was rejected with a falsy value");r.reason=t,t=r}return e(t)}e.promisify=function(t){if("function"!=typeof t)throw new TypeError('The "original" argument must be of type Function');if($&&t[$]){var e;if("function"!=typeof(e=t[$]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(e,$,{value:e,enumerable:!1,writable:!1,configurable:!0}),e}function e(){for(var e,r,n=new Promise((function(t,n){e=t,r=n})),i=[],o=0;o<arguments.length;o++)i.push(arguments[o]);i.push((function(t,n){t?r(t):e(n)}));try{t.apply(this,i)}catch(t){r(t)}return n}return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),$&&Object.defineProperty(e,$,{value:e,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(e,i(t))},e.promisify.custom=$,e.callbackify=function(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');function r(){for(var r=[],n=0;n<arguments.length;n++)r.push(arguments[n]);var i=r.pop();if("function"!=typeof i)throw new TypeError("The last argument must be of type Function");var o=this,s=function(){return i.apply(o,arguments)};e.apply(this,r).then((function(e){t.nextTick(s,null,e)}),(function(e){t.nextTick(P,e,s)}))}return Object.setPrototypeOf(r,Object.getPrototypeOf(e)),Object.defineProperties(r,i(e)),r}}).call(this,r(5))},function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}t.exports=r,r.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)}},function(t,e,r){"use strict";var n=e,i=r(21),o=r(10),s=r(128);n.assert=o,n.toArray=s.toArray,n.zero2=s.zero2,n.toHex=s.toHex,n.encode=s.encode,n.getNAF=function(t,e,r){var n=new Array(Math.max(t.bitLength(),r)+1);n.fill(0);for(var i=1<<e+1,o=t.clone(),s=0;s<n.length;s++){var a,u=o.andln(i-1);o.isOdd()?(a=u>(i>>1)-1?(i>>1)-u:u,o.isubn(a)):a=0,n[s]=a,o.iushrn(1)}return n},n.getJSF=function(t,e){var r=[[],[]];t=t.clone(),e=e.clone();for(var n,i=0,o=0;t.cmpn(-i)>0||e.cmpn(-o)>0;){var s,a,u=t.andln(3)+i&3,h=e.andln(3)+o&3;3===u&&(u=-1),3===h&&(h=-1),s=0==(1&u)?0:3!==(n=t.andln(7)+i&7)&&5!==n||2!==h?u:-u,r[0].push(s),a=0==(1&h)?0:3!==(n=e.andln(7)+o&7)&&5!==n||2!==u?h:-h,r[1].push(a),2*i===s+1&&(i=1-i),2*o===a+1&&(o=1-o),t.iushrn(1),e.iushrn(1)}return r},n.cachedProperty=function(t,e,r){var n="_"+e;t.prototype[e]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},n.parseBytes=function(t){return"string"==typeof t?n.toArray(t,"hex"):t},n.intFromLE=function(t){return new i(t,"hex","le")}},function(t,e,r){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i,o="object"===("undefined"==typeof Reflect?"undefined":n(Reflect))?Reflect:null,s=o&&"function"==typeof o.apply?o.apply:function(t,e,r){return Function.prototype.apply.call(t,e,r)};i=o&&"function"==typeof o.ownKeys?o.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var a=Number.isNaN||function(t){return t!=t};function u(){u.init.call(this)}t.exports=u,t.exports.once=function(t,e){return new Promise((function(r,n){function i(r){t.removeListener(e,o),n(r)}function o(){"function"==typeof t.removeListener&&t.removeListener("error",i),r([].slice.call(arguments))}v(t,e,o,{once:!0}),"error"!==e&&function(t,e,r){"function"==typeof t.on&&v(t,"error",e,r)}(t,i,{once:!0})}))},u.EventEmitter=u,u.prototype._events=void 0,u.prototype._eventsCount=0,u.prototype._maxListeners=void 0;var h=10;function f(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+n(t))}function c(t){return void 0===t._maxListeners?u.defaultMaxListeners:t._maxListeners}function l(t,e,r,n){var i,o,s,a;if(f(r),void 0===(o=t._events)?(o=t._events=Object.create(null),t._eventsCount=0):(void 0!==o.newListener&&(t.emit("newListener",e,r.listener?r.listener:r),o=t._events),s=o[e]),void 0===s)s=o[e]=r,++t._eventsCount;else if("function"==typeof s?s=o[e]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),(i=c(t))>0&&s.length>i&&!s.warned){s.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=s.length,a=u,console&&console.warn&&console.warn(a)}return t}function d(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=d.bind(n);return i.listener=r,n.wrapFn=i,i}function y(t,e,r){var n=t._events;if(void 0===n)return[];var i=n[e];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}(i):b(i,i.length)}function m(t){var e=this._events;if(void 0!==e){var r=e[t];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function b(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function v(t,e,r,i){if("function"==typeof t.on)i.once?t.once(e,r):t.on(e,r);else{if("function"!=typeof t.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+n(t));t.addEventListener(e,(function n(o){i.once&&t.removeEventListener(e,n),r(o)}))}}Object.defineProperty(u,"defaultMaxListeners",{enumerable:!0,get:function(){return h},set:function(t){if("number"!=typeof t||t<0||a(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");h=t}}),u.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},u.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||a(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},u.prototype.getMaxListeners=function(){return c(this)},u.prototype.emit=function(t){for(var e=[],r=1;r<arguments.length;r++)e.push(arguments[r]);var n="error"===t,i=this._events;if(void 0!==i)n=n&&void 0===i.error;else if(!n)return!1;if(n){var o;if(e.length>0&&(o=e[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var u=i[t];if(void 0===u)return!1;if("function"==typeof u)s(u,this,e);else{var h=u.length,f=b(u,h);for(r=0;r<h;++r)s(f[r],this,e)}return!0},u.prototype.addListener=function(t,e){return l(this,t,e,!1)},u.prototype.on=u.prototype.addListener,u.prototype.prependListener=function(t,e){return l(this,t,e,!0)},u.prototype.once=function(t,e){return f(e),this.on(t,p(this,t,e)),this},u.prototype.prependOnceListener=function(t,e){return f(e),this.prependListener(t,p(this,t,e)),this},u.prototype.removeListener=function(t,e){var r,n,i,o,s;if(f(e),void 0===(n=this._events))return this;if(void 0===(r=n[t]))return this;if(r===e||r.listener===e)0==--this._eventsCount?this._events=Object.create(null):(delete n[t],n.removeListener&&this.emit("removeListener",t,r.listener||e));else if("function"!=typeof r){for(i=-1,o=r.length-1;o>=0;o--)if(r[o]===e||r[o].listener===e){s=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(r,i),1===r.length&&(n[t]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",t,s||e)}return this},u.prototype.off=u.prototype.removeListener,u.prototype.removeAllListeners=function(t){var e,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[t]),this;if(0===arguments.length){var i,o=Object.keys(r);for(n=0;n<o.length;++n)"removeListener"!==(i=o[n])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(e=r[t]))this.removeListener(t,e);else if(void 0!==e)for(n=e.length-1;n>=0;n--)this.removeListener(t,e[n]);return this},u.prototype.listeners=function(t){return y(this,t,!0)},u.prototype.rawListeners=function(t){return y(this,t,!1)},u.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):m.call(t,e)},u.prototype.listenerCount=m,u.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]}},function(t,e,r){"use strict";
|
|
291
291
|
/*!
|
|
292
292
|
* Module dependencies.
|
|
293
|
-
*/function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function i(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return o(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return o(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,s=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw s}}}}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var a,u,h,f=r(12).EventEmitter,c=r(275),l=r(7),d=r(45),p=r(154),y=r(
|
|
293
|
+
*/function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function i(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return o(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return o(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,s=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw s}}}}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var a,u,h,f=r(12).EventEmitter,c=r(275),l=r(7),d=r(45),p=r(154),y=r(305),m=r(306),b=r(85),v=r(44),g=r(151),w=r(152),_=r(86),M=r(344),S=r(53),O=r(167),A=r(91).compile,E=r(91).defineKey,x=r(345).flatten,k=r(346),j=r(14),$=r(348),P=r(349),R=r(171),B=r(42),T=r(92),I=r(350),N=r(9).inspect,D=r(34).internalToObjectOptions,C=r(351),L=r(81),q=r(352),U=r(4),F=r(354),z=U.clone,V=U.deepEqual,K=U.isMongooseObject,H=r(1).arrayAtomicsBackupSymbol,Z=r(1).arrayAtomicsSymbol,W=r(1).documentArrayParent,J=r(1).documentIsModified,Y=r(1).documentModifiedPaths,Q=r(1).documentSchemaSymbol,G=r(1).getSymbol,X=r(1).populateModelSymbol,tt=r(1).scopeSymbol,et=r(55).schemaMixedSymbol,rt=r(355),nt=U.specialProperties;function it(t,e,r,n){if("object"===s(r)&&null!=r&&(r=(n=r).skipId),n=Object.assign({},n),null==this.$__schema){var o=U.isObject(e)&&!e.instanceOfSchema?new b(e):e;this.$__setSchema(o),e=r,r=n,n=arguments[4]||{}}if(this.$__=new c,this.$isNew=!("isNew"in n)||n.isNew,"priorDoc"in n&&(this.$__.priorDoc=n.priorDoc),r&&(this.$__.skipId=r),null!=t&&"object"!==s(t))throw new y(t,"obj","Document");var a=!0;void 0!==n.defaults&&(this.$__.defaults=n.defaults,a=n.defaults);var u=this.$__schema;"boolean"==typeof e||"throw"===e?(this.$__.strictMode=e,e=void 0):(this.$__.strictMode=u.options.strict,void 0!==e&&(this.$__.selected=e));var h,f=u.requiredPaths(!0),l=i(f);try{for(l.s();!(h=l.n()).done;){var d=h.value;this.$__.activePaths.require(d)}}catch(t){l.e(t)}finally{l.f()}var p=null;U.isPOJO(e)&&(p=I(e),this.$__.fields=e,this.$__.exclude=p);var m=!1===p&&e?M(e):null;if(null==this._doc&&(this.$__buildDoc(t,e,r,p,m,!1),a&&st(this,e,p,m,!0,null)),t&&(this.$__original_set?this.$__original_set(t,void 0,!0):this.$set(t,void 0,!0),t instanceof it&&(this.$isNew=t.$isNew)),n.willInit&&a?n.skipDefaults&&(this.$__.skipDefaults=n.skipDefaults):a&&st(this,e,p,m,!1,n.skipDefaults),this.$__._id=this._id,!this.$__.strictMode&&t){var v=this,g=Object.keys(this._doc);g.forEach((function(t){t in u.tree||t in u.methods||t in u.virtuals||t.startsWith("$")||E({prop:t,subprops:null,prototype:v})}))}lt(this)}for(var ot in Object.defineProperty(it.prototype,"isNew",{get:function(){return this.$isNew},set:function(t){this.$isNew=t}}),Object.defineProperty(it.prototype,"errors",{get:function(){return this.$errors},set:function(t){this.$errors=t}}),
|
|
294
294
|
/*!
|
|
295
295
|
* Document exposes the NodeJS event emitter API, so you can use
|
|
296
296
|
* `on`, `once`, etc.
|
|
@@ -299,7 +299,7 @@ U.each(["on","once","emit","listeners","removeListener","setMaxListeners","remov
|
|
|
299
299
|
/*!
|
|
300
300
|
* ignore
|
|
301
301
|
*/
|
|
302
|
-
function st(t,e,r,n,i,o){for(var s=Object.keys(t.$__schema.paths),a=s.length,u=0;u<a;++u){var h=void 0,f="",c=s[u];if("_id"!==c||!t.$__.skipId)for(var l=t.$__schema.paths[c],d=l.splitPath(),p=d.length,y=!1,m=t._doc,b=0;b<p&&null!=m;++b){var v=d[b];if(f+=(f.length?".":"")+v,!0===r){if(f in e)break}else if(!1===r&&e&&!y)if(f in e||
|
|
302
|
+
function st(t,e,r,n,i,o){for(var s=Object.keys(t.$__schema.paths),a=s.length,u=0;u<a;++u){var h=void 0,f="",c=s[u];if("_id"!==c||!t.$__.skipId)for(var l=t.$__schema.paths[c],d=l.splitPath(),p=d.length,y=!1,m=t._doc,b=0;b<p&&null!=m;++b){var v=d[b];if(f+=(f.length?".":"")+v,!0===r){if(f in e)break}else if(!1===r&&e&&!y){var g=l.$isSingleNested||l.$isMongooseDocumentArray;if(f in e||g&&null!=n&&n[f])y=!0;else if(null!=n&&!n[f])break}if(b===p-1){if(void 0!==m[v])break;if("function"==typeof l.defaultValue){if(!l.defaultValue.$runBeforeSetters&&i)break;if(l.defaultValue.$runBeforeSetters&&!i)break}else if(!i)continue;if(o&&o[f])break;if(e&&null!==r){if(!0===r){if(c in e)continue;try{h=l.getDefault(t,!1)}catch(e){t.invalidate(c,e);break}void 0!==h&&(m[v]=h,t.$__.activePaths.default(c))}else if(y){try{h=l.getDefault(t,!1)}catch(e){t.invalidate(c,e);break}void 0!==h&&(m[v]=h,t.$__.activePaths.default(c))}}else{try{h=l.getDefault(t,!1)}catch(e){t.invalidate(c,e);break}void 0!==h&&(m[v]=h,t.$__.activePaths.default(c))}}else m=m[v]}}}
|
|
303
303
|
/*!
|
|
304
304
|
* ignore
|
|
305
305
|
*/function at(t,e,r){if(null!=t){k(t);for(var n=Object.keys(r.$__schema.paths),i=n.length,o=-1===e.indexOf(".")?[e]:e.split("."),s=0;s<i;++s){var a="",u=n[s];if(u.startsWith(e+".")){var h=r.$__schema.paths[u],f=h.splitPath().slice(o.length),c=f.length;if(void 0!==h.defaultValue)for(var l=t,d=0;d<c&&null!=l;++d){var p=f[d];if(d===c-1){if(void 0!==l[p])break;try{var y=h.getDefault(r,!1);void 0!==y&&(l[p]=y)}catch(t){r.invalidate(e+"."+a,t);break}break}a+=(a.length?".":"")+p,l[p]=l[p]||{},l=l[p]}}}}}function ut(t){if(null==t)return!0;if("object"!==s(t)||Array.isArray(t))return!1;for(var e=0,r=Object.keys(t);e<r.length;e++){if(!ut(t[r[e]]))return!1}return!0}
|
|
@@ -354,26 +354,26 @@ it.prototype.toBSON=function(){return this.toObject(D)},it.prototype.init=functi
|
|
|
354
354
|
* @param {Object} doc object we are initializing
|
|
355
355
|
* @api private
|
|
356
356
|
*/
|
|
357
|
-
function t(e,r,n,i,o){o=o||"";var s,a,u,h=Object.keys(r),f=h.length,c=0,l=e.$__.strictMode,d=e.$__schema;for(;c<f;)p(c++);function p(f){if(u=h[f],a=o+u,s=d.path(a),!d.$isRootDiscriminator||e.$__isSelected(a))if(!s&&U.isPOJO(r[u]))n[u]||(n[u]={},l||u in d.tree||u in d.methods||u in d.virtuals||(e[u]=n[u])),t(e,r[u],n[u],i,a+".");else if(s){if(n.hasOwnProperty(u)&&void 0!==r[u]&&delete n[u],null===r[u])n[u]=s._castNullish(null);else if(void 0!==r[u]){var c=null==r[u].$__?null:r[u].$__.wasPopulated;if(s&&!c)try{n[u]=s.cast(r[u],e,!0)}catch(t){e.invalidate(t.path,new w({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],l||(e[u]=r[u])}}(this,t,this._doc,e),C(this,e.populated),this.$emit("init",this),this.constructor.emit("init",this),this.$__._id=this._id;var f=!1===this.$__.exclude&&this.$__.fields?M(this.$__.fields):
|
|
357
|
+
function t(e,r,n,i,o){o=o||"";var s,a,u,h=Object.keys(r),f=h.length,c=0,l=e.$__.strictMode,d=e.$__schema;for(;c<f;)p(c++);function p(f){if(u=h[f],a=o+u,s=d.path(a),!d.$isRootDiscriminator||e.$__isSelected(a))if(!s&&U.isPOJO(r[u]))n[u]||(n[u]={},l||u in d.tree||u in d.methods||u in d.virtuals||(e[u]=n[u])),t(e,r[u],n[u],i,a+".");else if(s){if(n.hasOwnProperty(u)&&void 0!==r[u]&&delete n[u],null===r[u])n[u]=s._castNullish(null);else if(void 0!==r[u]){var c=null==r[u].$__?null:r[u].$__.wasPopulated;if(s&&!c)try{n[u]=s.cast(r[u],e,!0)}catch(t){e.invalidate(t.path,new w({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],l||(e[u]=r[u])}}(this,t,this._doc,e),C(this,e.populated),this.$emit("init",this),this.constructor.emit("init",this),this.$__._id=this._id;var f=!1===this.$__.exclude&&this.$__.fields?M(this.$__.fields):null;return st(this,this.$__.fields,this.$__.exclude,f,!1,this.$__.skipDefaults),this},it.prototype.update=function(){var t=Array.prototype.slice.call(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},it.prototype.updateOne=function(t,e,r){var n=this,i=this.constructor.updateOne({_id:this._id},t,e);return i.pre((function(t){n.constructor._middleware.execPre("updateOne",n,[n],t)})),i.post((function(t){n.constructor._middleware.execPost("updateOne",n,[n],{},t)})),null!=this.$session()&&("session"in i.options||(i.options.session=this.$session())),null!=r?i.exec(r):i},it.prototype.replaceOne=function(){var t=Array.prototype.slice.call(arguments);return t.unshift({_id:this._id}),this.constructor.replaceOne.apply(this.constructor,t)},it.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 l("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(null!=t||null!=this.$__.session){if(this.$__.session=t,!this.$isSubdocument){var e,r=this.$getAllSubdocs(),n=i(r);try{for(n.s();!(e=n.n()).done;){var o=e.value;o.$session(t)}}catch(t){n.e(t)}finally{n.f()}}return t}},it.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},it.prototype.$set=function(t,e,r,o){var a=this;U.isPOJO(r)&&(o=r,r=void 0);var u,h,f,c,y=(o=o||{}).merge,m=r&&!0!==r,b=!0===r,g=this.$__schema.options.typeKey,w=0,_="strict"in o?o.strict:this.$__.strictMode;if(m&&((this.$__.adhocPaths||(this.$__.adhocPaths={}))[t]=this.$__schema.interpretAsType(t,r,this.$__schema.options)),null==t){var M=[e,t];t=M[0],e=M[1]}else if("string"!=typeof t){if(t instanceof it&&(t=t.$__isNested?t.toObject():t._doc),null==t){var S=[e,t];t=S[0],e=S[1]}c=e?e+".":"";var A=(u=P(this.$__schema,t)).length,E=o._skipMinimizeTopLevel||!1;if(0===A&&E)return delete o._skipMinimizeTopLevel,e&&this.$set(e,{}),this;for(var x=0;x<A;++x){var k=c+(f=u[x]);h=this.$__schema.pathType(k);var j=t[f];if(!0!==r||c||null==j||"nested"!==h||null==this._doc[f]?o=Object.assign({},o,{_skipMinimizeTopLevel:!1}):(delete this._doc[f],o=Object.assign({},o,{_skipMinimizeTopLevel:!0})),U.isNonBuiltinObject(j)&&"nested"===h)at(t[f],c+f,this),this.$set(c+f,t[f],b,Object.assign({},o,{_skipMarkModified:!0}));else if(_){if(b&&void 0===t[f]&&void 0!==this.$get(k))continue;if("adhocOrUndefined"===h&&(h=$(this,k,{typeOnly:!0})),"real"===h||"virtual"===h){var B=t[f];this.$set(c+f,B,b,o)}else if("nested"===h&&t[f]instanceof it)this.$set(c+f,t[f].toObject({transform:!1}),b,o);else if("throw"===_)throw"nested"===h?new p(f,t[f]):new v(f)}else void 0!==t[f]&&this.$set(c+f,t[f],b,o)}for(var T=0,I=Object.keys(this.$__schema.tree);T<I.length;T++){var N=I[T];if(this._doc.hasOwnProperty(N)){var C=this._doc[N];delete this._doc[N],this._doc[N]=C}}return this}var q=this.$__schema.pathType(t);"adhocOrUndefined"===q&&(q=$(this,t,{typeOnly:!0})),e=R(e);var F,z=null!=a.$__.priorDoc?a.$__.priorDoc.$__getValue(t):b?void 0:a.$__getValue(t);if("nested"===q&&e){if("object"===s(e)&&null!=e){if(null!=e.$__&&(e=e.toObject(D)),null==e)return this.invalidate(t,new l.CastError("Object",e,t)),this;var V=null!=this.$__.savedState&&this.$__.savedState.hasOwnProperty(t);if(null!=this.$__.savedState&&!this.$isNew&&!this.$__.savedState.hasOwnProperty(t)){var K=this.$__getValue(t);this.$__.savedState[t]=K;for(var H=0,Z=Object.keys(K||{});H<Z.length;H++){var W=Z[H];this.$__.savedState[t+"."+W]=K[W]}}if(y)return this.$set(e,t,b);this.$__setValue(t,null),O(this,t);var J=P(this.$__schema,e,t);this.$__setValue(t,{});var Y,Q=i(J);try{for(Q.s();!(Y=Q.n()).done;){var G=Y.value;this.$set(t+"."+G,e[G],b,o)}}catch(t){Q.e(t)}finally{Q.f()}return null!=z&&U.deepEqual(V?this.$__.savedState[t]:z,e)?this.unmarkModified(t):this.markModified(t),this}return this.invalidate(t,new l.CastError("Object",e,t)),this}var tt=-1===t.indexOf(".")?[t]:t.split(".");if("string"==typeof this.$__schema.aliases[tt[0]]&&(tt[0]=this.$__schema.aliases[tt[0]]),"adhocOrUndefined"===q&&_){var et;for(w=0;w<tt.length;++w){var rt=tt.slice(0,w+1).join(".");if(w+1<tt.length&&"virtual"===this.$__schema.pathType(rt))return L.set(t,e,this),this;if(null!=(F=this.$__schema.path(rt))&&F instanceof d){et=!0;break}}if(null==F&&(F=$(this,t)),!et&&!F){if("throw"===_)throw new v(t);return this}}else{if("virtual"===q)return(F=this.$__schema.virtualpath(t)).applySetters(e,this),this;F=this.$__path(t)}var nt,ot=this._doc,st="";for(w=0;w<tt.length-1;++w)ot=ot[tt[w]],st+=(0!==st.length?".":"")+tt[w],ot||(this.$set(st,{}),this.$__isSelected(st)||this.unmarkModified(st),ot=this.$__getValue(st));if(tt.length<=1)nt=t;else{var ut=tt.length;for(w=0;w<ut;++w){var ht=tt.slice(0,w+1).join(".");if(null===this.$get(ht,null,{getters:!1})){nt=ht;break}}nt||(nt=t)}if(!F)return this.$__set(nt,t,o,b,tt,F,e,z),this;if((F.$isSingleNested||F.$isMongooseArray)&&
|
|
358
358
|
/*!
|
|
359
359
|
* ignore
|
|
360
360
|
*/
|
|
361
361
|
function(t,e){if(!t.$__.validationError)return;for(var r=Object.keys(t.$__.validationError.errors),n=0,i=r;n<i.length;n++){var o=i[n];o.startsWith(e+".")&&delete t.$__.validationError.errors[o]}0===Object.keys(t.$__.validationError.errors).length&&(t.$__.validationError=null)}
|
|
362
362
|
/*!
|
|
363
363
|
* ignore
|
|
364
|
-
*/(this,t),null!=e&&y&&F.$isSingleNested){e instanceof it&&(e=e.toObject({virtuals:!1,transform:!1}));for(var ft=0,ct=Object.keys(e);ft<ct.length;ft++){var lt=ct[ft];this.$set(t+"."+lt,e[lt],b,o)}return this}var dt=!0;try{var pt,yt=function(){if(null==F.options)return!1;if(!(e instanceof it))return!1;var t=e.constructor,r=F.options.ref;if(null!=r&&(r===t.modelName||r===t.baseModelName))return!0;var n=F.options.refPath;if(null==n)return!1;var i=e.get(n);return i===t.modelName||i===t.baseModelName}(),mt=!1;if(yt&&e instanceof it&&(this.$populated(t,
|
|
364
|
+
*/(this,t),null!=e&&y&&F.$isSingleNested){e instanceof it&&(e=e.toObject({virtuals:!1,transform:!1}));for(var ft=0,ct=Object.keys(e);ft<ct.length;ft++){var lt=ct[ft];this.$set(t+"."+lt,e[lt],b,o)}return this}var dt=!0;try{var pt,yt=function(){if(null==F.options)return!1;if(!(e instanceof it))return!1;var t=e.constructor,r=F.options.ref;if(null!=r&&(r===t.modelName||r===t.baseModelName))return!0;var n=F.options.refPath;if(null==n)return!1;var i=e.get(n);return i===t.modelName||i===t.baseModelName}(),mt=!1;if(yt&&e instanceof it){var bt=F&&F.$isSingleNested?F.cast(e,this):e._id;this.$populated(t,bt,n({},X,e.constructor)),e.$__.wasPopulated={value:bt},mt=!0}if(F.options&&Array.isArray(F.options[g])&&F.options[g].length&&F.options[g][0].ref&&
|
|
365
365
|
/*!
|
|
366
366
|
* ignore
|
|
367
367
|
*/
|
|
368
|
-
function(t,e){if(!Array.isArray(t))return!1;if(0===t.length)return!1;var r,n=i(t);try{for(n.s();!(r=n.n()).done;){var o=r.value;if(!(o instanceof it))return!1;if(null==o.constructor.modelName)return!1;if(o.constructor.modelName!=e&&o.constructor.baseModelName!=e)return!1}}catch(t){n.e(t)}finally{n.f()}return!0}(e,F.options[g][0].ref)){pt=n({},X,e[0].constructor),this.$populated(t,e.map((function(t){return t._id})),pt);var
|
|
368
|
+
function(t,e){if(!Array.isArray(t))return!1;if(0===t.length)return!1;var r,n=i(t);try{for(n.s();!(r=n.n()).done;){var o=r.value;if(!(o instanceof it))return!1;if(null==o.constructor.modelName)return!1;if(o.constructor.modelName!=e&&o.constructor.baseModelName!=e)return!1}}catch(t){n.e(t)}finally{n.f()}return!0}(e,F.options[g][0].ref)){pt=n({},X,e[0].constructor),this.$populated(t,e.map((function(t){return t._id})),pt);var vt,gt=i(e);try{for(gt.s();!(vt=gt.n()).done;){var wt=vt.value;wt.$__.wasPopulated={value:wt._id}}}catch(t){gt.e(t)}finally{gt.f()}mt=!0}if(null!=this.$__schema.singleNestedPaths[t]||yt&&F.$isSingleNested&&e.$__||(e=F.applySetters(e,this,!1,z)),Array.isArray(e)&&!Array.isArray(F)&&F.$isMongooseDocumentArray&&0!==e.length&&null!=e[0]&&null!=e[0].$__&&null!=e[0].$__.populated){for(var _t=Object.keys(e[0].$__.populated),Mt=function(){var r=Ot[St];a.$populated(t+"."+r,e.map((function(t){return t.$populated(r)})),e[0].$__.populated[r].options)},St=0,Ot=_t;St<Ot.length;St++)Mt();mt=!0}if(!mt&&this.$__.populated){if(Array.isArray(e)&&this.$__.populated[t])for(var At=0;At<e.length;++At)e[At]instanceof it&&e.set(At,e[At]._id,!0);delete this.$__.populated[t]}null!=e&&F.$isSingleNested&&function(t,e,r){var n=e.schema;if(null==n)return;for(var i=0,o=Object.keys(n.paths);i<o.length;i++){var s=o[i],a=n.paths[s];if(null!=a.$immutableSetter){var u=null==r?void 0:r.$__getValue(s);a.$immutableSetter.call(t,u)}}}(e,F,z),this.$markValid(t)}catch(r){r instanceof l.StrictModeError&&r.isImmutableError?this.invalidate(t,r):r instanceof l.CastError?(this.invalidate(r.path,r),r.$originalErrorPath&&this.invalidate(t,new l.CastError(F.instance,e,t,r.$originalErrorPath))):this.invalidate(t,new l.CastError(F.instance,e,t,r)),dt=!1}if(dt){var Et=this.$isSubdocument?this.ownerDocument():this,xt=Et.$__.savedState,kt=this.$isSubdocument?this.$__.fullPath+"."+t:t;if(null!=xt){var jt=kt.indexOf("."),$t=-1===jt?kt:kt.slice(0,jt);xt.hasOwnProperty($t)||(xt[$t]=U.clone(Et.$__getValue($t)))}this.$__set(nt,t,o,b,tt,F,e,z),null!=xt&&xt.hasOwnProperty(kt)&&U.deepEqual(e,xt[kt])&&this.unmarkModified(t)}return F.$isSingleNested&&(this.isDirectModified(t)||null==e)&&O(this,t),this},it.prototype.set=it.prototype.$set,it.prototype.$__shouldModify=function(t,e,r,n,i,o,s,a){return!r._skipMarkModified&&(!!this.$isNew||null==this.$__schema.singleNestedPaths[e]&&(void 0===s&&!this.$__isSelected(e)||(void 0!==s||!(e in this.$__.activePaths.states.default))&&(!(this.$populated(e)&&s instanceof it&&V(s._id,a))&&(!V(s,a||U.getValue(e,this))||!(n||null==s||!(e in this.$__.activePaths.states.default)||!V(s,o.getDefault(this,n)))))))},it.prototype.$__set=function(t,e,n,i,o,s,a,f){h=h||r(46);var c=this.$__shouldModify(t,e,n,i,o,s,a,f),l=this;c?(this.markModified(t),u||(u=r(166)),a&&U.isMongooseArray(a)&&(a._registerAtomic("$set",a),U.isMongooseDocumentArray(a)&&a.forEach((function(t){t&&t.__parentArray&&(t.__parentArray=a)})),this.$__.activePaths.forEach((function(t){t.startsWith(e+".")&&l.$__.activePaths.ignore(t)})))):Array.isArray(a)&&Array.isArray(f)&&U.isMongooseArray(a)&&U.isMongooseArray(f)&&(a[Z]=f[Z],a[H]=f[H],U.isMongooseDocumentArray(a)&&a.forEach((function(t){t.isNew=!1})));for(var d=this._doc,p=0,y=o.length,m="";p<y;p++){var b=p+1===y;if(m+=m?"."+o[p]:o[p],nt.has(o[p]))return;b?d instanceof Map?d.set(o[p],a):d[o[p]]=a:(U.isPOJO(d[o[p]])||d[o[p]]&&d[o[p]]instanceof h||d[o[p]]&&!Array.isArray(d[o[p]])&&d[o[p]].$isSingleNested||d[o[p]]&&Array.isArray(d[o[p]])||(d[o[p]]=d[o[p]]||{}),d=d[o[p]])}},it.prototype.$__getValue=function(t){return U.getValue(t,this._doc)},it.prototype.$__setValue=function(t,e){return U.setValue(t,e,this._doc),this},it.prototype.get=function(t,e,r){var n;r=r||{},e&&(n=this.$__schema.interpretAsType(t,e,this.$__schema.options));var i=this.$__path(t);if(null==i&&(i=this.$__schema.virtualpath(t)),i instanceof d){var o=this.$__schema.virtualpath(t);null!=o&&(i=o)}var s=-1===t.indexOf(".")?[t]:t.split("."),a=this._doc;if(i instanceof _)return i.applyGetters(void 0,this);"string"==typeof this.$__schema.aliases[s[0]]&&(s[0]=this.$__schema.aliases[s[0]]);for(var u=0,h=s.length;u<h;u++)a&&a._doc&&(a=a._doc),a=null==a?void 0:a instanceof Map?a.get(s[u],{getters:!1}):u===h-1?U.getValue(s[u],a):a[s[u]];if(n&&(a=n.cast(a)),null!=i&&!1!==r.getters)a=i.applyGetters(a,this);else if(this.$__schema.nested[t]&&r.virtuals)return dt(this,U.clone(a)||{},{path:t});return a},
|
|
369
369
|
/*!
|
|
370
370
|
* ignore
|
|
371
371
|
*/
|
|
372
|
-
it.prototype[G]=it.prototype.get,it.prototype.$get=it.prototype.get,it.prototype.$__path=function(t){var e=this.$__.adhocPaths,r=e&&e.hasOwnProperty(t)?e[t]:null;return r||this.$__schema.path(t)},it.prototype.markModified=function(t,e){this.$__.activePaths.modify(t),null==e||this.$isSubdocument||(this.$__.pathsToScopes=this.$__pathsToScopes||{},this.$__.pathsToScopes[t]=e)},it.prototype.unmarkModified=function(t){this.$__.activePaths.init(t),null!=this.$__.pathsToScopes&&delete this.$__.pathsToScopes[t]},it.prototype.$ignore=function(t){this.$__.activePaths.ignore(t)},it.prototype.directModifiedPaths=function(){return Object.keys(this.$__.activePaths.states.modify)},it.prototype.$isEmpty=function(t){var e={minimize:!0,virtuals:!1,getters:!1,transform:!1};if(0!==arguments.length){var r=this.$get(t);return null==r||"object"===s(r)&&(U.isPOJO(r)?ut(r):0===Object.keys(r.toObject(e)).length)}return 0===Object.keys(this.toObject(e)).length},it.prototype.modifiedPaths=function(t){t=t||{};var e=Object.keys(this.$__.activePaths.states.modify),r=new Set,n=0,i=0,o=e.length;for(n=0;n<o;++n){var a=e[n],u=rt(a),h=u.length;for(i=0;i<h;++i)r.add(u[i]);if(t.includeChildren){var f=0,c=this.$get(a);if("object"===s(c)&&null!==c){c._doc&&(c=c._doc);var l=c.length;if(Array.isArray(c))for(f=0;f<l;++f){var d=a+"."+f;if(!r.has(d)&&(r.add(d),null!=c[f]&&c[f].$__)){var p=c[f].modifiedPaths(),y=0,m=p.length;for(y=0;y<m;++y)r.add(d+"."+p[y])}}else{var b=Object.keys(c),v=0,g=b.length;for(v=0;v<g;++v)r.add(a+"."+b[v])}}}}return Array.from(r)},it.prototype[Y]=it.prototype.modifiedPaths,it.prototype.isModified=function(t,e){if(t){var r=Object.keys(this.$__.activePaths.states.modify);if(0===r.length)return!1;Array.isArray(t)||(t=-1===t.indexOf(" ")?[t]:t.split(" "));var n=e||this[Y]();return t.some((function(t){return!!~n.indexOf(t)}))||t.some((function(t){return r.some((function(e){return e===t||t.startsWith(e+".")}))}))}return this.$__.activePaths.some("modify")},it.prototype.$isModified=it.prototype.isModified,it.prototype[J]=it.prototype.isModified,it.prototype.$isDefault=function(t){var e=this;if(null==t)return this.$__.activePaths.some("default");if("string"==typeof t&&-1===t.indexOf(" "))return this.$__.activePaths.states.default.hasOwnProperty(t);var r=t;return Array.isArray(r)||(r=r.split(" ")),r.some((function(t){return e.$__.activePaths.states.default.hasOwnProperty(t)}))},it.prototype.$isDeleted=function(t){return 0===arguments.length?!!this.$__.isDeleted:(this.$__.isDeleted=!!t,this)},it.prototype.isDirectModified=function(t){var e=this;if(null==t)return this.$__.activePaths.some("modify");if("string"==typeof t&&-1===t.indexOf(" "))return this.$__.activePaths.states.modify.hasOwnProperty(t);var r=t;return Array.isArray(r)||(r=r.split(" ")),r.some((function(t){return e.$__.activePaths.states.modify.hasOwnProperty(t)}))},it.prototype.isInit=function(t){var e=this;if(null==t)return this.$__.activePaths.some("init");if("string"==typeof t&&-1===t.indexOf(" "))return this.$__.activePaths.states.init.hasOwnProperty(t);var r=t;return Array.isArray(r)||(r=r.split(" ")),r.some((function(t){return e.$__.activePaths.states.init.hasOwnProperty(t)}))},it.prototype.isSelected=function(t){var e=this;if(null==this.$__.selected)return!0;if(!t)return!1;if("_id"===t)return 0!==this.$__.selected._id;if(-1!==t.indexOf(" ")&&(t=t.split(" ")),Array.isArray(t))return t.some((function(t){return e.$__isSelected(t)}));var r=Object.keys(this.$__.selected),n=null;if(1===r.length&&"_id"===r[0])return 0===this.$__.selected._id;for(var i=0,o=r;i<o.length;i++){var s=o[i];if("_id"!==s&&T(this.$__.selected[s])){n=!!this.$__.selected[s];break}}if(null===n)return!0;if(t in this.$__.selected)return n;for(var a=t+".",u=0,h=r;u<h.length;u++){var f=h[u];if("_id"!==f){if(f.startsWith(a))return n||f!==a;if(a.startsWith(f+"."))return n}}return!n},it.prototype.$__isSelected=it.prototype.isSelected,it.prototype.isDirectSelected=function(t){var e=this;if(null==this.$__.selected)return!0;if("_id"===t)return 0!==this.$__.selected._id;if(-1!==t.indexOf(" ")&&(t=t.split(" ")),Array.isArray(t))return t.some((function(t){return e.isDirectSelected(t)}));var r=Object.keys(this.$__.selected),n=null;if(1===r.length&&"_id"===r[0])return 0===this.$__.selected._id;for(var i=0,o=r;i<o.length;i++){var s=o[i];if("_id"!==s&&T(this.$__.selected[s])){n=!!this.$__.selected[s];break}}return null===n||(this.$__.selected.hasOwnProperty(t)?n:!n)},it.prototype.validate=function(t,e,r){var n,i=this;if(this.$op="validate",null!=this.$isSubdocument||(this.$__.validating?n=new m(this,{parentStack:e&&e.parentStack,conflictStack:this.$__.validating.stack}):this.$__.validating=new m(this,{parentStack:e&&e.parentStack})),1===arguments.length?"object"!==s(arguments[0])||Array.isArray(arguments[0])?"function"==typeof arguments[0]&&(r=arguments[0],e=null,t=null):(e=arguments[0],r=null,t=null):"function"==typeof t?(r=t,e=null,t=null):"function"==typeof e&&(r=e,e=t,t=null),e&&"string"==typeof e.pathsToSkip){var o=-1===e.pathsToSkip.indexOf(" ");e.pathsToSkip=o?[e.pathsToSkip]:e.pathsToSkip.split(" ")}return S(r,(function(r){if(null!=n)return r(n);i.$__validate(t,e,(function(t){i.$op=null,r(t)}))}),this.constructor.events)},it.prototype.$validate=it.prototype.validate,it.prototype.$__validate=function(t,e,r){var n=this;"function"==typeof t?(r=t,e=null,t=null):"function"==typeof e&&(r=e,e=null);var o,a=e&&"object"===s(e)&&"validateModifiedOnly"in e,u=e&&e.pathsToSkip||null;o=a?!!e.validateModifiedOnly:this.$__schema.options.validateModifiedOnly;var h=this,f=function(){var t=n.$__.validationError;if(n.$__.validationError=void 0,o&&null!=t){for(var e=0,r=Object.keys(t.errors);e<r.length;e++){var i=r[e];n.$isModified(i)||delete t.errors[i]}0===Object.keys(t.errors).length&&(t=void 0)}if(n.$__.cachedRequired={},n.$emit("validate",h),n.constructor.emit("validate",h),t){for(var s in t.errors)!n[W]&&t.errors[s]instanceof l.CastError&&n.invalidate(s,t.errors[s]);return t}},c=ht(this),d=o?c[0].filter((function(t){return n.$isModified(t)})):c[0],p=c[1];if("string"==typeof t&&(t=t.split(" ")),Array.isArray(t)?d=ft(d,t):u&&(d=ct(d,u)),0===d.length)return B((function(){var t=f();if(t)return h.$__schema.s.hooks.execPost("validate:error",h,[h],{error:t},(function(t){r(t)}));r(null,h)}));var y,m={},b=0,v=i(d);try{for(v.s();!(y=v.n()).done;){w(y.value)}}catch(t){v.e(t)}finally{v.f()}function w(t){null==t||m[t]||(m[t]=!0,b++,B((function(){var e=h.$__schema.path(t);if(!e)return--b||_();if(h.$isValid(t)){if(null!=e[et]&&t!==e.path)return--b||_();var r,n=h.$__getValue(t);(r=h.$populated(t))?n=r:null!=n&&null!=n.$__&&n.$__.wasPopulated&&(n=n._id);var i=null!=h.$__.pathsToScopes&&t in h.$__.pathsToScopes?h.$__.pathsToScopes[t]:h,s={skipSchemaValidators:p[t],path:t,validateModifiedOnly:o};e.doValidate(n,(function(r){if(r){if((e.$isSingleNested||e.$isArraySubdocument||e.$isMongooseDocumentArray)&&r instanceof g)return--b||_();h.invalidate(t,r,void 0,!0)}--b||_()}),i,s)}else--b||_()})))}function _(){var t=f();if(t)return h.$__schema.s.hooks.execPost("validate:error",h,[h],{error:t},(function(t){r(t)}));r(null,h)}},it.prototype.validateSync=function(t,e){var r=this,n=this;1!==arguments.length||"object"!==s(arguments[0])||Array.isArray(arguments[0])||(e=arguments[0],t=null);var i,o=e&&"object"===s(e)&&"validateModifiedOnly"in e;i=o?!!e.validateModifiedOnly:this.$__schema.options.validateModifiedOnly;var a=e&&e.pathsToSkip;if("string"==typeof t){var u=-1===t.indexOf(" ");t=u?[t]:t.split(" ")}else"string"==typeof a&&-1!==a.indexOf(" ")&&(a=a.split(" "));var h=ht(this),f=i?h[0].filter((function(t){return r.$isModified(t)})):h[0],c=h[1];Array.isArray(t)?f=ft(f,t):Array.isArray(a)&&(f=ct(f,a));var d={};f.forEach((function(t){if(!d[t]){d[t]=!0;var e=n.$__schema.path(t);if(e&&n.$isValid(t)){var r=n.$__getValue(t),o=e.doValidateSync(r,n,{skipSchemaValidators:c[t],path:t,validateModifiedOnly:i});if(o){if((e.$isSingleNested||e.$isArraySubdocument||e.$isMongooseDocumentArray)&&o instanceof g)return;n.invalidate(t,o,void 0,!0)}}}}));var p=n.$__.validationError;if(n.$__.validationError=void 0,n.$emit("validate",n),n.constructor.emit("validate",n),p)for(var y in p.errors)p.errors[y]instanceof l.CastError&&n.invalidate(y,p.errors[y]);return p},it.prototype.invalidate=function(t,e,r,n){if(this.$__.validationError||(this.$__.validationError=new g(this)),!this.$__.validationError.errors[t])return e&&"string"!=typeof e||(e=new w({path:t,message:e,type:n||"user defined",value:r})),this.$__.validationError===e||this.$__.validationError.addError(t,e),this.$__.validationError},it.prototype.$markValid=function(t){this.$__.validationError&&this.$__.validationError.errors[t]&&(delete this.$__.validationError.errors[t],0===Object.keys(this.$__.validationError.errors).length&&(this.$__.validationError=null))},it.prototype.$isValid=function(t){var e=this;return null==this.$__.validationError||0===Object.keys(this.$__.validationError.errors).length||null!=t&&(-1!==t.indexOf(" ")&&(t=t.split(" ")),Array.isArray(t)?t.some((function(t){return null==e.$__.validationError.errors[t]})):null==this.$__.validationError.errors[t])},it.prototype.$__reset=function(){var t=this;return a||(a=r(27)),this.$__.activePaths.map("init","modify",(function(e){return t.$__getValue(e)})).filter((function(t){return t&&Array.isArray(t)&&U.isMongooseDocumentArray(t)&&t.length})).forEach((function(e){for(var r=e.length;r--;){var n=e[r];n&&n.$__reset()}t.$__.activePaths.init(e.$path()),e[H]=e[Z],e[Z]={}})),this.$__.activePaths.map("init","modify",(function(e){return t.$__getValue(e)})).filter((function(t){return t&&!Array.isArray(t)&&t.$isSingleNested})).forEach((function(e){e.$__reset(),e.$parent()===t?t.$__.activePaths.init(e.$basePath):null!=e.$parent()&&e.$parent().$isSubdocument&&e.$parent().$__reset()})),this.$__dirty().forEach((function(t){var e=t.value;e&&e[Z]&&(e[H]=e[Z],e[Z]={})})),this.$__.backup={},this.$__.backup.activePaths={modify:Object.assign({},this.$__.activePaths.states.modify),default:Object.assign({},this.$__.activePaths.states.default)},this.$__.backup.validationError=this.$__.validationError,this.$__.backup.errors=this.$errors,this.$__.activePaths.clear("modify"),this.$__.activePaths.clear("default"),this.$__.validationError=void 0,this.$errors=void 0,t=this,this.$__schema.requiredPaths().forEach((function(e){t.$__.activePaths.require(e)})),this},
|
|
372
|
+
it.prototype[G]=it.prototype.get,it.prototype.$get=it.prototype.get,it.prototype.$__path=function(t){var e=this.$__.adhocPaths,r=e&&e.hasOwnProperty(t)?e[t]:null;return r||this.$__schema.path(t)},it.prototype.markModified=function(t,e){this.$__.activePaths.modify(t),null==e||this.$isSubdocument||(this.$__.pathsToScopes=this.$__pathsToScopes||{},this.$__.pathsToScopes[t]=e)},it.prototype.unmarkModified=function(t){this.$__.activePaths.init(t),null!=this.$__.pathsToScopes&&delete this.$__.pathsToScopes[t]},it.prototype.$ignore=function(t){this.$__.activePaths.ignore(t)},it.prototype.directModifiedPaths=function(){return Object.keys(this.$__.activePaths.states.modify)},it.prototype.$isEmpty=function(t){var e={minimize:!0,virtuals:!1,getters:!1,transform:!1};if(0!==arguments.length){var r=this.$get(t);return null==r||"object"===s(r)&&(U.isPOJO(r)?ut(r):0===Object.keys(r.toObject(e)).length)}return 0===Object.keys(this.toObject(e)).length},it.prototype.modifiedPaths=function(t){t=t||{};var e=Object.keys(this.$__.activePaths.states.modify),r=new Set,n=0,i=0,o=e.length;for(n=0;n<o;++n){var a=e[n],u=rt(a),h=u.length;for(i=0;i<h;++i)r.add(u[i]);if(t.includeChildren){var f=0,c=this.$get(a);if("object"===s(c)&&null!==c){c._doc&&(c=c._doc);var l=c.length;if(Array.isArray(c))for(f=0;f<l;++f){var d=a+"."+f;if(!r.has(d)&&(r.add(d),null!=c[f]&&c[f].$__)){var p=c[f].modifiedPaths(),y=0,m=p.length;for(y=0;y<m;++y)r.add(d+"."+p[y])}}else{var b=Object.keys(c),v=0,g=b.length;for(v=0;v<g;++v)r.add(a+"."+b[v])}}}}return Array.from(r)},it.prototype[Y]=it.prototype.modifiedPaths,it.prototype.isModified=function(t,e){if(t){var r=Object.keys(this.$__.activePaths.states.modify);if(0===r.length)return!1;Array.isArray(t)||(t=-1===t.indexOf(" ")?[t]:t.split(" "));var n=e||this[Y]();return t.some((function(t){return!!~n.indexOf(t)}))||t.some((function(t){return r.some((function(e){return e===t||t.startsWith(e+".")}))}))}return this.$__.activePaths.some("modify")},it.prototype.$isModified=it.prototype.isModified,it.prototype[J]=it.prototype.isModified,it.prototype.$isDefault=function(t){var e=this;if(null==t)return this.$__.activePaths.some("default");if("string"==typeof t&&-1===t.indexOf(" "))return this.$__.activePaths.states.default.hasOwnProperty(t);var r=t;return Array.isArray(r)||(r=r.split(" ")),r.some((function(t){return e.$__.activePaths.states.default.hasOwnProperty(t)}))},it.prototype.$isDeleted=function(t){return 0===arguments.length?!!this.$__.isDeleted:(this.$__.isDeleted=!!t,this)},it.prototype.isDirectModified=function(t){var e=this;if(null==t)return this.$__.activePaths.some("modify");if("string"==typeof t&&-1===t.indexOf(" "))return this.$__.activePaths.states.modify.hasOwnProperty(t);var r=t;return Array.isArray(r)||(r=r.split(" ")),r.some((function(t){return e.$__.activePaths.states.modify.hasOwnProperty(t)}))},it.prototype.isInit=function(t){var e=this;if(null==t)return this.$__.activePaths.some("init");if("string"==typeof t&&-1===t.indexOf(" "))return this.$__.activePaths.states.init.hasOwnProperty(t);var r=t;return Array.isArray(r)||(r=r.split(" ")),r.some((function(t){return e.$__.activePaths.states.init.hasOwnProperty(t)}))},it.prototype.isSelected=function(t){var e=this;if(null==this.$__.selected)return!0;if(!t)return!1;if("_id"===t)return 0!==this.$__.selected._id;if(-1!==t.indexOf(" ")&&(t=t.split(" ")),Array.isArray(t))return t.some((function(t){return e.$__isSelected(t)}));var r=Object.keys(this.$__.selected),n=null;if(1===r.length&&"_id"===r[0])return 0===this.$__.selected._id;for(var i=0,o=r;i<o.length;i++){var s=o[i];if("_id"!==s&&T(this.$__.selected[s])){n=!!this.$__.selected[s];break}}if(null===n)return!0;if(t in this.$__.selected)return n;for(var a=t+".",u=0,h=r;u<h.length;u++){var f=h[u];if("_id"!==f){if(f.startsWith(a))return n||f!==a;if(a.startsWith(f+"."))return n}}return!n},it.prototype.$__isSelected=it.prototype.isSelected,it.prototype.isDirectSelected=function(t){var e=this;if(null==this.$__.selected)return!0;if("_id"===t)return 0!==this.$__.selected._id;if(-1!==t.indexOf(" ")&&(t=t.split(" ")),Array.isArray(t))return t.some((function(t){return e.isDirectSelected(t)}));var r=Object.keys(this.$__.selected),n=null;if(1===r.length&&"_id"===r[0])return 0===this.$__.selected._id;for(var i=0,o=r;i<o.length;i++){var s=o[i];if("_id"!==s&&T(this.$__.selected[s])){n=!!this.$__.selected[s];break}}return null===n||(this.$__.selected.hasOwnProperty(t)?n:!n)},it.prototype.validate=function(t,e,r){var n,i=this;if(this.$op="validate",null!=this.$isSubdocument||(this.$__.validating?n=new m(this,{parentStack:e&&e.parentStack,conflictStack:this.$__.validating.stack}):this.$__.validating=new m(this,{parentStack:e&&e.parentStack})),1===arguments.length?"object"!==s(arguments[0])||Array.isArray(arguments[0])?"function"==typeof arguments[0]&&(r=arguments[0],e=null,t=null):(e=arguments[0],r=null,t=null):"function"==typeof t?(r=t,e=null,t=null):"function"==typeof e&&(r=e,e=t,t=null),e&&"string"==typeof e.pathsToSkip){var o=-1===e.pathsToSkip.indexOf(" ");e.pathsToSkip=o?[e.pathsToSkip]:e.pathsToSkip.split(" ")}return S(r,(function(r){if(null!=n)return r(n);i.$__validate(t,e,(function(t){i.$op=null,r(t)}))}),this.constructor.events)},it.prototype.$validate=it.prototype.validate,it.prototype.$__validate=function(t,e,r){var n=this;"function"==typeof t?(r=t,e=null,t=null):"function"==typeof e&&(r=e,e=null);var o,a=e&&"object"===s(e)&&"validateModifiedOnly"in e,u=e&&e.pathsToSkip||null;o=a?!!e.validateModifiedOnly:this.$__schema.options.validateModifiedOnly;var h=this,f=function(){var t=n.$__.validationError;if(n.$__.validationError=void 0,o&&null!=t){for(var e=0,r=Object.keys(t.errors);e<r.length;e++){var i=r[e];n.$isModified(i)||delete t.errors[i]}0===Object.keys(t.errors).length&&(t=void 0)}if(n.$__.cachedRequired={},n.$emit("validate",h),n.constructor.emit("validate",h),t){for(var s in t.errors)!n[W]&&t.errors[s]instanceof l.CastError&&n.invalidate(s,t.errors[s]);return t}},c=ht(this),d=o?c[0].filter((function(t){return n.$isModified(t)})):c[0],p=c[1];if("string"==typeof t&&(t=t.split(" ")),Array.isArray(t)?d=ft(d,t):u&&(d=ct(d,u)),0===d.length)return B((function(){var t=f();if(t)return h.$__schema.s.hooks.execPost("validate:error",h,[h],{error:t},(function(t){r(t)}));r(null,h)}));var y,m={},b=0,v=i(d);try{for(v.s();!(y=v.n()).done;){w(y.value)}}catch(t){v.e(t)}finally{v.f()}function w(t){null==t||m[t]||(m[t]=!0,b++,B((function(){var e=h.$__schema.path(t);if(!e)return--b||_();if(h.$isValid(t)){if(null!=e[et]&&t!==e.path)return--b||_();var r,n=h.$__getValue(t);(r=h.$populated(t))?n=r:null!=n&&null!=n.$__&&n.$__.wasPopulated&&(n=n._id);var i=null!=h.$__.pathsToScopes&&t in h.$__.pathsToScopes?h.$__.pathsToScopes[t]:h,s={skipSchemaValidators:p[t],path:t,validateModifiedOnly:o};e.doValidate(n,(function(r){if(r){if((e.$isSingleNested||e.$isArraySubdocument||e.$isMongooseDocumentArray)&&r instanceof g)return--b||_();h.invalidate(t,r,void 0,!0)}--b||_()}),i,s)}else--b||_()})))}function _(){var t=f();if(t)return h.$__schema.s.hooks.execPost("validate:error",h,[h],{error:t},(function(t){r(t)}));r(null,h)}},it.prototype.validateSync=function(t,e){var r=this,n=this;1!==arguments.length||"object"!==s(arguments[0])||Array.isArray(arguments[0])||(e=arguments[0],t=null);var i,o=e&&"object"===s(e)&&"validateModifiedOnly"in e;i=o?!!e.validateModifiedOnly:this.$__schema.options.validateModifiedOnly;var a=e&&e.pathsToSkip;if("string"==typeof t){var u=-1===t.indexOf(" ");t=u?[t]:t.split(" ")}else"string"==typeof a&&-1!==a.indexOf(" ")&&(a=a.split(" "));var h=ht(this),f=i?h[0].filter((function(t){return r.$isModified(t)})):h[0],c=h[1];Array.isArray(t)?f=ft(f,t):Array.isArray(a)&&(f=ct(f,a));for(var d={},p=0,y=f.length;p<y;++p){var m=f[p];if(!d[m]){d[m]=!0;var b=n.$__schema.path(m);if(b&&n.$isValid(m)){var v=n.$__getValue(m),w=b.doValidateSync(v,n,{skipSchemaValidators:c[m],path:m,validateModifiedOnly:i});if(w){var _=b.$isSingleNested||b.$isArraySubdocument||b.$isMongooseDocumentArray;if(_&&w instanceof g)continue;n.invalidate(m,w,void 0,!0)}}}}var M=n.$__.validationError;if(n.$__.validationError=void 0,n.$emit("validate",n),n.constructor.emit("validate",n),M)for(var S in M.errors)M.errors[S]instanceof l.CastError&&n.invalidate(S,M.errors[S]);return M},it.prototype.invalidate=function(t,e,r,n){if(this.$__.validationError||(this.$__.validationError=new g(this)),!this.$__.validationError.errors[t])return e&&"string"!=typeof e||(e=new w({path:t,message:e,type:n||"user defined",value:r})),this.$__.validationError===e||this.$__.validationError.addError(t,e),this.$__.validationError},it.prototype.$markValid=function(t){this.$__.validationError&&this.$__.validationError.errors[t]&&(delete this.$__.validationError.errors[t],0===Object.keys(this.$__.validationError.errors).length&&(this.$__.validationError=null))},it.prototype.$isValid=function(t){var e=this;return null==this.$__.validationError||0===Object.keys(this.$__.validationError.errors).length||null!=t&&(-1!==t.indexOf(" ")&&(t=t.split(" ")),Array.isArray(t)?t.some((function(t){return null==e.$__.validationError.errors[t]})):null==this.$__.validationError.errors[t])},it.prototype.$__reset=function(){var t=this;return a||(a=r(27)),this.$__.activePaths.map("init","modify",(function(e){return t.$__getValue(e)})).filter((function(t){return t&&Array.isArray(t)&&U.isMongooseDocumentArray(t)&&t.length})).forEach((function(e){for(var r=e.length;r--;){var n=e[r];n&&n.$__reset()}t.$__.activePaths.init(e.$path()),e[H]=e[Z],e[Z]={}})),this.$__.activePaths.map("init","modify",(function(e){return t.$__getValue(e)})).filter((function(t){return t&&!Array.isArray(t)&&t.$isSingleNested})).forEach((function(e){e.$__reset(),e.$parent()===t?t.$__.activePaths.init(e.$basePath):null!=e.$parent()&&e.$parent().$isSubdocument&&e.$parent().$__reset()})),this.$__dirty().forEach((function(t){var e=t.value;e&&e[Z]&&(e[H]=e[Z],e[Z]={})})),this.$__.backup={},this.$__.backup.activePaths={modify:Object.assign({},this.$__.activePaths.states.modify),default:Object.assign({},this.$__.activePaths.states.default)},this.$__.backup.validationError=this.$__.validationError,this.$__.backup.errors=this.$errors,this.$__.activePaths.clear("modify"),this.$__.activePaths.clear("default"),this.$__.validationError=void 0,this.$errors=void 0,t=this,this.$__schema.requiredPaths().forEach((function(e){t.$__.activePaths.require(e)})),this},
|
|
373
373
|
/*!
|
|
374
374
|
* ignore
|
|
375
375
|
*/
|
|
376
|
-
it.prototype.$__undoReset=function(){if(null!=this.$__.backup&&null!=this.$__.backup.activePaths){this.$__.activePaths.states.modify=this.$__.backup.activePaths.modify,this.$__.activePaths.states.default=this.$__.backup.activePaths.default,this.$__.validationError=this.$__.backup.validationError,this.$errors=this.$__.backup.errors;var t,e=i(this.$__dirty());try{for(e.s();!(t=e.n()).done;){var r=t.value.value;r&&r[Z]&&r[H]&&(r[Z]=r[H])}}catch(t){e.e(t)}finally{e.f()}var n,o=i(this.$getAllSubdocs());try{for(o.s();!(n=o.n()).done;){n.value.$__undoReset()}}catch(t){o.e(t)}finally{o.f()}}},it.prototype.$__dirty=function(){var t=this,e=this.$__.activePaths.map("modify",(function(e){return{path:e,value:t.$__getValue(e),schema:t.$__path(e)}}));e=e.concat(this.$__.activePaths.map("default",(function(e){if("_id"!==e&&null!=t.$__getValue(e))return{path:e,value:t.$__getValue(e),schema:t.$__path(e)}})));var r=new Map(e.filter((function(t){return null!=t})).map((function(t){return[t.path,t.value]}))),n=[];return e.forEach((function(t){if(t){for(var e=null,i=rt(t.path),o=0;o<i.length-1;o++)if(r.has(i[o])){e=r.get(i[o]);break}null==e?n.push(t):null!=e&&null!=e[Z]&&e.hasAtomics()&&(e[Z]={},e[Z].$set=e)}})),n},it.prototype.$__setSchema=function(t){A(t.tree,this,void 0,t.options);for(var e=0,r=Object.keys(t.virtuals);e<r.length;e++){var n=r[e];t.virtuals[n]._applyDefaultGetters()}null==t.path("schema")&&(this.schema=t),this.$__schema=t,this[Q]=t},it.prototype.$__getArrayPathsToValidate=function(){return a||(a=r(27)),this.$__.activePaths.map("init","modify",function(t){return this.$__getValue(t)}.bind(this)).filter((function(t){return t&&Array.isArray(t)&&U.isMongooseDocumentArray(t)&&t.length})).reduce((function(t,e){return t.concat(e)}),[]).filter((function(t){return t}))},it.prototype.$getAllSubdocs=function(){function t(e,r,n){var i=e,o=!1;if(n&&(e instanceof it&&e[Q].paths[n]?i=e._doc[n]:e instanceof it&&e[Q].nested[n]?(i=e._doc[n],o=!0):i=e[n]),i instanceof h)r.push(i);else if(i instanceof Map)r=Array.from(i.keys()).reduce((function(e,r){return t(i.get(r),e,null)}),r);else if(i&&!Array.isArray(i)&&i.$isSingleNested)(r=Object.keys(i._doc).reduce((function(e,r){return t(i._doc,e,r)}),r)).push(i);else if(i&&U.isMongooseDocumentArray(i))i.forEach((function(e){e&&e._doc&&(r=Object.keys(e._doc).reduce((function(r,n){return t(e._doc,r,n)}),r),e instanceof h&&r.push(e))}));else if(o&&null!=i)for(var s=0,a=Object.keys(i);s<a.length;s++){var u=a[s];t(i,r,u)}return r}a||(a=r(27)),h=h||r(46);for(var e=[],n=0,i=Object.keys(this._doc);n<i.length;n++){t(this,e,i[n])}return e},it.prototype.$__handleReject=function(t){this.$listeners("error").length?this.$emit("error",t):this.constructor.listeners&&this.constructor.listeners("error").length&&this.constructor.emit("error",t)},it.prototype.$toObject=function(t,e){var r,n,i={transform:!0,flattenDecimals:!0},o=e?"toJSON":"toObject",s=this.constructor&&this.constructor.base&&this.constructor.base.options&&j(this.constructor.base.options,o)||{},a=this.$__schema&&this.$__schema.options||{};i=U.options(i,z(s)),i=U.options(i,z(a[o]||{})),(t=U.isPOJO(t)?z(t):{})._calledWithOptions=t._calledWithOptions||z(t),r=null!=t._calledWithOptions.minimize?t.minimize:null!=i.minimize?i.minimize:a.minimize,n=null!=t._calledWithOptions.flattenMaps?t.flattenMaps:null!=i.flattenMaps?i.flattenMaps:a.flattenMaps;var u=Object.assign(U.clone(t),{_isNested:!0,json:e,minimize:r,flattenMaps:n});if(U.hasUserDefinedProperty(t,"getters")&&(u.getters=t.getters),U.hasUserDefinedProperty(t,"virtuals")&&(u.virtuals=t.virtuals),(t.depopulate||t._parentOptions&&t._parentOptions.depopulate||!1)&&t._isNested&&this.$__.wasPopulated)return z(this._id,u);(t=U.options(i,t))._isNested=!0,t.json=e,t.minimize=r,u._parentOptions=t,u._skipSingleNestedGetters=!0;var h=Object.assign({},u);h._skipSingleNestedGetters=!1;var f=t.transform,c=z(this._doc,u)||{};t.getters&&(!function(t,e,r){var n,i,o=t.$__schema,s=Object.keys(o.paths),a=s.length,u=t._doc;if(!u)return e;for(;a--;){var h=(n=s[a]).split("."),f=h.length,c=f-1,l=e,d=void 0;if(u=t._doc,t.$__isSelected(n))for(var p=0;p<f;++p){if(d=h[p],i=u[d],p===c){var y=t.$get(n);l[d]=z(y,r)}else{if(null==i){d in u&&(l[d]=i);break}l=l[d]||(l[d]={})}u=i}}}
|
|
376
|
+
it.prototype.$__undoReset=function(){if(null!=this.$__.backup&&null!=this.$__.backup.activePaths){this.$__.activePaths.states.modify=this.$__.backup.activePaths.modify,this.$__.activePaths.states.default=this.$__.backup.activePaths.default,this.$__.validationError=this.$__.backup.validationError,this.$errors=this.$__.backup.errors;var t,e=i(this.$__dirty());try{for(e.s();!(t=e.n()).done;){var r=t.value.value;r&&r[Z]&&r[H]&&(r[Z]=r[H])}}catch(t){e.e(t)}finally{e.f()}var n,o=i(this.$getAllSubdocs());try{for(o.s();!(n=o.n()).done;){n.value.$__undoReset()}}catch(t){o.e(t)}finally{o.f()}}},it.prototype.$__dirty=function(){var t=this,e=this.$__.activePaths.map("modify",(function(e){return{path:e,value:t.$__getValue(e),schema:t.$__path(e)}}));e=e.concat(this.$__.activePaths.map("default",(function(e){if("_id"!==e&&null!=t.$__getValue(e))return{path:e,value:t.$__getValue(e),schema:t.$__path(e)}})));var r=new Map(e.filter((function(t){return null!=t})).map((function(t){return[t.path,t.value]}))),n=[];return e.forEach((function(t){if(t){for(var e=null,i=rt(t.path),o=0;o<i.length-1;o++)if(r.has(i[o])){e=r.get(i[o]);break}null==e?n.push(t):null!=e&&null!=e[Z]&&e.hasAtomics()&&(e[Z]={},e[Z].$set=e)}})),n},it.prototype.$__setSchema=function(t){A(t.tree,this,void 0,t.options);for(var e=0,r=Object.keys(t.virtuals);e<r.length;e++){var n=r[e];t.virtuals[n]._applyDefaultGetters()}null==t.path("schema")&&(this.schema=t),this.$__schema=t,this[Q]=t},it.prototype.$__getArrayPathsToValidate=function(){return a||(a=r(27)),this.$__.activePaths.map("init","modify",function(t){return this.$__getValue(t)}.bind(this)).filter((function(t){return t&&Array.isArray(t)&&U.isMongooseDocumentArray(t)&&t.length})).reduce((function(t,e){return t.concat(e)}),[]).filter((function(t){return t}))},it.prototype.$getAllSubdocs=function(){function t(e,r,n){var i=e,o=!1;if(n&&(e instanceof it&&e[Q].paths[n]?i=e._doc[n]:e instanceof it&&e[Q].nested[n]?(i=e._doc[n],o=!0):i=e[n]),i instanceof h)r.push(i);else if(i instanceof Map)r=Array.from(i.keys()).reduce((function(e,r){return t(i.get(r),e,null)}),r);else if(i&&!Array.isArray(i)&&i.$isSingleNested)(r=Object.keys(i._doc).reduce((function(e,r){return t(i._doc,e,r)}),r)).push(i);else if(i&&U.isMongooseDocumentArray(i))i.forEach((function(e){e&&e._doc&&(r=Object.keys(e._doc).reduce((function(r,n){return t(e._doc,r,n)}),r),e instanceof h&&r.push(e))}));else if(o&&null!=i)for(var s=0,a=Object.keys(i);s<a.length;s++){var u=a[s];t(i,r,u)}return r}a||(a=r(27)),h=h||r(46);for(var e=[],n=0,i=Object.keys(this._doc);n<i.length;n++){t(this,e,i[n])}return e},it.prototype.$__handleReject=function(t){this.$listeners("error").length?this.$emit("error",t):this.constructor.listeners&&this.constructor.listeners("error").length&&this.constructor.emit("error",t)},it.prototype.$toObject=function(t,e){var r,n,i={transform:!0,flattenDecimals:!0},o=e?"toJSON":"toObject",s=this.constructor&&this.constructor.base&&this.constructor.base.options&&j(this.constructor.base.options,o)||{},a=this.$__schema&&this.$__schema.options||{};i=U.options(i,z(s)),i=U.options(i,z(a[o]||{})),(t=U.isPOJO(t)?z(t):{})._calledWithOptions=t._calledWithOptions||z(t),r=null!=t._calledWithOptions.minimize?t.minimize:null!=i.minimize?i.minimize:a.minimize,n=null!=t._calledWithOptions.flattenMaps?t.flattenMaps:null!=i.flattenMaps?i.flattenMaps:a.flattenMaps;var u=Object.assign(U.clone(t),{_isNested:!0,json:e,minimize:r,flattenMaps:n});if(U.hasUserDefinedProperty(t,"getters")&&(u.getters=t.getters),U.hasUserDefinedProperty(t,"virtuals")&&(u.virtuals=t.virtuals),(t.depopulate||t._parentOptions&&t._parentOptions.depopulate||!1)&&t._isNested&&this.$__.wasPopulated)return z(this.$__.wasPopulated.value||this._id,u);(t=U.options(i,t))._isNested=!0,t.json=e,t.minimize=r,u._parentOptions=t,u._skipSingleNestedGetters=!0;var h=Object.assign({},u);h._skipSingleNestedGetters=!1;var f=t.transform,c=z(this._doc,u)||{};t.getters&&(!function(t,e,r){var n,i,o=t.$__schema,s=Object.keys(o.paths),a=s.length,u=t._doc;if(!u)return e;for(;a--;){var h=(n=s[a]).split("."),f=h.length,c=f-1,l=e,d=void 0;if(u=t._doc,t.$__isSelected(n))for(var p=0;p<f;++p){if(d=h[p],i=u[d],p===c){var y=t.$get(n);l[d]=z(y,r)}else{if(null==i){d in u&&(l[d]=i);break}l=l[d]||(l[d]={})}u=i}}}
|
|
377
377
|
/*!
|
|
378
378
|
* Applies schema type transforms to `json`.
|
|
379
379
|
*
|
|
@@ -413,7 +413,7 @@ n.prototype.hasOwnProperty("valueOf")||(n.prototype.valueOf=function(){return th
|
|
|
413
413
|
*/function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){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 a(t){var e="function"==typeof Map?new Map:void 0;return(a=function(t){if(null===t||(r=t,-1===Function.toString.call(r).indexOf("[native code]")))return t;var r;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return u(t,arguments,c(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),f(n,t)})(t)}function u(t,e,r){return(u=h()?Reflect.construct:function(t,e,r){var n=[null];n.push.apply(n,e);var i=new(Function.bind.apply(t,n));return r&&f(i,r.prototype),i}).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 f(t,e){return(f=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function c(t){return(c=Object.setPrototypeOf?Object.getPrototypeOf: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&&f(t,e)}(d,t);var e,r,n,a,u,l=(e=d,r=h(),function(){var t,n=c(e);if(r){var i=c(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return s(this,t)});function d(){return o(this,d),l.apply(this,arguments)}return n=d,a&&i(n.prototype,a),u&&i(n,u),Object.defineProperty(n,"prototype",{writable:!1}),n}(a(Error));Object.defineProperty(l.prototype,"name",{value:"MongooseError"}),t.exports=l},function(t,e,r){"use strict";
|
|
414
414
|
/*!
|
|
415
415
|
* Module dependencies.
|
|
416
|
-
*/function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}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,n.key,n)}}function s(t,e){return(s=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function a(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=h(t);if(e){var i=h(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return u(this,r)}}function u(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var f=r(19),c=r(
|
|
416
|
+
*/function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}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,n.key,n)}}function s(t,e){return(s=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function a(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=h(t);if(e){var i=h(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return u(this,r)}}function u(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var f=r(19),c=r(9),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)}(f,t);var e,r,n,h=a(f);function f(t,e,r,n,o){var s;if(i(this,f),arguments.length>0){var a=d(e),c=p(e),l=y(o),b=m(null,t,a,r,l,c);(s=h.call(this,b)).init(t,e,r,n,o)}else s=h.call(this,m());return u(s)}return e=f,(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}}
|
|
417
417
|
/*!
|
|
418
418
|
* ignore
|
|
419
419
|
*/},{key:"init",value:function(t,e,r,n,i){this.stringValue=d(e),this.messageFormat=y(i),this.kind=t,this.value=e,this.path=r,this.reason=n,this.valueType=p(e)}
|
|
@@ -438,7 +438,7 @@ n.prototype.hasOwnProperty("valueOf")||(n.prototype.valueOf=function(){return th
|
|
|
438
438
|
*/var n=null;t.exports.get=function(){return n},t.exports.set=function(t){n=t}},function(t,e,r){"use strict";var n=r(47),i=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};t.exports=c;var o=Object.create(r(37));o.inherits=r(0);var s=r(105),a=r(65);o.inherits(c,s);for(var u=i(a.prototype),h=0;h<u.length;h++){var f=u[h];c.prototype[f]||(c.prototype[f]=a.prototype[f])}function c(t){if(!(this instanceof c))return new c(t);s.call(this,t),a.call(this,t),t&&!1===t.readable&&(this.readable=!1),t&&!1===t.writable&&(this.writable=!1),this.allowHalfOpen=!0,t&&!1===t.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",l)}function l(){this.allowHalfOpen||this._writableState.ended||n.nextTick(d,this)}function d(t){t.end()}Object.defineProperty(c.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(c.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(t){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}}),c.prototype._destroy=function(t,e){this.push(null),this.end(),n.nextTick(e,t)}},function(t,e,r){"use strict";
|
|
439
439
|
/*!
|
|
440
440
|
* Module dependencies.
|
|
441
|
-
*/function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var i=r(89),o=r(
|
|
441
|
+
*/function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var i=r(89),o=r(329),s=r(13),a=r(1).arrayAtomicsSymbol,u=r(1).arrayAtomicsBackupSymbol,h=r(1).arrayParentSymbol,f=r(1).arrayPathSymbol,c=r(1).arraySchemaSymbol,l=Array.prototype.push,d=/^\d+$/;
|
|
442
442
|
/*!
|
|
443
443
|
* Module exports.
|
|
444
444
|
*/
|
|
@@ -484,13 +484,13 @@ var r=e.nextTick.bind(e);t.exports=function(t){return r(t)}}).call(this,r(5))},f
|
|
|
484
484
|
*
|
|
485
485
|
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
|
|
486
486
|
* @license MIT
|
|
487
|
-
*/function o(t,e){if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];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(
|
|
487
|
+
*/function o(t,e){if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];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(9),u=Object.prototype.hasOwnProperty,h=Array.prototype.slice,f="foo"===function(){}.name;function c(t){return Object.prototype.toString.call(t)}function l(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 d=t.exports=g,p=/\s*function\s+([^\(\s]*)\s*/;function y(t){if(a.isFunction(t)){if(f)return t.name;var e=t.toString().match(p);return e&&e[1]}}function m(t,e){return"string"==typeof t?t.length<e?t:t.slice(0,e):t}function b(t){if(f||!a.isFunction(t))return a.inspect(t);var e=y(t);return"[Function"+(e?": "+e:"")+"]"}function v(t,e,r,n,i){throw new d.AssertionError({message:r,actual:t,expected:e,operator:n,stackStartFunction:i})}function g(t,e){t||v(t,!0,e,"==",d.ok)}function w(t,e,r,i){if(t===e)return!0;if(s(t)&&s(e))return 0===o(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(l(t)&&l(e)&&c(t)===c(e)&&!(t instanceof Float32Array||t instanceof Float64Array))return 0===o(new Uint8Array(t.buffer),new Uint8Array(e.buffer));if(s(t)!==s(e))return!1;var u=(i=i||{actual:[],expected:[]}).actual.indexOf(t);return-1!==u&&u===i.expected.indexOf(e)||(i.actual.push(t),i.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 i=_(t),o=_(e);if(i&&!o||!i&&o)return!1;if(i)return t=h.call(t),e=h.call(e),w(t,e,r);var s,u,f=O(t),c=O(e);if(f.length!==c.length)return!1;for(f.sort(),c.sort(),u=f.length-1;u>=0;u--)if(f[u]!==c[u])return!1;for(u=f.length-1;u>=0;u--)if(s=f[u],!w(t[s],e[s],r,n))return!1;return!0}(t,e,r,i))}return r?t===e:t==e}function _(t){return"[object Arguments]"==Object.prototype.toString.call(t)}function M(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 i;if("function"!=typeof e)throw new TypeError('"block" argument must be a function');"string"==typeof r&&(n=r,r=null),i=function(t){var e;try{t()}catch(t){e=t}return e}(e),n=(r&&r.name?" ("+r.name+").":".")+(n?" "+n:"."),t&&!i&&v(i,r,"Missing expected exception"+n);var o="string"==typeof n,s=!t&&i&&!r;if((!t&&a.isError(i)&&o&&M(i,r)||s)&&v(i,r,"Got unwanted exception"+n),t&&i&&r&&!M(i,r)||!t&&i)throw i}d.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 m(b(t.actual),128)+" "+t.operator+" "+m(b(t.expected),128)}(this),this.generatedMessage=!0);var e=t.stackStartFunction||v;if(Error.captureStackTrace)Error.captureStackTrace(this,e);else{var r=new Error;if(r.stack){var n=r.stack,i=y(e),o=n.indexOf("\n"+i);if(o>=0){var s=n.indexOf("\n",o+1);n=n.substring(s+1)}this.stack=n}}},a.inherits(d.AssertionError,Error),d.fail=v,d.ok=g,d.equal=function(t,e,r){t!=e&&v(t,e,r,"==",d.equal)},d.notEqual=function(t,e,r){t==e&&v(t,e,r,"!=",d.notEqual)},d.deepEqual=function(t,e,r){w(t,e,!1)||v(t,e,r,"deepEqual",d.deepEqual)},d.deepStrictEqual=function(t,e,r){w(t,e,!0)||v(t,e,r,"deepStrictEqual",d.deepStrictEqual)},d.notDeepEqual=function(t,e,r){w(t,e,!1)&&v(t,e,r,"notDeepEqual",d.notDeepEqual)},d.notDeepStrictEqual=function t(e,r,n){w(e,r,!0)&&v(e,r,n,"notDeepStrictEqual",t)},d.strictEqual=function(t,e,r){t!==e&&v(t,e,r,"===",d.strictEqual)},d.notStrictEqual=function(t,e,r){t===e&&v(t,e,r,"!==",d.notStrictEqual)},d.throws=function(t,e,r){S(!0,t,e,r)},d.doesNotThrow=function(t,e,r){S(!1,t,e,r)},d.ifError=function(t){if(t)throw t},d.strict=i((function t(e,r){e||v(e,!0,r,"==",t)}),d,{equal:d.strictEqual,deepEqual:d.deepStrictEqual,notEqual:d.notStrictEqual,notDeepEqual:d.notDeepStrictEqual}),d.strict.strict=d.strict;var O=Object.keys||function(t){var e=[];for(var r in t)u.call(t,r)&&e.push(r);return e}}).call(this,r(6))},function(t,e,r){"use strict";
|
|
488
488
|
/*!
|
|
489
489
|
* Module dependencies.
|
|
490
490
|
*/function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function o(t,e){return(o=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function s(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=u(t);if(e){var i=u(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return a(this,r)}}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){return(u=Object.setPrototypeOf?Object.getPrototypeOf: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&&o(t,e)}(u,t);var e,r,n,a=s(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=a.call(this,e)).isImmutableError=!!r,n.path=t,n}return e=u,r&&i(e.prototype,r),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(r(7));Object.defineProperty(h.prototype,"name",{value:"StrictModeError"}),t.exports=h},function(t,e,r){"use strict";
|
|
491
491
|
/*!
|
|
492
492
|
* Module dependencies.
|
|
493
|
-
*/var n=r(
|
|
493
|
+
*/var n=r(8),i=r(55),o=r(33),s=r(4);function a(t,e){if(e&&e.default){var r=e.default;Array.isArray(r)&&0===r.length?e.default=Array:!e.shared&&o(r)&&0===Object.keys(r).length&&(e.default=function(){return{}})}n.call(this,t,e,"Mixed"),this[i.schemaMixedSymbol]=!0}a.schemaName="Mixed",a.defaultOptions={},
|
|
494
494
|
/*!
|
|
495
495
|
* Inherits from SchemaType.
|
|
496
496
|
*/
|
|
@@ -511,7 +511,7 @@ t.exports=a},function(t,e,r){"use strict";
|
|
|
511
511
|
* @inherits Document
|
|
512
512
|
* @api private
|
|
513
513
|
*/
|
|
514
|
-
function a(t,e,r,n,a){o.isMongooseDocumentArray(e)?(this.__parentArray=e,this[s]=e.$parent()):(this.__parentArray=void 0,this[s]=void 0),this.$setIndex(a),this.$__parent=this[s],i.call(this,t,n,this[s],
|
|
514
|
+
function a(t,e,r,n,a){o.isMongooseDocumentArray(e)?(this.__parentArray=e,this[s]=e.$parent()):(this.__parentArray=void 0,this[s]=void 0),this.$setIndex(a),this.$__parent=this[s],i.call(this,t,n,this[s],r,{isNew:!0})}
|
|
515
515
|
/*!
|
|
516
516
|
* Inherit from Subdocument
|
|
517
517
|
*/for(var u in a.prototype=Object.create(i.prototype),a.prototype.constructor=a,Object.defineProperty(a.prototype,"$isSingleNested",{configurable:!1,writable:!1,value:!1}),Object.defineProperty(a.prototype,"$isDocumentArrayElement",{configurable:!1,writable:!1,value:!0}),n.prototype)a[u]=n.prototype[u];
|
|
@@ -600,7 +600,7 @@ var n=r(3),i=n.Buffer;function o(t,e){for(var r in t)e[r]=t[r]}function s(t,e,r)
|
|
|
600
600
|
/*!
|
|
601
601
|
* Module dependencies.
|
|
602
602
|
*/
|
|
603
|
-
function i(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function s(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return a(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return a(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return s=t.done,t},e:function(t){u=!0,o=t},f:function(){try{s||null==r.return||r.return()}finally{if(u)throw o}}}}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var u,h=r(12).EventEmitter,f=r(
|
|
603
|
+
function i(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function s(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return a(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return a(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return s=t.done,t},e:function(t){u=!0,o=t},f:function(){try{s||null==r.return||r.return()}finally{if(u)throw o}}}}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var u,h=r(12).EventEmitter,f=r(307),c=r(19),l=r(8),d=r(15),p=r(308),y=r(86),m=r(155),b=r(14),v=r(22),g=r(309),w=r(311),_=r(150),M=r(81),S=r(25).get().ReadPreference,O=r(312),A=r(4),E=r(316),x=r(317).middlewareFunctions,k=r(157).middlewareFunctions,j=x.concat(k).reduce((function(t,e){return t.add(e)}),new Set),$=A.isPOJO,P=0;function R(t,e){if(!(this instanceof R))return new R(t,e);if(this.obj=t,this.paths={},this.aliases={},this.subpaths={},this.virtuals={},this.singleNestedPaths={},this.nested={},this.inherits={},this.callQueue=[],this._indexes=[],this.methods={},this.methodOptions={},this.statics={},this.tree={},this.query={},this.childSchemas=[],this.plugins=[],this.$id=++P,this.mapPaths=[],this.s={hooks:new f},this.options=this.defaultOptions(e),Array.isArray(t)){var r,n=s(t);try{for(n.s();!(r=n.n()).done;){var i=r.value;this.add(i)}}catch(t){n.e(t)}finally{n.f()}}else t&&this.add(t);var o=t&&t._id&&A.isObject(t._id);!this.paths._id&&this.options._id&&!o&&m(this),this.setupTimestamp(this.options.timestamps)}
|
|
604
604
|
/*!
|
|
605
605
|
* Create virtual properties with alias field
|
|
606
606
|
*/
|
|
@@ -632,7 +632,7 @@ function T(t){return/\.\d+/.test(t)?t.replace(/\.\d+\./g,".$.").replace(/\.\d+$/
|
|
|
632
632
|
function N(t,e){var r=e.split(/\.(\d+)\.|\.(\d+)$/).filter(Boolean);if(r.length<2)return t.paths.hasOwnProperty(r[0])?t.paths[r[0]]:"adhocOrUndefined";var n=t.path(r[0]),i=!1;if(!n)return"adhocOrUndefined";for(var o=r.length-1,s=1;s<r.length;++s){i=!1;var a=r[s];if(s===o&&n&&!/\D/.test(a)){n=n.$isMongooseDocumentArray?n.$embeddedSchemaType:n instanceof u.Array?n.caster:void 0;break}if(/\D/.test(a)){if(!n||!n.schema){n=void 0;break}i="nested"===n.schema.pathType(a),n=n.schema.path(a)}else n instanceof u.Array&&s!==o&&(n=n.caster)}return t.subpaths[e]=n,n?"real":i?"nested":"adhocOrUndefined"}
|
|
633
633
|
/*!
|
|
634
634
|
* ignore
|
|
635
|
-
*/B.prototype=B.emit=B.listeners=B.on=B.removeListener=B.collection=B.errors=B.get=B.init=B.isModified=B.isNew=B.populated=B.remove=B.save=B.toObject=B.validate=1,B.collection=1,R.prototype.path=function(t,e){var r=T(t);if(void 0===e){var n=function(t,e,r){if(t.paths.hasOwnProperty(e))return t.paths[e];if(t.subpaths.hasOwnProperty(r))return t.subpaths[r];if(t.singleNestedPaths.hasOwnProperty(r)&&"object"===o(t.singleNestedPaths[r]))return t.singleNestedPaths[r];return null}(this,t,r);if(null!=n)return n;var i=I(this,t);return null!=i?i:null!=(n=this.hasMixedParent(r))?n:/\.\d+\.?.*$/.test(t)?function(t,e){return N(t,e),t.subpaths[e]}(this,t):void 0}var a=t.split(".")[0];if(B[a]&&!this.options.supressReservedKeysWarning){var u="`".concat(a,"` is a reserved schema pathname and may break some functionality. ")+"You are allowed to use it, but use at your own risk. To disable this warning pass `supressReservedKeysWarning` as a schema option.";A.warn(u)}"object"===o(e)&&A.hasUserDefinedProperty(e,"ref")&&E(e.ref,t);var h,f=t.split(/\./),c=f.pop(),d=this.tree,p="",y=s(f);try{for(y.s();!(h=y.n()).done;){var m=h.value;if(p=p+=(p.length>0?".":"")+m,d[m]||(this.nested[p]=!0,d[m]={}),"object"!==o(d[m])){var b="Cannot set nested path `"+t+"`. Parent path `"+p+"` already set to type "+d[m].name+".";throw new Error(b)}d=d[m]}}catch(t){y.e(t)}finally{y.f()}d[c]=A.clone(e),this.paths[t]=this.interpretAsType(t,e,this.options);var v=this.paths[t];if(v.$isSchemaMap){var g=t+".$*";this.paths[g]=v.$__schemaType,this.mapPaths.push(this.paths[g])}if(v.$isSingleNested){for(var w=0,_=Object.keys(v.schema.paths);w<_.length;w++){var M=_[w];this.singleNestedPaths[t+"."+M]=v.schema.paths[M]}for(var S=0,O=Object.keys(v.schema.singleNestedPaths);S<O.length;S++){var x=O[S];this.singleNestedPaths[t+"."+x]=v.schema.singleNestedPaths[x]}for(var k=0,j=Object.keys(v.schema.subpaths);k<j.length;k++){var $=j[k];this.singleNestedPaths[t+"."+$]=v.schema.subpaths[$]}for(var P=0,R=Object.keys(v.schema.nested);P<R.length;P++){var D=R[P];this.singleNestedPaths[t+"."+D]="nested"}Object.defineProperty(v.schema,"base",{configurable:!0,enumerable:!1,writable:!1,value:this.base}),v.caster.base=this.base,this.childSchemas.push({schema:v.schema,model:v.caster})}else v.$isMongooseDocumentArray&&(Object.defineProperty(v.schema,"base",{configurable:!0,enumerable:!1,writable:!1,value:this.base}),v.casterConstructor.base=this.base,this.childSchemas.push({schema:v.schema,model:v.casterConstructor}));if(v.$isMongooseArray&&v.caster instanceof l){for(var C=t,L=v,q=[];L.$isMongooseArray;)C+=".$",L.$isMongooseDocumentArray?(L.$embeddedSchemaType._arrayPath=C,L.$embeddedSchemaType._arrayParentPath=t,L=L.$embeddedSchemaType.clone()):(L.caster._arrayPath=C,L.caster._arrayParentPath=t,L=L.caster.clone()),L.path=C,q.push(L);for(var U=0,F=q;U<F.length;U++){var z=F[U];this.subpaths[z.path]=z}}if(v.$isMongooseDocumentArray){for(var V=0,K=Object.keys(v.schema.paths);V<K.length;V++){var H=K[V],Z=v.schema.paths[H];this.subpaths[t+"."+H]=Z,"object"===o(Z)&&null!=Z&&(Z.$isUnderneathDocArray=!0)}for(var W=0,J=Object.keys(v.schema.subpaths);W<J.length;W++){var Y=J[W],Q=v.schema.subpaths[Y];this.subpaths[t+"."+Y]=Q,"object"===o(Q)&&null!=Q&&(Q.$isUnderneathDocArray=!0)}for(var G=0,X=Object.keys(v.schema.singleNestedPaths);G<X.length;G++){var tt=X[G],et=v.schema.singleNestedPaths[tt];this.subpaths[t+"."+tt]=et,"object"===o(et)&&null!=et&&(et.$isUnderneathDocArray=!0)}}return this},Object.defineProperty(R.prototype,"base",{configurable:!0,enumerable:!1,writable:!0,value:null}),R.prototype.interpretAsType=function(t,e,r){if(e instanceof l){if(e.path===t)return e;var s=e.clone();return s.path=t,s}var a=null!=this.base?this.base.Schema.Types:R.Types;if(!(A.isPOJO(e)||e instanceof d)&&"Object"!==A.getFunctionName(e.constructor)){var u=e;(e={})[r.typeKey]=u}var h,f=e[r.typeKey]&&(e[r.typeKey]instanceof Function||"type"!==r.typeKey||!e.type.type)?e[r.typeKey]:{};if(A.isPOJO(f)||"mixed"===f)return new a.Mixed(t,e);if(Array.isArray(f)||f===Array||"array"===f||f===a.Array){var c=f===Array||"array"===f?e.cast||e.of:f[0];if(c&&c.instanceOfSchema){if(!(c instanceof R))throw new TypeError("Schema for array path `"+t+"` is from a different copy of the Mongoose module. Please make sure you're using the same version of Mongoose everywhere with `npm list mongoose`.");return new a.DocumentArray(t,c,e)}if(c&&c[r.typeKey]&&c[r.typeKey].instanceOfSchema){if(!(c[r.typeKey]instanceof R))throw new TypeError("Schema for array path `"+t+"` is from a different copy of the Mongoose module. Please make sure you're using the same version of Mongoose everywhere with `npm list mongoose`.");return new a.DocumentArray(t,c[r.typeKey],e,c)}if(Array.isArray(c))return new a.Array(t,this.interpretAsType(t,c,r),e);var p=null==c||!c[r.typeKey]||"type"===r.typeKey&&c.type.type?c:c[r.typeKey];if("string"==typeof c)c=a[c.charAt(0).toUpperCase()+c.substring(1)];else if(A.isPOJO(p)){if(Object.keys(p).length){var y={minimize:r.minimize};r.typeKey&&(y.typeKey=r.typeKey),r.hasOwnProperty("strict")&&(y.strict=r.strict),this._userProvidedOptions.hasOwnProperty("_id")?y._id=this._userProvidedOptions._id:null!=R.Types.DocumentArray.defaultOptions._id&&(y._id=R.Types.DocumentArray.defaultOptions._id);var m=new R(p,y);return m.$implicitlyCreated=!0,new a.DocumentArray(t,m,e)}return new a.Array(t,a.Mixed,e)}if(c){if(
|
|
635
|
+
*/B.prototype=B.emit=B.listeners=B.on=B.removeListener=B.collection=B.errors=B.get=B.init=B.isModified=B.isNew=B.populated=B.remove=B.save=B.toObject=B.validate=1,B.collection=1,R.prototype.path=function(t,e){var r=T(t);if(void 0===e){var n=function(t,e,r){if(t.paths.hasOwnProperty(e))return t.paths[e];if(t.subpaths.hasOwnProperty(r))return t.subpaths[r];if(t.singleNestedPaths.hasOwnProperty(r)&&"object"===o(t.singleNestedPaths[r]))return t.singleNestedPaths[r];return null}(this,t,r);if(null!=n)return n;var i=I(this,t);return null!=i?i:null!=(n=this.hasMixedParent(r))?n:/\.\d+\.?.*$/.test(t)?function(t,e){return N(t,e),t.subpaths[e]}(this,t):void 0}var a=t.split(".")[0];if(B[a]&&!this.options.supressReservedKeysWarning){var u="`".concat(a,"` is a reserved schema pathname and may break some functionality. ")+"You are allowed to use it, but use at your own risk. To disable this warning pass `supressReservedKeysWarning` as a schema option.";A.warn(u)}"object"===o(e)&&A.hasUserDefinedProperty(e,"ref")&&E(e.ref,t);var h,f=t.split(/\./),c=f.pop(),d=this.tree,p="",y=s(f);try{for(y.s();!(h=y.n()).done;){var m=h.value;if(p=p+=(p.length>0?".":"")+m,d[m]||(this.nested[p]=!0,d[m]={}),"object"!==o(d[m])){var b="Cannot set nested path `"+t+"`. Parent path `"+p+"` already set to type "+d[m].name+".";throw new Error(b)}d=d[m]}}catch(t){y.e(t)}finally{y.f()}d[c]=A.clone(e),this.paths[t]=this.interpretAsType(t,e,this.options);var v=this.paths[t];if(v.$isSchemaMap){var g=t+".$*";this.paths[g]=v.$__schemaType,this.mapPaths.push(this.paths[g])}if(v.$isSingleNested){for(var w=0,_=Object.keys(v.schema.paths);w<_.length;w++){var M=_[w];this.singleNestedPaths[t+"."+M]=v.schema.paths[M]}for(var S=0,O=Object.keys(v.schema.singleNestedPaths);S<O.length;S++){var x=O[S];this.singleNestedPaths[t+"."+x]=v.schema.singleNestedPaths[x]}for(var k=0,j=Object.keys(v.schema.subpaths);k<j.length;k++){var $=j[k];this.singleNestedPaths[t+"."+$]=v.schema.subpaths[$]}for(var P=0,R=Object.keys(v.schema.nested);P<R.length;P++){var D=R[P];this.singleNestedPaths[t+"."+D]="nested"}Object.defineProperty(v.schema,"base",{configurable:!0,enumerable:!1,writable:!1,value:this.base}),v.caster.base=this.base,this.childSchemas.push({schema:v.schema,model:v.caster})}else v.$isMongooseDocumentArray&&(Object.defineProperty(v.schema,"base",{configurable:!0,enumerable:!1,writable:!1,value:this.base}),v.casterConstructor.base=this.base,this.childSchemas.push({schema:v.schema,model:v.casterConstructor}));if(v.$isMongooseArray&&v.caster instanceof l){for(var C=t,L=v,q=[];L.$isMongooseArray;)C+=".$",L.$isMongooseDocumentArray?(L.$embeddedSchemaType._arrayPath=C,L.$embeddedSchemaType._arrayParentPath=t,L=L.$embeddedSchemaType.clone()):(L.caster._arrayPath=C,L.caster._arrayParentPath=t,L=L.caster.clone()),L.path=C,q.push(L);for(var U=0,F=q;U<F.length;U++){var z=F[U];this.subpaths[z.path]=z}}if(v.$isMongooseDocumentArray){for(var V=0,K=Object.keys(v.schema.paths);V<K.length;V++){var H=K[V],Z=v.schema.paths[H];this.subpaths[t+"."+H]=Z,"object"===o(Z)&&null!=Z&&(Z.$isUnderneathDocArray=!0)}for(var W=0,J=Object.keys(v.schema.subpaths);W<J.length;W++){var Y=J[W],Q=v.schema.subpaths[Y];this.subpaths[t+"."+Y]=Q,"object"===o(Q)&&null!=Q&&(Q.$isUnderneathDocArray=!0)}for(var G=0,X=Object.keys(v.schema.singleNestedPaths);G<X.length;G++){var tt=X[G],et=v.schema.singleNestedPaths[tt];this.subpaths[t+"."+tt]=et,"object"===o(et)&&null!=et&&(et.$isUnderneathDocArray=!0)}}return this},Object.defineProperty(R.prototype,"base",{configurable:!0,enumerable:!1,writable:!0,value:null}),R.prototype.interpretAsType=function(t,e,r){if(e instanceof l){if(e.path===t)return e;var s=e.clone();return s.path=t,s}var a=null!=this.base?this.base.Schema.Types:R.Types;if(!(A.isPOJO(e)||e instanceof d)&&"Object"!==A.getFunctionName(e.constructor)){var u=e;(e={})[r.typeKey]=u}var h,f=e[r.typeKey]&&(e[r.typeKey]instanceof Function||"type"!==r.typeKey||!e.type.type)?e[r.typeKey]:{};if(A.isPOJO(f)||"mixed"===f)return new a.Mixed(t,e);if(Array.isArray(f)||f===Array||"array"===f||f===a.Array){var c=f===Array||"array"===f?e.cast||e.of:f[0];if(c&&c.instanceOfSchema){if(!(c instanceof R))throw new TypeError("Schema for array path `"+t+"` is from a different copy of the Mongoose module. Please make sure you're using the same version of Mongoose everywhere with `npm list mongoose`.");return new a.DocumentArray(t,c,e)}if(c&&c[r.typeKey]&&c[r.typeKey].instanceOfSchema){if(!(c[r.typeKey]instanceof R))throw new TypeError("Schema for array path `"+t+"` is from a different copy of the Mongoose module. Please make sure you're using the same version of Mongoose everywhere with `npm list mongoose`.");return new a.DocumentArray(t,c[r.typeKey],e,c)}if(Array.isArray(c))return new a.Array(t,this.interpretAsType(t,c,r),e);var p=null==c||!c[r.typeKey]||"type"===r.typeKey&&c.type.type?c:c[r.typeKey];if("string"==typeof c)c=a[c.charAt(0).toUpperCase()+c.substring(1)];else if(A.isPOJO(p)){if(Object.keys(p).length){var y={minimize:r.minimize};r.typeKey&&(y.typeKey=r.typeKey),r.hasOwnProperty("strict")&&(y.strict=r.strict),this._userProvidedOptions.hasOwnProperty("_id")?y._id=this._userProvidedOptions._id:null!=R.Types.DocumentArray.defaultOptions._id&&(y._id=R.Types.DocumentArray.defaultOptions._id);var m=new R(p,y);return m.$implicitlyCreated=!0,new a.DocumentArray(t,m,e)}return new a.Array(t,a.Mixed,e)}if(c){if(f=!c[r.typeKey]||"type"===r.typeKey&&c.type.type?c:c[r.typeKey],Array.isArray(f))return new a.Array(t,this.interpretAsType(t,f,r),e);if("ClockDate"===(h="string"==typeof f?f:f.schemaName||A.getFunctionName(f))&&(h="Date"),void 0===h)throw new TypeError("Invalid schema configuration: "+"Could not determine the embedded type for array `".concat(t,"`. ")+"See https://mongoosejs.com/docs/guide.html#definition for more info on supported schema syntaxes.");if(!a.hasOwnProperty(h))throw new TypeError("Invalid schema configuration: "+"`".concat(h,"` is not a valid type within the array `").concat(t,"`.")+"See https://bit.ly/mongoose-schematypes for a list of valid schema types.")}return new a.Array(t,c||a.Mixed,e,r)}if(f&&f.instanceOfSchema)return new a.Subdocument(f,t,e);if((h=n.isBuffer(f)?"Buffer":"function"==typeof f||"object"===o(f)?f.schemaName||A.getFunctionName(f):null==f?""+f:f.toString())&&(h=h.charAt(0).toUpperCase()+h.substring(1)),"ObjectID"===h&&(h="ObjectId"),"ClockDate"===h&&(h="Date"),void 0===h)throw new TypeError("Invalid schema configuration: `".concat(t,"` schematype definition is ")+"invalid. See https://mongoosejs.com/docs/guide.html#definition for more info on supported schema syntaxes.");if(null==a[h])throw new TypeError("Invalid schema configuration: `".concat(h,"` is not ")+"a valid type at path `".concat(t,"`. See ")+"https://bit.ly/mongoose-schematypes for a list of valid schema types.");var b=new a[h](t,e);return b.$isSchemaMap&&
|
|
636
636
|
/*!
|
|
637
637
|
* ignore
|
|
638
638
|
*/
|
|
@@ -675,10 +675,10 @@ s.prototype.clone=function(){var t=new s(this.options,this.path);return t.getter
|
|
|
675
675
|
t.exports=s},function(t,e,r){"use strict";
|
|
676
676
|
/*!
|
|
677
677
|
* Module exports.
|
|
678
|
-
*/e.String=r(
|
|
678
|
+
*/e.String=r(319),e.Number=r(159),e.Boolean=r(322),e.DocumentArray=r(323),e.Subdocument=r(331),e.Array=r(88),e.Buffer=r(333),e.Date=r(335),e.ObjectId=r(338),e.Mixed=r(45),e.Decimal128=e.Decimal=r(340),e.Map=r(342),e.Oid=e.ObjectId,e.Object=e.Mixed,e.Bool=e.Boolean,e.ObjectID=e.ObjectId},function(t,e,r){"use strict";
|
|
679
679
|
/*!
|
|
680
680
|
* Module dependencies.
|
|
681
|
-
*/function n(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return i(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return i(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,s=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw s}}}}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var o,s,a=r(83),u=r(153),h=r(19),f=r(
|
|
681
|
+
*/function n(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return i(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return i(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,s=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw s}}}}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var o,s,a=r(83),u=r(153),h=r(19),f=r(324),c=r(8),l=c.CastError,d=r(45),p=r(325),y=r(326),m=r(164),b=r(9),v=r(4),g=r(56).castToNumber,w=r(165),_=r(57),M=Symbol("mongoose#isNestedArray"),S=Object.freeze({});function O(t,e,n,i){s||(s=r(58).Embedded);var o,a,u="type";if(i&&i.typeKey&&(u=i.typeKey),this.schemaOptions=i,e){var h={};v.isPOJO(e)&&(e[u]?(delete(h=v.clone(e))[u],e=e[u]):e=d),null!=n&&null!=n.ref&&null==h.ref&&(h.ref=n.ref),e===Object&&(e=d);var f="string"==typeof e?e:v.getFunctionName(e),l=r(87),p=l.hasOwnProperty(f)?l[f]:e;if(this.casterConstructor=p,this.casterConstructor instanceof O&&(this.casterConstructor[M]=!0),"function"!=typeof p||p.$isArraySubdocument||p.$isSchemaMap)this.caster=p,this.caster instanceof s||(this.caster.path=t);else{var y=this.caster instanceof s?null:t;this.caster=new p(y,h)}this.$embeddedSchemaType=this.caster}if(this.$isMongooseArray=!0,c.call(this,t,n,"Array"),null!=this.defaultValue&&(o=this.defaultValue,a="function"==typeof o),!("defaultValue"in this)||void 0!==this.defaultValue){var m=function(){return a?o.call(this):null!=o?[].concat(o):[]};m.$runBeforeSetters=!a,this.default(m)}}O.schemaName="Array",O.options={castNonArrays:!0},
|
|
682
682
|
/*!
|
|
683
683
|
* ignore
|
|
684
684
|
*/
|
|
@@ -702,7 +702,7 @@ O.prototype.discriminator=function(t,e){for(var r=this;r.$isMongooseArray&&!r.$i
|
|
|
702
702
|
/*!
|
|
703
703
|
* ignore
|
|
704
704
|
*/
|
|
705
|
-
O.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},O.prototype.castForQuery=function(t,e){var r,n,i=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 o=this.casterConstructor;if(n&&o.discriminators&&o.schema&&o.schema.options&&o.schema.options.discriminatorKey)if("string"==typeof n[o.schema.options.discriminatorKey]&&o.discriminators[n[o.schema.options.discriminatorKey]])o=o.discriminators[n[o.schema.options.discriminatorKey]];else{var s=_(o.discriminators,n[o.schema.options.discriminatorKey]);s&&(o=s)}var a=this.casterConstructor.prototype,u=a&&(a.castForQuery||a.cast);!u&&o.castForQuery&&(u=o.castForQuery);var h=this.caster;Array.isArray(n)?(this.setters.reverse().forEach((function(t){n=t.call(i,n,i)})),n=n.map((function(t){return v.isObject(t)&&t.$elemMatch?t:u?t=u.call(h,t):null!=t?t=new o(t):t}))):u?n=u.call(h,n):null!=n&&(n=new o(n))}return n};var A=O.prototype.$conditionalHandlers={};function E(t){return function(e){if(!Array.isArray(e))throw new TypeError("conditional "+t+" requires an array");var r,i=[],o=n(e);try{for(o.s();!(r=o.n()).done;){var s=r.value;i.push(y(this.casterConstructor.schema,s))}}catch(t){o.e(t)}finally{o.f()}return i}}A.$all=function(t){return Array.isArray(t)||(t=[t]),t=t.map((function(t){if(!v.isObject(t))return t;if(null!=t.$elemMatch)return{$elemMatch:y(this.casterConstructor.schema,t.$elemMatch)};var e={};return e[this.path]=t,y(this.casterConstructor.schema,e)[this.path]}),this),this.castForQuery(t)},A.$options=String,A.$elemMatch=function(t){for(var e=Object.keys(t),r=e.length,n=0;n<r;++n){var i=e[n],o=t[i];m(i)&&null!=o&&(t[i]=this.castForQuery(i,o))}var s=this&&this.casterConstructor&&this.casterConstructor.schema&&this.casterConstructor.schema.options&&this.casterConstructor.schema.options.discriminatorKey,a=this&&this.casterConstructor&&this.casterConstructor.schema&&this.casterConstructor.schema.discriminators||{};return null!=s&&null!=t[s]&&null!=a[t[s]]?y(a[t[s]],t):y(this.casterConstructor.schema,t)},A.$geoIntersects=w.cast$geoIntersects,A.$or=E("$or"),A.$and=E("$and"),A.$nor=E("$nor"),A.$near=A.$nearSphere=w.cast$near,A.$within=A.$geoWithin=w.cast$within,A.$size=A.$minDistance=A.$maxDistance=g,A.$exists=a,A.$type=u,A.$eq=A.$gt=A.$gte=A.$lt=A.$lte=A.$ne=A.$regex=O.prototype.castForQuery,A.$nin=c.prototype.$conditionalHandlers.$nin,A.$in=c.prototype.$conditionalHandlers.$in,
|
|
705
|
+
O.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},O.prototype.castForQuery=function(t,e){var r,n,i=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 o=this.casterConstructor;if(n&&o.discriminators&&o.schema&&o.schema.options&&o.schema.options.discriminatorKey)if("string"==typeof n[o.schema.options.discriminatorKey]&&o.discriminators[n[o.schema.options.discriminatorKey]])o=o.discriminators[n[o.schema.options.discriminatorKey]];else{var s=_(o.discriminators,n[o.schema.options.discriminatorKey]);s&&(o=s)}var a=this.casterConstructor.prototype,u=a&&(a.castForQuery||a.cast);!u&&o.castForQuery&&(u=o.castForQuery);var h=this.caster;Array.isArray(n)?(this.setters.reverse().forEach((function(t){n=t.call(i,n,i)})),n=n.map((function(t){return v.isObject(t)&&t.$elemMatch?t:u?t=u.call(h,t):null!=t?t=new o(t):t}))):u?n=u.call(h,n):null!=n&&(n=new o(n))}return n};var A=O.prototype.$conditionalHandlers={};function E(t){return function(e){if(!Array.isArray(e))throw new TypeError("conditional "+t+" requires an array");var r,i=[],o=n(e);try{for(o.s();!(r=o.n()).done;){var s=r.value;i.push(y(this.casterConstructor.schema,s))}}catch(t){o.e(t)}finally{o.f()}return i}}A.$all=function(t){return Array.isArray(t)||(t=[t]),t=t.map((function(t){if(!v.isObject(t))return t;if(null!=t.$elemMatch)return{$elemMatch:y(this.casterConstructor.schema,t.$elemMatch)};var e={};return e[this.path]=t,y(this.casterConstructor.schema,e)[this.path]}),this),this.castForQuery(t)},A.$options=String,A.$elemMatch=function(t){for(var e=Object.keys(t),r=e.length,n=0;n<r;++n){var i=e[n],o=t[i];m(i)&&null!=o&&(t[i]=this.castForQuery(i,o))}var s=this&&this.casterConstructor&&this.casterConstructor.schema&&this.casterConstructor.schema.options&&this.casterConstructor.schema.options.discriminatorKey,a=this&&this.casterConstructor&&this.casterConstructor.schema&&this.casterConstructor.schema.discriminators||{};return null!=s&&null!=t[s]&&null!=a[t[s]]?y(a[t[s]],t):y(this.casterConstructor.schema,t)},A.$geoIntersects=w.cast$geoIntersects,A.$or=E("$or"),A.$and=E("$and"),A.$nor=E("$nor"),A.$near=A.$nearSphere=w.cast$near,A.$within=A.$geoWithin=w.cast$within,A.$size=A.$minDistance=A.$maxDistance=g,A.$exists=a,A.$type=u,A.$eq=A.$gt=A.$gte=A.$lt=A.$lte=A.$ne=A.$not=A.$regex=O.prototype.castForQuery,A.$nin=c.prototype.$conditionalHandlers.$nin,A.$in=c.prototype.$conditionalHandlers.$in,
|
|
706
706
|
/*!
|
|
707
707
|
* Module exports.
|
|
708
708
|
*/
|
|
@@ -734,7 +734,7 @@ function w(t,e){var r,i,s,a=null==t?null:t[y]&&t[y].caster&&t[y].caster.options&
|
|
|
734
734
|
/*!
|
|
735
735
|
* ignore
|
|
736
736
|
*/
|
|
737
|
-
function(t,e){if(!e)return!1;var r,i=n(t);try{for(i.s();!(r=i.n()).done;){var s=r.value;if(null==s)return!1;var a=s.constructor;if(!(s instanceof o)||a.modelName!==e&&a.baseModelName!==e)return!1}}catch(t){i.e(t)}finally{i.f()}return!0}(e,a)&&t[d].$populated(t[p],[],(r={},i=m,s=e[0].constructor,i in r?Object.defineProperty(r,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):r[i]=s,r))}for(var _=function(){var t=S[M];if(null==Array.prototype[t])return"continue";g[t]=function(){var e=c.isMongooseArray(this)?this.__array:this,r=[].concat(e);return r[t].apply(r,arguments)}},M=0,S=["filter","flat","flatMap","map","slice"];M<S.length;M++)_();t.exports=g}).call(this,r(3).Buffer)},function(t,e,r){"use strict";var n=r(13),i=r(42),o=r(34).internalToObjectOptions,s=r(53),a=r(
|
|
737
|
+
function(t,e){if(!e)return!1;var r,i=n(t);try{for(i.s();!(r=i.n()).done;){var s=r.value;if(null==s)return!1;var a=s.constructor;if(!(s instanceof o)||a.modelName!==e&&a.baseModelName!==e)return!1}}catch(t){i.e(t)}finally{i.f()}return!0}(e,a)&&t[d].$populated(t[p],[],(r={},i=m,s=e[0].constructor,i in r?Object.defineProperty(r,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):r[i]=s,r))}for(var _=function(){var t=S[M];if(null==Array.prototype[t])return"continue";g[t]=function(){var e=c.isMongooseArray(this)?this.__array:this,r=[].concat(e);return r[t].apply(r,arguments)}},M=0,S=["filter","flat","flatMap","map","slice"];M<S.length;M++)_();t.exports=g}).call(this,r(3).Buffer)},function(t,e,r){"use strict";var n=r(13),i=r(42),o=r(34).internalToObjectOptions,s=r(53),a=r(9),u=r(4);function h(t,e,r,i,o){if(null!=r){var s={isNew:r.isNew};"defaults"in r.$__&&(s.defaults=r.$__.defaults),o=Object.assign(s,o)}null!=o&&null!=o.path&&(this.$basePath=o.path),n.call(this,t,e,i,o),delete this.$__.priorDoc}t.exports=h,h.prototype=Object.create(n.prototype),Object.defineProperty(h.prototype,"$isSubdocument",{configurable:!1,writable:!1,value:!0}),Object.defineProperty(h.prototype,"$isSingleNested",{configurable:!1,writable:!1,value:!0}),
|
|
738
738
|
/*!
|
|
739
739
|
* ignore
|
|
740
740
|
*/
|
|
@@ -816,7 +816,7 @@ var n=r(43),i=r(284),o={_promise:null,get:function(){return o._promise},set:func
|
|
|
816
816
|
o.set(e.Promise),t.exports=o}).call(this,r(6))},function(t,e,r){"use strict";(function(t,r,n,i){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)}e.isNode=void 0!==t&&"object"==o(r)&&"object"==(void 0===n?"undefined":o(n))&&"function"==typeof i&&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(5),r(24)(t),r(6),r(3).Buffer)},function(t,e,r){"use strict";t.exports=function(t,e,r){for(var n={},i=0,o=Object.keys(e.tree);i<o.length;i++){var s=o[i];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.s.hooks.merge(e.s.hooks,!1)}},function(t,e,r){"use strict";
|
|
817
817
|
/*!
|
|
818
818
|
* Module requirements
|
|
819
|
-
*/function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function o(t,e){return(o=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function s(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=u(t);if(e){var i=u(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return a(this,r)}}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){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var h=r(19),f=r(22),c=r(
|
|
819
|
+
*/function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function o(t,e){return(o=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function s(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=u(t);if(e){var i=u(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return a(this,r)}}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){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var h=r(19),f=r(22),c=r(9),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&&o(t,e)}(u,t);var e,r,n,a=s(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=a.call(this,r)).errors={},e._message=r,t&&(t.$errors=e.errors),e}return e=u,(r=[{key:"toString",value:function(){return this.name+": "+d(this)}
|
|
820
820
|
/*!
|
|
821
821
|
* inspect helper
|
|
822
822
|
*/},{key:"inspect",value:function(){return Object.assign(new Error(this.message),this)}
|
|
@@ -897,7 +897,7 @@ o.middlewareFunctions=["deleteOne","save","validate","remove","updateOne","init"
|
|
|
897
897
|
*/t.exports=function(t,e){if(null==t)return t;if(t._id&&"string"==typeof t._id)return t._id;if(t.toString&&t.toString!==Object.prototype.toString&&!Array.isArray(t))return t.toString();throw new n("string",t,e)}},function(t,e,r){"use strict";
|
|
898
898
|
/*!
|
|
899
899
|
* Module requirements.
|
|
900
|
-
*/var n=r(7),i=r(
|
|
900
|
+
*/var n=r(7),i=r(321),o=r(8),s=r(160),a=r(161),u=r(4),h=o.CastError;function f(t,e){o.call(this,t,e,"Number")}
|
|
901
901
|
/*!
|
|
902
902
|
* ignore
|
|
903
903
|
*/
|
|
@@ -980,7 +980,7 @@ o.mixin={_subtype:void 0,_markModified:function(){var t=this[a];return t&&t.mark
|
|
|
980
980
|
/*!
|
|
981
981
|
* Module exports.
|
|
982
982
|
*/
|
|
983
|
-
o.Binary=n,t.exports=o}).call(this,r(3).Buffer)},function(t,e,r){"use strict";var n=r(25).get().ObjectId;t.exports=function(t){if(null==t)return t;if(t instanceof n)return t;if(t._id){if(t._id instanceof n)return t._id;if(t._id.toString instanceof Function)return new n(t._id.toString())}return t.toString instanceof Function?new n(t.toString()):new n(t)}},function(t,e,r){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return o(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return o(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,s=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw s}}}}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function s(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function a(){return(a="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=u(t,e);if(n){var i=Object.getOwnPropertyDescriptor(n,e);return i.get?i.get.call(arguments.length<3?t:r):i.value}}).apply(this,arguments)}function u(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=p(t)););return t}function h(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function f(t){var e="function"==typeof Map?new Map:void 0;return(f=function(t){if(null===t||(r=t,-1===Function.toString.call(r).indexOf("[native code]")))return t;var r;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return c(t,arguments,p(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),d(n,t)})(t)}function c(t,e,r){return(c=l()?Reflect.construct:function(t,e,r){var n=[null];n.push.apply(n,e);var i=new(Function.bind.apply(t,n));return r&&d(i,r.prototype),i}).apply(null,arguments)}function l(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function d(t,e){return(d=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function p(t){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var y=r(45),m=r(18),b=r(41),v=r(4).deepEqual,g=r(22),w=r(171),_=r(
|
|
983
|
+
o.Binary=n,t.exports=o}).call(this,r(3).Buffer)},function(t,e,r){"use strict";var n=r(25).get().ObjectId;t.exports=function(t){if(null==t)return t;if(t instanceof n)return t;if(t._id){if(t._id instanceof n)return t._id;if(t._id.toString instanceof Function)return new n(t._id.toString())}return t.toString instanceof Function?new n(t.toString()):new n(t)}},function(t,e,r){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return o(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return o(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,s=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw s}}}}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function s(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function a(){return(a="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=u(t,e);if(n){var i=Object.getOwnPropertyDescriptor(n,e);return i.get?i.get.call(arguments.length<3?t:r):i.value}}).apply(this,arguments)}function u(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=p(t)););return t}function h(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function f(t){var e="function"==typeof Map?new Map:void 0;return(f=function(t){if(null===t||(r=t,-1===Function.toString.call(r).indexOf("[native code]")))return t;var r;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return c(t,arguments,p(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),d(n,t)})(t)}function c(t,e,r){return(c=l()?Reflect.construct:function(t,e,r){var n=[null];n.push.apply(n,e);var i=new(Function.bind.apply(t,n));return r&&d(i,r.prototype),i}).apply(null,arguments)}function l(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function d(t,e){return(d=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function p(t){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var y=r(45),m=r(18),b=r(41),v=r(4).deepEqual,g=r(22),w=r(171),_=r(9),M=r(82),S=r(1).populateModelSymbol,O=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&d(t,e)}(c,t);var e,r,n,o,u,f=(e=c,r=l(),function(){var t,n=p(e);if(r){var i=p(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return h(this,t)});function c(t,e,r,n){var i;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,c),"Object"===g(t)&&(t=Object.keys(t).reduce((function(e,r){return e.concat([[r,t[r]]])}),[])),(i=f.call(this,t)).$__parent=null!=r&&null!=r.$__?r:null,i.$__path=e,i.$__schemaType=null==n?new y(e):n,i.$__runDeferred(),i}return n=c,(o=[{key:"$init",value:function(t,e){A(t),a(p(c.prototype),"set",this).call(this,t,e),null!=e&&e.$isSingleNested&&(e.$basePath=this.$__path+"."+t)}},{key:"$__set",value:function(t,e){a(p(c.prototype),"set",this).call(this,t,e)}},{key:"get",value:function(t,e){return t instanceof m&&(t=t.toString()),!1===(e=e||{}).getters?a(p(c.prototype),"get",this).call(this,t):this.$__schemaType.applyGetters(a(p(c.prototype),"get",this).call(this,t),this.$__parent)}},{key:"set",value:function(t,e){if(t instanceof m&&(t=t.toString()),A(t),e=w(e),null==this.$__schemaType)return this.$__deferred=this.$__deferred||[],void this.$__deferred.push({key:t,value:e});var r=this.$__path+"."+t,n=null!=this.$__parent&&this.$__parent.$__?this.$__parent.$populated(r)||this.$__parent.$populated(this.$__path):null,i=this.get(t);if(null!=n)null==e.$__&&(e=new n.options[S](e)),e.$__.wasPopulated={value:n.value};else try{e=this.$__schemaType.applySetters(e,this.$__parent,!1,this.get(t),{path:r})}catch(t){if(null!=this.$__parent&&null!=this.$__parent.$__)return void this.$__parent.invalidate(r,t);throw t}a(p(c.prototype),"set",this).call(this,t,e),null!=e&&e.$isSingleNested&&(e.$basePath=this.$__path+"."+t);var o=this.$__parent;null==o||null==o.$__||v(e,i)||o.markModified(this.$__path+"."+t)}},{key:"clear",value:function(){a(p(c.prototype),"clear",this).call(this);var t=this.$__parent;null!=t&&t.markModified(this.$__path)}},{key:"delete",value:function(t){t instanceof m&&(t=t.toString()),this.set(t,void 0),a(p(c.prototype),"delete",this).call(this,t)}},{key:"toBSON",value:function(){return new Map(this)}},{key:"toObject",value:function(t){if(t&&t.flattenMaps){var e,r={},n=i(this.keys());try{for(n.s();!(e=n.n()).done;){var o=e.value;r[o]=b(this.get(o),t)}}catch(t){n.e(t)}finally{n.f()}return r}return new Map(this)}},{key:"$toObject",value:function(){return this.constructor.prototype.toObject.apply(this,arguments)}},{key:"toJSON",value:function(t){if("boolean"!=typeof(t&&t.flattenMaps)||t.flattenMaps){var e,r={},n=i(this.keys());try{for(n.s();!(e=n.n()).done;){var o=e.value;r[o]=b(this.get(o),t)}}catch(t){n.e(t)}finally{n.f()}return r}return new Map(this)}},{key:"inspect",value:function(){return new Map(this)}},{key:"$__runDeferred",value:function(){if(this.$__deferred){var t,e=i(this.$__deferred);try{for(e.s();!(t=e.n()).done;){var r=t.value;this.set(r.key,r.value)}}catch(t){e.e(t)}finally{e.f()}this.$__deferred=null}}}])&&s(n.prototype,o),u&&s(n,u),Object.defineProperty(n,"prototype",{writable:!1}),c}(f(Map));
|
|
984
984
|
/*!
|
|
985
985
|
* Since maps are stored as objects under the hood, keys must be strings
|
|
986
986
|
* and can't contain any invalid characters
|
|
@@ -992,7 +992,7 @@ function A(t){var e=n(t);if("string"!==e)throw new TypeError("Mongoose maps only
|
|
|
992
992
|
t.exports=function(t,e,r,i,f){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(f){var c=a(t.base,"options.applyPluginsToDiscriminators",!1);t.base._applyPlugins(r,{skipTopLevel:!c})}var l=t.schema.options.discriminatorKey,d=t.schema.path(l);if(null!=d)u.hasUserDefinedProperty(d.options,"select")||(d.options.select=!0),d.options.$skipDiscriminatorCheck=!0;else{var p={};p[l]={default:void 0,select:!0,$skipDiscriminatorCheck:!0},p[l][t.schema.options.typeKey]=String,t.schema.add(p),s({prop:l,prototype:t.prototype,options:t.schema.options})}if(r.path(l)&&!0!==r.path(l).options.$skipDiscriminatorCheck)throw new Error('Discriminator "'+e+'" cannot have field with name "'+l+'"');var y=e;if(("string"==typeof i&&i.length||null!=i)&&(y=i),function(e,r){e._baseSchema=r,r.paths._id&&r.paths._id.options&&!r.paths._id.options.auto&&e.remove("_id");for(var i=[],s=0,a=Object.keys(r.paths);s<a.length;s++){var f=a[s];if(e.nested[f])i.push(f);else if(-1!==f.indexOf(".")){var c,p="",m=n(f.split(".").slice(0,-1));try{for(m.s();!(c=m.n()).done;){var b=c.value;p+=(p.length?".":"")+b,(e.paths[p]instanceof o||e.singleNestedPaths[p]instanceof o)&&i.push(f)}}catch(t){m.e(t)}finally{m.f()}}}u.merge(e,r,{isDiscriminatorSchemaMerge:!0,omit:{discriminators:!0,base:!0},omitNested:i.reduce((function(t,e){return t["tree."+e]=!0,t}),{})});for(var v=0,g=i;v<g.length;v++){var w=g[v];delete e.paths[w]}e.childSchemas.forEach((function(t){t.model.prototype.$__setSchema(t.schema)}));var _={};_[l]={default:y,select:!0,set:function(t){if(t===y||Array.isArray(y)&&u.deepEqual(t,y))return y;throw new Error("Can't set discriminator key \""+l+'"')},$skipDiscriminatorCheck:!0},_[l][e.options.typeKey]=d?d.options[e.options.typeKey]:String,e.add(_),e.discriminatorMapping={key:l,value:y,isRoot:!1},r.options.collection&&(e.options.collection=r.options.collection);var M=e.options.toJSON,S=e.options.toObject,O=e.options._id,A=e.options.id,E=Object.keys(e.options);e.options.discriminatorKey=r.options.discriminatorKey;for(var x=0,k=E;x<k.length;x++){var j=k[x];if(!h[j]){if("pluralization"===j&&1==e.options[j]&&null==r.options[j])continue;if(!u.deepEqual(e.options[j],r.options[j]))throw new Error("Can't customize discriminator option "+j+" (can only modify "+Object.keys(h).join(", ")+")")}}e.options=u.clone(r.options),M&&(e.options.toJSON=M),S&&(e.options.toObject=S),void 0!==O&&(e.options._id=O),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:l,value:null,isRoot:!0}),t.schema.discriminators||(t.schema.discriminators={}),t.schema.discriminators[e]=r,t.discriminators[e]&&!r.options.overwriteModels)throw new Error('Discriminator with name "'+e+'" already exists');return r}},function(t,e,r){"use strict";var n=r(155);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(57);
|
|
993
993
|
/*!
|
|
994
994
|
* Find the correct constructor, taking into account discriminators
|
|
995
|
-
*/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 i=n(t.discriminators,e[r]);i&&(t=i)}return t}},function(t,e,r){"use strict";t.exports=r(176)},function(t,e,r){"use strict";(function(n){function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function s(t,e){return(s=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function a(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=h(t);if(e){var i=h(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return u(this,r)}}function u(t,e){if(e&&("object"===i(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}r(25).set(r(179));var f=r(274),c=r(148);f.setBrowser(!0),Object.defineProperty(e,"Promise",{get:function(){return c.get()},set:function(t){c.set(t)}}),e.PromiseProvider=c,e.Error=r(7),e.Schema=r(85),e.Types=r(58),e.VirtualType=r(86),e.SchemaType=r(
|
|
995
|
+
*/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 i=n(t.discriminators,e[r]);i&&(t=i)}return t}},function(t,e,r){"use strict";t.exports=r(176)},function(t,e,r){"use strict";(function(n){function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function s(t,e){return(s=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function a(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=h(t);if(e){var i=h(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return u(this,r)}}function u(t,e){if(e&&("object"===i(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}r(25).set(r(179));var f=r(274),c=r(148);f.setBrowser(!0),Object.defineProperty(e,"Promise",{get:function(){return c.get()},set:function(t){c.set(t)}}),e.PromiseProvider=c,e.Error=r(7),e.Schema=r(85),e.Types=r(58),e.VirtualType=r(86),e.SchemaType=r(8),e.utils=r(4),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&&s(t,e)}(h,t);var e,n,i,u=a(h);function h(t,e){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,h),u.call(this,t,r,e)}return e=h,n&&o(e.prototype,n),i&&o(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e}(e.Document);return n.modelName=t,n},
|
|
996
996
|
/*!
|
|
997
997
|
* Module exports.
|
|
998
998
|
*/
|
|
@@ -1032,7 +1032,7 @@ t.exports=n},function(t,e,r){"use strict";
|
|
|
1032
1032
|
*/t.exports=function(){}},function(t,e,r){"use strict";
|
|
1033
1033
|
/*!
|
|
1034
1034
|
* Module dependencies.
|
|
1035
|
-
*/var n=r(13),i=r(
|
|
1035
|
+
*/var n=r(13),i=r(356),o=!1;t.exports=function(){return o?i:n},
|
|
1036
1036
|
/*!
|
|
1037
1037
|
* ignore
|
|
1038
1038
|
*/
|
|
@@ -1135,7 +1135,7 @@ function t(e,r,n,i,o,s){for(var a,u=0;u<e.length&&u<r.length;++u)a=e[u],Array.is
|
|
|
1135
1135
|
object-assign
|
|
1136
1136
|
(c) Sindre Sorhus
|
|
1137
1137
|
@license MIT
|
|
1138
|
-
*/var n=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable;function s(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}t.exports=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},r=0;r<10;r++)e["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(e).map((function(t){return e[t]})).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach((function(t){n[t]=t})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(t){return!1}}()?Object.assign:function(t,e){for(var r,a,u=s(t),h=1;h<arguments.length;h++){for(var f in r=Object(arguments[h]))i.call(r,f)&&(u[f]=r[f]);if(n){a=n(r);for(var c=0;c<a.length;c++)o.call(r,a[c])&&(u[a[c]]=r[a[c]])}}return u}},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(t,e,r){"use strict";function n(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return i(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return i(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,s=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw s}}}}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var s=r(43),a=r(
|
|
1138
|
+
*/var n=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable;function s(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}t.exports=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},r=0;r<10;r++)e["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(e).map((function(t){return e[t]})).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach((function(t){n[t]=t})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(t){return!1}}()?Object.assign:function(t,e){for(var r,a,u=s(t),h=1;h<arguments.length;h++){for(var f in r=Object(arguments[h]))i.call(r,f)&&(u[f]=r[f]);if(n){a=n(r);for(var c=0;c<a.length;c++)o.call(r,a[c])&&(u[a[c]]=r[a[c]])}}return u}},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(t,e,r){"use strict";function n(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return i(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return i(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,s=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw s}}}}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var s=r(43),a=r(9),u=r(285),h=r(286)("mquery");function f(t,e){if(!(this instanceof f))return new f(t,e);var r=this.constructor.prototype;this.op=r.op||void 0,this.options=Object.assign({},r.options),this._conditions=r._conditions?u.clone(r._conditions):{},this._fields=r._fields?u.clone(r._fields):void 0,this._update=r._update?u.clone(r._update):void 0,this._path=r._path||void 0,this._distinct=r._distinct||void 0,this._collection=r._collection||void 0,this._traceFunction=r._traceFunction||void 0,e&&this.setOptions(e),t&&(t.find&&t.remove&&t.update?this.collection(t):this.find(t))}var c="$geoWithin";Object.defineProperty(f,"use$geoWithin",{get:function(){return"$geoWithin"==c},set:function(t){c=!0===t?"$geoWithin":"$within"}}),f.prototype.toConstructor=function(){function t(e,r){if(!(this instanceof t))return new t(e,r);f.call(this,e,r)}u.inherits(t,f);var e=t.prototype;return e.options={},e.setOptions(this.options),e.op=this.op,e._conditions=u.clone(this._conditions),e._fields=u.clone(this._fields),e._update=u.clone(this._update),e._path=this._path,e._distinct=this._distinct,e._collection=this._collection,e._traceFunction=this._traceFunction,t},f.prototype.setOptions=function(t){if(!t||!u.isObject(t))return this;for(var e,r=u.keys(t),n=0;n<r.length;++n)if("function"==typeof this[e=r[n]]){var i=Array.isArray(t[e])?t[e]:[t[e]];this[e].apply(this,i)}else this.options[e]=t[e];return this},f.prototype.collection=function(t){return this._collection=new f.Collection(t),this},f.prototype.collation=function(t){return this.options.collation=t,this},f.prototype.$where=function(t){return this._conditions.$where=t,this},f.prototype.where=function(){if(!arguments.length)return this;this.op||(this.op="find");var t=o(arguments[0]);if("string"==t)return this._path=arguments[0],2===arguments.length&&(this._conditions[this._path]=arguments[1]),this;if("object"==t&&!Array.isArray(arguments[0]))return this.merge(arguments[0]);throw new TypeError("path must be a string or object")},f.prototype.equals=function(t){this._ensurePath("equals");var e=this._path;return this._conditions[e]=t,this},f.prototype.eq=function(t){this._ensurePath("eq");var e=this._path;return this._conditions[e]=t,this},f.prototype.or=function(t){var e=this._conditions.$or||(this._conditions.$or=[]);return Array.isArray(t)||(t=[t]),e.push.apply(e,t),this},f.prototype.nor=function(t){var e=this._conditions.$nor||(this._conditions.$nor=[]);return Array.isArray(t)||(t=[t]),e.push.apply(e,t),this},f.prototype.and=function(t){var e=this._conditions.$and||(this._conditions.$and=[]);return Array.isArray(t)||(t=[t]),e.push.apply(e,t),this},
|
|
1139
1139
|
/*!
|
|
1140
1140
|
* gt, gte, lt, lte, ne, in, nin, all, regex, size, maxDistance
|
|
1141
1141
|
*
|
|
@@ -1175,7 +1175,7 @@ var i=["__proto__","constructor","prototype"],o=e.clone=function r(n,i){if(null=
|
|
|
1175
1175
|
e.cloneObject=function(t,e){var r,n=e&&e.minimize,s={},a=Object.keys(t),u=a.length,h=!1,f="",c=0;for(c=0;c<u;++c)f=a[c],-1===i.indexOf(f)&&(r=o(t[f],e),n&&void 0===r||(h||(h=!0),s[f]=r));return n?h&&s:s},e.cloneArray=function(t,e){for(var r=[],n=t.length,i=0;i<n;i++)r.push(o(t[i],e));return r},e.tick=function(t){if("function"==typeof t)return function(){var e=arguments;u((function(){t.apply(this,e)}))}},e.merge=function t(r,n){for(var o=0,s=Object.keys(n);o<s.length;o++){var a=s[o];-1===i.indexOf(a)&&(void 0===r[a]?r[a]=n[a]:e.isObject(n[a])?t(r[a],n[a]):r[a]=n[a])}},e.mergeClone=function t(r,n){for(var s=0,a=Object.keys(n);s<a.length;s++){var u=a[s];-1===i.indexOf(u)&&(void 0===r[u]?r[u]=o(n[u]):e.isObject(n[u])?t(r[u],n[u]):r[u]=o(n[u]))}},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 s=Object.prototype.toString;e.toString=function(t){return s.call(t)};var a=e.isObject=function(t){return"[object Object]"==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 u=e.soon="function"==typeof r?r:n.nextTick;e.isArgumentsObject=function(t){return"[object Arguments]"===Object.prototype.toString.call(t)}}).call(this,r(3).Buffer,r(108).setImmediate,r(5))},function(t,e,r){(function(n){var i;e.formatArgs=function(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;var r="color: "+this.color;e.splice(1,0,r,"color: inherit");var n=0,i=0;e[0].replace(/%[a-zA-Z%]/g,(function(t){"%%"!==t&&(n++,"%c"===t&&(i=n))})),e.splice(i,0,r)},e.save=function(t){try{t?e.storage.setItem("debug",t):e.storage.removeItem("debug")}catch(t){}},e.load=function(){var t;try{t=e.storage.getItem("debug")}catch(t){}!t&&void 0!==n&&"env"in n&&(t=n.env.DEBUG);return t},e.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))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||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},e.storage=function(){try{return localStorage}catch(t){}}(),e.destroy=(i=!1,function(){i||(i=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],e.log=console.debug||console.log||function(){},t.exports=r(287)(e),t.exports.formatters.j=function(t){try{return JSON.stringify(t)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}}).call(this,r(5))},function(t,e,r){function n(t){return function(t){if(Array.isArray(t))return i(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||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)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}t.exports=function(t){function e(t){var r,n,o,s=null;function a(){for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];if(a.enabled){var o=a,s=Number(new Date),u=s-(r||s);o.diff=u,o.prev=r,o.curr=s,r=s,n[0]=e.coerce(n[0]),"string"!=typeof n[0]&&n.unshift("%O");var h=0;n[0]=n[0].replace(/%([a-zA-Z%])/g,(function(t,r){if("%%"===t)return"%";h++;var i=e.formatters[r];if("function"==typeof i){var s=n[h];t=i.call(o,s),n.splice(h,1),h--}return t})),e.formatArgs.call(o,n);var f=o.log||e.log;f.apply(o,n)}}return a.namespace=t,a.useColors=e.useColors(),a.color=e.selectColor(t),a.extend=i,a.destroy=e.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:function(){return null!==s?s:(n!==e.namespaces&&(n=e.namespaces,o=e.enabled(t)),o)},set:function(t){s=t}}),"function"==typeof e.init&&e.init(a),a}function i(t,r){var n=e(this.namespace+(void 0===r?":":r)+t);return n.log=this.log,n}function o(t){return t.toString().substring(2,t.toString().length-2).replace(/\.\*\?$/,"*")}return e.debug=e,e.default=e,e.coerce=function(t){if(t instanceof Error)return t.stack||t.message;return t},e.disable=function(){var t=[].concat(n(e.names.map(o)),n(e.skips.map(o).map((function(t){return"-"+t})))).join(",");return e.enable(""),t},e.enable=function(t){var r;e.save(t),e.namespaces=t,e.names=[],e.skips=[];var n=("string"==typeof t?t:"").split(/[\s,]+/),i=n.length;for(r=0;r<i;r++)n[r]&&("-"===(t=n[r].replace(/\*/g,".*?"))[0]?e.skips.push(new RegExp("^"+t.substr(1)+"$")):e.names.push(new RegExp("^"+t+"$")))},e.enabled=function(t){if("*"===t[t.length-1])return!0;var r,n;for(r=0,n=e.skips.length;r<n;r++)if(e.skips[r].test(t))return!1;for(r=0,n=e.names.length;r<n;r++)if(e.names[r].test(t))return!0;return!1},e.humanize=r(143),e.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(t).forEach((function(r){e[r]=t[r]})),e.names=[],e.skips=[],e.formatters={},e.selectColor=function(t){for(var r=0,n=0;n<t.length;n++)r=(r<<5)-r+t.charCodeAt(n),r|=0;return e.colors[Math.abs(r)%e.colors.length]},e.enable(e.load()),e}},function(t,e,r){"use strict";var n=e;n.distinct=function(t){return t._fields&&Object.keys(t._fields).length>0?"field selection and slice":(Object.keys(n.distinct).every((function(r){return!t.options[r]||(e=r,!1)})),e);var e},n.distinct.select=n.distinct.slice=n.distinct.sort=n.distinct.limit=n.distinct.skip=n.distinct.batchSize=n.distinct.comment=n.distinct.maxScan=n.distinct.snapshot=n.distinct.hint=n.distinct.tailable=!0,n.findOneAndUpdate=n.findOneAndRemove=function(t){var e;return Object.keys(n.findOneAndUpdate).every((function(r){return!t.options[r]||(e=r,!1)})),e},n.findOneAndUpdate.limit=n.findOneAndUpdate.skip=n.findOneAndUpdate.batchSize=n.findOneAndUpdate.maxScan=n.findOneAndUpdate.snapshot=n.findOneAndUpdate.hint=n.findOneAndUpdate.tailable=n.findOneAndUpdate.comment=!0,n.count=function(t){return t._fields&&Object.keys(t._fields).length>0?"field selection and slice":(Object.keys(n.count).every((function(r){return!t.options[r]||(e=r,!1)})),e);var e},n.count.slice=n.count.batchSize=n.count.comment=n.count.maxScan=n.count.snapshot=n.count.tailable=!0},function(t,e,r){"use strict";var n=r(149);if("unknown"==n.type)throw new Error("Unknown environment");t.exports=n.isNode?r(290):(n.isMongo,r(54))},function(t,e,r){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function o(t,e){return(o=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function s(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=u(t);if(e){var i=u(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return a(this,r)}}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){return(u=Object.setPrototypeOf?Object.getPrototypeOf: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&&o(t,e)}(u,t);var e,r,n,a=s(u);function u(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,u),(e=a.call(this)).collection=t,e.collectionName=t.collectionName,e}return e=u,(r=[{key:"find",value:function(t,e,r){var n=this.collection.find(t,e);try{n.toArray(r)}catch(t){r(t)}}},{key:"findOne",value:function(t,e,r){this.collection.findOne(t,e,r)}},{key:"count",value:function(t,e,r){this.collection.count(t,e,r)}},{key:"distinct",value:function(t,e,r,n){this.collection.distinct(t,e,r,n)}},{key:"update",value:function(t,e,r,n){this.collection.update(t,e,r,n)}},{key:"updateMany",value:function(t,e,r,n){this.collection.updateMany(t,e,r,n)}},{key:"updateOne",value:function(t,e,r,n){this.collection.updateOne(t,e,r,n)}},{key:"replaceOne",value:function(t,e,r,n){this.collection.replaceOne(t,e,r,n)}},{key:"deleteOne",value:function(t,e,r){this.collection.deleteOne(t,e,r)}},{key:"deleteMany",value:function(t,e,r){this.collection.deleteMany(t,e,r)}},{key:"remove",value:function(t,e,r){this.collection.remove(t,e,r)}},{key:"findOneAndDelete",value:function(t,e,r){this.collection.findOneAndDelete(t,e,r)}},{key:"findOneAndUpdate",value:function(t,e,r,n){this.collection.findOneAndUpdate(t,e,r,n)}},{key:"findCursor",value:function(t,e){return this.collection.find(t,e)}}])&&i(e.prototype,r),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),u}(r(54));t.exports=h},function(t,e,r){"use strict";var n=t.exports={};n.DocumentNotFoundError=null,n.general={},n.general.default="Validator failed for path `{PATH}` with value `{VALUE}`",n.general.required="Path `{PATH}` is required.",n.Number={},n.Number.min="Path `{PATH}` ({VALUE}) is less than minimum allowed value ({MIN}).",n.Number.max="Path `{PATH}` ({VALUE}) is more than maximum allowed value ({MAX}).",n.Number.enum="`{VALUE}` is not a valid enum value for path `{PATH}`.",n.Date={},n.Date.min="Path `{PATH}` ({VALUE}) is before minimum allowed value ({MIN}).",n.Date.max="Path `{PATH}` ({VALUE}) is after maximum allowed value ({MAX}).",n.String={},n.String.enum="`{VALUE}` is not a valid enum value for path `{PATH}`.",n.String.match="Path `{PATH}` is invalid ({VALUE}).",n.String.minlength="Path `{PATH}` (`{VALUE}`) is shorter than the minimum allowed length ({MINLENGTH}).",n.String.maxlength="Path `{PATH}` (`{VALUE}`) is longer than the maximum allowed length ({MAXLENGTH})."},function(t,e,r){"use strict";
|
|
1176
1176
|
/*!
|
|
1177
1177
|
* Module dependencies.
|
|
1178
|
-
*/function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function o(t,e){return(o=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function s(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=u(t);if(e){var i=u(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return a(this,r)}}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){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var h=r(7),f=r(
|
|
1178
|
+
*/function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function o(t,e){return(o=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function s(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=u(t);if(e){var i=u(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return a(this,r)}}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){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var h=r(7),f=r(9),c=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&&o(t,e)}(u,t);var e,r,n,a=s(u);
|
|
1179
1179
|
/*!
|
|
1180
1180
|
* OverwriteModel Error constructor.
|
|
1181
1181
|
*/function u(t,e,r,n){var i,o;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,u);var s=h.messages;return o=null!=s.DocumentNotFoundError?"function"==typeof s.DocumentNotFoundError?s.DocumentNotFoundError(t,e):s.DocumentNotFoundError:'No document found for query "'+f.inspect(t)+'" on model "'+e+'"',(i=a.call(this,o)).result=n,i.numAffected=r,i.filter=t,i.query=t,i}return e=u,r&&i(e.prototype,r),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(h);Object.defineProperty(c.prototype,"name",{value:"DocumentNotFoundError"}),
|
|
@@ -1235,7 +1235,14 @@ t.exports=h},function(t,e,r){"use strict";
|
|
|
1235
1235
|
t.exports=h},function(t,e,r){"use strict";var n=r(44);
|
|
1236
1236
|
/*!
|
|
1237
1237
|
* ignore
|
|
1238
|
-
*/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 i=null!=this.$__.priorDoc?this.$__.priorDoc.$__getValue(e):this.$__getValue(e);if("throw"===this.$__.strictMode&&t!==i)throw new n(e,"Path `"+e+"` is immutable and strict mode is set to throw.",!0);return i}),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";var
|
|
1238
|
+
*/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 i=null!=this.$__.priorDoc?this.$__.priorDoc.$__getValue(e):this.$__getValue(e);if("throw"===this.$__.strictMode&&t!==i)throw new n(e,"Path `"+e+"` is immutable and strict mode is set to throw.",!0);return i}),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";function n(t,e,r,n,i,o,s){try{var a=t[o](s),u=a.value}catch(t){return void r(t)}a.done?e(u):Promise.resolve(u).then(n,i)}function i(t){return function(){var e=this,r=arguments;return new Promise((function(i,o){var s=t.apply(e,r);function a(t){n(s,i,o,a,u,"next",t)}function u(t){n(s,i,o,a,u,"throw",t)}a(void 0)}))}}var o=Object.getPrototypeOf(i(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:case"end":return t.stop()}}),t)}))));t.exports=function(t){return"function"==typeof t&&Object.getPrototypeOf(t)===o}},function(t,e,r){"use strict";
|
|
1239
|
+
/*!
|
|
1240
|
+
* Determines if `arg` is a flat object.
|
|
1241
|
+
*
|
|
1242
|
+
* @param {Object|Array|String|Function|RegExp|any} arg
|
|
1243
|
+
* @api private
|
|
1244
|
+
* @return {Boolean}
|
|
1245
|
+
*/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){for(var e=Object.keys(t),r=!0,i=0,o=e.length;i<o;++i)if("object"===n(t[e[i]])&&null!==t[e[i]]){r=!1;break}return r}},function(t,e,r){"use strict";
|
|
1239
1246
|
/*!
|
|
1240
1247
|
* Module dependencies.
|
|
1241
1248
|
*/function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function o(t,e){return(o=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function s(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=u(t);if(e){var i=u(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return a(this,r)}}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){return(u=Object.setPrototypeOf?Object.getPrototypeOf: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&&o(t,e)}(u,t);var e,r,n,a=s(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),a.call(this,'Parameter "'+e+'" to '+r+"() must be an object, got "+t.toString())}return e=u,r&&i(e.prototype,r),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(r(7));Object.defineProperty(h.prototype,"name",{value:"ObjectParameterError"}),t.exports=h},function(t,e,r){"use strict";
|
|
@@ -1245,26 +1252,26 @@ t.exports=h},function(t,e,r){"use strict";var n=r(44);
|
|
|
1245
1252
|
/*!
|
|
1246
1253
|
* exports
|
|
1247
1254
|
*/
|
|
1248
|
-
t.exports=h},function(t,e,r){"use strict";(function(e){function r(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return n(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return n(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var i=0,o=function(){};return{s:o,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,s=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw s}}}}function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(){this._pres=new Map,this._posts=new Map}function s(t,e,r,n,i,o,s){return o.useErrorHandlers?t.execPost(r,n,i,{error:e},(function(t){return"function"==typeof s&&s(t)})):"function"==typeof s&&s(e)}function a(t,e,r,n){var i;try{i=t.apply(e,r)}catch(t){return n(t)}u(i)&&i.then((function(){return n()}),(function(t){return n(t)}))}function u(t){return null!=t&&"function"==typeof t.then}function h(t){var r=!1,n=this;return function(){var i=arguments;if(!r)return r=!0,e.nextTick((function(){return t.apply(n,i)}))}}o.prototype.execPre=function(t,r,n,i){3===arguments.length&&(i=n,n=[]);var o=this._pres.get(t)||[],s=o.length,f=o.numAsync||0,c=0,l=f,d=!1,p=n;if(!s)return e.nextTick((function(){i(null)}));var y=function t(){if(!(c>=s)){var n=o[c];if(n.isAsync){var f=[h(m),h((function(t){if(t){if(d)return;return d=!0,i(t)}if(0==--l&&c>=s)return i(null)}))];a(n.fn,r,f,f[0])}else if(n.fn.length>0){f=[h(m)];for(var y=arguments.length>=2?arguments:[null].concat(p),b=1;b<y.length;++b)f.push(y[b]);a(n.fn,r,f,f[0])}else{var v=null;try{v=n.fn.call(r)}catch(t){if(null!=t)return i(t)}if(u(v))v.then((function(){return m()}),(function(t){return m(t)}));else{if(++c>=s)return l>0?void 0:e.nextTick((function(){i(null)}));t()}}}};function m(t){if(t){if(d)return;return d=!0,i(t)}if(++c>=s)return l>0?void 0:i(null);y.apply(r,arguments)}y.apply(null,[null].concat(n))},o.prototype.execPreSync=function(t,e,r){for(var n=this._pres.get(t)||[],i=n.length,o=0;o<i;++o)n[o].fn.apply(e,r||[])},o.prototype.execPost=function(t,r,n,i,o){arguments.length<5&&(o=i,i=null);var s=this._posts.get(t)||[],f=s.length,c=0,l=null;if(i&&i.error&&(l=i.error),!f)return e.nextTick((function(){o.apply(null,[l].concat(n))}));var d=function t(){for(var e=s[c].fn,i=0,d=n.length,p=[],y=0;y<d;++y)i+=n[y]&&n[y]._kareemIgnore?0:1,n[y]&&n[y]._kareemIgnore||p.push(n[y]);if(l)if(e.length===i+2){var m=h((function(e){if(e&&(l=e),++c>=f)return o.call(null,l);t()}));a(e,r,[l].concat(p).concat([m]),m)}else{if(++c>=f)return o.call(null,l);t()}else{var b=h((function(e){return e?(l=e,t()):++c>=f?o.apply(null,[null].concat(n)):void t()}));if(e.length===i+2)return++c>=f?o.apply(null,[null].concat(n)):t();if(e.length===i+1)a(e,r,p.concat([b]),b);else{var v,g;try{g=e.apply(r,p)}catch(t){v=t,l=t}if(u(g))return g.then((function(){return b()}),(function(t){return b(t)}));if(++c>=f)return o.apply(null,[v].concat(n));t()}}};d()},o.prototype.execPostSync=function(t,e,r){for(var n=this._posts.get(t)||[],i=n.length,o=0;o<i;++o)n[o].fn.apply(e,r||[])},o.prototype.createWrapperSync=function(t,e){var r=this;return function(){r.execPreSync(t,this,arguments);var n=e.apply(this,arguments);return r.execPostSync(t,this,[n]),n}},o.prototype.wrap=function(t,e,r,n,i){var o=n.length>0?n[n.length-1]:null,a=("function"==typeof o&&n.slice(0,n.length-1),this),u=(i=i||{}).checkForPromise;this.execPre(t,r,n,(function(h){if(h){for(var f=i.numCallbackParams||0,c=i.contextParameter?[r]:[],l=c.length;l<f;++l)c.push(null);return s(a,h,t,r,c,i,o)}var d,p="function"==typeof o?n.length-1:n.length,y=e.length;try{d=e.apply(r,n.slice(0,p).concat(m))}catch(t){return m(t)}if(u){if(null!=d&&"function"==typeof d.then)return d.then((function(t){return m(null,t)}),(function(t){return m(t)}));if(y<p+1)return m(null,d)}function m(){var e=Array.from(arguments);if(e.shift(),i.nullResultByDefault&&0===e.length&&e.push(null),arguments[0])return s(a,arguments[0],t,r,e,i,o);a.execPost(t,r,e,(function(){return arguments[0]?"function"==typeof o?o(arguments[0]):void 0:"function"==typeof o?o.apply(r,arguments):void 0}))}}))},o.prototype.filter=function(t){for(var e=this,r=this.clone(),n=Array.from(r._pres.keys()),i=function(){var n=s[o],i=e._pres.get(n).map((function(t){return Object.assign({},t,{name:n})})).filter(t);if(0===i.length)return r._pres.delete(n),"continue";i.numAsync=i.filter((function(t){return t.isAsync})).length,r._pres.set(n,i)},o=0,s=n;o<s.length;o++)i();for(var a=Array.from(r._posts.keys()),u=function(){var n=f[h],i=e._posts.get(n).map((function(t){return Object.assign({},t,{name:n})})).filter(t);if(0===i.length)return r._posts.delete(n),"continue";r._posts.set(n,i)},h=0,f=a;h<f.length;h++)u();return r},o.prototype.hasHooks=function(t){return this._pres.has(t)||this._posts.has(t)},o.prototype.createWrapper=function(t,r,n,i){var o=this;return this.hasHooks(t)?function(){var e=n||this;o.wrap(t,r,e,Array.from(arguments),i)}:function(){var t=arguments,n=this;e.nextTick((function(){return r.apply(n,t)}))}},o.prototype.pre=function(t,e,r,n,o){var s={};"object"===i(e)&&null!==e?e=(s=e).isAsync:"boolean"!=typeof arguments[1]&&(r=e,e=!1);var a=this._pres.get(t)||[];if(this._pres.set(t,a),e&&(a.numAsync=a.numAsync||0,++a.numAsync),"function"!=typeof r)throw new Error('pre() requires a function, got "'+i(r)+'"');return o?a.unshift(Object.assign({},s,{fn:r,isAsync:e})):a.push(Object.assign({},s,{fn:r,isAsync:e})),this},o.prototype.post=function(t,e,r,n){var o=this._posts.get(t)||[];if("function"==typeof e&&(n=!!r,r=e,e={}),"function"!=typeof r)throw new Error('post() requires a function, got "'+i(r)+'"');return n?o.unshift(Object.assign({},e,{fn:r})):o.push(Object.assign({},e,{fn:r})),this._posts.set(t,o),this},o.prototype.clone=function(){var t,e=new o,n=r(this._pres.keys());try{for(n.s();!(t=n.n()).done;){var i=t.value,s=this._pres.get(i).slice();s.numAsync=this._pres.get(i).numAsync,e._pres.set(i,s)}}catch(t){n.e(t)}finally{n.f()}var a,u=r(this._posts.keys());try{for(u.s();!(a=u.n()).done;){var h=a.value;e._posts.set(h,this._posts.get(h).slice())}}catch(t){u.e(t)}finally{u.f()}return e},o.prototype.merge=function(t,e){var n,i=(e=1===arguments.length||e)?this.clone():this,o=r(t._pres.keys());try{var s=function(){var e=n.value,r=i._pres.get(e)||[],o=t._pres.get(e).filter((function(t){return-1===r.map((function(t){return t.fn})).indexOf(t.fn)})),s=r.concat(o);s.numAsync=r.numAsync||0,s.numAsync+=o.filter((function(t){return t.isAsync})).length,i._pres.set(e,s)};for(o.s();!(n=o.n()).done;)s()}catch(t){o.e(t)}finally{o.f()}var a,u=r(t._posts.keys());try{var h=function(){var e=a.value,r=i._posts.get(e)||[],n=t._posts.get(e).filter((function(t){return-1===r.indexOf(t)}));i._posts.set(e,r.concat(n))};for(u.s();!(a=u.n()).done;)h()}catch(t){u.e(t)}finally{u.f()}return i},t.exports=o}).call(this,r(5))},function(t,e,r){"use strict";function n(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function i(t,e,r){return e&&n(t.prototype,e),r&&n(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}var o=r(16),s=i((function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),Object.assign(this,e),null!=e&&null!=e.options&&(this.options=Object.assign({},e.options))}));Object.defineProperty(s.prototype,"ref",o),Object.defineProperty(s.prototype,"refPath",o),Object.defineProperty(s.prototype,"localField",o),Object.defineProperty(s.prototype,"foreignField",o),Object.defineProperty(s.prototype,"justOne",o),Object.defineProperty(s.prototype,"count",o),Object.defineProperty(s.prototype,"match",o),Object.defineProperty(s.prototype,"options",o),Object.defineProperty(s.prototype,"skip",o),Object.defineProperty(s.prototype,"limit",o),Object.defineProperty(s.prototype,"perDocumentLimit",o),t.exports=s},function(t,e,r){"use strict";var n=r(14),i=r(33);
|
|
1255
|
+
t.exports=h},function(t,e,r){"use strict";(function(e){function r(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return n(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return n(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var i=0,o=function(){};return{s:o,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,s=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw s}}}}function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(){this._pres=new Map,this._posts=new Map}function s(t,e,r,n,i,o,s){return o.useErrorHandlers?t.execPost(r,n,i,{error:e},(function(t){return"function"==typeof s&&s(t)})):"function"==typeof s&&s(e)}function a(t,e,r,n){var i;try{i=t.apply(e,r)}catch(t){return n(t)}u(i)&&i.then((function(){return n()}),(function(t){return n(t)}))}function u(t){return null!=t&&"function"==typeof t.then}function h(t){var r=!1,n=this;return function(){var i=arguments;if(!r)return r=!0,e.nextTick((function(){return t.apply(n,i)}))}}o.prototype.execPre=function(t,r,n,i){3===arguments.length&&(i=n,n=[]);var o=this._pres.get(t)||[],s=o.length,f=o.numAsync||0,c=0,l=f,d=!1,p=n;if(!s)return e.nextTick((function(){i(null)}));var y=function t(){if(!(c>=s)){var n=o[c];if(n.isAsync){var f=[h(m),h((function(t){if(t){if(d)return;return d=!0,i(t)}if(0==--l&&c>=s)return i(null)}))];a(n.fn,r,f,f[0])}else if(n.fn.length>0){f=[h(m)];for(var y=arguments.length>=2?arguments:[null].concat(p),b=1;b<y.length;++b)f.push(y[b]);a(n.fn,r,f,f[0])}else{var v=null;try{v=n.fn.call(r)}catch(t){if(null!=t)return i(t)}if(u(v))v.then((function(){return m()}),(function(t){return m(t)}));else{if(++c>=s)return l>0?void 0:e.nextTick((function(){i(null)}));t()}}}};function m(t){if(t){if(d)return;return d=!0,i(t)}if(++c>=s)return l>0?void 0:i(null);y.apply(r,arguments)}y.apply(null,[null].concat(n))},o.prototype.execPreSync=function(t,e,r){for(var n=this._pres.get(t)||[],i=n.length,o=0;o<i;++o)n[o].fn.apply(e,r||[])},o.prototype.execPost=function(t,r,n,i,o){arguments.length<5&&(o=i,i=null);var s=this._posts.get(t)||[],f=s.length,c=0,l=null;if(i&&i.error&&(l=i.error),!f)return e.nextTick((function(){o.apply(null,[l].concat(n))}));var d=function t(){for(var e=s[c].fn,i=0,d=n.length,p=[],y=0;y<d;++y)i+=n[y]&&n[y]._kareemIgnore?0:1,n[y]&&n[y]._kareemIgnore||p.push(n[y]);if(l)if(e.length===i+2){var m=h((function(e){if(e&&(l=e),++c>=f)return o.call(null,l);t()}));a(e,r,[l].concat(p).concat([m]),m)}else{if(++c>=f)return o.call(null,l);t()}else{var b=h((function(e){return e?(l=e,t()):++c>=f?o.apply(null,[null].concat(n)):void t()}));if(e.length===i+2)return++c>=f?o.apply(null,[null].concat(n)):t();if(e.length===i+1)a(e,r,p.concat([b]),b);else{var v,g;try{g=e.apply(r,p)}catch(t){v=t,l=t}if(u(g))return g.then((function(){return b()}),(function(t){return b(t)}));if(++c>=f)return o.apply(null,[v].concat(n));t()}}};d()},o.prototype.execPostSync=function(t,e,r){for(var n=this._posts.get(t)||[],i=n.length,o=0;o<i;++o)n[o].fn.apply(e,r||[])},o.prototype.createWrapperSync=function(t,e){var r=this;return function(){r.execPreSync(t,this,arguments);var n=e.apply(this,arguments);return r.execPostSync(t,this,[n]),n}},o.prototype.wrap=function(t,e,r,n,i){var o=n.length>0?n[n.length-1]:null,a=("function"==typeof o&&n.slice(0,n.length-1),this),u=(i=i||{}).checkForPromise;this.execPre(t,r,n,(function(h){if(h){for(var f=i.numCallbackParams||0,c=i.contextParameter?[r]:[],l=c.length;l<f;++l)c.push(null);return s(a,h,t,r,c,i,o)}var d,p="function"==typeof o?n.length-1:n.length,y=e.length;try{d=e.apply(r,n.slice(0,p).concat(m))}catch(t){return m(t)}if(u){if(null!=d&&"function"==typeof d.then)return d.then((function(t){return m(null,t)}),(function(t){return m(t)}));if(y<p+1)return m(null,d)}function m(){var e=Array.from(arguments);if(e.shift(),i.nullResultByDefault&&0===e.length&&e.push(null),arguments[0])return s(a,arguments[0],t,r,e,i,o);a.execPost(t,r,e,(function(){return arguments[0]?"function"==typeof o?o(arguments[0]):void 0:"function"==typeof o?o.apply(r,arguments):void 0}))}}))},o.prototype.filter=function(t){for(var e=this,r=this.clone(),n=Array.from(r._pres.keys()),i=function(){var n=s[o],i=e._pres.get(n).map((function(t){return Object.assign({},t,{name:n})})).filter(t);if(0===i.length)return r._pres.delete(n),"continue";i.numAsync=i.filter((function(t){return t.isAsync})).length,r._pres.set(n,i)},o=0,s=n;o<s.length;o++)i();for(var a=Array.from(r._posts.keys()),u=function(){var n=f[h],i=e._posts.get(n).map((function(t){return Object.assign({},t,{name:n})})).filter(t);if(0===i.length)return r._posts.delete(n),"continue";r._posts.set(n,i)},h=0,f=a;h<f.length;h++)u();return r},o.prototype.hasHooks=function(t){return this._pres.has(t)||this._posts.has(t)},o.prototype.createWrapper=function(t,r,n,i){var o=this;return this.hasHooks(t)?function(){var e=n||this;o.wrap(t,r,e,Array.from(arguments),i)}:function(){var t=arguments,n=this;e.nextTick((function(){return r.apply(n,t)}))}},o.prototype.pre=function(t,e,r,n,o){var s={};"object"===i(e)&&null!==e?e=(s=e).isAsync:"boolean"!=typeof arguments[1]&&(r=e,e=!1);var a=this._pres.get(t)||[];if(this._pres.set(t,a),e&&(a.numAsync=a.numAsync||0,++a.numAsync),"function"!=typeof r)throw new Error('pre() requires a function, got "'+i(r)+'"');return o?a.unshift(Object.assign({},s,{fn:r,isAsync:e})):a.push(Object.assign({},s,{fn:r,isAsync:e})),this},o.prototype.post=function(t,e,r,n){var o=this._posts.get(t)||[];if("function"==typeof e&&(n=!!r,r=e,e={}),"function"!=typeof r)throw new Error('post() requires a function, got "'+i(r)+'"');return n?o.unshift(Object.assign({},e,{fn:r})):o.push(Object.assign({},e,{fn:r})),this._posts.set(t,o),this},o.prototype.clone=function(){var t,e=new o,n=r(this._pres.keys());try{for(n.s();!(t=n.n()).done;){var i=t.value,s=this._pres.get(i).slice();s.numAsync=this._pres.get(i).numAsync,e._pres.set(i,s)}}catch(t){n.e(t)}finally{n.f()}var a,u=r(this._posts.keys());try{for(u.s();!(a=u.n()).done;){var h=a.value;e._posts.set(h,this._posts.get(h).slice())}}catch(t){u.e(t)}finally{u.f()}return e},o.prototype.merge=function(t,e){var n,i=(e=1===arguments.length||e)?this.clone():this,o=r(t._pres.keys());try{var s=function(){var e=n.value,r=i._pres.get(e)||[],o=t._pres.get(e).filter((function(t){return-1===r.map((function(t){return t.fn})).indexOf(t.fn)})),s=r.concat(o);s.numAsync=r.numAsync||0,s.numAsync+=o.filter((function(t){return t.isAsync})).length,i._pres.set(e,s)};for(o.s();!(n=o.n()).done;)s()}catch(t){o.e(t)}finally{o.f()}var a,u=r(t._posts.keys());try{var h=function(){var e=a.value,r=i._posts.get(e)||[],n=t._posts.get(e).filter((function(t){return-1===r.indexOf(t)}));i._posts.set(e,r.concat(n))};for(u.s();!(a=u.n()).done;)h()}catch(t){u.e(t)}finally{u.f()}return i},t.exports=o}).call(this,r(5))},function(t,e,r){"use strict";function n(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function i(t,e,r){return e&&n(t.prototype,e),r&&n(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}var o=r(16),s=i((function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),Object.assign(this,e),null!=e&&null!=e.options&&(this.options=Object.assign({},e.options))}));Object.defineProperty(s.prototype,"ref",o),Object.defineProperty(s.prototype,"refPath",o),Object.defineProperty(s.prototype,"localField",o),Object.defineProperty(s.prototype,"foreignField",o),Object.defineProperty(s.prototype,"justOne",o),Object.defineProperty(s.prototype,"count",o),Object.defineProperty(s.prototype,"match",o),Object.defineProperty(s.prototype,"options",o),Object.defineProperty(s.prototype,"skip",o),Object.defineProperty(s.prototype,"limit",o),Object.defineProperty(s.prototype,"perDocumentLimit",o),t.exports=s},function(t,e,r){"use strict";var n=r(14),i=r(33),o=r(310);
|
|
1249
1256
|
/*!
|
|
1250
1257
|
* Gather all indexes defined in the schema, including single nested,
|
|
1251
1258
|
* document arrays, and embedded discriminators.
|
|
1252
1259
|
*/
|
|
1253
|
-
t.exports=function(t){var e=[],r=new WeakMap,
|
|
1260
|
+
t.exports=function(t){var e=[],r=new WeakMap,s=t.constructor.indexTypes,a=new Map;return function t(u,h,f){if(r.has(u))return;r.set(u,!0),h=h||"";for(var c=Object.keys(u.paths),l=0,d=c;l<d.length;l++){var p=d[l],y=u.paths[p];if(null==f||!f.paths[p]){if(y.$isMongooseDocumentArray||y.$isSingleNested){if(!0!==n(y,"options.excludeIndexes")&&!0!==n(y,"schemaOptions.excludeIndexes")&&!0!==n(y,"schema.options.excludeIndexes")&&t(y.schema,h+p+"."),null!=y.schema.discriminators)for(var m=y.schema.discriminators,b=Object.keys(m),v=0,g=b;v<g.length;v++){var w=g[v];t(m[w],h+p+".",y.schema)}if(y.$isMongooseDocumentArray)continue}var _=y._index||y.caster&&y.caster._index;if(!1!==_&&null!=_){var M={},S=i(_),O=S?_:{},A="string"==typeof _?_:!!S&&_.type;if(A&&-1!==s.indexOf(A))M[h+p]=A;else if(O.text)M[h+p]="text",delete O.text;else{var E=-1===Number(_);M[h+p]=E?-1:1}delete O.type,"background"in O||(O.background=!0),null!=u.options.autoIndex&&(O._autoIndex=u.options.autoIndex);var x=O&&O.name;"string"==typeof x&&a.has(x)?Object.assign(a.get(x),M):(e.push([M,O]),a.set(x,M))}}}r.delete(u),h?
|
|
1254
1261
|
/*!
|
|
1255
1262
|
* Checks for indexes added to subdocs using Schema.index().
|
|
1256
1263
|
* These indexes need their paths prefixed properly.
|
|
1257
1264
|
*
|
|
1258
1265
|
* schema._indexes = [ [indexObj, options], [indexObj, options] ..]
|
|
1259
1266
|
*/
|
|
1260
|
-
function(t,r){for(var n=t._indexes,i=n.length,o=0;o<i;++o){for(var s=n[o][0],a=n[o][1],u=Object.keys(s),h=u.length,f={},c=0;c<h;++c){var l=u[c];f[r+l]=s[l]}var d=Object.assign({},a);if(null!=a&&null!=a.partialFilterExpression){d.partialFilterExpression={};for(var p=a.partialFilterExpression,y=0,m=Object.keys(p);y<m.length;y++){var b=m[y];d.partialFilterExpression[r+b]=p[b]}}e.push([f,d])}}(
|
|
1267
|
+
function(t,r){for(var n=t._indexes,i=n.length,o=0;o<i;++o){for(var s=n[o][0],a=n[o][1],u=Object.keys(s),h=u.length,f={},c=0;c<h;++c){var l=u[c];f[r+l]=s[l]}var d=Object.assign({},a);if(null!=a&&null!=a.partialFilterExpression){d.partialFilterExpression={};for(var p=a.partialFilterExpression,y=0,m=Object.keys(p);y<m.length;y++){var b=m[y];d.partialFilterExpression[r+b]=p[b]}}e.push([f,d])}}(u,h):(u._indexes.forEach((function(t){var e=t[1];"background"in e||(e.background=!0),o(u,e)})),e=e.concat(u._indexes))}(t),e}},function(t,e,r){"use strict";t.exports=function(t,e){var r=t.discriminatorMapping&&t.discriminatorMapping.value;if(r&&!("sparse"in e)){var n=t.options.discriminatorKey;e.partialFilterExpression=e.partialFilterExpression||{},e.partialFilterExpression[n]=r}return e}},function(t,e,r){"use strict";
|
|
1261
1268
|
/*!
|
|
1262
1269
|
* ignore
|
|
1263
1270
|
*/
|
|
1264
1271
|
/*!
|
|
1265
1272
|
* Returns this documents _id cast to a string.
|
|
1266
1273
|
*/
|
|
1267
|
-
function n(){return null!=this._id?String(this._id):null}t.exports=function(t){return!t.paths.id&&t.paths._id&&t.options.id?(t.virtual("id").get(n),t):t}},function(t,e,r){"use strict";function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var i=r(
|
|
1274
|
+
function n(){return null!=this._id?String(this._id):null}t.exports=function(t){return!t.paths.id&&t.paths._id&&t.options.id?(t.virtual("id").get(n),t):t}},function(t,e,r){"use strict";function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var i=r(313),o=r(315),s=r(14),a=r(156),u=r(55);t.exports=function(t,e){var r=t.childSchemas.find((function(t){return!!t.schema.options.timestamps}));if(e||r){var h,f=a(e,"createdAt"),c=a(e,"updatedAt"),l=null!=e&&e.hasOwnProperty("currentTime")?e.currentTime:null,d={};if(t.$timestamps={createdAt:f,updatedAt:c},c&&!t.paths[c]&&(d[c]=Date),f&&!t.paths[f])d[f]=(n(h={},t.options.typeKey||"type",Date),n(h,"immutable",!0),h);t.add(d),t.pre("save",(function(t){var e=s(this,"$__.saveOptions.timestamps");if(!1===e)return t();var r=null!=e&&!1===e.updatedAt,n=null!=e&&!1===e.createdAt,i=null!=l?l():this.ownerDocument().constructor.base.now();if(!n&&this.isNew&&f&&!this.$__getValue(f)&&this.$__isSelected(f)&&this.$set(f,i),!r&&c&&(this.isNew||this.$isModified())){var o=i;this.isNew&&null!=f&&(o=this.$__getValue(f)),this.$set(c,o)}t()})),t.methods.initializeTimestamps=function(){var t=null!=l?l():this.constructor.base.now();return f&&!this.get(f)&&this.$set(f,t),c&&!this.get(c)&&this.$set(c,t),this},y[u.builtInMiddleware]=!0;var p={query:!0,model:!1};t.pre("findOneAndReplace",p,y),t.pre("findOneAndUpdate",p,y),t.pre("replaceOne",p,y),t.pre("update",p,y),t.pre("updateOne",p,y),t.pre("updateMany",p,y)}function y(t){var e=null!=l?l():this.model.base.now();"findOneAndReplace"===this.op&&null==this.getUpdate()&&this.setUpdate({}),o(e,f,c,this.getUpdate(),this.options,this.schema),i(e,this.getUpdate(),this.model.schema),t()}}},function(t,e,r){"use strict";function n(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return i(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return i(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,s=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw s}}}}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var o=r(314),s=r(156);
|
|
1268
1275
|
/*!
|
|
1269
1276
|
* ignore
|
|
1270
1277
|
*/
|
|
@@ -1275,10 +1282,10 @@ function a(t,e,r){if(null!=e){if(Object.keys(e).some((function(t){return t.start
|
|
|
1275
1282
|
/*!
|
|
1276
1283
|
* ignore
|
|
1277
1284
|
*/
|
|
1278
|
-
function(t,e,r,i,o){var s=i,a=s,u=n(o,"overwrite",!1),h=n(o,"timestamps",!0);if(!h||null==s)return i;var f=null!=h&&!1===h.createdAt,c=null!=h&&!1===h.updatedAt;if(u)return i&&i.$set&&(i=i.$set,s.$set={},a=s.$set),c||!r||i[r]||(a[r]=t),f||!e||i[e]||(a[e]=t),s;if(i=i||{},Array.isArray(s))return s.push({$set:(l={},d=r,p=t,d in l?Object.defineProperty(l,d,{value:p,enumerable:!0,configurable:!0,writable:!0}):l[d]=p,l)}),s;var l,d,p;if(s.$set=s.$set||{},!c&&r&&(!i.$currentDate||!i.$currentDate[r])){var y=!1;if(-1!==r.indexOf("."))for(var m=r.split("."),b=1;b<m.length;++b){var v=m.slice(-b).join("."),g=m.slice(0,-b).join(".");if(null!=i[g]){i[g][v]=t,y=!0;break}if(i.$set&&i.$set[g]){i.$set[g][v]=t,y=!0;break}}y||(s.$set[r]=t),s.hasOwnProperty(r)&&delete s[r]}if(!f&&e){i[e]&&delete i[e],i.$set&&i.$set[e]&&delete i.$set[e];var w=!1;if(-1!==e.indexOf("."))for(var _=e.split("."),M=1;M<_.length;++M){var S=_.slice(-M).join("."),O=_.slice(0,-M).join(".");if(null!=i[O]){i[O][S]=t,w=!0;break}if(i.$set&&i.$set[O]){i.$set[O][S]=t,w=!0;break}}w||(s.$setOnInsert=s.$setOnInsert||{},s.$setOnInsert[e]=t)}0===Object.keys(s.$set).length&&delete s.$set;return s}},function(t,e,r){"use strict";var n=r(19),i=r(
|
|
1285
|
+
function(t,e,r,i,o){var s=i,a=s,u=n(o,"overwrite",!1),h=n(o,"timestamps",!0);if(!h||null==s)return i;var f=null!=h&&!1===h.createdAt,c=null!=h&&!1===h.updatedAt;if(u)return i&&i.$set&&(i=i.$set,s.$set={},a=s.$set),c||!r||i[r]||(a[r]=t),f||!e||i[e]||(a[e]=t),s;if(i=i||{},Array.isArray(s))return s.push({$set:(l={},d=r,p=t,d in l?Object.defineProperty(l,d,{value:p,enumerable:!0,configurable:!0,writable:!0}):l[d]=p,l)}),s;var l,d,p;if(s.$set=s.$set||{},!c&&r&&(!i.$currentDate||!i.$currentDate[r])){var y=!1;if(-1!==r.indexOf("."))for(var m=r.split("."),b=1;b<m.length;++b){var v=m.slice(-b).join("."),g=m.slice(0,-b).join(".");if(null!=i[g]){i[g][v]=t,y=!0;break}if(i.$set&&i.$set[g]){i.$set[g][v]=t,y=!0;break}}y||(s.$set[r]=t),s.hasOwnProperty(r)&&delete s[r]}if(!f&&e){i[e]&&delete i[e],i.$set&&i.$set[e]&&delete i.$set[e];var w=!1;if(-1!==e.indexOf("."))for(var _=e.split("."),M=1;M<_.length;++M){var S=_.slice(-M).join("."),O=_.slice(0,-M).join(".");if(null!=i[O]){i[O][S]=t,w=!0;break}if(i.$set&&i.$set[O]){i.$set[O][S]=t,w=!0;break}}w||(s.$setOnInsert=s.$setOnInsert||{},s.$setOnInsert[e]=t)}0===Object.keys(s.$set).length&&delete s.$set;return s}},function(t,e,r){"use strict";var n=r(19),i=r(9);t.exports=function(t,e){if("string"==typeof t)return;if("function"==typeof t)return;throw new n('Invalid ref at path "'+e+'". Got '+i.inspect(t,{depth:0}))}},function(t,e,r){"use strict";
|
|
1279
1286
|
/*!
|
|
1280
1287
|
* ignore
|
|
1281
|
-
*/t.exports=i;var n=r(
|
|
1288
|
+
*/t.exports=i;var n=r(318);
|
|
1282
1289
|
/*!
|
|
1283
1290
|
* ignore
|
|
1284
1291
|
*/
|
|
@@ -1291,7 +1298,7 @@ function(t,e,r,i,o){var s=i,a=s,u=n(o,"overwrite",!1),h=n(o,"timestamps",!0);if(
|
|
|
1291
1298
|
function i(t,e){var r={useErrorHandlers:!0,numCallbackParams:1,nullResultByDefault:!0},n=e.hooks.filter((function(t){var e=function(t){var e={};t.hasOwnProperty("query")&&(e.query=t.query);t.hasOwnProperty("document")&&(e.document=t.document);return e}(t);return"updateOne"===t.name?null==e.query||!!e.query:"deleteOne"===t.name?!!e.query||0===Object.keys(e).length:"validate"===t.name||"remove"===t.name?!!e.query:null==t.query&&null==t.document||!!t.query}));t.prototype._execUpdate=n.createWrapper("update",t.prototype._execUpdate,null,r),t.prototype.__distinct=n.createWrapper("distinct",t.prototype.__distinct,null,r),t.prototype.validate=n.createWrapper("validate",t.prototype.validate,null,r),i.middlewareFunctions.filter((function(t){return"update"!==t&&"distinct"!==t&&"validate"!==t})).forEach((function(e){t.prototype["_".concat(e)]=n.createWrapper(e,t.prototype["_".concat(e)],null,r)}))}i.middlewareFunctions=n.concat(["validate"])},function(t,e,r){"use strict";t.exports=Object.freeze(["count","countDocuments","distinct","estimatedDocumentCount","find","findOne","findOneAndReplace","findOneAndUpdate","replaceOne","update","updateMany","updateOne","deleteMany","deleteOne","findOneAndDelete","findOneAndRemove","remove"])},function(t,e,r){"use strict";
|
|
1292
1299
|
/*!
|
|
1293
1300
|
* Module dependencies.
|
|
1294
|
-
*/function n(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return i(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return i(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,s=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw s}}}}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var o=r(
|
|
1301
|
+
*/function n(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return i(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return i(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,s=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw s}}}}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var o=r(8),s=r(7),a=r(320),u=r(158),h=r(4),f=o.CastError;function c(t,e){this.enumValues=[],this.regExp=null,o.call(this,t,e,"String")}
|
|
1295
1302
|
/*!
|
|
1296
1303
|
* ignore
|
|
1297
1304
|
*/
|
|
@@ -1326,7 +1333,7 @@ t.exports=f},function(t,e,r){"use strict";function n(t){return(n="function"==typ
|
|
|
1326
1333
|
t.exports=f},function(t,e,r){"use strict";
|
|
1327
1334
|
/*!
|
|
1328
1335
|
* Module dependencies.
|
|
1329
|
-
*/var n=r(20),i=r(
|
|
1336
|
+
*/var n=r(20),i=r(8),o=r(84),s=r(4);function a(t,e){i.call(this,t,e,"Boolean")}a.schemaName="Boolean",a.defaultOptions={},
|
|
1330
1337
|
/*!
|
|
1331
1338
|
* Inherits from SchemaType.
|
|
1332
1339
|
*/
|
|
@@ -1349,11 +1356,19 @@ a._checkRequired=function(t){return!0===t||!1===t},a.checkRequired=i.checkRequir
|
|
|
1349
1356
|
t.exports=a},function(t,e,r){"use strict";
|
|
1350
1357
|
/*!
|
|
1351
1358
|
* Module dependencies.
|
|
1352
|
-
*/var n,i,o=r(88),s=r(20),a=r(12).EventEmitter,u=r(
|
|
1359
|
+
*/var n,i,o=r(88),s=r(20),a=r(12).EventEmitter,u=r(330),h=r(8),f=r(172),c=r(173),l=r(9),d=r(4),p=r(174),y=r(1).arrayAtomicsSymbol,m=r(1).arrayPathSymbol,b=r(1).documentArrayParent;function v(t,e,r,n){null!=n&&null!=n._id?e=c(e,n):null!=r&&null!=r._id&&(e=c(e,r));var i=g(e,r);i.prototype.$basePath=t,o.call(this,t,i,r),this.schema=e,this.schemaOptions=n||{},this.$isMongooseDocumentArray=!0,this.Constructor=i,i.base=e.base;var s=this.defaultValue;"defaultValue"in this&&void 0===s||this.default((function(){var t=s.call(this);return null==t||Array.isArray(t)||(t=[t]),t}));var a=this;this.$embeddedSchemaType=new h(t+".$",{required:this&&this.schemaOptions&&this.schemaOptions.required||!1}),this.$embeddedSchemaType.cast=function(t,e,r){return a.cast(t,e,r)[0]},this.$embeddedSchemaType.$isMongooseDocumentArrayElement=!0,this.$embeddedSchemaType.caster=this.Constructor,this.$embeddedSchemaType.schema=this.schema}
|
|
1353
1360
|
/*!
|
|
1354
1361
|
* Ignore
|
|
1355
1362
|
*/
|
|
1356
|
-
function g(t,e,n){function o(){i.apply(this,arguments),this.$session(this.ownerDocument().$session())}i||(i=r(46)),t._preCompile();var s=null!=n?n.prototype:i.prototype;for(var u in o.prototype=Object.create(s),o.prototype.$__setSchema(t),o.schema=t,o.prototype.constructor=o,o.$isArraySubdocument=!0,o.events=new a,t.methods)o.prototype[u]=t.methods[u];for(var h in t.statics)o[h]=t.statics[h];for(var f in a.prototype)o[f]=a.prototype[f];return o.options=e,o}
|
|
1363
|
+
function g(t,e,n){function o(){i.apply(this,arguments),this.$session(this.ownerDocument().$session())}i||(i=r(46)),t._preCompile();var s=null!=n?n.prototype:i.prototype;for(var u in o.prototype=Object.create(s),o.prototype.$__setSchema(t),o.schema=t,o.prototype.constructor=o,o.$isArraySubdocument=!0,o.events=new a,t.methods)o.prototype[u]=t.methods[u];for(var h in t.statics)o[h]=t.statics[h];for(var f in a.prototype)o[f]=a.prototype[f];return o.options=e,o}v.schemaName="DocumentArray",v.options={castNonArrays:!0},
|
|
1364
|
+
/*!
|
|
1365
|
+
* Inherits from ArrayType.
|
|
1366
|
+
*/
|
|
1367
|
+
v.prototype=Object.create(o.prototype),v.prototype.constructor=v,v.prototype.OptionsConstructor=u,v.prototype.discriminator=function(t,e,r){"function"==typeof t&&(t=d.getFunctionName(t)),r=r||{};var n=d.isPOJO(r)?r.value:r,i="boolean"!=typeof r.clone||r.clone;e.instanceOfSchema&&i&&(e=e.clone());var o=g(e=f(this.casterConstructor,t,e,n),null,this.casterConstructor);o.baseCasterConstructor=this.casterConstructor;try{Object.defineProperty(o,"name",{value:t})}catch(t){}return this.casterConstructor.discriminators[t]=o,this.casterConstructor.discriminators[t]},v.prototype.doValidate=function(t,e,o,s){n||(n=r(27));var a=this;try{h.prototype.doValidate.call(this,t,(function(r){if(r)return e(r);var u,h=t&&t.length;if(!h)return e();if(s&&s.updateValidator)return e();d.isMongooseDocumentArray(t)||(t=new n(t,a.path,o));function f(t){null!=t&&(u=t),--h||e(u)}for(var c=0,l=h;c<l;++c){var y=t[c];if(null!=y){if(!(y instanceof i)){var m=p(a.casterConstructor,t[c]);y=t[c]=new m(y,t,void 0,void 0,c)}null==s||!s.validateModifiedOnly||y.$isModified()?y.$__validate(f):--h||e(u)}else--h||e(u)}}),o)}catch(t){return e(t)}},v.prototype.doValidateSync=function(t,e,r){var n=h.prototype.doValidateSync.call(this,t,e);if(null!=n)return n;var o=t&&t.length,s=null;if(o){for(var a=0,u=o;a<u;++a){var f=t[a];if(f){if(!(f instanceof i)){var c=p(this.casterConstructor,t[a]);f=t[a]=new c(f,t,void 0,void 0,a)}if(null==r||!r.validateModifiedOnly||f.$isModified()){var l=f.validateSync();l&&null==s&&(s=l)}}}return s}},
|
|
1368
|
+
/*!
|
|
1369
|
+
* ignore
|
|
1370
|
+
*/
|
|
1371
|
+
v.prototype.getDefault=function(t){var e="function"==typeof this.defaultValue?this.defaultValue.call(t):this.defaultValue;if(null==e)return e;n||(n=r(27)),Array.isArray(e)||(e=[e]),e=new n(e,this.path,t);for(var i=0;i<e.length;++i){var o=new(p(this.casterConstructor,e[i]))({},e,void 0,void 0,i);o.$init(e[i]),o.isNew=!0,Object.assign(o.$__.activePaths.default,o.$__.activePaths.init),o.$__.activePaths.init={},e[i]=o}return e};var w=Object.freeze({transform:!1,virtuals:!1}),_=Object.freeze({skipId:!0,willInit:!0});
|
|
1357
1372
|
/*!
|
|
1358
1373
|
* Scopes paths selected in a query to this array.
|
|
1359
1374
|
* Necessary for proper default application of subdocument values.
|
|
@@ -1362,15 +1377,7 @@ function g(t,e,n){function o(){i.apply(this,arguments),this.$session(this.ownerD
|
|
|
1362
1377
|
* @param {Object|undefined} fields - the root fields selected in the query
|
|
1363
1378
|
* @param {Boolean|undefined} init - if we are being created part of a query result
|
|
1364
1379
|
*/
|
|
1365
|
-
function
|
|
1366
|
-
/*!
|
|
1367
|
-
* Inherits from ArrayType.
|
|
1368
|
-
*/
|
|
1369
|
-
v.prototype=Object.create(o.prototype),v.prototype.constructor=v,v.prototype.OptionsConstructor=u,v.prototype.discriminator=function(t,e,r){"function"==typeof t&&(t=d.getFunctionName(t)),r=r||{};var n=d.isPOJO(r)?r.value:r,i="boolean"!=typeof r.clone||r.clone;e.instanceOfSchema&&i&&(e=e.clone());var o=g(e=f(this.casterConstructor,t,e,n),null,this.casterConstructor);o.baseCasterConstructor=this.casterConstructor;try{Object.defineProperty(o,"name",{value:t})}catch(t){}return this.casterConstructor.discriminators[t]=o,this.casterConstructor.discriminators[t]},v.prototype.doValidate=function(t,e,o,s){n||(n=r(27));var a=this;try{h.prototype.doValidate.call(this,t,(function(r){if(r)return e(r);var u,h=t&&t.length;if(!h)return e();if(s&&s.updateValidator)return e();d.isMongooseDocumentArray(t)||(t=new n(t,a.path,o));function f(t){null!=t&&(u=t),--h||e(u)}for(var c=0,l=h;c<l;++c){var y=t[c];if(null!=y){if(!(y instanceof i)){var m=p(a.casterConstructor,t[c]);y=t[c]=new m(y,t,void 0,void 0,c)}null==s||!s.validateModifiedOnly||y.$isModified()?y.$__validate(f):--h||e(u)}else--h||e(u)}}),o)}catch(t){return e(t)}},v.prototype.doValidateSync=function(t,e,r){var n=h.prototype.doValidateSync.call(this,t,e);if(null!=n)return n;var o=t&&t.length,s=null;if(o){for(var a=0,u=o;a<u;++a){var f=t[a];if(f){if(!(f instanceof i)){var c=p(this.casterConstructor,t[a]);f=t[a]=new c(f,t,void 0,void 0,a)}if(null==r||!r.validateModifiedOnly||f.$isModified()){var l=f.validateSync();l&&null==s&&(s=l)}}}return s}},
|
|
1370
|
-
/*!
|
|
1371
|
-
* ignore
|
|
1372
|
-
*/
|
|
1373
|
-
v.prototype.getDefault=function(t){var e="function"==typeof this.defaultValue?this.defaultValue.call(t):this.defaultValue;if(null==e)return e;n||(n=r(27)),Array.isArray(e)||(e=[e]),e=new n(e,this.path,t);for(var i=0;i<e.length;++i){var o=new(p(this.casterConstructor,e[i]))({},e,void 0,void 0,i);o.$init(e[i]),o.isNew=!0,Object.assign(o.$__.activePaths.default,o.$__.activePaths.init),o.$__.activePaths.init={},e[i]=o}return e},v.prototype.cast=function(t,e,o,a,u){if(n||(n=r(27)),null!=t&&null!=t[m]&&t===a)return t;var h,f,c={transform:!1,virtuals:!1};if(u=u||{},!Array.isArray(t)){if(!o&&!v.options.castNonArrays)throw new s("DocumentArray",l.inspect(t),this.path,null,this);return e&&o&&e.markModified(this.path),this.cast([t],e,o,a,u)}u.skipDocumentArrayCast&&!d.isMongooseDocumentArray(t)||(t=new n(t,this.path,e)),null!=a&&(t[y]=a[y]||{}),null!=u.arrayPathIndex&&(t[m]=this.path+"."+u.arrayPathIndex);for(var g=d.isMongooseDocumentArray(t)?t.__array:t,_=g.length,M={skipId:!0,willInit:!0},S=0;S<_;++S)if(g[S]){var O=p(this.casterConstructor,g[S]);if(!g[S].$__||g[S]instanceof O||(g[S]=g[S].toObject({transform:!1,virtuals:g[S].schema===O.schema})),g[S]instanceof i){if(g[S][b]!==e)if(o){var A=new O(null,t,M,h,S);g[S]=A.$init(g[S])}else{var E=new O(g[S],t,void 0,void 0,S);g[S]=E}null==g[S].__index&&g[S].$setIndex(S)}else if(null!=g[S])if(o)e?h||(h=w(this,e.$__.selected,o)):h=!0,f=new O(null,t,M,h,S),g[S]=f.$init(g[S]);else if(a&&"function"==typeof a.id&&(f=a.id(g[S]._id)),a&&f&&d.deepEqual(f.toObject(c),g[S]))f.set(g[S]),g[S]=f;else try{f=new O(g[S],t,void 0,void 0,S),g[S]=f}catch(e){var x=l.inspect(g[S]);throw new s("embedded",x,t[m],e,this)}}return t},
|
|
1380
|
+
function M(t,e,r){if(r&&e){for(var n,i,o,s=t.path+".",a=Object.keys(e),u=a.length,h={};u--;)if((i=a[u]).startsWith(s)){if("$"===(o=i.substring(s.length)))continue;o.startsWith("$.")&&(o=o.substring(2)),n||(n=!0),h[o]=e[i]}return n&&h||void 0}}v.prototype.cast=function(t,e,o,a,u){if(n||(n=r(27)),null!=t&&null!=t[m]&&t===a)return t;var h,f;if(u=u||{},!Array.isArray(t)){if(!o&&!v.options.castNonArrays)throw new s("DocumentArray",l.inspect(t),this.path,null,this);return e&&o&&e.markModified(this.path),this.cast([t],e,o,a,u)}u.skipDocumentArrayCast&&!d.isMongooseDocumentArray(t)||(t=new n(t,this.path,e)),null!=a&&(t[y]=a[y]||{}),null!=u.arrayPathIndex&&(t[m]=this.path+"."+u.arrayPathIndex);for(var c=d.isMongooseDocumentArray(t)?t.__array:t,g=c.length,S=0;S<g;++S)if(c[S]){var O=p(this.casterConstructor,c[S]);if(!c[S].$__||c[S]instanceof O||(c[S]=c[S].toObject({transform:!1,virtuals:c[S].schema===O.schema})),c[S]instanceof i){if(c[S][b]!==e)if(o){var A=new O(null,t,_,h,S);c[S]=A.$init(c[S])}else{var E=new O(c[S],t,void 0,void 0,S);c[S]=E}null==c[S].__index&&c[S].$setIndex(S)}else if(null!=c[S])if(o)e?h||(h=M(this,e.$__.selected,o)):h=!0,f=new O(null,t,_,h,S),c[S]=f.$init(c[S]);else if(a&&"function"==typeof a.id&&(f=a.id(c[S]._id)),a&&f&&d.deepEqual(f.toObject(w),c[S]))f.set(c[S]),c[S]=f;else try{f=new O(c[S],t,void 0,void 0,S),c[S]=f}catch(e){var x=l.inspect(c[S]);throw new s("embedded",x,t[m],e,this)}}return t},
|
|
1374
1381
|
/*!
|
|
1375
1382
|
* ignore
|
|
1376
1383
|
*/
|
|
@@ -1389,7 +1396,7 @@ t.exports=v},function(t,e,r){"use strict";function n(t){return(n="function"==typ
|
|
|
1389
1396
|
t.exports=f},function(t,e,r){"use strict";t.exports=function t(e){if(!Array.isArray(e))return{min:0,max:0,containsNonArrayItem:!0};if(0===e.length)return{min:1,max:1,containsNonArrayItem:!1};if(1===e.length&&!Array.isArray(e[0]))return{min:1,max:1,containsNonArrayItem:!1};for(var r=t(e[0]),n=1;n<e.length;++n){var i=t(e[n]);i.min<r.min&&(r.min=i.min),i.max>r.max&&(r.max=i.max),r.containsNonArrayItem=r.containsNonArrayItem||i.containsNonArrayItem}return r.min=r.min+1,r.max=r.max+1,r}},function(t,e,r){"use strict";
|
|
1390
1397
|
/*!
|
|
1391
1398
|
* Module dependencies.
|
|
1392
|
-
*/function n(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return i(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return i(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,s=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw s}}}}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var s=r(20),a=r(44),u=r(87),h=r(
|
|
1399
|
+
*/function n(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return i(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return i(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,s=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw s}}}}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var s=r(20),a=r(44),u=r(87),h=r(327),f=r(328),c=r(14),l=r(22),d=r(162),p=r(164),y=r(9),m=r(33),b=r(52),v=["Polygon","MultiPolygon"];function g(t,e,r){if(Array.isArray(t))t.forEach((function(n,i){if(Array.isArray(n)||m(n))return g(n,e,r);t[i]=e.castForQueryWrapper({val:n,context:r})}));else for(var n=Object.keys(t),i=n.length;i--;){var o=n[i],s=t[o];Array.isArray(s)||m(s)?(g(s,e,r),t[o]=s):t[o]=e.castForQuery({val:s,context:r})}}t.exports=function t(e,r,i,w){if(Array.isArray(r))throw new Error("Query filter must be an object, got an array ",y.inspect(r));if(null==r)return r;null!=e&&null!=e.discriminators&&null!=r[e.options.discriminatorKey]&&(e=d(e,r[e.options.discriminatorKey])||e);var _,M,S,O,A,E,x=Object.keys(r),k=x.length;for(i=i||{};k--;)if(E=r[O=x[k]],"$or"===O||"$nor"===O||"$and"===O){if(!Array.isArray(E))throw new s("Array",E,O);for(var j=0;j<E.length;++j){if(null==E[j]||"object"!==o(E[j]))throw new s("Object",E[j],O+"."+j);E[j]=t(e,E[j],i,w)}}else{if("$where"===O){if("string"!==(A=o(E))&&"function"!==A)throw new Error("Must have a string or function for $where");"function"===A&&(r[O]=E.toString());continue}if("$expr"===O){E=h(E,e);continue}if("$elemMatch"===O)E=t(e,E,i,w);else if("$text"===O)E=f(E,O);else{if(!e)continue;if(!(M=e.path(O)))for(var $=O.split("."),P=$.length;P--;){var R=$.slice(0,P).join("."),B=$.slice(P).join("."),T=e.path(R),I=T&&T.schema&&T.schema.options&&T.schema.options.discriminatorKey;if(null!=T&&null!=(T.schema&&T.schema.discriminators)&&null!=I&&B!==I){var N=c(r,R+"."+I);null!=N&&(M=T.schema.discriminators[N].path(B))}}if(M){if(null==E)continue;if("Object"===l(E))if(Object.keys(E).some(p))for(var D=Object.keys(E),C=void 0,L=D.length;L--;)if(S=E[C=D[L]],"$not"===C){if(S&&M){if((_=Object.keys(S)).length&&p(_[0]))for(var q in S)S[q]=M.castForQueryWrapper({$conditional:q,val:S[q],context:w});else E[C]=M.castForQueryWrapper({$conditional:C,val:S,context:w});continue}}else E[C]=M.castForQueryWrapper({$conditional:C,val:S,context:w});else r[O]=M.castForQueryWrapper({val:E,context:w});else if(Array.isArray(E)&&-1===["Buffer","Array"].indexOf(M.instance)){var U,F=[],z=n(E);try{for(z.s();!(U=z.n()).done;){var V=U.value;F.push(M.castForQueryWrapper({val:V,context:w}))}}catch(t){z.e(t)}finally{z.f()}r[O]={$in:F}}else r[O]=M.castForQueryWrapper({val:E,context:w})}else{for(var K=O.split("."),H=K.length,Z=void 0,W=void 0,J=void 0;H--&&(Z=K.slice(0,H).join("."),!(M=e.path(Z))););if(M){if(M.caster&&M.caster.schema){(J={})[W=K.slice(H).join(".")]=E;var Y=t(M.caster.schema,J,i,w)[W];void 0===Y?delete r[O]:r[O]=Y}else r[O]=E;continue}if(m(E)){var Q="";if(E.$near?Q="$near":E.$nearSphere?Q="$nearSphere":E.$within?Q="$within":E.$geoIntersects?Q="$geoIntersects":E.$geoWithin&&(Q="$geoWithin"),Q){var G=new u.Number("__QueryCasting__"),X=E[Q];if(null!=E.$maxDistance&&(E.$maxDistance=G.castForQueryWrapper({val:E.$maxDistance,context:w})),null!=E.$minDistance&&(E.$minDistance=G.castForQueryWrapper({val:E.$minDistance,context:w})),"$within"===Q){var tt=X.$center||X.$centerSphere||X.$box||X.$polygon;if(!tt)throw new Error("Bad $within parameter: "+JSON.stringify(E));X=tt}else if("$near"===Q&&"string"==typeof X.type&&Array.isArray(X.coordinates))X=X.coordinates;else if(("$near"===Q||"$nearSphere"===Q||"$geoIntersects"===Q)&&X.$geometry&&"string"==typeof X.$geometry.type&&Array.isArray(X.$geometry.coordinates))null!=X.$maxDistance&&(X.$maxDistance=G.castForQueryWrapper({val:X.$maxDistance,context:w})),null!=X.$minDistance&&(X.$minDistance=G.castForQueryWrapper({val:X.$minDistance,context:w})),b(X.$geometry)&&(X.$geometry=X.$geometry.toObject({transform:!1,virtuals:!1})),X=X.$geometry.coordinates;else if("$geoWithin"===Q)if(X.$geometry){b(X.$geometry)&&(X.$geometry=X.$geometry.toObject({virtuals:!1}));var et=X.$geometry.type;if(-1===v.indexOf(et))throw new Error('Invalid geoJSON type for $geoWithin "'+et+'", must be "Polygon" or "MultiPolygon"');X=X.$geometry.coordinates}else X=X.$box||X.$polygon||X.$center||X.$centerSphere,b(X)&&(X=X.toObject({virtuals:!1}));g(X,G,w);continue}}if(e.nested[O])continue;var rt="strict"in i?i.strict:e.options.strict,nt="strictQuery"in i?i.strictQuery:"strict"in i?i.strict:"strict"in e._userProvidedOptions?e._userProvidedOptions.strict:e.options.strictQuery;if(i.upsert&&rt){if("throw"===rt)throw new a(O);throw new a(O,'Path "'+O+'" is not in schema, strict mode is `true`, and upsert is `true`.')}if("throw"===nt)throw new a(O,'Path "'+O+"\" is not in schema and strictQuery is 'throw'.");nt&&delete r[O]}}}return r}},function(t,e,r){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i=r(20),o=r(44),s=r(160),a=new Set(["$and","$or","$not"]),u=new Set(["$cmp","$eq","$lt","$lte","$gt","$gte"]),h=new Set(["$multiply","$divide","$log","$mod","$trunc","$avg","$max","$min","$stdDevPop","$stdDevSamp","$sum"]),f=new Set(["$abs","$exp","$ceil","$floor","$ln","$log10","$round","$sqrt","$sin","$cos","$tan","$asin","$acos","$atan","$atan2","$asinh","$acosh","$atanh","$sinh","$cosh","$tanh","$degreesToRadians","$radiansToDegrees"]),c=new Set(["$arrayElemAt","$first","$last"]),l=new Set(["$year","$month","$week","$dayOfMonth","$dayOfYear","$hour","$minute","$second","$isoDayOfWeek","$isoWeekYear","$isoWeek","$millisecond"]);function d(t,e,r){if(b(t))return t;null!=t.$cond?Array.isArray(t.$cond)?t.$cond=t.$cond.map((function(t){return d(t,e,r)})):(t.$cond.if=d(t.$cond.if,e,r),t.$cond.then=d(t.$cond.then,e,r),t.$cond.else=d(t.$cond.else,e,r)):null!=t.$ifNull?t.$ifNull.map((function(t){return d(t,e,r)})):null!=t.$switch&&(t.branches.map((function(t){return d(t,e,r)})),t.default=d(t.default,e,r));for(var n=0,i=Object.keys(t);n<i.length;n++){var s=i[n];a.has(s)?t[s]=t[s].map((function(t){return d(t,e,r)})):u.has(s)?t[s]=m(t[s],e,r):h.has(s)?t[s]=y(t[s]):f.has(s)&&(t[s]=p(t[s]))}return t.$in&&(t.$in=function(t,e,r){var n=t[1];if(!b(n))return t;var i=t[0],s=e.path(n.slice(1));if(null===s){if(!1===r)return t;if("throw"===r)throw new o("$in");return}if(!s.$isMongooseArray)throw new Error("Path must be an array for $in");return[s.$isMongooseDocumentArray?s.$embeddedSchemaType.cast(i):s.caster.cast(i),n]}(t.$in,e,r)),t.$size&&(t.$size=p(t.$size)),function(t){for(var e=Object.keys(t),r=0,n=e.length;r<n;++r)void 0===t[e[r]]&&delete t[e[r]]}(t),t}function p(t){if(!v(t))return t;try{return s(t)}catch(e){throw new i("Number",t)}}function y(t){if(!Array.isArray(t)){if(!v(t))return t;try{return s(t)}catch(e){throw new i("Number",t)}}return t.map((function(t){if(!v(t))return t;try{return s(t)}catch(e){throw new i("Number",t)}}))}function m(t,e,r){if(!Array.isArray(t)||2!==t.length)throw new Error("Comparison operator must be an array of length 2");t[0]=d(t[0],e,r);var a=t[0];if(v(t[1])){var u=null,h=null,f=null;if(b(a))u=a.slice(1),h=e.path(u);else if("object"===n(a)&&null!=a)for(var p=0,y=Object.keys(a);p<y.length;p++){var m=y[p];l.has(m)&&b(a[m])?(u=a[m].slice(1)+"."+m,f=s):c.has(m)&&b(a[m])&&(u=a[m].slice(1)+"."+m,null!=(h=e.path(a[m].slice(1)))&&(h.$isMongooseDocumentArray?h=h.$embeddedSchemaType:h.$isMongooseArray&&(h=h.caster)))}var g="object"===n(t[1])&&null!=t[1]&&null!=t[1].$literal;if(null!=h)t[1]=g?{$literal:h.cast(t[1].$literal)}:h.cast(t[1]);else if(null!=f)if(g)try{t[1]={$literal:f(t[1].$literal)}}catch(e){throw new i(f.name.replace(/^cast/,""),t[1],u+".$literal")}else try{t[1]=f(t[1])}catch(e){throw new i(f.name.replace(/^cast/,""),t[1],u)}else{if(null!=u&&!0===r)return;if(null!=u&&"throw"===r)throw new o(u)}}else t[1]=d(t[1]);return t}function b(t){return"string"==typeof t&&"$"===t[0]}function v(t){return("string"!=typeof t||"$"!==t[0])&&("object"!==n(t)||null===t||!Object.keys(t).find((function(t){return"$"===t[0]}))||null!=t.$literal)}t.exports=function(t,e,r){if("object"!==n(t)||null===t)throw new Error("`$expr` must be an object");return d(t,e,r)}},function(t,e,r){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i=r(20),o=r(84),s=r(158);
|
|
1393
1400
|
/*!
|
|
1394
1401
|
* Casts val to an object suitable for `$text`. Throws an error if the object
|
|
1395
1402
|
* can't be casted.
|
|
@@ -1429,7 +1436,7 @@ function b(t){var e=t[l];if(e&&null!=e.$__.populated){var r,i=n(Object.keys(e.$_
|
|
|
1429
1436
|
t.exports=f},function(t,e,r){"use strict";
|
|
1430
1437
|
/*!
|
|
1431
1438
|
* Module dependencies.
|
|
1432
|
-
*/function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i,o=r(20),s=r(12).EventEmitter,a=r(154),u=r(
|
|
1439
|
+
*/function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i,o=r(20),s=r(12).EventEmitter,a=r(154),u=r(332),h=r(8),f=r(83),c=r(56).castToNumber,l=r(172),d=r(165),p=r(174),y=r(173),m=r(34).internalToObjectOptions,b=r(4);function v(t,e,r){t=y(t,r),this.caster=g(t),this.caster.path=e,this.caster.prototype.$basePath=e,this.schema=t,this.$isSingleNested=!0,h.call(this,e,r,"Embedded")}
|
|
1433
1440
|
/*!
|
|
1434
1441
|
* ignore
|
|
1435
1442
|
*/
|
|
@@ -1448,7 +1455,7 @@ function g(t,e){i||(i=r(90));var n=function(t,e,r){var n=this;this.$__parent=r,i
|
|
|
1448
1455
|
/*!
|
|
1449
1456
|
* ignore
|
|
1450
1457
|
*/
|
|
1451
|
-
v.prototype.$conditionalHandlers.$near=v.prototype.$conditionalHandlers.$nearSphere=d.cast$near,v.prototype.$conditionalHandlers.$within=v.prototype.$conditionalHandlers.$geoWithin=d.cast$within,v.prototype.$conditionalHandlers.$geoIntersects=d.cast$geoIntersects,v.prototype.$conditionalHandlers.$minDistance=c,v.prototype.$conditionalHandlers.$maxDistance=c,v.prototype.$conditionalHandlers.$exists=f,v.prototype.cast=function(t,e,r,i,o){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=p(this.caster,t),h=e&&e.$__&&e.$__.selected||{},f=this.path,c=Object.keys(h).reduce((function(t,e){return e.startsWith(f+".")&&(t[e.substring(f.length+1)]=h[e]),t}),{});return o=Object.assign({},o,{priorDoc:i}),r?((s=new u(void 0,c,e)).$init(t),s):0===Object.keys(t).length?new u({},c,e,void 0,o):new u(t,c,e,void 0,o)},v.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 i=p(this.caster,e),s=null!=r&&null!=r.strict?r.strict:void 0;try{e=new i(e,s)}catch(t){if(!(t instanceof o))throw new o("Embedded",e,this.path,t,this);throw t}return e},v.prototype.doValidate=function(t,e,r,n){var i=p(this.caster,t);if(!t||t instanceof i||(t=new i(t,null,r)),n&&n.skipSchemaValidators)return t.validate(e);h.prototype.doValidate.call(this,t,(function(r){return r?e(r):t?void t.validate(e):e(null)}),r,n)},v.prototype.doValidateSync=function(t,e,r){if(!r||!r.skipSchemaValidators){var n=h.prototype.doValidateSync.call(this,t,e);if(n)return n}if(t)return t.validateSync()},v.prototype.discriminator=function(t,e,r){r=r||{};var n=b.isPOJO(r)?r.value:r,i="boolean"!=typeof r.clone||r.clone;return e.instanceOfSchema&&i&&(e=e.clone()),e=l(this.caster,t,e,n),this.caster.discriminators[t]=g(e,this.caster),this.caster.discriminators[t]},v.defaultOptions={},v.set=h.set,
|
|
1458
|
+
v.prototype.$conditionalHandlers.$near=v.prototype.$conditionalHandlers.$nearSphere=d.cast$near,v.prototype.$conditionalHandlers.$within=v.prototype.$conditionalHandlers.$geoWithin=d.cast$within,v.prototype.$conditionalHandlers.$geoIntersects=d.cast$geoIntersects,v.prototype.$conditionalHandlers.$minDistance=c,v.prototype.$conditionalHandlers.$maxDistance=c,v.prototype.$conditionalHandlers.$exists=f,v.prototype.cast=function(t,e,r,i,o){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=p(this.caster,t),h=e&&e.$__&&e.$__.selected||{},f=this.path,c=Object.keys(h).reduce((function(t,e){return e.startsWith(f+".")&&(t[e.substring(f.length+1)]=h[e]),t}),{});return o=Object.assign({},o,{priorDoc:i}),r?((s=new u(void 0,c,e)).$init(t),s):0===Object.keys(t).length?new u({},c,e,void 0,o):new u(t,c,e,void 0,o)},v.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 i=p(this.caster,e),s=null!=r&&null!=r.strict?r.strict:void 0;try{e=new i(e,s)}catch(t){if(!(t instanceof o))throw new o("Embedded",e,this.path,t,this);throw t}return e},v.prototype.doValidate=function(t,e,r,n){var i=p(this.caster,t);if(!t||t instanceof i||(t=new i(t,null,null!=r&&null!=r.$__?r:null)),n&&n.skipSchemaValidators)return t.validate(e);h.prototype.doValidate.call(this,t,(function(r){return r?e(r):t?void t.validate(e):e(null)}),r,n)},v.prototype.doValidateSync=function(t,e,r){if(!r||!r.skipSchemaValidators){var n=h.prototype.doValidateSync.call(this,t,e);if(n)return n}if(t)return t.validateSync()},v.prototype.discriminator=function(t,e,r){r=r||{};var n=b.isPOJO(r)?r.value:r,i="boolean"!=typeof r.clone||r.clone;return e.instanceOfSchema&&i&&(e=e.clone()),e=l(this.caster,t,e,n),this.caster.discriminators[t]=g(e,this.caster),this.caster.discriminators[t]},v.defaultOptions={},v.set=h.set,
|
|
1452
1459
|
/*!
|
|
1453
1460
|
* ignore
|
|
1454
1461
|
*/
|
|
@@ -1456,7 +1463,7 @@ v.prototype.clone=function(){var t=Object.assign({},this.options),e=new this.con
|
|
|
1456
1463
|
/*!
|
|
1457
1464
|
* Module dependencies.
|
|
1458
1465
|
*/
|
|
1459
|
-
function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i=r(168),o=r(
|
|
1466
|
+
function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i=r(168),o=r(334),s=r(8),a=r(161),u=r(4),h=i.Binary,f=s.CastError;function c(t,e){s.call(this,t,e,"Buffer")}
|
|
1460
1467
|
/*!
|
|
1461
1468
|
* ignore
|
|
1462
1469
|
*/
|
|
@@ -1479,7 +1486,7 @@ t.exports=c}).call(this,r(3).Buffer)},function(t,e,r){"use strict";function n(t)
|
|
|
1479
1486
|
t.exports=f},function(t,e,r){"use strict";
|
|
1480
1487
|
/*!
|
|
1481
1488
|
* Module requirements.
|
|
1482
|
-
*/var n=r(7),i=r(
|
|
1489
|
+
*/var n=r(7),i=r(336),o=r(8),s=r(337),a=r(22),u=r(4),h=o.CastError;function f(t,e){o.call(this,t,e,"Date")}
|
|
1483
1490
|
/*!
|
|
1484
1491
|
* Date Query casting.
|
|
1485
1492
|
*
|
|
@@ -1512,7 +1519,7 @@ t.exports=f},function(t,e,r){"use strict";function n(t){return(n="function"==typ
|
|
|
1512
1519
|
t.exports=f},function(t,e,r){"use strict";var n=r(43);t.exports=function(t){return null==t||""===t?null:t instanceof Date?(n.ok(!isNaN(t.valueOf())),t):(n.ok("boolean"!=typeof t),e=t instanceof Number||"number"==typeof t?new Date(t):"string"==typeof t&&!isNaN(Number(t))&&(Number(t)>=275761||Number(t)<-271820)?new Date(Number(t)):"function"==typeof t.valueOf?new Date(t.valueOf()):new Date(t),isNaN(e.valueOf())?void n.ok(!1):e);var e}},function(t,e,r){"use strict";
|
|
1513
1520
|
/*!
|
|
1514
1521
|
* Module dependencies.
|
|
1515
|
-
*/var n,i=r(
|
|
1522
|
+
*/var n,i=r(339),o=r(8),s=r(169),a=r(22),u=r(18),h=r(4),f=o.CastError;function c(t,e){var r="string"==typeof t&&24===t.length&&/^[a-f0-9]+$/i.test(t),n=e&&e.suppressWarning;!r&&void 0!==t||n||h.warn("mongoose: To create a new ObjectId please try `Mongoose.Types.ObjectId` instead of using `Mongoose.Schema.ObjectId`. Set the `suppressWarning` option if you're trying to create a hex char path in your schema."),o.call(this,t,e,"ObjectID")}
|
|
1516
1523
|
/*!
|
|
1517
1524
|
* ignore
|
|
1518
1525
|
*/
|
|
@@ -1546,7 +1553,7 @@ c._defaultCaster=function(t){if(!(t instanceof u))throw new Error(t+" is not an
|
|
|
1546
1553
|
t.exports=f},function(t,e,r){"use strict";
|
|
1547
1554
|
/*!
|
|
1548
1555
|
* Module dependencies.
|
|
1549
|
-
*/var n=r(
|
|
1556
|
+
*/var n=r(8),i=n.CastError,o=r(32),s=r(341),a=r(4);function u(t,e){n.call(this,t,e,"Decimal128")}
|
|
1550
1557
|
/*!
|
|
1551
1558
|
* ignore
|
|
1552
1559
|
*/
|
|
@@ -1574,7 +1581,7 @@ t.exports=u},function(t,e,r){"use strict";(function(e){function n(t){return(n="f
|
|
|
1574
1581
|
/*!
|
|
1575
1582
|
* ignore
|
|
1576
1583
|
*/
|
|
1577
|
-
function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return o(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return o(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,s=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw s}}}}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function s(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function a(){return(a="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=u(t,e);if(n){var i=Object.getOwnPropertyDescriptor(n,e);return i.get?i.get.call(arguments.length<3?t:r):i.value}}).apply(this,arguments)}function u(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=l(t)););return t}function h(t,e){return(h=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function f(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=l(t);if(e){var i=l(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return c(this,r)}}function c(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function l(t){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var d=r(170),p=r(
|
|
1584
|
+
function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return o(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return o(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,s=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw s}}}}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function s(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function a(){return(a="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=u(t,e);if(n){var i=Object.getOwnPropertyDescriptor(n,e);return i.get?i.get.call(arguments.length<3?t:r):i.value}}).apply(this,arguments)}function u(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=l(t)););return t}function h(t,e){return(h=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function f(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=l(t);if(e){var i=l(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return c(this,r)}}function c(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function l(t){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var d=r(170),p=r(343),y=r(8),m=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&h(t,e)}(c,t);var r,n,o,u=f(c);function c(t,e){var r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,c),(r=u.call(this,t,e,"Map")).$isSchemaMap=!0,r}return r=c,(n=[{key:"set",value:function(t,e){return y.set(t,e)}},{key:"cast",value:function(t,r,n){if(t instanceof d)return t;var o=this.path;if(n){var s=new d({},o,r,this.$__schemaType);if(t instanceof e.Map){var a,u=i(t.keys());try{for(u.s();!(a=u.n()).done;){var h=a.value,f=t.get(h);f=null==f?s.$__schemaType._castNullish(f):s.$__schemaType.cast(f,r,!0,null,{path:o+"."+h}),s.$init(h,f)}}catch(t){u.e(t)}finally{u.f()}}else for(var c=0,l=Object.keys(t);c<l.length;c++){var p=l[c],y=t[p];y=null==y?s.$__schemaType._castNullish(y):s.$__schemaType.cast(y,r,!0,null,{path:o+"."+p}),s.$init(p,y)}return s}return new d(t,o,r,this.$__schemaType)}},{key:"clone",value:function(){var t=a(l(c.prototype),"clone",this).call(this);return null!=this.$__schemaType&&(t.$__schemaType=this.$__schemaType.clone()),t}}])&&s(r.prototype,n),o&&s(r,o),Object.defineProperty(r,"prototype",{writable:!1}),c}(y);m.prototype.OptionsConstructor=p,m.defaultOptions={},t.exports=m}).call(this,r(6))},function(t,e,r){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){return(s=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function a(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=h(t);if(e){var i=h(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return u(this,r)}}function u(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var f=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&s(t,e)}(h,t);var e,r,n,u=a(h);function h(){return o(this,h),u.apply(this,arguments)}return e=h,r&&i(e.prototype,r),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(r(15)),c=r(16);Object.defineProperty(f.prototype,"of",c),t.exports=f},function(t,e,r){"use strict";
|
|
1578
1585
|
/*!
|
|
1579
1586
|
* Creates an object that precomputes whether a given path has child fields in
|
|
1580
1587
|
* the projection.
|
|
@@ -1600,7 +1607,7 @@ function u(e){return e&&"object"===n(e)&&!(e instanceof Date)&&!(e instanceof s)
|
|
|
1600
1607
|
function e(r,n,i,o){var s;s=r&&a(r)&&!t.isBuffer(r)?Object.keys(r.toObject({transform:!1,virtuals:!1})||{}):Object.keys(r||{});var h=s.length,f={};n=n?n+".":"";for(var c=0;c<h;++c){var l=s[c],d=r[l];f[n+l]=d;var p=o&&o.path&&o.path(n+l),y=o&&o.nested&&o.nested[n+l];if(!p||"Mixed"!==p.instance){if(u(d)){if(i&&i.skipArrays&&Array.isArray(d))continue;var m=e(d,n+l,i,o);for(var b in m)f[b]=m[b];Array.isArray(d)&&(f[n+l]=d)}if(y)for(var v=Object.keys(o.paths),g=0,w=v;g<w.length;g++){var _=w[g];_.startsWith(n+l+".")&&!f.hasOwnProperty(_)&&(f[_]=void 0)}}}return f}
|
|
1601
1608
|
/*!
|
|
1602
1609
|
* ignore
|
|
1603
|
-
*/,e.modifiedPaths=function e(r,n,i){var o=Object.keys(r||{}),s=o.length;i=i||{},n=n?n+".":"";for(var h=0;h<s;++h){var f=o[h],c=r[f],l=n+f;if(i[l]=!0,-1!==l.indexOf("."))for(var d=l.split("."),p=d[0],y=1;y<d.length;++y)i[p]=!0,p+="."+d[y];!t.isBuffer(c)&&a(c)&&(c=c.toObject({transform:!1,virtuals:!1})),u(c)&&e(c,n+f,i)}return i}}).call(this,r(3).Buffer)},function(t,e,r){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i=r(19),o=r(
|
|
1610
|
+
*/,e.modifiedPaths=function e(r,n,i){var o=Object.keys(r||{}),s=o.length;i=i||{},n=n?n+".":"";for(var h=0;h<s;++h){var f=o[h],c=r[f],l=n+f;if(i[l]=!0,-1!==l.indexOf("."))for(var d=l.split("."),p=d[0],y=1;y<d.length;++y)i[p]=!0,p+="."+d[y];!t.isBuffer(c)&&a(c)&&(c=c.toObject({transform:!1,virtuals:!1})),u(c)&&e(c,n+f,i)}return i}}).call(this,r(3).Buffer)},function(t,e,r){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i=r(19),o=r(347),s=r(9);t.exports=function t(e){if(null!=e&&"object"===n(e)&&!Array.isArray(e)&&!e.$__)for(var r=0,a=Object.keys(e);r<a.length;r++){var u=a[r],h=e[u];if(-1===u.indexOf("."))t(e[u]);else try{delete e[u],o(e,u,h)}catch(t){if(!(t instanceof TypeError))throw t;throw new i('Conflicting dotted paths when setting document path, key: "'.concat(u,'", value: ').concat(s.inspect(h)))}}}},function(t,e,r){"use strict";function n(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return i(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return i(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,s=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw s}}}}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}t.exports=function(t,e,r){if(-1!==e.indexOf(".")){var i,o=e.split("."),s=o.pop(),a=t,u=n(o);try{for(u.s();!(i=u.n()).done;){var h=i.value;null==a[h]&&(a[h]={}),a=a[h]}}catch(t){u.e(t)}finally{u.f()}a[s]=r}else t[e]=r}},function(t,e,r){"use strict";var n=r(14),i=r(162);
|
|
1604
1611
|
/*!
|
|
1605
1612
|
* Like `schema.path()`, except with a document, because impossible to
|
|
1606
1613
|
* determine path type without knowing the embedded discriminator key.
|
|
@@ -1619,16 +1626,13 @@ t.exports=function t(e,r,o){for(var s=(o=o||{}).typeOnly,a=-1===r.indexOf(".")?[
|
|
|
1619
1626
|
*/t.exports=function(t,e){if(null!=t._id&&null!=e&&0!==e.length){var r,i=String(t._id),s=n(e);try{for(s.s();!(r=s.n()).done;){var a=r.value;if(!a.isVirtual)for(var u=a.path.split("."),h=0;h<u.length-1;++h){var f=u.slice(0,h+1).join("."),c=u.slice(h+1).join("."),l=t.get(f);if(null!=l&&o.isMongooseDocumentArray(l)){for(var d=0;d<l.length;++d)l[d].populated(c,null==a._docs[i]?void 0:a._docs[i][d],a);break}}}}catch(t){s.e(t)}finally{s.f()}}}},function(t,e,r){"use strict";
|
|
1620
1627
|
/*!
|
|
1621
1628
|
* Module dependencies
|
|
1622
|
-
*/function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return o(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return o(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,s=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw s}}}}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var s=r(
|
|
1629
|
+
*/function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return o(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return o(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,s=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw s}}}}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var s=r(353),a=r(14),u=r(57),h=r(92),f=r(41);
|
|
1623
1630
|
/*!
|
|
1624
1631
|
* Set each path query option to lean
|
|
1625
1632
|
*
|
|
1626
1633
|
* @param {Object} option
|
|
1627
1634
|
*/
|
|
1628
1635
|
function c(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}}
|
|
1629
|
-
/*!
|
|
1630
|
-
* Handle the `WriteOpResult` from the server
|
|
1631
|
-
*/
|
|
1632
1636
|
/*!
|
|
1633
1637
|
* Prepare a set of path options for query population.
|
|
1634
1638
|
*
|
|
@@ -1660,7 +1664,7 @@ e.createModel=function(t,r,n,i,o){t.hooks.execPreSync("createModel",r);var s=t.s
|
|
|
1660
1664
|
/*!
|
|
1661
1665
|
* ignore
|
|
1662
1666
|
*/
|
|
1663
|
-
e.applyPaths=function(t,e){var r,o,u;if(t)for(u=(o=Object.keys(t)).length;u--;)if("+"!==o[u][0]){var f=t[o[u]];if(h(f)){r=!f;break}}var c=[],l=[],d=[];switch(function e(n,i){if(i||(i=""),-1!==d.indexOf(n))return[];d.push(n);var o=[];return n.eachPath((function(n,a){i&&(n=i+"."+n);var u=E(n,a);if(null!=u||Array.isArray(a)||!a.$isMongooseArray||a.$isMongooseDocumentArray||(u=E(n,a.caster)),null!=u&&o.push(u),a.schema){var h=e(a.schema,n);!1===r&&s(t,n,a.schema,c,h)}})),d.pop(),o}(e),r){case!0:var p,y=i(l);try{for(y.s();!(p=y.n()).done;){var m=p.value;t[m]=0}}catch(t){y.e(t)}finally{y.f()}break;case!1:e&&e.paths._id&&e.paths._id.options&&!1===e.paths._id.options.select&&(t._id=0);var b,v=i(c);try{for(v.s();!(b=v.n()).done;){var g=b.value;t[g]=t[g]||1}}catch(t){v.e(t)}finally{v.f()}break;case void 0:if(null==t)break;for(var w=0,_=Object.keys(t||{});w<_.length;w++){var M=_[w];M.startsWith("+")&&delete t[M]}var S,O=i(l);try{for(O.s();!(S=O.n()).done;){var A=S.value;t[A]=0}}catch(t){O.e(t)}finally{O.f()}}function E(e,i){var s="+"+e,u=t&&s in t;if(u&&delete t[s],"boolean"==typeof i.selected){if(u)return delete t[s],void(!1===r&&o.length>1&&!~o.indexOf(e)&&(t[e]=1));for(var h=e.split("."),f="",d=0;d<h.length;++d)if(f+=f.length?"."+h[d]:h[d],-1!==l.indexOf(f))return;if(!r&&i&&i.options&&i.options.$skipDiscriminatorCheck)for(var p="",y=0;y<h.length;++y){p+=(0===p.length?"":".")+h[y];var m=a(t,p,!1)||a(t,p+".$",!1);if(m&&"object"!==n(m))return}return(i.selected?c:l).push(e),e}}}
|
|
1667
|
+
e.applyPaths=function(t,e){var r,o,u;if(t)for(u=(o=Object.keys(t)).length;u--;)if("+"!==o[u][0]){var f=t[o[u]];if(h(f)){r=!f;break}}var c=[],l=[],d=[];switch(function e(n,i){if(i||(i=""),-1!==d.indexOf(n))return[];d.push(n);var o=[];return n.eachPath((function(n,a){i&&(n=i+"."+n);var u=E(n,a);if(null!=u||Array.isArray(a)||!a.$isMongooseArray||a.$isMongooseDocumentArray||(u=E(n,a.caster)),null!=u&&o.push(u),a.schema){var h=e(a.schema,n);!1===r&&s(t,n,a.schema,c,h)}})),d.pop(),o}(e),r){case!0:var p,y=i(l);try{for(y.s();!(p=y.n()).done;){var m=p.value;t[m]=0}}catch(t){y.e(t)}finally{y.f()}break;case!1:e&&e.paths._id&&e.paths._id.options&&!1===e.paths._id.options.select&&(t._id=0);var b,v=i(c);try{for(v.s();!(b=v.n()).done;){var g=b.value;t[g]=t[g]||1}}catch(t){v.e(t)}finally{v.f()}break;case void 0:if(null==t)break;for(var w=0,_=Object.keys(t||{});w<_.length;w++){var M=_[w];M.startsWith("+")&&delete t[M]}var S,O=i(l);try{for(O.s();!(S=O.n()).done;){var A=S.value;t[A]=0}}catch(t){O.e(t)}finally{O.f()}}function E(e,i){var s="+"+e,u=t&&s in t;if(u&&delete t[s],"boolean"==typeof i.selected){if(u)return delete t[s],void(!1===r&&o.length>1&&!~o.indexOf(e)&&(t[e]=1));for(var h=e.split("."),f="",d=0;d<h.length;++d)if(f+=f.length?"."+h[d]:h[d],-1!==l.indexOf(f))return;if(!r&&i&&i.options&&i.options.$skipDiscriminatorCheck)for(var p="",y=0;y<h.length;++y){p+=(0===p.length?"":".")+h[y];var m=a(t,p,!1)||a(t,p+".$",!1);if(m&&"object"!==n(m))return}return(i.selected?c:l).push(e),e}}}},function(t,e,r){"use strict";t.exports=function(t,e,r,n,i){var o=Object.keys(t).reduce((function(t,r){return t||r.startsWith(e+".")}),!1),s=e+"."+r.options.discriminatorKey;o||1!==i.length||i[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";var n=/\./g;t.exports=function(t){if(-1===t.indexOf("."))return[t];for(var e=t.split(n),r=e.length,i=new Array(r),o="",s=0;s<r;++s)o+=0!==o.length?"."+e[s]:e[s],i[s]=o;return i}},function(t,e,r){"use strict";
|
|
1664
1668
|
/*!
|
|
1665
1669
|
* Module dependencies.
|
|
1666
1670
|
*/var n=r(13),i=r(12).EventEmitter,o=r(7),s=r(85),a=r(18),u=o.ValidationError,h=r(157),f=r(33);function c(t,e,r,i,u){if(!(this instanceof c))return new c(t,e,r,i,u);if(f(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 o.MissingSchemaError;for(var l in this.$__setSchema(e),n.call(this,t,r,i,u),h(this,e,{decorateDoc:!0}),e.methods)this[l]=e.methods[l];for(var d in e.statics)this[d]=e.statics[d]}
|