packageDocumentation module import { parse as parseVersion } from "semver" ; import { DbResult , Id64String } from "@itwin/core-bentley" ; import { Element , IModelDb } from "@itwin/core-backend" ; import { InstanceKey } from "@itwin/presentation-common" ; internal export function getElementKey ( imodel , id ) { let key ; const query = `SELECT ECClassId FROM ${ Element . classFullName } e WHERE ECInstanceId = ?` ; imodel . withPreparedStatement ( query , ( stmt ) => { try { stmt . bindId ( 1 , id ) ; if ( stmt . step ( ) === DbResult . BE_SQLITE_ROW ) key = { className : stmt . getValue ( 0 ) . getClassNameForClassId ( ) . replace ( "." , ":" ) , id } ; } catch { } } ) ; return key ; } internal export function normalizeVersion ( version ? ) { if ( version ) { const parsedVersion = parseVersion ( version , true ) ; if ( parsedVersion ) return `${ parsedVersion . major }.${ parsedVersion . minor }.${ parsedVersion . patch }` ; } return "0.0.0" ; }