apollo-server-core
Advanced tools
Comparing version 3.4.1 to 3.5.0
@@ -26,2 +26,3 @@ import type { GraphQLSchema, ValidationContext, GraphQLFieldResolver, DocumentNode, GraphQLError, GraphQLFormattedError, ParseOptions } from 'graphql'; | ||
nodeEnv?: string; | ||
allowBatchedHttpRequests?: boolean; | ||
} | ||
@@ -28,0 +29,0 @@ export declare type DataSources<TContext> = { |
@@ -8,5 +8,4 @@ export { runHttpQuery, HttpQueryRequest, HttpQueryError, isHttpQueryError, } from './runHttpQuery'; | ||
export { GraphQLServiceContext, GraphQLRequest, VariableValues, GraphQLResponse, GraphQLRequestMetrics, GraphQLRequestContext, ValidationRule, GraphQLExecutor, GraphQLExecutionResult, } from 'apollo-server-types'; | ||
import type { DocumentNode } from 'graphql'; | ||
export declare const gql: (template: TemplateStringsArray | string, ...substitutions: any[]) => DocumentNode; | ||
export * from './gql'; | ||
export * from './plugin'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -12,7 +12,4 @@ "use strict"; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.gql = exports.ApolloServerBase = exports.convertNodeHttpToRequest = exports.formatApolloErrors = exports.UserInputError = exports.ForbiddenError = exports.AuthenticationError = exports.ValidationError = exports.SyntaxError = exports.toApolloError = exports.ApolloError = exports.resolveGraphqlOptions = exports.isHttpQueryError = exports.HttpQueryError = exports.runHttpQuery = void 0; | ||
exports.ApolloServerBase = exports.convertNodeHttpToRequest = exports.formatApolloErrors = exports.UserInputError = exports.ForbiddenError = exports.AuthenticationError = exports.ValidationError = exports.SyntaxError = exports.toApolloError = exports.ApolloError = exports.resolveGraphqlOptions = exports.isHttpQueryError = exports.HttpQueryError = exports.runHttpQuery = void 0; | ||
var runHttpQuery_1 = require("./runHttpQuery"); | ||
@@ -38,5 +35,4 @@ Object.defineProperty(exports, "runHttpQuery", { enumerable: true, get: function () { return runHttpQuery_1.runHttpQuery; } }); | ||
__exportStar(require("./types"), exports); | ||
const graphql_tag_1 = __importDefault(require("graphql-tag")); | ||
exports.gql = graphql_tag_1.default; | ||
__exportStar(require("./gql"), exports); | ||
__exportStar(require("./plugin"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -5,2 +5,5 @@ import type { ImplicitlyInstallablePlugin } from '../../../ApolloServer'; | ||
footer?: boolean; | ||
document?: string; | ||
variables?: Record<string, string>; | ||
headers?: Record<string, string>; | ||
__internal_apolloStudioEnv__?: 'staging' | 'prod'; | ||
@@ -7,0 +10,0 @@ } |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SchemaReporter = exports.schemaReportGql = void 0; | ||
const __1 = require("../.."); | ||
const gql_1 = require("../../gql"); | ||
const apollo_server_env_1 = require("apollo-server-env"); | ||
const graphql_1 = require("graphql"); | ||
exports.schemaReportGql = (0, graphql_1.print)((0, __1.gql) ` | ||
exports.schemaReportGql = (0, graphql_1.print)((0, gql_1.gql) ` | ||
mutation SchemaReport($report: SchemaReport!, $coreSchema: String) { | ||
@@ -9,0 +9,0 @@ reportSchema(report: $report, coreSchema: $coreSchema) { |
@@ -98,2 +98,3 @@ "use strict"; | ||
plugins: options.plugins || [], | ||
allowBatchedHttpRequests: options.allowBatchedHttpRequests, | ||
}; | ||
@@ -158,2 +159,5 @@ return processHTTPRequest(config, request); | ||
if (Array.isArray(requestPayload)) { | ||
if (options.allowBatchedHttpRequests === false) { | ||
return throwHttpGraphQLError(400, [new Error('Operation batching disabled.')], options); | ||
} | ||
const requests = requestPayload.map((requestParams) => parseGraphQLRequest(httpRequest.request, requestParams)); | ||
@@ -160,0 +164,0 @@ const responses = await Promise.all(requests.map(async (request) => { |
@@ -14,3 +14,3 @@ import type { GraphQLSchema, DocumentNode, ParseOptions } from 'graphql'; | ||
export declare type PluginDefinition = ApolloServerPlugin | (() => ApolloServerPlugin); | ||
declare type BaseConfig = Pick<GraphQLOptions<Context>, 'formatError' | 'debug' | 'rootValue' | 'validationRules' | 'executor' | 'formatResponse' | 'fieldResolver' | 'dataSources' | 'cache' | 'logger'>; | ||
declare type BaseConfig = Pick<GraphQLOptions<Context>, 'formatError' | 'debug' | 'rootValue' | 'validationRules' | 'executor' | 'formatResponse' | 'fieldResolver' | 'dataSources' | 'cache' | 'logger' | 'allowBatchedHttpRequests'>; | ||
export declare type Unsubscriber = () => void; | ||
@@ -17,0 +17,0 @@ export declare type SchemaChangeCallback = (apiSchema: GraphQLSchema) => void; |
{ | ||
"name": "apollo-server-core", | ||
"version": "3.4.1", | ||
"version": "3.5.0", | ||
"description": "Core engine for Apollo GraphQL server", | ||
@@ -18,3 +18,3 @@ "main": "dist/index.js", | ||
], | ||
"author": "Apollo <opensource@apollographql.com>", | ||
"author": "Apollo <packages@apollographql.com>", | ||
"license": "MIT", | ||
@@ -35,10 +35,10 @@ "bugs": { | ||
"@josephg/resolvable": "^1.0.0", | ||
"apollo-datasource": "^3.2.0", | ||
"apollo-datasource": "^3.3.0", | ||
"apollo-graphql": "^0.9.0", | ||
"apollo-reporting-protobuf": "^3.1.0", | ||
"apollo-server-caching": "^3.2.0", | ||
"apollo-server-env": "^4.1.0", | ||
"apollo-server-errors": "^3.2.0", | ||
"apollo-server-plugin-base": "^3.3.0", | ||
"apollo-server-types": "^3.3.0", | ||
"apollo-reporting-protobuf": "^3.2.0", | ||
"apollo-server-caching": "^3.3.0", | ||
"apollo-server-env": "^4.2.0", | ||
"apollo-server-errors": "^3.3.0", | ||
"apollo-server-plugin-base": "^3.4.0", | ||
"apollo-server-types": "^3.4.0", | ||
"async-retry": "^1.2.1", | ||
@@ -53,5 +53,5 @@ "fast-json-stable-stringify": "^2.1.0", | ||
"peerDependencies": { | ||
"graphql": "^15.3.0" | ||
"graphql": "^15.3.0 || ^16.0.0" | ||
}, | ||
"gitHead": "f3fcbfe09957806df06f8de431877dd39d8b97c0" | ||
"gitHead": "e6c3cbbf820b3ffff1e7e98d41b3bfc08f99b9b0" | ||
} |
@@ -36,2 +36,3 @@ import type { | ||
* - (optional) parseOptions: options to pass when parsing schemas and queries | ||
* - (optional) allowBatchedHttpRequests: a boolean to toggle whether a single request can contain an array of queries. True by default | ||
* | ||
@@ -67,2 +68,3 @@ */ | ||
nodeEnv?: string; | ||
allowBatchedHttpRequests?: boolean; | ||
} | ||
@@ -69,0 +71,0 @@ |
@@ -42,11 +42,3 @@ export { | ||
// This currently provides the ability to have syntax highlighting as well as | ||
// consistency between client and server gql tags | ||
import type { DocumentNode } from 'graphql'; | ||
import gqlTag from 'graphql-tag'; | ||
export const gql: ( | ||
template: TemplateStringsArray | string, | ||
...substitutions: any[] | ||
) => DocumentNode = gqlTag; | ||
export * from './gql'; | ||
export * from './plugin'; |
@@ -17,2 +17,9 @@ import type { ImplicitlyInstallablePlugin } from '../../../ApolloServer'; | ||
footer?: boolean; | ||
/** | ||
* Folks can configure their landing page to link to Studio Explorer with a | ||
* document, variables and headers loaded in the UI. | ||
*/ | ||
document?: string; | ||
variables?: Record<string, string>; | ||
headers?: Record<string, string>; | ||
// For Apollo use only. | ||
@@ -41,2 +48,5 @@ __internal_apolloStudioEnv__?: 'staging' | 'prod'; | ||
apolloStudioEnv?: 'staging' | 'prod'; | ||
document?: string; | ||
variables?: Record<string, string>; | ||
headers?: Record<string, string>; | ||
footer?: boolean; | ||
@@ -43,0 +53,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import { gql } from '../..'; | ||
import { gql } from '../../gql'; | ||
import { fetch, Headers, Request } from 'apollo-server-env'; | ||
@@ -3,0 +3,0 @@ import type { GraphQLRequest, Logger } from 'apollo-server-types'; |
@@ -199,2 +199,4 @@ import { Request, Headers } from 'apollo-server-env'; | ||
plugins: options.plugins || [], | ||
allowBatchedHttpRequests: options.allowBatchedHttpRequests, | ||
}; | ||
@@ -297,2 +299,10 @@ | ||
if (Array.isArray(requestPayload)) { | ||
if (options.allowBatchedHttpRequests === false) { | ||
return throwHttpGraphQLError( | ||
400, | ||
[new Error('Operation batching disabled.')], | ||
options, | ||
); | ||
} | ||
// We're processing a batch request | ||
@@ -299,0 +309,0 @@ const requests = requestPayload.map((requestParams) => |
@@ -45,2 +45,3 @@ import type { GraphQLSchema, DocumentNode, ParseOptions } from 'graphql'; | ||
| 'logger' | ||
| 'allowBatchedHttpRequests' | ||
>; | ||
@@ -47,0 +48,0 @@ |
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
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
905068
194
17112
+ Addedgraphql@16.9.0(transitive)
Updatedapollo-datasource@^3.3.0
Updatedapollo-server-caching@^3.3.0
Updatedapollo-server-env@^4.2.0
Updatedapollo-server-errors@^3.3.0
Updatedapollo-server-types@^3.4.0