Skip to content

Commit e23d910

Browse files
committed
refactor: update on graphql@15.0.0
1 parent e731c82 commit e23d910

File tree

12 files changed

+1066
-969
lines changed

12 files changed

+1066
-969
lines changed

.flowconfig

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@
3333
.*/node_modules/travis.*
3434
.*/node_modules/uglify.*
3535
.*/node_modules/yargs.*
36-
.*/node_modules/express-graphql/dist/index.js.flow
36+
.*/node_modules/express-graphql/index.js.flow
37+
38+
# Redundant argument. This argument doesn't change any lint settings.
39+
# flowlint uninitialized-instance-property:off
40+
.*/node_modules/graphql/error/GraphQLError.js.flow
3741

3842
[include]
3943

examples/mongooseDiscriminators/data/seed.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export default async function seed(db: any) {
1212

1313
return Promise.all(
1414
files.map((file) => {
15-
return (async function() {
15+
return (async function () {
1616
const colName = `${collectionPrefix || ''}${file}`;
1717
const data = JSON.parse(fs.readFileSync(`${__dirname}/${file}.json`, 'utf8'));
1818
data.forEach((d, i) => {

examples/northwind/FunctifiedAsync.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export class FunctifiedAsync {
1717

1818
map(callback) {
1919
const iterable = this.iterable;
20-
return FunctifiedAsync.fromGenerator(async function*() {
20+
return FunctifiedAsync.fromGenerator(async function* () {
2121
for await (const value of iterable) {
2222
yield callback(value);
2323
}
@@ -26,7 +26,7 @@ export class FunctifiedAsync {
2626

2727
skipWhile(predicate) {
2828
const iterable = this.iterable;
29-
return FunctifiedAsync.fromGenerator(async function*() {
29+
return FunctifiedAsync.fromGenerator(async function* () {
3030
let skip = true;
3131
for await (const value of iterable) {
3232
if (!predicate(value)) {
@@ -41,7 +41,7 @@ export class FunctifiedAsync {
4141

4242
flatten() {
4343
const iterable = this.iterable;
44-
return FunctifiedAsync.fromGenerator(async function*() {
44+
return FunctifiedAsync.fromGenerator(async function* () {
4545
for await (const value of iterable) {
4646
if (value[Symbol.iterator] || value[Symbol.asyncIterator]) {
4747
yield* new FunctifiedAsync(value);
@@ -55,7 +55,7 @@ export class FunctifiedAsync {
5555
takeUntil(predicate) {
5656
const iterator = this.iterable[Symbol.asyncIterator]();
5757
const self = this;
58-
return FunctifiedAsync.fromGenerator(async function*() {
58+
return FunctifiedAsync.fromGenerator(async function* () {
5959
if (self.hasOwnProperty('startValue')) {
6060
yield self.startValue;
6161
}

examples/northwind/data/seed.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export default async function seed(db: any) {
2020

2121
return Promise.all(
2222
files.map((file) => {
23-
return (async function() {
23+
return (async function () {
2424
const colName = `${collectionPrefix || ''}${file}`;
2525
const data = JSON.parse(fs.readFileSync(`${__dirname}/json/${file}.json`, 'utf8'));
2626
if (collectionNames.indexOf(colName) > -1) {

examples/user/__tests__/queriesFromIndex-test.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,8 @@ describe('user > queries', () => {
6262
{
6363
const title = 'Create user mutation (with arg of MIXED type)';
6464
it(title, async () => {
65-
const result = await graphql(meta.schema, findQueryByTitle(title));
66-
// $FlowFixMe
67-
expect(result.data.userCreate.record).toMatchSnapshot();
65+
const result: any = await graphql(meta.schema, findQueryByTitle(title));
66+
expect(result?.data?.userCreate?.record).toMatchSnapshot();
6867
});
6968
}
7069
});

examples/user/data/seed.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export default async function seed(db: any) {
1212

1313
return Promise.all(
1414
files.map((file) => {
15-
return (async function() {
15+
return (async function () {
1616
const colName = `${collectionPrefix || ''}${file}`;
1717
const data = JSON.parse(fs.readFileSync(`${__dirname}/${file}.json`, 'utf8'));
1818
data.forEach((d, i) => {

examples/userForRelay/__tests__/queriesFromIndex-test.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,12 @@ describe('userForRelay > queries', () => {
5959
{
6060
const title = 'Create user mutation';
6161
it(title, async () => {
62-
const result = await graphql({
62+
const result: any = await graphql({
6363
schema: meta.schema,
6464
source: findQueryByTitle(title),
6565
});
66-
// $FlowFixMe
67-
expect(result.data.userCreate.record).toMatchSnapshot();
68-
// $FlowFixMe
69-
expect(result.data.userCreate.clientMutationId).toMatchSnapshot();
66+
expect(result?.data?.userCreate?.record).toMatchSnapshot();
67+
expect(result?.data?.userCreate?.clientMutationId).toMatchSnapshot();
7068
});
7169
}
7270
});

examples/userForRelay/data/seed.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export default async function seed(db: any) {
1212

1313
return Promise.all(
1414
files.map((file) => {
15-
return (async function() {
15+
return (async function () {
1616
const colName = `${collectionPrefix || ''}${file}`;
1717
const data = JSON.parse(fs.readFileSync(`${__dirname}/${file}.json`, 'utf8'));
1818
data.forEach((d, i) => {

package.json

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -28,46 +28,46 @@
2828
"homepage": "https://github.com/nodkz/graphql-compose-examples",
2929
"dependencies": {
3030
"@babel/cli": "7.8.4",
31-
"@babel/core": "7.8.4",
32-
"@babel/node": "7.8.4",
33-
"@babel/plugin-proposal-object-rest-spread": "7.8.3",
34-
"@babel/plugin-transform-flow-strip-types": "7.8.3",
35-
"@babel/preset-env": "7.8.4",
36-
"@babel/preset-flow": "7.8.3",
37-
"altair-express-middleware": "^2.4.3",
38-
"apollo-server-express": "^2.10.1",
39-
"aws-sdk": "2.624.0",
31+
"@babel/core": "7.9.0",
32+
"@babel/node": "7.8.7",
33+
"@babel/plugin-proposal-object-rest-spread": "7.9.0",
34+
"@babel/plugin-transform-flow-strip-types": "7.9.0",
35+
"@babel/preset-env": "7.9.0",
36+
"@babel/preset-flow": "7.9.0",
37+
"altair-express-middleware": "2.4.6",
38+
"apollo-server-express": "2.11.0",
39+
"aws-sdk": "2.653.0",
4040
"cors": "2.8.5",
4141
"dedent": "^0.7.0",
42-
"elasticsearch": "16.6.0",
42+
"elasticsearch": "16.7.1",
4343
"express": "4.17.1",
44-
"graphql": "14.6.0",
45-
"graphql-compose": "7.12.3",
44+
"graphql": "15.0.0",
45+
"graphql-compose": "7.14.1",
4646
"graphql-compose-aws": "4.0.1",
4747
"graphql-compose-connection": "6.0.4",
4848
"graphql-compose-elasticsearch": "4.0.9",
49-
"graphql-compose-mongoose": "7.3.4",
49+
"graphql-compose-mongoose": "7.3.5",
5050
"graphql-compose-pagination": "6.0.3",
5151
"graphql-compose-relay": "5.0.3",
5252
"graphql-query-complexity": "^0.4.1",
5353
"graphql-voyager": "^1.0.0-rc.29",
54-
"mongoose": "5.9.2",
54+
"mongoose": "5.9.7",
5555
"subscriptions-transport-ws": "^0.9.16"
5656
},
5757
"devDependencies": {
5858
"babel-core": "7.0.0-bridge.0",
59-
"babel-eslint": "10.0.3",
60-
"babel-jest": "25.1.0",
59+
"babel-eslint": "10.1.0",
60+
"babel-jest": "25.2.6",
6161
"eslint": "6.8.0",
62-
"eslint-config-airbnb-base": "14.0.0",
63-
"eslint-config-prettier": "6.10.0",
64-
"eslint-plugin-import": "2.20.1",
62+
"eslint-config-airbnb-base": "14.1.0",
63+
"eslint-config-prettier": "6.10.1",
64+
"eslint-plugin-import": "2.20.2",
6565
"eslint-plugin-prettier": "3.1.2",
66-
"flow-bin": "0.118.0",
67-
"jest": "25.1.0",
68-
"mongodb-memory-server": "6.2.4",
66+
"flow-bin": "0.122.0",
67+
"jest": "25.2.7",
68+
"mongodb-memory-server": "6.5.2",
6969
"nodemon": "2.0.2",
70-
"prettier": "1.19.1"
70+
"prettier": "2.0.2"
7171
},
7272
"scripts": {
7373
"build": "npm run buildSchema",

scripts/buildSchema.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
import fs from 'fs';
44
import path from 'path';
55
import { graphql } from 'graphql';
6-
import { introspectionQuery, printSchema } from 'graphql/utilities';
6+
import { getIntrospectionQuery, printSchema } from 'graphql/utilities';
77
import { getExampleNames, resolveExamplePath } from '../config';
88

99
async function buildSchema(schemaPath) {
1010
// $FlowFixMe
1111
const Schema = require(`${schemaPath}/schema`).default; // eslint-disable-line
12-
const result = await graphql(Schema, introspectionQuery);
12+
const result = await graphql(Schema, getIntrospectionQuery());
1313
if (result.errors) {
1414
console.error('ERROR introspecting schema: ', JSON.stringify(result.errors, null, 2));
1515
} else {
@@ -38,7 +38,7 @@ async function run() {
3838
console.log('Building schemas competed!');
3939
}
4040

41-
run().catch(e => {
41+
run().catch((e) => {
4242
console.log(e);
4343
process.exit(0);
4444
});

0 commit comments

Comments
 (0)