{"id":13499182,"url":"https://github.com/rse/graphql-tools-types","last_synced_at":"2025-10-04T09:31:15.123Z","repository":{"id":57253683,"uuid":"65844746","full_name":"rse/graphql-tools-types","owner":"rse","description":"Custom Scalar Types for GraphQL-Tools","archived":false,"fork":false,"pushed_at":"2023-01-23T17:37:34.000Z","size":73,"stargazers_count":47,"open_issues_count":2,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-17T20:49:29.938Z","etag":null,"topics":["custom","graphq-tools","graphql","scalar","type"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/graphql-tools-types","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/rse.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":"2016-08-16T18:39:47.000Z","updated_at":"2023-09-08T17:13:45.000Z","dependencies_parsed_at":"2023-02-13T01:31:36.369Z","dependency_job_id":null,"html_url":"https://github.com/rse/graphql-tools-types","commit_stats":null,"previous_names":[],"tags_count":49,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rse%2Fgraphql-tools-types","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rse%2Fgraphql-tools-types/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rse%2Fgraphql-tools-types/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rse%2Fgraphql-tools-types/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rse","download_url":"https://codeload.github.com/rse/graphql-tools-types/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235233168,"owners_count":18957064,"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":["custom","graphq-tools","graphql","scalar","type"],"created_at":"2024-07-31T22:00:30.561Z","updated_at":"2025-10-04T09:31:09.830Z","avatar_url":"https://github.com/rse.png","language":"JavaScript","readme":"\nGraphQL-Tools-Types\n===================\n\nCustom Scalar Types for GraphQL-Tools\n\n\u003cp/\u003e\n\u003cimg src=\"https://nodei.co/npm/graphql-tools-types.png?downloads=true\u0026stars=true\" alt=\"\"/\u003e\n\n\u003cp/\u003e\n\u003cimg src=\"https://david-dm.org/rse/graphql-tools-types.png\" alt=\"\"/\u003e\n\nAbout\n-----\n\nThis Node.js module provides the custom scalar types Void, Integer, Float,\nString, Date, Universally Unique Identifier (UUID) and\nJavaScript Object Notation (JSON) for\n[GraphQL Tools](https://github.com/apollostack/graphql-tools),\na wrapper around the [GraphQL](http://graphql.org/) engine\n[GraphQL.js](https://github.com/graphql/graphql-js).\n\nInstallation\n------------\n\n```shell\n$ npm install graphql-tools-types\n```\n\nUsage\n-----\n\n```js\nimport UUID              from \"pure-uuid\"\nimport * as GraphQL      from \"graphql\"\nimport * as GraphQLTools from \"graphql-tools\"\nimport GraphQLToolsTypes from \"graphql-tools-types\"\n\nlet definition = `\n    schema {\n        query: RootQuery\n    }\n    scalar Void\n    scalar MyInt\n    scalar MyFloat\n    scalar MyString\n    scalar Date\n    scalar UUID\n    scalar JSON\n    scalar Coord\n    type RootQuery {\n        exampleVoid: Void\n        exampleMyInt(num: MyInt): Int\n        exampleMyFloat(num: MyFloat): Float\n        exampleMyString(str: MyString): String\n        exampleDate(date: Date): Date\n        exampleUUID(uuid: UUID): UUID\n        exampleJSON(json: JSON): JSON\n        exampleCoord(coord: Coord): Coord\n    }\n`\nlet resolvers = {\n    Void:     GraphQLToolsTypes.Void({ name: \"MyVoid\" }),\n    MyInt:    GraphQLToolsTypes.Int({ name: \"MyInt\", min: 0, max: 100 }),\n    MyFloat:  GraphQLToolsTypes.Float({ name: \"MyFloat\", min: 0.0, max: 100.0 }),\n    MyString: GraphQLToolsTypes.String({ name: \"MyString\", regex: /^(?:foo|bar|quux)$/ }),\n    Date:     GraphQLToolsTypes.Date({ name: \"MyDate\" }),\n    UUID:     GraphQLToolsTypes.UUID({ name: \"MyUUID\" }),\n    JSON:     GraphQLToolsTypes.JSON({ name: \"MyJSON\" }),\n    Coord:    GraphQLToolsTypes.JSON({ name: \"Coord\", struct: \"{ x: number, y: number }\" }),\n    RootQuery: {\n        exampleVoid: (root, args, ctx, info) =\u003e {\n            return {}\n        },\n        exampleMyInt: (root, args, ctx, info) =\u003e {\n            return args.num\n        },\n        exampleMyFloat: (root, args, ctx, info) =\u003e {\n            return args.num\n        },\n        exampleMyString: (root, args, ctx, info) =\u003e {\n            return args.str\n        },\n        exampleDate: (root, args, ctx, info) =\u003e {\n            return args.date\n        },\n        exampleUUID: (root, args, ctx, info) =\u003e {\n            return args.uuid\n        },\n        exampleJSON: (root, args, ctx, info) =\u003e {\n            return args.json\n        },\n        exampleCoord: (root, args, ctx, info) =\u003e {\n            return args.coord\n        }\n    }\n}\nlet schema = GraphQLTools.makeExecutableSchema({\n    typeDefs: [ definition ],\n    resolvers: resolvers,\n})\nlet query = `\n    query ($date: Date, $uuid: UUID, $json: JSON, $coord: Coord) {\n        exampleVoid,\n        exampleMyInt(num: 100),\n        exampleMyFloat(num: 42.7),\n        exampleMyString(str: \"foo\")\n        date1: exampleDate(date: $date),\n        date2: exampleDate(date: \"2016-08-16T00:01:02.000Z\"),\n        uuid1: exampleUUID(uuid: $uuid),\n        uuid2: exampleUUID(uuid: \"6cbe657c-63e3-11e6-aa83-080027e303e4\"),\n        json1: exampleJSON(json: $json),\n        json2: exampleJSON(json: { foo: \"bar\", baz: 42, quux: true }),\n        coord1: exampleCoord(coord: $coord),\n        coord2: exampleCoord(coord: { x: 7, y: 42 })\n    }\n`\nlet variables = {\n    date: \"2016-08-16T00:01:02.000Z\",\n    uuid: \"6cbe657c-63e3-11e6-aa83-080027e303e4\",\n    json: { foo: \"bar\", baz: 42, quux: true },\n    coord: { x: 7, y: 42 }\n}\nGraphQL.graphql(schema, query, null, null, variables).then((result) =\u003e {\n    console.log(\"OK\", result)\n}).catch((result) =\u003e {\n    console.log(\"ERROR\", result)\n})\n```\n\n```sh\n$ npm test\nOK { data:\n   { exampleJSON: { foo: 'bar', baz: 42, quux: true },\n     exampleUUID: '6cbe657c-63e3-11e6-aa83-080027e303e4',\n     exampleDate: '2016-08-16T00:01:02.000Z',\n     exampleVoid: {},\n     exampleMyInt: 100,\n     exampleMyFloat: 42.7,\n     exampleMyString: 'foo' } }\n```\n\nLicense\n-------\n\nCopyright (c) 2016-2021 Dr. Ralf S. Engelschall (http://engelschall.com/)\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be included\nin all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n","funding_links":[],"categories":["Libraries"],"sub_categories":["JavaScript Libraries"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frse%2Fgraphql-tools-types","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frse%2Fgraphql-tools-types","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frse%2Fgraphql-tools-types/lists"}