{"id":23091596,"url":"https://github.com/bharley/graphql-hashid-type","last_synced_at":"2025-04-30T22:49:09.999Z","repository":{"id":57253471,"uuid":"80368868","full_name":"bharley/graphql-hashid-type","owner":"bharley","description":"A scalar type for GraphQL that obscures your database identifiers using Hashids","archived":false,"fork":false,"pushed_at":"2017-02-06T21:49:14.000Z","size":6,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-18T14:06:20.467Z","etag":null,"topics":["graphql","hashids","javascript"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bharley.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-01-29T20:01:34.000Z","updated_at":"2024-08-12T19:27:28.000Z","dependencies_parsed_at":"2022-08-31T22:11:48.839Z","dependency_job_id":null,"html_url":"https://github.com/bharley/graphql-hashid-type","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bharley%2Fgraphql-hashid-type","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bharley%2Fgraphql-hashid-type/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bharley%2Fgraphql-hashid-type/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bharley%2Fgraphql-hashid-type/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bharley","download_url":"https://codeload.github.com/bharley/graphql-hashid-type/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251795386,"owners_count":21645019,"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":["graphql","hashids","javascript"],"created_at":"2024-12-16T21:18:49.793Z","updated_at":"2025-04-30T22:49:09.972Z","avatar_url":"https://github.com/bharley.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# graphql-hashid-type\n\nA scalar type for [GraphQL] that obscures your database identifiers using\n[Hashids].\n\n## Installation\n\nUse yarn or npm:\n\n```\n$ yarn add graphql-hashid-type\n```\n\n```\n$ npm i -S graphql-hashid-type\n```\n\n## Usage\n\n```js\nimport {\n  GraphQLList,\n  GraphQLNonNull,\n  GraphQLObjectType,\n  GraphQLString,\n} from 'graphql';\nimport GraphQLHashIdType from 'graphql-hashid-type';\n\nconst GraphQLHashId = new GraphQLHashIdType('super secret salt');\n\nconst FoodType = new GraphQLObjectType({\n  name: 'Food',\n  description: 'A possibly tasty thing',\n  fields: {\n    id: { type: new GraphQLNonNull(GraphQLHashId) },\n    name: { type: new GraphQLNonNull(GraphQLString) },\n  },\n});\n\nconst food = [\n  { id: 1, name: 'Pizza' },\n  { id: 2, name: 'Hamburger' },\n  { id: 3, name: 'Burrito' },\n];\n\nconst RootType = new GraphQLObjectType({\n  name: 'RootType',\n  fields: {\n    food: {\n      type: new GraphQLList(FoodType),\n      resolve: () =\u003e food,\n    },\n    favorite: {\n      type: FoodType,\n      args: {\n        id: {\n          type: new GraphQLNonNull(GraphQLHashId)\n        }\n      },\n      resolve(root, { id }) {\n        return food.find(item =\u003e item.id === id);\n      },\n    }\n  }\n});\n\nexport default new GraphQLSchema({\n  query: RootType,\n});\n```\n\n[GraphQL]: http://graphql.org/\n[Hashids]: http://hashids.org/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbharley%2Fgraphql-hashid-type","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbharley%2Fgraphql-hashid-type","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbharley%2Fgraphql-hashid-type/lists"}