Commit graph

969 commits

Author SHA1 Message Date
Hugh Willson
dd86fa8a29 Re-enable Typescript esModuleInterop (#1699)
`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.
2018-09-21 16:43:33 +03:00
Tim Griesser
4175f1b9cd Allow an optional function to resolve the rootValue (#1555)
* 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
2018-09-20 11:47:40 -07:00
renovate[bot]
f2a4673006 chore(deps): update dependency graphql-tools to v4 (#1698) 2018-09-20 17:13:03 +03:00
Jesse Rosenberger
749538daee
Specify explicit cursorShape default for Playground options. (#1607)
* Specify explicit `cursorShape` to avoid missing cursor in GraphQL Playground.

This solves a problem with the text cursor caret not being visible in the
operation input box within GraphQL Playground by explicitly setting a
GraphQL Playground configuration option called `cursorShape` to `line`.

All credit for the actual solution goes to @lpellegr for their discovery in
https://github.com/prisma/graphql-playground/issues/790#issuecomment-409221277

* Update CHANGELOG.md
2018-09-20 17:12:11 +03:00
Jesse Rosenberger
6d6c9ff268
Make it more clear that generateClientInfo is an experimental API.
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
2018-09-20 12:11:56 +03:00
Evans Hauser
86dd95e223
Publish
- apollo-cache-control@0.2.5
 - apollo-engine-reporting@0.0.6
 - apollo-server-cloud-functions@2.1.0
 - apollo-server-cloudflare@2.1.0
 - apollo-server-core@2.1.0
 - apollo-server-express@2.1.0
 - apollo-server-hapi@2.1.0
 - apollo-server-integration-testsuite@2.1.0
 - apollo-server-koa@2.1.0
 - apollo-server-lambda@2.1.0
 - apollo-server-micro@2.1.0
 - apollo-server@2.1.0
 - apollo-tracing@0.2.5
 - graphql-extensions@0.2.1
2018-09-18 15:26:48 -07:00
Marcel Miranda Ackerman
e949ab6a72 Updated Google Cloud Function request handler to handle null or undefined req.path (#1674)
* Updated request handler to handle null or undefined req.path

* Added test for GCF handling request.path being null

* Updated Changelog

* Add note about checking for null path
2018-09-18 14:04:01 -07:00
Jake Dawkins
f3df370b0a Fix header misreporting to engine (#1689)
* fix header reporting being cut short

* added changelog entry & fix npm version
2018-09-18 13:29:54 -07:00
Evans Hauser
96af44e41a
Provide ability to specify client info in traces (#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
2018-09-17 22:45:34 -07:00
Evans Hauser
5adae649e3
Publish
- apollo-cache-control@0.2.4
 - apollo-engine-reporting@0.0.5
 - apollo-server-cloud-functions@2.0.4
 - apollo-server-cloudflare@2.0.5
 - apollo-server-core@2.0.7
 - apollo-server-express@2.0.7
 - apollo-server-hapi@2.0.7
 - apollo-server-integration-testsuite@2.0.7
 - apollo-server-koa@2.0.7
 - apollo-server-lambda@2.0.7
 - apollo-server-micro@2.0.7
 - apollo-server@2.0.8
 - apollo-tracing@0.2.4
 - graphql-extensions@0.2.0
2018-09-14 10:35:33 -07:00
nmchaves
e7823e8fc4 catch error if JSON.stringify fails for trace variables 2018-09-13 21:47:35 -07:00
nmchaves
7ac5a17e03 fix tslint errors (shadowed variable names) 2018-09-13 21:29:19 -07:00
Renovate Bot
3d3f155006 chore(deps): update dependency koa to v2.5.3 2018-09-12 04:07:48 +00:00
C.J. Winslow
408198e5ac Pass the context request and response extension methods (#1547)
* Pass the context along to all the extension methods

Addresses #1343 

With this change you should now be able to implement an extension like so:

```javascript
class MyErrorTrackingExtension extends GraphQLExtension {
    willSendResponse(o) {
        const { context, graphqlResponse } = o

        context.trackErrors(graphqlResponse.errors)

        return o
    }
}
```

Edit by @evans :
fixes #1343
fixes #614 as the request object can be taken from context or from requestDidStart
fixes #631 ""

* Remove context from extra extension functions

The context shouldn't be necessary for format, parse, validation, and
execute. Format generally outputs the state of the extension. Parse and
validate don't depend on the context. Execution includes the context
argument as contextValue

* Move change entry under vNext
2018-09-07 18:10:30 -07:00
Martijn Walraven
996c73063a Publish
- apollo-engine-reporting@0.0.4
 - apollo-server-cloud-functions@2.0.3
 - apollo-server-cloudflare@2.0.4
 - apollo-server-core@2.0.6
 - apollo-server-express@2.0.6
 - apollo-server-hapi@2.0.6
 - apollo-server-integration-testsuite@2.0.6
 - apollo-server-koa@2.0.6
 - apollo-server-lambda@2.0.6
 - apollo-server-micro@2.0.6
 - apollo-server@2.0.7
2018-09-05 17:33:16 +02:00
Martijn Walraven
3e98fefc49 Fix return statement required by TypeScript in apollo-server-micro 2018-09-05 17:13:03 +02:00
Dries Vandermeulen
4ab7bb3f1a Fix apolo-server-micro top level error response (#1619)
Fixes #1581.
2018-09-05 16:03:04 +02:00
Vincenzo Russo
88417b7398 Switch ApolloServerBase.schema from private access to protected access (#1610) 2018-09-05 16:02:06 +02:00
Evans Hauser
4a409766a5 Add toggle for including error messages in reports (#1615)
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.
2018-09-05 16:01:14 +02:00
Marcel Miranda Ackerman
1348933d33 Fix Google Cloud Functions tests (#1616)
Closes #1601.
2018-09-05 15:54:42 +02:00
Martijn Walraven
b80a8f050c Publish
- apollo-cache-control@0.2.3
 - apollo-datasource-rest@0.1.5
 - apollo-datasource@0.1.3
 - apollo-engine-reporting@0.0.3
 - apollo-server-cache-memcached@0.1.3
 - apollo-server-cache-redis@0.1.3
 - apollo-server-cloud-functions@2.0.2
 - apollo-server-cloudflare@2.0.3
 - apollo-server-core@2.0.5
 - apollo-server-env@2.0.3
 - apollo-server-express@2.0.5
 - apollo-server-hapi@2.0.5
 - apollo-server-integration-testsuite@2.0.5
 - apollo-server-koa@2.0.5
 - apollo-server-lambda@2.0.5
 - apollo-server-micro@2.0.5
 - apollo-server@2.0.6
 - apollo-tracing@0.2.3
 - graphql-extensions@0.1.3
2018-09-03 15:06:00 +02:00
Martijn Walraven
94ff82c636 Add apollo-server-integration-testsuite as devDependency to integration packages
This fixes ordering of tasks invoked through `lerna run`.
2018-09-03 14:47:25 +02:00
Martijn Walraven
7a472a3041 Make node-fetch extension properties optional 2018-09-02 12:01:13 +02:00
Shinya Ohira
6c44631657 Add node-fetch extensions typing (#1602) 2018-09-02 11:53:53 +02:00
Martijn Walraven
49d4ffb682 Augment typeDefs with cacheControl directive so SDL validation doesn't fail 2018-09-02 11:50:09 +02:00
Martijn Walraven
884d44e771 Use consistent range for graphql peer dependency 2018-09-02 11:50:09 +02:00
Renovate Bot
8b2adc49ad chore(deps): update dependency graphql to v14 2018-09-02 11:50:09 +02:00
Martijn Walraven
4bb6c74eea Remove stray devDependencies from packages 2018-09-01 14:48:30 +02:00
Martijn Walraven
3f595eb3de Use fly.io app env when available 2018-09-01 11:37:45 +02:00
Martijn Walraven
497b514511 Add processRequest to apollo-upload-server types 2018-09-01 11:37:45 +02:00
Martijn Walraven
ef67851997 Only require apollo-upload-server if uploads are enabled 2018-09-01 11:37:45 +02:00
Martijn Walraven
78d787908e Make apollo-server-env work with Cloudflare Workers and fly.io 2018-09-01 11:37:45 +02:00
Martijn Walraven
77064afa66 Add browser entry point to export globals from apollo-server-env 2018-09-01 11:37:45 +02:00
Yipeng Zhao
984c47d07a Use playground default settings when possible (#1516)
Playground can either use external settings or its default settings (browser settings), in incompatible ways. The original implementation of default settings here would always provide 'settings' for Playground, in turn make its own settings mechanism disabled, with consequences such as altering settings in-browser cannot work as expect. Besides, once the default settings here go different with Playground provided, it would cause other problems.

The intention here is to use Playground setting as default, while explicit passing Playground settings in Apollo server would still work with defaults defined here merged.
2018-09-01 09:50:10 +02:00
Rob Richard
23ee9ec53e Update default version of graphql-playground 2018-09-01 09:34:38 +02:00
Evans Hauser
2657e9b25b
Publish
- apollo-server-cloud-functions@2.0.1
 - apollo-server-cloudflare@2.0.2
 - apollo-server-core@2.0.4
 - apollo-server-express@2.0.4
 - apollo-server-hapi@2.0.4
 - apollo-server-integration-testsuite@2.0.4
 - apollo-server-koa@2.0.4
 - apollo-server-lambda@2.0.4
 - apollo-server-micro@2.0.4
 - apollo-server@2.0.5
2018-08-20 14:17:37 -07:00
Tim Griesser
99e4357537 Fix implicit any types in apollo-server-cloud-function (#1554) 2018-08-20 13:30:01 -07:00
Jesse Rosenberger
8347511db8 Switch to a fork of apollo-upload-server to fix missing core-js dependency. (#1556)
* Switch to a fork of `apollo-upload-server` to fix missing `core-js` dependency.

As reported in https://github.com/apollographql/apollo-server/issues/1542,
the `apollo-upload-server` package (v5.0.0, which `apollo-server` relies on)
is no longer able to provide a `core-js` package because of change that was
outside of its control in a Babel release.

The problem is resolved in newer versions of `apollo-upload-server`,
however, regrettably, the newer versions of that package (notably, v6 and
v7) drop support for Node.js 6 — one of two versions of Node.js that are
currently under the terms of the Node.js Foundation's Long-Term-Support
(LTS) agreements.

Since Apollo Server aims to support versions of Node.js which are under LTS
(and will drop support for Node.js 6 in April 2019, per Node.js' schedule)
the current, immediate solution is to fork the `apollo-upload-server`
package as `@apollographql/apollo-upload-server`.

With the inclusion of
https://github.com/apollographql/apollo-upload-server/pull/1, we are able to
keep supporting Node.js 6.  Without this change, every new installation
of `apollo-server`, which doesn't have a `package-lock.json` preventing
transitive dependency updates - specifically, the updates to
`@babel/runtime` versions newer than `-beta.56` - is broken.

* [squash] Update to `@apollographql/apollo-upload-server@5.0.2`.

* [squash] Update to `@apollographql/apollo-upload-server@5.0.3`.
2018-08-20 13:27:15 -07:00
Marcel Miranda Ackerman
724d9ff07d Implementation of Apollo Server 2 for Google Cloud Functions (#1446)
* Initial implementation of Apollo Server 2 for gcf

* First try at running with tests

* Updated naming

* Removed lambda mentions

* Simply use referer

* Updated README

* Updated Changelog

* Renamed gqlApollo to googleCloudApollo

* Added more details

* Removed extra check
2018-08-20 06:35:23 -04:00
Evans Hauser
b794c8d684
bump apollo-server package, due to bad build 2018-08-16 12:19:22 -07:00
Evans Hauser
3e54e60ced
Publish
- apollo-server-cloudflare@2.0.1
 - apollo-server-core@2.0.3
 - apollo-server-express@2.0.3
 - apollo-server-hapi@2.0.3
 - apollo-server-integration-testsuite@2.0.3
 - apollo-server-koa@2.0.3
 - apollo-server-lambda@2.0.3
 - apollo-server-micro@2.0.3
 - apollo-server@2.0.3
2018-08-16 11:40:49 -07:00
Curtis Layne
0f17f7c50e Pass payload into the context function for subscriptions (#1513)
* Pass payload into the context function for subscriptions

The payload can be used for things like auth. You can pass a token on
the payload of the message and use it to fetch the user.

* Update CHANGELOG.md
2018-08-16 11:26:39 -07:00
Evans Hauser
efc5302930
Add option to mock the entire schema(i.e. set preserveResolvers) (#1546)
* add mockEntireSchema as configuration for preserveResolvers

* add mockEntireSchema to api reference

* add changelog
2018-08-16 11:21:13 -07:00
Martijn Walraven
a88574d731 Publish
- apollo-datasource-rest@0.1.4
 - apollo-server-cloudflare@2.0.0
2018-08-15 05:54:45 +02:00
Martijn Walraven
42bec5687f Only cache successful responses when overriding TTL
Fixes #1481.
2018-08-15 05:47:44 +02:00
Evans Hauser
f7b5d63d03
Publish
- apollo-cache-control@0.2.2
 - apollo-datasource-rest@0.1.3
 - apollo-datasource@0.1.2
 - apollo-engine-reporting-protobuf@0.0.1
 - apollo-engine-reporting@0.0.2
 - apollo-server-cache-memcached@0.1.2
 - apollo-server-cache-redis@0.1.2
 - apollo-server-caching@0.1.2
 - apollo-server-cloudflare@2.0.0-rc.14
 - apollo-server-core@2.0.2
 - apollo-server-env@2.0.2
 - apollo-server-errors@2.0.2
 - apollo-server-express@2.0.2
 - apollo-server-hapi@2.0.2
 - apollo-server-integration-testsuite@2.0.2
 - apollo-server-koa@2.0.2
 - apollo-server-lambda@2.0.2
 - apollo-server-micro@2.0.2
 - apollo-server@2.0.2
 - apollo-tracing@0.2.2
 - graphql-extensions@0.1.2
2018-08-14 11:49:10 -07:00
Evans Hauser
ef82add05b
Publish
- apollo-cache-control@0.2.1
 - apollo-datasource-rest@0.1.2
 - apollo-datasource@0.1.1
 - apollo-engine-reporting-protobuf@0.0.0
 - apollo-engine-reporting@0.0.1
 - apollo-server-cache-memcached@0.1.1
 - apollo-server-cache-redis@0.1.1
 - apollo-server-caching@0.1.1
 - apollo-server-cloudflare@2.0.0-rc.13
 - apollo-server-core@2.0.1
 - apollo-server-env@2.0.1
 - apollo-server-errors@2.0.1
 - apollo-server-express@2.0.1
 - apollo-server-hapi@2.0.1
 - apollo-server-integration-testsuite@2.0.1
 - apollo-server-koa@2.0.1
 - apollo-server-lambda@2.0.1
 - apollo-server-micro@2.0.1
 - apollo-server@2.0.1
 - apollo-tracing@0.2.1
 - graphql-extensions@0.1.1
2018-08-14 11:05:31 -07:00
Jim (_nderscore)
412be208c1 Fixed GraphQL Playground with custom configuration in production. (#1495)
* Fixed support for GraphQL Playground with custom configuration in production environments.

* Updated logic in `createPlaygroundOptions` to cast the `playground` option to a boolean
  if it is defined. Fall back to `isDev` logic only if undefined.
* Updated unit test for partial graphql playground options to emulate a 'production'
  environment, mimicking the scenario that was broken before.

* Add PR #1495 to CHANGELOG.

* Restore partial playground options test when no `NODE_ENV`
2018-08-14 10:43:52 -07:00
Robin van der Vleuten
989481fea8 Allow additional Hapi route options to be passed (#1384)
* Allow additional route options to be passed

* Updated changelog with PR
2018-08-14 10:26:13 -07:00
Sashko Stubailo
8ca7380347 Look in event.path first when selecting endpoint for GraphQL Playground on Lambda, and check for null (#1527)
* Look in event.path first, and check for null

See here: https://docs.aws.amazon.com/lambda/latest/dg/eventsources.html#eventsources-api-gateway-request

* Add to changelog
2018-08-13 15:58:23 -04:00