Socket
Socket
Sign inDemoInstall

apollo-server-core

Package Overview
Dependencies
Maintainers
4
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.1.7 to 1.2.0-pre.1

1

dist/graphqlOptions.d.ts

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

tracing?: boolean;
cacheControl?: boolean;
}

@@ -17,0 +18,0 @@ export default GraphQLServerOptions;

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

tracing: optionsObject.tracing,
cacheControl: optionsObject.cacheControl,
};

@@ -155,0 +156,0 @@ if (optionsObject.formatParams) {

@@ -43,4 +43,5 @@ import { GraphQLSchema, GraphQLFieldResolver, DocumentNode, GraphQLError, ValidationContext } from 'graphql';

tracing?: boolean;
cacheControl?: boolean;
}
declare function runQuery(options: QueryOptions): Promise<GraphQLResponse>;
export { runQuery };

31

dist/runQuery.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var graphql_1 = require("graphql");
var graphql_extensions_1 = require("graphql-extensions");
var apollo_tracing_1 = require("apollo-tracing");
var apollo_cache_control_1 = require("apollo-cache-control");
var LogAction;

@@ -30,9 +32,15 @@ (function (LogAction) {

var context = options.context || {};
var traceCollector;
var extensions = [];
if (options.tracing) {
traceCollector = new apollo_tracing_1.TraceCollector();
context._traceCollector = traceCollector;
traceCollector.requestDidStart();
apollo_tracing_1.instrumentSchemaForTracing(options.schema);
extensions.push(apollo_tracing_1.TracingExtension);
}
if (options.cacheControl) {
extensions.push(apollo_cache_control_1.CacheControlExtension);
}
var extensionStack = extensions.length > 0 && new graphql_extensions_1.GraphQLExtensionStack(extensions);
if (extensionStack) {
context._extensionStack = extensionStack;
graphql_extensions_1.enableGraphQLExtensions(options.schema);
extensionStack.requestDidStart();
}
function format(errors) {

@@ -86,4 +94,4 @@ return errors.map(function (error) {

}
if (traceCollector) {
traceCollector.executionDidStart();
if (extensionStack) {
extensionStack.executionDidStart();
}

@@ -104,7 +112,6 @@ try {

}
if (traceCollector) {
traceCollector.requestDidEnd();
response.extensions = {
'tracing': apollo_tracing_1.formatTraceData(traceCollector),
};
if (extensionStack) {
extensionStack.executionDidEnd();
extensionStack.requestDidEnd();
response.extensions = extensionStack.format();
}

@@ -111,0 +118,0 @@ if (options.formatResponse) {

{
"name": "apollo-server-core",
"version": "1.1.7",
"version": "1.2.0-pre.1",
"description": "Core engine for Apollo GraphQL server",

@@ -8,2 +8,3 @@ "main": "dist/index.js",

"compile": "tsc",
"watch": "tsc -w",
"prepublish": "npm run compile"

@@ -31,3 +32,4 @@ },

"fibers": "1.0.15",
"meteor-promise": "0.8.6"
"meteor-promise": "0.8.6",
"typescript": "^2.5.3"
},

@@ -42,4 +44,6 @@ "peerDependencies": {

"dependencies": {
"apollo-tracing": "^0.0.x"
"apollo-cache-control": "^0.0.x",
"apollo-tracing": "^0.1.0",
"graphql-extensions": "^0.0.x"
}
}
import { GraphQLSchema, ValidationContext, GraphQLFieldResolver } from 'graphql';
import { LogFunction } from './runQuery';
import { GraphQLExtension } from 'graphql-extensions';

@@ -31,2 +32,3 @@ /*

tracing?: boolean;
cacheControl?: boolean;
}

@@ -33,0 +35,0 @@

@@ -122,2 +122,3 @@ import { parse, getOperationAST, DocumentNode, formatError, ExecutionResult } from 'graphql';

tracing: optionsObject.tracing,
cacheControl: optionsObject.cacheControl,
};

@@ -124,0 +125,0 @@

@@ -16,7 +16,5 @@ import {

import {
TraceCollector,
instrumentSchemaForTracing,
formatTraceData,
} from 'apollo-tracing';
import { enableGraphQLExtensions, GraphQLExtension, GraphQLExtensionStack } from 'graphql-extensions';
import { TracingExtension } from 'apollo-tracing';
import { CacheControlExtension } from 'apollo-cache-control';

@@ -65,2 +63,3 @@ export interface GraphQLResponse {

tracing?: boolean;
cacheControl?: boolean;
}

@@ -85,11 +84,18 @@

const context = options.context || {};
let traceCollector: TraceCollector;
let extensions = [];
if (options.tracing) {
traceCollector = new TraceCollector();
context._traceCollector = traceCollector;
traceCollector.requestDidStart();
instrumentSchemaForTracing(options.schema);
extensions.push(TracingExtension);
}
if (options.cacheControl) {
extensions.push(CacheControlExtension);
}
const extensionStack = extensions.length > 0 && new GraphQLExtensionStack(extensions);
if (extensionStack) {
context._extensionStack = extensionStack;
enableGraphQLExtensions(options.schema);
extensionStack.requestDidStart();
}
function format(errors: Array<Error>): Array<Error> {

@@ -146,4 +152,4 @@ return errors.map((error) => {

if (traceCollector) {
traceCollector.executionDidStart();
if (extensionStack) {
extensionStack.executionDidStart();
}

@@ -176,7 +182,6 @@

if (traceCollector) {
traceCollector.requestDidEnd();
response.extensions = {
'tracing': formatTraceData(traceCollector),
};
if (extensionStack) {
extensionStack.executionDidEnd();
extensionStack.requestDidEnd();
response.extensions = extensionStack.format();
}

@@ -183,0 +188,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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc