Move databaseFetcher.ts to /databases/database-fetcher.ts
This commit is contained in:
@@ -25,7 +25,7 @@ import { DatabaseItem, DatabaseManager } from "../local-databases";
|
||||
import { CodeQLCliServer } from "../cli";
|
||||
import { asError, assertNever, getErrorMessage } from "../pure/helpers-pure";
|
||||
import { generateFlowModel } from "./generate-flow-model";
|
||||
import { promptImportGithubDatabase } from "../databaseFetcher";
|
||||
import { promptImportGithubDatabase } from "../databases/database-fetcher";
|
||||
import { App } from "../common/app";
|
||||
import { ResolvableLocationValue } from "../pure/bqrs-cli-types";
|
||||
import { showResolvableLocation } from "../interface-utils";
|
||||
|
||||
@@ -2,7 +2,7 @@ import fetch, { Response } from "node-fetch";
|
||||
import { zip } from "zip-a-folder";
|
||||
import { Open } from "unzipper";
|
||||
import { Uri, CancellationToken, window, InputBoxOptions } from "vscode";
|
||||
import { CodeQLCliServer } from "./cli";
|
||||
import { CodeQLCliServer } from "../cli";
|
||||
import {
|
||||
ensureDir,
|
||||
realpath as fs_realpath,
|
||||
@@ -16,18 +16,18 @@ import { basename, join } from "path";
|
||||
import * as Octokit from "@octokit/rest";
|
||||
import { retry } from "@octokit/plugin-retry";
|
||||
|
||||
import { DatabaseManager, DatabaseItem } from "./local-databases";
|
||||
import { showAndLogInformationMessage, tmpDir } from "./helpers";
|
||||
import { reportStreamProgress, ProgressCallback } from "./progress";
|
||||
import { extLogger } from "./common";
|
||||
import { getErrorMessage } from "./pure/helpers-pure";
|
||||
import { DatabaseManager, DatabaseItem } from "../local-databases";
|
||||
import { showAndLogInformationMessage, tmpDir } from "../helpers";
|
||||
import { reportStreamProgress, ProgressCallback } from "../progress";
|
||||
import { extLogger } from "../common";
|
||||
import { getErrorMessage } from "../pure/helpers-pure";
|
||||
import {
|
||||
getNwoFromGitHubUrl,
|
||||
isValidGitHubNwo,
|
||||
} from "./common/github-url-identifier-helper";
|
||||
import { Credentials } from "./common/authentication";
|
||||
import { AppCommandManager } from "./common/commands";
|
||||
import { ALLOW_HTTP_SETTING } from "./config";
|
||||
} from "../common/github-url-identifier-helper";
|
||||
import { Credentials } from "../common/authentication";
|
||||
import { AppCommandManager } from "../common/commands";
|
||||
import { ALLOW_HTTP_SETTING } from "../config";
|
||||
|
||||
/**
|
||||
* Prompts a user to fetch a database from a remote location. Database is assumed to be an archive file.
|
||||
@@ -39,7 +39,7 @@ import {
|
||||
importArchiveDatabase,
|
||||
promptImportGithubDatabase,
|
||||
promptImportInternetDatabase,
|
||||
} from "./databaseFetcher";
|
||||
} from "./databases/database-fetcher";
|
||||
import { asError, asyncFilter, getErrorMessage } from "./pure/helpers-pure";
|
||||
import { QueryRunner } from "./query-server";
|
||||
import { isCanary } from "./config";
|
||||
|
||||
@@ -13,7 +13,10 @@ import { getErrorMessage } from "./pure/helpers-pure";
|
||||
import { QlPackGenerator } from "./qlpack-generator";
|
||||
import { DatabaseItem, DatabaseManager } from "./local-databases";
|
||||
import { ProgressCallback, UserCancellationException } from "./progress";
|
||||
import { askForGitHubRepo, downloadGitHubDatabase } from "./databaseFetcher";
|
||||
import {
|
||||
askForGitHubRepo,
|
||||
downloadGitHubDatabase,
|
||||
} from "./databases/database-fetcher";
|
||||
import {
|
||||
getSkeletonWizardFolder,
|
||||
isCodespacesTemplate,
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
import { join } from "path";
|
||||
import { CancellationToken, Uri, window } from "vscode";
|
||||
|
||||
import { CodeQLCliServer } from "../../../src/cli";
|
||||
import { DatabaseManager } from "../../../src/local-databases";
|
||||
import { CodeQLCliServer } from "../../../../src/cli";
|
||||
import { DatabaseManager } from "../../../../src/local-databases";
|
||||
import {
|
||||
importArchiveDatabase,
|
||||
promptImportInternetDatabase,
|
||||
} from "../../../src/databaseFetcher";
|
||||
} from "../../../../src/databases/database-fetcher";
|
||||
import {
|
||||
cleanDatabases,
|
||||
dbLoc,
|
||||
DB_URL,
|
||||
getActivatedExtension,
|
||||
storagePath,
|
||||
} from "../global.helper";
|
||||
import { createMockCommandManager } from "../../__mocks__/commandsMock";
|
||||
} from "../../global.helper";
|
||||
import { createMockCommandManager } from "../../../__mocks__/commandsMock";
|
||||
|
||||
/**
|
||||
* Run various integration tests for databases
|
||||
*/
|
||||
describe("DatabaseFetcher", () => {
|
||||
describe("database-fetcher", () => {
|
||||
let databaseManager: DatabaseManager;
|
||||
let inputBoxStub: jest.SpiedFunction<typeof window.showInputBox>;
|
||||
let cli: CodeQLCliServer;
|
||||
@@ -18,7 +18,7 @@ import {
|
||||
DatabaseManager,
|
||||
FullDatabaseOptions,
|
||||
} from "../../../src/local-databases";
|
||||
import * as databaseFetcher from "../../../src/databaseFetcher";
|
||||
import * as databaseFetcher from "../../../src/databases/database-fetcher";
|
||||
import { createMockDB } from "../../factories/databases/databases";
|
||||
import { asError } from "../../../src/pure/helpers-pure";
|
||||
import { Setting } from "../../../src/config";
|
||||
|
||||
@@ -12,7 +12,7 @@ import { CodeQLCliServer } from "../../src/cli";
|
||||
import { removeWorkspaceRefs } from "../../src/variant-analysis/run-remote-query";
|
||||
import { CodeQLExtensionInterface } from "../../src/extension";
|
||||
import { ProgressCallback } from "../../src/progress";
|
||||
import { importArchiveDatabase } from "../../src/databaseFetcher";
|
||||
import { importArchiveDatabase } from "../../src/databases/database-fetcher";
|
||||
import { createMockCommandManager } from "../__mocks__/commandsMock";
|
||||
|
||||
// This file contains helpers shared between tests that work with an activated extension.
|
||||
|
||||
@@ -6,14 +6,14 @@ import { window } from "vscode";
|
||||
import {
|
||||
convertGithubNwoToDatabaseUrl,
|
||||
findDirWithFile,
|
||||
} from "../../../src/databaseFetcher";
|
||||
} from "../../../../src/databases/database-fetcher";
|
||||
import * as Octokit from "@octokit/rest";
|
||||
import { mockedQuickPickItem } from "../utils/mocking.helpers";
|
||||
import { mockedQuickPickItem } from "../../utils/mocking.helpers";
|
||||
|
||||
// These tests make API calls and may need extra time to complete.
|
||||
jest.setTimeout(10000);
|
||||
|
||||
describe("databaseFetcher", () => {
|
||||
describe("database-fetcher", () => {
|
||||
describe("convertGithubNwoToDatabaseUrl", () => {
|
||||
let quickPickSpy: jest.SpiedFunction<typeof window.showQuickPick>;
|
||||
|
||||
Reference in New Issue
Block a user