Skip to content

Commit

Permalink
Merge pull request #260 from apollostack/switch-typings
Browse files Browse the repository at this point in the history
Switch typings
  • Loading branch information
helfer authored Jan 12, 2017
2 parents 9da3dec + 3858033 commit 780a9eb
Show file tree
Hide file tree
Showing 20 changed files with 52 additions and 59 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

### VNEXT

### v0.5.0
* Switch graphql typings for typescript to @types/graphql [#260](https://github.com/apollostack/graphql-server/pull/260)

### v0.4.4
* Update GraphiQL to version 0.8.0 ([@DxCx](https://github.com/DxCx)) on [#192](https://github.com/apollostack/graphql-server/pull/192)
* Upgrade to GraphQL-js 0.8.1.
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"lerna": "2.0.0-beta.30",
"version": "0.4.4",
"version": "0.5.0",
"changelog": {
"repo": "apollostack/graphql-server",
"labels": {
Expand Down
6 changes: 3 additions & 3 deletions packages/graphql-server-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "graphql-server-core",
"version": "0.4.4",
"version": "0.5.0",
"description": "Core engine for Apollo GraphQL server",
"main": "dist/index.js",
"scripts": {
Expand All @@ -26,15 +26,15 @@
"dependencies": {},
"devDependencies": {
"@types/fibers": "0.0.29",
"typed-graphql": "^1.0.2",
"@types/graphql": "^0.8.5",
"fibers": "^1.0.15",
"meteor-promise": "^0.7.3"
},
"peerDependencies": {
"graphql": "^0.6.1 || ^0.7.0 || ^0.8.0"
},
"optionalDependencies": {
"typed-graphql": "^1.0.2"
"@types/graphql": "^0.8.5"
},
"typings": "dist/index.d.ts",
"typescript": {
Expand Down
4 changes: 2 additions & 2 deletions packages/graphql-server-core/src/graphqlOptions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { GraphQLSchema, ValidationRule } from 'graphql';
import { GraphQLSchema, ValidationContext } from 'graphql';
import { LogFunction } from './runQuery';

/*
Expand All @@ -22,7 +22,7 @@ interface GraphQLServerOptions {
context?: any;
logFunction?: LogFunction;
formatParams?: Function;
validationRules?: Array<ValidationRule>;
validationRules?: Array<(context: ValidationContext) => any>;
formatResponse?: Function;
debug?: boolean;
}
Expand Down
18 changes: 9 additions & 9 deletions packages/graphql-server-core/src/runQuery.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import {
GraphQLSchema,
GraphQLResult,
Document,
ExecutionResult,
DocumentNode,
parse,
print,
validate,
execute,
formatError,
specifiedRules,
ValidationRule,
ValidationContext,
} from 'graphql';

export interface GqlResponse {
Expand Down Expand Up @@ -37,13 +37,13 @@ export interface LogFunction {

export interface QueryOptions {
schema: GraphQLSchema;
query: string | Document;
query: string | DocumentNode;
rootValue?: any;
context?: any;
variables?: { [key: string]: any };
operationName?: string;
logFunction?: LogFunction;
validationRules?: Array<ValidationRule>;
validationRules?: Array<(context: ValidationContext) => any>;
// WARNING: these extra validation rules are only applied to queries
// submitted as string, not those submitted as Document!

Expand All @@ -54,13 +54,13 @@ export interface QueryOptions {

const resolvedPromise = Promise.resolve();

function runQuery(options: QueryOptions): Promise<GraphQLResult> {
function runQuery(options: QueryOptions): Promise<ExecutionResult> {
// Fiber-aware Promises run their .then callbacks in Fibers.
return resolvedPromise.then(() => doRunQuery(options));
}

function doRunQuery(options: QueryOptions): Promise<GraphQLResult> {
let documentAST: Document;
function doRunQuery(options: QueryOptions): Promise<ExecutionResult> {
let documentAST: DocumentNode;

const logFunction = options.logFunction || function(){ return null; };
const debugDefault = process.env.NODE_ENV !== 'production' && process.env.NODE_ENV !== 'test';
Expand Down Expand Up @@ -118,7 +118,7 @@ function doRunQuery(options: QueryOptions): Promise<GraphQLResult> {
return Promise.resolve({ errors: format(validationErrors) });
}
} else {
documentAST = options.query as Document;
documentAST = options.query as DocumentNode;
}

try {
Expand Down
1 change: 0 additions & 1 deletion packages/graphql-server-core/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"node_modules/@types"
],
"types": [
"typed-graphql",
"@types/node"
]
},
Expand Down
12 changes: 6 additions & 6 deletions packages/graphql-server-express/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "graphql-server-express",
"version": "0.4.4",
"version": "0.5.0",
"description": "Production-ready Node.js GraphQL server for Express and Connect",
"main": "dist/index.js",
"scripts": {
Expand All @@ -26,26 +26,26 @@
},
"homepage": "https://github.com/apollostack/graphql-server#readme",
"dependencies": {
"graphql-server-core": "^0.4.4",
"graphql-server-core": "^0.5.0",
"graphql-server-module-graphiql": "^0.4.4"
},
"devDependencies": {
"@types/body-parser": "0.0.33",
"@types/connect": "^3.4.30",
"@types/express": "^4.0.33",
"@types/multer": "0.0.32",
"graphql-server-integration-testsuite": "^0.4.4",
"graphql-server-integration-testsuite": "^0.5.0",
"body-parser": "^1.15.2",
"connect": "^3.4.1",
"express": "^4.14.0",
"multer": "^1.2.0",
"typed-graphql": "^1.0.2"
"multer": "^1.2.0"
},
"peerDependencies": {
"graphql": "^0.6.1 || ^0.7.0 || ^0.8.0"
},
"optionalDependencies": {
"@types/express": "^4.0.33"
"@types/express": "^4.0.33",
"@types/graphql": "^0.8.5"
},
"typings": "dist/index.d.ts",
"typescript": {
Expand Down
2 changes: 1 addition & 1 deletion packages/graphql-server-express/src/expressApollo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export function graphqlExpress(options: GraphQLOptions | ExpressGraphQLOptionsFu
b = [b];
}

let responses: Array<graphql.GraphQLResult> = [];
let responses: Array<graphql.ExecutionResult> = [];
for (let requestParams of b) {
try {
const query = requestParams.query;
Expand Down
1 change: 0 additions & 1 deletion packages/graphql-server-express/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"node_modules/@types"
],
"types": [
"typed-graphql",
"@types/node"
]
},
Expand Down
10 changes: 5 additions & 5 deletions packages/graphql-server-hapi/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "graphql-server-hapi",
"version": "0.4.4",
"version": "0.5.0",
"description": "Production-ready Node.js GraphQL server for Hapi",
"main": "dist/index.js",
"scripts": {
Expand All @@ -25,23 +25,23 @@
},
"homepage": "https://github.com/apollostack/graphql-server#readme",
"dependencies": {
"graphql-server-core": "^0.4.4",
"graphql-server-core": "^0.5.0",
"graphql-server-module-graphiql": "^0.4.4",
"boom": "^4.0.0"
},
"devDependencies": {
"@types/boom": "0.0.32",
"@types/hapi": "^13.0.35",
"graphql-server-integration-testsuite": "^0.4.4",
"graphql-server-integration-testsuite": "^0.5.0",
"hapi": "^15.0.3",
"typed-graphql": "^1.0.2"
"@types/graphql": "^0.8.5"
},
"peerDependencies": {
"graphql": "^0.6.1 || ^0.7.0 || ^0.8.0"
},
"optionalDependencies": {
"@types/hapi": "^13.0.35",
"typed-graphql": "^1.0.2"
"@types/graphql": "^0.8.5"
},
"typings": "dist/index.d.ts",
"typescript": {
Expand Down
4 changes: 2 additions & 2 deletions packages/graphql-server-hapi/src/hapiApollo.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as Boom from 'boom';
import { Server, Request, IReply } from 'hapi';
import { GraphQLResult, formatError } from 'graphql';
import { ExecutionResult, formatError } from 'graphql';
import * as GraphiQL from 'graphql-server-module-graphiql';
import { GraphQLOptions, runQuery } from 'graphql-server-core';

Expand Down Expand Up @@ -125,7 +125,7 @@ async function getGraphQLOptions(request: Request, reply: IReply): Promise<{}> {
async function processQuery(graphqlParams, optionsObject: GraphQLOptions, isBatch: boolean, reply) {
const formatErrorFn = optionsObject.formatError || formatError;

let responses: GraphQLResult[] = [];
let responses: ExecutionResult[] = [];
for (let query of graphqlParams) {
try {
// Shallow clone context for queries in batches. This allows
Expand Down
1 change: 0 additions & 1 deletion packages/graphql-server-hapi/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"node_modules/@types"
],
"types": [
"typed-graphql",
"@types/node"
]
},
Expand Down
10 changes: 5 additions & 5 deletions packages/graphql-server-integration-testsuite/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "graphql-server-integration-testsuite",
"private": true,
"version": "0.4.4",
"version": "0.5.0",
"description": "Apollo Server Integrations testsuite",
"main": "dist/index.js",
"scripts": {
Expand All @@ -20,20 +20,20 @@
},
"homepage": "https://github.com/apollostack/graphql-server#readme",
"dependencies": {
"graphql-server-core": "^0.4.4",
"graphql-server-core": "^0.5.0",
"graphql-server-module-graphiql": "^0.4.4",
"graphql-server-module-operation-store": "^0.4.4",
"graphql-server-module-operation-store": "^0.5.0",
"supertest": "^2.0.0",
"supertest-as-promised": "^4.0.0"
},
"devDependencies": {
"typed-graphql": "^1.0.2"
"@types/graphql": "^0.8.5"
},
"peerDependencies": {
"graphql": "^0.6.1 || ^0.7.0 || ^0.8.0"
},
"optionalDependencies": {
"typed-graphql": "^1.0.2"
"@types/graphql": "^0.8.5"
},
"typings": "dist/index.d.ts",
"typescript": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"node_modules/@types"
],
"types": [
"typed-graphql",
"@types/node"
]
},
Expand Down
11 changes: 5 additions & 6 deletions packages/graphql-server-koa/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "graphql-server-koa",
"version": "0.4.4",
"version": "0.5.0",
"description": "Production-ready Node.js GraphQL server for Koa",
"main": "dist/index.js",
"scripts": {
Expand All @@ -25,25 +25,24 @@
},
"homepage": "https://github.com/apollostack/graphql-server#readme",
"dependencies": {
"graphql-server-core": "^0.4.4",
"graphql-server-core": "^0.5.0",
"graphql-server-module-graphiql": "^0.4.4"
},
"devDependencies": {
"@types/koa": "^2.0.33",
"@types/koa-bodyparser": "^3.0.19",
"@types/koa-router": "^7.0.21",
"graphql-server-integration-testsuite": "^0.4.4",
"graphql-server-integration-testsuite": "^0.5.0",
"koa": "^2.0.0-alpha.4",
"koa-bodyparser": "^3.0.0",
"koa-router": "^7.0.1",
"typed-graphql": "^1.0.2"
"koa-router": "^7.0.1"
},
"peerDependencies": {
"graphql": "^0.6.1 || ^0.7.0 || ^0.8.0"
},
"optionalDependencies": {
"@types/koa": "^2.0.33",
"typed-graphql": "^1.0.2"
"@types/graphql": "^0.8.5"
},
"typings": "dist/index.d.ts",
"typescript": {
Expand Down
2 changes: 1 addition & 1 deletion packages/graphql-server-koa/src/koaApollo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export function graphqlKoa(options: GraphQLOptions | KoaGraphQLOptionsFunction):
b = [b];
}

let responses: Array<graphql.GraphQLResult> = [];
let responses: Array<graphql.ExecutionResult> = [];
for (let requestParams of b) {
try {
const query = requestParams.query;
Expand Down
1 change: 0 additions & 1 deletion packages/graphql-server-koa/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"node_modules/@types"
],
"types": [
"typed-graphql",
"@types/node"
]
},
Expand Down
7 changes: 2 additions & 5 deletions packages/graphql-server-module-operation-store/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "graphql-server-module-operation-store",
"version": "0.4.4",
"version": "0.5.0",
"description": "Persisted operation store module for Apollo GraphQL Servers",
"main": "dist/index.js",
"scripts": {
Expand All @@ -24,14 +24,11 @@
},
"homepage": "https://github.com/apollostack/graphql-server#readme",
"dependencies": {},
"devDependencies": {
"typed-graphql": "^1.0.2"
},
"peerDependencies": {
"graphql": "^0.6.1 || ^0.7.0 || ^0.8.0"
},
"optionalDependencies": {
"typed-graphql": "^1.0.2"
"@types/graphql": "^0.8.5"
},
"typings": "dist/index.d.ts",
"typescript": {
Expand Down
Loading

0 comments on commit 780a9eb

Please sign in to comment.