Commit graph

2793 commits

Author SHA1 Message Date
Jesse Rosenberger
33885db0b9
Improve and cleanup the README.md, removing duplicated examples.
First, the getting started example was incorrect and instructed users to
install the wrong package.

Furthermore, each integration example was duplicated on its individual
package `README.md` and the verbosity of this `README.md` (which is for the
entire monorepo) makes it unclear where to start.

This change points those who desire the integration approach to the specific
page which has more information about those integrations (and mostly the
same content in terms of examples which are listed here, albeit with subtle
variations.)
2019-02-26 11:18:55 +02:00
Jesse Rosenberger
f0a48a5814
Update apollo-server badges. 2019-02-26 11:18:54 +02:00
Jesse Rosenberger
08ddf26cfe
Fix markdown headings to more properly group sections. 2019-02-26 11:18:53 +02:00
Jesse Rosenberger
ff4d6cc378
Pluck the "Context" section from the middle of the "Integrations".
This looks like it's been buried in the README.md after several rounds of
adding new integrations.  This moves it back out on its own.
2019-02-26 11:18:53 +02:00
Jesse Rosenberger
a7597913d2
Remove unnecessary --save flags from npm install commands.
While it used to be required to pass the `--save` flag in order to actually
write the dependency to the project's `package.json` file, this is no longer
the case in recent versions of npm.
2019-02-26 11:18:52 +02:00
Jesse Rosenberger
6d62d2428d
Remove @rc dist-tag suggestions from several package's READMEs. 2019-02-26 11:18:51 +02:00
renovate[bot]
2a74950f4e
chore(deps): update dependency @types/jest to v24.0.9 (#2379) 2019-02-26 08:41:03 +00:00
renovate[bot]
0b5a9cc4cd
chore(deps): update dependency @types/koa-router to v7.0.40 (#2378) 2019-02-26 05:29:08 +00:00
renovate[bot]
d763c1f3c0
chore(deps): update dependency @types/jest to v24.0.8 (#2377) 2019-02-26 04:25:35 +00:00
hrg921
d12f28089d docs: update apollo-server-lambda/README (#2364)
I think 'this' is better than 'the'
2019-02-25 17:33:05 +02:00
Chang Wang
1ef592adeb Fix: Remove incorrect cors option type from apollo-server-express's constructor (#2373)
* Fix: Remove incorrect cors option type from apollo-server-express's constructor

https://github.com/apollographql/apollo-server/pull/2330#discussion_r259773834

* update changelog

* Update CHANGELOG.md
2019-02-25 17:32:18 +02:00
renovate[bot]
85470d09d3
chore(deps): update dependency fastify to v1.14.2 (#2370) 2019-02-25 09:26:53 +00:00
renovate[bot]
6ef95fd3b0
chore(deps): update dependency tslint to v5.13.0 (#2369) 2019-02-25 08:48:53 +00:00
renovate[bot]
7d2336971e
chore(deps): update dependency @types/lru-cache to v4.1.2 (#2365) 2019-02-23 05:22:57 +00:00
Anton Vlasenko
720102c2a5 Schema types doc: fix a typo (#2348) 2019-02-22 13:00:40 +02:00
renovate[bot]
ee5b11da99
chore(deps): update dependency typescript to v3.3.3333 (#2358) 2019-02-22 09:29:15 +00: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
5bd4438d14 Update CHANGELOG.md in preparation for v2.4.6. 2019-02-22 07:08:09 +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
587c660dc1 Publish
- apollo-server-express@2.4.5
 - apollo-server@2.4.5
2019-02-21 14:35:58 -05:00
Chang Wang
739682053e Update CHANGELOG.md in preparation for v2.4.5. 2019-02-21 14:32:55 -05:00
Chang Wang
2a9ad9f839
Merge pull request #2352 from KATT/express-context
Express context
2019-02-21 14:30:54 -05:00
KATT
7cb33769cb Tests using ApolloServerExpressConfig 2019-02-21 15:46:10 -03:00
KATT
f0a3c69635 export interface ExpressContext 2019-02-21 15:46:07 -03: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
7da1a9dfa5 Update CHANGELOG.md in preparation for v2.4.4. 2019-02-21 12:59:28 -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
f6cdc94f29
docs: Remove suggestion that server is required for applyMiddleware.
The `server` attribute is neither required nor actually a valid property at all.

Closes #1413.
2019-02-20 20:41:04 +02: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
8303230697
Update CHANGELOG.md in preparation for v2.4.3. 2019-02-20 18:36:24 +02:00
Jesse Rosenberger
e727a252fe
Replace Slack shields in project README.mds with Spectrum shields. (#2345)
As we're moving the community from Slack to Spectrum, its time to update
these shields from our project README files (which show on npm and in
GitHub) to reflect the new home for conversation.

If you haven't already joined the new Apollo community on Spectrum.chat,
visit https://spectrum.chat/apollo/ to join the discussion!

For more details on the move, checkout the Apollo blog post by @hwillson:

https://blog.apollographql.com/goodbye-slack-hello-spectrum-8fa6b979645b
2019-02-20 17:55:16 +02:00
Jesse Rosenberger
72f410da46
Stop casting to net.AddressInfo type as that should already be inferred.
This is necessary after the changes in 0f75909e35
and https://github.com/apollographql/apollo-server/pull/2344, as the
`AddressInfo` type didn't become available until a future version of
`@types/node`.

Regardless, it seems to me that this should be inferred without any problem
and we don't actually rely on the `AddressInfo` type, and instead are only
looking for an interface which has `port`, `address` and `family`, as the
inferred return value from `http.Server.prototype.address()` does.
2019-02-20 17:11:09 +02:00
Jesse Rosenberger
0f75909e35
Pin @types/node to v8.x range.
Follows-up on #2344 with the appropriate changes to the `package.json` as
well.
2019-02-20 15:09:10 +02:00
Jesse Rosenberger
cb43c3b98b
Merge pull request #2176 from apollographql/renovate/jest-junit-6.x
chore(deps): update dependency jest-junit to v6
2019-02-20 15:05:10 +02:00
Jesse Rosenberger
236285d1da
Keep @types/node types at v8. (#2344)
While there are newer types available for newer Node.js APIs, the `8.x` range still gets most of the important updates via back-ports on the `DefinitelyTyped` repository.  I believe it'll be safer to limit the types to the version which we intend on developing for most directly, which is Node.js 8.  Node.js 10 has newer APIs but until we can drop Node.js 8 support (which is not at all anytime soon), we should try to stick to the `8.x` API types.

We will drop Node.js 6 support in the next major version of Apollo Server since it will end it's "Long-Term Support" coverage [in April 2019](https://github.com/nodejs/LTS/).

Hopefully this will auto-close #2302. 😉
2019-02-20 15:02:49 +02:00
Jesse Rosenberger
ffbe91815b
Directly depend on jest-config, since we directly depend on it! 2019-02-20 14:51:18 +02:00
Renovate Bot
c71c64f650 chore(deps): update dependency jest-junit to v6 2019-02-20 12:34:27 +00:00
renovate[bot]
d851c787a3 chore(deps): update dependency ts-jest to v24 (#2336) 2019-02-20 14:24:08 +02:00
Jesse Rosenberger
adecfc8eec
Fix WebSocket type import error: module has no default export (#2230)
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!

<!--
  Thanks for filing a pull request on GraphQL Server!

  Please look at the following checklist to ensure that your PR
  can be accepted quickly:
-->
2019-02-20 13:31:19 +02:00
Jesse Rosenberger
0d4fb48d9a
Merge branch 'master' into patch-1 2019-02-20 13:09:50 +02:00
Jesse Rosenberger
537e55c38d
Update CHANGELOG.md for #2230. 2019-02-20 12:49:57 +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
Jesse Rosenberger
6905e6dfdd
Use specific types from aws-lambda, rather than star-imports.
We've generally moved away from the star-import pattern which TypeScript
also no longer generates with its default `tsc --init` configuration, so it
seems to make sense to keep picking exactly what we want since this pattern
is no longer forced upon us by TypeScript.
2019-02-20 12:45:32 +02:00
Jesse Rosenberger
fe1c27b3e2
Update more optional dependencies in package-lock.json. 2019-02-20 12:16:17 +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
Ralph
2f773625c0 apollo-server-koa: Respond to OPTIONS (#2288)
Closes #2253
2019-02-19 18:01:17 +02:00
Arthur Petrie
212eb94430
Merge branch 'master' into patch-1 2019-02-19 15:55:37 +01:00
Arthur Petrie
5efa6a5175
Update ApolloServer.ts
Fix lambda types import: aws-lambda types has no default export
2019-02-19 15:54:11 +01:00