import { connectionProvider } from '@cloudbeaver/core-connections' ; import { injectable } from '@cloudbeaver/core-di' ; import type { IExtension } from '@cloudbeaver/core-extensions' ; import { objectCatalogProvider } from './extensions/IObjectCatalogProvider' ; import { objectSchemaProvider } from './extensions/IObjectSchemaProvider' ; import { NavNodeManagerService } from './NavNodeManagerService' ; import { NodeManagerUtils } from './NodeManagerUtils' ; @ injectable ( ) export class NavNodeExtensionsService { readonly extensions : Array < IExtension < string > > ; constructor ( private navNodeManagerService ) { this . extensions = [ connectionProvider ( this . getConnection . bind ( this ) ) , objectCatalogProvider ( this . getDBObjectCatalog . bind ( this ) ) , objectSchemaProvider ( this . getDBObjectSchema . bind ( this ) ) , ] ; } getConnection ( navNodeId ) { const nodeInfo = this . navNodeManagerService . getNodeContainerInfo ( navNodeId ) ; if ( ! nodeInfo . connectionId ) { return ; } return NodeManagerUtils . connectionNodeIdToConnectionId ( nodeInfo . connectionId ) ; } getDBObjectCatalog ( navNodeId ) { const nodeInfo = this . navNodeManagerService . getNodeContainerInfo ( navNodeId ) ; return nodeInfo . catalogId ; } getDBObjectSchema ( navNodeId ) { const nodeInfo = this . navNodeManagerService . getNodeContainerInfo ( navNodeId ) ; return nodeInfo . schemaId ; } }