- Add
loc
getter to parsedDocumentNode
fragment outputs to ensure that using fragments created bygql.tada
'sgraphql()
function withgraphql-tag
doesn't crash.graphql-tag
does not treat theDocumentNode.loc
property as optional on interpolations, which leads to intercompatibility issues Submitted by @kitten (See #396)
- Update internal type signature of
initGraphQLTada<>()
function and includeinitGraphQLTada<Setup>
alias type. This alias type makes it more intuitive to declare types the return type ofinitGraphQLTada()
, since it mirrors the same name Submitted by @kitten (See #377) - Updated dependencies (See #386 and #388)
- @gql.tada/internal@1.0.8
- @gql.tada/cli-utils@1.6.2
- Remove redundant
never
default onreadFragment<Document>()
signature (explicit generic passed) Submitted by @kitten (See #371) - Upgrade dependencies Submitted by @kitten (See #373)
- Allow
readFragment(doc, data)
to narrow output's__typename
s by the input type Submitted by @kitten (See #372) - Add
__typename
narrowing of unmasked interface fragment spreads, which could otherwise lead to confusion. This usually is relevant when the parent selection set forgets to include a__typename
selection Submitted by @kitten (See #368) - Improve type output readability for interfaces with narrowed types Submitted by @kitten (See #370)
- Updated dependencies (See #373)
- @gql.tada/cli-utils@1.6.1
- @gql.tada/internal@1.0.7
- Updated dependencies (See #361, #358, #359, and #363)
- @gql.tada/cli-utils@1.6.0
- @gql.tada/internal@1.0.6
- Extend
readFragment
types to allow| {}
optional fragments to be matched. When a fragment is annotated with a directive making it optional (such as@include
,@skip
, or@defer
) then its typed as optional.readFragment
previously didn't know how to match these types, but it will now matchT | {}
and infer the type as such Submitted by @kitten (See #349) - Updated dependencies (See #350)
- @gql.tada/internal@1.0.5
- @gql.tada/cli-utils@1.5.2
- Updated dependencies (See #340)
- @gql.tada/internal@1.0.4
- @gql.tada/cli-utils@1.5.1
⚠️ Fix@defer
,@skip
, and@include
optional fragments causing types to become exponentially more complex to evaluate, causing a recursive type error. Instead, merging field types and sub-selections from fragments is now separated, as needed Submitted by @kitten (See #319)- Updated dependencies (See #62, #329, and #62)
- @gql.tada/cli-utils@1.4.0
- @gql.tada/internal@1.0.2
⚠️ Fix Vue not transpiling to.tsx
files properly due to missing SFC plugin Submitted by @JoviDeCroock (See #305)- Updated dependencies (See #305)
- @gql.tada/cli-utils@1.3.9
- Updated dependencies (See #303)
- @gql.tada/cli-utils@1.3.8
- Updated dependencies (See #301)
- @gql.tada/cli-utils@1.3.7
- Updated dependencies (See #298)
- @gql.tada/cli-utils@1.3.6
- Add support for
oneOf
input objects as specified in the RFC Submitted by @JoviDeCroock (See #284)
- Updated dependencies (See #275)
- @gql.tada/cli-utils@1.3.3
- Updated dependencies (See #270)
- @gql.tada/internal@0.3.3
- @gql.tada/cli-utils@1.3.2
- Implement multi-schema support. Read more about it in the v1.6.0 Devlog post. Submitted by undefined (See #261)
- Switch between ESM and CJS when running CLI Submitted by @kitten (See #252)
- Updated dependencies (See #247, #251, #247, #249, and #251)
- @gql.tada/cli-utils@1.2.1
- @gql.tada/internal@0.2.3
- Ensure that
graphql.scalar()
accepts value arguments as-is, so excess properties trigger an error Submitted by @kitten (See #243) - Updated dependencies (See #241, #239, and #239)
- @gql.tada/cli-utils@1.2.0
- @gql.tada/internal@0.2.2
- Updated dependencies (See #236)
- @gql.tada/cli-utils@1.1.1
⚠️ FixreadFragment
falling back toany
type when called with invalid data or invalid type Submitted by @kitten (See #216)- Updated dependencies (See #222 and #214)
- @gql.tada/internal@0.2.1
- @gql.tada/cli-utils@1.0.2
- Updated dependencies (See #212)
- @gql.tada/cli-utils@1.0.1
Read the full release announcement post at: https://gql-tada.0no.co/devlog/2024-04-15
- Allow GraphQL enum types to be remapped with the
scalars
configuration option Submitted by @kitten (See #184) - Support a second argument in
graphql.persisted
which accepts aTadaDocumentNode
rather than passing a generic. This allows the document node to not be hidden, to still generatedocumentId
viagql.tada
without having to hide the document during runtime Submitted by @JoviDeCroock (See #188)
⚠️ Fixturbo
command reusing previously cached turbo typings. Instead, we now set a flag to disable the cache temporarily inside the command Submitted by @kitten (See #208)- Updated dependencies (See #203, #208, #184, #197, #183, #175, #176, #188, #207, #205, #200, #170, #169, #192, #185, #182, #193, #199, #200, and #200)
- @gql.tada/cli-utils@1.0.0
- @gql.tada/internal@0.2.0
- Updated dependencies (See #172)
- @gql.tada/internal@0.1.3
- @gql.tada/cli-utils@0.3.3
- Upgrade
@0no-co/graphql.web
to1.0.5
Submitted by @kitten (See #168) - Updated dependencies (See #163, #168, #163, and #165)
- @gql.tada/internal@0.1.2
- @gql.tada/cli-utils@0.3.2
- Improve type inference performance of hot-path that computes fragment spreads. The
getFragmentsOfDocuments
type has been refactored and will now have a lower impact on performance Submitted by @kitten (See #159) - Add
typescript
topeerDependencies
Submitted by @kitten (See #156) - Updated dependencies (See #156)
- @gql.tada/cli-utils@0.3.1
- @gql.tada/internal@0.1.1
- Accept a pre-processed schema when setting up
gql.tada
for theAbstractSetupSchema.introspection
option. This allows us to map anIntrospectionQuery
ahead of time Submitted by @kitten (See #147) - Add
@gql.tada/internal
package to extract common logic between the CLI and the LSP Submitted by @JoviDeCroock (See #149) - Change the default scalar type of
ID
to bestring
, as the GraphQL spec recommends it to serialize to a string Submitted by @JoviDeCroock (See #146)
- Remove
stringLiteral
generic constraint, causing errors depending on TypeScript version Submitted by @kitten (See #151) - Updated dependencies (See #155, #150, and #149)
- @gql.tada/cli-utils@0.3.0
- @gql.tada/internal@0.1.0
- Updated dependencies (See #135)
- @gql.tada/cli-utils@0.2.0
- Updated dependencies (See #131)
- @gql.tada/cli-utils@0.1.2
- Replace redundant
$tada.ref
value on$tada.fragmentRefs
definitions for masked fragments with typename string literal. The record for fragment masks is already namespaced, so there wasn't a need to use a symbol value here, and this further increases readability and usefulness Submitted by @kitten (See #126) - Allow
readFragment()
to accept the document as a generic rather than a (runtime value) argument. This replaces the complex mapping type for input arguments, and hence drops the (undocumented) support for nested arrays being passed to it Submitted by @kitten (See #128)
⚠️ Fix tokenizer hitting tail recursion limit by recursing on each ignored token Submitted by @kitten (See #125)- Allow
readFragment
to be called again on an already unmasked fragment Submitted by @kitten (See #124) - Re-export
DocumentDecoration
Submitted by @kitten (See #113) - Updated dependencies (See #120)
- @gql.tada/cli-utils@0.1.1
- Refactor internal GraphQL document parser to use a tokenizer phase, which further utilizes TypeScript’s tail recursion optimization. This should help to further improve type inference performance Submitted by @kitten (See #111)
- Add CLI entrypoint
gql-tada
capable of generating the types file without the LSP running Submitted by @JoviDeCroock (See #58) - Add
graphql.persisted()
to create an API for persisted documents that omits a query’s definitions from the output bundle Submitted by @kitten (See #98)
- Allow
graphql.scalar
to resolve types for input objects Submitted by @kitten (See #97) - Address performance cliff for
getDocumentNode
inference and object-flattening utilities Submitted by @kitten (See #107) - Refactor type unwrapping for
NON_NULL
field types (with@_optional
and@_required
), input types, and variable types Submitted by @kitten (See #104) ⚠️ Fix$tada
not being exported, which can cause projects withisolatedModules: true
set from building Submitted by @kitten (See #99)⚠️ Fix schema pathname resolution in CLI Submitted by @wyattades (See #82)- Add
disableMasking
flag to allow fragment masking to be disabled. When this is set totrue
on thesetupSchema
interface, fragments won’t be masked, which imitates the behaviour you’d see when adding@_unmask
to every single one of your fragments. This is currently considered a preview feature Submitted by @kitten (See #69) - Keep the possible types that are iterated through narrow through repeated abstract type fragment spreads, and provide an optional
__typename?: PossibleType
field by default so the type checker has an exact property to merge types on Submitted by @kitten (See #102) - Handle inference of input object fields with missing
defaultValue
properties in introspection Submitted by @llllvvuu (See #101) - Add missing support for input object fields with default values. Previously, input object fields with default values were still marked as required in variables Submitted by @kitten (See #73)
- Refactor several internal utility types Submitted by @kitten (See #68)
- Updated dependencies (See #58)
- @gql.tada/cli-utils@0.1.0
- Remove type name constraint from
graphql.scalar
’s type name to improve type checking performance Submitted by @kitten (See #53) - Improve performance of several smaller types (Thank you, @deathemperor & @HaiNNT) Submitted by @kitten (See #51)
- Add
maskFragments
to cast data to fragment masks of a given set of fragments Submitted by @kitten (See #43) - Add
graphql.scalar()
utility to retrieve or type check the type of scalars and enums Submitted by @kitten (See #45) - Add
unsafe_readResult
to unsafely cast data to the result data of a given document Submitted by @kitten (See #43)
- Tighten up type strictness to not accept operation documents where fragment documents are expected Submitted by @kitten (See #41)
- Support
@_optional
and@_required
directives on fields overriding the field types. When used,@_required
can turn a nullable type into a non-nullable, and@_optional
can turn non-nullable fields into nullable ones. (See “Client-Controlled Nullability” in Graphcache for an example of a client implementing this.) Submitted by @kitten (See #32) - Add support for
@_unmask
directive on fragments causing the fragment type to not be masked.FragmentOf<>
will return the full result type of fragments when they’re annotated with@_unmask
and spreading these unmasked fragments into parent documents will use their full type Submitted by @kitten (See #31)
- Format
TadaDocumentNode
output’s third generic differently. The output of fragment definitions will now be more readable (e.g.{ fragment: 'Name', on: 'Type', masked: true }
) Submitted by @kitten (See #31) - Improve performance of selection and variables inference Submitted by @kitten (See #35)
- Improve performance of GraphQL document parser Submitted by @kitten (See #34)
- Prevent type inference for schemas with “huge” root types (i.e. types with an excessive amount of fields) from failing introspection mapping Submitted by @kitten (See #25)
- Remove redundant constraint on
IntrospectionQuery
data. When the full type is used as anextends
, the input type (which can be a huge schema), is checked against this type, which forces a full evaluation. This means that TypeScript may spend multiple seconds inrecursiveTypeRelatedTo
. This work has been eliminated and should help performance Submitted by @kitten (See #26)
⚠️ FixreadFragment()
not inferring the types of complex fragments, i.e. fragments that derive with a union type Submitted by @kitten (See #15)- Make
$tada.fragmentRefs
property required. Previously, this was optional (to mirror what GCG’s client-preset does). However, this can lead to invalid checks inreadFragment
, as it would be able to match types that don’t actually match the fragment refs Submitted by @kitten (See #18)
⚠️ Fix__typename
literal string not being exact and instead a union of possible types, when the__typename
field is put onto an abstract type’s selection set Submitted by @kitten (See #11)
Initial Release
gql.tada
is a GraphQL document authoring library, inferring the result and variables types
of GraphQL queries and fragments in the TypeScript type system. It derives the types for your
GraphQL queries on the fly allowing you to write type-safe GraphQL documents quickly.
To get started, check out the documentation’s “Get Started” section.