@@ -10,7 +10,7 @@ let disableEdgeValidation;
10
10
module . exports = {
11
11
init : async function ( schema ) {
12
12
let db_name = process . env . db ? process . env . db : 'dev-db' ;
13
- let url = process . env . URL ? process . env . URL : 'http://localhost:8529' ;
13
+ let url = process . env . URL ? process . env . URL : 'http://localhost:8529' ;
14
14
let drop = process . env . DROP === 'true' ;
15
15
disableEdgeValidation = process . env . DISABLE_EDGE_VALIDATION === 'true' ;
16
16
db = new arangojs . Database ( { url : url } ) ;
@@ -44,10 +44,10 @@ module.exports = {
44
44
getByKey : function ( key , info ) {
45
45
return getByKey ( key , info ) ;
46
46
} ,
47
- create : function ( isRoot , context , data , returnType , info ) {
47
+ create : function ( isRoot , context , data , returnType , info ) {
48
48
return create ( isRoot , context , data , returnType , info ) ;
49
49
} ,
50
- createEdge : async function ( isRoot , ctxt , source , sourceType , sourceField , target , targetType , annotations , info ) {
50
+ createEdge : async function ( isRoot , ctxt , source , sourceType , sourceField , target , targetType , annotations , info ) {
51
51
return await createEdge ( isRoot , ctxt , source , sourceType , sourceField , target , targetType , annotations , info ) ;
52
52
} ,
53
53
update : async function ( isRoot , ctxt , id , data , returnType , info ) {
@@ -59,19 +59,19 @@ module.exports = {
59
59
getList : async function ( args , info ) {
60
60
return await getList ( args , info ) ;
61
61
} ,
62
- getTotalCount : async function ( parent , args , info ) {
62
+ getTotalCount : async function ( parent , args , info ) {
63
63
return await getTotalCount ( parent , args , info ) ;
64
64
} ,
65
- isEndOfList : async function ( parent , args , info ) {
65
+ isEndOfList : async function ( parent , args , info ) {
66
66
return await isEndOfList ( parent , args , info ) ;
67
67
} ,
68
- addPossibleTypes : function ( query , schema , type_name ) {
68
+ addPossibleTypes : function ( query , schema , type_name ) {
69
69
return addPossibleTypes ( query , schema , type_name ) ;
70
70
} ,
71
- addPossibleEdgeTypes : function ( query , schema , type_name , field_name ) {
71
+ addPossibleEdgeTypes : function ( query , schema , type_name , field_name ) {
72
72
return addPossibleEdgeTypes ( query , schema , type_name , field_name ) ;
73
73
} ,
74
- getEdgeCollectionName : function ( type , field ) {
74
+ getEdgeCollectionName : function ( type , field ) {
75
75
return getEdgeCollectionName ( type , field ) ;
76
76
} ,
77
77
hello : ( ) => hello ( ) // TODO: Remove after testing
@@ -81,7 +81,7 @@ async function hello(){
81
81
return "This is the arangodb.tools saying hello!"
82
82
}
83
83
84
- async function createAndUseDatabase ( db , db_name ) {
84
+ async function createAndUseDatabase ( db , db_name ) {
85
85
await db . createDatabase ( db_name ) . then (
86
86
( ) => { console . info ( `Database '${ db_name } ' created` ) ; } ,
87
87
err => { console . warn ( `Database '${ db_name } ' not created:` , err . response . body . errorMessage ) ; }
@@ -251,13 +251,13 @@ async function getEdge(parent, args, info){
251
251
252
252
// Create query
253
253
let query = [ aql `FOR x IN` ] ;
254
- if ( info . fieldName . startsWith ( '_' ) ) {
254
+ if ( info . fieldName . startsWith ( '_' ) ) {
255
255
// If the type that is the origin of the edge is an interface, then we need to check all the edge collections
256
256
// corresponding to its implementing types. Note: This is only necessary when traversing some edges that are
257
257
// defined in in the API schema for interfaces. The parent type will never be an interface type at this stage.
258
258
if ( graphql . isInterfaceType ( return_type ) ) {
259
259
let possible_types = info . schema . getPossibleTypes ( return_type ) ;
260
- if ( possible_types . length > 1 ) query . push ( aql `UNION(` ) ;
260
+ if ( possible_types . length > 1 ) query . push ( aql `UNION(` ) ;
261
261
for ( let i in possible_types ) {
262
262
if ( i != 0 ) query . push ( aql `,` ) ;
263
263
let collection = db . collection ( getEdgeCollectionName ( possible_types [ i ] . name , field_name ) ) ;
@@ -303,7 +303,6 @@ async function create(isRoot, ctxt, data, returnType, info){
303
303
304
304
// is root op and mutatation is already queued
305
305
if ( isRoot && ctxt . trans . queue [ info . path . key ] ) {
306
-
307
306
if ( ctxt . trans . open ) await executeTransaction ( ctxt ) ;
308
307
if ( ctxt . trans . error ) {
309
308
if ( ctxt . trans . errorReported ) return null ;
@@ -386,7 +385,7 @@ async function create(isRoot, ctxt, data, returnType, info){
386
385
addfinalDirectiveChecksForType ( ctxt , returnType , aql `${ asAQLVar ( resVar ) } ._id` , info . schema ) ;
387
386
388
387
// overwrite the current action
389
- if ( isRoot ) {
388
+ if ( isRoot ) {
390
389
ctxt . trans . code . push ( `result['${ info . path . key } '] = ${ resVar } ;` ) ; // add root result
391
390
ctxt . trans . queue [ info . path . key ] = true ; // indicate that this mutation op has been added to the transaction
392
391
getVar ( ctxt ) ; // increment varCounter
0 commit comments