{"_id":"@bengchet/typeorm-seeding","_rev":"2-15da4104b029099436bd7a92037dba76","name":"@bengchet/typeorm-seeding","dist-tags":{"latest":"5.0.4"},"versions":{"5.0.2":{"name":"@bengchet/typeorm-seeding","version":"5.0.2","keywords":["typeorm","seed","seeding","orm"],"description":"🌱 A delightful way to seed test data into your database.","license":"MIT","author":{"name":"Gery Hirschfeld","email":"gery.hirschfeld@w3tec.ch","url":"https://github.com/hirsch88"},"contributors":[{"name":"Jorge Bodega","email":"jorge.bodega.f@gmail.com","url":"https://github.com/jorgebodega"}],"main":"dist/index.js","types":"dist/index.d.ts","bin":{"typeorm-seeding":"dist/cli.js"},"repository":{"type":"git","url":"git+https://github.com/jorgebodega/typeorm-seeding.git"},"scripts":{"build":"tsc --project ./tsconfig.build.json","format":"prettier --write \"{src,test}/**/*.ts\"","format:ci":"prettier --check \"{src,test}/**/*.ts\"","lint":"eslint \"{src,test}/**/*.ts\"","lint:fix":"pnpm lint --fix","lint:ci":"pnpm lint","prebuild":"rimraf dist","schema:drop":"ts-node ./node_modules/typeorm/cli.js schema:drop","schema:log":"ts-node ./node_modules/typeorm/cli.js schema:log","schema:sync":"ts-node ./node_modules/typeorm/cli.js schema:sync","seed:run":"ts-node ./src/cli.ts seed","seed:config":"ts-node ./src/cli.ts config","test":"jest","test:ci":"jest --silent","test:cov":"jest --coverage --silent","test:watch":"jest --watch","typecheck":"tsc --noEmit"},"devDependencies":{"@faker-js/faker":"7.4.0","@tsconfig/node16":"1.0.3","@types/glob":"7.2.0","@types/jest":"28.1.7","@types/node":"18.7.6","@types/yargs":"17.0.11","@typescript-eslint/eslint-plugin":"5.33.1","@typescript-eslint/parser":"5.33.1","eslint":"8.22.0","eslint-config-prettier":"8.5.0","eslint-plugin-import":"2.26.0","jest":"28.1.3","prettier":"2.7.1","rimraf":"3.0.2","sqlite3":"5.0.11","ts-jest":"28.0.8","ts-node":"10.9.1","typeorm":"0.3.7","typescript":"4.7.4"},"dependencies":{"chalk":"4.1.2","glob":"8.0.3","ora":"5.4.1","reflect-metadata":"0.1.13","tslib":"2.4.0","yargs":"17.5.1"},"peerDependencies":{"typeorm":"^0.3.0"},"engines":{"node":">=14"},"bugs":{"url":"https://github.com/jorgebodega/typeorm-seeding/issues"},"homepage":"https://github.com/jorgebodega/typeorm-seeding#readme","directories":{"test":"test"},"gitHead":"5b704ea5624b9ca046980e689501e448ad60f142","_id":"@bengchet/typeorm-seeding@5.0.2","_nodeVersion":"14.18.1","_npmVersion":"7.18.1","dist":{"integrity":"sha512-rhACPz77aWL1UAfaxnhy+7T9tpFKrZOTTENeOgecns+ACsXZeAwrTj9yr//8cfLCoTmVsF1dRNcPuqr4rUpfUw==","shasum":"ffffa5c3a71afbf88e78893c8761651295162969","tarball":"https://registry.npmjs.org/@bengchet/typeorm-seeding/-/typeorm-seeding-5.0.2.tgz","fileCount":69,"unpackedSize":215359,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBIVqXeEhNY1ouCjIyAXbgMxH2G6e+8MQGwcGfnz6iFOAiAov6e6QvR29d8nCtzX943xP6pwaNqczDC4RFQ7c8NNhQ=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjH+yRACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmrvrw/8DH+aJkUqFm+Olnq5Nq1n1jsCM6Mz4MGWG2U9kmu1p43n9ZXX\r\nR5uSi6jGdZ/05bXaBwktbV7O0D0ivuFIIyV6DRIJHXyAmqIKn2ikyQL3x8k5\r\nVTQKVnxfHnXmqguC3Jt2M4x6RD28lY3pTIGFNEk0DT2YGJCMNW0E4mLNxJYy\r\nulKr3AIC+KCC+9KYKGqpr1z43SCuve3rYizQ2BR1qi1L2q0Fz64r1ojRpj2R\r\nJNKABNYqw9+n6aAdoNz4ghtj+3LwRyTku/1SXBJn0Ua+m8U8PyDU0hH8O5/k\r\nhluEL7uEwTPdhlLB60KN/tVMtqc8Dxuw8fy56WTweJHYV8EiGYk2smJ3ah3b\r\nRrPvzCC0f9UJCW9pcZElx0eucy0ggfN0KSBjHAPgqDyJFCxc67HJk73PfYmL\r\naktrJmNKw01H1dUjcK1iEPT/zktaP0QRTGMggiz0tm3UUEFwE+g/mCfp5Op0\r\n/Wya+JvCjtTh3/i/YPrFgSI5G5mK6nY8W0B1dooR1wsM3bBFdmoysrGiAB3m\r\nXg/O/gjsGms5GgWTGoJVzpAZGAKxTSlYeNwshMX8p9Jn4L+sEjy3il4EUc91\r\numD6TA8mCWLowC3hYBhNJOYTdIr8xiChLuNgmh2S1YqsiiDT8pw/t5rAJwuU\r\nWwg9IWN/6H5nvuSacZiEKtx9gMm/dzdMfNY=\r\n=wfQW\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"bengchet","email":"popfibo@gmail.com"},"maintainers":[{"name":"bengchet","email":"popfibo@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/typeorm-seeding_5.0.2_1663036561237_0.5923872811272564"},"_hasShrinkwrap":false},"5.0.3":{"name":"@bengchet/typeorm-seeding","version":"5.0.3","keywords":["typeorm","seed","seeding","orm"],"description":"🌱 A delightful way to seed test data into your database.","license":"MIT","author":{"name":"Gery Hirschfeld","email":"gery.hirschfeld@w3tec.ch","url":"https://github.com/hirsch88"},"contributors":[{"name":"Jorge Bodega","email":"jorge.bodega.f@gmail.com","url":"https://github.com/jorgebodega"}],"main":"dist/index.js","types":"dist/index.d.ts","bin":{"typeorm-seeding":"dist/cli.js"},"repository":{"type":"git","url":"git+https://github.com/jorgebodega/typeorm-seeding.git"},"scripts":{"build":"tsc --project ./tsconfig.build.json","format":"prettier --write \"{src,test}/**/*.ts\"","format:ci":"prettier --check \"{src,test}/**/*.ts\"","lint":"eslint \"{src,test}/**/*.ts\"","lint:fix":"pnpm lint --fix","lint:ci":"pnpm lint","prebuild":"rimraf dist","schema:drop":"ts-node ./node_modules/typeorm/cli.js schema:drop","schema:log":"ts-node ./node_modules/typeorm/cli.js schema:log","schema:sync":"ts-node ./node_modules/typeorm/cli.js schema:sync","seed:run":"ts-node ./src/cli.ts seed","seed:config":"ts-node ./src/cli.ts config","test":"jest","test:ci":"jest --silent","test:cov":"jest --coverage --silent","test:watch":"jest --watch","typecheck":"tsc --noEmit"},"devDependencies":{"@faker-js/faker":"7.4.0","@tsconfig/node16":"1.0.3","@types/glob":"7.2.0","@types/jest":"28.1.7","@types/node":"18.7.6","@types/yargs":"17.0.11","@typescript-eslint/eslint-plugin":"5.33.1","@typescript-eslint/parser":"5.33.1","eslint":"8.22.0","eslint-config-prettier":"8.5.0","eslint-plugin-import":"2.26.0","jest":"28.1.3","prettier":"2.7.1","rimraf":"3.0.2","sqlite3":"5.0.11","ts-jest":"28.0.8","ts-node":"10.9.1","typeorm":"0.3.7","typescript":"4.7.4"},"dependencies":{"chalk":"4.1.2","glob":"^8.0.3","ora":"5.4.1","reflect-metadata":"0.1.13","tslib":"2.4.0","yargs":"17.5.1"},"peerDependencies":{"typeorm":"^0.3.0"},"engines":{"node":">=14"},"bugs":{"url":"https://github.com/jorgebodega/typeorm-seeding/issues"},"homepage":"https://github.com/jorgebodega/typeorm-seeding#readme","directories":{"test":"test"},"gitHead":"84d444c7affb371a2437ac37c737c06dd12c250d","_id":"@bengchet/typeorm-seeding@5.0.3","_nodeVersion":"14.18.1","_npmVersion":"7.18.1","dist":{"integrity":"sha512-H4Y+VYgQyrgwUw3YlrvoWACTGsqjYPlyaUL8jOvK0WCXWyHxpC078uR/F8FWN+vS5cHdEqAtWE48Zt264RPMTw==","shasum":"e9d236090a62eb12494966b61e3a9687ded5ef57","tarball":"https://registry.npmjs.org/@bengchet/typeorm-seeding/-/typeorm-seeding-5.0.3.tgz","fileCount":70,"unpackedSize":216353,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIF1Vv20PuJfLzJBbDSvG/7gXvOHhE9aPNCy6fmpSHgcwAiA3G8C0gs4QsH5txpvlut+RtW4zepimNRGVoXVtc4uvWg=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjIBjIACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp+ZA/+KCDvbag6mPzoBMzz5HC4HattXPYn/ZAyEfFqc5rrl2UZtnBM\r\nPkr2Xnsz2ZWtC5GGyn+plUqxnAWPXBit5VCHjvhC3uUhV9kjqt7SRi3oWJPd\r\nRZGahGP+JAjRuNefiqd2ASpKrQO5VlGMwFWuHUiOm6diek67ZZQ9duJmozg2\r\nOi5l8YKgxmiOCqmMBSD9SVNYGKMN4WI7pThYCcbHG01FyRGl9yYrDyRZYcP1\r\nE/j4L4ZI6l/JCcyJSqn4oetDALztxs4c9LPmB/pRMqbYnkIVuwbCzvxeTLgj\r\nk7lzEjrxtjoZH5Q3Dp9xa0qkP0xXV6NeeNYpmRuuFIJ0XhnwL+UOJKjSAMOo\r\nKigjR1Sxmj//2P/CBbmk2Nq0m3b7+xKUsQl0K+LzsARXNELXZCMqE7lnG7JI\r\nuVyo16Vc/NtTtStgOxiUUEV8N26aAmk1cKCEXKLtAcKVBcfbIsnEB4OgBpN2\r\nPI5JhwgcRDx+reIrbn1u7hyFm/T/F6olIR/8S9GgdZnd3ZVVdXCGg4Hu+4Bd\r\n9lHLE1wPYneorzL+fCxsHWXqyVxXE/dNyv32H0d8DwPF6MyFYwDZxzQVa8HE\r\nj8VlhjOOMrzWG7guzjDjBYBZdu72o+QWz0TSrCtp8lTcsGzwEj3f/819wS+S\r\ngFC/cTvmkuDl4r8wQnKHNCNd9+7fjRm97fg=\r\n=0QRS\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"bengchet","email":"popfibo@gmail.com"},"maintainers":[{"name":"bengchet","email":"popfibo@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/typeorm-seeding_5.0.3_1663047880754_0.25967765306525803"},"_hasShrinkwrap":false},"5.0.4":{"name":"@bengchet/typeorm-seeding","version":"5.0.4","keywords":["typeorm","seed","seeding","orm"],"description":"🌱 A delightful way to seed test data into your database.","license":"MIT","author":{"name":"Gery Hirschfeld","email":"gery.hirschfeld@w3tec.ch","url":"https://github.com/hirsch88"},"contributors":[{"name":"Jorge Bodega","email":"jorge.bodega.f@gmail.com","url":"https://github.com/jorgebodega"}],"main":"dist/index.js","types":"dist/index.d.ts","bin":{"typeorm-seeding":"dist/cli.js"},"repository":{"type":"git","url":"git+https://github.com/jorgebodega/typeorm-seeding.git"},"scripts":{"build":"tsc --project ./tsconfig.build.json","format":"prettier --write \"{src,test}/**/*.ts\"","format:ci":"prettier --check \"{src,test}/**/*.ts\"","lint":"eslint \"{src,test}/**/*.ts\"","lint:fix":"pnpm lint --fix","lint:ci":"pnpm lint","prebuild":"rimraf dist","schema:drop":"ts-node ./node_modules/typeorm/cli.js schema:drop","schema:log":"ts-node ./node_modules/typeorm/cli.js schema:log","schema:sync":"ts-node ./node_modules/typeorm/cli.js schema:sync","seed:run":"ts-node ./src/cli.ts seed","seed:config":"ts-node ./src/cli.ts config","test":"jest","test:ci":"jest --silent","test:cov":"jest --coverage --silent","test:watch":"jest --watch","typecheck":"tsc --noEmit"},"devDependencies":{"@faker-js/faker":"7.4.0","@tsconfig/node16":"1.0.3","@types/glob":"7.2.0","@types/jest":"28.1.7","@types/node":"18.7.6","@types/yargs":"17.0.11","@typescript-eslint/eslint-plugin":"5.33.1","@typescript-eslint/parser":"5.33.1","eslint":"8.22.0","eslint-config-prettier":"8.5.0","eslint-plugin-import":"2.26.0","jest":"28.1.3","prettier":"2.7.1","rimraf":"3.0.2","sqlite3":"5.0.11","ts-jest":"28.0.8","ts-node":"10.9.1","typeorm":"0.3.7","typescript":"4.7.4"},"dependencies":{"chalk":"4.1.2","glob":"^8.0.3","ora":"5.4.1","reflect-metadata":"0.1.13","tslib":"2.4.0","yargs":"17.5.1"},"peerDependencies":{"typeorm":"^0.3.0"},"engines":{"node":">=14"},"bugs":{"url":"https://github.com/jorgebodega/typeorm-seeding/issues"},"homepage":"https://github.com/jorgebodega/typeorm-seeding#readme","directories":{"test":"test"},"gitHead":"84d444c7affb371a2437ac37c737c06dd12c250d","_id":"@bengchet/typeorm-seeding@5.0.4","_nodeVersion":"14.18.1","_npmVersion":"7.18.1","dist":{"integrity":"sha512-fHqX+glkeTECKUMzY03DeDDYWTNf6d4Yn+SP/3j7FG2pB35a8m4jQSRahH7PY05W1xtbaur2f6Z59YYvj6OW8w==","shasum":"57ac6ca94805a6a51b7ce3a07f501026b0d4fa9f","tarball":"https://registry.npmjs.org/@bengchet/typeorm-seeding/-/typeorm-seeding-5.0.4.tgz","fileCount":70,"unpackedSize":216697,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAzeGUEW76j5+BkefuYDKpizx6OBh9jqMZw6SK+H9Wo/AiEAqqwxG9095ZCLSpEx4xz0Ydu+lDK/fYvlvKVKCw3sDQo="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjIB8SACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrldhAAlcnAloJiL5yw8Y+2z3qqb6Hyl9XnY5ro1zwZlJ6YNqVcb1NB\r\nbDHIhKGUYjUzyYaQ/SKR3M2tLO0NdPvZOqox8nO8kC/GhgjpfoA2y2LH+M/5\r\nH7WOPyc+8zBMuykHCbe5at0LCLILtSAkKz+GE9Njh8fyNoo3JlLgNX+d6Yst\r\nyucXm31rNBFjcl6Wl1+j1KeY3+j25TCr5EMrzjGGVLpqurR2xXDYuDHMbQXe\r\nblt8tjDwu9ShTjKhEKpmeSI8gdTEiWzXv6rRd5OfQU1omMIpd2ZCk4ojD/ii\r\ncGoLt9pQ3M0ELXgQ+/e13YO7zuOsqnyUUr2Ccl3F3rTNkLRoyqLqqW9wOsWY\r\nrbUz6CbaNtlmogu5h7bmP1Z29D3xbIpMp1EjvP/z8MmoeGNj/oqpgnL9Apq1\r\ns7/KzUfppB2juJvlikDlfTMYEV+OI2a1SdPgtKv+2s0OyvCvJ8sQ44U8Wtqg\r\nu67JhY0ueay7DurJfQ8+drTXc7Eo0AvSKOAVluih6Upz9+YuMy9RBlQnczNq\r\nmaKdnrnE/PDQfmPBnoX5kpsja015KyrzquTk3YduQ+aGzPzGsPDxnINtvM/j\r\n7VUUqFPz8Wue75DnZH/ZGZHHQmlqCfiXdbZZT1FtG7JZAqJd4TOgs1MdFF99\r\nFIaCYxa9i4m88jjCldRt4Kke5a1Xx5LQl5w=\r\n=d2lE\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"bengchet","email":"popfibo@gmail.com"},"maintainers":[{"name":"bengchet","email":"popfibo@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/typeorm-seeding_5.0.4_1663049490364_0.8370752766591718"},"_hasShrinkwrap":false}},"time":{"created":"2022-09-13T02:36:01.179Z","5.0.2":"2022-09-13T02:36:01.454Z","modified":"2022-09-13T06:11:30.602Z","5.0.3":"2022-09-13T05:44:40.912Z","5.0.4":"2022-09-13T06:11:30.532Z"},"maintainers":[{"name":"bengchet","email":"popfibo@gmail.com"}],"description":"🌱 A delightful way to seed test data into your database.","homepage":"https://github.com/jorgebodega/typeorm-seeding#readme","keywords":["typeorm","seed","seeding","orm"],"repository":{"type":"git","url":"git+https://github.com/jorgebodega/typeorm-seeding.git"},"contributors":[{"name":"Jorge Bodega","email":"jorge.bodega.f@gmail.com","url":"https://github.com/jorgebodega"}],"author":{"name":"Gery Hirschfeld","email":"gery.hirschfeld@w3tec.ch","url":"https://github.com/hirsch88"},"bugs":{"url":"https://github.com/jorgebodega/typeorm-seeding/issues"},"license":"MIT","readme":"<p align=\"center\">\n  <img src=\"./logo.png\" alt=\"logo\" width=\"160\" />\n</p>\n<h1 align=\"center\" style=\"text-align: center;\">TypeORM Seeding</h1>\n\n<p align=\"center\">\n  <img alt=\"NPM\" src=\"https://img.shields.io/npm/l/@jorgebodega/typeorm-seeding?style=for-the-badge\">\n  <a href=\"https://www.npmjs.com/package/@jorgebodega/typeorm-seeding\">\n    <img alt=\"NPM latest version\" src=\"https://img.shields.io/npm/v/@jorgebodega/typeorm-seeding/latest?style=for-the-badge\">\n  </a>\n  <a href=\"https://www.npmjs.com/package/@jorgebodega/typeorm-seeding/v/next\">\n    <img alt=\"NPM next version\" src=\"https://img.shields.io/npm/v/@jorgebodega/typeorm-seeding/next?style=for-the-badge\">\n  </a>\n  <a href=\"https://github.com/semantic-release/semantic-release\">\n    <img src=\"https://img.shields.io/badge/semantic--release-angular-e10079?logo=semantic-release&style=for-the-badge\" alt=\"Semantic release\" />\n  </a>\n</p>\n\n<p align=\"center\">\n  <a href='https://coveralls.io/github/jorgebodega/typeorm-seeding'>\n    <img alt=\"Coveralls master branch\" src=\"https://img.shields.io/coveralls/github/jorgebodega/typeorm-seeding/master?style=for-the-badge\">\n  </a>\n  <a href='https://coveralls.io/github/jorgebodega/typeorm-seeding?branch=next'>\n    <img alt=\"Coveralls next branch\" src=\"https://img.shields.io/coveralls/github/jorgebodega/typeorm-seeding/next?style=for-the-badge&label=coverage%40next\">\n  </a>\n</p>\n\n<p align=\"center\">\n  <img alt=\"Checks for master branch\" src=\"https://img.shields.io/github/checks-status/jorgebodega/typeorm-seeding/master?style=for-the-badge\">\n  <a href='https://coveralls.io/github/jorgebodega/typeorm-seeding'>\n    <img alt=\"Checks for next branch\" src=\"https://img.shields.io/github/checks-status/jorgebodega/typeorm-seeding/next?label=checks%40next&style=for-the-badge\">\n  </a>\n</p>\n\n<p align=\"center\">\n  <b>A delightful way to seed test data into your database.</b></br>\n  <span>Inspired by the awesome framework <a href=\"https://laravel.com/\">laravel</a> in PHP, <a href=\"https://mikro-orm.io/docs/next/seeding/\">MikroORM seeding</a>  and the repositories from <a href=\"https://github.com/pleerock\">pleerock</a></span></br>\n</p>\n\n<p align=\"center\">\n  <sub>Made with ❤️ by <a href=\"https://github.com/hirsch88\">Gery Hirschfeld</a>, <a href=\"https://github.com/jorgebodega\">Jorge Bodega</a> and <a href=\"https://github.com/w3tecch/typeorm-seeding/graphs/contributors\">contributors</a></sub>\n</p>\n\n<br />\n\n# Contents\n\n- [Factory](#factory-1)\n  - [attrs](#attrs)\n    - [Simple value](#simple-value)\n    - [Function](#function)\n    - [InstanceAttribute](#instanceattribute)\n    - [LazyInstanceAttribute](#lazyinstanceattribute)\n    - [Subfactory](#subfactory)\n  - [make & makeMany](#make--makemany)\n  - [create & createMany](#create--createmany)\n- [Seeder](#seeder-1)\n  - [run](#run)\n- [CLI](#cli-configuration)\n  - [seed](#seed)\n- [Testing features](#testing-features)\n\n# Installation\n\nBefore using this TypeORM extension please read the [TypeORM Getting Started](https://typeorm.io/#/) documentation. This explains how to setup a TypeORM project.\n\nAfter that install the extension with `npm` or `yarn`. Add development flag if you are not using seeders nor factories in production code.\n\n```bash\nnpm i [-D] @jorgebodega/typeorm-seeding\nyarn add [-D] @jorgebodega/typeorm-seeding\npnpm add [-D] @jorgebodega/typeorm-seeding\n```\n\n## Configuration\n\nTo configure the path to your seeders extends the TypeORM config file or use environment variables like TypeORM. If both are used the environment variables will be prioritized.\n\n**ormconfig.js**\n\n```typescript\nmodule.exports = {\n  ...\n  seeders: ['src/seeds/**/*{.ts,.js}'],\n  defaultSeeder: RootSeeder,\n  ...\n}\n```\n\n**.env**\n\n```\nTYPEORM_SEEDING_SEEDERS=src/seeds/**/*{.ts,.js}\nTYPEORM_SEEDING_DEFAULT_SEEDER=RootSeeder\n```\n\n# Introduction\n\nIsn't it exhausting to create some sample data for your database, well this time is over!\n\nHow does it work? Just create a entity factory and/or seed script.\n\n### Entity\n\n```typescript\n@Entity()\nclass User {\n  @PrimaryGeneratedColumn('increment')\n  id!: number\n\n  @Column()\n  name!: string\n\n  @Column()\n  lastName!: string\n\n  @Column()\n  email!: string\n\n  @OneToMany(() => Pet, (pet) => pet.owner)\n  pets?: Pet[]\n\n  @ManyToOne(() => Country, (country) => country.users, { nullable: false })\n  @JoinColumn()\n  country!: Country\n}\n```\n\n### Factory\n\n```typescript\nclass UserFactory extends Factory<User> {\n  protected entity = User\n  protected attrs: FactorizedAttrs<User> = {\n    name: faker.name.firstName(),\n    lastName: async () => faker.name.lastName(),\n    email: new InstanceAttribute((instance) =>\n      [instance.name.toLowerCase(), instance.lastName.toLowerCase(), '@email.com'].join(''),\n    ),\n    country: new Subfactory(CountryFactory),\n  }\n}\n```\n\n### Seeder\n\n```typescript\nclass UserSeeder extends Seeder {\n  async run(connection: Connection) {\n    await new UserFactory().createMany(10)\n\n    await this.call(connection, [PetSeeder])\n  }\n}\n```\n\n# Factory\n\nFactory is how we provide a way to simplify entities creation, implementing a [factory creational pattern](https://refactoring.guru/design-patterns/factory-method). It is defined as an abstract class with generic typing, so you have to extend over it.\n\n```typescript\nclass UserFactory extends Factory<User> {\n  protected entity = User\n  protected attrs: FactorizedAttrs<User> = {\n    ...\n  }\n}\n```\n\n## `attrs`\n\nAttributes objects are superset from the original entity attributes.\n\n```typescript\nprotected attrs: FactorizedAttrs<User> = {\n  name: faker.name.firstName(),\n  lastName: async () => faker.name.lastName(),\n  email: new InstanceAttribute((instance) =>\n    [instance.name.toLowerCase(), instance.lastName.toLowerCase(), '@email.com'].join(''),\n  ),\n  country: new Subfactory(CountryFactory),\n}\n```\n\nThose factorized attributes resolves to the value of the original attribute, and could be one of the following types:\n\n- [Simple value](#simple-value)\n- [Function](#function)\n- [InstanceAttribute](#instanceattribute)\n- [LazyInstanceAttribute](#lazyinstanceattribute)\n- [Subfactory](#subfactory)\n\n### Simple value\n\nNothing special, just a value with same type.\n\n```typescript\nprotected attrs: FactorizedAttrs<User> = {\n  name: faker.name.firstName(),\n}\n```\n\n### Function\n\nFunction that could be sync or async, and return a value of the same type. This function will be executed once per entity.\n\n```typescript\nprotected attrs: FactorizedAttrs<User> = {\n  lastName: async () => faker.name.lastName(),\n}\n```\n\n### `InstanceAttribute`\n\n```typescript\nclass InstanceAttribute<T, V> {\n  constructor(private callback: (entity: T) => V) {}\n\n  ...\n}\n```\n\nClass with a function that receive the current instance and returns a value of the same type. It is ideal for attributes that could depend on some others to be computed.\n\nWill be executed after the entity has been created and the rest of the attributes have been calculated, but before persistance (in case of `create` or `createMany`).\n\n```typescript\nprotected attrs: FactorizedAttrs<User> = {\n  name: faker.name.firstName(),\n  lastName: async () => faker.name.lastName(),\n  email: new InstanceAttribute((instance) =>\n    [instance.name.toLowerCase(), instance.lastName.toLowerCase(), '@email.com'].join(''),\n  ),\n}\n```\n\nIn this simple case, if `name` or `lastName` override the value in any way, the `email` attribute will be affected too.\n\n### `LazyInstanceAttribute`\n\n```typescript\nclass LazyInstanceAttribute<T, V> {\n  constructor(private callback: (entity: T) => V) {}\n\n  ...\n}\n```\n\nClass with similar functionality than `InstanceAttribute`, but it will be executed only after persistance. This is useful for attributes that depends on the database id, like relations.\n\nJust remember that, if you use `make` or `makeMany`, the only difference between `InstanceAttribute` and `LazyInstanceAttribute` is that `LazyInstanceAttribute` will be processed the last.\n\n```typescript\nprotected attrs: FactorizedAttrs<User> = {\n  name: faker.name.firstName(),\n  email: new LazyInstanceAttribute((instance) =>\n    [instance.name.toLowerCase(), instance.id, '@email.com'].join(''),\n  ),\n}\n```\n\n### `Subfactory`\n\n```typescript\nexport class Subfactory<T> {\n  constructor(factory: Constructable<Factory<T>>)\n  constructor(factory: Constructable<Factory<T>>, values?: Partial<FactorizedAttrs<T>>)\n  constructor(factory: Constructable<Factory<T>>, count?: number)\n  constructor(factory: Constructable<Factory<T>>, values?: Partial<FactorizedAttrs<T>>, count?: number)\n\n  ...\n}\n```\n\nSubfactories are just a wrapper of another factory, to avoid explicit operations that could lead to unexpected results over that factory, like\n\n```typescript\nprotected attrs: FactorizedAttrs<User> = {\n  country: async () => new CountryFactory().create({\n    name: faker.address.country(),\n  }),\n}\n```\n\ninstead of\n\n```typescript\nprotected attrs: FactorizedAttrs<User> = {\n  country: new Subfactory(CountryFactory, {\n    name: faker.address.country(),\n  }),\n}\n```\n\nSubfactory just execute the same kind of operation (`make` or `create`) over the factory. If `count` param is provided, it will execute `makeMany`/`createMany` instead of `make`/`create`, and returns an array.\n\n## `make` & `makeMany`\n\nMake and makeMany executes the factory functions and return a new instance of the given entity. The instance is filled with the generated values from the factory function, but not saved in the database.\n\n- **overrideParams** - Override some of the attributes of the entity.\n\n```typescript\nmake(overrideParams: Partial<FactorizedAttrs<T>> = {}): Promise<T>\nmakeMany(amount: number, overrideParams: Partial<FactorizedAttrs<T>> = {}): Promise<T[]>\n```\n\n```typescript\nnew UserFactory().make()\nnew UserFactory().makeMany(10)\n\n// override the email\nnew UserFactory().make({ email: 'other@mail.com' })\nnew UserFactory().makeMany(10, { email: 'other@mail.com' })\n```\n\n## `create` & `createMany`\n\nthe create and createMany method is similar to the make and makeMany method, but at the end the created entity instance gets persisted in the database using TypeORM entity manager.\n\n- **overrideParams** - Override some of the attributes of the entity.\n- **saveOptions** - [Save options](https://github.com/typeorm/typeorm/blob/master/src/repository/SaveOptions.ts) from TypeORM\n\n```typescript\ncreate(overrideParams: Partial<FactorizedAttrs<T>> = {}, saveOptions?: SaveOptions): Promise<T>\ncreateMany(amount: number, overrideParams: Partial<FactorizedAttrs<T>> = {}, saveOptions?: SaveOptions): Promise<T[]>\n```\n\n```typescript\nnew UserFactory().create()\nnew UserFactory().createMany(10)\n\n// override the email\nnew UserFactory().create({ email: 'other@mail.com' })\nnew UserFactory().createMany(10, { email: 'other@mail.com' })\n\n// using save options\nnew UserFactory().create({ email: 'other@mail.com' }, { listeners: false })\nnew UserFactory().createMany(10, { email: 'other@mail.com' }, { listeners: false })\n```\n\n# Seeder\n\nSeeder class is how we provide a way to insert data into databases, and could be executed by the command line or by helper method. Is an abstract class with one method to be implemented, and a helper function to run some more seeder sequentially.\n\n```typescript\nclass UserSeeder extends Seeder {\n  async run(connection: Connection) {\n    ...\n  }\n}\n```\n\n## `run`\n\nThis function is the one that needs to be defined when extending the class. Could use `call` to run some other seeders.\n\n```typescript\nrun(connection: Connection): Promise<void>\n```\n\n```typescript\nasync run(connection: Connection) {\n    await new UserFactory().createMany(10)\n\n    await this.call(connection, [PetSeeder])\n}\n```\n\n# CLI Configuration\n\nThere are two possible commands to execute, one to see the current configuration and one to run a seeder.\n\nAdd the following scripts to your `package.json` file to configure them.\n\n```json\n\"scripts\": {\n  \"seed:run\": \"typeorm-seeding seed\",\n  ...\n}\n```\n\n## `seed`\n\nThis command execute a seeder, that could be specified as a parameter.\n\n```bash\ntypeorm-seeding seed <path>\n```\n\nThe name of the seeder to execute (either set with the `--seed` option or with default in [configs](#configuration)) must be the seeder's class name, and thus, the seeder must be exported with a named export. Please avoid default export for seeders: it may imply unwanted behavior. (See [\\#75](https://github.com/jorgebodega/typeorm-seeding/issues/75)).\n\n##### Options\n\n| Option                 | Default                              | Description                                           |\n| ---------------------- | ------------------------------------ | ----------------------------------------------------- |\n| `--dataSource` or `-d` |                                      | Path of the data source                               |\n\n# Testing features\n\nWe provide some testing features that we already use to test this package, like connection configuration.\nThe entity factories can also be used in testing. To do so call the `useFactories` or `useSeeders` function.\n\n## `useSeeders`\n\nExecute one or more seeders.\n\n```typescript\nuseSeeders(entrySeeders: ClassConstructor<Seeder> | ClassConstructor<Seeder>[]): Promise<void>\nuseSeeders(\n  entrySeeders: ClassConstructor<Seeder> | ClassConstructor<Seeder>[],\n  customOptions: Partial<ConnectionConfiguration>,\n): Promise<void>\n```\n\n## `useDataSource`\n\nUse specific data source on the factories. If the data source is not initialized when provided, can be initialized with the `forceInitialization` flag.\n\n```typescript\nuseDataSource(dataSource: DataSource): Promise<void>\nuseDataSource(dataSource: DataSource, overrideOptions: Partial<DataSourceOptions>): Promise<void>\nuseDataSource(dataSource: DataSource, forceInitialization: boolean): Promise<void>\nuseDataSource(\n  dataSource: DataSource,\n  overrideOptions: Partial<DataSourceOptions>,\n  forceInitialization: boolean,\n): Promise<void>\n```\n","readmeFilename":"README.md"}