@@ -35,10 +35,13 @@ import { QlPackGenerator } from "../qlpack-generator";
3535import { QueryLanguage } from "../common/query-language" ;
3636import { App } from "../common/app" ;
3737import { existsSync } from "fs" ;
38+ import { FullDatabaseOptions } from "./local-databases/database-options" ;
3839import {
39- DatabaseOptions ,
40- FullDatabaseOptions ,
41- } from "./local-databases/database-options" ;
40+ DatabaseItem ,
41+ PersistedDatabaseItem ,
42+ } from "./local-databases/database-item" ;
43+
44+ export { DatabaseItem } from "./local-databases/database-item" ;
4245
4346/**
4447 * databases.ts
@@ -62,11 +65,6 @@ const CURRENT_DB = "currentDatabase";
6265 */
6366const DB_LIST = "databaseList" ;
6467
65- interface PersistedDatabaseItem {
66- uri : string ;
67- options ?: DatabaseOptions ;
68- }
69-
7068/**
7169 * The layout of the database.
7270 */
@@ -226,88 +224,6 @@ export class DatabaseResolver {
226224 }
227225}
228226
229- /** An item in the list of available databases */
230- export interface DatabaseItem {
231- /** The URI of the database */
232- readonly databaseUri : vscode . Uri ;
233- /** The name of the database to be displayed in the UI */
234- name : string ;
235-
236- /** The primary language of the database or empty string if unknown */
237- readonly language : string ;
238- /** The URI of the database's source archive, or `undefined` if no source archive is to be used. */
239- readonly sourceArchive : vscode . Uri | undefined ;
240- /**
241- * The contents of the database.
242- * Will be `undefined` if the database is invalid. Can be updated by calling `refresh()`.
243- */
244- readonly contents : DatabaseContents | undefined ;
245-
246- /**
247- * The date this database was added as a unix timestamp. Or undefined if we don't know.
248- */
249- readonly dateAdded : number | undefined ;
250-
251- /** If the database is invalid, describes why. */
252- readonly error : Error | undefined ;
253- /**
254- * Resolves the contents of the database.
255- *
256- * @remarks
257- * The contents include the database directory, source archive, and metadata about the database.
258- * If the database is invalid, `this.error` is updated with the error object that describes why
259- * the database is invalid. This error is also thrown.
260- */
261- refresh ( ) : Promise < void > ;
262- /**
263- * Resolves a filename to its URI in the source archive.
264- *
265- * @param file Filename within the source archive. May be `undefined` to return a dummy file path.
266- */
267- resolveSourceFile ( file : string | undefined ) : vscode . Uri ;
268-
269- /**
270- * Holds if the database item has a `.dbinfo` or `codeql-database.yml` file.
271- */
272- hasMetadataFile ( ) : Promise < boolean > ;
273-
274- /**
275- * Returns `sourceLocationPrefix` of exported database.
276- */
277- getSourceLocationPrefix ( server : cli . CodeQLCliServer ) : Promise < string > ;
278-
279- /**
280- * Returns dataset folder of exported database.
281- */
282- getDatasetFolder ( server : cli . CodeQLCliServer ) : Promise < string > ;
283-
284- /**
285- * Returns the root uri of the virtual filesystem for this database's source archive,
286- * as displayed in the filesystem explorer.
287- */
288- getSourceArchiveExplorerUri ( ) : vscode . Uri ;
289-
290- /**
291- * Holds if `uri` belongs to this database's source archive.
292- */
293- belongsToSourceArchiveExplorerUri ( uri : vscode . Uri ) : boolean ;
294-
295- /**
296- * Whether the database may be affected by test execution for the given path.
297- */
298- isAffectedByTest ( testPath : string ) : Promise < boolean > ;
299-
300- /**
301- * Gets the state of this database, to be persisted in the workspace state.
302- */
303- getPersistedState ( ) : PersistedDatabaseItem ;
304-
305- /**
306- * Verifies that this database item has a zipped source folder. Returns an error message if it does not.
307- */
308- verifyZippedSources ( ) : string | undefined ;
309- }
310-
311227export enum DatabaseEventKind {
312228 Add = "Add" ,
313229 Remove = "Remove" ,
0 commit comments