Socket
Socket
Sign inDemoInstall

apollo-server-core

Package Overview
Dependencies
Maintainers
3
Versions
314
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apollo-server-core - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3-tracing.0

1

dist/graphqlOptions.d.ts

@@ -13,2 +13,3 @@ import { GraphQLSchema, ValidationContext } from 'graphql';

debug?: boolean;
tracing?: boolean;
}

@@ -15,0 +16,0 @@ export default GraphQLServerOptions;

@@ -151,2 +151,3 @@ "use strict";

debug: optionsObject.debug,
tracing: optionsObject.tracing
};

@@ -153,0 +154,0 @@ if (optionsObject.formatParams) {

10

dist/runQuery.d.ts

@@ -1,5 +0,6 @@

import { GraphQLSchema, ExecutionResult, DocumentNode, ValidationContext } from 'graphql';
import { GraphQLSchema, DocumentNode, GraphQLError, ValidationContext } from 'graphql';
export interface GqlResponse {
data?: Object;
errors?: Array<string>;
data?: object;
errors?: Array<GraphQLError & object>;
extensions?: object;
}

@@ -40,4 +41,5 @@ export declare enum LogAction {

debug?: boolean;
tracing?: boolean;
}
declare function runQuery(options: QueryOptions): Promise<ExecutionResult>;
declare function runQuery(options: QueryOptions): Promise<GqlResponse>;
export { runQuery };
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var graphql_1 = require("graphql");
var apollo_tracing_1 = require("apollo-tracing");
var LogAction;

@@ -28,2 +29,9 @@ (function (LogAction) {

logFunction({ action: LogAction.request, step: LogStep.start });
var traceCollector;
if (options.tracing) {
traceCollector = new apollo_tracing_1.TraceCollector();
options.context._traceCollector = traceCollector;
traceCollector.requestDidStart();
apollo_tracing_1.instrumentSchemaForTracing(options.schema);
}
function format(errors) {

@@ -77,16 +85,25 @@ return errors.map(function (error) {

}
if (traceCollector) {
traceCollector.executionDidStart();
}
try {
logFunction({ action: LogAction.execute, step: LogStep.start });
return graphql_1.execute(options.schema, documentAST, options.rootValue, options.context, options.variables, options.operationName).then(function (gqlResponse) {
return graphql_1.execute(options.schema, documentAST, options.rootValue, options.context, options.variables, options.operationName).then(function (result) {
logFunction({ action: LogAction.execute, step: LogStep.end });
logFunction({ action: LogAction.request, step: LogStep.end });
var response = {
data: gqlResponse.data,
data: result.data,
};
if (gqlResponse.errors) {
response['errors'] = format(gqlResponse.errors);
if (result.errors) {
response.errors = format(result.errors);
if (debug) {
gqlResponse.errors.map(printStackTrace);
result.errors.map(printStackTrace);
}
}
if (traceCollector) {
traceCollector.requestDidEnd();
response.extensions = {
'tracing': apollo_tracing_1.formatTraceData(traceCollector)
};
}
if (options.formatResponse) {

@@ -93,0 +110,0 @@ response = options.formatResponse(response, options);

{
"name": "apollo-server-core",
"version": "1.0.2",
"version": "1.0.3-tracing.0",
"description": "Core engine for Apollo GraphQL server",

@@ -41,3 +41,6 @@ "main": "dist/index.js",

"definition": "dist/index.d.ts"
},
"dependencies": {
"apollo-tracing": "0.0.4"
}
}

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc