Move DatabaseContents to separate file

This commit is contained in:
Koen Vlaswinkel
2023-05-24 16:55:31 +02:00
parent d02e53fbd2
commit 67983c64ca
4 changed files with 38 additions and 31 deletions

View File

@@ -35,7 +35,13 @@ import {
PersistedDatabaseItem,
} from "./local-databases/database-item";
import { DatabaseItemImpl } from "./local-databases/database-item-impl";
import {
DatabaseContents,
DatabaseContentsWithDbScheme,
DatabaseKind,
} from "./local-databases/database-contents";
export { DatabaseContentsWithDbScheme } from "./local-databases/database-contents";
export { DatabaseItem } from "./local-databases/database-item";
/**
@@ -60,35 +66,6 @@ const CURRENT_DB = "currentDatabase";
*/
const DB_LIST = "databaseList";
/**
* The layout of the database.
*/
export enum DatabaseKind {
/** A CodeQL database */
Database,
/** A raw QL dataset */
RawDataset,
}
export interface DatabaseContents {
/** The layout of the database */
kind: DatabaseKind;
/**
* The name of the database.
*/
name: string;
/** The URI of the QL dataset within the database. */
datasetUri: vscode.Uri;
/** The URI of the source archive within the database, if one exists. */
sourceArchiveUri?: vscode.Uri;
/** The URI of the CodeQL database scheme within the database, if exactly one exists. */
dbSchemeUri?: vscode.Uri;
}
export interface DatabaseContentsWithDbScheme extends DatabaseContents {
dbSchemeUri: vscode.Uri; // Always present
}
/**
* An error thrown when we cannot find a valid database in a putative
* database directory.

View File

@@ -0,0 +1,30 @@
import vscode from "vscode";
/**
* The layout of the database.
*/
export enum DatabaseKind {
/** A CodeQL database */
Database,
/** A raw QL dataset */
RawDataset,
}
export interface DatabaseContents {
/** The layout of the database */
kind: DatabaseKind;
/**
* The name of the database.
*/
name: string;
/** The URI of the QL dataset within the database. */
datasetUri: vscode.Uri;
/** The URI of the source archive within the database, if one exists. */
sourceArchiveUri?: vscode.Uri;
/** The URI of the CodeQL database scheme within the database, if exactly one exists. */
dbSchemeUri?: vscode.Uri;
}
export interface DatabaseContentsWithDbScheme extends DatabaseContents {
dbSchemeUri: vscode.Uri; // Always present
}

View File

@@ -16,10 +16,10 @@ import { stat } from "fs-extra";
import { pathsEqual } from "../../pure/files";
import {
DatabaseChangedEvent,
DatabaseContents,
DatabaseEventKind,
DatabaseResolver,
} from "../local-databases";
import { DatabaseContents } from "./database-contents";
export class DatabaseItemImpl implements DatabaseItem {
private _error: Error | undefined = undefined;

View File

@@ -1,6 +1,6 @@
import vscode from "vscode";
import * as cli from "../../codeql-cli/cli";
import { DatabaseContents } from "../local-databases";
import { DatabaseContents } from "./database-contents";
import { DatabaseOptions } from "./database-options";
/** An item in the list of available databases */