fix: add deprecated, description, nullable to connectionField (#578)
This commit is contained in:
parent
2aaaf5cb9f
commit
cc12ec16fb
|
|
@ -26,7 +26,7 @@ const schema = makeSchema({
|
|||
],
|
||||
contextType: 't.Context',
|
||||
},
|
||||
prettierConfig: require.resolve('../../../package.json'),
|
||||
prettierConfig: require.resolve('../../../.prettierrc'),
|
||||
})
|
||||
|
||||
const store = createStore()
|
||||
|
|
|
|||
|
|
@ -26,5 +26,5 @@ export const schema = makeSchema({
|
|||
Date: 'Date',
|
||||
},
|
||||
},
|
||||
prettierConfig: require.resolve('../../../package.json'),
|
||||
prettierConfig: require.resolve('../../../.prettierrc'),
|
||||
})
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ const schema = makeSchema({
|
|||
schema: path.join(__dirname, '../githunt-api-schema.graphql'),
|
||||
typegen: path.join(__dirname, './githunt-typegen.ts'),
|
||||
},
|
||||
prettierConfig: require.resolve('../../../package.json'),
|
||||
prettierConfig: require.resolve('../../../.prettierrc'),
|
||||
})
|
||||
|
||||
const server = new ApolloServer({
|
||||
|
|
|
|||
|
|
@ -146,6 +146,27 @@ type Query {
|
|||
): BooleanConnection
|
||||
complexQuery(count: Int!): [ComplexObject]
|
||||
dateAsList: [Date]
|
||||
deprecatedConnection(
|
||||
"""
|
||||
Returns the elements in the list that come after the specified cursor
|
||||
"""
|
||||
after: String
|
||||
|
||||
"""
|
||||
Returns the elements in the list that come before the specified cursor
|
||||
"""
|
||||
before: String
|
||||
|
||||
"""
|
||||
Returns the first n elements from the list.
|
||||
"""
|
||||
first: Int
|
||||
|
||||
"""
|
||||
Returns the last n elements from the list.
|
||||
"""
|
||||
last: Int
|
||||
): BooleanConnection! @deprecated(reason: "Dont use this, use booleanConnection instead")
|
||||
extended: SomeItem
|
||||
getNumberOrNull(a: Int!): Int
|
||||
guardedConnection(
|
||||
|
|
@ -200,6 +221,10 @@ type Query {
|
|||
"""
|
||||
first: Int!
|
||||
): UserConnection
|
||||
|
||||
"""
|
||||
A connection with some user nodes
|
||||
"""
|
||||
usersConnectionNodes(
|
||||
"""
|
||||
Returns the elements in the list that come after the specified cursor
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ const schema = makeSchema({
|
|||
},
|
||||
}),
|
||||
],
|
||||
prettierConfig: require.resolve('../../../package.json'),
|
||||
prettierConfig: require.resolve('../../../.prettierrc'),
|
||||
})
|
||||
|
||||
const server = new ApolloServer({
|
||||
|
|
|
|||
|
|
@ -204,6 +204,15 @@ export const Query = objectType({
|
|||
},
|
||||
})
|
||||
|
||||
t.connectionField('deprecatedConnection', {
|
||||
type: 'Boolean',
|
||||
deprecation: 'Dont use this, use booleanConnection instead',
|
||||
nullable: false,
|
||||
nodes() {
|
||||
return [true]
|
||||
},
|
||||
})
|
||||
|
||||
t.connectionField('guardedConnection', {
|
||||
type: 'Date',
|
||||
disableBackwardPagination: true,
|
||||
|
|
@ -217,6 +226,7 @@ export const Query = objectType({
|
|||
|
||||
t.connectionField('usersConnectionNodes', {
|
||||
type: User,
|
||||
description: 'A connection with some user nodes',
|
||||
cursorFromNode(node, args, ctx, info, { index, nodes }) {
|
||||
if (args.last && !args.before) {
|
||||
const totalCount = USERS_DATA.length
|
||||
|
|
|
|||
|
|
@ -201,6 +201,7 @@ export interface NexusGenFieldTypes {
|
|||
booleanConnection: NexusGenRootTypes['BooleanConnection'] | null // BooleanConnection
|
||||
complexQuery: Array<NexusGenRootTypes['ComplexObject'] | null> | null // [ComplexObject]
|
||||
dateAsList: Array<NexusGenScalars['Date'] | null> | null // [Date]
|
||||
deprecatedConnection: NexusGenRootTypes['BooleanConnection'] // BooleanConnection!
|
||||
extended: NexusGenRootTypes['SomeItem'] | null // SomeItem
|
||||
getNumberOrNull: number | null // Int
|
||||
guardedConnection: NexusGenRootTypes['DateConnection'] | null // DateConnection
|
||||
|
|
@ -310,6 +311,7 @@ export interface NexusGenFieldTypeNames {
|
|||
booleanConnection: 'BooleanConnection'
|
||||
complexQuery: 'ComplexObject'
|
||||
dateAsList: 'Date'
|
||||
deprecatedConnection: 'BooleanConnection'
|
||||
extended: 'SomeItem'
|
||||
getNumberOrNull: 'Int'
|
||||
guardedConnection: 'DateConnection'
|
||||
|
|
@ -396,6 +398,13 @@ export interface NexusGenArgTypes {
|
|||
// args
|
||||
count: number // Int!
|
||||
}
|
||||
deprecatedConnection: {
|
||||
// args
|
||||
after?: string | null // String
|
||||
before?: string | null // String
|
||||
first?: number | null // Int
|
||||
last?: number | null // Int
|
||||
}
|
||||
getNumberOrNull: {
|
||||
// args
|
||||
a: number // Int!
|
||||
|
|
|
|||
|
|
@ -31,5 +31,5 @@ export const schema = makeSchema({
|
|||
],
|
||||
contextType: 'swapi.ContextType',
|
||||
},
|
||||
prettierConfig: require.resolve('../../../package.json'),
|
||||
prettierConfig: require.resolve('../../../.prettierrc'),
|
||||
})
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ export const schema = makeSchema({
|
|||
},
|
||||
// debug: true,
|
||||
},
|
||||
prettierConfig: require.resolve('../../../package.json'),
|
||||
prettierConfig: require.resolve('../../../.prettierrc'),
|
||||
})
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
"clean": "rm -rf dist*",
|
||||
"deploy-site": "yarn && yarn build",
|
||||
"dev": "tsc -p tsconfig.cjs.json -w",
|
||||
"dev:examples": "yarn -s link-examples && tsc -w",
|
||||
"dev:examples": "yarn -s link-examples && yarn dev",
|
||||
"dev:test": "jest --watch",
|
||||
"examples": "yarn link-examples && yarn gulp run-examples",
|
||||
"format": "prettier --write 'src/**/*.ts' 'tests/**/*.ts' 'examples/*/src/**.ts'",
|
||||
|
|
|
|||
|
|
@ -34,11 +34,11 @@ gulp.task('link-examples', async () => {
|
|||
})
|
||||
|
||||
gulp.task('api-tsc', () => {
|
||||
runService('yarn', 'tsc -w -p api/tsconfig.json', { stdio: 'ignore' })
|
||||
runService('yarn', 'tsc -w -p api/tsconfig.cjs.json', { stdio: 'ignore' })
|
||||
})
|
||||
|
||||
gulp.task('core-tsc', () => {
|
||||
runService('yarn', 'tsc -w -p tsconfig.json', {
|
||||
runService('yarn', 'tsc -w -p tsconfig.cjs.json', {
|
||||
stdio: 'ignore',
|
||||
cwd: path.join(__dirname, '..'),
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { GraphQLFieldResolver, GraphQLResolveInfo } from 'graphql'
|
||||
import { ArgsRecord, intArg, stringArg } from '../definitions/args'
|
||||
import { FieldOutConfig } from '../definitions/definitionBlocks'
|
||||
import { CommonFieldConfig, FieldOutConfig } from '../definitions/definitionBlocks'
|
||||
import { ObjectDefinitionBlock, objectType } from '../definitions/objectType'
|
||||
import { AllNexusOutputTypeDefs } from '../definitions/wrapping'
|
||||
import { dynamicOutputMethod } from '../dynamicMethod'
|
||||
|
|
@ -246,6 +246,7 @@ export type ConnectionFieldConfig<TypeName extends string = any, FieldName exten
|
|||
nodes?: never
|
||||
}
|
||||
) &
|
||||
Pick<CommonFieldConfig, 'deprecation' | 'description' | 'nullable'> &
|
||||
NexusGenPluginFieldConfig<TypeName, FieldName>
|
||||
|
||||
const ForwardPaginateArgs = {
|
||||
|
|
|
|||
Loading…
Reference in New Issue