Initial Save

This commit is contained in:
jackbeeby
2025-03-28 12:30:19 +11:00
parent e381994f19
commit d8773925e8
9910 changed files with 982718 additions and 0 deletions

8
node_modules/apollo-server/CHANGELOG.md generated vendored Normal file
View File

@@ -0,0 +1,8 @@
# Changelog
### vNEXT
* `apollo-server`: move non-schema related options into listen [PR#1059](https://github.com/apollographql/apollo-server/pull/1059)
* `apollo-server`: add `bodyParserConfig` options [PR#1059](https://github.com/apollographql/apollo-server/pull/1059)
* `apollo-server`: add `/.well-known/apollo/server-health` endpoint with async callback for additional checks, ie database poke [PR#992](https://github.com/apollographql/apollo-server/pull/992)
* `apollo-server`: collocate graphql gui with endpoint and provide gui when accessed from browser [PR#987](https://github.com/apollographql/apollo-server/pull/987)

21
node_modules/apollo-server/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2016-2020 Apollo Graph, Inc. (Formerly Meteor Development Group, Inc.)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

165
node_modules/apollo-server/README.md generated vendored Normal file
View File

@@ -0,0 +1,165 @@
# <a href='https://www.apollographql.com/'><img src='https://user-images.githubusercontent.com/841294/53402609-b97a2180-39ba-11e9-8100-812bab86357c.png' height='100' alt='Apollo Server'></a>
## GraphQL Server for Express, Koa, Hapi, Lambda, and more.
[![npm version](https://badge.fury.io/js/apollo-server-core.svg)](https://badge.fury.io/js/apollo-server-core)
[![Build Status](https://circleci.com/gh/apollographql/apollo-server/tree/main.svg?style=svg)](https://circleci.com/gh/apollographql/apollo-server/tree/main)
[![Join the community forum](https://img.shields.io/badge/join%20the%20community-forum-blueviolet)](https://community.apollographql.com)
[![Read CHANGELOG](https://img.shields.io/badge/read-changelog-blue)](https://github.com/apollographql/apollo-server/blob/HEAD/CHANGELOG.md)
Apollo Server is a community-maintained open-source GraphQL server. It works with pretty much all Node.js HTTP server frameworks, and we're happy to take PRs to add more! Apollo Server works with any GraphQL schema built with [GraphQL.js](https://github.com/graphql/graphql-js)--or define a schema's type definitions using schema definition language (SDL).
[Read the documentation](https://www.apollographql.com/docs/apollo-server/) for information on getting started and many other use cases and [follow the CHANGELOG](https://github.com/apollographql/apollo-server/blob/HEAD/CHANGELOG.md) for updates.
## Principles
Apollo Server is built with the following principles in mind:
- **By the community, for the community**: Its development is driven by the needs of developers.
- **Simplicity**: By keeping things simple, it is more secure and easier to implement and contribute.
- **Performance**: It is well-tested and production-ready.
Anyone is welcome to contribute to Apollo Server, just read [CONTRIBUTING.md](./CONTRIBUTING.md), take a look at the [roadmap](./ROADMAP.md) and make your first PR!
## Getting started
To get started with Apollo Server:
* Install with `npm install apollo-server-<integration> graphql`
* Write a GraphQL schema
* Use one of the following snippets
There are two ways to install Apollo Server:
* **[Standalone](#installation-standalone)**: For applications that do not require an existing web framework, use the `apollo-server` package.
* **[Integrations](#installation-integrations)**: For applications with a web framework (e.g. `express`, `koa`, `hapi`, etc.), use the appropriate Apollo Server integration package.
For more info, please refer to the [Apollo Server docs](https://www.apollographql.com/docs/apollo-server/v2).
### Installation: Standalone
In a new project, install the `apollo-server` and `graphql` dependencies using:
npm install apollo-server graphql
Then, create an `index.js` which defines the schema and its functionality (i.e. resolvers):
```js
const { ApolloServer, gql } = require('apollo-server');
// The GraphQL schema
const typeDefs = gql`
type Query {
"A simple type for getting started!"
hello: String
}
`;
// A map of functions which return data for the schema.
const resolvers = {
Query: {
hello: () => 'world',
},
};
const server = new ApolloServer({
typeDefs,
resolvers,
});
server.listen().then(({ url }) => {
console.log(`🚀 Server ready at ${url}`);
});
```
> Due to its human-readability, we recommend using [schema-definition language (SDL)](https://www.apollographql.com/docs/apollo-server/essentials/schema/#schema-definition-language) to define a GraphQL schema--[a `GraphQLSchema` object from `graphql-js`](https://github.com/graphql/graphql-js/#using-graphqljs) can also be specified instead of `typeDefs` and `resolvers` using the `schema` property:
>
> ```js
> const server = new ApolloServer({
> schema: ...
> });
> ```
Finally, start the server using `node index.js` and go to the URL returned on the console.
For more details, check out the Apollo Server [Getting Started guide](https://www.apollographql.com/docs/apollo-server/getting-started.html) and the [fullstack tutorial](https://www.apollographql.com/docs/tutorial/introduction.html).
For questions, the [Apollo community forum](https://community.apollographql.com) is a great place to get help.
## Installation: Integrations
While the standalone installation above can be used without making a decision about which web framework to use, the Apollo Server integration packages are paired with specific web frameworks (e.g. Express, Koa, hapi).
The following web frameworks have Apollo Server integrations, and each of these linked integrations has its own installation instructions and examples on its package `README.md`:
- [Express](https://github.com/apollographql/apollo-server/tree/main/packages/apollo-server-express) _(Most popular)_
- [Koa](https://github.com/apollographql/apollo-server/tree/main/packages/apollo-server-koa)
- [Hapi](https://github.com/apollographql/apollo-server/tree/main/packages/apollo-server-hapi)
- [Fastify](https://github.com/apollographql/apollo-server/tree/main/packages/apollo-server-fastify)
- [Amazon Lambda](https://github.com/apollographql/apollo-server/tree/main/packages/apollo-server-lambda)
- [Micro](https://github.com/apollographql/apollo-server/tree/main/packages/apollo-server-micro)
- [Azure Functions](https://github.com/apollographql/apollo-server/tree/main/packages/apollo-server-azure-functions)
- [Google Cloud Functions](https://github.com/apollographql/apollo-server/tree/main/packages/apollo-server-cloud-functions)
- [Cloudflare](https://github.com/apollographql/apollo-server/tree/main/packages/apollo-server-cloudflare) _(Experimental)_
## Context
A request context is available for each request. When `context` is defined as a function, it will be called on each request and will receive an object containing a `req` property, which represents the request itself.
By returning an object from the `context` function, it will be available as the third positional parameter of the resolvers:
```js
new ApolloServer({
typeDefs,
resolvers: {
Query: {
books: (parent, args, context, info) => {
console.log(context.myProperty); // Will be `true`!
return books;
},
}
},
context: async ({ req }) => {
return {
myProperty: true
};
},
})
```
## Documentation
The [Apollo Server documentation](https://apollographql.com/docs/apollo-server/) contains additional details on how to get started with GraphQL and Apollo Server.
The raw Markdown source of the documentation is available within the `docs/` directory of this monorepo--to contribute, please use the _Edit on GitHub_ buttons at the bottom of each page.
## Development
If you wish to develop or contribute to Apollo Server, we suggest the following:
- Fork this repository
- Install the Apollo Server project on your computer
```
git clone https://github.com/[your-user]/apollo-server
cd apollo-server
npm install
cd packages/apollo-server-<integration>/
npm link
```
- Install your local Apollo Server in the other App
```
cd ~/myApp
npm link apollo-server-<integration>
```
## Community
Are you stuck? Want to contribute? Come visit us in the [Apollo community forum!](https://community.apollographql.com)
## Maintainers
- [@abernix](https://github.com/abernix) (Apollo)

5
node_modules/apollo-server/dist/exports.d.ts generated vendored Normal file
View File

@@ -0,0 +1,5 @@
export * from 'graphql-tools';
export * from 'graphql-subscriptions';
export { gql, GraphQLUpload, GraphQLOptions, GraphQLExtension, Config, GraphQLSchemaModule, ApolloError, toApolloError, SyntaxError, ValidationError, AuthenticationError, ForbiddenError, UserInputError, defaultPlaygroundOptions, PlaygroundConfig, PlaygroundRenderPageOptions, } from 'apollo-server-core';
export { CorsOptions } from 'apollo-server-express';
//# sourceMappingURL=exports.d.ts.map

1
node_modules/apollo-server/dist/exports.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../src/exports.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AAEtC,OAAO,EACL,GAAG,EACH,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,MAAM,EACN,mBAAmB,EAEnB,WAAW,EACX,aAAa,EACb,WAAW,EACX,eAAe,EACf,mBAAmB,EACnB,cAAc,EACd,cAAc,EAEd,wBAAwB,EACxB,gBAAgB,EAChB,2BAA2B,GAC5B,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC"}

27
node_modules/apollo-server/dist/exports.js generated vendored Normal file
View File

@@ -0,0 +1,27 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("graphql-tools"), exports);
__exportStar(require("graphql-subscriptions"), exports);
var apollo_server_core_1 = require("apollo-server-core");
Object.defineProperty(exports, "gql", { enumerable: true, get: function () { return apollo_server_core_1.gql; } });
Object.defineProperty(exports, "GraphQLUpload", { enumerable: true, get: function () { return apollo_server_core_1.GraphQLUpload; } });
Object.defineProperty(exports, "GraphQLExtension", { enumerable: true, get: function () { return apollo_server_core_1.GraphQLExtension; } });
Object.defineProperty(exports, "ApolloError", { enumerable: true, get: function () { return apollo_server_core_1.ApolloError; } });
Object.defineProperty(exports, "toApolloError", { enumerable: true, get: function () { return apollo_server_core_1.toApolloError; } });
Object.defineProperty(exports, "SyntaxError", { enumerable: true, get: function () { return apollo_server_core_1.SyntaxError; } });
Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return apollo_server_core_1.ValidationError; } });
Object.defineProperty(exports, "AuthenticationError", { enumerable: true, get: function () { return apollo_server_core_1.AuthenticationError; } });
Object.defineProperty(exports, "ForbiddenError", { enumerable: true, get: function () { return apollo_server_core_1.ForbiddenError; } });
Object.defineProperty(exports, "UserInputError", { enumerable: true, get: function () { return apollo_server_core_1.UserInputError; } });
Object.defineProperty(exports, "defaultPlaygroundOptions", { enumerable: true, get: function () { return apollo_server_core_1.defaultPlaygroundOptions; } });
//# sourceMappingURL=exports.js.map

1
node_modules/apollo-server/dist/exports.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"exports.js","sourceRoot":"","sources":["../src/exports.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gDAA8B;AAC9B,wDAAsC;AAEtC,yDAmB4B;AAlB1B,yGAAA,GAAG,OAAA;AACH,mHAAA,aAAa,OAAA;AAEb,sHAAA,gBAAgB,OAAA;AAIhB,iHAAA,WAAW,OAAA;AACX,mHAAA,aAAa,OAAA;AACb,iHAAA,WAAW,OAAA;AACX,qHAAA,eAAe,OAAA;AACf,yHAAA,mBAAmB,OAAA;AACnB,oHAAA,cAAc,OAAA;AACd,oHAAA,cAAc,OAAA;AAEd,8HAAA,wBAAwB,OAAA"}

31
node_modules/apollo-server/dist/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,31 @@
/// <reference types="node" />
import express from 'express';
import http from 'http';
import { ApolloServer as ApolloServerBase, CorsOptions, ApolloServerExpressConfig } from 'apollo-server-express';
export * from './exports';
export interface ServerInfo {
address: string;
family: string;
url: string;
subscriptionsUrl: string;
port: number | string;
subscriptionsPath: string;
server: http.Server;
}
export declare class ApolloServer extends ApolloServerBase {
private httpServer?;
private cors?;
private onHealthCheck?;
private stopGracePeriodMillis;
constructor(config: ApolloServerExpressConfig & {
cors?: CorsOptions | boolean;
onHealthCheck?: (req: express.Request) => Promise<any>;
stopGracePeriodMillis?: number;
});
private createServerInfo;
applyMiddleware(): void;
start(): Promise<void>;
listen(...opts: Array<any>): Promise<ServerInfo>;
stop(): Promise<void>;
}
//# sourceMappingURL=index.d.ts.map

1
node_modules/apollo-server/dist/index.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAKA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EACL,YAAY,IAAI,gBAAgB,EAChC,WAAW,EACX,yBAAyB,EAC1B,MAAM,uBAAuB,CAAC;AAE/B,cAAc,WAAW,CAAC;AAE1B,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,gBAAgB,EAAE,MAAM,CAAC;IACzB,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IACtB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC;CACrB;AAED,qBAAa,YAAa,SAAQ,gBAAgB;IAChD,OAAO,CAAC,UAAU,CAAC,CAA4B;IAC/C,OAAO,CAAC,IAAI,CAAC,CAAwB;IACrC,OAAO,CAAC,aAAa,CAAC,CAAyC;IAC/D,OAAO,CAAC,qBAAqB,CAAS;gBAGpC,MAAM,EAAE,yBAAyB,GAAG;QAClC,IAAI,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC;QAC7B,aAAa,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,CAAC,OAAO,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;QACvD,qBAAqB,CAAC,EAAE,MAAM,CAAC;KAChC;IAQH,OAAO,CAAC,gBAAgB;IA8CjB,eAAe;IAMT,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAOtB,MAAM,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC;IAqDhD,IAAI;CAQlB"}

114
node_modules/apollo-server/dist/index.js generated vendored Normal file
View File

@@ -0,0 +1,114 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ApolloServer = void 0;
const express_1 = __importDefault(require("express"));
const http_1 = __importDefault(require("http"));
const stoppable_1 = __importDefault(require("stoppable"));
const apollo_server_express_1 = require("apollo-server-express");
__exportStar(require("./exports"), exports);
class ApolloServer extends apollo_server_express_1.ApolloServer {
constructor(config) {
var _a;
super(config);
this.cors = config && config.cors;
this.onHealthCheck = config && config.onHealthCheck;
this.stopGracePeriodMillis = (_a = config === null || config === void 0 ? void 0 : config.stopGracePeriodMillis) !== null && _a !== void 0 ? _a : 10000;
}
createServerInfo(server, subscriptionsPath) {
const serverInfo = Object.assign(Object.assign({}, server.address()), { server,
subscriptionsPath });
let hostForUrl = serverInfo.address;
if (serverInfo.address === '' || serverInfo.address === '::')
hostForUrl = 'localhost';
serverInfo.url = require('url').format({
protocol: 'http',
hostname: hostForUrl,
port: serverInfo.port,
pathname: this.graphqlPath,
});
serverInfo.subscriptionsUrl = require('url').format({
protocol: 'ws',
hostname: hostForUrl,
port: serverInfo.port,
slashes: true,
pathname: subscriptionsPath,
});
return serverInfo;
}
applyMiddleware() {
throw new Error('To use Apollo Server with an existing express application, please use apollo-server-express');
}
start() {
return __awaiter(this, void 0, void 0, function* () {
throw new Error("When using the `apollo-server` package, you don't need to call start(); just call listen().");
});
}
listen(...opts) {
const _super = Object.create(null, {
applyMiddleware: { get: () => super.applyMiddleware }
});
return __awaiter(this, void 0, void 0, function* () {
yield this._start();
const app = express_1.default();
app.disable('x-powered-by');
_super.applyMiddleware.call(this, {
app,
path: '/',
bodyParserConfig: { limit: '50mb' },
onHealthCheck: this.onHealthCheck,
cors: typeof this.cors !== 'undefined'
? this.cors
: {
origin: '*',
},
});
const httpServer = http_1.default.createServer(app);
this.httpServer = stoppable_1.default(httpServer, this.stopGracePeriodMillis);
if (this.subscriptionServerOptions) {
this.installSubscriptionHandlers(httpServer);
}
yield new Promise((resolve) => {
httpServer.once('listening', resolve);
httpServer.listen(...(opts.length ? opts : [{ port: 4000 }]));
});
return this.createServerInfo(httpServer, this.subscriptionsPath);
});
}
stop() {
const _super = Object.create(null, {
stop: { get: () => super.stop }
});
return __awaiter(this, void 0, void 0, function* () {
if (this.httpServer) {
const httpServer = this.httpServer;
yield new Promise((resolve) => httpServer.stop(() => resolve()));
this.httpServer = undefined;
}
yield _super.stop.call(this);
});
}
}
exports.ApolloServer = ApolloServer;
//# sourceMappingURL=index.js.map

1
node_modules/apollo-server/dist/index.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAKA,sDAA8B;AAC9B,gDAAwB;AACxB,0DAAkC;AAClC,iEAI+B;AAE/B,4CAA0B;AAY1B,MAAa,YAAa,SAAQ,oCAAgB;IAMhD,YACE,MAIC;;QAED,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,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,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;gBACvE,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;aAC7B;YACD,MAAM,OAAM,IAAI,WAAE,CAAC;QACrB,CAAC;KAAA;CACF;AA3ID,oCA2IC"}

36
node_modules/apollo-server/package.json generated vendored Normal file
View File

@@ -0,0 +1,36 @@
{
"name": "apollo-server",
"version": "2.26.2",
"description": "Production ready GraphQL Server",
"author": "Apollo <opensource@apollographql.com>",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/apollographql/apollo-server",
"directory": "packages/apollo-server"
},
"keywords": [
"GraphQL",
"Apollo",
"Server",
"Javascript"
],
"license": "MIT",
"bugs": {
"url": "https://github.com/apollographql/apollo-server/issues"
},
"homepage": "https://github.com/apollographql/apollo-server#readme",
"dependencies": {
"apollo-server-core": "^2.26.2",
"apollo-server-express": "^2.26.2",
"express": "^4.0.0",
"graphql-subscriptions": "^1.0.0",
"graphql-tools": "^4.0.8",
"stoppable": "^1.1.0"
},
"peerDependencies": {
"graphql": "^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0"
},
"gitHead": "8fbc66cded6549d5a61433c9fed26775e60e0648"
}

289
node_modules/apollo-server/src/__tests__/index.test.ts generated vendored Normal file
View File

@@ -0,0 +1,289 @@
import { createConnection } from 'net';
import request from 'request';
import { createApolloFetch } from 'apollo-fetch';
import resolvable from '@josephg/resolvable';
import { gql, ApolloServer } from '../index';
const typeDefs = gql`
type Query {
hello: String
hang: String
}
`;
const resolvers = {
Query: {
hello: () => 'hi',
},
};
describe('apollo-server', () => {
describe('constructor', () => {
it('accepts typeDefs and resolvers', () => {
expect(() => new ApolloServer({ typeDefs, resolvers })).not.toThrow;
});
it('accepts typeDefs and mocks', () => {
expect(() => new ApolloServer({ typeDefs, mocks: true })).not.toThrow;
});
it('runs serverWillStart and serverWillStop', async () => {
const fn = jest.fn();
const beAsync = () => new Promise((res) => res());
const server = new ApolloServer({
typeDefs,
resolvers,
plugins: [
{
async serverWillStart() {
fn('a');
await beAsync();
fn('b');
return {
async serverWillStop() {
fn('c');
await beAsync();
fn('d');
},
};
},
},
],
});
await server.listen();
expect(fn.mock.calls).toEqual([['a'], ['b']]);
await server.stop();
expect(fn.mock.calls).toEqual([['a'], ['b'], ['c'], ['d']]);
});
describe('stops even with open HTTP connections', () => {
it('all connections are idle', async () => {
const server = new ApolloServer({
typeDefs,
resolvers,
// Disable killing non-idle connections. This means the test will only
// pass if the fast graceful close of the idle connection works.
stopGracePeriodMillis: Infinity,
});
const { port } = await server.listen({ port: 0 });
// Open a TCP connection to the server, and let it dangle idle
// without starting a request.
const connectionBarrier = resolvable();
createConnection({ host: 'localhost', port: port as number }, () =>
connectionBarrier.resolve(),
);
await connectionBarrier;
// Stop the server. Before, when this was just net.Server.close, this
// would hang. Now that we use stoppable, the idle connection is immediately
// killed.
await server.stop();
});
it('a connection with an active HTTP request', async () => {
const gotToHangBarrier = resolvable();
const hangBarrier = resolvable();
const server = new ApolloServer({
typeDefs,
resolvers: {
...resolvers,
Query: {
...resolvers.Query,
async hang() {
gotToHangBarrier.resolve();
await hangBarrier; // never unblocks
},
},
},
// A short grace period, because we're going to actually let this
// strike.
stopGracePeriodMillis: 10,
});
const { url } = await server.listen({ port: 0 });
// Start an HTTP request that won't ever finish. (Ignore the very
// expected error that happens after the server is stopped.)
const apolloFetch = createApolloFetch({ uri: url });
apolloFetch({ query: '{hang}' }).catch(() => {});
await gotToHangBarrier;
// Stop the server. Before, when this was just net.Server.close, this
// would hang. Now that we use stoppable, the idle connection is immediately
// killed.
await server.stop();
});
});
// These tests are duplicates of ones in apollo-server-integration-testsuite
// We don't actually expect Jest to do much here, the purpose of these
// tests is to make sure our typings are correct, and to trigger a
// compile error if they aren't
describe('context field', () => {
describe('as a function', () => {
it('can accept and return `req`', () => {
expect(
new ApolloServer({
typeDefs,
resolvers,
context: ({ req }) => ({ req }),
}),
).not.toThrow;
});
it('can accept nothing and return an empty object', () => {
expect(
new ApolloServer({
typeDefs,
resolvers,
context: () => ({}),
}),
).not.toThrow;
});
});
});
describe('as an object', () => {
it('can be an empty object', () => {
expect(
new ApolloServer({
typeDefs,
resolvers,
context: {},
}),
).not.toThrow;
});
it('can contain arbitrary values', () => {
expect(
new ApolloServer({
typeDefs,
resolvers,
context: { value: 'arbitrary' },
}),
).not.toThrow;
});
});
});
describe('without registerServer', () => {
let server: ApolloServer;
afterEach(async () => {
await server.stop();
});
it('can be queried', async () => {
server = new ApolloServer({
typeDefs,
resolvers,
});
const { url: uri } = await server.listen({ port: 0 });
const apolloFetch = createApolloFetch({ uri });
const result = await apolloFetch({ query: '{hello}' });
expect(result.data).toEqual({ hello: 'hi' });
expect(result.errors).toBeUndefined();
});
it('renders GraphQL playground when browser requests', async () => {
const nodeEnv = process.env.NODE_ENV;
delete process.env.NODE_ENV;
server = new ApolloServer({
typeDefs,
resolvers,
stopOnTerminationSignals: false,
});
const { url } = await server.listen({ port: 0 });
return new Promise((resolve, reject) => {
request(
{
url,
method: 'GET',
headers: {
accept:
'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',
},
},
(error, response, body) => {
process.env.NODE_ENV = nodeEnv;
if (error) {
reject(error);
} else {
expect(body).toMatch('GraphQLPlayground');
expect(response.statusCode).toEqual(200);
resolve();
}
},
);
});
});
it('configures cors', async () => {
server = new ApolloServer({
typeDefs,
resolvers,
});
const { url: uri } = await server.listen({ port: 0 });
const apolloFetch = createApolloFetch({ uri }).useAfter(
(response, next) => {
expect(
response.response.headers.get('access-control-allow-origin'),
).toEqual('*');
next();
},
);
await apolloFetch({ query: '{hello}' });
});
it('configures cors', async () => {
server = new ApolloServer({
typeDefs,
resolvers,
cors: { origin: 'localhost' },
});
const { url: uri } = await server.listen({ port: 0 });
const apolloFetch = createApolloFetch({ uri }).useAfter(
(response, next) => {
expect(
response.response.headers.get('access-control-allow-origin'),
).toEqual('localhost');
next();
},
);
await apolloFetch({ query: '{hello}' });
});
it('creates a healthcheck endpoint', async () => {
server = new ApolloServer({
typeDefs,
resolvers,
});
const { port } = await server.listen({ port: 0 });
return new Promise((resolve, reject) => {
request(
{
url: `http://localhost:${port}/.well-known/apollo/server-health`,
method: 'GET',
},
(error, response, body) => {
if (error) {
reject(error);
} else {
expect(body).toEqual(JSON.stringify({ status: 'pass' }));
expect(response.statusCode).toEqual(200);
resolve();
}
},
);
});
});
});
});

View File

@@ -0,0 +1,7 @@
{
"extends": "../../../../tsconfig.test.base",
"include": ["**/*"],
"references": [
{ "path": "../../" },
]
}

25
node_modules/apollo-server/src/exports.ts generated vendored Normal file
View File

@@ -0,0 +1,25 @@
export * from 'graphql-tools';
export * from 'graphql-subscriptions';
export {
gql,
GraphQLUpload,
GraphQLOptions,
GraphQLExtension,
Config,
GraphQLSchemaModule,
// Errors
ApolloError,
toApolloError,
SyntaxError,
ValidationError,
AuthenticationError,
ForbiddenError,
UserInputError,
// playground
defaultPlaygroundOptions,
PlaygroundConfig,
PlaygroundRenderPageOptions,
} from 'apollo-server-core';
export { CorsOptions } from 'apollo-server-express';

166
node_modules/apollo-server/src/index.ts generated vendored Normal file
View File

@@ -0,0 +1,166 @@
// This is the "batteries-included" version of `apollo-server-express`. It
// handles creating the Express app and HTTP server for you (using whatever
// version of `express` its dependency pulls in). If you need to customize the
// Express app or HTTP server at all, you just use `apollo-server-express`
// instead.
import express from 'express';
import http from 'http';
import stoppable from 'stoppable';
import {
ApolloServer as ApolloServerBase,
CorsOptions,
ApolloServerExpressConfig,
} from 'apollo-server-express';
export * from './exports';
export interface ServerInfo {
address: string;
family: string;
url: string;
subscriptionsUrl: string;
port: number | string;
subscriptionsPath: string;
server: http.Server;
}
export class ApolloServer extends ApolloServerBase {
private httpServer?: stoppable.StoppableServer;
private cors?: CorsOptions | boolean;
private onHealthCheck?: (req: express.Request) => Promise<any>;
private stopGracePeriodMillis: number;
constructor(
config: ApolloServerExpressConfig & {
cors?: CorsOptions | boolean;
onHealthCheck?: (req: express.Request) => Promise<any>;
stopGracePeriodMillis?: number;
},
) {
super(config);
this.cors = config && config.cors;
this.onHealthCheck = config && config.onHealthCheck;
this.stopGracePeriodMillis = config?.stopGracePeriodMillis ?? 10_000;
}
private createServerInfo(
server: http.Server,
subscriptionsPath?: string,
): ServerInfo {
const serverInfo: any = {
// TODO: Once we bump to `@types/node@10` or higher, we can replace cast
// with the `net.AddressInfo` type, rather than this custom interface.
// Unfortunately, prior to the 10.x types, this type existed on `dgram`,
// but not on `net`, and in later types, the `server.address()` signature
// can also be a string.
...(server.address() as {
address: string;
family: string;
port: number;
}),
server,
subscriptionsPath,
};
// Convert IPs which mean "any address" (IPv4 or IPv6) into localhost
// corresponding loopback ip. Note that the url field we're setting is
// primarily for consumption by our test suite. If this heuristic is wrong
// for your use case, explicitly specify a frontend host (in the `host`
// option to ApolloServer.listen).
let hostForUrl = serverInfo.address;
if (serverInfo.address === '' || serverInfo.address === '::')
hostForUrl = 'localhost';
serverInfo.url = require('url').format({
protocol: 'http',
hostname: hostForUrl,
port: serverInfo.port,
pathname: this.graphqlPath,
});
serverInfo.subscriptionsUrl = require('url').format({
protocol: 'ws',
hostname: hostForUrl,
port: serverInfo.port,
slashes: true,
pathname: subscriptionsPath,
});
return serverInfo;
}
public applyMiddleware() {
throw new Error(
'To use Apollo Server with an existing express application, please use apollo-server-express',
);
}
public async start(): Promise<void> {
throw new Error(
"When using the `apollo-server` package, you don't need to call start(); just call listen().",
);
}
// Listen takes the same arguments as http.Server.listen.
public async listen(...opts: Array<any>): Promise<ServerInfo> {
// First start the server and throw if startup fails (eg, schema can't be loaded
// or a serverWillStart plugin throws).
await this._start();
// This class is the easy mode for people who don't create their own express
// object, so we have to create it.
const app = express();
app.disable('x-powered-by');
// provide generous values for the getting started experience
super.applyMiddleware({
app,
path: '/',
bodyParserConfig: { limit: '50mb' },
onHealthCheck: this.onHealthCheck,
cors:
typeof this.cors !== 'undefined'
? this.cors
: {
origin: '*',
},
});
const httpServer = http.createServer(app);
// `stoppable` adds a `.stop()` method which:
// - closes the server (ie, stops listening)
// - closes all connections with no active requests
// - continues to close connections when their active request count drops to
// zero
// - in 10 seconds (configurable), closes all remaining active connections
// - calls its callback once there are no remaining active connections
//
// If you don't like this behavior, use apollo-server-express instead of
// apollo-server.
this.httpServer = stoppable(httpServer, this.stopGracePeriodMillis);
if (this.subscriptionServerOptions) {
this.installSubscriptionHandlers(httpServer);
}
await new Promise((resolve) => {
httpServer.once('listening', resolve);
// If the user passed a callback to listen, it'll get called in addition
// to our resolver. They won't have the ability to get the ServerInfo
// object unless they use our Promise, though.
httpServer.listen(...(opts.length ? opts : [{ port: 4000 }]));
});
return this.createServerInfo(httpServer, this.subscriptionsPath);
}
public async stop() {
if (this.httpServer) {
const httpServer = this.httpServer;
await new Promise<void>((resolve) => httpServer.stop(() => resolve()));
this.httpServer = undefined;
}
await super.stop();
}
}