Commit Graph

89 Commits

Author SHA1 Message Date
Daniel Schwartz b906288c58
chore: change facebook.github.io to relay.dev links (#1083) 2022-05-03 11:24:45 -04:00
Tim Griesser 0d06f26b12
feat: add GraphQL 16 support (#977) 2022-02-17 12:47:40 -05:00
Tim Griesser 555ae79ded
fix: revert declareInputs default to false (#975) 2021-09-02 13:18:47 +00:00
Tim Griesser 380ed9d4ca
fix: correct imports for changes in #967 (#968)
* fix: correct imports for changes in #967
2021-08-17 19:35:56 -04:00
Jason Kuhrt 1ebae9f2a8 chore: update nexus ver in examples 2020-12-14 14:10:29 -05:00
Flavian Desverne 80ad53135c
improve!: rename package to nexus (#699)
Co-authored-by: Jason Kuhrt <jasonkuhrt@me.com>

COMPLETES INITIAL DEVELOPMENT

BREAKING CHANGE:

You will now need to install Nexus Schema from the npm package `nexus` instead of `@nexus/schema`.
2020-12-14 09:41:29 -05:00
Flavian Desverne d66e8f10d7 feat: rename typegenAutoConfig and rootTyping (#723)
BREAKING CHANGES:
- Renames `typegenAutoConfig` to `sourceTypes`
- Renames `typegenAutoConfig.sources` to `sourceTypes.modules`
- Renames `typegenAutoConfig.sources[].source` to `sourcesTypes.modules[].module`
- Renames `rootTyping` to `sourceType`
2020-12-10 19:23:23 +01:00
Flavian DESVERNE 642be8b69f feat: make contextType independent of source types
BREAKING CHANGES:
- `contextType` is no longer nested in `typegenAutoConfig`
- `contextType` can no longer references `sources` registered in `typegenAutoConfig`
- `contextType` API was refactored to use  `module` instead of `path` and `export` instead of `name`
- `rootTyping` API was refactored to use  `module` instead of `path` and `export` instead of `name`
2020-12-10 19:23:23 +01:00
Tim Griesser 9d0f4f4226
feat: add .asArg for enum, fix default typings (#708)
- Renames `EnumTypeConfig` -> `NexusEnumTypeConfig` for consistency
- Adds `.asArg` on `enumType`, since these are often defined inline for one-off field args
- Fixes types so `default` type is properly inferred, eases types elsewhere so valid types which haven't been added to the manifest do not show as type errors
2020-12-06 18:52:04 -05:00
Tim Griesser 439864aabb
chore: Prettier on the codebase for JSDoc formatting (#706) 2020-12-06 15:47:58 -05:00
Tim Griesser 306dbaae10
feat: .nonNull / .nullable chaining, additional cleanup (#655)
- Fixes SDL conversion
- Defer wrapping until types are built
- Supports GraphQL types anywhere that a type can be used, wrapped, etc.
- Split out the wrapping, w/ `finalizeWrapping` helper which adds in the `NonNull` to the list as needed
- Make `nonNull(nonNull(T))` & `nullable(nullable(T))` no-op for simplicity
- Change: `nullable(nonNull(T))` will undo the `nonNull`
- Properly type-check's `subscriptionType` by passing `Event` generic properly
- Adds `declarativeWrappingPlugin` for previous `nullable` / `list` behavior

Co-authored-by: Flavian DESVERNE <flavian.desverne@epitech.eu>
2020-11-23 10:41:03 -05:00
Tim Griesser bfcc959fd6
feat: add t.modify API for modifying inherited fields (#634)
Adds `t.modify` API for modifying inherited types. 

Use cases:

- If you have an `interface` type, but want to override the resolver or description for the field per-`objectType`
- If an inherited field's value is abstract, and you want to narrow it to a subtype which conforms to the inherited type
- If you want to add additional optional arguments for an inherited field, as is permitted by the spec

The types should validate that only fields inherited from interfaces can be modified, and the `type` can only be 
changed if the result of that field is an abstract type which implements the existing inherited return type.
2020-11-18 21:58:14 -05:00
Flavian Desverne de832e79ca
feat: replace list & nullable API by type wrappers (#538)
This PR removes the `nullable: boolean` and `list: boolean | boolean[]` API and replaces it with top-level type wrappers named: `list()`, `nonNull()` and `nullable()`
2020-11-18 17:59:59 +01:00
Tim Griesser 9ba7d9b702
refactor: Simplify typegen with keyof and intersection types (#628) 2020-11-17 13:17:22 -05:00
Flavian Desverne 967d2df73e
feat: improve abstract types (#602)
BREAKING CHANGES:

- `isTypeOf` is now the _default_ strategy to discriminate members of an abstract type. To keep using `resolveType` as you might have been before, enable the following config in `makeSchema`:

```ts
makeSchema({
  features: {
    abstractTypeStrategies: {
      resolveType: true
    }
  }
})
```
2020-11-13 20:19:15 +01:00
Jason Kuhrt f60938079a
improve: remove resolver shorthands (#592)
closes #582

As discussed. In most cases resolver shorthands are not a serious use of the API.

BREAKING CHANGE:

Resolver shorthand API is now removed. The following will now not typecheck:

```ts
t.string('foo', () => ... )
```

Instead use:

```ts
t.string('foo', { resolve: () => ... })
```

Runtime support is still intact but will result in a logged warning. Runtime support will be removed in the next Nexus release.
2020-11-04 12:03:29 -05:00
Tim Griesser cc12ec16fb
fix: add deprecated, description, nullable to connectionField (#578) 2020-10-27 14:21:30 -04:00
Flavian Desverne de7cdfd396
fix: connection plugin (#569)
fixes #402
fixes #450

Fixes:

- Global connection field extensions were never executed
- Typings of global connection field extension (root, args and the resolver return type was wrong)
- Typings of local connection field extension (everything was any)
2020-10-26 09:24:20 -04:00
Tim Griesser b4e0debd95
feat: add onObjectDefinition / onInputObjectDefinition (#533) 2020-10-07 13:08:43 -04:00
Tim Griesser 8f3189c069
chore: Keep prettier config local to the project (#531) 2020-10-03 16:26:50 -04:00
Tim Griesser 2bceeb915f
chore: Bumping deps & adding scripts for running examples (#530) 2020-10-03 15:50:56 -04:00
Jason Kuhrt 0ee644b234
feat(deps)!: upgrade to graphql v15 (#486)
closes #410

BREAKING CHANGE:

The graphql peer dep requirement has been bumped to v15.

No graphql v15 exclusive features have been shipped yet. But this update
sets us up to begin that work.

Support for graphql v14 and lower has been dropped. It may technically work
still (the test suite did not show any major reasons why it won't, for
now/currently) but there is no guarantee about that remaining so in the
future. Internally we are only testing against v15. Certain new grpahqljs
v15 features like interfaces being able to implement other interfaces will
be released in the future.

If you absolutely cannot upgrade from graphql v14 right now then stay with
@nexus/schema v15. But if you also really need a new @nexus/schema feature
on v16+ (future) then you can try your luck with it an older version of
graphqljs.
2020-08-07 16:12:15 -04:00
Jason Kuhrt 78af75686d
chore: format with prisma-labs prettier config (#461) 2020-07-01 23:42:06 -04:00
Tim Griesser a10463e77c
chore: update lockfile entries (#404)
* chore: update lockfile entries
* fix: link-examples for website
2020-03-31 12:33:16 -04:00
Jason Kuhrt fc627fdcd8
fix: schema component import refs (#403)
Also migrates to GH Actions away from CircleCI
2020-03-30 16:14:47 -04:00
Jason Kuhrt 7d4dba0515 docs: update examples to @nexus/schema 2020-03-30 15:03:06 -04:00
Tim Griesser d878c9d620 Bump local dependencies 2020-02-11 11:59:07 -05:00
Bjorn Lu 14fcbcdc22
feat: Add queryComplexityPlugin for query cost analysis (#369)
* Add graphql-query-complexity package

* Add query complexity plugin

* Add tests

* Add example

* Add docs

* Remove redundant async
2020-02-10 19:00:45 -05:00
Tim Griesser 4351a1d051
feat: Add connectionPlugin for relay style pagination (#324)
Adds `connectionsPlugin` for cursor style connections. These adhere to the Relay specification and offer plenty of options for customization:

https://facebook.github.io/relay/graphql/connections.htm
2020-01-22 20:17:17 -05:00
Tim Griesser cd25998259
chore: Clarify ts-node example so it doesn't fail on run #327 (#348) 2019-12-04 07:43:10 -05:00
Tim Griesser aa9a46fe48 chore(deps): Bump prettier to latest 2019-11-11 14:57:21 -05:00
Tim Griesser 50bf2981e7
feat(epic): 0.12.0 Plugin System and Internal Refactor (#242)
See #242 for a full summary
2019-11-07 16:39:33 -05:00
dependabot[bot] 31e92e0649 chore(deps): bump mixin-deep in /examples/kitchen-sink (#299)
Bumps [mixin-deep](https://github.com/jonschlinkert/mixin-deep) from 1.3.1 to 1.3.2.
- [Release notes](https://github.com/jonschlinkert/mixin-deep/releases)
- [Commits](https://github.com/jonschlinkert/mixin-deep/compare/1.3.1...1.3.2)

Signed-off-by: dependabot[bot] <support@github.com>
2019-11-06 10:18:57 -05:00
Tim Griesser 17b9afb8ce
Cleanup codegen from examples to make plugins diff less noisy (#298) 2019-11-04 15:04:06 -05:00
Brice BERNARD 0a77f622e9 Test examples with CI (#220)
* Update CI config to test examples

* Fix star wars example

* Update yarn.lock of nexus-prisma example

* Fix kitchen-sink example

* Update nexus to beta9 in star wars example

* Upgrade nexus in ts-ast-reader example

* Fix ghost example

* Fix githunt-api example

* Make githunt-api test pass

* Fix nexus-prisma example

* Fix typing in ts-ast-reader

* Use yarn link when nexus deps is already 0.12.0-beta.9

* Remove yarn link from example_ghost

* Make sure generated files are up to date
2019-09-21 16:12:03 -04:00
Tim Griesser 1e932eb4b5
Initial pass at dynamic field inclusion/definition (#143)
* Initial pass at dynamic field inclusion/definition

* Split input/output custom fields, fixes #93 and #129

* Bump some lib versions

* Change around some dynamic field implementation details

* Make args override collection args

* Rename dynamicField -> dynamicMethod, export types from root

* Add decorateType, ability to specify rootType, fixes #17
2019-06-02 20:29:53 -04:00
Tim Griesser 342dccf265 Bumping TypeScript version for development 2019-05-18 18:01:56 -04:00
Tim Griesser 09abed674a
.list on custom scalar type (#141)
* Fix #114 - .list on custom scalar type
2019-05-16 23:44:26 -04:00
Tim Griesser 0060cb9ec7 Don't output the version number in typegen 2019-05-16 23:34:41 -04:00
Tim Griesser 6b3056a787 Upgrade examples dependencies 2019-03-10 13:40:54 -04:00
Tim Griesser 045c35fdab Bump example versions after release 2019-03-07 20:00:08 -05:00
Tim Griesser e09d42add6
Add subscriptionField, initial pass at #21 (#66)
* Add subscriptionField, initial pass at #21
2019-03-07 19:39:40 -05:00
Tim Griesser 18401c465a
Fix #68, allow nested input types, fix typings for input field default values (#72) 2019-03-07 19:38:14 -05:00
Tim Griesser 4e894c2081
Add mutationField shorthand helper (#58)
* Add mutationField helper, closes #46
2019-02-23 12:25:12 -05:00
Tim Griesser 62a858f7ab
Fix #52, incorrect Symbol type for arg definition (#57) 2019-02-22 17:42:33 -05:00
Tim Griesser f1175c0c21
Add extendInputType (#54)
* Add extendInputType, fix #51
2019-02-22 17:29:01 -05:00
Tim Griesser 3991317383 Update examples 2019-02-22 14:54:10 -05:00
Tim Griesser 4af597f566
Fix #55 (#56) 2019-02-22 14:46:27 -05:00
Tim Griesser 9af376746b Bump changelog, examples 2019-02-18 18:06:18 -05:00
Tim Griesser ee1589ae8c
Fix #44, add correct typing for union types (#45) 2019-02-18 18:04:46 -05:00