{"_id":"@atlas.js/sequelize","_rev":"25-7c74fe1cd20894c0cf325ae24e06bfce","name":"@atlas.js/sequelize","description":"Sequelize service for @atlas.js","dist-tags":{"latest":"3.0.0","next":"2.1.0-alpha.8"},"versions":{"0.1.0":{"name":"@atlas.js/sequelize","description":"Sequelize service for @atlas.js","version":"0.1.0","author":{"name":"Robert Rossmann","email":"robert.rossmann@strv.com"},"bugs":{"url":"https://github.com/strvcom/atlas.js/issues"},"contributors":[],"dependencies":{"@atlas.js/action":"^0.0.3","@atlas.js/errors":"^0.0.3","@atlas.js/hook":"^0.0.3","@atlas.js/service":"^0.0.3","babel-runtime":"^6.23.0","sequelize":"^4.7.5"},"devDependencies":{"sqlite3":"^3.1.9"},"engines":{"node":"^8.3.0","npm":"^5.3.0"},"homepage":"https://github.com/strvcom/atlas.js/tree/master/packages/sequelize","keywords":[],"license":"BSD-3-Clause","main":"src","repository":{"type":"git","url":"git://github.com/strvcom/atlas.js.git"},"_id":"@atlas.js/sequelize@0.1.0","_npmVersion":"5.4.0","_nodeVersion":"8.4.0","_npmUser":{"name":"robertrossmann","email":"robert.rossmann@strv.com"},"dist":{"integrity":"sha512-ZNdATd02B7B3+KcLjYkE8ezoQWjlcqRD3oif2wL10ATHiqTq+RmQAmCRs+wsfWrm2RGm2pBkZDBxr8ibpd9llw==","shasum":"cd8c99670e257d98625f648e0439aaf3773263b9","tarball":"https://registry.npmjs.org/@atlas.js/sequelize/-/sequelize-0.1.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGwnp0MaBlpqfU7e8dGdOIy7jqs8d/dpdql8W7eO9bTEAiEAxAWLwiAjnM2JIARc8LoPSs+Q58+mYZYtfAThsUwOYeM="}]},"maintainers":[{"name":"robertrossmann","email":"robert.rossmann@strv.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sequelize-0.1.0.tgz_1504355316816_0.7503754708450288"},"directories":{}},"0.1.1":{"name":"@atlas.js/sequelize","description":"Sequelize service for @atlas.js","version":"0.1.1","author":{"name":"Robert Rossmann","email":"robert.rossmann@strv.com"},"bugs":{"url":"https://github.com/strvcom/atlas.js/issues"},"contributors":[],"dependencies":{"@atlas.js/action":"^0.0.3","@atlas.js/errors":"^0.0.3","@atlas.js/hook":"^0.0.3","@atlas.js/service":"^0.0.3","babel-runtime":"^6.23.0","sequelize":"^4.7.5"},"devDependencies":{"sqlite3":"^3.1.9"},"engines":{"node":"^8.3.0","npm":"^5.3.0"},"homepage":"https://github.com/strvcom/atlas.js/tree/master/packages/sequelize","keywords":[],"license":"BSD-3-Clause","main":"src","repository":{"type":"git","url":"git://github.com/strvcom/atlas.js.git"},"_id":"@atlas.js/sequelize@0.1.1","_npmVersion":"5.4.0","_nodeVersion":"8.4.0","_npmUser":{"name":"robertrossmann","email":"robert.rossmann@strv.com"},"dist":{"integrity":"sha512-+msp1K1nzWGH5UNQQ66xeQvwH04Ywr7XgyRUazeqNSP9PIr8TGFxttUGbXr17ipcQi5E+Qgj/v+94YOmiE8NxA==","shasum":"5ba062abe208ded8ca8b19f3e9e431eb0fd67f50","tarball":"https://registry.npmjs.org/@atlas.js/sequelize/-/sequelize-0.1.1.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCh+NyoonH/ZlKVid3sOZZfnjFpHaMvgSUM72iEwG2RYAIgaZCcUSJmMuL0jCR135tp+9ckgto/KSXWWebJY7HeES8="}]},"maintainers":[{"email":"licenses@strv.com","name":"strvuser"},{"email":"robert.rossmann@strv.com","name":"robertrossmann"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sequelize-0.1.1.tgz_1504705174348_0.8593245421070606"},"directories":{}},"0.2.0":{"name":"@atlas.js/sequelize","description":"Sequelize service for @atlas.js","version":"0.2.0","author":{"name":"Robert Rossmann","email":"robert.rossmann@strv.com"},"bugs":{"url":"https://github.com/strvcom/atlas.js/issues"},"contributors":[],"dependencies":{"@atlas.js/action":"^0.0.3","@atlas.js/errors":"^0.0.3","@atlas.js/hook":"^0.0.3","@atlas.js/service":"^0.0.3","babel-runtime":"^6.23.0","sequelize":"^4.7.5","umzug":"^2.0.1"},"devDependencies":{"sqlite3":"^3.1.9"},"engines":{"node":"^8.3.0","npm":"^5.3.0"},"homepage":"https://github.com/strvcom/atlas.js/tree/master/packages/sequelize","keywords":[],"license":"BSD-3-Clause","main":"src","repository":{"type":"git","url":"git://github.com/strvcom/atlas.js.git"},"_id":"@atlas.js/sequelize@0.2.0","_npmVersion":"5.4.1","_nodeVersion":"8.4.0","_npmUser":{"name":"robertrossmann","email":"robert.rossmann@strv.com"},"dist":{"integrity":"sha512-17Mg/rX00MaZA8B7Z4S+TH+s7b3HgwC5hCubVH2JGyi6wH25AvVToorAbnXbYONI6M6Qu/wv68V2JWRZ3x4gXw==","shasum":"25fbe6902db492ed68558fc93f95760c01f4191e","tarball":"https://registry.npmjs.org/@atlas.js/sequelize/-/sequelize-0.2.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC3c3gdIN3Z/V6N990KxrsNsS/T73L5tcTUi0szAMyr/AIhAMhFJ+ngbSheErSJP3pP+eGIe73Gx+xbj5hCA1ywruYZ"}]},"maintainers":[{"email":"licenses@strv.com","name":"strvuser"},{"email":"robert.rossmann@strv.com","name":"robertrossmann"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sequelize-0.2.0.tgz_1504800050954_0.952655166387558"},"directories":{}},"0.2.1":{"name":"@atlas.js/sequelize","description":"Sequelize service for @atlas.js","version":"0.2.1","author":{"name":"Robert Rossmann","email":"robert.rossmann@strv.com"},"bugs":{"url":"https://github.com/strvcom/atlas.js/issues"},"contributors":[],"dependencies":{"@atlas.js/action":"^0.0.4","@atlas.js/errors":"^0.0.4","@atlas.js/hook":"^0.0.4","@atlas.js/service":"^0.0.4","sequelize":"^4.7.5","umzug":"^2.0.1"},"devDependencies":{"sqlite3":"^3.1.9"},"engines":{"node":"^8.3.0","npm":"^5.3.0"},"homepage":"https://github.com/strvcom/atlas.js/tree/master/packages/sequelize","keywords":[],"license":"BSD-3-Clause","main":"src","repository":{"type":"git","url":"git://github.com/strvcom/atlas.js.git"},"_id":"@atlas.js/sequelize@0.2.1","_npmVersion":"5.4.2","_nodeVersion":"8.5.0","_npmUser":{"name":"robertrossmann","email":"robert.rossmann@strv.com"},"dist":{"integrity":"sha512-KzkwRxikFRcaqerCIR+Icu6ekvbhzRs7ZgZzvc100XpotZ0mTJ0tlwQobkkgZ6vYc1sG9YUI7ZG3w9qEvklEVg==","shasum":"af365d8b373ecfc86daac6a5029c0c5b8bb8701e","tarball":"https://registry.npmjs.org/@atlas.js/sequelize/-/sequelize-0.2.1.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICYo004xIhwyQotlaCv40wryI+N001zdUm5JhVhiE1lWAiA5hUtgofZelsXD6rQgGvXZ9fuLZo6at3JooO8dd1PgDw=="}]},"maintainers":[{"email":"licenses@strv.com","name":"strvuser"},{"email":"robert.rossmann@strv.com","name":"robertrossmann"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sequelize-0.2.1.tgz_1506067625105_0.2621375652961433"},"directories":{}},"0.3.0":{"name":"@atlas.js/sequelize","description":"Sequelize service for @atlas.js","version":"0.3.0","author":{"name":"Robert Rossmann","email":"robert.rossmann@strv.com"},"bugs":{"url":"https://github.com/strvcom/atlas.js/issues"},"contributors":[],"dependencies":{"@atlas.js/action":"^0.0.5","@atlas.js/errors":"^0.0.4","@atlas.js/hook":"^0.0.4","@atlas.js/service":"^0.0.4","sequelize":"^4.7.5","umzug":"^2.0.1"},"devDependencies":{"sqlite3":"^3.1.9"},"engines":{"node":"^8.3.0","npm":"^5.3.0"},"homepage":"https://github.com/strvcom/atlas.js/tree/master/packages/sequelize","keywords":[],"license":"BSD-3-Clause","main":"src","repository":{"type":"git","url":"git://github.com/strvcom/atlas.js.git"},"_id":"@atlas.js/sequelize@0.3.0","_npmVersion":"5.4.2","_nodeVersion":"8.5.0","_npmUser":{"name":"robertrossmann","email":"robert.rossmann@strv.com"},"dist":{"integrity":"sha512-8Fm6GB32wjaDWJweb0XeCX/EK0aVeURPUjX0KSrLmIVnFuoOnmqE9JEWhS/8JvZnvXBWvh92PkYhTGgpg5Ovxg==","shasum":"d65ad546ff2f6ef1b092dccce18a2ede24d52657","tarball":"https://registry.npmjs.org/@atlas.js/sequelize/-/sequelize-0.3.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDDXu5tnuVMsZjUgq7wwSoV2V2D5q9BzXlg8sTHhUvbmAiEA9GuwJsPDx2A20T3J4OpKla8IV7FYrH5M3UwNjbmRao0="}]},"maintainers":[{"email":"licenses@strv.com","name":"strvuser"},{"email":"robert.rossmann@strv.com","name":"robertrossmann"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sequelize-0.3.0.tgz_1506425713300_0.42926452844403684"},"directories":{}},"0.4.0":{"name":"@atlas.js/sequelize","description":"Sequelize service for @atlas.js","version":"0.4.0","author":{"name":"Robert Rossmann","email":"robert.rossmann@strv.com"},"bugs":{"url":"https://github.com/strvcom/atlas.js/issues"},"contributors":[],"dependencies":{"@atlas.js/action":"^0.1.0","@atlas.js/errors":"^0.1.0","@atlas.js/hook":"^0.1.0","@atlas.js/service":"^0.1.0","sequelize":"^4.7.5","umzug":"^2.0.1"},"devDependencies":{"sqlite3":"^3.1.9"},"engines":{"node":"^8.3.0","npm":"^5.3.0"},"homepage":"https://github.com/strvcom/atlas.js/tree/master/packages/sequelize","keywords":[],"license":"BSD-3-Clause","main":"src","repository":{"type":"git","url":"git://github.com/strvcom/atlas.js.git"},"_id":"@atlas.js/sequelize@0.4.0","_npmVersion":"5.4.2","_nodeVersion":"8.6.0","_npmUser":{"name":"robertrossmann","email":"robert.rossmann@strv.com"},"dist":{"integrity":"sha512-8ynvgW61fa7e0YJmDu5SjwM6s3SfJFATqj/10OPKl2GZDB70Wyxby678zLhaSOnSLy+rAyJyurRvrBgW4b3rEw==","shasum":"f2223d741504aacd28b3ae55f152b477a7069252","tarball":"https://registry.npmjs.org/@atlas.js/sequelize/-/sequelize-0.4.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEOQwzxQA4qTRxl7qD9SLYeqzdCAwN3mLF1jppfinff3AiEAsLT39orO3tKGYrMKWd6f/3PEmbTR/Xo8JNG046tOAKg="}]},"maintainers":[{"email":"licenses@strv.com","name":"strvuser"},{"email":"robert.rossmann@strv.com","name":"robertrossmann"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sequelize-0.4.0.tgz_1506502232256_0.4002809177618474"},"directories":{}},"1.0.0":{"name":"@atlas.js/sequelize","description":"Sequelize service for @atlas.js","version":"1.0.0","author":{"name":"Robert Rossmann","email":"robert.rossmann@strv.com"},"bugs":{"url":"https://github.com/strvcom/atlas.js/issues"},"contributors":[],"dependencies":{"@atlas.js/action":"^1.0.0","@atlas.js/errors":"^0.1.0","@atlas.js/hook":"^1.0.0","@atlas.js/service":"^1.0.0","sequelize":"^4.7.5","umzug":"^2.0.1"},"devDependencies":{"sqlite3":"^3.1.9"},"engines":{"node":"^8.3.0","npm":"^5.3.0"},"homepage":"https://github.com/strvcom/atlas.js/tree/master/packages/sequelize","keywords":[],"license":"BSD-3-Clause","main":"src","repository":{"type":"git","url":"git://github.com/strvcom/atlas.js.git"},"_id":"@atlas.js/sequelize@1.0.0","_npmVersion":"5.5.1","_nodeVersion":"8.7.0","_npmUser":{"name":"robertrossmann","email":"robert.rossmann@strv.com"},"dist":{"integrity":"sha512-ii0446k6S1d0jDDjWWQLXqIvVPXhGCqc4fubQ6IRi4lJQzxWd+/yGxK3yq5BT4UFGgKNJoKBafT3blMG1PNy2w==","shasum":"e59597e1bcfb4e0691279dc9e44a097410fa134f","tarball":"https://registry.npmjs.org/@atlas.js/sequelize/-/sequelize-1.0.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDJKFq+ZQaIKBMBUUt2o+jbyqs50eakv5BqYgaHgtkFjwIhAKMvc7tMY+Mq4M9P1syEepUEpovMcb2ZoZquCCdRq4tX"}]},"maintainers":[{"email":"licenses@strv.com","name":"strvuser"},{"email":"robert.rossmann@strv.com","name":"robertrossmann"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sequelize-1.0.0.tgz_1508878113694_0.14764045481570065"},"directories":{}},"1.0.1":{"name":"@atlas.js/sequelize","description":"Sequelize service for @atlas.js","version":"1.0.1","author":{"name":"Robert Rossmann","email":"robert.rossmann@strv.com"},"bugs":{"url":"https://github.com/strvcom/atlas.js/issues"},"contributors":[],"dependencies":{"@atlas.js/action":"^1.0.1","@atlas.js/errors":"^0.1.1","@atlas.js/hook":"^1.0.1","@atlas.js/service":"^1.0.1","sequelize":"^4.7.5","umzug":"^2.0.1"},"devDependencies":{"sqlite3":"^3.1.9"},"engines":{"node":"^8.3.0","npm":"^5.3.0"},"homepage":"https://github.com/strvcom/atlas.js/tree/master/packages/sequelize","keywords":[],"license":"BSD-3-Clause","main":"src","repository":{"type":"git","url":"git://github.com/strvcom/atlas.js.git"},"_id":"@atlas.js/sequelize@1.0.1","_npmVersion":"5.5.1","_nodeVersion":"8.9.0","_npmUser":{"name":"robertrossmann","email":"robert.rossmann@strv.com"},"dist":{"integrity":"sha512-6o1rNIS3fypALftw7uHPYo/EnLlI9jYIm8KP+qa0C7HTzgy4ZinrHiNECfNJ9xCHtwuxmmHrQcm35pSgpTzC6A==","shasum":"a5431ba00cb62dbdf0713a5aa329b7cde076c1de","tarball":"https://registry.npmjs.org/@atlas.js/sequelize/-/sequelize-1.0.1.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCSiQog3d46PpcwjU/oE/+52CbsR0SmnW/3R7ZNyQYKygIgdBgpkP++WRMhxvscVwa0WkUr62xN0yTWQQ4FiOymf6k="}]},"maintainers":[{"email":"licenses@strv.com","name":"strvuser"},{"email":"robert.rossmann@strv.com","name":"robertrossmann"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sequelize-1.0.1.tgz_1511776468442_0.288133597234264"},"directories":{}},"1.1.0":{"name":"@atlas.js/sequelize","description":"Sequelize service for @atlas.js","version":"1.1.0","author":{"name":"Robert Rossmann","email":"robert.rossmann@strv.com"},"bugs":{"url":"https://github.com/strvcom/atlas.js/issues"},"contributors":[],"dependencies":{"@atlas.js/action":"^1.0.2","@atlas.js/errors":"^0.1.1","@atlas.js/hook":"^1.0.2","@atlas.js/service":"^1.0.2","sequelize":"^4.7.5","umzug":"^2.0.1"},"devDependencies":{"sqlite3":"^3.1.9"},"engines":{"node":"^8.3.0","npm":"^5.3.0"},"homepage":"https://github.com/strvcom/atlas.js/tree/master/packages/sequelize","keywords":[],"license":"BSD-3-Clause","main":"src","repository":{"type":"git","url":"git://github.com/strvcom/atlas.js.git"},"_id":"@atlas.js/sequelize@1.1.0","_npmVersion":"5.5.1","_nodeVersion":"8.9.3","_npmUser":{"name":"robertrossmann","email":"robert.rossmann@strv.com"},"dist":{"integrity":"sha512-DLU1Dm2Q2VfjiM/Uqn5mEGV1oOYGkOA8iVB21KCgKvCRiSqfgCl5bIO7QfbZnDhxtKOesJSLC7SZrkksyF7jIA==","shasum":"7f1a3ab8ad28c75da2b0d6ce86b2bf65acab8931","tarball":"https://registry.npmjs.org/@atlas.js/sequelize/-/sequelize-1.1.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHR6ZkXqGcZEgSzBoAXG3NAVnudFsxZLe6PleeaRal6iAiB+KNA+sglXkrBShZRJ/glE1ojQy7Yx70xVyAm/lKGzLw=="}]},"maintainers":[{"email":"licenses@strv.com","name":"strvuser"},{"email":"robert.rossmann@strv.com","name":"robertrossmann"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sequelize-1.1.0.tgz_1513166195330_0.032475920394062996"},"directories":{}},"1.2.0-alpha.a596c671":{"name":"@atlas.js/sequelize","description":"Sequelize service for @atlas.js","version":"1.2.0-alpha.a596c671","author":{"name":"Robert Rossmann","email":"robert.rossmann@strv.com"},"bugs":{"url":"https://github.com/strvcom/atlas.js/issues"},"contributors":[],"dependencies":{"@atlas.js/action":"^1.1.0-alpha.a596c671","@atlas.js/errors":"^0.2.0-alpha.a596c671","@atlas.js/hook":"^1.1.0-alpha.a596c671","@atlas.js/service":"^1.1.0-alpha.a596c671","sequelize":"^4.37.6","umzug":"^2.0.1"},"devDependencies":{"@atlas.js/atlas":"^1.4.0-alpha.a596c671","sqlite3":"^4.0.0"},"engines":{"node":"^8.3.0","npm":"^5.3.0"},"homepage":"https://github.com/strvcom/atlas.js/tree/master/packages/sequelize","keywords":[],"license":"BSD-3-Clause","main":"src","publishConfig":{"access":"public"},"repository":{"type":"git","url":"git://github.com/strvcom/atlas.js.git"},"readme":"# @atlas.js/sequelize\n\nSequelize service for @atlas.js.\n\n## Installation\n\n`npm i @atlas.js/sequelize`\n\nYou will also need to install one of the [supported database drivers][sequelize-db-drivers] on your own.\n\n## Usage\n\n### Service\n\nThe service configuration only accepts two properties: `uri` and `options` which are passed directly to the [`new Sequelize(uri, options)`][sequelize-constructor] constructor.\n\n```js\nimport * as sequelize from '@atlas.js/sequelize'\nimport { Atlas } from '@atlas.js/atlas'\n\nconst atlas = new Atlas({\n  config: {\n    services: {\n      database: {\n        uri: 'postgres://postgres:postgres@127.0.0.1:27017/my-db',\n        options: {\n          pool: {\n            max: 5,\n            min: 2,\n          }\n        },\n      }\n    }\n  }\n})\n\natlas.service('database', sequelize.Service)\nawait atlas.start()\n\n// You have your sequelize client available here:\natlas.services.database\n```\n\nNote that by default, the service does not load your models which means you will either have to load them up yourself or use the `ModelsHook` documented below.\n\n### ModelsHook\n\nThis hook allows you to import your Sequelize models from a particular module location into the sequelize service.\n\n#### ModelsHook Dependencies\n\n- `service:sequelize`: A sequelize service to load the models into\n\n```js\n// models/user.js\n\n// You can import the necessary classes and definitions directly from the\n// @atlas.js/sequelize module instead of loading the whole sequelize lib\nimport { Model, DataTypes } from '@atlas.js/sequelize'\n\nclass User extends Model {\n  // Here you can describe your model's fields (columns/attributes)\n  // This goes directly to Model.init() as first argument\n  static fields = {\n    name: {\n      type: DataTypes.STRING,\n      allowNull: false,\n    },\n\n    someDate: {\n      type: DataTypes.DATE,\n      allowNull: true,\n    },\n  }\n\n  // Here you can specify your model's config (options)\n  // This goes directly to Model.init() as second argument\n  static config = {\n    paranoid: true,\n    timestamps: true,\n  }\n\n  static staticMethod() {\n    // You can access the Atlas instance as a property on the\n    // Model class:\n    // this refers to the model class itself\n    this.atlas\n  }\n\n  async instanceMethod() {\n    // On instance methods, you can also access the Atlas instance\n    // directly on the model's instance\n    // this refers to the model class' instance\n    this.atlas\n  }\n}\n\nexport default User\n\n\n// models/index.js\nimport User from './user'\n// Do not use `export default` - instead export each model as a named export\n// Alternatively, just assign each model to `module.exports` object.\nexport {\n  User\n}\n// or\nmodule.exports = {\n  User,\n}\n\n// index.js\nimport * as sequelize from '@atlas.js/sequelize'\nimport { Atlas } from '@atlas.js/atlas'\n\nconst atlas = new Atlas({\n  root: __dirname,\n  config: {\n    hooks: {\n      models: {\n        // The path to the module from which all the database models should be\n        // loaded, relative to atlas.root\n        module: 'models'\n      }\n    }\n  }\n})\n\natlas.service('database', sequelize.Service)\natlas.hook('models', sequelize.ModelsHook, {\n  aliases: {\n    'service:sequelize': 'database',\n  }\n})\nawait atlas.start()\n\n// Now your models from the models/index.js module are loaded up!\nconst User = atlas.services.database.model('User')\n// or\nconst User = atlas.services.database.models.User\n```\n\n### RelationsHook\n\nThis hook allows you to describe your model's associations (relations) directly on the model definition, making the model's definition even more descriptive.\n\n#### Dependencies\n\n- `service:sequelize`: A sequelize service with all the models already loaded up\n\n```js\nclass User extends Model {\n  // Here you can define your model's relations (associations) to other models\n  // in your app\n  static relations = {\n    // This will set up a \"has many\" relation from this model to the models\n    // defined in the object\n    hasMany: {\n      // Let's say you have a Purchase model defined in your app - this will cause the following relation to be set up for you:\n      // User.hasMany(Purchase, { as: 'purchase' })\n      Purchase: {\n        as: 'purchase',\n      },\n      // The key must match an existing model name\n      Company: {}\n    },\n    belongsTo: {},\n    hasOne: {},\n  }\n}\n```\n\n### Why fields, relations, config...?\n\n> Why not attributes, associations and options?\n\nBecause all those properties already exist on a standard sequelize Model object, and adding them in your own model definition would overwrite them, causing all kinds of issues. Therefore new names had to be chosen.\n\n### MigrationAction\n\nThis action contains methods for applying and rolling back your sequelize migrations. The migration files are written exactly like standard Sequelize migrations. In addition to using plain JavaScript migration files, you may also organise your migrations into a folder with an _index.js_ file inside, if the migration requires more data or you simply wish to organise the migration in a different way than a single script.\n\n#### MigrationAction Dependencies\n\n- `service:sequelize`: A sequelize service to use with which to apply/undo the migrations\n\n```js\n// index.js\nimport * as sequelize from '@atlas.js/sequelize'\nimport { Atlas } from '@atlas.js/atlas'\n\nconst atlas = new Atlas({\n  root: __dirname,\n  config: {\n    actions: {\n      migration: {\n        // The path to the module from which all the migrations should be\n        // loaded, relative to atlas.root\n        module: 'migrations'\n      }\n    }\n  }\n})\n\natlas.action('migration', sequelize.MigrationAction, {\n  aliases: {\n    'service:sequelize': 'database'\n  }\n})\nawait atlas.start()\n\n// Available actions:\nawait atlas.actions.migration.up() // Applies all pending migrations\nawait atlas.actions.migration.down() // Rolls back last applied migration\nawait atlas.actions.migration.pending() // Returns names of pending migrations\n```\n\n#### Running migrations on start\n\nMigrations are not applied automatically on application start. You will need to implement your own hook which implements the `beforeStart` event handler and run the `up()` method from there.\n\nA simple hook doing just that:\n\n```js\nimport Hook from '@atlas.js/hook'\n\nexport default MigrateHook extends Hook {\n  async beforeStart() {\n    await this.atlas.actions.migrate.up()\n  }\n}\n```\n\n## License\n\nSee the [LICENSE](LICENSE) file for information.\n\n[sequelize-db-drivers]: http://docs.sequelizejs.com/manual/installation/getting-started.html#installation\n[sequelize-constructor]: http://docs.sequelizejs.com/class/lib/sequelize.js~Sequelize.html#instance-constructor-constructor\n","readmeFilename":"README.md","_id":"@atlas.js/sequelize@1.2.0-alpha.a596c671","_npmVersion":"6.0.1","_nodeVersion":"8.11.1","_npmUser":{"name":"robertrossmann","email":"robert.rossmann@strv.com"},"dist":{"integrity":"sha512-atFcVXqg8hTkskSj4soiNoUyrK/a5qgWBIY1QqahCNN0IV3qF1MQH5HFpM9Sw3sAc1oQjmGpG5scl3O7hqzKTg==","shasum":"a6ac55da4aec4ab089d4d569bbcf896461dd0300","tarball":"https://registry.npmjs.org/@atlas.js/sequelize/-/sequelize-1.2.0-alpha.a596c671.tgz","fileCount":38,"unpackedSize":108852,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa+aTSCRA9TVsSAnZWagAArscP/ibKGAKCrwvSIjCxI4zg\njAmF43DG5rtiRl7smMarKRhXZT6IRVGBS9m1xjXzhwQPUv/BntK7Kbva/bHl\nEeAfolc7pG62ce40YOSBZnecQN4hE5XvgmblTyQ+7BHobYwiP6QkUEhY3x63\n/hn0XBeIw+JxQOJBDwATfyHLkIkEbwZXNc9j1VqID4yst1EYD/ZCIuUD8B39\neNJMGsmh4CvXDvKSGwFvDc96/K9jzpizGuJqqxyv7/Ck6fCFIugewYbRVCq/\nVaX1jNG2gOBeA5rduSNdfbL60l+izrsqCL6Q6nevhK0NJKPshE/smKCvc9EL\nllK3+3tmvOaPh13yFtbxw088Gd7A34mST85E+rVDTBQTbEiq34yVX4vS5fJi\nGJuXYqVUdgmsGiUjZJOvIh1lPSc9qhAH2e3vun41i7G31XhVq/3Ews2G/mG4\nbOqW2ElcZGsgRn95TNjIcwSaLatjApovclmJxJ5YBSSpg/LBuiE451mAa8tq\ntxGcz59Dzw6t97RHYDhNUweZpMj7a3ns7HuzxtG2OkHgzovxC1SUbQ66XxkE\nnh/SkVuUGO4hLNmquEiSAbbUuJvE/Wl+gwzu6bIHy7YzctusIqyTYeHf68gs\noEGyYlxm32nuDyylELLls8/GEW01vPnQEAVaAYrtY8a3Tx9OTPIUwl0lZxBs\nkF7r\r\n=7k3j\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFuC304nxwt6G8YP1UhgVVMpUWJiEVEs882w3mD6RX/HAiEA2YMVsi/sZElkzKwWeZwoG2U3uSo4VNZ0ZWJ+3Y3axw8="}]},"maintainers":[{"email":"robert.rossmann@strv.com","name":"robertrossmann"},{"email":"licenses@strv.com","name":"strvuser"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sequelize_1.2.0-alpha.a596c671_1526310096568_0.9494347654386674"},"_hasShrinkwrap":false},"2.0.0":{"name":"@atlas.js/sequelize","description":"Sequelize service for @atlas.js","version":"2.0.0","author":{"name":"Robert Rossmann","email":"robert.rossmann@strv.com"},"bugs":{"url":"https://github.com/strvcom/atlas.js/issues"},"contributors":[],"dependencies":{"@atlas.js/action":"^1.1.0","@atlas.js/errors":"^0.2.0","@atlas.js/hook":"^2.0.0","@atlas.js/service":"^1.1.0","sequelize":"^4.37.6","umzug":"^2.0.1"},"devDependencies":{"@atlas.js/atlas":"^2.0.0","sqlite3":"^4.0.0"},"engines":{"node":">=8.3.0","npm":"^5.3.0"},"homepage":"https://github.com/strvcom/atlas.js/tree/master/packages/sequelize","keywords":[],"license":"BSD-3-Clause","main":"src","publishConfig":{"access":"public"},"repository":{"type":"git","url":"git://github.com/strvcom/atlas.js.git"},"readme":"# @atlas.js/sequelize\n\nSequelize service for @atlas.js.\n\n## Installation\n\n`npm i @atlas.js/sequelize`\n\nYou will also need to install one of the [supported database drivers][sequelize-db-drivers] on your own.\n\n## Usage\n\n### Service\n\nThe service configuration only accepts two properties: `uri` and `options` which are passed directly to the [`new Sequelize(uri, options)`][sequelize-constructor] constructor.\n\n```js\nimport * as sequelize from '@atlas.js/sequelize'\nimport { Atlas } from '@atlas.js/atlas'\n\nconst atlas = new Atlas({\n  config: {\n    services: {\n      database: {\n        uri: 'postgres://postgres:postgres@127.0.0.1:27017/my-db',\n        options: {\n          pool: {\n            max: 5,\n            min: 2,\n          }\n        },\n      }\n    }\n  }\n})\n\natlas.service('database', sequelize.Service)\nawait atlas.start()\n\n// You have your sequelize client available here:\natlas.services.database\n```\n\nNote that by default, the service does not load your models which means you will either have to load them up yourself or use the `ModelsHook` documented below.\n\n### ModelsHook\n\nThis hook allows you to import your Sequelize models from a particular module location into the sequelize service.\n\n#### ModelsHook Dependencies\n\n- `service:sequelize`: A sequelize service to load the models into\n\n```js\n// models/user.js\n\n// You can import the necessary classes and definitions directly from the\n// @atlas.js/sequelize module instead of loading the whole sequelize lib\nimport { Model, DataTypes } from '@atlas.js/sequelize'\n\nclass User extends Model {\n  // Here you can describe your model's fields (columns/attributes)\n  // This goes directly to Model.init() as first argument\n  static fields = {\n    name: {\n      type: DataTypes.STRING,\n      allowNull: false,\n    },\n\n    someDate: {\n      type: DataTypes.DATE,\n      allowNull: true,\n    },\n  }\n\n  // Here you can specify your model's config (options)\n  // This goes directly to Model.init() as second argument\n  static config = {\n    paranoid: true,\n    timestamps: true,\n  }\n\n  static staticMethod() {\n    // You can access the Atlas instance as a property on the\n    // Model class:\n    // this refers to the model class itself\n    this.atlas\n  }\n\n  async instanceMethod() {\n    // On instance methods, you can also access the Atlas instance\n    // directly on the model's instance\n    // this refers to the model class' instance\n    this.atlas\n  }\n}\n\nexport default User\n\n\n// models/index.js\nimport User from './user'\n// Do not use `export default` - instead export each model as a named export\n// Alternatively, just assign each model to `module.exports` object.\nexport {\n  User\n}\n// or\nmodule.exports = {\n  User,\n}\n\n// index.js\nimport * as sequelize from '@atlas.js/sequelize'\nimport { Atlas } from '@atlas.js/atlas'\n\nconst atlas = new Atlas({\n  root: __dirname,\n  config: {\n    hooks: {\n      models: {\n        // The path to the module from which all the database models should be\n        // loaded, relative to atlas.root\n        module: 'models'\n      }\n    }\n  }\n})\n\natlas.service('database', sequelize.Service)\natlas.hook('models', sequelize.ModelsHook, {\n  aliases: {\n    'service:sequelize': 'database',\n  }\n})\nawait atlas.start()\n\n// Now your models from the models/index.js module are loaded up!\nconst User = atlas.services.database.model('User')\n// or\nconst User = atlas.services.database.models.User\n```\n\n### RelationsHook\n\nThis hook allows you to describe your model's associations (relations) directly on the model definition, making the model's definition even more descriptive.\n\n#### Dependencies\n\n- `service:sequelize`: A sequelize service with all the models already loaded up\n\n```js\nclass User extends Model {\n  // Here you can define your model's relations (associations) to other models\n  // in your app\n  static relations = {\n    // This will set up a \"has many\" relation from this model to the models\n    // defined in the object\n    hasMany: {\n      // Let's say you have a Purchase model defined in your app - this will cause the following relation to be set up for you:\n      // User.hasMany(Purchase, { as: 'purchase' })\n      Purchase: {\n        as: 'purchase',\n      },\n      // The key must match an existing model name\n      Company: {}\n    },\n    belongsTo: {},\n    hasOne: {},\n  }\n}\n```\n\n### Why fields, relations, config...?\n\n> Why not attributes, associations and options?\n\nBecause all those properties already exist on a standard sequelize Model object, and adding them in your own model definition would overwrite them, causing all kinds of issues. Therefore new names had to be chosen.\n\n### MigrationAction\n\nThis action contains methods for applying and rolling back your sequelize migrations. The migration files are written exactly like standard Sequelize migrations. In addition to using plain JavaScript migration files, you may also organise your migrations into a folder with an _index.js_ file inside, if the migration requires more data or you simply wish to organise the migration in a different way than a single script.\n\n#### MigrationAction Dependencies\n\n- `service:sequelize`: A sequelize service to use with which to apply/undo the migrations\n\n```js\n// index.js\nimport * as sequelize from '@atlas.js/sequelize'\nimport { Atlas } from '@atlas.js/atlas'\n\nconst atlas = new Atlas({\n  root: __dirname,\n  config: {\n    actions: {\n      migration: {\n        // The path to the module from which all the migrations should be\n        // loaded, relative to atlas.root\n        module: 'migrations'\n      }\n    }\n  }\n})\n\natlas.action('migration', sequelize.MigrationAction, {\n  aliases: {\n    'service:sequelize': 'database'\n  }\n})\nawait atlas.start()\n\n// Available actions:\nawait atlas.actions.migration.up() // Applies all pending migrations\nawait atlas.actions.migration.down() // Rolls back last applied migration\nawait atlas.actions.migration.pending() // Returns names of pending migrations\n```\n\n#### Running migrations on start\n\nMigrations are not applied automatically on application start. You will need to implement your own hook which implements the `beforeStart` event handler and run the `up()` method from there.\n\nA simple hook doing just that:\n\n```js\nimport Hook from '@atlas.js/hook'\n\nexport default MigrateHook extends Hook {\n  async beforeStart() {\n    await this.atlas.actions.migrate.up()\n  }\n}\n```\n\n## License\n\nSee the [LICENSE](LICENSE) file for information.\n\n[sequelize-db-drivers]: http://docs.sequelizejs.com/manual/installation/getting-started.html#installation\n[sequelize-constructor]: http://docs.sequelizejs.com/class/lib/sequelize.js~Sequelize.html#instance-constructor-constructor\n","readmeFilename":"README.md","_id":"@atlas.js/sequelize@2.0.0","_npmVersion":"6.0.1","_nodeVersion":"10.1.0","_npmUser":{"name":"robertrossmann","email":"robert.rossmann@strv.com"},"dist":{"integrity":"sha512-uMkiYjnWwf6GUzHaP/jAhZNzcDFSX54otKdaJQ7ebcLIcaBD1umzsEDPlN6xsjt+YAqZDmSrxnOvXmRAJm+5NQ==","shasum":"d1be60632ac70d34768737c0edf1119f869959b7","tarball":"https://registry.npmjs.org/@atlas.js/sequelize/-/sequelize-2.0.0.tgz","fileCount":38,"unpackedSize":108840,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbBDksCRA9TVsSAnZWagAAJNMQAICMIXP09VH91Bx1UMoi\nV0JC3aflwKzCR7lW4psUfIW8BrJnLj+Sm/EFwcqTBZSY3/WlGfMGVn+tY/cY\nPGNe/67HO1jJUdcpXGjzHv8/l+VdE0ExwtNkGm+5/hcl0KeEv0GERfLaFz3I\nVSNJvmgifZN5m+oqYJa+pP/cdSBp//JKf0wPdJvRNdhIeIskVPGfPHY6xdzJ\ny8OFezLEvpdx8xuWTS8sP2dzIeFmeXYfHeS0BlIFJ0/MegGIyXD8EbjJHbsw\nFivDgulIb3HIEGeV9lzffkIDkhlTcnjd2Wetc8INnn3XuU7R19C9ed/SCbrF\nJB4AHBg1RpHI5ghYiq+E7K5wzqugTFxBEeh+W1amEyANNt4687mHMXMrLOZG\ndgAPfa7Q2fr3KVn5LAmDwv+2JS3WWf5cuf+EP2dR/Yv6HimDIzBMt7PidYXi\nM8xluQ+iTRZNXhlk29JSRxjBIOyK//cEvcokSLBFjFUbdcRvKfjoz3TtBf9n\nKqqAmn0O23iYr62HO7Idv8zDU7i3B0/G/ZTXQQmcgObBtytVSg4Vgj/YtAss\nIL+Jt7O/ASqhITxOu8D5055RM6JNKLoTaUmR5XAQJUJLyFAdqju+u1GzyXeM\nJl/Ii0Zqrcb7+WUyJzUswYeMkCH1+Qtz4V6kNQLzeP7S31S+RyeCuFnWCuMR\nc2HK\r\n=JtRA\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIChDNCh6N8KeINJ2Phbi8Z7HqoJCUL8+OORe+FmoalXwAiEAjCRc6oCNZvfUIKRaspvHik3Y9/7Q0Zx2kB2ionKfsHs="}]},"maintainers":[{"email":"robert.rossmann@strv.com","name":"robertrossmann"},{"email":"licenses@strv.com","name":"strvuser"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sequelize_2.0.0_1527003436514_0.41026164868214954"},"_hasShrinkwrap":false},"2.0.1":{"name":"@atlas.js/sequelize","description":"Sequelize service for @atlas.js","version":"2.0.1","author":{"name":"Robert Rossmann","email":"robert.rossmann@strv.com"},"bugs":{"url":"https://github.com/strvcom/atlas.js/issues"},"contributors":[],"dependencies":{"@atlas.js/action":"^1.1.1","@atlas.js/errors":"^0.2.1","@atlas.js/hook":"^2.0.1","@atlas.js/service":"^1.1.1","sequelize":"^4.37.6","umzug":"^2.0.1"},"devDependencies":{"@atlas.js/atlas":"^2.1.0","sqlite3":"^4.0.0"},"engines":{"node":">=8.3.0","npm":"^5.3.0"},"homepage":"https://github.com/strvcom/atlas.js/tree/master/packages/sequelize","keywords":[],"license":"BSD-3-Clause","main":"src","publishConfig":{"access":"public"},"repository":{"type":"git","url":"git://github.com/strvcom/atlas.js.git"},"_id":"@atlas.js/sequelize@2.0.1","_npmVersion":"6.1.0","_nodeVersion":"10.6.0","_npmUser":{"name":"robertrossmann","email":"robert.rossmann@strv.com"},"dist":{"integrity":"sha512-QH1C7u7F8S6k2y+M2fvL9vvMYCc1xQp36ZblHtWY9NbwL8It7CFbsV/AArmG6fVV/413olU/RAaL7RDfQ1JR4A==","shasum":"bf9b1dbab4d7c48e333c0f26fbafa7b953d3aa3c","tarball":"https://registry.npmjs.org/@atlas.js/sequelize/-/sequelize-2.0.1.tgz","fileCount":38,"unpackedSize":111317,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbR0pNCRA9TVsSAnZWagAAIfIP/2hSpHf4TIvIrKI5cxfY\nSaGk5IG1nj7CuM+MOXjMtqjahYJigDH+SSxJdlAPoN9uCB69cPVhVUc9b2QB\nJNs4NlZSFFarCgfnVAcZ/H/3yzjUzdEQ640C3rxqXU89rrBXvJn9DpTgHk9I\n60DmmvhKM0j9JcdQEb8OnTLVz8UVWeEYd+NFMPdokA+MjV3Vz+Lqeea2LiQq\nOqzOCSK3rz9sTA9AMSLZ0GMXakvtUveDRsqi77RDdxuioLBnzruQEJKA8TIz\n43v324AL/JL4+6/IYvxONVWrJOK6iiQL1O+GwWPB29rkK9lTMrauovonGDyH\n4ZgIxLuYpKoxTaDS3xElPQJn2drc/WizixWhtprpbr+FMJ6k8ZfRWOD0/hvz\nGgnWfLNX31itRkienrcqQD8BIlYJ4Cx4G4oznUzPb0N8eiAiXOgB1UDZuQow\np22p7mJOQOuwq8fmoTvdx5yBb6t/JXJxbReLCTt5qtQLuUKIa8eJ0eXE3Irz\nLPw9ocvR+Yw8X87WzmbhC6lOWLCPfw8PcUI49Uz9rpz3cn8UoJjl2Qoe1+Fd\nHYQuzv1WlXw8lJ4Zcya7bLvePJdf80BNcTKdv3Wtlodf2TxqIlVbSqkyrpoQ\nBjbE0MFMmsII1h/Yr8qp5RGWGBPTVXL8GJoc4++hUFdKk4CoEo3nMJQvPzci\n48oU\r\n=b2eA\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDMeF1xm36OC6Su4hL3NfxmUR+q3YVvcsMnnnB4bnpzowIhAK/9xsUxYo/6pIgVM72r5vpcaWQyZqDRAYuwzxvvoZS0"}]},"maintainers":[{"email":"robert.rossmann@strv.com","name":"robertrossmann"},{"email":"licenses@strv.com","name":"strvuser"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sequelize_2.0.1_1531398724084_0.3634307963798926"},"_hasShrinkwrap":false},"2.1.0-alpha.0":{"name":"@atlas.js/sequelize","description":"Sequelize service for @atlas.js","version":"2.1.0-alpha.0","author":{"name":"Robert Rossmann","email":"robert.rossmann@strv.com"},"bugs":{"url":"https://github.com/strvcom/atlas.js/issues"},"contributors":[],"dependencies":{"@atlas.js/action":"^1.2.0-alpha.0","@atlas.js/errors":"^0.3.0-alpha.0","@atlas.js/hook":"^2.1.0-alpha.0","@atlas.js/service":"^1.2.0-alpha.0","@types/sequelize":"^4.27.32","sequelize":"^4.37.6","umzug":"^2.0.0"},"devDependencies":{"@atlas.js/atlas":"^2.2.0-alpha.0","sqlite3":"^4.0.0"},"engines":{"node":">=8.3.0","npm":"^5.3.0"},"homepage":"https://github.com/strvcom/atlas.js/tree/master/packages/sequelize","keywords":[],"license":"BSD-3-Clause","main":"src","publishConfig":{"access":"public"},"repository":{"type":"git","url":"git://github.com/strvcom/atlas.js.git"},"gitHead":"8b6af27b5ca8e64ba5dffa05e92c01d804dbf6f1","_resolved":"","_integrity":"","_from":"file:atlas.js-sequelize-2.1.0-alpha.0.tgz","readme":"# @atlas.js/sequelize\n\nSequelize service for @atlas.js.\n\n## Installation\n\n`npm i @atlas.js/sequelize`\n\nYou will also need to install one of the [supported database drivers][sequelize-db-drivers] on your own.\n\n## Usage\n\n### Service\n\nThe service configuration only accepts two properties: `uri` and `options` which are passed directly to the [`new Sequelize(uri, options)`][sequelize-constructor] constructor.\n\n```js\nimport * as sequelize from '@atlas.js/sequelize'\nimport { Atlas } from '@atlas.js/atlas'\n\nconst atlas = new Atlas({\n  config: {\n    services: {\n      database: {\n        uri: 'postgres://postgres:postgres@127.0.0.1:27017/my-db',\n        options: {\n          pool: {\n            max: 5,\n            min: 2,\n          }\n        },\n      }\n    }\n  }\n})\n\natlas.service('database', sequelize.Service)\nawait atlas.start()\n\n// You have your sequelize client available here:\natlas.services.database\n```\n\nNote that by default, the service does not load your models which means you will either have to load them up yourself or use the `ModelsHook` documented below.\n\n### ModelsHook\n\nThis hook allows you to import your Sequelize models from a particular module location into the sequelize service.\n\n#### ModelsHook Dependencies\n\n- `service:sequelize`: A sequelize service to load the models into\n\n```js\n// models/user.js\n\n// You can import the necessary classes and definitions directly from the\n// @atlas.js/sequelize module instead of loading the whole sequelize lib\nimport { Model, DataTypes } from '@atlas.js/sequelize'\n\nclass User extends Model {\n  // Here you can describe your model's fields (columns/attributes)\n  // This goes directly to Model.init() as first argument\n  static fields = {\n    name: {\n      type: DataTypes.STRING,\n      allowNull: false,\n    },\n\n    someDate: {\n      type: DataTypes.DATE,\n      allowNull: true,\n    },\n  }\n\n  // Here you can specify your model's config (options)\n  // This goes directly to Model.init() as second argument\n  static config = {\n    paranoid: true,\n    timestamps: true,\n  }\n\n  static staticMethod() {\n    // You can access the Atlas instance as a property on the\n    // Model class:\n    // this refers to the model class itself\n    this.atlas\n  }\n\n  async instanceMethod() {\n    // On instance methods, you can also access the Atlas instance\n    // directly on the model's instance\n    // this refers to the model class' instance\n    this.atlas\n  }\n}\n\nexport default User\n\n\n// models/index.js\nimport User from './user'\n// Do not use `export default` - instead export each model as a named export\n// Alternatively, just assign each model to `module.exports` object.\nexport {\n  User\n}\n// or\nmodule.exports = {\n  User,\n}\n\n// index.js\nimport * as sequelize from '@atlas.js/sequelize'\nimport { Atlas } from '@atlas.js/atlas'\n\nconst atlas = new Atlas({\n  root: __dirname,\n  config: {\n    hooks: {\n      models: {\n        // The path to the module from which all the database models should be\n        // loaded, relative to atlas.root\n        module: 'models'\n      }\n    }\n  }\n})\n\natlas.service('database', sequelize.Service)\natlas.hook('models', sequelize.ModelsHook, {\n  aliases: {\n    'service:sequelize': 'database',\n  }\n})\nawait atlas.start()\n\n// Now your models from the models/index.js module are loaded up!\nconst User = atlas.services.database.model('User')\n// or\nconst User = atlas.services.database.models.User\n```\n\n### RelationsHook\n\nThis hook allows you to describe your model's associations (relations) directly on the model definition, making the model's definition even more descriptive.\n\n#### Dependencies\n\n- `service:sequelize`: A sequelize service with all the models already loaded up\n\n```js\nclass User extends Model {\n  // Here you can define your model's relations (associations) to other models\n  // in your app\n  static relations = {\n    // This will set up a \"has many\" relation from this model to the models\n    // defined in the object\n    hasMany: {\n      // Let's say you have a Purchase model defined in your app - this will cause the following relation to be set up for you:\n      // User.hasMany(Purchase, { as: 'purchase' })\n      Purchase: {\n        as: 'purchase',\n      },\n      // The key must match an existing model name\n      Company: {}\n    },\n    belongsTo: {},\n    hasOne: {},\n  }\n}\n```\n\n### Why fields, relations, config...?\n\n> Why not attributes, associations and options?\n\nBecause all those properties already exist on a standard sequelize Model object, and adding them in your own model definition would overwrite them, causing all kinds of issues. Therefore new names had to be chosen.\n\n### MigrationAction\n\nThis action contains methods for applying and rolling back your sequelize migrations. The migration files are written exactly like standard Sequelize migrations. In addition to using plain JavaScript migration files, you may also organise your migrations into a folder with an _index.js_ file inside, if the migration requires more data or you simply wish to organise the migration in a different way than a single script.\n\n#### MigrationAction Dependencies\n\n- `service:sequelize`: A sequelize service to use with which to apply/undo the migrations\n\n```js\n// index.js\nimport * as sequelize from '@atlas.js/sequelize'\nimport { Atlas } from '@atlas.js/atlas'\n\nconst atlas = new Atlas({\n  root: __dirname,\n  config: {\n    actions: {\n      migration: {\n        // The path to the module from which all the migrations should be\n        // loaded, relative to atlas.root\n        module: 'migrations'\n      }\n    }\n  }\n})\n\natlas.action('migration', sequelize.MigrationAction, {\n  aliases: {\n    'service:sequelize': 'database'\n  }\n})\nawait atlas.start()\n\n// Available actions:\nawait atlas.actions.migration.up() // Applies all pending migrations\nawait atlas.actions.migration.down() // Rolls back last applied migration\nawait atlas.actions.migration.pending() // Returns names of pending migrations\n```\n\n#### Running migrations on start\n\nMigrations are not applied automatically on application start. You will need to implement your own hook which implements the `beforeStart` event handler and run the `up()` method from there.\n\nA simple hook doing just that:\n\n```js\nimport Hook from '@atlas.js/hook'\n\nexport default MigrateHook extends Hook {\n  async beforeStart() {\n    await this.atlas.actions.migrate.up()\n  }\n}\n```\n\n## License\n\nSee the [LICENSE](LICENSE) file for information.\n\n[sequelize-db-drivers]: http://docs.sequelizejs.com/manual/installation/getting-started.html#installation\n[sequelize-constructor]: http://docs.sequelizejs.com/class/lib/sequelize.js~Sequelize.html#instance-constructor-constructor\n","readmeFilename":"README.md","_id":"@atlas.js/sequelize@2.1.0-alpha.0","_npmVersion":"6.4.1","_nodeVersion":"11.3.0","_npmUser":{"name":"robertrossmann","email":"robert.rossmann@strv.com"},"dist":{"integrity":"sha512-Oi7Rm5FvyO4UvwAmZv0Bc8my0aBgFsUdE7gacBjigNQFbc2Iiw82+E5W4nX6gxqhF30mzqUTvyaDXqP4jV6A+w==","shasum":"d2717356f5ce5a0dd69a4ac18b1dbdaef0304bb5","tarball":"https://registry.npmjs.org/@atlas.js/sequelize/-/sequelize-2.1.0-alpha.0.tgz","fileCount":43,"unpackedSize":122501,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcCnM9CRA9TVsSAnZWagAAepsP/RgSPIQ8PjC1hVGS+rsI\neqFSUkQ3SdIKcijMrnWT3Wb/c9RklT+pBXK0BSRqOcGol+HFEs2SLSkz1016\nX0D89pm2VhKG04ppEmHrXvAlM6sYJ8+jIUk1nsSpcgpqTuKsV2Etkll0hUYe\n7dDpcbwjQCcJAsOHTTXcDBzIdQjftNwuUCjo+JfRQxeWC5JPUTCJ1zweucHe\n6NRpFP0w73V3oZXnmN8OmhU/sqcgD4obUlmA0Se+y6qMTK3uNXuS/Edh55u3\nHMuH+7RX9Y9YnWOwZnVACX4rNHO3mxhEyMcHn04JEA/zU3mpDL4WiJMhya4A\nzxO/RD149pIeq18ZsAPnmKPSwBoNLmCUjtUoFdIxLOe/7pgBeOM+iftG2eyE\nqHcaiQwjgA15L0YBBknyWbn1K4lojfM5iuDV2HipHxT4xBmVj7PZCh93U++n\ndw1vGhxR2S8muYTGifkQM1zaujMOowJI2RVIC+TZFy0Ewbc9PDtOI8RXIc5j\noa0hze7bAF/iz31oqgfHdWD0gnjqlklZIBkUX+idlLt8wyBX2+IR5BJG91WK\ndtxn+DX4Ed/8pmo3rgoShaMBozCBYSTNA8du6y87Owb9/OtOVsH6vSDG12hy\nneTrnA8+j8ZGa9vQ5LbFgPcRFcfXmNcXA5p1ORZczRcsRqmRMk0FjwxfkH0o\nSvo3\r\n=4rrJ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIF6c5QvShr6eCfUbjLqpXtYq27D9fCC0kifvHsybko+WAiEAgytLAU6OGK0rHEe7+TiZts17z7740jGZh0IKe325Wbo="}]},"maintainers":[{"email":"robert.rossmann@strv.com","name":"robertrossmann"},{"email":"licenses@strv.com","name":"strvuser"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sequelize_2.1.0-alpha.0_1544188732601_0.6092832037177032"},"_hasShrinkwrap":false},"2.1.0-alpha.1":{"name":"@atlas.js/sequelize","description":"Sequelize service for @atlas.js","version":"2.1.0-alpha.1","author":{"name":"Robert Rossmann","email":"robert.rossmann@strv.com"},"bugs":{"url":"https://github.com/strvcom/atlas.js/issues"},"contributors":[],"dependencies":{"@atlas.js/action":"^1.2.0-alpha.0","@atlas.js/errors":"^0.3.0-alpha.0","@atlas.js/hook":"^2.1.0-alpha.0","@atlas.js/service":"^1.2.0-alpha.0","@types/sequelize":"^4.27.32","sequelize":"^4.37.6","umzug":"^2.0.0"},"devDependencies":{"@atlas.js/atlas":"^2.2.0-alpha.1","sqlite3":"^4.0.0"},"engines":{"node":">=8.3.0","npm":"^5.3.0"},"homepage":"https://github.com/strvcom/atlas.js/tree/master/packages/sequelize","keywords":[],"license":"BSD-3-Clause","main":"src","publishConfig":{"access":"public"},"repository":{"type":"git","url":"git://github.com/strvcom/atlas.js.git"},"gitHead":"e58999d8f2eee67c5e5e0f079f273f65ee9932fa","_resolved":"","_integrity":"","_from":"file:atlas.js-sequelize-2.1.0-alpha.1.tgz","readme":"# @atlas.js/sequelize\n\nSequelize service for @atlas.js.\n\n## Installation\n\n`npm i @atlas.js/sequelize`\n\nYou will also need to install one of the [supported database drivers][sequelize-db-drivers] on your own.\n\n## Usage\n\n### Service\n\nThe service configuration only accepts two properties: `uri` and `options` which are passed directly to the [`new Sequelize(uri, options)`][sequelize-constructor] constructor.\n\n```js\nimport * as sequelize from '@atlas.js/sequelize'\nimport { Atlas } from '@atlas.js/atlas'\n\nconst atlas = new Atlas({\n  config: {\n    services: {\n      database: {\n        uri: 'postgres://postgres:postgres@127.0.0.1:27017/my-db',\n        options: {\n          pool: {\n            max: 5,\n            min: 2,\n          }\n        },\n      }\n    }\n  }\n})\n\natlas.service('database', sequelize.Service)\nawait atlas.start()\n\n// You have your sequelize client available here:\natlas.services.database\n```\n\nNote that by default, the service does not load your models which means you will either have to load them up yourself or use the `ModelsHook` documented below.\n\n### ModelsHook\n\nThis hook allows you to import your Sequelize models from a particular module location into the sequelize service.\n\n#### ModelsHook Dependencies\n\n- `service:sequelize`: A sequelize service to load the models into\n\n```js\n// models/user.js\n\n// You can import the necessary classes and definitions directly from the\n// @atlas.js/sequelize module instead of loading the whole sequelize lib\nimport { Model, DataTypes } from '@atlas.js/sequelize'\n\nclass User extends Model {\n  // Here you can describe your model's fields (columns/attributes)\n  // This goes directly to Model.init() as first argument\n  static fields = {\n    name: {\n      type: DataTypes.STRING,\n      allowNull: false,\n    },\n\n    someDate: {\n      type: DataTypes.DATE,\n      allowNull: true,\n    },\n  }\n\n  // Here you can specify your model's config (options)\n  // This goes directly to Model.init() as second argument\n  static config = {\n    paranoid: true,\n    timestamps: true,\n  }\n\n  static staticMethod() {\n    // You can access the Atlas instance as a property on the\n    // Model class:\n    // this refers to the model class itself\n    this.atlas\n  }\n\n  async instanceMethod() {\n    // On instance methods, you can also access the Atlas instance\n    // directly on the model's instance\n    // this refers to the model class' instance\n    this.atlas\n  }\n}\n\nexport default User\n\n\n// models/index.js\nimport User from './user'\n// Do not use `export default` - instead export each model as a named export\n// Alternatively, just assign each model to `module.exports` object.\nexport {\n  User\n}\n// or\nmodule.exports = {\n  User,\n}\n\n// index.js\nimport * as sequelize from '@atlas.js/sequelize'\nimport { Atlas } from '@atlas.js/atlas'\n\nconst atlas = new Atlas({\n  root: __dirname,\n  config: {\n    hooks: {\n      models: {\n        // The path to the module from which all the database models should be\n        // loaded, relative to atlas.root\n        module: 'models'\n      }\n    }\n  }\n})\n\natlas.service('database', sequelize.Service)\natlas.hook('models', sequelize.ModelsHook, {\n  aliases: {\n    'service:sequelize': 'database',\n  }\n})\nawait atlas.start()\n\n// Now your models from the models/index.js module are loaded up!\nconst User = atlas.services.database.model('User')\n// or\nconst User = atlas.services.database.models.User\n```\n\n### RelationsHook\n\nThis hook allows you to describe your model's associations (relations) directly on the model definition, making the model's definition even more descriptive.\n\n#### Dependencies\n\n- `service:sequelize`: A sequelize service with all the models already loaded up\n\n```js\nclass User extends Model {\n  // Here you can define your model's relations (associations) to other models\n  // in your app\n  static relations = {\n    // This will set up a \"has many\" relation from this model to the models\n    // defined in the object\n    hasMany: {\n      // Let's say you have a Purchase model defined in your app - this will cause the following relation to be set up for you:\n      // User.hasMany(Purchase, { as: 'purchase' })\n      Purchase: {\n        as: 'purchase',\n      },\n      // The key must match an existing model name\n      Company: {}\n    },\n    belongsTo: {},\n    hasOne: {},\n  }\n}\n```\n\n### Why fields, relations, config...?\n\n> Why not attributes, associations and options?\n\nBecause all those properties already exist on a standard sequelize Model object, and adding them in your own model definition would overwrite them, causing all kinds of issues. Therefore new names had to be chosen.\n\n### MigrationAction\n\nThis action contains methods for applying and rolling back your sequelize migrations. The migration files are written exactly like standard Sequelize migrations. In addition to using plain JavaScript migration files, you may also organise your migrations into a folder with an _index.js_ file inside, if the migration requires more data or you simply wish to organise the migration in a different way than a single script.\n\n#### MigrationAction Dependencies\n\n- `service:sequelize`: A sequelize service to use with which to apply/undo the migrations\n\n```js\n// index.js\nimport * as sequelize from '@atlas.js/sequelize'\nimport { Atlas } from '@atlas.js/atlas'\n\nconst atlas = new Atlas({\n  root: __dirname,\n  config: {\n    actions: {\n      migration: {\n        // The path to the module from which all the migrations should be\n        // loaded, relative to atlas.root\n        module: 'migrations'\n      }\n    }\n  }\n})\n\natlas.action('migration', sequelize.MigrationAction, {\n  aliases: {\n    'service:sequelize': 'database'\n  }\n})\nawait atlas.start()\n\n// Available actions:\nawait atlas.actions.migration.up() // Applies all pending migrations\nawait atlas.actions.migration.down() // Rolls back last applied migration\nawait atlas.actions.migration.pending() // Returns names of pending migrations\n```\n\n#### Running migrations on start\n\nMigrations are not applied automatically on application start. You will need to implement your own hook which implements the `beforeStart` event handler and run the `up()` method from there.\n\nA simple hook doing just that:\n\n```js\nimport Hook from '@atlas.js/hook'\n\nexport default MigrateHook extends Hook {\n  async beforeStart() {\n    await this.atlas.actions.migrate.up()\n  }\n}\n```\n\n## License\n\nSee the [LICENSE](LICENSE) file for information.\n\n[sequelize-db-drivers]: http://docs.sequelizejs.com/manual/installation/getting-started.html#installation\n[sequelize-constructor]: http://docs.sequelizejs.com/class/lib/sequelize.js~Sequelize.html#instance-constructor-constructor\n","readmeFilename":"README.md","_id":"@atlas.js/sequelize@2.1.0-alpha.1","_npmVersion":"6.4.1","_nodeVersion":"11.3.0","_npmUser":{"name":"robertrossmann","email":"robert.rossmann@strv.com"},"dist":{"integrity":"sha512-JC6vchKJdFiYhkCcf+nNqd1UtAu20c2zIZwrrqqznElvXs6+I6htRKPYAaO3BuW7+m3jJPATxRrtg1M5ZC6SNQ==","shasum":"f2d514f0af3c4928efd404b16e1715cb1740129c","tarball":"https://registry.npmjs.org/@atlas.js/sequelize/-/sequelize-2.1.0-alpha.1.tgz","fileCount":43,"unpackedSize":122492,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcDi1nCRA9TVsSAnZWagAADUsP+gIe2CXshEpX+NylEWpJ\nobDluOFrHOKLD/V5/gQw87e0sqXv5rbsUZzRfD2tRq/uHi+9frGJmgP/Lasz\n/CHxQ/l2oXSBxQm1+a72EGCPvEWpp8T5kXN0H+mliJ0Vx6cODqc4ZZgnUvzY\nj9kte+jpVk1EaJoDh218RMv07q0CzYEgfNgzZybQRjEdba0u8A5y3l0RPiU0\nYfQ+EVOXp7FchBRsAMv90PaAMo+hLemZf3eObVzSQUGWH46HGnnR2nbISDRu\nwpP+G/1sx/WMSvlFOofftdPTQ8/FCXwF06/jgAjHdlEE47iHJuCkY6phSMoC\ne7ubUw61FlOfAo+maLhdsmzKDlmBl3wBklhlcUg4SQbhGABcROJZ86eplQHj\nh0yr1pSn7Zkcbwg9DeBTK3boUmDOlDJPgLoMb9f9Xn0Lzji/N6gDZAiIEdw7\n6ONRvX1S4163Np3YoV2CoTWdkb813RU+YqElMpdn32vhLQKqFnYmoP2VKEBE\nFSG9E4fsha0ZVhVSiZifZ/7alJZ/RoDY5sILQku2wlNKoOD0yrDZTI3L4d93\nchoDmFqa4s+n4YFsj4lUl0BqF73UVKKftC6DFExwGZ7Jxu5KUNhcYlsN+cGq\nIxiYReyc1nHwDwnv6ky8tsF6qvy/AkGAuMBv1p0QOF1hb8hZYvKKOTeSDTX/\nP9Ir\r\n=UEaS\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD5BJkXw8lDZ640ENwRv6/rEu8Y3WGRko4WzOA8YwB6hAIhANOlAuNwQqZva5eQnG2xtx6hS/YuWiKUqw3Dj0RZ8mnX"}]},"maintainers":[{"email":"robert.rossmann@strv.com","name":"robertrossmann"},{"email":"licenses@strv.com","name":"strvuser"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sequelize_2.1.0-alpha.1_1544432998761_0.6021489857511197"},"_hasShrinkwrap":false},"2.1.0-alpha.2":{"name":"@atlas.js/sequelize","description":"Sequelize service for @atlas.js","version":"2.1.0-alpha.2","author":{"name":"Robert Rossmann","email":"robert.rossmann@strv.com"},"bugs":{"url":"https://github.com/strvcom/atlas.js/issues"},"contributors":[],"dependencies":{"@atlas.js/action":"^1.2.0-alpha.0","@atlas.js/errors":"^0.3.0-alpha.0","@atlas.js/hook":"^2.1.0-alpha.0","@atlas.js/service":"^1.2.0-alpha.0","@types/sequelize":"^4.27.32","sequelize":"^4.37.6","umzug":"^2.0.0"},"devDependencies":{"@atlas.js/atlas":"^2.2.0-alpha.1","sqlite3":"^4.0.0"},"engines":{"node":">=8.3.0","npm":"^5.3.0"},"homepage":"https://github.com/strvcom/atlas.js/tree/master/packages/sequelize","keywords":[],"license":"BSD-3-Clause","main":"src","publishConfig":{"access":"public"},"repository":{"type":"git","url":"git://github.com/strvcom/atlas.js.git"},"gitHead":"63f310da00ce969d92f1547d7635e09a56dd57fb","_resolved":"","_integrity":"","_from":"file:atlas.js-sequelize-2.1.0-alpha.2.tgz","readme":"# @atlas.js/sequelize\n\nSequelize service for @atlas.js.\n\n## Installation\n\n`npm i @atlas.js/sequelize`\n\nYou will also need to install one of the [supported database drivers][sequelize-db-drivers] on your own.\n\n## Usage\n\n### Service\n\nThe service configuration only accepts two properties: `uri` and `options` which are passed directly to the [`new Sequelize(uri, options)`][sequelize-constructor] constructor.\n\n```js\nimport * as sequelize from '@atlas.js/sequelize'\nimport { Atlas } from '@atlas.js/atlas'\n\nconst atlas = new Atlas({\n  config: {\n    services: {\n      database: {\n        uri: 'postgres://postgres:postgres@127.0.0.1:27017/my-db',\n        options: {\n          pool: {\n            max: 5,\n            min: 2,\n          }\n        },\n      }\n    }\n  }\n})\n\natlas.service('database', sequelize.Service)\nawait atlas.start()\n\n// You have your sequelize client available here:\natlas.services.database\n```\n\nNote that by default, the service does not load your models which means you will either have to load them up yourself or use the `ModelsHook` documented below.\n\n### ModelsHook\n\nThis hook allows you to import your Sequelize models from a particular module location into the sequelize service.\n\n#### ModelsHook Dependencies\n\n- `service:sequelize`: A sequelize service to load the models into\n\n```js\n// models/user.js\n\n// You can import the necessary classes and definitions directly from the\n// @atlas.js/sequelize module instead of loading the whole sequelize lib\nimport { Model, DataTypes } from '@atlas.js/sequelize'\n\nclass User extends Model {\n  // Here you can describe your model's fields (columns/attributes)\n  // This goes directly to Model.init() as first argument\n  static fields = {\n    name: {\n      type: DataTypes.STRING,\n      allowNull: false,\n    },\n\n    someDate: {\n      type: DataTypes.DATE,\n      allowNull: true,\n    },\n  }\n\n  // Here you can specify your model's config (options)\n  // This goes directly to Model.init() as second argument\n  static config = {\n    paranoid: true,\n    timestamps: true,\n  }\n\n  static staticMethod() {\n    // You can access the Atlas instance as a property on the\n    // Model class:\n    // this refers to the model class itself\n    this.atlas\n  }\n\n  async instanceMethod() {\n    // On instance methods, you can also access the Atlas instance\n    // directly on the model's instance\n    // this refers to the model class' instance\n    this.atlas\n  }\n}\n\nexport default User\n\n\n// models/index.js\nimport User from './user'\n// Do not use `export default` - instead export each model as a named export\n// Alternatively, just assign each model to `module.exports` object.\nexport {\n  User\n}\n// or\nmodule.exports = {\n  User,\n}\n\n// index.js\nimport * as sequelize from '@atlas.js/sequelize'\nimport { Atlas } from '@atlas.js/atlas'\n\nconst atlas = new Atlas({\n  root: __dirname,\n  config: {\n    hooks: {\n      models: {\n        // The path to the module from which all the database models should be\n        // loaded, relative to atlas.root\n        module: 'models'\n      }\n    }\n  }\n})\n\natlas.service('database', sequelize.Service)\natlas.hook('models', sequelize.ModelsHook, {\n  aliases: {\n    'service:sequelize': 'database',\n  }\n})\nawait atlas.start()\n\n// Now your models from the models/index.js module are loaded up!\nconst User = atlas.services.database.model('User')\n// or\nconst User = atlas.services.database.models.User\n```\n\n### RelationsHook\n\nThis hook allows you to describe your model's associations (relations) directly on the model definition, making the model's definition even more descriptive.\n\n#### Dependencies\n\n- `service:sequelize`: A sequelize service with all the models already loaded up\n\n```js\nclass User extends Model {\n  // Here you can define your model's relations (associations) to other models\n  // in your app\n  static relations = {\n    // This will set up a \"has many\" relation from this model to the models\n    // defined in the object\n    hasMany: {\n      // Let's say you have a Purchase model defined in your app - this will cause the following relation to be set up for you:\n      // User.hasMany(Purchase, { as: 'purchase' })\n      Purchase: {\n        as: 'purchase',\n      },\n      // The key must match an existing model name\n      Company: {}\n    },\n    belongsTo: {},\n    hasOne: {},\n  }\n}\n```\n\n### Why fields, relations, config...?\n\n> Why not attributes, associations and options?\n\nBecause all those properties already exist on a standard sequelize Model object, and adding them in your own model definition would overwrite them, causing all kinds of issues. Therefore new names had to be chosen.\n\n### MigrationAction\n\nThis action contains methods for applying and rolling back your sequelize migrations. The migration files are written exactly like standard Sequelize migrations. In addition to using plain JavaScript migration files, you may also organise your migrations into a folder with an _index.js_ file inside, if the migration requires more data or you simply wish to organise the migration in a different way than a single script.\n\n#### MigrationAction Dependencies\n\n- `service:sequelize`: A sequelize service to use with which to apply/undo the migrations\n\n```js\n// index.js\nimport * as sequelize from '@atlas.js/sequelize'\nimport { Atlas } from '@atlas.js/atlas'\n\nconst atlas = new Atlas({\n  root: __dirname,\n  config: {\n    actions: {\n      migration: {\n        // The path to the module from which all the migrations should be\n        // loaded, relative to atlas.root\n        module: 'migrations'\n      }\n    }\n  }\n})\n\natlas.action('migration', sequelize.MigrationAction, {\n  aliases: {\n    'service:sequelize': 'database'\n  }\n})\nawait atlas.start()\n\n// Available actions:\nawait atlas.actions.migration.up() // Applies all pending migrations\nawait atlas.actions.migration.down() // Rolls back last applied migration\nawait atlas.actions.migration.pending() // Returns names of pending migrations\n```\n\n#### Running migrations on start\n\nMigrations are not applied automatically on application start. You will need to implement your own hook which implements the `beforeStart` event handler and run the `up()` method from there.\n\nA simple hook doing just that:\n\n```js\nimport Hook from '@atlas.js/hook'\n\nexport default MigrateHook extends Hook {\n  async beforeStart() {\n    await this.atlas.actions.migrate.up()\n  }\n}\n```\n\n## License\n\nSee the [LICENSE](LICENSE) file for information.\n\n[sequelize-db-drivers]: http://docs.sequelizejs.com/manual/installation/getting-started.html#installation\n[sequelize-constructor]: http://docs.sequelizejs.com/class/lib/sequelize.js~Sequelize.html#instance-constructor-constructor\n","readmeFilename":"README.md","_id":"@atlas.js/sequelize@2.1.0-alpha.2","_npmVersion":"6.4.1","_nodeVersion":"11.3.0","_npmUser":{"name":"robertrossmann","email":"robert.rossmann@strv.com"},"dist":{"integrity":"sha512-n7NaZE9TkHT27qxrIlcQ87zMIQpruEmAgs9t7jNXpX3GOtmsq5e8TD1B0gupbfZrTUGEk7Hbv8g/Eu6J6BkP3Q==","shasum":"013423ed9d837b263e3f8bfb263ba4dcd9862bda","tarball":"https://registry.npmjs.org/@atlas.js/sequelize/-/sequelize-2.1.0-alpha.2.tgz","fileCount":43,"unpackedSize":122628,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcD3s2CRA9TVsSAnZWagAA+iAP/3h0vKmt9XepR531VdMH\nXDNVwgcnwG9QQcA7v2Npok7ZXPyklrUjzkxFKdvytbCQHAp8zn2Qpy3Mo6ca\npinprOau5pQI2Bh9OiOoT7UXoL4qRw5N04JsZAdw4S9q+U+1axRRJ51cULG4\n3jELeEb3oyvJnsph/g+f7o6Vr/jrYm4VDSe7oLkWH/OZy8L+qGk9wM8UkJm+\ncHGyXzDHJ7hXwXUNA8hDEYk/CdJllaFhFKAhJhyBuqAw2ypn3O1JnEfTMSVQ\nnW2DcTGDlQkmVXJ2vGUx6b8j+QVN0v1UY/1FnRvypOJYAqTG+s+RNkZhpjXy\nDN5yCg3eJJcTtFbo/7Z7iQpsmj5P1L0yc25KSmc4gwbOrUudJterVsIEU90I\nL6Mr1F2hoa5tfJiP9VhKad9RuA1dmGOIOkEJJZP9noIjPG0pE28egJ+sDXBU\nhkUGf+6x1AGJWEh1QOSo5FhzWMSdNI+tcwKk3Cum1adKsZqNRQTo2NJW7o/z\nopp00oq0h8INNTbICmiOcgcPO1j5cEgqU+CWDNSz24ukkuQKeJWVbpYqhmcW\nVNonuBFWx6EGInUToVDJz73Z76EQXPbjf0nO8f/QOF9bl+ZPl7sw1sb+tlk5\nkbqDOAbvt+8nV4MdiBgtt0ldDH+7KOaAQSXmXPzaCd5qMEdzcb9r9C4Wm9zI\nsVGy\r\n=Mues\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDtdqE09eOID2OflJIcxTBR6LRWRcSdYxsxdGY5AprDjQIgJenEt8PevTiOEaFhVQykdlX2eFiYps1XpY4OtiXhZZI="}]},"maintainers":[{"email":"robert.rossmann@strv.com","name":"robertrossmann"},{"email":"licenses@strv.com","name":"strvuser"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sequelize_2.1.0-alpha.2_1544518454083_0.17451343659710972"},"_hasShrinkwrap":false},"2.1.0-alpha.3":{"name":"@atlas.js/sequelize","description":"Sequelize service for @atlas.js","version":"2.1.0-alpha.3","author":{"name":"Robert Rossmann","email":"robert.rossmann@strv.com"},"bugs":{"url":"https://github.com/strvcom/atlas.js/issues"},"contributors":[],"dependencies":{"@atlas.js/action":"^1.2.0-alpha.0","@atlas.js/errors":"^0.3.0-alpha.0","@atlas.js/hook":"^2.1.0-alpha.0","@atlas.js/service":"^1.2.0-alpha.0","@types/sequelize":"^4.27.32","sequelize":"^4.37.6","umzug":"^2.0.0"},"devDependencies":{"@atlas.js/atlas":"^2.2.0-alpha.2","sqlite3":"^4.0.0"},"engines":{"node":">=8.3.0","npm":"^5.3.0"},"homepage":"https://github.com/strvcom/atlas.js/tree/master/packages/sequelize","keywords":[],"license":"BSD-3-Clause","main":"src","publishConfig":{"access":"public"},"repository":{"type":"git","url":"git://github.com/strvcom/atlas.js.git"},"gitHead":"7b27ac160fb022b2f275b850faa70b26347c339a","_resolved":"","_integrity":"","_from":"file:atlas.js-sequelize-2.1.0-alpha.3.tgz","readme":"# @atlas.js/sequelize\n\nSequelize service for @atlas.js.\n\n## Installation\n\n`npm i @atlas.js/sequelize`\n\nYou will also need to install one of the [supported database drivers][sequelize-db-drivers] on your own.\n\n## Usage\n\n### Service\n\nThe service configuration only accepts two properties: `uri` and `options` which are passed directly to the [`new Sequelize(uri, options)`][sequelize-constructor] constructor.\n\n```js\nimport * as sequelize from '@atlas.js/sequelize'\nimport { Atlas } from '@atlas.js/atlas'\n\nconst atlas = new Atlas({\n  config: {\n    services: {\n      database: {\n        uri: 'postgres://postgres:postgres@127.0.0.1:27017/my-db',\n        options: {\n          pool: {\n            max: 5,\n            min: 2,\n          }\n        },\n      }\n    }\n  }\n})\n\natlas.service('database', sequelize.Service)\nawait atlas.start()\n\n// You have your sequelize client available here:\natlas.services.database\n```\n\nNote that by default, the service does not load your models which means you will either have to load them up yourself or use the `ModelsHook` documented below.\n\n### ModelsHook\n\nThis hook allows you to import your Sequelize models from a particular module location into the sequelize service.\n\n#### ModelsHook Dependencies\n\n- `service:sequelize`: A sequelize service to load the models into\n\n```js\n// models/user.js\n\n// You can import the necessary classes and definitions directly from the\n// @atlas.js/sequelize module instead of loading the whole sequelize lib\nimport { Model, DataTypes } from '@atlas.js/sequelize'\n\nclass User extends Model {\n  // Here you can describe your model's fields (columns/attributes)\n  // This goes directly to Model.init() as first argument\n  static fields = {\n    name: {\n      type: DataTypes.STRING,\n      allowNull: false,\n    },\n\n    someDate: {\n      type: DataTypes.DATE,\n      allowNull: true,\n    },\n  }\n\n  // Here you can specify your model's config (options)\n  // This goes directly to Model.init() as second argument\n  static config = {\n    paranoid: true,\n    timestamps: true,\n  }\n\n  static staticMethod() {\n    // You can access the Atlas instance as a property on the\n    // Model class:\n    // this refers to the model class itself\n    this.atlas\n  }\n\n  async instanceMethod() {\n    // On instance methods, you can also access the Atlas instance\n    // directly on the model's instance\n    // this refers to the model class' instance\n    this.atlas\n  }\n}\n\nexport default User\n\n\n// models/index.js\nimport User from './user'\n// Do not use `export default` - instead export each model as a named export\n// Alternatively, just assign each model to `module.exports` object.\nexport {\n  User\n}\n// or\nmodule.exports = {\n  User,\n}\n\n// index.js\nimport * as sequelize from '@atlas.js/sequelize'\nimport { Atlas } from '@atlas.js/atlas'\n\nconst atlas = new Atlas({\n  root: __dirname,\n  config: {\n    hooks: {\n      models: {\n        // The path to the module from which all the database models should be\n        // loaded, relative to atlas.root\n        module: 'models'\n      }\n    }\n  }\n})\n\natlas.service('database', sequelize.Service)\natlas.hook('models', sequelize.ModelsHook, {\n  aliases: {\n    'service:sequelize': 'database',\n  }\n})\nawait atlas.start()\n\n// Now your models from the models/index.js module are loaded up!\nconst User = atlas.services.database.model('User')\n// or\nconst User = atlas.services.database.models.User\n```\n\n### RelationsHook\n\nThis hook allows you to describe your model's associations (relations) directly on the model definition, making the model's definition even more descriptive.\n\n#### Dependencies\n\n- `service:sequelize`: A sequelize service with all the models already loaded up\n\n```js\nclass User extends Model {\n  // Here you can define your model's relations (associations) to other models\n  // in your app\n  static relations = {\n    // This will set up a \"has many\" relation from this model to the models\n    // defined in the object\n    hasMany: {\n      // Let's say you have a Purchase model defined in your app - this will cause the following relation to be set up for you:\n      // User.hasMany(Purchase, { as: 'purchase' })\n      Purchase: {\n        as: 'purchase',\n      },\n      // The key must match an existing model name\n      Company: {}\n    },\n    belongsTo: {},\n    hasOne: {},\n  }\n}\n```\n\n### Why fields, relations, config...?\n\n> Why not attributes, associations and options?\n\nBecause all those properties already exist on a standard sequelize Model object, and adding them in your own model definition would overwrite them, causing all kinds of issues. Therefore new names had to be chosen.\n\n### MigrationAction\n\nThis action contains methods for applying and rolling back your sequelize migrations. The migration files are written exactly like standard Sequelize migrations. In addition to using plain JavaScript migration files, you may also organise your migrations into a folder with an _index.js_ file inside, if the migration requires more data or you simply wish to organise the migration in a different way than a single script.\n\n#### MigrationAction Dependencies\n\n- `service:sequelize`: A sequelize service to use with which to apply/undo the migrations\n\n```js\n// index.js\nimport * as sequelize from '@atlas.js/sequelize'\nimport { Atlas } from '@atlas.js/atlas'\n\nconst atlas = new Atlas({\n  root: __dirname,\n  config: {\n    actions: {\n      migration: {\n        // The path to the module from which all the migrations should be\n        // loaded, relative to atlas.root\n        module: 'migrations'\n      }\n    }\n  }\n})\n\natlas.action('migration', sequelize.MigrationAction, {\n  aliases: {\n    'service:sequelize': 'database'\n  }\n})\nawait atlas.start()\n\n// Available actions:\nawait atlas.actions.migration.up() // Applies all pending migrations\nawait atlas.actions.migration.down() // Rolls back last applied migration\nawait atlas.actions.migration.pending() // Returns names of pending migrations\n```\n\n#### Running migrations on start\n\nMigrations are not applied automatically on application start. You will need to implement your own hook which implements the `beforeStart` event handler and run the `up()` method from there.\n\nA simple hook doing just that:\n\n```js\nimport Hook from '@atlas.js/hook'\n\nexport default MigrateHook extends Hook {\n  async beforeStart() {\n    await this.atlas.actions.migrate.up()\n  }\n}\n```\n\n## License\n\nSee the [LICENSE](LICENSE) file for information.\n\n[sequelize-db-drivers]: http://docs.sequelizejs.com/manual/installation/getting-started.html#installation\n[sequelize-constructor]: http://docs.sequelizejs.com/class/lib/sequelize.js~Sequelize.html#instance-constructor-constructor\n","readmeFilename":"README.md","_id":"@atlas.js/sequelize@2.1.0-alpha.3","_npmVersion":"6.4.1","_nodeVersion":"11.3.0","_npmUser":{"name":"robertrossmann","email":"robert.rossmann@strv.com"},"dist":{"integrity":"sha512-I3evc2h4RAY1T4cNxrPuwQjsPFvC8GOSd1wvR8TF/43WjdLgCQ+GnBGuQGqYdRXhfYTgAEnkyJS/s46oGUrhnw==","shasum":"2ff5d8a8a4e136ae021b8371ed95069688614e3e","tarball":"https://registry.npmjs.org/@atlas.js/sequelize/-/sequelize-2.1.0-alpha.3.tgz","fileCount":43,"unpackedSize":122628,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcD7fCCRA9TVsSAnZWagAAJl8P/3nvluVMqqqQa7m3XAq9\nOPH/ToPd8prY1jbpHMc6QpTASAcEfJEqsXkd18knsFXvgCGolBjLMFN4Su1e\nsGTwpfNzf+WwLQ+/b/X+gd59ho90GPt0gX1nFIRKtgcVVCLt5YcndZlItNeP\noaUwv/qRCKCK90KpXP0GXviqcDQSVjtbWTuVKpxEECZwNiM2Jd0sGQR8Ymhs\n8HjFfyr/V3bbdUf1V4xQP0rPxPI+TaPAqnLcVUYPUfnJ3EcS26j3odo/agYH\nr09iisOEe/gDtaaWgksb7b5V9jpWTVdGX2VAajMUXqgVt8COZSay+yGmpR6z\naYMKtKh/SVMQr7TFcuDOFmVgfV409cyj0vsWTZT9luSD8o1AaclFl+yx9Fk/\nCRTGALFom2CebyqhYYjbpQLQHR5bHm9MfviMaGC/WWsXUfHYOI9/K8riko4f\nnXo6AMQPE5GAJLIBn9eWbttptPq4VJL/pmN9MlzoAmrdfxBdCnL7xkIjZhPy\n3GRbZo/q+622912FhwSnYb2lV/LTLOUC1rbEWxu/VF44i0cmIzTB5GyrvhkL\n/n6C6yxTfCAa4Qca0T+tlko+y4C8NeOrkxZUMjd+ruFpE6gLiwGeXXa9Rh4O\nbmkTKbDUB7WembQuvQf90r2ipUZXzCP0p7MtYOzsbS+7t8jvH3v+hvLE++v1\nuGj2\r\n=JlA8\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIE72wQLkJO7yDQVzdcQ/sfu9bd2j31XUxDF5eWqmn8B/AiAy+4lph8rz8DhEu1kaNZ8ZT7uOgsz+TVcJUSQW+GTWIw=="}]},"maintainers":[{"email":"robert.rossmann@strv.com","name":"robertrossmann"},{"email":"licenses@strv.com","name":"strvuser"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sequelize_2.1.0-alpha.3_1544533953471_0.04976153896315072"},"_hasShrinkwrap":false},"2.1.0-alpha.4":{"name":"@atlas.js/sequelize","description":"Sequelize service for @atlas.js","version":"2.1.0-alpha.4","author":{"name":"Robert Rossmann","email":"robert.rossmann@strv.com"},"bugs":{"url":"https://github.com/strvcom/atlas.js/issues"},"contributors":[],"dependencies":{"@atlas.js/action":"^1.2.0-alpha.0","@atlas.js/errors":"^0.3.0-alpha.0","@atlas.js/hook":"^2.1.0-alpha.0","@atlas.js/service":"^1.2.0-alpha.0","@types/sequelize":"^4.27.32","sequelize":"^4.37.6","umzug":"^2.0.0"},"devDependencies":{"@atlas.js/atlas":"^2.2.0-alpha.3","sqlite3":"^4.0.0"},"engines":{"node":">=8.3.0","npm":"^5.3.0"},"homepage":"https://github.com/strvcom/atlas.js/tree/master/packages/sequelize","keywords":[],"license":"BSD-3-Clause","main":"src","publishConfig":{"access":"public"},"repository":{"type":"git","url":"git://github.com/strvcom/atlas.js.git"},"gitHead":"ee441a017595bb0b88e20eec1df9cacddfdae96f","_resolved":"","_integrity":"","_from":"file:atlas.js-sequelize-2.1.0-alpha.4.tgz","readme":"# @atlas.js/sequelize\n\nSequelize service for @atlas.js.\n\n## Installation\n\n`npm i @atlas.js/sequelize`\n\nYou will also need to install one of the [supported database drivers][sequelize-db-drivers] on your own.\n\n## Usage\n\n### Service\n\nThe service configuration only accepts two properties: `uri` and `options` which are passed directly to the [`new Sequelize(uri, options)`][sequelize-constructor] constructor.\n\n```js\nimport * as sequelize from '@atlas.js/sequelize'\nimport { Atlas } from '@atlas.js/atlas'\n\nconst atlas = new Atlas({\n  config: {\n    services: {\n      database: {\n        uri: 'postgres://postgres:postgres@127.0.0.1:27017/my-db',\n        options: {\n          pool: {\n            max: 5,\n            min: 2,\n          }\n        },\n      }\n    }\n  }\n})\n\natlas.service('database', sequelize.Service)\nawait atlas.start()\n\n// You have your sequelize client available here:\natlas.services.database\n```\n\nNote that by default, the service does not load your models which means you will either have to load them up yourself or use the `ModelsHook` documented below.\n\n### ModelsHook\n\nThis hook allows you to import your Sequelize models from a particular module location into the sequelize service.\n\n#### ModelsHook Dependencies\n\n- `service:sequelize`: A sequelize service to load the models into\n\n```js\n// models/user.js\n\n// You can import the necessary classes and definitions directly from the\n// @atlas.js/sequelize module instead of loading the whole sequelize lib\nimport { Model, DataTypes } from '@atlas.js/sequelize'\n\nclass User extends Model {\n  // Here you can describe your model's fields (columns/attributes)\n  // This goes directly to Model.init() as first argument\n  static fields = {\n    name: {\n      type: DataTypes.STRING,\n      allowNull: false,\n    },\n\n    someDate: {\n      type: DataTypes.DATE,\n      allowNull: true,\n    },\n  }\n\n  // Here you can specify your model's config (options)\n  // This goes directly to Model.init() as second argument\n  static config = {\n    paranoid: true,\n    timestamps: true,\n  }\n\n  static staticMethod() {\n    // You can access the Atlas instance as a property on the\n    // Model class:\n    // this refers to the model class itself\n    this.atlas\n  }\n\n  async instanceMethod() {\n    // On instance methods, you can also access the Atlas instance\n    // directly on the model's instance\n    // this refers to the model class' instance\n    this.atlas\n  }\n}\n\nexport default User\n\n\n// models/index.js\nimport User from './user'\n// Do not use `export default` - instead export each model as a named export\n// Alternatively, just assign each model to `module.exports` object.\nexport {\n  User\n}\n// or\nmodule.exports = {\n  User,\n}\n\n// index.js\nimport * as sequelize from '@atlas.js/sequelize'\nimport { Atlas } from '@atlas.js/atlas'\n\nconst atlas = new Atlas({\n  root: __dirname,\n  config: {\n    hooks: {\n      models: {\n        // The path to the module from which all the database models should be\n        // loaded, relative to atlas.root\n        module: 'models'\n      }\n    }\n  }\n})\n\natlas.service('database', sequelize.Service)\natlas.hook('models', sequelize.ModelsHook, {\n  aliases: {\n    'service:sequelize': 'database',\n  }\n})\nawait atlas.start()\n\n// Now your models from the models/index.js module are loaded up!\nconst User = atlas.services.database.model('User')\n// or\nconst User = atlas.services.database.models.User\n```\n\n### RelationsHook\n\nThis hook allows you to describe your model's associations (relations) directly on the model definition, making the model's definition even more descriptive.\n\n#### Dependencies\n\n- `service:sequelize`: A sequelize service with all the models already loaded up\n\n```js\nclass User extends Model {\n  // Here you can define your model's relations (associations) to other models\n  // in your app\n  static relations = {\n    // This will set up a \"has many\" relation from this model to the models\n    // defined in the object\n    hasMany: {\n      // Let's say you have a Purchase model defined in your app - this will cause the following relation to be set up for you:\n      // User.hasMany(Purchase, { as: 'purchase' })\n      Purchase: {\n        as: 'purchase',\n      },\n      // The key must match an existing model name\n      Company: {}\n    },\n    belongsTo: {},\n    hasOne: {},\n  }\n}\n```\n\n### Why fields, relations, config...?\n\n> Why not attributes, associations and options?\n\nBecause all those properties already exist on a standard sequelize Model object, and adding them in your own model definition would overwrite them, causing all kinds of issues. Therefore new names had to be chosen.\n\n### MigrationAction\n\nThis action contains methods for applying and rolling back your sequelize migrations. The migration files are written exactly like standard Sequelize migrations. In addition to using plain JavaScript migration files, you may also organise your migrations into a folder with an _index.js_ file inside, if the migration requires more data or you simply wish to organise the migration in a different way than a single script.\n\n#### MigrationAction Dependencies\n\n- `service:sequelize`: A sequelize service to use with which to apply/undo the migrations\n\n```js\n// index.js\nimport * as sequelize from '@atlas.js/sequelize'\nimport { Atlas } from '@atlas.js/atlas'\n\nconst atlas = new Atlas({\n  root: __dirname,\n  config: {\n    actions: {\n      migration: {\n        // The path to the module from which all the migrations should be\n        // loaded, relative to atlas.root\n        module: 'migrations'\n      }\n    }\n  }\n})\n\natlas.action('migration', sequelize.MigrationAction, {\n  aliases: {\n    'service:sequelize': 'database'\n  }\n})\nawait atlas.start()\n\n// Available actions:\nawait atlas.actions.migration.up() // Applies all pending migrations\nawait atlas.actions.migration.down() // Rolls back last applied migration\nawait atlas.actions.migration.pending() // Returns names of pending migrations\n```\n\n#### Running migrations on start\n\nMigrations are not applied automatically on application start. You will need to implement your own hook which implements the `beforeStart` event handler and run the `up()` method from there.\n\nA simple hook doing just that:\n\n```js\nimport Hook from '@atlas.js/hook'\n\nexport default MigrateHook extends Hook {\n  async beforeStart() {\n    await this.atlas.actions.migrate.up()\n  }\n}\n```\n\n## License\n\nSee the [LICENSE](LICENSE) file for information.\n\n[sequelize-db-drivers]: http://docs.sequelizejs.com/manual/installation/getting-started.html#installation\n[sequelize-constructor]: http://docs.sequelizejs.com/class/lib/sequelize.js~Sequelize.html#instance-constructor-constructor\n","readmeFilename":"README.md","_id":"@atlas.js/sequelize@2.1.0-alpha.4","_npmVersion":"6.4.1","_nodeVersion":"11.3.0","_npmUser":{"name":"robertrossmann","email":"robert.rossmann@strv.com"},"dist":{"integrity":"sha512-MyCVywFFjhglyfypFn9x7zfw6fKVtlyPPC5UCmf8I6tP5MMVC7dw0BQbwwms986v2uh4Yql2nsZMfW0d1o+FUg==","shasum":"e7651dd9379c63593a6700636982ba75dcab9064","tarball":"https://registry.npmjs.org/@atlas.js/sequelize/-/sequelize-2.1.0-alpha.4.tgz","fileCount":43,"unpackedSize":120428,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcEqVTCRA9TVsSAnZWagAAbz8QAIIoyxgCnRPt+/J3/Zoy\n0kRGFoguu/2IbOxGz+o6WhIX6UN0FD9jFc0/N2eQ85EsCNkrCQftUdtrj/OL\nm3vRDFodJaWqK1AdA3AMXsuRMirDfVSnNoY3Rvu3QmG1ulEz8hK7eceCXgsw\nR1l+Kd+Y8Ntd1XqEGA/d3aMfN/Paq1zdVwhzqTAVM50UgZpGVwHvJ3E6cYBm\nXene3Z7ClZW53TADuWXyFZC5HA9NjS95HPdK2OgoDo6f7hrgKzgfbf6RfC0R\nFk7sYd6n6IBllG5I4c7jKluLxPEgChc2pyv1d0ehOnSUK1cy+dum1e0mK/kB\n08tQty+JbYESx+Udo0sz4esCzYbyI9+QdyH/TfuvllP0fqu6mGtttAViMIxV\ndRRAJ8FVzJD/gRxr4ybMP70dQZuGVnl+Z4wVpYYyiCoTC6LrLedXyVW4K2rO\nukN2X5vi7wUV3EA4JMivcA6F6QgJcLO+Wmy+snQTCxqMVJchFB5pIHAIm+TN\na67AhHRonZUpEJVr9t+l0nPELAgAGanTMMky39AEy/8SF9rlkFHw4+bWcJ/K\nVnoejIFMO52pFWV2fckLowjaMK1opBuFNkubWjQkqiqR76lYHqmkXEzRtU2p\nPhfKb+TltU6k9KV9ow13yBMTHuqZdn7h3KdN5/WQL1jwJrd6ITMGXJH1y6fN\nKmzH\r\n=mhqG\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCxlqqJ87KFNPQQiK5oYffZtcY9rb7NCzgB6q5baKSeIgIhAPzGKOq+GfRK9HRgWHcdj22VgmhQm6Ws0TUr7dalAFxb"}]},"maintainers":[{"email":"robert.rossmann@strv.com","name":"robertrossmann"},{"email":"licenses@strv.com","name":"strvuser"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sequelize_2.1.0-alpha.4_1544725843144_0.051718440975191404"},"_hasShrinkwrap":false},"2.1.0-alpha.5":{"name":"@atlas.js/sequelize","description":"Sequelize service for @atlas.js","version":"2.1.0-alpha.5","author":{"name":"Robert Rossmann","email":"robert.rossmann@strv.com"},"bugs":{"url":"https://github.com/strvcom/atlas.js/issues"},"contributors":[],"dependencies":{"@atlas.js/action":"^1.2.0-alpha.0","@atlas.js/errors":"^0.3.0-alpha.0","@atlas.js/hook":"^2.1.0-alpha.0","@atlas.js/service":"^1.2.0-alpha.0","@types/sequelize":"^4.27.32","sequelize":"^4.37.6","umzug":"^2.0.0"},"devDependencies":{"@atlas.js/atlas":"^2.2.0-alpha.4","sqlite3":"^4.0.0"},"engines":{"node":">=8.3.0","npm":"^5.3.0"},"homepage":"https://github.com/strvcom/atlas.js/tree/master/packages/sequelize","keywords":[],"license":"BSD-3-Clause","main":"src","publishConfig":{"access":"public"},"repository":{"type":"git","url":"git://github.com/strvcom/atlas.js.git"},"gitHead":"5a7ec5098e521b7d14d2ecdf584d1bef188c9bbf","_resolved":"","_integrity":"","_from":"file:atlas.js-sequelize-2.1.0-alpha.5.tgz","readme":"# @atlas.js/sequelize\n\nSequelize service for @atlas.js.\n\n## Installation\n\n`npm i @atlas.js/sequelize`\n\nYou will also need to install one of the [supported database drivers][sequelize-db-drivers] on your own.\n\n## Usage\n\n### Service\n\nThe service configuration only accepts two properties: `uri` and `options` which are passed directly to the [`new Sequelize(uri, options)`][sequelize-constructor] constructor.\n\n```js\nimport * as sequelize from '@atlas.js/sequelize'\nimport { Atlas } from '@atlas.js/atlas'\n\nconst atlas = new Atlas({\n  config: {\n    services: {\n      database: {\n        uri: 'postgres://postgres:postgres@127.0.0.1:27017/my-db',\n        options: {\n          pool: {\n            max: 5,\n            min: 2,\n          }\n        },\n      }\n    }\n  }\n})\n\natlas.service('database', sequelize.Service)\nawait atlas.start()\n\n// You have your sequelize client available here:\natlas.services.database\n```\n\nNote that by default, the service does not load your models which means you will either have to load them up yourself or use the `ModelsHook` documented below.\n\n### ModelsHook\n\nThis hook allows you to import your Sequelize models from a particular module location into the sequelize service.\n\n#### ModelsHook Dependencies\n\n- `service:sequelize`: A sequelize service to load the models into\n\n```js\n// models/user.js\n\n// You can import the necessary classes and definitions directly from the\n// @atlas.js/sequelize module instead of loading the whole sequelize lib\nimport { Model, DataTypes } from '@atlas.js/sequelize'\n\nclass User extends Model {\n  // Here you can describe your model's fields (columns/attributes)\n  // This goes directly to Model.init() as first argument\n  static fields = {\n    name: {\n      type: DataTypes.STRING,\n      allowNull: false,\n    },\n\n    someDate: {\n      type: DataTypes.DATE,\n      allowNull: true,\n    },\n  }\n\n  // Here you can specify your model's config (options)\n  // This goes directly to Model.init() as second argument\n  static config = {\n    paranoid: true,\n    timestamps: true,\n  }\n\n  static staticMethod() {\n    // You can access the Atlas instance as a property on the\n    // Model class:\n    // this refers to the model class itself\n    this.atlas\n  }\n\n  async instanceMethod() {\n    // On instance methods, you can also access the Atlas instance\n    // directly on the model's instance\n    // this refers to the model class' instance\n    this.atlas\n  }\n}\n\nexport default User\n\n\n// models/index.js\nimport User from './user'\n// Do not use `export default` - instead export each model as a named export\n// Alternatively, just assign each model to `module.exports` object.\nexport {\n  User\n}\n// or\nmodule.exports = {\n  User,\n}\n\n// index.js\nimport * as sequelize from '@atlas.js/sequelize'\nimport { Atlas } from '@atlas.js/atlas'\n\nconst atlas = new Atlas({\n  root: __dirname,\n  config: {\n    hooks: {\n      models: {\n        // The path to the module from which all the database models should be\n        // loaded, relative to atlas.root\n        module: 'models'\n      }\n    }\n  }\n})\n\natlas.service('database', sequelize.Service)\natlas.hook('models', sequelize.ModelsHook, {\n  aliases: {\n    'service:sequelize': 'database',\n  }\n})\nawait atlas.start()\n\n// Now your models from the models/index.js module are loaded up!\nconst User = atlas.services.database.model('User')\n// or\nconst User = atlas.services.database.models.User\n```\n\n### RelationsHook\n\nThis hook allows you to describe your model's associations (relations) directly on the model definition, making the model's definition even more descriptive.\n\n#### Dependencies\n\n- `service:sequelize`: A sequelize service with all the models already loaded up\n\n```js\nclass User extends Model {\n  // Here you can define your model's relations (associations) to other models\n  // in your app\n  static relations = {\n    // This will set up a \"has many\" relation from this model to the models\n    // defined in the object\n    hasMany: {\n      // Let's say you have a Purchase model defined in your app - this will cause the following relation to be set up for you:\n      // User.hasMany(Purchase, { as: 'purchase' })\n      Purchase: {\n        as: 'purchase',\n      },\n      // The key must match an existing model name\n      Company: {}\n    },\n    belongsTo: {},\n    hasOne: {},\n  }\n}\n```\n\n### Why fields, relations, config...?\n\n> Why not attributes, associations and options?\n\nBecause all those properties already exist on a standard sequelize Model object, and adding them in your own model definition would overwrite them, causing all kinds of issues. Therefore new names had to be chosen.\n\n### MigrationAction\n\nThis action contains methods for applying and rolling back your sequelize migrations. The migration files are written exactly like standard Sequelize migrations. In addition to using plain JavaScript migration files, you may also organise your migrations into a folder with an _index.js_ file inside, if the migration requires more data or you simply wish to organise the migration in a different way than a single script.\n\n#### MigrationAction Dependencies\n\n- `service:sequelize`: A sequelize service to use with which to apply/undo the migrations\n\n```js\n// index.js\nimport * as sequelize from '@atlas.js/sequelize'\nimport { Atlas } from '@atlas.js/atlas'\n\nconst atlas = new Atlas({\n  root: __dirname,\n  config: {\n    actions: {\n      migration: {\n        // The path to the module from which all the migrations should be\n        // loaded, relative to atlas.root\n        module: 'migrations'\n      }\n    }\n  }\n})\n\natlas.action('migration', sequelize.MigrationAction, {\n  aliases: {\n    'service:sequelize': 'database'\n  }\n})\nawait atlas.start()\n\n// Available actions:\nawait atlas.actions.migration.up() // Applies all pending migrations\nawait atlas.actions.migration.down() // Rolls back last applied migration\nawait atlas.actions.migration.pending() // Returns names of pending migrations\n```\n\n#### Running migrations on start\n\nMigrations are not applied automatically on application start. You will need to implement your own hook which implements the `beforeStart` event handler and run the `up()` method from there.\n\nA simple hook doing just that:\n\n```js\nimport Hook from '@atlas.js/hook'\n\nexport default MigrateHook extends Hook {\n  async beforeStart() {\n    await this.atlas.actions.migrate.up()\n  }\n}\n```\n\n## License\n\nSee the [LICENSE](LICENSE) file for information.\n\n[sequelize-db-drivers]: http://docs.sequelizejs.com/manual/installation/getting-started.html#installation\n[sequelize-constructor]: http://docs.sequelizejs.com/class/lib/sequelize.js~Sequelize.html#instance-constructor-constructor\n","readmeFilename":"README.md","_id":"@atlas.js/sequelize@2.1.0-alpha.5","_npmVersion":"6.4.1","_nodeVersion":"11.3.0","_npmUser":{"name":"robertrossmann","email":"robert.rossmann@strv.com"},"dist":{"integrity":"sha512-knv240nd1aSO5nuFpRZJ1kR27I4Ffbe6X6CJ0zF6FrEdJR4av0km6eTOFFIWbj+dqattw+qeSic5tp8NV4n45g==","shasum":"51a858cd0ed2e8102260a9573d2ba5da6b5352c3","tarball":"https://registry.npmjs.org/@atlas.js/sequelize/-/sequelize-2.1.0-alpha.5.tgz","fileCount":43,"unpackedSize":120428,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcGNcqCRA9TVsSAnZWagAA/jYP/RUgY+s/uES0HwcqY4EL\nqlgHIiRvzuhVYjmlIGX2o+EdlYEjpMrcCDJXhr8O2NKAP+rfPDuzC69E43yi\nU7xhhnBqPkjTTS0EEo01CmV0idkaXfGZFbURo1FCBHPWVJS4FQeLNWV/sQut\n81tk92FWaz/JR6hzLA9GxEZ+Hac+gJEmesaSuaQW6ywEVDXPx/ARADliz4te\nJqIzeCypjoSCZSxYUeF/sjmIEJG6mYCfmBbYDDozjdsrl3emJ4nvdgrWWQsg\nuEgGjZ1xj0t+jWIJZr7jD5mFivgJXB/nize4JjCGvelYDUxeolBgZ4cVR1pk\nmjMDGyPcT+msybYTAUAWdgxweKdqS2z53bCwt4qctl97mYmqA7BvaQx0VRTo\nDQ6kJC70pRA5uktmdh0pi6Af6695xYDsxXxhZz/5K9wOnBLBCoJyUqG6T+fC\nq1oC0djOJAIEBqKiiVYGmgr3qBVFVNstnfo9KUfDHfD5OIjtsUkFsT84vhs7\nD1fYwTOjloZGzAqWrerbqqpqF2fBpQuETmxCLwe1cnwRM8xMBq09cCjYF7rX\n/UpbgOQ1aTgAvW2m1L9bISKTgq3o5aqExQH13PLHMGAnTp1BB76DvnABoM+F\n7f3kvU/tnXCmOqxJ4IPe9ka1iFCSW1KBIUN7NmwOq7QYetUW0mzec6KMkJ4z\n+y8Z\r\n=sVQu\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBYKODp2A5ax2mg1ulpGvFxAawzLvo4qbxDm8wtBvKwEAiEAoQlc4Gyei6seUiCj5/gon5sMtvJsl7rWJLGrSPkDGlY="}]},"maintainers":[{"email":"robert.rossmann@strv.com","name":"robertrossmann"},{"email":"licenses@strv.com","name":"strvuser"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sequelize_2.1.0-alpha.5_1545131818360_0.40018260884977686"},"_hasShrinkwrap":false},"2.1.0-alpha.6":{"name":"@atlas.js/sequelize","description":"Sequelize service for @atlas.js","version":"2.1.0-alpha.6","author":{"name":"Robert Rossmann","email":"robert.rossmann@strv.com"},"bugs":{"url":"https://github.com/strvcom/atlas.js/issues"},"contributors":[],"dependencies":{"@atlas.js/action":"^1.2.0-alpha.0","@atlas.js/errors":"^0.3.0-alpha.0","@atlas.js/hook":"^2.1.0-alpha.0","@atlas.js/service":"^1.2.0-alpha.0","@types/sequelize":"^4.27.32","sequelize":"^4.37.6","umzug":"^2.0.0"},"devDependencies":{"@atlas.js/atlas":"^2.2.0-alpha.5","sqlite3":"^4.0.0"},"engines":{"node":">=8.3.0","npm":"^5.3.0"},"homepage":"https://github.com/strvcom/atlas.js/tree/master/packages/sequelize","keywords":[],"license":"BSD-3-Clause","main":"src","publishConfig":{"access":"public"},"repository":{"type":"git","url":"git://github.com/strvcom/atlas.js.git"},"gitHead":"8b27d87a507b5ce31392fc7c02b4b3f22b14a163","readme":"# @atlas.js/sequelize\n\nSequelize service for @atlas.js.\n\n## Installation\n\n`npm i @atlas.js/sequelize`\n\nYou will also need to install one of the [supported database drivers][sequelize-db-drivers] on your own.\n\n## Usage\n\n### Service\n\nThe service configuration only accepts two properties: `uri` and `options` which are passed directly to the [`new Sequelize(uri, options)`][sequelize-constructor] constructor.\n\n```js\nimport * as sequelize from '@atlas.js/sequelize'\nimport { Atlas } from '@atlas.js/atlas'\n\nconst atlas = new Atlas({\n  config: {\n    services: {\n      database: {\n        uri: 'postgres://postgres:postgres@127.0.0.1:27017/my-db',\n        options: {\n          pool: {\n            max: 5,\n            min: 2,\n          }\n        },\n      }\n    }\n  }\n})\n\natlas.service('database', sequelize.Service)\nawait atlas.start()\n\n// You have your sequelize client available here:\natlas.services.database\n```\n\nNote that by default, the service does not load your models which means you will either have to load them up yourself or use the `ModelsHook` documented below.\n\n### ModelsHook\n\nThis hook allows you to import your Sequelize models from a particular module location into the sequelize service.\n\n#### ModelsHook Dependencies\n\n- `service:sequelize`: A sequelize service to load the models into\n\n```js\n// models/user.js\n\n// You can import the necessary classes and definitions directly from the\n// @atlas.js/sequelize module instead of loading the whole sequelize lib\nimport { Model, DataTypes } from '@atlas.js/sequelize'\n\nclass User extends Model {\n  // Here you can describe your model's fields (columns/attributes)\n  // This goes directly to Model.init() as first argument\n  static fields = {\n    name: {\n      type: DataTypes.STRING,\n      allowNull: false,\n    },\n\n    someDate: {\n      type: DataTypes.DATE,\n      allowNull: true,\n    },\n  }\n\n  // Here you can specify your model's config (options)\n  // This goes directly to Model.init() as second argument\n  static config = {\n    paranoid: true,\n    timestamps: true,\n  }\n\n  static staticMethod() {\n    // You can access the Atlas instance as a property on the\n    // Model class:\n    // this refers to the model class itself\n    this.atlas\n  }\n\n  async instanceMethod() {\n    // On instance methods, you can also access the Atlas instance\n    // directly on the model's instance\n    // this refers to the model class' instance\n    this.atlas\n  }\n}\n\nexport default User\n\n\n// models/index.js\nimport User from './user'\n// Do not use `export default` - instead export each model as a named export\n// Alternatively, just assign each model to `module.exports` object.\nexport {\n  User\n}\n// or\nmodule.exports = {\n  User,\n}\n\n// index.js\nimport * as sequelize from '@atlas.js/sequelize'\nimport { Atlas } from '@atlas.js/atlas'\n\nconst atlas = new Atlas({\n  root: __dirname,\n  config: {\n    hooks: {\n      models: {\n        // The path to the module from which all the database models should be\n        // loaded, relative to atlas.root\n        module: 'models'\n      }\n    }\n  }\n})\n\natlas.service('database', sequelize.Service)\natlas.hook('models', sequelize.ModelsHook, {\n  aliases: {\n    'service:sequelize': 'database',\n  }\n})\nawait atlas.start()\n\n// Now your models from the models/index.js module are loaded up!\nconst User = atlas.services.database.model('User')\n// or\nconst User = atlas.services.database.models.User\n```\n\n### RelationsHook\n\nThis hook allows you to describe your model's associations (relations) directly on the model definition, making the model's definition even more descriptive.\n\n#### Dependencies\n\n- `service:sequelize`: A sequelize service with all the models already loaded up\n\n```js\nclass User extends Model {\n  // Here you can define your model's relations (associations) to other models\n  // in your app\n  static relations = {\n    // This will set up a \"has many\" relation from this model to the models\n    // defined in the object\n    hasMany: {\n      // Let's say you have a Purchase model defined in your app - this will cause the following relation to be set up for you:\n      // User.hasMany(Purchase, { as: 'purchase' })\n      Purchase: {\n        as: 'purchase',\n      },\n      // The key must match an existing model name\n      Company: {}\n    },\n    belongsTo: {},\n    hasOne: {},\n  }\n}\n```\n\n### Why fields, relations, config...?\n\n> Why not attributes, associations and options?\n\nBecause all those properties already exist on a standard sequelize Model object, and adding them in your own model definition would overwrite them, causing all kinds of issues. Therefore new names had to be chosen.\n\n### MigrationAction\n\nThis action contains methods for applying and rolling back your sequelize migrations. The migration files are written exactly like standard Sequelize migrations. In addition to using plain JavaScript migration files, you may also organise your migrations into a folder with an _index.js_ file inside, if the migration requires more data or you simply wish to organise the migration in a different way than a single script.\n\n#### MigrationAction Dependencies\n\n- `service:sequelize`: A sequelize service to use with which to apply/undo the migrations\n\n```js\n// index.js\nimport * as sequelize from '@atlas.js/sequelize'\nimport { Atlas } from '@atlas.js/atlas'\n\nconst atlas = new Atlas({\n  root: __dirname,\n  config: {\n    actions: {\n      migration: {\n        // The path to the module from which all the migrations should be\n        // loaded, relative to atlas.root\n        module: 'migrations'\n      }\n    }\n  }\n})\n\natlas.action('migration', sequelize.MigrationAction, {\n  aliases: {\n    'service:sequelize': 'database'\n  }\n})\nawait atlas.start()\n\n// Available actions:\nawait atlas.actions.migration.up() // Applies all pending migrations\nawait atlas.actions.migration.down() // Rolls back last applied migration\nawait atlas.actions.migration.pending() // Returns names of pending migrations\n```\n\n#### Running migrations on start\n\nMigrations are not applied automatically on application start. You will need to implement your own hook which implements the `beforeStart` event handler and run the `up()` method from there.\n\nA simple hook doing just that:\n\n```js\nimport Hook from '@atlas.js/hook'\n\nexport default MigrateHook extends Hook {\n  async beforeStart() {\n    await this.atlas.actions.migrate.up()\n  }\n}\n```\n\n## License\n\nSee the [LICENSE](LICENSE) file for information.\n\n[sequelize-db-drivers]: http://docs.sequelizejs.com/manual/installation/getting-started.html#installation\n[sequelize-constructor]: http://docs.sequelizejs.com/class/lib/sequelize.js~Sequelize.html#instance-constructor-constructor\n","readmeFilename":"README.md","_id":"@atlas.js/sequelize@2.1.0-alpha.6","_nodeVersion":"10.15.0","_npmVersion":"lerna/3.10.5/node@v10.15.0+x64 (linux)","dist":{"integrity":"sha512-xXliNDCSQ43FKc0Vbl3YfRZrOJ1DhtV+e5/6uibUKrnDk1eK5ILvbsgO6tk9rB+DbQsSEUOLEhs0/F6B9IWJIg==","shasum":"efcf9e14d39e2c016df604a0455b68eb13114233","tarball":"https://registry.npmjs.org/@atlas.js/sequelize/-/sequelize-2.1.0-alpha.6.tgz","fileCount":43,"unpackedSize":120640,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcPvQoCRA9TVsSAnZWagAAv+0P/jfoOFqnG0BBP4NE/NCP\n7b/HfA+5HFSqMSGxa5f0BtKiEDako2PlvvuBMILYvey2Gtbk7vh0cTYeTaXS\nFZqb3s1ki4mVsvvoJlrKGQCaAd4eqLuuZR9hW21cpTzA/k3vXCC55eJeVEq8\nOKdzO0vOBUBGKqLjDNqf9/CYWMvdKiXENtAkFnTyHUO+gdWKBQIa8PnR7mog\nvBfjqPUn8BWnjCYSZuqGMesgGg6UzabN8yO/wmzuzO4GA9l3cBCKzOc3oyuC\nfCtAYEyeksL9mYInwg3XhVhEuvCoSYDLTC0/i8E3bmE6CipRlzb73TTS9Gm6\nGIdhrvoxtwpIRoySBo3uF7aI6QZ28vYf7g2hcmn7Nb1he2jQg8sUtyoWBWRH\n4LK2UtRib725PVoDE27qgly0FEHBowRGAV49sWcQyN2/FIgVJlJhj/vL/Ny2\nk+xEzAbnlb4duoWP1q8dnxxqzg6uHiGubCM0cGqYy4j3HMd2V120kmohmZ/q\nNPhBuTc0AieBF5j9cK7SO96YPhhQ+suUz59FYXQZIl6J/29v6BnTPeYQDBMX\nZ9zmVp8YlJ4BlU1Z0/mRNH4lOqjc2ZR6KjbVmZTwbwY6RGS5u6ud9avylE5s\n6EuoqC8ly3bizr+PLg3GFnCdZx5hoMcY0WhMGVcFkGpcF7sv9RqwZHyj3uTd\nHtq8\r\n=VJfX\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCFEXI4PCj8ZZFg6tZYjGUsH5djRe6N6+aN5cwL0uF8rAIhAP3IvS2/8LlWFoK1xTtZFVPFt08+GDKG1Fqa+aM24FmD"}]},"maintainers":[{"email":"robert.rossmann@strv.com","name":"robertrossmann"},{"email":"licenses@strv.com","name":"strvuser"}],"_npmUser":{"name":"robertrossmann","email":"robert.rossmann@strv.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sequelize_2.1.0-alpha.6_1547629607877_0.08441979973885338"},"_hasShrinkwrap":false},"2.1.0-alpha.7":{"name":"@atlas.js/sequelize","description":"Sequelize service for @atlas.js","version":"2.1.0-alpha.7","author":{"name":"Robert Rossmann","email":"robert.rossmann@strv.com"},"bugs":{"url":"https://github.com/strvcom/atlas.js/issues"},"contributors":[],"dependencies":{"@atlas.js/action":"^1.2.0-alpha.1","@atlas.js/errors":"^0.3.0-alpha.1","@atlas.js/hook":"^2.1.0-alpha.1","@atlas.js/service":"^1.2.0-alpha.1","@types/sequelize":"^4.27.32","sequelize":"^4.37.6","umzug":"^2.0.0"},"devDependencies":{"@atlas.js/atlas":"^2.2.0-alpha.6","sqlite3":"^4.0.0"},"engines":{"node":">=8.3.0","npm":"^5.3.0"},"homepage":"https://github.com/strvcom/atlas.js/tree/master/packages/sequelize","keywords":[],"license":"BSD-3-Clause","main":"src","publishConfig":{"access":"public"},"repository":{"type":"git","url":"git://github.com/strvcom/atlas.js.git"},"gitHead":"39c0427aa76e1003d5f4acf19cee927925ca0ad3","readme":"# @atlas.js/sequelize\n\nSequelize service for @atlas.js.\n\n## Installation\n\n`npm i @atlas.js/sequelize`\n\nYou will also need to install one of the [supported database drivers][sequelize-db-drivers] on your own.\n\n## Usage\n\n### Service\n\nThe service configuration only accepts two properties: `uri` and `options` which are passed directly to the [`new Sequelize(uri, options)`][sequelize-constructor] constructor.\n\n```js\nimport * as sequelize from '@atlas.js/sequelize'\nimport { Atlas } from '@atlas.js/atlas'\n\nconst atlas = new Atlas({\n  config: {\n    services: {\n      database: {\n        uri: 'postgres://postgres:postgres@127.0.0.1:27017/my-db',\n        options: {\n          pool: {\n            max: 5,\n            min: 2,\n          }\n        },\n      }\n    }\n  }\n})\n\natlas.service('database', sequelize.Service)\nawait atlas.start()\n\n// You have your sequelize client available here:\natlas.services.database\n```\n\nNote that by default, the service does not load your models which means you will either have to load them up yourself or use the `ModelsHook` documented below.\n\n### ModelsHook\n\nThis hook allows you to import your Sequelize models from a particular module location into the sequelize service.\n\n#### ModelsHook Dependencies\n\n- `service:sequelize`: A sequelize service to load the models into\n\n```js\n// models/user.js\n\n// You can import the necessary classes and definitions directly from the\n// @atlas.js/sequelize module instead of loading the whole sequelize lib\nimport { Model, DataTypes } from '@atlas.js/sequelize'\n\nclass User extends Model {\n  // Here you can describe your model's fields (columns/attributes)\n  // This goes directly to Model.init() as first argument\n  static fields = {\n    name: {\n      type: DataTypes.STRING,\n      allowNull: false,\n    },\n\n    someDate: {\n      type: DataTypes.DATE,\n      allowNull: true,\n    },\n  }\n\n  // Here you can specify your model's config (options)\n  // This goes directly to Model.init() as second argument\n  static config = {\n    paranoid: true,\n    timestamps: true,\n  }\n\n  static staticMethod() {\n    // You can access the Atlas instance as a property on the\n    // Model class:\n    // this refers to the model class itself\n    this.atlas\n  }\n\n  async instanceMethod() {\n    // On instance methods, you can also access the Atlas instance\n    // directly on the model's instance\n    // this refers to the model class' instance\n    this.atlas\n  }\n}\n\nexport default User\n\n\n// models/index.js\nimport User from './user'\n// Do not use `export default` - instead export each model as a named export\n// Alternatively, just assign each model to `module.exports` object.\nexport {\n  User\n}\n// or\nmodule.exports = {\n  User,\n}\n\n// index.js\nimport * as sequelize from '@atlas.js/sequelize'\nimport { Atlas } from '@atlas.js/atlas'\n\nconst atlas = new Atlas({\n  root: __dirname,\n  config: {\n    hooks: {\n      models: {\n        // The path to the module from which all the database models should be\n        // loaded, relative to atlas.root\n        module: 'models'\n      }\n    }\n  }\n})\n\natlas.service('database', sequelize.Service)\natlas.hook('models', sequelize.ModelsHook, {\n  aliases: {\n    'service:sequelize': 'database',\n  }\n})\nawait atlas.start()\n\n// Now your models from the models/index.js module are loaded up!\nconst User = atlas.services.database.model('User')\n// or\nconst User = atlas.services.database.models.User\n```\n\n### RelationsHook\n\nThis hook allows you to describe your model's associations (relations) directly on the model definition, making the model's definition even more descriptive.\n\n#### Dependencies\n\n- `service:sequelize`: A sequelize service with all the models already loaded up\n\n```js\nclass User extends Model {\n  // Here you can define your model's relations (associations) to other models\n  // in your app\n  static relations = {\n    // This will set up a \"has many\" relation from this model to the models\n    // defined in the object\n    hasMany: {\n      // Let's say you have a Purchase model defined in your app - this will cause the following relation to be set up for you:\n      // User.hasMany(Purchase, { as: 'purchase' })\n      Purchase: {\n        as: 'purchase',\n      },\n      // The key must match an existing model name\n      Company: {}\n    },\n    belongsTo: {},\n    hasOne: {},\n  }\n}\n```\n\n### Why fields, relations, config...?\n\n> Why not attributes, associations and options?\n\nBecause all those properties already exist on a standard sequelize Model object, and adding them in your own model definition would overwrite them, causing all kinds of issues. Therefore new names had to be chosen.\n\n### MigrationAction\n\nThis action contains methods for applying and rolling back your sequelize migrations. The migration files are written exactly like standard Sequelize migrations. In addition to using plain JavaScript migration files, you may also organise your migrations into a folder with an _index.js_ file inside, if the migration requires more data or you simply wish to organise the migration in a different way than a single script.\n\n#### MigrationAction Dependencies\n\n- `service:sequelize`: A sequelize service to use with which to apply/undo the migrations\n\n```js\n// index.js\nimport * as sequelize from '@atlas.js/sequelize'\nimport { Atlas } from '@atlas.js/atlas'\n\nconst atlas = new Atlas({\n  root: __dirname,\n  config: {\n    actions: {\n      migration: {\n        // The path to the module from which all the migrations should be\n        // loaded, relative to atlas.root\n        module: 'migrations'\n      }\n    }\n  }\n})\n\natlas.action('migration', sequelize.MigrationAction, {\n  aliases: {\n    'service:sequelize': 'database'\n  }\n})\nawait atlas.start()\n\n// Available actions:\nawait atlas.actions.migration.up() // Applies all pending migrations\nawait atlas.actions.migration.down() // Rolls back last applied migration\nawait atlas.actions.migration.pending() // Returns names of pending migrations\n```\n\n#### Running migrations on start\n\nMigrations are not applied automatically on application start. You will need to implement your own hook which implements the `beforeStart` event handler and run the `up()` method from there.\n\nA simple hook doing just that:\n\n```js\nimport Hook from '@atlas.js/hook'\n\nexport default MigrateHook extends Hook {\n  async beforeStart() {\n    await this.atlas.actions.migrate.up()\n  }\n}\n```\n\n## License\n\nSee the [LICENSE](LICENSE) file for information.\n\n[sequelize-db-drivers]: http://docs.sequelizejs.com/manual/installation/getting-started.html#installation\n[sequelize-constructor]: http://docs.sequelizejs.com/class/lib/sequelize.js~Sequelize.html#instance-constructor-constructor\n","readmeFilename":"README.md","_id":"@atlas.js/sequelize@2.1.0-alpha.7","_nodeVersion":"10.15.0","_npmVersion":"lerna/3.10.5/node@v10.15.0+x64 (linux)","dist":{"integrity":"sha512-wzAvnex4lDHsZM2bAYV2uD0bFg9E+K1bwrwFcFEYHdUIatIp8vZ6/ICajN1HaL8KKDUFG471PjEFmVgnkl5zFQ==","shasum":"a49507c767709bc4410e87e1fb55708777b09089","tarball":"https://registry.npmjs.org/@atlas.js/sequelize/-/sequelize-2.1.0-alpha.7.tgz","fileCount":43,"unpackedSize":120929,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcTt7TCRA9TVsSAnZWagAAGk4P/2lja5iKGrKWi1hdViUJ\nZmvTofUe5cenYVOJ4YZWgeShZW9+QpfsNOiZDfrT+k0s0XfwMYVr0mC5bA8n\nMB1dpbpvzmaPvzfaqwI0KvoWjoZz370rIy6GH/OecrFMSj427DCEtwOkcQ5+\nd45HWMXN61/0tLiOACn3CXwtR8QhRq9lN/ppFU+6IdehmtiZK07bg8lpL+GJ\n15mpodwnn5NjKfocnKBXHn+ksP3iAnJj4dapNFsn3mHdRF23BDbVm+6gLJ1R\nS+RRo+nypDznqTcNsZuCICMmxc9IBLNVIcww1txapU7nnv3kYGT9xqUxMceV\nUlXhHDduD+Fd0gC2LxzH++XCLpeBMWKz+YaiwmmSMXzAYHXeLkUIy+BH1j8t\nXG+zd2qTWdgDlrT6Oa7D8Hhzxc6SxoxC11/4eaPyGNmIvLF+0glrU/9nmIhv\ngGlmgWA5MHtgQm7fBh/JVRh2Ma6mtvV1ei2GImefu5I8kiEDPEatXkrzfuQT\n2VJEXjstM/o+H5MNNaYiazavRw9a7CQN3shGJ0FsyliimzwwlqLe/4FcN9ox\n2AiSKrRHwzHBS9fyt3lAbABw51gQz8Sbo8AASHUK2DB6pSj9iJw1iKiV4Ku4\nKe8QeLrj2lnxyLmYdw82TuQ90XEd3LfvGhQ0lelMLCMoWD8ifLI1NdAaGUoh\nTlkW\r\n=CrgY\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGyqn858wsTC3tbFXiCzwxLQ0AJaft0Oy4gJsRr7ApruAiB0t4v0Udme+I/qtfKlA6k7MCC2KIHfaNGbaJUhMl/GcQ=="}]},"maintainers":[{"email":"robert.rossmann@strv.com","name":"robertrossmann"},{"email":"licenses@strv.com","name":"strvuser"}],"_npmUser":{"name":"robertrossmann","email":"robert.rossmann@strv.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sequelize_2.1.0-alpha.7_1548672723218_0.29691702838861245"},"_hasShrinkwrap":false},"2.1.0-alpha.8":{"name":"@atlas.js/sequelize","description":"Sequelize service for @atlas.js","version":"2.1.0-alpha.8","author":{"name":"Robert Rossmann","email":"robert.rossmann@strv.com"},"bugs":{"url":"https://github.com/strvcom/atlas.js/issues"},"contributors":[],"dependencies":{"@atlas.js/action":"^1.2.0-alpha.1","@atlas.js/errors":"^0.3.0-alpha.1","@atlas.js/hook":"^2.1.0-alpha.1","@atlas.js/service":"^1.2.0-alpha.1","@types/sequelize":"^4.27.32","sequelize":"^4.37.6","umzug":"^2.0.0"},"devDependencies":{"@atlas.js/atlas":"^2.2.0-alpha.7","sqlite3":"^4.0.0"},"engines":{"node":">=8.3.0","npm":"^5.3.0"},"homepage":"https://github.com/strvcom/atlas.js/tree/master/packages/sequelize","keywords":[],"license":"BSD-3-Clause","main":"src","publishConfig":{"access":"public"},"repository":{"type":"git","url":"git://github.com/strvcom/atlas.js.git"},"gitHead":"20fa27bf205f83baaae14c5ef99c6ff8e007b214","readme":"# @atlas.js/sequelize\n\nSequelize service for @atlas.js.\n\n## Installation\n\n`npm i @atlas.js/sequelize`\n\nYou will also need to install one of the [supported database drivers][sequelize-db-drivers] on your own.\n\n## Usage\n\n### Service\n\nThe service configuration only accepts two properties: `uri` and `options` which are passed directly to the [`new Sequelize(uri, options)`][sequelize-constructor] constructor.\n\n```js\nimport * as sequelize from '@atlas.js/sequelize'\nimport { Atlas } from '@atlas.js/atlas'\n\nconst atlas = new Atlas({\n  config: {\n    services: {\n      database: {\n        uri: 'postgres://postgres:postgres@127.0.0.1:27017/my-db',\n        options: {\n          pool: {\n            max: 5,\n            min: 2,\n          }\n        },\n      }\n    }\n  }\n})\n\natlas.service('database', sequelize.Service)\nawait atlas.start()\n\n// You have your sequelize client available here:\natlas.services.database\n```\n\nNote that by default, the service does not load your models which means you will either have to load them up yourself or use the `ModelsHook` documented below.\n\n### ModelsHook\n\nThis hook allows you to import your Sequelize models from a particular module location into the sequelize service.\n\n#### ModelsHook Dependencies\n\n- `service:sequelize`: A sequelize service to load the models into\n\n```js\n// models/user.js\n\n// You can import the necessary classes and definitions directly from the\n// @atlas.js/sequelize module instead of loading the whole sequelize lib\nimport { Model, DataTypes } from '@atlas.js/sequelize'\n\nclass User extends Model {\n  // Here you can describe your model's fields (columns/attributes)\n  // This goes directly to Model.init() as first argument\n  static fields = {\n    name: {\n      type: DataTypes.STRING,\n      allowNull: false,\n    },\n\n    someDate: {\n      type: DataTypes.DATE,\n      allowNull: true,\n    },\n  }\n\n  // Here you can specify your model's config (options)\n  // This goes directly to Model.init() as second argument\n  static config = {\n    paranoid: true,\n    timestamps: true,\n  }\n\n  static staticMethod() {\n    // You can access the Atlas instance as a property on the\n    // Model class:\n    // this refers to the model class itself\n    this.atlas\n  }\n\n  async instanceMethod() {\n    // On instance methods, you can also access the Atlas instance\n    // directly on the model's instance\n    // this refers to the model class' instance\n    this.atlas\n  }\n}\n\nexport default User\n\n\n// models/index.js\nimport User from './user'\n// Do not use `export default` - instead export each model as a named export\n// Alternatively, just assign each model to `module.exports` object.\nexport {\n  User\n}\n// or\nmodule.exports = {\n  User,\n}\n\n// index.js\nimport * as sequelize from '@atlas.js/sequelize'\nimport { Atlas } from '@atlas.js/atlas'\n\nconst atlas = new Atlas({\n  root: __dirname,\n  config: {\n    hooks: {\n      models: {\n        // The path to the module from which all the database models should be\n        // loaded, relative to atlas.root\n        module: 'models'\n      }\n    }\n  }\n})\n\natlas.service('database', sequelize.Service)\natlas.hook('models', sequelize.ModelsHook, {\n  aliases: {\n    'service:sequelize': 'database',\n  }\n})\nawait atlas.start()\n\n// Now your models from the models/index.js module are loaded up!\nconst User = atlas.services.database.model('User')\n// or\nconst User = atlas.services.database.models.User\n```\n\n### RelationsHook\n\nThis hook allows you to describe your model's associations (relations) directly on the model definition, making the model's definition even more descriptive.\n\n#### Dependencies\n\n- `service:sequelize`: A sequelize service with all the models already loaded up\n\n```js\nclass User extends Model {\n  // Here you can define your model's relations (associations) to other models\n  // in your app\n  static relations = {\n    // This will set up a \"has many\" relation from this model to the models\n    // defined in the object\n    hasMany: {\n      // Let's say you have a Purchase model defined in your app - this will cause the following relation to be set up for you:\n      // User.hasMany(Purchase, { as: 'purchase' })\n      Purchase: {\n        as: 'purchase',\n      },\n      // The key must match an existing model name\n      Company: {}\n    },\n    belongsTo: {},\n    hasOne: {},\n  }\n}\n```\n\n### Why fields, relations, config...?\n\n> Why not attributes, associations and options?\n\nBecause all those properties already exist on a standard sequelize Model object, and adding them in your own model definition would overwrite them, causing all kinds of issues. Therefore new names had to be chosen.\n\n### MigrationAction\n\nThis action contains methods for applying and rolling back your sequelize migrations. The migration files are written exactly like standard Sequelize migrations. In addition to using plain JavaScript migration files, you may also organise your migrations into a folder with an _index.js_ file inside, if the migration requires more data or you simply wish to organise the migration in a different way than a single script.\n\n#### MigrationAction Dependencies\n\n- `service:sequelize`: A sequelize service to use with which to apply/undo the migrations\n\n```js\n// index.js\nimport * as sequelize from '@atlas.js/sequelize'\nimport { Atlas } from '@atlas.js/atlas'\n\nconst atlas = new Atlas({\n  root: __dirname,\n  config: {\n    actions: {\n      migration: {\n        // The path to the module from which all the migrations should be\n        // loaded, relative to atlas.root\n        module: 'migrations'\n      }\n    }\n  }\n})\n\natlas.action('migration', sequelize.MigrationAction, {\n  aliases: {\n    'service:sequelize': 'database'\n  }\n})\nawait atlas.start()\n\n// Available actions:\nawait atlas.actions.migration.up() // Applies all pending migrations\nawait atlas.actions.migration.down() // Rolls back last applied migration\nawait atlas.actions.migration.pending() // Returns names of pending migrations\n```\n\n#### Running migrations on start\n\nMigrations are not applied automatically on application start. You will need to implement your own hook which implements the `beforeStart` event handler and run the `up()` method from there.\n\nA simple hook doing just that:\n\n```js\nimport Hook from '@atlas.js/hook'\n\nexport default MigrateHook extends Hook {\n  async beforeStart() {\n    await this.atlas.actions.migrate.up()\n  }\n}\n```\n\n## License\n\nSee the [LICENSE](LICENSE) file for information.\n\n[sequelize-db-drivers]: http://docs.sequelizejs.com/manual/installation/getting-started.html#installation\n[sequelize-constructor]: http://docs.sequelizejs.com/class/lib/sequelize.js~Sequelize.html#instance-constructor-constructor\n","readmeFilename":"README.md","_id":"@atlas.js/sequelize@2.1.0-alpha.8","_nodeVersion":"10.15.0","_npmVersion":"lerna/3.10.5/node@v10.15.0+x64 (linux)","dist":{"integrity":"sha512-zTO/Rd3jzCH6uCsuPki/DGJlqVsE11qzDYz4gglcMnDHrXAGQbe3DB8fv5gm+al/ttGs0AKUsiT40n6zF1svaQ==","shasum":"8db77a72e622a30a490b98cc61300850e6f8a89c","tarball":"https://registry.npmjs.org/@atlas.js/sequelize/-/sequelize-2.1.0-alpha.8.tgz","fileCount":43,"unpackedSize":121141,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcTuJ4CRA9TVsSAnZWagAAvHwQAIQxYuXVgvLdJsnJy7Vt\nPWIGrdMACRvbryulVsFzPhT/IOBdmgqrwA7Ea8d2oP2dRvH1NnUdOyhaFxfB\nu9Nb3G0gxm2IT4rwcWePP3X8qwOS+grCO4yy+8faqV741e6pXFWoT/wzA2Ar\nEduiRJIzjheY6c1gV+4vQng8Ls/NYI6G04CiWxQRpBpJhlITjMToWep/zYTr\nZasSmuFLk7HMgTukUV7DK9SwBoVBqhXkMXSBt4KH+zBMjCgkhrX+Rs16uGGR\nvoa2LuiyCm/tjQEGk24GBO/zE/9mgQglwUGpaMp6e0tRL6k9Hm4fk2tj+Z7M\n6/RgJA2jaKtNRDngO4yNYWUetafagy+HmqN92fxR6nfvdPcCDrx/dYmrTIuo\nx6l90duLAaZJ6c0B4gJVh7d+Ds95fEepgvdJcPEsPAQGueQVux92AqjLrIAE\n/5p18rRerIT9PNaPNP4BK0HCcYuR4OEBiKoJVCMCZZiFPJ47tXApT0p7aWse\nvtKZUolexAaIsuwgJIcOuOFq/lSpA4eEx5y3bFPh8SMUyg7lpd98ZeXTzsep\nsfmAMs+hVCgRCsOL8nzMjPs+2lcn7p86lFxsB8qHPHymHZq9AH7fd1+6brx9\nNcNPgWJ9p/rvHPQ/BADDHFfTQNgXKL8R0cfTkhrLMgTaeJGTef6dN1tyDH5A\n6d/0\r\n=7M/8\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCnQIBfjZCJc5OIKbb0QPfOlhJniyqI/Kvv9hU/QyOscAIhAKqxZB89bXOIVyBx8h+dD0evFsP9kMnZmz13GyHcMqCj"}]},"maintainers":[{"email":"robert.rossmann@strv.com","name":"robertrossmann"},{"email":"licenses@strv.com","name":"strvuser"}],"_npmUser":{"name":"robertrossmann","email":"robert.rossmann@strv.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sequelize_2.1.0-alpha.8_1548673655425_0.3330674917545313"},"_hasShrinkwrap":false},"2.1.0":{"name":"@atlas.js/sequelize","description":"Sequelize service for @atlas.js","version":"2.1.0","author":{"name":"Robert Rossmann","email":"robert.rossmann@strv.com"},"bugs":{"url":"https://github.com/strvcom/atlas.js/issues"},"contributors":[],"dependencies":{"@atlas.js/action":"^1.2.0","@atlas.js/errors":"^0.3.0","@atlas.js/hook":"^2.1.0","@atlas.js/service":"^1.2.0","@types/sequelize":"^4.27.32","sequelize":"^4.37.6","umzug":"^2.0.0"},"devDependencies":{"@atlas.js/atlas":"^2.2.0","sqlite3":"^4.0.0"},"engines":{"node":">=8.3.0","npm":"^5.3.0"},"homepage":"https://github.com/strvcom/atlas.js/tree/master/packages/sequelize","keywords":[],"license":"BSD-3-Clause","main":"src","publishConfig":{"access":"public"},"repository":{"type":"git","url":"git://github.com/strvcom/atlas.js.git"},"gitHead":"e67f1220a6aa157ef078f26075b6aa5bfad5ee18","_id":"@atlas.js/sequelize@2.1.0","_nodeVersion":"10.15.1","_npmVersion":"lerna/3.10.5/node@v10.15.1+x64 (linux)","dist":{"integrity":"sha512-7sRxpJEyiEzSyBccgAQCElzAPgco1n/5zNASMM2WEwH4GUaZ1b6aHBH8wjQHqjc5gae2QKxlG4wxqCer2zE4Kg==","shasum":"fa519e91a4317c6c7cc97f0186e3fdb606dd2d04","tarball":"https://registry.npmjs.org/@atlas.js/sequelize/-/sequelize-2.1.0.tgz","fileCount":43,"unpackedSize":122130,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcXWHsCRA9TVsSAnZWagAAiV4P/0YdwUvcZoSiAZRkCpmb\nEbe4Vr6SY1B5eLqre7lY0X0+udmULiqYnPaiS15odZco7QMNG92FUuZUjSRm\nb0l/LexGFIFCWr6NcUlRIJiiG613QcUYn+bjMNofbrkneVR1bUZvwF0JmB3B\nQN0d/fmyaUIwLxMYS/tuwvbsjnqyNhJNAzgV0YUYzzxwxPSVO5V9FQmulzGq\nKKNAhqrvXq4AOenu1VHJjS7nLSki6A0agzk60Zv+HHuJN2udnenfr9BiO3zm\n+OrUq/bOFpRtu9NPeaXcf5FF+XszVmsrlQft2m54o5fYbkBjZc6mJ9zIn6+7\n1mYYXxh0LcZtSzBbuDBqfURM+KBq7SXi+g8LgD98qtc9sARzc1wmZ5kfXiJ9\nRW3NMnsIH/mSWqTnwBO/7gaNKMEChdnwnzdnyR9QHtBt8ojF+pErQ5Mtl2KG\nvbsAEMUzi9XGaO3U2hPCYZX9kNinS4knpeEKpBuTDjB2A8+eq/bbAQZAr1Jw\nunoz1Xw48tzWXXXIWuEdKgTW5+zduKaKVUMor9HvAviKnZA+/5/zPytgkD0I\no9Pz8bNQBeily6hh7WS1waZcIOcqrpjHFMbTEEaq5ULVxtfyW4j/g3k1Rhhn\nSWbznhEqxsomGITENNxBaYHCwxiJA4iAxmd+bdPDW7VSDt9pPfaXv1SH3Gzj\ngRzE\r\n=zzv2\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCj5pKqDBsrcRxonw7p0AUAzEXZgCeaWICK6HCpE+f3egIgWLHFR3ab8GCEf+yxI2QdKPtedcA4B3EijQBjdH7UVGc="}]},"maintainers":[{"email":"robert.rossmann@strv.com","name":"robertrossmann"},{"email":"licenses@strv.com","name":"strvuser"}],"_npmUser":{"name":"robertrossmann","email":"robert.rossmann@strv.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sequelize_2.1.0_1549623788260_0.7705175682806178"},"_hasShrinkwrap":false},"2.1.1":{"name":"@atlas.js/sequelize","description":"Sequelize service for @atlas.js","version":"2.1.1","author":{"name":"Robert Rossmann","email":"robert.rossmann@strv.com"},"bugs":{"url":"https://github.com/strvcom/atlas.js/issues"},"contributors":[],"dependencies":{"@atlas.js/action":"^1.2.0","@atlas.js/errors":"^0.4.0","@atlas.js/hook":"^2.1.0","@atlas.js/service":"^1.2.0","@types/sequelize":"^4.27.32","sequelize":"^4.37.6","umzug":"^2.0.0"},"devDependencies":{"@atlas.js/atlas":"^2.3.0","sqlite3":"^4.0.0"},"engines":{"node":">=8.3.0","npm":"^5.3.0"},"homepage":"https://github.com/strvcom/atlas.js/tree/master/packages/sequelize","keywords":[],"license":"BSD-3-Clause","main":"src","publishConfig":{"access":"public"},"repository":{"type":"git","url":"git://github.com/strvcom/atlas.js.git"},"gitHead":"5c97a07bd8836b5ec1324990def51e7a310154af","_id":"@atlas.js/sequelize@2.1.1","_nodeVersion":"10.15.1","_npmVersion":"lerna/3.13.0/node@v10.15.1+x64 (linux)","dist":{"integrity":"sha512-9FUayHmrbnHSlWYAxB4T+Ds/n8uKJ+hvPJSJ6d+rv1J0TosEPE5/3TIlWq9sB1kkL5gP7qu+Xa/mKPGNgWFADg==","shasum":"1462175c4e60b20aa94cc379823c0532e83a27e1","tarball":"https://registry.npmjs.org/@atlas.js/sequelize/-/sequelize-2.1.1.tgz","fileCount":43,"unpackedSize":122319,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcbUmRCRA9TVsSAnZWagAAi9QP/j0DDYMI1keQ/5As2KOL\nIoX0LQLI3fVbE3tzrPUBDZRhJyk4motNXo6UdKQrwxEk/+rw8URVrUk2EV7n\nBQxpjG4zs5ozHfQ2a2nWw15nswtwOhwhh/xtXz5igyL0uoiew5NFmVC5GoAm\nmntkZmw0aKYh8OAJ4V3VzabdzUXm9AnfrMkSTncb5Q4bgZhgiuRkyLKZj3uy\n8hCWbiN2fSl2KIDAQe4MsO1K26saMgnAKGHWtLeTU87G7vrbTc2HkEnBBlgp\nYIoRCtXN3CgLqnLD/SUp7KFPNRKHAzTILkDSjhYJjnXve8tNJt6E3bTdUyyw\nLjh+Yr6oEX6BN97HE5P1byKsnZeCRufjEKkLQ0482NaUkLkESLASefcR5K4M\nolvDIImiVXSXL/nus0yAf6BAVW4QDJx07mOf3M0IjsI5bsLim5keiaN1KHrU\nJ0W0DrBFB1ce7JpOYBYl3jrj+MyL05Y6CSnRONNAlEy0nqLrcr2kCxQGxSYx\no+NAJGQkCjpDTmUuvvVsaSXNI/kWfmIyr0ecgIoPeADxAC/TJUHhlrota50k\n4clqjdPxngZFv7DV3Qtbqq2IgTaXFR34hTsqT721uJjD8jM2jqq97PxP4V2D\n7htZwFyHdL+xKVHrRvAm2EZhZZONuRIaWujq9aMBlAKp4siCF+JyPTiUreHJ\njItt\r\n=YTsZ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDbG9Bgeaci9qo6v836PWnhVlKRH3JaBwg3daRexFpEYAIgOTS2eK7o07kyrTvA5m9kQc0S8NHBrrRQZtrYW86VlOU="}]},"maintainers":[{"email":"robert.rossmann@strv.com","name":"robertrossmann"},{"email":"licenses@strv.com","name":"strvuser"}],"_npmUser":{"name":"robertrossmann","email":"robert.rossmann@strv.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sequelize_2.1.1_1550666128693_0.4210605335487918"},"_hasShrinkwrap":false},"3.0.0":{"name":"@atlas.js/sequelize","description":"Sequelize service for @atlas.js","version":"3.0.0","author":{"name":"Robert Rossmann","email":"robert.rossmann@strv.com"},"bugs":{"url":"https://github.com/strvcom/atlas.js/issues"},"contributors":[],"dependencies":{"@atlas.js/action":"^1.2.1","@atlas.js/errors":"^0.4.0","@atlas.js/hook":"^2.1.1","@atlas.js/service":"^1.2.1","sequelize":"^5.2.12","umzug":"^2.0.0"},"devDependencies":{"@atlas.js/atlas":"^2.4.0","sqlite3":"^4.0.0"},"engines":{"node":">=8.3.0","npm":"^5.3.0"},"homepage":"https://github.com/strvcom/atlas.js/tree/master/packages/sequelize","keywords":[],"license":"BSD-3-Clause","main":"src","publishConfig":{"access":"public"},"repository":{"type":"git","url":"git://github.com/strvcom/atlas.js.git"},"gitHead":"6c9ce4041de9f5c386b205e72c656443101327b0","_id":"@atlas.js/sequelize@3.0.0","_nodeVersion":"10.15.3","_npmVersion":"lerna/3.13.1/node@v10.15.3+x64 (linux)","dist":{"integrity":"sha512-miDWmfZuQN2iOqNXFYYEKQgJ9quQbr+0r7qlpS6luFcsmPBbx8bMir768rMomIHUEtemEVrn5FdST5liQi4c7A==","shasum":"c7309049059aaba8b51f2fe38bb41bb45cc4530f","tarball":"https://registry.npmjs.org/@atlas.js/sequelize/-/sequelize-3.0.0.tgz","fileCount":43,"unpackedSize":121986,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcpz1KCRA9TVsSAnZWagAABW8P/0DWQgOUUflDXco2JbJ2\nWQpqN7bIZdufqCzEch/EMljjB++1v++zoJqalSs0jSXbhEact+ixXBX3r5Va\noeRJHHR3RbJmXfUQaJKYmbqwAKCcQk/zKy/uQNEcHoLZ84YAIr9V0DhQEp6P\nYIpAO7PFA/cxtWUq875d+Ne1Egh3zVq/DKDqaEbc2WPZn/xh0rfWj35TIuQc\n8TOaq9t3KTv83cXQISBYPba0oj8UFB6BAMAiOkAobgJgwf0Fn810QjQaxibm\n0v4nXGL2L8rpC3liKSWXo3w1jR8h1SH8Svk7A8vYZzyQGqNsID7mXjTpn73Z\nqeGM9xrKidtbgkCTlnZX4dYQydrNpSfdbB6L4+Ia/zImJIQS+eTG23RlbomZ\nSiezYka2+qg9NwdeHqPwfs6zCx5H0SRQqAlWljpfZSzzzH8i7FAH+g5UKlUr\n2MLuKuutu39UYuEzIJm8NzXmjkZTuoQD/E3x4uo6zbNJ55+BKxh+Gq5+GdGd\niBZTyP4NF8VKdEOVXXGeFhYT1FrVFykw6Eb0nkjLXCfRA9nQ89wGYDJrG0up\nIcNL7na4E75iOFF4BvgeYX60c8DTWGzkmNOtGxw+Mg7G3wvRK/KRQjR84Dhh\nOVdtuAc4myVp62+nk9Z3/QKw2ZlsVfJxeSpf8NSKXN4jY9F79MErdzdexG0I\nEsrq\r\n=Cy5M\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEh9ejAVW8sW4kQwIyojQtMkPJk2j9za6CqygmTKIMGYAiAxem9Wvgnk5qb5quTczRdpFXJN4xG4ZZQl5ly9UmFc8g=="}]},"maintainers":[{"email":"robert.rossmann@strv.com","name":"robertrossmann"},{"email":"licenses@strv.com","name":"strvuser"}],"_npmUser":{"name":"robertrossmann","email":"robert.rossmann@strv.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sequelize_3.0.0_1554464073817_0.9199335551158379"},"_hasShrinkwrap":false}},"readme":"# @atlas.js/sequelize\n\nSequelize service for @atlas.js.\n\n## Installation\n\n`npm i @atlas.js/sequelize`\n\nYou will also need to install one of the [supported database drivers][sequelize-db-drivers] on your own.\n\n## Usage\n\n### Service\n\nThe service configuration only accepts two properties: `uri` and `options` which are passed directly to the [`new Sequelize(uri, options)`][sequelize-constructor] constructor.\n\n```js\nimport * as sequelize from '@atlas.js/sequelize'\nimport { Atlas } from '@atlas.js/atlas'\n\nconst atlas = new Atlas({\n  config: {\n    services: {\n      database: {\n        uri: 'postgres://postgres:postgres@127.0.0.1:27017/my-db',\n        options: {\n          pool: {\n            max: 5,\n            min: 2,\n          }\n        },\n      }\n    }\n  }\n})\n\natlas.service('database', sequelize.Service)\nawait atlas.start()\n\n// You have your sequelize client available here:\natlas.services.database\n```\n\nNote that by default, the service does not load your models which means you will either have to load them up yourself or use the `ModelsHook` documented below.\n\n### ModelsHook\n\nThis hook allows you to import your Sequelize models from a particular module location into the sequelize service.\n\n#### ModelsHook Dependencies\n\n- `service:sequelize`: A sequelize service to load the models into\n\n```js\n// models/user.js\n\n// You can import the necessary classes and definitions directly from the\n// @atlas.js/sequelize module instead of loading the whole sequelize lib\nimport { Model, DataTypes } from '@atlas.js/sequelize'\n\nclass User extends Model {\n  // Here you can describe your model's fields (columns/attributes)\n  // This goes directly to Model.init() as first argument\n  static fields = {\n    name: {\n      type: DataTypes.STRING,\n      allowNull: false,\n    },\n\n    someDate: {\n      type: DataTypes.DATE,\n      allowNull: true,\n    },\n  }\n\n  // Here you can specify your model's config (options)\n  // This goes directly to Model.init() as second argument\n  static config = {\n    paranoid: true,\n    timestamps: true,\n  }\n\n  static staticMethod() {\n    // You can access the Atlas instance as a property on the\n    // Model class:\n    // this refers to the model class itself\n    this.atlas\n  }\n\n  async instanceMethod() {\n    // On instance methods, you can also access the Atlas instance\n    // directly on the model's instance\n    // this refers to the model class' instance\n    this.atlas\n  }\n}\n\nexport default User\n\n\n// models/index.js\nimport User from './user'\n// Do not use `export default` - instead export each model as a named export\n// Alternatively, just assign each model to `module.exports` object.\nexport {\n  User\n}\n// or\nmodule.exports = {\n  User,\n}\n\n// index.js\nimport * as sequelize from '@atlas.js/sequelize'\nimport { Atlas } from '@atlas.js/atlas'\n\nconst atlas = new Atlas({\n  root: __dirname,\n  config: {\n    hooks: {\n      models: {\n        // The path to the module from which all the database models should be\n        // loaded, relative to atlas.root\n        module: 'models'\n      }\n    }\n  }\n})\n\natlas.service('database', sequelize.Service)\natlas.hook('models', sequelize.ModelsHook, {\n  aliases: {\n    'service:sequelize': 'database',\n  }\n})\nawait atlas.start()\n\n// Now your models from the models/index.js module are loaded up!\nconst User = atlas.services.database.model('User')\n// or\nconst User = atlas.services.database.models.User\n```\n\n### RelationsHook\n\nThis hook allows you to describe your model's associations (relations) directly on the model definition, making the model's definition even more descriptive.\n\n#### Dependencies\n\n- `service:sequelize`: A sequelize service with all the models already loaded up\n\n```js\nclass User extends Model {\n  // Here you can define your model's relations (associations) to other models\n  // in your app\n  static relations = {\n    // This will set up a \"has many\" relation from this model to the models\n    // defined in the object\n    hasMany: {\n      // Let's say you have a Purchase model defined in your app - this will cause the following relation to be set up for you:\n      // User.hasMany(Purchase, { as: 'purchase' })\n      Purchase: {\n        as: 'purchase',\n      },\n      // The key must match an existing model name\n      Company: {}\n    },\n    belongsTo: {},\n    hasOne: {},\n  }\n}\n```\n\n### Why fields, relations, config...?\n\n> Why not attributes, associations and options?\n\nBecause all those properties already exist on a standard sequelize Model object, and adding them in your own model definition would overwrite them, causing all kinds of issues. Therefore new names had to be chosen.\n\n### MigrationAction\n\nThis action contains methods for applying and rolling back your sequelize migrations. The migration files are written exactly like standard Sequelize migrations. In addition to using plain JavaScript migration files, you may also organise your migrations into a folder with an _index.js_ file inside, if the migration requires more data or you simply wish to organise the migration in a different way than a single script.\n\n#### MigrationAction Dependencies\n\n- `service:sequelize`: A sequelize service to use with which to apply/undo the migrations\n\n```js\n// index.js\nimport * as sequelize from '@atlas.js/sequelize'\nimport { Atlas } from '@atlas.js/atlas'\n\nconst atlas = new Atlas({\n  root: __dirname,\n  config: {\n    actions: {\n      migration: {\n        // The path to the module from which all the migrations should be\n        // loaded, relative to atlas.root\n        module: 'migrations'\n      }\n    }\n  }\n})\n\natlas.action('migration', sequelize.MigrationAction, {\n  aliases: {\n    'service:sequelize': 'database'\n  }\n})\nawait atlas.start()\n\n// Available actions:\nawait atlas.actions.migration.up() // Applies all pending migrations\nawait atlas.actions.migration.down() // Rolls back last applied migration\nawait atlas.actions.migration.pending() // Returns names of pending migrations\n```\n\n#### Running migrations on start\n\nMigrations are not applied automatically on application start. You will need to implement your own hook which implements the `beforeStart` event handler and run the `up()` method from there.\n\nA simple hook doing just that:\n\n```js\nimport Hook from '@atlas.js/hook'\n\nexport default MigrateHook extends Hook {\n  async beforeStart() {\n    await this.atlas.actions.migrate.up()\n  }\n}\n```\n\n## License\n\nSee the [LICENSE](LICENSE) file for information.\n\n[sequelize-db-drivers]: http://docs.sequelizejs.com/manual/installation/getting-started.html#installation\n[sequelize-constructor]: http://docs.sequelizejs.com/class/lib/sequelize.js~Sequelize.html#instance-constructor-constructor\n","maintainers":[{"email":"robert.rossmann@strv.com","name":"robertrossmann"},{"email":"licenses@strv.com","name":"strvuser"}],"time":{"modified":"2022-04-04T16:08:37.628Z","created":"2017-09-02T12:28:37.830Z","0.1.0":"2017-09-02T12:28:37.830Z","0.1.1":"2017-09-06T13:39:35.809Z","0.2.0":"2017-09-07T16:00:52.180Z","0.2.1":"2017-09-22T08:07:06.131Z","0.3.0":"2017-09-26T11:35:14.372Z","0.4.0":"2017-09-27T08:50:33.355Z","1.0.0":"2017-10-24T20:48:34.717Z","1.0.1":"2017-11-27T09:54:29.590Z","1.1.0":"2017-12-13T11:56:36.033Z","1.2.0-alpha.a596c671":"2018-05-14T15:01:38.111Z","2.0.0":"2018-05-22T15:37:16.665Z","2.0.1":"2018-07-12T12:32:13.239Z","2.1.0-alpha.0":"2018-12-07T13:18:52.676Z","2.1.0-alpha.1":"2018-12-10T09:09:58.851Z","2.1.0-alpha.2":"2018-12-11T08:54:14.292Z","2.1.0-alpha.3":"2018-12-11T13:12:33.587Z","2.1.0-alpha.4":"2018-12-13T18:30:43.356Z","2.1.0-alpha.5":"2018-12-18T11:16:58.520Z","2.1.0-alpha.6":"2019-01-16T09:06:48.010Z","2.1.0-alpha.7":"2019-01-28T10:52:03.364Z","2.1.0-alpha.8":"2019-01-28T11:07:35.566Z","2.1.0":"2019-02-08T11:03:08.391Z","2.1.1":"2019-02-20T12:35:28.915Z","3.0.0":"2019-04-05T11:34:33.977Z"},"homepage":"https://github.com/strvcom/atlas.js/tree/master/packages/sequelize","keywords":[],"repository":{"type":"git","url":"git://github.com/strvcom/atlas.js.git"},"contributors":[],"author":{"name":"Robert Rossmann","email":"robert.rossmann@strv.com"},"bugs":{"url":"https://github.com/strvcom/atlas.js/issues"},"license":"BSD-3-Clause","readmeFilename":"README.md"}