format export type GKID = string ; export const TEST_PASSING_GK = 'TEST_PASSING_GK' ; export const TEST_FAILING_GK = 'TEST_FAILING_GK' ; export type GKMap = { [ key ] : boolean ; } ; const whitelistedGKs = [ ] ; export function loadGKs ( _username , _gks ) { return Promise . reject ( new Error ( 'Implement your custom logic for loading GK' ) ) ; } export function loadDistilleryGK ( _gk ) { return Promise . reject ( new Error ( 'Implement your custom logic for loading GK' ) ) ; } export default class GK { static init ( _username ) { } static get ( id ) { if ( process . env . NODE_ENV === 'test' && id === TEST_PASSING_GK ) { return true ; } if ( whitelistedGKs . includes ( id ) ) { return true ; } return false ; } static async withWhitelistedGK ( id , callback ) { whitelistedGKs . push ( id ) ; try { const p = callback ( ) ; if ( p ) { await p ; } } finally { const idx = whitelistedGKs . indexOf ( id ) ; if ( idx !== - 1 ) { whitelistedGKs . splice ( idx , 1 ) ; } } } static allGKs ( ) { return { } ; } }