Skip to content

Commit

Permalink
Merge branch 'release-vNEXT' into abernix/throw-when-uploads-on-pre-n…
Browse files Browse the repository at this point in the history
…ode-8.5
  • Loading branch information
abernix committed Dec 4, 2018
2 parents fe2d597 + 5497fb2 commit abb8dc5
Show file tree
Hide file tree
Showing 27 changed files with 109 additions and 71 deletions.
Binary file removed .DS_Store
Binary file not shown.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@ junit.xml

# Node modules
node_modules/

# Mac OS
.DS_Store
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changelog

### vNEXT
### v2.3.0-alpha

- **BREAKING FOR NODE.JS <= 8.5.0 ONLY**: To continue using Apollo Server 2.x in versions of Node.js prior to v8.5.0, file uploads must be disabled by setting `uploads: false` on the `ApolloServer` constructor options. Without explicitly disabling file-uploads, the server will `throw` at launch (with instructions and a link to our documentation).

Expand All @@ -9,6 +9,14 @@
While Node.js 6.x is covered by a [Long Term Support agreement by the Node.js Foundation](https://github.com/nodejs/Release#release-schedule) until April 2019, there are substantial performance (e.g. [V8](https://v8.dev/) improvements) and language changes (e.g. "modern" ECMAScript support) offered by newer Node.js engines (e.g. 8.x, 10.x). We encourage _all users_ of Apollo Server to update to newer LTS versions of Node.js prior to the "end-of-life" dates for their current server version.

**We intend to drop support for Node.js 6.x in the next major version of Apollo Server.**

### v2.2.7-beta.0

- `apollo-engine-reporting`: When multiple instances of `apollo-engine-reporting` are loaded (an uncommon edge case), ensure that `encodedTraces` are handled only once rather than once per loaded instance. [PR #2040](https://github.com/apollographql/apollo-server/pull/2040)

### v2.2.6

- `apollo-server-micro`: Set the `Content-type` to `text/html` for GraphQL Playground. [PR #2026](https://github.com/apollographql/apollo-server/pull/2026)

### v2.2.5

Expand Down
38 changes: 19 additions & 19 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"@types/connect": "3.4.32",
"@types/fibers": "0.0.30",
"@types/graphql": "14.0.3",
"@types/hapi": "17.6.4",
"@types/hapi": "17.8.0",
"@types/jest": "23.3.10",
"@types/json-stable-stringify": "1.0.32",
"@types/koa-multer": "1.0.0",
Expand All @@ -78,7 +78,7 @@
"@types/memcached": "2.2.5",
"@types/micro": "7.3.3",
"@types/multer": "1.3.7",
"@types/node": "10.12.10",
"@types/node": "10.12.12",
"@types/node-fetch": "2.1.4",
"@types/redis": "2.8.8",
"@types/request": "2.48.1",
Expand Down Expand Up @@ -108,14 +108,14 @@
"js-sha256": "0.9.0",
"koa": "2.6.2",
"koa-multer": "1.0.2",
"lerna": "3.5.0",
"lerna": "3.5.1",
"lint-staged": "8.1.0",
"memcached-mock": "0.1.0",
"meteor-promise": "0.8.6",
"mock-req": "0.2.0",
"multer": "1.4.1",
"node-fetch": "2.3.0",
"prettier": "1.15.2",
"prettier": "1.15.3",
"prettier-check": "2.0.0",
"qs-middleware": "1.0.3",
"redis-mock": "0.40.0",
Expand All @@ -126,7 +126,7 @@
"test-listen": "1.1.0",
"ts-jest": "23.10.5",
"tslint": "5.11.0",
"typescript": "3.2.0-rc",
"typescript": "3.2.1",
"ws": "6.1.0",
"yup": "0.26.5"
},
Expand Down
32 changes: 27 additions & 5 deletions packages/apollo-engine-reporting-protobuf/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,29 @@
# apollo-engine-reporting-protobuf
# `apollo-engine-reporting-protobuf`

This contains generated Javascript/TypeScript code for the protobuf definitions
for the Engine reporting API.
> **Note:** The Apollo Engine reporting API is subject to change. We strongly
> encourage developers to contact Apollo Engine support to discuss their use
> case prior to building their own reporting agent using this module.
The Engine reporting API is currently subject to change at any time; do not rely
on this to build your own client.
This module provides JavaScript/TypeScript
[Protocol buffer](https://developers.google.com/protocol-buffers/) definitions
for the Apollo Engine reporting API. These definitions are generated for
consumption from the `reports.proto` file which is defined internally within
Apollo.

## Development

> **Note:** Due to a dependency on Unix tools (e.g. `bash`, `grep`, etc.), the
> development of this module requires a Unix system. There is no reason why
> this can't be avoided, the time just hasn't been taken to make those changes.
> We'd happily accept a PR which makes the appropriate changes!
Currently, this package generates a majority of its code with
[`protobufjs`](https://www.npmjs.com/package/protobufjs) based on the
`reports.proto` file. The output is generated with the `prepare` npm script.

The root of the repository provides the `devDependencies` necessary to build
these definitions (e.g. `pbjs`, `pbts`, `protobuf`, etc.) and the the `prepare`
npm script is invoked programmatically via the monorepo tooling (e.g. Lerna)
thanks to _this_ module's `postinstall` script. Therefore, when making
changes to this module, `npx lerna run prepare` should be run from the **root**
of this monorepo in order to update the definitions in _this_ module.
6 changes: 3 additions & 3 deletions packages/apollo-engine-reporting-protobuf/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"main": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
"prepare": "npm run pbjs && npm run pbts",
"pbjs": "bash -c 'mkdir -p dist && pbjs --target static-module --out dist/index.js --wrap commonjs --force-number <(grep -v \"package mdg.engine.proto\" reports.proto)'",
"pbts": "pbts -o dist/index.d.ts dist/index.js"
"prepare": "npm run pbjs && npm run pbts && cp src/* dist",
"pbjs": "bash -c 'mkdir -p dist && pbjs --target static-module --out dist/protobuf.js --wrap commonjs --force-number <(grep -v \"package mdg.engine.proto\" src/reports.proto)'",
"pbts": "pbts -o dist/protobuf.d.ts dist/protobuf.js"
},
"repository": {
"type": "git",
Expand Down
2 changes: 2 additions & 0 deletions packages/apollo-engine-reporting-protobuf/src/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import * as protobuf from './protobuf';
export = protobuf;
24 changes: 24 additions & 0 deletions packages/apollo-engine-reporting-protobuf/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const protobuf = require('./protobuf');

// Override the generated protobuf Traces.encode function so that it will look
// for Traces that are already encoded to Buffer as well as unencoded
// Traces. This amortizes the protobuf encoding time over each generated Trace
// instead of bunching it all up at once at sendReport time. In load tests, this
// change improved p99 end-to-end HTTP response times by a factor of 11 without
// a casually noticeable effect on p50 times. This also makes it easier for us
// to implement maxUncompressedReportSize as we know the encoded size of traces
// as we go.
const originalTracesEncode = protobuf.Traces.encode;
protobuf.Traces.encode = function(message, originalWriter) {
const writer = originalTracesEncode(message, originalWriter);
const encodedTraces = message.encodedTraces;
if (encodedTraces != null && encodedTraces.length) {
for (let i = 0; i < encodedTraces.length; ++i) {
writer.uint32(/* id 1, wireType 2 =*/ 10);
writer.bytes(encodedTraces[i]);
}
}
return writer;
};

module.exports = protobuf;
25 changes: 2 additions & 23 deletions packages/apollo-engine-reporting/src/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,6 @@ import {
GraphQLServiceContext,
} from 'apollo-server-core/dist/requestPipelineAPI';

// Override the generated protobuf Traces.encode function so that it will look
// for Traces that are already encoded to Buffer as well as unencoded
// Traces. This amortizes the protobuf encoding time over each generated Trace
// instead of bunching it all up at once at sendReport time. In load tests, this
// change improved p99 end-to-end HTTP response times by a factor of 11 without
// a casually noticeable effect on p50 times. This also makes it easier for us
// to implement maxUncompressedReportSize as we know the encoded size of traces
// as we go.
const originalTracesEncode = Traces.encode;
Traces.encode = function(message, originalWriter) {
const writer = originalTracesEncode(message, originalWriter);
const encodedTraces = (message as any).encodedTraces;
if (encodedTraces != null && encodedTraces.length) {
for (let i = 0; i < encodedTraces.length; ++i) {
writer.uint32(/* id 1, wireType 2 =*/ 10);
writer.bytes(encodedTraces[i]);
}
}
return writer;
};

export interface ClientInfo {
clientName?: string;
clientVersion?: string;
Expand Down Expand Up @@ -190,8 +169,8 @@ export class EngineReportingAgent<TContext = any> {
this.report.tracesPerQuery[statsReportKey] = new Traces();
(this.report.tracesPerQuery[statsReportKey] as any).encodedTraces = [];
}
// See comment on our override of Traces.encode to learn more about this
// strategy.
// See comment on our override of Traces.encode inside of
// apollo-engine-reporting-protobuf to learn more about this strategy.
(this.report.tracesPerQuery[statsReportKey] as any).encodedTraces.push(
encodedTrace,
);
Expand Down
2 changes: 1 addition & 1 deletion packages/apollo-server-azure-functions/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "apollo-server-azure-functions",
"version": "2.2.5",
"version": "2.2.6",
"description": "Production-ready Node.js GraphQL server for Azure Functions",
"keywords": [
"GraphQL",
Expand Down
2 changes: 1 addition & 1 deletion packages/apollo-server-cloud-functions/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "apollo-server-cloud-functions",
"version": "2.2.5",
"version": "2.2.6",
"description": "Production-ready Node.js GraphQL server for Google Cloud Functions",
"keywords": [
"GraphQL",
Expand Down
2 changes: 1 addition & 1 deletion packages/apollo-server-cloudflare/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "apollo-server-cloudflare",
"version": "2.2.5",
"version": "2.2.6",
"description": "Production-ready Node.js GraphQL server for Cloudflare workers",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/apollo-server-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "apollo-server-core",
"version": "2.2.5",
"version": "2.2.6",
"description": "Core engine for Apollo GraphQL server",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/apollo-server-express/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "apollo-server-express",
"version": "2.2.5",
"version": "2.2.6",
"description": "Production-ready Node.js GraphQL server for Express and Connect",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/apollo-server-hapi/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "apollo-server-hapi",
"version": "2.2.5",
"version": "2.2.6",
"description": "Production-ready Node.js GraphQL server for Hapi",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/apollo-server-integration-testsuite/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "apollo-server-integration-testsuite",
"private": true,
"version": "2.2.5",
"version": "2.2.6",
"description": "Apollo Server Integrations testsuite",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/apollo-server-koa/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "apollo-server-koa",
"version": "2.2.5",
"version": "2.2.6",
"description": "Production-ready Node.js GraphQL server for Koa",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/apollo-server-lambda/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "apollo-server-lambda",
"version": "2.2.5",
"version": "2.2.6",
"description": "Production-ready Node.js GraphQL server for AWS Lambda",
"keywords": [
"GraphQL",
Expand Down
1 change: 0 additions & 1 deletion packages/apollo-server-micro/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ const graphqlPath = '/data';
const graphqlHandler = apolloServer.createHandler({ path: graphqlPath });
module.exports = router(
get('/', (req, res) => 'Welcome!'),
options(graphqlPath, graphqlHandler),
post(graphqlPath, graphqlHandler),
get(graphqlPath, graphqlHandler),
);
Expand Down
2 changes: 1 addition & 1 deletion packages/apollo-server-micro/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "apollo-server-micro",
"version": "2.2.5",
"version": "2.2.6",
"description": "Production-ready Node.js GraphQL server for Micro",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
1 change: 1 addition & 0 deletions packages/apollo-server-micro/src/ApolloServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ export class ApolloServer extends ApolloServerBase {
subscriptionEndpoint: this.subscriptionsPath,
...this.playgroundOptions,
};
res.setHeader('Content-Type', 'text/html; charset=utf-8');
send(res, 200, renderPlaygroundPage(middlewareOptions));
handled = true;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/apollo-server-plugin-base/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "apollo-server-plugin-base",
"version": "0.1.5",
"version": "0.1.6",
"description": "Apollo Server plugin base classes",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/apollo-server-testing/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "apollo-server-testing",
"version": "2.2.5",
"version": "2.2.6",
"description": "Test utils for apollo-server",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/apollo-server/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "apollo-server",
"version": "2.2.5",
"version": "2.2.6",
"description": "Production ready GraphQL Server",
"author": "opensource@apollographql.com",
"main": "dist/index.js",
Expand Down

0 comments on commit abb8dc5

Please sign in to comment.