UNPKG

atlasgql

Version:

A self-composing GraphQL server library using TypeScript, Express and Apollo Server

29 lines 1.23 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.InterfacesAutomation = void 0; const from_schema_1 = require("@gql2ts/from-schema"); class InterfacesAutomation { static generate(schema) { const options = { ignoredTypes: ['BadGraphType'], }; const overrides = { generateInterfaceName: (name) => this.capitalizeFirstLetter(name).replace(/_/gm, ''), interfaceBuilder: (name, body) => `export interface ${name} ${body}`, typeBuilder: (name, body) => `export type ${name} = ${body}`, enumTypeBuilder: (name, values) => `export const enum ${name} ${values}`, generateNamespace: (_namespaceName, interfaces) => `// tslint:disable // graphql typescript definitions ${interfaces.replace(/__typename\:/gm, '__typename?:')} // tslint:enable `, }; this.blob = (0, from_schema_1.generateNamespace)('AtlasGQLNS', schema, options, overrides); } static capitalizeFirstLetter(str) { return str.charAt(0).toUpperCase() + str.slice(1); } } exports.InterfacesAutomation = InterfacesAutomation; InterfacesAutomation.blob = ''; //# sourceMappingURL=automation.js.map