{"_id":"@angablue/typeorm-store","name":"@angablue/typeorm-store","dist-tags":{"latest":"3.0.3"},"versions":{"3.0.3":{"name":"@angablue/typeorm-store","version":"3.0.3","description":"A TypeORM-based store for express-session","main":"lib/index.js","typings":"lib/index.d.ts","repository":{"type":"git","url":"git+https://github.com/AngaBlue/typeorm-store.git"},"author":{"name":"AngaBlue","email":"contact@anga.blue"},"license":"MIT","scripts":{"build":"tsc","lint":"eslint . --ext ts --fix"},"peerDependencies":{"express-session":"^1.17.3","typeorm":"^0.3.6"},"devDependencies":{"@angablue/eslint-config":"^1.3.3","@types/express-session":"^1.17.4","@types/node":"^18.0.0","eslint":"^8.18.0","prettier":"^2.7.1","rimraf":"^3.0.2","typeorm":"^0.3.6","typescript":"^4.7.4"},"gitHead":"9f84fe65aab2b04151ed17dd29ec54fbf7a99213","bugs":{"url":"https://github.com/AngaBlue/typeorm-store/issues"},"homepage":"https://github.com/AngaBlue/typeorm-store#readme","_id":"@angablue/typeorm-store@3.0.3","_nodeVersion":"17.9.1","_npmVersion":"8.11.0","dist":{"integrity":"sha512-r2qLuOVioTmmbUEBq8SCBqZGnEr6DnVsl8OELffhlZAKkYMewcMrpGJjSPBlM7mjb2TNk7oR+xIrVysUg4VH0Q==","shasum":"170f856bfbd438a3265cc00f9d2aaeeb01c1eb71","tarball":"https://registry.npmjs.org/@angablue/typeorm-store/-/typeorm-store-3.0.3.tgz","fileCount":9,"unpackedSize":19354,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC8YH4v2SdN5N8LUHtWZDTWuOyIiJwkhrMoTDw7RQqIUAIgQGfexiRB8hTRbBKcu5A1zFRmKuStFxrc5e/l4N/5k3E="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJitTdgACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmoodg//eBkRf25n4Qz2hL+ijJvzcXbq0MjCmqEbbog3WU6HsJhhrwLU\r\nUbnWYYPfKDPu0Tw86Po71GetNeTk9E2VRdip7gsguFQkUDnd81TSgJ+uJ0AB\r\ncbDJazuEmoVmdu/Ub+/CQ0YTKtpEAWM1KEI068Lwpuv90bVDs5zNTyRdb7DR\r\nCgPtTRBYL+BDfxmfFfZiVlP2xquEgpGlkAD82keCcM4reo7hM7qbfOq4Wv08\r\nuAHV2AnTUGs+DBmrQxturEbXGc7eQjquYksVPu5fNuVY+FmcKJ6jdwXoC5ZR\r\nbBm2pOZav3Ir8Pd/+sIYfhaDY8MZGN0evEpagi34Lu37d0IjT/jeqocldOm7\r\nK8Rz7qZ+7JIo1P7UUSKiwuylLJ0k88rDxPiURQ1cLzoMxuBZS6j/jG7GTQbD\r\nU797Oek5JTBgDQrR+kbAn/aMmlvwZu6ZspqO3rYOrSsln4IRnaKp57Zh1sWp\r\nYuH8JUGSWek1YSMD1Uy4mPKEJ9p1u3pq8MFM5T3flN/29VzZ2LK+x1Ljpzvd\r\n5ySCXFRkWfijnKA/TQ2a53hCQ2nxUzIp6Ue8qlZuvoTamfFo3i9tY02j/WwS\r\n+blLsEbtAU7N4izqcV37a+qOAwE+t6FN2y5Iao1DeCchneFSMctfVYNLpvH3\r\nmhcNehH06IyzWaOFjZbhQJIb4UdKS9X4Du8=\r\n=bKJy\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"angablue","email":"contact@anga.blue"},"directories":{},"maintainers":[{"name":"angablue","email":"contact@anga.blue"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/typeorm-store_3.0.3_1656043360237_0.1955250335158374"},"_hasShrinkwrap":false}},"time":{"created":"2022-06-24T04:02:40.166Z","3.0.3":"2022-06-24T04:02:40.450Z","modified":"2022-06-24T04:02:40.616Z"},"maintainers":[{"name":"angablue","email":"contact@anga.blue"}],"description":"A TypeORM-based store for express-session","homepage":"https://github.com/AngaBlue/typeorm-store#readme","repository":{"type":"git","url":"git+https://github.com/AngaBlue/typeorm-store.git"},"author":{"name":"AngaBlue","email":"contact@anga.blue"},"bugs":{"url":"https://github.com/AngaBlue/typeorm-store/issues"},"license":"MIT","readme":"# typeorm-store\nA TypeORM-based store for [express-session](https://github.com/expressjs/session).\n\n## Installation\n```bash\n$ pnpm install typeorm-store\n```\n\n## Usage\nFirst, make a new `Session` entity. Make sure to synchronize the entity to the database. `typeorm-store` will not to this for you.\n```typescript\nimport { BaseEntity, Column, Entity, PrimaryColumn } from 'typeorm';\nimport { SessionEntity } from 'typeorm-store';\n\n@Entity()\nexport class Session extends BaseEntity implements SessionEntity {\n    @PrimaryColumn()\n    id: string;\n\n    @Column()\n    expiresAt: number;\n\n    @Column()\n    data: string;\n}\n```\n\nUse `TypeormStore` as store in `express-session`, specifying the repository of the new `Session` entity.\n```typescript\nimport * as express from 'express';\nimport * as session from 'express-session';\nimport { getConnection } from 'typeorm';\nimport { TypeormStore } from 'typeorm-store';\nimport { Session } from './entities/session';\n\nconst app = express();\n\n// Make sure the connection is ready before doing this\nconst repository = getConnection().getRepository(Session);\n\napp.use(session({\n   secret: 'secret',\n   resave: false,\n   saveUninitialized: false,\n   store: new TypeormStore({ repository })\n}))\n```\n\n# API\n`new TypeormStore(options)`\n\n## Options\n* `repository` (required) - The repository of the session entity.\n* `ttl` (optional) - The time to live for the session in milliseconds. Defaults to 86400000 (1 day).\n","readmeFilename":"README.md"}