Skip to content

Commit 67983c6

Browse files
committed
Move DatabaseContents to separate file
1 parent d02e53f commit 67983c6

4 files changed

Lines changed: 38 additions & 31 deletions

File tree

extensions/ql-vscode/src/databases/local-databases.ts

Lines changed: 6 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,13 @@ import {
3535
PersistedDatabaseItem,
3636
} from "./local-databases/database-item";
3737
import { DatabaseItemImpl } from "./local-databases/database-item-impl";
38+
import {
39+
DatabaseContents,
40+
DatabaseContentsWithDbScheme,
41+
DatabaseKind,
42+
} from "./local-databases/database-contents";
3843

44+
export { DatabaseContentsWithDbScheme } from "./local-databases/database-contents";
3945
export { DatabaseItem } from "./local-databases/database-item";
4046

4147
/**
@@ -60,35 +66,6 @@ const CURRENT_DB = "currentDatabase";
6066
*/
6167
const DB_LIST = "databaseList";
6268

63-
/**
64-
* The layout of the database.
65-
*/
66-
export enum DatabaseKind {
67-
/** A CodeQL database */
68-
Database,
69-
/** A raw QL dataset */
70-
RawDataset,
71-
}
72-
73-
export interface DatabaseContents {
74-
/** The layout of the database */
75-
kind: DatabaseKind;
76-
/**
77-
* The name of the database.
78-
*/
79-
name: string;
80-
/** The URI of the QL dataset within the database. */
81-
datasetUri: vscode.Uri;
82-
/** The URI of the source archive within the database, if one exists. */
83-
sourceArchiveUri?: vscode.Uri;
84-
/** The URI of the CodeQL database scheme within the database, if exactly one exists. */
85-
dbSchemeUri?: vscode.Uri;
86-
}
87-
88-
export interface DatabaseContentsWithDbScheme extends DatabaseContents {
89-
dbSchemeUri: vscode.Uri; // Always present
90-
}
91-
9269
/**
9370
* An error thrown when we cannot find a valid database in a putative
9471
* database directory.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import vscode from "vscode";
2+
3+
/**
4+
* The layout of the database.
5+
*/
6+
export enum DatabaseKind {
7+
/** A CodeQL database */
8+
Database,
9+
/** A raw QL dataset */
10+
RawDataset,
11+
}
12+
13+
export interface DatabaseContents {
14+
/** The layout of the database */
15+
kind: DatabaseKind;
16+
/**
17+
* The name of the database.
18+
*/
19+
name: string;
20+
/** The URI of the QL dataset within the database. */
21+
datasetUri: vscode.Uri;
22+
/** The URI of the source archive within the database, if one exists. */
23+
sourceArchiveUri?: vscode.Uri;
24+
/** The URI of the CodeQL database scheme within the database, if exactly one exists. */
25+
dbSchemeUri?: vscode.Uri;
26+
}
27+
28+
export interface DatabaseContentsWithDbScheme extends DatabaseContents {
29+
dbSchemeUri: vscode.Uri; // Always present
30+
}

extensions/ql-vscode/src/databases/local-databases/database-item-impl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ import { stat } from "fs-extra";
1616
import { pathsEqual } from "../../pure/files";
1717
import {
1818
DatabaseChangedEvent,
19-
DatabaseContents,
2019
DatabaseEventKind,
2120
DatabaseResolver,
2221
} from "../local-databases";
22+
import { DatabaseContents } from "./database-contents";
2323

2424
export class DatabaseItemImpl implements DatabaseItem {
2525
private _error: Error | undefined = undefined;

extensions/ql-vscode/src/databases/local-databases/database-item.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import vscode from "vscode";
22
import * as cli from "../../codeql-cli/cli";
3-
import { DatabaseContents } from "../local-databases";
3+
import { DatabaseContents } from "./database-contents";
44
import { DatabaseOptions } from "./database-options";
55

66
/** An item in the list of available databases */

0 commit comments

Comments
 (0)