1+ import { fail } from "assert" ;
12import { exec } from "child_process" ;
23import { promisify } from "util" ;
34
@@ -28,15 +29,15 @@ const MUTATE_PERMISSION_DENIED = new Error(`7 PERMISSION_DENIED:\
2829const ALTER_PERMISSION_DENIED = new Error ( `7 PERMISSION_DENIED:\
2930 unauthorized to alter following predicates: ${ PRED } \n` ) ;
3031
31- async function cmd ( command : string ) : Promise < void > {
32+ async function cmd ( command : string ) {
3233 try {
3334 await execute ( command ) ;
3435 } catch ( err ) {
3536 fail ( `Failed to execute command:\n\t${ command } \nError: ${ err } ` ) ;
3637 }
3738}
3839
39- async function insertSampleData ( ) : Promise < void > {
40+ async function insertSampleData ( ) {
4041 const txn = client . newTxn ( ) ;
4142 const mu = new dgraph . Mutation ( ) ;
4243 mu . setSetNquads ( `
@@ -48,7 +49,7 @@ async function insertSampleData(): Promise<void> {
4849 expect ( uid ) . toBeDefined ( ) ;
4950}
5051
51- async function loginUser ( ) : Promise < dgraph . DgraphClient > {
52+ async function loginUser ( ) {
5253 const aclClientStub = createClientStub ( ) ;
5354 try {
5455 await aclClientStub . login ( USERID , USERPWD ) ;
@@ -58,7 +59,7 @@ async function loginUser(): Promise<dgraph.DgraphClient> {
5859 return createClient ( aclClientStub ) ;
5960}
6061
61- async function aclSetup ( ) : Promise < dgraph . DgraphClient > {
62+ async function aclSetup ( ) {
6263 client = await setup ( ) ;
6364 await setSchema ( client , `
6465 ${ PRED } : string .
@@ -70,24 +71,23 @@ async function aclSetup(): Promise<dgraph.DgraphClient> {
7071 return loginUser ( ) ;
7172}
7273
73- async function addUser ( ) : Promise < void > {
74+ async function addUser ( ) {
7475 const command = `dgraph acl -a \'${ SERVER_ADDR } \' add -u \'${ USERID } \' -p \'${ USERPWD } \' --guardian-creds \'${ GUARDIAN_CREDS } \'` ;
7576 await cmd ( command ) ;
7677}
7778
78- async function addGroup ( ) : Promise < void > {
79+ async function addGroup ( ) {
7980 const command = `dgraph acl -a \'${ SERVER_ADDR } \' add -g \'${ DEV_GROUP } \' --guardian-creds \'${ GUARDIAN_CREDS } \'` ;
8081 await cmd ( command ) ;
8182}
8283
83- async function addUserToGroup ( ) : Promise < void > {
84+ async function addUserToGroup ( ) {
8485 const command = `dgraph acl -a \'${ SERVER_ADDR } \' mod -u \'${ USERID } \' -l \'${ DEV_GROUP } \' --guardian-creds \'${ GUARDIAN_CREDS } \'` ;
8586 await cmd ( command ) ;
8687}
8788
88- async function changePermission ( permission : number ) : Promise < void > {
89- const command = `dgraph acl -a \'${ SERVER_ADDR } \' mod -g \'${ DEV_GROUP } \' -p \'${ PRED } \' -m \'${ permission } \'
90- --guardian-creds \'${ GUARDIAN_CREDS } \'` ;
89+ async function changePermission ( permission : number ) {
90+ const command = `dgraph acl -a \'${ SERVER_ADDR } \' mod -g \'${ DEV_GROUP } \' -p \'${ PRED } \' -m \'${ permission } \' --guardian-creds \'${ GUARDIAN_CREDS } \'` ;
9191 await cmd ( command ) ;
9292 await wait ( WAIT_FOR_SIX_SECONDS ) ;
9393}
0 commit comments