import { ChainGunClient , ChainGunLink } from '@chaingun/client' ; import { unpackGraph } from '@chaingun/sear' ; import { ChainGunUserApi } from './ChainGunUserApi' ; export class ChainGunSeaClient extends ChainGunClient { protected readonly _user ? : ChainGunUserApi ; constructor ( graph , LinkClass = ChainGunLink ) { super ( graph , LinkClass ) ; this . registerSearMiddleware ( ) ; } public user ( ) { return ( this . _user = this . _user || new ChainGunUserApi ( this ) ) ; } protected registerSearMiddleware ( ) { this . graph . use ( graph => unpackGraph ( graph , this . graph [ '_opt' ] . mutable ? 'mutable' : 'immutable' ) ) ; } }