1
- const { createPostGraphileSchema } = require ( ' postgraphile' )
1
+ const { createPostGraphileSchema } = require ( " postgraphile" ) ;
2
2
3
3
function requireFrom ( modules , moduleName ) {
4
- const path = [ ...modules , moduleName ] . join ( ' /node_modules/' )
4
+ const path = [ ...modules , moduleName ] . join ( " /node_modules/" ) ;
5
5
try {
6
6
return require ( path ) ; // eslint-disable-line
7
7
} catch ( e ) {
@@ -10,46 +10,40 @@ function requireFrom(modules, moduleName) {
10
10
const result = requireFrom (
11
11
modules . slice ( 0 , modules . length - 1 ) ,
12
12
moduleName
13
- )
14
- if ( result ) return result
13
+ ) ;
14
+ if ( result ) return result ;
15
15
}
16
16
return (
17
17
requireFrom ( modules . slice ( 1 ) , moduleName ) ||
18
18
requireFrom ( modules . slice ( 0 , modules . length - 1 ) , moduleName )
19
- )
19
+ ) ;
20
20
}
21
21
}
22
22
const graphileBuild = requireFrom (
23
- [ 'postgraphile' , 'postgraphile-core' ] ,
24
- 'graphile-build'
25
- )
26
- /*
27
- const graphileBuildPg = requireFrom(
28
- ['postgraphile', 'postgraphile-core'],
29
- 'postgraphile/node_modules/graphile-build-pg'
30
- )
31
- */
23
+ [ "postgraphile" , "postgraphile-core" ] ,
24
+ "graphile-build"
25
+ ) ;
32
26
33
- const RenamedQueryPlugin = require ( ' ./RenamedQueryPlugin' )
27
+ const RenamedQueryPlugin = require ( " ./RenamedQueryPlugin" ) ;
34
28
35
29
const skipPlugins = [
36
30
graphileBuild . QueryPlugin ,
37
31
graphileBuild . MutationPlugin ,
38
32
graphileBuild . SubscriptionPlugin ,
39
- ]
40
- const prependPlugins = [ RenamedQueryPlugin ]
33
+ ] ;
34
+ const prependPlugins = [ RenamedQueryPlugin ] ;
41
35
42
36
module . exports = async ( pool , schema , options ) => {
43
- const schemas = Array . isArray ( schema ) ? schema : schema . split ( ',' )
37
+ const schemas = Array . isArray ( schema ) ? schema : schema . split ( "," ) ;
44
38
const graphqlSchema = await createPostGraphileSchema ( pool , schemas , {
45
- simpleCollections : ' both' ,
39
+ simpleCollections : " both" ,
46
40
dynamicJson : true ,
47
41
showErrorStack : true ,
48
- extendedErrors : [ ' hint' , ' detail' , ' errcode' ] ,
49
- legacyRelations : ' omit' ,
42
+ extendedErrors : [ " hint" , " detail" , " errcode" ] ,
43
+ legacyRelations : " omit" ,
50
44
...options ,
51
45
skipPlugins : [ ...skipPlugins , ...( options . skipPlugins || [ ] ) ] ,
52
46
prependPlugins : [ ...prependPlugins , ...( options . prependPlugins || [ ] ) ] ,
53
- } )
54
- return graphqlSchema
55
- }
47
+ } ) ;
48
+ return graphqlSchema ;
49
+ } ;
0 commit comments