Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge graphql-tools-fork into v5 #1307

Merged
merged 249 commits into from Mar 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
249 commits
Select commit Hold shift + click to select a range
91b150e
Fix tests
yaacovCR Apr 14, 2019
8eb0359
[fix] allow renaming of subscription root fields
yaacovCR Apr 15, 2019
d783d78
[feat] Add transformers to rename, filter, and arbitrarily transform …
yaacovCR May 21, 2019
d7ce4e8
lint
yaacovCR Jun 2, 2019
97d8fe6
feat(errors): Pass through all possible errors.
hwillson Mar 9, 2019
9fda499
fix(stitching): fix regression
yaacovCR Jun 13, 2019
c7f82ac
feat(stitching): restore onTypeConflict option to mergeSchemas
yaacovCR Jun 16, 2019
c4ddfcc
fix(stitching): nested enums
yaacovCR Jun 16, 2019
c662bea
perf(stitching): remove unnecessary map
yaacovCR Jun 16, 2019
21c1486
chore(lint)
yaacovCR Jun 16, 2019
ddbeb9a
fix(stitching): serialize/deserialize enum/custom scalar values
stefanprobst Mar 9, 2019
59418ed
docs: update index
yaacovCR Jun 18, 2019
d627b3c
docs(dedeprecate)
yaacovCR Jun 18, 2019
c6567e7
fix(stitching): add default value support
yaacovCR Jun 27, 2019
169fad4
fix(stitching): Directive disappears when enum has resolvers
kamilkisiela Jun 12, 2019
5abdaf0
fix(stitching): fix legacy custom scalar recreation to more closely m…
yaacovCR Jun 28, 2019
4e6616e
feat(deps): upgrade dependencies to latest minor version.
yaacovCR Jun 28, 2019
773f765
fix(stitching): include specified directives even when merging of dir…
yaacovCR Jun 30, 2019
6600d5d
fix(stitching): fix reparsing of lists
yaacovCR Jun 30, 2019
b41896f
chore(lint)
yaacovCR Jun 30, 2019
46083a2
fix(stitching): fix default resolver to execute field if specified as…
yaacovCR Jul 1, 2019
5f6a5f3
fix(stitching): fix lists of enum and custom scalars, closes #9
yaacovCR Jul 3, 2019
dd5abab
fix(stitching): do not convert falsy values to null.
yaacovCR Jul 5, 2019
39fc007
fix(mocking): to work with schema stitching
yaacovCR Jul 9, 2019
230af75
fix(stitching): support stitching unions of types with enums
yaacovCR Jul 19, 2019
490e433
feat(stitching): allow delegateToSchema, mergeSchemas and transformSc…
yaacovCR Jul 23, 2019
c5571fb
fix(types): export OnTypeConflict type
yaacovCR Jul 25, 2019
194e467
feat(transformers): TransformQuery transformer adds errorPathTransfor…
yaacovCR Jul 29, 2019
c3d7cae
feat(transforms): add dedicated filterSchema function to allow schema…
yaacovCR Jul 31, 2019
8c82178
feat(transforms): map object fields to new structures
yaacovCR Aug 7, 2019
1c25e12
fix(stitching): fixes error mapping with ExtendSchema transform. Also…
yaacovCR Aug 16, 2019
9af1ec5
fix(stitching): map errors along schema transformation path when extr…
yaacovCR Aug 18, 2019
d5e54ad
fix(stitching): input fields without default value
bconnorwhite Aug 19, 2019
a88f667
fix(transforms): support custom scalar input variables on root fields…
yaacovCR Aug 26, 2019
339c569
chore(deps): upgrade dependencies.
yaacovCR Aug 27, 2019
bde8e53
chore(style): do not import from index
yaacovCR Sep 1, 2019
80d196c
fix(generate): addResolversToSchema should update enums and scalars o…
yaacovCR Sep 1, 2019
e3b04d0
fix(healSchema): healing schema requires reparsing default field valu…
yaacovCR Sep 2, 2019
71e2459
fix(healSchema): revert most recent change
yaacovCR Sep 3, 2019
49ee536
fix(transforms): VisitSchemaKind.TYPE should have greatest priority
yaacovCR Sep 4, 2019
bd2363b
fix(visitSchema): new interfaces should not break schema.
yaacovCR Sep 8, 2019
ad4e23a
refactor: create utils folder
yaacovCR Sep 8, 2019
ef14f8d
refactor: move underlying healSchema implementation to utils
yaacovCR Sep 9, 2019
6f313bd
refactor(visitSchema): remove transforms visitSchema reference
yaacovCR Sep 9, 2019
a2f407f
chore: label blocking issue
yaacovCR Sep 9, 2019
11104f0
feat(cloning): export methods to shallow clone types and directives a…
yaacovCR Sep 9, 2019
771f310
chore(deps): drop support for graphql 14.0 and 14.1
yaacovCR Sep 10, 2019
faad819
refactor(transforms): export wrapSchema
yaacovCR Sep 11, 2019
c6b5470
feat(filterSchema): provide type argument to type filter
yaacovCR Sep 12, 2019
c7f3a13
refactor: move stub type methods to utils
yaacovCR Sep 12, 2019
538461e
fix(cloneSchema): healSchema requires a new array for object interfac…
yaacovCR Sep 12, 2019
b55bc82
refactor: rewrite transforms visitSchema to use cloneSchema and healT…
yaacovCR Sep 12, 2019
cf69bd8
refactor: deprecate stripResolvers argument for transforms visitSchema
yaacovCR Sep 12, 2019
ce77e4d
refactor: use graphql toConfig() instead of fieldToFieldConfig
yaacovCR Sep 12, 2019
ecf3066
refactor: use cloneType and healTypeMap within mergeSchemas instead o…
yaacovCR Sep 13, 2019
d52e4f6
refactor: rename healTypeMap to healTypes
yaacovCR Sep 14, 2019
567967f
refactor: organize utils
yaacovCR Sep 14, 2019
0854ed5
refactor: rename pruneTypeMap
yaacovCR Sep 15, 2019
cfc3db7
refactor: all visiting requires healing
yaacovCR Sep 15, 2019
68bf8cb
feat(visitSchema): export consolidated visitSchema method
yaacovCR Sep 15, 2019
1b49371
refactor: remove unnecessary transforms
yaacovCR Sep 15, 2019
bf39855
fix(cloneSchema): cloneSchema should preserve extensions
yaacovCR Sep 15, 2019
0150e02
fix(visitSchema): visitSchema must reinitialize private variables whe…
yaacovCR Sep 17, 2019
0b2ddb8
fix(filterSchema): should not modify original schema.
yaacovCR Sep 17, 2019
0eec7b5
fix(stitching): observabeToAsyncIterator should preserve graphql errors
yaacovCR Sep 18, 2019
aa5728b
fix(release): broken npmignore
yaacovCR Sep 19, 2019
3965da5
refactor(delegateToSchema): refactor away delegateToRemoteSchema
yaacovCR Sep 19, 2019
39fe30b
refactor(mergeSchemas): simplify createDelegatingResolver
yaacovCR Sep 19, 2019
4c78947
refactor(delegateToSchema): do not add empty args
yaacovCR Sep 19, 2019
e8ee6bb
chore(tests): mocha not found with graphql 14.2
yaacovCR Sep 22, 2019
01d99f4
refactor(schemaRecreation): deprecate most of schema recreation now t…
yaacovCR Sep 22, 2019
f2d9b1c
chore(lint)
yaacovCR Sep 22, 2019
52ca30f
chore(experimentalFragmentVariables): fix test, clarify use case.
yaacovCR Sep 24, 2019
3f79614
fix(remote schemas): must add __typename to remote query to properly …
yaacovCR Sep 24, 2019
b4df9ad
fix(delegateToSchema): fix typo breaking refactoring
yaacovCR Sep 24, 2019
3352229
docs(delegateToSchema): update use cases and defaultMergedResolver usage
yaacovCR Sep 24, 2019
19295f3
chore(tests): add tests for cloneSchema
yaacovCR Sep 25, 2019
9cb29df
feat(utils): getResolversFromSchema
yaacovCR Sep 26, 2019
686d9d5
fix(transforms): should work with remote schema execution config.
yaacovCR Oct 3, 2019
6572568
lint(resolveFromParentTypename): use same name even for default import
yaacovCR Oct 3, 2019
50d8250
refactor(healSchema): schema recreation should be part of all healing
yaacovCR Oct 3, 2019
9e87082
feat(WrapType): add WrapType transform
yaacovCR Oct 3, 2019
a9a6ff6
fix(transforms): to properly allow chaining.
yaacovCR Oct 6, 2019
c3abc07
refactor: remove unused composeTransforms function
yaacovCR Oct 6, 2019
52128a3
fix(types): enforce VisitSchemaKind enum
yaacovCR Oct 11, 2019
9a5b06a
feat(RenameTypes): remove extra result traversal
yaacovCR Oct 3, 2019
eca442f
fix(docs): use delegateToSchema
yaacovCR Oct 13, 2019
8c9f6cd
fix(docs): expands transforms docs
yaacovCR Oct 13, 2019
70fceca
fix(RenameTypes): add required arg
yaacovCR Oct 13, 2019
47cbda7
fix(deps): correct graphql peer dependency.
yaacovCR Oct 20, 2019
24d17bb
refactor(mergeSchemas): consolidate code
yaacovCR Oct 24, 2019
a1296f3
refactor(mergeSchemas): remove variable
yaacovCR Oct 24, 2019
775747e
refactor(utils): consolidate more utils.
yaacovCR Oct 24, 2019
15c24eb
feat(mergeSchemas): allow transform specification
yaacovCR Oct 25, 2019
d978ef6
refactor(subschemas): improve delegation workflow
yaacovCR Nov 4, 2019
d7e7b8b
fix(stitching): pass along more errors
yaacovCR Nov 6, 2019
d2173f3
fix(stitching): change merged result format
yaacovCR Nov 7, 2019
300f86d
refactor(handleResult): remove some extra logic checks.
yaacovCR Nov 7, 2019
743bc30
refactor(handleNull): refactor to handleErrors
yaacovCR Nov 7, 2019
18c03b8
fix(stitching): latest fix breaks zeros
yaacovCR Nov 7, 2019
fb45bbb
fix(stitching): don't annotate primitives
yaacovCR Nov 7, 2019
52104a9
feat(mergeTypes): initial version
yaacovCR Nov 8, 2019
16fa015
refactor(stitching): resolveFromParentTypename
yaacovCR Nov 19, 2019
7b33988
feat(stitching): precompile fragment replacements
yaacovCR Nov 19, 2019
1ad6015
feat(mergeTypes): adds abiliity to merge types
yaacovCR Nov 20, 2019
a4ec882
fix(stitching): add test
yaacovCR Nov 27, 2019
a5a9a1a
fix(transforms): cloneSchema prior to transformSchema
yaacovCR Nov 27, 2019
5b1790d
refactor(TransformObjectFields)
yaacovCR Nov 27, 2019
8d5e29f
refactor(Object Transform tests)
yaacovCR Dec 1, 2019
aa79488
refactor(tests): run all tests
yaacovCR Dec 3, 2019
8dbc188
refactor(addTypenameToAbstract)
yaacovCR Dec 3, 2019
06f9d5e
refactor(FilterToSchema)
yaacovCR Dec 3, 2019
ca8382a
lint(types): lint type definition.
yaacovCR Dec 5, 2019
ba609d2
refactor(fieldNodes)
yaacovCR Dec 5, 2019
cf12fdf
fix(stitching): improve error proxying for lists
yaacovCR Dec 9, 2019
db10787
fix(WrapType): fix root type edge case
yaacovCR Dec 9, 2019
378e8b5
fix(handleList): missing context
yaacovCR Dec 10, 2019
332c758
fix(stitching): wrapping and hoisting field transforms
yaacovCR Dec 15, 2019
c95345a
refactor(transforms): streamline with upstream
yaacovCR Dec 15, 2019
738f129
refactor(createMergedResolver)
yaacovCR Dec 17, 2019
2d6e9c9
refactor(tests)
yaacovCR Dec 17, 2019
e00d693
feat(WrapFields): add new transform
yaacovCR Dec 19, 2019
83d00ac
chore(deps): update minor versions
yaacovCR Dec 19, 2019
90c3565
fix(stitching): filter unused variables from map
yaacovCR Dec 25, 2019
bb6c443
lint
yaacovCR Dec 25, 2019
e286205
fix(filterToSchema): remove map in favor of plain object
yaacovCR Dec 26, 2019
6a25db3
feat(stitching): enable proxying uploads
yaacovCR Dec 26, 2019
6252261
chore(changelog): update vNext
yaacovCR Dec 31, 2019
d13bd2b
lint
yaacovCR Dec 31, 2019
00925cc
refactor(tests): group tests wrapping fields
yaacovCR Dec 31, 2019
472ad97
refactor(FilterObjectFields)
yaacovCR Jan 2, 2020
0d4e8eb
fix(TransformObjectFields/MapFields): allow more transformations
yaacovCR Jan 2, 2020
4483f00
refactor(TransformObjectFields): do not modify info object
yaacovCR Jan 2, 2020
348cc1b
refactor(RenameTypes): simplify recursive method
yaacovCR Jan 2, 2020
dffc7eb
fix(wrapping): wrapped field names must be unique.
yaacovCR Jan 5, 2020
898d421
feat(transforms): add HoistField transform
yaacovCR Jan 6, 2020
144548f
refactor(addResolveFunctionsToSchema)
yaacovCR Jan 6, 2020
415b5d4
refactor(resolvers)
yaacovCR Jan 6, 2020
bea9d69
chore(types)
yaacovCR Jan 6, 2020
6033344
refactor(handleObject): consolidate
yaacovCR Jan 8, 2020
285274d
refactor(hoisting)
yaacovCR Jan 8, 2020
0db56d7
fix(stitching): custom scalars/enums
yaacovCR Jan 9, 2020
9e5fc5b
refactor(testUpload)
yaacovCR Jan 9, 2020
e51d11f
refactor(stitching): type merging
yaacovCR Jan 13, 2020
0bd4528
refactor(subSchema): rename to subschema
yaacovCR Jan 13, 2020
491c9dd
fix(stitching): do not make sync delegation async
yaacovCR Jan 15, 2020
4f3a0b7
fix(healing): empty types should be pruned even if fields of those ty…
yaacovCR Jan 16, 2020
bcb04ba
feat(stitching): add returnType option to delegateToSchema
yaacovCR Jan 16, 2020
3fecf4e
feat(stitching): export createDelegatingRequest and delegateRequest m…
yaacovCR Jan 16, 2020
2b3896f
refactor(ResolveFunctions)
yaacovCR Jan 16, 2020
9d74412
refactor(mergeTypes): provide flag
yaacovCR Jan 16, 2020
3a23a63
refactor(stitching)
yaacovCR Jan 19, 2020
8754452
fix(transforms): refactor TransformRootFields to allow flexible trans…
yaacovCR Jan 20, 2020
60e04d6
refactor(transforms): standardize sourceSchema argument
yaacovCR Jan 20, 2020
54b6a9c
fix(delegateToSchema): standardize args format
yaacovCR Jan 20, 2020
dedb1ae
chore(deps): remove unused dependency
yaacovCR Jan 21, 2020
cefa4db
chore(deps): upgrade deps
yaacovCR Jan 21, 2020
d5f1a9a
refactor(AddArgumentsAsVariables): to AddArguments
yaacovCR Jan 21, 2020
bd907f9
refactor(AddArguments): transform not necessary
yaacovCR Jan 22, 2020
2a142e5
refactor(delegateToSchema): organize imports
yaacovCR Jan 22, 2020
284eca3
fix(delegateRequest)
yaacovCR Jan 22, 2020
aecf495
feat(stitching): support advanced type merging
yaacovCR Jan 23, 2020
5790c6b
fix(stitching): add arguments as variables
yaacovCR Jan 26, 2020
fb23115
refactor(createRequest): split into separate file
yaacovCR Jan 26, 2020
6e8cad0
refactor(updateArguments): linting
yaacovCR Jan 26, 2020
5831e92
fix(merging): use proper collectFields when possible
yaacovCR Jan 27, 2020
cd357be
feat(merging): check subschema rather than fragment for merging
yaacovCR Jan 27, 2020
be89138
feat(delegation): selectionSet option
yaacovCR Jan 29, 2020
6030507
feat(merging): allow keys for merged types to also include subfields
yaacovCR Jan 30, 2020
3a1560f
fix(merging): fixes merging for non root types
yaacovCR Jan 30, 2020
86fa099
refactor(addMockFunctionsToSchema)
yaacovCR Jan 30, 2020
33647bf
refactor(delegationTransforms)
yaacovCR Jan 30, 2020
ce834ff
docs(transforms):
yaacovCR Jan 30, 2020
9e3048c
feat(merging): set up default mergeTypeResolver
yaacovCR Jan 30, 2020
6a58a18
feat(merging): merge additional types besides GraphQLObjectTypes
yaacovCR Feb 1, 2020
89fa13f
fix(stitching): pass context
yaacovCR Feb 4, 2020
1c0a27d
fix(generation): allow modification of default scalar types
yaacovCR Feb 6, 2020
f89df7f
chore(linting): switch from tslint to eslint
yaacovCR Feb 13, 2020
9367443
chore(deps): upgrade dependencies
yaacovCR Feb 13, 2020
6fdb6f6
chore(remove) tslint
yaacovCR Feb 13, 2020
dde3be7
chore(lint): pin eslint-plugin-import to 2.22.0
yaacovCR Feb 13, 2020
a99ae19
chore(prettier): use prettier!
yaacovCR Feb 13, 2020
ac51b57
chore(ci): attempt to fix coverage and ci workflow
yaacovCR Feb 13, 2020
cd944d0
chore(ci): add releaseonly option
yaacovCR Feb 13, 2020
55a15ef
fix(transformSchema): handle schemaConfig objects
yaacovCR Feb 16, 2020
8ff2fda
chore(lint): fix a few eslint issues
yaacovCR Feb 16, 2020
a47550a
feat(graphql): initial v15 support.
yaacovCR Feb 16, 2020
9a0186c
chore(test): fix graphql v14 test
yaacovCR Feb 16, 2020
e05dec7
feat(graphql): interfaces implementing interfaces
yaacovCR Feb 16, 2020
dcf18bd
fix(ci): fix types
yaacovCR Feb 17, 2020
1f1ec07
fix(typo): caused by prettier?
yaacovCR Feb 17, 2020
a509d3e
fix(typescript): remove dom requirement
yaacovCR Feb 17, 2020
3b46556
chore(deps): remove unnecessary dependency
yaacovCR Feb 19, 2020
e00003a
chore(deps): remove dev dependency
yaacovCR Feb 24, 2020
74ba001
chore(deps): support graphql v0.12 and above
yaacovCR Feb 27, 2020
0f50240
chore(deps): upgrade deps
yaacovCR Feb 27, 2020
21f9509
chore(ci): upgrade to nyc
yaacovCR Feb 27, 2020
5180bfb
chore(ci): explicitly test minor versions
yaacovCR Feb 28, 2020
5fdb8d2
fix(ci): properly polyfill graphql v14.1 and 14.2
yaacovCR Feb 28, 2020
02098e0
chore(graphql-js): use toConfig if available
yaacovCR Feb 28, 2020
97c584a
fix(instanceof): use graphql predicates
yaacovCR Mar 1, 2020
2be5d53
fix(mergeSchemas): remove unnecessarily healing
yaacovCR Mar 1, 2020
8d0e666
fix(extendSchema): adjust polyfill
yaacovCR Mar 1, 2020
ac81da8
feat(RenameRootTypes): add new transform
yaacovCR Mar 6, 2020
bad75aa
fix(stitching): do not reproxy a nested root field
yaacovCR Mar 6, 2020
210662c
feat(stitching): allow specification of custom root object names
yaacovCR Mar 6, 2020
86d0a6c
fix(RenameRootTypes): to work when stitching
yaacovCR Mar 8, 2020
98964d0
feat(mapSchema): initial version
yaacovCR Mar 9, 2020
5f85c76
fix(tests): use toConfig polyfill for all tests
yaacovCR Mar 9, 2020
39f2a28
fix(toConfig): touch up types
yaacovCR Mar 10, 2020
fcbb674
fix(mapSchema): fix rewiring
yaacovCR Mar 10, 2020
ed5d610
refactor(cloneSchema): to use mapSchema without any mappers
yaacovCR Mar 10, 2020
041d2ab
fix(MapperKind): export MapperKind
yaacovCR Mar 10, 2020
54c04e0
fix(mapSchema): fix rewiring
yaacovCR Mar 10, 2020
a59345b
refactor(filterSchema): to use mapSchema
yaacovCR Mar 10, 2020
61047fd
refactor(FilterTypes): to use mapSchema
yaacovCR Mar 10, 2020
62d8554
refactor(RenameRootTypes): to use mapSchema
yaacovCR Mar 10, 2020
d8eec05
refactor(TransformObjectFields): to use mapSchema
yaacovCR Mar 10, 2020
121b3e1
chore(RenameTypes): add comment for visitSchema
yaacovCR Mar 10, 2020
a1a2129
chore(tests): add failing test
yaacovCR Mar 11, 2020
17229f5
fix(mapSchema): rewire directives last
yaacovCR Mar 11, 2020
fa2a1d4
fix(SchemaDirectiveVisitor): visit directives added via extend
yaacovCR Mar 12, 2020
78d454b
refactor(types): remove a few unknown types
yaacovCR Mar 12, 2020
f0cee57
refactor(mapSchema)
yaacovCR Mar 12, 2020
1a6da66
refactor(tests): to use mocks rather than remote schema
yaacovCR Mar 12, 2020
d0c5b78
fix(tests): v12 and v13 extensionASTNode support
yaacovCR Mar 12, 2020
0317114
refactor(RenameTypes): to use mapSchema
yaacovCR Mar 12, 2020
b8f145a
refactor(organize): folders and types
yaacovCR Mar 20, 2020
9ccb825
refactor(npmignore): into package.json
yaacovCR Mar 20, 2020
d994577
fix(tests): v15 test failure
yaacovCR Mar 22, 2020
d09b778
chore(prettier)
yaacovCR Mar 22, 2020
2abda1b
fix(toConfig): accept field or inputField as arguments
yaacovCR Mar 22, 2020
f53371f
fix(transforms): fix nested field name changes
yaacovCR Mar 23, 2020
279aa27
fix(toConfig): in older versions of graphql
yaacovCR Mar 23, 2020
06bc62d
chore(prettier)
yaacovCR Mar 23, 2020
390f699
fix(addResolveFunctionsToSchema): return modified schema
yaacovCR Mar 23, 2020
0116a1b
refactor(MapFields): using TransformObjectFields
yaacovCR Mar 23, 2020
96be791
refactor(transforms): collect wrapping transforms
yaacovCR Mar 23, 2020
41e4271
refactor(imports): do not import from folder
yaacovCR Mar 23, 2020
e8b68e7
refactor(wrap): move wrapping resolvers
yaacovCR Mar 23, 2020
1f0c77f
chore(deps): upgrade deps
yaacovCR Mar 23, 2020
6414242
chore(git): line endings
yaacovCR Mar 24, 2020
29fbb0d
feat(transforms): add interface transforms
yaacovCR Mar 24, 2020
9da8f60
refactor(transforms): remove unnecessary exports
yaacovCR Mar 24, 2020
6f1dea4
refactor: use field toConfig when possible
yaacovCR Mar 24, 2020
d91447b
fix(delegation): fix argument/variable bugs
yaacovCR Mar 25, 2020
7dcd006
fix(stitching): delegateToSchema args specification
yaacovCR Mar 26, 2020
0b1477c
docs(fix): remove fork reference
yaacovCR Mar 26, 2020
3224224
fix(delegation): do not override null defaults
yaacovCR Mar 27, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
507 changes: 507 additions & 0 deletions .eslintrc.yml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions .gitattributes
@@ -0,0 +1 @@
* text=auto eol=lf
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -11,3 +11,6 @@ package-lock.json
npm-debug.log*
yarn-debug.log*
yarn-error.log*

.eslintcache
.nyc_output
9 changes: 0 additions & 9 deletions .npmignore

This file was deleted.

30 changes: 25 additions & 5 deletions .travis.yml
@@ -1,18 +1,38 @@
language: node_js
node_js:
- "8"
- "13"
- "12"
- "10"

env:
- GRAPHQL_VERSION='0.12'
- GRAPHQL_VERSION='0.13'
- GRAPHQL_VERSION='14.0'
- GRAPHQL_VERSION='14.1'
- GRAPHQL_VERSION='14.2'
- GRAPHQL_VERSION='14.3'
- GRAPHQL_VERSION='14.4'
- GRAPHQL_VERSION='14.5'
- GRAPHQL_VERSION='14.6'
- GRAPHQL_VERSION='rc'

install:
- npm config set spin=false
- npm install -g coveralls
- npm install

script:
- npm test
- npm run lint
- node_version=$(node -v); if [[ ${node_version:1:2} == "13" && $GRAPHQL_VERSION == "14.6" ]]; then
npm run lint;
fi
- node_version=$(node -v); if [[ ${node_version:1:2} == "13" && $GRAPHQL_VERSION == "14.6" ]]; then
npm run prettier:check;
fi
- npm run compile
- npm install graphql@$GRAPHQL_VERSION
- npm run testonly:cover

after_success:
- npm run coverage
- coveralls < ./coverage/lcov.info || true # if coveralls doesn't have it covered

# Allow Travis tests to run in containers.
sudo: false
32 changes: 32 additions & 0 deletions CHANGELOG.md
Expand Up @@ -2,6 +2,32 @@

### Next

#### Features

* Adds [graphql-upload](https://github.com/jaydenseric/graphql-upload) compatible scalar and link for proxying remote file uploads #671
* Add ability to merge fields from types from different schemas
* Adds transforms to wrap, extract, and rename fields #1183
* Adds transform to filter object fields #819
* Exports visitSchema, SchemaVisitor, healSchema, healTypes, cloneSchema, cloneType, cloneDirective to enable more custom transforms. #1070
* Allows removing extra delegation layers by passing fetcher/link options directly to delegateToSchema, mergeSchemas, and transformSchema and by filtering directly with filterSchema without additional transformation round #1165

#### Bug Fixes

* Filter unused variables from map when proxying requests
* Preserve subscription errors when using makeRemoteExecutableSchema
* Preserve extensions when transforming schemas
* Fix merging and transforming of custom scalars and enums #501, #1056, #1200
* Allow renaming of subscription root fields #997, #1002
* Fix alias resolution to no longer incorrectly fallback to non-aliased field when null #1171
* Do not remove default directives (skip, include, deprecated) when not merging custom directives #1159
* Fixes errors support #743, #1037, #1046
* Fix mergeSchemas to allow resolvers to return fields defined as functions #1061
* Fix default values with mergeSchemas and addResolveFunctionsToSchema #1121
* Fix interface and union healing
* Fix stitching unions of types with enums
* Fix mocking to work when schema stitching
* Fix lost directives when adding an enum resolver

### 4.0.7

* Filter `extensions` prior to passing them to `buildASTSchema`, in an effort to provide minimum compatibilty for `graphql@14`-compatible schemas with the upcoming `graphql@15` release. This PR does not, however, bring support for newer `graphql@15` features like interfaces implementing interfaces. [#1284](https://github.com/apollographql/graphql-tools/pull/1284)
Expand All @@ -20,6 +46,12 @@
[@freiksenet](https://github.com/freiksenet) in [#1003](https://github.com/apollographql/graphql-tools/pull/1003)
* Allow user-provided `buildSchema` options. <br/>
[@trevor-scheer](https://github.com/trevor-scheer) in [#1154](https://github.com/apollographql/graphql-tools/pull/1154)
* Fix `delegateToSchema` to allow delegation to subscriptions with different root field names, allows
the use of the `RenameRootFields` transform with subscriptions,
pull request [#1104](https://github.com/apollographql/graphql-tools/pull/1104), fixes
[#997](https://github.com/apollographql/graphql-tools/issues/997). <br/>
* Add transformers to rename, filter, and arbitrarily transform object fields. <br/>
Fixes [#819](https://github.com/apollographql/graphql-tools/issues/819).

### 4.0.4

Expand Down
6 changes: 3 additions & 3 deletions designs/connectors.md
Expand Up @@ -9,7 +9,7 @@ This document is intended as a design document for people who want to write conn
This is a draft at the moment, and not the final document. Chances are that the spec will change as we learn about the better ways to build GraphQL servers. It should be pretty close to the final version though, so if you want to get started and build connectors for specific backends, this document is a good starting point.


Technically you could write a GraphQL server without connectors and models by writing all your logic directly into the resolve functions, but in most cases that's not ideal. Connectors and models are a way of organizing code in a GraphQL server, and you should use them to keep your server modular. If the need arises, you can always write optimized queries directly in your resolvers or models.
Technically you could write a GraphQL server without connectors and models by writing all your logic directly into the resolvers, but in most cases that's not ideal. Connectors and models are a way of organizing code in a GraphQL server, and you should use them to keep your server modular. If the need arises, you can always write optimized queries directly in your resolvers or models.

Let's use an example schema, because it's always easier to explain things with examples:
```
Expand Down Expand Up @@ -60,7 +60,7 @@ Both batching and caching are more important in GraphQL than in traditional endp

Models are the glue between connectors - which are backend-specific - and GraphQL types - which are app-specific. They are very similar to models in ORMs, such as Rails' Active Record.

Let's say for example that you have two types, Author and Post, which are both stored in MySQL. Rather than calling the MySQL connector directly from your resolve functions, you should create models for Author and Post, which use the MySQL connector. This additional level of abstraction helps separate the data fetching logic from the GraphQL schema, which makes reusing and refactoring it easier.
Let's say for example that you have two types, Author and Post, which are both stored in MySQL. Rather than calling the MySQL connector directly from your resolvers, you should create models for Author and Post, which use the MySQL connector. This additional level of abstraction helps separate the data fetching logic from the GraphQL schema, which makes reusing and refactoring it easier.

In the example schema above, the Authors model would have the following methods:
```
Expand Down Expand Up @@ -150,7 +150,7 @@ app.use('/graphql', apolloServer({
});
```

Step 4: Calling models in resolve functions
Step 4: Calling models in resolvers
```
function resolve(author, args, ctx){
return ctx.models.Author.getById(author.id, ctx);
Expand Down
6 changes: 3 additions & 3 deletions designs/graphql-decorator-spec.md
Expand Up @@ -73,9 +73,9 @@ Decorators can be selectively applied to:
* A specific field
* An argument

Decorators can modify the behavior of the parts of the schema they are applied to. Sometimes that requires modifying other parts of the schema. For instance, the @validateRange decorator modifies the behavior of the containing field's resolve function.
Decorators can modify the behavior of the parts of the schema they are applied to. Sometimes that requires modifying other parts of the schema. For instance, the @validateRange decorator modifies the behavior of the containing field's resolver.

In general, decorators either add, remove or modify an attribute of the thing they wrap. The most common type of decorator (e.g. @adminOnly, @log, @connector) will wrap one or more field's resolve functions to alter the execution behavior of the GraphQL schema, but other decorators (e.g. @description) may add attributes to a type, field or argument. It is also possible for a type decorator to add a field to the type (e.g. @id(fields: ["uuid"]) can add the __id field).
In general, decorators either add, remove or modify an attribute of the thing they wrap. The most common type of decorator (e.g. @adminOnly, @log, @connector) will wrap one or more field resolvers to alter the execution behavior of the GraphQL schema, but other decorators (e.g. @description) may add attributes to a type, field or argument. It is also possible for a type decorator to add a field to the type (e.g. @id(fields: ["uuid"]) can add the __id field).


## Schema decorator API
Expand Down Expand Up @@ -120,7 +120,7 @@ class SampleFieldDecorator extends SchemaDecorator {
return (wrappedThing, { schema, type, field, context }) => {
// use this.config ...
// use args
// modify wrappedThing's properties, resolve functions, etc.
// modify wrappedThing's properties, resolvers, etc.
}
}
}
Expand Down
2 changes: 0 additions & 2 deletions docs/source/directive-resolvers.md
Expand Up @@ -2,7 +2,6 @@
## Directive example

Let's take a look at how we can create `@upper` Directive to upper-case a string returned from resolve on Field
[See a complete runnable example on Launchpad.](https://launchpad.graphql.com/p00rw37qx0)

To start, let's grab the schema definition string from the `makeExecutableSchema` example [in the "Generating a schema" article](/generate-schema/#example).

Expand Down Expand Up @@ -65,7 +64,6 @@ graphql(schema, query).then((result) => console.log('Got result', result));
## Multi-Directives example

Multi-Directives on a field will be apply with LTR order.
[See a complete runnable example on Launchpad.](https://launchpad.graphql.com/nx945rq1x7)

```js
// graphql-tools combines a schema string with resolvers.
Expand Down
8 changes: 3 additions & 5 deletions docs/source/generate-schema.md
Expand Up @@ -7,8 +7,6 @@ The graphql-tools package allows you to create a GraphQL.js GraphQLSchema instan

## Example

[See the complete live example in Apollo Launchpad.](https://launchpad.graphql.com/1jzxrj179)

When using `graphql-tools`, you describe the schema as a GraphQL type language string:

```js
Expand Down Expand Up @@ -212,14 +210,14 @@ const jsSchema = makeExecutableSchema({

- `parseOptions` is an optional argument which allows customization of parse when specifying `typeDefs` as a string.

- `allowUndefinedInResolve` is an optional argument, which is `true` by default. When set to `false`, causes your resolve functions to throw errors if they return undefined, which can help make debugging easier.
- `allowUndefinedInResolve` is an optional argument, which is `true` by default. When set to `false`, causes your resolver to throw errors if they return undefined, which can help make debugging easier.

- `resolverValidationOptions` is an optional argument which accepts an `ResolverValidationOptions` object which has the following boolean properties:
- `requireResolversForArgs` will cause `makeExecutableSchema` to throw an error if no resolve function is defined for a field that has arguments.
- `requireResolversForArgs` will cause `makeExecutableSchema` to throw an error if no resolver is defined for a field that has arguments.

- `requireResolversForNonScalar` will cause `makeExecutableSchema` to throw an error if a non-scalar field has no resolver defined. Setting this to `true` can be helpful in catching errors, but defaults to `false` to avoid confusing behavior for those coming from other GraphQL libraries.

- `requireResolversForAllFields` asserts that *all* fields have a valid resolve function.
- `requireResolversForAllFields` asserts that *all* fields have valid resolvers.

- `requireResolversForResolveType` will require a `resolveType()` method for Interface and Union types. This can be passed in with the field resolvers as `__resolveType()`. False to disable the warning.

Expand Down
6 changes: 3 additions & 3 deletions docs/source/index.mdx
Expand Up @@ -3,13 +3,13 @@ title: graphql-tools
description: A set of utilities to build your JavaScript GraphQL schema in a concise and powerful way.
---

GraphQL Tools is an npm package and an opinionated structure for how to build a GraphQL schema and resolvers in JavaScript, following the GraphQL-first development workflow.
GraphQL Tools is an npm package and an opinionated structure for how to build a GraphQL schema and resolvers in JavaScript, following the GraphQL-first development workflow, authored originally by the Apollo team.

```txt
npm install graphql-tools graphql
```

Functions in the `graphql-tools` package are not just useful for building servers. They can also be used in the browser, for example to mock a backend during development or testing.
Functions in the `graphql-tools` packages are not just useful for building servers. They can also be used in the browser, for example to mock a backend during development or testing.

Even though we recommend a specific way of building GraphQL servers, you can use these tools even if you don't follow our structure; they work with any GraphQL-JS schema, and each tool can be useful on its own.

Expand All @@ -24,5 +24,5 @@ JavaScript GraphQL servers are often developed with `graphql-tools` and `apollo-
This package enables a specific workflow for developing a GraphQL server, where the GraphQL schema is the first thing you design, and acts as the contract between your frontend and backend. It's not necessarily for everyone, but it can be a great way to get a server up and running with a very clear separation of concerns. These concerns are aligned with Facebook's direction about the best way to use GraphQL, and our own findings after thinking about the best way to architect a JavaScript GraphQL API codebase.

1. **Use the GraphQL schema language.** The [official GraphQL documentation](http://graphql.org/learn/schema/) explains schema concepts using a concise and easy to read language. The [getting started guide](http://graphql.org/graphql-js/) for GraphQL.js now uses the schema to introduce new developers to GraphQL. `graphql-tools` enables you to use this language alongside with all of the features of GraphQL including resolvers, interfaces, custom scalars, and more, so that you can have a seamless flow from design to mocking to implementation. For a more complete overview of the benefits, check out Nick Nance's talk, [Managing GraphQL Development at Scale](https://www.youtube.com/watch?v=XOM8J4LaYFg).
2. **Separate business logic from the schema.** As Dan Schafer covered in his talk, [GraphQL at Facebook](https://medium.com/apollo-stack/graphql-at-facebook-by-dan-schafer-38d65ef075af#.jduhdwudr), it's a good idea to treat GraphQL as a thin API and routing layer. This means that your actual business logic, permissions, and other concerns should not be part of your GraphQL schema. For large apps, we suggest splitting your GraphQL server code into 4 components: Schema, Resolvers, Models, and Connectors, which each handle a specific part of the work.
2. **Separate business logic from the schema.** As Dan Schafer covered in his talk, [GraphQL at Facebook](https://medium.com/apollo-stack/graphql-at-facebook-by-dan-schafer-38d65ef075af#.jduhdwudr), it's a good idea to treat GraphQL as a thin API and routing layer. This means that your actual business logic, permissions, and other concerns should not be part of your GraphQL schema. For large apps, we suggest splitting your GraphQL server code into 4 components: Schema, Resolvers, Models, and Connectors, which each handle a specific part of the work. You can see this in action in the server part of our [GitHunt example app](https://github.com/apollostack/GitHunt-API/blob/master/api/schema.js).
3. **Use standard libraries for auth and other special concerns.** There's no need to reinvent the login process in GraphQL. Every server framework already has a wealth of technologies for auth, file uploads, and more. It's prudent to use those standard solutions even if your data is being served through a GraphQL endpoint, and it is okay to have non-GraphQL endpoints on your server when it's the most practical solution.
24 changes: 12 additions & 12 deletions docs/source/mocking.md
Expand Up @@ -14,7 +14,7 @@ Let's take a look at how we can mock a GraphQL schema with just one line of code
To start, let's grab the schema definition string from the `makeExecutableSchema` example [in the "Generating a schema" article](/generate-schema/#example).

```js
import { makeExecutableSchema, addMockFunctionsToSchema } from 'graphql-tools';
import { makeExecutableSchema, addMocksToSchema } from 'graphql-tools';
import { graphql } from 'graphql';

// Fill this in with the schema string
Expand All @@ -24,7 +24,7 @@ const schemaString = `...`;
const schema = makeExecutableSchema({ typeDefs: schemaString });

// Add mocks, modifies schema in place
addMockFunctionsToSchema({ schema });
addMocksToSchema({ schema });

const query = `
query tasksForUser {
Expand Down Expand Up @@ -126,13 +126,13 @@ You can read some background and flavor on this approach in our blog post, ["Moc

## Mocking interfaces

You will need resolvers to mock interfaces. By default [`addMockFunctionsToSchema`](#addmockfunctionstoschema) will overwrite resolver functions.
You will need resolvers to mock interfaces. By default [`addMocksToSchema`](#addmockfunctionstoschema) will overwrite resolver functions.
By setting the property `preserveResolvers` on the options object to `true`, the type resolvers will be preserved.

```js
import {
makeExecutableSchema,
addMockFunctionsToSchema
addMocksToSchema
} from 'graphql-tools'
import mocks from './mocks' // your mock functions

Expand Down Expand Up @@ -188,7 +188,7 @@ const schema = makeExecutableSchema({
typeResolvers
})

addMockFunctionsToSchema({
addMocksToSchema({
schema,
mocks,
preserveResolvers: true
Expand All @@ -209,24 +209,24 @@ import * as introspectionResult from 'schema.json';

const schema = buildClientSchema(introspectionResult);

addMockFunctionsToSchema({schema});
addMocksToSchema({schema});
```

## API

### addMockFunctionsToSchema
### addMocksToSchema

```js
import { addMockFunctionsToSchema } from 'graphql-tools';
import { addMocksToSchema } from 'graphql-tools';

addMockFunctionsToSchema({
addMocksToSchema({
schema,
mocks: {},
preserveResolvers: false,
});
```

Given an instance of GraphQLSchema and a mock object, `addMockFunctionsToSchema` modifies the schema in place to return mock data for any valid query that is sent to the server. If `mocks` is not passed, the defaults will be used for each of the scalar types. If `preserveResolvers` is set to `true`, existing resolve functions will not be overwritten to provide mock data. This can be used to mock some parts of the server and not others.
Given an instance of GraphQLSchema and a mock object, `addMocksToSchema` modifies the schema in place to return mock data for any valid query that is sent to the server. If `mocks` is not passed, the defaults will be used for each of the scalar types. If `preserveResolvers` is set to `true`, existing resolvers will not be overwritten to provide mock data. This can be used to mock some parts of the server and not others.

### MockList

Expand All @@ -247,7 +247,7 @@ import { mockServer } from 'graphql-tools';
// or a GraphQLSchema object (eg the result of `buildSchema` from `graphql`)
const schema = `...`

// Same mocks object that `addMockFunctionsToSchema` takes above
// Same mocks object that `addMocksToSchema` takes above
const mocks = {}
preserveResolvers = false

Expand All @@ -262,6 +262,6 @@ server.query(query, variables)
})
```

`mockServer` is just a convenience wrapper on top of `addMockFunctionsToSchema`. It adds your mock resolvers to your schema and returns a client that will correctly execute
`mockServer` is just a convenience wrapper on top of `addMocksToSchema`. It adds your mock resolvers to your schema and returns a client that will correctly execute
your query with variables. **Note**: when executing queries from the returned server,
`context` and `root` will both equal `{}`.