Commit Graph

35 Commits

Author SHA1 Message Date
Tim Griesser 9875e90dae
feat: Add Schema Directives to SDL (#952)
Adds directive & addDirective utilities for defining directives emitted in the SDL
2022-05-15 16:59:05 -04:00
Tim Griesser 251af9461b fix: update snapshots for change in #1083 2022-05-03 11:38:57 -04:00
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 74c93e2ce4
refactor: add importsNotUsedAsValues: error to force import type (#872) 2021-03-27 16:26:13 -04:00
Filip Stefansson bb936cb95c
feat: add plugin support for inputObjectType (#799) 2021-01-31 12:32:37 -05:00
Miguel Oller 4f3cef9d38
feat: Add custom name options to Relay Connection plugin (#744) 2021-01-06 22:08:40 -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
Tim Griesser dc1e21bdad
feat: pass connection args to field extensions (#710) 2020-12-07 17:02:36 -05: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 cf5b2695dc
feat: support graphql@^14.5 (#677) 2020-11-27 14:22:48 -05:00
Tim Griesser bb136009c0 feat: #399, add requireResolver: false
Will skip requiring global extension fields
2020-11-27 13:08:57 -05:00
Tim Griesser af7c06ce9d feat: #515, connection can accept non-String cursor 2020-11-27 13:08:50 -05:00
Tim Griesser 2dd90b4d87
fix: #618 Add inputFieldDefTypes for declarativeWrappingPlugin (#682) 2020-11-27 12:20:50 -05:00
Tim Griesser 24a78e8cf4
fix: #670 - explicit nullability for connectionPlugin (#671) 2020-11-25 09:49:27 -05:00
Tim Griesser 15515069c1
feat: Improved description for types on output method / output field (#666) 2020-11-24 11:40:55 -05:00
Tim Griesser 5ab7dd35d1
feat: Simplified upgrade path w/ better warning messages (#663)
Co-authored-by: Jason Kuhrt <jason.kuhrt@dialogue.co>
2020-11-24 11:40:38 -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 4f4f9f49e8
feat(plugin): add onFieldDefinition / onArgDefinition / onInputFieldDefinition (#640) 2020-11-19 11:50:14 +01: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
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
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
Jason Kuhrt 76e6eff6a0 test: improve connection plugin tests
This deals with spec ambiguity raised in #490
2020-10-20 14:30:24 -04:00
Flavian Desverne c7eff85edd
feat: output types & list items are now nullable by default (#508)
BREAKING CHANGE:
- output types are now nullable by default. Type! -> Type
- list items are now nullable by default. [Type!] -> [Type]
2020-09-30 15:53:48 +02: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
Émile Fugulin 1d97b788b5
feat: allow asNexusMethod to specify TS type (#473)
Co-authored-by: Jason Kuhrt <jasonkuhrt@me.com>

- Create a new `NexusGenScalars` for all scalar types
- Remove scalars from `NexusGenRootTypes` (might be a breaking change, need review)
- Use the `NexusGenScalars` for all non specified (base GraphQL) scalars in `input` and `output` types
- Add `rootTyping` parameter to `asNexusMethod` to allow the user to specify it, otherwise it will fallback to the `backingTypeMap`

BREAKING CHANGE:

The global TS type `NexusGenRootTypes` no longer contains scalars. All scalars now live under a new global TS type named `NexusGenScalars`.

```ts
// before
let foo: NexusGenRootTypes['String']
```
```ts
// after
let foo: NexusGenScalars['String']
```
2020-08-04 09:50:09 -04:00
Jason Kuhrt 122b0e17b0
feat: base hasNextPage in connectionPlugin upon gt not gte (#458)
closes #392

BREAKING CHANGE:

Remember that internally Nexus Schema over-fetches by 1 but hides this internally.

It used to be that `SomeEdge.hasNextPage` would be `true` _if_ the number of returned nodes was greater-than OR equal-to the `first` arg value given in the query.

Now when Nexus Schema treats the `equal-to` case as `SomeEdge.hasNextPage` being `false`.

Co-authored-by: Eyal Wiener <eyalwiener@gmail.com>
2020-07-01 16:16:09 -04:00
Jason Kuhrt 17fad3a78a chore: update snapshots 2020-04-07 11:19:59 -04:00
Jason Kuhrt cd08bb2a6d refactor: update lang headers 2020-04-07 11:14:08 -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
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
Lukáš Huvar 2f4107ebbb
feat: add name to fieldConfig (#368) 2020-02-10 18:49:52 -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 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