1.0.0 • Published 12 months ago
@graphql-tools/documents v1.0.0
@graphql-tools/documents
Utilities for GraphQL documents.
Install
yarn install @graphql-tools/documents
Contents
Print GraphQL Documents
A stable way to print a GraphQL document. All executable/fragment variable definitions, fields are printed in a stable way. Useful for stuff like persisted GraphQL operations.
Usage
import { parse } from 'graphql'
import { printExecutableGraphQLDocument } from '@graphql-tools/documents'
const inputDocument = parse(/* GraphQL */ `
query A {
... on Query {
a {
...B
b
}
}
... on Query {
a {
...B
a
}
}
}
fragment B on Query {
c
}
`)
const outputStr = printExecutableGraphQLDocument(inputDocument)
console.assert(
outputStr === 'fragment B on Query { c } query A { ... on Query { a { a ...B } } ... on Query { a { b ...B } } }',
'Stuff is not equal.'
)
Rules
- Fragments are always printed before executable operations
- Executable operations are sorted alphabetically by name.
- Arguments (Directive, Fields) are sorted alphabetical
- Selections sets are sorted Field, FragmentSpread, InlineFragmentSpread (sorted based on TypeCondition, inner SelectionSet)
1.0.0-alpha-20230517124706-cfe11c10
12 months ago
1.0.0
12 months ago
1.0.0-alpha-20230518015511-1595bc81
12 months ago
1.0.0-rc-20230517125140-6b16e710
12 months ago
1.0.0-alpha-20230518084344-389b1397
12 months ago
1.0.0-rc-20230519015308-f93ea91d
12 months ago
1.0.0-alpha-20230517162914-c9b3c81c
12 months ago
1.0.0-alpha-20230518163937-ec682d56
12 months ago
1.0.0-alpha-20230517123108-df347e95
12 months ago
1.0.0-alpha-20230518210711-0e51a149
12 months ago
1.0.0-rc-20230519104627-f6fea064
12 months ago
1.0.0-rc-20230519104353-b09f3180
12 months ago
1.0.0-rc-20230518084244-1053d643
12 months ago
1.0.0-alpha-20230518083908-57102758
12 months ago
1.0.0-alpha-20230517124048-55208565
12 months ago
1.0.0-alpha-20230517212118-f09767ef
12 months ago
1.0.0-alpha-20230518053230-3bdd3d8d
12 months ago
1.0.0-rc-20230518085242-b3a813e9
12 months ago
1.0.0-alpha-20230519000249-b153667f
12 months ago
0.1.0
1 year ago
0.1.0-alpha-20230117140344-a66a6c52
1 year ago
0.1.0-alpha-20230116131331-c8add6ee
1 year ago
0.1.0-alpha-20230109070606-edcfa527
1 year ago
0.1.0-alpha-20230109070251-4be4b310
1 year ago
0.1.0-alpha-20230109070017-99ec0546
1 year ago