@fnlb-project/database 1.0.27 → 1.0.28

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.
Files changed (2) hide show
  1. package/dist/index.js +3 -3
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -278,7 +278,7 @@ updatePath: '${Z.raw.path}'`);Z.trace.add(F);let J=Object.keys(F||{}),X=J.length
278
278
  * ignore
279
279
  */function jB1(F){let A=Object.keys(F.$__.activePaths.getStatePaths("require")),D=0,Z=A.length;for(D=0;D<Z;++D){let J=A[D],X=F.$__schema.path(J);if(X!=null&&typeof X.originalRequiredValue==="function"){F.$__.cachedRequired=F.$__.cachedRequired||{};try{F.$__.cachedRequired[J]=X.originalRequiredValue.call(F,F)}catch($){F.invalidate(J,$)}}}}/*!
280
280
  * ignore
281
- */function Zf(F,A,D,Z){let J={};jB1(F);let X=new Set(Object.keys(F.$__.activePaths.getStatePaths("require")).filter(function(Y){if(!F.$__isSelected(Y)&&!F.$isModified(Y))return!1;if(F.$__.cachedRequired!=null&&Y in F.$__.cachedRequired)return F.$__.cachedRequired[Y];return!0}));Object.keys(F.$__.activePaths.getStatePaths("init")).forEach($),Object.keys(F.$__.activePaths.getStatePaths("modify")).forEach($),Object.keys(F.$__.activePaths.getStatePaths("default")).forEach($);function $(Y){X.add(Y)}if(!Z){let Y=F.$getAllSubdocs({useCache:!0}),B=F.modifiedPaths();for(let H of Y)if(H.$basePath){let q=H.$isSingleNested?H.$__pathRelativeToParent():H.$__fullPathWithIndexes();for(let W of H.modifiedPaths())X.delete(q+"."+W);if(F.$isModified(q,null,B)&&!F.$__.activePaths.getStatePaths("modify").hasOwnProperty(q)&&!F.$isDefault(q)){if(X.add(q),F.$__.pathsToScopes==null)F.$__.pathsToScopes={};if(F.$__.pathsToScopes[q]=H.$isDocumentArrayElement?H.__parentArray:H.$parent(),J[q]={skipSchemaValidators:!0},H.$isDocumentArrayElement&&H.__index!=null)J[q].index=H.__index}}}for(let Y of X){let B=F.$__schema.path(Y);if(!B)continue;if(B.$isMongooseDocumentArray){for(let H of X)if(H==null||H.startsWith(B.path+"."))X.delete(H)}if(!B.caster&&B.validators.length===0&&!B.$parentSchemaDocArray)X.delete(Y);else if(B.$isMongooseArray&&!B.$isMongooseDocumentArray&&!B.$embeddedSchemaType.$isMongooseArray&&B.validators.length===0&&B.$embeddedSchemaType.validators.length===0)X.delete(Y)}if(Array.isArray(A))X=kB1(X,A);else if(Array.isArray(D))X=OB1(X,D);TB1(F,X);let G={skipArrays:!0};for(let Y of X)if(F.$__schema.nested[Y]){let B=F.$__getValue(Y);if(EB1(B))B=B.toObject({transform:!1});let H=YB1(B,Y,G,F.$__schema);Object.keys(H).filter((q)=>!F.$__schema.singleNestedPaths.hasOwnProperty(q)).forEach($)}for(let Y of X){let B=F.$__schema.path(Y);if(!B)continue;if(B.$parentSchemaDocArray&&typeof B.$parentSchemaDocArray.path==="string")X.add(B.$parentSchemaDocArray.path);if(!B.$isSchemaMap)continue;let H=F.$__getValue(Y);if(H==null)continue;for(let q of H.keys())X.add(Y+"."+q)}return X=Array.from(X),[X,J]}function TB1(F,A){for(let D of A){let Z=F.$__schema.path(D);if(!Z)continue;if(!Z.$isMongooseArray||!Array.isArray(Z)&&Z.$isMongooseDocumentArray&&!(Z&&Z.schemaOptions&&Z.schemaOptions.required))continue;if(Z.$isMongooseArray&&!Z.$isMongooseDocumentArray&&!Z.$embeddedSchemaType.$isMongooseArray&&Z.$embeddedSchemaType.validators.length===0)continue;let J=F.$__getValue(D);VJ(J,A,D)}}function VJ(F,A,D){if(F!=null){let Z=F.length;for(let J=0;J<Z;++J)if(Array.isArray(F[J]))VJ(F[J],A,D+"."+J);else A.add(D+"."+J)}}/*!
281
+ */function Zf(F,A,D,Z){let J={};jB1(F);let X=new Set(Object.keys(F.$__.activePaths.getStatePaths("require")).filter(function(Y){if(!F.$__isSelected(Y)&&!F.$isModified(Y))return!1;if(F.$__.cachedRequired!=null&&Y in F.$__.cachedRequired)return F.$__.cachedRequired[Y];return!0}));Object.keys(F.$__.activePaths.getStatePaths("init")).forEach($),Object.keys(F.$__.activePaths.getStatePaths("modify")).forEach($),Object.keys(F.$__.activePaths.getStatePaths("default")).forEach($);function $(Y){X.add(Y)}if(!Z){let Y=[];for(let H of Object.keys(F.$__schema.paths)){let q=F.$__schema.path(H);if(q.$isSingleNested){let W=F.$get(H);if(W)Y.push(W)}else if(q.$isMongooseDocumentArray){let W=F.$get(H);if(W&&W.length){for(let C of W)if(C)Y.push(C)}}}let B=F.modifiedPaths();for(let H of Y)if(H.$basePath){let q=H.$__pathRelativeToParent();for(let C of H.modifiedPaths())X.delete(q+"."+C);let W=H.$parent();if(F.$isModified(q,null,B)&&!W.$__.activePaths.getStatePaths("modify").hasOwnProperty(q)&&!W.$isDefault(q)){if(X.add(q),F.$__.pathsToScopes==null)F.$__.pathsToScopes={};if(F.$__.pathsToScopes[q]=H.$isDocumentArrayElement?H.__parentArray:H.$parent(),J[q]={skipSchemaValidators:!0},H.$isDocumentArrayElement&&H.__index!=null)J[q].index=H.__index}}}for(let Y of X){let B=F.$__schema.path(Y);if(!B)continue;if(B.$isMongooseDocumentArray){for(let H of X)if(H==null||H.startsWith(B.path+"."))X.delete(H)}if(!B.caster&&B.validators.length===0&&!B.$parentSchemaDocArray)X.delete(Y);else if(B.$isMongooseArray&&!B.$isMongooseDocumentArray&&!B.$embeddedSchemaType.$isMongooseArray&&B.validators.length===0&&B.$embeddedSchemaType.validators.length===0)X.delete(Y)}if(Array.isArray(A))X=kB1(X,A);else if(Array.isArray(D))X=OB1(X,D);TB1(F,X);let G={skipArrays:!0};for(let Y of X)if(F.$__schema.nested[Y]){let B=F.$__getValue(Y);if(EB1(B))B=B.toObject({transform:!1});let H=YB1(B,Y,G,F.$__schema);Object.keys(H).filter((q)=>!F.$__schema.singleNestedPaths.hasOwnProperty(q)).forEach($)}for(let Y of X){let B=F.$__schema.path(Y);if(!B)continue;if(B.$parentSchemaDocArray&&typeof B.$parentSchemaDocArray.path==="string")X.add(B.$parentSchemaDocArray.path);if(!B.$isSchemaMap)continue;let H=F.$__getValue(Y);if(H==null)continue;for(let q of H.keys())X.add(Y+"."+q)}return X=Array.from(X),[X,J]}function TB1(F,A){for(let D of A){let Z=F.$__schema.path(D);if(!Z)continue;if(!Z.$isMongooseArray||!Array.isArray(Z)&&Z.$isMongooseDocumentArray&&!(Z&&Z.schemaOptions&&Z.schemaOptions.required))continue;if(Z.$isMongooseArray&&!Z.$isMongooseDocumentArray&&!Z.$embeddedSchemaType.$isMongooseArray&&Z.$embeddedSchemaType.validators.length===0)continue;let J=F.$__getValue(D);VJ(J,A,D)}}function VJ(F,A,D){if(F!=null){let Z=F.length;for(let J=0;J<Z;++J)if(Array.isArray(F[J]))VJ(F[J],A,D+"."+J);else A.add(D+"."+J)}}/*!
282
282
  * ignore
283
283
  */m.prototype.$__validate=function(F,A,D){if(this.$__.saveOptions&&this.$__.saveOptions.pathsToSave&&!F)F=[...this.$__.saveOptions.pathsToSave];else if(typeof F==="function")D=F,A=null,F=null;else if(typeof A==="function")D=A,A=null;let Z=A&&typeof A==="object"&&"validateModifiedOnly"in A,J=A&&A.pathsToSkip||null,X;if(Z)X=!!A.validateModifiedOnly;else X=this.$__schema.options.validateModifiedOnly;let $=A&&A.validateAllPaths;if($){if(J)throw new TypeError("Cannot set both `validateAllPaths` and `pathsToSkip`");if(F)throw new TypeError("Cannot set both `validateAllPaths` and `pathsToValidate`");if(Z&&X)throw new TypeError("Cannot set both `validateAllPaths` and `validateModifiedOnly`")}let G=this,Y=()=>{let U=this.$__.validationError;if(this.$__.validationError=null,this.$__.validating=null,X&&U!=null){let z=Object.keys(U.errors);for(let L of z)if(!this.$isModified(L))delete U.errors[L];if(Object.keys(U.errors).length===0)U=void 0}if(this.$__.cachedRequired={},this.$emit("validate",G),this.constructor.emit("validate",G),U){for(let z in U.errors)if(!this[UB1]&&U.errors[z]instanceof e2.CastError)this.invalidate(z,U.errors[z]);return U}},B,H;if($){B=new Set(Object.keys(this.$__schema.paths));for(let U of B){let z=this.$__schema.path(U);if(!z||!z.$isMongooseArray)continue;let L=this.$__getValue(U);if(!L)continue;VJ(L,B,U)}B=[...B],H={}}else{let U=Zf(this,F,J,A&&A._nestedValidate);B=X?U[0].filter((z)=>this.$isModified(z)):U[0],H=U[1]}if(typeof F==="string")F=F.split(" ");if(B.length===0)return cg(function(){let U=Y();if(U)return G.$__schema.s.hooks.execPost("validate:error",G,[G],{error:U},function(z){D(z)});D(null,G)});let q={},W=0,C=this.$__.saveOptions?.pathsToSave;if(Array.isArray(C)){C=new Set(C);for(let U of B){if(!C.has(U))continue;Q(U)}}else for(let U of B)Q(U);function Q(U){if(U==null||q[U])return;q[U]=!0,W++,cg(function(){let z=G.$__schema.path(U);if(!z)return--W||K();if(!G.$isValid(U)){--W||K();return}if(z[PB1]!=null&&U!==z.path)return--W||K();let L=G.$__getValue(U),V;if(V=G.$populated(U))L=V;else if(L!=null&&L.$__!=null&&L.$__.wasPopulated)L=L._doc._id;let P=G.$__.pathsToScopes!=null&&U in G.$__.pathsToScopes?G.$__.pathsToScopes[U]:G,I={...H[U],path:U,validateAllPaths:$,_nestedValidate:!0};z.doValidate(L,function(M){if(M){if((z.$isSingleNested||z.$isArraySubdocument||z.$isMongooseDocumentArray)&&M instanceof zJ)return--W||K();G.invalidate(U,M,void 0,!0)}--W||K()},P,I)})}function K(){let U=Y();if(U)return G.$__schema.s.hooks.execPost("validate:error",G,[G],{error:U},function(z){D(z)});D(null,G)}};/*!
284
284
  * ignore
@@ -717,7 +717,7 @@ updatePath: '${Z.raw.path}'`);Z.trace.add(F);let J=Object.keys(F||{}),X=J.length
717
717
  * Called internally by `openUri()` to create a MongoClient instance.
718
718
  */X1.prototype.createClient=function F(){throw new P0("Connection#createClient not implemented by driver")};X1.prototype.syncIndexes=async function F(A={}){let D={},Z={},{continueOnError:J}=A;delete A.continueOnError;for(let X of Object.values(this.models))try{D[X.modelName]=await X.syncIndexes(A)}catch($){if(!J){Z[X.modelName]=$;break}else D[X.modelName]=$}if(!J&&Object.keys(Z).length){let X=Object.entries(Z).map(([G,Y])=>`${G}: ${Y.message}`).join(", ");throw new pK1(X,Z)}return D};/*!
719
719
  * Module exports.
720
- */X1.STATES=O0;lv.exports=X1});var aQ=E((QO1,JE1)=>{JE1.exports={name:"mongoose",description:"Mongoose MongoDB ODM",version:"8.13.0",author:"Guillermo Rauch <guillermo@learnboost.com>",keywords:["mongodb","document","model","schema","database","odm","data","datastore","query","nosql","orm","db"],type:"commonjs",license:"MIT",dependencies:{bson:"^6.10.3",kareem:"2.6.3",mongodb:"~6.15.0",mpath:"0.9.0",mquery:"5.0.0",ms:"2.1.3",sift:"17.1.3"},devDependencies:{"@babel/core":"7.26.9","@babel/preset-env":"7.26.9","@typescript-eslint/eslint-plugin":"^8.19.1","@typescript-eslint/parser":"^8.19.1",acquit:"1.3.0","acquit-ignore":"0.2.1","acquit-require":"0.1.1",ajv:"8.17.1","assert-browserify":"2.0.0","babel-loader":"8.2.5","broken-link-checker":"^0.7.8",buffer:"^5.6.0",cheerio:"1.0.0","crypto-browserify":"3.12.1",dox:"1.0.0",eslint:"8.57.1","eslint-plugin-markdown":"^5.1.0","eslint-plugin-mocha-no-only":"1.2.0",express:"^4.19.2","fs-extra":"~11.3.0","highlight.js":"11.11.1","lodash.isequal":"4.5.0","lodash.isequalwith":"4.4.0","markdownlint-cli2":"^0.17.1",marked:"15.0.7",mkdirp:"^3.0.1",mocha:"11.1.0",moment:"2.30.1","mongodb-memory-server":"10.1.4",ncp:"^2.0.0",nyc:"15.1.0",pug:"3.0.3",q:"1.5.1",sinon:"19.0.2","stream-browserify":"3.0.0",tsd:"0.31.2",typescript:"5.7.3",uuid:"11.1.0",webpack:"5.98.0"},directories:{lib:"./lib/mongoose"},scripts:{"docs:clean":"npm run docs:clean:stable","docs:clean:stable":"rimraf index.html && rimraf -rf ./docs/*.html && rimraf -rf ./docs/api && rimraf -rf ./docs/tutorials/*.html && rimraf -rf ./docs/typescript/*.html && rimraf -rf ./docs/*.html && rimraf -rf ./docs/source/_docs && rimraf -rf ./tmp","docs:clean:5x":"rimraf index.html && rimraf -rf ./docs/5.x && rimraf -rf ./docs/source/_docs && rimraf -rf ./tmp","docs:clean:6x":"rimraf index.html && rimraf -rf ./docs/6.x && rimraf -rf ./docs/source/_docs && rimraf -rf ./tmp","docs:copy:tmp":"mkdirp ./tmp/docs/css && mkdirp ./tmp/docs/js && mkdirp ./tmp/docs/images && mkdirp ./tmp/docs/tutorials && mkdirp ./tmp/docs/typescript && mkdirp ./tmp/docs/api && ncp ./docs/css ./tmp/docs/css --filter=.css$ && ncp ./docs/js ./tmp/docs/js --filter=.js$ && ncp ./docs/images ./tmp/docs/images && ncp ./docs/tutorials ./tmp/docs/tutorials && ncp ./docs/typescript ./tmp/docs/typescript && ncp ./docs/api ./tmp/docs/api && cp index.html ./tmp && cp docs/*.html ./tmp/docs/","docs:copy:tmp:5x":"rimraf ./docs/5.x && ncp ./tmp ./docs/5.x","docs:copy:tmp:6x":"rimraf ./docs/6.x && ncp ./tmp ./docs/6.x","docs:generate":"node ./scripts/website.js","docs:generate:sponsorData":"node ./scripts/loadSponsorData.js","docs:test":"npm run docs:generate","docs:view":"node ./scripts/static.js","docs:prepare:publish:stable":"git checkout gh-pages && git merge master && npm run docs:generate","docs:prepare:publish:5x":"git checkout 5.x && git merge 5.x && npm run docs:clean:stable && npm run docs:generate && npm run docs:copy:tmp && git checkout gh-pages && npm run docs:copy:tmp:5x","docs:prepare:publish:6x":"git checkout 6.x && git merge 6.x && npm run docs:clean:stable && env DOCS_DEPLOY=true npm run docs:generate && mv ./docs/6.x ./tmp && git checkout gh-pages && npm run docs:copy:tmp:6x","docs:prepare:publish:7x":"env DOCS_DEPLOY=true npm run docs:generate && git checkout gh-pages && rimraf ./docs/7.x && mv ./tmp ./docs/7.x","docs:check-links":"blc http://127.0.0.1:8089 -ro",lint:"eslint .","lint-js":"eslint . --ext .js --ext .cjs","lint-ts":"eslint . --ext .ts","lint-md":'markdownlint-cli2 "**/*.md" "#node_modules" "#benchmarks"',"build-browser":"(rm ./dist/* || true) && node ./scripts/build-browser.js",prepublishOnly:"npm run build-browser",release:"git pull && git push origin master --tags && npm publish","release-5x":"git pull origin 5.x && git push origin 5.x && git push origin 5.x --tags && npm publish --tag 5x","release-6x":"git pull origin 6.x && git push origin 6.x && git push origin 6.x --tags && npm publish --tag 6x",mongo:"node ./tools/repl.js","publish-7x":"npm publish --tag 7x",test:"mocha --exit ./test/*.test.js","test-deno":"deno run --allow-env --allow-read --allow-net --allow-run --allow-sys --allow-write ./test/deno.js","test-rs":"START_REPLICA_SET=1 mocha --timeout 30000 --exit ./test/*.test.js","test-tsd":"node ./test/types/check-types-filename && tsd","setup-test-encryption":"bash scripts/configure-cluster-with-encryption.sh","test-encryption":"mocha --exit ./test/encryption/*.test.js",tdd:"mocha ./test/*.test.js --inspect --watch --recursive --watch-files ./**/*.{js,ts}","test-coverage":"nyc --reporter=html --reporter=text npm test","ts-benchmark":"cd ./benchmarks/typescript/simple && npm install && npm run benchmark | node ../../../scripts/tsc-diagnostics-check"},main:"./index.js",types:"./types/index.d.ts",engines:{node:">=16.20.1"},bugs:{url:"https://github.com/Automattic/mongoose/issues/new"},repository:{type:"git",url:"git://github.com/Automattic/mongoose.git"},homepage:"https://mongoosejs.com",browser:"./dist/browser.umd.js",config:{mongodbMemoryServer:{disablePostinstall:!0}},funding:{type:"opencollective",url:"https://opencollective.com/mongoose"},tsd:{directory:"test/types",compilerOptions:{esModuleInterop:!1,strict:!0,allowSyntheticDefaultImports:!0,strictPropertyInitialization:!1,noImplicitAny:!1,strictNullChecks:!0,module:"commonjs",target:"ES2017"}}}});var av=E((KO1,iv)=>{var XE1=K0(),$E1=a2();function YE1(F,A){let D=A?A:{},Z=D.readPreference?D.readPreference:qE1(F),J=XE1(D);return Z&&Z!=="primary"&&Z!=="primaryPreferred"?GE1(Z,J):J}function GE1(F,A){if(BE1(A)&&HE1(F))CE1();else return WE1(A)}function BE1(F){let A=F.config&&F.config.autoIndex,{autoCreate:D,autoIndex:Z}=F;return!!(A||D||Z)}function HE1(F){return F==="secondary"||F==="secondaryPreferred"}function qE1(F){let D=/(?:&|\?)readPreference=(\w+)(?:&|$)/.exec(F);return D?D[1]:null}function WE1(F){return F.config={autoIndex:!1},F.autoCreate=!1,F.autoIndex=!1,F}function CE1(){throw new $E1('MongoDB prohibits index creation on connections that read from non-primary replicas. Connections that set "readPreference" to "secondary" or "secondaryPreferred" may not opt-in to the following connection options: autoCreate, autoIndex')}iv.exports=YE1});var nv=E((QE1)=>{QE1.setTimeout=setTimeout});var ev=E((UO1,ov)=>{/*!
720
+ */X1.STATES=O0;lv.exports=X1});var aQ=E((QO1,JE1)=>{JE1.exports={name:"mongoose",description:"Mongoose MongoDB ODM",version:"8.13.2",author:"Guillermo Rauch <guillermo@learnboost.com>",keywords:["mongodb","document","model","schema","database","odm","data","datastore","query","nosql","orm","db"],type:"commonjs",license:"MIT",dependencies:{bson:"^6.10.3",kareem:"2.6.3",mongodb:"~6.15.0",mpath:"0.9.0",mquery:"5.0.0",ms:"2.1.3",sift:"17.1.3"},devDependencies:{"@babel/core":"7.26.10","@babel/preset-env":"7.26.9","@typescript-eslint/eslint-plugin":"^8.19.1","@typescript-eslint/parser":"^8.19.1",acquit:"1.3.0","acquit-ignore":"0.2.1","acquit-require":"0.1.1",ajv:"8.17.1","assert-browserify":"2.0.0","babel-loader":"8.2.5","broken-link-checker":"^0.7.8",buffer:"^5.6.0",cheerio:"1.0.0","crypto-browserify":"3.12.1",dox:"1.0.0",eslint:"8.57.1","eslint-plugin-markdown":"^5.1.0","eslint-plugin-mocha-no-only":"1.2.0",express:"^4.19.2","fs-extra":"~11.3.0","highlight.js":"11.11.1","lodash.isequal":"4.5.0","lodash.isequalwith":"4.4.0","markdownlint-cli2":"^0.17.1",marked:"15.0.7",mkdirp:"^3.0.1",mocha:"11.1.0",moment:"2.30.1","mongodb-memory-server":"10.1.4",ncp:"^2.0.0",nyc:"15.1.0",pug:"3.0.3",q:"1.5.1",sinon:"20.0.0","stream-browserify":"3.0.0",tsd:"0.31.2",typescript:"5.7.3",uuid:"11.1.0",webpack:"5.98.0"},directories:{lib:"./lib/mongoose"},scripts:{"docs:clean":"npm run docs:clean:stable","docs:clean:stable":"rimraf index.html && rimraf -rf ./docs/*.html && rimraf -rf ./docs/api && rimraf -rf ./docs/tutorials/*.html && rimraf -rf ./docs/typescript/*.html && rimraf -rf ./docs/*.html && rimraf -rf ./docs/source/_docs && rimraf -rf ./tmp","docs:clean:5x":"rimraf index.html && rimraf -rf ./docs/5.x && rimraf -rf ./docs/source/_docs && rimraf -rf ./tmp","docs:clean:6x":"rimraf index.html && rimraf -rf ./docs/6.x && rimraf -rf ./docs/source/_docs && rimraf -rf ./tmp","docs:copy:tmp":"mkdirp ./tmp/docs/css && mkdirp ./tmp/docs/js && mkdirp ./tmp/docs/images && mkdirp ./tmp/docs/tutorials && mkdirp ./tmp/docs/typescript && mkdirp ./tmp/docs/api && ncp ./docs/css ./tmp/docs/css --filter=.css$ && ncp ./docs/js ./tmp/docs/js --filter=.js$ && ncp ./docs/images ./tmp/docs/images && ncp ./docs/tutorials ./tmp/docs/tutorials && ncp ./docs/typescript ./tmp/docs/typescript && ncp ./docs/api ./tmp/docs/api && cp index.html ./tmp && cp docs/*.html ./tmp/docs/","docs:copy:tmp:5x":"rimraf ./docs/5.x && ncp ./tmp ./docs/5.x","docs:copy:tmp:6x":"rimraf ./docs/6.x && ncp ./tmp ./docs/6.x","docs:generate":"node ./scripts/website.js","docs:generate:sponsorData":"node ./scripts/loadSponsorData.js","docs:test":"npm run docs:generate","docs:view":"node ./scripts/static.js","docs:prepare:publish:stable":"git checkout gh-pages && git merge master && npm run docs:generate","docs:prepare:publish:5x":"git checkout 5.x && git merge 5.x && npm run docs:clean:stable && npm run docs:generate && npm run docs:copy:tmp && git checkout gh-pages && npm run docs:copy:tmp:5x","docs:prepare:publish:6x":"git checkout 6.x && git merge 6.x && npm run docs:clean:stable && env DOCS_DEPLOY=true npm run docs:generate && mv ./docs/6.x ./tmp && git checkout gh-pages && npm run docs:copy:tmp:6x","docs:prepare:publish:7x":"env DOCS_DEPLOY=true npm run docs:generate && git checkout gh-pages && rimraf ./docs/7.x && mv ./tmp ./docs/7.x","docs:check-links":"blc http://127.0.0.1:8089 -ro",lint:"eslint .","lint-js":"eslint . --ext .js --ext .cjs","lint-ts":"eslint . --ext .ts","lint-md":'markdownlint-cli2 "**/*.md" "#node_modules" "#benchmarks"',"build-browser":"(rm ./dist/* || true) && node ./scripts/build-browser.js",prepublishOnly:"npm run build-browser",release:"git pull && git push origin master --tags && npm publish","release-5x":"git pull origin 5.x && git push origin 5.x && git push origin 5.x --tags && npm publish --tag 5x","release-6x":"git pull origin 6.x && git push origin 6.x && git push origin 6.x --tags && npm publish --tag 6x",mongo:"node ./tools/repl.js","publish-7x":"npm publish --tag 7x",test:"mocha --exit ./test/*.test.js","test-deno":"deno run --allow-env --allow-read --allow-net --allow-run --allow-sys --allow-write ./test/deno.js","test-rs":"START_REPLICA_SET=1 mocha --timeout 30000 --exit ./test/*.test.js","test-tsd":"node ./test/types/check-types-filename && tsd","setup-test-encryption":"bash scripts/configure-cluster-with-encryption.sh","test-encryption":"mocha --exit ./test/encryption/*.test.js",tdd:"mocha ./test/*.test.js --inspect --watch --recursive --watch-files ./**/*.{js,ts}","test-coverage":"nyc --reporter=html --reporter=text npm test","ts-benchmark":"cd ./benchmarks/typescript/simple && npm install && npm run benchmark | node ../../../scripts/tsc-diagnostics-check"},main:"./index.js",types:"./types/index.d.ts",engines:{node:">=16.20.1"},bugs:{url:"https://github.com/Automattic/mongoose/issues/new"},repository:{type:"git",url:"git://github.com/Automattic/mongoose.git"},homepage:"https://mongoosejs.com",browser:"./dist/browser.umd.js",config:{mongodbMemoryServer:{disablePostinstall:!0}},funding:{type:"opencollective",url:"https://opencollective.com/mongoose"},tsd:{directory:"test/types",compilerOptions:{esModuleInterop:!1,strict:!0,allowSyntheticDefaultImports:!0,strictPropertyInitialization:!1,noImplicitAny:!1,strictNullChecks:!0,module:"commonjs",target:"ES2017"}}}});var av=E((KO1,iv)=>{var XE1=K0(),$E1=a2();function YE1(F,A){let D=A?A:{},Z=D.readPreference?D.readPreference:qE1(F),J=XE1(D);return Z&&Z!=="primary"&&Z!=="primaryPreferred"?GE1(Z,J):J}function GE1(F,A){if(BE1(A)&&HE1(F))CE1();else return WE1(A)}function BE1(F){let A=F.config&&F.config.autoIndex,{autoCreate:D,autoIndex:Z}=F;return!!(A||D||Z)}function HE1(F){return F==="secondary"||F==="secondaryPreferred"}function qE1(F){let D=/(?:&|\?)readPreference=(\w+)(?:&|$)/.exec(F);return D?D[1]:null}function WE1(F){return F.config={autoIndex:!1},F.autoCreate=!1,F.autoIndex=!1,F}function CE1(){throw new $E1('MongoDB prohibits index creation on connections that read from non-primary replicas. Connections that set "readPreference" to "secondary" or "secondaryPreferred" may not opt-in to the following connection options: autoCreate, autoIndex')}iv.exports=YE1});var nv=E((QE1)=>{QE1.setTimeout=setTimeout});var ev=E((UO1,ov)=>{/*!
721
721
  * Module dependencies.
722
722
  */var sv=pv(),A7=a2(),F6=NF(),rv=Y8(),EE1=aQ(),UE1=av(),zE1=nv().setTimeout,tv=q1();function O3(){sv.apply(this,arguments),this._listening=!1,this._lastHeartbeatAt=null}O3.STATES=F6;/*!
723
723
  * Inherits from Connection.
@@ -849,7 +849,7 @@ updatePath: '${Z.raw.path}'`);Z.trace.add(F);let J=Object.keys(F||{}),X=J.length
849
849
  * Exports
850
850
  */rd.exports=I1});var od=E((oO1,td)=>{var Tz1=K0();class NK{constructor(F){if(F==null)return;Object.assign(this,Tz1(F))}}NK.prototype.__subdocs=null;td.exports=NK});var Fc=E((eO1,ed)=>{ed.exports=function F(A,D){let Z=Object.keys(D.paths),J=Z.length;for(let X=0;X<J;++X){let $="",G=Z[X],Y=D.paths[G],B=Y.splitPath(),H=B.length,q=A;for(let W=0;W<H;++W){if(q==null)break;let C=B[W];if($+=(!$.length?"":".")+C,W===H-1){if(typeof q[C]!=="undefined"){if(Y.$isSingleNested)F(q[C],Y.caster.schema);else if(Y.$isMongooseDocumentArray&&Array.isArray(q[C]))q[C].forEach((K)=>F(K,Y.schema));break}let Q=Y.getDefault(A,!1,{skipCast:!0});if(typeof Q!=="undefined"){if(q[C]=Q,Y.$isSingleNested)F(Q,Y.caster.schema);else if(Y.$isMongooseDocumentArray&&Array.isArray(Q))Q.forEach((K)=>F(K,Y.schema))}}else{if(q[C]==null)q[C]={};q=q[C]}}}}});var TK=E((FS1,Ac)=>{Ac.exports=jK;function jK(F,A=new WeakSet,D=!1){if(A.has(F))return;A.add(F);for(let Z of Object.keys(F.paths)){let J=F.paths[Z];if(!J.schema)continue;if(jK(J.schema,A),!J.schema._applyDiscriminators)continue;if(J._appliedDiscriminators&&!D)continue;for(let X of J.schema._applyDiscriminators.keys()){let{schema:$,options:G}=J.schema._applyDiscriminators.get(X);jK($,A),J.discriminator(X,$,D?{...G,overwriteExisting:!0}:G)}J._appliedDiscriminators=!0}}});var Zc=E((AS1,Dc)=>{var kz1=L0(),Oz1=q1();Dc.exports=function F(A,D){let Z=kK();function J(X,$){Object.defineProperty(A.prototype,X,{get:function(){let G={};for(let Y in $.methods[X])G[Y]=$.methods[X][Y].bind(this);return G},configurable:!0})}for(let X of Object.keys(D.methods)){let $=D.methods[X];if(D.tree.hasOwnProperty(X))throw new Error('You have a method and a property in your schema both named "'+X+'"');if(typeof $==="function"&&Z.prototype[X]===$){delete D.methods[X];continue}if(D.reserved[X]&&!kz1(D,`methodOptions.${X}.suppressWarning`,!1))Oz1.warn(`mongoose: the method name "${X}" is used by mongoose internally, overwriting it may cause bugs. If you're sure you know what you're doing, you can suppress this error by using \`schema.method('${X}', fn, { suppressWarning: true })\`.`);if(typeof $==="function")A.prototype[X]=$;else J(X,D)}A.$appliedMethods=!0;for(let X of Object.keys(D.paths)){let $=D.paths[X];if($.$isSingleNested&&!$.caster.$appliedMethods)F($.caster,$.schema);if($.$isMongooseDocumentArray&&!$.Constructor.$appliedMethods)F($.Constructor,$.schema)}}});var $c=E((DS1,Xc)=>{var Jc=RW(),Sz1=u8(),_z1=EX(),SX=q1().isPOJO;Xc.exports=function F(A,D,Z){if(D==null)return A;if(A==null)return A;let J=null;if(_z1(D))J=!1;else if(Sz1(D))J=!0;if(J==null)return A;else if(J)return Z=Z||Jc(D),kX(A,D,Z);else return Z=Z||Jc(D),OX(A,D,Z)};function kX(F,A,D,Z,J){if(F==null||typeof F!=="object")return F;if(Array.isArray(F))return F.map(($)=>kX($,A,D,Z,J));let X={...F};Z=J?Z||{}:A;for(let $ of Object.keys(X)){let G=J?J+"."+$:$;if(A.hasOwnProperty(G)||Z.hasOwnProperty($))if(SX(A[G])||SX(Z[$]))X[$]=kX(X[$],A,D,Z[$],G);else delete X[$];else if(D[G])X[$]=kX(X[$],A,D,Z[$],G)}return X}function OX(F,A,D,Z,J){if(F==null||typeof F!=="object")return F;if(Array.isArray(F))return F.map(($)=>OX($,A,D,Z,J));let X={...F};Z=J?Z||{}:A;for(let $ of Object.keys(X)){let G=J?J+"."+$:$;if(A.hasOwnProperty(G)||Z.hasOwnProperty($)){if(SX(A[G])||SX(Z[$]))X[$]=OX(X[$],A,D,Z[$],G);continue}else if(D[G])X[$]=OX(X[$],A,D,Z[$],G);else delete X[$]}return X}});var Gc=E((ZS1,Yc)=>{Yc.exports=function F(A){let D=!1;for(let Z of Object.keys(A))if(A[Z]==="text")D=!0;return D}});var Hc=E((JS1,Bc)=>{var uz1=Gc();Bc.exports=function F(A,D,Z){if(uz1(A))return;if(Z.hasOwnProperty("collation")&&!D.hasOwnProperty("collation"))D.collation=Z.collation}});var Wc=E((XS1,qc)=>{var xz1=nZ(),{queryMiddlewareFunctions:gz1,aggregateMiddlewareFunctions:fz1,modelMiddlewareFunctions:yz1,documentMiddlewareFunctions:bz1}=NJ(),hz1=Array.from(new Set([...gz1,...fz1,...yz1,...bz1]));qc.exports=function F(A,D,Z){let J={useErrorHandlers:!0,numCallbackParams:1};A.$__insertMany=D.createWrapper("insertMany",A.$__insertMany,A,J),D=D.filter((X)=>{if(hz1.indexOf(X.name)!==-1)return!!X.model;return X.model!==!1});for(let X of Object.keys(Z))if(D.hasHooks(X)){let $=A[X];A[X]=function(){let G=arguments.length,Y=G>0?arguments[G-1]:null,B=typeof Y==="function"?Y:null,H=Array.prototype.slice.call(arguments,0,B==null?G:G-1);return xz1(B,(q)=>{D.execPre(X,A,H,function(W){if(W!=null)return q(W);let C=0,Q=$.apply(A,H.concat(K));if(Q!=null&&typeof Q.then==="function")Q.then((U)=>K(null,U),(U)=>K(U));function K(U,z){if(C++>0)return;if(U!=null)return q(U);D.execPost(X,A,[z],function(L){if(L!=null)return q(L);q(null,z)})}})},A.events)}}}});var Qc=E(($S1,Cc)=>{Cc.exports=function F(A,D){for(let Z in D.statics)A[Z]=D.statics[Z]}});var Vc=E((YS1,zc)=>{var Kc=MJ(),vz1=z6();zc.exports=Ec;function Ec(F,A,D){if(A==null)return A;return mz1(F,A,D),Uc(F,A,D)}function mz1(F,A,D){for(let Z of F.childSchemas){let J=Z.model.path,X=Z.schema;if(!J)continue;let $=vz1.get(J,A);if($==null||Array.isArray($)&&$.flat(1/0).length===0)continue;Ec(X,$,D)}}function Uc(F,A,D){if(A==null||typeof A!=="object")return;if(Array.isArray(A)){for(let G of A)Uc(F,G,D);return}if(F.discriminators&&Object.keys(F.discriminators).length>0)for(let G of Object.keys(F.discriminators)){let Y=F.discriminators[G],B=Y.discriminatorMapping.key,H=Y.discriminatorMapping.value;if(A[B]==H){F=Y;break}}let Z=Kc(F.options.timestamps,"createdAt"),J=Kc(F.options.timestamps,"updatedAt"),X=D?.currentTime,$=null;if(X!=null)$=X();else if(F.base?.now)$=F.base.now();else $=new Date;if(Z&&A[Z]==null&&!D?.isUpdate)A[Z]=$;if(J)A[J]=$}});var wc=E((GS1,Rc)=>{var dz1=z6();Rc.exports=Lc;function Lc(F,A,D){if(A==null)return A;let Z=D,J=null;if(Array.isArray(D)){Z=[],J=[];for(let X of D)if(X.length===1)J.push(X[0]);else Z.push(X)}return cz1(F,A,Z),OK(F,A,J)}function cz1(F,A,D){let Z=!1;for(let J of F.childSchemas){let X=J.model.path,$=J.schema;if(!X)continue;let G=dz1.get(X,A);if(G==null||Array.isArray(G)&&G.flat(1/0).length===0)continue;let Y=null;if(Array.isArray(D)){Y=[];for(let B of D)if(B[0]==X)Y.push(B.slice(1));if(Y.length===0)continue}Lc($,G,Y),Z=!0}if(D&&D.length&&!Z)OK(F,A,D)}function OK(F,A,D){if(A==null||typeof A!=="object")return;if(Array.isArray(A)){for(let Z of A)OK(F,Z,D);return}if(F.discriminators&&Object.keys(F.discriminators).length>0)for(let Z of Object.keys(F.discriminators)){let J=F.discriminators[Z],X=J.discriminatorMapping.key,$=J.discriminatorMapping.value;if(A[X]==$){F=J;break}}if(D==null)D=Object.keys(F.virtuals);for(let Z of D){if(F.virtuals[Z]==null)continue;let J=F.virtuals[Z],X=Array.isArray(Z)?Z:Z.indexOf(".")===-1?[Z]:Z.split("."),$=A;for(let B=0;B<X.length-1;++B)$[X[B]]=X[B]in $?$[X[B]]:{},$=$[X[B]];let G=J.applyGetters($[X[X.length-1]],A);if(J.options&&(J.options.ref||J.options.refPath)&&G===void 0)if(J.options.justOne)G=null;else G=[];$[X[X.length-1]]=G}}});var _X=E((BS1,Pc)=>{Pc.exports=function F(A){if(!(this instanceof F))return new F(A);return this.val=A,this}});var TA=E((HS1,Ic)=>{/*!
851
851
  * ignore
852
- */Ic.exports=new WeakMap});var Tc=E((qS1,jc)=>{var lz1=K0(),Mc=TA(),pz1=A1().modelSymbol,iz1=q1();jc.exports=Nc;var uX=Symbol("mongoose#assignRawDocsToIdStructure#hasArray");function Nc(F,A,D,Z,J){let X=[],$=Z.isVirtual&&Z.justOne&&F.length>1?!1:Z.sort&&F.length>1,G=Z.$nullIfNotFound,Y,B,H;if(iz1.isMongooseArray(F))F=F.__array;let q=0,W=F.length;if($&&J&&Z[uX]===void 0){Z[uX]=!1;for(let C in D)if(Array.isArray(D[C])){Z[uX]=!0;break}}for(q=0;q<W;++q){if(H=F[q],Array.isArray(H)){Nc(H,A,D,Z,!0),X.push(H);continue}if(H===null&&$===!1){X.push(H);continue}if(B=String(H),Y=A[B],Z.clone&&Y!=null)if(Z.lean){let C=Mc.get(Y);Y=lz1(Y),Mc.set(Y,C)}else Y=Y.constructor.hydrate(Y._doc);if(J)if(Y)if($){let C=D[B];if(Z[uX])X.push(Y);else X[C]=Y}else X.push(Y);else if(H!=null&&H[pz1]!=null)X.push(H);else X.push(Z.retainNullValues||G?null:H);else X[q]=Y||null}if(F.length=0,X.length)X.forEach(function(C,Q){F[Q]=C})}});var _K=E((WS1,kc)=>{kc.exports=SK;/*!
852
+ */Ic.exports=new WeakMap});var Tc=E((qS1,jc)=>{var lz1=K0(),Mc=TA(),pz1=A1().modelSymbol,iz1=q1();jc.exports=Nc;var uX=Symbol("mongoose#assignRawDocsToIdStructure#hasArray");function Nc(F,A,D,Z,J){let X=[],$=Z.isVirtual&&Z.justOne&&F.length>1?!1:Z.sort&&F.length>1,G=Z.$nullIfNotFound,Y,B,H;if(iz1.isMongooseArray(F))F=F.__array;let q=0,W=F.length;if($&&J&&Z[uX]===void 0){Z[uX]=!1;for(let C in D)if(Array.isArray(D[C])){Z[uX]=!0;break}}for(q=0;q<W;++q){if(H=F[q],Array.isArray(H)){Nc(H,A,D,Z,!0),X.push(H);continue}if(H===null&&$===!1){X.push(H);continue}if(H?.constructor?.name==="Binary"&&H.sub_type===4&&typeof H.toUUID==="function")B=String(H.toUUID());else B=String(H);if(Y=A[B],Z.clone&&Y!=null)if(Z.lean){let C=Mc.get(Y);Y=lz1(Y),Mc.set(Y,C)}else Y=Y.constructor.hydrate(Y._doc);if(J)if(Y)if($){let C=D[B];if(Z[uX])X.push(Y);else X[C]=Y}else X.push(Y);else if(H!=null&&H[pz1]!=null)X.push(H);else X.push(Z.retainNullValues||G?null:H);else X[q]=Y||null}if(F.length=0,X.length)X.forEach(function(C,Q){F[Q]=C})}});var _K=E((WS1,kc)=>{kc.exports=SK;/*!
853
853
  * ignore
854
854
  */function SK(F,A){if(F.virtuals[A])return{virtual:F.virtuals[A],path:void 0};let D=A.split("."),Z="",J="";for(let X=0;X<D.length;++X){if(Z+=(Z.length>0?".":"")+D[X],F.virtuals[Z]){if(X===D.length-1)return{virtual:F.virtuals[Z],path:J};continue}if(F.nested[Z])continue;if(F.paths[Z]&&F.paths[Z].schema){F=F.paths[Z].schema;let $=D.slice(X+1).join(".");if(F.virtuals[$]){if(X===D.length-2)return{virtual:F.virtuals[$],nestedSchemaPath:[J,Z].filter((G)=>!!G).join(".")};continue}if(X+1<D.length&&F.discriminators)for(let G of Object.keys(F.discriminators)){let Y=SK(F.discriminators[G],$);if(Y!=null){let B=[J,Z,Y.nestedSchemaPath].filter((H)=>!!H).join(".");return{virtual:Y.virtual,nestedSchemaPath:B}}}J+=(J.length>0?".":"")+Z,Z="";continue}if(F.discriminators)for(let $ of Object.keys(F.discriminators)){let G=SK(F.discriminators[$],A);if(G)return G}return null}}});var Sc=E((xX,Oc)=>{(function(F,A){typeof xX==="object"&&typeof Oc!=="undefined"?A(xX):typeof define==="function"&&define.amd?define(["exports"],A):(F=typeof globalThis!=="undefined"?globalThis:F||self,A(F.sift={}))})(xX,function(F){var A=function(w,N){return A=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(k,b){k.__proto__=b}||function(k,b){for(var s in b)if(Object.prototype.hasOwnProperty.call(b,s))k[s]=b[s]},A(w,N)};function D(w,N){if(typeof N!=="function"&&N!==null)throw new TypeError("Class extends value "+String(N)+" is not a constructor or null");A(w,N);function k(){this.constructor=w}w.prototype=N===null?Object.create(N):(k.prototype=N.prototype,new k)}typeof SuppressedError==="function"&&SuppressedError;var Z=function(w){var N="[object "+w+"]";return function(k){return J(k)===N}},J=function(w){return Object.prototype.toString.call(w)},X=function(w){if(w instanceof Date)return w.getTime();else if(G(w))return w.map(X);else if(w&&typeof w.toJSON==="function")return w.toJSON();return w},$=function(w){return w==null?null:w},G=Z("Array"),Y=Z("Object"),B=Z("Function"),H=function(w,N){return w.hasOwnProperty(N)&&!B(w[N])},q=function(w){return w&&(w.constructor===Object||w.constructor===Array||w.constructor.toString()==="function Object() { [native code] }"||w.constructor.toString()==="function Array() { [native code] }")&&!w.toJSON},W=function(w,N){if(w==null&&w==N)return!0;if(w===N)return!0;if(Object.prototype.toString.call(w)!==Object.prototype.toString.call(N))return!1;if(G(w)){if(w.length!==N.length)return!1;for(var k=0,b=w.length;k<b;k++)if(!W(w[k],N[k]))return!1;return!0}else if(Y(w)){if(Object.keys(w).length!==Object.keys(N).length)return!1;for(var s in w)if(!W(w[s],N[s]))return!1;return!0}return!1},C=function(w,N,k,b,s,D1){var C1=N[b];if(G(w)&&isNaN(Number(C1))&&!H(w,C1)){for(var M1=0,X2=w.length;M1<X2;M1++)if(!C(w[M1],N,k,b,M1,w))return!1}if(b===N.length||w==null)return k(w,s,D1,b===0,b===N.length);return C(w[C1],N,k,b+1,C1,w)},Q=function(){function w(N,k,b,s){this.params=N,this.owneryQuery=k,this.options=b,this.name=s,this.init()}return w.prototype.init=function(){},w.prototype.reset=function(){this.done=!1,this.keep=!1},w}(),K=function(w){D(N,w);function N(k,b,s,D1){var C1=w.call(this,k,b,s)||this;return C1.children=D1,C1}return N.prototype.reset=function(){this.keep=!1,this.done=!1;for(var k=0,b=this.children.length;k<b;k++)this.children[k].reset()},N.prototype.childrenNext=function(k,b,s,D1,C1){var M1=!0,X2=!0;for(var Z6=0,K3=this.children.length;Z6<K3;Z6++){var J9=this.children[Z6];if(!J9.done)J9.next(k,b,s,D1,C1);if(!J9.keep)X2=!1;if(J9.done){if(!J9.keep)break}else M1=!1}this.done=M1,this.keep=X2},N}(Q),U=function(w){D(N,w);function N(k,b,s,D1,C1){var M1=w.call(this,k,b,s,D1)||this;return M1.name=C1,M1}return N}(K),z=function(w){D(N,w);function N(){var k=w!==null&&w.apply(this,arguments)||this;return k.propop=!0,k}return N.prototype.next=function(k,b,s,D1){this.childrenNext(k,b,s,D1)},N}(K),L=function(w){D(N,w);function N(k,b,s,D1,C1){var M1=w.call(this,b,s,D1,C1)||this;return M1.keyPath=k,M1.propop=!0,M1._nextNestedValue=function(X2,Z6,K3,J9,_p){return M1.childrenNext(X2,Z6,K3,J9,_p),!M1.done},M1}return N.prototype.next=function(k,b,s){C(k,this.keyPath,this._nextNestedValue,0,b,s)},N}(K),V=function(w,N){if(w instanceof Function)return w;if(w instanceof RegExp)return function(b){var s=typeof b==="string"&&w.test(b);return w.lastIndex=0,s};var k=X(w);return function(b){return N(k,X(b))}},P=function(w){D(N,w);function N(){var k=w!==null&&w.apply(this,arguments)||this;return k.propop=!0,k}return N.prototype.init=function(){this._test=V(this.params,this.options.compare)},N.prototype.next=function(k,b,s){if(!Array.isArray(s)||s.hasOwnProperty(b)){if(this._test(k,b,s))this.done=!0,this.keep=!0}},N}(Q),I=function(w,N,k){return new P(w,N,k)},M=function(w){return function(N,k,b,s){return w(N,k,b,s)}},x=function(w){return M(function(N,k,b,s){var D1=typeof X(N),C1=w(N);return new P(function(M1){var X2=$(M1);return typeof X(X2)===D1&&C1(X2)},k,b,s)})},_=function(w,N,k,b){var s=b.operations[w];if(!s)O(w);return s(N,k,b,w)},O=function(w){throw new Error("Unsupported operation: ".concat(w))},R=function(w,N){for(var k in w)if(N.operations.hasOwnProperty(k)||k.charAt(0)==="$")return!0;return!1},S=function(w,N,k,b,s){if(R(N,s)){var D1=c(N,k,s),C1=D1[0],M1=D1[1];if(M1.length)throw new Error("Property queries must contain only operations, or exact objects.");return new L(w,N,b,s,C1)}return new L(w,N,b,s,[new P(N,b,s)])},u=function(w,N,k){if(N===void 0)N=null;var b=k===void 0?{}:k,s=b.compare,D1=b.operations,C1={compare:s||W,operations:Object.assign({},D1||{})},M1=c(w,null,C1),X2=M1[0],Z6=M1[1],K3=[];if(X2.length)K3.push(new L([],w,N,C1,X2));if(K3.push.apply(K3,Z6),K3.length===1)return K3[0];return new z(w,N,C1,K3)},c=function(w,N,k){var b=[],s=[];if(!q(w))return b.push(new P(w,w,k)),[b,s];for(var D1 in w)if(k.operations.hasOwnProperty(D1)){var C1=_(D1,w[D1],w,k);if(C1){if(!C1.propop&&N&&!k.operations[N])throw new Error("Malformed query. ".concat(D1," cannot be matched against property."))}if(C1!=null)b.push(C1)}else if(D1.charAt(0)==="$")O(D1);else s.push(S(D1.split("."),w[D1],D1,w,k));return[b,s]},r=function(w){return function(N,k,b){return w.reset(),w.next(N,k,b),w.keep}},J0=function(w,N){if(N===void 0)N={};return r(u(w,null,N))},d0=function(w){D(N,w);function N(){var k=w!==null&&w.apply(this,arguments)||this;return k.propop=!0,k}return N.prototype.init=function(){this._test=V(this.params,this.options.compare)},N.prototype.reset=function(){w.prototype.reset.call(this),this.keep=!0},N.prototype.next=function(k){if(this._test(k))this.done=!0,this.keep=!1},N}(Q),X0=function(w){D(N,w);function N(){var k=w!==null&&w.apply(this,arguments)||this;return k.propop=!0,k}return N.prototype.init=function(){if(!this.params||typeof this.params!=="object")throw new Error("Malformed query. $elemMatch must by an object.");this._queryOperation=u(this.params,this.owneryQuery,this.options)},N.prototype.reset=function(){w.prototype.reset.call(this),this._queryOperation.reset()},N.prototype.next=function(k){if(G(k)){for(var b=0,s=k.length;b<s;b++){this._queryOperation.reset();var D1=k[b];this._queryOperation.next(D1,b,k,!1),this.keep=this.keep||this._queryOperation.keep}this.done=!0}else this.done=!1,this.keep=!1},N}(Q),c0=function(w){D(N,w);function N(){var k=w!==null&&w.apply(this,arguments)||this;return k.propop=!0,k}return N.prototype.init=function(){this._queryOperation=u(this.params,this.owneryQuery,this.options)},N.prototype.reset=function(){w.prototype.reset.call(this),this._queryOperation.reset()},N.prototype.next=function(k,b,s,D1){this._queryOperation.next(k,b,s,D1),this.done=this._queryOperation.done,this.keep=!this._queryOperation.keep},N}(Q),M2=function(w){D(N,w);function N(){var k=w!==null&&w.apply(this,arguments)||this;return k.propop=!0,k}return N.prototype.init=function(){},N.prototype.next=function(k){if(G(k)&&k.length===this.params)this.done=!0,this.keep=!0},N}(Q),J2=function(w){if(w.length===0)throw new Error("$and/$or/$nor must be a nonempty array")},_3=function(w){D(N,w);function N(){var k=w!==null&&w.apply(this,arguments)||this;return k.propop=!1,k}return N.prototype.init=function(){var k=this;J2(this.params),this._ops=this.params.map(function(b){return u(b,null,k.options)})},N.prototype.reset=function(){this.done=!1,this.keep=!1;for(var k=0,b=this._ops.length;k<b;k++)this._ops[k].reset()},N.prototype.next=function(k,b,s){var D1=!1,C1=!1;for(var M1=0,X2=this._ops.length;M1<X2;M1++){var Z6=this._ops[M1];if(Z6.next(k,b,s),Z6.keep){D1=!0,C1=Z6.keep;break}}this.keep=C1,this.done=D1},N}(Q),Mp=function(w){D(N,w);function N(){var k=w!==null&&w.apply(this,arguments)||this;return k.propop=!1,k}return N.prototype.next=function(k,b,s){w.prototype.next.call(this,k,b,s),this.keep=!this.keep},N}(_3),GE=function(w){D(N,w);function N(){var k=w!==null&&w.apply(this,arguments)||this;return k.propop=!0,k}return N.prototype.init=function(){var k=this,b=Array.isArray(this.params)?this.params:[this.params];this._testers=b.map(function(s){if(R(s,k.options))throw new Error("cannot nest $ under ".concat(k.name.toLowerCase()));return V(s,k.options.compare)})},N.prototype.next=function(k,b,s){var D1=!1,C1=!1;for(var M1=0,X2=this._testers.length;M1<X2;M1++){var Z6=this._testers[M1];if(Z6(k)){D1=!0,C1=!0;break}}this.keep=C1,this.done=D1},N}(Q),Np=function(w){D(N,w);function N(k,b,s,D1){var C1=w.call(this,k,b,s,D1)||this;return C1.propop=!0,C1._in=new GE(k,b,s,D1),C1}return N.prototype.next=function(k,b,s,D1){if(this._in.next(k,b,s),G(s)&&!D1){if(this._in.keep)this.keep=!1,this.done=!0;else if(b==s.length-1)this.keep=!0,this.done=!0}else this.keep=!this._in.keep,this.done=!0},N.prototype.reset=function(){w.prototype.reset.call(this),this._in.reset()},N}(Q),jp=function(w){D(N,w);function N(){var k=w!==null&&w.apply(this,arguments)||this;return k.propop=!0,k}return N.prototype.next=function(k,b,s,D1,C1){if(!C1)this.done=!0,this.keep=!this.params;else if(s.hasOwnProperty(b)===this.params)this.done=!0,this.keep=!0},N}(Q),Tp=function(w){D(N,w);function N(k,b,s,D1){var C1=w.call(this,k,b,s,k.map(function(M1){return u(M1,b,s)}),D1)||this;return C1.propop=!1,J2(k),C1}return N.prototype.next=function(k,b,s,D1){this.childrenNext(k,b,s,D1)},N}(U),kp=function(w){D(N,w);function N(k,b,s,D1){var C1=w.call(this,k,b,s,k.map(function(M1){return u(M1,b,s)}),D1)||this;return C1.propop=!0,C1}return N.prototype.next=function(k,b,s,D1){this.childrenNext(k,b,s,D1)},N}(U),BE=function(w,N,k){return new P(w,N,k)},HE=function(w,N,k,b){return new d0(w,N,k,b)},qE=function(w,N,k,b){return new _3(w,N,k,b)},WE=function(w,N,k,b){return new Mp(w,N,k,b)},CE=function(w,N,k,b){return new X0(w,N,k,b)},QE=function(w,N,k,b){return new Np(w,N,k,b)},KE=function(w,N,k,b){return new GE(w,N,k,b)},EE=x(function(w){return function(N){return N!=null&&N<w}}),UE=x(function(w){return function(N){return N===w||N<=w}}),zE=x(function(w){return function(N){return N!=null&&N>w}}),VE=x(function(w){return function(N){return N===w||N>=w}}),LE=function(w,N,k){var b=w[0],s=w[1];return new P(function(D1){return X(D1)%b===s},N,k)},RE=function(w,N,k,b){return new jp(w,N,k,b)},wE=function(w,N,k){return new P(new RegExp(w,N.$options),N,k)},PE=function(w,N,k,b){return new c0(w,N,k,b)},IE={number:function(w){return typeof w==="number"},string:function(w){return typeof w==="string"},bool:function(w){return typeof w==="boolean"},array:function(w){return Array.isArray(w)},null:function(w){return w===null},timestamp:function(w){return w instanceof Date}},ME=function(w,N,k){return new P(function(b){if(typeof w==="string"){if(!IE[w])throw new Error("Type alias does not exist");return IE[w](b)}return b!=null?b instanceof w||b.constructor===w:!1},N,k)},NE=function(w,N,k,b){return new Tp(w,N,k,b)},jE=function(w,N,k,b){return new kp(w,N,k,b)},TE=function(w,N,k){return new M2(w,N,k,"$size")},kE=function(){return null},OE=function(w,N,k){var b;if(B(w))b=w;else if(!process.env.CSP_ENABLED)b=new Function("obj","return "+w);else throw new Error('In CSP mode, sift does not support strings in "$where" condition');return new P(function(s){return b.bind(s)(s)},N,k)},Op=Object.freeze({__proto__:null,$Size:M2,$all:jE,$and:NE,$elemMatch:CE,$eq:BE,$exists:RE,$gt:zE,$gte:VE,$in:KE,$lt:EE,$lte:UE,$mod:LE,$ne:HE,$nin:QE,$nor:WE,$not:PE,$options:kE,$or:qE,$regex:wE,$size:TE,$type:ME,$where:OE}),SE=function(w,N,k){var b=k===void 0?{}:k,s=b.compare,D1=b.operations;return u(w,N,{compare:s,operations:Object.assign({},Op,D1||{})})},Sp=function(w,N){if(N===void 0)N={};var k=SE(w,null,N);return r(k)};F.$Size=M2,F.$all=jE,F.$and=NE,F.$elemMatch=CE,F.$eq=BE,F.$exists=RE,F.$gt=zE,F.$gte=VE,F.$in=KE,F.$lt=EE,F.$lte=UE,F.$mod=LE,F.$ne=HE,F.$nin=QE,F.$nor=WE,F.$not=PE,F.$options=kE,F.$or=qE,F.$regex=wE,F.$size=TE,F.$type=ME,F.$where=OE,F.EqualsOperation=P,F.createDefaultQueryOperation=SE,F.createEqualsOperation=I,F.createOperationTester=r,F.createQueryOperation=u,F.createQueryTester=J0,F.default=Sp,Object.defineProperty(F,"__esModule",{value:!0})})});var uc=E((CS1,uK)=>{var _c=Sc();uK.exports=_c.default;Object.assign(uK.exports,_c)});var hc=E((QS1,bc)=>{var az1=TJ(),nz1=_X(),sz1=Tc(),gX=L0(),rz1=_K(),yc=TA(),xc=PJ(),tz1=NW(),xK=z6(),gc=uc().default,fX=q1(),{populateModelSymbol:oz1}=A1();bc.exports=function F(A){let D=Object.assign({},gX(A,"allOptions.options.options"),gX(A,"allOptions.options")),Z=Object.assign({},A.options,D,{justOne:A.justOne,isVirtual:A.isVirtual});Z.$nullIfNotFound=A.isVirtual;let J=A.populatedModel,X=[].concat(A.rawIds);A.allIds=[].concat(A.allIds),sz1(A.rawIds,A.rawDocs,A.rawOrder,Z);let{docs:$,rawIds:G,options:Y}=A,B=A.count&&A.isVirtual,H,q=0;function W(C){if(++q,B)return C;if(C instanceof nz1)return C.val;if(C===void 0)return C;let Q=A.allIds[H];if(A.path.endsWith(".$*"))return kA(C,Y,Z,Q);if(A.justOne===!0&&Array.isArray(C)){let K=[];for(let U of C){let z=yc.get(U);if(z==null||z===J)K.push(U)}while(C.length>K.length)Array.prototype.pop.apply(C,[]);for(let U=0;U<K.length;++U)C[U]=K[U];return kA(C[0],Y,Z,Q)}else if(A.justOne===!1&&!Array.isArray(C))return kA([C],Y,Z,Q);else if(A.justOne===!0&&!Array.isArray(C)&&Array.isArray(Q))return kA(C,Y,Z,C==null?C:Q[q-1]);return kA(C,Y,Z,Q)}for(H=0;H<$.length;++H){q=0;let C=A.path.endsWith(".$*")?A.path.slice(0,-3):A.path,Q=xK.get(C,$[H],xc);if(Q==null&&!rz1(A.originalModel.schema,C))continue;let K;if(B)K=ez1(G[H]);else if(Array.isArray(A.match))K=Array.isArray(G[H])?G[H].filter((I)=>I==null||gc(A.match[H])(I)):[G[H]].filter((I)=>I==null||gc(A.match[H])(I))[0];else K=G[H];let U=A.originalModel.schema,z=gX($[H],"$__",null)!=null,L=z?Q instanceof Map:fX.isPOJO(Q);if(L=L&&gX(U._getSchema(C),"$isSchemaMap"),!A.isVirtual&&L){let I=Q instanceof Map?Array.from(Q.keys()):Object.keys(Q);K=K.reduce((M,x,_)=>{return M.set(I[_],x),M},new Map)}if(z&&Array.isArray(K)){for(let I of K)if(I!=null&&I.$__!=null)I.$__.parent=$[H]}else if(z&&K!=null&&K.$__!=null)K.$__.parent=$[H];if(A.isVirtual&&z){if($[H].$populated(C,A.justOne?X[0]:X,A.allOptions),Array.isArray(K))K=K.map((I)=>I==null?void 0:I);xK.set(C,K,$[H],void 0,W,!1);continue}let V=C.split("."),P=$[H];for(let I=0;I<V.length-1;++I){if(Array.isArray(P)&&!fX.isArrayIndex(V[I]))break;if(V[I]==="$*")break;if(P[V[I]]==null){let M=V.slice(0,I+1).join("."),x=U._getSchema(M);if(K==null&&x!=null&&x.$isMongooseArray)break;P[V[I]]={}}if(P=P[V[I]],typeof P!=="object")break}if($[H].$__){if(A.allOptions.options[oz1]=A.allOptions.model,$[H].$populated(C,A.unpopulatedValues[H],A.allOptions.options),K!=null&&K.$__!=null)K.$__.wasPopulated={value:A.unpopulatedValues[H]};if(K instanceof Map&&!K.$isMongooseMap)K=new az1(K,C,$[H],$[H].schema.path(C).$__schemaType)}if(xK.set(C,K,$[H],xc,W,!1),$[H].$__)tz1($[H],[A.allOptions.options])}};function ez1(F){if(Array.isArray(F)){if(F.some((A)=>Array.isArray(A)||A===null))return F.map((A)=>{if(A==null)return 0;if(Array.isArray(A))return A.filter((D)=>D!=null).length;return 1});return F.filter((A)=>A!=null).length}return F==null?0:1}function kA(F,A,D,Z){let J=typeof D.transform==="function",X=J?D.transform:($)=>$;if(Array.isArray(F)){let $=[],G=F.length;for(let H=0;H<G;++H){let q=F[H],W=Array.isArray(Z)?Z[H]:Z;if(!gK(q)&&(!D.retainNullValues||q!=null)&&!J)continue;else if(!D.retainNullValues&&q==null)continue;else if(J)q=X(gK(q)?q:null,W);if(fc(q,A),$.push(q),A.originalLimit&&$.length>=A.originalLimit)break}let Y=$.length;while(F.length>Y)Array.prototype.pop.apply(F,[]);let B=0;if(fX.isMongooseArray(F))for(B=0;B<Y;++B)F.set(B,$[B],!0);else for(B=0;B<Y;++B)F[B]=$[B];return F}if(gK(F)||fX.isPOJO(F))return fc(F,A),X(F,Z);if(F instanceof Map)return F;if(D.justOne===!1)return[];return F==null?X(F,Z):X(null,Z)}function fc(F,A){if(F!=null&&A.excludeId)if(typeof F.$__setValue==="function")delete F._doc._id;else delete F._id}function gK(F){if(F==null)return!1;return Array.isArray(F)||F.$isMongooseMap||F.$__!=null||yc.has(F)}});var cc=E((KS1,dc)=>{var FV1=_X(),AV1=TW(),{trusted:yX}=w8(),vc=IX();dc.exports=function F(A,D,Z,J,X){let $=DV1(D);if(Z.size===1){let G=Array.from(Z)[0],Y=J.schema.path(G);if(G!=="_id"||!$._id)A=mc(A,Y,X),$[G]=yX({$in:A});else if(G==="_id"&&$._id){let H=vc($[G])?$[G]:{$eq:$[G]};$[G]={...yX({$in:A}),...H}}let B=AV1(G);for(let H=0;H<B.length-1;++H){let q=B[H];if($[q]!=null&&$[q].$elemMatch!=null){$[q].$elemMatch[G.slice(q.length+1)]=yX({$in:A}),delete $[G];break}}}else{let G=[];if(Array.isArray($.$or))$.$and=[{$or:$.$or},{$or:G}],delete $.$or;else $.$or=G;for(let Y of Z)if(Y!=="_id"||!$._id){let B=J.schema.path(Y);A=mc(A,B,X),G.push({[Y]:{$in:A}})}else if(Y==="_id"&&$._id){let B=vc($[Y])?$[Y]:{$eq:$[Y]};$[Y]={...yX({$in:A}),...B}}}return $};function mc(F,A,D){if(F=F.filter((Z)=>!(Z instanceof FV1)),!D)return F;return F.filter((Z)=>{try{return A.cast(Z),!0}catch(J){return!1}})}function DV1(F){if(Array.isArray(F)){if(F.length>1)return{$or:[].concat(F.map((A)=>Object.assign({},A)))};return Object.assign({},F[0])}return Object.assign({},F)}});var ac=E((ES1,ic)=>{/*!
855
855
  * ignore
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fnlb-project/database",
3
3
  "description": "FNLB Database Client",
4
- "version": "1.0.27",
4
+ "version": "1.0.28",
5
5
  "private": false,
6
6
  "type": "module",
7
7
  "main": "dist/index.js",
@@ -19,13 +19,13 @@
19
19
  "author": "FNLB-Project",
20
20
  "files": ["dist"],
21
21
  "dependencies": {
22
- "@fnlb-project/shared": "^1.5.33",
23
- "mongoose": "^8.13.0"
22
+ "@fnlb-project/shared": "^1.5.38",
23
+ "mongoose": "^8.13.2"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@biomejs/biome": "^1.9.4",
27
27
  "@types/bun": "1.2.4",
28
28
  "bun-plugin-dts": "^0.3.0",
29
- "typescript": "^5.8.2"
29
+ "typescript": "^5.8.3"
30
30
  }
31
31
  }