Skip to content

Commit

Permalink
Merge branch 'main' into tgriesser/feat/sdl-directives
Browse files Browse the repository at this point in the history
* main:
  feat: ability to rename root types (#976)
  docs: Remove `.ts` extension from import statement (#974)
  fix: revert declareInputs default to false (#975)
  fix: printer imports, follow up from #967 (#970)
  fix: plugin inputFieldDefTypes (#919)
  fix: add globalHeaders to imports for global def file (#969)
  fix: correct imports for changes in #967 (#968)
  feat: ConfiguredTypegen for splitting global types & configuring input type emission (#967)
  Revert "fix: #921 wrong typegen for nullable values w/ default (#965)" (#966)
  fix: #921 wrong typegen for nullable values w/ default (#965)
  • Loading branch information
tgriesser committed Sep 2, 2021
2 parents 8524a96 + d4c6260 commit 54fa7a3
Show file tree
Hide file tree
Showing 19 changed files with 1,700 additions and 416 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export const server = new ApolloServer({ schema })

```ts copy
// api/index.ts
import { server } from './server.ts'
import { server } from './server'

server.listen().then(({ url }) => {
console.log(`🚀 Server ready at ${url}`)
Expand Down
6 changes: 5 additions & 1 deletion examples/kitchen-sink/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ const schema = makeSchema({
types,
outputs: {
schema: path.join(__dirname, '../kitchen-sink-schema.graphql'),
typegen: path.join(__dirname, './kitchen-sink.gen.ts'),
typegen: {
outputPath: path.join(__dirname, './kitchen-sink.gen.ts'),
globalsPath: path.join(__dirname, './kitchen-sink-globals.gen.ts'),
declareInputs: true,
},
},
plugins: [
NodePlugin,
Expand Down
65 changes: 65 additions & 0 deletions examples/kitchen-sink/src/kitchen-sink-globals.gen.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/** This file was generated by Nexus Schema Do not make changes to this file directly */

import type { NexusGenTypes } from './kitchen-sink.gen'
declare global {
interface NexusGenCustomInputMethods<TypeName extends string> {
date<FieldName extends string>(
fieldName: FieldName,
opts?: core.CommonInputFieldConfig<TypeName, FieldName>
): void // "Date";
}
}
declare global {
interface NexusGenCustomOutputMethods<TypeName extends string> {
date<FieldName extends string>(
fieldName: FieldName,
...opts: core.ScalarOutSpread<TypeName, FieldName>
): void // "Date";
/**
* Adds a Relay-style connection to the type, with numerous options for configuration
*
* @see https://nexusjs.org/docs/plugins/connection
*/
connectionField<FieldName extends string>(
fieldName: FieldName,
config: connectionPluginCore.ConnectionFieldConfig<TypeName, FieldName>
): void
}
}

declare global {
interface NexusGen extends NexusGenTypes {}
}

import type { core, connectionPluginCore } from 'nexus'
import type { QueryComplexity } from 'nexus/dist/plugins/queryComplexityPlugin'
import type { FieldAuthorizeResolver } from 'nexus/dist/plugins/fieldAuthorizePlugin'

declare global {
interface NexusGenPluginTypeConfig<TypeName extends string> {
node?: string | core.FieldResolver<TypeName, any>
}
interface NexusGenPluginInputTypeConfig<TypeName extends string> {}
interface NexusGenPluginFieldConfig<TypeName extends string, FieldName extends string> {
/**
* The complexity for an individual field. Return a number or a function that returns a number to specify
* the complexity for this field.
*/
complexity?: QueryComplexity<TypeName, FieldName>
/**
* Authorization for an individual field. Returning "true" or "Promise<true>" means the field can be
* accessed. Returning "false" or "Promise<false>" will respond with a "Not Authorized" error for the
* field. Returning or throwing an error will also prevent the resolver from executing.
*/
authorize?: FieldAuthorizeResolver<TypeName, FieldName>
/**
* The nullability guard can be helpful, but is also a potentially expensive operation for lists. We need
* to iterate the entire list to check for null items to guard against. Set this to true to skip the null
* guard on a specific field if you know there's no potential for unsafe types.
*/
skipNullGuard?: boolean
}
interface NexusGenPluginInputFieldConfig<TypeName extends string, FieldName extends string> {}
interface NexusGenPluginSchemaConfig {}
interface NexusGenPluginArgConfig {}
}
Loading

0 comments on commit 54fa7a3

Please sign in to comment.