├── .github └── workflows │ └── test.yml ├── .gitignore ├── CHANGELOG.md ├── LICENSE ├── Makefile ├── README.md ├── index.js ├── package-lock.json ├── package.json └── test └── index.js /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: Test 2 | on: 3 | pull_request: 4 | push: 5 | jobs: 6 | test: 7 | runs-on: ${{ matrix.os }} 8 | strategy: 9 | fail-fast: false 10 | matrix: 11 | os: [ubuntu-20.04, ubuntu-22.04] 12 | node: [16, 18, 20] 13 | mongodb-version: ['4.4.18', '5.0.14', '6.0.4'] 14 | name: Node ${{ matrix.node }} MongoDB ${{ matrix.mongodb-version }} 15 | steps: 16 | - name: Git checkout 17 | uses: actions/checkout@v2 18 | 19 | - name: Use Node.js ${{ matrix.node-version }} 20 | uses: actions/setup-node@v1 21 | with: 22 | node-version: ${{ matrix.node-version }} 23 | 24 | - name: Start MongoDB 25 | uses: supercharge/mongodb-github-action@1.6.0 26 | with: 27 | mongodb-version: ${{ matrix.mongodb-version }} 28 | 29 | - run: npm install 30 | 31 | - run: npm test 32 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | 5 | # Runtime data 6 | pids 7 | *.pid 8 | *.seed 9 | 10 | # Directory for instrumented libs generated by jscoverage/JSCover 11 | lib-cov 12 | 13 | # Coverage directory used by tools like istanbul 14 | coverage 15 | 16 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 17 | .grunt 18 | 19 | # Compiled binary addons (http://nodejs.org/api/addons.html) 20 | build/Release 21 | 22 | # Dependency directory 23 | # Deployed apps should consider commenting this line out: 24 | # see https://npmjs.org/doc/faq.html#Should-I-check-my-node_modules-folder-into-git 25 | node_modules 26 | 27 | # IDE 28 | .idea 29 | 30 | # OSX 31 | .DS_Store 32 | 33 | .nyc_output 34 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## [v1.0.2] 2 | > February 5, 2024 3 | - Update `devDependencies` to `"mongoose": "^8.1.1"` 4 | - `peerDependencies` for `mongoose` set to `"5.x || 6.x || 7.x || 8.x"` ([RajatJain4061](https://github.com/RajatJain4061)) [#148](https://github.com/dsanel/mongoose-delete/pull/148) 5 | - fix test: count() -> should return 3 documents 6 | 7 | 8 | ## [v1.0.1] 9 | > June 13, 2023 10 | - fix: aggregateWithDeleted returns no result with Discriminators #130 11 | - Update `devDependencies` to `"mongoose": "^7.2.4"` 12 | 13 | ## [v1.0.0] 14 | > June 12, 2023 15 | 16 | - **BREAKING CHANGE**: remove support for Mongoose 4.x 17 | - Upgrade all test to support mongoose 5, 6, 7 18 | - Refactor all tests to use async/await, remove callbacks [ 19 | Emanuel Canavesio](https://github.com/ecanavesio) 20 | - Update version of mongoose, mocha, chai in `devDependencies` [ 21 | Emanuel Canavesio](https://github.com/ecanavesio) 22 | - `peerDependencies` for `mongoose` set to `"5.x || 6.x || 7.x"` 23 | - Setup GitHub action for tests 24 | - OS: `ubuntu-20.04`, `ubuntu-22.04` 25 | - Node: `14`, `16`, `18` 26 | - MongoDB: `4.4.18`, `5.0.14`, `6.0.4` 27 | - Add validateBeforeRestore option [AnthonyNabil](https://github.com/AnthonyNabil) 28 | - Fixed Static Restore does not remove deletedAt and deletedBy [benny1hk](https://github.com/benny1hk) 29 | 30 | ## [v0.5.4] 31 | > August 31, 2021 32 | 33 | - Upgrade all test to support mongoose 5.x and 6.x 34 | - Stop using TravicCI as test runner 35 | - Setup GitHub action for tests 36 | - Node: 12, 14, 16 37 | - MongoDB: 4.0, 4.2, 4.4 38 | - Upgrade Mongoose ^6 in `devDependencies` 39 | - Add Mongoose 6 into `peerDependencies` #105 (@Paso) 40 | 41 | ## [v0.5.3] 42 | > November 19, 2020 43 | 44 | - Add option to `populate` deleted documents #40 (@sven) 45 | - Update documentation for `aggregate` (@Jericho1060) 46 | - Update `mocha` -> `8.x` 47 | - fix: deprecation warning for collection.update when user overrides update method #81 #78 (@nsine) 48 | - fix: `nyc` moved into `devDependencies` #80 (@isikhi) 49 | 50 | ## [v0.5.2] 51 | > April 1, 2020 52 | 53 | - Add option to override `aggregate` (@shimonbrandsdorfer) 54 | - Upgrade all `devDependencies` to latest versions 55 | - Remove Istanbul coverage tool 56 | 57 | 58 | ## [v0.5.1] 59 | > September 3, 2019 60 | 61 | - Add option to disable use of `$ne` operator using `{use$neOperator: false}` (@bdelville, @gabzim) #50 62 | - Fix Mongoose DeprecationWarning: collection.update is deprecated (@cardimajs, @jebarjonet) 63 | - Upgrade all `devDependencies` to latest versions 64 | - Fix security vulnerabilities in dependencies 65 | - Add additional tests for `updateMany`, `countDocuments`, `use$neOperator` 66 | - Setup `.travis.yml` to test plugin on Node: 12, 11, 10, 9, 8, 7, 6, 5, 4 67 | 68 | ## [v0.5.0] 69 | > December 10, 2018 70 | 71 | - Add support to mongoose 5.x (@joelmukuthu, @gforge) 72 | - Add `deleteById` static method #16 73 | - Add `countDocuments` method with related override methods (only for v5 Mongoose) #45 74 | - Upgrade all `devDependencies` to latest versions 75 | - Setup `.travis.yml` to test plugin on Node: 10, 9, 8, 7, 6, 5, 4 76 | - Setup `.travis.yml` to use `coveralls@3.0.2` 77 | - Add additional tests 78 | 79 | ## [v0.4.0] 80 | > July 10, 2016 81 | 82 | - Add custom typeKey support #22 83 | - Add option to set custom type for deletedBy 84 | - Support instance method delete promise 85 | - Add specification about remove() to README 86 | 87 | ## [v0.3.4] 88 | > June 20, 2016 89 | 90 | - Methods override fix for existent DB #11 91 | - Option to create indexes for deleted, deletedAt, deletedBy, related to #12 92 | 93 | ## [v0.3.3] 94 | > July 1, 2016 95 | 96 | - Default delete set to `false` #10 97 | 98 | ## [v0.3.2] 99 | > April 26, 2016 100 | 101 | - Correct field name into documentation, `validateBeforeDelete` 102 | 103 | ## [v0.3.1] 104 | > April 20, 2016 105 | 106 | - Add option to disable validation on delete #6 107 | 108 | ## [v0.3.0] 109 | > Mar 11, 2016 110 | 111 | - Bulk delete and restore 112 | - Remove requirement for callback in delete() and restore() 113 | 114 | ## [v0.2.1] 115 | > Feb 1, 2016 116 | 117 | - Add option to override static model methods (`count`, `find`, `findOne`, `findOneAndUpdate`, `update`) 118 | - Add additional methods for overridden static methods: 119 | 120 | | only not deleted documents | only deleted documents | all documents | 121 | |----------------------------|-------------------------|-----------------------------| 122 | | count() | countDeleted | countWithDeleted | 123 | | find() | findDeleted | findWithDeleted | 124 | | findOne() | findOneDeleted | findOneWithDeleted | 125 | | findOneAndUpdate() | findOneAndUpdateDeleted | findOneAndUpdateWithDeleted | 126 | | update() | updateDeleted | updateWithDeleted | 127 | 128 | 129 | 130 | ## [v0.1.1] 131 | > Aug 1, 2014 132 | 133 | - Initial version 134 | - Add `deleted` (true-false) key on document 135 | - Add `deletedAt` key to store time of deletion 136 | - Add `deletedBy` key to record who deleted document 137 | - Restore deleted documents, `restore()` method 138 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Sanel Deljkic 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | ./node_modules/.bin/mocha --reporter spec 3 | 4 | .PHONY: test 5 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Mongoose Delete Plugin 2 | ========= 3 | 4 | mongoose-delete is simple and lightweight plugin that enables soft deletion of documents in MongoDB. This code is based on [riyadhalnur's](https://github.com/riyadhalnur) plugin [mongoose-softdelete](https://github.com/riyadhalnur/mongoose-softdelete). 5 | 6 | [![Build Status](https://github.com/dsanel/mongoose-delete/workflows/Test/badge.svg)](https://github.com/dsanel/mongoose-delete/actions/workflows/test.yml) 7 | 8 | ## Features 9 | - [Add __delete()__ method on document (do not override standard __remove()__ method)](#simple-usage) 10 | - [Add __deleteById()__ static method](#simple-usage) 11 | - [Add __deleted__ (true-false) key on document](#simple-usage) 12 | - [Add __deletedAt__ key to store time of deletion](#save-time-of-deletion) 13 | - [Add __deletedBy__ key to record who deleted document](#who-has-deleted-the-data) 14 | - Restore deleted documents using __restore__ method 15 | - [Bulk delete and restore](#bulk-delete-and-restore) 16 | - [Option to override static methods](#examples-how-to-override-one-or-multiple-methods) (__count, countDocuments, find, findOne, findOneAndUpdate, update, updateOne, updateMany__) 17 | - [For overridden methods we have two additional methods](#method-overridden): __methodDeleted__ and __methodWithDeleted__ 18 | - [Disable model validation on delete](#disable-model-validation-on-delete) 19 | - [Disable model validation on restore](#disable-model-validation-on-restore) 20 | - [Option to create index on delete fields](#create-index-on-fields) (__deleted__, __deletedAt__, __deletedBy__) 21 | - Option to disable use of `$ne` operator using `{use$neOperator: false}`. Before you start to use this option please check [#50](https://github.com/dsanel/mongoose-delete/issues/50). 22 | - Option to override **aggregate**. 23 | - Option to **populate** with deleted documents (`{ withDeleted: true }`) 24 | 25 | ## Installation 26 | Install using [npm](https://npmjs.org) 27 | ``` 28 | npm install mongoose-delete 29 | ``` 30 | ## TypeScript support 31 | 32 | The plugin currently does not have its own type definition. Please be free to use [@types/mongoose-delete](https://www.npmjs.com/package/@types/mongoose-delete). 33 | 34 | In doing so, you should make use of the `SoftDeleteModel` type, instead of the `Model` type. 35 | 36 | ```typescript 37 | import { Schema, model, connect } from 'mongoose'; 38 | import { SoftDeleteModel }, MongooseDelete from 'mongoose-delete'; 39 | 40 | interface Pet extends SoftDeleteDocument { 41 | name: string; 42 | } 43 | 44 | const PetSchema = new Schema({ 45 | name: String 46 | }); 47 | 48 | PetSchema.plugin(MongooseDelete, { deletedBy: true, deletedByType: String }); 49 | 50 | const model: SoftDeleteModel = model('Pet', PetSchema); 51 | 52 | export default model; 53 | ``` 54 | 55 | ## Usage 56 | 57 | We can use this plugin with or without options. 58 | 59 | ### Simple usage 60 | 61 | ```javascript 62 | var mongoose_delete = require('mongoose-delete'); 63 | 64 | var PetSchema = new Schema({ 65 | name: String 66 | }); 67 | 68 | PetSchema.plugin(mongoose_delete); 69 | 70 | var Pet = mongoose.model('Pet', PetSchema); 71 | 72 | var fluffy = new Pet({ name: 'Fluffy' }); 73 | 74 | fluffy.save(function () { 75 | // mongodb: { deleted: false, name: 'Fluffy' } 76 | 77 | // note: you should invoke exactly delete() method instead of standard fluffy.remove() 78 | fluffy.delete(function () { 79 | // mongodb: { deleted: true, name: 'Fluffy' } 80 | 81 | fluffy.restore(function () { 82 | // mongodb: { deleted: false, name: 'Fluffy' } 83 | }); 84 | }); 85 | 86 | }); 87 | 88 | var examplePetId = mongoose.Types.ObjectId("53da93b16b4a6670076b16bf"); 89 | 90 | // INFO: Example usage of deleteById static method 91 | Pet.deleteById(examplePetId, function (err, petDocument) { 92 | // mongodb: { deleted: true, name: 'Fluffy', _id: '53da93b1...' } 93 | }); 94 | 95 | ``` 96 | 97 | 98 | ### Save time of deletion 99 | 100 | ```javascript 101 | var mongoose_delete = require('mongoose-delete'); 102 | 103 | var PetSchema = new Schema({ 104 | name: String 105 | }); 106 | 107 | PetSchema.plugin(mongoose_delete, { deletedAt : true }); 108 | 109 | var Pet = mongoose.model('Pet', PetSchema); 110 | 111 | var fluffy = new Pet({ name: 'Fluffy' }); 112 | 113 | fluffy.save(function () { 114 | // mongodb: { deleted: false, name: 'Fluffy' } 115 | 116 | // note: you should invoke exactly delete() method instead of standard fluffy.remove() 117 | fluffy.delete(function () { 118 | // mongodb: { deleted: true, name: 'Fluffy', deletedAt: ISODate("2014-08-01T10:34:53.171Z")} 119 | 120 | fluffy.restore(function () { 121 | // mongodb: { deleted: false, name: 'Fluffy' } 122 | }); 123 | }); 124 | 125 | }); 126 | ``` 127 | 128 | 129 | ### Who has deleted the data? 130 | 131 | ```javascript 132 | var mongoose_delete = require('mongoose-delete'); 133 | 134 | var PetSchema = new Schema({ 135 | name: String 136 | }); 137 | 138 | PetSchema.plugin(mongoose_delete, { deletedBy : true }); 139 | 140 | var Pet = mongoose.model('Pet', PetSchema); 141 | 142 | var fluffy = new Pet({ name: 'Fluffy' }); 143 | 144 | fluffy.save(function () { 145 | // mongodb: { deleted: false, name: 'Fluffy' } 146 | 147 | var idUser = mongoose.Types.ObjectId("53da93b16b4a6670076b16bf"); 148 | 149 | // note: you should invoke exactly delete() method instead of standard fluffy.remove() 150 | fluffy.delete(idUser, function () { 151 | // mongodb: { deleted: true, name: 'Fluffy', deletedBy: ObjectId("53da93b16b4a6670076b16bf")} 152 | 153 | fluffy.restore(function () { 154 | // mongodb: { deleted: false, name: 'Fluffy' } 155 | }); 156 | }); 157 | 158 | }); 159 | ``` 160 | 161 | The type for `deletedBy` does not have to be `ObjectId`, you can set a custom type, such as `String`. 162 | 163 | ```javascript 164 | var mongoose_delete = require('mongoose-delete'); 165 | 166 | var PetSchema = new Schema({ 167 | name: String 168 | }); 169 | 170 | PetSchema.plugin(mongoose_delete, { deletedBy: true, deletedByType: String }); 171 | 172 | var Pet = mongoose.model('Pet', PetSchema); 173 | 174 | var fluffy = new Pet({ name: 'Fluffy' }); 175 | 176 | fluffy.save(function () { 177 | // mongodb: { deleted: false, name: 'Fluffy' } 178 | 179 | var idUser = "my-custom-user-id"; 180 | 181 | // note: you should invoke exactly delete() method instead of standard fluffy.remove() 182 | fluffy.delete(idUser, function () { 183 | // mongodb: { deleted: true, name: 'Fluffy', deletedBy: 'my-custom-user-id' } 184 | 185 | fluffy.restore(function () { 186 | // mongodb: { deleted: false, name: 'Fluffy' } 187 | }); 188 | }); 189 | }); 190 | ``` 191 | 192 | ### Bulk delete and restore 193 | 194 | ```javascript 195 | var mongoose_delete = require('mongoose-delete'); 196 | 197 | var PetSchema = new Schema({ 198 | name: String, 199 | age: Number 200 | }); 201 | 202 | PetSchema.plugin(mongoose_delete); 203 | 204 | var Pet = mongoose.model('Pet', PetSchema); 205 | 206 | var idUser = mongoose.Types.ObjectId("53da93b16b4a6670076b16bf"); 207 | 208 | // Delete multiple object, callback 209 | Pet.delete(function (err, result) { ... }); 210 | Pet.delete({age:10}, function (err, result) { ... }); 211 | Pet.delete({}, idUser, function (err, result) { ... }); 212 | Pet.delete({age:10}, idUser, function (err, result) { ... }); 213 | 214 | // Delete multiple object, promise 215 | Pet.delete().exec(function (err, result) { ... }); 216 | Pet.delete({age:10}).exec(function (err, result) { ... }); 217 | Pet.delete({}, idUser).exec(function (err, result) { ... }); 218 | Pet.delete({age:10}, idUser).exec(function (err, result) { ... }); 219 | 220 | // Restore multiple object, callback 221 | Pet.restore(function (err, result) { ... }); 222 | Pet.restore({age:10}, function (err, result) { ... }); 223 | 224 | // Restore multiple object, promise 225 | Pet.restore().exec(function (err, result) { ... }); 226 | Pet.restore({age:10}).exec(function (err, result) { ... }); 227 | ``` 228 | 229 | ### Method overridden 230 | 231 | We have the option to override all standard methods or only specific methods. Overridden methods will exclude deleted documents from results, documents that have ```deleted = true```. Every overridden method will have two additional methods, so we will be able to work with deleted documents. 232 | 233 | | only not deleted documents | only deleted documents | all documents | 234 | |----------------------------|------------------------------------|----------------------------------------| 235 | | count() | countDeleted | countWithDeleted | 236 | | countDocuments() | countDocumentsDeleted | countDocumentsWithDeleted | 237 | | find() | findDeleted | findWithDeleted | 238 | | findOne() | findOneDeleted | findOneWithDeleted | 239 | | findOneAndUpdate() | findOneAndUpdateDeleted | findOneAndUpdateWithDeleted | 240 | | update() | updateDeleted | updateWithDeleted | 241 | | updateOne() | updateOneDeleted | updateOneWithDeleted | 242 | | updateMany() | updateManyDeleted | updateManyWithDeleted | 243 | | aggregate() | aggregateDeleted | aggregateWithDeleted | 244 | | findById() | Please use findOne | Please use findOneWithDeleted | 245 | | findByIdAndUpdate() | Please use findOneAndUpdateDeleted | Please use findOneAndUpdateWithDeleted | 246 | 247 | 248 | ### Examples how to override one or multiple methods 249 | 250 | ```javascript 251 | var mongoose_delete = require('mongoose-delete'); 252 | 253 | var PetSchema = new Schema({ 254 | name: String 255 | }); 256 | 257 | // Override all methods 258 | PetSchema.plugin(mongoose_delete, { overrideMethods: 'all' }); 259 | // or 260 | PetSchema.plugin(mongoose_delete, { overrideMethods: true }); 261 | 262 | // Overide only specific methods 263 | PetSchema.plugin(mongoose_delete, { overrideMethods: ['count', 'find', 'findOne', 'findOneAndUpdate', 'update'] }); 264 | // or 265 | PetSchema.plugin(mongoose_delete, { overrideMethods: ['count', 'countDocuments', 'find'] }); 266 | // or (unrecognized method names will be ignored) 267 | PetSchema.plugin(mongoose_delete, { overrideMethods: ['count', 'find', 'errorXyz'] }); 268 | 269 | 270 | var Pet = mongoose.model('Pet', PetSchema); 271 | 272 | // Example of usage overridden methods 273 | 274 | Pet.find(function (err, documents) { 275 | // will return only NOT DELETED documents 276 | }); 277 | 278 | Pet.findDeleted(function (err, documents) { 279 | // will return only DELETED documents 280 | }); 281 | 282 | Pet.findWithDeleted(function (err, documents) { 283 | // will return ALL documents 284 | }); 285 | 286 | ``` 287 | 288 | ### Disable model validation on delete 289 | 290 | ```javascript 291 | var mongoose_delete = require('mongoose-delete'); 292 | 293 | var PetSchema = new Schema({ 294 | name: { type: String, required: true } 295 | }); 296 | 297 | // By default, validateBeforeDelete is set to true 298 | PetSchema.plugin(mongoose_delete); 299 | // the previous line is identical to next line 300 | PetSchema.plugin(mongoose_delete, { validateBeforeDelete: true }); 301 | 302 | // To disable model validation on delete, set validateBeforeDelete option to false 303 | PetSchema.plugin(mongoose_delete, { validateBeforeDelete: false }); 304 | 305 | // NOTE: This is based on existing Mongoose validateBeforeSave option 306 | // http://mongoosejs.com/docs/guide.html#validateBeforeSave 307 | 308 | ``` 309 | 310 | ### Disable model validation on restore 311 | 312 | ```javascript 313 | var mongoose_delete = require('mongoose-delete'); 314 | 315 | var PetSchema = new Schema({ 316 | name: { type: String, required: true } 317 | }); 318 | 319 | // By default, validateBeforeRestore is set to true 320 | PetSchema.plugin(mongoose_delete); 321 | // the previous line is identical to next line 322 | PetSchema.plugin(mongoose_delete, { validateBeforeRestore: true }); 323 | 324 | // To disable model validation on restore, set validateBeforeRestore option to false 325 | PetSchema.plugin(mongoose_delete, { validateBeforeRestore: false }); 326 | 327 | // NOTE: This is based on existing Mongoose validateBeforeSave option 328 | // http://mongoosejs.com/docs/guide.html#validateBeforeSave 329 | ``` 330 | 331 | 332 | 333 | ### Create index on fields 334 | 335 | ```javascript 336 | var mongoose_delete = require('mongoose-delete'); 337 | 338 | var PetSchema = new Schema({ 339 | name: String 340 | }); 341 | 342 | // Index all field related to plugin (deleted, deletedAt, deletedBy) 343 | PetSchema.plugin(mongoose_delete, { indexFields: 'all' }); 344 | // or 345 | PetSchema.plugin(mongoose_delete, { indexFields: true }); 346 | 347 | // Index only specific fields 348 | PetSchema.plugin(mongoose_delete, { indexFields: ['deleted', 'deletedBy'] }); 349 | // or 350 | PetSchema.plugin(mongoose_delete, { indexFields: ['deletedAt'] }); 351 | 352 | 353 | ``` 354 | 355 | ## License 356 | 357 | The MIT License 358 | 359 | Copyright (c) 2014 Sanel Deljkic http://dsanel.github.io/ 360 | 361 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 362 | 363 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 364 | 365 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 366 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | var mongoose = require('mongoose'), 2 | Schema = mongoose.Schema, 3 | Model = mongoose.Model, 4 | util = require('util'); 5 | 6 | /** 7 | * This code is taken from official mongoose repository 8 | * https://github.com/Automattic/mongoose/blob/master/lib/query.js#L3847-L3873 9 | */ 10 | function parseUpdateArguments (conditions, doc, options, callback) { 11 | if ('function' === typeof options) { 12 | // .update(conditions, doc, callback) 13 | callback = options; 14 | options = null; 15 | } else if ('function' === typeof doc) { 16 | // .update(doc, callback); 17 | callback = doc; 18 | doc = conditions; 19 | conditions = {}; 20 | options = null; 21 | } else if ('function' === typeof conditions) { 22 | // .update(callback) 23 | callback = conditions; 24 | conditions = undefined; 25 | doc = undefined; 26 | options = undefined; 27 | } else if (typeof conditions === 'object' && !doc && !options && !callback) { 28 | // .update(doc) 29 | doc = conditions; 30 | conditions = undefined; 31 | options = undefined; 32 | callback = undefined; 33 | } 34 | 35 | var args = []; 36 | 37 | if (conditions) args.push(conditions); 38 | if (doc) args.push(doc); 39 | if (options) args.push(options); 40 | if (callback) args.push(callback); 41 | 42 | return args; 43 | } 44 | 45 | function parseIndexFields (options) { 46 | var indexFields = { 47 | deleted: false, 48 | deletedAt: false, 49 | deletedBy: false 50 | }; 51 | 52 | if (!options.indexFields) { 53 | return indexFields; 54 | } 55 | 56 | if ((typeof options.indexFields === 'string' || options.indexFields instanceof String) && options.indexFields === 'all') { 57 | indexFields.deleted = indexFields.deletedAt = indexFields.deletedBy = true; 58 | } 59 | 60 | if (typeof(options.indexFields) === "boolean" && options.indexFields === true) { 61 | indexFields.deleted = indexFields.deletedAt = indexFields.deletedBy = true; 62 | } 63 | 64 | if (Array.isArray(options.indexFields)) { 65 | indexFields.deleted = options.indexFields.indexOf('deleted') > -1; 66 | indexFields.deletedAt = options.indexFields.indexOf('deletedAt') > -1; 67 | indexFields.deletedBy = options.indexFields.indexOf('deletedBy') > -1; 68 | } 69 | 70 | return indexFields; 71 | } 72 | 73 | function createSchemaObject (typeKey, typeValue, options) { 74 | options[typeKey] = typeValue; 75 | return options; 76 | } 77 | 78 | module.exports = function (schema, options) { 79 | options = options || {}; 80 | var indexFields = parseIndexFields(options); 81 | 82 | var typeKey = schema.options.typeKey; 83 | var mongooseMajorVersion = +mongoose.version[0]; // 4, 5... 84 | var mainUpdateMethod = mongooseMajorVersion < 5 ? 'update' : 'updateMany'; 85 | var mainUpdateWithDeletedMethod = mainUpdateMethod + 'WithDeleted'; 86 | 87 | function updateDocumentsByQuery(schema, conditions, updateQuery, callback) { 88 | if (schema[mainUpdateWithDeletedMethod]) { 89 | return schema[mainUpdateWithDeletedMethod](conditions, updateQuery, { multi: true }, callback); 90 | } else { 91 | return schema[mainUpdateMethod](conditions, updateQuery, { multi: true }, callback); 92 | } 93 | } 94 | 95 | schema.add({ deleted: createSchemaObject(typeKey, Boolean, { default: false, index: indexFields.deleted }) }); 96 | 97 | if (options.deletedAt === true) { 98 | schema.add({ deletedAt: createSchemaObject(typeKey, Date, { index: indexFields.deletedAt }) }); 99 | } 100 | 101 | if (options.deletedBy === true) { 102 | schema.add({ deletedBy: createSchemaObject(typeKey, options.deletedByType || Schema.Types.ObjectId, { index: indexFields.deletedBy }) }); 103 | } 104 | 105 | var use$neOperator = true; 106 | if (options.use$neOperator !== undefined && typeof options.use$neOperator === "boolean") { 107 | use$neOperator = options.use$neOperator; 108 | } 109 | 110 | schema.pre('save', function (next) { 111 | if (!this.deleted) { 112 | this.deleted = false; 113 | } 114 | next(); 115 | }); 116 | 117 | if (options.overrideMethods) { 118 | var overrideItems = options.overrideMethods; 119 | var overridableMethods = ['count', 'countDocuments', 'find', 'findOne', 'findOneAndUpdate', 'update', 'updateOne', 'updateMany', 'aggregate']; 120 | var finalList = []; 121 | 122 | if ((typeof overrideItems === 'string' || overrideItems instanceof String) && overrideItems === 'all') { 123 | finalList = overridableMethods; 124 | } 125 | 126 | if (typeof(overrideItems) === "boolean" && overrideItems === true) { 127 | finalList = overridableMethods; 128 | } 129 | 130 | if (Array.isArray(overrideItems)) { 131 | overrideItems.forEach(function(method) { 132 | if (overridableMethods.indexOf(method) > -1) { 133 | finalList.push(method); 134 | } 135 | }); 136 | } 137 | 138 | if (finalList.indexOf('aggregate') > -1) { 139 | schema.pre('aggregate', function() { 140 | var firstMatch = this.pipeline()[0]; 141 | 142 | if(firstMatch.$match?.deleted?.$ne !== false){ 143 | if(firstMatch.$match?.showAllDocuments === 'true'){ 144 | var {showAllDocuments, ...replacement} = firstMatch.$match; 145 | this.pipeline().shift(); 146 | if(Object.keys(replacement).length > 0){ 147 | this.pipeline().unshift({ $match: replacement }); 148 | } 149 | }else{ 150 | this.pipeline().unshift({ $match: { deleted: { '$ne': true } } }); 151 | } 152 | } 153 | }); 154 | } 155 | 156 | finalList.forEach(function(method) { 157 | if (['count', 'countDocuments', 'find', 'findOne'].indexOf(method) > -1) { 158 | var modelMethodName = method; 159 | 160 | schema.statics[method] = function () { 161 | var query = Model[modelMethodName].apply(this, arguments); 162 | if (!arguments[2] || arguments[2].withDeleted !== true) { 163 | if (use$neOperator) { 164 | query.where('deleted').ne(true); 165 | } else { 166 | query.where({deleted: false}); 167 | } 168 | } 169 | return query; 170 | }; 171 | schema.statics[method + 'Deleted'] = function () { 172 | if (use$neOperator) { 173 | return Model[modelMethodName].apply(this, arguments).where('deleted').ne(false); 174 | } else { 175 | return Model[modelMethodName].apply(this, arguments).where({deleted: true}); 176 | } 177 | }; 178 | schema.statics[method + 'WithDeleted'] = function () { 179 | return Model[modelMethodName].apply(this, arguments); 180 | }; 181 | } else { 182 | if (method === 'aggregate') { 183 | schema.statics[method + 'Deleted'] = function () { 184 | var args = []; 185 | Array.prototype.push.apply(args, arguments); 186 | var match = { $match : { deleted : {'$ne': false } } }; 187 | arguments.length ? args[0].unshift(match) : args.push([match]); 188 | return Model[method].apply(this, args); 189 | }; 190 | 191 | schema.statics[method + 'WithDeleted'] = function () { 192 | var args = []; 193 | Array.prototype.push.apply(args, arguments); 194 | var match = { $match : { showAllDocuments : 'true' } }; 195 | arguments.length ? args[0].unshift(match) : args.push([match]); 196 | return Model[method].apply(this, args); 197 | }; 198 | } else { 199 | schema.statics[method] = function () { 200 | var args = parseUpdateArguments.apply(undefined, arguments); 201 | 202 | if (use$neOperator) { 203 | args[0].deleted = {'$ne': true}; 204 | } else { 205 | args[0].deleted = false; 206 | } 207 | 208 | return Model[method].apply(this, args); 209 | }; 210 | 211 | schema.statics[method + 'Deleted'] = function () { 212 | var args = parseUpdateArguments.apply(undefined, arguments); 213 | 214 | if (use$neOperator) { 215 | args[0].deleted = {'$ne': false}; 216 | } else { 217 | args[0].deleted = true; 218 | } 219 | 220 | return Model[method].apply(this, args); 221 | }; 222 | 223 | schema.statics[method + 'WithDeleted'] = function () { 224 | return Model[method].apply(this, arguments); 225 | }; 226 | } 227 | } 228 | }); 229 | } 230 | 231 | schema.methods.delete = function (deletedBy, cb) { 232 | if (typeof deletedBy === 'function') { 233 | cb = deletedBy; 234 | deletedBy = null; 235 | } 236 | 237 | this.deleted = true; 238 | 239 | if (schema.path('deletedAt')) { 240 | this.deletedAt = new Date(); 241 | } 242 | 243 | if (schema.path('deletedBy')) { 244 | this.deletedBy = deletedBy; 245 | } 246 | 247 | if (options.validateBeforeDelete === false) { 248 | return this.save({ validateBeforeSave: false }, cb); 249 | } 250 | 251 | return this.save(cb); 252 | }; 253 | 254 | schema.statics.delete = function (conditions, deletedBy, callback) { 255 | if (typeof deletedBy === 'function') { 256 | callback = deletedBy; 257 | conditions = conditions; 258 | deletedBy = null; 259 | } else if (typeof conditions === 'function') { 260 | callback = conditions; 261 | conditions = {}; 262 | deletedBy = null; 263 | } 264 | 265 | var doc = { 266 | deleted: true 267 | }; 268 | 269 | if (schema.path('deletedAt')) { 270 | doc.deletedAt = new Date(); 271 | } 272 | 273 | if (schema.path('deletedBy')) { 274 | doc.deletedBy = deletedBy; 275 | } 276 | 277 | return updateDocumentsByQuery(this, conditions, doc, callback); 278 | }; 279 | 280 | schema.statics.deleteById = function (id, deletedBy, callback) { 281 | if (arguments.length === 0 || typeof id === 'function') { 282 | var msg = 'First argument is mandatory and must not be a function.'; 283 | throw new TypeError(msg); 284 | } 285 | 286 | var conditions = { 287 | _id: id 288 | }; 289 | 290 | return this.delete(conditions, deletedBy, callback); 291 | }; 292 | 293 | schema.methods.restore = function (callback) { 294 | this.deleted = false; 295 | this.deletedAt = undefined; 296 | this.deletedBy = undefined; 297 | 298 | if (options.validateBeforeRestore === false) { 299 | return this.save({ validateBeforeSave: false }, callback); 300 | } 301 | 302 | return this.save(callback); 303 | }; 304 | 305 | schema.statics.restore = function (conditions, callback) { 306 | if (typeof conditions === 'function') { 307 | callback = conditions; 308 | conditions = {}; 309 | } 310 | 311 | var doc = { 312 | $unset:{ 313 | deleted: true, 314 | deletedAt: true, 315 | deletedBy: true 316 | } 317 | }; 318 | 319 | return updateDocumentsByQuery(this, conditions, doc, callback); 320 | }; 321 | }; 322 | -------------------------------------------------------------------------------- /package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mongoose-delete", 3 | "version": "1.0.2", 4 | "lockfileVersion": 3, 5 | "requires": true, 6 | "packages": { 7 | "": { 8 | "name": "mongoose-delete", 9 | "version": "1.0.2", 10 | "license": "MIT", 11 | "devDependencies": { 12 | "chai": "^4.3.7", 13 | "mocha": "^10.2.0", 14 | "mongoose": "^8.1.1", 15 | "nyc": "^15.0.0" 16 | }, 17 | "peerDependencies": { 18 | "mongoose": "5.x || 6.x || 7.x || 8.x" 19 | } 20 | }, 21 | "node_modules/@babel/code-frame": { 22 | "version": "7.23.5", 23 | "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.23.5.tgz", 24 | "integrity": "sha512-CgH3s1a96LipHCmSUmYFPwY7MNx8C3avkq7i4Wl3cfa662ldtUe4VM1TPXX70pfmrlWTb6jLqTYrZyT2ZTJBgA==", 25 | "dev": true, 26 | "dependencies": { 27 | "@babel/highlight": "^7.23.4", 28 | "chalk": "^2.4.2" 29 | }, 30 | "engines": { 31 | "node": ">=6.9.0" 32 | } 33 | }, 34 | "node_modules/@babel/code-frame/node_modules/ansi-styles": { 35 | "version": "3.2.1", 36 | "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", 37 | "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", 38 | "dev": true, 39 | "dependencies": { 40 | "color-convert": "^1.9.0" 41 | }, 42 | "engines": { 43 | "node": ">=4" 44 | } 45 | }, 46 | "node_modules/@babel/code-frame/node_modules/chalk": { 47 | "version": "2.4.2", 48 | "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", 49 | "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", 50 | "dev": true, 51 | "dependencies": { 52 | "ansi-styles": "^3.2.1", 53 | "escape-string-regexp": "^1.0.5", 54 | "supports-color": "^5.3.0" 55 | }, 56 | "engines": { 57 | "node": ">=4" 58 | } 59 | }, 60 | "node_modules/@babel/code-frame/node_modules/color-convert": { 61 | "version": "1.9.3", 62 | "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", 63 | "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", 64 | "dev": true, 65 | "dependencies": { 66 | "color-name": "1.1.3" 67 | } 68 | }, 69 | "node_modules/@babel/code-frame/node_modules/color-name": { 70 | "version": "1.1.3", 71 | "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", 72 | "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", 73 | "dev": true 74 | }, 75 | "node_modules/@babel/code-frame/node_modules/escape-string-regexp": { 76 | "version": "1.0.5", 77 | "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", 78 | "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", 79 | "dev": true, 80 | "engines": { 81 | "node": ">=0.8.0" 82 | } 83 | }, 84 | "node_modules/@babel/code-frame/node_modules/has-flag": { 85 | "version": "3.0.0", 86 | "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", 87 | "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", 88 | "dev": true, 89 | "engines": { 90 | "node": ">=4" 91 | } 92 | }, 93 | "node_modules/@babel/code-frame/node_modules/supports-color": { 94 | "version": "5.5.0", 95 | "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", 96 | "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", 97 | "dev": true, 98 | "dependencies": { 99 | "has-flag": "^3.0.0" 100 | }, 101 | "engines": { 102 | "node": ">=4" 103 | } 104 | }, 105 | "node_modules/@babel/core": { 106 | "version": "7.12.3", 107 | "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.12.3.tgz", 108 | "integrity": "sha512-0qXcZYKZp3/6N2jKYVxZv0aNCsxTSVCiK72DTiTYZAu7sjg73W0/aynWjMbiGd87EQL4WyA8reiJVh92AVla9g==", 109 | "dev": true, 110 | "dependencies": { 111 | "@babel/code-frame": "^7.10.4", 112 | "@babel/generator": "^7.12.1", 113 | "@babel/helper-module-transforms": "^7.12.1", 114 | "@babel/helpers": "^7.12.1", 115 | "@babel/parser": "^7.12.3", 116 | "@babel/template": "^7.10.4", 117 | "@babel/traverse": "^7.12.1", 118 | "@babel/types": "^7.12.1", 119 | "convert-source-map": "^1.7.0", 120 | "debug": "^4.1.0", 121 | "gensync": "^1.0.0-beta.1", 122 | "json5": "^2.1.2", 123 | "lodash": "^4.17.19", 124 | "resolve": "^1.3.2", 125 | "semver": "^5.4.1", 126 | "source-map": "^0.5.0" 127 | }, 128 | "engines": { 129 | "node": ">=6.9.0" 130 | }, 131 | "funding": { 132 | "type": "opencollective", 133 | "url": "https://opencollective.com/babel" 134 | } 135 | }, 136 | "node_modules/@babel/generator": { 137 | "version": "7.23.6", 138 | "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.23.6.tgz", 139 | "integrity": "sha512-qrSfCYxYQB5owCmGLbl8XRpX1ytXlpueOb0N0UmQwA073KZxejgQTzAmJezxvpwQD9uGtK2shHdi55QT+MbjIw==", 140 | "dev": true, 141 | "dependencies": { 142 | "@babel/types": "^7.23.6", 143 | "@jridgewell/gen-mapping": "^0.3.2", 144 | "@jridgewell/trace-mapping": "^0.3.17", 145 | "jsesc": "^2.5.1" 146 | }, 147 | "engines": { 148 | "node": ">=6.9.0" 149 | } 150 | }, 151 | "node_modules/@babel/helper-environment-visitor": { 152 | "version": "7.22.20", 153 | "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz", 154 | "integrity": "sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA==", 155 | "dev": true, 156 | "engines": { 157 | "node": ">=6.9.0" 158 | } 159 | }, 160 | "node_modules/@babel/helper-function-name": { 161 | "version": "7.23.0", 162 | "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.23.0.tgz", 163 | "integrity": "sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw==", 164 | "dev": true, 165 | "dependencies": { 166 | "@babel/template": "^7.22.15", 167 | "@babel/types": "^7.23.0" 168 | }, 169 | "engines": { 170 | "node": ">=6.9.0" 171 | } 172 | }, 173 | "node_modules/@babel/helper-hoist-variables": { 174 | "version": "7.22.5", 175 | "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.22.5.tgz", 176 | "integrity": "sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw==", 177 | "dev": true, 178 | "dependencies": { 179 | "@babel/types": "^7.22.5" 180 | }, 181 | "engines": { 182 | "node": ">=6.9.0" 183 | } 184 | }, 185 | "node_modules/@babel/helper-member-expression-to-functions": { 186 | "version": "7.12.1", 187 | "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.12.1.tgz", 188 | "integrity": "sha512-k0CIe3tXUKTRSoEx1LQEPFU9vRQfqHtl+kf8eNnDqb4AUJEy5pz6aIiog+YWtVm2jpggjS1laH68bPsR+KWWPQ==", 189 | "dev": true, 190 | "dependencies": { 191 | "@babel/types": "^7.12.1" 192 | } 193 | }, 194 | "node_modules/@babel/helper-module-imports": { 195 | "version": "7.12.5", 196 | "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.12.5.tgz", 197 | "integrity": "sha512-SR713Ogqg6++uexFRORf/+nPXMmWIn80TALu0uaFb+iQIUoR7bOC7zBWyzBs5b3tBBJXuyD0cRu1F15GyzjOWA==", 198 | "dev": true, 199 | "dependencies": { 200 | "@babel/types": "^7.12.5" 201 | } 202 | }, 203 | "node_modules/@babel/helper-module-transforms": { 204 | "version": "7.12.1", 205 | "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.12.1.tgz", 206 | "integrity": "sha512-QQzehgFAZ2bbISiCpmVGfiGux8YVFXQ0abBic2Envhej22DVXV9nCFaS5hIQbkyo1AdGb+gNME2TSh3hYJVV/w==", 207 | "dev": true, 208 | "dependencies": { 209 | "@babel/helper-module-imports": "^7.12.1", 210 | "@babel/helper-replace-supers": "^7.12.1", 211 | "@babel/helper-simple-access": "^7.12.1", 212 | "@babel/helper-split-export-declaration": "^7.11.0", 213 | "@babel/helper-validator-identifier": "^7.10.4", 214 | "@babel/template": "^7.10.4", 215 | "@babel/traverse": "^7.12.1", 216 | "@babel/types": "^7.12.1", 217 | "lodash": "^4.17.19" 218 | } 219 | }, 220 | "node_modules/@babel/helper-optimise-call-expression": { 221 | "version": "7.10.4", 222 | "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.10.4.tgz", 223 | "integrity": "sha512-n3UGKY4VXwXThEiKrgRAoVPBMqeoPgHVqiHZOanAJCG9nQUL2pLRQirUzl0ioKclHGpGqRgIOkgcIJaIWLpygg==", 224 | "dev": true, 225 | "dependencies": { 226 | "@babel/types": "^7.10.4" 227 | } 228 | }, 229 | "node_modules/@babel/helper-replace-supers": { 230 | "version": "7.12.5", 231 | "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.12.5.tgz", 232 | "integrity": "sha512-5YILoed0ZyIpF4gKcpZitEnXEJ9UoDRki1Ey6xz46rxOzfNMAhVIJMoune1hmPVxh40LRv1+oafz7UsWX+vyWA==", 233 | "dev": true, 234 | "dependencies": { 235 | "@babel/helper-member-expression-to-functions": "^7.12.1", 236 | "@babel/helper-optimise-call-expression": "^7.10.4", 237 | "@babel/traverse": "^7.12.5", 238 | "@babel/types": "^7.12.5" 239 | } 240 | }, 241 | "node_modules/@babel/helper-simple-access": { 242 | "version": "7.12.1", 243 | "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.12.1.tgz", 244 | "integrity": "sha512-OxBp7pMrjVewSSC8fXDFrHrBcJATOOFssZwv16F3/6Xtc138GHybBfPbm9kfiqQHKhYQrlamWILwlDCeyMFEaA==", 245 | "dev": true, 246 | "dependencies": { 247 | "@babel/types": "^7.12.1" 248 | } 249 | }, 250 | "node_modules/@babel/helper-split-export-declaration": { 251 | "version": "7.22.6", 252 | "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.22.6.tgz", 253 | "integrity": "sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g==", 254 | "dev": true, 255 | "dependencies": { 256 | "@babel/types": "^7.22.5" 257 | }, 258 | "engines": { 259 | "node": ">=6.9.0" 260 | } 261 | }, 262 | "node_modules/@babel/helper-string-parser": { 263 | "version": "7.23.4", 264 | "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.23.4.tgz", 265 | "integrity": "sha512-803gmbQdqwdf4olxrX4AJyFBV/RTr3rSmOj0rKwesmzlfhYNDEs+/iOcznzpNWlJlIlTJC2QfPFcHB6DlzdVLQ==", 266 | "dev": true, 267 | "engines": { 268 | "node": ">=6.9.0" 269 | } 270 | }, 271 | "node_modules/@babel/helper-validator-identifier": { 272 | "version": "7.22.20", 273 | "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz", 274 | "integrity": "sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==", 275 | "dev": true, 276 | "engines": { 277 | "node": ">=6.9.0" 278 | } 279 | }, 280 | "node_modules/@babel/helpers": { 281 | "version": "7.12.5", 282 | "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.12.5.tgz", 283 | "integrity": "sha512-lgKGMQlKqA8meJqKsW6rUnc4MdUk35Ln0ATDqdM1a/UpARODdI4j5Y5lVfUScnSNkJcdCRAaWkspykNoFg9sJA==", 284 | "dev": true, 285 | "dependencies": { 286 | "@babel/template": "^7.10.4", 287 | "@babel/traverse": "^7.12.5", 288 | "@babel/types": "^7.12.5" 289 | } 290 | }, 291 | "node_modules/@babel/highlight": { 292 | "version": "7.23.4", 293 | "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.23.4.tgz", 294 | "integrity": "sha512-acGdbYSfp2WheJoJm/EBBBLh/ID8KDc64ISZ9DYtBmC8/Q204PZJLHyzeB5qMzJ5trcOkybd78M4x2KWsUq++A==", 295 | "dev": true, 296 | "dependencies": { 297 | "@babel/helper-validator-identifier": "^7.22.20", 298 | "chalk": "^2.4.2", 299 | "js-tokens": "^4.0.0" 300 | }, 301 | "engines": { 302 | "node": ">=6.9.0" 303 | } 304 | }, 305 | "node_modules/@babel/highlight/node_modules/ansi-styles": { 306 | "version": "3.2.1", 307 | "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", 308 | "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", 309 | "dev": true, 310 | "dependencies": { 311 | "color-convert": "^1.9.0" 312 | }, 313 | "engines": { 314 | "node": ">=4" 315 | } 316 | }, 317 | "node_modules/@babel/highlight/node_modules/chalk": { 318 | "version": "2.4.2", 319 | "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", 320 | "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", 321 | "dev": true, 322 | "dependencies": { 323 | "ansi-styles": "^3.2.1", 324 | "escape-string-regexp": "^1.0.5", 325 | "supports-color": "^5.3.0" 326 | }, 327 | "engines": { 328 | "node": ">=4" 329 | } 330 | }, 331 | "node_modules/@babel/highlight/node_modules/color-convert": { 332 | "version": "1.9.3", 333 | "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", 334 | "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", 335 | "dev": true, 336 | "dependencies": { 337 | "color-name": "1.1.3" 338 | } 339 | }, 340 | "node_modules/@babel/highlight/node_modules/color-name": { 341 | "version": "1.1.3", 342 | "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", 343 | "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", 344 | "dev": true 345 | }, 346 | "node_modules/@babel/highlight/node_modules/escape-string-regexp": { 347 | "version": "1.0.5", 348 | "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", 349 | "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", 350 | "dev": true, 351 | "engines": { 352 | "node": ">=0.8.0" 353 | } 354 | }, 355 | "node_modules/@babel/highlight/node_modules/has-flag": { 356 | "version": "3.0.0", 357 | "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", 358 | "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", 359 | "dev": true, 360 | "engines": { 361 | "node": ">=4" 362 | } 363 | }, 364 | "node_modules/@babel/highlight/node_modules/supports-color": { 365 | "version": "5.5.0", 366 | "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", 367 | "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", 368 | "dev": true, 369 | "dependencies": { 370 | "has-flag": "^3.0.0" 371 | }, 372 | "engines": { 373 | "node": ">=4" 374 | } 375 | }, 376 | "node_modules/@babel/parser": { 377 | "version": "7.23.9", 378 | "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.23.9.tgz", 379 | "integrity": "sha512-9tcKgqKbs3xGJ+NtKF2ndOBBLVwPjl1SHxPQkd36r3Dlirw3xWUeGaTbqr7uGZcTaxkVNwc+03SVP7aCdWrTlA==", 380 | "dev": true, 381 | "bin": { 382 | "parser": "bin/babel-parser.js" 383 | }, 384 | "engines": { 385 | "node": ">=6.0.0" 386 | } 387 | }, 388 | "node_modules/@babel/template": { 389 | "version": "7.23.9", 390 | "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.23.9.tgz", 391 | "integrity": "sha512-+xrD2BWLpvHKNmX2QbpdpsBaWnRxahMwJjO+KZk2JOElj5nSmKezyS1B4u+QbHMTX69t4ukm6hh9lsYQ7GHCKA==", 392 | "dev": true, 393 | "dependencies": { 394 | "@babel/code-frame": "^7.23.5", 395 | "@babel/parser": "^7.23.9", 396 | "@babel/types": "^7.23.9" 397 | }, 398 | "engines": { 399 | "node": ">=6.9.0" 400 | } 401 | }, 402 | "node_modules/@babel/traverse": { 403 | "version": "7.23.9", 404 | "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.9.tgz", 405 | "integrity": "sha512-I/4UJ9vs90OkBtY6iiiTORVMyIhJ4kAVmsKo9KFc8UOxMeUfi2hvtIBsET5u9GizXE6/GFSuKCTNfgCswuEjRg==", 406 | "dev": true, 407 | "dependencies": { 408 | "@babel/code-frame": "^7.23.5", 409 | "@babel/generator": "^7.23.6", 410 | "@babel/helper-environment-visitor": "^7.22.20", 411 | "@babel/helper-function-name": "^7.23.0", 412 | "@babel/helper-hoist-variables": "^7.22.5", 413 | "@babel/helper-split-export-declaration": "^7.22.6", 414 | "@babel/parser": "^7.23.9", 415 | "@babel/types": "^7.23.9", 416 | "debug": "^4.3.1", 417 | "globals": "^11.1.0" 418 | }, 419 | "engines": { 420 | "node": ">=6.9.0" 421 | } 422 | }, 423 | "node_modules/@babel/types": { 424 | "version": "7.23.9", 425 | "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.9.tgz", 426 | "integrity": "sha512-dQjSq/7HaSjRM43FFGnv5keM2HsxpmyV1PfaSVm0nzzjwwTmjOe6J4bC8e3+pTEIgHaHj+1ZlLThRJ2auc/w1Q==", 427 | "dev": true, 428 | "dependencies": { 429 | "@babel/helper-string-parser": "^7.23.4", 430 | "@babel/helper-validator-identifier": "^7.22.20", 431 | "to-fast-properties": "^2.0.0" 432 | }, 433 | "engines": { 434 | "node": ">=6.9.0" 435 | } 436 | }, 437 | "node_modules/@istanbuljs/load-nyc-config": { 438 | "version": "1.1.0", 439 | "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", 440 | "integrity": "sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ==", 441 | "dev": true, 442 | "dependencies": { 443 | "camelcase": "^5.3.1", 444 | "find-up": "^4.1.0", 445 | "get-package-type": "^0.1.0", 446 | "js-yaml": "^3.13.1", 447 | "resolve-from": "^5.0.0" 448 | }, 449 | "engines": { 450 | "node": ">=8" 451 | } 452 | }, 453 | "node_modules/@istanbuljs/load-nyc-config/node_modules/find-up": { 454 | "version": "4.1.0", 455 | "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", 456 | "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", 457 | "dev": true, 458 | "dependencies": { 459 | "locate-path": "^5.0.0", 460 | "path-exists": "^4.0.0" 461 | }, 462 | "engines": { 463 | "node": ">=8" 464 | } 465 | }, 466 | "node_modules/@istanbuljs/load-nyc-config/node_modules/locate-path": { 467 | "version": "5.0.0", 468 | "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", 469 | "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", 470 | "dev": true, 471 | "dependencies": { 472 | "p-locate": "^4.1.0" 473 | }, 474 | "engines": { 475 | "node": ">=8" 476 | } 477 | }, 478 | "node_modules/@istanbuljs/load-nyc-config/node_modules/p-limit": { 479 | "version": "2.3.0", 480 | "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", 481 | "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", 482 | "dev": true, 483 | "dependencies": { 484 | "p-try": "^2.0.0" 485 | }, 486 | "engines": { 487 | "node": ">=6" 488 | }, 489 | "funding": { 490 | "url": "https://github.com/sponsors/sindresorhus" 491 | } 492 | }, 493 | "node_modules/@istanbuljs/load-nyc-config/node_modules/p-locate": { 494 | "version": "4.1.0", 495 | "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", 496 | "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", 497 | "dev": true, 498 | "dependencies": { 499 | "p-limit": "^2.2.0" 500 | }, 501 | "engines": { 502 | "node": ">=8" 503 | } 504 | }, 505 | "node_modules/@istanbuljs/load-nyc-config/node_modules/resolve-from": { 506 | "version": "5.0.0", 507 | "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", 508 | "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", 509 | "dev": true, 510 | "engines": { 511 | "node": ">=8" 512 | } 513 | }, 514 | "node_modules/@istanbuljs/schema": { 515 | "version": "0.1.2", 516 | "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.2.tgz", 517 | "integrity": "sha512-tsAQNx32a8CoFhjhijUIhI4kccIAgmGhy8LZMZgGfmXcpMbPRUqn5LWmgRttILi6yeGmBJd2xsPkFMs0PzgPCw==", 518 | "dev": true, 519 | "engines": { 520 | "node": ">=8" 521 | } 522 | }, 523 | "node_modules/@jridgewell/gen-mapping": { 524 | "version": "0.3.3", 525 | "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz", 526 | "integrity": "sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==", 527 | "dev": true, 528 | "dependencies": { 529 | "@jridgewell/set-array": "^1.0.1", 530 | "@jridgewell/sourcemap-codec": "^1.4.10", 531 | "@jridgewell/trace-mapping": "^0.3.9" 532 | }, 533 | "engines": { 534 | "node": ">=6.0.0" 535 | } 536 | }, 537 | "node_modules/@jridgewell/resolve-uri": { 538 | "version": "3.1.1", 539 | "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz", 540 | "integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==", 541 | "dev": true, 542 | "engines": { 543 | "node": ">=6.0.0" 544 | } 545 | }, 546 | "node_modules/@jridgewell/set-array": { 547 | "version": "1.1.2", 548 | "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", 549 | "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", 550 | "dev": true, 551 | "engines": { 552 | "node": ">=6.0.0" 553 | } 554 | }, 555 | "node_modules/@jridgewell/sourcemap-codec": { 556 | "version": "1.4.15", 557 | "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", 558 | "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", 559 | "dev": true 560 | }, 561 | "node_modules/@jridgewell/trace-mapping": { 562 | "version": "0.3.22", 563 | "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.22.tgz", 564 | "integrity": "sha512-Wf963MzWtA2sjrNt+g18IAln9lKnlRp+K2eH4jjIoF1wYeq3aMREpG09xhlhdzS0EjwU7qmUJYangWa+151vZw==", 565 | "dev": true, 566 | "dependencies": { 567 | "@jridgewell/resolve-uri": "^3.1.0", 568 | "@jridgewell/sourcemap-codec": "^1.4.14" 569 | } 570 | }, 571 | "node_modules/@mongodb-js/saslprep": { 572 | "version": "1.1.4", 573 | "resolved": "https://registry.npmjs.org/@mongodb-js/saslprep/-/saslprep-1.1.4.tgz", 574 | "integrity": "sha512-8zJ8N1x51xo9hwPh6AWnKdLGEC5N3lDa6kms1YHmFBoRhTpJR6HG8wWk0td1MVCu9cD4YBrvjZEtd5Obw0Fbnw==", 575 | "dev": true, 576 | "dependencies": { 577 | "sparse-bitfield": "^3.0.3" 578 | } 579 | }, 580 | "node_modules/@types/webidl-conversions": { 581 | "version": "7.0.3", 582 | "resolved": "https://registry.npmjs.org/@types/webidl-conversions/-/webidl-conversions-7.0.3.tgz", 583 | "integrity": "sha512-CiJJvcRtIgzadHCYXw7dqEnMNRjhGZlYK05Mj9OyktqV8uVT8fD2BFOB7S1uwBE3Kj2Z+4UyPmFw/Ixgw/LAlA==", 584 | "dev": true 585 | }, 586 | "node_modules/@types/whatwg-url": { 587 | "version": "11.0.4", 588 | "resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-11.0.4.tgz", 589 | "integrity": "sha512-lXCmTWSHJvf0TRSO58nm978b8HJ/EdsSsEKLd3ODHFjo+3VGAyyTp4v50nWvwtzBxSMQrVOK7tcuN0zGPLICMw==", 590 | "dev": true, 591 | "dependencies": { 592 | "@types/webidl-conversions": "*" 593 | } 594 | }, 595 | "node_modules/aggregate-error": { 596 | "version": "3.1.0", 597 | "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", 598 | "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==", 599 | "dev": true, 600 | "dependencies": { 601 | "clean-stack": "^2.0.0", 602 | "indent-string": "^4.0.0" 603 | }, 604 | "engines": { 605 | "node": ">=8" 606 | } 607 | }, 608 | "node_modules/ansi-colors": { 609 | "version": "4.1.1", 610 | "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", 611 | "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", 612 | "dev": true, 613 | "engines": { 614 | "node": ">=6" 615 | } 616 | }, 617 | "node_modules/ansi-regex": { 618 | "version": "5.0.1", 619 | "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", 620 | "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", 621 | "dev": true, 622 | "engines": { 623 | "node": ">=8" 624 | } 625 | }, 626 | "node_modules/ansi-styles": { 627 | "version": "4.3.0", 628 | "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", 629 | "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", 630 | "dev": true, 631 | "dependencies": { 632 | "color-convert": "^2.0.1" 633 | }, 634 | "engines": { 635 | "node": ">=8" 636 | }, 637 | "funding": { 638 | "url": "https://github.com/chalk/ansi-styles?sponsor=1" 639 | } 640 | }, 641 | "node_modules/anymatch": { 642 | "version": "3.1.3", 643 | "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", 644 | "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", 645 | "dev": true, 646 | "dependencies": { 647 | "normalize-path": "^3.0.0", 648 | "picomatch": "^2.0.4" 649 | }, 650 | "engines": { 651 | "node": ">= 8" 652 | } 653 | }, 654 | "node_modules/append-transform": { 655 | "version": "2.0.0", 656 | "resolved": "https://registry.npmjs.org/append-transform/-/append-transform-2.0.0.tgz", 657 | "integrity": "sha512-7yeyCEurROLQJFv5Xj4lEGTy0borxepjFv1g22oAdqFu//SrAlDl1O1Nxx15SH1RoliUml6p8dwJW9jvZughhg==", 658 | "dev": true, 659 | "dependencies": { 660 | "default-require-extensions": "^3.0.0" 661 | }, 662 | "engines": { 663 | "node": ">=8" 664 | } 665 | }, 666 | "node_modules/archy": { 667 | "version": "1.0.0", 668 | "resolved": "https://registry.npmjs.org/archy/-/archy-1.0.0.tgz", 669 | "integrity": "sha1-+cjBN1fMHde8N5rHeyxipcKGjEA=", 670 | "dev": true 671 | }, 672 | "node_modules/argparse": { 673 | "version": "1.0.10", 674 | "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", 675 | "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", 676 | "dev": true, 677 | "dependencies": { 678 | "sprintf-js": "~1.0.2" 679 | } 680 | }, 681 | "node_modules/assertion-error": { 682 | "version": "1.1.0", 683 | "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", 684 | "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", 685 | "dev": true, 686 | "engines": { 687 | "node": "*" 688 | } 689 | }, 690 | "node_modules/balanced-match": { 691 | "version": "1.0.0", 692 | "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", 693 | "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", 694 | "dev": true 695 | }, 696 | "node_modules/binary-extensions": { 697 | "version": "2.2.0", 698 | "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", 699 | "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", 700 | "dev": true, 701 | "engines": { 702 | "node": ">=8" 703 | } 704 | }, 705 | "node_modules/brace-expansion": { 706 | "version": "1.1.11", 707 | "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", 708 | "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", 709 | "dev": true, 710 | "dependencies": { 711 | "balanced-match": "^1.0.0", 712 | "concat-map": "0.0.1" 713 | } 714 | }, 715 | "node_modules/braces": { 716 | "version": "3.0.2", 717 | "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", 718 | "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", 719 | "dev": true, 720 | "dependencies": { 721 | "fill-range": "^7.0.1" 722 | }, 723 | "engines": { 724 | "node": ">=8" 725 | } 726 | }, 727 | "node_modules/browser-stdout": { 728 | "version": "1.3.1", 729 | "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", 730 | "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", 731 | "dev": true 732 | }, 733 | "node_modules/bson": { 734 | "version": "6.3.0", 735 | "resolved": "https://registry.npmjs.org/bson/-/bson-6.3.0.tgz", 736 | "integrity": "sha512-balJfqwwTBddxfnidJZagCBPP/f48zj9Sdp3OJswREOgsJzHiQSaOIAtApSgDQFYgHqAvFkp53AFSqjMDZoTFw==", 737 | "dev": true, 738 | "engines": { 739 | "node": ">=16.20.1" 740 | } 741 | }, 742 | "node_modules/caching-transform": { 743 | "version": "4.0.0", 744 | "resolved": "https://registry.npmjs.org/caching-transform/-/caching-transform-4.0.0.tgz", 745 | "integrity": "sha512-kpqOvwXnjjN44D89K5ccQC+RUrsy7jB/XLlRrx0D7/2HNcTPqzsb6XgYoErwko6QsV184CA2YgS1fxDiiDZMWA==", 746 | "dev": true, 747 | "dependencies": { 748 | "hasha": "^5.0.0", 749 | "make-dir": "^3.0.0", 750 | "package-hash": "^4.0.0", 751 | "write-file-atomic": "^3.0.0" 752 | }, 753 | "engines": { 754 | "node": ">=8" 755 | } 756 | }, 757 | "node_modules/camelcase": { 758 | "version": "5.3.1", 759 | "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", 760 | "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", 761 | "dev": true, 762 | "engines": { 763 | "node": ">=6" 764 | } 765 | }, 766 | "node_modules/chai": { 767 | "version": "4.3.7", 768 | "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.7.tgz", 769 | "integrity": "sha512-HLnAzZ2iupm25PlN0xFreAlBA5zaBSv3og0DdeGA4Ar6h6rJ3A0rolRUKJhSF2V10GZKDgWF/VmAEsNWjCRB+A==", 770 | "dev": true, 771 | "dependencies": { 772 | "assertion-error": "^1.1.0", 773 | "check-error": "^1.0.2", 774 | "deep-eql": "^4.1.2", 775 | "get-func-name": "^2.0.0", 776 | "loupe": "^2.3.1", 777 | "pathval": "^1.1.1", 778 | "type-detect": "^4.0.5" 779 | }, 780 | "engines": { 781 | "node": ">=4" 782 | } 783 | }, 784 | "node_modules/chalk": { 785 | "version": "4.1.2", 786 | "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", 787 | "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", 788 | "dev": true, 789 | "dependencies": { 790 | "ansi-styles": "^4.1.0", 791 | "supports-color": "^7.1.0" 792 | }, 793 | "engines": { 794 | "node": ">=10" 795 | }, 796 | "funding": { 797 | "url": "https://github.com/chalk/chalk?sponsor=1" 798 | } 799 | }, 800 | "node_modules/check-error": { 801 | "version": "1.0.2", 802 | "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", 803 | "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", 804 | "dev": true, 805 | "engines": { 806 | "node": "*" 807 | } 808 | }, 809 | "node_modules/chokidar": { 810 | "version": "3.5.3", 811 | "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", 812 | "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", 813 | "dev": true, 814 | "funding": [ 815 | { 816 | "type": "individual", 817 | "url": "https://paulmillr.com/funding/" 818 | } 819 | ], 820 | "dependencies": { 821 | "anymatch": "~3.1.2", 822 | "braces": "~3.0.2", 823 | "glob-parent": "~5.1.2", 824 | "is-binary-path": "~2.1.0", 825 | "is-glob": "~4.0.1", 826 | "normalize-path": "~3.0.0", 827 | "readdirp": "~3.6.0" 828 | }, 829 | "engines": { 830 | "node": ">= 8.10.0" 831 | }, 832 | "optionalDependencies": { 833 | "fsevents": "~2.3.2" 834 | } 835 | }, 836 | "node_modules/clean-stack": { 837 | "version": "2.2.0", 838 | "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", 839 | "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", 840 | "dev": true, 841 | "engines": { 842 | "node": ">=6" 843 | } 844 | }, 845 | "node_modules/cliui": { 846 | "version": "7.0.4", 847 | "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", 848 | "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", 849 | "dev": true, 850 | "dependencies": { 851 | "string-width": "^4.2.0", 852 | "strip-ansi": "^6.0.0", 853 | "wrap-ansi": "^7.0.0" 854 | } 855 | }, 856 | "node_modules/color-convert": { 857 | "version": "2.0.1", 858 | "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", 859 | "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", 860 | "dev": true, 861 | "dependencies": { 862 | "color-name": "~1.1.4" 863 | }, 864 | "engines": { 865 | "node": ">=7.0.0" 866 | } 867 | }, 868 | "node_modules/color-name": { 869 | "version": "1.1.4", 870 | "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", 871 | "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", 872 | "dev": true 873 | }, 874 | "node_modules/commondir": { 875 | "version": "1.0.1", 876 | "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", 877 | "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=", 878 | "dev": true 879 | }, 880 | "node_modules/concat-map": { 881 | "version": "0.0.1", 882 | "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", 883 | "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", 884 | "dev": true 885 | }, 886 | "node_modules/convert-source-map": { 887 | "version": "1.7.0", 888 | "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.7.0.tgz", 889 | "integrity": "sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA==", 890 | "dev": true, 891 | "dependencies": { 892 | "safe-buffer": "~5.1.1" 893 | } 894 | }, 895 | "node_modules/convert-source-map/node_modules/safe-buffer": { 896 | "version": "5.1.2", 897 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", 898 | "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", 899 | "dev": true 900 | }, 901 | "node_modules/cross-spawn": { 902 | "version": "7.0.3", 903 | "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", 904 | "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", 905 | "dev": true, 906 | "dependencies": { 907 | "path-key": "^3.1.0", 908 | "shebang-command": "^2.0.0", 909 | "which": "^2.0.1" 910 | }, 911 | "engines": { 912 | "node": ">= 8" 913 | } 914 | }, 915 | "node_modules/debug": { 916 | "version": "4.3.4", 917 | "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", 918 | "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", 919 | "dev": true, 920 | "dependencies": { 921 | "ms": "2.1.2" 922 | }, 923 | "engines": { 924 | "node": ">=6.0" 925 | }, 926 | "peerDependenciesMeta": { 927 | "supports-color": { 928 | "optional": true 929 | } 930 | } 931 | }, 932 | "node_modules/decamelize": { 933 | "version": "1.2.0", 934 | "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", 935 | "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", 936 | "dev": true, 937 | "engines": { 938 | "node": ">=0.10.0" 939 | } 940 | }, 941 | "node_modules/deep-eql": { 942 | "version": "4.1.3", 943 | "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.3.tgz", 944 | "integrity": "sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw==", 945 | "dev": true, 946 | "dependencies": { 947 | "type-detect": "^4.0.0" 948 | }, 949 | "engines": { 950 | "node": ">=6" 951 | } 952 | }, 953 | "node_modules/default-require-extensions": { 954 | "version": "3.0.0", 955 | "resolved": "https://registry.npmjs.org/default-require-extensions/-/default-require-extensions-3.0.0.tgz", 956 | "integrity": "sha512-ek6DpXq/SCpvjhpFsLFRVtIxJCRw6fUR42lYMVZuUMK7n8eMz4Uh5clckdBjEpLhn/gEBZo7hDJnJcwdKLKQjg==", 957 | "dev": true, 958 | "dependencies": { 959 | "strip-bom": "^4.0.0" 960 | }, 961 | "engines": { 962 | "node": ">=8" 963 | } 964 | }, 965 | "node_modules/diff": { 966 | "version": "5.0.0", 967 | "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", 968 | "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==", 969 | "dev": true, 970 | "engines": { 971 | "node": ">=0.3.1" 972 | } 973 | }, 974 | "node_modules/emoji-regex": { 975 | "version": "8.0.0", 976 | "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", 977 | "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", 978 | "dev": true 979 | }, 980 | "node_modules/es6-error": { 981 | "version": "4.1.1", 982 | "resolved": "https://registry.npmjs.org/es6-error/-/es6-error-4.1.1.tgz", 983 | "integrity": "sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg==", 984 | "dev": true 985 | }, 986 | "node_modules/escalade": { 987 | "version": "3.1.1", 988 | "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", 989 | "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", 990 | "dev": true, 991 | "engines": { 992 | "node": ">=6" 993 | } 994 | }, 995 | "node_modules/escape-string-regexp": { 996 | "version": "4.0.0", 997 | "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", 998 | "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", 999 | "dev": true, 1000 | "engines": { 1001 | "node": ">=10" 1002 | }, 1003 | "funding": { 1004 | "url": "https://github.com/sponsors/sindresorhus" 1005 | } 1006 | }, 1007 | "node_modules/esprima": { 1008 | "version": "4.0.1", 1009 | "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", 1010 | "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", 1011 | "dev": true, 1012 | "bin": { 1013 | "esparse": "bin/esparse.js", 1014 | "esvalidate": "bin/esvalidate.js" 1015 | }, 1016 | "engines": { 1017 | "node": ">=4" 1018 | } 1019 | }, 1020 | "node_modules/fill-range": { 1021 | "version": "7.0.1", 1022 | "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", 1023 | "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", 1024 | "dev": true, 1025 | "dependencies": { 1026 | "to-regex-range": "^5.0.1" 1027 | }, 1028 | "engines": { 1029 | "node": ">=8" 1030 | } 1031 | }, 1032 | "node_modules/find-cache-dir": { 1033 | "version": "3.3.1", 1034 | "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.1.tgz", 1035 | "integrity": "sha512-t2GDMt3oGC/v+BMwzmllWDuJF/xcDtE5j/fCGbqDD7OLuJkj0cfh1YSA5VKPvwMeLFLNDBkwOKZ2X85jGLVftQ==", 1036 | "dev": true, 1037 | "dependencies": { 1038 | "commondir": "^1.0.1", 1039 | "make-dir": "^3.0.2", 1040 | "pkg-dir": "^4.1.0" 1041 | }, 1042 | "engines": { 1043 | "node": ">=8" 1044 | }, 1045 | "funding": { 1046 | "url": "https://github.com/avajs/find-cache-dir?sponsor=1" 1047 | } 1048 | }, 1049 | "node_modules/find-up": { 1050 | "version": "5.0.0", 1051 | "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", 1052 | "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", 1053 | "dev": true, 1054 | "dependencies": { 1055 | "locate-path": "^6.0.0", 1056 | "path-exists": "^4.0.0" 1057 | }, 1058 | "engines": { 1059 | "node": ">=10" 1060 | }, 1061 | "funding": { 1062 | "url": "https://github.com/sponsors/sindresorhus" 1063 | } 1064 | }, 1065 | "node_modules/flat": { 1066 | "version": "5.0.2", 1067 | "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", 1068 | "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", 1069 | "dev": true, 1070 | "bin": { 1071 | "flat": "cli.js" 1072 | } 1073 | }, 1074 | "node_modules/foreground-child": { 1075 | "version": "2.0.0", 1076 | "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-2.0.0.tgz", 1077 | "integrity": "sha512-dCIq9FpEcyQyXKCkyzmlPTFNgrCzPudOe+mhvJU5zAtlBnGVy2yKxtfsxK2tQBThwq225jcvBjpw1Gr40uzZCA==", 1078 | "dev": true, 1079 | "dependencies": { 1080 | "cross-spawn": "^7.0.0", 1081 | "signal-exit": "^3.0.2" 1082 | }, 1083 | "engines": { 1084 | "node": ">=8.0.0" 1085 | } 1086 | }, 1087 | "node_modules/fromentries": { 1088 | "version": "1.3.2", 1089 | "resolved": "https://registry.npmjs.org/fromentries/-/fromentries-1.3.2.tgz", 1090 | "integrity": "sha512-cHEpEQHUg0f8XdtZCc2ZAhrHzKzT0MrFUTcvx+hfxYu7rGMDc5SKoXFh+n4YigxsHXRzc6OrCshdR1bWH6HHyg==", 1091 | "dev": true, 1092 | "funding": [ 1093 | { 1094 | "type": "github", 1095 | "url": "https://github.com/sponsors/feross" 1096 | }, 1097 | { 1098 | "type": "patreon", 1099 | "url": "https://www.patreon.com/feross" 1100 | }, 1101 | { 1102 | "type": "consulting", 1103 | "url": "https://feross.org/support" 1104 | } 1105 | ] 1106 | }, 1107 | "node_modules/fs.realpath": { 1108 | "version": "1.0.0", 1109 | "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", 1110 | "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", 1111 | "dev": true 1112 | }, 1113 | "node_modules/fsevents": { 1114 | "version": "2.3.2", 1115 | "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", 1116 | "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", 1117 | "dev": true, 1118 | "hasInstallScript": true, 1119 | "optional": true, 1120 | "os": [ 1121 | "darwin" 1122 | ], 1123 | "engines": { 1124 | "node": "^8.16.0 || ^10.6.0 || >=11.0.0" 1125 | } 1126 | }, 1127 | "node_modules/function-bind": { 1128 | "version": "1.1.1", 1129 | "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", 1130 | "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", 1131 | "dev": true 1132 | }, 1133 | "node_modules/gensync": { 1134 | "version": "1.0.0-beta.2", 1135 | "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", 1136 | "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", 1137 | "dev": true, 1138 | "engines": { 1139 | "node": ">=6.9.0" 1140 | } 1141 | }, 1142 | "node_modules/get-caller-file": { 1143 | "version": "2.0.5", 1144 | "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", 1145 | "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", 1146 | "dev": true, 1147 | "engines": { 1148 | "node": "6.* || 8.* || >= 10.*" 1149 | } 1150 | }, 1151 | "node_modules/get-func-name": { 1152 | "version": "2.0.2", 1153 | "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.2.tgz", 1154 | "integrity": "sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ==", 1155 | "dev": true, 1156 | "engines": { 1157 | "node": "*" 1158 | } 1159 | }, 1160 | "node_modules/get-package-type": { 1161 | "version": "0.1.0", 1162 | "resolved": "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz", 1163 | "integrity": "sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==", 1164 | "dev": true, 1165 | "engines": { 1166 | "node": ">=8.0.0" 1167 | } 1168 | }, 1169 | "node_modules/glob": { 1170 | "version": "7.2.0", 1171 | "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", 1172 | "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", 1173 | "dev": true, 1174 | "dependencies": { 1175 | "fs.realpath": "^1.0.0", 1176 | "inflight": "^1.0.4", 1177 | "inherits": "2", 1178 | "minimatch": "^3.0.4", 1179 | "once": "^1.3.0", 1180 | "path-is-absolute": "^1.0.0" 1181 | }, 1182 | "engines": { 1183 | "node": "*" 1184 | }, 1185 | "funding": { 1186 | "url": "https://github.com/sponsors/isaacs" 1187 | } 1188 | }, 1189 | "node_modules/glob-parent": { 1190 | "version": "5.1.2", 1191 | "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", 1192 | "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", 1193 | "dev": true, 1194 | "dependencies": { 1195 | "is-glob": "^4.0.1" 1196 | }, 1197 | "engines": { 1198 | "node": ">= 6" 1199 | } 1200 | }, 1201 | "node_modules/globals": { 1202 | "version": "11.12.0", 1203 | "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", 1204 | "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", 1205 | "dev": true, 1206 | "engines": { 1207 | "node": ">=4" 1208 | } 1209 | }, 1210 | "node_modules/graceful-fs": { 1211 | "version": "4.2.4", 1212 | "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz", 1213 | "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==", 1214 | "dev": true 1215 | }, 1216 | "node_modules/has": { 1217 | "version": "1.0.3", 1218 | "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", 1219 | "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", 1220 | "dev": true, 1221 | "dependencies": { 1222 | "function-bind": "^1.1.1" 1223 | }, 1224 | "engines": { 1225 | "node": ">= 0.4.0" 1226 | } 1227 | }, 1228 | "node_modules/has-flag": { 1229 | "version": "4.0.0", 1230 | "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", 1231 | "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", 1232 | "dev": true, 1233 | "engines": { 1234 | "node": ">=8" 1235 | } 1236 | }, 1237 | "node_modules/hasha": { 1238 | "version": "5.2.2", 1239 | "resolved": "https://registry.npmjs.org/hasha/-/hasha-5.2.2.tgz", 1240 | "integrity": "sha512-Hrp5vIK/xr5SkeN2onO32H0MgNZ0f17HRNH39WfL0SYUNOTZ5Lz1TJ8Pajo/87dYGEFlLMm7mIc/k/s6Bvz9HQ==", 1241 | "dev": true, 1242 | "dependencies": { 1243 | "is-stream": "^2.0.0", 1244 | "type-fest": "^0.8.0" 1245 | }, 1246 | "engines": { 1247 | "node": ">=8" 1248 | }, 1249 | "funding": { 1250 | "url": "https://github.com/sponsors/sindresorhus" 1251 | } 1252 | }, 1253 | "node_modules/he": { 1254 | "version": "1.2.0", 1255 | "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", 1256 | "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", 1257 | "dev": true, 1258 | "bin": { 1259 | "he": "bin/he" 1260 | } 1261 | }, 1262 | "node_modules/html-escaper": { 1263 | "version": "2.0.2", 1264 | "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", 1265 | "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", 1266 | "dev": true 1267 | }, 1268 | "node_modules/imurmurhash": { 1269 | "version": "0.1.4", 1270 | "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", 1271 | "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", 1272 | "dev": true, 1273 | "engines": { 1274 | "node": ">=0.8.19" 1275 | } 1276 | }, 1277 | "node_modules/indent-string": { 1278 | "version": "4.0.0", 1279 | "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", 1280 | "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", 1281 | "dev": true, 1282 | "engines": { 1283 | "node": ">=8" 1284 | } 1285 | }, 1286 | "node_modules/inflight": { 1287 | "version": "1.0.6", 1288 | "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", 1289 | "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", 1290 | "dev": true, 1291 | "dependencies": { 1292 | "once": "^1.3.0", 1293 | "wrappy": "1" 1294 | } 1295 | }, 1296 | "node_modules/inherits": { 1297 | "version": "2.0.4", 1298 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", 1299 | "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", 1300 | "dev": true 1301 | }, 1302 | "node_modules/is-binary-path": { 1303 | "version": "2.1.0", 1304 | "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", 1305 | "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", 1306 | "dev": true, 1307 | "dependencies": { 1308 | "binary-extensions": "^2.0.0" 1309 | }, 1310 | "engines": { 1311 | "node": ">=8" 1312 | } 1313 | }, 1314 | "node_modules/is-core-module": { 1315 | "version": "2.1.0", 1316 | "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.1.0.tgz", 1317 | "integrity": "sha512-YcV7BgVMRFRua2FqQzKtTDMz8iCuLEyGKjr70q8Zm1yy2qKcurbFEd79PAdHV77oL3NrAaOVQIbMmiHQCHB7ZA==", 1318 | "dev": true, 1319 | "dependencies": { 1320 | "has": "^1.0.3" 1321 | }, 1322 | "funding": { 1323 | "url": "https://github.com/sponsors/ljharb" 1324 | } 1325 | }, 1326 | "node_modules/is-extglob": { 1327 | "version": "2.1.1", 1328 | "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", 1329 | "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", 1330 | "dev": true, 1331 | "engines": { 1332 | "node": ">=0.10.0" 1333 | } 1334 | }, 1335 | "node_modules/is-fullwidth-code-point": { 1336 | "version": "3.0.0", 1337 | "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", 1338 | "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", 1339 | "dev": true, 1340 | "engines": { 1341 | "node": ">=8" 1342 | } 1343 | }, 1344 | "node_modules/is-glob": { 1345 | "version": "4.0.3", 1346 | "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", 1347 | "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", 1348 | "dev": true, 1349 | "dependencies": { 1350 | "is-extglob": "^2.1.1" 1351 | }, 1352 | "engines": { 1353 | "node": ">=0.10.0" 1354 | } 1355 | }, 1356 | "node_modules/is-number": { 1357 | "version": "7.0.0", 1358 | "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", 1359 | "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", 1360 | "dev": true, 1361 | "engines": { 1362 | "node": ">=0.12.0" 1363 | } 1364 | }, 1365 | "node_modules/is-plain-obj": { 1366 | "version": "2.1.0", 1367 | "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", 1368 | "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", 1369 | "dev": true, 1370 | "engines": { 1371 | "node": ">=8" 1372 | } 1373 | }, 1374 | "node_modules/is-stream": { 1375 | "version": "2.0.0", 1376 | "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz", 1377 | "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==", 1378 | "dev": true, 1379 | "engines": { 1380 | "node": ">=8" 1381 | } 1382 | }, 1383 | "node_modules/is-typedarray": { 1384 | "version": "1.0.0", 1385 | "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", 1386 | "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", 1387 | "dev": true 1388 | }, 1389 | "node_modules/is-unicode-supported": { 1390 | "version": "0.1.0", 1391 | "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", 1392 | "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", 1393 | "dev": true, 1394 | "engines": { 1395 | "node": ">=10" 1396 | }, 1397 | "funding": { 1398 | "url": "https://github.com/sponsors/sindresorhus" 1399 | } 1400 | }, 1401 | "node_modules/is-windows": { 1402 | "version": "1.0.2", 1403 | "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", 1404 | "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==", 1405 | "dev": true, 1406 | "engines": { 1407 | "node": ">=0.10.0" 1408 | } 1409 | }, 1410 | "node_modules/isexe": { 1411 | "version": "2.0.0", 1412 | "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", 1413 | "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", 1414 | "dev": true 1415 | }, 1416 | "node_modules/istanbul-lib-coverage": { 1417 | "version": "3.0.0", 1418 | "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.0.0.tgz", 1419 | "integrity": "sha512-UiUIqxMgRDET6eR+o5HbfRYP1l0hqkWOs7vNxC/mggutCMUIhWMm8gAHb8tHlyfD3/l6rlgNA5cKdDzEAf6hEg==", 1420 | "dev": true, 1421 | "engines": { 1422 | "node": ">=8" 1423 | } 1424 | }, 1425 | "node_modules/istanbul-lib-hook": { 1426 | "version": "3.0.0", 1427 | "resolved": "https://registry.npmjs.org/istanbul-lib-hook/-/istanbul-lib-hook-3.0.0.tgz", 1428 | "integrity": "sha512-Pt/uge1Q9s+5VAZ+pCo16TYMWPBIl+oaNIjgLQxcX0itS6ueeaA+pEfThZpH8WxhFgCiEb8sAJY6MdUKgiIWaQ==", 1429 | "dev": true, 1430 | "dependencies": { 1431 | "append-transform": "^2.0.0" 1432 | }, 1433 | "engines": { 1434 | "node": ">=8" 1435 | } 1436 | }, 1437 | "node_modules/istanbul-lib-instrument": { 1438 | "version": "4.0.3", 1439 | "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-4.0.3.tgz", 1440 | "integrity": "sha512-BXgQl9kf4WTCPCCpmFGoJkz/+uhvm7h7PFKUYxh7qarQd3ER33vHG//qaE8eN25l07YqZPpHXU9I09l/RD5aGQ==", 1441 | "dev": true, 1442 | "dependencies": { 1443 | "@babel/core": "^7.7.5", 1444 | "@istanbuljs/schema": "^0.1.2", 1445 | "istanbul-lib-coverage": "^3.0.0", 1446 | "semver": "^6.3.0" 1447 | }, 1448 | "engines": { 1449 | "node": ">=8" 1450 | } 1451 | }, 1452 | "node_modules/istanbul-lib-instrument/node_modules/semver": { 1453 | "version": "6.3.1", 1454 | "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", 1455 | "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", 1456 | "dev": true, 1457 | "bin": { 1458 | "semver": "bin/semver.js" 1459 | } 1460 | }, 1461 | "node_modules/istanbul-lib-processinfo": { 1462 | "version": "2.0.2", 1463 | "resolved": "https://registry.npmjs.org/istanbul-lib-processinfo/-/istanbul-lib-processinfo-2.0.2.tgz", 1464 | "integrity": "sha512-kOwpa7z9hme+IBPZMzQ5vdQj8srYgAtaRqeI48NGmAQ+/5yKiHLV0QbYqQpxsdEF0+w14SoB8YbnHKcXE2KnYw==", 1465 | "dev": true, 1466 | "dependencies": { 1467 | "archy": "^1.0.0", 1468 | "cross-spawn": "^7.0.0", 1469 | "istanbul-lib-coverage": "^3.0.0-alpha.1", 1470 | "make-dir": "^3.0.0", 1471 | "p-map": "^3.0.0", 1472 | "rimraf": "^3.0.0", 1473 | "uuid": "^3.3.3" 1474 | }, 1475 | "engines": { 1476 | "node": ">=8" 1477 | } 1478 | }, 1479 | "node_modules/istanbul-lib-report": { 1480 | "version": "3.0.0", 1481 | "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", 1482 | "integrity": "sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw==", 1483 | "dev": true, 1484 | "dependencies": { 1485 | "istanbul-lib-coverage": "^3.0.0", 1486 | "make-dir": "^3.0.0", 1487 | "supports-color": "^7.1.0" 1488 | }, 1489 | "engines": { 1490 | "node": ">=8" 1491 | } 1492 | }, 1493 | "node_modules/istanbul-lib-source-maps": { 1494 | "version": "4.0.0", 1495 | "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.0.tgz", 1496 | "integrity": "sha512-c16LpFRkR8vQXyHZ5nLpY35JZtzj1PQY1iZmesUbf1FZHbIupcWfjgOXBY9YHkLEQ6puz1u4Dgj6qmU/DisrZg==", 1497 | "dev": true, 1498 | "dependencies": { 1499 | "debug": "^4.1.1", 1500 | "istanbul-lib-coverage": "^3.0.0", 1501 | "source-map": "^0.6.1" 1502 | }, 1503 | "engines": { 1504 | "node": ">=8" 1505 | } 1506 | }, 1507 | "node_modules/istanbul-lib-source-maps/node_modules/source-map": { 1508 | "version": "0.6.1", 1509 | "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", 1510 | "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", 1511 | "dev": true, 1512 | "engines": { 1513 | "node": ">=0.10.0" 1514 | } 1515 | }, 1516 | "node_modules/istanbul-reports": { 1517 | "version": "3.0.2", 1518 | "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.0.2.tgz", 1519 | "integrity": "sha512-9tZvz7AiR3PEDNGiV9vIouQ/EAcqMXFmkcA1CDFTwOB98OZVDL0PH9glHotf5Ugp6GCOTypfzGWI/OqjWNCRUw==", 1520 | "dev": true, 1521 | "dependencies": { 1522 | "html-escaper": "^2.0.0", 1523 | "istanbul-lib-report": "^3.0.0" 1524 | }, 1525 | "engines": { 1526 | "node": ">=8" 1527 | } 1528 | }, 1529 | "node_modules/js-tokens": { 1530 | "version": "4.0.0", 1531 | "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", 1532 | "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", 1533 | "dev": true 1534 | }, 1535 | "node_modules/js-yaml": { 1536 | "version": "3.14.0", 1537 | "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.0.tgz", 1538 | "integrity": "sha512-/4IbIeHcD9VMHFqDR/gQ7EdZdLimOvW2DdcxFjdyyZ9NsbS+ccrXqVWDtab/lRl5AlUqmpBx8EhPaWR+OtY17A==", 1539 | "dev": true, 1540 | "dependencies": { 1541 | "argparse": "^1.0.7", 1542 | "esprima": "^4.0.0" 1543 | }, 1544 | "bin": { 1545 | "js-yaml": "bin/js-yaml.js" 1546 | } 1547 | }, 1548 | "node_modules/jsesc": { 1549 | "version": "2.5.2", 1550 | "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", 1551 | "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", 1552 | "dev": true, 1553 | "bin": { 1554 | "jsesc": "bin/jsesc" 1555 | }, 1556 | "engines": { 1557 | "node": ">=4" 1558 | } 1559 | }, 1560 | "node_modules/json5": { 1561 | "version": "2.2.3", 1562 | "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", 1563 | "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", 1564 | "dev": true, 1565 | "bin": { 1566 | "json5": "lib/cli.js" 1567 | }, 1568 | "engines": { 1569 | "node": ">=6" 1570 | } 1571 | }, 1572 | "node_modules/kareem": { 1573 | "version": "2.5.1", 1574 | "resolved": "https://registry.npmjs.org/kareem/-/kareem-2.5.1.tgz", 1575 | "integrity": "sha512-7jFxRVm+jD+rkq3kY0iZDJfsO2/t4BBPeEb2qKn2lR/9KhuksYk5hxzfRYWMPV8P/x2d0kHD306YyWLzjjH+uA==", 1576 | "dev": true, 1577 | "engines": { 1578 | "node": ">=12.0.0" 1579 | } 1580 | }, 1581 | "node_modules/locate-path": { 1582 | "version": "6.0.0", 1583 | "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", 1584 | "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", 1585 | "dev": true, 1586 | "dependencies": { 1587 | "p-locate": "^5.0.0" 1588 | }, 1589 | "engines": { 1590 | "node": ">=10" 1591 | }, 1592 | "funding": { 1593 | "url": "https://github.com/sponsors/sindresorhus" 1594 | } 1595 | }, 1596 | "node_modules/lodash": { 1597 | "version": "4.17.21", 1598 | "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", 1599 | "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", 1600 | "dev": true 1601 | }, 1602 | "node_modules/lodash.flattendeep": { 1603 | "version": "4.4.0", 1604 | "resolved": "https://registry.npmjs.org/lodash.flattendeep/-/lodash.flattendeep-4.4.0.tgz", 1605 | "integrity": "sha1-+wMJF/hqMTTlvJvsDWngAT3f7bI=", 1606 | "dev": true 1607 | }, 1608 | "node_modules/log-symbols": { 1609 | "version": "4.1.0", 1610 | "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", 1611 | "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", 1612 | "dev": true, 1613 | "dependencies": { 1614 | "chalk": "^4.1.0", 1615 | "is-unicode-supported": "^0.1.0" 1616 | }, 1617 | "engines": { 1618 | "node": ">=10" 1619 | }, 1620 | "funding": { 1621 | "url": "https://github.com/sponsors/sindresorhus" 1622 | } 1623 | }, 1624 | "node_modules/loupe": { 1625 | "version": "2.3.6", 1626 | "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.6.tgz", 1627 | "integrity": "sha512-RaPMZKiMy8/JruncMU5Bt6na1eftNoo++R4Y+N2FrxkDVTrGvcyzFTsaGif4QTeKESheMGegbhw6iUAq+5A8zA==", 1628 | "dev": true, 1629 | "dependencies": { 1630 | "get-func-name": "^2.0.0" 1631 | } 1632 | }, 1633 | "node_modules/make-dir": { 1634 | "version": "3.1.0", 1635 | "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", 1636 | "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", 1637 | "dev": true, 1638 | "dependencies": { 1639 | "semver": "^6.0.0" 1640 | }, 1641 | "engines": { 1642 | "node": ">=8" 1643 | }, 1644 | "funding": { 1645 | "url": "https://github.com/sponsors/sindresorhus" 1646 | } 1647 | }, 1648 | "node_modules/make-dir/node_modules/semver": { 1649 | "version": "6.3.1", 1650 | "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", 1651 | "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", 1652 | "dev": true, 1653 | "bin": { 1654 | "semver": "bin/semver.js" 1655 | } 1656 | }, 1657 | "node_modules/memory-pager": { 1658 | "version": "1.5.0", 1659 | "resolved": "https://registry.npmjs.org/memory-pager/-/memory-pager-1.5.0.tgz", 1660 | "integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==", 1661 | "dev": true 1662 | }, 1663 | "node_modules/minimatch": { 1664 | "version": "3.1.2", 1665 | "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", 1666 | "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", 1667 | "dev": true, 1668 | "dependencies": { 1669 | "brace-expansion": "^1.1.7" 1670 | }, 1671 | "engines": { 1672 | "node": "*" 1673 | } 1674 | }, 1675 | "node_modules/mocha": { 1676 | "version": "10.2.0", 1677 | "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.2.0.tgz", 1678 | "integrity": "sha512-IDY7fl/BecMwFHzoqF2sg/SHHANeBoMMXFlS9r0OXKDssYE1M5O43wUY/9BVPeIvfH2zmEbBfseqN9gBQZzXkg==", 1679 | "dev": true, 1680 | "dependencies": { 1681 | "ansi-colors": "4.1.1", 1682 | "browser-stdout": "1.3.1", 1683 | "chokidar": "3.5.3", 1684 | "debug": "4.3.4", 1685 | "diff": "5.0.0", 1686 | "escape-string-regexp": "4.0.0", 1687 | "find-up": "5.0.0", 1688 | "glob": "7.2.0", 1689 | "he": "1.2.0", 1690 | "js-yaml": "4.1.0", 1691 | "log-symbols": "4.1.0", 1692 | "minimatch": "5.0.1", 1693 | "ms": "2.1.3", 1694 | "nanoid": "3.3.3", 1695 | "serialize-javascript": "6.0.0", 1696 | "strip-json-comments": "3.1.1", 1697 | "supports-color": "8.1.1", 1698 | "workerpool": "6.2.1", 1699 | "yargs": "16.2.0", 1700 | "yargs-parser": "20.2.4", 1701 | "yargs-unparser": "2.0.0" 1702 | }, 1703 | "bin": { 1704 | "_mocha": "bin/_mocha", 1705 | "mocha": "bin/mocha.js" 1706 | }, 1707 | "engines": { 1708 | "node": ">= 14.0.0" 1709 | }, 1710 | "funding": { 1711 | "type": "opencollective", 1712 | "url": "https://opencollective.com/mochajs" 1713 | } 1714 | }, 1715 | "node_modules/mocha/node_modules/argparse": { 1716 | "version": "2.0.1", 1717 | "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", 1718 | "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", 1719 | "dev": true 1720 | }, 1721 | "node_modules/mocha/node_modules/brace-expansion": { 1722 | "version": "2.0.1", 1723 | "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", 1724 | "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", 1725 | "dev": true, 1726 | "dependencies": { 1727 | "balanced-match": "^1.0.0" 1728 | } 1729 | }, 1730 | "node_modules/mocha/node_modules/js-yaml": { 1731 | "version": "4.1.0", 1732 | "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", 1733 | "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", 1734 | "dev": true, 1735 | "dependencies": { 1736 | "argparse": "^2.0.1" 1737 | }, 1738 | "bin": { 1739 | "js-yaml": "bin/js-yaml.js" 1740 | } 1741 | }, 1742 | "node_modules/mocha/node_modules/minimatch": { 1743 | "version": "5.0.1", 1744 | "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz", 1745 | "integrity": "sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g==", 1746 | "dev": true, 1747 | "dependencies": { 1748 | "brace-expansion": "^2.0.1" 1749 | }, 1750 | "engines": { 1751 | "node": ">=10" 1752 | } 1753 | }, 1754 | "node_modules/mocha/node_modules/ms": { 1755 | "version": "2.1.3", 1756 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", 1757 | "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", 1758 | "dev": true 1759 | }, 1760 | "node_modules/mocha/node_modules/supports-color": { 1761 | "version": "8.1.1", 1762 | "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", 1763 | "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", 1764 | "dev": true, 1765 | "dependencies": { 1766 | "has-flag": "^4.0.0" 1767 | }, 1768 | "engines": { 1769 | "node": ">=10" 1770 | }, 1771 | "funding": { 1772 | "url": "https://github.com/chalk/supports-color?sponsor=1" 1773 | } 1774 | }, 1775 | "node_modules/mongodb": { 1776 | "version": "6.3.0", 1777 | "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-6.3.0.tgz", 1778 | "integrity": "sha512-tt0KuGjGtLUhLoU263+xvQmPHEGTw5LbcNC73EoFRYgSHwZt5tsoJC110hDyO1kjQzpgNrpdcSza9PknWN4LrA==", 1779 | "dev": true, 1780 | "dependencies": { 1781 | "@mongodb-js/saslprep": "^1.1.0", 1782 | "bson": "^6.2.0", 1783 | "mongodb-connection-string-url": "^3.0.0" 1784 | }, 1785 | "engines": { 1786 | "node": ">=16.20.1" 1787 | }, 1788 | "peerDependencies": { 1789 | "@aws-sdk/credential-providers": "^3.188.0", 1790 | "@mongodb-js/zstd": "^1.1.0", 1791 | "gcp-metadata": "^5.2.0", 1792 | "kerberos": "^2.0.1", 1793 | "mongodb-client-encryption": ">=6.0.0 <7", 1794 | "snappy": "^7.2.2", 1795 | "socks": "^2.7.1" 1796 | }, 1797 | "peerDependenciesMeta": { 1798 | "@aws-sdk/credential-providers": { 1799 | "optional": true 1800 | }, 1801 | "@mongodb-js/zstd": { 1802 | "optional": true 1803 | }, 1804 | "gcp-metadata": { 1805 | "optional": true 1806 | }, 1807 | "kerberos": { 1808 | "optional": true 1809 | }, 1810 | "mongodb-client-encryption": { 1811 | "optional": true 1812 | }, 1813 | "snappy": { 1814 | "optional": true 1815 | }, 1816 | "socks": { 1817 | "optional": true 1818 | } 1819 | } 1820 | }, 1821 | "node_modules/mongodb-connection-string-url": { 1822 | "version": "3.0.0", 1823 | "resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-3.0.0.tgz", 1824 | "integrity": "sha512-t1Vf+m1I5hC2M5RJx/7AtxgABy1cZmIPQRMXw+gEIPn/cZNF3Oiy+l0UIypUwVB5trcWHq3crg2g3uAR9aAwsQ==", 1825 | "dev": true, 1826 | "dependencies": { 1827 | "@types/whatwg-url": "^11.0.2", 1828 | "whatwg-url": "^13.0.0" 1829 | } 1830 | }, 1831 | "node_modules/mongoose": { 1832 | "version": "8.1.1", 1833 | "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-8.1.1.tgz", 1834 | "integrity": "sha512-DbLb0NsiEXmaqLOpEz+AtAsgwhRw6f25gwa1dF5R7jj6lS1D8X6uTdhBSC8GDVtOwe5Tfw2EL7nTn6hiJT3Bgg==", 1835 | "dev": true, 1836 | "dependencies": { 1837 | "bson": "^6.2.0", 1838 | "kareem": "2.5.1", 1839 | "mongodb": "6.3.0", 1840 | "mpath": "0.9.0", 1841 | "mquery": "5.0.0", 1842 | "ms": "2.1.3", 1843 | "sift": "16.0.1" 1844 | }, 1845 | "engines": { 1846 | "node": ">=16.20.1" 1847 | }, 1848 | "funding": { 1849 | "type": "opencollective", 1850 | "url": "https://opencollective.com/mongoose" 1851 | } 1852 | }, 1853 | "node_modules/mongoose/node_modules/ms": { 1854 | "version": "2.1.3", 1855 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", 1856 | "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", 1857 | "dev": true 1858 | }, 1859 | "node_modules/mpath": { 1860 | "version": "0.9.0", 1861 | "resolved": "https://registry.npmjs.org/mpath/-/mpath-0.9.0.tgz", 1862 | "integrity": "sha512-ikJRQTk8hw5DEoFVxHG1Gn9T/xcjtdnOKIU1JTmGjZZlg9LST2mBLmcX3/ICIbgJydT2GOc15RnNy5mHmzfSew==", 1863 | "dev": true, 1864 | "engines": { 1865 | "node": ">=4.0.0" 1866 | } 1867 | }, 1868 | "node_modules/mquery": { 1869 | "version": "5.0.0", 1870 | "resolved": "https://registry.npmjs.org/mquery/-/mquery-5.0.0.tgz", 1871 | "integrity": "sha512-iQMncpmEK8R8ncT8HJGsGc9Dsp8xcgYMVSbs5jgnm1lFHTZqMJTUWTDx1LBO8+mK3tPNZWFLBghQEIOULSTHZg==", 1872 | "dev": true, 1873 | "dependencies": { 1874 | "debug": "4.x" 1875 | }, 1876 | "engines": { 1877 | "node": ">=14.0.0" 1878 | } 1879 | }, 1880 | "node_modules/ms": { 1881 | "version": "2.1.2", 1882 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", 1883 | "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", 1884 | "dev": true 1885 | }, 1886 | "node_modules/nanoid": { 1887 | "version": "3.3.3", 1888 | "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.3.tgz", 1889 | "integrity": "sha512-p1sjXuopFs0xg+fPASzQ28agW1oHD7xDsd9Xkf3T15H3c/cifrFHVwrh74PdoklAPi+i7MdRsE47vm2r6JoB+w==", 1890 | "dev": true, 1891 | "bin": { 1892 | "nanoid": "bin/nanoid.cjs" 1893 | }, 1894 | "engines": { 1895 | "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" 1896 | } 1897 | }, 1898 | "node_modules/node-preload": { 1899 | "version": "0.2.1", 1900 | "resolved": "https://registry.npmjs.org/node-preload/-/node-preload-0.2.1.tgz", 1901 | "integrity": "sha512-RM5oyBy45cLEoHqCeh+MNuFAxO0vTFBLskvQbOKnEE7YTTSN4tbN8QWDIPQ6L+WvKsB/qLEGpYe2ZZ9d4W9OIQ==", 1902 | "dev": true, 1903 | "dependencies": { 1904 | "process-on-spawn": "^1.0.0" 1905 | }, 1906 | "engines": { 1907 | "node": ">=8" 1908 | } 1909 | }, 1910 | "node_modules/normalize-path": { 1911 | "version": "3.0.0", 1912 | "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", 1913 | "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", 1914 | "dev": true, 1915 | "engines": { 1916 | "node": ">=0.10.0" 1917 | } 1918 | }, 1919 | "node_modules/nyc": { 1920 | "version": "15.1.0", 1921 | "resolved": "https://registry.npmjs.org/nyc/-/nyc-15.1.0.tgz", 1922 | "integrity": "sha512-jMW04n9SxKdKi1ZMGhvUTHBN0EICCRkHemEoE5jm6mTYcqcdas0ATzgUgejlQUHMvpnOZqGB5Xxsv9KxJW1j8A==", 1923 | "dev": true, 1924 | "dependencies": { 1925 | "@istanbuljs/load-nyc-config": "^1.0.0", 1926 | "@istanbuljs/schema": "^0.1.2", 1927 | "caching-transform": "^4.0.0", 1928 | "convert-source-map": "^1.7.0", 1929 | "decamelize": "^1.2.0", 1930 | "find-cache-dir": "^3.2.0", 1931 | "find-up": "^4.1.0", 1932 | "foreground-child": "^2.0.0", 1933 | "get-package-type": "^0.1.0", 1934 | "glob": "^7.1.6", 1935 | "istanbul-lib-coverage": "^3.0.0", 1936 | "istanbul-lib-hook": "^3.0.0", 1937 | "istanbul-lib-instrument": "^4.0.0", 1938 | "istanbul-lib-processinfo": "^2.0.2", 1939 | "istanbul-lib-report": "^3.0.0", 1940 | "istanbul-lib-source-maps": "^4.0.0", 1941 | "istanbul-reports": "^3.0.2", 1942 | "make-dir": "^3.0.0", 1943 | "node-preload": "^0.2.1", 1944 | "p-map": "^3.0.0", 1945 | "process-on-spawn": "^1.0.0", 1946 | "resolve-from": "^5.0.0", 1947 | "rimraf": "^3.0.0", 1948 | "signal-exit": "^3.0.2", 1949 | "spawn-wrap": "^2.0.0", 1950 | "test-exclude": "^6.0.0", 1951 | "yargs": "^15.0.2" 1952 | }, 1953 | "bin": { 1954 | "nyc": "bin/nyc.js" 1955 | }, 1956 | "engines": { 1957 | "node": ">=8.9" 1958 | } 1959 | }, 1960 | "node_modules/nyc/node_modules/cliui": { 1961 | "version": "6.0.0", 1962 | "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", 1963 | "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==", 1964 | "dev": true, 1965 | "dependencies": { 1966 | "string-width": "^4.2.0", 1967 | "strip-ansi": "^6.0.0", 1968 | "wrap-ansi": "^6.2.0" 1969 | } 1970 | }, 1971 | "node_modules/nyc/node_modules/find-up": { 1972 | "version": "4.1.0", 1973 | "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", 1974 | "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", 1975 | "dev": true, 1976 | "dependencies": { 1977 | "locate-path": "^5.0.0", 1978 | "path-exists": "^4.0.0" 1979 | }, 1980 | "engines": { 1981 | "node": ">=8" 1982 | } 1983 | }, 1984 | "node_modules/nyc/node_modules/locate-path": { 1985 | "version": "5.0.0", 1986 | "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", 1987 | "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", 1988 | "dev": true, 1989 | "dependencies": { 1990 | "p-locate": "^4.1.0" 1991 | }, 1992 | "engines": { 1993 | "node": ">=8" 1994 | } 1995 | }, 1996 | "node_modules/nyc/node_modules/p-limit": { 1997 | "version": "2.3.0", 1998 | "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", 1999 | "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", 2000 | "dev": true, 2001 | "dependencies": { 2002 | "p-try": "^2.0.0" 2003 | }, 2004 | "engines": { 2005 | "node": ">=6" 2006 | }, 2007 | "funding": { 2008 | "url": "https://github.com/sponsors/sindresorhus" 2009 | } 2010 | }, 2011 | "node_modules/nyc/node_modules/p-locate": { 2012 | "version": "4.1.0", 2013 | "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", 2014 | "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", 2015 | "dev": true, 2016 | "dependencies": { 2017 | "p-limit": "^2.2.0" 2018 | }, 2019 | "engines": { 2020 | "node": ">=8" 2021 | } 2022 | }, 2023 | "node_modules/nyc/node_modules/resolve-from": { 2024 | "version": "5.0.0", 2025 | "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", 2026 | "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", 2027 | "dev": true, 2028 | "engines": { 2029 | "node": ">=8" 2030 | } 2031 | }, 2032 | "node_modules/nyc/node_modules/wrap-ansi": { 2033 | "version": "6.2.0", 2034 | "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", 2035 | "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", 2036 | "dev": true, 2037 | "dependencies": { 2038 | "ansi-styles": "^4.0.0", 2039 | "string-width": "^4.1.0", 2040 | "strip-ansi": "^6.0.0" 2041 | }, 2042 | "engines": { 2043 | "node": ">=8" 2044 | } 2045 | }, 2046 | "node_modules/nyc/node_modules/yargs": { 2047 | "version": "15.4.1", 2048 | "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz", 2049 | "integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==", 2050 | "dev": true, 2051 | "dependencies": { 2052 | "cliui": "^6.0.0", 2053 | "decamelize": "^1.2.0", 2054 | "find-up": "^4.1.0", 2055 | "get-caller-file": "^2.0.1", 2056 | "require-directory": "^2.1.1", 2057 | "require-main-filename": "^2.0.0", 2058 | "set-blocking": "^2.0.0", 2059 | "string-width": "^4.2.0", 2060 | "which-module": "^2.0.0", 2061 | "y18n": "^4.0.0", 2062 | "yargs-parser": "^18.1.2" 2063 | }, 2064 | "engines": { 2065 | "node": ">=8" 2066 | } 2067 | }, 2068 | "node_modules/nyc/node_modules/yargs-parser": { 2069 | "version": "18.1.3", 2070 | "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz", 2071 | "integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==", 2072 | "dev": true, 2073 | "dependencies": { 2074 | "camelcase": "^5.0.0", 2075 | "decamelize": "^1.2.0" 2076 | }, 2077 | "engines": { 2078 | "node": ">=6" 2079 | } 2080 | }, 2081 | "node_modules/once": { 2082 | "version": "1.4.0", 2083 | "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", 2084 | "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", 2085 | "dev": true, 2086 | "dependencies": { 2087 | "wrappy": "1" 2088 | } 2089 | }, 2090 | "node_modules/p-limit": { 2091 | "version": "3.0.2", 2092 | "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.0.2.tgz", 2093 | "integrity": "sha512-iwqZSOoWIW+Ew4kAGUlN16J4M7OB3ysMLSZtnhmqx7njIHFPlxWBX8xo3lVTyFVq6mI/lL9qt2IsN1sHwaxJkg==", 2094 | "dev": true, 2095 | "dependencies": { 2096 | "p-try": "^2.0.0" 2097 | }, 2098 | "engines": { 2099 | "node": ">=10" 2100 | }, 2101 | "funding": { 2102 | "url": "https://github.com/sponsors/sindresorhus" 2103 | } 2104 | }, 2105 | "node_modules/p-locate": { 2106 | "version": "5.0.0", 2107 | "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", 2108 | "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", 2109 | "dev": true, 2110 | "dependencies": { 2111 | "p-limit": "^3.0.2" 2112 | }, 2113 | "engines": { 2114 | "node": ">=10" 2115 | }, 2116 | "funding": { 2117 | "url": "https://github.com/sponsors/sindresorhus" 2118 | } 2119 | }, 2120 | "node_modules/p-map": { 2121 | "version": "3.0.0", 2122 | "resolved": "https://registry.npmjs.org/p-map/-/p-map-3.0.0.tgz", 2123 | "integrity": "sha512-d3qXVTF/s+W+CdJ5A29wywV2n8CQQYahlgz2bFiA+4eVNJbHJodPZ+/gXwPGh0bOqA+j8S+6+ckmvLGPk1QpxQ==", 2124 | "dev": true, 2125 | "dependencies": { 2126 | "aggregate-error": "^3.0.0" 2127 | }, 2128 | "engines": { 2129 | "node": ">=8" 2130 | } 2131 | }, 2132 | "node_modules/p-try": { 2133 | "version": "2.2.0", 2134 | "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", 2135 | "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", 2136 | "dev": true, 2137 | "engines": { 2138 | "node": ">=6" 2139 | } 2140 | }, 2141 | "node_modules/package-hash": { 2142 | "version": "4.0.0", 2143 | "resolved": "https://registry.npmjs.org/package-hash/-/package-hash-4.0.0.tgz", 2144 | "integrity": "sha512-whdkPIooSu/bASggZ96BWVvZTRMOFxnyUG5PnTSGKoJE2gd5mbVNmR2Nj20QFzxYYgAXpoqC+AiXzl+UMRh7zQ==", 2145 | "dev": true, 2146 | "dependencies": { 2147 | "graceful-fs": "^4.1.15", 2148 | "hasha": "^5.0.0", 2149 | "lodash.flattendeep": "^4.4.0", 2150 | "release-zalgo": "^1.0.0" 2151 | }, 2152 | "engines": { 2153 | "node": ">=8" 2154 | } 2155 | }, 2156 | "node_modules/path-exists": { 2157 | "version": "4.0.0", 2158 | "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", 2159 | "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", 2160 | "dev": true, 2161 | "engines": { 2162 | "node": ">=8" 2163 | } 2164 | }, 2165 | "node_modules/path-is-absolute": { 2166 | "version": "1.0.1", 2167 | "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", 2168 | "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", 2169 | "dev": true, 2170 | "engines": { 2171 | "node": ">=0.10.0" 2172 | } 2173 | }, 2174 | "node_modules/path-key": { 2175 | "version": "3.1.1", 2176 | "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", 2177 | "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", 2178 | "dev": true, 2179 | "engines": { 2180 | "node": ">=8" 2181 | } 2182 | }, 2183 | "node_modules/path-parse": { 2184 | "version": "1.0.7", 2185 | "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", 2186 | "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", 2187 | "dev": true 2188 | }, 2189 | "node_modules/pathval": { 2190 | "version": "1.1.1", 2191 | "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", 2192 | "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", 2193 | "dev": true, 2194 | "engines": { 2195 | "node": "*" 2196 | } 2197 | }, 2198 | "node_modules/picomatch": { 2199 | "version": "2.3.1", 2200 | "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", 2201 | "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", 2202 | "dev": true, 2203 | "engines": { 2204 | "node": ">=8.6" 2205 | }, 2206 | "funding": { 2207 | "url": "https://github.com/sponsors/jonschlinkert" 2208 | } 2209 | }, 2210 | "node_modules/pkg-dir": { 2211 | "version": "4.2.0", 2212 | "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", 2213 | "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", 2214 | "dev": true, 2215 | "dependencies": { 2216 | "find-up": "^4.0.0" 2217 | }, 2218 | "engines": { 2219 | "node": ">=8" 2220 | } 2221 | }, 2222 | "node_modules/pkg-dir/node_modules/find-up": { 2223 | "version": "4.1.0", 2224 | "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", 2225 | "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", 2226 | "dev": true, 2227 | "dependencies": { 2228 | "locate-path": "^5.0.0", 2229 | "path-exists": "^4.0.0" 2230 | }, 2231 | "engines": { 2232 | "node": ">=8" 2233 | } 2234 | }, 2235 | "node_modules/pkg-dir/node_modules/locate-path": { 2236 | "version": "5.0.0", 2237 | "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", 2238 | "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", 2239 | "dev": true, 2240 | "dependencies": { 2241 | "p-locate": "^4.1.0" 2242 | }, 2243 | "engines": { 2244 | "node": ">=8" 2245 | } 2246 | }, 2247 | "node_modules/pkg-dir/node_modules/p-limit": { 2248 | "version": "2.3.0", 2249 | "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", 2250 | "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", 2251 | "dev": true, 2252 | "dependencies": { 2253 | "p-try": "^2.0.0" 2254 | }, 2255 | "engines": { 2256 | "node": ">=6" 2257 | }, 2258 | "funding": { 2259 | "url": "https://github.com/sponsors/sindresorhus" 2260 | } 2261 | }, 2262 | "node_modules/pkg-dir/node_modules/p-locate": { 2263 | "version": "4.1.0", 2264 | "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", 2265 | "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", 2266 | "dev": true, 2267 | "dependencies": { 2268 | "p-limit": "^2.2.0" 2269 | }, 2270 | "engines": { 2271 | "node": ">=8" 2272 | } 2273 | }, 2274 | "node_modules/process-on-spawn": { 2275 | "version": "1.0.0", 2276 | "resolved": "https://registry.npmjs.org/process-on-spawn/-/process-on-spawn-1.0.0.tgz", 2277 | "integrity": "sha512-1WsPDsUSMmZH5LeMLegqkPDrsGgsWwk1Exipy2hvB0o/F0ASzbpIctSCcZIK1ykJvtTJULEH+20WOFjMvGnCTg==", 2278 | "dev": true, 2279 | "dependencies": { 2280 | "fromentries": "^1.2.0" 2281 | }, 2282 | "engines": { 2283 | "node": ">=8" 2284 | } 2285 | }, 2286 | "node_modules/punycode": { 2287 | "version": "2.3.1", 2288 | "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", 2289 | "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", 2290 | "dev": true, 2291 | "engines": { 2292 | "node": ">=6" 2293 | } 2294 | }, 2295 | "node_modules/randombytes": { 2296 | "version": "2.1.0", 2297 | "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", 2298 | "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", 2299 | "dev": true, 2300 | "dependencies": { 2301 | "safe-buffer": "^5.1.0" 2302 | } 2303 | }, 2304 | "node_modules/readdirp": { 2305 | "version": "3.6.0", 2306 | "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", 2307 | "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", 2308 | "dev": true, 2309 | "dependencies": { 2310 | "picomatch": "^2.2.1" 2311 | }, 2312 | "engines": { 2313 | "node": ">=8.10.0" 2314 | } 2315 | }, 2316 | "node_modules/release-zalgo": { 2317 | "version": "1.0.0", 2318 | "resolved": "https://registry.npmjs.org/release-zalgo/-/release-zalgo-1.0.0.tgz", 2319 | "integrity": "sha1-CXALflB0Mpc5Mw5TXFqQ+2eFFzA=", 2320 | "dev": true, 2321 | "dependencies": { 2322 | "es6-error": "^4.0.1" 2323 | }, 2324 | "engines": { 2325 | "node": ">=4" 2326 | } 2327 | }, 2328 | "node_modules/require-directory": { 2329 | "version": "2.1.1", 2330 | "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", 2331 | "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", 2332 | "dev": true, 2333 | "engines": { 2334 | "node": ">=0.10.0" 2335 | } 2336 | }, 2337 | "node_modules/require-main-filename": { 2338 | "version": "2.0.0", 2339 | "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", 2340 | "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", 2341 | "dev": true 2342 | }, 2343 | "node_modules/resolve": { 2344 | "version": "1.19.0", 2345 | "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.19.0.tgz", 2346 | "integrity": "sha512-rArEXAgsBG4UgRGcynxWIWKFvh/XZCcS8UJdHhwy91zwAvCZIbcs+vAbflgBnNjYMs/i/i+/Ux6IZhML1yPvxg==", 2347 | "dev": true, 2348 | "dependencies": { 2349 | "is-core-module": "^2.1.0", 2350 | "path-parse": "^1.0.6" 2351 | }, 2352 | "funding": { 2353 | "url": "https://github.com/sponsors/ljharb" 2354 | } 2355 | }, 2356 | "node_modules/rimraf": { 2357 | "version": "3.0.2", 2358 | "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", 2359 | "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", 2360 | "dev": true, 2361 | "dependencies": { 2362 | "glob": "^7.1.3" 2363 | }, 2364 | "bin": { 2365 | "rimraf": "bin.js" 2366 | }, 2367 | "funding": { 2368 | "url": "https://github.com/sponsors/isaacs" 2369 | } 2370 | }, 2371 | "node_modules/safe-buffer": { 2372 | "version": "5.2.1", 2373 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", 2374 | "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", 2375 | "dev": true, 2376 | "funding": [ 2377 | { 2378 | "type": "github", 2379 | "url": "https://github.com/sponsors/feross" 2380 | }, 2381 | { 2382 | "type": "patreon", 2383 | "url": "https://www.patreon.com/feross" 2384 | }, 2385 | { 2386 | "type": "consulting", 2387 | "url": "https://feross.org/support" 2388 | } 2389 | ] 2390 | }, 2391 | "node_modules/semver": { 2392 | "version": "5.7.2", 2393 | "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", 2394 | "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", 2395 | "dev": true, 2396 | "bin": { 2397 | "semver": "bin/semver" 2398 | } 2399 | }, 2400 | "node_modules/serialize-javascript": { 2401 | "version": "6.0.0", 2402 | "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", 2403 | "integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==", 2404 | "dev": true, 2405 | "dependencies": { 2406 | "randombytes": "^2.1.0" 2407 | } 2408 | }, 2409 | "node_modules/set-blocking": { 2410 | "version": "2.0.0", 2411 | "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", 2412 | "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", 2413 | "dev": true 2414 | }, 2415 | "node_modules/shebang-command": { 2416 | "version": "2.0.0", 2417 | "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", 2418 | "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", 2419 | "dev": true, 2420 | "dependencies": { 2421 | "shebang-regex": "^3.0.0" 2422 | }, 2423 | "engines": { 2424 | "node": ">=8" 2425 | } 2426 | }, 2427 | "node_modules/shebang-regex": { 2428 | "version": "3.0.0", 2429 | "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", 2430 | "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", 2431 | "dev": true, 2432 | "engines": { 2433 | "node": ">=8" 2434 | } 2435 | }, 2436 | "node_modules/sift": { 2437 | "version": "16.0.1", 2438 | "resolved": "https://registry.npmjs.org/sift/-/sift-16.0.1.tgz", 2439 | "integrity": "sha512-Wv6BjQ5zbhW7VFefWusVP33T/EM0vYikCaQ2qR8yULbsilAT8/wQaXvuQ3ptGLpoKx+lihJE3y2UTgKDyyNHZQ==", 2440 | "dev": true 2441 | }, 2442 | "node_modules/signal-exit": { 2443 | "version": "3.0.3", 2444 | "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", 2445 | "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==", 2446 | "dev": true 2447 | }, 2448 | "node_modules/source-map": { 2449 | "version": "0.5.7", 2450 | "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", 2451 | "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", 2452 | "dev": true, 2453 | "engines": { 2454 | "node": ">=0.10.0" 2455 | } 2456 | }, 2457 | "node_modules/sparse-bitfield": { 2458 | "version": "3.0.3", 2459 | "resolved": "https://registry.npmjs.org/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz", 2460 | "integrity": "sha512-kvzhi7vqKTfkh0PZU+2D2PIllw2ymqJKujUcyPMd9Y75Nv4nPbGJZXNhxsgdQab2BmlDct1YnfQCguEvHr7VsQ==", 2461 | "dev": true, 2462 | "dependencies": { 2463 | "memory-pager": "^1.0.2" 2464 | } 2465 | }, 2466 | "node_modules/spawn-wrap": { 2467 | "version": "2.0.0", 2468 | "resolved": "https://registry.npmjs.org/spawn-wrap/-/spawn-wrap-2.0.0.tgz", 2469 | "integrity": "sha512-EeajNjfN9zMnULLwhZZQU3GWBoFNkbngTUPfaawT4RkMiviTxcX0qfhVbGey39mfctfDHkWtuecgQ8NJcyQWHg==", 2470 | "dev": true, 2471 | "dependencies": { 2472 | "foreground-child": "^2.0.0", 2473 | "is-windows": "^1.0.2", 2474 | "make-dir": "^3.0.0", 2475 | "rimraf": "^3.0.0", 2476 | "signal-exit": "^3.0.2", 2477 | "which": "^2.0.1" 2478 | }, 2479 | "engines": { 2480 | "node": ">=8" 2481 | } 2482 | }, 2483 | "node_modules/sprintf-js": { 2484 | "version": "1.0.3", 2485 | "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", 2486 | "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", 2487 | "dev": true 2488 | }, 2489 | "node_modules/string-width": { 2490 | "version": "4.2.3", 2491 | "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", 2492 | "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", 2493 | "dev": true, 2494 | "dependencies": { 2495 | "emoji-regex": "^8.0.0", 2496 | "is-fullwidth-code-point": "^3.0.0", 2497 | "strip-ansi": "^6.0.1" 2498 | }, 2499 | "engines": { 2500 | "node": ">=8" 2501 | } 2502 | }, 2503 | "node_modules/strip-ansi": { 2504 | "version": "6.0.1", 2505 | "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", 2506 | "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", 2507 | "dev": true, 2508 | "dependencies": { 2509 | "ansi-regex": "^5.0.1" 2510 | }, 2511 | "engines": { 2512 | "node": ">=8" 2513 | } 2514 | }, 2515 | "node_modules/strip-bom": { 2516 | "version": "4.0.0", 2517 | "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz", 2518 | "integrity": "sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==", 2519 | "dev": true, 2520 | "engines": { 2521 | "node": ">=8" 2522 | } 2523 | }, 2524 | "node_modules/strip-json-comments": { 2525 | "version": "3.1.1", 2526 | "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", 2527 | "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", 2528 | "dev": true, 2529 | "engines": { 2530 | "node": ">=8" 2531 | }, 2532 | "funding": { 2533 | "url": "https://github.com/sponsors/sindresorhus" 2534 | } 2535 | }, 2536 | "node_modules/supports-color": { 2537 | "version": "7.2.0", 2538 | "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", 2539 | "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", 2540 | "dev": true, 2541 | "dependencies": { 2542 | "has-flag": "^4.0.0" 2543 | }, 2544 | "engines": { 2545 | "node": ">=8" 2546 | } 2547 | }, 2548 | "node_modules/test-exclude": { 2549 | "version": "6.0.0", 2550 | "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", 2551 | "integrity": "sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==", 2552 | "dev": true, 2553 | "dependencies": { 2554 | "@istanbuljs/schema": "^0.1.2", 2555 | "glob": "^7.1.4", 2556 | "minimatch": "^3.0.4" 2557 | }, 2558 | "engines": { 2559 | "node": ">=8" 2560 | } 2561 | }, 2562 | "node_modules/to-fast-properties": { 2563 | "version": "2.0.0", 2564 | "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", 2565 | "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=", 2566 | "dev": true, 2567 | "engines": { 2568 | "node": ">=4" 2569 | } 2570 | }, 2571 | "node_modules/to-regex-range": { 2572 | "version": "5.0.1", 2573 | "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", 2574 | "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", 2575 | "dev": true, 2576 | "dependencies": { 2577 | "is-number": "^7.0.0" 2578 | }, 2579 | "engines": { 2580 | "node": ">=8.0" 2581 | } 2582 | }, 2583 | "node_modules/tr46": { 2584 | "version": "4.1.1", 2585 | "resolved": "https://registry.npmjs.org/tr46/-/tr46-4.1.1.tgz", 2586 | "integrity": "sha512-2lv/66T7e5yNyhAAC4NaKe5nVavzuGJQVVtRYLyQ2OI8tsJ61PMLlelehb0wi2Hx6+hT/OJUWZcw8MjlSRnxvw==", 2587 | "dev": true, 2588 | "dependencies": { 2589 | "punycode": "^2.3.0" 2590 | }, 2591 | "engines": { 2592 | "node": ">=14" 2593 | } 2594 | }, 2595 | "node_modules/type-detect": { 2596 | "version": "4.0.8", 2597 | "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", 2598 | "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", 2599 | "dev": true, 2600 | "engines": { 2601 | "node": ">=4" 2602 | } 2603 | }, 2604 | "node_modules/type-fest": { 2605 | "version": "0.8.1", 2606 | "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", 2607 | "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", 2608 | "dev": true, 2609 | "engines": { 2610 | "node": ">=8" 2611 | } 2612 | }, 2613 | "node_modules/typedarray-to-buffer": { 2614 | "version": "3.1.5", 2615 | "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", 2616 | "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", 2617 | "dev": true, 2618 | "dependencies": { 2619 | "is-typedarray": "^1.0.0" 2620 | } 2621 | }, 2622 | "node_modules/uuid": { 2623 | "version": "3.4.0", 2624 | "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", 2625 | "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", 2626 | "deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.", 2627 | "dev": true, 2628 | "bin": { 2629 | "uuid": "bin/uuid" 2630 | } 2631 | }, 2632 | "node_modules/webidl-conversions": { 2633 | "version": "7.0.0", 2634 | "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz", 2635 | "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==", 2636 | "dev": true, 2637 | "engines": { 2638 | "node": ">=12" 2639 | } 2640 | }, 2641 | "node_modules/whatwg-url": { 2642 | "version": "13.0.0", 2643 | "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-13.0.0.tgz", 2644 | "integrity": "sha512-9WWbymnqj57+XEuqADHrCJ2eSXzn8WXIW/YSGaZtb2WKAInQ6CHfaUUcTyyver0p8BDg5StLQq8h1vtZuwmOig==", 2645 | "dev": true, 2646 | "dependencies": { 2647 | "tr46": "^4.1.1", 2648 | "webidl-conversions": "^7.0.0" 2649 | }, 2650 | "engines": { 2651 | "node": ">=16" 2652 | } 2653 | }, 2654 | "node_modules/which": { 2655 | "version": "2.0.2", 2656 | "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", 2657 | "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", 2658 | "dev": true, 2659 | "dependencies": { 2660 | "isexe": "^2.0.0" 2661 | }, 2662 | "bin": { 2663 | "node-which": "bin/node-which" 2664 | }, 2665 | "engines": { 2666 | "node": ">= 8" 2667 | } 2668 | }, 2669 | "node_modules/which-module": { 2670 | "version": "2.0.0", 2671 | "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", 2672 | "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", 2673 | "dev": true 2674 | }, 2675 | "node_modules/workerpool": { 2676 | "version": "6.2.1", 2677 | "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.1.tgz", 2678 | "integrity": "sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw==", 2679 | "dev": true 2680 | }, 2681 | "node_modules/wrap-ansi": { 2682 | "version": "7.0.0", 2683 | "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", 2684 | "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", 2685 | "dev": true, 2686 | "dependencies": { 2687 | "ansi-styles": "^4.0.0", 2688 | "string-width": "^4.1.0", 2689 | "strip-ansi": "^6.0.0" 2690 | }, 2691 | "engines": { 2692 | "node": ">=10" 2693 | }, 2694 | "funding": { 2695 | "url": "https://github.com/chalk/wrap-ansi?sponsor=1" 2696 | } 2697 | }, 2698 | "node_modules/wrappy": { 2699 | "version": "1.0.2", 2700 | "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", 2701 | "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", 2702 | "dev": true 2703 | }, 2704 | "node_modules/write-file-atomic": { 2705 | "version": "3.0.3", 2706 | "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.3.tgz", 2707 | "integrity": "sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q==", 2708 | "dev": true, 2709 | "dependencies": { 2710 | "imurmurhash": "^0.1.4", 2711 | "is-typedarray": "^1.0.0", 2712 | "signal-exit": "^3.0.2", 2713 | "typedarray-to-buffer": "^3.1.5" 2714 | } 2715 | }, 2716 | "node_modules/y18n": { 2717 | "version": "4.0.1", 2718 | "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.1.tgz", 2719 | "integrity": "sha512-wNcy4NvjMYL8gogWWYAO7ZFWFfHcbdbE57tZO8e4cbpj8tfUcwrwqSl3ad8HxpYWCdXcJUCeKKZS62Av1affwQ==", 2720 | "dev": true 2721 | }, 2722 | "node_modules/yargs": { 2723 | "version": "16.2.0", 2724 | "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", 2725 | "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", 2726 | "dev": true, 2727 | "dependencies": { 2728 | "cliui": "^7.0.2", 2729 | "escalade": "^3.1.1", 2730 | "get-caller-file": "^2.0.5", 2731 | "require-directory": "^2.1.1", 2732 | "string-width": "^4.2.0", 2733 | "y18n": "^5.0.5", 2734 | "yargs-parser": "^20.2.2" 2735 | }, 2736 | "engines": { 2737 | "node": ">=10" 2738 | } 2739 | }, 2740 | "node_modules/yargs-parser": { 2741 | "version": "20.2.4", 2742 | "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", 2743 | "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", 2744 | "dev": true, 2745 | "engines": { 2746 | "node": ">=10" 2747 | } 2748 | }, 2749 | "node_modules/yargs-unparser": { 2750 | "version": "2.0.0", 2751 | "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", 2752 | "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", 2753 | "dev": true, 2754 | "dependencies": { 2755 | "camelcase": "^6.0.0", 2756 | "decamelize": "^4.0.0", 2757 | "flat": "^5.0.2", 2758 | "is-plain-obj": "^2.1.0" 2759 | }, 2760 | "engines": { 2761 | "node": ">=10" 2762 | } 2763 | }, 2764 | "node_modules/yargs-unparser/node_modules/camelcase": { 2765 | "version": "6.2.0", 2766 | "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.2.0.tgz", 2767 | "integrity": "sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg==", 2768 | "dev": true, 2769 | "engines": { 2770 | "node": ">=10" 2771 | }, 2772 | "funding": { 2773 | "url": "https://github.com/sponsors/sindresorhus" 2774 | } 2775 | }, 2776 | "node_modules/yargs-unparser/node_modules/decamelize": { 2777 | "version": "4.0.0", 2778 | "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", 2779 | "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", 2780 | "dev": true, 2781 | "engines": { 2782 | "node": ">=10" 2783 | }, 2784 | "funding": { 2785 | "url": "https://github.com/sponsors/sindresorhus" 2786 | } 2787 | }, 2788 | "node_modules/yargs/node_modules/y18n": { 2789 | "version": "5.0.8", 2790 | "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", 2791 | "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", 2792 | "dev": true, 2793 | "engines": { 2794 | "node": ">=10" 2795 | } 2796 | } 2797 | } 2798 | } 2799 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mongoose-delete", 3 | "version": "1.0.2", 4 | "description": "Mongoose soft delete plugin", 5 | "author": "Sanel Deljkic (http://dsanel.github.io/)", 6 | "main": "index.js", 7 | "scripts": { 8 | "test": "mocha", 9 | "test-cov": "nyc --reporter=html --reporter=text ./node_modules/mocha/bin/_mocha -- -R spec ./test/*" 10 | }, 11 | "repository": { 12 | "type": "git", 13 | "url": "git@github.com:dsanel/mongoose-delete.git" 14 | }, 15 | "keywords": [ 16 | "mongoose", 17 | "soft", 18 | "delete", 19 | "delete", 20 | "remove", 21 | "plugin" 22 | ], 23 | "license": "MIT", 24 | "bugs": { 25 | "url": "https://github.com/dsanel/mongoose-delete/issues" 26 | }, 27 | "homepage": "https://github.com/dsanel/mongoose-delete", 28 | "peerDependencies": { 29 | "mongoose": "5.x || 6.x || 7.x || 8.x" 30 | }, 31 | "devDependencies": { 32 | "chai": "^4.3.7", 33 | "mocha": "^10.2.0", 34 | "mongoose": "^8.1.1", 35 | "nyc": "^15.0.0" 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /test/index.js: -------------------------------------------------------------------------------- 1 | var chai = require('chai'), 2 | should = chai.should(), 3 | expect = chai.expect, 4 | mongoose = require('mongoose'), 5 | Schema = mongoose.Schema; 6 | 7 | var mongoose_delete = require('../'); 8 | 9 | var mongooseMajorVersion = +mongoose.version[0]; // 4, 5, 6... 10 | 11 | console.log(`> mongoose: ${mongooseMajorVersion}`); 12 | 13 | if (mongooseMajorVersion < 7) { 14 | mongoose.set('strictQuery', true); 15 | } 16 | 17 | if (mongooseMajorVersion === 5) { 18 | mongoose.set('useCreateIndex', true); 19 | mongoose.set('useFindAndModify', false); 20 | } 21 | 22 | function getNewObjectId(value) { 23 | if (mongooseMajorVersion > 6) { 24 | return new mongoose.Types.ObjectId(value); 25 | } 26 | return mongoose.Types.ObjectId(value); 27 | } 28 | 29 | chai.use(function (_chai, utils) { 30 | utils.addChainableMethod(chai.Assertion.prototype, 'mongoose_count', function (val) { 31 | if (mongooseMajorVersion >= 6) { 32 | new chai.Assertion(this._obj.matchedCount).to.be.equal(val); 33 | } else { 34 | new chai.Assertion(this._obj.n).to.be.equal(val); 35 | } 36 | }); 37 | 38 | utils.addChainableMethod(chai.Assertion.prototype, 'mongoose_ok', function () { 39 | if (mongooseMajorVersion >= 6) { 40 | new chai.Assertion(this._obj.acknowledged).to.be.equal(true); 41 | } else { 42 | new chai.Assertion(this._obj.ok).to.be.equal(1); 43 | } 44 | }); 45 | 46 | }); 47 | 48 | before(async function () { 49 | await mongoose.connect(process.env.MONGOOSE_TEST_URI || 'mongodb://localhost/test'); 50 | }); 51 | 52 | after(async function () { 53 | await mongoose.connection.db.dropDatabase(); 54 | await mongoose.disconnect(); 55 | }); 56 | 57 | describe("mongoose_delete delete method without callback function", function () { 58 | var Test1Schema = new Schema({name: String}, {collection: 'mongoose_delete_test0'}); 59 | Test1Schema.plugin(mongoose_delete); 60 | var Test0 = mongoose.model('Test0', Test1Schema); 61 | 62 | before(async function () { 63 | var puffy = new Test0({name: 'Puffy'}); 64 | await puffy.save(); 65 | }); 66 | 67 | after(async function () { 68 | await mongoose.connection.db.dropCollection("mongoose_delete_test0"); 69 | }); 70 | 71 | it("delete() -> should return a thenable (Promise)", function () { 72 | return Test0.findOne({ name: 'Puffy' }) 73 | .then(function (puffy) { 74 | expect(puffy.delete()).to.have.property('then'); 75 | }) 76 | .catch(function (err) { 77 | should.not.exist(err); 78 | }); 79 | }); 80 | }); 81 | 82 | describe("mongoose_delete plugin without options", function () { 83 | 84 | var Test1Schema = new Schema({name: String}, {collection: 'mongoose_delete_test1'}); 85 | Test1Schema.plugin(mongoose_delete); 86 | var Test1 = mongoose.model('Test1', Test1Schema); 87 | 88 | var puffy1 = null; 89 | var puffy2 = null; 90 | 91 | beforeEach(async function () { 92 | const created = await Test1.create( 93 | [ 94 | { name: 'Puffy1'}, 95 | { name: 'Puffy2'} 96 | ] 97 | ); 98 | 99 | puffy1 = { ...created[0]._doc }; 100 | puffy2 = { ...created[1]._doc }; 101 | }); 102 | 103 | afterEach(async function () { 104 | await mongoose.connection.db.dropCollection("mongoose_delete_test1"); 105 | }); 106 | 107 | it("delete() -> should set deleted:true", async function () { 108 | try { 109 | const puffy = await Test1.findOne({ name: 'Puffy1' }); 110 | const success = await puffy.delete(); 111 | success.deleted.should.equal(true); 112 | } catch (err) { 113 | should.not.exist(err); 114 | } 115 | }); 116 | 117 | it("delete() -> should not save 'deletedAt' value", async function () { 118 | try { 119 | const puffy = await Test1.findOne({ name: 'Puffy1' }); 120 | const success = await puffy.delete(); 121 | should.not.exist(success.deletedAt); 122 | } catch (err) { 123 | should.not.exist(err); 124 | } 125 | }); 126 | 127 | it("deleteById() -> should set deleted:true and not save 'deletedAt'", async function () { 128 | try { 129 | const documents = await Test1.deleteById(puffy2._id); 130 | expect(documents).to.be.mongoose_ok(); 131 | expect(documents).to.be.mongoose_count(1); 132 | 133 | const doc = await Test1.findOne({ name: 'Puffy2' }); 134 | doc.deleted.should.equal(true); 135 | should.not.exist(doc.deletedAt); 136 | } catch (err) { 137 | should.not.exist(err); 138 | } 139 | }); 140 | 141 | it("deleteById() -> should throw an exception: first argument error", async function () { 142 | try { 143 | await Test1.deleteById() 144 | } catch (error) { 145 | expect(error.message).to.equal('First argument is mandatory and must not be a function.'); 146 | } 147 | }); 148 | 149 | it("restoreMany() -> should set deleted:false", async function () { 150 | try { 151 | await Test1.restore({ name: 'Puffy1' }); 152 | const puffy = await Test1.findOne({ name: 'Puffy1' }); 153 | 154 | puffy.deleted.should.equal(false); 155 | should.not.exist(puffy.deletedBy); 156 | } catch (e) { 157 | should.not.exist(e); 158 | } 159 | }); 160 | }); 161 | 162 | describe("mongoose_delete plugin without options, using option: typeKey", function () { 163 | var Test1Schema = new Schema({name: String}, {collection: 'mongoose_delete_test1', typeKey: '$type'}); 164 | Test1Schema.plugin(mongoose_delete); 165 | var Test1 = mongoose.model('Test1a', Test1Schema); 166 | 167 | var puffy1 = null; 168 | var puffy2 = null; 169 | 170 | beforeEach(async function () { 171 | const created = await Test1.create( 172 | [ 173 | { name: 'Puffy1' }, 174 | { name: 'Puffy2' }, 175 | { name: 'Puffy3', deleted: true } 176 | ] 177 | ); 178 | 179 | puffy1 = { ...created[0]._doc }; 180 | puffy2 = { ...created[1]._doc }; 181 | }); 182 | 183 | afterEach(async function () { 184 | await mongoose.connection.db.dropCollection("mongoose_delete_test1"); 185 | }); 186 | 187 | it("delete() -> should set deleted:true", async function () { 188 | try { 189 | const puffy = await Test1.findOne({ name: 'Puffy1' }); 190 | const success = await puffy.delete(); 191 | success.deleted.should.equal(true); 192 | } catch (err) { 193 | should.not.exist(err); 194 | } 195 | }); 196 | 197 | it("delete() -> should not save 'deletedAt' value", async function () { 198 | try { 199 | const puffy = await Test1.findOne({name: 'Puffy1'}); 200 | const success = await puffy.delete(); 201 | should.not.exist(success.deletedAt); 202 | } catch (err) { 203 | should.not.exist(err); 204 | } 205 | }); 206 | 207 | it("deleteById() -> should set deleted:true and not save 'deletedAt'", async function () { 208 | try { 209 | const documents = await Test1.deleteById(puffy2._id) 210 | expect(documents).to.be.mongoose_ok(); 211 | expect(documents).to.be.mongoose_count(1); 212 | 213 | const doc = await Test1.findOne({name: 'Puffy2'}); 214 | doc.deleted.should.equal(true); 215 | should.not.exist(doc.deletedAt); 216 | } catch (err) { 217 | should.not.exist(err); 218 | } 219 | }); 220 | 221 | it("restore() -> should set deleted:false", async function () { 222 | try { 223 | const puffy = await Test1.findOne({ name: 'Puffy3' }); 224 | const success = await puffy.restore(); 225 | 226 | success.deleted.should.equal(false); 227 | } catch (err) { 228 | should.not.exist(err); 229 | } 230 | }); 231 | }); 232 | 233 | describe("mongoose_delete with options: { deletedAt : true }", function () { 234 | var Test2Schema = new Schema({name: String}, {collection: 'mongoose_delete_test2'}); 235 | Test2Schema.plugin(mongoose_delete, { deletedAt: true }); 236 | var Test2 = mongoose.model('Test2', Test2Schema); 237 | 238 | var puffy1 = null; 239 | var puffy2 = null; 240 | 241 | beforeEach(async function () { 242 | const created = await Test2.create( 243 | [ 244 | { name: 'Puffy1' }, 245 | { name: 'Puffy2' }, 246 | { name: 'Puffy3', deleted: true } 247 | ] 248 | ); 249 | 250 | puffy1 = { ...created[0]._doc }; 251 | puffy2 = { ...created[1]._doc }; 252 | }); 253 | 254 | afterEach(async function () { 255 | await mongoose.connection.db.dropCollection("mongoose_delete_test2"); 256 | }); 257 | 258 | it("delete() -> should save 'deletedAt' key", async function () { 259 | try { 260 | const puffy = await Test2.findOne({name: 'Puffy1'}); 261 | const success = await puffy.delete(); 262 | should.exist(success.deletedAt); 263 | } catch (err) { 264 | should.not.exist(err); 265 | } 266 | }); 267 | 268 | it("deleteById() -> should save 'deletedAt' key", async function () { 269 | try { 270 | const documents = await Test2.deleteById(puffy2._id); 271 | 272 | expect(documents).to.be.mongoose_ok(); 273 | expect(documents).to.be.mongoose_count(1); 274 | 275 | const doc = await Test2.findOne({name: 'Puffy2'}) 276 | doc.deleted.should.equal(true); 277 | should.exist(doc.deletedAt); 278 | } catch (err) { 279 | should.not.exist(err); 280 | } 281 | }); 282 | 283 | it("restore() -> should set deleted:false and delete deletedAt key", async function () { 284 | try { 285 | const puffy = await Test2.findOne({ name: 'Puffy3' }); 286 | const success = await puffy.restore(); 287 | success.deleted.should.equal(false); 288 | should.not.exist(success.deletedAt); 289 | } catch (err) { 290 | should.not.exist(err); 291 | } 292 | }); 293 | }); 294 | 295 | describe("mongoose_delete with options: { deletedAt : true }, using option: typeKey", function () { 296 | var Test2Schema = new Schema({name: String}, {collection: 'mongoose_delete_test2', typeKey: '$type'}); 297 | Test2Schema.plugin(mongoose_delete, {deletedAt: true}); 298 | var Test2 = mongoose.model('Test2a', Test2Schema); 299 | 300 | var puffy1 = null; 301 | var puffy2 = null; 302 | 303 | beforeEach(async function () { 304 | const created = await Test2.create( 305 | [ 306 | { name: 'Puffy1' }, 307 | { name: 'Puffy2' }, 308 | { name: 'Puffy3', deleted: true } 309 | ] 310 | ); 311 | 312 | puffy1 = { ...created[0]._doc }; 313 | puffy2 = { ...created[1]._doc }; 314 | }); 315 | 316 | afterEach(async function () { 317 | await mongoose.connection.db.dropCollection("mongoose_delete_test2"); 318 | }); 319 | 320 | it("delete() -> should save 'deletedAt' key", async function () { 321 | try { 322 | const puffy = await Test2.findOne({name: 'Puffy1'}); 323 | const success = await puffy.delete(); 324 | should.exist(success.deletedAt); 325 | } catch (err) { 326 | should.not.exist(err); 327 | } 328 | }); 329 | 330 | it("deleteById() -> should save 'deletedAt' key", async function () { 331 | try { 332 | const documents = await Test2.deleteById(puffy2._id); 333 | 334 | expect(documents).to.be.mongoose_ok(); 335 | expect(documents).to.be.mongoose_count(1); 336 | 337 | const doc = await Test2.findOne({name: 'Puffy2'}); 338 | doc.deleted.should.equal(true); 339 | should.exist(doc.deletedAt); 340 | } catch (err) { 341 | should.not.exist(err); 342 | } 343 | }); 344 | 345 | it("restore() -> should set deleted:false and delete deletedAt key", async function () { 346 | try { 347 | const puffy = await Test2.findOne({name: 'Puffy1'}); 348 | const success = await puffy.restore(); 349 | success.deleted.should.equal(false); 350 | should.not.exist(success.deletedAt); 351 | } catch (err) { 352 | should.not.exist(err); 353 | } 354 | }); 355 | }); 356 | 357 | describe("mongoose_delete with options: { deletedBy : true }", function () { 358 | 359 | var Test3Schema = new Schema({name: String}, {collection: 'mongoose_delete_test3'}); 360 | Test3Schema.plugin(mongoose_delete, { deletedBy: true }); 361 | var Test3 = mongoose.model('Test3', Test3Schema); 362 | 363 | var puffy1 = null; 364 | var puffy2 = null; 365 | 366 | beforeEach(async function () { 367 | const created = await Test3.create( 368 | [ 369 | { name: 'Puffy1' }, 370 | { name: 'Puffy2' }, 371 | { name: 'Puffy3', deleted: true, deletedBy: "53da93b16b4a6670076b16bf" } 372 | ] 373 | ); 374 | 375 | puffy1 = { ...created[0]._doc }; 376 | puffy2 = { ...created[1]._doc }; 377 | }); 378 | 379 | afterEach(async function () { 380 | await mongoose.connection.db.dropCollection("mongoose_delete_test3"); 381 | }); 382 | 383 | var userId = getNewObjectId("53da93b16b4a6670076b16bf"); 384 | 385 | it("delete() -> should save 'deletedBy' key", async function () { 386 | try { 387 | const puffy = await Test3.findOne({ name: 'Puffy1' }); 388 | const success = await puffy.delete(userId); 389 | success.deletedBy.should.equal(userId); 390 | } catch (err) { 391 | should.not.exist(err); 392 | } 393 | }); 394 | 395 | it("deleteById() -> should save `deletedBy` key", async function () { 396 | try { 397 | const documents = await Test3.deleteById(puffy2._id, userId) 398 | 399 | expect(documents).to.be.mongoose_ok(); 400 | expect(documents).to.be.mongoose_count(1); 401 | 402 | const doc = await Test3.findOne({name: 'Puffy2'}); 403 | doc.deleted.should.equal(true); 404 | doc.deletedBy.toString().should.equal(userId.toString()); 405 | } catch (err) { 406 | should.not.exist(err); 407 | } 408 | }); 409 | 410 | it("restore() -> should set deleted:false and delete `deletedBy` key", async function () { 411 | try { 412 | const puffy = await Test3.findOne({ name: 'Puffy3' }); 413 | const success = await puffy.restore(); 414 | success.deleted.should.equal(false); 415 | should.not.exist(success.deletedBy); 416 | } catch (err) { 417 | should.not.exist(err); 418 | } 419 | }); 420 | }); 421 | 422 | describe("mongoose_delete with options: { deletedBy : true }, using option: typeKey", function () { 423 | 424 | var Test3Schema = new Schema({name: String}, {collection: 'mongoose_delete_test3', typeKey: '$type'}); 425 | Test3Schema.plugin(mongoose_delete, {deletedBy: true}); 426 | var Test3 = mongoose.model('Test3a', Test3Schema); 427 | 428 | var puffy1 = null; 429 | var puffy2 = null; 430 | 431 | beforeEach(async function () { 432 | const created = await Test3.create( 433 | [ 434 | { name: 'Puffy1' }, 435 | { name: 'Puffy2' }, 436 | { name: 'Puffy3', deleted: true, deletedBy: "53da93b16b4a6670076b16bf" } 437 | ] 438 | ); 439 | 440 | puffy1 = { ...created[0]._doc }; 441 | puffy2 = { ...created[1]._doc }; 442 | }); 443 | 444 | afterEach(async function () { 445 | await mongoose.connection.db.dropCollection("mongoose_delete_test3"); 446 | }); 447 | 448 | var userId = getNewObjectId("53da93b16b4a6670076b16bf") 449 | 450 | it("delete() -> should save `deletedBy` key", async function () { 451 | try { 452 | const puffy = await Test3.findOne({name: 'Puffy1'}); 453 | const success = await puffy.delete(userId); 454 | success.deletedBy.should.equal(userId); 455 | } catch (err) { 456 | should.not.exist(err); 457 | } 458 | }); 459 | 460 | it("deleteById() -> should save deletedBy key", async function () { 461 | try { 462 | const documents = await Test3.deleteById(puffy2._id, userId); 463 | 464 | expect(documents).to.be.mongoose_ok(); 465 | expect(documents).to.be.mongoose_count(1); 466 | 467 | const doc = await Test3.findOne({name: 'Puffy2'}); 468 | doc.deleted.should.equal(true); 469 | doc.deletedBy.toString().should.equal(userId.toString()); 470 | } catch (err) { 471 | 472 | } 473 | }); 474 | 475 | it("restore() -> should set deleted:false and delete deletedBy key", async function () { 476 | try { 477 | const puffy = await Test3.findOne({name: 'Puffy3'}); 478 | const success = await puffy.restore(); 479 | success.deleted.should.equal(false); 480 | should.not.exist(success.deletedBy); 481 | } catch (err) { 482 | should.not.exist(err); 483 | } 484 | }); 485 | }); 486 | 487 | describe("mongoose_delete with options: { deletedBy : true, deletedByType: String }", function () { 488 | 489 | var TestSchema = new Schema({name: String}, {collection: 'mongoose_delete_test'}); 490 | TestSchema.plugin(mongoose_delete, { deletedBy: true, deletedByType: String }); 491 | var Test = mongoose.model('TestDeletedByType', TestSchema); 492 | 493 | var puffy1 = null; 494 | var puffy2 = null; 495 | 496 | beforeEach(async function () { 497 | const created = await Test.create( 498 | [ 499 | { name: 'Puffy1' }, 500 | { name: 'Puffy2' }, 501 | { name: 'Puffy3', deleted: true, deletedBy: "custom_user_id_12345678" } 502 | ] 503 | ); 504 | 505 | puffy1 = { ...created[0]._doc }; 506 | puffy2 = { ...created[1]._doc }; 507 | }); 508 | 509 | afterEach(async function () { 510 | await mongoose.connection.db.dropCollection("mongoose_delete_test"); 511 | }); 512 | 513 | var userIdCustom = "custom_user_id_12345678"; 514 | 515 | it("delete() -> should save deletedBy key", async function () { 516 | try { 517 | const puffy = await Test.findOne({name: 'Puffy1'}); 518 | const success = await puffy.delete(userIdCustom); 519 | success.deletedBy.should.equal(userIdCustom); 520 | } catch (err) { 521 | console.log(err); 522 | should.not.exist(err); 523 | } 524 | }); 525 | 526 | it("deleteById() -> should save deletedBy key", async function () { 527 | try { 528 | const documents = await Test.deleteById(puffy2._id, userIdCustom) 529 | expect(documents).to.be.mongoose_ok(); 530 | expect(documents).to.be.mongoose_count(1); 531 | 532 | const doc = await Test.findOne({name: 'Puffy2'}); 533 | doc.deleted.should.equal(true); 534 | doc.deletedBy.should.equal(userIdCustom); 535 | } catch (err) { 536 | should.not.exist(err); 537 | } 538 | }); 539 | 540 | it("restore() -> should set deleted:false and delete deletedBy key", async function () { 541 | try { 542 | const puffy = await Test.findOne({ name: 'Puffy3' }); 543 | const success = await puffy.restore(); 544 | success.deleted.should.equal(false); 545 | should.not.exist(success.deletedBy); 546 | } catch (err) { 547 | should.not.exist(err); 548 | } 549 | }); 550 | }); 551 | 552 | describe("check not overridden static methods", function () { 553 | var TestSchema = new Schema({name: String}, { collection: 'mongoose_delete_test' }); 554 | TestSchema.plugin(mongoose_delete); 555 | var TestModel = mongoose.model('Test4', TestSchema); 556 | 557 | beforeEach(async function () { 558 | await TestModel.create( 559 | [ 560 | { name: 'Obi-Wan Kenobi', deleted: true }, 561 | { name: 'Darth Vader'}, 562 | { name: 'Luke Skywalker'} 563 | ] 564 | ); 565 | }); 566 | 567 | afterEach(async function () { 568 | await mongoose.connection.db.dropCollection("mongoose_delete_test"); 569 | }); 570 | 571 | // https://mongoosejs.com/docs/migrating_to_8.html#removed-count 572 | it("count() -> should return 3 documents", async function () { 573 | try { 574 | if (mongooseMajorVersion < 8) { 575 | const count = await TestModel.count(); 576 | count.should.equal(3); 577 | } 578 | } catch (err) { 579 | should.not.exist(err); 580 | } 581 | }); 582 | 583 | it("countDocuments() -> should return 3 documents", async function () { 584 | try { 585 | const count = await TestModel.countDocuments(); 586 | count.should.equal(3); 587 | } catch (err) { 588 | should.not.exist(err); 589 | } 590 | }); 591 | 592 | 593 | it("find() -> should return 3 documents", async function () { 594 | try { 595 | const documents = await TestModel.find(); 596 | documents.length.should.equal(3); 597 | } catch (err) { 598 | should.not.exist(err); 599 | } 600 | }); 601 | 602 | it("findOne() -> should return 1 deleted document", async function () { 603 | try { 604 | const doc = await TestModel.findOne({name: 'Obi-Wan Kenobi'}); 605 | expect(doc).not.to.be.null; 606 | doc.deleted.should.equal(true); 607 | } catch (err) { 608 | should.not.exist(err); 609 | } 610 | }); 611 | 612 | it("findOneAndUpdate() -> should find and update deleted document", async function () { 613 | try { 614 | const doc = await TestModel.findOneAndUpdate({name: 'Obi-Wan Kenobi'}, {name: 'Obi-Wan Kenobi Test'}, {new: true}) 615 | expect(doc).not.to.be.null; 616 | doc.name.should.equal('Obi-Wan Kenobi Test'); 617 | } catch (err) { 618 | should.not.exist(err); 619 | } 620 | }); 621 | 622 | it("updateOne() -> should find and update deleted document", async function () { 623 | try { 624 | const doc = await TestModel.updateOne({name: 'Obi-Wan Kenobi'}, {name: 'Obi-Wan Kenobi Test'}, {}); 625 | expect(doc).to.be.mongoose_ok(); 626 | expect(doc).to.be.mongoose_count(1); 627 | } catch (err) { 628 | should.not.exist(err); 629 | } 630 | }); 631 | 632 | it("updateOne() -> should find and update not deleted document", async function () { 633 | try { 634 | const doc = await TestModel.updateOne({name: 'Darth Vader'}, {name: 'Darth Vader Test'}); 635 | expect(doc).to.be.mongoose_ok(); 636 | expect(doc).to.be.mongoose_count(1); 637 | } catch (err) { 638 | should.not.exist(err); 639 | } 640 | }); 641 | 642 | it("updateOne() -> should insert new document", async function () { 643 | try { 644 | const doc = await TestModel.updateOne({name: 'Obi-Wan Kenobi Upsert'}, {name: 'Obi-Wan Kenobi Upsert Test'}, { upsert: true }) 645 | 646 | expect(doc).to.be.mongoose_ok(); 647 | 648 | if (mongooseMajorVersion >= 6) { 649 | expect(doc.upsertedId).not.to.be.null; 650 | expect(doc.upsertedId).not.to.be.undefined; 651 | 652 | doc.upsertedCount.should.equal(1); 653 | } else { 654 | expect(doc.upserted).not.to.be.null; 655 | expect(doc.upserted).not.to.be.undefined; 656 | 657 | expect(doc).to.be.mongoose_count(1); 658 | } 659 | } catch (err) { 660 | should.not.exist(err); 661 | } 662 | }); 663 | 664 | it("updateMany() -> should update deleted document", async function () { 665 | try { 666 | const doc = await TestModel.updateMany({name: 'Obi-Wan Kenobi'}, {name: 'Obi-Wan Kenobi Test'}); 667 | expect(doc).to.be.mongoose_ok(); 668 | expect(doc).to.be.mongoose_count(1); 669 | } catch (err) { 670 | should.not.exist(err); 671 | } 672 | }); 673 | }); 674 | 675 | describe("check overridden static methods: { overrideMethods: 'all' }", function () { 676 | var TestSchema = new Schema({name: String}, {collection: 'mongoose_delete_test'}); 677 | TestSchema.plugin(mongoose_delete, {overrideMethods: 'all'}); 678 | var TestModel = mongoose.model('Test5', TestSchema); 679 | 680 | beforeEach(async function () { 681 | await TestModel.create( 682 | [ 683 | {name: 'Obi-Wan Kenobi', deleted: true}, 684 | {name: 'Darth Vader'}, 685 | {name: 'Luke Skywalker', deleted: true} 686 | ]); 687 | }); 688 | 689 | afterEach(async function () { 690 | await mongoose.connection.db.dropCollection("mongoose_delete_test"); 691 | }); 692 | 693 | it("countDocuments() -> should return 1 documents", async function () { 694 | try { 695 | const count = await TestModel.countDocuments(); 696 | count.should.equal(1); 697 | } catch (err) { 698 | should.not.exist(err); 699 | } 700 | }); 701 | 702 | it("countDocumentsDeleted() -> should return 2 deleted documents", async function () { 703 | try { 704 | const count = await TestModel.countDocumentsDeleted(); 705 | count.should.equal(2); 706 | } catch (err) { 707 | should.not.exist(err); 708 | } 709 | }); 710 | 711 | it("countDocumentsWithDeleted() -> should return 3 documents", async function () { 712 | try { 713 | const count = await TestModel.countDocumentsWithDeleted(); 714 | count.should.equal(3); 715 | } catch (err) { 716 | should.not.exist(err); 717 | } 718 | }); 719 | 720 | it("find() -> should return 1 documents", async function () { 721 | try { 722 | const documents = await TestModel.find(); 723 | documents.length.should.equal(1); 724 | } catch (err) { 725 | should.not.exist(err); 726 | } 727 | }); 728 | 729 | it("findDeleted() -> should return 2 documents", async function () { 730 | try { 731 | const documents = await TestModel.findDeleted(); 732 | documents.length.should.equal(2); 733 | } catch (err) { 734 | should.not.exist(err); 735 | } 736 | }); 737 | 738 | it("findWithDeleted() -> should return 3 documents", async function () { 739 | try { 740 | const documents = await TestModel.findWithDeleted(); 741 | documents.length.should.equal(3); 742 | } catch (err) { 743 | should.not.exist(err); 744 | } 745 | }); 746 | 747 | it("findOne() -> should not return 1 deleted document", async function () { 748 | try { 749 | const doc = await TestModel.findOne({name: 'Obi-Wan Kenobi'}); 750 | expect(doc).to.be.null; 751 | } catch (err) { 752 | should.not.exist(err); 753 | } 754 | }); 755 | 756 | it("findOneDeleted() -> should return 1 deleted document", async function () { 757 | try { 758 | const doc = await TestModel.findOneDeleted({name: 'Obi-Wan Kenobi'}); 759 | expect(doc).not.to.be.null; 760 | } catch (err) { 761 | should.not.exist(err); 762 | } 763 | }); 764 | 765 | it("findOneWithDeleted() -> should return 1 deleted document", async function () { 766 | try { 767 | const doc = await TestModel.findOneWithDeleted({name: 'Obi-Wan Kenobi'}); 768 | expect(doc).not.to.be.null; 769 | } catch (err) { 770 | should.not.exist(err); 771 | } 772 | }); 773 | 774 | it("findOneWithDeleted() -> should return 1 not deleted document", async function () { 775 | try { 776 | const doc = await TestModel.findOneWithDeleted({name: 'Darth Vader'}); 777 | expect(doc).not.to.be.null; 778 | } catch (err) { 779 | should.not.exist(err); 780 | } 781 | }); 782 | 783 | it("findOneAndUpdate() -> should not find and update deleted document", async function () { 784 | try { 785 | const doc = await TestModel.findOneAndUpdate({name: 'Obi-Wan Kenobi'}, {name: 'Obi-Wan Kenobi Test'}, {new: true}); 786 | expect(doc).to.be.null; 787 | } catch (err) { 788 | should.not.exist(err); 789 | } 790 | }); 791 | 792 | it("findOneAndUpdateDeleted() -> should find and update deleted document", async function () { 793 | try { 794 | const doc = await TestModel.findOneAndUpdateDeleted({name: 'Obi-Wan Kenobi'}, {name: 'Obi-Wan Kenobi Test'}, {new: true}); 795 | expect(doc).not.to.be.null; 796 | } catch (err) { 797 | should.not.exist(err); 798 | } 799 | }); 800 | 801 | it("findOneAndUpdateWithDeleted() -> should find and update deleted document", async function () { 802 | try { 803 | const doc = await TestModel.findOneAndUpdateWithDeleted({name: 'Obi-Wan Kenobi'}, {name: 'Obi-Wan Kenobi Test'}, {new: true}); 804 | expect(doc).not.to.be.null; 805 | } catch (err) { 806 | should.not.exist(err); 807 | } 808 | }); 809 | 810 | it("findOneAndUpdateWithDeleted() -> should find and update not deleted document", async function () { 811 | try { 812 | const doc = await TestModel.findOneAndUpdateWithDeleted({name: 'Darth Vader'}, {name: 'Darth Vader Test'}, {new: true}); 813 | expect(doc).not.to.be.null; 814 | } catch (err) { 815 | should.not.exist(err); 816 | } 817 | }); 818 | 819 | it("updateOne(conditions, update, options, callback) -> should not update first deleted document", async function () { 820 | try { 821 | const doc = await TestModel.updateOne({name: 'Luke Skywalker'}, {name: 'Luke Skywalker Test'}, {}); 822 | expect(doc).to.be.mongoose_ok(); 823 | expect(doc).to.be.mongoose_count(0); 824 | } catch (err) { 825 | should.not.exist(err); 826 | } 827 | }); 828 | 829 | it("updateOne(conditions, update, options, callback) -> should insert new document", async function () { 830 | try { 831 | const doc = await TestModel.updateOne({name: 'Luke Skywalker'}, {name: 'Luke Skywalker'}, {upsert: true}); 832 | 833 | expect(doc).to.be.mongoose_ok(); 834 | 835 | if (mongooseMajorVersion >= 6) { 836 | expect(doc.upsertedId).not.to.be.null; 837 | expect(doc.upsertedId).not.to.be.undefined; 838 | doc.upsertedCount.should.equal(1); 839 | } else { 840 | expect(doc.upserted).not.to.be.null; 841 | expect(doc.upserted).not.to.be.undefined; 842 | expect(doc).to.be.mongoose_count(1); 843 | } 844 | } catch (err) { 845 | should.not.exist(err); 846 | } 847 | }); 848 | 849 | it("updateMany(conditions, update, options, callback) -> should not update deleted documents", async function () { 850 | try { 851 | const doc = await TestModel.updateMany({}, {name: 'Luke Skywalker Test'}, {multi: true}); 852 | expect(doc).to.be.mongoose_ok(); 853 | expect(doc).to.be.mongoose_count(1); 854 | } catch (err) { 855 | should.not.exist(err); 856 | } 857 | }); 858 | 859 | it("updateOne(conditions, update, options) -> should not update first deleted document", async function () { 860 | try { 861 | const doc = await TestModel.updateOne({name: 'Luke Skywalker'}, {name: 'Luke Skywalker Test'}, {}); 862 | expect(doc).to.be.mongoose_ok(); 863 | expect(doc).to.be.mongoose_count(0); 864 | } catch (err) { 865 | should.not.exist(err); 866 | } 867 | }); 868 | 869 | it("updateOne(conditions, update, options) -> should insert new document", async function () { 870 | try { 871 | const doc = await TestModel.updateOne({name: 'Luke Skywalker'}, {name: 'Luke Skywalker Test'}, {upsert: true}); 872 | 873 | expect(doc).to.be.mongoose_ok(); 874 | 875 | if (mongooseMajorVersion >= 6) { 876 | expect(doc.upsertedId).not.to.be.null; 877 | expect(doc.upsertedId).not.to.be.undefined; 878 | doc.upsertedCount.should.equal(1); 879 | } else { 880 | expect(doc.upserted).not.to.be.null; 881 | expect(doc.upserted).not.to.be.undefined; 882 | expect(doc).to.be.mongoose_count(1); 883 | } 884 | } catch (err) { 885 | should.not.exist(err); 886 | } 887 | }); 888 | 889 | it("updateMany(conditions, update, options) -> should not update deleted documents", async function () { 890 | try { 891 | const doc = await TestModel.updateMany({}, {name: 'Luke Skywalker Test'}, {multi: true}); 892 | expect(doc).to.be.mongoose_ok(); 893 | expect(doc).to.be.mongoose_count(1); 894 | } catch (err) { 895 | 896 | } 897 | }); 898 | 899 | it("updateOne(conditions, update, callback) -> should not update first deleted document", async function () { 900 | try { 901 | const doc = await TestModel.updateOne({name: 'Luke Skywalker'}, {name: 'Luke Skywalker Test'}); 902 | expect(doc).to.be.mongoose_ok(); 903 | expect(doc).to.be.mongoose_count(0); 904 | } catch (err) { 905 | should.not.exist(err); 906 | } 907 | }); 908 | 909 | it("updateMany(conditions, update, callback) -> should not update deleted documents", async function () { 910 | try { 911 | const doc = await TestModel.updateMany({}, {name: 'Luke Skywalker Test'}); 912 | expect(doc).to.be.mongoose_ok(); 913 | expect(doc).to.be.mongoose_count(1); 914 | } catch (err) { 915 | should.not.exist(err); 916 | } 917 | }); 918 | 919 | it("updateOne(conditions, update) -> should not update first deleted document", async function () { 920 | try { 921 | const doc = await TestModel.updateOne({name: 'Luke Skywalker'}, {name: 'Luke Skywalker Test'}, {}); 922 | expect(doc).to.be.mongoose_ok(); 923 | expect(doc).to.be.mongoose_count(0); 924 | } catch (err) { 925 | should.not.exist(err); 926 | } 927 | }); 928 | 929 | it("updateMany(conditions, update) -> should not update deleted documents", async function () { 930 | try { 931 | const doc = await TestModel.updateMany({}, {name: 'Luke Skywalker Test'}); 932 | expect(doc).to.be.mongoose_ok(); 933 | expect(doc).to.be.mongoose_count(1); 934 | } catch (err) { 935 | should.not.exist(err); 936 | } 937 | }); 938 | 939 | it("updateOneDeleted(conditions, update, options, callback) -> should update first deleted document", async function () { 940 | try { 941 | const doc = await TestModel.updateOneDeleted({name: 'Luke Skywalker'}, {name: 'Luke Skywalker Test'}, {}); 942 | 943 | expect(doc).to.be.mongoose_ok(); 944 | expect(doc).to.be.mongoose_count(1); 945 | } catch (err) { 946 | should.not.exist(err); 947 | } 948 | }); 949 | 950 | it("updateOneDeleted(conditions, update, options, callback) -> should update first deleted document", async function () { 951 | try { 952 | const doc = await TestModel.updateOneDeleted({name: 'Luke Skywalker'}, {name: 'Luke Skywalker Test'}, {upsert: true}); 953 | 954 | expect(doc.upserted).to.be.undefined; 955 | expect(doc).to.be.mongoose_ok(); 956 | expect(doc).to.be.mongoose_count(1); 957 | } catch (err) { 958 | should.not.exist(err); 959 | } 960 | 961 | }); 962 | 963 | it("updateManyDeleted() -> should update deleted document", async function () { 964 | try { 965 | const doc = await TestModel.updateManyDeleted({}, {name: 'Test 123'}, {multi: true}); 966 | 967 | expect(doc).to.be.mongoose_ok(); 968 | expect(doc).to.be.mongoose_count(2); 969 | } catch (err) { 970 | should.not.exist(err); 971 | } 972 | }); 973 | 974 | it("updateOneWithDeleted(conditions, update, options, callback) -> should update first deleted document", async function () { 975 | try { 976 | const doc = await TestModel.updateOneWithDeleted({name: 'Luke Skywalker'}, {name: 'Luke Skywalker Test'}, {}); 977 | 978 | expect(doc).to.be.mongoose_ok(); 979 | expect(doc).to.be.mongoose_count(1); 980 | } catch (err) { 981 | should.not.exist(err); 982 | } 983 | }); 984 | 985 | it("updateOneWithDeleted(conditions, update, options, callback) -> should update first deleted document", async function () { 986 | try { 987 | const doc = await TestModel.updateOneWithDeleted({name: 'Luke Skywalker'}, {name: 'Luke Skywalker Test'}, {upsert: true}); 988 | 989 | expect(doc.upserted).to.be.undefined; 990 | 991 | expect(doc).to.be.mongoose_ok(); 992 | expect(doc).to.be.mongoose_count(1); 993 | } catch (err) { 994 | should.not.exist(err); 995 | } 996 | }); 997 | 998 | it("updateManyWithDeleted() -> should update all document", async function () { 999 | try { 1000 | const doc = await TestModel.updateManyWithDeleted({}, {name: 'Test 654'}, {multi: true}); 1001 | 1002 | expect(doc).to.be.mongoose_ok(); 1003 | expect(doc).to.be.mongoose_count(3); 1004 | } catch (err) { 1005 | should.not.exist(err); 1006 | } 1007 | }); 1008 | }); 1009 | 1010 | describe("check the existence of override static methods: { overrideMethods: true }", function () { 1011 | var TestSchema = new Schema({name: String}, {collection: 'mongoose_delete_test'}); 1012 | TestSchema.plugin(mongoose_delete, {overrideMethods: true}); 1013 | var TestModel = mongoose.model('Test6', TestSchema); 1014 | 1015 | it("count() -> method should exist", function () { 1016 | expect(TestModel.count).to.exist; 1017 | }); 1018 | 1019 | it("countDeleted() -> method should exist", function () { 1020 | expect(TestModel.countDeleted).to.exist; 1021 | }); 1022 | 1023 | it("countWithDeleted() -> method should exist", function () { 1024 | expect(TestModel.countWithDeleted).to.exist; 1025 | }); 1026 | 1027 | it("countDocuments() -> method should exist", function () { 1028 | expect(TestModel.countDocuments).to.exist; 1029 | }); 1030 | 1031 | it("countDocumentsDeleted() -> method should exist", function () { 1032 | expect(TestModel.countDocumentsDeleted).to.exist; 1033 | }); 1034 | 1035 | it("countDocumentsWithDeleted() -> method should exist", function () { 1036 | expect(TestModel.countDocumentsWithDeleted).to.exist; 1037 | }); 1038 | 1039 | it("find() -> method should exist", function () { 1040 | expect(TestModel.find).to.exist; 1041 | }); 1042 | 1043 | it("findDeleted() -> method should exist", function () { 1044 | expect(TestModel.findDeleted).to.exist; 1045 | }); 1046 | 1047 | it("findWithDeleted() -> method should exist", function () { 1048 | expect(TestModel.findWithDeleted).to.exist; 1049 | }); 1050 | 1051 | it("findOne() -> method should exist", function () { 1052 | expect(TestModel.findOne).to.exist; 1053 | }); 1054 | 1055 | it("findOneDeleted() -> method should exist", function () { 1056 | expect(TestModel.findOneDeleted).to.exist; 1057 | }); 1058 | 1059 | it("findOneWithDeleted() -> method should exist", function () { 1060 | expect(TestModel.findOneWithDeleted).to.exist; 1061 | }); 1062 | 1063 | it("findOneAndUpdate() -> method should exist", function () { 1064 | expect(TestModel.findOneAndUpdate).to.exist; 1065 | }); 1066 | 1067 | it("findOneAndUpdateDeleted() -> method should exist", function () { 1068 | expect(TestModel.findOneAndUpdateDeleted).to.exist; 1069 | }); 1070 | 1071 | it("findOneAndUpdateWithDeleted() -> method should exist", function () { 1072 | expect(TestModel.findOneAndUpdateWithDeleted).to.exist; 1073 | }); 1074 | 1075 | it("update() -> method should exist", function () { 1076 | expect(TestModel.update).to.exist; 1077 | }); 1078 | 1079 | it("updateDeleted() -> method should exist", function () { 1080 | expect(TestModel.updateDeleted).to.exist; 1081 | }); 1082 | 1083 | it("updateWithDeleted() -> method should exist", function () { 1084 | expect(TestModel.updateWithDeleted).to.exist; 1085 | }); 1086 | 1087 | it("updateOne() -> method should exist", function () { 1088 | expect(TestModel.updateOne).to.exist; 1089 | }); 1090 | 1091 | it("updateOneDeleted() -> method should exist", function () { 1092 | expect(TestModel.updateOneDeleted).to.exist; 1093 | }); 1094 | 1095 | it("updateOneWithDeleted() -> method should exist", function () { 1096 | expect(TestModel.updateOneWithDeleted).to.exist; 1097 | }); 1098 | 1099 | it("updateMany() -> method should exist", function () { 1100 | expect(TestModel.updateMany).to.exist; 1101 | }); 1102 | 1103 | it("updateManyDeleted() -> method should exist", function () { 1104 | expect(TestModel.updateManyDeleted).to.exist; 1105 | }); 1106 | 1107 | it("updateManyWithDeleted() -> method should exist", function () { 1108 | expect(TestModel.updateManyWithDeleted).to.exist; 1109 | }); 1110 | }); 1111 | 1112 | describe("check the existence of override static methods: { overrideMethods: ['testError', 'count', 'countDocuments', 'find', 'findOne', 'findOneAndUpdate', 'update', 'updateOne', 'updateMany'] }", function () { 1113 | var TestSchema = new Schema({name: String}, {collection: 'mongoose_delete_test'}); 1114 | TestSchema.plugin(mongoose_delete, {overrideMethods: ['testError', 'count', 'countDocuments', 'find', 'findOne', 'findOneAndUpdate', 'update', 'updateOne', 'updateMany']}); 1115 | var TestModel = mongoose.model('Test7', TestSchema); 1116 | 1117 | it("testError() -> method should not exist", function () { 1118 | expect(TestModel.testError).to.not.exist; 1119 | }); 1120 | 1121 | it("count() -> method should exist", function () { 1122 | expect(TestModel.count).to.exist; 1123 | }); 1124 | 1125 | it("countDeleted() -> method should exist", function () { 1126 | expect(TestModel.countDeleted).to.exist; 1127 | }); 1128 | 1129 | it("countWithDeleted() -> method should exist", function () { 1130 | expect(TestModel.countWithDeleted).to.exist; 1131 | }); 1132 | 1133 | it("countDocuments() -> method should exist", function () { 1134 | expect(TestModel.countDocuments).to.exist; 1135 | }); 1136 | 1137 | it("countDocumentsDeleted() -> method should exist", function () { 1138 | expect(TestModel.countDocumentsDeleted).to.exist; 1139 | }); 1140 | 1141 | it("countDocumentsWithDeleted() -> method should exist", function () { 1142 | expect(TestModel.countDocumentsWithDeleted).to.exist; 1143 | }); 1144 | 1145 | it("find() -> method should exist", function () { 1146 | expect(TestModel.find).to.exist; 1147 | }); 1148 | 1149 | it("findDeleted() -> method should exist", function () { 1150 | expect(TestModel.findDeleted).to.exist; 1151 | }); 1152 | 1153 | it("findWithDeleted() -> method should exist", function () { 1154 | expect(TestModel.findWithDeleted).to.exist; 1155 | }); 1156 | 1157 | it("findOne() -> method should exist", function () { 1158 | expect(TestModel.findOne).to.exist; 1159 | }); 1160 | 1161 | it("findOneDeleted() -> method should exist", function () { 1162 | expect(TestModel.findOneDeleted).to.exist; 1163 | }); 1164 | 1165 | it("findOneWithDeleted() -> method should exist", function () { 1166 | expect(TestModel.findOneWithDeleted).to.exist; 1167 | }); 1168 | 1169 | it("findOneAndUpdate() -> method should exist", function () { 1170 | expect(TestModel.findOneAndUpdate).to.exist; 1171 | }); 1172 | 1173 | it("findOneAndUpdateDeleted() -> method should exist", function () { 1174 | expect(TestModel.findOneAndUpdateDeleted).to.exist; 1175 | }); 1176 | 1177 | it("findOneAndUpdateWithDeleted() -> method should exist", function () { 1178 | expect(TestModel.findOneAndUpdateWithDeleted).to.exist; 1179 | }); 1180 | 1181 | it("update() -> method should exist", function () { 1182 | expect(TestModel.update).to.exist; 1183 | }); 1184 | 1185 | it("updateDeleted() -> method should exist", function () { 1186 | expect(TestModel.updateDeleted).to.exist; 1187 | }); 1188 | 1189 | it("updateWithDeleted() -> method should exist", function () { 1190 | expect(TestModel.updateWithDeleted).to.exist; 1191 | }); 1192 | 1193 | it("updateOne() -> method should exist", function () { 1194 | expect(TestModel.updateOne).to.exist; 1195 | }); 1196 | 1197 | it("updateOneDeleted() -> method should exist", function () { 1198 | expect(TestModel.updateOneDeleted).to.exist; 1199 | }); 1200 | 1201 | it("updateOneWithDeleted() -> method should exist", function () { 1202 | expect(TestModel.updateOneWithDeleted).to.exist; 1203 | }); 1204 | 1205 | it("updateMany() -> method should exist", function () { 1206 | expect(TestModel.updateMany).to.exist; 1207 | }); 1208 | 1209 | it("updateManyDeleted() -> method should exist", function () { 1210 | expect(TestModel.updateManyDeleted).to.exist; 1211 | }); 1212 | 1213 | it("updateManyWithDeleted() -> method should exist", function () { 1214 | expect(TestModel.updateManyWithDeleted).to.exist; 1215 | }); 1216 | }); 1217 | 1218 | describe("check the existence of override static methods: { overrideMethods: ['count', 'countDocuments', 'find'] }", function () { 1219 | var TestSchema = new Schema({name: String}, {collection: 'mongoose_delete_test'}); 1220 | TestSchema.plugin(mongoose_delete, {overrideMethods: ['count', 'countDocuments', 'find']}); 1221 | var TestModel = mongoose.model('Test8', TestSchema); 1222 | 1223 | it("testError() -> method should not exist", function () { 1224 | expect(TestModel.testError).to.not.exist; 1225 | }); 1226 | 1227 | it("count() -> method should exist", function () { 1228 | expect(TestModel.count).to.exist; 1229 | }); 1230 | 1231 | it("countDeleted() -> method should exist", function () { 1232 | expect(TestModel.countDeleted).to.exist; 1233 | }); 1234 | 1235 | it("countWithDeleted() -> method should exist", function () { 1236 | expect(TestModel.countWithDeleted).to.exist; 1237 | }); 1238 | 1239 | it("countDocuments() -> method should exist", function () { 1240 | expect(TestModel.countDocuments).to.exist; 1241 | }); 1242 | 1243 | it("countDocumentsDeleted() -> method should exist", function () { 1244 | expect(TestModel.countDocumentsDeleted).to.exist; 1245 | }); 1246 | 1247 | it("countDocumentsWithDeleted() -> method should exist", function () { 1248 | expect(TestModel.countDocumentsWithDeleted).to.exist; 1249 | }); 1250 | 1251 | it("find() -> method should exist", function () { 1252 | expect(TestModel.find).to.exist; 1253 | }); 1254 | 1255 | it("findDeleted() -> method should exist", function () { 1256 | expect(TestModel.findDeleted).to.exist; 1257 | }); 1258 | 1259 | it("findWithDeleted() -> method should exist", function () { 1260 | expect(TestModel.findWithDeleted).to.exist; 1261 | }); 1262 | 1263 | it("findOne() -> method should exist", function () { 1264 | expect(TestModel.findOne).to.exist; 1265 | }); 1266 | 1267 | it("findOneDeleted() -> method should not exist", function () { 1268 | expect(TestModel.findOneDeleted).to.not.exist; 1269 | }); 1270 | 1271 | it("findOneWithDeleted() -> method should not exist", function () { 1272 | expect(TestModel.findOneWithDeleted).to.not.exist; 1273 | }); 1274 | 1275 | it("findOneAndUpdate() -> method should exist", function () { 1276 | expect(TestModel.findOneAndUpdate).to.exist; 1277 | }); 1278 | 1279 | it("findOneAndUpdateDeleted() -> method should not exist", function () { 1280 | expect(TestModel.findOneAndUpdateDeleted).to.not.exist; 1281 | }); 1282 | 1283 | it("findOneAndUpdateWithDeleted() -> method should not exist", function () { 1284 | expect(TestModel.findOneAndUpdateWithDeleted).to.not.exist; 1285 | }); 1286 | 1287 | it("update() -> method should exist", function () { 1288 | if (mongooseMajorVersion <= 6) { 1289 | expect(TestModel.update).to.exist; 1290 | } 1291 | }); 1292 | 1293 | it("updateDeleted() -> method should not exist", function () { 1294 | expect(TestModel.updateDeleted).to.not.exist; 1295 | }); 1296 | 1297 | it("updateWithDeleted() -> method should not exist", function () { 1298 | expect(TestModel.updateWithDeleted).to.not.exist; 1299 | }); 1300 | 1301 | it("updateOne() -> method should exist", function () { 1302 | expect(TestModel.updateOne).to.exist; 1303 | }); 1304 | 1305 | it("updateOneDeleted() -> method should not exist", function () { 1306 | expect(TestModel.updateOneDeleted).to.not.exist; 1307 | }); 1308 | 1309 | it("updateOneWithDeleted() -> method should not exist", function () { 1310 | expect(TestModel.updateOneWithDeleted).to.not.exist; 1311 | }); 1312 | 1313 | it("updateMany() -> method should exist", function () { 1314 | expect(TestModel.updateMany).to.exist; 1315 | }); 1316 | 1317 | it("updateManyDeleted() -> method should not exist", function () { 1318 | expect(TestModel.updateManyDeleted).to.not.exist; 1319 | }); 1320 | 1321 | it("updateManyWithDeleted() -> method should not exist", function () { 1322 | expect(TestModel.updateManyWithDeleted).to.not.exist; 1323 | }); 1324 | }); 1325 | 1326 | describe("delete multiple documents", function () { 1327 | var TestSchema = new Schema({name: String, side: Number}, {collection: 'mongoose_delete_test'}); 1328 | TestSchema.plugin(mongoose_delete, {overrideMethods: 'all', deletedAt: true, deletedBy: true}); 1329 | var TestModel = mongoose.model('Test14', TestSchema); 1330 | 1331 | beforeEach(async function () { 1332 | await TestModel.create( 1333 | [ 1334 | {name: 'Obi-Wan Kenobi', side: 0}, 1335 | {name: 'Darth Vader', side: 1}, 1336 | {name: 'Luke Skywalker', side: 0} 1337 | ]); 1338 | }); 1339 | 1340 | afterEach(async function () { 1341 | await mongoose.connection.db.dropCollection("mongoose_delete_test"); 1342 | }); 1343 | 1344 | var userId = getNewObjectId("53da93b16b4a6670076b16bf") 1345 | 1346 | it("delete() -> delete multiple documents", async function () { 1347 | try { 1348 | const documents = await TestModel.delete(); 1349 | 1350 | expect(documents).to.be.mongoose_ok(); 1351 | expect(documents).to.be.mongoose_count(3); 1352 | } catch (err) { 1353 | should.not.exist(err); 1354 | } 1355 | }); 1356 | 1357 | it("delete(query) -> delete multiple documents with conditions", async function () { 1358 | try { 1359 | const documents = await TestModel.delete({side: 0}); 1360 | 1361 | expect(documents).to.be.mongoose_ok(); 1362 | expect(documents).to.be.mongoose_count(2); 1363 | } catch (err) { 1364 | should.not.exist(err); 1365 | } 1366 | }); 1367 | 1368 | it("delete(query, deletedBy) -> delete multiple documents with conditions and user ID", async function () { 1369 | try { 1370 | const documents = await TestModel.delete({side: 1}, userId); 1371 | 1372 | expect(documents).to.be.mongoose_ok(); 1373 | expect(documents).to.be.mongoose_count(1); 1374 | } catch (err) { 1375 | should.not.exist(err); 1376 | } 1377 | }); 1378 | 1379 | it("delete().exec() -> delete all documents", async function () { 1380 | try { 1381 | const documents = await TestModel.delete().exec(); 1382 | 1383 | expect(documents).to.be.mongoose_ok(); 1384 | expect(documents).to.be.mongoose_count(3); 1385 | } catch (err) { 1386 | should.not.exist(err); 1387 | } 1388 | }); 1389 | 1390 | it("delete(query).exec() -> delete multiple documents with conditions", async function () { 1391 | try { 1392 | const documents = await TestModel.delete({side: 0}).exec(); 1393 | 1394 | expect(documents).to.be.mongoose_ok(); 1395 | expect(documents).to.be.mongoose_count(2); 1396 | } catch (err) { 1397 | should.not.exist(err); 1398 | } 1399 | }); 1400 | 1401 | it("delete(query, deletedBy).exec() -> delete multiple documents with conditions and user ID", async function () { 1402 | try { 1403 | const documents = await TestModel.delete({side: 1}, userId).exec(); 1404 | 1405 | expect(documents).to.be.mongoose_count(1); 1406 | expect(documents).to.be.mongoose_ok(); 1407 | } catch (err) { 1408 | should.not.exist(err); 1409 | } 1410 | }); 1411 | 1412 | it("delete({}, deletedBy).exec() -> delete all documents passing user ID", async function () { 1413 | try { 1414 | const documents = await TestModel.delete({}, userId).exec(); 1415 | 1416 | expect(documents).to.be.mongoose_count(3); 1417 | expect(documents).to.be.mongoose_ok(); 1418 | } catch (err) { 1419 | should.not.exist(err); 1420 | } 1421 | }); 1422 | }); 1423 | 1424 | describe("restore multiple documents", function () { 1425 | var TestSchema = new Schema({name: String, side: Number}, {collection: 'mongoose_restore_test'}); 1426 | TestSchema.plugin(mongoose_delete, {overrideMethods: 'all', deletedAt: true, deletedBy: true}); 1427 | var TestModel = mongoose.model('Test15', TestSchema); 1428 | 1429 | beforeEach(async function () { 1430 | await TestModel.create( 1431 | [ 1432 | {name: 'Obi-Wan Kenobi', side: 0}, 1433 | {name: 'Darth Vader', side: 1, deleted: true}, 1434 | {name: 'Luke Skywalker', side: 0, deleted: true, deletedAt: new Date()} 1435 | ] 1436 | ); 1437 | }); 1438 | 1439 | afterEach(async function () { 1440 | await mongoose.connection.db.dropCollection("mongoose_restore_test"); 1441 | }); 1442 | 1443 | it("restore() -> restore all documents", async function () { 1444 | try { 1445 | const documents = await TestModel.restore(); 1446 | 1447 | expect(documents).to.be.mongoose_ok(); 1448 | expect(documents).to.be.mongoose_count(3); 1449 | } catch (err) { 1450 | should.not.exist(err); 1451 | } 1452 | }); 1453 | 1454 | it("restore(query) -> restore multiple documents with conditions", async function () { 1455 | try { 1456 | const documents = await TestModel.restore({side: 0}); 1457 | 1458 | expect(documents).to.be.mongoose_ok(); 1459 | expect(documents).to.be.mongoose_count(2); 1460 | } catch (err) { 1461 | should.not.exist(err); 1462 | } 1463 | }); 1464 | 1465 | it("restore().exec() -> restore all documents", async function () { 1466 | try { 1467 | const documents = await TestModel.restore().exec(); 1468 | 1469 | expect(documents).to.be.mongoose_ok(); 1470 | expect(documents).to.be.mongoose_count(3); 1471 | } catch (err) { 1472 | should.not.exist(err); 1473 | } 1474 | }); 1475 | 1476 | it("restore(query).exec() -> restore multiple documents with conditions", async function () { 1477 | try { 1478 | const documents = await TestModel.restore({side: 0}).exec(); 1479 | 1480 | expect(documents).to.be.mongoose_ok(); 1481 | expect(documents).to.be.mongoose_count(2); 1482 | } catch (err) { 1483 | should.not.exist(err); 1484 | } 1485 | }); 1486 | 1487 | }); 1488 | 1489 | describe("model validation on delete (default): { validateBeforeDelete: true }", function () { 1490 | var TestSchema = new Schema({ name: {type: String, required: true}}, {collection: 'mongoose_restore_test'}); 1491 | TestSchema.plugin(mongoose_delete); 1492 | var TestModel = mongoose.model('Test17', TestSchema); 1493 | 1494 | beforeEach(async function () { 1495 | await TestModel.create( 1496 | [ 1497 | {name: 'Luke Skywalker'} 1498 | ]); 1499 | }); 1500 | 1501 | afterEach(async function () { 1502 | await mongoose.connection.db.dropCollection("mongoose_restore_test"); 1503 | }); 1504 | 1505 | it("delete() -> should raise ValidationError error", async function () { 1506 | try { 1507 | const luke = await TestModel.findOne({name: 'Luke Skywalker'}); 1508 | luke.name = ""; 1509 | try { 1510 | await luke.delete(); 1511 | } catch (e) { 1512 | e.should.exist; 1513 | e.name.should.exist; 1514 | e.name.should.equal('ValidationError'); 1515 | } 1516 | } catch (err) { 1517 | should.not.exist(err); 1518 | } 1519 | }); 1520 | 1521 | it("delete() -> should not raise ValidationError error", async function () { 1522 | try { 1523 | const luke = await TestModel.findOne({name: 'Luke Skywalker'}); 1524 | luke.name = "Test Name"; 1525 | try { 1526 | await luke.delete(); 1527 | } catch (e) { 1528 | should.not.exist(err); 1529 | } 1530 | } catch (err) { 1531 | should.not.exist(err); 1532 | } 1533 | }); 1534 | }); 1535 | 1536 | describe("model validation on delete: { validateBeforeDelete: false }", function () { 1537 | var TestSchema = new Schema({ 1538 | name: {type: String, required: true} 1539 | }, {collection: 'mongoose_restore_test'}); 1540 | TestSchema.plugin(mongoose_delete, {validateBeforeDelete: false}); 1541 | var TestModel = mongoose.model('Test18', TestSchema); 1542 | 1543 | beforeEach(async function () { 1544 | await TestModel.create( 1545 | [ 1546 | {name: 'Luke Skywalker'} 1547 | ]); 1548 | }); 1549 | 1550 | afterEach(async function () { 1551 | await mongoose.connection.db.dropCollection("mongoose_restore_test"); 1552 | }); 1553 | 1554 | it("delete() -> should not raise ValidationError error", async function () { 1555 | try { 1556 | const luke = await TestModel.findOne({name: 'Luke Skywalker'}) 1557 | luke.name = ""; 1558 | await luke.delete(); 1559 | } catch (err) { 1560 | should.not.exist(err); 1561 | } 1562 | }); 1563 | 1564 | it("delete() -> should not raise ValidationError error", async function () { 1565 | try { 1566 | const luke = await TestModel.findOne({name: 'Luke Skywalker'}) 1567 | luke.name = "Test Name"; 1568 | await luke.delete() 1569 | } catch (err) { 1570 | should.not.exist(err); 1571 | } 1572 | }); 1573 | }); 1574 | 1575 | describe("mongoose_delete indexFields options", function () { 1576 | 1577 | it("all fields must have index: { indexFields: true }", function () { 1578 | var TestSchema = new Schema({name: String}, {collection: 'mongoose_delete_test_indexFields'}); 1579 | TestSchema.plugin(mongoose_delete, {indexFields: true, deletedAt: true, deletedBy: true}); 1580 | var Test0 = mongoose.model('Test0_indexFields', TestSchema); 1581 | 1582 | expect(Test0.schema.paths.deleted._index).to.be.true; 1583 | expect(Test0.schema.paths.deletedAt._index).to.be.true; 1584 | expect(Test0.schema.paths.deletedBy._index).to.be.true; 1585 | }); 1586 | 1587 | it("all fields must have index: { indexFields: 'all' }", function () { 1588 | var TestSchema = new Schema({name: String}, {collection: 'mongoose_delete_test_indexFields'}); 1589 | TestSchema.plugin(mongoose_delete, {indexFields: 'all', deletedAt: true, deletedBy: true}); 1590 | var Test0 = mongoose.model('Test1_indexFields', TestSchema); 1591 | 1592 | expect(Test0.schema.paths.deleted._index).to.be.true; 1593 | expect(Test0.schema.paths.deletedAt._index).to.be.true; 1594 | expect(Test0.schema.paths.deletedBy._index).to.be.true; 1595 | }); 1596 | 1597 | it("only 'deleted' field must have index: { indexFields: ['deleted'] }", function () { 1598 | var TestSchema = new Schema({name: String}, {collection: 'mongoose_delete_test_indexFields'}); 1599 | TestSchema.plugin(mongoose_delete, {indexFields: ['deleted'], deletedAt: true, deletedBy: true}); 1600 | var Test0 = mongoose.model('Test2_indexFields', TestSchema); 1601 | 1602 | expect(Test0.schema.paths.deletedAt._index).to.be.false; 1603 | expect(Test0.schema.paths.deletedBy._index).to.be.false; 1604 | expect(Test0.schema.paths.deleted._index).to.be.true; 1605 | }); 1606 | 1607 | it("only 'deletedAt' and 'deletedBy' fields must have index: { indexFields: ['deletedAt', 'deletedBy'] }", function () { 1608 | var TestSchema = new Schema({name: String}, {collection: 'mongoose_delete_test_indexFields'}); 1609 | TestSchema.plugin(mongoose_delete, {indexFields: ['deletedAt', 'deletedBy'], deletedAt: true, deletedBy: true}); 1610 | var Test0 = mongoose.model('Test3_indexFields', TestSchema); 1611 | 1612 | expect(Test0.schema.paths.deleted._index).to.be.false; 1613 | expect(Test0.schema.paths.deletedAt._index).to.be.true; 1614 | expect(Test0.schema.paths.deletedBy._index).to.be.true; 1615 | }); 1616 | }); 1617 | 1618 | describe("check usage of $ne operator", function () { 1619 | var TestRawSchema = new Schema({name: String, deleted: Boolean}, {collection: 'mongoose_delete_test_ne'}); 1620 | var TestRawModel = mongoose.model('TestNeRaw', TestRawSchema); 1621 | 1622 | var TestSchema = new Schema({name: String}, {collection: 'mongoose_delete_test_ne'}); 1623 | TestSchema.plugin(mongoose_delete, {overrideMethods: 'all', use$neOperator: false}); 1624 | var TestModel = mongoose.model('Test55', TestSchema); 1625 | 1626 | before(async function () { 1627 | await TestRawModel.create( 1628 | [ 1629 | {name: 'One'}, 1630 | {name: 'Two', deleted: true}, 1631 | {name: 'Three', deleted: false} 1632 | ]); 1633 | }); 1634 | 1635 | after(async function () { 1636 | await mongoose.connection.db.dropCollection("mongoose_delete_test_ne"); 1637 | }); 1638 | 1639 | it("find() -> should return 1 documents", async function () { 1640 | try { 1641 | const documents = await TestModel.find(); 1642 | documents.length.should.equal(1); 1643 | } catch (err) { 1644 | should.not.exist(err); 1645 | } 1646 | }); 1647 | 1648 | it("findDeleted() -> should return 1 documents", async function () { 1649 | try { 1650 | const documents = await TestModel.findDeleted(); 1651 | documents.length.should.equal(1); 1652 | } catch (err) { 1653 | should.not.exist(err); 1654 | } 1655 | }); 1656 | }); 1657 | 1658 | describe("aggregate methods: { overrideMethods: ['aggregate'] }", function () { 1659 | var TestSchema = new Schema({ name: String }, { collection: 'mongoose_delete_test_aggregate' }); 1660 | TestSchema.plugin(mongoose_delete, { overrideMethods: ['aggregate'] }); 1661 | 1662 | var TestModel = mongoose.model('Test5_Aggregate', TestSchema); 1663 | 1664 | beforeEach(async function () { 1665 | await TestModel.create( 1666 | [ 1667 | { name: 'Obi-Wan Kenobi', deleted: true }, 1668 | { name: 'Darth Vader' }, 1669 | { name: 'Luke Skywalker', deleted: true } 1670 | ]); 1671 | }); 1672 | 1673 | afterEach(async function () { 1674 | await mongoose.connection.db.dropCollection("mongoose_delete_test_aggregate"); 1675 | }); 1676 | 1677 | it("aggregate([{$project : {name : 1} }]) -> should return 1 document", async function () { 1678 | try { 1679 | const documents = await TestModel.aggregate([{$project : { name : 1 }}]); 1680 | documents.length.should.equal(1); 1681 | } catch (err) { 1682 | should.not.exist(err); 1683 | } 1684 | }); 1685 | 1686 | it("aggregate([{$project : {name : 1} }]) -> should return 1 document (pipeline)", async function () { 1687 | try { 1688 | const documents = await TestModel 1689 | .aggregate() 1690 | .project({ name : 1 }); 1691 | 1692 | documents.length.should.equal(1); 1693 | } catch (err) { 1694 | should.not.exist(err); 1695 | } 1696 | }); 1697 | 1698 | it("aggregateDeleted([{$project : {name : 1} }]) -> should return deleted documents", async function () { 1699 | try { 1700 | const documents = await TestModel.aggregateDeleted([ 1701 | { 1702 | $project : { name : 1 } 1703 | } 1704 | ]); 1705 | 1706 | documents.length.should.equal(2); 1707 | } catch (err) { 1708 | should.not.exist(err); 1709 | } 1710 | }); 1711 | 1712 | it("aggregateDeleted([{$project : {name : 1} }]) -> should return deleted documents (pipeline)", async function () { 1713 | try { 1714 | const documents = await TestModel 1715 | .aggregateDeleted() 1716 | .project({ name : 1 }); 1717 | 1718 | documents.length.should.equal(2); 1719 | } catch (err) { 1720 | should.not.exist(err); 1721 | } 1722 | }); 1723 | 1724 | it("aggregateWithDeleted([{$project : {name : 1} }]) -> should return deleted documents", async function () { 1725 | try { 1726 | const documents = await TestModel.aggregateWithDeleted([ 1727 | { 1728 | $project : { name : 1 } 1729 | } 1730 | ]); 1731 | 1732 | documents.length.should.equal(3); 1733 | } catch (err) { 1734 | should.not.exist(err); 1735 | } 1736 | }); 1737 | 1738 | it("aggregateWithDeleted([{$project : {name : 1} }]) -> should return deleted documents (pipeline)", async function () { 1739 | try { 1740 | const documents = await TestModel 1741 | .aggregateWithDeleted() 1742 | .project({ name : 1 }); 1743 | 1744 | documents.length.should.equal(3); 1745 | } catch (err) { 1746 | should.not.exist(err); 1747 | } 1748 | }); 1749 | }); 1750 | 1751 | describe("aggregate methods & discriminator: { overrideMethods: ['aggregate'] }", function () { 1752 | var TestSchema = new Schema({ name: String }, { collection: 'mongoose_delete_test_aggregate', discriminatorKey:'kind' }); 1753 | TestSchema.plugin(mongoose_delete, { overrideMethods: ['aggregate'] }); 1754 | 1755 | var TestModel = mongoose.model('Test6_Aggregate', TestSchema); 1756 | var DiscriminatorTestModel = TestModel.discriminator('DiscriminatorTest',new Schema({ age: Number })) 1757 | 1758 | beforeEach(async function () { 1759 | await DiscriminatorTestModel.create( 1760 | [ 1761 | { name: 'Lando Calrissian', age: 46, deleted: true }, 1762 | { name: 'Han Solo', age: 44 }, 1763 | { name: 'Jabba Desilijic Tiure', age:617, deleted: true }, 1764 | { name: 'Boba Fett', age: 61 }, 1765 | ]); 1766 | }); 1767 | 1768 | afterEach(async function () { 1769 | await mongoose.connection.db.dropCollection("mongoose_delete_test_aggregate"); 1770 | }); 1771 | 1772 | it("aggregateWithDeleted([{ $match: { age:{ $gte: 50 } } }]) -> should return deleted documents from discriminator (pipeline)", async function () { 1773 | try { 1774 | var documents = await DiscriminatorTestModel 1775 | .aggregateWithDeleted([{ $match: { age:{ $gte: 50 } } }]) 1776 | .project({ name : 1, age:1 }); 1777 | 1778 | documents.length.should.equal(2); 1779 | } catch (err) { 1780 | should.not.exist(err); 1781 | } 1782 | }); 1783 | 1784 | it("aggregate([{ $match: { age:{ $gte: 50 } } }]) -> should return non-deleted documents from discriminator (pipeline)", async function () { 1785 | try { 1786 | var documents = await DiscriminatorTestModel 1787 | .aggregate([{ $match: { age:{ $gte: 50 } } }]) 1788 | .project({ name : 1, age:1 }); 1789 | 1790 | documents.length.should.equal(1); 1791 | } catch (err) { 1792 | should.not.exist(err); 1793 | } 1794 | }); 1795 | 1796 | it("aggregateDeleted([{ $match: { age:{ $gte: 50 } } }]) -> should return ONLY deleted documents from discriminator (pipeline)", async function () { 1797 | try { 1798 | var documents = await DiscriminatorTestModel 1799 | .aggregateDeleted([{ $match: { age:{ $gte: 50 } } }]) 1800 | .project({ name : 1, age: 1 }); 1801 | 1802 | documents.length.should.equal(1); 1803 | } catch (err) { 1804 | should.not.exist(err); 1805 | } 1806 | }); 1807 | }); 1808 | 1809 | describe("mongoose_delete find method overridden with populate", function () { 1810 | var TestPopulateSchema1 = new Schema( 1811 | { name: String }, 1812 | { collection: 'TestPopulate1' } 1813 | ); 1814 | TestPopulateSchema1.plugin(mongoose_delete, { overrideMethods: 'all' }); 1815 | var TestPopulate1 = mongoose.model('TestPopulate1', TestPopulateSchema1); 1816 | 1817 | var TestPopulateSchema2 = new Schema( 1818 | { 1819 | name: String, 1820 | test: { type: mongoose.Types.ObjectId, ref: 'TestPopulate1' } 1821 | }, 1822 | { collection: 'TestPopulate2' } 1823 | ); 1824 | TestPopulateSchema2.plugin(mongoose_delete, { overrideMethods: 'all' }); 1825 | var TestPopulate2 = mongoose.model('TestPopulate2', TestPopulateSchema2); 1826 | 1827 | beforeEach(async function () { 1828 | await TestPopulate1.create( 1829 | [ 1830 | { name: 'Obi-Wan Kenobi', _id: getNewObjectId("53da93b16b4a6670076b16b1"), deleted: true }, 1831 | { name: 'Darth Vader', _id: getNewObjectId("53da93b16b4a6670076b16b2") }, 1832 | { name: 'Luke Skywalker', _id: getNewObjectId("53da93b16b4a6670076b16b3"), deleted: true } 1833 | ] 1834 | ); 1835 | await TestPopulate2.create( 1836 | [ 1837 | { name: 'Student 1', test: getNewObjectId("53da93b16b4a6670076b16b1") }, 1838 | { name: 'Student 2', test: getNewObjectId("53da93b16b4a6670076b16b2") }, 1839 | { name: 'Student 3', test: getNewObjectId("53da93b16b4a6670076b16b3"), deleted: true } 1840 | ] 1841 | ) 1842 | }); 1843 | 1844 | afterEach(async function () { 1845 | await mongoose.connection.db.dropCollection("TestPopulate1"); 1846 | await mongoose.connection.db.dropCollection("TestPopulate2"); 1847 | }); 1848 | 1849 | it("populate() -> should not return deleted sub-document", async function () { 1850 | try { 1851 | const document = await TestPopulate2 1852 | .findOne({ name: 'Student 1' }) 1853 | .populate({ path: 'test' }); 1854 | 1855 | expect(document.test).to.be.null; 1856 | } catch (err) { 1857 | should.not.exist(err); 1858 | } 1859 | }); 1860 | 1861 | it("populate() -> should return the deleted sub-document using { withDeleted: true }", async function () { 1862 | try { 1863 | const document = await TestPopulate2 1864 | .findOne({ name: 'Student 1' }) 1865 | .populate({ path: 'test', options: { withDeleted: true } }); 1866 | 1867 | expect(document.test).not.to.be.null; 1868 | document.test.deleted.should.equal(true); 1869 | } catch (err) { 1870 | should.not.exist(err); 1871 | } 1872 | }); 1873 | 1874 | it("populate() -> should not return deleted documents and sub-documents", async function () { 1875 | try { 1876 | const documents = await TestPopulate2 1877 | .find({ }) 1878 | .populate({ path: 'test' }) 1879 | .exec(); 1880 | 1881 | var student1 = documents.findIndex(function(i) { return i.name === "Student 1" }); 1882 | var student2 = documents.findIndex(function(i) { return i.name === "Student 2" }); 1883 | 1884 | documents.length.should.equal(2) 1885 | expect(documents[student1].test).to.be.null; 1886 | expect(documents[student2].test).not.to.be.null; 1887 | } catch (err) { 1888 | should.not.exist(err); 1889 | } 1890 | }); 1891 | 1892 | it("populate() -> should return deleted documents and sub-documents", async function () { 1893 | try { 1894 | const documents = await TestPopulate2 1895 | .findWithDeleted() 1896 | .populate({ path: 'test', options: { withDeleted: true } }) 1897 | .exec(); 1898 | 1899 | documents.length.should.equal(3); 1900 | 1901 | var student1 = documents.findIndex(function(i) { return i.name === "Student 1" }); 1902 | var student2 = documents.findIndex(function(i) { return i.name === "Student 2" }); 1903 | var student3 = documents.findIndex(function(i) { return i.name === "Student 3" }); 1904 | 1905 | expect(documents[student1].test).not.to.be.null; 1906 | expect(documents[student2].test).not.to.be.null; 1907 | expect(documents[student3].test).not.to.be.null; 1908 | } catch (err) { 1909 | should.not.exist(err); 1910 | } 1911 | }); 1912 | }); 1913 | 1914 | describe("model validation on restore: { validateBeforeRestore: false }", function () { 1915 | var TestSchema = new Schema({ 1916 | name: { type: String, required: true } 1917 | }, { collection: 'mongoose_restore_test' }); 1918 | TestSchema.plugin(mongoose_delete, { validateBeforeRestore: false }); 1919 | var TestModel = mongoose.model('Test18_restore', TestSchema); 1920 | 1921 | beforeEach(async function () { 1922 | await TestModel.create( 1923 | [ 1924 | { name: 'Luke Skywalker' } 1925 | ] 1926 | ); 1927 | }); 1928 | 1929 | afterEach(async function () { 1930 | await mongoose.connection.db.dropCollection("mongoose_restore_test"); 1931 | }); 1932 | 1933 | it("restore() -> not raise ValidationError error", async function () { 1934 | try { 1935 | const luke = await TestModel.findOne({ name: 'Luke Skywalker' }); 1936 | luke.name = ""; 1937 | await luke.restore(); 1938 | } catch (err) { 1939 | should.not.exist(err); 1940 | } 1941 | }); 1942 | }); 1943 | 1944 | describe("model validation on restore (default): { validateBeforeRestore: true }", function () { 1945 | var TestSchema = new Schema({ 1946 | name: { type: String, required: true } 1947 | }, { collection: 'mongoose_restore_test' }); 1948 | TestSchema.plugin(mongoose_delete); 1949 | var TestModel = mongoose.model('Test17_restore', TestSchema); 1950 | 1951 | beforeEach(async function () { 1952 | await TestModel.create( 1953 | [ 1954 | { name: 'Luke Skywalker' } 1955 | ] 1956 | ); 1957 | }); 1958 | 1959 | afterEach(async function () { 1960 | await mongoose.connection.db.dropCollection("mongoose_restore_test"); 1961 | }); 1962 | 1963 | it("restore() -> should raise ValidationError error", async function () { 1964 | try { 1965 | const luke = await TestModel.findOne({ name: 'Luke Skywalker' }); 1966 | try { 1967 | luke.name = ""; 1968 | await luke.restore(); 1969 | } catch (e) { 1970 | e.should.exist; 1971 | e.name.should.exist; 1972 | e.name.should.equal('ValidationError'); 1973 | } 1974 | } catch (err) { 1975 | should.not.exist(err); 1976 | } 1977 | }); 1978 | }); 1979 | 1980 | --------------------------------------------------------------------------------