export const NodeManagerUtils = { param connectionNodeId connectionNodeIdToConnectionId ( connectionNodeId ) { return connectionNodeId . replace ( 'database://' , '' ) ; } , parentsFromPath ( nodeId ) { const parts = nodeId . replace ( '//' , '\\' ) . split ( '/' ) ; let lastPath = '' ; const parents = [ ] ; for ( const part of parts ) { if ( lastPath !== '' ) { lastPath += '/' ; } lastPath += part . replace ( '\\' , '//' ) ; parents . push ( lastPath ) ; } return parents ; } , connectionIdToConnectionNodeId ( connectionId ) { return `database://${ connectionId }` ; } , nodeIdToConnectionId ( nodeId ) { const matches = nodeId . match ( /database:\/\/(.*?)(|\/.*)$/ ) ; if ( ! matches ) { throw new Error ( 'Not database object' ) ; } return matches [ 1 ] ; } , isDatabaseObject ( objectId ) { return /^database:\/\// . test ( objectId ) ; } , concatSchemaAndCatalog ( catalogId ? , schemaId ? ) { return `${ schemaId || '' }${ schemaId && catalogId ? '@' : '' }${ catalogId || '' }` ; } , } ;