LCOV - code coverage report
Current view: top level - dashql-app/src/connections - connection_merge.ts Coverage Total Hit
Test: DashQL 915828b Lines: 100.0 % 12 12
Test Date: 2026-11-06 19:30:32

            Line data    Source code
       1              : import { connectionParamsShareEqual } from './connection_params.js';
       2              : import { isListedConnection, type ConnectionReferences, type ConnectionRegistry } from './connection_registry.js';
       3              : import type { ConnectionState } from './connection_state.js';
       4              : 
       5              : /// The connections that can be merged into a connection.
       6              : ///
       7              : /// A candidate describes the same database as the target: same connector and the same params,
       8              : /// ignoring secrets, the rule that imports consolidate connections with. Only listed connections
       9              : /// are candidates, the user can't see the others.
      10            1 : export function connectionMergeCandidates(
      11            1 :     registry: Pick<ConnectionRegistry, 'connections' | 'connectionsByType'>,
      12            1 :     references: ConnectionReferences,
      13            1 :     targetId: string,
      14            1 : ): ConnectionState[] {
      15            1 :     const target = registry.connections.get(targetId);
      16            1 :     if (target == null) return [];
      17            1 :     return registry.connectionsByType[target.connectorInfo.connectorType]
      18            1 :         .filter(connectionId => connectionId !== targetId && isListedConnection(registry, references, connectionId))
      19            1 :         .map(connectionId => registry.connections.get(connectionId)!)
      20            1 :         .filter(candidate => connectionParamsShareEqual(candidate.params, target.params));
      21            1 : }
        

Generated by: LCOV version 2.0-1