{"_id":"@2fd/graphtype","_rev":"5-001f18fc4d816ebaab4ad27e2e8f568f","name":"@2fd/graphtype","description":"\"Generator of TypeScripts definitions for GraphQL\"","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"@2fd/graphtype","version":"1.0.0","description":"\"Generator of TypeScripts definitions for GraphQL\"","main":"index.js","bin":{"graphtype":"./bin/graphtype.js"},"scripts":{"test":"mocha"},"repository":{"type":"git","url":"git+https://github.com/2fd/graphtype.git"},"keywords":["typescript","graphql"],"author":{"name":"Fede Ramirez","email":"i@2fd.me"},"license":"MIT","bugs":{"url":"https://github.com/2fd/graphtype/issues"},"homepage":"https://github.com/2fd/graphtype#readme","dependencies":{"@2fd/command":"^1.1.2","@types/mocha":"^2.2.38","@types/node":"^7.0.4","@types/request":"^0.0.39","request":"^2.79.0","word-wrap":"^1.2.0"},"gitHead":"1b5ba683b9ea3249840eea0aab841512ce918f4a","_id":"@2fd/graphtype@1.0.0","_shasum":"f1832a35ddfd0809375dc71eff3e1643ab092df2","_from":".","_npmVersion":"3.10.9","_nodeVersion":"6.9.2","_npmUser":{"name":"2fd","email":"i@2fd.me"},"dist":{"shasum":"f1832a35ddfd0809375dc71eff3e1643ab092df2","tarball":"https://registry.npmjs.org/@2fd/graphtype/-/graphtype-1.0.0.tgz","integrity":"sha512-I4mRSOHUjgbvOjNxkZsvNS3M9Qy1OuiyfCnLSTutvRMqnQzcMeVWRGihSxeNRTd2AoKDhOQx76Z1I4yMIFcDIA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFxMsuL7gjZ0tud37CfDwIYOAtNJtFNsOzbFm2/VV8oyAiEAj1ZR1P/uAWnaNaKEIxUQBInXxqWtcPzwSRI8B3ZqCSg="}]},"maintainers":[{"name":"2fd","email":"i@2fd.me"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/graphtype-1.0.0.tgz_1485542501695_0.04033712646923959"}},"1.0.1":{"name":"@2fd/graphtype","version":"1.0.1","description":"\"Generator of TypeScripts definitions for GraphQL\"","main":"index.js","bin":{"graphtype":"./bin/graphtype.js"},"scripts":{"test":"mocha"},"repository":{"type":"git","url":"git+https://github.com/2fd/graphtype.git"},"keywords":["typescript","graphql"],"author":{"name":"Fede Ramirez","email":"i@2fd.me"},"license":"MIT","bugs":{"url":"https://github.com/2fd/graphtype/issues"},"homepage":"https://github.com/2fd/graphtype#readme","dependencies":{"@2fd/command":"^1.1.2","@types/mocha":"^2.2.38","@types/node":"^7.0.4","@types/request":"^0.0.39","request":"^2.79.0","word-wrap":"^1.2.0"},"gitHead":"ad715eb7cee26613e70946463e8da51a1ae89adb","_id":"@2fd/graphtype@1.0.1","_shasum":"4b524b5ef44f89172fbbe604aeb92119a694f3a4","_from":".","_npmVersion":"3.10.9","_nodeVersion":"6.9.2","_npmUser":{"name":"2fd","email":"i@2fd.me"},"dist":{"shasum":"4b524b5ef44f89172fbbe604aeb92119a694f3a4","tarball":"https://registry.npmjs.org/@2fd/graphtype/-/graphtype-1.0.1.tgz","integrity":"sha512-kw/y/iOtiokpw7zgNs4KjOKgP/bvepQ5AEFutv3VhYvnzJVH5EWGIeusFiFKut8AWwGlD6aGzH/wAE0Nc829Vw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCdy0WUF/yJoc24JelhOtSG8WPe1uBRCSULtftZtYawIwIhAJSdE0xjevuUA+vgJZgkMvt4wnRumxEjpXzHJl39Ofvd"}]},"maintainers":[{"name":"2fd","email":"i@2fd.me"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/graphtype-1.0.1.tgz_1485542622175_0.6779654873535037"}},"1.0.2":{"name":"@2fd/graphtype","version":"1.0.2","description":"\"Generator of TypeScripts definitions for GraphQL\"","main":"index.js","bin":{"graphtype":"./bin/graphtype.js"},"scripts":{"compile":"tsc -p .","test":"jest"},"repository":{"type":"git","url":"git+https://github.com/2fd/graphtype.git"},"keywords":["typescript","graphql"],"author":{"name":"Fede Ramirez","email":"i@2fd.me"},"license":"MIT","bugs":{"url":"https://github.com/2fd/graphtype/issues"},"homepage":"https://github.com/2fd/graphtype#readme","dependencies":{"@2fd/command":"^1.1.2","request":"^2.79.0","word-wrap":"^1.2.0"},"devDependencies":{"@types/jest":"^18.1.1","@types/node":"^7.0.4","@types/request":"^0.0.39","jest":"^18.1.0","typescript":"~2.3.0"},"gitHead":"7cbf8be7cfe46cd9be3789af329bb7dbe690a7e7","_id":"@2fd/graphtype@1.0.2","_npmVersion":"5.3.0","_nodeVersion":"8.3.0","_npmUser":{"name":"2fd","email":"i@2fd.me"},"dist":{"integrity":"sha512-Y21+8nnrcxjOCZdCpO9mxjSI16CWdoihpgneKLdCbfAoa10DWaga15+Xh/2tyAMd1YK+qvxztanhRfUe52wlhw==","shasum":"5cb9b8cd81b2f90e268a1c8386741b4c6586011c","tarball":"https://registry.npmjs.org/@2fd/graphtype/-/graphtype-1.0.2.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGFleR8OGsGIPaLU1guuZq+3xHptVCn2gcgOjxRu5pL4AiAYOecegHg7/xkmYsO3b4ErnxKwgTl6RH426a8TNLQ7qg=="}]},"maintainers":[{"name":"2fd","email":"i@2fd.me"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/graphtype-1.0.2.tgz_1503545705924_0.35177134489640594"}}},"readme":"# graphtype\n\n[![Build Status](https://travis-ci.org/2fd/graphtype.svg?branch=master)](https://travis-ci.org/2fd/graphtype)\n\nGenerator of TypeScripts definitions for GraphQL\n\n## Install\n\n```bash\n    npm install -g @2fd/graphtype\n```\n\n## Use\n\n### Generate definitions from live endpoint\n\n```bash\n    > graphtype -e http://localhost:8080/graphql -o ./doc/schema.d.ts\n```\n\n### Generate definitions from json file\n\n```bash\n    > graphtype -s ./schema.json -o ./doc/schema.d.ts\n```\n\n> `./schema.json` contains the result of [GraphQL introspection query](https://github.com/2fd/graphdoc/blob/gh-pages/introspection.graphql)\n\n\n### Add scalars that must be represented as numbers\n\n```bash\n    > graphtype -e http://localhost:8080/graphql -n \"UnsignedInt\"\n```\n\n```typescript\n    /**\n     * Represents `true` or `false` values.\n     */\n    export type UnsignedInt = number;\n```\n\n### Add scalars that must be represented as numbers\n\n```bash\n    > graphtype -e http://localhost:8080/graphql -n \"UnsignedInt\"\n```\n\n```typescript\n    // ...\n    export type UnsignedInt = number;\n    // ...\n```\n\n### Add scalars that must be represented as alias of other types\n\n```bash\n    > graphtype -e http://localhost:8080/graphql -s \"NumberOrString=number | string\"\n```\n\n```typescript\n    // ...\n    export type NumberOrString = number | string;\n    // ...\n```\n\n### Help\n\n```bash\n\n    > graphtype -h\n\n    Generator of TypeScripts definitions for GraphQL v1.0.0\n\n    Usage: graphtype [OPTIONS]\n\n     [OPTIONS]:\n    -e, --endpoint        Graphql http endpoint [\"https://domain.com/graphql\"].\n    -x, --header          HTTP header for request (use with --endpoint). [\"Authorization: Token cb8795e7\"].\n    -q, --query           HTTP querystring for request (use with --endpoint) [\"token=cb8795e7\"].\n    -s, --schema          Graphql Schema file [\"./schema.json\"].\n    -o, --output          Output file (otherwise write on stdout).\n    -n, --number-alias    Scalars that must be represented as numbers [\"UnsignedInt\"].\n    -a, --alias           Scalars that must be represented as alias of other types [\"NumberOrString=number | string\"].\n    -V, --version         Show graphtype version.\n    -h, --help            Print this help\n\n```\n\n## Translations\n\n### TypeScripts definitions (.d.ts)\n\n* [Scalars](#scalars)\n* [Enums](#enums)\n* [Unions](#unions)\n* [Interfaces](#interfaces)\n* [Types](#types)\n* [Inputs](#inputs)\n\n\n#### Scalars\n\n```graphql\n    # schema definitions\n\n    scalar Boolean;\n    scalar Int;\n    scalar String;\n```\n\n```typescript\n    // typescript output\n\n    /**\n     * Represents `true` or `false` values.\n     */\n    export type Boolean = boolean;\n\n    /**\n     * Represents non-fractional signed whole numeric values. Int can represent values\n     * between -(2^31) and 2^31 - 1.\n     */\n    export type Int = number;\n\n    /**\n     * Represents textual data as UTF-8 character sequences. This type is most often\n     * used by GraphQL to represent free-form human-readable text.\n     */\n    export type String = string;\n```\n\n![Autocomplete Scalars on Typescript](https://github.com/2fd/graphtype/raw/master/img/typescript.scalar.png)\n\n#### Enums\n\n```graphql\n    # schema definitions\n\n    enum __TypeKind {\n        SCALAR\n        OBJECT\n        INTERFACE\n        UNION\n        ENUM\n        INPUT_OBJECT\n        LIST\n        NON_NULL\n    }\n```\n\n```typescript\n    // typescript output\n\n    /**\n     * An enum describing what kind of type a given `__Type` is.\n     */\n    export type __TypeKind = (\n\n        /**\n         * Indicates this type is a scalar.\n         */\n        \"SCALAR\" |\n\n        /**\n         * Indicates this type is an object. `fields` and `interfaces` are valid fields.\n         */\n        \"OBJECT\" |\n\n        /**\n         * Indicates this type is an interface. `fields` and `possibleTypes` are valid\n         * fields.\n         */\n        \"INTERFACE\" |\n\n        /**\n         * Indicates this type is a union. `possibleTypes` is a valid field.\n         */\n        \"UNION\" |\n\n        /**\n         * Indicates this type is an enum. `enumValues` is a valid field.\n         */\n        \"ENUM\" |\n\n        /**\n         * Indicates this type is an input object. `inputFields` is a valid field.\n         */\n        \"INPUT_OBJECT\" |\n\n        /**\n         * Indicates this type is a list. `ofType` is a valid field.\n         */\n        \"LIST\" |\n\n        /**\n         * Indicates this type is a non-null. `ofType` is a valid field.\n         */\n        \"NON_NULL\"\n    );\n```\n\n![Autocomplete Enums on Typescript](https://github.com/2fd/graphtype/raw/master/img/typescript.enum.png)\n\n#### Unions\n\n```graphql\n    # schema definitions\n\n    union ProjectCardItem = Issue | PullRequest;\n```\n\n```typescript\n    // typescript output\n\n    /**\n     * Types that can be inside Project Cards.\n     */\n    export type ProjectCardItem = Issue | PullRequest;\n```\n\n![Autocomplete Enums on Typescript](https://github.com/2fd/graphtype/raw/master/img/typescript.union.png)\n\n#### Interfaces\n\n```graphql\n    # schema definitions\n\n    interface Node {\n        id: ID!\n    }\n```\n\n```typescript\n    // typescript output\n\n    /**\n     * An application user.\n     */\n    export interface Node {\n\n        /**\n         * .ID of the node.\n         */\n        id: NonNull<ID>;\n    }\n```\n\n![Autocomplete Enums on Typescript](https://github.com/2fd/graphtype/raw/master/img/typescript.interface.png)\n\n#### Types\n\n```graphql\n    # schema definitions\n\n    type User implements Node {\n        id: ID!\n        email: String!\n        name: String\n        lastName: String\n        friends: [ID!]!\n    }\n```\n\n```typescript\n    // typescript output\n\n    /**\n     * An application user.\n     */\n    export interface User extends Node {\n\n        /**\n         * ID of the user.\n         */\n        id: NonNull<ID>;\n\n        /**\n         * contact email of the user.\n         */\n        email: NonNull<String>;\n\n        /**\n         * name of the user.\n         */\n        name?: Optional<String>;\n\n        /**\n         * last name of the user.\n         */\n        lastName?: Optional<String>;\n\n        /**\n         * list of friend´s ID of the user.\n         */\n        friends: NonNull<List<NonNull<ID>>>;\n    }\n```\n\n![Autocomplete Objects on Typescript](https://github.com/2fd/graphtype/raw/master/img/typescript.type.png)\n\n#### Inputs\n\n```graphql\n    # schema definitions\n\n    input NewUser {\n        email: String!\n        name: String\n        lastName: String\n        friends: [ID!] = []\n    }\n```\n\n```typescript\n    // typescript output\n\n    /**\n     * An application user.\n     */\n    export interface NewUser {\n\n        /**\n         * contact email of the user.\n         */\n        email: NonNull<String>;\n\n        /**\n         * name of the user.\n         */\n        name?: Optional<String>;\n\n        /**\n         * last name of the user.\n         */\n        lastName?: Optional<String>;\n\n        /**\n         * @default []\n         *\n         * list of friend´s ID of the user.\n         */\n        friends?: Optional<List<NonNull<ID>>>;\n    }\n```\n\n![Autocomplete Inputs on Typescript](https://github.com/2fd/graphtype/raw/master/img/typescript.input.png)\n","maintainers":[{"name":"2fd","email":"i@2fd.me"}],"time":{"modified":"2022-06-12T14:10:32.692Z","created":"2017-01-27T18:41:43.747Z","1.0.0":"2017-01-27T18:41:43.747Z","1.0.1":"2017-01-27T18:43:44.080Z","1.0.2":"2017-08-24T03:35:06.138Z"},"homepage":"https://github.com/2fd/graphtype#readme","keywords":["typescript","graphql"],"repository":{"type":"git","url":"git+https://github.com/2fd/graphtype.git"},"author":{"name":"Fede Ramirez","email":"i@2fd.me"},"bugs":{"url":"https://github.com/2fd/graphtype/issues"},"license":"MIT","readmeFilename":"README.md"}