Commit graph

972 commits

Author SHA1 Message Date
Jesse Rosenberger
034383f491
Consistently use parent, rather than root, as first resolver argument.
In an effort to maintain consistency and semantically correct meaning,
this changes (only in documentation and internal Apollo Server tests) the
name of the first argument in resolver signatures to use `parent` rather
than `root`.

While `root` certainly makes sense when the resolver is belonging to the
root `Query` or `Mutation` type, once nested field resolvers begin getting
called, the more semantically correct term would seem to be `parent`.

Since `parent` still makes sense at the root level, and since resolvers
frequently get copied and pasted into more deeply-nested positions, putting
this pattern in place for apps which are just beginning might just help
someone more clearly understand the relationship in the future — without
incorrectly thinking that a nested resolver is accessing the root of the
graph, rather than the parent.
2018-11-16 20:37:26 +02:00
Monday Chen
10dfda2092 Fix connect integration sample code (#1973) 2018-11-16 13:35:42 +02:00
limerick
94f10eb68f fix: Avoid GraphQL Playground default assignment. (#1578)
Due to a number of other assignments within `createPlaygroundOptions`, the default is still maintained and the `playground` configuration parameter should be entirely optional.
2018-11-16 12:22:57 +02:00
Adam Zionts
81d9f4719e aer/Default to headers for client identity in
lolwut

Revert "lolwut"

This reverts commit 03a2e101f6c25b46f0bdaf0e7578ab03a5ed7dad.
2018-11-13 17:36:38 -08:00
Jesse Rosenberger
47676e0cd9
Publish
- apollo-cache-control@0.3.2
 - apollo-engine-reporting@0.1.2
 - apollo-server-azure-functions@2.2.2
 - apollo-server-cloud-functions@2.2.2
 - apollo-server-cloudflare@2.2.2
 - apollo-server-core@2.2.2
 - apollo-server-express@2.2.2
 - apollo-server-hapi@2.2.2
 - apollo-server-integration-testsuite@2.2.2
 - apollo-server-koa@2.2.2
 - apollo-server-lambda@2.2.2
 - apollo-server-micro@2.2.2
 - apollo-server-plugin-base@0.1.2
 - apollo-server-testing@2.2.2
 - apollo-server@2.2.2
 - apollo-tracing@0.3.2
 - graphql-extensions@0.3.2
2018-11-13 15:58:57 +02:00
Jesse Rosenberger
629ab68172
Fix TypeScript typing and improve message in async introspection query check.
Ref: #1955
2018-11-13 15:55:03 +02:00
Jesse Rosenberger
e90e955f80
Follow up on #1955's incorrect then-able check.
I foolishly used `O.p.hasOwnProperty` here which, while safe for checking
properties, is actually not correct since this `then` property is inherited
from `Promise.prototype.then`.

Checking if `then` is a function should be safe _enough_.

Follows-up on: #1955
2018-11-13 12:42:01 +02:00
Jesse Rosenberger
c82cdec9b5
Throw an error on asynchronous introspection query behavior. (#1955)
We expect introspection queries to behave in an synchronous manner since
they do not have any resolvers which return Promises.  This expectation
seems to also be had by `graphql-js` which utilizes `graphqlSync`, rather
than `graphql` for execution of introspection queries.  In fact, this may be
one of the entire reasons that `graphqlSync` exists: to fulfill a contract
for synchronous execution of server introspection.  The introspection tests
within `graphql-js` seem to support this theory[[0]].

Utilities which wrap GraphQL resolvers should take care to maintain the
execution dynamics of what they are wrapping, or they should avoid wrapping
introspection types entirely by checking the type with the
`isIntrospectionType` predicate function from `graphql/type`[[1]].

[0]: 787422956c/src/type/__tests__/introspection-test.js
[1]: https://github.com/graphql/graphql-js/blob/74d1e941/src/type/introspection.js#L484.
Closes: https://github.com/apollographql/apollo-server/issues/1935
2018-11-13 12:11:56 +02:00
Martijn Walraven
26d6c73950 Update @apollographql/apollo-tools dependency to 0.2.6
Fixes #1951, apollographql/apollo-tooling#687.
2018-11-13 10:02:09 +01:00
Evan Lucas
59af364aa3 ApolloServer: fix uploads error message (#1820)
There was a typo in the error message.
2018-11-12 06:04:11 -08:00
renovate[bot]
3ed9e4ced7 chore(deps): update dependency prettier to v1.15.2 (#1949)
* chore(deps): update dependency prettier to v1.15.2

* (lint) Fix desires of new `prettier` patch version, v1.15.2.

Ref: https://github.com/apollographql/apollo-server/pull/1949
2018-11-12 06:01:52 -08:00
Martijn Walraven
20eb2e9e03 Publish
- apollo-cache-control@0.3.1
 - apollo-engine-reporting@0.1.1
 - apollo-server-azure-functions@2.2.1
 - apollo-server-cloud-functions@2.2.1
 - apollo-server-cloudflare@2.2.1
 - apollo-server-core@2.2.1
 - apollo-server-express@2.2.1
 - apollo-server-hapi@2.2.1
 - apollo-server-integration-testsuite@2.2.1
 - apollo-server-koa@2.2.1
 - apollo-server-lambda@2.2.1
 - apollo-server-micro@2.2.1
 - apollo-server-plugin-base@0.1.1
 - apollo-server-testing@2.2.1
 - apollo-server@2.2.1
 - apollo-tracing@0.3.1
 - graphql-extensions@0.3.1
2018-11-12 14:26:26 +01:00
Jesse Rosenberger
b61dee310b
Add correct project references for apollo-server-cloud-functions. (#1948)
* Add correct project references for `apollo-server-cloud-functions`.

The `apollo-server-cloud-functions` has been been mis-referenced (or
referenced inconsistently) since its original inception in #1446 when its
package directory was `apollo-server-cloud-function` (singular!) and the
`package.json` referenced the plural form (`apollo-server-cloud-functions`):

https://github.com/apollographql/apollo-server/commit/724d9ff0#diff-e1d725fd66f7e9ef5251abf0437a09ca

These references have been mostly fixed in the READMEs and supporting
documentation, but the underlying monorepo directory structure has still not
been fixed, which I'm sure contributed to this module being overlooked and
unreferenced in the move to TypeScript project references in #1772.

Additionally, the lack of referencing in the monorepo's TS config has
resulted in it being broken in the most recent 2.2.0 release, as reported by
@pyros2097 and @thetre97 in: https://github.com/apollographql/apollo-server/pull/1896#issuecomment-436994955

This should fix that by properly adding the TypeScript project references.

* Sorting.
2018-11-12 05:13:04 -08:00
Jesse Rosenberger
d36eea0f84 typings: Improvements for apollo-server-testing's createTestClient. (#1943)
The `createTestClient` should receive either a `query` or a `mutation`, but
not both.
2018-11-10 20:48:43 -08:00
Renovate Bot
87b4833926 chore(deps): update dependency koa to v2.6.2 2018-11-10 09:54:48 +00:00
Jesse Rosenberger
95a2ee53d0
More prettier changes. 2018-11-09 16:08:58 -08:00
Jesse Rosenberger
dc20485bd5
Prettier updates from the prettier bump.
Ah yes, the subtle side-effects of an opinionated linter evolving over time.
2018-11-09 15:44:41 -08:00
Martijn Walraven
40f3660e23 Fix relative import to use the proper apollo-tools package 2018-11-09 09:23:29 -08:00
Martijn Walraven
8c9666d4d7 Update apollo-tools dependency 2018-11-09 09:12:51 -08:00
Martijn Walraven
e4a55498f8 Collect fields and pass these to resolveObject() 2018-11-09 05:49:58 -08:00
Martijn Walraven
8f6481e60f Add modules option to ApolloServer 2018-11-09 05:07:08 -08:00
Martijn Walraven
bb67584a22 Add support for resolveObject to query execution 2018-11-09 05:07:07 -08:00
Peter
d81ae051e7 Update README.md with the latest package name (#1936) 2018-11-08 16:29:18 -08:00
Divyendu Singh
0d6b8f24e6 Update README.md (#1938) 2018-11-08 14:53:18 -08:00
Martijn Walraven
6bd73b175f Publish
- apollo-cache-control@0.3.0
 - apollo-datasource-rest@0.2.0
 - apollo-datasource@0.2.0
 - apollo-engine-reporting-protobuf@0.1.0
 - apollo-engine-reporting@0.1.0
 - apollo-server-azure-functions@2.2.0
 - apollo-server-cache-memcached@0.2.0
 - apollo-server-cache-redis@0.2.0
 - apollo-server-caching@0.2.0
 - apollo-server-cloud-functions@2.2.0
 - apollo-server-cloudflare@2.2.0
 - apollo-server-core@2.2.0
 - apollo-server-env@2.2.0
 - apollo-server-errors@2.2.0
 - apollo-server-express@2.2.0
 - apollo-server-hapi@2.2.0
 - apollo-server-integration-testsuite@2.2.0
 - apollo-server-koa@2.2.0
 - apollo-server-lambda@2.2.0
 - apollo-server-micro@2.2.0
 - apollo-server-plugin-base@0.1.0
 - apollo-server-testing@2.2.0
 - apollo-server@2.2.0
 - apollo-tracing@0.3.0
 - graphql-extensions@0.3.0
2018-11-07 08:17:21 -08:00
Jesse Rosenberger
3eada89827
Publish
- apollo-server-azure-functions@2.2.0-alpha.4
2018-11-06 16:38:19 -08:00
Jesse Rosenberger
e1e126fc76
For lerna. 2018-11-06 16:24:23 -08:00
Jesse Rosenberger
6346be3a6f
Publish
- apollo-server-azure-functions@2.2.0-alpha.4
2018-11-06 16:03:16 -08:00
Jesse Rosenberger
0b1f887db2
Lower version of apollo-server-azure-functions to publish correct version via lerna. 2018-11-06 16:02:39 -08:00
Michael Watson
6c87cbc291 Correct name of Azure implementation to match original name. (#1926) 2018-11-06 13:46:33 -08:00
Jesse Rosenberger
79fe6bf0bf
Publish
- apollo-server-azure-function@2.2.0-alpha.4
 - apollo-server-cloud-functions@2.2.0-alpha.4
 - apollo-server-cloudflare@2.2.0-alpha.4
 - apollo-server-core@2.2.0-alpha.4
 - apollo-server-express@2.2.0-alpha.4
 - apollo-server-hapi@2.2.0-alpha.4
 - apollo-server-integration-testsuite@2.2.0-alpha.4
 - apollo-server-koa@2.2.0-alpha.4
 - apollo-server-lambda@2.2.0-alpha.4
 - apollo-server-micro@2.2.0-alpha.4
 - apollo-server-plugin-base@0.1.0-alpha.4
 - apollo-server-testing@2.2.0-alpha.4
 - apollo-server@2.2.0-alpha.4
 - graphql-extensions@0.3.0-alpha.4
2018-11-06 11:33:35 -08:00
Jesse Rosenberger
52f210dcdd
Bump apollo-server-azure-functions to 2.2.0-alpha.3 to align versions. 2018-11-06 11:32:03 -08:00
Leonid Buneev
5b64cf9160 apollo-server-azure-function v2 implementation. (#1753)
Closes #1752.
2018-11-06 11:28:25 -08:00
Jesse Rosenberger
25cbd3ad61
Don't require a plugin to subclass ApolloServerPlugin.
To avoid problems frequently associated with subclassing, and the possible
versioning ergonomics of subclassing the wrong version, this changes the
plugin infrastructure to no longer require subclassing the abstract class.
2018-11-06 10:01:52 -08:00
Jesse Rosenberger
5ca4c07bd5
Publish
- apollo-cache-control@0.3.0-alpha.3
 - apollo-engine-reporting-protobuf@0.1.0-alpha.3
 - apollo-engine-reporting@0.1.0-alpha.3
 - apollo-server-cloud-functions@2.2.0-alpha.3
 - apollo-server-cloudflare@2.2.0-alpha.3
 - apollo-server-core@2.2.0-alpha.3
 - apollo-server-express@2.2.0-alpha.3
 - apollo-server-hapi@2.2.0-alpha.3
 - apollo-server-integration-testsuite@2.2.0-alpha.3
 - apollo-server-koa@2.2.0-alpha.3
 - apollo-server-lambda@2.2.0-alpha.3
 - apollo-server-micro@2.2.0-alpha.3
 - apollo-server-plugin-base@0.1.0-alpha.3
 - apollo-server-testing@2.2.0-alpha.3
 - apollo-server@2.2.0-alpha.3
 - apollo-tracing@0.3.0-alpha.3
 - graphql-extensions@0.3.0-alpha.3
2018-11-05 21:36:39 -08:00
Jesse Rosenberger
58711be91a
Bump apollo-engine-reporting-protobuf to align prerelease version suffix. 2018-11-05 21:22:20 -08:00
James Baxley
3d69124340 change clientId => clientReportingId and schemaBranch => schemaTag (#1921)
@abernix this should be a lot more clear 👍
2018-11-05 21:18:25 -08:00
Jesse Rosenberger
a6872c2f6c
Publish
- apollo-cache-control@0.3.0-alpha.2
 - apollo-datasource-rest@0.2.0-alpha.2
 - apollo-datasource@0.2.0-alpha.2
 - apollo-engine-reporting@0.1.0-alpha.2
 - apollo-server-cache-memcached@0.2.0-alpha.2
 - apollo-server-cache-redis@0.2.0-alpha.2
 - apollo-server-caching@0.2.0-alpha.2
 - apollo-server-cloud-functions@2.2.0-alpha.2
 - apollo-server-cloudflare@2.2.0-alpha.2
 - apollo-server-core@2.2.0-alpha.2
 - apollo-server-express@2.2.0-alpha.2
 - apollo-server-hapi@2.2.0-alpha.2
 - apollo-server-integration-testsuite@2.2.0-alpha.2
 - apollo-server-koa@2.2.0-alpha.2
 - apollo-server-lambda@2.2.0-alpha.2
 - apollo-server-micro@2.2.0-alpha.2
 - apollo-server-plugin-base@0.1.0-alpha.2
 - apollo-server-testing@2.2.0-alpha.2
 - apollo-server@2.2.0-alpha.2
 - apollo-tracing@0.3.0-alpha.2
 - graphql-extensions@0.3.0-alpha.2
2018-11-05 11:45:46 -08:00
Jesse Rosenberger
c5e1760894
Adjust apollo-server-testing to start at 2.2.0-alpha.2. 2018-11-05 11:43:15 -08:00
Jesse Rosenberger
d7d4495b7b
(perf) Stop adding the checkOperationPlugin on every request.
This was causing the `checkOperationPlugin` to be added to the list of
plugins to be executed, thus resulting in an additional plugin pass (of the
same plugin) for each request.

1st request = 1 plugin
2nd request = 2 of the same plugin
3rd request = 3 of the same plugin

Obviously, this was not intended.
2018-11-05 11:23:26 -08:00
Jake Dawkins
e3d5be954f Introduce apollo-server-testing package. (#1909) 2018-11-05 11:22:30 -08:00
Jesse Rosenberger
422609e621
Merge pull request #1900 from apollographql/abernix/preserve-typescript-2-compat
Preserve TypeScript 2 Backwards compatibility until Semver Major
2018-11-05 07:14:45 -08:00
Jesse Rosenberger
0dfa8ed39b
(compat) Avoid TypeScript 3.x features to maintain backwards compatibility.
This mostly reverts fd34771841 along with a
number of slight adjustments to avoid other typing luxuries which were
introduced with TypeScript 3.x.

While the generic `ServerOptionFunction` types and `HandlerArguments`
generic rest argument type were certainly welcome additions to the codebase,
they present a backwards compatibility problem for consumers of Apollo
Server who have not yet made the jump to TypeScript 3.x.

With any luck, when we bump the major version of Apollo Server to 3.x, and
in accordance with semantic versioning, we'll be in the position to
straight-up revert this commit.
2018-11-05 05:24:32 -08:00
Tomáš Szabo
abbe382785 Make mocking configuration less confusing. (#1835)
* Make mocking configuration less confusing.
Setting mocks to false will always disable mocking.

* Updated CHANGELOG
2018-10-30 09:14:12 -07:00
Jesse Rosenberger
64e9099f86
Export CloudFunctionGraphQLOptionsFunction type, like other integrations.
This wasn't currently being exported, but this in-between commit will make
sure that the commit which follows this can be reverted without
inadvertently dropping this export.
2018-10-30 12:50:18 +02:00
Jesse Rosenberger
b98191c431
Avoid Function.prototype.bind when invoking createGraphQLServerOptions.
By avoiding this pattern, we can maintain better typing for users of
TypeScript 2.8, which didn't maintain typings when passing through
`Function.prototype.bind` calls.

Also, personally, this just appears to be more readable.
2018-10-30 12:34:43 +02:00
Andre Eberhardt
52da28d6b1 Fix apollo-server-cache delete implementation for both redis and memcached (#1891) 2018-10-29 11:25:09 +02:00
Jesse Rosenberger
5b83883233
Publish
- apollo-cache-control@0.3.0-alpha.1
 - apollo-datasource-rest@0.2.0-alpha.1
 - apollo-datasource@0.2.0-alpha.1
 - apollo-engine-reporting-protobuf@0.1.0-alpha.1
 - apollo-engine-reporting@0.1.0-alpha.1
 - apollo-server-cache-memcached@0.2.0-alpha.1
 - apollo-server-cache-redis@0.2.0-alpha.1
 - apollo-server-caching@0.2.0-alpha.1
 - apollo-server-cloud-functions@2.2.0-alpha.1
 - apollo-server-cloudflare@2.2.0-alpha.1
 - apollo-server-core@2.2.0-alpha.1
 - apollo-server-env@2.1.0-alpha.1
 - apollo-server-express@2.2.0-alpha.1
 - apollo-server-hapi@2.2.0-alpha.1
 - apollo-server-integration-testsuite@2.2.0-alpha.1
 - apollo-server-koa@2.2.0-alpha.1
 - apollo-server-lambda@2.2.0-alpha.1
 - apollo-server-micro@2.2.0-alpha.1
 - apollo-server-plugin-base@0.1.0-alpha.1
 - apollo-server@2.2.0-alpha.1
 - apollo-tracing@0.3.0-alpha.1
 - graphql-extensions@0.3.0-alpha.1
2018-10-26 21:28:15 +03:00
Jesse Rosenberger
bcfd76ceed
Add missing dependency on graphql-playground-html to apollo-server-core. 2018-10-26 20:39:23 +03:00
James Baxley
8b918e5bb6 fix failing test for default branch name 2018-10-26 20:19:30 +03:00