{"_id":"@cme-pro/mongoose-audit","_rev":"3-09f9ba956976a9835fe5689332a4f5bb","name":"@cme-pro/mongoose-audit","dist-tags":{"latest":"0.0.2"},"versions":{"0.0.0":{"name":"@cme-pro/mongoose-audit","version":"0.0.0","description":"Mongoose plugin to store audit information like userAgent, ip, country, etc...  ","homepage":"https://github.com/cme-pro/mongoose-audit#readme","main":"dist/index.js","types":"dist/index.d.ts","scripts":{},"repository":{"type":"git","url":"git+https://github.com/cme-pro/mongoose-audit.git"},"keywords":["mongoose","audit"],"author":{"name":"Sven Gaubert","url":"https://github.com/svengau"},"license":"MIT","bugs":{"url":"https://github.com/cme-pro/mongoose-audit/issues"},"devDependencies":{"@types/mongoose":"^5.5.6","mongoose":"^5.6.0","typescript":"^3.5.2","typescript-eslint-parser":"^22.0.0"},"peerDependencies":{"mongoose":">= 4"},"gitHead":"2a49ebca80d785edce4ed70ee0ac480ededaec4c","_id":"@cme-pro/mongoose-audit@0.0.0","_nodeVersion":"10.7.0","_npmVersion":"6.9.0","dist":{"integrity":"sha512-jxYvvQMT/JT9tTQaHWyogZ7OkBvcKrIe0hkwq0S5KZWFPexW12rBw9bzjg26q0nGmsRCT2Hpvdwk22GacchN2w==","shasum":"2087e67fd0396c1b55bf523292c2ca379ce0764f","tarball":"https://registry.npmjs.org/@cme-pro/mongoose-audit/-/mongoose-audit-0.0.0.tgz","fileCount":13,"unpackedSize":22444,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdCbzwCRA9TVsSAnZWagAAmXEP/jWoa0VGczp04xls9yUU\nFNQTRO2KnAPOdfp+rUdO2nHDPZGCBq7bzKObsSNoxQigg/PQ9jBR8JanDuin\nRCixYt5q+hmfRt6rfGdsJAQSbmQvbr5fXT/K7CnbPu2EeStKURKqI0IKjKbK\naBb7HVJnqlVM9fhTjpEJ3yHKEaxw0ZxfOAuxoDA+4UL79Wd60S+5KV6waTap\nB4djdlS/KC0qtc6/rBcrQmdyRkbKVo2yTveYwe1Sunq4EIAS16bH2Z39jfeP\nbbpT+Y3s/I4OwJZxge3HqcGQjRuDKIIQizEdAqTdJifV0jRuAm2/P+wUyWE6\n/RNZUjeFJIhRoXBilnyscPkwrp7qANK09A1CWabNh08Kc4W0TfR5vaDtbANe\ntw1rUjIDOM83GE6HhdNNIepYBjpdrQ5cGTyeF2zc8QEvPpvmD7XwQS9dBJOY\nDxg1YTTHmkwkNNbQhibVKeCY+ZFAlUv5VuL2lIZ3T2Ub9B2b0V6q8XRPPEnQ\nr9t8KczeQR7tXmu5zYfG4oSdMS66eIkWK+DLdgCdqetP82Baeei8uotQ1tCP\no5ExT0wXub5jCwHOEC6aaGWEitinJkM2QYxod7Xi+OoeiS3k7ETZmo16S5iK\nVg1cvuv7hXiOp0dlY51aMkBppKt2FNm4tjli3xLGY3T/kgHA4nyPUVGOQl6D\nmg+e\r\n=ob14\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDbHgmixnI2IXaHNl3dSzHg0INimcg2etHsO5QHmTeS6wIhAJ/zk3Xi8FrYYMN0hx3o6hFs7gYStnQyB598yFTZx1mG"}]},"maintainers":[{"name":"martinratinaud","email":"martinratinaud@gmail.com"},{"name":"svengau","email":"svengau@yahoo.fr"}],"_npmUser":{"name":"svengau","email":"svengau@yahoo.fr"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mongoose-audit_0.0.0_1560919279996_0.7094430921925805"},"_hasShrinkwrap":false},"0.0.1":{"name":"@cme-pro/mongoose-audit","version":"0.0.1","description":"Mongoose plugin to store audit information like userAgent, ip, country, etc...  ","homepage":"https://github.com/cme-pro/mongoose-audit#readme","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"prepublish":"rm -rf dist && tsc"},"repository":{"type":"git","url":"git+https://github.com/cme-pro/mongoose-audit.git"},"keywords":["mongoose","audit"],"author":{"name":"Sven Gaubert","url":"https://github.com/svengau"},"license":"MIT","bugs":{"url":"https://github.com/cme-pro/mongoose-audit/issues"},"devDependencies":{"@types/mongoose":"^5.5.6","mongoose":"^5.6.0","typescript":"^3.5.2","typescript-eslint-parser":"^22.0.0"},"peerDependencies":{"mongoose":">= 4"},"gitHead":"5bef4aca3b4c2dd55eb7e5de520f0d0719532fc8","_id":"@cme-pro/mongoose-audit@0.0.1","_nodeVersion":"10.7.0","_npmVersion":"6.9.0","dist":{"integrity":"sha512-TjIPz8uL12+fSn6djjCK6Zl6IOr7NAbRJBpW37b3zOuVmoZf4gL0dVPuJmb6WKidXsyiSjHLpK8ntq5IRPes+A==","shasum":"94ea1fd6cfe9fd04e4bb4bf61e7e654b1668f863","tarball":"https://registry.npmjs.org/@cme-pro/mongoose-audit/-/mongoose-audit-0.0.1.tgz","fileCount":11,"unpackedSize":11352,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdCb/wCRA9TVsSAnZWagAAnGEP/0ZfTetVgttHZuJSrmf0\nE38m4Yuhrzhsl6Fvd56I/QyrCAG20Wa5WP+geqEO5hC4KIJoECtNDfFsYHZh\nBoO+9/Kyjn4ATmJvZS2+YWU8kkbl6bb0e897iDsSuCphB9hac6uhlqWg9NRm\nWWXS28mI2UZIpY9AQ6s4q3L4o9t0qdYSxAeL1eeTGRKawWi16B510Mcs8sS1\n7Xq3W28NRfJ0Kv6gJ1+BBGAXye8MQBoppus0ZDUs+ewcFPVe7aIo3P+jrhxm\nRhAwg8emP7AZwy/RLHwgTFB6aV4BMe9h98Spf9U2tGFtiJAMRlGtzP8VoxtN\n/qYg3QgXOuIDkfS94ZW/HcerRdSmIkyB4Bvq0d7exW9oh5lKz7lJURnJR8lg\n/oJloB2FGw+c5tKahh4ZrxkHULIh0G39TyJt1jo/r96mXVL7/EIEjdZ15xpP\nyYrBG0+TWRAtvHqBDrn7mRb2vP5C6c8LnwBYVyEOV1ebnRwnQdb/Zq7xh4jv\nxhGPcxJPIu8MraecNLJ93c0HnxNgV5faLE+GLhYk1yCbOUSUKNRmM3fZjyhk\niKPh6CEWFIVKmy9O4a7Z07vJuus9sGq/37UhkIZJyrhnnTkKjM6pXjDs7x2l\n+F2XlZ4uB5PcW5Av/iFx71LwpMhxB4Lascb9zVblM/UShpdecMbDntov6hpf\nzzo1\r\n=gXTI\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDOaN3fMlJ5Q6o6aFSCrYGSr09Dbgd+AGOrikzLVaFBWAIgHGLXqPEudke2R1h7AeY4/2arTrTlHVLT+ePG6M2WhiA="}]},"maintainers":[{"name":"martinratinaud","email":"martinratinaud@gmail.com"},{"name":"svengau","email":"svengau@yahoo.fr"}],"_npmUser":{"name":"svengau","email":"svengau@yahoo.fr"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mongoose-audit_0.0.1_1560920047938_0.791867168441146"},"_hasShrinkwrap":false},"0.0.2":{"name":"@cme-pro/mongoose-audit","version":"0.0.2","description":"Mongoose plugin to store audit information like userAgent, ip, country, etc...  ","homepage":"https://github.com/cme-pro/mongoose-audit#readme","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"prepublish":"rm -rf dist && tsc"},"repository":{"type":"git","url":"git+https://github.com/cme-pro/mongoose-audit.git"},"keywords":["mongoose","audit"],"author":{"name":"Sven Gaubert","url":"https://github.com/svengau"},"license":"MIT","bugs":{"url":"https://github.com/cme-pro/mongoose-audit/issues"},"devDependencies":{"@types/mongoose":"^5.11.97","mongoose":"^5.13.14","typescript":"^4.6.2","typescript-eslint-parser":"22.0.0"},"peerDependencies":{"mongoose":"^5.13.14"},"gitHead":"cab562415a13d28b1a66e3d725167e9011c56f25","_id":"@cme-pro/mongoose-audit@0.0.2","_nodeVersion":"16.8.0","_npmVersion":"8.3.0","dist":{"integrity":"sha512-wXzEEjrpbIESu6vNV9ACYgR58/zy1VMHf58utSmPM0AJYKpyVEMbWere+k7cf7e654YQ7R+foyqhU5dYHkcGDQ==","shasum":"da4f3141ee93464dbd3729b0b426fe869ddd31a1","tarball":"https://registry.npmjs.org/@cme-pro/mongoose-audit/-/mongoose-audit-0.0.2.tgz","fileCount":17,"unpackedSize":14519,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiJzWRACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpZyA//SL+zrQFyFFvCIYIJwNLVXGn3avR6srTyK+w1S+345e5vq3aE\r\nTlj6kpDCb77LBEVrCTJ61gbA6qtx14ndPzAer/EPhMHxD7y9T+Bv5nB89FIC\r\niPt8wT0vR5zHeXPVXrFE6/BuX2u+YrKnll5ZNYnv4vzoMkcXm3XSCaSSqyEn\r\niXyavHig1tcy3wUtk813kPCfZFBKAfm48N5Hgs4a7yj/muZikaJ1LvITSQTK\r\n1NyMxXfiygE1BMyDysBpaewnKELOUpyGsh2AwvMZSAtX0sS+y5xSqtM/pOWa\r\ns5PGw/HfcGLMyqKnMcR90KoXiaqUfkDKnTK4IsEmA/+ke5gUU0WnC0pKvwgo\r\noljsfyMIe1HEm+ECbG6HLcbrba2YNGQ2yM/1MPaRqwP8K/hBzsHEUMkRETYT\r\nXJedlL6uDV1ABap9z5ziHf39A181iDacU2tdlONqtp1qt0XcFW7vGoVffXlm\r\nRLnKshG+HU1dYPHb2bCtD/BZQCXZzZAH1JqjUNjDdT3ogm9MbDwhK+v/buKJ\r\nuJIIHCwK83ftpDVCMLkkuePpUW4gW4xMDlSiYcYCPzMK9lTm7ybh86h81j//\r\nli9zw5+sw/4ylam6xrXoO1BEDNMGuJ56eb4VC6mVR91NkSGJkSpneHQl1qUq\r\nDlicaRsVricjNiNTlAAOYSpzH1FY1E7j55g=\r\n=a4vt\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD5Svsji8eCZ7AcyoHVck9tTVgSUsRfbgYxbgGiHG93MgIgcMbykL4R+RJulQLrzUYO3meIP7PRuKnmMfzS2EZXgwI="}]},"_npmUser":{"name":"svengau","email":"svengau@yahoo.fr"},"directories":{},"maintainers":[{"name":"svengau","email":"svengau@yahoo.fr"},{"name":"martinratinaud","email":"martinratinaud@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mongoose-audit_0.0.2_1646736785463_0.9474570169967018"},"_hasShrinkwrap":false}},"time":{"created":"2019-06-19T04:41:19.835Z","0.0.0":"2019-06-19T04:41:20.137Z","modified":"2022-04-04T23:43:16.408Z","0.0.1":"2019-06-19T04:54:08.039Z","0.0.2":"2022-03-08T10:53:05.599Z"},"maintainers":[{"name":"svengau","email":"svengau@yahoo.fr"},{"name":"martinratinaud","email":"martinratinaud@gmail.com"}],"description":"Mongoose plugin to store audit information like userAgent, ip, country, etc...  ","homepage":"https://github.com/cme-pro/mongoose-audit#readme","keywords":["mongoose","audit"],"repository":{"type":"git","url":"git+https://github.com/cme-pro/mongoose-audit.git"},"author":{"name":"Sven Gaubert","url":"https://github.com/svengau"},"bugs":{"url":"https://github.com/cme-pro/mongoose-audit/issues"},"license":"MIT","readme":"[![npm][npm]][npm-url]\n[![node][node]][node-url]\n[![downloads][downloads]][downloads-url]\n\n# mongoose-audit\n\nMongoose plugin to store audit information like userAgent, ip, country, etc...\n\nThis plugin simply adds the following fields: \n- createdBy\n- updatedBy \n- deletedBy \n- createdFrom\n- updatedFrom\n- deletedFrom\n\nWhere: \n1. createdBy, updatedBy and deletedBy are a user id, \n2. createdFrom, updatedFrom and deletedFrom have the following structure:\n   - userAgent\n   - ip\n   - country\n   - continent\n   - region\n   - city\n   - zip\n   - lat\n   - lng\n   - tz\n\nNote: deletedBy and deletedFrom are only useful if combined with [mongoose-delete plugin](https://www.npmjs.com/package/mongoose-delete).\n\n## Installation\n\n```sh\n$ npm install mongoose-audit --save\n```\n\n## Overview\n\n### Adding plugin to the schema\n\n```js\nBlogPost.plugin(mongooseAudit, { userModel: 'Author' });\n```\n\n### Plugin options\n\n* userModel - optional (default is \"User\"). The mongoose Model managing users. Used to populate the field).\n\n## Usage\n\nOn create:\n```js\n    const post = new BlogPost({});\n    post.createdBy = currentUserId;\n    post.createdFrom = {{ ip, userAgent, country };\n    await post.save();\n```\n\nOn update:\n```js\n    post.set();\n    post.updatedBy = currentUserId;\n    post.updatedFrom = {{ ip, userAgent, country };\n    await post.save();\n```\n\nOn delete (only useful if combined with [mongoose-delete plugin](https://www.npmjs.com/package/mongoose-delete))\n```js\n    post.deletedBy = currentUserId;\n    post.deletedFrom = {{ ip, userAgent, country };\n    await post.save();\n    await post.delete();\n```\n\n\n[npm]: https://img.shields.io/npm/v/@cme-pro/mongoose-audit.svg\n[npm-url]: https://npmjs.com/package/@cme-pro/mongoose-audit\n[node]: https://img.shields.io/node/v/@cme-pro/mongoose-audit.svg\n[node-url]: https://nodejs.org\n[tests]: http://img.shields.io/travis/webpack-contrib/@cme-pro/mongoose-audit.svg\n[tests-url]: https://travis-ci.org/webpack-contrib/@cme-pro/mongoose-audit\n[downloads]: https://img.shields.io/npm/dt/@cme-pro/mongoose-audit.svg\n[downloads-url]: https://npmjs.com/package/@cme-pro/mongoose-audit\n\n","readmeFilename":"README.md"}