Commit graph

440 commits

Author SHA1 Message Date
Jesse Rosenberger
046327068b
Publish
- apollo-engine-reporting@1.0.7
 - apollo-server-azure-functions@2.4.8
 - apollo-server-cloud-functions@2.4.8
 - apollo-server-cloudflare@2.4.8
 - apollo-server-core@2.4.8
 - apollo-server-express@2.4.8
 - apollo-server-fastify@2.4.8
 - apollo-server-hapi@2.4.8
 - apollo-server-integration-testsuite@2.4.8
 - apollo-server-koa@2.4.8
 - apollo-server-lambda@2.4.8
 - apollo-server-micro@2.4.8
 - apollo-server-plugin-base@0.3.7
 - apollo-server-testing@2.4.8
 - apollo-server@2.4.8
 - graphql-extensions@0.5.7
2019-02-26 16:21:42 +02:00
Jesse Rosenberger
a95421f19b
Publish
- apollo-engine-reporting@1.0.6
 - apollo-server-azure-functions@2.4.7
 - apollo-server-cloud-functions@2.4.7
 - apollo-server-cloudflare@2.4.7
 - apollo-server-core@2.4.7
 - apollo-server-express@2.4.7
 - apollo-server-fastify@2.4.7
 - apollo-server-hapi@2.4.7
 - apollo-server-integration-testsuite@2.4.7
 - apollo-server-koa@2.4.7
 - apollo-server-lambda@2.4.7
 - apollo-server-micro@2.4.7
 - apollo-server-plugin-base@0.3.6
 - apollo-server-testing@2.4.7
 - apollo-server@2.4.7
 - graphql-extensions@0.5.6
2019-02-26 13:21:32 +02:00
Jesse Rosenberger
62587e037b Publish
- apollo-engine-reporting@1.0.5
 - apollo-server-azure-functions@2.4.6
 - apollo-server-cloud-functions@2.4.6
 - apollo-server-cloudflare@2.4.6
 - apollo-server-core@2.4.6
 - apollo-server-express@2.4.6
 - apollo-server-fastify@2.4.6
 - apollo-server-hapi@2.4.6
 - apollo-server-integration-testsuite@2.4.6
 - apollo-server-koa@2.4.6
 - apollo-server-lambda@2.4.6
 - apollo-server-micro@2.4.6
 - apollo-server-plugin-base@0.3.5
 - apollo-server-testing@2.4.6
 - apollo-server@2.4.6
 - graphql-extensions@0.5.5
2019-02-22 07:21:47 +00:00
Jesse Rosenberger
8b02c0c440
Allow Node.js-like runtimes to identify as Node.js as well. (#2357)
Previously, in order to only load dependencies which only work on Node.js
and fail in non-Node.js environments, we introduced a check which did a
string-comparison of `process.release.name` to see if it is was `node`.

This was first introduced in 9c563fae50 as
part of #2054, but has gone on to be useful for other purposes as well.

Some Node.js forks such as NodeSource's N|Solid, which is a fork of Node.js
which follows-up each Node.js release with a custom build that includes
additional native addons but is otherwise the same, override this value with
their own name.  This means that N|Source returns `nsolid`, despite the fact
that it is almost entirely the same as Node.js.

Luckily, N|Solid leaves the base version of its Node.js in
`process.versions.node` (and additionally adds its own
`process.versions.nsolid`).  By relaxing the string comparison on
`process.release.name`, we should still be able to accurately detect the
environment we want - which is "Close enough to Node.js!".

Fixes https://github.com/apollographql/apollo-server/issues/2356
2019-02-22 09:04:16 +02:00
Jesse Rosenberger
750f0010ca Re-align version numbers after 587c660d.
cc @cheapsteak
2019-02-22 06:37:16 +00:00
Chang Wang
879ed19034 Publish
- apollo-cache-control@0.5.2
 - apollo-datasource-rest@0.3.2
 - apollo-engine-reporting@1.0.4
 - apollo-server-azure-functions@2.4.4
 - apollo-server-cloud-functions@2.4.4
 - apollo-server-cloudflare@2.4.4
 - apollo-server-core@2.4.4
 - apollo-server-errors@2.2.1
 - apollo-server-express@2.4.4
 - apollo-server-fastify@2.4.4
 - apollo-server-hapi@2.4.4
 - apollo-server-integration-testsuite@2.4.4
 - apollo-server-koa@2.4.4
 - apollo-server-lambda@2.4.4
 - apollo-server-micro@2.4.4
 - apollo-server-plugin-base@0.3.4
 - apollo-server-testing@2.4.4
 - apollo-server@2.4.4
 - apollo-tracing@0.5.2
 - graphql-extensions@0.5.4
2019-02-21 13:05:33 -05:00
Chang Wang
a4ebadc876
Type parameters for context function separately from the context it produces (#2350)
* Add AS constructor with context usage to tests

* fix(typing): Context template type should be 'object' and not 'any'

```context?: ContextFunction<ExpressContext, any> | Context<any>;```
is
```context?: ContextFunction<ExpressContext, any> | any;```
which is
```context?: any;```

https://github.com/Microsoft/TypeScript/issues/18568

Since the ContextFunction<...> part is ignored, no type hinting will be provided when a function is passed to `context`. We don't really mean `any`, we mean an object with any shape, so we should use `object` instead

* fix(typing): type ContextFunction params separately from resulting context object

* Update changelog

* rename: ContextContent -> ProducedContext
2019-02-21 12:49:04 -05:00
Chang Wang
8850e0f7ed
Add more accurate typings to formatError (#2343)
* Type formatErrors function to specify that it accepts and returns ApolloError

* Update changelog

* type(formatErrors): accept GraphQLError, return GraphQLFormattedError

* update changelog
2019-02-21 09:10:13 -05:00
Jesse Rosenberger
e1d7078817
Publish
- apollo-engine-reporting@1.0.3
 - apollo-server-azure-functions@2.4.3
 - apollo-server-cloud-functions@2.4.3
 - apollo-server-cloudflare@2.4.3
 - apollo-server-core@2.4.3
 - apollo-server-express@2.4.3
 - apollo-server-fastify@2.4.3
 - apollo-server-hapi@2.4.3
 - apollo-server-integration-testsuite@2.4.3
 - apollo-server-koa@2.4.3
 - apollo-server-lambda@2.4.3
 - apollo-server-micro@2.4.3
 - apollo-server-plugin-base@0.3.3
 - apollo-server-testing@2.4.3
 - apollo-server@2.4.3
 - graphql-extensions@0.5.3
2019-02-20 19:00:08 +02:00
Jesse Rosenberger
0d4fb48d9a
Merge branch 'master' into patch-1 2019-02-20 13:09:50 +02:00
Jesse Rosenberger
c1607cb919
Switch to import = for ws types, since @types/ws uses export =.
While it would be perfectly fine to use `import *` in this particular case,
we've moved away from the star-import pattern in this repository, instead
preferring the `esModuleInterop` compiler option which seems to be the
direction that TypeScript is moving as it's now the default with `tsc --init`.

TypeScript clearly lost its battle with `import *` which many consider to
have been an incorrect direction in the first place.  Some build tools won't
work with star imports, and using them can make some optimizations more
difficult.  By avoiding this pattern here, hopefully we'll avoid moving back
in that direction inadvertently.

Here's a read I found at one point which roughly explains:

https://itnext.io/great-import-schism-typescript-confusion-around-imports-explained-d512fc6769c2
2019-02-20 12:45:42 +02:00
Chang Wang
63089961f5 Provide more accurate types for apollo-server-express's ContextFunction (#2330)
* typing: context function could return value synchronously

* Create ApolloServerExpressConfig type that has req and res in context

* Have apollo-server-express's constructor also use the express-specific config

* Update changelog
2019-02-19 20:00:12 +02:00
Arthur Petrie
212eb94430
Merge branch 'master' into patch-1 2019-02-19 15:55:37 +01:00
Jesse Rosenberger
c1669c3d74
Publish
- apollo-cache-control@0.5.1
 - apollo-datasource-rest@0.3.1
 - apollo-datasource@0.3.1
 - apollo-engine-reporting-protobuf@0.2.1
 - apollo-engine-reporting@1.0.2
 - apollo-server-azure-functions@2.4.2
 - apollo-server-cache-memcached@0.3.1
 - apollo-server-cache-redis@0.3.1
 - apollo-server-caching@0.3.1
 - apollo-server-cloud-functions@2.4.2
 - apollo-server-cloudflare@2.4.2
 - apollo-server-core@2.4.2
 - apollo-server-express@2.4.2
 - apollo-server-fastify@2.4.2
 - apollo-server-hapi@2.4.2
 - apollo-server-integration-testsuite@2.4.2
 - apollo-server-koa@2.4.2
 - apollo-server-lambda@2.4.2
 - apollo-server-micro@2.4.2
 - apollo-server-plugin-base@0.3.2
 - apollo-server-testing@2.4.2
 - apollo-server@2.4.2
 - apollo-tracing@0.5.1
 - graphql-extensions@0.5.2
2019-02-14 15:25:38 +02:00
Jesse Rosenberger
f988a30e8c
Publish
- apollo-cache-control@0.5.1-rc.0
 - apollo-datasource-rest@0.3.1-rc.0
 - apollo-datasource@0.3.1-rc.0
 - apollo-engine-reporting-protobuf@0.2.1-rc.0
 - apollo-engine-reporting@1.0.2-rc.0
 - apollo-server-azure-functions@2.4.2-rc.0
 - apollo-server-cache-memcached@0.3.1-rc.0
 - apollo-server-cache-redis@0.3.1-rc.0
 - apollo-server-caching@0.3.1-rc.0
 - apollo-server-cloud-functions@2.4.2-rc.0
 - apollo-server-cloudflare@2.4.2-rc.0
 - apollo-server-core@2.4.2-rc.0
 - apollo-server-express@2.4.2-rc.0
 - apollo-server-fastify@2.4.2-rc.0
 - apollo-server-hapi@2.4.2-rc.0
 - apollo-server-integration-testsuite@2.4.2-rc.0
 - apollo-server-koa@2.4.2-rc.0
 - apollo-server-lambda@2.4.2-rc.0
 - apollo-server-micro@2.4.2-rc.0
 - apollo-server-plugin-base@0.3.2-rc.0
 - apollo-server-testing@2.4.2-rc.0
 - apollo-server@2.4.2-rc.0
 - apollo-tracing@0.5.1-rc.0
 - graphql-extensions@0.5.2-rc.0
2019-02-14 15:16:36 +02:00
Jesse Rosenberger
e7709588fb
Update to apollo-tools@0.3.3, even for nested dependencies.
There was a breaking change to `core-js` in `3.0.0-beta.12` which seems to
warrant this extra protection.
2019-02-13 16:16:45 +02:00
Ben Newman
4116b2ff4a
Publish
- apollo-engine-reporting@1.0.1
 - apollo-server-azure-functions@2.4.1
 - apollo-server-cloud-functions@2.4.1
 - apollo-server-cloudflare@2.4.1
 - apollo-server-core@2.4.1
 - apollo-server-express@2.4.1
 - apollo-server-hapi@2.4.1
 - apollo-server-integration-testsuite@2.4.1
 - apollo-server-koa@2.4.1
 - apollo-server-lambda@2.4.1
 - apollo-server-micro@2.4.1
 - apollo-server-plugin-base@0.3.1
 - apollo-server-testing@2.4.1
 - apollo-server@2.4.1
 - graphql-extensions@0.5.1
2019-02-12 16:34:47 -05:00
Ben Newman
b89de2675b
Allow passing parseOptions to ApolloServerBase constructor. (#2289) 2019-02-12 14:09:12 -05:00
Ben Newman
3f7a7f3d67
Avoid importing entire crypto dependency tree if not in Node.js. (#2304)
The apollo-server-core package uses Node's built-in crypto module only to
create SHA-256 and -512 hashes.

When we're actually running in Node, the native crypto library is clearly
the best way to create these hashes, not least because we can assume it
will be available without having to bundle it first.

Outside of Node (such as in React Native apps), bundlers tend to fall back
on the crypto-browserify polyfill, which comprises more than a hundred
separate modules. Importing this polyfill at runtime (likely during
application startup) takes precious time and memory, even though almost
all of it is unused.

Since we only need to create SHA hashes, we can import the much smaller
sha.js library in non-Node environments, which happens to be what
crypto-browserify uses for SHA hashing, and is a widely used npm package
in its own right: https://www.npmjs.com/package/sha.js.
2019-02-12 14:07:42 -05:00
Chang Wang
bf120018bf Await on graphql.execute() before calling executionDidEnd handler (AS-59) (#2298)
* Wait on graphql.execute() before calling end handler

* Update changelog
2019-02-12 20:34:56 +02:00
Ben Newman
543b9c8432
Require apollo-engine-reporting only if EngineReportingAgent used. (#2305)
When getEngineServiceId does not return a truthy value, we can save memory
and startup time by avoiding importing apollo-engine-reporting, which
(among its other dependencies) imports the protobuf.js implementation.
2019-02-12 11:21:07 -05:00
Ben Newman
96351a4db6 Remove unused lodash dependency. (#2303)
The only usage of lodash was removed by @martijnwalraven in commit
a09d514e59.
2019-02-12 17:44:22 +02:00
Jesse Rosenberger
a3222ece11
Publish
- apollo-cache-control@0.5.0
 - apollo-datasource-rest@0.3.0
 - apollo-datasource@0.3.0
 - apollo-engine-reporting@1.0.0
 - apollo-graphql@0.1.0
 - apollo-server-azure-functions@2.4.0
 - apollo-server-cache-memcached@0.3.0
 - apollo-server-cache-redis@0.3.0
 - apollo-server-caching@0.3.0
 - apollo-server-cloud-functions@2.4.0
 - apollo-server-cloudflare@2.4.0
 - apollo-server-core@2.4.0
 - apollo-server-express@2.4.0
 - apollo-server-hapi@2.4.0
 - apollo-server-integration-testsuite@2.4.0
 - apollo-server-koa@2.4.0
 - apollo-server-lambda@2.4.0
 - apollo-server-micro@2.4.0
 - apollo-server-plugin-base@0.3.0
 - apollo-server-testing@2.4.0
 - apollo-server@2.4.0
 - apollo-tracing@0.5.0
 - graphql-extensions@0.5.0
2019-02-07 14:08:23 +02:00
Jesse Rosenberger
f74610b290
Publish
- apollo-cache-control@0.5.0-alpha.3
 - apollo-datasource-rest@0.3.0-alpha.3
 - apollo-engine-reporting@1.0.0-alpha.3
 - apollo-graphql@0.0.1-alpha.1
 - apollo-server-azure-functions@2.4.0-alpha.4
 - apollo-server-cloud-functions@2.4.0-alpha.4
 - apollo-server-cloudflare@2.4.0-alpha.4
 - apollo-server-core@2.4.0-alpha.4
 - apollo-server-express@2.4.0-alpha.4
 - apollo-server-hapi@2.4.0-alpha.4
 - apollo-server-integration-testsuite@2.4.0-alpha.4
 - apollo-server-koa@2.4.0-alpha.4
 - apollo-server-lambda@2.4.0-alpha.4
 - apollo-server-micro@2.4.0-alpha.4
 - apollo-server-plugin-base@0.3.0-alpha.4
 - apollo-server-testing@2.4.0-alpha.4
 - apollo-server@2.4.0-alpha.4
 - apollo-tracing@0.5.0-alpha.3
 - graphql-extensions@0.5.0-alpha.4
2019-02-07 13:01:14 +02:00
Jesse Rosenberger
03283f9ad3
Merge branch 'master' into release-2.4.0 2019-01-29 12:10:13 +02:00
Jesse Rosenberger
5939327edd
Publish
- apollo-server-azure-functions@2.3.3
 - apollo-server-cloud-functions@2.3.3
 - apollo-server-cloudflare@2.3.3
 - apollo-server-core@2.3.3
 - apollo-server-express@2.3.3
 - apollo-server-hapi@2.3.3
 - apollo-server-integration-testsuite@2.3.3
 - apollo-server-koa@2.3.3
 - apollo-server-lambda@2.3.3
 - apollo-server-micro@2.3.3
 - apollo-server-plugin-base@0.2.3
 - apollo-server-testing@2.3.3
 - apollo-server@2.3.3
 - graphql-extensions@0.4.3
2019-01-29 11:51:30 +02:00
Kurt Mackey
cd674aae72 More strict check for node version for graphql-upload (#2235)
Stop traversing the `graphql-upload` module tree in all non-Node.js environments, to support subset-V8 runtimes like Fly.io.
2019-01-29 11:36:40 +02:00
Arthie
0e5437bd0e
Fix Typescript WebSocket import error
I get the following error when using the apollo-server-core with typescript (3.2.4) :

node_modules/apollo-server-core/dist/types.d.ts:4:8 - error TS1192: Module '"/node_modules/@types/ws/index"' has no default export.
import WebSocket from 'ws';

The change fixes this error!
2019-01-26 12:42:53 +01:00
Jesse Rosenberger
d48d0972c5
Publish
- apollo-cache-control@0.4.1
 - apollo-datasource-rest@0.2.2
 - apollo-datasource@0.2.2
 - apollo-engine-reporting@0.2.1
 - apollo-server-azure-functions@2.3.2
 - apollo-server-cache-memcached@0.2.2
 - apollo-server-cache-redis@0.2.2
 - apollo-server-caching@0.2.2
 - apollo-server-cloud-functions@2.3.2
 - apollo-server-cloudflare@2.3.2
 - apollo-server-core@2.3.2
 - apollo-server-express@2.3.2
 - apollo-server-hapi@2.3.2
 - apollo-server-integration-testsuite@2.3.2
 - apollo-server-koa@2.3.2
 - apollo-server-lambda@2.3.2
 - apollo-server-micro@2.3.2
 - apollo-server-plugin-base@0.2.2
 - apollo-server-testing@2.3.2
 - apollo-server@2.3.2
 - apollo-tracing@0.4.1
 - graphql-extensions@0.4.2
2019-01-25 18:48:18 +02:00
Jesse Rosenberger
18d9041db7
Don't write to persisted query cache until execution will begin. (#2227)
Since we already write to the persisted query cache asynchronously (and
intentionally do not await the Promise) this won't have any affect on the
current behavior of when the persisted query cache is written to in the
event of an executable request, but if an operation comes in and doesn't
parse or validate, we'll avoid wasting cache space on an operation that will
never execute.

Additionally, in a similar light, if a plugin throws an error which stops
execution, we can avoid the side-effect of writing to the persisted query
cache.

In terms of the APQ behavior, while this could cause additional round-trips
for a client which repeatedly sends an invalid operation, that operation is
never going to successfully finish anyway.  While developer tooling will
help avoid this problem in the first place, this refusal to store an invalid
operation in the APQ cache could actually help diagnose a failure since the
full operation (rather than just the SHA256 of that document) will appear
in the browser's dev-tools on the retry.

If we're looking to spare parsing and validating documents which we know are
going to fail, I think that's going to be a better use of the (new)
`documentStore` cache (#2111), since its in-memory and can accommodate a
more complex data structure which includes the validation errors from the
previous attempt which will, of course, be the same when validating the same
operation against the same schema again.  As the PR that introduced that
feature shows, sparing those additional parses and validations (cached APQ
documents still needs to be parsed and validated, currently) will provide a
more successful performance win overall.

Ref: https://github.com/apollographql/apollo-server/pull/2111
2019-01-25 18:01:15 +02:00
renovate[bot]
117ea3042b chore(deps): update dependency prettier to v1.16.1 (#2203)
This PR contains the following updates:

| Package | Type | Update | Change | References |
|---|---|---|---|---|
| prettier | devDependencies | minor | `1.15.3` -> `1.16.1` | [homepage](https://prettier.io), [source](https://togithub.com/prettier/prettier) |

---

### Release Notes

<details>
<summary>prettier/prettier</summary>

### [`v1.16.1`](https://togithub.com/prettier/prettier/blob/master/CHANGELOG.md#&#8203;1161)

[Compare Source](https://togithub.com/prettier/prettier/compare/1.16.0...1.16.1)

[diff](https://togithub.com/prettier/prettier/compare/1.16.0...1.16.1)

-   JavaScript: Do not format functions with arguments as react hooks ([#&#8203;5778] by [@&#8203;SimenB])

    The formatting added in Prettier 1.16 would format any function receiving an
    arrow function and an array literal to match React Hook's documentation.
    Prettier will now format this the same as before that change if the arrow
    function receives any arguments.

    <!-- prettier-ignore -->

    ```js
    // Input
    ["red", "white", "blue", "black", "hotpink", "rebeccapurple"].reduce(
      (allColors, color) => {
        return allColors.concat(color);
      },
      []
    );

    // Output (Prettier 1.16.0)
    ["red", "white", "blue", "black", "hotpink", "rebeccapurple"].reduce((
      allColors,
      color
    ) => {
      return allColors.concat(color);
    }, []);

    // Output (Prettier 1.16.1)
    ["red", "white", "blue", "black", "hotpink", "rebeccapurple"].reduce(
      (allColors, color) => {
        return allColors.concat(color);
      },
      []
    );
    ```

-   JavaScript: Add necessary parentheses for decorators ([#&#8203;5785] by [@&#8203;ikatyang])

    Parentheses for decorators with nested call expressions are optional for legacy decorators
    but they're required for decorators in the current [proposal](https://tc39.github.io/proposal-decorators/#sec-syntax).

    <!-- prettier-ignore -->

    ```js
    // Input
    class X {
      @&#8203;(computed().volatile())
      prop
    }

    // Output (Prettier 1.16.0)
    class X {
      @&#8203;computed().volatile()
      prop
    }

    // Output (Prettier 1.16.1)
    class X {
      @&#8203;(computed().volatile())
      prop
    }
    ```

-   TypeScript: Stable parentheses for function type in the return type of arrow function ([#&#8203;5790] by [@&#8203;ikatyang])

    There's a regression introduced in 1.16 that
    parentheses for function type in the return type of arrow function were kept adding/removing.
    Their parentheses are always printed now.

    <!-- prettier-ignore -->

    ```ts
    // Input
    const foo = (): (() => void) => (): void => null;
    const bar = (): () => void => (): void => null;

    // First Output (Prettier 1.16.0)
    const foo = (): () => void => (): void => null;
    const bar = (): (() => void) => (): void => null;

    // Second Output (Prettier 1.16.0)
    const foo = (): (() => void) => (): void => null;
    const bar = (): () => void => (): void => null;

    // Output (Prettier 1.16.1)
    const foo = (): (() => void) => (): void => null;
    const bar = (): (() => void) => (): void => null;
    ```

-   MDX: Correctly recognize inline JSX ([#&#8203;5783] by [@&#8203;ikatyang])

    Previously, some inline JSXs are wrongly recognized as block HTML/JSX,
    which causes unexpected behaviors. This issue is now fixed.

    <!-- prettier-ignore -->

    ```md
    <!-- Input -->
    _foo <InlineJSX /> bar_

    <!-- Output (Prettier 1.16.0) -->
    _foo

    <InlineJSX /> bar_

    <!-- Output (Prettier 1.16.1) -->
    _foo <InlineJSX /> bar_
    ```

[@&#8203;ikatyang]: https://togithub.com/ikatyang

[@&#8203;simenb]: https://togithub.com/SimenB

[#&#8203;5778]: https://togithub.com/prettier/prettier/pull/5778

[#&#8203;5783]: https://togithub.com/prettier/prettier/pull/5783

[#&#8203;5785]: https://togithub.com/prettier/prettier/pull/5785

[#&#8203;5790]: https://togithub.com/prettier/prettier/pull/5790

### [`v1.16.0`](https://togithub.com/prettier/prettier/blob/master/CHANGELOG.md#&#8203;1160)

[Compare Source](https://togithub.com/prettier/prettier/compare/1.15.3...1.16.0)

[diff](https://togithub.com/prettier/prettier/compare/1.15.3...1.16.0)

🔗 [Release Notes](https://prettier.io/blog/2019/01/20/1.16.0.html)

</details>

---

### Renovate configuration

📅 **Schedule**: "after 6pm every weekday,before 5am every weekday" in timezone America/Los_Angeles.

🚦 **Automerge**: Enabled.

♻️ **Rebasing**: Whenever PR is stale, or if you modify the PR title to begin with "`rebase!`".

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- renovate-rebase -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://togithub.com/marketplace/renovate). View repository job log [here](https://renovatebot.com/dashboard#apollographql/apollo-server).
2019-01-23 17:46:53 +02:00
Jesse Rosenberger
f045a4d0c9
Publish
- apollo-cache-control@0.5.0-alpha.2
 - apollo-datasource-rest@0.3.0-alpha.2
 - apollo-datasource@0.3.0-alpha.2
 - apollo-engine-reporting@0.3.0-alpha.2
 - apollo-server-azure-functions@2.4.0-alpha.3
 - apollo-server-cache-memcached@0.3.0-alpha.2
 - apollo-server-cache-redis@0.3.0-alpha.2
 - apollo-server-caching@0.3.0-alpha.2
 - apollo-server-cloud-functions@2.4.0-alpha.3
 - apollo-server-cloudflare@2.4.0-alpha.3
 - apollo-server-core@2.4.0-alpha.3
 - apollo-server-express@2.4.0-alpha.3
 - apollo-server-fastify@2.4.0-alpha.3
 - apollo-server-hapi@2.4.0-alpha.3
 - apollo-server-integration-testsuite@2.4.0-alpha.3
 - apollo-server-koa@2.4.0-alpha.3
 - apollo-server-lambda@2.4.0-alpha.3
 - apollo-server-micro@2.4.0-alpha.3
 - apollo-server-plugin-base@0.3.0-alpha.3
 - apollo-server-testing@2.4.0-alpha.3
 - apollo-server@2.4.0-alpha.3
 - apollo-tracing@0.5.0-alpha.2
 - graphql-extensions@0.5.0-alpha.3
2019-01-23 15:58:50 +02:00
Jesse Rosenberger
7d5468800f
Merge pull request #2111 from apollographql/abernix/cache-parsed-validated
Cache successfully parsed and validated documents for future requests.
2019-01-23 15:09:56 +02:00
Jesse Rosenberger
1d0021933e
Publish
- apollo-server-azure-functions@2.4.0-alpha.2
 - apollo-server-cloud-functions@2.4.0-alpha.2
 - apollo-server-cloudflare@2.4.0-alpha.2
 - apollo-server-core@2.4.0-alpha.2
 - apollo-server-express@2.4.0-alpha.2
 - apollo-server-hapi@2.4.0-alpha.2
 - apollo-server-integration-testsuite@2.4.0-alpha.2
 - apollo-server-koa@2.4.0-alpha.2
 - apollo-server-lambda@2.4.0-alpha.2
 - apollo-server-micro@2.4.0-alpha.2
 - apollo-server-plugin-base@0.3.0-alpha.2
 - apollo-server-testing@2.4.0-alpha.2
 - apollo-server@2.4.0-alpha.2
 - graphql-extensions@0.5.0-alpha.2
2019-01-23 15:04:23 +02:00
Jesse Rosenberger
2ed1c0e074
Revert (as intended!) "[debug] Print out documentStore stats every 60 seconds."
This reverts commit 7a0d0e6e96, as I intended
when I originally introduced it.

Ref: https://github.com/apollographql/apollo-server/pull/2111#issuecomment-454779949
2019-01-23 14:56:50 +02:00
renovate[bot]
6e2cc5a8c5
chore(deps): update dependency @apollographql/apollo-tools to ^0.3.0 (#2190) 2019-01-17 04:22:44 +00:00
Jesse Rosenberger
33d1f82814
Publish
- apollo-cache-control@0.5.0-alpha.1
 - apollo-datasource-rest@0.3.0-alpha.1
 - apollo-datasource@0.3.0-alpha.1
 - apollo-engine-reporting@0.3.0-alpha.1
 - apollo-server-azure-functions@2.4.0-alpha.1
 - apollo-server-cache-memcached@0.3.0-alpha.1
 - apollo-server-cache-redis@0.3.0-alpha.1
 - apollo-server-caching@0.3.0-alpha.1
 - apollo-server-cloud-functions@2.4.0-alpha.1
 - apollo-server-cloudflare@2.4.0-alpha.1
 - apollo-server-core@2.4.0-alpha.1
 - apollo-server-express@2.4.0-alpha.1
 - apollo-server-hapi@2.4.0-alpha.1
 - apollo-server-integration-testsuite@2.4.0-alpha.1
 - apollo-server-koa@2.4.0-alpha.1
 - apollo-server-lambda@2.4.0-alpha.1
 - apollo-server-micro@2.4.0-alpha.1
 - apollo-server-plugin-base@0.3.0-alpha.1
 - apollo-server-testing@2.4.0-alpha.1
 - apollo-server@2.4.0-alpha.1
 - apollo-tracing@0.5.0-alpha.1
 - graphql-extensions@0.5.0-alpha.1
2019-01-16 13:11:21 +02:00
Jesse Rosenberger
7a0d0e6e96
[debug] Print out documentStore stats every 60 seconds.
In an effort to see how effective this cache is in production during this
alpha phase, we'll print out the stats on the document store every 60
seconds.
2019-01-16 13:07:17 +02:00
Jesse Rosenberger
be7162094c
Shift the burden of object approximation into the ApolloServerBase class.
The implementation of object-size approximation which is used for cache
eviction purposes in the `InMemoryLRUCache` implementation (via `lru-cache`)
was a short-term location for extensible logic which is better located
within `ApolloServerBase`.

This is particularly important since future logic may necessitate knowing or
understanding the current size (roughly, memory usage) of the in-memory
storage.  Effective immediately, this adds support for providing a `dispose`
function which is called when an object is purged from the cache to make
room for another.
2019-01-16 12:46:48 +02:00
Jesse Rosenberger
0879a1267e
Be considerate of variable length utf-8 encodings in InMemoryLRUCache.
Previously, this used the `JSON.stringify` length, but this is slightly more
aware.
2019-01-15 17:45:20 +02:00
Jesse Rosenberger
1a9d65dd81
Guard against (currently impossible) failure to read from documentStore.
While the implementation of the `documentStore` is currently simple enough
to never throw (it is in-memory), it makes some sense to guard against future
extended functionality where an exception might be raised.

Since storing this object in a distributed memory store isn't currently
feasible, I'm not sure what such an exception would be right now, but I
don't mind being proactive!

Ref: https://github.com/apollographql/apollo-server/pull/2111/files#r247618501
2019-01-15 17:03:00 +02:00
Jesse Rosenberger
f546086e95
Fix typos/spacing in commentary.
Of my own making!
2019-01-15 17:03:00 +02:00
Jesse Rosenberger
2652057c33
Clarify comments surrounding documentStore, which led to confusion.
The parsed/validated cache store is on by default.  While it could be disabled,
in theory, it cannot be disabled since its an internal property of the
request pipeline processor class.

See confusion here:

  https://github.com/withspectrum/spectrum/pull/4533#issuecomment-453446535
2019-01-15 17:02:59 +02:00
Jesse Rosenberger
f33ae19f6d
Ensure requestContext.document set, irregardless of documentStore use.
Without this change, the `document` property was not set on the
`requestContext` for consumption by request pipeline plugins.

To further guard against this oversight, I've removed the extra `document`
variable which was being used as scoped state for the document and switched to
directly using (and assigning to) the `requestContext.document`.

Nice catch, @glasser!

Ref: https://github.com/apollographql/apollo-server/pull/2111/files#r247617469
2019-01-15 17:02:59 +02:00
Jesse Rosenberger
45f14a2971
Fix incorrect contraction in code comment, per feedback.
Ref: https://github.com/apollographql/apollo-server/pull/2111/files#r247616489
2019-01-15 17:02:58 +02:00
Jesse Rosenberger
ea7da3a38c
Merge branch 'master' into abernix/cache-parsed-validated 2019-01-14 20:39:36 +02:00
wtgtybhertgeghgtwtg
ccba8c87da Switch json-stable-stringify to fast-json-stable-stringify. (#2065)
* refactor: switch `json-stable-stringify` to `fast-json-stable-stringify`

* chore: drop `@types/json-stable-stringify`

* Update CHANGELOG.md for #2065.
2018-12-19 20:06:17 +02:00
Jesse Rosenberger
7697623789
Publish
- apollo-cache-control@0.5.0-alpha.0
 - apollo-datasource-rest@0.3.0-alpha.0
 - apollo-datasource@0.3.0-alpha.0
 - apollo-engine-reporting@0.3.0-alpha.0
 - apollo-server-azure-functions@2.4.0-alpha.0
 - apollo-server-cache-memcached@0.3.0-alpha.0
 - apollo-server-cache-redis@0.3.0-alpha.0
 - apollo-server-caching@0.3.0-alpha.0
 - apollo-server-cloud-functions@2.4.0-alpha.0
 - apollo-server-cloudflare@2.4.0-alpha.0
 - apollo-server-core@2.4.0-alpha.0
 - apollo-server-express@2.4.0-alpha.0
 - apollo-server-hapi@2.4.0-alpha.0
 - apollo-server-integration-testsuite@2.4.0-alpha.0
 - apollo-server-koa@2.4.0-alpha.0
 - apollo-server-lambda@2.4.0-alpha.0
 - apollo-server-micro@2.4.0-alpha.0
 - apollo-server-plugin-base@0.3.0-alpha.0
 - apollo-server-testing@2.4.0-alpha.0
 - apollo-server@2.4.0-alpha.0
 - apollo-tracing@0.5.0-alpha.0
 - graphql-extensions@0.5.0-alpha.0
2018-12-18 17:14:02 +02:00
Jesse Rosenberger
b30e9332fc
Cache successfully parsed and validated documents for future requests.
WIP
2018-12-18 11:18:55 +02:00
Jesse Rosenberger
5a50e1bab2
chore: DRY-up the error response logic with a sendErrorResponse helper.
Introduces a helper function to DRY-up the increasingly-repeated pattern of
sending an error response in the event of request errors.
2018-12-18 10:43:19 +02:00