{"id":16767209,"url":"https://github.com/j-mendez/dfirestore","last_synced_at":"2025-04-10T19:13:20.265Z","repository":{"id":43045667,"uuid":"380717563","full_name":"j-mendez/dfirestore","owner":"j-mendez","description":"a deno Firestore client","archived":false,"fork":false,"pushed_at":"2022-04-23T15:50:18.000Z","size":38,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-24T16:56:05.151Z","etag":null,"topics":["deno","deno-firestore","firebase","firebase-firestore","firestore","firestore-client"],"latest_commit_sha":null,"homepage":"https://deno.land/x/dfirestore","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/j-mendez.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-06-27T11:02:14.000Z","updated_at":"2023-11-14T17:33:01.000Z","dependencies_parsed_at":"2022-09-01T08:50:49.308Z","dependency_job_id":null,"html_url":"https://github.com/j-mendez/dfirestore","commit_stats":null,"previous_names":[],"tags_count":38,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j-mendez%2Fdfirestore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j-mendez%2Fdfirestore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j-mendez%2Fdfirestore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j-mendez%2Fdfirestore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/j-mendez","download_url":"https://codeload.github.com/j-mendez/dfirestore/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248103915,"owners_count":21048245,"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":["deno","deno-firestore","firebase","firebase-firestore","firestore","firestore-client"],"created_at":"2024-10-13T06:08:39.049Z","updated_at":"2025-04-10T19:13:20.241Z","avatar_url":"https://github.com/j-mendez.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dfirestore\n\n![test workflow](https://github.com/j-mendez/dfirestore/actions/workflows/test.yml/badge.svg)\n[![Maintainability](https://api.codeclimate.com/v1/badges/ed5ddd5e541f49f61382/maintainability)](https://codeclimate.com/github/j-mendez/dfirestore/maintainability)\n\na deno [Firestore](https://firebase.google.com/docs/firestore) REST client\n\n## Usage\n\nTo get started with the package you can either setup the application with your tokens or authenticate with one of the helpers.\nAfter you authenticate you can freely use the REST client and your access tokens will rotate before they expire.\nFor examples of values to use when perform creates/updates can be found at [Firestore Value Docs](https://firebase.google.com/docs/firestore/reference/rest/v1/Value)\n\n### Configuration\n\nAll pre-configuration settings are optional and can be set via env variables. You should use `setProjectID` to establish your project if you are going to use the same one for every request. Make sure to start deno with the following `--allow-env --allow-read --unstable --allow-run --allow-net=firestore.googleapis.com,identitytoolkit.googleapis.com` to allow network request to firestore.\n\n```typescript\nimport {\n  setDatabase,\n  setToken,\n  setProjectID,\n  setProjectKey,\n  setTokenFromServiceAccount,\n  setTokenFromEmailPassword,\n} from \"https://deno.land/x/dfirestore/mod.ts\";\n\n// Optional: If GoogleService-Info.plist and gcloud installed on machine run to get service token\nsetTokenFromServiceAccount();\n// Optional: If Email and Password secret shared. Optional params when using env variables\nsetTokenFromEmailPassword(\n  {\n    email: \"someemail@something.com\",\n    password: \"something\",\n  },\n  true // background refresh token before expiration\n);\n// Optional: Manually set authentication from access token (jwt)\nsetToken(\"someidtoken\");\n\n// Optional: set db\nsetDatabase(\"(default)\");\n// Optional: set global project id for all request - nice to use.\nsetProjectID(\"my_project_id\");\n// Optional: set project web key or use the env FIREBASE_PROJECT_KEY\nsetProjectKey(\"mywebprojectkey\");\n```\n\n### Client\n\nUse the REST client below via the following methods to perform CRUD operations.\n\n```typescript\nimport { firestore } from \"https://deno.land/x/dfirestore/mod.ts\";\n\n// add new document: Check firebase param values for list key types ex (stringValue).\nawait firestore.createDocument({\n  collection: \"users\",\n  id: \"L0xO1Yri80WlrFSw6KxqccHhKhv2\",\n  value: { firstname: { stringValue: \"Jeff\" } },\n});\n// get document in collection by id\nawait firestore.getDocument({\n  collection: \"users\",\n  id: \"L0xO1Yri80WlrFSw6KxqccHhKhv2\",\n});\n// get document collection list\nawait firestore.getDocument({\n  collection: \"users\",\n  pageSize: 10, // optional: page limit\n  pageToken: \"thepagetokenfornextpage\", // optional: page token to get the next page\n  orderBy: \"desc\", // optional: order desc, key, etc\n  showMissing: false, // optional: show missing props\n  mask: { fieldPaths: [\"id\", \"name\"] }, // optional: mask the object fields\n});\n// delete document by id\nawait firestore.deleteDocument({\n  collection: \"users\",\n  id: \"L0xO1Yri80WlrFSw6KxqccHhKhv2\",\n});\n// update document in collection by id\nawait firestore.updateDocument({\n  collection: \"users\",\n  id: \"L0xO1Yri80WlrFSw6KxqccHhKhv2\",\n  value: { firstname: { stringValue: \"Jeff\" } },\n});\n// update document in collection by id for set projectID\nawait firestore.updateDocument({\n  collection: \"users\",\n  id: \"L0xO1Yri80WlrFSw6KxqccHhKhv2\",\n  project: \"someproj\",\n  value: { firstname: { stringValue: \"Jeff\" } },\n});\n// move documents import/export may require admin account token\nawait firestore.moveDocuments({\n  collectionIds: undefined, // export all documents\n  outputUriPrefix: \"gs://BUCKET_NAME[/NAMESPACE_PATH]\", // replace with your bucket name and namespace\n  type: \"export\",\n});\n```\n\n## Environment Variables\n\nThe environment variables below will help setup the project defaults so you do not have to manually configure at the application level. If you are not going to setup any of the envs below you need to make sure you pass in the required params.\n\n```\nFIREBASE_AUTH_EMAIL=\nFIREBASE_AUTH_PASSWORD=\nFIREBASE_PROJECT_KEY=\nFIREBASE_PROJECT_ID=\nFIREBASE_DATABASE=(default)\nFIREBASE_TOKEN=\nFIREBASE_EVENT_LOG=\nFIREBASE_REFRESH_RATE=\nCI=\n```\n\n## CLI\n\nA CLI entrypoint that can manage the access token between steps is WIP. For now set the token prior per run.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fj-mendez%2Fdfirestore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fj-mendez%2Fdfirestore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fj-mendez%2Fdfirestore/lists"}