{"id":20668669,"url":"https://github.com/coturiv/simplyfire","last_synced_at":"2025-04-19T18:07:56.445Z","repository":{"id":40354809,"uuid":"398440714","full_name":"coturiv/simplyfire","owner":"coturiv","description":"A lightweight firestore wrapper for the firebase cloud functions \u0026 Angular apps.","archived":false,"fork":false,"pushed_at":"2022-10-22T18:38:15.000Z","size":1236,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-13T23:23:05.485Z","etag":null,"topics":["angular","firebase","firestore"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/simplyfire","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/coturiv.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-08-21T01:41:40.000Z","updated_at":"2022-03-13T13:51:53.000Z","dependencies_parsed_at":"2022-08-03T04:46:17.639Z","dependency_job_id":null,"html_url":"https://github.com/coturiv/simplyfire","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coturiv%2Fsimplyfire","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coturiv%2Fsimplyfire/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coturiv%2Fsimplyfire/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coturiv%2Fsimplyfire/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coturiv","download_url":"https://codeload.github.com/coturiv/simplyfire/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249758229,"owners_count":21321476,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["angular","firebase","firestore"],"created_at":"2024-11-16T20:10:45.625Z","updated_at":"2025-04-19T18:07:56.402Z","avatar_url":"https://github.com/coturiv.png","language":"TypeScript","readme":"# simplyfire\n\nA lightweight firestore api for firebase cloud functions \u0026 Angular.\n\n![](https://github.com/coturiv/simplyfire/workflows/Build/badge.svg)\n[![npm version](https://img.shields.io/npm/v/simplyfire.svg)](https://www.npmjs.com/package/simplyfire)\n[![Codacy Badge](https://app.codacy.com/project/badge/Grade/59e264bce65b40e2b019edcdee9509f2)](https://www.codacy.com/gh/coturiv/simplyfire/dashboard?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=coturiv/simplyfire\u0026amp;utm_campaign=Badge_Grade)\n\n## Installation\n\nTo use the library, install it via `npm` or `yarn`:\n\n```bash\n# To get the latest stable version in dependencies\n\n$ npm install simplyfire --save\n\n# Or\n\n$ yarn add simplyfire\n```\n\n### Usage\n\n```\n\n// in the firebase cloud functions\n\nimport * as admin from 'firebase-admin';\nimport * as functions from 'firebase-functions';\nimport { FirestoreCloudService, QueryBuilder } from 'simplyfire';\n\nconst fsService = FirestoreCloudService.getInstance(admin);\n\nexport const purgeUnusedUsers = functions.pubsub.schedule('every 24 hours').onRun(async () =\u003e {\n  const qb = new QueryBuilder();\n  qb.where('isEmailVerified', '==', false);\n  qb.where('lastSignInTime', '\u003c', new Date(Date.now() - 60 * 24 * 60 * 60 * 1000));\n\n  return fsService.bulkDelete('users', qb);\n});\n\n\n// in the client (with Angular)\n\nimport { QueryBuilder } from 'simplyfire';\nimport { FirebaseService } from 'simplyfire/ngx';\n\n@Injectable({\n  providedIn: 'root'\n})\nexport class UserService {\n\n    constructor(private firebaseService: FirebaseService) {}\n\n    async getUsers() {\n        const qb = new QueryBuilder();\n        qb.where('isEmailVerified', '==', true);\n        qb.limit(20);\n\n        qb.leftJoin('companyId', 'companies', 'company');\n        qb.leftJoin('lastPostId', 'posts', 'post');\n\n        return await this.firebaseService.collection(`users`, qb);\n    }\n}\n\n```\n\n### Firestore API\n\n| API | DESCRIPTION |\n| ------ | ------ |\n| `collection\u003cT\u003e(collection: string, qb?: QueryBuilder, maxAge?: number): Promise\u003cT[]\u003e` |  Get documents from the firestore. |\n| `collectionGroup\u003cT\u003e(collectionId: string, qb?: QueryBuilder, maxAge?: number): Promise\u003cT[]\u003e` |  Get documents from the firestore(collectionGroup). |\n| `collectionSnapshotChanges\u003cT\u003e(collection: string, qb?: QueryBuilder, events?: DocumentChangeType[]): Observable\u003cT[]\u003e` |  Get documents from the firestore (*Client only*). |\n| `collectionValueChanges\u003cT\u003e(collection: string, qb?: QueryBuilder): Observable\u003cT[]\u003e` |  Get documents from the firestore (*Client only*). |\n| `doc\u003cT = any\u003e(docPath: string, maxAge?: number): Promise\u003cT\u003e` | Get a document data from the firstore. |\n| `docValueChanges\u003cT\u003e(docPath: string): Observable\u003cT\u003e` | Get a document data from the firstore (*Client only*). |\n| `upsert(collection: string, data: { id?: string; [key: string]: any }, opts?: SetOptions): Promise\u003cstring\u003e` | Insert/or update document. (If data includes `id`, it's an update operation, otherwise inserts a document) |\n| `update(docPath: string, data: { [key: string]: any }): Promise\u003cvoid\u003e` | Update a document. (The `path` must includes document `id`.) |\n| `delete(docPath: string): Promise\u003cvoid\u003e` | Delete a document. |\n| `bulkUpsert(collection: string, docs: DocumentData[], opts?: SetOptions): Promise\u003cvoid\u003e` | Upsert bulk documents. (`batch` writes) |\n| `bulkDelete(collection: string, qb?: QueryBuilder): Promise\u003cnumber\u003e` | Delete bulk documents. (`batch` deletes) |\n| `increment(n?: number): FieldValue` | Firestore Increment. |\n| `get batch(): WriteBatch` | Getter of Firestore batch. |\n| `get serverTimestamp(): FieldValue` | Getter of Firestore timestamp. |\n","funding_links":[],"categories":["Framework Interoperability"],"sub_categories":["Wrappers"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoturiv%2Fsimplyfire","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoturiv%2Fsimplyfire","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoturiv%2Fsimplyfire/lists"}