Skip to content

Commit ed59358

Browse files
Merge pull request #717 from enonic/issue-716
Upgrade lib-graphql to 2.0.1 #716
2 parents 7dfe3e9 + 9de5e85 commit ed59358

File tree

10 files changed

+60
-21
lines changed

10 files changed

+60
-21
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ dependencies {
3838
include "com.enonic.lib:lib-mustache:2.0.0"
3939
include "com.enonic.lib:lib-http-client:3.0.0"
4040
include "com.enonic.lib:lib-util:2.2.1"
41-
include "com.enonic.lib:lib-graphql:1.1.1"
41+
include "com.enonic.lib:lib-graphql:2.0.1"
4242
include "com.enonic.lib:lib-geoip:2.0.0"
4343
include "com.enonic.lib:lib-text-encoding:2.0.0"
4444
include "com.enonic.lib:lib-notifications:2.0.0"
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
const graphQlLib = require('/lib/graphql');
2+
3+
for (let prop in graphQlLib) {
4+
exports[prop] = graphQlLib[prop];
5+
}
6+
7+
const schemaGenerator = graphQlLib.newSchemaGenerator();
8+
9+
exports.createSchema = function (params) {
10+
return schemaGenerator.createSchema(params);
11+
}
12+
13+
exports.createPageInfoObjectType = function (params) {
14+
return schemaGenerator.createPageInfoObjectType(params);
15+
}
16+
17+
exports.createObjectType = function (params) {
18+
return schemaGenerator.createObjectType(params);
19+
}
20+
21+
exports.createInputObjectType = function (params) {
22+
return schemaGenerator.createInputObjectType(params);
23+
}
24+
25+
exports.createInterfaceType = function (params) {
26+
return schemaGenerator.createInterfaceType(params);
27+
}
28+
29+
exports.createUnionType = function (params) {
30+
return schemaGenerator.createUnionType(params);
31+
}
32+
33+
exports.createEnumType = function (params) {
34+
return schemaGenerator.createEnumType(params);
35+
}
36+
37+
exports.getSchemaGenerator = function () {
38+
return schemaGenerator;
39+
}

src/main/resources/services/graphql/graphql-enums.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var graphQlLib = require('/lib/graphql');
1+
var graphQlLib = require('/lib/officeleague/graphql');
22

33
exports.handednessEnumType = graphQlLib.createEnumType({
44
name: 'Handedness',

src/main/resources/services/graphql/graphql-info-pages.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var graphQlLib = require('/lib/graphql');
1+
var graphQlLib = require('/lib/officeleague/graphql');
22
// var graphQlConnectionLib = require('/lib/graphql-connection');
33
// var graphQlEnumsLib = require('./graphql-enums');
44
// var graphQlUtilLib = require('./graphql-util');
@@ -26,4 +26,4 @@ exports.infoPageType = graphQlLib.createObjectType({
2626
}
2727
}
2828
}
29-
});
29+
});

src/main/resources/services/graphql/graphql-input-types.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var graphQlLib = require('/lib/graphql');
1+
var graphQlLib = require('/lib/officeleague/graphql');
22
var graphQlEnumsLib = require('./graphql-enums');
33

44
exports.pointCreationType = graphQlLib.createInputObjectType({
@@ -27,4 +27,4 @@ exports.gamePlayerCreationType = graphQlLib.createInputObjectType({
2727
type: graphQlLib.nonNull(graphQlLib.GraphQLID)
2828
}
2929
}
30-
});
30+
});

src/main/resources/services/graphql/graphql-object-types.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var graphQlLib = require('/lib/graphql');
1+
var graphQlLib = require('/lib/officeleague/graphql');
22
var graphQlConnectionLib = require('/lib/graphql-connection');
33
var graphQlEnumsLib = require('./graphql-enums');
44
var graphQlUtilLib = require('./graphql-util');
@@ -165,7 +165,7 @@ exports.playerType = graphQlLib.createObjectType({
165165
}
166166
});
167167

168-
exports.playerConnectionType = graphQlConnectionLib.createConnectionType(exports.playerType);
168+
exports.playerConnectionType = graphQlConnectionLib.createConnectionType(graphQlLib.getSchemaGenerator(), exports.playerType);
169169

170170
exports.teamStatsType = graphQlLib.createObjectType({
171171
name: 'TeamStats',
@@ -251,7 +251,7 @@ exports.teamType = graphQlLib.createObjectType({
251251
}
252252
}
253253
});
254-
exports.teamConnectionType = graphQlConnectionLib.createConnectionType(exports.teamType);
254+
exports.teamConnectionType = graphQlConnectionLib.createConnectionType(graphQlLib.getSchemaGenerator(), exports.teamType);
255255

256256
exports.gamePlayerType = graphQlLib.createObjectType({
257257
name: 'GamePlayer',
@@ -470,7 +470,7 @@ exports.gameType = graphQlLib.createObjectType({
470470
}
471471
}
472472
});
473-
exports.gameConnectionType = graphQlConnectionLib.createConnectionType(exports.gameType);
473+
exports.gameConnectionType = graphQlConnectionLib.createConnectionType(graphQlLib.getSchemaGenerator(), exports.gameType);
474474

475475
exports.leaguePlayerType = graphQlLib.createObjectType({
476476
name: 'LeaguePlayer',
@@ -536,7 +536,7 @@ exports.leaguePlayerType = graphQlLib.createObjectType({
536536
}
537537
}
538538
});
539-
exports.leaguePlayerConnectionType = graphQlConnectionLib.createConnectionType(exports.leaguePlayerType);
539+
exports.leaguePlayerConnectionType = graphQlConnectionLib.createConnectionType(graphQlLib.getSchemaGenerator(), exports.leaguePlayerType);
540540

541541
exports.leagueTeamType = graphQlLib.createObjectType({
542542
name: 'LeagueTeam',
@@ -576,7 +576,7 @@ exports.leagueTeamType = graphQlLib.createObjectType({
576576
}
577577
}
578578
});
579-
exports.leagueTeamConnectionType = graphQlConnectionLib.createConnectionType(exports.leagueTeamType);
579+
exports.leagueTeamConnectionType = graphQlConnectionLib.createConnectionType(graphQlLib.getSchemaGenerator(), exports.leagueTeamType);
580580

581581
exports.leagueStatsType = graphQlLib.createObjectType({
582582
name: 'LeagueStats',
@@ -808,4 +808,4 @@ var getCurrentPlayerId = function () {
808808

809809
var isAdmin = function () {
810810
return authLib.hasRole('system.admin');
811-
};
811+
};

src/main/resources/services/graphql/graphql-root-mutation.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var graphQlLib = require('/lib/graphql');
1+
var graphQlLib = require('/lib/officeleague/graphql');
22
var graphQlEnumsLib = require('./graphql-enums');
33
var graphQlObjectTypesLib = require('./graphql-object-types');
44
var graphQlInputTypesLib = require('./graphql-input-types');
@@ -875,4 +875,4 @@ var isNotAdmin = function () {
875875

876876
var isAdmin = function () {
877877
return authLib.hasRole('system.admin');
878-
};
878+
};

src/main/resources/services/graphql/graphql-root-query.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const graphQlLib = require('/lib/graphql');
1+
const graphQlLib = require('/lib/officeleague/graphql');
22
const graphQlConnectionLib = require('/lib/graphql-connection');
33
const graphQlObjectTypesLib = require('./graphql-object-types');
44
const graphQlInfoPagesLib = require('./graphql-info-pages');
@@ -317,4 +317,4 @@ exports.rootQueryType = graphQlLib.createObjectType({
317317
}
318318
}
319319
}
320-
});
320+
});
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
var graphQlLib = require('/lib/graphql');
1+
var graphQlLib = require('/lib/officeleague/graphql');
22
var graphQlRootQueryLib = require('./graphql-root-query');
33
var graphQlRootMutationLib = require('./graphql-root-mutation');
44

55
exports.schema = graphQlLib.createSchema({
66
query: graphQlRootQueryLib.rootQueryType,
77
mutation: graphQlRootMutationLib.rootMutationType
8-
});
8+
});

src/main/resources/services/graphql/graphql.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var graphQlLib = require('/lib/graphql');
1+
var graphQlLib = require('/lib/officeleague/graphql');
22
var schemaLib = require('./graphql-schema');
33

44
exports.post = function (req) {
@@ -9,4 +9,4 @@ exports.post = function (req) {
99
contentType: 'application/json',
1010
body: result
1111
};
12-
};
12+
};

0 commit comments

Comments
 (0)