🌜
🌞
@nexus/schema

@nexus/schema

v0.20.1

Scalable, strongly typed GraphQL schema development

npm install @nexus/schema

README

Nexus Schema

@nexus/schema was renamed to nexus on December 14 2020. @nexus/[email protected] corresponds to [email protected]. There will be no more publishing done on this package. Please switch to the nexus package.

Release Notes

0.19.2
By Flavian Desverne • Published on November 27, 2020

Fixes

  • 2dd90b4 #618 Add inputFieldDefTypes for declarativeWrappingPlugin (#682)

Improvements

  • 79e6c02 docs: Update index.mdx, add missing list import (#680)

Chores

  • 13f7423 add about section to prisma plugin docs
  • d3af607 publish canary releases on every trunk commit
  • 4296286 tutorial typo nullable schema defined (#675)
0.19.1
By Jason Kuhrt • Published on November 25, 2020

Fixes

  • 24a78e8 explicit nullability for connectionPlugin (#671)
0.19.0
By Jason Kuhrt • Published on November 25, 2020

Breaking Changes

SDL file generation by default in development

#652 → 618521d

SDL file generation will be enabled by default in development now.

If you were enabling it manually before and outputting to project root at schema.graphql You can probably now just rely on the default.

If you were relying on the default to disable SDL file generation before then now you need to pass an explicit false:

makeSchema({
  outputs: {
    schema: false
  }
})


Highlights

Abstract types system

#602 → 967d2df

New Abstract types system. Learn more at https://nxs.li/guides/abstract-types.


Type functions for list & nullability & .nonNull / .nullable chaining

#538 → de832e7
#655 → 306dbaa

New API for specifying list and nullability types. Learn more at https://nexusjs.org/docs/api/list-nonNull.



All Changes

Features

  • 1551506 Improved description for types on output method / output field (#666)
  • 5ab7dd3 Simplified upgrade path w/ better warning messages (#663)
  • 306dbaa .nonNull / .nullable chaining, additional cleanup (#655)
  • 618521d (breaking) SDL file generation by default in development (#652)
  • 481e2c7 Allow contextType to specify an TypingImport config (#606)
  • 4f4f9f4 add onFieldDefinition / onArgDefinition / onInputFieldDefinition (#640)
  • bfcc959 add t.modify API for modifying inherited fields (#634)
  • 94ba687 deprecate plugin onInstall return for consistent API (#637)
  • de832e7 type functions for list & nullability (#538)
  • 967d2df abstract types system (#602)

Fixes

  • 57bb5b0 Ensure we can modify nullability of an interface field (#662)
  • 5c73102 Make custom scalars work with interfaceType (#661)

Improvements

  • eb04d8f SDL converter list/nonNull chaining (#660)
  • 506b61b deps: update all to latest (#649)
  • 3a3d03b refactor: move wrapping helper fns to definitions/wrapping.ts (#643)
  • 9ba7d9b refactor: Simplify typegen with keyof and intersection types (#628)
  • e33906c refactor: remove namespace, separate internal types (#627)
  • bff7008 resolveType warning, restore declarativeWrapping list behavior (#658)
  • 1e11720 Refine exports for plugins (#639)

Docs

  • f7b9cf8 docs: fix typo
  • f49d0b0 update to use new 0.19 api (#667)
  • 3e8843f add atomicOperations setting for prisma plugin (#587)
  • 75c4c09 Add release changelog entries to CHANGELOG.md (#656)
  • 36503f7 @tgriesser/schemats for simpler DB output in ghost example (#633)
  • 45938cf fix little typo in 021-abstract-types.mdx (#624)
  • 5870d5e fix installation note (#609)

Tests

  • ab4b627 Restore integration codegen removed in #629 and #630 (#654)
  • e2c88ea fix types in nullabilityGuardPlugin spec
  • 5a8fcae run integration tests separately (#630)
0.18.0
By Jason Kuhrt • Published on November 12, 2020

Breaking Changes

Remove resolver shorthands

#592 → f609380

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

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

Instead use:

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.


Remove dynamic output builtins

9f01342 → #590

ext is no longer exported. The relayConnectionField and collectionField dynamic output methods have been removed. In their place try the connection plugin.



All Changes

Features

  • b19e83e Allow specifying a node module for type imports (#604)

Fixes

  • 2e93338 deduplicate interfaces implementing interfaces (#608)
  • 0064dc9 #588, #384 non-null list items & connection nullability (#598)

Improvements

  • f609380 (breaking) remove resolver shorthands (#592)
  • 9f01342 (breaking) remove dynamic output builtins (#590)

Docs

  • ca74442 update zeit example
  • 2de6f89 document subscription type (#593)

Chores

  • 6e06f8f Fixes broken windows tests (#607)
0.17.0
By Jason Kuhrt • Published on October 28, 2020

Features

  • 9bfdf2c allow interfaces to implement other interfaces (#496)

  • b4e0deb add onObjectDefinition / onInputObjectDefinition (#533)

  • f8d164a error feedback if root typing path is invalid (#557)

    This may be a breaking change if you were relying on pointing root typing path to a non-file for some reason in the past. We think for almost all users this will not be a breaking change however.

Fixes

  • 10c5f8b "union too complex to represent" for large union types (#571)
  • cc12ec1 (connection plugin) add deprecated, description, nullable to connectionField (#578)
  • de7cdfd (connection plugin) various fixes (#569)
    • 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)
  • 2edfcfa subscription type static typings (#564)
  • 10208e3 input fields with default should not be typed as optional (#563)

Improvements

  • 083c1ad test: capture union too large error
  • 76e6eff test: improve connection plugin tests

Docs

  • 489b5ab docs: Fix ts-node-dev flag in the docs (#529)
  • fb1216e header media query (#554)
  • 2aaaf5c fix nullabillity guard docs (#575)
  • 980920a fix for outdated prisma-labs link in the documentation #518 (#572)
  • 9960015 Update 06-chapter-5-persisting-data-via-prisma.mdx (#574)
  • e65f6ef Remove references to nexus framework (#528)
  • c68a94c fix typo in migration guide (#527)
  • 69af932 fix typo in nexus framework migration guide (#526)
  • 8cea40a Fix a prisma client call b/c latest Prisma Client (#535)
  • 0a6db6a fix link to announcement (#544)
  • e2cfcb0 fix typo in 02-chapter-1-setup-and-first-query docs (#547)
  • ebdb55a Update docs content (#553)
  • 00fb8a6 fix duplicate in 020-nexus-framework-users.mdx (#561)
  • 04fe2f5 touch api/schema.ts (#562)
  • ceeea8c fix typos
  • d4d32f7 fix migration guide ts-node command
  • 0dd8ea3 Fix a typo in 030-neuxs-framework-prisma-users.mdx (#537)
  • d1bb819 Remove framework mention, update link (#525)

Chores

  • 393de57 update test in trunk.yml
  • a8df05c Use codecov/codecov-action GH action (#534)
  • 85bf467 Restoring codecov (#532)
  • 8f3189c Keep prettier config local to the project (#531)
  • 2bceeb9 Bumping deps & adding scripts for running examples (#530)
  • 27d5b82 update url in package.json (#524)
0.16.0
By Jason Kuhrt • Published on September 30, 2020

BREAKING CHANGES

  • c7eff85 output types & list items are now nullable by default (#508)
  • 0ee644b upgrade to graphql v15 (#486)

MIGRATION GUIDE

As Nexus Schema just made output types and list items nullable by default, there's a couple of changes you need to do to produce the same schema as before the update.

Changing global defaults to revert to non-nullable output types

import { makeSchema } from '@nexus/schema'

makeSchema({
+  nonNullDefaults: {
+    output: true
+  }
})

Changing type-level configuration to revert to non-nullable output types

import { objectType } from '@nexus/schema'

objectType({
  name: 'User',
  nonNullDefaults: {
+   output: true
  }
  definition(t) {
    /* ... */
  }
})

Updating lists output types to be non-nullable

import { objectType } from '@nexus/schema'

objectType({
  name: 'User',
  definition(t) {
    t.field('posts', {
-     list: true
+     list: [true]
    })
  }
})

Features

  • c7eff85 (breaking) output types & list items are now nullable by default (#508)
  • efa96cb new docs site (#500)
  • 0ee644b (breaking) upgrade to graphql v15 (#486)

Fixes

  • e4a68e5 config file fixed (#522)
  • 646879d change netlify config (#519)
  • 796add7 Github link
  • b7ecbb0 Logo URL and Github link
  • 2327a94 force release
  • 3c38a65 message for missing resolveType in interfaces (#495)

Improvements

  • 2fef488 tmp: tmp/index.html
  • 99b34f6 temp: Temporary redirects for old nexus.js.org (#514)
  • 5e156ac docs: update asNexusMethod example with the changes from #473 (#476)

Chores

  • a44dbe4 fix link
  • f8288b5 fix link
  • 58c3ad9 release changes
  • ddb1211 upgrade dripip

Unspecified Changes

  • 4bd0ffc Update netlify.toml (#521)
0.15.0
By Jason Kuhrt • Published on August 4, 2020

BREAKING CHANGES

  • 1d97b78 allow asNexusMethod to specify TS type (#473)

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

    // before
    let foo: NexusGenRootTypes['String']
    
    // after
    let foo: NexusGenScalars['String']
    
  • 122b0e1 base hasNextPage in connectionPlugin upon gt not gte (#458)

Features

  • 1d97b78 (breaking) allow asNexusMethod to specify TS type (#473)

    • 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
  • 903ceb8 add subscriptionType (#462)

  • ee7c371 use prettier api to load config (#460)

  • 9c8e776 support typescript 3.9 (#459)

  • 122b0e1 (breaking) base hasNextPage in connectionPlugin upon gt not gte (#458)

Fixes

  • 61eccca MaybePromiseDeep case of null with .then (#475)
  • 5b900b1 connectionPlugin config: allow first and last to be zero (#436)

Improvements

  • bf0df64 tests: add windows to os matrix (#405)

Chores

  • f0c163a move renovate config into github dir
  • 78af756 format with prisma-labs prettier config (#461)
  • fe2553c Update repo name in examples readme (#443)
  • b3abdb9 dripip managed version
0.14.0
By Jason Kuhrt • Published on June 3, 2020

Features

  • 133c4a4 publish esm builds (#438)
  • a6c29ba allow control over nexus schema import id (#408)

Fixes

  • 8c7615e return types of queryField and mutationField (#415)
  • 035e0a1 typegen stable path generation with Windows (#400)

Improvements

  • 286bd66 improve: update warning to use new package name
  • 358c33e refactor: add typegen utils module
  • 72a13a9 refactor: update lang headers
  • cd08bb2 refactor: update lang headers
  • b9df04b refactor: getOwnPackage util (#409)
  • 3156f9b refactor: sort imports

Chores

  • 8c7b047 setup dripip for release scripts
  • 7fce3dc fix links (#433)
  • 57f1c7c update example lock file, fix tests
  • 6e58acd Disable Renovate (#430)
  • 0518101 fix typo on readme file (#420)
  • 70d2abb fix link
  • d74f997 examples update
  • 17fad3a update snapshots
  • 9deb327 setup renovate
  • a10463e update lockfile entries (#404)
  • ccae81a update changelog

Unspecified Changes

  • d597086 v0.14.0-next.2
  • 63e9ea0 v0.14.0-next.1
0.13.1
By Jason Kuhrt • Published on March 30, 2020

See changelog

General

License
MIT
Typescript Types
Built-in
Tree-shakeable
Yes

Popularity

GitHub Stargazers
3,109
Community Interest
2,924
Number of Forks
276

Maintenance

Commits
10/219/22010
Last Commit
Open Issues
227
Closed Issues
394
Open Pull Requests
14
Closed Pull Requests
61

Versions

Versions Released
10/219/2201
Latest Version Released
Dec 14, 2020
Current Tags
latest0.20.1
next0.20.1
pr.6020.0.0-pr.602.2.2c14c79
pr.6840.0.0-pr.684.1.187f285
pr.7200.0.0-pr.720.1.8b54bd6

Contributors

tgriesser
tgriesser
Commits: 318
jasonkuhrt
jasonkuhrt
Commits: 116
Weakky
Weakky
Commits: 28
nikolasburk
nikolasburk
Commits: 14
janpio
janpio
Commits: 10
ahmedosama5200
ahmedosama5200
Commits: 6
ruheni
ruheni
Commits: 5
chenkie
chenkie
Commits: 4
nilubava
nilubava
Commits: 4
valentinpalkovic
valentinpalkovic
Commits: 3
shreyas44
shreyas44
Commits: 3
johnnyoshika
johnnyoshika
Commits: 3
Sytten
Sytten
Commits: 3
santialbo
santialbo
Commits: 3
davekiss
davekiss
Commits: 2