{"_id":"@cristobalgvera/nestjs-firestore","_rev":"3-2be4c3e61b5ee6059a6d087462800dc3","name":"@cristobalgvera/nestjs-firestore","dist-tags":{"latest":"0.0.5"},"versions":{"0.0.2":{"name":"@cristobalgvera/nestjs-firestore","version":"0.0.2","author":{"name":"Cristóbal Gajardo Vera","email":"cristobalgajardo.v@gmail.com"},"description":"Use Firestore with NestJS using injectable collection services","private":false,"license":"MIT","main":"dist/index.js","types":"dist/index.d.ts","peerDependencies":{"@google-cloud/firestore":"^6.0.0","@nestjs/common":"^9.0.0","reflect-metadata":"^0.1.0","rxjs":"^7.0.0"},"devDependencies":{"@automock/jest":"^1.1.0","@changesets/cli":"^2.26.1","@golevelup/ts-jest":"^0.3.7","@nestjs/cli":"^9.5.0","@nestjs/schematics":"^9.2.0","@nestjs/testing":"^9.4.2","@types/express":"^4.17.17","@types/jest":"29.5.2","@types/node":"^20.2.5","@typescript-eslint/eslint-plugin":"^5.59.9","@typescript-eslint/parser":"^5.59.9","eslint":"^8.42.0","eslint-config-prettier":"^8.8.0","eslint-plugin-jest":"^27.2.1","eslint-plugin-prettier":"^4.2.1","husky":"^8.0.3","jest":"29.5.0","lint-staged":"^13.2.2","prettier":"^2.8.8","rimraf":"^5.0.1","source-map-support":"^0.5.21","ts-jest":"29.1.0","ts-loader":"^9.4.3","ts-node":"^10.9.1","tsconfig-paths":"4.2.0","typescript":"^5.1.3"},"keywords":["nestjs"],"repository":{"type":"git","url":"git+https://github.com/cristobalgvera/nestjs-firestore.git"},"homepage":"https://github.com/cristobalgvera/nestjs-firestore","scripts":{"release":"pnpm run prebuild && pnpm run build && changeset publish","prebuild":"rimraf dist","build":"nest build","format":"prettier --check --ignore-unknown --write","format:all":"npm run format -- .","lint":"eslint --fix","lint:all":"npm run lint -- \"{src,apps,libs,test}/**/*.ts\"","test":"jest","test:watch":"jest --watch","test:cov":"jest --coverage","test:debug":"node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand"},"bugs":{"url":"https://github.com/cristobalgvera/nestjs-firestore/issues"},"_id":"@cristobalgvera/nestjs-firestore@0.0.2","_integrity":"sha512-j8z8Zv0AzWEsIA42UF3WBFzcdb54g8R5/rcKY9TuvLXqJ4p3hlJB0S/s6NOhoqYFQZnFTxSl1ehxBKkrJHNNpw==","_resolved":"/tmp/d51b5a43e4c78f1865ccba0af9539c77/cristobalgvera-nestjs-firestore-0.0.2.tgz","_from":"file:cristobalgvera-nestjs-firestore-0.0.2.tgz","_nodeVersion":"18.16.0","_npmVersion":"9.5.1","dist":{"integrity":"sha512-j8z8Zv0AzWEsIA42UF3WBFzcdb54g8R5/rcKY9TuvLXqJ4p3hlJB0S/s6NOhoqYFQZnFTxSl1ehxBKkrJHNNpw==","shasum":"b0c43294bedf4722d98cf1795543eec864e48762","tarball":"https://registry.npmjs.org/@cristobalgvera/nestjs-firestore/-/nestjs-firestore-0.0.2.tgz","fileCount":53,"unpackedSize":19157,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDtz0qdTsP+IoW9wSP+erdurQLsQrc3GR/hRFiagmUJIAiEAs2TPLlFvaFG+0mUFHWKHAohV2nq4wHabAe/6krbU13c="}]},"_npmUser":{"name":"cristobalgvera","email":"cristobalgajardo.v@gmail.com"},"directories":{},"maintainers":[{"name":"cristobalgvera","email":"cristobalgajardo.v@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/nestjs-firestore_0.0.2_1686032320033_0.8641704083106805"},"_hasShrinkwrap":false},"0.0.3":{"name":"@cristobalgvera/nestjs-firestore","version":"0.0.3","author":{"name":"Cristóbal Gajardo Vera","email":"cristobalgajardo.v@gmail.com"},"description":"Use Firestore with NestJS using injectable collection services","private":false,"license":"MIT","main":"dist/index.js","types":"dist/index.d.ts","peerDependencies":{"@google-cloud/firestore":"^6.0.0","@nestjs/common":"^9.0.0","reflect-metadata":"^0.1.0","rxjs":"^7.0.0"},"devDependencies":{"@automock/jest":"^1.1.0","@changesets/cli":"^2.26.1","@golevelup/ts-jest":"^0.3.7","@nestjs/cli":"^9.5.0","@nestjs/schematics":"^9.2.0","@nestjs/testing":"^9.4.2","@types/express":"^4.17.17","@types/jest":"29.5.2","@types/node":"^20.2.5","@typescript-eslint/eslint-plugin":"^5.59.9","@typescript-eslint/parser":"^5.59.9","eslint":"^8.42.0","eslint-config-prettier":"^8.8.0","eslint-plugin-jest":"^27.2.1","eslint-plugin-prettier":"^4.2.1","husky":"^8.0.3","jest":"29.5.0","lint-staged":"^13.2.2","prettier":"^2.8.8","rimraf":"^5.0.1","source-map-support":"^0.5.21","ts-jest":"29.1.0","ts-loader":"^9.4.3","ts-node":"^10.9.1","tsconfig-paths":"4.2.0","typescript":"^5.1.3"},"keywords":["nestjs"],"repository":{"type":"git","url":"git+https://github.com/cristobalgvera/nestjs-firestore.git"},"homepage":"https://github.com/cristobalgvera/nestjs-firestore","scripts":{"release":"pnpm run prebuild && pnpm run build && changeset publish","prebuild":"rimraf dist","build":"nest build","format":"prettier --check --ignore-unknown --write","format:all":"npm run format -- .","lint":"eslint --fix","lint:all":"npm run lint -- \"{src,apps,libs,test}/**/*.ts\"","test":"jest","test:watch":"jest --watch","test:cov":"jest --coverage","test:debug":"node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand"},"bugs":{"url":"https://github.com/cristobalgvera/nestjs-firestore/issues"},"_id":"@cristobalgvera/nestjs-firestore@0.0.3","_integrity":"sha512-8Xk+tgeB71W8Z+rcl9g5NS0RetmdauWQHqcNnr7FkgqCnB68u5TjVsJnX7bbGSgzcRICXiFiGgQIzhOzTZbNpg==","_resolved":"/tmp/c95a202b3fedd344504cd06aa3783410/cristobalgvera-nestjs-firestore-0.0.3.tgz","_from":"file:cristobalgvera-nestjs-firestore-0.0.3.tgz","_nodeVersion":"18.16.0","_npmVersion":"9.5.1","dist":{"integrity":"sha512-8Xk+tgeB71W8Z+rcl9g5NS0RetmdauWQHqcNnr7FkgqCnB68u5TjVsJnX7bbGSgzcRICXiFiGgQIzhOzTZbNpg==","shasum":"24fd7c07d82344168c332f4e3daf0aeedb78482e","tarball":"https://registry.npmjs.org/@cristobalgvera/nestjs-firestore/-/nestjs-firestore-0.0.3.tgz","fileCount":53,"unpackedSize":19451,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCcIWAyAAlCARyXK9kcxqnOc/7TVZDolY4nzeMn52n0jAIgIeXS8MajuNMafysDX3CWmy9LjPYV6fwxT797kvJ1+bY="}]},"_npmUser":{"name":"cristobalgvera","email":"cristobalgajardo.v@gmail.com"},"directories":{},"maintainers":[{"name":"cristobalgvera","email":"cristobalgajardo.v@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/nestjs-firestore_0.0.3_1686068501039_0.34834102293569225"},"_hasShrinkwrap":false},"0.0.4":{"name":"@cristobalgvera/nestjs-firestore","version":"0.0.4","author":{"name":"Cristóbal Gajardo Vera","email":"cristobalgajardo.v@gmail.com"},"description":"Use Firestore with NestJS using injectable collection services","private":false,"license":"MIT","main":"dist/index.js","types":"dist/index.d.ts","peerDependencies":{"@google-cloud/firestore":"^6.0.0","@nestjs/common":"^10.0.0 || ^9.0.0","reflect-metadata":"^0.1.0","rxjs":"^7.0.0"},"devDependencies":{"@automock/jest":"^1.2.0","@changesets/cli":"^2.26.1","@golevelup/ts-jest":"^0.3.7","@nestjs/cli":"^10.0.3","@nestjs/schematics":"^10.0.1","@nestjs/testing":"^10.0.2","@types/express":"^4.17.17","@types/jest":"29.5.2","@types/node":"^20.3.1","@typescript-eslint/eslint-plugin":"^5.60.0","@typescript-eslint/parser":"^5.60.0","eslint":"^8.43.0","eslint-config-prettier":"^8.8.0","eslint-plugin-jest":"^27.2.2","eslint-plugin-prettier":"^4.2.1","husky":"^8.0.3","jest":"29.5.0","lint-staged":"^13.2.2","prettier":"^2.8.8","rimraf":"^5.0.1","source-map-support":"^0.5.21","ts-jest":"29.1.0","ts-loader":"^9.4.3","ts-node":"^10.9.1","tsconfig-paths":"4.2.0","typescript":"^5.1.3"},"keywords":["nestjs"],"repository":{"type":"git","url":"git+https://github.com/cristobalgvera/nestjs-firestore.git"},"homepage":"https://github.com/cristobalgvera/nestjs-firestore","scripts":{"release":"pnpm run prebuild && pnpm run build && changeset publish","prebuild":"rimraf dist","build":"nest build","format":"prettier --check --ignore-unknown --write","format:all":"npm run format -- .","lint":"eslint --fix","lint:all":"npm run lint -- \"{src,apps,libs,test}/**/*.ts\"","test":"jest","test:watch":"jest --watch","test:cov":"jest --coverage","test:debug":"node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand"},"bugs":{"url":"https://github.com/cristobalgvera/nestjs-firestore/issues"},"_id":"@cristobalgvera/nestjs-firestore@0.0.4","_integrity":"sha512-tBoHgq7LUDF9ecXsaeWfYJJgJA3bwmQjPnAuRtnGGecyXVl+Zj6JEYjitetBHfQ4SNRz6hyTkgTGjSqDvIvyww==","_resolved":"/tmp/e02aa13a745951cf7fe6dc9aa21ab0fe/cristobalgvera-nestjs-firestore-0.0.4.tgz","_from":"file:cristobalgvera-nestjs-firestore-0.0.4.tgz","_nodeVersion":"18.16.0","_npmVersion":"9.5.1","dist":{"integrity":"sha512-tBoHgq7LUDF9ecXsaeWfYJJgJA3bwmQjPnAuRtnGGecyXVl+Zj6JEYjitetBHfQ4SNRz6hyTkgTGjSqDvIvyww==","shasum":"b319353b51b946b39d39a2f80254db70a312570d","tarball":"https://registry.npmjs.org/@cristobalgvera/nestjs-firestore/-/nestjs-firestore-0.0.4.tgz","fileCount":53,"unpackedSize":19465,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDZ72VzAJDfPRKHT0fE0hMdiWNSpmoxCiXUfpv6bJZsdgIgQzcSchpJM6J9CwfVdKnsQ8pq/1RLTLpo1Lk34HUEYyw="}]},"_npmUser":{"name":"cristobalgvera","email":"cristobalgajardo.v@gmail.com"},"directories":{},"maintainers":[{"name":"cristobalgvera","email":"cristobalgajardo.v@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/nestjs-firestore_0.0.4_1687314019761_0.29866030814913835"},"_hasShrinkwrap":false},"0.0.5":{"name":"@cristobalgvera/nestjs-firestore","version":"0.0.5","author":{"name":"Cristóbal Gajardo Vera","email":"cristobalgajardo.v@gmail.com"},"description":"Use Firestore with NestJS using injectable collection services","private":false,"license":"MIT","main":"dist/index.js","types":"dist/index.d.ts","peerDependencies":{"@google-cloud/firestore":"^6.0.0","@nestjs/common":"^10.0.0 || ^9.0.0","reflect-metadata":"^0.1.0","rxjs":"^7.0.0"},"devDependencies":{"@automock/jest":"^1.2.0","@changesets/cli":"^2.26.1","@golevelup/ts-jest":"^0.3.7","@nestjs/cli":"^10.0.3","@nestjs/schematics":"^10.0.1","@nestjs/testing":"^10.0.2","@types/express":"^4.17.17","@types/jest":"29.5.2","@types/node":"^20.3.1","@typescript-eslint/eslint-plugin":"^5.60.0","@typescript-eslint/parser":"^5.60.0","eslint":"^8.43.0","eslint-config-prettier":"^8.8.0","eslint-plugin-jest":"^27.2.2","eslint-plugin-prettier":"^4.2.1","husky":"^8.0.3","jest":"29.5.0","lint-staged":"^13.2.2","prettier":"^2.8.8","rimraf":"^5.0.1","source-map-support":"^0.5.21","ts-jest":"29.1.0","ts-loader":"^9.4.3","ts-node":"^10.9.1","tsconfig-paths":"4.2.0","typescript":"^5.1.3"},"keywords":["nestjs"],"repository":{"type":"git","url":"git+https://github.com/cristobalgvera/nestjs-firestore.git"},"homepage":"https://github.com/cristobalgvera/nestjs-firestore","scripts":{"release":"pnpm run prebuild && pnpm run build && changeset publish","prebuild":"rimraf dist","build":"nest build","format":"prettier --check --ignore-unknown --write","format:all":"npm run format -- .","lint":"eslint --fix","lint:all":"npm run lint -- \"{src,apps,libs,test}/**/*.ts\"","test":"jest","test:watch":"jest --watch","test:cov":"jest --coverage","test:debug":"node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand"},"bugs":{"url":"https://github.com/cristobalgvera/nestjs-firestore/issues"},"_id":"@cristobalgvera/nestjs-firestore@0.0.5","_integrity":"sha512-CaP2AELVddd5L85xg/yDyg6HW47LbJg/AOhp7dBg6kUraYs/1vh0sgoM9UWjvXLSo5jJYwroPaR0yELEYhuh7Q==","_resolved":"/tmp/40b294e3930d3750739fd6128fcf247e/cristobalgvera-nestjs-firestore-0.0.5.tgz","_from":"file:cristobalgvera-nestjs-firestore-0.0.5.tgz","_nodeVersion":"18.16.0","_npmVersion":"9.5.1","dist":{"integrity":"sha512-CaP2AELVddd5L85xg/yDyg6HW47LbJg/AOhp7dBg6kUraYs/1vh0sgoM9UWjvXLSo5jJYwroPaR0yELEYhuh7Q==","shasum":"b26a7d8698121cede4f7094a45618e9662d2224e","tarball":"https://registry.npmjs.org/@cristobalgvera/nestjs-firestore/-/nestjs-firestore-0.0.5.tgz","fileCount":53,"unpackedSize":22276,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDe2hMgmizSsf9duO3pJdkF9PXx54dub/IAn7o1cs3mXwIgWb3LhTQZnFurbr4qR4AUP3RC8/DQHGGEUlKU9NqqUlY="}]},"_npmUser":{"name":"cristobalgvera","email":"cristobalgajardo.v@gmail.com"},"directories":{},"maintainers":[{"name":"cristobalgvera","email":"cristobalgajardo.v@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/nestjs-firestore_0.0.5_1687316590841_0.9621915554701543"},"_hasShrinkwrap":false}},"time":{"created":"2023-06-06T06:18:39.973Z","0.0.2":"2023-06-06T06:18:40.190Z","modified":"2023-06-21T03:03:11.102Z","0.0.3":"2023-06-06T16:21:41.223Z","0.0.4":"2023-06-21T02:20:19.954Z","0.0.5":"2023-06-21T03:03:10.988Z"},"maintainers":[{"name":"cristobalgvera","email":"cristobalgajardo.v@gmail.com"}],"description":"Use Firestore with NestJS using injectable collection services","homepage":"https://github.com/cristobalgvera/nestjs-firestore","keywords":["nestjs"],"repository":{"type":"git","url":"git+https://github.com/cristobalgvera/nestjs-firestore.git"},"author":{"name":"Cristóbal Gajardo Vera","email":"cristobalgajardo.v@gmail.com"},"bugs":{"url":"https://github.com/cristobalgvera/nestjs-firestore/issues"},"license":"MIT","readme":"# NestJS Firebase\n\n<p align=\"center\">\n  <a href=\"http://nestjs.com/\" target=\"blank\">\n    <img src=\"https://nestjs.com/img/logo-small.svg\" width=\"200\" alt=\"Nest Logo\" />\n  </a>\n</p>\n\nThis project helps you to use your Firestore collections in a well known way,\nsimilar\\* to how TypeORM lets you to handle your tables.\n\nThe principal benefits are:\n\n- Model your collections using classes (similar on how ORMs works).\n- Simplify the testing of the Firestore SDK.\n\n_\\*This is NOT an ORM._\n\n## Installation\n\nIn order to install this package simply run the following command.\n\n```bash\nnpm install @cristobalgvera/nestjs-firestore\n```\n\n## Usage\n\nThe simplest way to use it is the following:\n\n1. Import the `FirestoreModule#forRoot` into your main module.\n\n   ```ts\n   import { FirestoreModule } from '@cristobalgvera/nestjs-firestore';\n   import { Module } from '@nestjs/common';\n\n   @Module({\n     imports: [\n       FirestoreModule.forRootAsync({\n         useFactory: (environmentService: EnvironmentService) => ({\n           // You can define custom properties here, see https://github.com/googleapis/nodejs-firestore\n           projectId: 'firebase-project-id',\n         }),\n       }),\n     ],\n   })\n   export class AppModule {}\n   ```\n\n1. Define your model (currently only classes are supported).\n\n   ```ts\n   export class User {\n     name: string;\n     age: number;\n   }\n   ```\n\n1. Import the `FirestoreModule#forFeature` into your feature module.\n\n   ```ts\n   import { FirestoreModule } from '@cristobalgvera/nestjs-firestore';\n   import { Module } from '@nestjs/common';\n   import { User } from './user.collection';\n\n   @Module({\n     imports: [\n       FirestoreModule.forFeature([\n         { collection: User, path: 'path-to-your-collection' },\n       ]),\n     ],\n   })\n   export class UserModule {}\n   ```\n\n1. Inject the collection into your services using the `InjectCollection` decorator\n   and the `FirestoreCollection` type. The `FirestoreCollection` needs a generic\n   class (soon type or interface too) in order to type your collection.\n\n   The `FirestoreCollection` is a wrapper on top of the `CollectionReference` type\n   provided by `@google-cloud/firestore`, so you can use the entire API, but it\n   will provide correct typing based in the collection class.\n\n   ```ts\n   import {\n     FirestoreCollection,\n     InjectCollection,\n   } from '@cristobalgvera/nestjs-firestore';\n   import { Injectable } from '@nestjs/common';\n   import { User } from './user.collection';\n\n   @Injectable()\n   export class UserService {\n     constructor(\n       @InjectCollection(User)\n       private readonly userCollection: FirestoreCollection<User>,\n     ) {}\n\n     saveUser({ name, age }: SaveUserDto) {\n       return this.userCollection.add({ name, age });\n     }\n   }\n   ```\n\n1. Test it using the `getCollectionToken` to get the token used to inject the collection\n   in the service.\n\n   ```ts\n   import { TestBed } from '@automock/jest';\n   import {\n     FirestoreCollection,\n     getCollectionToken,\n   } from '@cristobalgvera/nestjs-firestore';\n   import { User } from './user.collection';\n   import { UserService } from './user.service';\n\n   describe('UserService', () => {\n     let underTest: UserService;\n     let userCollection: FirestoreCollection<User>;\n\n     beforeEach(() => {\n       // Don't focus on how to create the context of the test\n       const { unit, unitRef } = TestBed.create(UserService).compile();\n       underTest = unit;\n\n       userCollection = unitRef.get(getCollectionToken(User)); // <-- THIS IS THE IMPORTANT PART\n     });\n\n     /* Your tests here... */\n   });\n   ```\n","readmeFilename":"README.md"}