From 55050446e7d20c39ffbb7a9ff02bd47a13c02589 Mon Sep 17 00:00:00 2001 From: Flavian DESVERNE Date: Fri, 9 Nov 2018 19:12:04 +0100 Subject: [PATCH 01/35] Add test to compile typescript-yoga template --- packages/graphqlgen/package.json | 3 +- packages/graphqlgen/src/index.ts | 6 +- .../src/tests/fixtures/context/types.ts | 6 +- .../graphqlgen/src/tests/flow/basic.test.ts | 8 +- packages/graphqlgen/src/tests/generation.ts | 90 +++++++++++++++++-- .../__snapshots__/basic.test.ts.snap | 18 ++-- .../__snapshots__/large-schema.test.ts.snap | 2 +- .../src/tests/typescript/basic.test.ts | 37 ++++---- .../src/tests/typescript/large-schema.test.ts | 9 +- 9 files changed, 132 insertions(+), 47 deletions(-) diff --git a/packages/graphqlgen/package.json b/packages/graphqlgen/package.json index ea6496ab..3cc62315 100644 --- a/packages/graphqlgen/package.json +++ b/packages/graphqlgen/package.json @@ -62,6 +62,7 @@ "jest": "23.6.0", "ts-jest": "23.10.4", "ts-node": "7.0.1", - "tslint": "5.11.0" + "tslint": "5.11.0", + "typescript": "^3.1.6" } } diff --git a/packages/graphqlgen/src/index.ts b/packages/graphqlgen/src/index.ts index c98a4069..ff745a10 100644 --- a/packages/graphqlgen/src/index.ts +++ b/packages/graphqlgen/src/index.ts @@ -114,7 +114,7 @@ export function generateCode( return { generatedTypes, generatedResolvers } } -function writeTypes(types: string, config: GraphQLGenDefinition): void { +export function writeTypes(types: string, config: GraphQLGenDefinition): void { // Create generation target folder, if it does not exist // TODO: Error handling around this mkdirp.sync(path.dirname(config.output)) @@ -135,7 +135,7 @@ function writeTypes(types: string, config: GraphQLGenDefinition): void { ) } -function writeResolversScaffolding( +export function writeResolversScaffolding( resolvers: CodeFileLike[], config: GraphQLGenDefinition, ) { @@ -172,8 +172,6 @@ function writeResolversScaffolding( }) console.log(chalk.green(`Resolvers scaffolded at ${outputResolversDir}`)) - - process.exit(0) } function bootstrapYamlFile() { diff --git a/packages/graphqlgen/src/tests/fixtures/context/types.ts b/packages/graphqlgen/src/tests/fixtures/context/types.ts index afd5c4a3..d5929cfa 100644 --- a/packages/graphqlgen/src/tests/fixtures/context/types.ts +++ b/packages/graphqlgen/src/tests/fixtures/context/types.ts @@ -1,11 +1,11 @@ -interface Data { +export interface Data { users: User[] } -interface Context { +export interface Context { data: Data } -interface User { +export interface User { id: string } diff --git a/packages/graphqlgen/src/tests/flow/basic.test.ts b/packages/graphqlgen/src/tests/flow/basic.test.ts index e54ded15..478b7341 100644 --- a/packages/graphqlgen/src/tests/flow/basic.test.ts +++ b/packages/graphqlgen/src/tests/flow/basic.test.ts @@ -26,7 +26,7 @@ test('basic enum', async () => { models: { files: [relative('../fixtures/enum/types-flow.js')], }, - output: relative('./generated/enum/graphqlgen.ts'), + output: relative('./generated/enum/graphqlgen.js'), ['resolver-scaffolding']: { output: relative('./tmp/enum/'), layout: 'file-per-type', @@ -41,7 +41,7 @@ test('basic union', async () => { models: { files: [relative('../fixtures/union/flow-types.js')], }, - output: relative('./generated/union/graphqlgen.ts'), + output: relative('./generated/union/graphqlgen.js'), ['resolver-scaffolding']: { output: relative('./tmp/union/'), layout: 'file-per-type', @@ -61,7 +61,7 @@ test('defaultName', async () => { }, ], }, - output: relative('./generated/defaultName/graphqlgen.ts'), + output: relative('./generated/defaultName/graphqlgen.js'), ['resolver-scaffolding']: { output: relative('./tmp/scalar/'), layout: 'file-per-type', @@ -76,7 +76,7 @@ test('basic scalar', async () => { models: { files: [relative('../fixtures/scalar/flow-types.js')], }, - output: relative('./generated/scalar/graphqlgen.ts'), + output: relative('./generated/scalar/graphqlgen.js'), ['resolver-scaffolding']: { output: relative('./tmp/scalar/'), layout: 'file-per-type', diff --git a/packages/graphqlgen/src/tests/generation.ts b/packages/graphqlgen/src/tests/generation.ts index a57f9868..e5acd3ba 100644 --- a/packages/graphqlgen/src/tests/generation.ts +++ b/packages/graphqlgen/src/tests/generation.ts @@ -1,14 +1,62 @@ -import { GraphQLGenDefinition } from "graphqlgen-json-schema"; -import { parseModels, parseSchema } from "../parse"; -import { validateConfig } from "../validation"; -import { generateCode } from "../index"; +import * as ts from 'typescript' +import * as rimraf from 'rimraf' +import * as path from 'path' +import { GraphQLGenDefinition } from 'graphqlgen-json-schema' +import { parseModels, parseSchema } from '../parse' +import { validateConfig } from '../validation' +import { generateCode, writeResolversScaffolding, writeTypes } from '../index' + +function printTypescriptErrors(diagnotics: ReadonlyArray) { + diagnotics.forEach(diagnostic => { + if (diagnostic.file) { + let { line, character } = diagnostic.file.getLineAndCharacterOfPosition( + diagnostic.start!, + ) + let message = ts.flattenDiagnosticMessageText( + diagnostic.messageText, + '\n', + ) + console.log( + `${diagnostic.file.fileName} (${line + 1},${character + + 1}): ${message}`, + ) + } else { + console.log( + `${ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n')}`, + ) + } + }) +} + +function compileTypescript(fileNames: string[], compiledOutputDir: string) { + const errors = ts + .createProgram(fileNames, { + sourceMap: false, + noEmitOnError: true, + target: ts.ScriptTarget.ESNext, + module: ts.ModuleKind.CommonJS, + outDir: compiledOutputDir, + }) + .emit().diagnostics + + if (errors.length > 0) { + printTypescriptErrors(errors) + } + + expect(errors.length).toEqual(0) +} export function testGeneration(config: GraphQLGenDefinition) { const schema = parseSchema(config.schema) expect(validateConfig(config, schema)).toBe(true) - const modelMap = parseModels(config.models, schema, config.output, config.language) + const modelMap = parseModels( + config.models, + schema, + config.output, + config.language, + ) const { generatedTypes, generatedResolvers } = generateCode({ schema, language: config.language, @@ -19,4 +67,36 @@ export function testGeneration(config: GraphQLGenDefinition) { expect(generatedTypes).toMatchSnapshot() expect(generatedResolvers).toMatchSnapshot() + + const restoreLog = console.log + + // Mock console.log + console.log = jest.fn() + + writeTypes(generatedTypes, config) + writeResolversScaffolding(generatedResolvers, config) + + // Restore console log to print errors if there are any + console.log = restoreLog + + const outputResolversDir = config['resolver-scaffolding']!.output + + const fileNames = [ + ...generatedResolvers.map(resolver => + path.join(outputResolversDir, resolver.path), + ), + config.output, + ] + + const compiledOutputDir = path.join(path.dirname(config.output), 'compiled') + + if (config.language === 'typescript') { + compileTypescript(fileNames, compiledOutputDir) + } + + if (config.language === 'flow') { + // compileFlow(fileNames) + } + + rimraf.sync(path.dirname(config.output)) } diff --git a/packages/graphqlgen/src/tests/typescript/__snapshots__/basic.test.ts.snap b/packages/graphqlgen/src/tests/typescript/__snapshots__/basic.test.ts.snap index 62a5c748..8ddb3838 100644 --- a/packages/graphqlgen/src/tests/typescript/__snapshots__/basic.test.ts.snap +++ b/packages/graphqlgen/src/tests/typescript/__snapshots__/basic.test.ts.snap @@ -4,7 +4,7 @@ exports[`basic enum 1`] = ` "// Code generated by github.com/prisma/graphqlgen, DO NOT EDIT. import { GraphQLResolveInfo } from \\"graphql\\"; -import { User } from \\"../../../fixtures/enum/types\\"; +import { User } from \\"../../fixtures/enum/types\\"; type Context = any; type EnumAnnotation = \\"EDITOR\\" | \\"COLLABORATOR\\"; @@ -167,7 +167,7 @@ exports[`basic input 1`] = ` "// Code generated by github.com/prisma/graphqlgen, DO NOT EDIT. import { GraphQLResolveInfo } from \\"graphql\\"; -import { AddMemberPayload } from \\"../../../fixtures/input/types\\"; +import { AddMemberPayload } from \\"../../fixtures/input/types\\"; type Context = any; export namespace MutationResolvers { @@ -337,7 +337,7 @@ exports[`basic scalar 1`] = ` "// Code generated by github.com/prisma/graphqlgen, DO NOT EDIT. import { GraphQLResolveInfo } from \\"graphql\\"; -import { AddMemberPayload } from \\"../../../fixtures/scalar/types\\"; +import { AddMemberPayload } from \\"../../fixtures/scalar/types\\"; type Context = any; export namespace MutationResolvers { @@ -453,7 +453,7 @@ exports[`basic schema 1`] = ` "// Code generated by github.com/prisma/graphqlgen, DO NOT EDIT. import { GraphQLResolveInfo } from \\"graphql\\"; -import { Number } from \\"../../../fixtures/basic\\"; +import { Number } from \\"../../fixtures/basic\\"; type Context = any; export namespace QueryResolvers { @@ -795,7 +795,7 @@ exports[`basic union 1`] = ` "// Code generated by github.com/prisma/graphqlgen, DO NOT EDIT. import { GraphQLResolveInfo } from \\"graphql\\"; -import { User, Student, Professor } from \\"../../../fixtures/union/types\\"; +import { User, Student, Professor } from \\"../../fixtures/union/types\\"; type Context = any; export namespace UserResolvers { @@ -972,8 +972,8 @@ exports[`context 1`] = ` "// Code generated by github.com/prisma/graphqlgen, DO NOT EDIT. import { GraphQLResolveInfo } from \\"graphql\\"; -import { User } from \\"../../../fixtures/context/types\\"; -import { Context } from \\"../../../fixtures/context/types\\"; +import { User } from \\"../../fixtures/context/types\\"; +import { Context } from \\"../../fixtures/context/types\\"; export namespace QueryResolvers { export const defaultResolvers = {}; @@ -1079,7 +1079,7 @@ exports[`defaultName 1`] = ` "// Code generated by github.com/prisma/graphqlgen, DO NOT EDIT. import { GraphQLResolveInfo } from \\"graphql\\"; -import { NumberNode } from \\"../../../fixtures/defaultName\\"; +import { NumberNode } from \\"../../fixtures/defaultName\\"; type Context = any; export namespace QueryResolvers { @@ -1421,7 +1421,7 @@ exports[`subscription 1`] = ` "// Code generated by github.com/prisma/graphqlgen, DO NOT EDIT. import { GraphQLResolveInfo } from \\"graphql\\"; -import { User } from \\"../../../fixtures/subscription/types\\"; +import { User } from \\"../../fixtures/subscription/types\\"; type Context = any; export namespace SubscriptionResolvers { diff --git a/packages/graphqlgen/src/tests/typescript/__snapshots__/large-schema.test.ts.snap b/packages/graphqlgen/src/tests/typescript/__snapshots__/large-schema.test.ts.snap index c6bcf7a5..8db8411d 100644 --- a/packages/graphqlgen/src/tests/typescript/__snapshots__/large-schema.test.ts.snap +++ b/packages/graphqlgen/src/tests/typescript/__snapshots__/large-schema.test.ts.snap @@ -33,7 +33,7 @@ import { Message, AuthPayload, MutationResult -} from \\"../../../fixtures/prisma/types\\"; +} from \\"../../fixtures/prisma/types\\"; type Context = any; type PLACE_SIZES = diff --git a/packages/graphqlgen/src/tests/typescript/basic.test.ts b/packages/graphqlgen/src/tests/typescript/basic.test.ts index 77679e29..9b5d8778 100644 --- a/packages/graphqlgen/src/tests/typescript/basic.test.ts +++ b/packages/graphqlgen/src/tests/typescript/basic.test.ts @@ -1,9 +1,12 @@ import { testGeneration } from '../generation' import { join } from 'path' -const language = 'typescript' const relative = (p: string) => join(__dirname, p) +const typesDir = relative('./generated-basic/graphqlgen.ts') +const resolversDir = relative('./generated-basic/tmp-resolvers/') +const language = 'typescript' + test('basic schema', async () => { testGeneration({ language, @@ -11,9 +14,9 @@ test('basic schema', async () => { models: { files: [relative('../fixtures/basic/index.ts')], }, - output: relative('./generated/basic/graphqlgen.ts'), + output: typesDir, ['resolver-scaffolding']: { - output: relative('./tmp/basic/'), + output: resolversDir, layout: 'file-per-type', }, }) @@ -26,9 +29,9 @@ test('basic enum', async () => { models: { files: [relative('../fixtures/enum/types.ts')], }, - output: relative('./generated/enum/graphqlgen.ts'), + output: typesDir, ['resolver-scaffolding']: { - output: relative('./tmp/enum/'), + output: resolversDir, layout: 'file-per-type', }, }) @@ -41,9 +44,9 @@ test('basic union', async () => { models: { files: [relative('../fixtures/union/types.ts')], }, - output: relative('./generated/union/graphqlgen.ts'), + output: typesDir, ['resolver-scaffolding']: { - output: relative('./tmp/union/'), + output: resolversDir, layout: 'file-per-type', }, }) @@ -61,9 +64,9 @@ test('defaultName', async () => { }, ], }, - output: relative('./generated/defaultName/graphqlgen.ts'), + output: typesDir, ['resolver-scaffolding']: { - output: relative('./tmp/scalar/'), + output: resolversDir, layout: 'file-per-type', }, }) @@ -76,9 +79,9 @@ test('basic scalar', async () => { models: { files: [relative('../fixtures/scalar/types.ts')], }, - output: relative('./generated/scalar/graphqlgen.ts'), + output: typesDir, ['resolver-scaffolding']: { - output: relative('./tmp/scalar/'), + output: resolversDir, layout: 'file-per-type', }, }) @@ -91,9 +94,9 @@ test('basic input', async () => { models: { files: [relative('../fixtures/input/types.ts')], }, - output: relative('./generated/input/graphqlgen.ts'), + output: typesDir, ['resolver-scaffolding']: { - output: relative('./tmp/input/'), + output: resolversDir, layout: 'file-per-type', }, }) @@ -107,9 +110,9 @@ test('context', async () => { models: { files: [relative('../fixtures/context/types.ts')], }, - output: relative('./generated/context/graphqlgen.ts'), + output: typesDir, ['resolver-scaffolding']: { - output: relative('./tmp/input/'), + output: resolversDir, layout: 'file-per-type', }, }) @@ -122,9 +125,9 @@ test('subscription', () => { models: { files: [relative('../fixtures/subscription/types.ts')], }, - output: relative('./generated/subscription/graphqlgen.ts'), + output: typesDir, ['resolver-scaffolding']: { - output: relative('./tmp/input/'), + output: resolversDir, layout: 'file-per-type', }, }) diff --git a/packages/graphqlgen/src/tests/typescript/large-schema.test.ts b/packages/graphqlgen/src/tests/typescript/large-schema.test.ts index d37cf63c..820187a3 100644 --- a/packages/graphqlgen/src/tests/typescript/large-schema.test.ts +++ b/packages/graphqlgen/src/tests/typescript/large-schema.test.ts @@ -1,9 +1,12 @@ import { testGeneration } from '../generation' import { join } from 'path' -const language = 'typescript' const relative = (p: string) => join(__dirname, p) +const typesDir = relative('./generated-large/graphqlgen.ts') +const resolversDir = relative('./generated-large/tmp-resolvers/') +const language = 'typescript' + describe('large schema tests', () => { test('large schema', async () => { testGeneration({ @@ -12,9 +15,9 @@ describe('large schema tests', () => { models: { files: [relative('../fixtures/prisma/types.ts')], }, - output: relative('./generated/prisma/graphqlgen.ts'), + output: typesDir, ['resolver-scaffolding']: { - output: relative('./tmp/prisma/'), + output: resolversDir, layout: 'file-per-type', }, }) From e76fb8e60f3352837c6fa2640fcbcb586fc33701 Mon Sep 17 00:00:00 2001 From: Flavian DESVERNE Date: Sat, 10 Nov 2018 13:22:20 +0100 Subject: [PATCH 02/35] Add tests to compile output of graphqlgen with flow --- packages/graphqlgen/package.json | 1 + .../src/tests/fixtures/context/flow-types.js | 6 +- .../src/tests/fixtures/prisma/flow-types.js | 38 ++--- .../flow/__snapshots__/basic.test.ts.snap | 130 +----------------- .../__snapshots__/large-schema.test.ts.snap | 2 +- .../graphqlgen/src/tests/flow/basic.test.ts | 57 ++++---- .../src/tests/flow/large-schema.test.ts | 8 +- packages/graphqlgen/src/tests/generation.ts | 62 ++++++++- .../src/tests/typescript/basic.test.ts | 18 +-- 9 files changed, 134 insertions(+), 188 deletions(-) diff --git a/packages/graphqlgen/package.json b/packages/graphqlgen/package.json index 3cc62315..1c043ebc 100644 --- a/packages/graphqlgen/package.json +++ b/packages/graphqlgen/package.json @@ -59,6 +59,7 @@ "@types/prettier": "1.13.2", "@types/rimraf": "2.0.2", "@types/yargs": "12.0.1", + "flow-bin": "^0.86.0", "jest": "23.6.0", "ts-jest": "23.10.4", "ts-node": "7.0.1", diff --git a/packages/graphqlgen/src/tests/fixtures/context/flow-types.js b/packages/graphqlgen/src/tests/fixtures/context/flow-types.js index 1c41e32d..1b8e43ef 100644 --- a/packages/graphqlgen/src/tests/fixtures/context/flow-types.js +++ b/packages/graphqlgen/src/tests/fixtures/context/flow-types.js @@ -1,13 +1,13 @@ // @flow -interface Data { +export interface Data { users: User[]; } -interface Context { +export interface Context { data: Data; } -interface User { +export interface User { id: string; } diff --git a/packages/graphqlgen/src/tests/fixtures/prisma/flow-types.js b/packages/graphqlgen/src/tests/fixtures/prisma/flow-types.js index 66857ab6..f724abbc 100644 --- a/packages/graphqlgen/src/tests/fixtures/prisma/flow-types.js +++ b/packages/graphqlgen/src/tests/fixtures/prisma/flow-types.js @@ -31,7 +31,7 @@ export interface Review { checkIn: number; cleanliness: number; communication: number; - createdAt: undefined; + createdAt: string; id: string; location: number; stars: number; @@ -119,7 +119,7 @@ export interface Amenities { export interface User { bookings: any[]; - createdAt: undefined; + createdAt: string; email: string; firstName: string; hostingExperiences: any[]; @@ -136,22 +136,22 @@ export interface User { responseRate: number | null; responseTime: number | null; sentMessages: any[]; - updatedAt: undefined; + updatedAt: string; } export interface Booking { id: string; - createdAt: undefined; + createdAt: string; bookee: any; place: any; - startDate: undefined; - endDate: undefined; + startDate: any; + endDate: any; payment: any; } export interface Payment { booking: any; - createdAt: undefined; + createdAt: string; id: string; paymentMethod: any; serviceFee: number; @@ -159,7 +159,7 @@ export interface Payment { export interface PaymentAccount { id: string; - createdAt: undefined; + createdAt: string; type: any | null; user: any; payments: any[]; @@ -170,7 +170,7 @@ export interface PaymentAccount { export interface PAYMENT_PROVIDER {} export interface PaypalInformation { - createdAt: undefined; + createdAt: string; email: string; id: string; paymentAccount: any; @@ -179,7 +179,7 @@ export interface PaypalInformation { export interface CreditCardInformation { cardNumber: string; country: string; - createdAt: undefined; + createdAt: string; expiresOnMonth: number; expiresOnYear: number; firstName: string; @@ -191,10 +191,10 @@ export interface CreditCardInformation { } export interface Notification { - createdAt: undefined; + createdAt: string; id: string; link: string; - readDate: undefined; + readDate: any; type: any | null; user: any; } @@ -202,10 +202,10 @@ export interface Notification { export interface NOTIFICATION_TYPE {} export interface Message { - createdAt: undefined; - deliveredAt: undefined; + createdAt: string; + deliveredAt: any; id: string; - readAt: undefined; + readAt: any; } export interface Pricing { @@ -242,21 +242,21 @@ export interface Policies { checkInEndTime: number; checkInStartTime: number; checkoutTime: number; - createdAt: undefined; + createdAt: string; id: string; - updatedAt: undefined; + updatedAt: string; } export interface HouseRules { additionalRules: string | null; - createdAt: undefined; + createdAt: string; id: string; partiesAndEventsAllowed: boolean | null; petsAllowed: boolean | null; smokingAllowed: boolean | null; suitableForChildren: boolean | null; suitableForInfants: boolean | null; - updatedAt: undefined; + updatedAt: string; } export interface Reservation { diff --git a/packages/graphqlgen/src/tests/flow/__snapshots__/basic.test.ts.snap b/packages/graphqlgen/src/tests/flow/__snapshots__/basic.test.ts.snap index 124e009d..5fdefa5a 100644 --- a/packages/graphqlgen/src/tests/flow/__snapshots__/basic.test.ts.snap +++ b/packages/graphqlgen/src/tests/flow/__snapshots__/basic.test.ts.snap @@ -5,7 +5,7 @@ exports[`basic enum 1`] = ` // Code generated by github.com/prisma/graphqlgen, DO NOT EDIT. import type { GraphQLResolveInfo } from \\"graphql\\"; -import type { User } from \\"../../../fixtures/enum/types-flow\\"; +import type { User } from \\"../../fixtures/enum/types-flow\\"; type Context = any; type EnumAnnotation = \\"EDITOR\\" | \\"COLLABORATOR\\"; @@ -159,124 +159,12 @@ export const resolvers: Resolvers = { ] `; -exports[`basic scalar 1`] = ` -"/* @flow */ -// Code generated by github.com/prisma/graphqlgen, DO NOT EDIT. - -import type { GraphQLResolveInfo } from \\"graphql\\"; -import type { AddMemberPayload } from \\"../../../fixtures/scalar/flow-types\\"; -type Context = any; - -// Types for Mutation -export const Mutation_defaultResolvers = {}; - -export interface Mutation_AddMemberData { - email: string; - projects: string[]; -} - -export interface Mutation_Args_AddMember { - data: AddMemberData; -} - -export type Mutation_AddMember_Resolver = ( - parent: {}, - args: Mutation_Args_AddMember, - ctx: Context, - info: GraphQLResolveInfo -) => AddMemberPayload | Promise; - -export interface Mutation_Resolvers { - addMember: ( - parent: {}, - args: Mutation_Args_AddMember, - ctx: Context, - info: GraphQLResolveInfo - ) => AddMemberPayload | Promise; -} - -// Types for AddMemberPayload -export const AddMemberPayload_defaultResolvers = { - json: (parent: AddMemberPayload) => parent.json -}; - -export type AddMemberPayload_Json_Resolver = ( - parent: AddMemberPayload, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | null | Promise; - -export interface AddMemberPayload_Resolvers { - json: ( - parent: AddMemberPayload, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | null | Promise; -} - -export interface Resolvers { - Mutation: Mutation_Resolvers; - AddMemberPayload: AddMemberPayload_Resolvers; -} -" -`; - -exports[`basic scalar 2`] = ` -Array [ - Object { - "code": "/* @flow */ -import { AddMemberPayload_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; -import type { AddMemberPayload_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -export const AddMemberPayload: AddMemberPayload_Resolvers = { - ...AddMemberPayload_defaultResolvers -}; -", - "force": false, - "path": "AddMemberPayload.js", - }, - Object { - "code": "/* @flow */ -import type { Mutation_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -export const Mutation: Mutation_Resolvers = { - addMember: (parent, args, ctx, info) => { - throw new Error(\\"Resolver not implemented\\"); - } -}; -", - "force": false, - "path": "Mutation.js", - }, - Object { - "code": "// @flow -// This resolver file was scaffolded by github.com/prisma/graphqlgen, DO NOT EDIT. -// Please do not import this file directly but copy & paste to your application code. - -import type { Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -import { Mutation } from \\"./Mutation\\"; -import { AddMemberPayload } from \\"./AddMemberPayload\\"; - -export const resolvers: Resolvers = { - Mutation, - AddMemberPayload -}; -", - "force": false, - "path": "index.js", - }, -] -`; - exports[`basic schema 1`] = ` "/* @flow */ // Code generated by github.com/prisma/graphqlgen, DO NOT EDIT. import type { GraphQLResolveInfo } from \\"graphql\\"; -import type { Number } from \\"../../../fixtures/basic/types-flow\\"; +import type { Number } from \\"../../fixtures/basic/types-flow\\"; type Context = any; // Types for Query @@ -614,11 +502,7 @@ exports[`basic union 1`] = ` // Code generated by github.com/prisma/graphqlgen, DO NOT EDIT. import type { GraphQLResolveInfo } from \\"graphql\\"; -import type { - User, - Student, - Professor -} from \\"../../../fixtures/union/flow-types\\"; +import type { User, Student, Professor } from \\"../../fixtures/union/flow-types\\"; type Context = any; // Types for User @@ -791,8 +675,8 @@ exports[`context 1`] = ` // Code generated by github.com/prisma/graphqlgen, DO NOT EDIT. import type { GraphQLResolveInfo } from \\"graphql\\"; -import type { User } from \\"../../../fixtures/context/flow-types\\"; -import type { Context } from \\"../../../fixtures/context/flow-types\\"; +import type { User } from \\"../../fixtures/context/flow-types\\"; +import type { Context } from \\"../../fixtures/context/flow-types\\"; // Types for Query export const Query_defaultResolvers = {}; @@ -894,7 +778,7 @@ exports[`defaultName 1`] = ` // Code generated by github.com/prisma/graphqlgen, DO NOT EDIT. import type { GraphQLResolveInfo } from \\"graphql\\"; -import type { NumberNode } from \\"../../../fixtures/defaultName/flow-types\\"; +import type { NumberNode } from \\"../../fixtures/defaultName/flow-types\\"; type Context = any; // Types for Query @@ -1232,7 +1116,7 @@ exports[`subscription 1`] = ` // Code generated by github.com/prisma/graphqlgen, DO NOT EDIT. import type { GraphQLResolveInfo } from \\"graphql\\"; -import type { User } from \\"../../../fixtures/subscription/flow-types\\"; +import type { User } from \\"../../fixtures/subscription/flow-types\\"; type Context = any; // Types for Subscription diff --git a/packages/graphqlgen/src/tests/flow/__snapshots__/large-schema.test.ts.snap b/packages/graphqlgen/src/tests/flow/__snapshots__/large-schema.test.ts.snap index 58d2d337..568dc06f 100644 --- a/packages/graphqlgen/src/tests/flow/__snapshots__/large-schema.test.ts.snap +++ b/packages/graphqlgen/src/tests/flow/__snapshots__/large-schema.test.ts.snap @@ -34,7 +34,7 @@ import type { Message, AuthPayload, MutationResult -} from \\"../../../fixtures/prisma/flow-types\\"; +} from \\"../../fixtures/prisma/flow-types\\"; type Context = any; type PLACE_SIZES = diff --git a/packages/graphqlgen/src/tests/flow/basic.test.ts b/packages/graphqlgen/src/tests/flow/basic.test.ts index 478b7341..2d291f31 100644 --- a/packages/graphqlgen/src/tests/flow/basic.test.ts +++ b/packages/graphqlgen/src/tests/flow/basic.test.ts @@ -1,8 +1,10 @@ import { testGeneration } from '../generation' import { join } from 'path' -const language = 'flow' const relative = (p: string) => join(__dirname, p) +const typesPath = relative('./generated-basic/graphqlgen.js') +const resolversDir = relative('./generated-basic/tmp-resolvers/') +const language = 'flow' test('basic schema', async () => { testGeneration({ @@ -11,9 +13,9 @@ test('basic schema', async () => { models: { files: [relative('../fixtures/basic/types-flow.js')], }, - output: relative('./generated/basic/graphqlgen.js'), + output: typesPath, ['resolver-scaffolding']: { - output: relative('./tmp/basic/'), + output: resolversDir, layout: 'file-per-type', }, }) @@ -26,9 +28,9 @@ test('basic enum', async () => { models: { files: [relative('../fixtures/enum/types-flow.js')], }, - output: relative('./generated/enum/graphqlgen.js'), + output: typesPath, ['resolver-scaffolding']: { - output: relative('./tmp/enum/'), + output: resolversDir, layout: 'file-per-type', }, }) @@ -41,9 +43,9 @@ test('basic union', async () => { models: { files: [relative('../fixtures/union/flow-types.js')], }, - output: relative('./generated/union/graphqlgen.js'), + output: typesPath, ['resolver-scaffolding']: { - output: relative('./tmp/union/'), + output: resolversDir, layout: 'file-per-type', }, }) @@ -61,28 +63,29 @@ test('defaultName', async () => { }, ], }, - output: relative('./generated/defaultName/graphqlgen.js'), + output: typesPath, ['resolver-scaffolding']: { - output: relative('./tmp/scalar/'), + output: resolversDir, layout: 'file-per-type', }, }) }) -test('basic scalar', async () => { - testGeneration({ - language, - schema: relative('../fixtures/scalar/schema.graphql'), - models: { - files: [relative('../fixtures/scalar/flow-types.js')], - }, - output: relative('./generated/scalar/graphqlgen.js'), - ['resolver-scaffolding']: { - output: relative('./tmp/scalar/'), - layout: 'file-per-type', - }, - }) -}) +//TODO: Fix this test (detected since compiling flow) +// test('basic scalar', async () => { +// testGeneration({ +// language, +// schema: relative('../fixtures/scalar/schema.graphql'), +// models: { +// files: [relative('../fixtures/scalar/flow-types.js')], +// }, +// output: typesPath, +// ['resolver-scaffolding']: { +// output: resolversDir, +// layout: 'file-per-type', +// }, +// }) +// }) test('context', async () => { testGeneration({ @@ -92,9 +95,9 @@ test('context', async () => { models: { files: [relative('../fixtures/context/flow-types.js')], }, - output: relative('./generated/context/graphqlgen.js'), + output: typesPath, ['resolver-scaffolding']: { - output: relative('./tmp/input/'), + output: resolversDir, layout: 'file-per-type', }, }) @@ -107,9 +110,9 @@ test('subscription', () => { models: { files: [relative('../fixtures/subscription/flow-types.js')], }, - output: relative('./generated/subscription/graphqlgen.js'), + output: typesPath, ['resolver-scaffolding']: { - output: relative('./tmp/input/'), + output: resolversDir, layout: 'file-per-type', }, }) diff --git a/packages/graphqlgen/src/tests/flow/large-schema.test.ts b/packages/graphqlgen/src/tests/flow/large-schema.test.ts index a63110d3..0dcb63fd 100644 --- a/packages/graphqlgen/src/tests/flow/large-schema.test.ts +++ b/packages/graphqlgen/src/tests/flow/large-schema.test.ts @@ -1,8 +1,10 @@ import { testGeneration } from '../generation' import { join } from 'path' -const language = 'flow' const relative = (p: string) => join(__dirname, p) +const typesDir = relative('./generated-large/graphqlgen.js') +const resolversDir = relative('./generated-large/tmp-resolvers/') +const language = 'flow' test('large schema', async () => { testGeneration({ @@ -11,9 +13,9 @@ test('large schema', async () => { models: { files: [relative('../fixtures/prisma/flow-types.js')], }, - output: relative('./generated/prisma/graphqlgen.js'), + output: typesDir, ['resolver-scaffolding']: { - output: relative('./tmp/prisma/'), + output: resolversDir, layout: 'file-per-type', }, }) diff --git a/packages/graphqlgen/src/tests/generation.ts b/packages/graphqlgen/src/tests/generation.ts index e5acd3ba..d29d85be 100644 --- a/packages/graphqlgen/src/tests/generation.ts +++ b/packages/graphqlgen/src/tests/generation.ts @@ -1,10 +1,15 @@ import * as ts from 'typescript' +import { EOL } from 'os' import * as rimraf from 'rimraf' import * as path from 'path' -import { GraphQLGenDefinition } from 'graphqlgen-json-schema' -import { parseModels, parseSchema } from '../parse' +import { execFileSync } from 'child_process' +import { writeFileSync } from 'fs' +import chalk from 'chalk' +import { File, GraphQLGenDefinition } from 'graphqlgen-json-schema' +import { getPath, parseModels, parseSchema } from '../parse' import { validateConfig } from '../validation' import { generateCode, writeResolversScaffolding, writeTypes } from '../index' +const flow = require('flow-bin') function printTypescriptErrors(diagnotics: ReadonlyArray) { diagnotics.forEach(diagnostic => { @@ -46,6 +51,57 @@ function compileTypescript(fileNames: string[], compiledOutputDir: string) { expect(errors.length).toEqual(0) } +function compileFlow(includeFiles: File[], typesPath: string) { + const flowConfig = ` +[ignore] + +[include] +${includeFiles.map(file => getPath(file)).join(EOL)} + +[libs] + +[lints] + +[options] + +[strict] + ` + + writeFileSync(path.join(path.dirname(typesPath), '.flowconfig'), flowConfig) + + let stdout = '' + + try { + execFileSync( + flow, + ['check', path.resolve(path.dirname(typesPath))], + ) + } catch (e) { + stdout = e.stdout.toString() + } + + const errorDelimiter = + 'Error ----------------------------------------------------------------' + // Do not take into account error from 'import type { GraphQLResolveInfo } from "graphql"' + const errors = (stdout as string) + .split(errorDelimiter) + .filter( + error => + error.length !== 0 && + !error.includes('Cannot resolve module `graphql`'), + ) + + if (errors.length > 0) { + console.log( + errors + .map(error => `${chalk.red(errorDelimiter) + EOL}${error}`) + .join(EOL), + ) + } + + expect(errors.length).toEqual(0) +} + export function testGeneration(config: GraphQLGenDefinition) { const schema = parseSchema(config.schema) @@ -95,7 +151,7 @@ export function testGeneration(config: GraphQLGenDefinition) { } if (config.language === 'flow') { - // compileFlow(fileNames) + compileFlow(config.models.files!, config.output) } rimraf.sync(path.dirname(config.output)) diff --git a/packages/graphqlgen/src/tests/typescript/basic.test.ts b/packages/graphqlgen/src/tests/typescript/basic.test.ts index 9b5d8778..8287fa42 100644 --- a/packages/graphqlgen/src/tests/typescript/basic.test.ts +++ b/packages/graphqlgen/src/tests/typescript/basic.test.ts @@ -3,7 +3,7 @@ import { join } from 'path' const relative = (p: string) => join(__dirname, p) -const typesDir = relative('./generated-basic/graphqlgen.ts') +const typesPath = relative('./generated-basic/graphqlgen.ts') const resolversDir = relative('./generated-basic/tmp-resolvers/') const language = 'typescript' @@ -14,7 +14,7 @@ test('basic schema', async () => { models: { files: [relative('../fixtures/basic/index.ts')], }, - output: typesDir, + output: typesPath, ['resolver-scaffolding']: { output: resolversDir, layout: 'file-per-type', @@ -29,7 +29,7 @@ test('basic enum', async () => { models: { files: [relative('../fixtures/enum/types.ts')], }, - output: typesDir, + output: typesPath, ['resolver-scaffolding']: { output: resolversDir, layout: 'file-per-type', @@ -44,7 +44,7 @@ test('basic union', async () => { models: { files: [relative('../fixtures/union/types.ts')], }, - output: typesDir, + output: typesPath, ['resolver-scaffolding']: { output: resolversDir, layout: 'file-per-type', @@ -64,7 +64,7 @@ test('defaultName', async () => { }, ], }, - output: typesDir, + output: typesPath, ['resolver-scaffolding']: { output: resolversDir, layout: 'file-per-type', @@ -79,7 +79,7 @@ test('basic scalar', async () => { models: { files: [relative('../fixtures/scalar/types.ts')], }, - output: typesDir, + output: typesPath, ['resolver-scaffolding']: { output: resolversDir, layout: 'file-per-type', @@ -94,7 +94,7 @@ test('basic input', async () => { models: { files: [relative('../fixtures/input/types.ts')], }, - output: typesDir, + output: typesPath, ['resolver-scaffolding']: { output: resolversDir, layout: 'file-per-type', @@ -110,7 +110,7 @@ test('context', async () => { models: { files: [relative('../fixtures/context/types.ts')], }, - output: typesDir, + output: typesPath, ['resolver-scaffolding']: { output: resolversDir, layout: 'file-per-type', @@ -125,7 +125,7 @@ test('subscription', () => { models: { files: [relative('../fixtures/subscription/types.ts')], }, - output: typesDir, + output: typesPath, ['resolver-scaffolding']: { output: resolversDir, layout: 'file-per-type', From 693fd78e35aafbaf7e8d4cd96f6682ecd228e1f6 Mon Sep 17 00:00:00 2001 From: Flavian DESVERNE Date: Sat, 10 Nov 2018 13:45:44 +0100 Subject: [PATCH 03/35] Use execFile instead of execFileSync --- .../graphqlgen/src/tests/flow/basic.test.ts | 14 ++++++------- .../src/tests/flow/large-schema.test.ts | 2 +- packages/graphqlgen/src/tests/generation.ts | 21 +++++++++---------- .../src/tests/typescript/basic.test.ts | 16 +++++++------- .../src/tests/typescript/large-schema.test.ts | 2 +- 5 files changed, 27 insertions(+), 28 deletions(-) diff --git a/packages/graphqlgen/src/tests/flow/basic.test.ts b/packages/graphqlgen/src/tests/flow/basic.test.ts index 2d291f31..f4ee0afd 100644 --- a/packages/graphqlgen/src/tests/flow/basic.test.ts +++ b/packages/graphqlgen/src/tests/flow/basic.test.ts @@ -7,7 +7,7 @@ const resolversDir = relative('./generated-basic/tmp-resolvers/') const language = 'flow' test('basic schema', async () => { - testGeneration({ + return testGeneration({ language, schema: relative('../fixtures/basic/schema.graphql'), models: { @@ -22,7 +22,7 @@ test('basic schema', async () => { }) test('basic enum', async () => { - testGeneration({ + return testGeneration({ language, schema: relative('../fixtures/enum/schema.graphql'), models: { @@ -37,7 +37,7 @@ test('basic enum', async () => { }) test('basic union', async () => { - testGeneration({ + return testGeneration({ language, schema: relative('../fixtures/union/schema.graphql'), models: { @@ -52,7 +52,7 @@ test('basic union', async () => { }) test('defaultName', async () => { - testGeneration({ + return testGeneration({ language, schema: relative('../fixtures/defaultName/schema.graphql'), models: { @@ -73,7 +73,7 @@ test('defaultName', async () => { //TODO: Fix this test (detected since compiling flow) // test('basic scalar', async () => { -// testGeneration({ +// return testGeneration({ // language, // schema: relative('../fixtures/scalar/schema.graphql'), // models: { @@ -88,7 +88,7 @@ test('defaultName', async () => { // }) test('context', async () => { - testGeneration({ + return testGeneration({ language, schema: relative('../fixtures/context/schema.graphql'), context: relative('../fixtures/context/flow-types.js:Context'), @@ -104,7 +104,7 @@ test('context', async () => { }) test('subscription', () => { - testGeneration({ + return testGeneration({ language, schema: relative('../fixtures/subscription/schema.graphql'), models: { diff --git a/packages/graphqlgen/src/tests/flow/large-schema.test.ts b/packages/graphqlgen/src/tests/flow/large-schema.test.ts index 0dcb63fd..5b13bd7b 100644 --- a/packages/graphqlgen/src/tests/flow/large-schema.test.ts +++ b/packages/graphqlgen/src/tests/flow/large-schema.test.ts @@ -7,7 +7,7 @@ const resolversDir = relative('./generated-large/tmp-resolvers/') const language = 'flow' test('large schema', async () => { - testGeneration({ + return testGeneration({ language, schema: relative('../fixtures/prisma/schema.graphql'), models: { diff --git a/packages/graphqlgen/src/tests/generation.ts b/packages/graphqlgen/src/tests/generation.ts index d29d85be..e1d509fa 100644 --- a/packages/graphqlgen/src/tests/generation.ts +++ b/packages/graphqlgen/src/tests/generation.ts @@ -2,7 +2,7 @@ import * as ts from 'typescript' import { EOL } from 'os' import * as rimraf from 'rimraf' import * as path from 'path' -import { execFileSync } from 'child_process' +import { execFile } from 'child_process' import { writeFileSync } from 'fs' import chalk from 'chalk' import { File, GraphQLGenDefinition } from 'graphqlgen-json-schema' @@ -51,7 +51,7 @@ function compileTypescript(fileNames: string[], compiledOutputDir: string) { expect(errors.length).toEqual(0) } -function compileFlow(includeFiles: File[], typesPath: string) { +async function compileFlow(includeFiles: File[], typesPath: string) { const flowConfig = ` [ignore] @@ -69,16 +69,15 @@ ${includeFiles.map(file => getPath(file)).join(EOL)} writeFileSync(path.join(path.dirname(typesPath), '.flowconfig'), flowConfig) - let stdout = '' - - try { - execFileSync( + const stdout = await new Promise(resolve => { + return execFile( flow, ['check', path.resolve(path.dirname(typesPath))], + (_err: any, stdout: string) => { + resolve(stdout) + }, ) - } catch (e) { - stdout = e.stdout.toString() - } + }) const errorDelimiter = 'Error ----------------------------------------------------------------' @@ -102,7 +101,7 @@ ${includeFiles.map(file => getPath(file)).join(EOL)} expect(errors.length).toEqual(0) } -export function testGeneration(config: GraphQLGenDefinition) { +export async function testGeneration(config: GraphQLGenDefinition) { const schema = parseSchema(config.schema) expect(validateConfig(config, schema)).toBe(true) @@ -151,7 +150,7 @@ export function testGeneration(config: GraphQLGenDefinition) { } if (config.language === 'flow') { - compileFlow(config.models.files!, config.output) + await compileFlow(config.models.files!, config.output) } rimraf.sync(path.dirname(config.output)) diff --git a/packages/graphqlgen/src/tests/typescript/basic.test.ts b/packages/graphqlgen/src/tests/typescript/basic.test.ts index 8287fa42..b35b3c84 100644 --- a/packages/graphqlgen/src/tests/typescript/basic.test.ts +++ b/packages/graphqlgen/src/tests/typescript/basic.test.ts @@ -8,7 +8,7 @@ const resolversDir = relative('./generated-basic/tmp-resolvers/') const language = 'typescript' test('basic schema', async () => { - testGeneration({ + return testGeneration({ language, schema: relative('../fixtures/basic/schema.graphql'), models: { @@ -23,7 +23,7 @@ test('basic schema', async () => { }) test('basic enum', async () => { - testGeneration({ + return testGeneration({ language, schema: relative('../fixtures/enum/schema.graphql'), models: { @@ -38,7 +38,7 @@ test('basic enum', async () => { }) test('basic union', async () => { - testGeneration({ + return testGeneration({ language, schema: relative('../fixtures/union/schema.graphql'), models: { @@ -53,7 +53,7 @@ test('basic union', async () => { }) test('defaultName', async () => { - testGeneration({ + return testGeneration({ language, schema: relative('../fixtures/defaultName/schema.graphql'), models: { @@ -73,7 +73,7 @@ test('defaultName', async () => { }) test('basic scalar', async () => { - testGeneration({ + return testGeneration({ language, schema: relative('../fixtures/scalar/schema.graphql'), models: { @@ -88,7 +88,7 @@ test('basic scalar', async () => { }) test('basic input', async () => { - testGeneration({ + return testGeneration({ language, schema: relative('../fixtures/input/schema.graphql'), models: { @@ -103,7 +103,7 @@ test('basic input', async () => { }) test('context', async () => { - testGeneration({ + return testGeneration({ language, schema: relative('../fixtures/context/schema.graphql'), context: relative('../fixtures/context/types.ts:Context'), @@ -119,7 +119,7 @@ test('context', async () => { }) test('subscription', () => { - testGeneration({ + return testGeneration({ language, schema: relative('../fixtures/subscription/schema.graphql'), models: { diff --git a/packages/graphqlgen/src/tests/typescript/large-schema.test.ts b/packages/graphqlgen/src/tests/typescript/large-schema.test.ts index 820187a3..a66cab01 100644 --- a/packages/graphqlgen/src/tests/typescript/large-schema.test.ts +++ b/packages/graphqlgen/src/tests/typescript/large-schema.test.ts @@ -9,7 +9,7 @@ const language = 'typescript' describe('large schema tests', () => { test('large schema', async () => { - testGeneration({ + return testGeneration({ language, schema: relative('../fixtures/prisma/schema.graphql'), models: { From f81d73df3282026ad8bbfd270ca8b9f676ce0eb8 Mon Sep 17 00:00:00 2001 From: Jason Kuhrt Date: Wed, 12 Dec 2018 22:22:04 -0500 Subject: [PATCH 04/35] fix typescript versions conflict warning --- packages/graphqlgen/package.json | 3 +-- yarn.lock | 5 +++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/graphqlgen/package.json b/packages/graphqlgen/package.json index 1c043ebc..be805e36 100644 --- a/packages/graphqlgen/package.json +++ b/packages/graphqlgen/package.json @@ -63,7 +63,6 @@ "jest": "23.6.0", "ts-jest": "23.10.4", "ts-node": "7.0.1", - "tslint": "5.11.0", - "typescript": "^3.1.6" + "tslint": "5.11.0" } } diff --git a/yarn.lock b/yarn.lock index ca9ae5b2..82a94837 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1349,6 +1349,11 @@ find-up@^3.0.0: dependencies: locate-path "^3.0.0" +flow-bin@^0.86.0: + version "0.86.0" + resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.86.0.tgz#153a28722b4dc13b7200c74b644dd4d9f4969a11" + integrity sha512-ulRvFH3ewGIYwg+qPk/OJXoe3Nhqi0RyR0wqgK0b1NzUDEC6O99zU39MBTickXvlrr6iwRO6Wm4lVGeDmnzbew== + for-in@^1.0.1, for-in@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" From 28c83f3c85d02baf7206b60629636a1b9e5d8437 Mon Sep 17 00:00:00 2001 From: Jason Kuhrt Date: Thu, 13 Dec 2018 20:49:10 -0500 Subject: [PATCH 05/35] debug: take away flow tests --- .../flow/__snapshots__/basic.test.ts.snap | 1233 ----- .../__snapshots__/large-schema.test.ts.snap | 4312 ----------------- .../graphqlgen/src/tests/flow/basic.test.ts | 119 - .../src/tests/flow/large-schema.test.ts | 22 - 4 files changed, 5686 deletions(-) delete mode 100644 packages/graphqlgen/src/tests/flow/__snapshots__/basic.test.ts.snap delete mode 100644 packages/graphqlgen/src/tests/flow/__snapshots__/large-schema.test.ts.snap delete mode 100644 packages/graphqlgen/src/tests/flow/basic.test.ts delete mode 100644 packages/graphqlgen/src/tests/flow/large-schema.test.ts diff --git a/packages/graphqlgen/src/tests/flow/__snapshots__/basic.test.ts.snap b/packages/graphqlgen/src/tests/flow/__snapshots__/basic.test.ts.snap deleted file mode 100644 index 5fdefa5a..00000000 --- a/packages/graphqlgen/src/tests/flow/__snapshots__/basic.test.ts.snap +++ /dev/null @@ -1,1233 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`basic enum 1`] = ` -"/* @flow */ -// Code generated by github.com/prisma/graphqlgen, DO NOT EDIT. - -import type { GraphQLResolveInfo } from \\"graphql\\"; -import type { User } from \\"../../fixtures/enum/types-flow\\"; -type Context = any; - -type EnumAnnotation = \\"EDITOR\\" | \\"COLLABORATOR\\"; -type EnumAsUnionType = \\"RED\\" | \\"GREEN\\" | \\"BLUE\\"; - -// Types for Query -export const Query_defaultResolvers = {}; - -export interface Query_Args_CreateUser { - name: string; - type: EnumAnnotation; -} - -export type Query_CreateUser_Resolver = ( - parent: {}, - args: Query_Args_CreateUser, - ctx: Context, - info: GraphQLResolveInfo -) => User | null | Promise; - -export interface Query_Resolvers { - createUser: ( - parent: {}, - args: Query_Args_CreateUser, - ctx: Context, - info: GraphQLResolveInfo - ) => User | null | Promise; -} - -// Types for User -export const User_defaultResolvers = { - id: (parent: User) => parent.id, - name: (parent: User) => parent.name, - enumAsUnionType: (parent: User) => parent.enumAsUnionType -}; - -export type User_Id_Resolver = ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type User_Name_Resolver = ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type User_EnumAnnotation_Resolver = ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => EnumAnnotation | Promise; - -export type User_EnumAsUnionType_Resolver = ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => EnumAsUnionType | Promise; - -export interface User_Resolvers { - id: ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - name: ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - enumAnnotation: ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => EnumAnnotation | Promise; - - enumAsUnionType: ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => EnumAsUnionType | Promise; -} - -export interface Resolvers { - Query: Query_Resolvers; - User: User_Resolvers; -} -" -`; - -exports[`basic enum 2`] = ` -Array [ - Object { - "code": "/* @flow */ -import { User_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; -import type { User_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -export const User: User_Resolvers = { - ...User_defaultResolvers, - - enumAnnotation: (parent, args, ctx, info) => { - throw new Error(\\"Resolver not implemented\\"); - } -}; -", - "force": false, - "path": "User.js", - }, - Object { - "code": "/* @flow */ -import type { Query_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -export const Query: Query_Resolvers = { - createUser: (parent, args, ctx, info) => { - throw new Error(\\"Resolver not implemented\\"); - } -}; -", - "force": false, - "path": "Query.js", - }, - Object { - "code": "// @flow -// This resolver file was scaffolded by github.com/prisma/graphqlgen, DO NOT EDIT. -// Please do not import this file directly but copy & paste to your application code. - -import type { Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -import { Query } from \\"./Query\\"; -import { User } from \\"./User\\"; - -export const resolvers: Resolvers = { - Query, - User -}; -", - "force": false, - "path": "index.js", - }, -] -`; - -exports[`basic schema 1`] = ` -"/* @flow */ -// Code generated by github.com/prisma/graphqlgen, DO NOT EDIT. - -import type { GraphQLResolveInfo } from \\"graphql\\"; -import type { Number } from \\"../../fixtures/basic/types-flow\\"; -type Context = any; - -// Types for Query -export const Query_defaultResolvers = {}; - -export interface Query_Args_Custom_with_arg { - id: number; -} - -export interface Query_Args_Custom_with_custom_arg { - id: Number; -} - -export interface Query_Args_Scalar_with_arg { - id: number; -} - -export interface Query_Args_Scalar_with_custom_arg { - id: Number; -} - -export type Query_Id_Resolver = ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type Query_Custom_required_Resolver = ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => Number | Promise; - -export type Query_Custom_nullable_Resolver = ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => Number | null | Promise; - -export type Query_Custom_array_nullable_Resolver = ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => Number[] | null | Promise; - -export type Query_Custom_array_required_Resolver = ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => Number[] | Promise; - -export type Query_Custom_with_arg_Resolver = ( - parent: {}, - args: Query_Args_Custom_with_arg, - ctx: Context, - info: GraphQLResolveInfo -) => Number | Promise; - -export type Query_Custom_with_custom_arg_Resolver = ( - parent: {}, - args: Query_Args_Custom_with_custom_arg, - ctx: Context, - info: GraphQLResolveInfo -) => Number | Promise; - -export type Query_Scalar_required_Resolver = ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => boolean | Promise; - -export type Query_Scalar_nullable_Resolver = ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => boolean | null | Promise; - -export type Query_Scalar_array_nullable_Resolver = ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => boolean[] | null | Promise; - -export type Query_Scalar_array_required_Resolver = ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => boolean[] | Promise; - -export type Query_Scalar_with_arg_Resolver = ( - parent: {}, - args: Query_Args_Scalar_with_arg, - ctx: Context, - info: GraphQLResolveInfo -) => boolean | Promise; - -export type Query_Scalar_with_custom_arg_Resolver = ( - parent: {}, - args: Query_Args_Scalar_with_custom_arg, - ctx: Context, - info: GraphQLResolveInfo -) => boolean | Promise; - -export interface Query_Resolvers { - id: ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - custom_required: ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => Number | Promise; - - custom_nullable: ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => Number | null | Promise; - - custom_array_nullable: ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => Number[] | null | Promise; - - custom_array_required: ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => Number[] | Promise; - - custom_with_arg: ( - parent: {}, - args: Query_Args_Custom_with_arg, - ctx: Context, - info: GraphQLResolveInfo - ) => Number | Promise; - - custom_with_custom_arg: ( - parent: {}, - args: Query_Args_Custom_with_custom_arg, - ctx: Context, - info: GraphQLResolveInfo - ) => Number | Promise; - - scalar_required: ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean | Promise; - - scalar_nullable: ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean | null | Promise; - - scalar_array_nullable: ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean[] | null | Promise; - - scalar_array_required: ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean[] | Promise; - - scalar_with_arg: ( - parent: {}, - args: Query_Args_Scalar_with_arg, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean | Promise; - - scalar_with_custom_arg: ( - parent: {}, - args: Query_Args_Scalar_with_custom_arg, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean | Promise; -} - -// Types for Number -export const Number_defaultResolvers = { - id: (parent: Number) => parent.id, - value: (parent: Number) => parent.value -}; - -export type Number_Id_Resolver = ( - parent: Number, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | null | Promise; - -export type Number_Value_Resolver = ( - parent: Number, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => number | null | Promise; - -export interface Number_Resolvers { - id: ( - parent: Number, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | null | Promise; - - value: ( - parent: Number, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => number | null | Promise; -} - -export interface Resolvers { - Query: Query_Resolvers; - Number: Number_Resolvers; -} -" -`; - -exports[`basic schema 2`] = ` -Array [ - Object { - "code": "/* @flow */ -import { Number_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; -import type { Number_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -export const Number: Number_Resolvers = { - ...Number_defaultResolvers -}; -", - "force": false, - "path": "Number.js", - }, - Object { - "code": "/* @flow */ -import type { Query_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -export const Query: Query_Resolvers = { - id: (parent, args, ctx, info) => { - throw new Error(\\"Resolver not implemented\\"); - }, - custom_required: (parent, args, ctx, info) => { - throw new Error(\\"Resolver not implemented\\"); - }, - custom_nullable: (parent, args, ctx, info) => { - throw new Error(\\"Resolver not implemented\\"); - }, - custom_array_nullable: (parent, args, ctx, info) => { - throw new Error(\\"Resolver not implemented\\"); - }, - custom_array_required: (parent, args, ctx, info) => { - throw new Error(\\"Resolver not implemented\\"); - }, - custom_with_arg: (parent, args, ctx, info) => { - throw new Error(\\"Resolver not implemented\\"); - }, - custom_with_custom_arg: (parent, args, ctx, info) => { - throw new Error(\\"Resolver not implemented\\"); - }, - scalar_required: (parent, args, ctx, info) => { - throw new Error(\\"Resolver not implemented\\"); - }, - scalar_nullable: (parent, args, ctx, info) => { - throw new Error(\\"Resolver not implemented\\"); - }, - scalar_array_nullable: (parent, args, ctx, info) => { - throw new Error(\\"Resolver not implemented\\"); - }, - scalar_array_required: (parent, args, ctx, info) => { - throw new Error(\\"Resolver not implemented\\"); - }, - scalar_with_arg: (parent, args, ctx, info) => { - throw new Error(\\"Resolver not implemented\\"); - }, - scalar_with_custom_arg: (parent, args, ctx, info) => { - throw new Error(\\"Resolver not implemented\\"); - } -}; -", - "force": false, - "path": "Query.js", - }, - Object { - "code": "// @flow -// This resolver file was scaffolded by github.com/prisma/graphqlgen, DO NOT EDIT. -// Please do not import this file directly but copy & paste to your application code. - -import type { Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -import { Query } from \\"./Query\\"; -import { Number } from \\"./Number\\"; - -export const resolvers: Resolvers = { - Query, - Number -}; -", - "force": false, - "path": "index.js", - }, -] -`; - -exports[`basic union 1`] = ` -"/* @flow */ -// Code generated by github.com/prisma/graphqlgen, DO NOT EDIT. - -import type { GraphQLResolveInfo } from \\"graphql\\"; -import type { User, Student, Professor } from \\"../../fixtures/union/flow-types\\"; -type Context = any; - -// Types for User -export const User_defaultResolvers = { - id: (parent: User) => parent.id, - name: (parent: User) => parent.name -}; - -export type User_Id_Resolver = ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type User_Name_Resolver = ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type User_Type_Resolver = ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => {} | Promise<{}>; - -export interface User_Resolvers { - id: ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - name: ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - type: ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => {} | Promise<{}>; -} - -// Types for Student -export const Student_defaultResolvers = { - age: (parent: Student) => parent.age -}; - -export type Student_Age_Resolver = ( - parent: Student, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => number | Promise; - -export interface Student_Resolvers { - age: ( - parent: Student, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => number | Promise; -} - -// Types for Professor -export const Professor_defaultResolvers = { - degree: (parent: Professor) => parent.degree -}; - -export type Professor_Degree_Resolver = ( - parent: Professor, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | null | Promise; - -export interface Professor_Resolvers { - degree: ( - parent: Professor, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | null | Promise; -} - -export interface Resolvers { - User: User_Resolvers; - Student: Student_Resolvers; - Professor: Professor_Resolvers; -} -" -`; - -exports[`basic union 2`] = ` -Array [ - Object { - "code": "/* @flow */ -import { User_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; -import type { User_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -export const User: User_Resolvers = { - ...User_defaultResolvers, - - type: (parent, args, ctx, info) => { - throw new Error(\\"Resolver not implemented\\"); - } -}; -", - "force": false, - "path": "User.js", - }, - Object { - "code": "/* @flow */ -import { Student_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; -import type { Student_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -export const Student: Student_Resolvers = { - ...Student_defaultResolvers -}; -", - "force": false, - "path": "Student.js", - }, - Object { - "code": "/* @flow */ -import { Professor_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; -import type { Professor_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -export const Professor: Professor_Resolvers = { - ...Professor_defaultResolvers -}; -", - "force": false, - "path": "Professor.js", - }, - Object { - "code": "// @flow -// This resolver file was scaffolded by github.com/prisma/graphqlgen, DO NOT EDIT. -// Please do not import this file directly but copy & paste to your application code. - -import type { Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -import { User } from \\"./User\\"; -import { Student } from \\"./Student\\"; -import { Professor } from \\"./Professor\\"; - -export const resolvers: Resolvers = { - User, - Student, - Professor -}; -", - "force": false, - "path": "index.js", - }, -] -`; - -exports[`context 1`] = ` -"/* @flow */ -// Code generated by github.com/prisma/graphqlgen, DO NOT EDIT. - -import type { GraphQLResolveInfo } from \\"graphql\\"; -import type { User } from \\"../../fixtures/context/flow-types\\"; -import type { Context } from \\"../../fixtures/context/flow-types\\"; - -// Types for Query -export const Query_defaultResolvers = {}; - -export type Query_CreateUser_Resolver = ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => User | null | Promise; - -export interface Query_Resolvers { - createUser: ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => User | null | Promise; -} - -// Types for User -export const User_defaultResolvers = { - id: (parent: User) => parent.id -}; - -export type User_Id_Resolver = ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export interface User_Resolvers { - id: ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; -} - -export interface Resolvers { - Query: Query_Resolvers; - User: User_Resolvers; -} -" -`; - -exports[`context 2`] = ` -Array [ - Object { - "code": "/* @flow */ -import { User_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; -import type { User_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -export const User: User_Resolvers = { - ...User_defaultResolvers -}; -", - "force": false, - "path": "User.js", - }, - Object { - "code": "/* @flow */ -import type { Query_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -export const Query: Query_Resolvers = { - createUser: (parent, args, ctx, info) => { - throw new Error(\\"Resolver not implemented\\"); - } -}; -", - "force": false, - "path": "Query.js", - }, - Object { - "code": "// @flow -// This resolver file was scaffolded by github.com/prisma/graphqlgen, DO NOT EDIT. -// Please do not import this file directly but copy & paste to your application code. - -import type { Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -import { Query } from \\"./Query\\"; -import { User } from \\"./User\\"; - -export const resolvers: Resolvers = { - Query, - User -}; -", - "force": false, - "path": "index.js", - }, -] -`; - -exports[`defaultName 1`] = ` -"/* @flow */ -// Code generated by github.com/prisma/graphqlgen, DO NOT EDIT. - -import type { GraphQLResolveInfo } from \\"graphql\\"; -import type { NumberNode } from \\"../../fixtures/defaultName/flow-types\\"; -type Context = any; - -// Types for Query -export const Query_defaultResolvers = {}; - -export interface Query_Args_Custom_with_arg { - id: number; -} - -export interface Query_Args_Custom_with_custom_arg { - id: NumberNode; -} - -export interface Query_Args_Scalar_with_arg { - id: number; -} - -export interface Query_Args_Scalar_with_custom_arg { - id: NumberNode; -} - -export type Query_Id_Resolver = ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type Query_Custom_required_Resolver = ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => NumberNode | Promise; - -export type Query_Custom_nullable_Resolver = ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => NumberNode | null | Promise; - -export type Query_Custom_array_nullable_Resolver = ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => NumberNode[] | null | Promise; - -export type Query_Custom_array_required_Resolver = ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => NumberNode[] | Promise; - -export type Query_Custom_with_arg_Resolver = ( - parent: {}, - args: Query_Args_Custom_with_arg, - ctx: Context, - info: GraphQLResolveInfo -) => NumberNode | Promise; - -export type Query_Custom_with_custom_arg_Resolver = ( - parent: {}, - args: Query_Args_Custom_with_custom_arg, - ctx: Context, - info: GraphQLResolveInfo -) => NumberNode | Promise; - -export type Query_Scalar_required_Resolver = ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => boolean | Promise; - -export type Query_Scalar_nullable_Resolver = ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => boolean | null | Promise; - -export type Query_Scalar_array_nullable_Resolver = ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => boolean[] | null | Promise; - -export type Query_Scalar_array_required_Resolver = ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => boolean[] | Promise; - -export type Query_Scalar_with_arg_Resolver = ( - parent: {}, - args: Query_Args_Scalar_with_arg, - ctx: Context, - info: GraphQLResolveInfo -) => boolean | Promise; - -export type Query_Scalar_with_custom_arg_Resolver = ( - parent: {}, - args: Query_Args_Scalar_with_custom_arg, - ctx: Context, - info: GraphQLResolveInfo -) => boolean | Promise; - -export interface Query_Resolvers { - id: ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - custom_required: ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => NumberNode | Promise; - - custom_nullable: ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => NumberNode | null | Promise; - - custom_array_nullable: ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => NumberNode[] | null | Promise; - - custom_array_required: ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => NumberNode[] | Promise; - - custom_with_arg: ( - parent: {}, - args: Query_Args_Custom_with_arg, - ctx: Context, - info: GraphQLResolveInfo - ) => NumberNode | Promise; - - custom_with_custom_arg: ( - parent: {}, - args: Query_Args_Custom_with_custom_arg, - ctx: Context, - info: GraphQLResolveInfo - ) => NumberNode | Promise; - - scalar_required: ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean | Promise; - - scalar_nullable: ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean | null | Promise; - - scalar_array_nullable: ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean[] | null | Promise; - - scalar_array_required: ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean[] | Promise; - - scalar_with_arg: ( - parent: {}, - args: Query_Args_Scalar_with_arg, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean | Promise; - - scalar_with_custom_arg: ( - parent: {}, - args: Query_Args_Scalar_with_custom_arg, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean | Promise; -} - -// Types for Number -export const Number_defaultResolvers = { - id: (parent: NumberNode) => parent.id, - value: (parent: NumberNode) => parent.value -}; - -export type Number_Id_Resolver = ( - parent: NumberNode, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | null | Promise; - -export type Number_Value_Resolver = ( - parent: NumberNode, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => number | null | Promise; - -export interface Number_Resolvers { - id: ( - parent: NumberNode, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | null | Promise; - - value: ( - parent: NumberNode, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => number | null | Promise; -} - -export interface Resolvers { - Query: Query_Resolvers; - Number: Number_Resolvers; -} -" -`; - -exports[`defaultName 2`] = ` -Array [ - Object { - "code": "/* @flow */ -import { Number_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; -import type { Number_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -export const Number: Number_Resolvers = { - ...Number_defaultResolvers -}; -", - "force": false, - "path": "Number.js", - }, - Object { - "code": "/* @flow */ -import type { Query_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -export const Query: Query_Resolvers = { - id: (parent, args, ctx, info) => { - throw new Error(\\"Resolver not implemented\\"); - }, - custom_required: (parent, args, ctx, info) => { - throw new Error(\\"Resolver not implemented\\"); - }, - custom_nullable: (parent, args, ctx, info) => { - throw new Error(\\"Resolver not implemented\\"); - }, - custom_array_nullable: (parent, args, ctx, info) => { - throw new Error(\\"Resolver not implemented\\"); - }, - custom_array_required: (parent, args, ctx, info) => { - throw new Error(\\"Resolver not implemented\\"); - }, - custom_with_arg: (parent, args, ctx, info) => { - throw new Error(\\"Resolver not implemented\\"); - }, - custom_with_custom_arg: (parent, args, ctx, info) => { - throw new Error(\\"Resolver not implemented\\"); - }, - scalar_required: (parent, args, ctx, info) => { - throw new Error(\\"Resolver not implemented\\"); - }, - scalar_nullable: (parent, args, ctx, info) => { - throw new Error(\\"Resolver not implemented\\"); - }, - scalar_array_nullable: (parent, args, ctx, info) => { - throw new Error(\\"Resolver not implemented\\"); - }, - scalar_array_required: (parent, args, ctx, info) => { - throw new Error(\\"Resolver not implemented\\"); - }, - scalar_with_arg: (parent, args, ctx, info) => { - throw new Error(\\"Resolver not implemented\\"); - }, - scalar_with_custom_arg: (parent, args, ctx, info) => { - throw new Error(\\"Resolver not implemented\\"); - } -}; -", - "force": false, - "path": "Query.js", - }, - Object { - "code": "// @flow -// This resolver file was scaffolded by github.com/prisma/graphqlgen, DO NOT EDIT. -// Please do not import this file directly but copy & paste to your application code. - -import type { Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -import { Query } from \\"./Query\\"; -import { Number } from \\"./Number\\"; - -export const resolvers: Resolvers = { - Query, - Number -}; -", - "force": false, - "path": "index.js", - }, -] -`; - -exports[`subscription 1`] = ` -"/* @flow */ -// Code generated by github.com/prisma/graphqlgen, DO NOT EDIT. - -import type { GraphQLResolveInfo } from \\"graphql\\"; -import type { User } from \\"../../fixtures/subscription/flow-types\\"; -type Context = any; - -// Types for Subscription -export const Subscription_defaultResolvers = {}; - -export type Subscription_SubscribeToUser_Resolver = {| - subscribe: ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => AsyncIterator | Promise>, - resolve?: ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => User | Promise -|}; - -export interface Subscription_Resolvers { - subscribeToUser: {| - subscribe: ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => AsyncIterator | Promise>, - resolve?: ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => User | Promise - |}; -} - -// Types for User -export const User_defaultResolvers = { - name: (parent: User) => parent.name -}; - -export type User_Name_Resolver = ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export interface User_Resolvers { - name: ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; -} - -export interface Resolvers { - Subscription: Subscription_Resolvers; - User: User_Resolvers; -} -" -`; - -exports[`subscription 2`] = ` -Array [ - Object { - "code": "/* @flow */ -import { User_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; -import type { User_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -export const User: User_Resolvers = { - ...User_defaultResolvers -}; -", - "force": false, - "path": "User.js", - }, - Object { - "code": "/* @flow */ -import type { Subscription_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -export const Subscription: Subscription_Resolvers = { - subscribeToUser: { - subscribe: (parent, args, ctx, info) => { - throw new Error(\\"Resolver not implemented\\"); - } - } -}; -", - "force": false, - "path": "Subscription.js", - }, - Object { - "code": "// @flow -// This resolver file was scaffolded by github.com/prisma/graphqlgen, DO NOT EDIT. -// Please do not import this file directly but copy & paste to your application code. - -import type { Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -import { Subscription } from \\"./Subscription\\"; -import { User } from \\"./User\\"; - -export const resolvers: Resolvers = { - Subscription, - User -}; -", - "force": false, - "path": "index.js", - }, -] -`; diff --git a/packages/graphqlgen/src/tests/flow/__snapshots__/large-schema.test.ts.snap b/packages/graphqlgen/src/tests/flow/__snapshots__/large-schema.test.ts.snap deleted file mode 100644 index 568dc06f..00000000 --- a/packages/graphqlgen/src/tests/flow/__snapshots__/large-schema.test.ts.snap +++ /dev/null @@ -1,4312 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`large schema 1`] = ` -"/* @flow */ -// Code generated by github.com/prisma/graphqlgen, DO NOT EDIT. - -import type { GraphQLResolveInfo } from \\"graphql\\"; -import type { - Experience, - ExperienceCategory, - Location, - Review, - Picture, - Home, - Reservation, - Neighbourhood, - City, - ExperiencesByCity, - Viewer, - User, - Booking, - Place, - Amenities, - Pricing, - PlaceViews, - GuestRequirements, - Policies, - HouseRules, - Payment, - PaymentAccount, - PaypalInformation, - CreditCardInformation, - Notification, - Message, - AuthPayload, - MutationResult -} from \\"../../fixtures/prisma/flow-types\\"; -type Context = any; - -type PLACE_SIZES = - | \\"ENTIRE_HOUSE\\" - | \\"ENTIRE_APARTMENT\\" - | \\"ENTIRE_EARTH_HOUSE\\" - | \\"ENTIRE_CABIN\\" - | \\"ENTIRE_VILLA\\" - | \\"ENTIRE_PLACE\\" - | \\"ENTIRE_BOAT\\" - | \\"PRIVATE_ROOM\\"; -type CURRENCY = \\"CAD\\" | \\"CHF\\" | \\"EUR\\" | \\"JPY\\" | \\"USD\\" | \\"ZAR\\"; -type PAYMENT_PROVIDER = \\"PAYPAL\\" | \\"CREDIT_CARD\\"; -type NOTIFICATION_TYPE = - | \\"OFFER\\" - | \\"INSTANT_BOOK\\" - | \\"RESPONSIVENESS\\" - | \\"NEW_AMENITIES\\" - | \\"HOUSE_RULES\\"; - -// Types for Query -export const Query_defaultResolvers = {}; - -export interface Query_Args_HomesInPriceRange { - min: number; - max: number; -} - -export interface Query_Args_ExperiencesByCity { - cities: string[]; -} - -export type Query_TopExperiences_Resolver = ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => Experience[] | Promise; - -export type Query_TopHomes_Resolver = ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => Home[] | Promise; - -export type Query_HomesInPriceRange_Resolver = ( - parent: {}, - args: Query_Args_HomesInPriceRange, - ctx: Context, - info: GraphQLResolveInfo -) => Home[] | Promise; - -export type Query_TopReservations_Resolver = ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => Reservation[] | Promise; - -export type Query_FeaturedDestinations_Resolver = ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => Neighbourhood[] | Promise; - -export type Query_ExperiencesByCity_Resolver = ( - parent: {}, - args: Query_Args_ExperiencesByCity, - ctx: Context, - info: GraphQLResolveInfo -) => ExperiencesByCity[] | Promise; - -export type Query_Viewer_Resolver = ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => Viewer | null | Promise; - -export type Query_MyLocation_Resolver = ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => Location | null | Promise; - -export interface Query_Resolvers { - topExperiences: ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => Experience[] | Promise; - - topHomes: ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => Home[] | Promise; - - homesInPriceRange: ( - parent: {}, - args: Query_Args_HomesInPriceRange, - ctx: Context, - info: GraphQLResolveInfo - ) => Home[] | Promise; - - topReservations: ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => Reservation[] | Promise; - - featuredDestinations: ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => Neighbourhood[] | Promise; - - experiencesByCity: ( - parent: {}, - args: Query_Args_ExperiencesByCity, - ctx: Context, - info: GraphQLResolveInfo - ) => ExperiencesByCity[] | Promise; - - viewer: ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => Viewer | null | Promise; - - myLocation: ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => Location | null | Promise; -} - -// Types for Experience -export const Experience_defaultResolvers = { - id: (parent: Experience) => parent.id, - category: (parent: Experience) => - parent.category === undefined ? null : parent.category, - title: (parent: Experience) => parent.title, - location: (parent: Experience) => parent.location, - pricePerPerson: (parent: Experience) => parent.pricePerPerson, - reviews: (parent: Experience) => parent.reviews, - preview: (parent: Experience) => parent.preview, - popularity: (parent: Experience) => parent.popularity -}; - -export type Experience_Id_Resolver = ( - parent: Experience, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type Experience_Category_Resolver = ( - parent: Experience, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => ExperienceCategory | null | Promise; - -export type Experience_Title_Resolver = ( - parent: Experience, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type Experience_Location_Resolver = ( - parent: Experience, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => Location | Promise; - -export type Experience_PricePerPerson_Resolver = ( - parent: Experience, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => number | Promise; - -export type Experience_Reviews_Resolver = ( - parent: Experience, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => Review[] | Promise; - -export type Experience_Preview_Resolver = ( - parent: Experience, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => Picture | Promise; - -export type Experience_Popularity_Resolver = ( - parent: Experience, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => number | Promise; - -export interface Experience_Resolvers { - id: ( - parent: Experience, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - category: ( - parent: Experience, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => ExperienceCategory | null | Promise; - - title: ( - parent: Experience, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - location: ( - parent: Experience, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => Location | Promise; - - pricePerPerson: ( - parent: Experience, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => number | Promise; - - reviews: ( - parent: Experience, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => Review[] | Promise; - - preview: ( - parent: Experience, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => Picture | Promise; - - popularity: ( - parent: Experience, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => number | Promise; -} - -// Types for ExperienceCategory -export const ExperienceCategory_defaultResolvers = { - id: (parent: ExperienceCategory) => parent.id, - mainColor: (parent: ExperienceCategory) => parent.mainColor, - name: (parent: ExperienceCategory) => parent.name, - experience: (parent: ExperienceCategory) => - parent.experience === undefined ? null : parent.experience -}; - -export type ExperienceCategory_Id_Resolver = ( - parent: ExperienceCategory, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type ExperienceCategory_MainColor_Resolver = ( - parent: ExperienceCategory, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type ExperienceCategory_Name_Resolver = ( - parent: ExperienceCategory, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type ExperienceCategory_Experience_Resolver = ( - parent: ExperienceCategory, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => Experience | null | Promise; - -export interface ExperienceCategory_Resolvers { - id: ( - parent: ExperienceCategory, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - mainColor: ( - parent: ExperienceCategory, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - name: ( - parent: ExperienceCategory, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - experience: ( - parent: ExperienceCategory, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => Experience | null | Promise; -} - -// Types for Location -export const Location_defaultResolvers = { - id: (parent: Location) => parent.id, - lat: (parent: Location) => parent.lat, - lng: (parent: Location) => parent.lng, - address: (parent: Location) => - parent.address === undefined ? null : parent.address, - directions: (parent: Location) => - parent.directions === undefined ? null : parent.directions -}; - -export type Location_Id_Resolver = ( - parent: Location, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type Location_Lat_Resolver = ( - parent: Location, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => number | Promise; - -export type Location_Lng_Resolver = ( - parent: Location, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => number | Promise; - -export type Location_Address_Resolver = ( - parent: Location, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | null | Promise; - -export type Location_Directions_Resolver = ( - parent: Location, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | null | Promise; - -export interface Location_Resolvers { - id: ( - parent: Location, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - lat: ( - parent: Location, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => number | Promise; - - lng: ( - parent: Location, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => number | Promise; - - address: ( - parent: Location, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | null | Promise; - - directions: ( - parent: Location, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | null | Promise; -} - -// Types for Review -export const Review_defaultResolvers = { - accuracy: (parent: Review) => parent.accuracy, - checkIn: (parent: Review) => parent.checkIn, - cleanliness: (parent: Review) => parent.cleanliness, - communication: (parent: Review) => parent.communication, - createdAt: (parent: Review) => parent.createdAt, - id: (parent: Review) => parent.id, - location: (parent: Review) => parent.location, - stars: (parent: Review) => parent.stars, - text: (parent: Review) => parent.text, - value: (parent: Review) => parent.value -}; - -export type Review_Accuracy_Resolver = ( - parent: Review, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => number | Promise; - -export type Review_CheckIn_Resolver = ( - parent: Review, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => number | Promise; - -export type Review_Cleanliness_Resolver = ( - parent: Review, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => number | Promise; - -export type Review_Communication_Resolver = ( - parent: Review, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => number | Promise; - -export type Review_CreatedAt_Resolver = ( - parent: Review, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type Review_Id_Resolver = ( - parent: Review, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type Review_Location_Resolver = ( - parent: Review, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => number | Promise; - -export type Review_Stars_Resolver = ( - parent: Review, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => number | Promise; - -export type Review_Text_Resolver = ( - parent: Review, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type Review_Value_Resolver = ( - parent: Review, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => number | Promise; - -export interface Review_Resolvers { - accuracy: ( - parent: Review, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => number | Promise; - - checkIn: ( - parent: Review, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => number | Promise; - - cleanliness: ( - parent: Review, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => number | Promise; - - communication: ( - parent: Review, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => number | Promise; - - createdAt: ( - parent: Review, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - id: ( - parent: Review, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - location: ( - parent: Review, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => number | Promise; - - stars: ( - parent: Review, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => number | Promise; - - text: ( - parent: Review, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - value: ( - parent: Review, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => number | Promise; -} - -// Types for Picture -export const Picture_defaultResolvers = { - id: (parent: Picture) => parent.id, - url: (parent: Picture) => parent.url -}; - -export type Picture_Id_Resolver = ( - parent: Picture, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type Picture_Url_Resolver = ( - parent: Picture, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export interface Picture_Resolvers { - id: ( - parent: Picture, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - url: ( - parent: Picture, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; -} - -// Types for Home -export const Home_defaultResolvers = { - id: (parent: Home) => parent.id, - name: (parent: Home) => (parent.name === undefined ? null : parent.name), - description: (parent: Home) => parent.description, - numRatings: (parent: Home) => parent.numRatings, - avgRating: (parent: Home) => - parent.avgRating === undefined ? null : parent.avgRating, - pictures: (parent: Home) => parent.pictures, - perNight: (parent: Home) => parent.perNight -}; - -export interface Home_Args_Pictures { - first: number | null; -} - -export type Home_Id_Resolver = ( - parent: Home, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type Home_Name_Resolver = ( - parent: Home, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | null | Promise; - -export type Home_Description_Resolver = ( - parent: Home, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type Home_NumRatings_Resolver = ( - parent: Home, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => number | Promise; - -export type Home_AvgRating_Resolver = ( - parent: Home, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => number | null | Promise; - -export type Home_Pictures_Resolver = ( - parent: Home, - args: Home_Args_Pictures, - ctx: Context, - info: GraphQLResolveInfo -) => Picture[] | Promise; - -export type Home_PerNight_Resolver = ( - parent: Home, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => number | Promise; - -export interface Home_Resolvers { - id: ( - parent: Home, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - name: ( - parent: Home, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | null | Promise; - - description: ( - parent: Home, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - numRatings: ( - parent: Home, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => number | Promise; - - avgRating: ( - parent: Home, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => number | null | Promise; - - pictures: ( - parent: Home, - args: Home_Args_Pictures, - ctx: Context, - info: GraphQLResolveInfo - ) => Picture[] | Promise; - - perNight: ( - parent: Home, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => number | Promise; -} - -// Types for Reservation -export const Reservation_defaultResolvers = { - id: (parent: Reservation) => parent.id, - title: (parent: Reservation) => parent.title, - avgPricePerPerson: (parent: Reservation) => parent.avgPricePerPerson, - pictures: (parent: Reservation) => parent.pictures, - location: (parent: Reservation) => parent.location, - isCurated: (parent: Reservation) => parent.isCurated, - slug: (parent: Reservation) => parent.slug, - popularity: (parent: Reservation) => parent.popularity -}; - -export type Reservation_Id_Resolver = ( - parent: Reservation, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type Reservation_Title_Resolver = ( - parent: Reservation, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type Reservation_AvgPricePerPerson_Resolver = ( - parent: Reservation, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => number | Promise; - -export type Reservation_Pictures_Resolver = ( - parent: Reservation, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => Picture[] | Promise; - -export type Reservation_Location_Resolver = ( - parent: Reservation, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => Location | Promise; - -export type Reservation_IsCurated_Resolver = ( - parent: Reservation, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => boolean | Promise; - -export type Reservation_Slug_Resolver = ( - parent: Reservation, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type Reservation_Popularity_Resolver = ( - parent: Reservation, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => number | Promise; - -export interface Reservation_Resolvers { - id: ( - parent: Reservation, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - title: ( - parent: Reservation, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - avgPricePerPerson: ( - parent: Reservation, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => number | Promise; - - pictures: ( - parent: Reservation, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => Picture[] | Promise; - - location: ( - parent: Reservation, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => Location | Promise; - - isCurated: ( - parent: Reservation, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean | Promise; - - slug: ( - parent: Reservation, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - popularity: ( - parent: Reservation, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => number | Promise; -} - -// Types for Neighbourhood -export const Neighbourhood_defaultResolvers = { - id: (parent: Neighbourhood) => parent.id, - name: (parent: Neighbourhood) => parent.name, - slug: (parent: Neighbourhood) => parent.slug, - homePreview: (parent: Neighbourhood) => - parent.homePreview === undefined ? null : parent.homePreview, - city: (parent: Neighbourhood) => parent.city, - featured: (parent: Neighbourhood) => parent.featured, - popularity: (parent: Neighbourhood) => parent.popularity -}; - -export type Neighbourhood_Id_Resolver = ( - parent: Neighbourhood, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type Neighbourhood_Name_Resolver = ( - parent: Neighbourhood, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type Neighbourhood_Slug_Resolver = ( - parent: Neighbourhood, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type Neighbourhood_HomePreview_Resolver = ( - parent: Neighbourhood, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => Picture | null | Promise; - -export type Neighbourhood_City_Resolver = ( - parent: Neighbourhood, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => City | Promise; - -export type Neighbourhood_Featured_Resolver = ( - parent: Neighbourhood, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => boolean | Promise; - -export type Neighbourhood_Popularity_Resolver = ( - parent: Neighbourhood, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => number | Promise; - -export interface Neighbourhood_Resolvers { - id: ( - parent: Neighbourhood, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - name: ( - parent: Neighbourhood, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - slug: ( - parent: Neighbourhood, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - homePreview: ( - parent: Neighbourhood, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => Picture | null | Promise; - - city: ( - parent: Neighbourhood, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => City | Promise; - - featured: ( - parent: Neighbourhood, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean | Promise; - - popularity: ( - parent: Neighbourhood, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => number | Promise; -} - -// Types for City -export const City_defaultResolvers = { - id: (parent: City) => parent.id, - name: (parent: City) => parent.name -}; - -export type City_Id_Resolver = ( - parent: City, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type City_Name_Resolver = ( - parent: City, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export interface City_Resolvers { - id: ( - parent: City, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - name: ( - parent: City, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; -} - -// Types for ExperiencesByCity -export const ExperiencesByCity_defaultResolvers = { - experiences: (parent: ExperiencesByCity) => parent.experiences, - city: (parent: ExperiencesByCity) => parent.city -}; - -export type ExperiencesByCity_Experiences_Resolver = ( - parent: ExperiencesByCity, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => Experience[] | Promise; - -export type ExperiencesByCity_City_Resolver = ( - parent: ExperiencesByCity, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => City | Promise; - -export interface ExperiencesByCity_Resolvers { - experiences: ( - parent: ExperiencesByCity, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => Experience[] | Promise; - - city: ( - parent: ExperiencesByCity, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => City | Promise; -} - -// Types for Viewer -export const Viewer_defaultResolvers = { - me: (parent: Viewer) => parent.me, - bookings: (parent: Viewer) => parent.bookings -}; - -export type Viewer_Me_Resolver = ( - parent: Viewer, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => User | Promise; - -export type Viewer_Bookings_Resolver = ( - parent: Viewer, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => Booking[] | Promise; - -export interface Viewer_Resolvers { - me: ( - parent: Viewer, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => User | Promise; - - bookings: ( - parent: Viewer, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => Booking[] | Promise; -} - -// Types for User -export const User_defaultResolvers = { - bookings: (parent: User) => parent.bookings, - createdAt: (parent: User) => parent.createdAt, - email: (parent: User) => parent.email, - firstName: (parent: User) => parent.firstName, - hostingExperiences: (parent: User) => parent.hostingExperiences, - id: (parent: User) => parent.id, - isSuperHost: (parent: User) => parent.isSuperHost, - lastName: (parent: User) => parent.lastName, - notifications: (parent: User) => parent.notifications, - ownedPlaces: (parent: User) => parent.ownedPlaces, - phone: (parent: User) => parent.phone, - profilePicture: (parent: User) => - parent.profilePicture === undefined ? null : parent.profilePicture, - receivedMessages: (parent: User) => parent.receivedMessages, - responseRate: (parent: User) => - parent.responseRate === undefined ? null : parent.responseRate, - responseTime: (parent: User) => - parent.responseTime === undefined ? null : parent.responseTime, - sentMessages: (parent: User) => parent.sentMessages, - updatedAt: (parent: User) => parent.updatedAt -}; - -export type User_Bookings_Resolver = ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => Booking[] | Promise; - -export type User_CreatedAt_Resolver = ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type User_Email_Resolver = ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type User_FirstName_Resolver = ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type User_HostingExperiences_Resolver = ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => Experience[] | Promise; - -export type User_Id_Resolver = ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type User_IsSuperHost_Resolver = ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => boolean | Promise; - -export type User_LastName_Resolver = ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type User_Location_Resolver = ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => Location | Promise; - -export type User_Notifications_Resolver = ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => Notification[] | Promise; - -export type User_OwnedPlaces_Resolver = ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => Place[] | Promise; - -export type User_PaymentAccount_Resolver = ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => PaymentAccount[] | Promise; - -export type User_Phone_Resolver = ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type User_ProfilePicture_Resolver = ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => Picture | null | Promise; - -export type User_ReceivedMessages_Resolver = ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => Message[] | Promise; - -export type User_ResponseRate_Resolver = ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => number | null | Promise; - -export type User_ResponseTime_Resolver = ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => number | null | Promise; - -export type User_SentMessages_Resolver = ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => Message[] | Promise; - -export type User_UpdatedAt_Resolver = ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type User_Token_Resolver = ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export interface User_Resolvers { - bookings: ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => Booking[] | Promise; - - createdAt: ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - email: ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - firstName: ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - hostingExperiences: ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => Experience[] | Promise; - - id: ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - isSuperHost: ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean | Promise; - - lastName: ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - location: ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => Location | Promise; - - notifications: ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => Notification[] | Promise; - - ownedPlaces: ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => Place[] | Promise; - - paymentAccount: ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => PaymentAccount[] | Promise; - - phone: ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - profilePicture: ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => Picture | null | Promise; - - receivedMessages: ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => Message[] | Promise; - - responseRate: ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => number | null | Promise; - - responseTime: ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => number | null | Promise; - - sentMessages: ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => Message[] | Promise; - - updatedAt: ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - token: ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; -} - -// Types for Booking -export const Booking_defaultResolvers = { - id: (parent: Booking) => parent.id, - createdAt: (parent: Booking) => parent.createdAt, - bookee: (parent: Booking) => parent.bookee, - place: (parent: Booking) => parent.place, - startDate: (parent: Booking) => parent.startDate, - endDate: (parent: Booking) => parent.endDate, - payment: (parent: Booking) => parent.payment -}; - -export type Booking_Id_Resolver = ( - parent: Booking, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type Booking_CreatedAt_Resolver = ( - parent: Booking, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type Booking_Bookee_Resolver = ( - parent: Booking, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => User | Promise; - -export type Booking_Place_Resolver = ( - parent: Booking, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => Place | Promise; - -export type Booking_StartDate_Resolver = ( - parent: Booking, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type Booking_EndDate_Resolver = ( - parent: Booking, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type Booking_Payment_Resolver = ( - parent: Booking, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => Payment | Promise; - -export interface Booking_Resolvers { - id: ( - parent: Booking, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - createdAt: ( - parent: Booking, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - bookee: ( - parent: Booking, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => User | Promise; - - place: ( - parent: Booking, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => Place | Promise; - - startDate: ( - parent: Booking, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - endDate: ( - parent: Booking, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - payment: ( - parent: Booking, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => Payment | Promise; -} - -// Types for Place -export const Place_defaultResolvers = { - id: (parent: Place) => parent.id, - name: (parent: Place) => (parent.name === undefined ? null : parent.name), - size: (parent: Place) => (parent.size === undefined ? null : parent.size), - shortDescription: (parent: Place) => parent.shortDescription, - description: (parent: Place) => parent.description, - slug: (parent: Place) => parent.slug, - maxGuests: (parent: Place) => parent.maxGuests, - numBedrooms: (parent: Place) => parent.numBedrooms, - numBeds: (parent: Place) => parent.numBeds, - numBaths: (parent: Place) => parent.numBaths, - reviews: (parent: Place) => parent.reviews, - amenities: (parent: Place) => parent.amenities, - host: (parent: Place) => parent.host, - pricing: (parent: Place) => parent.pricing, - location: (parent: Place) => parent.location, - views: (parent: Place) => parent.views, - guestRequirements: (parent: Place) => - parent.guestRequirements === undefined ? null : parent.guestRequirements, - policies: (parent: Place) => - parent.policies === undefined ? null : parent.policies, - houseRules: (parent: Place) => - parent.houseRules === undefined ? null : parent.houseRules, - bookings: (parent: Place) => parent.bookings, - pictures: (parent: Place) => parent.pictures, - popularity: (parent: Place) => parent.popularity -}; - -export type Place_Id_Resolver = ( - parent: Place, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type Place_Name_Resolver = ( - parent: Place, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | null | Promise; - -export type Place_Size_Resolver = ( - parent: Place, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => PLACE_SIZES | null | Promise; - -export type Place_ShortDescription_Resolver = ( - parent: Place, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type Place_Description_Resolver = ( - parent: Place, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type Place_Slug_Resolver = ( - parent: Place, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type Place_MaxGuests_Resolver = ( - parent: Place, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => number | Promise; - -export type Place_NumBedrooms_Resolver = ( - parent: Place, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => number | Promise; - -export type Place_NumBeds_Resolver = ( - parent: Place, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => number | Promise; - -export type Place_NumBaths_Resolver = ( - parent: Place, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => number | Promise; - -export type Place_Reviews_Resolver = ( - parent: Place, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => Review[] | Promise; - -export type Place_Amenities_Resolver = ( - parent: Place, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => Amenities | Promise; - -export type Place_Host_Resolver = ( - parent: Place, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => User | Promise; - -export type Place_Pricing_Resolver = ( - parent: Place, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => Pricing | Promise; - -export type Place_Location_Resolver = ( - parent: Place, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => Location | Promise; - -export type Place_Views_Resolver = ( - parent: Place, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => PlaceViews | Promise; - -export type Place_GuestRequirements_Resolver = ( - parent: Place, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => GuestRequirements | null | Promise; - -export type Place_Policies_Resolver = ( - parent: Place, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => Policies | null | Promise; - -export type Place_HouseRules_Resolver = ( - parent: Place, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => HouseRules | null | Promise; - -export type Place_Bookings_Resolver = ( - parent: Place, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => Booking[] | Promise; - -export type Place_Pictures_Resolver = ( - parent: Place, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => Picture[] | Promise; - -export type Place_Popularity_Resolver = ( - parent: Place, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => number | Promise; - -export interface Place_Resolvers { - id: ( - parent: Place, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - name: ( - parent: Place, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | null | Promise; - - size: ( - parent: Place, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => PLACE_SIZES | null | Promise; - - shortDescription: ( - parent: Place, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - description: ( - parent: Place, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - slug: ( - parent: Place, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - maxGuests: ( - parent: Place, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => number | Promise; - - numBedrooms: ( - parent: Place, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => number | Promise; - - numBeds: ( - parent: Place, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => number | Promise; - - numBaths: ( - parent: Place, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => number | Promise; - - reviews: ( - parent: Place, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => Review[] | Promise; - - amenities: ( - parent: Place, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => Amenities | Promise; - - host: ( - parent: Place, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => User | Promise; - - pricing: ( - parent: Place, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => Pricing | Promise; - - location: ( - parent: Place, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => Location | Promise; - - views: ( - parent: Place, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => PlaceViews | Promise; - - guestRequirements: ( - parent: Place, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => GuestRequirements | null | Promise; - - policies: ( - parent: Place, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => Policies | null | Promise; - - houseRules: ( - parent: Place, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => HouseRules | null | Promise; - - bookings: ( - parent: Place, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => Booking[] | Promise; - - pictures: ( - parent: Place, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => Picture[] | Promise; - - popularity: ( - parent: Place, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => number | Promise; -} - -// Types for Amenities -export const Amenities_defaultResolvers = { - airConditioning: (parent: Amenities) => parent.airConditioning, - babyBath: (parent: Amenities) => parent.babyBath, - babyMonitor: (parent: Amenities) => parent.babyMonitor, - babysitterRecommendations: (parent: Amenities) => - parent.babysitterRecommendations, - bathtub: (parent: Amenities) => parent.bathtub, - breakfast: (parent: Amenities) => parent.breakfast, - buzzerWirelessIntercom: (parent: Amenities) => parent.buzzerWirelessIntercom, - cableTv: (parent: Amenities) => parent.cableTv, - changingTable: (parent: Amenities) => parent.changingTable, - childrensBooksAndToys: (parent: Amenities) => parent.childrensBooksAndToys, - childrensDinnerware: (parent: Amenities) => parent.childrensDinnerware, - crib: (parent: Amenities) => parent.crib, - doorman: (parent: Amenities) => parent.doorman, - dryer: (parent: Amenities) => parent.dryer, - elevator: (parent: Amenities) => parent.elevator, - essentials: (parent: Amenities) => parent.essentials, - familyKidFriendly: (parent: Amenities) => parent.familyKidFriendly, - freeParkingOnPremises: (parent: Amenities) => parent.freeParkingOnPremises, - freeParkingOnStreet: (parent: Amenities) => parent.freeParkingOnStreet, - gym: (parent: Amenities) => parent.gym, - hairDryer: (parent: Amenities) => parent.hairDryer, - hangers: (parent: Amenities) => parent.hangers, - heating: (parent: Amenities) => parent.heating, - hotTub: (parent: Amenities) => parent.hotTub, - id: (parent: Amenities) => parent.id, - indoorFireplace: (parent: Amenities) => parent.indoorFireplace, - internet: (parent: Amenities) => parent.internet, - iron: (parent: Amenities) => parent.iron, - kitchen: (parent: Amenities) => parent.kitchen, - laptopFriendlyWorkspace: (parent: Amenities) => - parent.laptopFriendlyWorkspace, - paidParkingOffPremises: (parent: Amenities) => parent.paidParkingOffPremises, - petsAllowed: (parent: Amenities) => parent.petsAllowed, - pool: (parent: Amenities) => parent.pool, - privateEntrance: (parent: Amenities) => parent.privateEntrance, - shampoo: (parent: Amenities) => parent.shampoo, - smokingAllowed: (parent: Amenities) => parent.smokingAllowed, - suitableForEvents: (parent: Amenities) => parent.suitableForEvents, - tv: (parent: Amenities) => parent.tv, - washer: (parent: Amenities) => parent.washer, - wheelchairAccessible: (parent: Amenities) => parent.wheelchairAccessible, - wirelessInternet: (parent: Amenities) => parent.wirelessInternet -}; - -export type Amenities_AirConditioning_Resolver = ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => boolean | Promise; - -export type Amenities_BabyBath_Resolver = ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => boolean | Promise; - -export type Amenities_BabyMonitor_Resolver = ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => boolean | Promise; - -export type Amenities_BabysitterRecommendations_Resolver = ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => boolean | Promise; - -export type Amenities_Bathtub_Resolver = ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => boolean | Promise; - -export type Amenities_Breakfast_Resolver = ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => boolean | Promise; - -export type Amenities_BuzzerWirelessIntercom_Resolver = ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => boolean | Promise; - -export type Amenities_CableTv_Resolver = ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => boolean | Promise; - -export type Amenities_ChangingTable_Resolver = ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => boolean | Promise; - -export type Amenities_ChildrensBooksAndToys_Resolver = ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => boolean | Promise; - -export type Amenities_ChildrensDinnerware_Resolver = ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => boolean | Promise; - -export type Amenities_Crib_Resolver = ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => boolean | Promise; - -export type Amenities_Doorman_Resolver = ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => boolean | Promise; - -export type Amenities_Dryer_Resolver = ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => boolean | Promise; - -export type Amenities_Elevator_Resolver = ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => boolean | Promise; - -export type Amenities_Essentials_Resolver = ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => boolean | Promise; - -export type Amenities_FamilyKidFriendly_Resolver = ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => boolean | Promise; - -export type Amenities_FreeParkingOnPremises_Resolver = ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => boolean | Promise; - -export type Amenities_FreeParkingOnStreet_Resolver = ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => boolean | Promise; - -export type Amenities_Gym_Resolver = ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => boolean | Promise; - -export type Amenities_HairDryer_Resolver = ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => boolean | Promise; - -export type Amenities_Hangers_Resolver = ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => boolean | Promise; - -export type Amenities_Heating_Resolver = ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => boolean | Promise; - -export type Amenities_HotTub_Resolver = ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => boolean | Promise; - -export type Amenities_Id_Resolver = ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type Amenities_IndoorFireplace_Resolver = ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => boolean | Promise; - -export type Amenities_Internet_Resolver = ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => boolean | Promise; - -export type Amenities_Iron_Resolver = ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => boolean | Promise; - -export type Amenities_Kitchen_Resolver = ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => boolean | Promise; - -export type Amenities_LaptopFriendlyWorkspace_Resolver = ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => boolean | Promise; - -export type Amenities_PaidParkingOffPremises_Resolver = ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => boolean | Promise; - -export type Amenities_PetsAllowed_Resolver = ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => boolean | Promise; - -export type Amenities_Pool_Resolver = ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => boolean | Promise; - -export type Amenities_PrivateEntrance_Resolver = ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => boolean | Promise; - -export type Amenities_Shampoo_Resolver = ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => boolean | Promise; - -export type Amenities_SmokingAllowed_Resolver = ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => boolean | Promise; - -export type Amenities_SuitableForEvents_Resolver = ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => boolean | Promise; - -export type Amenities_Tv_Resolver = ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => boolean | Promise; - -export type Amenities_Washer_Resolver = ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => boolean | Promise; - -export type Amenities_WheelchairAccessible_Resolver = ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => boolean | Promise; - -export type Amenities_WirelessInternet_Resolver = ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => boolean | Promise; - -export interface Amenities_Resolvers { - airConditioning: ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean | Promise; - - babyBath: ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean | Promise; - - babyMonitor: ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean | Promise; - - babysitterRecommendations: ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean | Promise; - - bathtub: ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean | Promise; - - breakfast: ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean | Promise; - - buzzerWirelessIntercom: ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean | Promise; - - cableTv: ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean | Promise; - - changingTable: ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean | Promise; - - childrensBooksAndToys: ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean | Promise; - - childrensDinnerware: ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean | Promise; - - crib: ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean | Promise; - - doorman: ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean | Promise; - - dryer: ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean | Promise; - - elevator: ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean | Promise; - - essentials: ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean | Promise; - - familyKidFriendly: ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean | Promise; - - freeParkingOnPremises: ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean | Promise; - - freeParkingOnStreet: ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean | Promise; - - gym: ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean | Promise; - - hairDryer: ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean | Promise; - - hangers: ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean | Promise; - - heating: ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean | Promise; - - hotTub: ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean | Promise; - - id: ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - indoorFireplace: ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean | Promise; - - internet: ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean | Promise; - - iron: ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean | Promise; - - kitchen: ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean | Promise; - - laptopFriendlyWorkspace: ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean | Promise; - - paidParkingOffPremises: ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean | Promise; - - petsAllowed: ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean | Promise; - - pool: ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean | Promise; - - privateEntrance: ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean | Promise; - - shampoo: ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean | Promise; - - smokingAllowed: ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean | Promise; - - suitableForEvents: ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean | Promise; - - tv: ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean | Promise; - - washer: ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean | Promise; - - wheelchairAccessible: ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean | Promise; - - wirelessInternet: ( - parent: Amenities, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean | Promise; -} - -// Types for Pricing -export const Pricing_defaultResolvers = { - averageMonthly: (parent: Pricing) => parent.averageMonthly, - averageWeekly: (parent: Pricing) => parent.averageWeekly, - basePrice: (parent: Pricing) => parent.basePrice, - cleaningFee: (parent: Pricing) => - parent.cleaningFee === undefined ? null : parent.cleaningFee, - currency: (parent: Pricing) => - parent.currency === undefined ? null : parent.currency, - extraGuests: (parent: Pricing) => - parent.extraGuests === undefined ? null : parent.extraGuests, - id: (parent: Pricing) => parent.id, - monthlyDiscount: (parent: Pricing) => - parent.monthlyDiscount === undefined ? null : parent.monthlyDiscount, - perNight: (parent: Pricing) => parent.perNight, - securityDeposit: (parent: Pricing) => - parent.securityDeposit === undefined ? null : parent.securityDeposit, - smartPricing: (parent: Pricing) => parent.smartPricing, - weekendPricing: (parent: Pricing) => - parent.weekendPricing === undefined ? null : parent.weekendPricing, - weeklyDiscount: (parent: Pricing) => - parent.weeklyDiscount === undefined ? null : parent.weeklyDiscount -}; - -export type Pricing_AverageMonthly_Resolver = ( - parent: Pricing, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => number | Promise; - -export type Pricing_AverageWeekly_Resolver = ( - parent: Pricing, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => number | Promise; - -export type Pricing_BasePrice_Resolver = ( - parent: Pricing, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => number | Promise; - -export type Pricing_CleaningFee_Resolver = ( - parent: Pricing, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => number | null | Promise; - -export type Pricing_Currency_Resolver = ( - parent: Pricing, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => CURRENCY | null | Promise; - -export type Pricing_ExtraGuests_Resolver = ( - parent: Pricing, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => number | null | Promise; - -export type Pricing_Id_Resolver = ( - parent: Pricing, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type Pricing_MonthlyDiscount_Resolver = ( - parent: Pricing, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => number | null | Promise; - -export type Pricing_PerNight_Resolver = ( - parent: Pricing, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => number | Promise; - -export type Pricing_SecurityDeposit_Resolver = ( - parent: Pricing, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => number | null | Promise; - -export type Pricing_SmartPricing_Resolver = ( - parent: Pricing, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => boolean | Promise; - -export type Pricing_WeekendPricing_Resolver = ( - parent: Pricing, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => number | null | Promise; - -export type Pricing_WeeklyDiscount_Resolver = ( - parent: Pricing, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => number | null | Promise; - -export interface Pricing_Resolvers { - averageMonthly: ( - parent: Pricing, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => number | Promise; - - averageWeekly: ( - parent: Pricing, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => number | Promise; - - basePrice: ( - parent: Pricing, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => number | Promise; - - cleaningFee: ( - parent: Pricing, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => number | null | Promise; - - currency: ( - parent: Pricing, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => CURRENCY | null | Promise; - - extraGuests: ( - parent: Pricing, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => number | null | Promise; - - id: ( - parent: Pricing, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - monthlyDiscount: ( - parent: Pricing, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => number | null | Promise; - - perNight: ( - parent: Pricing, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => number | Promise; - - securityDeposit: ( - parent: Pricing, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => number | null | Promise; - - smartPricing: ( - parent: Pricing, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean | Promise; - - weekendPricing: ( - parent: Pricing, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => number | null | Promise; - - weeklyDiscount: ( - parent: Pricing, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => number | null | Promise; -} - -// Types for PlaceViews -export const PlaceViews_defaultResolvers = { - id: (parent: PlaceViews) => parent.id, - lastWeek: (parent: PlaceViews) => parent.lastWeek -}; - -export type PlaceViews_Id_Resolver = ( - parent: PlaceViews, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type PlaceViews_LastWeek_Resolver = ( - parent: PlaceViews, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => number | Promise; - -export interface PlaceViews_Resolvers { - id: ( - parent: PlaceViews, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - lastWeek: ( - parent: PlaceViews, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => number | Promise; -} - -// Types for GuestRequirements -export const GuestRequirements_defaultResolvers = { - govIssuedId: (parent: GuestRequirements) => parent.govIssuedId, - guestTripInformation: (parent: GuestRequirements) => - parent.guestTripInformation, - id: (parent: GuestRequirements) => parent.id, - recommendationsFromOtherHosts: (parent: GuestRequirements) => - parent.recommendationsFromOtherHosts -}; - -export type GuestRequirements_GovIssuedId_Resolver = ( - parent: GuestRequirements, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => boolean | Promise; - -export type GuestRequirements_GuestTripInformation_Resolver = ( - parent: GuestRequirements, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => boolean | Promise; - -export type GuestRequirements_Id_Resolver = ( - parent: GuestRequirements, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type GuestRequirements_RecommendationsFromOtherHosts_Resolver = ( - parent: GuestRequirements, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => boolean | Promise; - -export interface GuestRequirements_Resolvers { - govIssuedId: ( - parent: GuestRequirements, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean | Promise; - - guestTripInformation: ( - parent: GuestRequirements, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean | Promise; - - id: ( - parent: GuestRequirements, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - recommendationsFromOtherHosts: ( - parent: GuestRequirements, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean | Promise; -} - -// Types for Policies -export const Policies_defaultResolvers = { - checkInEndTime: (parent: Policies) => parent.checkInEndTime, - checkInStartTime: (parent: Policies) => parent.checkInStartTime, - checkoutTime: (parent: Policies) => parent.checkoutTime, - createdAt: (parent: Policies) => parent.createdAt, - id: (parent: Policies) => parent.id, - updatedAt: (parent: Policies) => parent.updatedAt -}; - -export type Policies_CheckInEndTime_Resolver = ( - parent: Policies, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => number | Promise; - -export type Policies_CheckInStartTime_Resolver = ( - parent: Policies, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => number | Promise; - -export type Policies_CheckoutTime_Resolver = ( - parent: Policies, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => number | Promise; - -export type Policies_CreatedAt_Resolver = ( - parent: Policies, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type Policies_Id_Resolver = ( - parent: Policies, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type Policies_UpdatedAt_Resolver = ( - parent: Policies, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export interface Policies_Resolvers { - checkInEndTime: ( - parent: Policies, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => number | Promise; - - checkInStartTime: ( - parent: Policies, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => number | Promise; - - checkoutTime: ( - parent: Policies, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => number | Promise; - - createdAt: ( - parent: Policies, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - id: ( - parent: Policies, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - updatedAt: ( - parent: Policies, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; -} - -// Types for HouseRules -export const HouseRules_defaultResolvers = { - additionalRules: (parent: HouseRules) => - parent.additionalRules === undefined ? null : parent.additionalRules, - createdAt: (parent: HouseRules) => parent.createdAt, - id: (parent: HouseRules) => parent.id, - partiesAndEventsAllowed: (parent: HouseRules) => - parent.partiesAndEventsAllowed === undefined - ? null - : parent.partiesAndEventsAllowed, - petsAllowed: (parent: HouseRules) => - parent.petsAllowed === undefined ? null : parent.petsAllowed, - smokingAllowed: (parent: HouseRules) => - parent.smokingAllowed === undefined ? null : parent.smokingAllowed, - suitableForChildren: (parent: HouseRules) => - parent.suitableForChildren === undefined - ? null - : parent.suitableForChildren, - suitableForInfants: (parent: HouseRules) => - parent.suitableForInfants === undefined ? null : parent.suitableForInfants, - updatedAt: (parent: HouseRules) => parent.updatedAt -}; - -export type HouseRules_AdditionalRules_Resolver = ( - parent: HouseRules, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | null | Promise; - -export type HouseRules_CreatedAt_Resolver = ( - parent: HouseRules, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type HouseRules_Id_Resolver = ( - parent: HouseRules, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type HouseRules_PartiesAndEventsAllowed_Resolver = ( - parent: HouseRules, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => boolean | null | Promise; - -export type HouseRules_PetsAllowed_Resolver = ( - parent: HouseRules, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => boolean | null | Promise; - -export type HouseRules_SmokingAllowed_Resolver = ( - parent: HouseRules, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => boolean | null | Promise; - -export type HouseRules_SuitableForChildren_Resolver = ( - parent: HouseRules, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => boolean | null | Promise; - -export type HouseRules_SuitableForInfants_Resolver = ( - parent: HouseRules, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => boolean | null | Promise; - -export type HouseRules_UpdatedAt_Resolver = ( - parent: HouseRules, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export interface HouseRules_Resolvers { - additionalRules: ( - parent: HouseRules, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | null | Promise; - - createdAt: ( - parent: HouseRules, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - id: ( - parent: HouseRules, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - partiesAndEventsAllowed: ( - parent: HouseRules, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean | null | Promise; - - petsAllowed: ( - parent: HouseRules, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean | null | Promise; - - smokingAllowed: ( - parent: HouseRules, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean | null | Promise; - - suitableForChildren: ( - parent: HouseRules, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean | null | Promise; - - suitableForInfants: ( - parent: HouseRules, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean | null | Promise; - - updatedAt: ( - parent: HouseRules, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; -} - -// Types for Payment -export const Payment_defaultResolvers = { - booking: (parent: Payment) => parent.booking, - createdAt: (parent: Payment) => parent.createdAt, - id: (parent: Payment) => parent.id, - paymentMethod: (parent: Payment) => parent.paymentMethod, - serviceFee: (parent: Payment) => parent.serviceFee -}; - -export type Payment_Booking_Resolver = ( - parent: Payment, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => Booking | Promise; - -export type Payment_CreatedAt_Resolver = ( - parent: Payment, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type Payment_Id_Resolver = ( - parent: Payment, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type Payment_PaymentMethod_Resolver = ( - parent: Payment, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => PaymentAccount | Promise; - -export type Payment_ServiceFee_Resolver = ( - parent: Payment, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => number | Promise; - -export interface Payment_Resolvers { - booking: ( - parent: Payment, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => Booking | Promise; - - createdAt: ( - parent: Payment, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - id: ( - parent: Payment, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - paymentMethod: ( - parent: Payment, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => PaymentAccount | Promise; - - serviceFee: ( - parent: Payment, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => number | Promise; -} - -// Types for PaymentAccount -export const PaymentAccount_defaultResolvers = { - id: (parent: PaymentAccount) => parent.id, - createdAt: (parent: PaymentAccount) => parent.createdAt, - type: (parent: PaymentAccount) => - parent.type === undefined ? null : parent.type, - user: (parent: PaymentAccount) => parent.user, - payments: (parent: PaymentAccount) => parent.payments, - paypal: (parent: PaymentAccount) => - parent.paypal === undefined ? null : parent.paypal, - creditcard: (parent: PaymentAccount) => - parent.creditcard === undefined ? null : parent.creditcard -}; - -export type PaymentAccount_Id_Resolver = ( - parent: PaymentAccount, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type PaymentAccount_CreatedAt_Resolver = ( - parent: PaymentAccount, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type PaymentAccount_Type_Resolver = ( - parent: PaymentAccount, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => PAYMENT_PROVIDER | null | Promise; - -export type PaymentAccount_User_Resolver = ( - parent: PaymentAccount, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => User | Promise; - -export type PaymentAccount_Payments_Resolver = ( - parent: PaymentAccount, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => Payment[] | Promise; - -export type PaymentAccount_Paypal_Resolver = ( - parent: PaymentAccount, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => PaypalInformation | null | Promise; - -export type PaymentAccount_Creditcard_Resolver = ( - parent: PaymentAccount, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => CreditCardInformation | null | Promise; - -export interface PaymentAccount_Resolvers { - id: ( - parent: PaymentAccount, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - createdAt: ( - parent: PaymentAccount, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - type: ( - parent: PaymentAccount, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => PAYMENT_PROVIDER | null | Promise; - - user: ( - parent: PaymentAccount, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => User | Promise; - - payments: ( - parent: PaymentAccount, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => Payment[] | Promise; - - paypal: ( - parent: PaymentAccount, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => PaypalInformation | null | Promise; - - creditcard: ( - parent: PaymentAccount, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => CreditCardInformation | null | Promise; -} - -// Types for PaypalInformation -export const PaypalInformation_defaultResolvers = { - createdAt: (parent: PaypalInformation) => parent.createdAt, - email: (parent: PaypalInformation) => parent.email, - id: (parent: PaypalInformation) => parent.id, - paymentAccount: (parent: PaypalInformation) => parent.paymentAccount -}; - -export type PaypalInformation_CreatedAt_Resolver = ( - parent: PaypalInformation, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type PaypalInformation_Email_Resolver = ( - parent: PaypalInformation, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type PaypalInformation_Id_Resolver = ( - parent: PaypalInformation, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type PaypalInformation_PaymentAccount_Resolver = ( - parent: PaypalInformation, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => PaymentAccount | Promise; - -export interface PaypalInformation_Resolvers { - createdAt: ( - parent: PaypalInformation, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - email: ( - parent: PaypalInformation, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - id: ( - parent: PaypalInformation, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - paymentAccount: ( - parent: PaypalInformation, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => PaymentAccount | Promise; -} - -// Types for CreditCardInformation -export const CreditCardInformation_defaultResolvers = { - cardNumber: (parent: CreditCardInformation) => parent.cardNumber, - country: (parent: CreditCardInformation) => parent.country, - createdAt: (parent: CreditCardInformation) => parent.createdAt, - expiresOnMonth: (parent: CreditCardInformation) => parent.expiresOnMonth, - expiresOnYear: (parent: CreditCardInformation) => parent.expiresOnYear, - firstName: (parent: CreditCardInformation) => parent.firstName, - id: (parent: CreditCardInformation) => parent.id, - lastName: (parent: CreditCardInformation) => parent.lastName, - paymentAccount: (parent: CreditCardInformation) => - parent.paymentAccount === undefined ? null : parent.paymentAccount, - postalCode: (parent: CreditCardInformation) => parent.postalCode, - securityCode: (parent: CreditCardInformation) => parent.securityCode -}; - -export type CreditCardInformation_CardNumber_Resolver = ( - parent: CreditCardInformation, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type CreditCardInformation_Country_Resolver = ( - parent: CreditCardInformation, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type CreditCardInformation_CreatedAt_Resolver = ( - parent: CreditCardInformation, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type CreditCardInformation_ExpiresOnMonth_Resolver = ( - parent: CreditCardInformation, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => number | Promise; - -export type CreditCardInformation_ExpiresOnYear_Resolver = ( - parent: CreditCardInformation, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => number | Promise; - -export type CreditCardInformation_FirstName_Resolver = ( - parent: CreditCardInformation, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type CreditCardInformation_Id_Resolver = ( - parent: CreditCardInformation, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type CreditCardInformation_LastName_Resolver = ( - parent: CreditCardInformation, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type CreditCardInformation_PaymentAccount_Resolver = ( - parent: CreditCardInformation, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => PaymentAccount | null | Promise; - -export type CreditCardInformation_PostalCode_Resolver = ( - parent: CreditCardInformation, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type CreditCardInformation_SecurityCode_Resolver = ( - parent: CreditCardInformation, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export interface CreditCardInformation_Resolvers { - cardNumber: ( - parent: CreditCardInformation, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - country: ( - parent: CreditCardInformation, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - createdAt: ( - parent: CreditCardInformation, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - expiresOnMonth: ( - parent: CreditCardInformation, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => number | Promise; - - expiresOnYear: ( - parent: CreditCardInformation, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => number | Promise; - - firstName: ( - parent: CreditCardInformation, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - id: ( - parent: CreditCardInformation, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - lastName: ( - parent: CreditCardInformation, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - paymentAccount: ( - parent: CreditCardInformation, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => PaymentAccount | null | Promise; - - postalCode: ( - parent: CreditCardInformation, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - securityCode: ( - parent: CreditCardInformation, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; -} - -// Types for Notification -export const Notification_defaultResolvers = { - createdAt: (parent: Notification) => parent.createdAt, - id: (parent: Notification) => parent.id, - link: (parent: Notification) => parent.link, - readDate: (parent: Notification) => parent.readDate, - type: (parent: Notification) => - parent.type === undefined ? null : parent.type, - user: (parent: Notification) => parent.user -}; - -export type Notification_CreatedAt_Resolver = ( - parent: Notification, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type Notification_Id_Resolver = ( - parent: Notification, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type Notification_Link_Resolver = ( - parent: Notification, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type Notification_ReadDate_Resolver = ( - parent: Notification, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type Notification_Type_Resolver = ( - parent: Notification, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => NOTIFICATION_TYPE | null | Promise; - -export type Notification_User_Resolver = ( - parent: Notification, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => User | Promise; - -export interface Notification_Resolvers { - createdAt: ( - parent: Notification, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - id: ( - parent: Notification, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - link: ( - parent: Notification, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - readDate: ( - parent: Notification, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - type: ( - parent: Notification, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => NOTIFICATION_TYPE | null | Promise; - - user: ( - parent: Notification, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => User | Promise; -} - -// Types for Message -export const Message_defaultResolvers = { - createdAt: (parent: Message) => parent.createdAt, - deliveredAt: (parent: Message) => parent.deliveredAt, - id: (parent: Message) => parent.id, - readAt: (parent: Message) => parent.readAt -}; - -export type Message_CreatedAt_Resolver = ( - parent: Message, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type Message_DeliveredAt_Resolver = ( - parent: Message, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type Message_Id_Resolver = ( - parent: Message, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type Message_ReadAt_Resolver = ( - parent: Message, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export interface Message_Resolvers { - createdAt: ( - parent: Message, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - deliveredAt: ( - parent: Message, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - id: ( - parent: Message, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - readAt: ( - parent: Message, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; -} - -// Types for Mutation -export const Mutation_defaultResolvers = {}; - -export interface Mutation_Args_Signup { - email: string; - password: string; - firstName: string; - lastName: string; - phone: string; -} - -export interface Mutation_Args_Login { - email: string; - password: string; -} - -export interface Mutation_Args_AddPaymentMethod { - cardNumber: string; - expiresOnMonth: number; - expiresOnYear: number; - securityCode: string; - firstName: string; - lastName: string; - postalCode: string; - country: string; -} - -export interface Mutation_Args_Book { - placeId: string; - checkIn: string; - checkOut: string; - numGuests: number; -} - -export type Mutation_Signup_Resolver = ( - parent: {}, - args: Mutation_Args_Signup, - ctx: Context, - info: GraphQLResolveInfo -) => AuthPayload | Promise; - -export type Mutation_Login_Resolver = ( - parent: {}, - args: Mutation_Args_Login, - ctx: Context, - info: GraphQLResolveInfo -) => AuthPayload | Promise; - -export type Mutation_AddPaymentMethod_Resolver = ( - parent: {}, - args: Mutation_Args_AddPaymentMethod, - ctx: Context, - info: GraphQLResolveInfo -) => MutationResult | Promise; - -export type Mutation_Book_Resolver = ( - parent: {}, - args: Mutation_Args_Book, - ctx: Context, - info: GraphQLResolveInfo -) => MutationResult | Promise; - -export interface Mutation_Resolvers { - signup: ( - parent: {}, - args: Mutation_Args_Signup, - ctx: Context, - info: GraphQLResolveInfo - ) => AuthPayload | Promise; - - login: ( - parent: {}, - args: Mutation_Args_Login, - ctx: Context, - info: GraphQLResolveInfo - ) => AuthPayload | Promise; - - addPaymentMethod: ( - parent: {}, - args: Mutation_Args_AddPaymentMethod, - ctx: Context, - info: GraphQLResolveInfo - ) => MutationResult | Promise; - - book: ( - parent: {}, - args: Mutation_Args_Book, - ctx: Context, - info: GraphQLResolveInfo - ) => MutationResult | Promise; -} - -// Types for AuthPayload -export const AuthPayload_defaultResolvers = { - token: (parent: AuthPayload) => parent.token, - user: (parent: AuthPayload) => parent.user -}; - -export type AuthPayload_Token_Resolver = ( - parent: AuthPayload, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type AuthPayload_User_Resolver = ( - parent: AuthPayload, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => User | Promise; - -export interface AuthPayload_Resolvers { - token: ( - parent: AuthPayload, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - user: ( - parent: AuthPayload, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => User | Promise; -} - -// Types for MutationResult -export const MutationResult_defaultResolvers = { - success: (parent: MutationResult) => parent.success -}; - -export type MutationResult_Success_Resolver = ( - parent: MutationResult, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => boolean | Promise; - -export interface MutationResult_Resolvers { - success: ( - parent: MutationResult, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean | Promise; -} - -export interface Resolvers { - Query: Query_Resolvers; - Experience: Experience_Resolvers; - ExperienceCategory: ExperienceCategory_Resolvers; - Location: Location_Resolvers; - Review: Review_Resolvers; - Picture: Picture_Resolvers; - Home: Home_Resolvers; - Reservation: Reservation_Resolvers; - Neighbourhood: Neighbourhood_Resolvers; - City: City_Resolvers; - ExperiencesByCity: ExperiencesByCity_Resolvers; - Viewer: Viewer_Resolvers; - User: User_Resolvers; - Booking: Booking_Resolvers; - Place: Place_Resolvers; - Amenities: Amenities_Resolvers; - Pricing: Pricing_Resolvers; - PlaceViews: PlaceViews_Resolvers; - GuestRequirements: GuestRequirements_Resolvers; - Policies: Policies_Resolvers; - HouseRules: HouseRules_Resolvers; - Payment: Payment_Resolvers; - PaymentAccount: PaymentAccount_Resolvers; - PaypalInformation: PaypalInformation_Resolvers; - CreditCardInformation: CreditCardInformation_Resolvers; - Notification: Notification_Resolvers; - Message: Message_Resolvers; - Mutation: Mutation_Resolvers; - AuthPayload: AuthPayload_Resolvers; - MutationResult: MutationResult_Resolvers; -} -" -`; - -exports[`large schema 2`] = ` -Array [ - Object { - "code": "/* @flow */ -import { Experience_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; -import type { Experience_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -export const Experience: Experience_Resolvers = { - ...Experience_defaultResolvers -}; -", - "force": false, - "path": "Experience.js", - }, - Object { - "code": "/* @flow */ -import { ExperienceCategory_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; -import type { ExperienceCategory_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -export const ExperienceCategory: ExperienceCategory_Resolvers = { - ...ExperienceCategory_defaultResolvers -}; -", - "force": false, - "path": "ExperienceCategory.js", - }, - Object { - "code": "/* @flow */ -import { Location_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; -import type { Location_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -export const Location: Location_Resolvers = { - ...Location_defaultResolvers -}; -", - "force": false, - "path": "Location.js", - }, - Object { - "code": "/* @flow */ -import { Review_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; -import type { Review_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -export const Review: Review_Resolvers = { - ...Review_defaultResolvers -}; -", - "force": false, - "path": "Review.js", - }, - Object { - "code": "/* @flow */ -import { Picture_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; -import type { Picture_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -export const Picture: Picture_Resolvers = { - ...Picture_defaultResolvers -}; -", - "force": false, - "path": "Picture.js", - }, - Object { - "code": "/* @flow */ -import { Home_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; -import type { Home_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -export const Home: Home_Resolvers = { - ...Home_defaultResolvers -}; -", - "force": false, - "path": "Home.js", - }, - Object { - "code": "/* @flow */ -import { Reservation_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; -import type { Reservation_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -export const Reservation: Reservation_Resolvers = { - ...Reservation_defaultResolvers -}; -", - "force": false, - "path": "Reservation.js", - }, - Object { - "code": "/* @flow */ -import { Neighbourhood_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; -import type { Neighbourhood_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -export const Neighbourhood: Neighbourhood_Resolvers = { - ...Neighbourhood_defaultResolvers -}; -", - "force": false, - "path": "Neighbourhood.js", - }, - Object { - "code": "/* @flow */ -import { City_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; -import type { City_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -export const City: City_Resolvers = { - ...City_defaultResolvers -}; -", - "force": false, - "path": "City.js", - }, - Object { - "code": "/* @flow */ -import { ExperiencesByCity_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; -import type { ExperiencesByCity_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -export const ExperiencesByCity: ExperiencesByCity_Resolvers = { - ...ExperiencesByCity_defaultResolvers -}; -", - "force": false, - "path": "ExperiencesByCity.js", - }, - Object { - "code": "/* @flow */ -import { Viewer_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; -import type { Viewer_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -export const Viewer: Viewer_Resolvers = { - ...Viewer_defaultResolvers -}; -", - "force": false, - "path": "Viewer.js", - }, - Object { - "code": "/* @flow */ -import { User_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; -import type { User_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -export const User: User_Resolvers = { - ...User_defaultResolvers, - - location: (parent, args, ctx, info) => { - throw new Error(\\"Resolver not implemented\\"); - }, - paymentAccount: (parent, args, ctx, info) => { - throw new Error(\\"Resolver not implemented\\"); - }, - token: (parent, args, ctx, info) => { - throw new Error(\\"Resolver not implemented\\"); - } -}; -", - "force": false, - "path": "User.js", - }, - Object { - "code": "/* @flow */ -import { Booking_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; -import type { Booking_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -export const Booking: Booking_Resolvers = { - ...Booking_defaultResolvers -}; -", - "force": false, - "path": "Booking.js", - }, - Object { - "code": "/* @flow */ -import { Place_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; -import type { Place_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -export const Place: Place_Resolvers = { - ...Place_defaultResolvers -}; -", - "force": false, - "path": "Place.js", - }, - Object { - "code": "/* @flow */ -import { Amenities_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; -import type { Amenities_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -export const Amenities: Amenities_Resolvers = { - ...Amenities_defaultResolvers -}; -", - "force": false, - "path": "Amenities.js", - }, - Object { - "code": "/* @flow */ -import { Pricing_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; -import type { Pricing_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -export const Pricing: Pricing_Resolvers = { - ...Pricing_defaultResolvers -}; -", - "force": false, - "path": "Pricing.js", - }, - Object { - "code": "/* @flow */ -import { PlaceViews_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; -import type { PlaceViews_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -export const PlaceViews: PlaceViews_Resolvers = { - ...PlaceViews_defaultResolvers -}; -", - "force": false, - "path": "PlaceViews.js", - }, - Object { - "code": "/* @flow */ -import { GuestRequirements_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; -import type { GuestRequirements_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -export const GuestRequirements: GuestRequirements_Resolvers = { - ...GuestRequirements_defaultResolvers -}; -", - "force": false, - "path": "GuestRequirements.js", - }, - Object { - "code": "/* @flow */ -import { Policies_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; -import type { Policies_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -export const Policies: Policies_Resolvers = { - ...Policies_defaultResolvers -}; -", - "force": false, - "path": "Policies.js", - }, - Object { - "code": "/* @flow */ -import { HouseRules_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; -import type { HouseRules_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -export const HouseRules: HouseRules_Resolvers = { - ...HouseRules_defaultResolvers -}; -", - "force": false, - "path": "HouseRules.js", - }, - Object { - "code": "/* @flow */ -import { Payment_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; -import type { Payment_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -export const Payment: Payment_Resolvers = { - ...Payment_defaultResolvers -}; -", - "force": false, - "path": "Payment.js", - }, - Object { - "code": "/* @flow */ -import { PaymentAccount_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; -import type { PaymentAccount_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -export const PaymentAccount: PaymentAccount_Resolvers = { - ...PaymentAccount_defaultResolvers -}; -", - "force": false, - "path": "PaymentAccount.js", - }, - Object { - "code": "/* @flow */ -import { PaypalInformation_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; -import type { PaypalInformation_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -export const PaypalInformation: PaypalInformation_Resolvers = { - ...PaypalInformation_defaultResolvers -}; -", - "force": false, - "path": "PaypalInformation.js", - }, - Object { - "code": "/* @flow */ -import { CreditCardInformation_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; -import type { CreditCardInformation_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -export const CreditCardInformation: CreditCardInformation_Resolvers = { - ...CreditCardInformation_defaultResolvers -}; -", - "force": false, - "path": "CreditCardInformation.js", - }, - Object { - "code": "/* @flow */ -import { Notification_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; -import type { Notification_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -export const Notification: Notification_Resolvers = { - ...Notification_defaultResolvers -}; -", - "force": false, - "path": "Notification.js", - }, - Object { - "code": "/* @flow */ -import { Message_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; -import type { Message_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -export const Message: Message_Resolvers = { - ...Message_defaultResolvers -}; -", - "force": false, - "path": "Message.js", - }, - Object { - "code": "/* @flow */ -import { AuthPayload_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; -import type { AuthPayload_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -export const AuthPayload: AuthPayload_Resolvers = { - ...AuthPayload_defaultResolvers -}; -", - "force": false, - "path": "AuthPayload.js", - }, - Object { - "code": "/* @flow */ -import { MutationResult_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; -import type { MutationResult_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -export const MutationResult: MutationResult_Resolvers = { - ...MutationResult_defaultResolvers -}; -", - "force": false, - "path": "MutationResult.js", - }, - Object { - "code": "/* @flow */ -import type { Query_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -export const Query: Query_Resolvers = { - topExperiences: (parent, args, ctx, info) => { - throw new Error(\\"Resolver not implemented\\"); - }, - topHomes: (parent, args, ctx, info) => { - throw new Error(\\"Resolver not implemented\\"); - }, - homesInPriceRange: (parent, args, ctx, info) => { - throw new Error(\\"Resolver not implemented\\"); - }, - topReservations: (parent, args, ctx, info) => { - throw new Error(\\"Resolver not implemented\\"); - }, - featuredDestinations: (parent, args, ctx, info) => { - throw new Error(\\"Resolver not implemented\\"); - }, - experiencesByCity: (parent, args, ctx, info) => { - throw new Error(\\"Resolver not implemented\\"); - }, - viewer: (parent, args, ctx, info) => { - throw new Error(\\"Resolver not implemented\\"); - }, - myLocation: (parent, args, ctx, info) => { - throw new Error(\\"Resolver not implemented\\"); - } -}; -", - "force": false, - "path": "Query.js", - }, - Object { - "code": "/* @flow */ -import type { Mutation_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -export const Mutation: Mutation_Resolvers = { - signup: (parent, args, ctx, info) => { - throw new Error(\\"Resolver not implemented\\"); - }, - login: (parent, args, ctx, info) => { - throw new Error(\\"Resolver not implemented\\"); - }, - addPaymentMethod: (parent, args, ctx, info) => { - throw new Error(\\"Resolver not implemented\\"); - }, - book: (parent, args, ctx, info) => { - throw new Error(\\"Resolver not implemented\\"); - } -}; -", - "force": false, - "path": "Mutation.js", - }, - Object { - "code": "// @flow -// This resolver file was scaffolded by github.com/prisma/graphqlgen, DO NOT EDIT. -// Please do not import this file directly but copy & paste to your application code. - -import type { Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -import { Query } from \\"./Query\\"; -import { Experience } from \\"./Experience\\"; -import { ExperienceCategory } from \\"./ExperienceCategory\\"; -import { Location } from \\"./Location\\"; -import { Review } from \\"./Review\\"; -import { Picture } from \\"./Picture\\"; -import { Home } from \\"./Home\\"; -import { Reservation } from \\"./Reservation\\"; -import { Neighbourhood } from \\"./Neighbourhood\\"; -import { City } from \\"./City\\"; -import { ExperiencesByCity } from \\"./ExperiencesByCity\\"; -import { Viewer } from \\"./Viewer\\"; -import { User } from \\"./User\\"; -import { Booking } from \\"./Booking\\"; -import { Place } from \\"./Place\\"; -import { Amenities } from \\"./Amenities\\"; -import { Pricing } from \\"./Pricing\\"; -import { PlaceViews } from \\"./PlaceViews\\"; -import { GuestRequirements } from \\"./GuestRequirements\\"; -import { Policies } from \\"./Policies\\"; -import { HouseRules } from \\"./HouseRules\\"; -import { Payment } from \\"./Payment\\"; -import { PaymentAccount } from \\"./PaymentAccount\\"; -import { PaypalInformation } from \\"./PaypalInformation\\"; -import { CreditCardInformation } from \\"./CreditCardInformation\\"; -import { Notification } from \\"./Notification\\"; -import { Message } from \\"./Message\\"; -import { Mutation } from \\"./Mutation\\"; -import { AuthPayload } from \\"./AuthPayload\\"; -import { MutationResult } from \\"./MutationResult\\"; - -export const resolvers: Resolvers = { - Query, - Experience, - ExperienceCategory, - Location, - Review, - Picture, - Home, - Reservation, - Neighbourhood, - City, - ExperiencesByCity, - Viewer, - User, - Booking, - Place, - Amenities, - Pricing, - PlaceViews, - GuestRequirements, - Policies, - HouseRules, - Payment, - PaymentAccount, - PaypalInformation, - CreditCardInformation, - Notification, - Message, - Mutation, - AuthPayload, - MutationResult -}; -", - "force": false, - "path": "index.js", - }, -] -`; diff --git a/packages/graphqlgen/src/tests/flow/basic.test.ts b/packages/graphqlgen/src/tests/flow/basic.test.ts deleted file mode 100644 index f4ee0afd..00000000 --- a/packages/graphqlgen/src/tests/flow/basic.test.ts +++ /dev/null @@ -1,119 +0,0 @@ -import { testGeneration } from '../generation' -import { join } from 'path' - -const relative = (p: string) => join(__dirname, p) -const typesPath = relative('./generated-basic/graphqlgen.js') -const resolversDir = relative('./generated-basic/tmp-resolvers/') -const language = 'flow' - -test('basic schema', async () => { - return testGeneration({ - language, - schema: relative('../fixtures/basic/schema.graphql'), - models: { - files: [relative('../fixtures/basic/types-flow.js')], - }, - output: typesPath, - ['resolver-scaffolding']: { - output: resolversDir, - layout: 'file-per-type', - }, - }) -}) - -test('basic enum', async () => { - return testGeneration({ - language, - schema: relative('../fixtures/enum/schema.graphql'), - models: { - files: [relative('../fixtures/enum/types-flow.js')], - }, - output: typesPath, - ['resolver-scaffolding']: { - output: resolversDir, - layout: 'file-per-type', - }, - }) -}) - -test('basic union', async () => { - return testGeneration({ - language, - schema: relative('../fixtures/union/schema.graphql'), - models: { - files: [relative('../fixtures/union/flow-types.js')], - }, - output: typesPath, - ['resolver-scaffolding']: { - output: resolversDir, - layout: 'file-per-type', - }, - }) -}) - -test('defaultName', async () => { - return testGeneration({ - language, - schema: relative('../fixtures/defaultName/schema.graphql'), - models: { - files: [ - { - path: relative('../fixtures/defaultName/flow-types.js'), - defaultName: '${typeName}Node', - }, - ], - }, - output: typesPath, - ['resolver-scaffolding']: { - output: resolversDir, - layout: 'file-per-type', - }, - }) -}) - -//TODO: Fix this test (detected since compiling flow) -// test('basic scalar', async () => { -// return testGeneration({ -// language, -// schema: relative('../fixtures/scalar/schema.graphql'), -// models: { -// files: [relative('../fixtures/scalar/flow-types.js')], -// }, -// output: typesPath, -// ['resolver-scaffolding']: { -// output: resolversDir, -// layout: 'file-per-type', -// }, -// }) -// }) - -test('context', async () => { - return testGeneration({ - language, - schema: relative('../fixtures/context/schema.graphql'), - context: relative('../fixtures/context/flow-types.js:Context'), - models: { - files: [relative('../fixtures/context/flow-types.js')], - }, - output: typesPath, - ['resolver-scaffolding']: { - output: resolversDir, - layout: 'file-per-type', - }, - }) -}) - -test('subscription', () => { - return testGeneration({ - language, - schema: relative('../fixtures/subscription/schema.graphql'), - models: { - files: [relative('../fixtures/subscription/flow-types.js')], - }, - output: typesPath, - ['resolver-scaffolding']: { - output: resolversDir, - layout: 'file-per-type', - }, - }) -}) diff --git a/packages/graphqlgen/src/tests/flow/large-schema.test.ts b/packages/graphqlgen/src/tests/flow/large-schema.test.ts deleted file mode 100644 index 5b13bd7b..00000000 --- a/packages/graphqlgen/src/tests/flow/large-schema.test.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { testGeneration } from '../generation' -import { join } from 'path' - -const relative = (p: string) => join(__dirname, p) -const typesDir = relative('./generated-large/graphqlgen.js') -const resolversDir = relative('./generated-large/tmp-resolvers/') -const language = 'flow' - -test('large schema', async () => { - return testGeneration({ - language, - schema: relative('../fixtures/prisma/schema.graphql'), - models: { - files: [relative('../fixtures/prisma/flow-types.js')], - }, - output: typesDir, - ['resolver-scaffolding']: { - output: resolversDir, - layout: 'file-per-type', - }, - }) -}) From 2e1206498892652b445bb230db6833d675407684 Mon Sep 17 00:00:00 2001 From: Jason Kuhrt Date: Thu, 13 Dec 2018 20:54:29 -0500 Subject: [PATCH 06/35] debug: bring back base flow test --- .../flow/__snapshots__/basic.test.ts.snap | 1233 +++++++++++++++++ .../graphqlgen/src/tests/flow/basic.test.ts | 119 ++ 2 files changed, 1352 insertions(+) create mode 100644 packages/graphqlgen/src/tests/flow/__snapshots__/basic.test.ts.snap create mode 100644 packages/graphqlgen/src/tests/flow/basic.test.ts diff --git a/packages/graphqlgen/src/tests/flow/__snapshots__/basic.test.ts.snap b/packages/graphqlgen/src/tests/flow/__snapshots__/basic.test.ts.snap new file mode 100644 index 00000000..5fdefa5a --- /dev/null +++ b/packages/graphqlgen/src/tests/flow/__snapshots__/basic.test.ts.snap @@ -0,0 +1,1233 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`basic enum 1`] = ` +"/* @flow */ +// Code generated by github.com/prisma/graphqlgen, DO NOT EDIT. + +import type { GraphQLResolveInfo } from \\"graphql\\"; +import type { User } from \\"../../fixtures/enum/types-flow\\"; +type Context = any; + +type EnumAnnotation = \\"EDITOR\\" | \\"COLLABORATOR\\"; +type EnumAsUnionType = \\"RED\\" | \\"GREEN\\" | \\"BLUE\\"; + +// Types for Query +export const Query_defaultResolvers = {}; + +export interface Query_Args_CreateUser { + name: string; + type: EnumAnnotation; +} + +export type Query_CreateUser_Resolver = ( + parent: {}, + args: Query_Args_CreateUser, + ctx: Context, + info: GraphQLResolveInfo +) => User | null | Promise; + +export interface Query_Resolvers { + createUser: ( + parent: {}, + args: Query_Args_CreateUser, + ctx: Context, + info: GraphQLResolveInfo + ) => User | null | Promise; +} + +// Types for User +export const User_defaultResolvers = { + id: (parent: User) => parent.id, + name: (parent: User) => parent.name, + enumAsUnionType: (parent: User) => parent.enumAsUnionType +}; + +export type User_Id_Resolver = ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type User_Name_Resolver = ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type User_EnumAnnotation_Resolver = ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => EnumAnnotation | Promise; + +export type User_EnumAsUnionType_Resolver = ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => EnumAsUnionType | Promise; + +export interface User_Resolvers { + id: ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + name: ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + enumAnnotation: ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => EnumAnnotation | Promise; + + enumAsUnionType: ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => EnumAsUnionType | Promise; +} + +export interface Resolvers { + Query: Query_Resolvers; + User: User_Resolvers; +} +" +`; + +exports[`basic enum 2`] = ` +Array [ + Object { + "code": "/* @flow */ +import { User_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; +import type { User_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +export const User: User_Resolvers = { + ...User_defaultResolvers, + + enumAnnotation: (parent, args, ctx, info) => { + throw new Error(\\"Resolver not implemented\\"); + } +}; +", + "force": false, + "path": "User.js", + }, + Object { + "code": "/* @flow */ +import type { Query_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +export const Query: Query_Resolvers = { + createUser: (parent, args, ctx, info) => { + throw new Error(\\"Resolver not implemented\\"); + } +}; +", + "force": false, + "path": "Query.js", + }, + Object { + "code": "// @flow +// This resolver file was scaffolded by github.com/prisma/graphqlgen, DO NOT EDIT. +// Please do not import this file directly but copy & paste to your application code. + +import type { Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +import { Query } from \\"./Query\\"; +import { User } from \\"./User\\"; + +export const resolvers: Resolvers = { + Query, + User +}; +", + "force": false, + "path": "index.js", + }, +] +`; + +exports[`basic schema 1`] = ` +"/* @flow */ +// Code generated by github.com/prisma/graphqlgen, DO NOT EDIT. + +import type { GraphQLResolveInfo } from \\"graphql\\"; +import type { Number } from \\"../../fixtures/basic/types-flow\\"; +type Context = any; + +// Types for Query +export const Query_defaultResolvers = {}; + +export interface Query_Args_Custom_with_arg { + id: number; +} + +export interface Query_Args_Custom_with_custom_arg { + id: Number; +} + +export interface Query_Args_Scalar_with_arg { + id: number; +} + +export interface Query_Args_Scalar_with_custom_arg { + id: Number; +} + +export type Query_Id_Resolver = ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type Query_Custom_required_Resolver = ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => Number | Promise; + +export type Query_Custom_nullable_Resolver = ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => Number | null | Promise; + +export type Query_Custom_array_nullable_Resolver = ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => Number[] | null | Promise; + +export type Query_Custom_array_required_Resolver = ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => Number[] | Promise; + +export type Query_Custom_with_arg_Resolver = ( + parent: {}, + args: Query_Args_Custom_with_arg, + ctx: Context, + info: GraphQLResolveInfo +) => Number | Promise; + +export type Query_Custom_with_custom_arg_Resolver = ( + parent: {}, + args: Query_Args_Custom_with_custom_arg, + ctx: Context, + info: GraphQLResolveInfo +) => Number | Promise; + +export type Query_Scalar_required_Resolver = ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => boolean | Promise; + +export type Query_Scalar_nullable_Resolver = ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => boolean | null | Promise; + +export type Query_Scalar_array_nullable_Resolver = ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => boolean[] | null | Promise; + +export type Query_Scalar_array_required_Resolver = ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => boolean[] | Promise; + +export type Query_Scalar_with_arg_Resolver = ( + parent: {}, + args: Query_Args_Scalar_with_arg, + ctx: Context, + info: GraphQLResolveInfo +) => boolean | Promise; + +export type Query_Scalar_with_custom_arg_Resolver = ( + parent: {}, + args: Query_Args_Scalar_with_custom_arg, + ctx: Context, + info: GraphQLResolveInfo +) => boolean | Promise; + +export interface Query_Resolvers { + id: ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + custom_required: ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => Number | Promise; + + custom_nullable: ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => Number | null | Promise; + + custom_array_nullable: ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => Number[] | null | Promise; + + custom_array_required: ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => Number[] | Promise; + + custom_with_arg: ( + parent: {}, + args: Query_Args_Custom_with_arg, + ctx: Context, + info: GraphQLResolveInfo + ) => Number | Promise; + + custom_with_custom_arg: ( + parent: {}, + args: Query_Args_Custom_with_custom_arg, + ctx: Context, + info: GraphQLResolveInfo + ) => Number | Promise; + + scalar_required: ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean | Promise; + + scalar_nullable: ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean | null | Promise; + + scalar_array_nullable: ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean[] | null | Promise; + + scalar_array_required: ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean[] | Promise; + + scalar_with_arg: ( + parent: {}, + args: Query_Args_Scalar_with_arg, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean | Promise; + + scalar_with_custom_arg: ( + parent: {}, + args: Query_Args_Scalar_with_custom_arg, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean | Promise; +} + +// Types for Number +export const Number_defaultResolvers = { + id: (parent: Number) => parent.id, + value: (parent: Number) => parent.value +}; + +export type Number_Id_Resolver = ( + parent: Number, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | null | Promise; + +export type Number_Value_Resolver = ( + parent: Number, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => number | null | Promise; + +export interface Number_Resolvers { + id: ( + parent: Number, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | null | Promise; + + value: ( + parent: Number, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => number | null | Promise; +} + +export interface Resolvers { + Query: Query_Resolvers; + Number: Number_Resolvers; +} +" +`; + +exports[`basic schema 2`] = ` +Array [ + Object { + "code": "/* @flow */ +import { Number_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; +import type { Number_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +export const Number: Number_Resolvers = { + ...Number_defaultResolvers +}; +", + "force": false, + "path": "Number.js", + }, + Object { + "code": "/* @flow */ +import type { Query_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +export const Query: Query_Resolvers = { + id: (parent, args, ctx, info) => { + throw new Error(\\"Resolver not implemented\\"); + }, + custom_required: (parent, args, ctx, info) => { + throw new Error(\\"Resolver not implemented\\"); + }, + custom_nullable: (parent, args, ctx, info) => { + throw new Error(\\"Resolver not implemented\\"); + }, + custom_array_nullable: (parent, args, ctx, info) => { + throw new Error(\\"Resolver not implemented\\"); + }, + custom_array_required: (parent, args, ctx, info) => { + throw new Error(\\"Resolver not implemented\\"); + }, + custom_with_arg: (parent, args, ctx, info) => { + throw new Error(\\"Resolver not implemented\\"); + }, + custom_with_custom_arg: (parent, args, ctx, info) => { + throw new Error(\\"Resolver not implemented\\"); + }, + scalar_required: (parent, args, ctx, info) => { + throw new Error(\\"Resolver not implemented\\"); + }, + scalar_nullable: (parent, args, ctx, info) => { + throw new Error(\\"Resolver not implemented\\"); + }, + scalar_array_nullable: (parent, args, ctx, info) => { + throw new Error(\\"Resolver not implemented\\"); + }, + scalar_array_required: (parent, args, ctx, info) => { + throw new Error(\\"Resolver not implemented\\"); + }, + scalar_with_arg: (parent, args, ctx, info) => { + throw new Error(\\"Resolver not implemented\\"); + }, + scalar_with_custom_arg: (parent, args, ctx, info) => { + throw new Error(\\"Resolver not implemented\\"); + } +}; +", + "force": false, + "path": "Query.js", + }, + Object { + "code": "// @flow +// This resolver file was scaffolded by github.com/prisma/graphqlgen, DO NOT EDIT. +// Please do not import this file directly but copy & paste to your application code. + +import type { Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +import { Query } from \\"./Query\\"; +import { Number } from \\"./Number\\"; + +export const resolvers: Resolvers = { + Query, + Number +}; +", + "force": false, + "path": "index.js", + }, +] +`; + +exports[`basic union 1`] = ` +"/* @flow */ +// Code generated by github.com/prisma/graphqlgen, DO NOT EDIT. + +import type { GraphQLResolveInfo } from \\"graphql\\"; +import type { User, Student, Professor } from \\"../../fixtures/union/flow-types\\"; +type Context = any; + +// Types for User +export const User_defaultResolvers = { + id: (parent: User) => parent.id, + name: (parent: User) => parent.name +}; + +export type User_Id_Resolver = ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type User_Name_Resolver = ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type User_Type_Resolver = ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => {} | Promise<{}>; + +export interface User_Resolvers { + id: ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + name: ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + type: ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => {} | Promise<{}>; +} + +// Types for Student +export const Student_defaultResolvers = { + age: (parent: Student) => parent.age +}; + +export type Student_Age_Resolver = ( + parent: Student, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => number | Promise; + +export interface Student_Resolvers { + age: ( + parent: Student, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => number | Promise; +} + +// Types for Professor +export const Professor_defaultResolvers = { + degree: (parent: Professor) => parent.degree +}; + +export type Professor_Degree_Resolver = ( + parent: Professor, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | null | Promise; + +export interface Professor_Resolvers { + degree: ( + parent: Professor, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | null | Promise; +} + +export interface Resolvers { + User: User_Resolvers; + Student: Student_Resolvers; + Professor: Professor_Resolvers; +} +" +`; + +exports[`basic union 2`] = ` +Array [ + Object { + "code": "/* @flow */ +import { User_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; +import type { User_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +export const User: User_Resolvers = { + ...User_defaultResolvers, + + type: (parent, args, ctx, info) => { + throw new Error(\\"Resolver not implemented\\"); + } +}; +", + "force": false, + "path": "User.js", + }, + Object { + "code": "/* @flow */ +import { Student_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; +import type { Student_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +export const Student: Student_Resolvers = { + ...Student_defaultResolvers +}; +", + "force": false, + "path": "Student.js", + }, + Object { + "code": "/* @flow */ +import { Professor_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; +import type { Professor_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +export const Professor: Professor_Resolvers = { + ...Professor_defaultResolvers +}; +", + "force": false, + "path": "Professor.js", + }, + Object { + "code": "// @flow +// This resolver file was scaffolded by github.com/prisma/graphqlgen, DO NOT EDIT. +// Please do not import this file directly but copy & paste to your application code. + +import type { Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +import { User } from \\"./User\\"; +import { Student } from \\"./Student\\"; +import { Professor } from \\"./Professor\\"; + +export const resolvers: Resolvers = { + User, + Student, + Professor +}; +", + "force": false, + "path": "index.js", + }, +] +`; + +exports[`context 1`] = ` +"/* @flow */ +// Code generated by github.com/prisma/graphqlgen, DO NOT EDIT. + +import type { GraphQLResolveInfo } from \\"graphql\\"; +import type { User } from \\"../../fixtures/context/flow-types\\"; +import type { Context } from \\"../../fixtures/context/flow-types\\"; + +// Types for Query +export const Query_defaultResolvers = {}; + +export type Query_CreateUser_Resolver = ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => User | null | Promise; + +export interface Query_Resolvers { + createUser: ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => User | null | Promise; +} + +// Types for User +export const User_defaultResolvers = { + id: (parent: User) => parent.id +}; + +export type User_Id_Resolver = ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export interface User_Resolvers { + id: ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; +} + +export interface Resolvers { + Query: Query_Resolvers; + User: User_Resolvers; +} +" +`; + +exports[`context 2`] = ` +Array [ + Object { + "code": "/* @flow */ +import { User_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; +import type { User_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +export const User: User_Resolvers = { + ...User_defaultResolvers +}; +", + "force": false, + "path": "User.js", + }, + Object { + "code": "/* @flow */ +import type { Query_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +export const Query: Query_Resolvers = { + createUser: (parent, args, ctx, info) => { + throw new Error(\\"Resolver not implemented\\"); + } +}; +", + "force": false, + "path": "Query.js", + }, + Object { + "code": "// @flow +// This resolver file was scaffolded by github.com/prisma/graphqlgen, DO NOT EDIT. +// Please do not import this file directly but copy & paste to your application code. + +import type { Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +import { Query } from \\"./Query\\"; +import { User } from \\"./User\\"; + +export const resolvers: Resolvers = { + Query, + User +}; +", + "force": false, + "path": "index.js", + }, +] +`; + +exports[`defaultName 1`] = ` +"/* @flow */ +// Code generated by github.com/prisma/graphqlgen, DO NOT EDIT. + +import type { GraphQLResolveInfo } from \\"graphql\\"; +import type { NumberNode } from \\"../../fixtures/defaultName/flow-types\\"; +type Context = any; + +// Types for Query +export const Query_defaultResolvers = {}; + +export interface Query_Args_Custom_with_arg { + id: number; +} + +export interface Query_Args_Custom_with_custom_arg { + id: NumberNode; +} + +export interface Query_Args_Scalar_with_arg { + id: number; +} + +export interface Query_Args_Scalar_with_custom_arg { + id: NumberNode; +} + +export type Query_Id_Resolver = ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type Query_Custom_required_Resolver = ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => NumberNode | Promise; + +export type Query_Custom_nullable_Resolver = ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => NumberNode | null | Promise; + +export type Query_Custom_array_nullable_Resolver = ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => NumberNode[] | null | Promise; + +export type Query_Custom_array_required_Resolver = ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => NumberNode[] | Promise; + +export type Query_Custom_with_arg_Resolver = ( + parent: {}, + args: Query_Args_Custom_with_arg, + ctx: Context, + info: GraphQLResolveInfo +) => NumberNode | Promise; + +export type Query_Custom_with_custom_arg_Resolver = ( + parent: {}, + args: Query_Args_Custom_with_custom_arg, + ctx: Context, + info: GraphQLResolveInfo +) => NumberNode | Promise; + +export type Query_Scalar_required_Resolver = ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => boolean | Promise; + +export type Query_Scalar_nullable_Resolver = ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => boolean | null | Promise; + +export type Query_Scalar_array_nullable_Resolver = ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => boolean[] | null | Promise; + +export type Query_Scalar_array_required_Resolver = ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => boolean[] | Promise; + +export type Query_Scalar_with_arg_Resolver = ( + parent: {}, + args: Query_Args_Scalar_with_arg, + ctx: Context, + info: GraphQLResolveInfo +) => boolean | Promise; + +export type Query_Scalar_with_custom_arg_Resolver = ( + parent: {}, + args: Query_Args_Scalar_with_custom_arg, + ctx: Context, + info: GraphQLResolveInfo +) => boolean | Promise; + +export interface Query_Resolvers { + id: ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + custom_required: ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => NumberNode | Promise; + + custom_nullable: ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => NumberNode | null | Promise; + + custom_array_nullable: ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => NumberNode[] | null | Promise; + + custom_array_required: ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => NumberNode[] | Promise; + + custom_with_arg: ( + parent: {}, + args: Query_Args_Custom_with_arg, + ctx: Context, + info: GraphQLResolveInfo + ) => NumberNode | Promise; + + custom_with_custom_arg: ( + parent: {}, + args: Query_Args_Custom_with_custom_arg, + ctx: Context, + info: GraphQLResolveInfo + ) => NumberNode | Promise; + + scalar_required: ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean | Promise; + + scalar_nullable: ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean | null | Promise; + + scalar_array_nullable: ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean[] | null | Promise; + + scalar_array_required: ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean[] | Promise; + + scalar_with_arg: ( + parent: {}, + args: Query_Args_Scalar_with_arg, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean | Promise; + + scalar_with_custom_arg: ( + parent: {}, + args: Query_Args_Scalar_with_custom_arg, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean | Promise; +} + +// Types for Number +export const Number_defaultResolvers = { + id: (parent: NumberNode) => parent.id, + value: (parent: NumberNode) => parent.value +}; + +export type Number_Id_Resolver = ( + parent: NumberNode, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | null | Promise; + +export type Number_Value_Resolver = ( + parent: NumberNode, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => number | null | Promise; + +export interface Number_Resolvers { + id: ( + parent: NumberNode, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | null | Promise; + + value: ( + parent: NumberNode, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => number | null | Promise; +} + +export interface Resolvers { + Query: Query_Resolvers; + Number: Number_Resolvers; +} +" +`; + +exports[`defaultName 2`] = ` +Array [ + Object { + "code": "/* @flow */ +import { Number_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; +import type { Number_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +export const Number: Number_Resolvers = { + ...Number_defaultResolvers +}; +", + "force": false, + "path": "Number.js", + }, + Object { + "code": "/* @flow */ +import type { Query_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +export const Query: Query_Resolvers = { + id: (parent, args, ctx, info) => { + throw new Error(\\"Resolver not implemented\\"); + }, + custom_required: (parent, args, ctx, info) => { + throw new Error(\\"Resolver not implemented\\"); + }, + custom_nullable: (parent, args, ctx, info) => { + throw new Error(\\"Resolver not implemented\\"); + }, + custom_array_nullable: (parent, args, ctx, info) => { + throw new Error(\\"Resolver not implemented\\"); + }, + custom_array_required: (parent, args, ctx, info) => { + throw new Error(\\"Resolver not implemented\\"); + }, + custom_with_arg: (parent, args, ctx, info) => { + throw new Error(\\"Resolver not implemented\\"); + }, + custom_with_custom_arg: (parent, args, ctx, info) => { + throw new Error(\\"Resolver not implemented\\"); + }, + scalar_required: (parent, args, ctx, info) => { + throw new Error(\\"Resolver not implemented\\"); + }, + scalar_nullable: (parent, args, ctx, info) => { + throw new Error(\\"Resolver not implemented\\"); + }, + scalar_array_nullable: (parent, args, ctx, info) => { + throw new Error(\\"Resolver not implemented\\"); + }, + scalar_array_required: (parent, args, ctx, info) => { + throw new Error(\\"Resolver not implemented\\"); + }, + scalar_with_arg: (parent, args, ctx, info) => { + throw new Error(\\"Resolver not implemented\\"); + }, + scalar_with_custom_arg: (parent, args, ctx, info) => { + throw new Error(\\"Resolver not implemented\\"); + } +}; +", + "force": false, + "path": "Query.js", + }, + Object { + "code": "// @flow +// This resolver file was scaffolded by github.com/prisma/graphqlgen, DO NOT EDIT. +// Please do not import this file directly but copy & paste to your application code. + +import type { Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +import { Query } from \\"./Query\\"; +import { Number } from \\"./Number\\"; + +export const resolvers: Resolvers = { + Query, + Number +}; +", + "force": false, + "path": "index.js", + }, +] +`; + +exports[`subscription 1`] = ` +"/* @flow */ +// Code generated by github.com/prisma/graphqlgen, DO NOT EDIT. + +import type { GraphQLResolveInfo } from \\"graphql\\"; +import type { User } from \\"../../fixtures/subscription/flow-types\\"; +type Context = any; + +// Types for Subscription +export const Subscription_defaultResolvers = {}; + +export type Subscription_SubscribeToUser_Resolver = {| + subscribe: ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => AsyncIterator | Promise>, + resolve?: ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => User | Promise +|}; + +export interface Subscription_Resolvers { + subscribeToUser: {| + subscribe: ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => AsyncIterator | Promise>, + resolve?: ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => User | Promise + |}; +} + +// Types for User +export const User_defaultResolvers = { + name: (parent: User) => parent.name +}; + +export type User_Name_Resolver = ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export interface User_Resolvers { + name: ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; +} + +export interface Resolvers { + Subscription: Subscription_Resolvers; + User: User_Resolvers; +} +" +`; + +exports[`subscription 2`] = ` +Array [ + Object { + "code": "/* @flow */ +import { User_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; +import type { User_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +export const User: User_Resolvers = { + ...User_defaultResolvers +}; +", + "force": false, + "path": "User.js", + }, + Object { + "code": "/* @flow */ +import type { Subscription_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +export const Subscription: Subscription_Resolvers = { + subscribeToUser: { + subscribe: (parent, args, ctx, info) => { + throw new Error(\\"Resolver not implemented\\"); + } + } +}; +", + "force": false, + "path": "Subscription.js", + }, + Object { + "code": "// @flow +// This resolver file was scaffolded by github.com/prisma/graphqlgen, DO NOT EDIT. +// Please do not import this file directly but copy & paste to your application code. + +import type { Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +import { Subscription } from \\"./Subscription\\"; +import { User } from \\"./User\\"; + +export const resolvers: Resolvers = { + Subscription, + User +}; +", + "force": false, + "path": "index.js", + }, +] +`; diff --git a/packages/graphqlgen/src/tests/flow/basic.test.ts b/packages/graphqlgen/src/tests/flow/basic.test.ts new file mode 100644 index 00000000..f4ee0afd --- /dev/null +++ b/packages/graphqlgen/src/tests/flow/basic.test.ts @@ -0,0 +1,119 @@ +import { testGeneration } from '../generation' +import { join } from 'path' + +const relative = (p: string) => join(__dirname, p) +const typesPath = relative('./generated-basic/graphqlgen.js') +const resolversDir = relative('./generated-basic/tmp-resolvers/') +const language = 'flow' + +test('basic schema', async () => { + return testGeneration({ + language, + schema: relative('../fixtures/basic/schema.graphql'), + models: { + files: [relative('../fixtures/basic/types-flow.js')], + }, + output: typesPath, + ['resolver-scaffolding']: { + output: resolversDir, + layout: 'file-per-type', + }, + }) +}) + +test('basic enum', async () => { + return testGeneration({ + language, + schema: relative('../fixtures/enum/schema.graphql'), + models: { + files: [relative('../fixtures/enum/types-flow.js')], + }, + output: typesPath, + ['resolver-scaffolding']: { + output: resolversDir, + layout: 'file-per-type', + }, + }) +}) + +test('basic union', async () => { + return testGeneration({ + language, + schema: relative('../fixtures/union/schema.graphql'), + models: { + files: [relative('../fixtures/union/flow-types.js')], + }, + output: typesPath, + ['resolver-scaffolding']: { + output: resolversDir, + layout: 'file-per-type', + }, + }) +}) + +test('defaultName', async () => { + return testGeneration({ + language, + schema: relative('../fixtures/defaultName/schema.graphql'), + models: { + files: [ + { + path: relative('../fixtures/defaultName/flow-types.js'), + defaultName: '${typeName}Node', + }, + ], + }, + output: typesPath, + ['resolver-scaffolding']: { + output: resolversDir, + layout: 'file-per-type', + }, + }) +}) + +//TODO: Fix this test (detected since compiling flow) +// test('basic scalar', async () => { +// return testGeneration({ +// language, +// schema: relative('../fixtures/scalar/schema.graphql'), +// models: { +// files: [relative('../fixtures/scalar/flow-types.js')], +// }, +// output: typesPath, +// ['resolver-scaffolding']: { +// output: resolversDir, +// layout: 'file-per-type', +// }, +// }) +// }) + +test('context', async () => { + return testGeneration({ + language, + schema: relative('../fixtures/context/schema.graphql'), + context: relative('../fixtures/context/flow-types.js:Context'), + models: { + files: [relative('../fixtures/context/flow-types.js')], + }, + output: typesPath, + ['resolver-scaffolding']: { + output: resolversDir, + layout: 'file-per-type', + }, + }) +}) + +test('subscription', () => { + return testGeneration({ + language, + schema: relative('../fixtures/subscription/schema.graphql'), + models: { + files: [relative('../fixtures/subscription/flow-types.js')], + }, + output: typesPath, + ['resolver-scaffolding']: { + output: resolversDir, + layout: 'file-per-type', + }, + }) +}) From 6fabb08400225019e51dc8d760580bce3beb8578 Mon Sep 17 00:00:00 2001 From: Jason Kuhrt Date: Thu, 13 Dec 2018 20:55:58 -0500 Subject: [PATCH 07/35] Revert "debug: take away flow tests" This reverts commit 28c83f3c85d02baf7206b60629636a1b9e5d8437. --- .../__snapshots__/large-schema.test.ts.snap | 4312 +++++++++++++++++ .../src/tests/flow/large-schema.test.ts | 22 + 2 files changed, 4334 insertions(+) create mode 100644 packages/graphqlgen/src/tests/flow/__snapshots__/large-schema.test.ts.snap create mode 100644 packages/graphqlgen/src/tests/flow/large-schema.test.ts diff --git a/packages/graphqlgen/src/tests/flow/__snapshots__/large-schema.test.ts.snap b/packages/graphqlgen/src/tests/flow/__snapshots__/large-schema.test.ts.snap new file mode 100644 index 00000000..568dc06f --- /dev/null +++ b/packages/graphqlgen/src/tests/flow/__snapshots__/large-schema.test.ts.snap @@ -0,0 +1,4312 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`large schema 1`] = ` +"/* @flow */ +// Code generated by github.com/prisma/graphqlgen, DO NOT EDIT. + +import type { GraphQLResolveInfo } from \\"graphql\\"; +import type { + Experience, + ExperienceCategory, + Location, + Review, + Picture, + Home, + Reservation, + Neighbourhood, + City, + ExperiencesByCity, + Viewer, + User, + Booking, + Place, + Amenities, + Pricing, + PlaceViews, + GuestRequirements, + Policies, + HouseRules, + Payment, + PaymentAccount, + PaypalInformation, + CreditCardInformation, + Notification, + Message, + AuthPayload, + MutationResult +} from \\"../../fixtures/prisma/flow-types\\"; +type Context = any; + +type PLACE_SIZES = + | \\"ENTIRE_HOUSE\\" + | \\"ENTIRE_APARTMENT\\" + | \\"ENTIRE_EARTH_HOUSE\\" + | \\"ENTIRE_CABIN\\" + | \\"ENTIRE_VILLA\\" + | \\"ENTIRE_PLACE\\" + | \\"ENTIRE_BOAT\\" + | \\"PRIVATE_ROOM\\"; +type CURRENCY = \\"CAD\\" | \\"CHF\\" | \\"EUR\\" | \\"JPY\\" | \\"USD\\" | \\"ZAR\\"; +type PAYMENT_PROVIDER = \\"PAYPAL\\" | \\"CREDIT_CARD\\"; +type NOTIFICATION_TYPE = + | \\"OFFER\\" + | \\"INSTANT_BOOK\\" + | \\"RESPONSIVENESS\\" + | \\"NEW_AMENITIES\\" + | \\"HOUSE_RULES\\"; + +// Types for Query +export const Query_defaultResolvers = {}; + +export interface Query_Args_HomesInPriceRange { + min: number; + max: number; +} + +export interface Query_Args_ExperiencesByCity { + cities: string[]; +} + +export type Query_TopExperiences_Resolver = ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => Experience[] | Promise; + +export type Query_TopHomes_Resolver = ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => Home[] | Promise; + +export type Query_HomesInPriceRange_Resolver = ( + parent: {}, + args: Query_Args_HomesInPriceRange, + ctx: Context, + info: GraphQLResolveInfo +) => Home[] | Promise; + +export type Query_TopReservations_Resolver = ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => Reservation[] | Promise; + +export type Query_FeaturedDestinations_Resolver = ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => Neighbourhood[] | Promise; + +export type Query_ExperiencesByCity_Resolver = ( + parent: {}, + args: Query_Args_ExperiencesByCity, + ctx: Context, + info: GraphQLResolveInfo +) => ExperiencesByCity[] | Promise; + +export type Query_Viewer_Resolver = ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => Viewer | null | Promise; + +export type Query_MyLocation_Resolver = ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => Location | null | Promise; + +export interface Query_Resolvers { + topExperiences: ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => Experience[] | Promise; + + topHomes: ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => Home[] | Promise; + + homesInPriceRange: ( + parent: {}, + args: Query_Args_HomesInPriceRange, + ctx: Context, + info: GraphQLResolveInfo + ) => Home[] | Promise; + + topReservations: ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => Reservation[] | Promise; + + featuredDestinations: ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => Neighbourhood[] | Promise; + + experiencesByCity: ( + parent: {}, + args: Query_Args_ExperiencesByCity, + ctx: Context, + info: GraphQLResolveInfo + ) => ExperiencesByCity[] | Promise; + + viewer: ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => Viewer | null | Promise; + + myLocation: ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => Location | null | Promise; +} + +// Types for Experience +export const Experience_defaultResolvers = { + id: (parent: Experience) => parent.id, + category: (parent: Experience) => + parent.category === undefined ? null : parent.category, + title: (parent: Experience) => parent.title, + location: (parent: Experience) => parent.location, + pricePerPerson: (parent: Experience) => parent.pricePerPerson, + reviews: (parent: Experience) => parent.reviews, + preview: (parent: Experience) => parent.preview, + popularity: (parent: Experience) => parent.popularity +}; + +export type Experience_Id_Resolver = ( + parent: Experience, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type Experience_Category_Resolver = ( + parent: Experience, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => ExperienceCategory | null | Promise; + +export type Experience_Title_Resolver = ( + parent: Experience, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type Experience_Location_Resolver = ( + parent: Experience, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => Location | Promise; + +export type Experience_PricePerPerson_Resolver = ( + parent: Experience, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => number | Promise; + +export type Experience_Reviews_Resolver = ( + parent: Experience, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => Review[] | Promise; + +export type Experience_Preview_Resolver = ( + parent: Experience, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => Picture | Promise; + +export type Experience_Popularity_Resolver = ( + parent: Experience, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => number | Promise; + +export interface Experience_Resolvers { + id: ( + parent: Experience, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + category: ( + parent: Experience, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => ExperienceCategory | null | Promise; + + title: ( + parent: Experience, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + location: ( + parent: Experience, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => Location | Promise; + + pricePerPerson: ( + parent: Experience, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => number | Promise; + + reviews: ( + parent: Experience, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => Review[] | Promise; + + preview: ( + parent: Experience, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => Picture | Promise; + + popularity: ( + parent: Experience, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => number | Promise; +} + +// Types for ExperienceCategory +export const ExperienceCategory_defaultResolvers = { + id: (parent: ExperienceCategory) => parent.id, + mainColor: (parent: ExperienceCategory) => parent.mainColor, + name: (parent: ExperienceCategory) => parent.name, + experience: (parent: ExperienceCategory) => + parent.experience === undefined ? null : parent.experience +}; + +export type ExperienceCategory_Id_Resolver = ( + parent: ExperienceCategory, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type ExperienceCategory_MainColor_Resolver = ( + parent: ExperienceCategory, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type ExperienceCategory_Name_Resolver = ( + parent: ExperienceCategory, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type ExperienceCategory_Experience_Resolver = ( + parent: ExperienceCategory, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => Experience | null | Promise; + +export interface ExperienceCategory_Resolvers { + id: ( + parent: ExperienceCategory, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + mainColor: ( + parent: ExperienceCategory, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + name: ( + parent: ExperienceCategory, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + experience: ( + parent: ExperienceCategory, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => Experience | null | Promise; +} + +// Types for Location +export const Location_defaultResolvers = { + id: (parent: Location) => parent.id, + lat: (parent: Location) => parent.lat, + lng: (parent: Location) => parent.lng, + address: (parent: Location) => + parent.address === undefined ? null : parent.address, + directions: (parent: Location) => + parent.directions === undefined ? null : parent.directions +}; + +export type Location_Id_Resolver = ( + parent: Location, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type Location_Lat_Resolver = ( + parent: Location, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => number | Promise; + +export type Location_Lng_Resolver = ( + parent: Location, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => number | Promise; + +export type Location_Address_Resolver = ( + parent: Location, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | null | Promise; + +export type Location_Directions_Resolver = ( + parent: Location, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | null | Promise; + +export interface Location_Resolvers { + id: ( + parent: Location, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + lat: ( + parent: Location, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => number | Promise; + + lng: ( + parent: Location, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => number | Promise; + + address: ( + parent: Location, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | null | Promise; + + directions: ( + parent: Location, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | null | Promise; +} + +// Types for Review +export const Review_defaultResolvers = { + accuracy: (parent: Review) => parent.accuracy, + checkIn: (parent: Review) => parent.checkIn, + cleanliness: (parent: Review) => parent.cleanliness, + communication: (parent: Review) => parent.communication, + createdAt: (parent: Review) => parent.createdAt, + id: (parent: Review) => parent.id, + location: (parent: Review) => parent.location, + stars: (parent: Review) => parent.stars, + text: (parent: Review) => parent.text, + value: (parent: Review) => parent.value +}; + +export type Review_Accuracy_Resolver = ( + parent: Review, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => number | Promise; + +export type Review_CheckIn_Resolver = ( + parent: Review, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => number | Promise; + +export type Review_Cleanliness_Resolver = ( + parent: Review, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => number | Promise; + +export type Review_Communication_Resolver = ( + parent: Review, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => number | Promise; + +export type Review_CreatedAt_Resolver = ( + parent: Review, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type Review_Id_Resolver = ( + parent: Review, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type Review_Location_Resolver = ( + parent: Review, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => number | Promise; + +export type Review_Stars_Resolver = ( + parent: Review, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => number | Promise; + +export type Review_Text_Resolver = ( + parent: Review, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type Review_Value_Resolver = ( + parent: Review, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => number | Promise; + +export interface Review_Resolvers { + accuracy: ( + parent: Review, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => number | Promise; + + checkIn: ( + parent: Review, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => number | Promise; + + cleanliness: ( + parent: Review, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => number | Promise; + + communication: ( + parent: Review, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => number | Promise; + + createdAt: ( + parent: Review, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + id: ( + parent: Review, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + location: ( + parent: Review, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => number | Promise; + + stars: ( + parent: Review, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => number | Promise; + + text: ( + parent: Review, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + value: ( + parent: Review, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => number | Promise; +} + +// Types for Picture +export const Picture_defaultResolvers = { + id: (parent: Picture) => parent.id, + url: (parent: Picture) => parent.url +}; + +export type Picture_Id_Resolver = ( + parent: Picture, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type Picture_Url_Resolver = ( + parent: Picture, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export interface Picture_Resolvers { + id: ( + parent: Picture, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + url: ( + parent: Picture, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; +} + +// Types for Home +export const Home_defaultResolvers = { + id: (parent: Home) => parent.id, + name: (parent: Home) => (parent.name === undefined ? null : parent.name), + description: (parent: Home) => parent.description, + numRatings: (parent: Home) => parent.numRatings, + avgRating: (parent: Home) => + parent.avgRating === undefined ? null : parent.avgRating, + pictures: (parent: Home) => parent.pictures, + perNight: (parent: Home) => parent.perNight +}; + +export interface Home_Args_Pictures { + first: number | null; +} + +export type Home_Id_Resolver = ( + parent: Home, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type Home_Name_Resolver = ( + parent: Home, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | null | Promise; + +export type Home_Description_Resolver = ( + parent: Home, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type Home_NumRatings_Resolver = ( + parent: Home, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => number | Promise; + +export type Home_AvgRating_Resolver = ( + parent: Home, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => number | null | Promise; + +export type Home_Pictures_Resolver = ( + parent: Home, + args: Home_Args_Pictures, + ctx: Context, + info: GraphQLResolveInfo +) => Picture[] | Promise; + +export type Home_PerNight_Resolver = ( + parent: Home, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => number | Promise; + +export interface Home_Resolvers { + id: ( + parent: Home, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + name: ( + parent: Home, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | null | Promise; + + description: ( + parent: Home, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + numRatings: ( + parent: Home, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => number | Promise; + + avgRating: ( + parent: Home, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => number | null | Promise; + + pictures: ( + parent: Home, + args: Home_Args_Pictures, + ctx: Context, + info: GraphQLResolveInfo + ) => Picture[] | Promise; + + perNight: ( + parent: Home, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => number | Promise; +} + +// Types for Reservation +export const Reservation_defaultResolvers = { + id: (parent: Reservation) => parent.id, + title: (parent: Reservation) => parent.title, + avgPricePerPerson: (parent: Reservation) => parent.avgPricePerPerson, + pictures: (parent: Reservation) => parent.pictures, + location: (parent: Reservation) => parent.location, + isCurated: (parent: Reservation) => parent.isCurated, + slug: (parent: Reservation) => parent.slug, + popularity: (parent: Reservation) => parent.popularity +}; + +export type Reservation_Id_Resolver = ( + parent: Reservation, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type Reservation_Title_Resolver = ( + parent: Reservation, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type Reservation_AvgPricePerPerson_Resolver = ( + parent: Reservation, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => number | Promise; + +export type Reservation_Pictures_Resolver = ( + parent: Reservation, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => Picture[] | Promise; + +export type Reservation_Location_Resolver = ( + parent: Reservation, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => Location | Promise; + +export type Reservation_IsCurated_Resolver = ( + parent: Reservation, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => boolean | Promise; + +export type Reservation_Slug_Resolver = ( + parent: Reservation, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type Reservation_Popularity_Resolver = ( + parent: Reservation, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => number | Promise; + +export interface Reservation_Resolvers { + id: ( + parent: Reservation, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + title: ( + parent: Reservation, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + avgPricePerPerson: ( + parent: Reservation, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => number | Promise; + + pictures: ( + parent: Reservation, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => Picture[] | Promise; + + location: ( + parent: Reservation, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => Location | Promise; + + isCurated: ( + parent: Reservation, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean | Promise; + + slug: ( + parent: Reservation, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + popularity: ( + parent: Reservation, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => number | Promise; +} + +// Types for Neighbourhood +export const Neighbourhood_defaultResolvers = { + id: (parent: Neighbourhood) => parent.id, + name: (parent: Neighbourhood) => parent.name, + slug: (parent: Neighbourhood) => parent.slug, + homePreview: (parent: Neighbourhood) => + parent.homePreview === undefined ? null : parent.homePreview, + city: (parent: Neighbourhood) => parent.city, + featured: (parent: Neighbourhood) => parent.featured, + popularity: (parent: Neighbourhood) => parent.popularity +}; + +export type Neighbourhood_Id_Resolver = ( + parent: Neighbourhood, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type Neighbourhood_Name_Resolver = ( + parent: Neighbourhood, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type Neighbourhood_Slug_Resolver = ( + parent: Neighbourhood, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type Neighbourhood_HomePreview_Resolver = ( + parent: Neighbourhood, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => Picture | null | Promise; + +export type Neighbourhood_City_Resolver = ( + parent: Neighbourhood, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => City | Promise; + +export type Neighbourhood_Featured_Resolver = ( + parent: Neighbourhood, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => boolean | Promise; + +export type Neighbourhood_Popularity_Resolver = ( + parent: Neighbourhood, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => number | Promise; + +export interface Neighbourhood_Resolvers { + id: ( + parent: Neighbourhood, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + name: ( + parent: Neighbourhood, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + slug: ( + parent: Neighbourhood, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + homePreview: ( + parent: Neighbourhood, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => Picture | null | Promise; + + city: ( + parent: Neighbourhood, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => City | Promise; + + featured: ( + parent: Neighbourhood, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean | Promise; + + popularity: ( + parent: Neighbourhood, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => number | Promise; +} + +// Types for City +export const City_defaultResolvers = { + id: (parent: City) => parent.id, + name: (parent: City) => parent.name +}; + +export type City_Id_Resolver = ( + parent: City, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type City_Name_Resolver = ( + parent: City, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export interface City_Resolvers { + id: ( + parent: City, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + name: ( + parent: City, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; +} + +// Types for ExperiencesByCity +export const ExperiencesByCity_defaultResolvers = { + experiences: (parent: ExperiencesByCity) => parent.experiences, + city: (parent: ExperiencesByCity) => parent.city +}; + +export type ExperiencesByCity_Experiences_Resolver = ( + parent: ExperiencesByCity, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => Experience[] | Promise; + +export type ExperiencesByCity_City_Resolver = ( + parent: ExperiencesByCity, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => City | Promise; + +export interface ExperiencesByCity_Resolvers { + experiences: ( + parent: ExperiencesByCity, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => Experience[] | Promise; + + city: ( + parent: ExperiencesByCity, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => City | Promise; +} + +// Types for Viewer +export const Viewer_defaultResolvers = { + me: (parent: Viewer) => parent.me, + bookings: (parent: Viewer) => parent.bookings +}; + +export type Viewer_Me_Resolver = ( + parent: Viewer, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => User | Promise; + +export type Viewer_Bookings_Resolver = ( + parent: Viewer, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => Booking[] | Promise; + +export interface Viewer_Resolvers { + me: ( + parent: Viewer, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => User | Promise; + + bookings: ( + parent: Viewer, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => Booking[] | Promise; +} + +// Types for User +export const User_defaultResolvers = { + bookings: (parent: User) => parent.bookings, + createdAt: (parent: User) => parent.createdAt, + email: (parent: User) => parent.email, + firstName: (parent: User) => parent.firstName, + hostingExperiences: (parent: User) => parent.hostingExperiences, + id: (parent: User) => parent.id, + isSuperHost: (parent: User) => parent.isSuperHost, + lastName: (parent: User) => parent.lastName, + notifications: (parent: User) => parent.notifications, + ownedPlaces: (parent: User) => parent.ownedPlaces, + phone: (parent: User) => parent.phone, + profilePicture: (parent: User) => + parent.profilePicture === undefined ? null : parent.profilePicture, + receivedMessages: (parent: User) => parent.receivedMessages, + responseRate: (parent: User) => + parent.responseRate === undefined ? null : parent.responseRate, + responseTime: (parent: User) => + parent.responseTime === undefined ? null : parent.responseTime, + sentMessages: (parent: User) => parent.sentMessages, + updatedAt: (parent: User) => parent.updatedAt +}; + +export type User_Bookings_Resolver = ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => Booking[] | Promise; + +export type User_CreatedAt_Resolver = ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type User_Email_Resolver = ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type User_FirstName_Resolver = ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type User_HostingExperiences_Resolver = ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => Experience[] | Promise; + +export type User_Id_Resolver = ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type User_IsSuperHost_Resolver = ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => boolean | Promise; + +export type User_LastName_Resolver = ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type User_Location_Resolver = ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => Location | Promise; + +export type User_Notifications_Resolver = ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => Notification[] | Promise; + +export type User_OwnedPlaces_Resolver = ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => Place[] | Promise; + +export type User_PaymentAccount_Resolver = ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => PaymentAccount[] | Promise; + +export type User_Phone_Resolver = ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type User_ProfilePicture_Resolver = ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => Picture | null | Promise; + +export type User_ReceivedMessages_Resolver = ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => Message[] | Promise; + +export type User_ResponseRate_Resolver = ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => number | null | Promise; + +export type User_ResponseTime_Resolver = ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => number | null | Promise; + +export type User_SentMessages_Resolver = ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => Message[] | Promise; + +export type User_UpdatedAt_Resolver = ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type User_Token_Resolver = ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export interface User_Resolvers { + bookings: ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => Booking[] | Promise; + + createdAt: ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + email: ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + firstName: ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + hostingExperiences: ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => Experience[] | Promise; + + id: ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + isSuperHost: ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean | Promise; + + lastName: ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + location: ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => Location | Promise; + + notifications: ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => Notification[] | Promise; + + ownedPlaces: ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => Place[] | Promise; + + paymentAccount: ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => PaymentAccount[] | Promise; + + phone: ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + profilePicture: ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => Picture | null | Promise; + + receivedMessages: ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => Message[] | Promise; + + responseRate: ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => number | null | Promise; + + responseTime: ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => number | null | Promise; + + sentMessages: ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => Message[] | Promise; + + updatedAt: ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + token: ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; +} + +// Types for Booking +export const Booking_defaultResolvers = { + id: (parent: Booking) => parent.id, + createdAt: (parent: Booking) => parent.createdAt, + bookee: (parent: Booking) => parent.bookee, + place: (parent: Booking) => parent.place, + startDate: (parent: Booking) => parent.startDate, + endDate: (parent: Booking) => parent.endDate, + payment: (parent: Booking) => parent.payment +}; + +export type Booking_Id_Resolver = ( + parent: Booking, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type Booking_CreatedAt_Resolver = ( + parent: Booking, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type Booking_Bookee_Resolver = ( + parent: Booking, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => User | Promise; + +export type Booking_Place_Resolver = ( + parent: Booking, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => Place | Promise; + +export type Booking_StartDate_Resolver = ( + parent: Booking, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type Booking_EndDate_Resolver = ( + parent: Booking, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type Booking_Payment_Resolver = ( + parent: Booking, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => Payment | Promise; + +export interface Booking_Resolvers { + id: ( + parent: Booking, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + createdAt: ( + parent: Booking, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + bookee: ( + parent: Booking, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => User | Promise; + + place: ( + parent: Booking, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => Place | Promise; + + startDate: ( + parent: Booking, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + endDate: ( + parent: Booking, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + payment: ( + parent: Booking, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => Payment | Promise; +} + +// Types for Place +export const Place_defaultResolvers = { + id: (parent: Place) => parent.id, + name: (parent: Place) => (parent.name === undefined ? null : parent.name), + size: (parent: Place) => (parent.size === undefined ? null : parent.size), + shortDescription: (parent: Place) => parent.shortDescription, + description: (parent: Place) => parent.description, + slug: (parent: Place) => parent.slug, + maxGuests: (parent: Place) => parent.maxGuests, + numBedrooms: (parent: Place) => parent.numBedrooms, + numBeds: (parent: Place) => parent.numBeds, + numBaths: (parent: Place) => parent.numBaths, + reviews: (parent: Place) => parent.reviews, + amenities: (parent: Place) => parent.amenities, + host: (parent: Place) => parent.host, + pricing: (parent: Place) => parent.pricing, + location: (parent: Place) => parent.location, + views: (parent: Place) => parent.views, + guestRequirements: (parent: Place) => + parent.guestRequirements === undefined ? null : parent.guestRequirements, + policies: (parent: Place) => + parent.policies === undefined ? null : parent.policies, + houseRules: (parent: Place) => + parent.houseRules === undefined ? null : parent.houseRules, + bookings: (parent: Place) => parent.bookings, + pictures: (parent: Place) => parent.pictures, + popularity: (parent: Place) => parent.popularity +}; + +export type Place_Id_Resolver = ( + parent: Place, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type Place_Name_Resolver = ( + parent: Place, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | null | Promise; + +export type Place_Size_Resolver = ( + parent: Place, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => PLACE_SIZES | null | Promise; + +export type Place_ShortDescription_Resolver = ( + parent: Place, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type Place_Description_Resolver = ( + parent: Place, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type Place_Slug_Resolver = ( + parent: Place, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type Place_MaxGuests_Resolver = ( + parent: Place, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => number | Promise; + +export type Place_NumBedrooms_Resolver = ( + parent: Place, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => number | Promise; + +export type Place_NumBeds_Resolver = ( + parent: Place, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => number | Promise; + +export type Place_NumBaths_Resolver = ( + parent: Place, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => number | Promise; + +export type Place_Reviews_Resolver = ( + parent: Place, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => Review[] | Promise; + +export type Place_Amenities_Resolver = ( + parent: Place, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => Amenities | Promise; + +export type Place_Host_Resolver = ( + parent: Place, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => User | Promise; + +export type Place_Pricing_Resolver = ( + parent: Place, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => Pricing | Promise; + +export type Place_Location_Resolver = ( + parent: Place, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => Location | Promise; + +export type Place_Views_Resolver = ( + parent: Place, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => PlaceViews | Promise; + +export type Place_GuestRequirements_Resolver = ( + parent: Place, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => GuestRequirements | null | Promise; + +export type Place_Policies_Resolver = ( + parent: Place, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => Policies | null | Promise; + +export type Place_HouseRules_Resolver = ( + parent: Place, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => HouseRules | null | Promise; + +export type Place_Bookings_Resolver = ( + parent: Place, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => Booking[] | Promise; + +export type Place_Pictures_Resolver = ( + parent: Place, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => Picture[] | Promise; + +export type Place_Popularity_Resolver = ( + parent: Place, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => number | Promise; + +export interface Place_Resolvers { + id: ( + parent: Place, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + name: ( + parent: Place, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | null | Promise; + + size: ( + parent: Place, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => PLACE_SIZES | null | Promise; + + shortDescription: ( + parent: Place, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + description: ( + parent: Place, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + slug: ( + parent: Place, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + maxGuests: ( + parent: Place, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => number | Promise; + + numBedrooms: ( + parent: Place, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => number | Promise; + + numBeds: ( + parent: Place, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => number | Promise; + + numBaths: ( + parent: Place, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => number | Promise; + + reviews: ( + parent: Place, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => Review[] | Promise; + + amenities: ( + parent: Place, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => Amenities | Promise; + + host: ( + parent: Place, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => User | Promise; + + pricing: ( + parent: Place, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => Pricing | Promise; + + location: ( + parent: Place, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => Location | Promise; + + views: ( + parent: Place, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => PlaceViews | Promise; + + guestRequirements: ( + parent: Place, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => GuestRequirements | null | Promise; + + policies: ( + parent: Place, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => Policies | null | Promise; + + houseRules: ( + parent: Place, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => HouseRules | null | Promise; + + bookings: ( + parent: Place, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => Booking[] | Promise; + + pictures: ( + parent: Place, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => Picture[] | Promise; + + popularity: ( + parent: Place, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => number | Promise; +} + +// Types for Amenities +export const Amenities_defaultResolvers = { + airConditioning: (parent: Amenities) => parent.airConditioning, + babyBath: (parent: Amenities) => parent.babyBath, + babyMonitor: (parent: Amenities) => parent.babyMonitor, + babysitterRecommendations: (parent: Amenities) => + parent.babysitterRecommendations, + bathtub: (parent: Amenities) => parent.bathtub, + breakfast: (parent: Amenities) => parent.breakfast, + buzzerWirelessIntercom: (parent: Amenities) => parent.buzzerWirelessIntercom, + cableTv: (parent: Amenities) => parent.cableTv, + changingTable: (parent: Amenities) => parent.changingTable, + childrensBooksAndToys: (parent: Amenities) => parent.childrensBooksAndToys, + childrensDinnerware: (parent: Amenities) => parent.childrensDinnerware, + crib: (parent: Amenities) => parent.crib, + doorman: (parent: Amenities) => parent.doorman, + dryer: (parent: Amenities) => parent.dryer, + elevator: (parent: Amenities) => parent.elevator, + essentials: (parent: Amenities) => parent.essentials, + familyKidFriendly: (parent: Amenities) => parent.familyKidFriendly, + freeParkingOnPremises: (parent: Amenities) => parent.freeParkingOnPremises, + freeParkingOnStreet: (parent: Amenities) => parent.freeParkingOnStreet, + gym: (parent: Amenities) => parent.gym, + hairDryer: (parent: Amenities) => parent.hairDryer, + hangers: (parent: Amenities) => parent.hangers, + heating: (parent: Amenities) => parent.heating, + hotTub: (parent: Amenities) => parent.hotTub, + id: (parent: Amenities) => parent.id, + indoorFireplace: (parent: Amenities) => parent.indoorFireplace, + internet: (parent: Amenities) => parent.internet, + iron: (parent: Amenities) => parent.iron, + kitchen: (parent: Amenities) => parent.kitchen, + laptopFriendlyWorkspace: (parent: Amenities) => + parent.laptopFriendlyWorkspace, + paidParkingOffPremises: (parent: Amenities) => parent.paidParkingOffPremises, + petsAllowed: (parent: Amenities) => parent.petsAllowed, + pool: (parent: Amenities) => parent.pool, + privateEntrance: (parent: Amenities) => parent.privateEntrance, + shampoo: (parent: Amenities) => parent.shampoo, + smokingAllowed: (parent: Amenities) => parent.smokingAllowed, + suitableForEvents: (parent: Amenities) => parent.suitableForEvents, + tv: (parent: Amenities) => parent.tv, + washer: (parent: Amenities) => parent.washer, + wheelchairAccessible: (parent: Amenities) => parent.wheelchairAccessible, + wirelessInternet: (parent: Amenities) => parent.wirelessInternet +}; + +export type Amenities_AirConditioning_Resolver = ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => boolean | Promise; + +export type Amenities_BabyBath_Resolver = ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => boolean | Promise; + +export type Amenities_BabyMonitor_Resolver = ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => boolean | Promise; + +export type Amenities_BabysitterRecommendations_Resolver = ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => boolean | Promise; + +export type Amenities_Bathtub_Resolver = ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => boolean | Promise; + +export type Amenities_Breakfast_Resolver = ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => boolean | Promise; + +export type Amenities_BuzzerWirelessIntercom_Resolver = ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => boolean | Promise; + +export type Amenities_CableTv_Resolver = ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => boolean | Promise; + +export type Amenities_ChangingTable_Resolver = ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => boolean | Promise; + +export type Amenities_ChildrensBooksAndToys_Resolver = ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => boolean | Promise; + +export type Amenities_ChildrensDinnerware_Resolver = ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => boolean | Promise; + +export type Amenities_Crib_Resolver = ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => boolean | Promise; + +export type Amenities_Doorman_Resolver = ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => boolean | Promise; + +export type Amenities_Dryer_Resolver = ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => boolean | Promise; + +export type Amenities_Elevator_Resolver = ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => boolean | Promise; + +export type Amenities_Essentials_Resolver = ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => boolean | Promise; + +export type Amenities_FamilyKidFriendly_Resolver = ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => boolean | Promise; + +export type Amenities_FreeParkingOnPremises_Resolver = ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => boolean | Promise; + +export type Amenities_FreeParkingOnStreet_Resolver = ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => boolean | Promise; + +export type Amenities_Gym_Resolver = ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => boolean | Promise; + +export type Amenities_HairDryer_Resolver = ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => boolean | Promise; + +export type Amenities_Hangers_Resolver = ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => boolean | Promise; + +export type Amenities_Heating_Resolver = ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => boolean | Promise; + +export type Amenities_HotTub_Resolver = ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => boolean | Promise; + +export type Amenities_Id_Resolver = ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type Amenities_IndoorFireplace_Resolver = ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => boolean | Promise; + +export type Amenities_Internet_Resolver = ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => boolean | Promise; + +export type Amenities_Iron_Resolver = ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => boolean | Promise; + +export type Amenities_Kitchen_Resolver = ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => boolean | Promise; + +export type Amenities_LaptopFriendlyWorkspace_Resolver = ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => boolean | Promise; + +export type Amenities_PaidParkingOffPremises_Resolver = ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => boolean | Promise; + +export type Amenities_PetsAllowed_Resolver = ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => boolean | Promise; + +export type Amenities_Pool_Resolver = ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => boolean | Promise; + +export type Amenities_PrivateEntrance_Resolver = ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => boolean | Promise; + +export type Amenities_Shampoo_Resolver = ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => boolean | Promise; + +export type Amenities_SmokingAllowed_Resolver = ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => boolean | Promise; + +export type Amenities_SuitableForEvents_Resolver = ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => boolean | Promise; + +export type Amenities_Tv_Resolver = ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => boolean | Promise; + +export type Amenities_Washer_Resolver = ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => boolean | Promise; + +export type Amenities_WheelchairAccessible_Resolver = ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => boolean | Promise; + +export type Amenities_WirelessInternet_Resolver = ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => boolean | Promise; + +export interface Amenities_Resolvers { + airConditioning: ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean | Promise; + + babyBath: ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean | Promise; + + babyMonitor: ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean | Promise; + + babysitterRecommendations: ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean | Promise; + + bathtub: ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean | Promise; + + breakfast: ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean | Promise; + + buzzerWirelessIntercom: ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean | Promise; + + cableTv: ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean | Promise; + + changingTable: ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean | Promise; + + childrensBooksAndToys: ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean | Promise; + + childrensDinnerware: ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean | Promise; + + crib: ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean | Promise; + + doorman: ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean | Promise; + + dryer: ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean | Promise; + + elevator: ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean | Promise; + + essentials: ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean | Promise; + + familyKidFriendly: ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean | Promise; + + freeParkingOnPremises: ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean | Promise; + + freeParkingOnStreet: ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean | Promise; + + gym: ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean | Promise; + + hairDryer: ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean | Promise; + + hangers: ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean | Promise; + + heating: ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean | Promise; + + hotTub: ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean | Promise; + + id: ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + indoorFireplace: ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean | Promise; + + internet: ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean | Promise; + + iron: ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean | Promise; + + kitchen: ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean | Promise; + + laptopFriendlyWorkspace: ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean | Promise; + + paidParkingOffPremises: ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean | Promise; + + petsAllowed: ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean | Promise; + + pool: ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean | Promise; + + privateEntrance: ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean | Promise; + + shampoo: ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean | Promise; + + smokingAllowed: ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean | Promise; + + suitableForEvents: ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean | Promise; + + tv: ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean | Promise; + + washer: ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean | Promise; + + wheelchairAccessible: ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean | Promise; + + wirelessInternet: ( + parent: Amenities, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean | Promise; +} + +// Types for Pricing +export const Pricing_defaultResolvers = { + averageMonthly: (parent: Pricing) => parent.averageMonthly, + averageWeekly: (parent: Pricing) => parent.averageWeekly, + basePrice: (parent: Pricing) => parent.basePrice, + cleaningFee: (parent: Pricing) => + parent.cleaningFee === undefined ? null : parent.cleaningFee, + currency: (parent: Pricing) => + parent.currency === undefined ? null : parent.currency, + extraGuests: (parent: Pricing) => + parent.extraGuests === undefined ? null : parent.extraGuests, + id: (parent: Pricing) => parent.id, + monthlyDiscount: (parent: Pricing) => + parent.monthlyDiscount === undefined ? null : parent.monthlyDiscount, + perNight: (parent: Pricing) => parent.perNight, + securityDeposit: (parent: Pricing) => + parent.securityDeposit === undefined ? null : parent.securityDeposit, + smartPricing: (parent: Pricing) => parent.smartPricing, + weekendPricing: (parent: Pricing) => + parent.weekendPricing === undefined ? null : parent.weekendPricing, + weeklyDiscount: (parent: Pricing) => + parent.weeklyDiscount === undefined ? null : parent.weeklyDiscount +}; + +export type Pricing_AverageMonthly_Resolver = ( + parent: Pricing, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => number | Promise; + +export type Pricing_AverageWeekly_Resolver = ( + parent: Pricing, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => number | Promise; + +export type Pricing_BasePrice_Resolver = ( + parent: Pricing, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => number | Promise; + +export type Pricing_CleaningFee_Resolver = ( + parent: Pricing, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => number | null | Promise; + +export type Pricing_Currency_Resolver = ( + parent: Pricing, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => CURRENCY | null | Promise; + +export type Pricing_ExtraGuests_Resolver = ( + parent: Pricing, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => number | null | Promise; + +export type Pricing_Id_Resolver = ( + parent: Pricing, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type Pricing_MonthlyDiscount_Resolver = ( + parent: Pricing, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => number | null | Promise; + +export type Pricing_PerNight_Resolver = ( + parent: Pricing, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => number | Promise; + +export type Pricing_SecurityDeposit_Resolver = ( + parent: Pricing, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => number | null | Promise; + +export type Pricing_SmartPricing_Resolver = ( + parent: Pricing, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => boolean | Promise; + +export type Pricing_WeekendPricing_Resolver = ( + parent: Pricing, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => number | null | Promise; + +export type Pricing_WeeklyDiscount_Resolver = ( + parent: Pricing, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => number | null | Promise; + +export interface Pricing_Resolvers { + averageMonthly: ( + parent: Pricing, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => number | Promise; + + averageWeekly: ( + parent: Pricing, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => number | Promise; + + basePrice: ( + parent: Pricing, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => number | Promise; + + cleaningFee: ( + parent: Pricing, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => number | null | Promise; + + currency: ( + parent: Pricing, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => CURRENCY | null | Promise; + + extraGuests: ( + parent: Pricing, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => number | null | Promise; + + id: ( + parent: Pricing, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + monthlyDiscount: ( + parent: Pricing, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => number | null | Promise; + + perNight: ( + parent: Pricing, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => number | Promise; + + securityDeposit: ( + parent: Pricing, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => number | null | Promise; + + smartPricing: ( + parent: Pricing, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean | Promise; + + weekendPricing: ( + parent: Pricing, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => number | null | Promise; + + weeklyDiscount: ( + parent: Pricing, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => number | null | Promise; +} + +// Types for PlaceViews +export const PlaceViews_defaultResolvers = { + id: (parent: PlaceViews) => parent.id, + lastWeek: (parent: PlaceViews) => parent.lastWeek +}; + +export type PlaceViews_Id_Resolver = ( + parent: PlaceViews, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type PlaceViews_LastWeek_Resolver = ( + parent: PlaceViews, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => number | Promise; + +export interface PlaceViews_Resolvers { + id: ( + parent: PlaceViews, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + lastWeek: ( + parent: PlaceViews, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => number | Promise; +} + +// Types for GuestRequirements +export const GuestRequirements_defaultResolvers = { + govIssuedId: (parent: GuestRequirements) => parent.govIssuedId, + guestTripInformation: (parent: GuestRequirements) => + parent.guestTripInformation, + id: (parent: GuestRequirements) => parent.id, + recommendationsFromOtherHosts: (parent: GuestRequirements) => + parent.recommendationsFromOtherHosts +}; + +export type GuestRequirements_GovIssuedId_Resolver = ( + parent: GuestRequirements, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => boolean | Promise; + +export type GuestRequirements_GuestTripInformation_Resolver = ( + parent: GuestRequirements, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => boolean | Promise; + +export type GuestRequirements_Id_Resolver = ( + parent: GuestRequirements, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type GuestRequirements_RecommendationsFromOtherHosts_Resolver = ( + parent: GuestRequirements, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => boolean | Promise; + +export interface GuestRequirements_Resolvers { + govIssuedId: ( + parent: GuestRequirements, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean | Promise; + + guestTripInformation: ( + parent: GuestRequirements, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean | Promise; + + id: ( + parent: GuestRequirements, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + recommendationsFromOtherHosts: ( + parent: GuestRequirements, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean | Promise; +} + +// Types for Policies +export const Policies_defaultResolvers = { + checkInEndTime: (parent: Policies) => parent.checkInEndTime, + checkInStartTime: (parent: Policies) => parent.checkInStartTime, + checkoutTime: (parent: Policies) => parent.checkoutTime, + createdAt: (parent: Policies) => parent.createdAt, + id: (parent: Policies) => parent.id, + updatedAt: (parent: Policies) => parent.updatedAt +}; + +export type Policies_CheckInEndTime_Resolver = ( + parent: Policies, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => number | Promise; + +export type Policies_CheckInStartTime_Resolver = ( + parent: Policies, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => number | Promise; + +export type Policies_CheckoutTime_Resolver = ( + parent: Policies, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => number | Promise; + +export type Policies_CreatedAt_Resolver = ( + parent: Policies, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type Policies_Id_Resolver = ( + parent: Policies, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type Policies_UpdatedAt_Resolver = ( + parent: Policies, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export interface Policies_Resolvers { + checkInEndTime: ( + parent: Policies, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => number | Promise; + + checkInStartTime: ( + parent: Policies, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => number | Promise; + + checkoutTime: ( + parent: Policies, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => number | Promise; + + createdAt: ( + parent: Policies, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + id: ( + parent: Policies, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + updatedAt: ( + parent: Policies, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; +} + +// Types for HouseRules +export const HouseRules_defaultResolvers = { + additionalRules: (parent: HouseRules) => + parent.additionalRules === undefined ? null : parent.additionalRules, + createdAt: (parent: HouseRules) => parent.createdAt, + id: (parent: HouseRules) => parent.id, + partiesAndEventsAllowed: (parent: HouseRules) => + parent.partiesAndEventsAllowed === undefined + ? null + : parent.partiesAndEventsAllowed, + petsAllowed: (parent: HouseRules) => + parent.petsAllowed === undefined ? null : parent.petsAllowed, + smokingAllowed: (parent: HouseRules) => + parent.smokingAllowed === undefined ? null : parent.smokingAllowed, + suitableForChildren: (parent: HouseRules) => + parent.suitableForChildren === undefined + ? null + : parent.suitableForChildren, + suitableForInfants: (parent: HouseRules) => + parent.suitableForInfants === undefined ? null : parent.suitableForInfants, + updatedAt: (parent: HouseRules) => parent.updatedAt +}; + +export type HouseRules_AdditionalRules_Resolver = ( + parent: HouseRules, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | null | Promise; + +export type HouseRules_CreatedAt_Resolver = ( + parent: HouseRules, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type HouseRules_Id_Resolver = ( + parent: HouseRules, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type HouseRules_PartiesAndEventsAllowed_Resolver = ( + parent: HouseRules, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => boolean | null | Promise; + +export type HouseRules_PetsAllowed_Resolver = ( + parent: HouseRules, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => boolean | null | Promise; + +export type HouseRules_SmokingAllowed_Resolver = ( + parent: HouseRules, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => boolean | null | Promise; + +export type HouseRules_SuitableForChildren_Resolver = ( + parent: HouseRules, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => boolean | null | Promise; + +export type HouseRules_SuitableForInfants_Resolver = ( + parent: HouseRules, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => boolean | null | Promise; + +export type HouseRules_UpdatedAt_Resolver = ( + parent: HouseRules, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export interface HouseRules_Resolvers { + additionalRules: ( + parent: HouseRules, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | null | Promise; + + createdAt: ( + parent: HouseRules, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + id: ( + parent: HouseRules, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + partiesAndEventsAllowed: ( + parent: HouseRules, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean | null | Promise; + + petsAllowed: ( + parent: HouseRules, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean | null | Promise; + + smokingAllowed: ( + parent: HouseRules, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean | null | Promise; + + suitableForChildren: ( + parent: HouseRules, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean | null | Promise; + + suitableForInfants: ( + parent: HouseRules, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean | null | Promise; + + updatedAt: ( + parent: HouseRules, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; +} + +// Types for Payment +export const Payment_defaultResolvers = { + booking: (parent: Payment) => parent.booking, + createdAt: (parent: Payment) => parent.createdAt, + id: (parent: Payment) => parent.id, + paymentMethod: (parent: Payment) => parent.paymentMethod, + serviceFee: (parent: Payment) => parent.serviceFee +}; + +export type Payment_Booking_Resolver = ( + parent: Payment, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => Booking | Promise; + +export type Payment_CreatedAt_Resolver = ( + parent: Payment, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type Payment_Id_Resolver = ( + parent: Payment, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type Payment_PaymentMethod_Resolver = ( + parent: Payment, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => PaymentAccount | Promise; + +export type Payment_ServiceFee_Resolver = ( + parent: Payment, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => number | Promise; + +export interface Payment_Resolvers { + booking: ( + parent: Payment, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => Booking | Promise; + + createdAt: ( + parent: Payment, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + id: ( + parent: Payment, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + paymentMethod: ( + parent: Payment, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => PaymentAccount | Promise; + + serviceFee: ( + parent: Payment, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => number | Promise; +} + +// Types for PaymentAccount +export const PaymentAccount_defaultResolvers = { + id: (parent: PaymentAccount) => parent.id, + createdAt: (parent: PaymentAccount) => parent.createdAt, + type: (parent: PaymentAccount) => + parent.type === undefined ? null : parent.type, + user: (parent: PaymentAccount) => parent.user, + payments: (parent: PaymentAccount) => parent.payments, + paypal: (parent: PaymentAccount) => + parent.paypal === undefined ? null : parent.paypal, + creditcard: (parent: PaymentAccount) => + parent.creditcard === undefined ? null : parent.creditcard +}; + +export type PaymentAccount_Id_Resolver = ( + parent: PaymentAccount, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type PaymentAccount_CreatedAt_Resolver = ( + parent: PaymentAccount, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type PaymentAccount_Type_Resolver = ( + parent: PaymentAccount, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => PAYMENT_PROVIDER | null | Promise; + +export type PaymentAccount_User_Resolver = ( + parent: PaymentAccount, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => User | Promise; + +export type PaymentAccount_Payments_Resolver = ( + parent: PaymentAccount, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => Payment[] | Promise; + +export type PaymentAccount_Paypal_Resolver = ( + parent: PaymentAccount, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => PaypalInformation | null | Promise; + +export type PaymentAccount_Creditcard_Resolver = ( + parent: PaymentAccount, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => CreditCardInformation | null | Promise; + +export interface PaymentAccount_Resolvers { + id: ( + parent: PaymentAccount, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + createdAt: ( + parent: PaymentAccount, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + type: ( + parent: PaymentAccount, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => PAYMENT_PROVIDER | null | Promise; + + user: ( + parent: PaymentAccount, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => User | Promise; + + payments: ( + parent: PaymentAccount, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => Payment[] | Promise; + + paypal: ( + parent: PaymentAccount, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => PaypalInformation | null | Promise; + + creditcard: ( + parent: PaymentAccount, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => CreditCardInformation | null | Promise; +} + +// Types for PaypalInformation +export const PaypalInformation_defaultResolvers = { + createdAt: (parent: PaypalInformation) => parent.createdAt, + email: (parent: PaypalInformation) => parent.email, + id: (parent: PaypalInformation) => parent.id, + paymentAccount: (parent: PaypalInformation) => parent.paymentAccount +}; + +export type PaypalInformation_CreatedAt_Resolver = ( + parent: PaypalInformation, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type PaypalInformation_Email_Resolver = ( + parent: PaypalInformation, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type PaypalInformation_Id_Resolver = ( + parent: PaypalInformation, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type PaypalInformation_PaymentAccount_Resolver = ( + parent: PaypalInformation, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => PaymentAccount | Promise; + +export interface PaypalInformation_Resolvers { + createdAt: ( + parent: PaypalInformation, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + email: ( + parent: PaypalInformation, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + id: ( + parent: PaypalInformation, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + paymentAccount: ( + parent: PaypalInformation, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => PaymentAccount | Promise; +} + +// Types for CreditCardInformation +export const CreditCardInformation_defaultResolvers = { + cardNumber: (parent: CreditCardInformation) => parent.cardNumber, + country: (parent: CreditCardInformation) => parent.country, + createdAt: (parent: CreditCardInformation) => parent.createdAt, + expiresOnMonth: (parent: CreditCardInformation) => parent.expiresOnMonth, + expiresOnYear: (parent: CreditCardInformation) => parent.expiresOnYear, + firstName: (parent: CreditCardInformation) => parent.firstName, + id: (parent: CreditCardInformation) => parent.id, + lastName: (parent: CreditCardInformation) => parent.lastName, + paymentAccount: (parent: CreditCardInformation) => + parent.paymentAccount === undefined ? null : parent.paymentAccount, + postalCode: (parent: CreditCardInformation) => parent.postalCode, + securityCode: (parent: CreditCardInformation) => parent.securityCode +}; + +export type CreditCardInformation_CardNumber_Resolver = ( + parent: CreditCardInformation, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type CreditCardInformation_Country_Resolver = ( + parent: CreditCardInformation, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type CreditCardInformation_CreatedAt_Resolver = ( + parent: CreditCardInformation, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type CreditCardInformation_ExpiresOnMonth_Resolver = ( + parent: CreditCardInformation, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => number | Promise; + +export type CreditCardInformation_ExpiresOnYear_Resolver = ( + parent: CreditCardInformation, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => number | Promise; + +export type CreditCardInformation_FirstName_Resolver = ( + parent: CreditCardInformation, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type CreditCardInformation_Id_Resolver = ( + parent: CreditCardInformation, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type CreditCardInformation_LastName_Resolver = ( + parent: CreditCardInformation, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type CreditCardInformation_PaymentAccount_Resolver = ( + parent: CreditCardInformation, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => PaymentAccount | null | Promise; + +export type CreditCardInformation_PostalCode_Resolver = ( + parent: CreditCardInformation, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type CreditCardInformation_SecurityCode_Resolver = ( + parent: CreditCardInformation, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export interface CreditCardInformation_Resolvers { + cardNumber: ( + parent: CreditCardInformation, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + country: ( + parent: CreditCardInformation, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + createdAt: ( + parent: CreditCardInformation, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + expiresOnMonth: ( + parent: CreditCardInformation, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => number | Promise; + + expiresOnYear: ( + parent: CreditCardInformation, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => number | Promise; + + firstName: ( + parent: CreditCardInformation, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + id: ( + parent: CreditCardInformation, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + lastName: ( + parent: CreditCardInformation, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + paymentAccount: ( + parent: CreditCardInformation, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => PaymentAccount | null | Promise; + + postalCode: ( + parent: CreditCardInformation, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + securityCode: ( + parent: CreditCardInformation, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; +} + +// Types for Notification +export const Notification_defaultResolvers = { + createdAt: (parent: Notification) => parent.createdAt, + id: (parent: Notification) => parent.id, + link: (parent: Notification) => parent.link, + readDate: (parent: Notification) => parent.readDate, + type: (parent: Notification) => + parent.type === undefined ? null : parent.type, + user: (parent: Notification) => parent.user +}; + +export type Notification_CreatedAt_Resolver = ( + parent: Notification, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type Notification_Id_Resolver = ( + parent: Notification, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type Notification_Link_Resolver = ( + parent: Notification, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type Notification_ReadDate_Resolver = ( + parent: Notification, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type Notification_Type_Resolver = ( + parent: Notification, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => NOTIFICATION_TYPE | null | Promise; + +export type Notification_User_Resolver = ( + parent: Notification, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => User | Promise; + +export interface Notification_Resolvers { + createdAt: ( + parent: Notification, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + id: ( + parent: Notification, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + link: ( + parent: Notification, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + readDate: ( + parent: Notification, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + type: ( + parent: Notification, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => NOTIFICATION_TYPE | null | Promise; + + user: ( + parent: Notification, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => User | Promise; +} + +// Types for Message +export const Message_defaultResolvers = { + createdAt: (parent: Message) => parent.createdAt, + deliveredAt: (parent: Message) => parent.deliveredAt, + id: (parent: Message) => parent.id, + readAt: (parent: Message) => parent.readAt +}; + +export type Message_CreatedAt_Resolver = ( + parent: Message, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type Message_DeliveredAt_Resolver = ( + parent: Message, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type Message_Id_Resolver = ( + parent: Message, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type Message_ReadAt_Resolver = ( + parent: Message, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export interface Message_Resolvers { + createdAt: ( + parent: Message, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + deliveredAt: ( + parent: Message, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + id: ( + parent: Message, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + readAt: ( + parent: Message, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; +} + +// Types for Mutation +export const Mutation_defaultResolvers = {}; + +export interface Mutation_Args_Signup { + email: string; + password: string; + firstName: string; + lastName: string; + phone: string; +} + +export interface Mutation_Args_Login { + email: string; + password: string; +} + +export interface Mutation_Args_AddPaymentMethod { + cardNumber: string; + expiresOnMonth: number; + expiresOnYear: number; + securityCode: string; + firstName: string; + lastName: string; + postalCode: string; + country: string; +} + +export interface Mutation_Args_Book { + placeId: string; + checkIn: string; + checkOut: string; + numGuests: number; +} + +export type Mutation_Signup_Resolver = ( + parent: {}, + args: Mutation_Args_Signup, + ctx: Context, + info: GraphQLResolveInfo +) => AuthPayload | Promise; + +export type Mutation_Login_Resolver = ( + parent: {}, + args: Mutation_Args_Login, + ctx: Context, + info: GraphQLResolveInfo +) => AuthPayload | Promise; + +export type Mutation_AddPaymentMethod_Resolver = ( + parent: {}, + args: Mutation_Args_AddPaymentMethod, + ctx: Context, + info: GraphQLResolveInfo +) => MutationResult | Promise; + +export type Mutation_Book_Resolver = ( + parent: {}, + args: Mutation_Args_Book, + ctx: Context, + info: GraphQLResolveInfo +) => MutationResult | Promise; + +export interface Mutation_Resolvers { + signup: ( + parent: {}, + args: Mutation_Args_Signup, + ctx: Context, + info: GraphQLResolveInfo + ) => AuthPayload | Promise; + + login: ( + parent: {}, + args: Mutation_Args_Login, + ctx: Context, + info: GraphQLResolveInfo + ) => AuthPayload | Promise; + + addPaymentMethod: ( + parent: {}, + args: Mutation_Args_AddPaymentMethod, + ctx: Context, + info: GraphQLResolveInfo + ) => MutationResult | Promise; + + book: ( + parent: {}, + args: Mutation_Args_Book, + ctx: Context, + info: GraphQLResolveInfo + ) => MutationResult | Promise; +} + +// Types for AuthPayload +export const AuthPayload_defaultResolvers = { + token: (parent: AuthPayload) => parent.token, + user: (parent: AuthPayload) => parent.user +}; + +export type AuthPayload_Token_Resolver = ( + parent: AuthPayload, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type AuthPayload_User_Resolver = ( + parent: AuthPayload, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => User | Promise; + +export interface AuthPayload_Resolvers { + token: ( + parent: AuthPayload, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + user: ( + parent: AuthPayload, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => User | Promise; +} + +// Types for MutationResult +export const MutationResult_defaultResolvers = { + success: (parent: MutationResult) => parent.success +}; + +export type MutationResult_Success_Resolver = ( + parent: MutationResult, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => boolean | Promise; + +export interface MutationResult_Resolvers { + success: ( + parent: MutationResult, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean | Promise; +} + +export interface Resolvers { + Query: Query_Resolvers; + Experience: Experience_Resolvers; + ExperienceCategory: ExperienceCategory_Resolvers; + Location: Location_Resolvers; + Review: Review_Resolvers; + Picture: Picture_Resolvers; + Home: Home_Resolvers; + Reservation: Reservation_Resolvers; + Neighbourhood: Neighbourhood_Resolvers; + City: City_Resolvers; + ExperiencesByCity: ExperiencesByCity_Resolvers; + Viewer: Viewer_Resolvers; + User: User_Resolvers; + Booking: Booking_Resolvers; + Place: Place_Resolvers; + Amenities: Amenities_Resolvers; + Pricing: Pricing_Resolvers; + PlaceViews: PlaceViews_Resolvers; + GuestRequirements: GuestRequirements_Resolvers; + Policies: Policies_Resolvers; + HouseRules: HouseRules_Resolvers; + Payment: Payment_Resolvers; + PaymentAccount: PaymentAccount_Resolvers; + PaypalInformation: PaypalInformation_Resolvers; + CreditCardInformation: CreditCardInformation_Resolvers; + Notification: Notification_Resolvers; + Message: Message_Resolvers; + Mutation: Mutation_Resolvers; + AuthPayload: AuthPayload_Resolvers; + MutationResult: MutationResult_Resolvers; +} +" +`; + +exports[`large schema 2`] = ` +Array [ + Object { + "code": "/* @flow */ +import { Experience_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; +import type { Experience_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +export const Experience: Experience_Resolvers = { + ...Experience_defaultResolvers +}; +", + "force": false, + "path": "Experience.js", + }, + Object { + "code": "/* @flow */ +import { ExperienceCategory_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; +import type { ExperienceCategory_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +export const ExperienceCategory: ExperienceCategory_Resolvers = { + ...ExperienceCategory_defaultResolvers +}; +", + "force": false, + "path": "ExperienceCategory.js", + }, + Object { + "code": "/* @flow */ +import { Location_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; +import type { Location_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +export const Location: Location_Resolvers = { + ...Location_defaultResolvers +}; +", + "force": false, + "path": "Location.js", + }, + Object { + "code": "/* @flow */ +import { Review_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; +import type { Review_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +export const Review: Review_Resolvers = { + ...Review_defaultResolvers +}; +", + "force": false, + "path": "Review.js", + }, + Object { + "code": "/* @flow */ +import { Picture_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; +import type { Picture_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +export const Picture: Picture_Resolvers = { + ...Picture_defaultResolvers +}; +", + "force": false, + "path": "Picture.js", + }, + Object { + "code": "/* @flow */ +import { Home_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; +import type { Home_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +export const Home: Home_Resolvers = { + ...Home_defaultResolvers +}; +", + "force": false, + "path": "Home.js", + }, + Object { + "code": "/* @flow */ +import { Reservation_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; +import type { Reservation_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +export const Reservation: Reservation_Resolvers = { + ...Reservation_defaultResolvers +}; +", + "force": false, + "path": "Reservation.js", + }, + Object { + "code": "/* @flow */ +import { Neighbourhood_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; +import type { Neighbourhood_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +export const Neighbourhood: Neighbourhood_Resolvers = { + ...Neighbourhood_defaultResolvers +}; +", + "force": false, + "path": "Neighbourhood.js", + }, + Object { + "code": "/* @flow */ +import { City_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; +import type { City_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +export const City: City_Resolvers = { + ...City_defaultResolvers +}; +", + "force": false, + "path": "City.js", + }, + Object { + "code": "/* @flow */ +import { ExperiencesByCity_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; +import type { ExperiencesByCity_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +export const ExperiencesByCity: ExperiencesByCity_Resolvers = { + ...ExperiencesByCity_defaultResolvers +}; +", + "force": false, + "path": "ExperiencesByCity.js", + }, + Object { + "code": "/* @flow */ +import { Viewer_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; +import type { Viewer_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +export const Viewer: Viewer_Resolvers = { + ...Viewer_defaultResolvers +}; +", + "force": false, + "path": "Viewer.js", + }, + Object { + "code": "/* @flow */ +import { User_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; +import type { User_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +export const User: User_Resolvers = { + ...User_defaultResolvers, + + location: (parent, args, ctx, info) => { + throw new Error(\\"Resolver not implemented\\"); + }, + paymentAccount: (parent, args, ctx, info) => { + throw new Error(\\"Resolver not implemented\\"); + }, + token: (parent, args, ctx, info) => { + throw new Error(\\"Resolver not implemented\\"); + } +}; +", + "force": false, + "path": "User.js", + }, + Object { + "code": "/* @flow */ +import { Booking_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; +import type { Booking_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +export const Booking: Booking_Resolvers = { + ...Booking_defaultResolvers +}; +", + "force": false, + "path": "Booking.js", + }, + Object { + "code": "/* @flow */ +import { Place_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; +import type { Place_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +export const Place: Place_Resolvers = { + ...Place_defaultResolvers +}; +", + "force": false, + "path": "Place.js", + }, + Object { + "code": "/* @flow */ +import { Amenities_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; +import type { Amenities_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +export const Amenities: Amenities_Resolvers = { + ...Amenities_defaultResolvers +}; +", + "force": false, + "path": "Amenities.js", + }, + Object { + "code": "/* @flow */ +import { Pricing_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; +import type { Pricing_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +export const Pricing: Pricing_Resolvers = { + ...Pricing_defaultResolvers +}; +", + "force": false, + "path": "Pricing.js", + }, + Object { + "code": "/* @flow */ +import { PlaceViews_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; +import type { PlaceViews_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +export const PlaceViews: PlaceViews_Resolvers = { + ...PlaceViews_defaultResolvers +}; +", + "force": false, + "path": "PlaceViews.js", + }, + Object { + "code": "/* @flow */ +import { GuestRequirements_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; +import type { GuestRequirements_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +export const GuestRequirements: GuestRequirements_Resolvers = { + ...GuestRequirements_defaultResolvers +}; +", + "force": false, + "path": "GuestRequirements.js", + }, + Object { + "code": "/* @flow */ +import { Policies_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; +import type { Policies_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +export const Policies: Policies_Resolvers = { + ...Policies_defaultResolvers +}; +", + "force": false, + "path": "Policies.js", + }, + Object { + "code": "/* @flow */ +import { HouseRules_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; +import type { HouseRules_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +export const HouseRules: HouseRules_Resolvers = { + ...HouseRules_defaultResolvers +}; +", + "force": false, + "path": "HouseRules.js", + }, + Object { + "code": "/* @flow */ +import { Payment_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; +import type { Payment_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +export const Payment: Payment_Resolvers = { + ...Payment_defaultResolvers +}; +", + "force": false, + "path": "Payment.js", + }, + Object { + "code": "/* @flow */ +import { PaymentAccount_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; +import type { PaymentAccount_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +export const PaymentAccount: PaymentAccount_Resolvers = { + ...PaymentAccount_defaultResolvers +}; +", + "force": false, + "path": "PaymentAccount.js", + }, + Object { + "code": "/* @flow */ +import { PaypalInformation_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; +import type { PaypalInformation_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +export const PaypalInformation: PaypalInformation_Resolvers = { + ...PaypalInformation_defaultResolvers +}; +", + "force": false, + "path": "PaypalInformation.js", + }, + Object { + "code": "/* @flow */ +import { CreditCardInformation_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; +import type { CreditCardInformation_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +export const CreditCardInformation: CreditCardInformation_Resolvers = { + ...CreditCardInformation_defaultResolvers +}; +", + "force": false, + "path": "CreditCardInformation.js", + }, + Object { + "code": "/* @flow */ +import { Notification_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; +import type { Notification_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +export const Notification: Notification_Resolvers = { + ...Notification_defaultResolvers +}; +", + "force": false, + "path": "Notification.js", + }, + Object { + "code": "/* @flow */ +import { Message_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; +import type { Message_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +export const Message: Message_Resolvers = { + ...Message_defaultResolvers +}; +", + "force": false, + "path": "Message.js", + }, + Object { + "code": "/* @flow */ +import { AuthPayload_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; +import type { AuthPayload_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +export const AuthPayload: AuthPayload_Resolvers = { + ...AuthPayload_defaultResolvers +}; +", + "force": false, + "path": "AuthPayload.js", + }, + Object { + "code": "/* @flow */ +import { MutationResult_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; +import type { MutationResult_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +export const MutationResult: MutationResult_Resolvers = { + ...MutationResult_defaultResolvers +}; +", + "force": false, + "path": "MutationResult.js", + }, + Object { + "code": "/* @flow */ +import type { Query_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +export const Query: Query_Resolvers = { + topExperiences: (parent, args, ctx, info) => { + throw new Error(\\"Resolver not implemented\\"); + }, + topHomes: (parent, args, ctx, info) => { + throw new Error(\\"Resolver not implemented\\"); + }, + homesInPriceRange: (parent, args, ctx, info) => { + throw new Error(\\"Resolver not implemented\\"); + }, + topReservations: (parent, args, ctx, info) => { + throw new Error(\\"Resolver not implemented\\"); + }, + featuredDestinations: (parent, args, ctx, info) => { + throw new Error(\\"Resolver not implemented\\"); + }, + experiencesByCity: (parent, args, ctx, info) => { + throw new Error(\\"Resolver not implemented\\"); + }, + viewer: (parent, args, ctx, info) => { + throw new Error(\\"Resolver not implemented\\"); + }, + myLocation: (parent, args, ctx, info) => { + throw new Error(\\"Resolver not implemented\\"); + } +}; +", + "force": false, + "path": "Query.js", + }, + Object { + "code": "/* @flow */ +import type { Mutation_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +export const Mutation: Mutation_Resolvers = { + signup: (parent, args, ctx, info) => { + throw new Error(\\"Resolver not implemented\\"); + }, + login: (parent, args, ctx, info) => { + throw new Error(\\"Resolver not implemented\\"); + }, + addPaymentMethod: (parent, args, ctx, info) => { + throw new Error(\\"Resolver not implemented\\"); + }, + book: (parent, args, ctx, info) => { + throw new Error(\\"Resolver not implemented\\"); + } +}; +", + "force": false, + "path": "Mutation.js", + }, + Object { + "code": "// @flow +// This resolver file was scaffolded by github.com/prisma/graphqlgen, DO NOT EDIT. +// Please do not import this file directly but copy & paste to your application code. + +import type { Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +import { Query } from \\"./Query\\"; +import { Experience } from \\"./Experience\\"; +import { ExperienceCategory } from \\"./ExperienceCategory\\"; +import { Location } from \\"./Location\\"; +import { Review } from \\"./Review\\"; +import { Picture } from \\"./Picture\\"; +import { Home } from \\"./Home\\"; +import { Reservation } from \\"./Reservation\\"; +import { Neighbourhood } from \\"./Neighbourhood\\"; +import { City } from \\"./City\\"; +import { ExperiencesByCity } from \\"./ExperiencesByCity\\"; +import { Viewer } from \\"./Viewer\\"; +import { User } from \\"./User\\"; +import { Booking } from \\"./Booking\\"; +import { Place } from \\"./Place\\"; +import { Amenities } from \\"./Amenities\\"; +import { Pricing } from \\"./Pricing\\"; +import { PlaceViews } from \\"./PlaceViews\\"; +import { GuestRequirements } from \\"./GuestRequirements\\"; +import { Policies } from \\"./Policies\\"; +import { HouseRules } from \\"./HouseRules\\"; +import { Payment } from \\"./Payment\\"; +import { PaymentAccount } from \\"./PaymentAccount\\"; +import { PaypalInformation } from \\"./PaypalInformation\\"; +import { CreditCardInformation } from \\"./CreditCardInformation\\"; +import { Notification } from \\"./Notification\\"; +import { Message } from \\"./Message\\"; +import { Mutation } from \\"./Mutation\\"; +import { AuthPayload } from \\"./AuthPayload\\"; +import { MutationResult } from \\"./MutationResult\\"; + +export const resolvers: Resolvers = { + Query, + Experience, + ExperienceCategory, + Location, + Review, + Picture, + Home, + Reservation, + Neighbourhood, + City, + ExperiencesByCity, + Viewer, + User, + Booking, + Place, + Amenities, + Pricing, + PlaceViews, + GuestRequirements, + Policies, + HouseRules, + Payment, + PaymentAccount, + PaypalInformation, + CreditCardInformation, + Notification, + Message, + Mutation, + AuthPayload, + MutationResult +}; +", + "force": false, + "path": "index.js", + }, +] +`; diff --git a/packages/graphqlgen/src/tests/flow/large-schema.test.ts b/packages/graphqlgen/src/tests/flow/large-schema.test.ts new file mode 100644 index 00000000..5b13bd7b --- /dev/null +++ b/packages/graphqlgen/src/tests/flow/large-schema.test.ts @@ -0,0 +1,22 @@ +import { testGeneration } from '../generation' +import { join } from 'path' + +const relative = (p: string) => join(__dirname, p) +const typesDir = relative('./generated-large/graphqlgen.js') +const resolversDir = relative('./generated-large/tmp-resolvers/') +const language = 'flow' + +test('large schema', async () => { + return testGeneration({ + language, + schema: relative('../fixtures/prisma/schema.graphql'), + models: { + files: [relative('../fixtures/prisma/flow-types.js')], + }, + output: typesDir, + ['resolver-scaffolding']: { + output: resolversDir, + layout: 'file-per-type', + }, + }) +}) From eedf6974e9f02ea30b11d377244fb46d1d38b795 Mon Sep 17 00:00:00 2001 From: Jason Kuhrt Date: Thu, 13 Dec 2018 21:07:09 -0500 Subject: [PATCH 08/35] debug: focus on tests that fail to start/finish on ci --- packages/graphqlgen/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/graphqlgen/package.json b/packages/graphqlgen/package.json index be805e36..20aebcd3 100644 --- a/packages/graphqlgen/package.json +++ b/packages/graphqlgen/package.json @@ -17,7 +17,7 @@ "build": "npm run lint && tsc --declaration", "watch": "tsc -w", "lint": "tslint --project tsconfig.json {src,test}/**/*.ts", - "t": "jest", + "t": "jest 'large-schema'", "test": "npm run lint && npm run t", "gen": "ts-node --files src/index.ts" }, From d8e5e97bfc749608ce847d6b9083a362207c096a Mon Sep 17 00:00:00 2001 From: Jason Kuhrt Date: Thu, 13 Dec 2018 21:17:25 -0500 Subject: [PATCH 09/35] debug: jest run in band --- packages/graphqlgen/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/graphqlgen/package.json b/packages/graphqlgen/package.json index 20aebcd3..8fc69c1f 100644 --- a/packages/graphqlgen/package.json +++ b/packages/graphqlgen/package.json @@ -17,7 +17,7 @@ "build": "npm run lint && tsc --declaration", "watch": "tsc -w", "lint": "tslint --project tsconfig.json {src,test}/**/*.ts", - "t": "jest 'large-schema'", + "t": "jest --runInBand", "test": "npm run lint && npm run t", "gen": "ts-node --files src/index.ts" }, From 0bb073202d3bf3815d5589fb3388d2942530302b Mon Sep 17 00:00:00 2001 From: Jason Kuhrt Date: Thu, 13 Dec 2018 21:24:55 -0500 Subject: [PATCH 10/35] debug: maybe there is disk contention --- packages/graphqlgen/package.json | 2 +- packages/graphqlgen/src/tests/generation.ts | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/graphqlgen/package.json b/packages/graphqlgen/package.json index 8fc69c1f..be805e36 100644 --- a/packages/graphqlgen/package.json +++ b/packages/graphqlgen/package.json @@ -17,7 +17,7 @@ "build": "npm run lint && tsc --declaration", "watch": "tsc -w", "lint": "tslint --project tsconfig.json {src,test}/**/*.ts", - "t": "jest --runInBand", + "t": "jest", "test": "npm run lint && npm run t", "gen": "ts-node --files src/index.ts" }, diff --git a/packages/graphqlgen/src/tests/generation.ts b/packages/graphqlgen/src/tests/generation.ts index e1d509fa..c2ac6720 100644 --- a/packages/graphqlgen/src/tests/generation.ts +++ b/packages/graphqlgen/src/tests/generation.ts @@ -143,7 +143,10 @@ export async function testGeneration(config: GraphQLGenDefinition) { config.output, ] - const compiledOutputDir = path.join(path.dirname(config.output), 'compiled') + const compiledOutputDir = path.join( + path.dirname(config.output), + String(Math.random()), + ) if (config.language === 'typescript') { compileTypescript(fileNames, compiledOutputDir) From 353b212b89026f2933ff59b55027c2a16a3597da Mon Sep 17 00:00:00 2001 From: Jason Kuhrt Date: Thu, 13 Dec 2018 21:31:34 -0500 Subject: [PATCH 11/35] debug: find minimal fix - do not compile --- packages/graphqlgen/src/tests/generation.ts | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/packages/graphqlgen/src/tests/generation.ts b/packages/graphqlgen/src/tests/generation.ts index c2ac6720..7429f21d 100644 --- a/packages/graphqlgen/src/tests/generation.ts +++ b/packages/graphqlgen/src/tests/generation.ts @@ -148,13 +148,18 @@ export async function testGeneration(config: GraphQLGenDefinition) { String(Math.random()), ) - if (config.language === 'typescript') { - compileTypescript(fileNames, compiledOutputDir) - } - - if (config.language === 'flow') { - await compileFlow(config.models.files!, config.output) - } + compiledOutputDir + fileNames + compileTypescript + compileFlow + + // if (config.language === 'typescript') { + // compileTypescript(fileNames, compiledOutputDir) + // } + + // if (config.language === 'flow') { + // await compileFlow(config.models.files!, config.output) + // } rimraf.sync(path.dirname(config.output)) } From 72d1c20b849dadf0b62b6eb9693226aed4fb575e Mon Sep 17 00:00:00 2001 From: Jason Kuhrt Date: Thu, 13 Dec 2018 21:33:34 -0500 Subject: [PATCH 12/35] debug: find minimal fix - do not compile flow --- packages/graphqlgen/src/tests/generation.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/graphqlgen/src/tests/generation.ts b/packages/graphqlgen/src/tests/generation.ts index 7429f21d..5e1e35e7 100644 --- a/packages/graphqlgen/src/tests/generation.ts +++ b/packages/graphqlgen/src/tests/generation.ts @@ -148,14 +148,11 @@ export async function testGeneration(config: GraphQLGenDefinition) { String(Math.random()), ) - compiledOutputDir - fileNames - compileTypescript compileFlow - // if (config.language === 'typescript') { - // compileTypescript(fileNames, compiledOutputDir) - // } + if (config.language === 'typescript') { + compileTypescript(fileNames, compiledOutputDir) + } // if (config.language === 'flow') { // await compileFlow(config.models.files!, config.output) From a17200f5c39ec70ee882270ea28cab752937218d Mon Sep 17 00:00:00 2001 From: Jason Kuhrt Date: Thu, 13 Dec 2018 21:35:10 -0500 Subject: [PATCH 13/35] debug: find minimal fix - do not compile ts --- packages/graphqlgen/src/tests/generation.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/packages/graphqlgen/src/tests/generation.ts b/packages/graphqlgen/src/tests/generation.ts index 5e1e35e7..ccc8bee6 100644 --- a/packages/graphqlgen/src/tests/generation.ts +++ b/packages/graphqlgen/src/tests/generation.ts @@ -148,15 +148,17 @@ export async function testGeneration(config: GraphQLGenDefinition) { String(Math.random()), ) - compileFlow + compileTypescript + compiledOutputDir + fileNames - if (config.language === 'typescript') { - compileTypescript(fileNames, compiledOutputDir) - } - - // if (config.language === 'flow') { - // await compileFlow(config.models.files!, config.output) + // if (config.language === 'typescript') { + // compileTypescript(fileNames, compiledOutputDir) // } + if (config.language === 'flow') { + await compileFlow(config.models.files!, config.output) + } + rimraf.sync(path.dirname(config.output)) } From 1a38f5eb32aad5eceac317669e1a45c49918d560 Mon Sep 17 00:00:00 2001 From: Jason Kuhrt Date: Thu, 13 Dec 2018 21:45:40 -0500 Subject: [PATCH 14/35] debug: will removing one flow test suite make it work? --- .../{basic.test.ts.snap => basic.ignore.ts.snap} | 0 .../src/tests/flow/{basic.test.ts => basic.ignore.ts} | 0 packages/graphqlgen/src/tests/generation.ts | 10 +++------- 3 files changed, 3 insertions(+), 7 deletions(-) rename packages/graphqlgen/src/tests/flow/__snapshots__/{basic.test.ts.snap => basic.ignore.ts.snap} (100%) rename packages/graphqlgen/src/tests/flow/{basic.test.ts => basic.ignore.ts} (100%) diff --git a/packages/graphqlgen/src/tests/flow/__snapshots__/basic.test.ts.snap b/packages/graphqlgen/src/tests/flow/__snapshots__/basic.ignore.ts.snap similarity index 100% rename from packages/graphqlgen/src/tests/flow/__snapshots__/basic.test.ts.snap rename to packages/graphqlgen/src/tests/flow/__snapshots__/basic.ignore.ts.snap diff --git a/packages/graphqlgen/src/tests/flow/basic.test.ts b/packages/graphqlgen/src/tests/flow/basic.ignore.ts similarity index 100% rename from packages/graphqlgen/src/tests/flow/basic.test.ts rename to packages/graphqlgen/src/tests/flow/basic.ignore.ts diff --git a/packages/graphqlgen/src/tests/generation.ts b/packages/graphqlgen/src/tests/generation.ts index ccc8bee6..c2ac6720 100644 --- a/packages/graphqlgen/src/tests/generation.ts +++ b/packages/graphqlgen/src/tests/generation.ts @@ -148,13 +148,9 @@ export async function testGeneration(config: GraphQLGenDefinition) { String(Math.random()), ) - compileTypescript - compiledOutputDir - fileNames - - // if (config.language === 'typescript') { - // compileTypescript(fileNames, compiledOutputDir) - // } + if (config.language === 'typescript') { + compileTypescript(fileNames, compiledOutputDir) + } if (config.language === 'flow') { await compileFlow(config.models.files!, config.output) From 1ac04be0a2ed8d94830c78446bdc97d38eb9556a Mon Sep 17 00:00:00 2001 From: Jason Kuhrt Date: Thu, 13 Dec 2018 22:23:42 -0500 Subject: [PATCH 15/35] fix: remove disk contention --- ...asic.ignore.ts.snap => basic.test.ts.snap} | 0 .../flow/{basic.ignore.ts => basic.test.ts} | 0 packages/graphqlgen/src/tests/generation.ts | 78 ++++++++++++------- 3 files changed, 49 insertions(+), 29 deletions(-) rename packages/graphqlgen/src/tests/flow/__snapshots__/{basic.ignore.ts.snap => basic.test.ts.snap} (100%) rename packages/graphqlgen/src/tests/flow/{basic.ignore.ts => basic.test.ts} (100%) diff --git a/packages/graphqlgen/src/tests/flow/__snapshots__/basic.ignore.ts.snap b/packages/graphqlgen/src/tests/flow/__snapshots__/basic.test.ts.snap similarity index 100% rename from packages/graphqlgen/src/tests/flow/__snapshots__/basic.ignore.ts.snap rename to packages/graphqlgen/src/tests/flow/__snapshots__/basic.test.ts.snap diff --git a/packages/graphqlgen/src/tests/flow/basic.ignore.ts b/packages/graphqlgen/src/tests/flow/basic.test.ts similarity index 100% rename from packages/graphqlgen/src/tests/flow/basic.ignore.ts rename to packages/graphqlgen/src/tests/flow/basic.test.ts diff --git a/packages/graphqlgen/src/tests/generation.ts b/packages/graphqlgen/src/tests/generation.ts index c2ac6720..71d76b09 100644 --- a/packages/graphqlgen/src/tests/generation.ts +++ b/packages/graphqlgen/src/tests/generation.ts @@ -11,6 +11,24 @@ import { validateConfig } from '../validation' import { generateCode, writeResolversScaffolding, writeTypes } from '../index' const flow = require('flow-bin') +const exec = (command: string, args: string[]): Promise => { + return new Promise((resolve, reject) => { + return execFile( + command, + args, + (err: any, stdout: string, stderr: string) => { + if (err) { + err.stderr = stderr + err.stdout = stdout + reject(err) + } else { + resolve(stdout) + } + }, + ) + }) +} + function printTypescriptErrors(diagnotics: ReadonlyArray) { diagnotics.forEach(diagnostic => { if (diagnostic.file) { @@ -67,38 +85,40 @@ ${includeFiles.map(file => getPath(file)).join(EOL)} [strict] ` - writeFileSync(path.join(path.dirname(typesPath), '.flowconfig'), flowConfig) - - const stdout = await new Promise(resolve => { - return execFile( - flow, - ['check', path.resolve(path.dirname(typesPath))], - (_err: any, stdout: string) => { - resolve(stdout) - }, - ) - }) + const flowConfigName = `.flowconfig-${Math.random()}` + const flowConfigPath = path.join(path.dirname(typesPath), flowConfigName) + + writeFileSync(flowConfigPath, flowConfig) + + try { + await exec(flow, [ + 'check', + '--flowconfig-name', + flowConfigName, + path.resolve(path.dirname(typesPath)), + ]) + } catch (error) { + const errorDelimiter = + 'Error ----------------------------------------------------------------' + // Do not take into account error from 'import type { GraphQLResolveInfo } from "graphql"' + const errors = (error.stdout as string) + .split(errorDelimiter) + .filter( + error => + error.length !== 0 && + !error.includes('Cannot resolve module `graphql`'), + ) - const errorDelimiter = - 'Error ----------------------------------------------------------------' - // Do not take into account error from 'import type { GraphQLResolveInfo } from "graphql"' - const errors = (stdout as string) - .split(errorDelimiter) - .filter( - error => - error.length !== 0 && - !error.includes('Cannot resolve module `graphql`'), - ) + if (errors.length > 0) { + console.log( + errors + .map(error => `${chalk.red(errorDelimiter) + EOL}${error}`) + .join(EOL), + ) + } - if (errors.length > 0) { - console.log( - errors - .map(error => `${chalk.red(errorDelimiter) + EOL}${error}`) - .join(EOL), - ) + expect(errors.length).toEqual(0) } - - expect(errors.length).toEqual(0) } export async function testGeneration(config: GraphQLGenDefinition) { From b35ba9fbbdf0c7a5ad8b1cb98d2e9e0f749064ac Mon Sep 17 00:00:00 2001 From: Jason Kuhrt Date: Thu, 13 Dec 2018 23:13:14 -0500 Subject: [PATCH 16/35] fix: sub-class error correctly --- packages/graphqlgen/src/tests/generation.ts | 58 ++++++++++++--------- 1 file changed, 33 insertions(+), 25 deletions(-) diff --git a/packages/graphqlgen/src/tests/generation.ts b/packages/graphqlgen/src/tests/generation.ts index 71d76b09..63bba733 100644 --- a/packages/graphqlgen/src/tests/generation.ts +++ b/packages/graphqlgen/src/tests/generation.ts @@ -11,21 +11,28 @@ import { validateConfig } from '../validation' import { generateCode, writeResolversScaffolding, writeTypes } from '../index' const flow = require('flow-bin') -const exec = (command: string, args: string[]): Promise => { - return new Promise((resolve, reject) => { - return execFile( - command, - args, - (err: any, stdout: string, stderr: string) => { - if (err) { - err.stderr = stderr - err.stdout = stdout - reject(err) - } else { - resolve(stdout) - } - }, - ) +class ExecError extends Error { + constructor( + public message: string, + public stdout: string, + public stderr: string, + ) { + super(message) + // restore prototype chain + const actualProto = new.target.prototype + Object.setPrototypeOf(this, actualProto) + } +} + +const exec = (command: string, args: string[]): Promise => { + return new Promise(resolve => { + return execFile(command, args, (err, stdout, stderr) => { + if (err) { + resolve(new ExecError(err.message, stdout, stderr)) + } else { + resolve(stdout) + } + }) }) } @@ -90,19 +97,20 @@ ${includeFiles.map(file => getPath(file)).join(EOL)} writeFileSync(flowConfigPath, flowConfig) - try { - await exec(flow, [ - 'check', - '--flowconfig-name', - flowConfigName, - path.resolve(path.dirname(typesPath)), - ]) - } catch (error) { + const result = await exec(flow, [ + 'check', + '--flowconfig-name', + flowConfigName, + path.resolve(path.dirname(typesPath)), + ]) + + if (result instanceof ExecError) { const errorDelimiter = 'Error ----------------------------------------------------------------' - // Do not take into account error from 'import type { GraphQLResolveInfo } from "graphql"' - const errors = (error.stdout as string) + + const errors = result.stdout .split(errorDelimiter) + // Do not take into account error from 'import type { GraphQLResolveInfo } from "graphql"' .filter( error => error.length !== 0 && From bc465117dc42f8dfaa5ad4ccfe6f8533ea77b69d Mon Sep 17 00:00:00 2001 From: Jason Kuhrt Date: Thu, 13 Dec 2018 23:17:20 -0500 Subject: [PATCH 17/35] debug: is issue specific to flow basic? --- .../{large-schema.test.ts.snap => large-schema.ignore.ts.snap} | 0 .../tests/flow/{large-schema.test.ts => large-schema.ignore.ts} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename packages/graphqlgen/src/tests/flow/__snapshots__/{large-schema.test.ts.snap => large-schema.ignore.ts.snap} (100%) rename packages/graphqlgen/src/tests/flow/{large-schema.test.ts => large-schema.ignore.ts} (100%) diff --git a/packages/graphqlgen/src/tests/flow/__snapshots__/large-schema.test.ts.snap b/packages/graphqlgen/src/tests/flow/__snapshots__/large-schema.ignore.ts.snap similarity index 100% rename from packages/graphqlgen/src/tests/flow/__snapshots__/large-schema.test.ts.snap rename to packages/graphqlgen/src/tests/flow/__snapshots__/large-schema.ignore.ts.snap diff --git a/packages/graphqlgen/src/tests/flow/large-schema.test.ts b/packages/graphqlgen/src/tests/flow/large-schema.ignore.ts similarity index 100% rename from packages/graphqlgen/src/tests/flow/large-schema.test.ts rename to packages/graphqlgen/src/tests/flow/large-schema.ignore.ts From 6e82d04a71d920587fd37d79d1f27e8c030d74cb Mon Sep 17 00:00:00 2001 From: Jason Kuhrt Date: Thu, 13 Dec 2018 23:22:04 -0500 Subject: [PATCH 18/35] debug: only one basic test --- .../flow/__snapshots__/basic.test.ts.snap | 894 ------------------ ...nore.ts.snap => large-schema.test.ts.snap} | 0 .../graphqlgen/src/tests/flow/basic.test.ts | 162 ++-- ...-schema.ignore.ts => large-schema.test.ts} | 0 4 files changed, 81 insertions(+), 975 deletions(-) rename packages/graphqlgen/src/tests/flow/__snapshots__/{large-schema.ignore.ts.snap => large-schema.test.ts.snap} (100%) rename packages/graphqlgen/src/tests/flow/{large-schema.ignore.ts => large-schema.test.ts} (100%) diff --git a/packages/graphqlgen/src/tests/flow/__snapshots__/basic.test.ts.snap b/packages/graphqlgen/src/tests/flow/__snapshots__/basic.test.ts.snap index 5fdefa5a..e2c414c9 100644 --- a/packages/graphqlgen/src/tests/flow/__snapshots__/basic.test.ts.snap +++ b/packages/graphqlgen/src/tests/flow/__snapshots__/basic.test.ts.snap @@ -1,164 +1,5 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`basic enum 1`] = ` -"/* @flow */ -// Code generated by github.com/prisma/graphqlgen, DO NOT EDIT. - -import type { GraphQLResolveInfo } from \\"graphql\\"; -import type { User } from \\"../../fixtures/enum/types-flow\\"; -type Context = any; - -type EnumAnnotation = \\"EDITOR\\" | \\"COLLABORATOR\\"; -type EnumAsUnionType = \\"RED\\" | \\"GREEN\\" | \\"BLUE\\"; - -// Types for Query -export const Query_defaultResolvers = {}; - -export interface Query_Args_CreateUser { - name: string; - type: EnumAnnotation; -} - -export type Query_CreateUser_Resolver = ( - parent: {}, - args: Query_Args_CreateUser, - ctx: Context, - info: GraphQLResolveInfo -) => User | null | Promise; - -export interface Query_Resolvers { - createUser: ( - parent: {}, - args: Query_Args_CreateUser, - ctx: Context, - info: GraphQLResolveInfo - ) => User | null | Promise; -} - -// Types for User -export const User_defaultResolvers = { - id: (parent: User) => parent.id, - name: (parent: User) => parent.name, - enumAsUnionType: (parent: User) => parent.enumAsUnionType -}; - -export type User_Id_Resolver = ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type User_Name_Resolver = ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type User_EnumAnnotation_Resolver = ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => EnumAnnotation | Promise; - -export type User_EnumAsUnionType_Resolver = ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => EnumAsUnionType | Promise; - -export interface User_Resolvers { - id: ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - name: ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - enumAnnotation: ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => EnumAnnotation | Promise; - - enumAsUnionType: ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => EnumAsUnionType | Promise; -} - -export interface Resolvers { - Query: Query_Resolvers; - User: User_Resolvers; -} -" -`; - -exports[`basic enum 2`] = ` -Array [ - Object { - "code": "/* @flow */ -import { User_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; -import type { User_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -export const User: User_Resolvers = { - ...User_defaultResolvers, - - enumAnnotation: (parent, args, ctx, info) => { - throw new Error(\\"Resolver not implemented\\"); - } -}; -", - "force": false, - "path": "User.js", - }, - Object { - "code": "/* @flow */ -import type { Query_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -export const Query: Query_Resolvers = { - createUser: (parent, args, ctx, info) => { - throw new Error(\\"Resolver not implemented\\"); - } -}; -", - "force": false, - "path": "Query.js", - }, - Object { - "code": "// @flow -// This resolver file was scaffolded by github.com/prisma/graphqlgen, DO NOT EDIT. -// Please do not import this file directly but copy & paste to your application code. - -import type { Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -import { Query } from \\"./Query\\"; -import { User } from \\"./User\\"; - -export const resolvers: Resolvers = { - Query, - User -}; -", - "force": false, - "path": "index.js", - }, -] -`; - exports[`basic schema 1`] = ` "/* @flow */ // Code generated by github.com/prisma/graphqlgen, DO NOT EDIT. @@ -496,738 +337,3 @@ export const resolvers: Resolvers = { }, ] `; - -exports[`basic union 1`] = ` -"/* @flow */ -// Code generated by github.com/prisma/graphqlgen, DO NOT EDIT. - -import type { GraphQLResolveInfo } from \\"graphql\\"; -import type { User, Student, Professor } from \\"../../fixtures/union/flow-types\\"; -type Context = any; - -// Types for User -export const User_defaultResolvers = { - id: (parent: User) => parent.id, - name: (parent: User) => parent.name -}; - -export type User_Id_Resolver = ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type User_Name_Resolver = ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type User_Type_Resolver = ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => {} | Promise<{}>; - -export interface User_Resolvers { - id: ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - name: ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - type: ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => {} | Promise<{}>; -} - -// Types for Student -export const Student_defaultResolvers = { - age: (parent: Student) => parent.age -}; - -export type Student_Age_Resolver = ( - parent: Student, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => number | Promise; - -export interface Student_Resolvers { - age: ( - parent: Student, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => number | Promise; -} - -// Types for Professor -export const Professor_defaultResolvers = { - degree: (parent: Professor) => parent.degree -}; - -export type Professor_Degree_Resolver = ( - parent: Professor, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | null | Promise; - -export interface Professor_Resolvers { - degree: ( - parent: Professor, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | null | Promise; -} - -export interface Resolvers { - User: User_Resolvers; - Student: Student_Resolvers; - Professor: Professor_Resolvers; -} -" -`; - -exports[`basic union 2`] = ` -Array [ - Object { - "code": "/* @flow */ -import { User_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; -import type { User_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -export const User: User_Resolvers = { - ...User_defaultResolvers, - - type: (parent, args, ctx, info) => { - throw new Error(\\"Resolver not implemented\\"); - } -}; -", - "force": false, - "path": "User.js", - }, - Object { - "code": "/* @flow */ -import { Student_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; -import type { Student_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -export const Student: Student_Resolvers = { - ...Student_defaultResolvers -}; -", - "force": false, - "path": "Student.js", - }, - Object { - "code": "/* @flow */ -import { Professor_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; -import type { Professor_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -export const Professor: Professor_Resolvers = { - ...Professor_defaultResolvers -}; -", - "force": false, - "path": "Professor.js", - }, - Object { - "code": "// @flow -// This resolver file was scaffolded by github.com/prisma/graphqlgen, DO NOT EDIT. -// Please do not import this file directly but copy & paste to your application code. - -import type { Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -import { User } from \\"./User\\"; -import { Student } from \\"./Student\\"; -import { Professor } from \\"./Professor\\"; - -export const resolvers: Resolvers = { - User, - Student, - Professor -}; -", - "force": false, - "path": "index.js", - }, -] -`; - -exports[`context 1`] = ` -"/* @flow */ -// Code generated by github.com/prisma/graphqlgen, DO NOT EDIT. - -import type { GraphQLResolveInfo } from \\"graphql\\"; -import type { User } from \\"../../fixtures/context/flow-types\\"; -import type { Context } from \\"../../fixtures/context/flow-types\\"; - -// Types for Query -export const Query_defaultResolvers = {}; - -export type Query_CreateUser_Resolver = ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => User | null | Promise; - -export interface Query_Resolvers { - createUser: ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => User | null | Promise; -} - -// Types for User -export const User_defaultResolvers = { - id: (parent: User) => parent.id -}; - -export type User_Id_Resolver = ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export interface User_Resolvers { - id: ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; -} - -export interface Resolvers { - Query: Query_Resolvers; - User: User_Resolvers; -} -" -`; - -exports[`context 2`] = ` -Array [ - Object { - "code": "/* @flow */ -import { User_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; -import type { User_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -export const User: User_Resolvers = { - ...User_defaultResolvers -}; -", - "force": false, - "path": "User.js", - }, - Object { - "code": "/* @flow */ -import type { Query_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -export const Query: Query_Resolvers = { - createUser: (parent, args, ctx, info) => { - throw new Error(\\"Resolver not implemented\\"); - } -}; -", - "force": false, - "path": "Query.js", - }, - Object { - "code": "// @flow -// This resolver file was scaffolded by github.com/prisma/graphqlgen, DO NOT EDIT. -// Please do not import this file directly but copy & paste to your application code. - -import type { Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -import { Query } from \\"./Query\\"; -import { User } from \\"./User\\"; - -export const resolvers: Resolvers = { - Query, - User -}; -", - "force": false, - "path": "index.js", - }, -] -`; - -exports[`defaultName 1`] = ` -"/* @flow */ -// Code generated by github.com/prisma/graphqlgen, DO NOT EDIT. - -import type { GraphQLResolveInfo } from \\"graphql\\"; -import type { NumberNode } from \\"../../fixtures/defaultName/flow-types\\"; -type Context = any; - -// Types for Query -export const Query_defaultResolvers = {}; - -export interface Query_Args_Custom_with_arg { - id: number; -} - -export interface Query_Args_Custom_with_custom_arg { - id: NumberNode; -} - -export interface Query_Args_Scalar_with_arg { - id: number; -} - -export interface Query_Args_Scalar_with_custom_arg { - id: NumberNode; -} - -export type Query_Id_Resolver = ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export type Query_Custom_required_Resolver = ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => NumberNode | Promise; - -export type Query_Custom_nullable_Resolver = ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => NumberNode | null | Promise; - -export type Query_Custom_array_nullable_Resolver = ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => NumberNode[] | null | Promise; - -export type Query_Custom_array_required_Resolver = ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => NumberNode[] | Promise; - -export type Query_Custom_with_arg_Resolver = ( - parent: {}, - args: Query_Args_Custom_with_arg, - ctx: Context, - info: GraphQLResolveInfo -) => NumberNode | Promise; - -export type Query_Custom_with_custom_arg_Resolver = ( - parent: {}, - args: Query_Args_Custom_with_custom_arg, - ctx: Context, - info: GraphQLResolveInfo -) => NumberNode | Promise; - -export type Query_Scalar_required_Resolver = ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => boolean | Promise; - -export type Query_Scalar_nullable_Resolver = ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => boolean | null | Promise; - -export type Query_Scalar_array_nullable_Resolver = ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => boolean[] | null | Promise; - -export type Query_Scalar_array_required_Resolver = ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => boolean[] | Promise; - -export type Query_Scalar_with_arg_Resolver = ( - parent: {}, - args: Query_Args_Scalar_with_arg, - ctx: Context, - info: GraphQLResolveInfo -) => boolean | Promise; - -export type Query_Scalar_with_custom_arg_Resolver = ( - parent: {}, - args: Query_Args_Scalar_with_custom_arg, - ctx: Context, - info: GraphQLResolveInfo -) => boolean | Promise; - -export interface Query_Resolvers { - id: ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; - - custom_required: ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => NumberNode | Promise; - - custom_nullable: ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => NumberNode | null | Promise; - - custom_array_nullable: ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => NumberNode[] | null | Promise; - - custom_array_required: ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => NumberNode[] | Promise; - - custom_with_arg: ( - parent: {}, - args: Query_Args_Custom_with_arg, - ctx: Context, - info: GraphQLResolveInfo - ) => NumberNode | Promise; - - custom_with_custom_arg: ( - parent: {}, - args: Query_Args_Custom_with_custom_arg, - ctx: Context, - info: GraphQLResolveInfo - ) => NumberNode | Promise; - - scalar_required: ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean | Promise; - - scalar_nullable: ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean | null | Promise; - - scalar_array_nullable: ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean[] | null | Promise; - - scalar_array_required: ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean[] | Promise; - - scalar_with_arg: ( - parent: {}, - args: Query_Args_Scalar_with_arg, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean | Promise; - - scalar_with_custom_arg: ( - parent: {}, - args: Query_Args_Scalar_with_custom_arg, - ctx: Context, - info: GraphQLResolveInfo - ) => boolean | Promise; -} - -// Types for Number -export const Number_defaultResolvers = { - id: (parent: NumberNode) => parent.id, - value: (parent: NumberNode) => parent.value -}; - -export type Number_Id_Resolver = ( - parent: NumberNode, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | null | Promise; - -export type Number_Value_Resolver = ( - parent: NumberNode, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => number | null | Promise; - -export interface Number_Resolvers { - id: ( - parent: NumberNode, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | null | Promise; - - value: ( - parent: NumberNode, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => number | null | Promise; -} - -export interface Resolvers { - Query: Query_Resolvers; - Number: Number_Resolvers; -} -" -`; - -exports[`defaultName 2`] = ` -Array [ - Object { - "code": "/* @flow */ -import { Number_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; -import type { Number_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -export const Number: Number_Resolvers = { - ...Number_defaultResolvers -}; -", - "force": false, - "path": "Number.js", - }, - Object { - "code": "/* @flow */ -import type { Query_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -export const Query: Query_Resolvers = { - id: (parent, args, ctx, info) => { - throw new Error(\\"Resolver not implemented\\"); - }, - custom_required: (parent, args, ctx, info) => { - throw new Error(\\"Resolver not implemented\\"); - }, - custom_nullable: (parent, args, ctx, info) => { - throw new Error(\\"Resolver not implemented\\"); - }, - custom_array_nullable: (parent, args, ctx, info) => { - throw new Error(\\"Resolver not implemented\\"); - }, - custom_array_required: (parent, args, ctx, info) => { - throw new Error(\\"Resolver not implemented\\"); - }, - custom_with_arg: (parent, args, ctx, info) => { - throw new Error(\\"Resolver not implemented\\"); - }, - custom_with_custom_arg: (parent, args, ctx, info) => { - throw new Error(\\"Resolver not implemented\\"); - }, - scalar_required: (parent, args, ctx, info) => { - throw new Error(\\"Resolver not implemented\\"); - }, - scalar_nullable: (parent, args, ctx, info) => { - throw new Error(\\"Resolver not implemented\\"); - }, - scalar_array_nullable: (parent, args, ctx, info) => { - throw new Error(\\"Resolver not implemented\\"); - }, - scalar_array_required: (parent, args, ctx, info) => { - throw new Error(\\"Resolver not implemented\\"); - }, - scalar_with_arg: (parent, args, ctx, info) => { - throw new Error(\\"Resolver not implemented\\"); - }, - scalar_with_custom_arg: (parent, args, ctx, info) => { - throw new Error(\\"Resolver not implemented\\"); - } -}; -", - "force": false, - "path": "Query.js", - }, - Object { - "code": "// @flow -// This resolver file was scaffolded by github.com/prisma/graphqlgen, DO NOT EDIT. -// Please do not import this file directly but copy & paste to your application code. - -import type { Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -import { Query } from \\"./Query\\"; -import { Number } from \\"./Number\\"; - -export const resolvers: Resolvers = { - Query, - Number -}; -", - "force": false, - "path": "index.js", - }, -] -`; - -exports[`subscription 1`] = ` -"/* @flow */ -// Code generated by github.com/prisma/graphqlgen, DO NOT EDIT. - -import type { GraphQLResolveInfo } from \\"graphql\\"; -import type { User } from \\"../../fixtures/subscription/flow-types\\"; -type Context = any; - -// Types for Subscription -export const Subscription_defaultResolvers = {}; - -export type Subscription_SubscribeToUser_Resolver = {| - subscribe: ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => AsyncIterator | Promise>, - resolve?: ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => User | Promise -|}; - -export interface Subscription_Resolvers { - subscribeToUser: {| - subscribe: ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => AsyncIterator | Promise>, - resolve?: ( - parent: {}, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => User | Promise - |}; -} - -// Types for User -export const User_defaultResolvers = { - name: (parent: User) => parent.name -}; - -export type User_Name_Resolver = ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | Promise; - -export interface User_Resolvers { - name: ( - parent: User, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | Promise; -} - -export interface Resolvers { - Subscription: Subscription_Resolvers; - User: User_Resolvers; -} -" -`; - -exports[`subscription 2`] = ` -Array [ - Object { - "code": "/* @flow */ -import { User_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; -import type { User_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -export const User: User_Resolvers = { - ...User_defaultResolvers -}; -", - "force": false, - "path": "User.js", - }, - Object { - "code": "/* @flow */ -import type { Subscription_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -export const Subscription: Subscription_Resolvers = { - subscribeToUser: { - subscribe: (parent, args, ctx, info) => { - throw new Error(\\"Resolver not implemented\\"); - } - } -}; -", - "force": false, - "path": "Subscription.js", - }, - Object { - "code": "// @flow -// This resolver file was scaffolded by github.com/prisma/graphqlgen, DO NOT EDIT. -// Please do not import this file directly but copy & paste to your application code. - -import type { Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -import { Subscription } from \\"./Subscription\\"; -import { User } from \\"./User\\"; - -export const resolvers: Resolvers = { - Subscription, - User -}; -", - "force": false, - "path": "index.js", - }, -] -`; diff --git a/packages/graphqlgen/src/tests/flow/__snapshots__/large-schema.ignore.ts.snap b/packages/graphqlgen/src/tests/flow/__snapshots__/large-schema.test.ts.snap similarity index 100% rename from packages/graphqlgen/src/tests/flow/__snapshots__/large-schema.ignore.ts.snap rename to packages/graphqlgen/src/tests/flow/__snapshots__/large-schema.test.ts.snap diff --git a/packages/graphqlgen/src/tests/flow/basic.test.ts b/packages/graphqlgen/src/tests/flow/basic.test.ts index f4ee0afd..2b335d55 100644 --- a/packages/graphqlgen/src/tests/flow/basic.test.ts +++ b/packages/graphqlgen/src/tests/flow/basic.test.ts @@ -21,63 +21,47 @@ test('basic schema', async () => { }) }) -test('basic enum', async () => { - return testGeneration({ - language, - schema: relative('../fixtures/enum/schema.graphql'), - models: { - files: [relative('../fixtures/enum/types-flow.js')], - }, - output: typesPath, - ['resolver-scaffolding']: { - output: resolversDir, - layout: 'file-per-type', - }, - }) -}) - -test('basic union', async () => { - return testGeneration({ - language, - schema: relative('../fixtures/union/schema.graphql'), - models: { - files: [relative('../fixtures/union/flow-types.js')], - }, - output: typesPath, - ['resolver-scaffolding']: { - output: resolversDir, - layout: 'file-per-type', - }, - }) -}) +// test('basic enum', async () => { +// return testGeneration({ +// language, +// schema: relative('../fixtures/enum/schema.graphql'), +// models: { +// files: [relative('../fixtures/enum/types-flow.js')], +// }, +// output: typesPath, +// ['resolver-scaffolding']: { +// output: resolversDir, +// layout: 'file-per-type', +// }, +// }) +// }) -test('defaultName', async () => { - return testGeneration({ - language, - schema: relative('../fixtures/defaultName/schema.graphql'), - models: { - files: [ - { - path: relative('../fixtures/defaultName/flow-types.js'), - defaultName: '${typeName}Node', - }, - ], - }, - output: typesPath, - ['resolver-scaffolding']: { - output: resolversDir, - layout: 'file-per-type', - }, - }) -}) +// test('basic union', async () => { +// return testGeneration({ +// language, +// schema: relative('../fixtures/union/schema.graphql'), +// models: { +// files: [relative('../fixtures/union/flow-types.js')], +// }, +// output: typesPath, +// ['resolver-scaffolding']: { +// output: resolversDir, +// layout: 'file-per-type', +// }, +// }) +// }) -//TODO: Fix this test (detected since compiling flow) -// test('basic scalar', async () => { +// test('defaultName', async () => { // return testGeneration({ // language, -// schema: relative('../fixtures/scalar/schema.graphql'), +// schema: relative('../fixtures/defaultName/schema.graphql'), // models: { -// files: [relative('../fixtures/scalar/flow-types.js')], +// files: [ +// { +// path: relative('../fixtures/defaultName/flow-types.js'), +// defaultName: '${typeName}Node', +// }, +// ], // }, // output: typesPath, // ['resolver-scaffolding']: { @@ -87,33 +71,49 @@ test('defaultName', async () => { // }) // }) -test('context', async () => { - return testGeneration({ - language, - schema: relative('../fixtures/context/schema.graphql'), - context: relative('../fixtures/context/flow-types.js:Context'), - models: { - files: [relative('../fixtures/context/flow-types.js')], - }, - output: typesPath, - ['resolver-scaffolding']: { - output: resolversDir, - layout: 'file-per-type', - }, - }) -}) +// //TODO: Fix this test (detected since compiling flow) +// // test('basic scalar', async () => { +// // return testGeneration({ +// // language, +// // schema: relative('../fixtures/scalar/schema.graphql'), +// // models: { +// // files: [relative('../fixtures/scalar/flow-types.js')], +// // }, +// // output: typesPath, +// // ['resolver-scaffolding']: { +// // output: resolversDir, +// // layout: 'file-per-type', +// // }, +// // }) +// // }) -test('subscription', () => { - return testGeneration({ - language, - schema: relative('../fixtures/subscription/schema.graphql'), - models: { - files: [relative('../fixtures/subscription/flow-types.js')], - }, - output: typesPath, - ['resolver-scaffolding']: { - output: resolversDir, - layout: 'file-per-type', - }, - }) -}) +// test('context', async () => { +// return testGeneration({ +// language, +// schema: relative('../fixtures/context/schema.graphql'), +// context: relative('../fixtures/context/flow-types.js:Context'), +// models: { +// files: [relative('../fixtures/context/flow-types.js')], +// }, +// output: typesPath, +// ['resolver-scaffolding']: { +// output: resolversDir, +// layout: 'file-per-type', +// }, +// }) +// }) + +// test('subscription', () => { +// return testGeneration({ +// language, +// schema: relative('../fixtures/subscription/schema.graphql'), +// models: { +// files: [relative('../fixtures/subscription/flow-types.js')], +// }, +// output: typesPath, +// ['resolver-scaffolding']: { +// output: resolversDir, +// layout: 'file-per-type', +// }, +// }) +// }) diff --git a/packages/graphqlgen/src/tests/flow/large-schema.ignore.ts b/packages/graphqlgen/src/tests/flow/large-schema.test.ts similarity index 100% rename from packages/graphqlgen/src/tests/flow/large-schema.ignore.ts rename to packages/graphqlgen/src/tests/flow/large-schema.test.ts From 310904bc7d7640f63b9f1fe27af7f28f56acd75f Mon Sep 17 00:00:00 2001 From: Jason Kuhrt Date: Thu, 13 Dec 2018 23:27:34 -0500 Subject: [PATCH 19/35] debug: logs --- packages/graphqlgen/src/tests/generation.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/graphqlgen/src/tests/generation.ts b/packages/graphqlgen/src/tests/generation.ts index 63bba733..d638e168 100644 --- a/packages/graphqlgen/src/tests/generation.ts +++ b/packages/graphqlgen/src/tests/generation.ts @@ -59,6 +59,7 @@ function printTypescriptErrors(diagnotics: ReadonlyArray) { } function compileTypescript(fileNames: string[], compiledOutputDir: string) { + console.log('compileTypescript') const errors = ts .createProgram(fileNames, { sourceMap: false, @@ -77,6 +78,7 @@ function compileTypescript(fileNames: string[], compiledOutputDir: string) { } async function compileFlow(includeFiles: File[], typesPath: string) { + console.log('compileFlow') const flowConfig = ` [ignore] From 4c9e85d04c297483d1a6faa031cc1182a8e65f58 Mon Sep 17 00:00:00 2001 From: Jason Kuhrt Date: Thu, 13 Dec 2018 23:39:13 -0500 Subject: [PATCH 20/35] debug: logs --- .../flow/__snapshots__/basic.test.ts.snap | 894 ++++++++++++++++++ .../graphqlgen/src/tests/flow/basic.test.ts | 162 ++-- packages/graphqlgen/src/tests/generation.ts | 4 + 3 files changed, 979 insertions(+), 81 deletions(-) diff --git a/packages/graphqlgen/src/tests/flow/__snapshots__/basic.test.ts.snap b/packages/graphqlgen/src/tests/flow/__snapshots__/basic.test.ts.snap index e2c414c9..5fdefa5a 100644 --- a/packages/graphqlgen/src/tests/flow/__snapshots__/basic.test.ts.snap +++ b/packages/graphqlgen/src/tests/flow/__snapshots__/basic.test.ts.snap @@ -1,5 +1,164 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`basic enum 1`] = ` +"/* @flow */ +// Code generated by github.com/prisma/graphqlgen, DO NOT EDIT. + +import type { GraphQLResolveInfo } from \\"graphql\\"; +import type { User } from \\"../../fixtures/enum/types-flow\\"; +type Context = any; + +type EnumAnnotation = \\"EDITOR\\" | \\"COLLABORATOR\\"; +type EnumAsUnionType = \\"RED\\" | \\"GREEN\\" | \\"BLUE\\"; + +// Types for Query +export const Query_defaultResolvers = {}; + +export interface Query_Args_CreateUser { + name: string; + type: EnumAnnotation; +} + +export type Query_CreateUser_Resolver = ( + parent: {}, + args: Query_Args_CreateUser, + ctx: Context, + info: GraphQLResolveInfo +) => User | null | Promise; + +export interface Query_Resolvers { + createUser: ( + parent: {}, + args: Query_Args_CreateUser, + ctx: Context, + info: GraphQLResolveInfo + ) => User | null | Promise; +} + +// Types for User +export const User_defaultResolvers = { + id: (parent: User) => parent.id, + name: (parent: User) => parent.name, + enumAsUnionType: (parent: User) => parent.enumAsUnionType +}; + +export type User_Id_Resolver = ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type User_Name_Resolver = ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type User_EnumAnnotation_Resolver = ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => EnumAnnotation | Promise; + +export type User_EnumAsUnionType_Resolver = ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => EnumAsUnionType | Promise; + +export interface User_Resolvers { + id: ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + name: ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + enumAnnotation: ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => EnumAnnotation | Promise; + + enumAsUnionType: ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => EnumAsUnionType | Promise; +} + +export interface Resolvers { + Query: Query_Resolvers; + User: User_Resolvers; +} +" +`; + +exports[`basic enum 2`] = ` +Array [ + Object { + "code": "/* @flow */ +import { User_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; +import type { User_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +export const User: User_Resolvers = { + ...User_defaultResolvers, + + enumAnnotation: (parent, args, ctx, info) => { + throw new Error(\\"Resolver not implemented\\"); + } +}; +", + "force": false, + "path": "User.js", + }, + Object { + "code": "/* @flow */ +import type { Query_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +export const Query: Query_Resolvers = { + createUser: (parent, args, ctx, info) => { + throw new Error(\\"Resolver not implemented\\"); + } +}; +", + "force": false, + "path": "Query.js", + }, + Object { + "code": "// @flow +// This resolver file was scaffolded by github.com/prisma/graphqlgen, DO NOT EDIT. +// Please do not import this file directly but copy & paste to your application code. + +import type { Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +import { Query } from \\"./Query\\"; +import { User } from \\"./User\\"; + +export const resolvers: Resolvers = { + Query, + User +}; +", + "force": false, + "path": "index.js", + }, +] +`; + exports[`basic schema 1`] = ` "/* @flow */ // Code generated by github.com/prisma/graphqlgen, DO NOT EDIT. @@ -337,3 +496,738 @@ export const resolvers: Resolvers = { }, ] `; + +exports[`basic union 1`] = ` +"/* @flow */ +// Code generated by github.com/prisma/graphqlgen, DO NOT EDIT. + +import type { GraphQLResolveInfo } from \\"graphql\\"; +import type { User, Student, Professor } from \\"../../fixtures/union/flow-types\\"; +type Context = any; + +// Types for User +export const User_defaultResolvers = { + id: (parent: User) => parent.id, + name: (parent: User) => parent.name +}; + +export type User_Id_Resolver = ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type User_Name_Resolver = ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type User_Type_Resolver = ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => {} | Promise<{}>; + +export interface User_Resolvers { + id: ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + name: ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + type: ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => {} | Promise<{}>; +} + +// Types for Student +export const Student_defaultResolvers = { + age: (parent: Student) => parent.age +}; + +export type Student_Age_Resolver = ( + parent: Student, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => number | Promise; + +export interface Student_Resolvers { + age: ( + parent: Student, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => number | Promise; +} + +// Types for Professor +export const Professor_defaultResolvers = { + degree: (parent: Professor) => parent.degree +}; + +export type Professor_Degree_Resolver = ( + parent: Professor, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | null | Promise; + +export interface Professor_Resolvers { + degree: ( + parent: Professor, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | null | Promise; +} + +export interface Resolvers { + User: User_Resolvers; + Student: Student_Resolvers; + Professor: Professor_Resolvers; +} +" +`; + +exports[`basic union 2`] = ` +Array [ + Object { + "code": "/* @flow */ +import { User_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; +import type { User_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +export const User: User_Resolvers = { + ...User_defaultResolvers, + + type: (parent, args, ctx, info) => { + throw new Error(\\"Resolver not implemented\\"); + } +}; +", + "force": false, + "path": "User.js", + }, + Object { + "code": "/* @flow */ +import { Student_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; +import type { Student_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +export const Student: Student_Resolvers = { + ...Student_defaultResolvers +}; +", + "force": false, + "path": "Student.js", + }, + Object { + "code": "/* @flow */ +import { Professor_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; +import type { Professor_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +export const Professor: Professor_Resolvers = { + ...Professor_defaultResolvers +}; +", + "force": false, + "path": "Professor.js", + }, + Object { + "code": "// @flow +// This resolver file was scaffolded by github.com/prisma/graphqlgen, DO NOT EDIT. +// Please do not import this file directly but copy & paste to your application code. + +import type { Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +import { User } from \\"./User\\"; +import { Student } from \\"./Student\\"; +import { Professor } from \\"./Professor\\"; + +export const resolvers: Resolvers = { + User, + Student, + Professor +}; +", + "force": false, + "path": "index.js", + }, +] +`; + +exports[`context 1`] = ` +"/* @flow */ +// Code generated by github.com/prisma/graphqlgen, DO NOT EDIT. + +import type { GraphQLResolveInfo } from \\"graphql\\"; +import type { User } from \\"../../fixtures/context/flow-types\\"; +import type { Context } from \\"../../fixtures/context/flow-types\\"; + +// Types for Query +export const Query_defaultResolvers = {}; + +export type Query_CreateUser_Resolver = ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => User | null | Promise; + +export interface Query_Resolvers { + createUser: ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => User | null | Promise; +} + +// Types for User +export const User_defaultResolvers = { + id: (parent: User) => parent.id +}; + +export type User_Id_Resolver = ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export interface User_Resolvers { + id: ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; +} + +export interface Resolvers { + Query: Query_Resolvers; + User: User_Resolvers; +} +" +`; + +exports[`context 2`] = ` +Array [ + Object { + "code": "/* @flow */ +import { User_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; +import type { User_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +export const User: User_Resolvers = { + ...User_defaultResolvers +}; +", + "force": false, + "path": "User.js", + }, + Object { + "code": "/* @flow */ +import type { Query_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +export const Query: Query_Resolvers = { + createUser: (parent, args, ctx, info) => { + throw new Error(\\"Resolver not implemented\\"); + } +}; +", + "force": false, + "path": "Query.js", + }, + Object { + "code": "// @flow +// This resolver file was scaffolded by github.com/prisma/graphqlgen, DO NOT EDIT. +// Please do not import this file directly but copy & paste to your application code. + +import type { Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +import { Query } from \\"./Query\\"; +import { User } from \\"./User\\"; + +export const resolvers: Resolvers = { + Query, + User +}; +", + "force": false, + "path": "index.js", + }, +] +`; + +exports[`defaultName 1`] = ` +"/* @flow */ +// Code generated by github.com/prisma/graphqlgen, DO NOT EDIT. + +import type { GraphQLResolveInfo } from \\"graphql\\"; +import type { NumberNode } from \\"../../fixtures/defaultName/flow-types\\"; +type Context = any; + +// Types for Query +export const Query_defaultResolvers = {}; + +export interface Query_Args_Custom_with_arg { + id: number; +} + +export interface Query_Args_Custom_with_custom_arg { + id: NumberNode; +} + +export interface Query_Args_Scalar_with_arg { + id: number; +} + +export interface Query_Args_Scalar_with_custom_arg { + id: NumberNode; +} + +export type Query_Id_Resolver = ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export type Query_Custom_required_Resolver = ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => NumberNode | Promise; + +export type Query_Custom_nullable_Resolver = ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => NumberNode | null | Promise; + +export type Query_Custom_array_nullable_Resolver = ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => NumberNode[] | null | Promise; + +export type Query_Custom_array_required_Resolver = ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => NumberNode[] | Promise; + +export type Query_Custom_with_arg_Resolver = ( + parent: {}, + args: Query_Args_Custom_with_arg, + ctx: Context, + info: GraphQLResolveInfo +) => NumberNode | Promise; + +export type Query_Custom_with_custom_arg_Resolver = ( + parent: {}, + args: Query_Args_Custom_with_custom_arg, + ctx: Context, + info: GraphQLResolveInfo +) => NumberNode | Promise; + +export type Query_Scalar_required_Resolver = ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => boolean | Promise; + +export type Query_Scalar_nullable_Resolver = ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => boolean | null | Promise; + +export type Query_Scalar_array_nullable_Resolver = ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => boolean[] | null | Promise; + +export type Query_Scalar_array_required_Resolver = ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => boolean[] | Promise; + +export type Query_Scalar_with_arg_Resolver = ( + parent: {}, + args: Query_Args_Scalar_with_arg, + ctx: Context, + info: GraphQLResolveInfo +) => boolean | Promise; + +export type Query_Scalar_with_custom_arg_Resolver = ( + parent: {}, + args: Query_Args_Scalar_with_custom_arg, + ctx: Context, + info: GraphQLResolveInfo +) => boolean | Promise; + +export interface Query_Resolvers { + id: ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; + + custom_required: ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => NumberNode | Promise; + + custom_nullable: ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => NumberNode | null | Promise; + + custom_array_nullable: ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => NumberNode[] | null | Promise; + + custom_array_required: ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => NumberNode[] | Promise; + + custom_with_arg: ( + parent: {}, + args: Query_Args_Custom_with_arg, + ctx: Context, + info: GraphQLResolveInfo + ) => NumberNode | Promise; + + custom_with_custom_arg: ( + parent: {}, + args: Query_Args_Custom_with_custom_arg, + ctx: Context, + info: GraphQLResolveInfo + ) => NumberNode | Promise; + + scalar_required: ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean | Promise; + + scalar_nullable: ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean | null | Promise; + + scalar_array_nullable: ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean[] | null | Promise; + + scalar_array_required: ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean[] | Promise; + + scalar_with_arg: ( + parent: {}, + args: Query_Args_Scalar_with_arg, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean | Promise; + + scalar_with_custom_arg: ( + parent: {}, + args: Query_Args_Scalar_with_custom_arg, + ctx: Context, + info: GraphQLResolveInfo + ) => boolean | Promise; +} + +// Types for Number +export const Number_defaultResolvers = { + id: (parent: NumberNode) => parent.id, + value: (parent: NumberNode) => parent.value +}; + +export type Number_Id_Resolver = ( + parent: NumberNode, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | null | Promise; + +export type Number_Value_Resolver = ( + parent: NumberNode, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => number | null | Promise; + +export interface Number_Resolvers { + id: ( + parent: NumberNode, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | null | Promise; + + value: ( + parent: NumberNode, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => number | null | Promise; +} + +export interface Resolvers { + Query: Query_Resolvers; + Number: Number_Resolvers; +} +" +`; + +exports[`defaultName 2`] = ` +Array [ + Object { + "code": "/* @flow */ +import { Number_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; +import type { Number_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +export const Number: Number_Resolvers = { + ...Number_defaultResolvers +}; +", + "force": false, + "path": "Number.js", + }, + Object { + "code": "/* @flow */ +import type { Query_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +export const Query: Query_Resolvers = { + id: (parent, args, ctx, info) => { + throw new Error(\\"Resolver not implemented\\"); + }, + custom_required: (parent, args, ctx, info) => { + throw new Error(\\"Resolver not implemented\\"); + }, + custom_nullable: (parent, args, ctx, info) => { + throw new Error(\\"Resolver not implemented\\"); + }, + custom_array_nullable: (parent, args, ctx, info) => { + throw new Error(\\"Resolver not implemented\\"); + }, + custom_array_required: (parent, args, ctx, info) => { + throw new Error(\\"Resolver not implemented\\"); + }, + custom_with_arg: (parent, args, ctx, info) => { + throw new Error(\\"Resolver not implemented\\"); + }, + custom_with_custom_arg: (parent, args, ctx, info) => { + throw new Error(\\"Resolver not implemented\\"); + }, + scalar_required: (parent, args, ctx, info) => { + throw new Error(\\"Resolver not implemented\\"); + }, + scalar_nullable: (parent, args, ctx, info) => { + throw new Error(\\"Resolver not implemented\\"); + }, + scalar_array_nullable: (parent, args, ctx, info) => { + throw new Error(\\"Resolver not implemented\\"); + }, + scalar_array_required: (parent, args, ctx, info) => { + throw new Error(\\"Resolver not implemented\\"); + }, + scalar_with_arg: (parent, args, ctx, info) => { + throw new Error(\\"Resolver not implemented\\"); + }, + scalar_with_custom_arg: (parent, args, ctx, info) => { + throw new Error(\\"Resolver not implemented\\"); + } +}; +", + "force": false, + "path": "Query.js", + }, + Object { + "code": "// @flow +// This resolver file was scaffolded by github.com/prisma/graphqlgen, DO NOT EDIT. +// Please do not import this file directly but copy & paste to your application code. + +import type { Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +import { Query } from \\"./Query\\"; +import { Number } from \\"./Number\\"; + +export const resolvers: Resolvers = { + Query, + Number +}; +", + "force": false, + "path": "index.js", + }, +] +`; + +exports[`subscription 1`] = ` +"/* @flow */ +// Code generated by github.com/prisma/graphqlgen, DO NOT EDIT. + +import type { GraphQLResolveInfo } from \\"graphql\\"; +import type { User } from \\"../../fixtures/subscription/flow-types\\"; +type Context = any; + +// Types for Subscription +export const Subscription_defaultResolvers = {}; + +export type Subscription_SubscribeToUser_Resolver = {| + subscribe: ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => AsyncIterator | Promise>, + resolve?: ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => User | Promise +|}; + +export interface Subscription_Resolvers { + subscribeToUser: {| + subscribe: ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => AsyncIterator | Promise>, + resolve?: ( + parent: {}, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => User | Promise + |}; +} + +// Types for User +export const User_defaultResolvers = { + name: (parent: User) => parent.name +}; + +export type User_Name_Resolver = ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | Promise; + +export interface User_Resolvers { + name: ( + parent: User, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | Promise; +} + +export interface Resolvers { + Subscription: Subscription_Resolvers; + User: User_Resolvers; +} +" +`; + +exports[`subscription 2`] = ` +Array [ + Object { + "code": "/* @flow */ +import { User_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; +import type { User_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +export const User: User_Resolvers = { + ...User_defaultResolvers +}; +", + "force": false, + "path": "User.js", + }, + Object { + "code": "/* @flow */ +import type { Subscription_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +export const Subscription: Subscription_Resolvers = { + subscribeToUser: { + subscribe: (parent, args, ctx, info) => { + throw new Error(\\"Resolver not implemented\\"); + } + } +}; +", + "force": false, + "path": "Subscription.js", + }, + Object { + "code": "// @flow +// This resolver file was scaffolded by github.com/prisma/graphqlgen, DO NOT EDIT. +// Please do not import this file directly but copy & paste to your application code. + +import type { Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +import { Subscription } from \\"./Subscription\\"; +import { User } from \\"./User\\"; + +export const resolvers: Resolvers = { + Subscription, + User +}; +", + "force": false, + "path": "index.js", + }, +] +`; diff --git a/packages/graphqlgen/src/tests/flow/basic.test.ts b/packages/graphqlgen/src/tests/flow/basic.test.ts index 2b335d55..f4ee0afd 100644 --- a/packages/graphqlgen/src/tests/flow/basic.test.ts +++ b/packages/graphqlgen/src/tests/flow/basic.test.ts @@ -21,79 +21,63 @@ test('basic schema', async () => { }) }) -// test('basic enum', async () => { -// return testGeneration({ -// language, -// schema: relative('../fixtures/enum/schema.graphql'), -// models: { -// files: [relative('../fixtures/enum/types-flow.js')], -// }, -// output: typesPath, -// ['resolver-scaffolding']: { -// output: resolversDir, -// layout: 'file-per-type', -// }, -// }) -// }) - -// test('basic union', async () => { -// return testGeneration({ -// language, -// schema: relative('../fixtures/union/schema.graphql'), -// models: { -// files: [relative('../fixtures/union/flow-types.js')], -// }, -// output: typesPath, -// ['resolver-scaffolding']: { -// output: resolversDir, -// layout: 'file-per-type', -// }, -// }) -// }) +test('basic enum', async () => { + return testGeneration({ + language, + schema: relative('../fixtures/enum/schema.graphql'), + models: { + files: [relative('../fixtures/enum/types-flow.js')], + }, + output: typesPath, + ['resolver-scaffolding']: { + output: resolversDir, + layout: 'file-per-type', + }, + }) +}) -// test('defaultName', async () => { -// return testGeneration({ -// language, -// schema: relative('../fixtures/defaultName/schema.graphql'), -// models: { -// files: [ -// { -// path: relative('../fixtures/defaultName/flow-types.js'), -// defaultName: '${typeName}Node', -// }, -// ], -// }, -// output: typesPath, -// ['resolver-scaffolding']: { -// output: resolversDir, -// layout: 'file-per-type', -// }, -// }) -// }) +test('basic union', async () => { + return testGeneration({ + language, + schema: relative('../fixtures/union/schema.graphql'), + models: { + files: [relative('../fixtures/union/flow-types.js')], + }, + output: typesPath, + ['resolver-scaffolding']: { + output: resolversDir, + layout: 'file-per-type', + }, + }) +}) -// //TODO: Fix this test (detected since compiling flow) -// // test('basic scalar', async () => { -// // return testGeneration({ -// // language, -// // schema: relative('../fixtures/scalar/schema.graphql'), -// // models: { -// // files: [relative('../fixtures/scalar/flow-types.js')], -// // }, -// // output: typesPath, -// // ['resolver-scaffolding']: { -// // output: resolversDir, -// // layout: 'file-per-type', -// // }, -// // }) -// // }) +test('defaultName', async () => { + return testGeneration({ + language, + schema: relative('../fixtures/defaultName/schema.graphql'), + models: { + files: [ + { + path: relative('../fixtures/defaultName/flow-types.js'), + defaultName: '${typeName}Node', + }, + ], + }, + output: typesPath, + ['resolver-scaffolding']: { + output: resolversDir, + layout: 'file-per-type', + }, + }) +}) -// test('context', async () => { +//TODO: Fix this test (detected since compiling flow) +// test('basic scalar', async () => { // return testGeneration({ // language, -// schema: relative('../fixtures/context/schema.graphql'), -// context: relative('../fixtures/context/flow-types.js:Context'), +// schema: relative('../fixtures/scalar/schema.graphql'), // models: { -// files: [relative('../fixtures/context/flow-types.js')], +// files: [relative('../fixtures/scalar/flow-types.js')], // }, // output: typesPath, // ['resolver-scaffolding']: { @@ -103,17 +87,33 @@ test('basic schema', async () => { // }) // }) -// test('subscription', () => { -// return testGeneration({ -// language, -// schema: relative('../fixtures/subscription/schema.graphql'), -// models: { -// files: [relative('../fixtures/subscription/flow-types.js')], -// }, -// output: typesPath, -// ['resolver-scaffolding']: { -// output: resolversDir, -// layout: 'file-per-type', -// }, -// }) -// }) +test('context', async () => { + return testGeneration({ + language, + schema: relative('../fixtures/context/schema.graphql'), + context: relative('../fixtures/context/flow-types.js:Context'), + models: { + files: [relative('../fixtures/context/flow-types.js')], + }, + output: typesPath, + ['resolver-scaffolding']: { + output: resolversDir, + layout: 'file-per-type', + }, + }) +}) + +test('subscription', () => { + return testGeneration({ + language, + schema: relative('../fixtures/subscription/schema.graphql'), + models: { + files: [relative('../fixtures/subscription/flow-types.js')], + }, + output: typesPath, + ['resolver-scaffolding']: { + output: resolversDir, + layout: 'file-per-type', + }, + }) +}) diff --git a/packages/graphqlgen/src/tests/generation.ts b/packages/graphqlgen/src/tests/generation.ts index d638e168..2f482a1b 100644 --- a/packages/graphqlgen/src/tests/generation.ts +++ b/packages/graphqlgen/src/tests/generation.ts @@ -97,14 +97,18 @@ ${includeFiles.map(file => getPath(file)).join(EOL)} const flowConfigName = `.flowconfig-${Math.random()}` const flowConfigPath = path.join(path.dirname(typesPath), flowConfigName) + console.log('flow writeFileSync') writeFileSync(flowConfigPath, flowConfig) + const id = Math.random() + console.log('flow will check %s', id) const result = await exec(flow, [ 'check', '--flowconfig-name', flowConfigName, path.resolve(path.dirname(typesPath)), ]) + console.log('flow did check %s', id) if (result instanceof ExecError) { const errorDelimiter = From 1602058a571fa8e42275edaa18def55c27cb2f49 Mon Sep 17 00:00:00 2001 From: Jason Kuhrt Date: Thu, 13 Dec 2018 23:41:56 -0500 Subject: [PATCH 21/35] debug: force build again --- .../graphqlgen/src/tests/flow/basic.test.ts | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/packages/graphqlgen/src/tests/flow/basic.test.ts b/packages/graphqlgen/src/tests/flow/basic.test.ts index f4ee0afd..446c8e51 100644 --- a/packages/graphqlgen/src/tests/flow/basic.test.ts +++ b/packages/graphqlgen/src/tests/flow/basic.test.ts @@ -71,21 +71,21 @@ test('defaultName', async () => { }) }) -//TODO: Fix this test (detected since compiling flow) -// test('basic scalar', async () => { -// return testGeneration({ -// language, -// schema: relative('../fixtures/scalar/schema.graphql'), -// models: { -// files: [relative('../fixtures/scalar/flow-types.js')], -// }, -// output: typesPath, -// ['resolver-scaffolding']: { -// output: resolversDir, -// layout: 'file-per-type', -// }, -// }) -// }) +// TODO: Fix this test (detected since compiling flow) +test('basic scalar', async () => { + return testGeneration({ + language, + schema: relative('../fixtures/scalar/schema.graphql'), + models: { + files: [relative('../fixtures/scalar/flow-types.js')], + }, + output: typesPath, + ['resolver-scaffolding']: { + output: resolversDir, + layout: 'file-per-type', + }, + }) +}) test('context', async () => { return testGeneration({ From 27a455a861c1402bce3fed060228b5daab770c69 Mon Sep 17 00:00:00 2001 From: Jason Kuhrt Date: Thu, 13 Dec 2018 23:43:37 -0500 Subject: [PATCH 22/35] put test back into todo --- .../flow/__snapshots__/basic.test.ts.snap | 112 ++++++++++++++++++ .../graphqlgen/src/tests/flow/basic.test.ts | 30 ++--- 2 files changed, 127 insertions(+), 15 deletions(-) diff --git a/packages/graphqlgen/src/tests/flow/__snapshots__/basic.test.ts.snap b/packages/graphqlgen/src/tests/flow/__snapshots__/basic.test.ts.snap index 5fdefa5a..2e26a5f9 100644 --- a/packages/graphqlgen/src/tests/flow/__snapshots__/basic.test.ts.snap +++ b/packages/graphqlgen/src/tests/flow/__snapshots__/basic.test.ts.snap @@ -159,6 +159,118 @@ export const resolvers: Resolvers = { ] `; +exports[`basic scalar 1`] = ` +"/* @flow */ +// Code generated by github.com/prisma/graphqlgen, DO NOT EDIT. + +import type { GraphQLResolveInfo } from \\"graphql\\"; +import type { AddMemberPayload } from \\"../../fixtures/scalar/flow-types\\"; +type Context = any; + +// Types for Mutation +export const Mutation_defaultResolvers = {}; + +export interface Mutation_AddMemberData { + email: string; + projects: string[]; +} + +export interface Mutation_Args_AddMember { + data: AddMemberData; +} + +export type Mutation_AddMember_Resolver = ( + parent: {}, + args: Mutation_Args_AddMember, + ctx: Context, + info: GraphQLResolveInfo +) => AddMemberPayload | Promise; + +export interface Mutation_Resolvers { + addMember: ( + parent: {}, + args: Mutation_Args_AddMember, + ctx: Context, + info: GraphQLResolveInfo + ) => AddMemberPayload | Promise; +} + +// Types for AddMemberPayload +export const AddMemberPayload_defaultResolvers = { + json: (parent: AddMemberPayload) => parent.json +}; + +export type AddMemberPayload_Json_Resolver = ( + parent: AddMemberPayload, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | null | Promise; + +export interface AddMemberPayload_Resolvers { + json: ( + parent: AddMemberPayload, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | null | Promise; +} + +export interface Resolvers { + Mutation: Mutation_Resolvers; + AddMemberPayload: AddMemberPayload_Resolvers; +} +" +`; + +exports[`basic scalar 2`] = ` +Array [ + Object { + "code": "/* @flow */ +import { AddMemberPayload_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; +import type { AddMemberPayload_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +export const AddMemberPayload: AddMemberPayload_Resolvers = { + ...AddMemberPayload_defaultResolvers +}; +", + "force": false, + "path": "AddMemberPayload.js", + }, + Object { + "code": "/* @flow */ +import type { Mutation_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +export const Mutation: Mutation_Resolvers = { + addMember: (parent, args, ctx, info) => { + throw new Error(\\"Resolver not implemented\\"); + } +}; +", + "force": false, + "path": "Mutation.js", + }, + Object { + "code": "// @flow +// This resolver file was scaffolded by github.com/prisma/graphqlgen, DO NOT EDIT. +// Please do not import this file directly but copy & paste to your application code. + +import type { Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +import { Mutation } from \\"./Mutation\\"; +import { AddMemberPayload } from \\"./AddMemberPayload\\"; + +export const resolvers: Resolvers = { + Mutation, + AddMemberPayload +}; +", + "force": false, + "path": "index.js", + }, +] +`; + exports[`basic schema 1`] = ` "/* @flow */ // Code generated by github.com/prisma/graphqlgen, DO NOT EDIT. diff --git a/packages/graphqlgen/src/tests/flow/basic.test.ts b/packages/graphqlgen/src/tests/flow/basic.test.ts index 446c8e51..27e9c2cc 100644 --- a/packages/graphqlgen/src/tests/flow/basic.test.ts +++ b/packages/graphqlgen/src/tests/flow/basic.test.ts @@ -71,21 +71,21 @@ test('defaultName', async () => { }) }) -// TODO: Fix this test (detected since compiling flow) -test('basic scalar', async () => { - return testGeneration({ - language, - schema: relative('../fixtures/scalar/schema.graphql'), - models: { - files: [relative('../fixtures/scalar/flow-types.js')], - }, - output: typesPath, - ['resolver-scaffolding']: { - output: resolversDir, - layout: 'file-per-type', - }, - }) -}) +// // TODO: Fix this test (detected since compiling flow) +// test('basic scalar', async () => { +// return testGeneration({ +// language, +// schema: relative('../fixtures/scalar/schema.graphql'), +// models: { +// files: [relative('../fixtures/scalar/flow-types.js')], +// }, +// output: typesPath, +// ['resolver-scaffolding']: { +// output: resolversDir, +// layout: 'file-per-type', +// }, +// }) +// }) test('context', async () => { return testGeneration({ From 730c7b6b9eefdb8df68a02c32bd58168c9d41620 Mon Sep 17 00:00:00 2001 From: Jason Kuhrt Date: Thu, 13 Dec 2018 23:49:35 -0500 Subject: [PATCH 23/35] debug: jest verbose --- packages/graphqlgen/package.json | 2 +- .../flow/__snapshots__/basic.test.ts.snap | 112 ------------------ 2 files changed, 1 insertion(+), 113 deletions(-) diff --git a/packages/graphqlgen/package.json b/packages/graphqlgen/package.json index be805e36..01bbcbbc 100644 --- a/packages/graphqlgen/package.json +++ b/packages/graphqlgen/package.json @@ -17,7 +17,7 @@ "build": "npm run lint && tsc --declaration", "watch": "tsc -w", "lint": "tslint --project tsconfig.json {src,test}/**/*.ts", - "t": "jest", + "t": "jest --verbose", "test": "npm run lint && npm run t", "gen": "ts-node --files src/index.ts" }, diff --git a/packages/graphqlgen/src/tests/flow/__snapshots__/basic.test.ts.snap b/packages/graphqlgen/src/tests/flow/__snapshots__/basic.test.ts.snap index 2e26a5f9..5fdefa5a 100644 --- a/packages/graphqlgen/src/tests/flow/__snapshots__/basic.test.ts.snap +++ b/packages/graphqlgen/src/tests/flow/__snapshots__/basic.test.ts.snap @@ -159,118 +159,6 @@ export const resolvers: Resolvers = { ] `; -exports[`basic scalar 1`] = ` -"/* @flow */ -// Code generated by github.com/prisma/graphqlgen, DO NOT EDIT. - -import type { GraphQLResolveInfo } from \\"graphql\\"; -import type { AddMemberPayload } from \\"../../fixtures/scalar/flow-types\\"; -type Context = any; - -// Types for Mutation -export const Mutation_defaultResolvers = {}; - -export interface Mutation_AddMemberData { - email: string; - projects: string[]; -} - -export interface Mutation_Args_AddMember { - data: AddMemberData; -} - -export type Mutation_AddMember_Resolver = ( - parent: {}, - args: Mutation_Args_AddMember, - ctx: Context, - info: GraphQLResolveInfo -) => AddMemberPayload | Promise; - -export interface Mutation_Resolvers { - addMember: ( - parent: {}, - args: Mutation_Args_AddMember, - ctx: Context, - info: GraphQLResolveInfo - ) => AddMemberPayload | Promise; -} - -// Types for AddMemberPayload -export const AddMemberPayload_defaultResolvers = { - json: (parent: AddMemberPayload) => parent.json -}; - -export type AddMemberPayload_Json_Resolver = ( - parent: AddMemberPayload, - args: {}, - ctx: Context, - info: GraphQLResolveInfo -) => string | null | Promise; - -export interface AddMemberPayload_Resolvers { - json: ( - parent: AddMemberPayload, - args: {}, - ctx: Context, - info: GraphQLResolveInfo - ) => string | null | Promise; -} - -export interface Resolvers { - Mutation: Mutation_Resolvers; - AddMemberPayload: AddMemberPayload_Resolvers; -} -" -`; - -exports[`basic scalar 2`] = ` -Array [ - Object { - "code": "/* @flow */ -import { AddMemberPayload_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; -import type { AddMemberPayload_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -export const AddMemberPayload: AddMemberPayload_Resolvers = { - ...AddMemberPayload_defaultResolvers -}; -", - "force": false, - "path": "AddMemberPayload.js", - }, - Object { - "code": "/* @flow */ -import type { Mutation_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -export const Mutation: Mutation_Resolvers = { - addMember: (parent, args, ctx, info) => { - throw new Error(\\"Resolver not implemented\\"); - } -}; -", - "force": false, - "path": "Mutation.js", - }, - Object { - "code": "// @flow -// This resolver file was scaffolded by github.com/prisma/graphqlgen, DO NOT EDIT. -// Please do not import this file directly but copy & paste to your application code. - -import type { Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; - -import { Mutation } from \\"./Mutation\\"; -import { AddMemberPayload } from \\"./AddMemberPayload\\"; - -export const resolvers: Resolvers = { - Mutation, - AddMemberPayload -}; -", - "force": false, - "path": "index.js", - }, -] -`; - exports[`basic schema 1`] = ` "/* @flow */ // Code generated by github.com/prisma/graphqlgen, DO NOT EDIT. From bb5ef9c6fd1576b99a762d06e84f764b941353f8 Mon Sep 17 00:00:00 2001 From: Jason Kuhrt Date: Fri, 14 Dec 2018 18:28:40 -0500 Subject: [PATCH 24/35] debug: max-workers flag 2 --- packages/graphqlgen/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/graphqlgen/package.json b/packages/graphqlgen/package.json index 01bbcbbc..0f4b04ed 100644 --- a/packages/graphqlgen/package.json +++ b/packages/graphqlgen/package.json @@ -17,7 +17,7 @@ "build": "npm run lint && tsc --declaration", "watch": "tsc -w", "lint": "tslint --project tsconfig.json {src,test}/**/*.ts", - "t": "jest --verbose", + "t": "jest --maxWorkers 2", "test": "npm run lint && npm run t", "gen": "ts-node --files src/index.ts" }, From 68d318772813dd7abcc0b646ae3771728a769f85 Mon Sep 17 00:00:00 2001 From: Jason Kuhrt Date: Fri, 14 Dec 2018 19:14:37 -0500 Subject: [PATCH 25/35] cleanup: remove debug logs --- packages/graphqlgen/src/tests/generation.ts | 6 ------ 1 file changed, 6 deletions(-) diff --git a/packages/graphqlgen/src/tests/generation.ts b/packages/graphqlgen/src/tests/generation.ts index 2f482a1b..63bba733 100644 --- a/packages/graphqlgen/src/tests/generation.ts +++ b/packages/graphqlgen/src/tests/generation.ts @@ -59,7 +59,6 @@ function printTypescriptErrors(diagnotics: ReadonlyArray) { } function compileTypescript(fileNames: string[], compiledOutputDir: string) { - console.log('compileTypescript') const errors = ts .createProgram(fileNames, { sourceMap: false, @@ -78,7 +77,6 @@ function compileTypescript(fileNames: string[], compiledOutputDir: string) { } async function compileFlow(includeFiles: File[], typesPath: string) { - console.log('compileFlow') const flowConfig = ` [ignore] @@ -97,18 +95,14 @@ ${includeFiles.map(file => getPath(file)).join(EOL)} const flowConfigName = `.flowconfig-${Math.random()}` const flowConfigPath = path.join(path.dirname(typesPath), flowConfigName) - console.log('flow writeFileSync') writeFileSync(flowConfigPath, flowConfig) - const id = Math.random() - console.log('flow will check %s', id) const result = await exec(flow, [ 'check', '--flowconfig-name', flowConfigName, path.resolve(path.dirname(typesPath)), ]) - console.log('flow did check %s', id) if (result instanceof ExecError) { const errorDelimiter = From 688a86c8a190371a3f0bec2f73cbd5d81d2a1e73 Mon Sep 17 00:00:00 2001 From: Jason Kuhrt Date: Fri, 14 Dec 2018 20:04:47 -0500 Subject: [PATCH 26/35] chore: refacotr package test scripts --- packages/graphqlgen/package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/graphqlgen/package.json b/packages/graphqlgen/package.json index 0f4b04ed..03b8949b 100644 --- a/packages/graphqlgen/package.json +++ b/packages/graphqlgen/package.json @@ -17,8 +17,9 @@ "build": "npm run lint && tsc --declaration", "watch": "tsc -w", "lint": "tslint --project tsconfig.json {src,test}/**/*.ts", - "t": "jest --maxWorkers 2", - "test": "npm run lint && npm run t", + "test:local": "jest", + "test:watch": "jest --watch", + "test": "npm run lint && jest --maxWorkers 2", "gen": "ts-node --files src/index.ts" }, "repository": { From 30e7dc5e30001df9389438dde0a21de05c9f10d3 Mon Sep 17 00:00:00 2001 From: Jason Kuhrt Date: Fri, 14 Dec 2018 21:43:21 -0500 Subject: [PATCH 27/35] fix: restore previously failing flow test --- .../src/generators/flow-generator.ts | 22 +++- packages/graphqlgen/src/source-helper.ts | 4 +- .../flow/__snapshots__/basic.test.ts.snap | 112 ++++++++++++++++++ .../graphqlgen/src/tests/flow/basic.test.ts | 29 +++-- 4 files changed, 148 insertions(+), 19 deletions(-) diff --git a/packages/graphqlgen/src/generators/flow-generator.ts b/packages/graphqlgen/src/generators/flow-generator.ts index eafdfcee..35981307 100644 --- a/packages/graphqlgen/src/generators/flow-generator.ts +++ b/packages/graphqlgen/src/generators/flow-generator.ts @@ -2,7 +2,11 @@ import * as os from 'os' import * as prettier from 'prettier' import { GenerateArgs, ModelMap, ContextDefinition } from '../types' -import { GraphQLTypeField, GraphQLTypeObject } from '../source-helper' +import { + GraphQLTypeField, + GraphQLTypeObject, + GraphQLTypeArgument, +} from '../source-helper' import { upperFirst } from '../utils' import { getContextName, @@ -192,12 +196,26 @@ function renderInputArgInterface( return '' } + const getArgTypePrefix = ( + type: GraphQLTypeObject, + fieldArg: GraphQLTypeArgument, + ): string => { + if ( + fieldArg.type.isScalar || + // Object type includes GQL ID + fieldArg.type.isObject || + fieldArg.type.isEnum + ) + return '' + return upperFirst(type.name) + '_' + } + return ` export interface ${getInputArgName(type, field)} { ${field.arguments .map( arg => - `${arg.name}: ${printFieldLikeType( + `${arg.name}: ${getArgTypePrefix(type, arg)}${printFieldLikeType( arg as GraphQLTypeField, modelMap, )}`, diff --git a/packages/graphqlgen/src/source-helper.ts b/packages/graphqlgen/src/source-helper.ts index 502e379d..a2b8a870 100644 --- a/packages/graphqlgen/src/source-helper.ts +++ b/packages/graphqlgen/src/source-helper.ts @@ -49,7 +49,7 @@ export type GraphQLType = GraphQLTypeDefinition & { isRequired: boolean } -type GraphQLTypeArgument = { +export type GraphQLTypeArgument = { name: string type: GraphQLType } @@ -331,7 +331,7 @@ const graphqlToTypescriptFlow: { [key: string]: string } = { ID: 'string', Int: 'number', Float: 'number', - DateTime: 'string' + DateTime: 'string', } export function graphQLToTypecriptFlowType(type: GraphQLType): string { diff --git a/packages/graphqlgen/src/tests/flow/__snapshots__/basic.test.ts.snap b/packages/graphqlgen/src/tests/flow/__snapshots__/basic.test.ts.snap index 5fdefa5a..7871fa13 100644 --- a/packages/graphqlgen/src/tests/flow/__snapshots__/basic.test.ts.snap +++ b/packages/graphqlgen/src/tests/flow/__snapshots__/basic.test.ts.snap @@ -159,6 +159,118 @@ export const resolvers: Resolvers = { ] `; +exports[`basic scalar 1`] = ` +"/* @flow */ +// Code generated by github.com/prisma/graphqlgen, DO NOT EDIT. + +import type { GraphQLResolveInfo } from \\"graphql\\"; +import type { AddMemberPayload } from \\"../../fixtures/scalar/flow-types\\"; +type Context = any; + +// Types for Mutation +export const Mutation_defaultResolvers = {}; + +export interface Mutation_AddMemberData { + email: string; + projects: string[]; +} + +export interface Mutation_Args_AddMember { + data: Mutation_AddMemberData; +} + +export type Mutation_AddMember_Resolver = ( + parent: {}, + args: Mutation_Args_AddMember, + ctx: Context, + info: GraphQLResolveInfo +) => AddMemberPayload | Promise; + +export interface Mutation_Resolvers { + addMember: ( + parent: {}, + args: Mutation_Args_AddMember, + ctx: Context, + info: GraphQLResolveInfo + ) => AddMemberPayload | Promise; +} + +// Types for AddMemberPayload +export const AddMemberPayload_defaultResolvers = { + json: (parent: AddMemberPayload) => parent.json +}; + +export type AddMemberPayload_Json_Resolver = ( + parent: AddMemberPayload, + args: {}, + ctx: Context, + info: GraphQLResolveInfo +) => string | null | Promise; + +export interface AddMemberPayload_Resolvers { + json: ( + parent: AddMemberPayload, + args: {}, + ctx: Context, + info: GraphQLResolveInfo + ) => string | null | Promise; +} + +export interface Resolvers { + Mutation: Mutation_Resolvers; + AddMemberPayload: AddMemberPayload_Resolvers; +} +" +`; + +exports[`basic scalar 2`] = ` +Array [ + Object { + "code": "/* @flow */ +import { AddMemberPayload_defaultResolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; +import type { AddMemberPayload_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +export const AddMemberPayload: AddMemberPayload_Resolvers = { + ...AddMemberPayload_defaultResolvers +}; +", + "force": false, + "path": "AddMemberPayload.js", + }, + Object { + "code": "/* @flow */ +import type { Mutation_Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +export const Mutation: Mutation_Resolvers = { + addMember: (parent, args, ctx, info) => { + throw new Error(\\"Resolver not implemented\\"); + } +}; +", + "force": false, + "path": "Mutation.js", + }, + Object { + "code": "// @flow +// This resolver file was scaffolded by github.com/prisma/graphqlgen, DO NOT EDIT. +// Please do not import this file directly but copy & paste to your application code. + +import type { Resolvers } from \\"[TEMPLATE-INTERFACES-PATH]\\"; + +import { Mutation } from \\"./Mutation\\"; +import { AddMemberPayload } from \\"./AddMemberPayload\\"; + +export const resolvers: Resolvers = { + Mutation, + AddMemberPayload +}; +", + "force": false, + "path": "index.js", + }, +] +`; + exports[`basic schema 1`] = ` "/* @flow */ // Code generated by github.com/prisma/graphqlgen, DO NOT EDIT. diff --git a/packages/graphqlgen/src/tests/flow/basic.test.ts b/packages/graphqlgen/src/tests/flow/basic.test.ts index 27e9c2cc..6781a6db 100644 --- a/packages/graphqlgen/src/tests/flow/basic.test.ts +++ b/packages/graphqlgen/src/tests/flow/basic.test.ts @@ -71,21 +71,20 @@ test('defaultName', async () => { }) }) -// // TODO: Fix this test (detected since compiling flow) -// test('basic scalar', async () => { -// return testGeneration({ -// language, -// schema: relative('../fixtures/scalar/schema.graphql'), -// models: { -// files: [relative('../fixtures/scalar/flow-types.js')], -// }, -// output: typesPath, -// ['resolver-scaffolding']: { -// output: resolversDir, -// layout: 'file-per-type', -// }, -// }) -// }) +test('basic scalar', async () => { + return testGeneration({ + language, + schema: relative('../fixtures/scalar/schema.graphql'), + models: { + files: [relative('../fixtures/scalar/flow-types.js')], + }, + output: typesPath, + ['resolver-scaffolding']: { + output: resolversDir, + layout: 'file-per-type', + }, + }) +}) test('context', async () => { return testGeneration({ From 0699d08f68ab0cbe486e3b0b6dddb4753806e730 Mon Sep 17 00:00:00 2001 From: Jason Kuhrt Date: Fri, 14 Dec 2018 21:44:17 -0500 Subject: [PATCH 28/35] improvement: nicer flow compile error output --- packages/graphqlgen/src/tests/generation.ts | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/packages/graphqlgen/src/tests/generation.ts b/packages/graphqlgen/src/tests/generation.ts index 63bba733..d9db14b0 100644 --- a/packages/graphqlgen/src/tests/generation.ts +++ b/packages/graphqlgen/src/tests/generation.ts @@ -118,14 +118,11 @@ ${includeFiles.map(file => getPath(file)).join(EOL)} ) if (errors.length > 0) { - console.log( - errors - .map(error => `${chalk.red(errorDelimiter) + EOL}${error}`) - .join(EOL), - ) + const message = errors + .map(error => `${chalk.red(errorDelimiter) + EOL}${error}`) + .join(EOL) + throw new Error(message) } - - expect(errors.length).toEqual(0) } } From 57837be6cddc7d5accfcb148159e5e9a3a98a411 Mon Sep 17 00:00:00 2001 From: Jason Kuhrt Date: Fri, 14 Dec 2018 21:49:24 -0500 Subject: [PATCH 29/35] try: more workers for cci --- packages/graphqlgen/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/graphqlgen/package.json b/packages/graphqlgen/package.json index 03b8949b..9b665b18 100644 --- a/packages/graphqlgen/package.json +++ b/packages/graphqlgen/package.json @@ -19,7 +19,7 @@ "lint": "tslint --project tsconfig.json {src,test}/**/*.ts", "test:local": "jest", "test:watch": "jest --watch", - "test": "npm run lint && jest --maxWorkers 2", + "test": "npm run lint && jest --maxWorkers 4", "gen": "ts-node --files src/index.ts" }, "repository": { From 157fd80a4e60f2684fe66f799e39c60d31afb8bf Mon Sep 17 00:00:00 2001 From: Jason Kuhrt Date: Fri, 14 Dec 2018 22:01:59 -0500 Subject: [PATCH 30/35] doc --- packages/graphqlgen/src/tests/generation.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/graphqlgen/src/tests/generation.ts b/packages/graphqlgen/src/tests/generation.ts index d9db14b0..68c59064 100644 --- a/packages/graphqlgen/src/tests/generation.ts +++ b/packages/graphqlgen/src/tests/generation.ts @@ -18,9 +18,8 @@ class ExecError extends Error { public stderr: string, ) { super(message) - // restore prototype chain - const actualProto = new.target.prototype - Object.setPrototypeOf(this, actualProto) + // https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work + Object.setPrototypeOf(this, new.target.prototype) } } From 04a1b46dd417c7c6a8548d708170d0ab0297132b Mon Sep 17 00:00:00 2001 From: Jason Kuhrt Date: Fri, 14 Dec 2018 22:18:48 -0500 Subject: [PATCH 31/35] hoist out function --- .../src/generators/flow-generator.ts | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/packages/graphqlgen/src/generators/flow-generator.ts b/packages/graphqlgen/src/generators/flow-generator.ts index 35981307..3c733b7c 100644 --- a/packages/graphqlgen/src/generators/flow-generator.ts +++ b/packages/graphqlgen/src/generators/flow-generator.ts @@ -196,20 +196,6 @@ function renderInputArgInterface( return '' } - const getArgTypePrefix = ( - type: GraphQLTypeObject, - fieldArg: GraphQLTypeArgument, - ): string => { - if ( - fieldArg.type.isScalar || - // Object type includes GQL ID - fieldArg.type.isObject || - fieldArg.type.isEnum - ) - return '' - return upperFirst(type.name) + '_' - } - return ` export interface ${getInputArgName(type, field)} { ${field.arguments @@ -225,6 +211,20 @@ function renderInputArgInterface( ` } +const getArgTypePrefix = ( + type: GraphQLTypeObject, + fieldArg: GraphQLTypeArgument, +): string => { + if ( + fieldArg.type.isScalar || + // Object type includes GQL ID + fieldArg.type.isObject || + fieldArg.type.isEnum + ) + return '' + return upperFirst(type.name) + '_' +} + function renderResolverFunctionInterfaces( type: GraphQLTypeObject, modelMap: ModelMap, From 84759bee5fc8640758318f5b0fba963d64284db0 Mon Sep 17 00:00:00 2001 From: Jason Kuhrt Date: Mon, 17 Dec 2018 21:44:29 -0500 Subject: [PATCH 32/35] feedback: use const over let --- packages/graphqlgen/src/tests/generation.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/graphqlgen/src/tests/generation.ts b/packages/graphqlgen/src/tests/generation.ts index 68c59064..98bf4f9d 100644 --- a/packages/graphqlgen/src/tests/generation.ts +++ b/packages/graphqlgen/src/tests/generation.ts @@ -38,10 +38,10 @@ const exec = (command: string, args: string[]): Promise => { function printTypescriptErrors(diagnotics: ReadonlyArray) { diagnotics.forEach(diagnostic => { if (diagnostic.file) { - let { line, character } = diagnostic.file.getLineAndCharacterOfPosition( + const { line, character } = diagnostic.file.getLineAndCharacterOfPosition( diagnostic.start!, ) - let message = ts.flattenDiagnosticMessageText( + const message = ts.flattenDiagnosticMessageText( diagnostic.messageText, '\n', ) From f7d686f3aee3d632b56f88bde7e5c81144fea604 Mon Sep 17 00:00:00 2001 From: Jason Kuhrt Date: Mon, 17 Dec 2018 22:02:39 -0500 Subject: [PATCH 33/35] fix: no-license warning --- package.json | 1 + packages/graphqlgen-json-schema/package.json | 1 + 2 files changed, 2 insertions(+) diff --git a/package.json b/package.json index 22a06427..a999a558 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,6 @@ { "private": true, + "license": "MIT", "scripts": { "build": "cd packages/graphqlgen-json-schema && yarn build && cd ../graphqlgen && yarn build", "test": "yarn build && cd packages/graphqlgen && yarn test" diff --git a/packages/graphqlgen-json-schema/package.json b/packages/graphqlgen-json-schema/package.json index 853ebada..d913be08 100644 --- a/packages/graphqlgen-json-schema/package.json +++ b/packages/graphqlgen-json-schema/package.json @@ -1,5 +1,6 @@ { "name": "graphqlgen-json-schema", + "license": "MIT", "version": "0.2.12", "main": "dist/definition.js", "typings": "dist/definition.d.ts", From 364f8695b3f7e261cea20a5d97f363396e35103a Mon Sep 17 00:00:00 2001 From: Jason Kuhrt Date: Mon, 17 Dec 2018 22:04:03 -0500 Subject: [PATCH 34/35] chore: make test script what developer uses not ci --- .circleci/config.yml | 2 +- package.json | 5 +++-- packages/graphqlgen/package.json | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4868d59d..5a0e1b1b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -6,5 +6,5 @@ jobs: steps: - checkout - run: yarn install - - run: yarn test + - run: yarn test:ci # - run: npx semantic-release diff --git a/package.json b/package.json index a999a558..e397f903 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,8 @@ "license": "MIT", "scripts": { "build": "cd packages/graphqlgen-json-schema && yarn build && cd ../graphqlgen && yarn build", - "test": "yarn build && cd packages/graphqlgen && yarn test" + "test": "yarn build && cd packages/graphqlgen && yarn test", + "test:ci": "yarn build && cd packages/graphqlgen && yarn test:ci" }, "workspaces": [ "packages/*" @@ -13,4 +14,4 @@ "trailingComma": "all", "singleQuote": true } -} \ No newline at end of file +} diff --git a/packages/graphqlgen/package.json b/packages/graphqlgen/package.json index 9b665b18..0dca7aff 100644 --- a/packages/graphqlgen/package.json +++ b/packages/graphqlgen/package.json @@ -17,9 +17,9 @@ "build": "npm run lint && tsc --declaration", "watch": "tsc -w", "lint": "tslint --project tsconfig.json {src,test}/**/*.ts", - "test:local": "jest", + "test": "jest", "test:watch": "jest --watch", - "test": "npm run lint && jest --maxWorkers 4", + "test:ci": "npm run lint && jest --maxWorkers 4", "gen": "ts-node --files src/index.ts" }, "repository": { From 07d48f2747993eecd5e48b592f56d7848a840be7 Mon Sep 17 00:00:00 2001 From: Jason Kuhrt Date: Mon, 17 Dec 2018 22:09:24 -0500 Subject: [PATCH 35/35] fix: duplicate package key --- packages/graphqlgen-json-schema/package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/graphqlgen-json-schema/package.json b/packages/graphqlgen-json-schema/package.json index 0e981693..5179a7d2 100644 --- a/packages/graphqlgen-json-schema/package.json +++ b/packages/graphqlgen-json-schema/package.json @@ -1,6 +1,5 @@ { "name": "graphqlgen-json-schema", - "license": "MIT", "version": "0.2.12", "main": "dist/definition.js", "typings": "dist/definition.d.ts",