packageDocumentation module import { Logger } from "@itwin/core-bentley" ; import { IModelDb , IpcHandler } from "@itwin/core-backend" ; import { NodeKeyJSON , PRESENTATION_IPC_CHANNEL_NAME , PresentationIpcInterface , RulesetVariable , RulesetVariableJSON , SetRulesetVariableParams , UnsetRulesetVariableParams , UpdateHierarchyStateParams , } from "@itwin/presentation-common" ; import { PresentationBackendLoggerCategory } from "./BackendLoggerCategory" ; import { Presentation } from "./Presentation" ; internal export class PresentationIpcHandler extends IpcHandler implements PresentationIpcInterface { public channelName = PRESENTATION_IPC_CHANNEL_NAME ; public async setRulesetVariable ( params ) { const { clientId , rulesetId , variable } = params ; const parsedVariable = RulesetVariable . fromJSON ( variable ) ; Presentation . getManager ( clientId ) . vars ( rulesetId ) . setValue ( parsedVariable . id , parsedVariable . type , parsedVariable . value ) ; } public async unsetRulesetVariable ( params ) { const { clientId , rulesetId , variableId } = params ; Presentation . getManager ( clientId ) . vars ( rulesetId ) . unset ( variableId ) ; } public async updateHierarchyState ( params ) { const { clientId , imodelKey , rulesetId , changeType , nodeKeys } = params ; const imodelDb = IModelDb . tryFindByKey ( imodelKey ) ; if ( ! imodelDb ) { Logger . logError ( PresentationBackendLoggerCategory . Ipc , "Could not find IModelDb to perform hierarchy state update" ) ; return ; } Presentation . getManager ( clientId ) . getNativePlatform ( ) . updateHierarchyState ( imodelDb . nativeDb , rulesetId , changeType , JSON . stringify ( nodeKeys ) ) ; } }