apollo-server-core
Advanced tools
Comparing version 3.12.1 to 3.13.0
@@ -525,2 +525,3 @@ "use strict"; | ||
documentStore, | ||
dangerouslyDisableValidation: this.config.dangerouslyDisableValidation, | ||
context, | ||
@@ -527,0 +528,0 @@ parseOptions: this.parseOptions, |
@@ -25,2 +25,3 @@ import type { GraphQLSchema, ValidationContext, GraphQLFieldResolver, DocumentNode, GraphQLError, GraphQLFormattedError, ParseOptions } from 'graphql'; | ||
documentStore?: DocumentStore | null; | ||
dangerouslyDisableValidation?: boolean; | ||
parseOptions?: ParseOptions; | ||
@@ -27,0 +28,0 @@ nodeEnv?: string; |
@@ -20,2 +20,3 @@ import { GraphQLSchema, GraphQLFieldResolver, DocumentNode, GraphQLError, GraphQLFormattedError, ParseOptions } from 'graphql'; | ||
plugins?: ApolloServerPlugin[]; | ||
dangerouslyDisableValidation?: boolean; | ||
documentStore?: DocumentStore | null; | ||
@@ -22,0 +23,0 @@ parseOptions?: ParseOptions; |
@@ -97,11 +97,13 @@ "use strict"; | ||
} | ||
const validationDidEnd = await dispatcher.invokeDidStartHook('validationDidStart', requestContext); | ||
const validationErrors = validate(requestContext.document); | ||
if (validationErrors.length === 0) { | ||
await validationDidEnd(); | ||
if (config.dangerouslyDisableValidation !== true) { | ||
const validationDidEnd = await dispatcher.invokeDidStartHook('validationDidStart', requestContext); | ||
const validationErrors = validate(requestContext.document); | ||
if (validationErrors.length === 0) { | ||
await validationDidEnd(); | ||
} | ||
else { | ||
await validationDidEnd(validationErrors); | ||
return await sendErrorResponse(validationErrors, apollo_server_errors_1.ValidationError); | ||
} | ||
} | ||
else { | ||
await validationDidEnd(validationErrors); | ||
return await sendErrorResponse(validationErrors, apollo_server_errors_1.ValidationError); | ||
} | ||
if (config.documentStore) { | ||
@@ -108,0 +110,0 @@ Promise.resolve(config.documentStore.set(queryHash, requestContext.document)).catch((err) => logger.warn('Could not store validated document. ' + (err === null || err === void 0 ? void 0 : err.message) || err)); |
@@ -125,2 +125,3 @@ "use strict"; | ||
dataSources: options.dataSources, | ||
dangerouslyDisableValidation: options.dangerouslyDisableValidation, | ||
documentStore: options.documentStore, | ||
@@ -127,0 +128,0 @@ persistedQueries: options.persistedQueries, |
@@ -51,2 +51,3 @@ import type { GraphQLSchema, DocumentNode } from 'graphql'; | ||
nodeEnv?: string; | ||
dangerouslyDisableValidation?: boolean; | ||
documentStore?: DocumentStore | null; | ||
@@ -53,0 +54,0 @@ csrfPrevention?: CSRFPreventionOptions | boolean; |
{ | ||
"name": "apollo-server-core", | ||
"version": "3.12.1", | ||
"version": "3.13.0", | ||
"description": "Core engine for Apollo GraphQL server", | ||
@@ -55,3 +55,3 @@ "main": "dist/index.js", | ||
}, | ||
"gitHead": "ea2e2c3e071afc9144af00cae7b51720b9cc8b32" | ||
"gitHead": "f93284e853efd6da46d91ae40da47a2dd15b61fe" | ||
} |
@@ -962,2 +962,3 @@ import { addMocksToSchema } from '@graphql-tools/mock'; | ||
documentStore, | ||
dangerouslyDisableValidation: this.config.dangerouslyDisableValidation, | ||
context, | ||
@@ -964,0 +965,0 @@ parseOptions: this.parseOptions, |
@@ -65,2 +65,3 @@ import type { | ||
documentStore?: DocumentStore | null; | ||
dangerouslyDisableValidation?: boolean; | ||
parseOptions?: ParseOptions; | ||
@@ -67,0 +68,0 @@ nodeEnv?: string; |
@@ -94,2 +94,3 @@ import { | ||
plugins?: ApolloServerPlugin[]; | ||
dangerouslyDisableValidation?: boolean; | ||
documentStore?: DocumentStore | null; | ||
@@ -261,14 +262,16 @@ | ||
const validationDidEnd = await dispatcher.invokeDidStartHook( | ||
'validationDidStart', | ||
requestContext as GraphQLRequestContextValidationDidStart<TContext>, | ||
); | ||
if (config.dangerouslyDisableValidation !== true) { | ||
const validationDidEnd = await dispatcher.invokeDidStartHook( | ||
'validationDidStart', | ||
requestContext as GraphQLRequestContextValidationDidStart<TContext>, | ||
); | ||
const validationErrors = validate(requestContext.document); | ||
const validationErrors = validate(requestContext.document); | ||
if (validationErrors.length === 0) { | ||
await validationDidEnd(); | ||
} else { | ||
await validationDidEnd(validationErrors); | ||
return await sendErrorResponse(validationErrors, ValidationError); | ||
if (validationErrors.length === 0) { | ||
await validationDidEnd(); | ||
} else { | ||
await validationDidEnd(validationErrors); | ||
return await sendErrorResponse(validationErrors, ValidationError); | ||
} | ||
} | ||
@@ -275,0 +278,0 @@ |
@@ -277,2 +277,3 @@ import { Headers, Request } from 'apollo-server-env'; | ||
dataSources: options.dataSources, | ||
dangerouslyDisableValidation: options.dangerouslyDisableValidation, | ||
documentStore: options.documentStore, | ||
@@ -279,0 +280,0 @@ |
@@ -110,2 +110,3 @@ import type { GraphQLSchema, DocumentNode } from 'graphql'; | ||
nodeEnv?: string; | ||
dangerouslyDisableValidation?: boolean; | ||
documentStore?: DocumentStore | null; | ||
@@ -112,0 +113,0 @@ csrfPrevention?: CSRFPreventionOptions | boolean; |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
963243
18349
0