* Fix the example for "Using an Existing Schema"
The file caused the following error:
```
const gql = String.raw;
^
SyntaxError: Identifier 'gql' has already been declared
```
* Update migration-two-dot.md
* Update migration-two-dot.md
`esModuleInterop` was enabled in
e4164c8892
to help with importing from packages that use default exports.
Those changes were reverted in
https://github.com/apollographql/apollo-server/pull/1210
to work around a few reported issues. Those issues are no longer
relevant, so this commit re-enables `esModuleInterop`, and
updates all default imports to use the more common (standard)
import syntax.
* Incorrect sample codes
```const { ApolloServer } = require('apollo-server');```
should be
```const { ApolloServer, gql } = require('apollo-server');```
The functions in `mocks` would be used when no resolver in `resolvers` is specified only when `mockEntireSchema: false`.
* Update mocking.md
Change the documentation to be correct, indicating that the mocks overwrite the resolvers
* Allow an optional function to resolve the rootValue
Passes the parsed DocumentNode AST to determine the root value,
useful when providing a different rootValue for query vs mutation
* Add API docs for rootValue
On version 3.1.1 there is an error ( `Error: Invalid schema passed` ) when wrapping the `linkTypeDefs` in `gql`. Passing the plain string the example works.
The `generateClientInfo` API, used to set client identification attributes
within traces, is an experimental API and is subject to removal or change in
a future (major) Apollo Server release.
Ref: #1631
* Provide ability to specify client info in traces
Adds the createClientInfo to apollo-engine-reporting, which enables the
differentiation of clients based on the request, operation, and
variables. This could be extended to include the response. However for
the first release. It doesn't quite make sense.
* Use extensions and context in createClientInfo
* Remove support for clientAddress
The frontend will not support it in the near future
* create -> generate and make default generator
createClientInfo -> generateClientInfo
* Clarify default values
Fixes#1613.
We always send traces that includes an error node if the trace has an
error. In the case that sending errors is disabled, we replace the
message and remove the location.
Note that the Engine proxy strips all error information from the traces
with noErrorTraces set. To get errors to show up in the ui, the proxy
sends error counts inside of the aggregated stats reports. To get
similar behavior inside of the apollo server metrics reporting, we
always send a trace and mask out the PII.
* docs: Correct path for GraphQL Playground.
This corrects the documentation which incorrectly stated that the message on the console would include `http://localhost:4000/graphql`.
While the `/graphql` URL will also serve the GraphQL Playground, it's only working as a by-product of of `/graphql` being included within the (higher) `/` path. (That is to say that `/any-url` would also respond!).
* [squash] Tweak per feedback.
cc @evans
This corrects the headings to be properly tiered/nested within each other, rather than having "2.0" at the same level as its features.
It also makes some slight wording changes, but more are to follow.