{"id":16206929,"url":"https://github.com/ericvera/firestore-snapshot-utils","last_synced_at":"2025-03-19T07:31:37.168Z","repository":{"id":257814188,"uuid":"869248831","full_name":"ericvera/firestore-snapshot-utils","owner":"ericvera","description":"Utils for testing Firestore DB snapshots","archived":false,"fork":false,"pushed_at":"2025-02-26T03:31:29.000Z","size":2450,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-17T04:43:29.395Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/ericvera.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-08T01:24:34.000Z","updated_at":"2025-02-26T03:31:32.000Z","dependencies_parsed_at":"2024-10-08T01:45:33.825Z","dependency_job_id":"9215ac46-9d49-4b9e-9bf7-9eeace9ee3fc","html_url":"https://github.com/ericvera/firestore-snapshot-utils","commit_stats":null,"previous_names":["ericvera/firestore-snapshot-utils"],"tags_count":5,"template":false,"template_full_name":"ericvera/ts-lib-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericvera%2Ffirestore-snapshot-utils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericvera%2Ffirestore-snapshot-utils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericvera%2Ffirestore-snapshot-utils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericvera%2Ffirestore-snapshot-utils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ericvera","download_url":"https://codeload.github.com/ericvera/firestore-snapshot-utils/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244379242,"owners_count":20443422,"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":[],"created_at":"2024-10-10T10:08:57.716Z","updated_at":"2025-03-19T07:31:37.157Z","avatar_url":"https://github.com/ericvera.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Firestore Snapshot Utils\n\n**Utils for testing Firestore DB snapshots**\n\n[![github license](https://img.shields.io/github/license/ericvera/firestore-snapshot-utils.svg?style=flat-square)](https://github.com/ericvera/firestore-snapshot-utils/blob/master/LICENSE)\n[![npm version](https://img.shields.io/npm/v/firestore-snapshot-utils.svg?style=flat-square)](https://npmjs.org/package/firestore-snapshot-utils)\n\nA lightweight utility library for testing Firestore database snapshots, making it easier to track and verify changes in your Firestore collections.\n\n## Features\n\n- **Snapshot Retrieval**: Get snapshots from single or multiple Firestore queries\n- **Change Detection**: Track document additions, removals, and modifications\n- **Timestamp Normalization**: Consistent representation of Firestore timestamps for reliable comparisons\n- **Property Masking**: Mask sensitive or variable properties (e.g., IDs, timestamps) for deterministic testing\n- **Diff Generation**: Generate human-readable diffs of database changes\n- **TypeScript Support**: Full TypeScript support with strict type checking\n\n## Usage\n\n```typescript\nimport {\n  getDBSnapshot,\n  getDBSnapshotChanges,\n  getDiffFromDBSnapshotChanges,\n} from 'firestore-snapshot-utils'\n\n// Get snapshots before changes\nconst beforeDocs = await getDBSnapshot(beforeQuery)\n\n// Perform tests...\n\n// Get snapshots after changes\nconst afterDocs = await getDBSnapshot(afterQuery)\n\n// Compare snapshots and get changes\nconst changes = getDBSnapshotChanges(beforeDocs, afterDocs, {\n  // Optional: mask sensitive fields by collection\n  users: ['id', 'createdAt'],\n})\n\n// Generate human-readable diff. This can be used with expect.toMatchInlineSnapshot('\u003cdiff content\u003e')\nconsole.log(getDiffFromDBSnapshotChanges(changes))\n```\n\n# API Reference\n\nSee [docs](docs/README.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fericvera%2Ffirestore-snapshot-utils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fericvera%2Ffirestore-snapshot-utils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fericvera%2Ffirestore-snapshot-utils/lists"}