apollo-server-core
Advanced tools
Comparing version 3.6.1 to 3.6.2
@@ -168,3 +168,3 @@ "use strict"; | ||
serverListener: plugin.serverWillStart && (await plugin.serverWillStart(service)), | ||
installedImplicity: isImplicitlyInstallablePlugin(plugin) && | ||
installedImplicitly: isImplicitlyInstallablePlugin(plugin) && | ||
plugin.__internal_installed_implicitly__, | ||
@@ -206,3 +206,3 @@ })))).filter((maybeTaggedServerListener) => typeof maybeTaggedServerListener.serverListener === 'object'); | ||
taggedServerListenersWithRenderLandingPage = | ||
taggedServerListenersWithRenderLandingPage.filter((l) => !l.installedImplicity); | ||
taggedServerListenersWithRenderLandingPage.filter((l) => !l.installedImplicitly); | ||
} | ||
@@ -209,0 +209,0 @@ if (taggedServerListenersWithRenderLandingPage.length > 1) { |
@@ -6,3 +6,3 @@ /// <reference types="node" /> | ||
private server; | ||
private reqsPerSocket; | ||
private requestCountPerSocket; | ||
private stopped; | ||
@@ -9,0 +9,0 @@ constructor(server: http.Server | https.Server); |
@@ -11,15 +11,15 @@ "use strict"; | ||
this.server = server; | ||
this.reqsPerSocket = new Map(); | ||
this.requestCountPerSocket = new Map(); | ||
this.stopped = false; | ||
server.on(server instanceof https_1.default.Server ? 'secureConnection' : 'connection', (socket) => { | ||
this.reqsPerSocket.set(socket, 0); | ||
socket.once('close', () => this.reqsPerSocket.delete(socket)); | ||
this.requestCountPerSocket.set(socket, 0); | ||
socket.once('close', () => this.requestCountPerSocket.delete(socket)); | ||
}); | ||
server.on('request', (req, res) => { | ||
var _a; | ||
this.reqsPerSocket.set(req.socket, ((_a = this.reqsPerSocket.get(req.socket)) !== null && _a !== void 0 ? _a : 0) + 1); | ||
this.requestCountPerSocket.set(req.socket, ((_a = this.requestCountPerSocket.get(req.socket)) !== null && _a !== void 0 ? _a : 0) + 1); | ||
res.once('finish', () => { | ||
var _a; | ||
const pending = ((_a = this.reqsPerSocket.get(req.socket)) !== null && _a !== void 0 ? _a : 0) - 1; | ||
this.reqsPerSocket.set(req.socket, pending); | ||
const pending = ((_a = this.requestCountPerSocket.get(req.socket)) !== null && _a !== void 0 ? _a : 0) - 1; | ||
this.requestCountPerSocket.set(req.socket, pending); | ||
if (this.stopped && pending === 0) { | ||
@@ -39,5 +39,5 @@ req.socket.end(); | ||
gracefully = false; | ||
this.reqsPerSocket.forEach((_, socket) => socket.end()); | ||
this.requestCountPerSocket.forEach((_, socket) => socket.end()); | ||
setImmediate(() => { | ||
this.reqsPerSocket.forEach((_, socket) => socket.destroy()); | ||
this.requestCountPerSocket.forEach((_, socket) => socket.destroy()); | ||
}); | ||
@@ -53,3 +53,3 @@ }, stopGracePeriodMillis); | ||
})); | ||
this.reqsPerSocket.forEach((requests, socket) => { | ||
this.requestCountPerSocket.forEach((requests, socket) => { | ||
if (requests === 0) | ||
@@ -56,0 +56,0 @@ socket.end(); |
import { fetch } from 'apollo-server-env'; | ||
import type { Logger } from 'apollo-server-types'; | ||
import type { SchemaReport, ReportSchemaResponse } from './operations'; | ||
import type { SchemaReport, ReportSchemaResponse } from './generated/operations'; | ||
export declare const schemaReportGql: string; | ||
@@ -5,0 +5,0 @@ export declare class SchemaReporter { |
@@ -1,4 +0,4 @@ | ||
import type { GraphQLSchema, DocumentNode, ParseOptions } from 'graphql'; | ||
import type { GraphQLSchema, DocumentNode } from 'graphql'; | ||
import type { IMocks } from '@graphql-tools/mock'; | ||
import type { IResolvers } from '@graphql-tools/utils'; | ||
import type { IExecutableSchemaDefinition } from '@graphql-tools/schema'; | ||
import type { ApolloConfig, ValueOrPromise, GraphQLExecutor, ApolloConfigInput } from 'apollo-server-types'; | ||
@@ -37,5 +37,5 @@ import type { GraphQLServerOptions as GraphQLOptions, PersistedQueryOptions } from './graphqlOptions'; | ||
modules?: GraphQLSchemaModule[]; | ||
typeDefs?: DocumentNode | Array<DocumentNode> | string | Array<string>; | ||
parseOptions?: ParseOptions; | ||
resolvers?: IResolvers | Array<IResolvers>; | ||
typeDefs?: IExecutableSchemaDefinition['typeDefs']; | ||
resolvers?: IExecutableSchemaDefinition['resolvers']; | ||
parseOptions?: IExecutableSchemaDefinition['parseOptions']; | ||
schema?: GraphQLSchema; | ||
@@ -42,0 +42,0 @@ context?: Context | ContextFunction<ContextFunctionParams>; |
{ | ||
"name": "apollo-server-core", | ||
"version": "3.6.1", | ||
"version": "3.6.2", | ||
"description": "Core engine for Apollo GraphQL server", | ||
@@ -32,11 +32,10 @@ "main": "dist/index.js", | ||
"@graphql-tools/schema": "^8.0.0", | ||
"@graphql-tools/utils": "^8.0.0", | ||
"@josephg/resolvable": "^1.0.0", | ||
"apollo-datasource": "^3.3.0", | ||
"apollo-datasource": "^3.3.1", | ||
"apollo-reporting-protobuf": "^3.3.0", | ||
"apollo-server-caching": "^3.3.0", | ||
"apollo-server-env": "^4.2.0", | ||
"apollo-server-errors": "^3.3.0", | ||
"apollo-server-plugin-base": "^3.5.0", | ||
"apollo-server-types": "^3.5.0", | ||
"apollo-server-env": "^4.2.1", | ||
"apollo-server-errors": "^3.3.1", | ||
"apollo-server-plugin-base": "^3.5.1", | ||
"apollo-server-types": "^3.5.1", | ||
"async-retry": "^1.2.1", | ||
@@ -54,3 +53,3 @@ "fast-json-stable-stringify": "^2.1.0", | ||
}, | ||
"gitHead": "f3fc7d147a3bc3446f4f3452acfa5f598099b08f" | ||
"gitHead": "022184a4d01d4452ebbcfeeef6e8ee1aae7a5db7" | ||
} |
@@ -397,3 +397,3 @@ import { addMocksToSchema } from '@graphql-tools/mock'; | ||
plugin.serverWillStart && (await plugin.serverWillStart(service)), | ||
installedImplicity: | ||
installedImplicitly: | ||
isImplicitlyInstallablePlugin(plugin) && | ||
@@ -408,3 +408,3 @@ plugin.__internal_installed_implicitly__, | ||
serverListener: GraphQLServerListener; | ||
installedImplicity: boolean; | ||
installedImplicitly: boolean; | ||
} => typeof maybeTaggedServerListener.serverListener === 'object', | ||
@@ -469,3 +469,3 @@ ); | ||
taggedServerListenersWithRenderLandingPage.filter( | ||
(l) => !l.installedImplicity, | ||
(l) => !l.installedImplicitly, | ||
); | ||
@@ -472,0 +472,0 @@ } |
@@ -34,12 +34,12 @@ // This file is adapted from the stoppable npm package: | ||
export class Stopper { | ||
private reqsPerSocket = new Map<Socket, number>(); | ||
private requestCountPerSocket = new Map<Socket, number>(); | ||
private stopped = false; | ||
constructor(private server: http.Server | https.Server) { | ||
// Keep a number in reqsPerSocket for each current connection. | ||
// Keep a number in requestCountPerSocket for each current connection. | ||
server.on( | ||
server instanceof https.Server ? 'secureConnection' : 'connection', | ||
(socket: Socket) => { | ||
this.reqsPerSocket.set(socket, 0); | ||
socket.once('close', () => this.reqsPerSocket.delete(socket)); | ||
this.requestCountPerSocket.set(socket, 0); | ||
socket.once('close', () => this.requestCountPerSocket.delete(socket)); | ||
}, | ||
@@ -52,9 +52,9 @@ ); | ||
(req: http.IncomingMessage, res: http.ServerResponse) => { | ||
this.reqsPerSocket.set( | ||
this.requestCountPerSocket.set( | ||
req.socket, | ||
(this.reqsPerSocket.get(req.socket) ?? 0) + 1, | ||
(this.requestCountPerSocket.get(req.socket) ?? 0) + 1, | ||
); | ||
res.once('finish', () => { | ||
const pending = (this.reqsPerSocket.get(req.socket) ?? 0) - 1; | ||
this.reqsPerSocket.set(req.socket, pending); | ||
const pending = (this.requestCountPerSocket.get(req.socket) ?? 0) - 1; | ||
this.requestCountPerSocket.set(req.socket, pending); | ||
// If we're in the process of stopping and it's gone idle, close the | ||
@@ -85,7 +85,7 @@ // socket. | ||
gracefully = false; | ||
this.reqsPerSocket.forEach((_, socket) => socket.end()); | ||
this.requestCountPerSocket.forEach((_, socket) => socket.end()); | ||
// (FYI, when importing from upstream, not sure why we need setImmediate | ||
// here.) | ||
setImmediate(() => { | ||
this.reqsPerSocket.forEach((_, socket) => socket.destroy()); | ||
this.requestCountPerSocket.forEach((_, socket) => socket.destroy()); | ||
}); | ||
@@ -108,3 +108,3 @@ }, stopGracePeriodMillis); | ||
// Immediately close any idle sockets. | ||
this.reqsPerSocket.forEach((requests, socket) => { | ||
this.requestCountPerSocket.forEach((requests, socket) => { | ||
if (requests === 0) socket.end(); | ||
@@ -111,0 +111,0 @@ }); |
@@ -9,3 +9,3 @@ import os from 'os'; | ||
import { schemaIsFederated } from '../schemaIsFederated'; | ||
import type { SchemaReport } from './operations'; | ||
import type { SchemaReport } from './generated/operations'; | ||
@@ -136,3 +136,3 @@ export interface ApolloServerPluginSchemaReportingOptions { | ||
// An identifier used to distinguish the version of the server code such as git or docker sha. | ||
// Length must be <= 256 charecters | ||
// Length must be <= 256 characters | ||
userVersion: process.env.APOLLO_SERVER_USER_VERSION, | ||
@@ -139,0 +139,0 @@ // "An identifier for the server instance. Length must be <= 256 characters. |
@@ -10,3 +10,3 @@ import { gql } from '../../gql'; | ||
ReportSchemaResponse, | ||
} from './operations'; | ||
} from './generated/operations'; | ||
@@ -13,0 +13,0 @@ export const schemaReportGql = print(gql` |
@@ -194,3 +194,3 @@ import type { GraphQLError, DocumentNode } from 'graphql'; | ||
* validation phases). This will be included as a separate field on the trace | ||
* and the operation name and signature will always be reported with a cosntant | ||
* and the operation name and signature will always be reported with a constant | ||
* identifier. Whether the operation was a parse failure or a validation | ||
@@ -197,0 +197,0 @@ * failure will be embedded within the stats report key itself. |
@@ -1,4 +0,4 @@ | ||
import type { GraphQLSchema, DocumentNode, ParseOptions } from 'graphql'; | ||
import type { GraphQLSchema, DocumentNode } from 'graphql'; | ||
import type { IMocks } from '@graphql-tools/mock'; | ||
import type { IResolvers } from '@graphql-tools/utils'; | ||
import type { IExecutableSchemaDefinition } from '@graphql-tools/schema'; | ||
import type { | ||
@@ -92,5 +92,10 @@ ApolloConfig, | ||
modules?: GraphQLSchemaModule[]; | ||
typeDefs?: DocumentNode | Array<DocumentNode> | string | Array<string>; | ||
parseOptions?: ParseOptions; | ||
resolvers?: IResolvers | Array<IResolvers>; | ||
// These three options are always only passed directly through to | ||
// makeExecutableSchema. (If you don't want to use makeExecutableSchema, pass | ||
// `schema` instead.) | ||
typeDefs?: IExecutableSchemaDefinition['typeDefs']; | ||
resolvers?: IExecutableSchemaDefinition['resolvers']; | ||
parseOptions?: IExecutableSchemaDefinition['parseOptions']; | ||
schema?: GraphQLSchema; | ||
@@ -97,0 +102,0 @@ context?: Context | ContextFunction<ContextFunctionParams>; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
944658
21
18013
- Removed@graphql-tools/utils@^8.0.0
- Removed@graphql-tools/utils@8.13.1(transitive)
Updatedapollo-datasource@^3.3.1
Updatedapollo-server-env@^4.2.1
Updatedapollo-server-errors@^3.3.1
Updatedapollo-server-types@^3.5.1