apollo-server-core
Advanced tools
Comparing version 3.6.3 to 3.6.4
"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]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k; |
@@ -13,3 +13,6 @@ "use strict"; | ||
this.logger = console; | ||
this.trace = new apollo_reporting_protobuf_1.Trace({ root: this.rootNode }); | ||
this.trace = new apollo_reporting_protobuf_1.Trace({ | ||
root: this.rootNode, | ||
fieldExecutionWeight: 1, | ||
}); | ||
this.stopped = false; | ||
@@ -16,0 +19,0 @@ this.nodes = new Map([ |
@@ -281,5 +281,2 @@ "use strict"; | ||
} | ||
else if (metrics.captureTraces) { | ||
treeBuilder.trace.fieldExecutionWeight = 1; | ||
} | ||
} | ||
@@ -345,2 +342,3 @@ }, | ||
} | ||
const isExecutable = statsReportKey === undefined; | ||
if (statsReportKey) { | ||
@@ -368,3 +366,3 @@ if (options.sendUnexecutableOperationDocuments) { | ||
asTrace: graphMightSupportTraces && | ||
!!metrics.captureTraces && | ||
(!isExecutable || !!metrics.captureTraces) && | ||
sendOperationAsTrace(trace, statsReportKey), | ||
@@ -371,0 +369,0 @@ includeTracesContributingToStats, |
@@ -28,3 +28,3 @@ "use strict"; | ||
async function processGraphQLRequest(config, requestContext) { | ||
var _a, _b, _c; | ||
var _a, _b; | ||
const logger = requestContext.logger || console; | ||
@@ -85,3 +85,3 @@ const metrics = (requestContext.metrics = | ||
logger.warn('An error occurred while attempting to read from the documentStore. ' + | ||
((_a = err) === null || _a === void 0 ? void 0 : _a.message) || err); | ||
(err === null || err === void 0 ? void 0 : err.message) || err); | ||
} | ||
@@ -114,3 +114,3 @@ } | ||
requestContext.operation = operation || undefined; | ||
requestContext.operationName = ((_b = operation === null || operation === void 0 ? void 0 : operation.name) === null || _b === void 0 ? void 0 : _b.value) || null; | ||
requestContext.operationName = ((_a = operation === null || operation === void 0 ? void 0 : operation.name) === null || _a === void 0 ? void 0 : _a.value) || null; | ||
try { | ||
@@ -152,3 +152,3 @@ await dispatcher.invokeHook('didResolveOperation', requestContext); | ||
const result = await execute(requestContext); | ||
const resultErrors = (_c = result.errors) === null || _c === void 0 ? void 0 : _c.map((e) => { | ||
const resultErrors = (_b = result.errors) === null || _b === void 0 ? void 0 : _b.map((e) => { | ||
if (isBadUserInputGraphQLError(e)) { | ||
@@ -155,0 +155,0 @@ return (0, apollo_server_errors_1.fromGraphQLError)(e, { |
@@ -21,4 +21,3 @@ "use strict"; | ||
function isHttpQueryError(e) { | ||
var _a; | ||
return ((_a = e) === null || _a === void 0 ? void 0 : _a.name) === 'HttpQueryError'; | ||
return (e === null || e === void 0 ? void 0 : e.name) === 'HttpQueryError'; | ||
} | ||
@@ -25,0 +24,0 @@ exports.isHttpQueryError = isHttpQueryError; |
{ | ||
"name": "apollo-server-core", | ||
"version": "3.6.3", | ||
"version": "3.6.4", | ||
"description": "Core engine for Apollo GraphQL server", | ||
@@ -52,3 +52,3 @@ "main": "dist/index.js", | ||
}, | ||
"gitHead": "289acad0e3777bd0010506763c3fd6e4c0289813" | ||
"gitHead": "dfa9fef87b75513ff32391fb6d8dea4bf5c7d889" | ||
} |
@@ -14,3 +14,13 @@ // This class is a helper for ApolloServerPluginUsageReporting and | ||
private logger: Logger = console; | ||
public trace = new Trace({ root: this.rootNode }); | ||
public trace = new Trace({ | ||
root: this.rootNode, | ||
// By default, each trace counts as one operation for the sake of field | ||
// execution counts. If we end up calling the fieldLevelInstrumentation | ||
// callback (once we've successfully resolved the operation) then we | ||
// may set this to a higher number; but we'll start it at 1 so that traces | ||
// that don't successfully resolve the operation (eg parse failures) or | ||
// where we don't call the callback because a plugin set captureTraces to | ||
// true have a reasonable default. | ||
fieldExecutionWeight: 1, | ||
}); | ||
public startHrTime?: [number, number]; | ||
@@ -17,0 +27,0 @@ private stopped = false; |
@@ -541,7 +541,2 @@ import os from 'os'; | ||
!!treeBuilder.trace.fieldExecutionWeight; | ||
} else if (metrics.captureTraces) { | ||
// Some other plugin already decided that we are capturing traces. | ||
// (For example, you may be running ApolloServerPluginInlineTrace | ||
// and this is a request with the header that requests tracing.) | ||
treeBuilder.trace.fieldExecutionWeight = 1; | ||
} | ||
@@ -648,2 +643,4 @@ } | ||
const isExecutable = statsReportKey === undefined; | ||
if (statsReportKey) { | ||
@@ -680,5 +677,12 @@ if (options.sendUnexecutableOperationDocuments) { | ||
// sendOperationAsTrace says so. | ||
// | ||
// (As an edge case, if the reason metrics.captureTraces is | ||
// falsey is that this is an unexecutable operation and thus we | ||
// never ran the code in didResolveOperation that sets | ||
// metrics.captureTrace, we allow it to be sent as a trace. This | ||
// means we'll still send some parse and validation failures as | ||
// traces, for the sake of the Errors page.) | ||
asTrace: | ||
graphMightSupportTraces && | ||
!!metrics.captureTraces && | ||
(!isExecutable || !!metrics.captureTraces) && | ||
sendOperationAsTrace(trace, statsReportKey), | ||
@@ -685,0 +689,0 @@ includeTracesContributingToStats, |
@@ -16,5 +16,4 @@ import { parse } from 'graphql/language'; | ||
* upgrading `graphql-js` can change its value. It was created for use in | ||
* apollo-server-plugin-operation-registry but it is no longer used there. It is | ||
* *not* the same as the hash used in schema and usage reporting, which is just | ||
* a hash of the schema SDL document. | ||
* apollo-server-plugin-operation-registry (now @apollo/server-plugin-operation-registry) * but it is no longer used there. It is *not* the same as the hash used in | ||
* schema and usage reporting, which is just a hash of the schema SDL document. | ||
* | ||
@@ -21,0 +20,0 @@ * For backwards-compatibility reasons, it is still calculated and passed to all |
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
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
948282
18115