{"id":15675081,"url":"https://github.com/simenandre/firestore-graphql-scalars","last_synced_at":"2025-04-13T00:50:48.211Z","repository":{"id":48101707,"uuid":"267929994","full_name":"simenandre/firestore-graphql-scalars","owner":"simenandre","description":"Custom GraphQL scalars types for Firebase and Google Cloud Firestore.","archived":false,"fork":false,"pushed_at":"2024-12-09T04:55:32.000Z","size":252,"stargazers_count":14,"open_issues_count":12,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-04T20:56:56.061Z","etag":null,"topics":["firebase","firestore","graphql","scalars"],"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/simenandre.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":"2020-05-29T18:39:59.000Z","updated_at":"2023-04-21T20:43:44.000Z","dependencies_parsed_at":"2023-12-22T15:09:31.858Z","dependency_job_id":"ca8e047b-74d3-4a13-907b-98ad01a140c0","html_url":"https://github.com/simenandre/firestore-graphql-scalars","commit_stats":{"total_commits":119,"total_committers":6,"mean_commits":"19.833333333333332","dds":"0.32773109243697474","last_synced_commit":"c1a7c6ebdc9a73953a7ccd86e048ea8bb5fd7d7e"},"previous_names":["cobraz/firestore-graphql-scalars"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simenandre%2Ffirestore-graphql-scalars","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simenandre%2Ffirestore-graphql-scalars/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simenandre%2Ffirestore-graphql-scalars/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simenandre%2Ffirestore-graphql-scalars/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simenandre","download_url":"https://codeload.github.com/simenandre/firestore-graphql-scalars/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247997904,"owners_count":21030699,"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":["firebase","firestore","graphql","scalars"],"created_at":"2024-10-03T15:55:57.042Z","updated_at":"2025-04-13T00:50:48.179Z","avatar_url":"https://github.com/simenandre.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![npm version](https://badge.fury.io/js/firestore-graphql-scalars.svg)](https://badge.fury.io/js/firestore-graphql-scalars)\n\n\u003e A custom GraphQL [scalar type](http://graphql.org/learn/schema/#scalar-types) for Firebase and Google Cloud Firestore.\n\n## Installation\n\n```\nnpm install --save firestore-graphql-scalars\n```\n\nor\n\n```\nyarn add firestore-graphql-scalars\n```\n\n## Usage\n\nTo use this scalar you'll need to add it in two places, your schema and your resolvers map.\n\nIn your schema:\n\n```graphql\nscalar Timestamp\n```\n\nIn your resolver map, first import them:\n\n```javascript\nimport { timestampResolver } from 'firestore-graphql-scalars';\n```\n\nThen make sure they're in the root resolver map like this:\n\n```javascript\nconst myResolverMap = {\n  Timestamp: timestampResolver,\n\n  Query: {\n    // more stuff here\n  },\n\n  Mutation: {\n    // more stuff here\n  },\n};\n```\n\nAlternatively, use the default import and ES6's spread operator syntax:\n\n```javascript\nimport { resolvers } from 'firestore-graphql-scalars';\n```\n\nThen make sure they're in the root resolver map like this:\n\n```javascript\nconst myResolverMap = {\n  ...resolvers,\n\n  Query: {\n    // more stuff here\n  },\n\n  Mutation: {\n    // more stuff here\n  },\n};\n```\n\nThat's it. Now you can use these scalar types in your schema definition like this:\n\n```graphql\ntype Person {\n  createdAt: Timestamp\n  ...\n}\n```\n\nThese scalars can be used just like the base, built-in ones.\n\n### Usage with Apollo Server\n\n```javascript\nimport { ApolloServer } from 'apollo-server';\nimport { makeExecutableSchema } from '@graphql-tools/schema';\nimport { typeDefs, resolvers } from 'firestore-graphql-scalars';\n\nconst server = new ApolloServer({\n  schema: makeExecutableSchema({\n    typeDefs: [\n      // use spread syntax to add scalar definitions to your schema\n      ...typeDefs,\n      // DateTimeTypeDefinition,\n      // ...\n      // ... other type definitions ...\n    ],\n    resolvers: {\n      // use spread syntax to add scalar resolvers to your resolver map\n      ...resolvers,\n      // DateTimeResolver,\n      // ...\n      // ... remainder of resolver map ...\n    },\n  }),\n});\n\nserver.listen().then(({ url }) =\u003e {\n  console.log(`🚀 Server ready at ${url}`);\n});\n```\n\n## License\n\nReleased under the [MIT license](./LICENSE).\n\n## Contributing\n\nIssues and Pull Requests are always welcome. ❤️\n\n## Thanks\n\nThis repository is a fork of [graphql-scalars](https://github.com/Urigo/graphql-scalars). It's inspired by [@lookfirst's issue](https://github.com/Urigo/graphql-scalars/issues/61) and\n[juicylevel/coffee-service](https://github.com/juicylevel/coffee-service). Big thanks to the contributors of these repositories! 🙏\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimenandre%2Ffirestore-graphql-scalars","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimenandre%2Ffirestore-graphql-scalars","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimenandre%2Ffirestore-graphql-scalars/lists"}