fix: return type of ensureDatabaseExists and run api-report

Signed-off-by: Minn Soe <contributions@minn.io>
This commit is contained in:
Minn Soe
2021-05-17 22:37:44 +01:00
parent 4d17ececc5
commit 630b75798a
2 changed files with 223 additions and 258 deletions
+222 -254
View File
@@ -3,6 +3,7 @@
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
```ts
import { AzureIntegration } from '@backstage/integration';
import { BitbucketIntegration } from '@backstage/integration';
import { Config } from '@backstage/config';
@@ -15,6 +16,7 @@ import { GithubCredentialsProvider } from '@backstage/integration';
import { GitHubIntegration } from '@backstage/integration';
import { GitLabIntegration } from '@backstage/integration';
import * as http from 'http';
import { JsonObject } from '@backstage/config';
import { JsonValue } from '@backstage/config';
import { Knex } from 'knex';
import { Logger } from 'winston';
@@ -30,55 +32,49 @@ import { Writable } from 'stream';
// @public (undocumented)
export class AzureUrlReader implements UrlReader {
constructor(
integration: AzureIntegration,
deps: {
treeResponseFactory: ReadTreeResponseFactory;
},
);
// (undocumented)
static factory: ReaderFactory;
// (undocumented)
read(url: string): Promise<Buffer>;
// (undocumented)
readTree(url: string, options?: ReadTreeOptions): Promise<ReadTreeResponse>;
// (undocumented)
search(url: string, options?: SearchOptions): Promise<SearchResponse>;
// (undocumented)
toString(): string;
constructor(integration: AzureIntegration, deps: {
treeResponseFactory: ReadTreeResponseFactory;
});
// (undocumented)
static factory: ReaderFactory;
// (undocumented)
read(url: string): Promise<Buffer>;
// (undocumented)
readTree(url: string, options?: ReadTreeOptions): Promise<ReadTreeResponse>;
// (undocumented)
search(url: string, options?: SearchOptions): Promise<SearchResponse>;
// (undocumented)
toString(): string;
}
// @public
export class BitbucketUrlReader implements UrlReader {
constructor(
integration: BitbucketIntegration,
deps: {
treeResponseFactory: ReadTreeResponseFactory;
},
);
// (undocumented)
static factory: ReaderFactory;
// (undocumented)
read(url: string): Promise<Buffer>;
// (undocumented)
readTree(url: string, options?: ReadTreeOptions): Promise<ReadTreeResponse>;
// (undocumented)
search(url: string, options?: SearchOptions): Promise<SearchResponse>;
// (undocumented)
toString(): string;
constructor(integration: BitbucketIntegration, deps: {
treeResponseFactory: ReadTreeResponseFactory;
});
// (undocumented)
static factory: ReaderFactory;
// (undocumented)
read(url: string): Promise<Buffer>;
// (undocumented)
readTree(url: string, options?: ReadTreeOptions): Promise<ReadTreeResponse>;
// (undocumented)
search(url: string, options?: SearchOptions): Promise<SearchResponse>;
// (undocumented)
toString(): string;
}
// @public
export interface CacheClient {
delete(key: string): Promise<void>;
get(key: string): Promise<JsonValue | undefined>;
set(key: string, value: JsonValue, options?: CacheSetOptions): Promise<void>;
delete(key: string): Promise<void>;
get(key: string): Promise<JsonValue | undefined>;
set(key: string, value: JsonValue, options?: CacheSetOptions): Promise<void>;
}
// @public
export class CacheManager {
forPlugin(pluginId: string): PluginCacheManager;
static fromConfig(config: Config, options?: CacheManagerOptions): CacheManager;
forPlugin(pluginId: string): PluginCacheManager;
static fromConfig(config: Config, options?: CacheManagerOptions): CacheManager;
}
// @public (undocumented)
@@ -86,64 +82,48 @@ export const coloredFormat: winston.Logform.Format;
// @public (undocumented)
export interface ContainerRunner {
// (undocumented)
runContainer(opts: RunContainerOptions): Promise<void>;
// (undocumented)
runContainer(opts: RunContainerOptions): Promise<void>;
}
// @public @deprecated
export const createDatabase: typeof createDatabaseClient;
// @public
export function createDatabaseClient(
dbConfig: Config,
overrides?: Partial<Knex.Config>,
): Knex<any, unknown[]>;
export function createDatabaseClient(dbConfig: Config, overrides?: Partial<Knex.Config>): Knex<any, unknown[]>;
// @public
export function createNameOverride(client: string, name: string): Partial<Knex.Config>;
// @public (undocumented)
export function createRootLogger(
options?: winston.LoggerOptions,
env?: NodeJS.ProcessEnv,
): winston.Logger;
export function createRootLogger(options?: winston.LoggerOptions, env?: NodeJS.ProcessEnv): winston.Logger;
// @public
export function createServiceBuilder(_module: NodeModule): ServiceBuilderImpl;
// @public (undocumented)
export function createStatusCheckRouter(
options: StatusCheckRouterOptions,
): Promise<express.Router>;
export function createStatusCheckRouter(options: StatusCheckRouterOptions): Promise<express.Router>;
// @public (undocumented)
export class DockerContainerRunner implements ContainerRunner {
constructor({ dockerClient }: { dockerClient: Docker });
// (undocumented)
runContainer({
imageName,
command,
args,
logStream,
mountDirs,
workingDir,
envVars,
}: RunContainerOptions): Promise<void>;
constructor({ dockerClient }: {
dockerClient: Docker;
});
// (undocumented)
runContainer({ imageName, command, args, logStream, mountDirs, workingDir, envVars, }: RunContainerOptions): Promise<void>;
}
// @public
export function ensureDatabaseExists(
dbConfig: Config,
...databases: Array<string>
): Promise<void>;
export function ensureDatabaseExists(dbConfig: Config, ...databases: Array<string>): Promise<void>;
// @public
export function errorHandler(
options?: ErrorHandlerOptions,
): ErrorRequestHandler;
export function errorHandler(options?: ErrorHandlerOptions): ErrorRequestHandler;
// @public (undocumented)
export type ErrorHandlerOptions = {
showStackTraces?: boolean;
logger?: Logger;
logClientErrors?: boolean;
showStackTraces?: boolean;
logger?: Logger;
logClientErrors?: boolean;
};
// @public (undocumented)
@@ -154,177 +134,171 @@ export function getVoidLogger(): winston.Logger;
// @public (undocumented)
export class Git {
// (undocumented)
add({ dir, filepath }: { dir: string; filepath: string }): Promise<void>;
// (undocumented)
addRemote({
dir,
url,
remote,
}: {
dir: string;
remote: string;
url: string;
}): Promise<void>;
// (undocumented)
clone({
url,
dir,
ref,
}: {
url: string;
dir: string;
ref?: string;
}): Promise<void>;
// (undocumented)
commit({
dir,
message,
author,
committer,
}: {
dir: string;
message: string;
author: {
name: string;
email: string;
};
committer: {
name: string;
email: string;
};
}): Promise<string>;
// (undocumented)
currentBranch({
dir,
fullName,
}: {
dir: string;
fullName?: boolean;
}): Promise<string | undefined>;
// (undocumented)
fetch({ dir, remote }: { dir: string; remote?: string }): Promise<void>;
// (undocumented)
static fromAuth: ({
username,
password,
logger,
}: {
username?: string | undefined;
password?: string | undefined;
logger?: Logger | undefined;
}) => Git;
// (undocumented)
init({ dir }: { dir: string }): Promise<void>;
// (undocumented)
merge({
dir,
theirs,
ours,
author,
committer,
}: {
dir: string;
theirs: string;
ours?: string;
author: {
name: string;
email: string;
};
committer: {
name: string;
email: string;
};
}): Promise<MergeResult>;
// (undocumented)
push({ dir, remote }: { dir: string; remote: string }): Promise<PushResult>;
// (undocumented)
readCommit({
dir,
sha,
}: {
dir: string;
sha: string;
}): Promise<ReadCommitResult>;
// (undocumented)
resolveRef({ dir, ref }: { dir: string; ref: string }): Promise<string>;
// (undocumented)
add({ dir, filepath, }: {
dir: string;
filepath: string;
}): Promise<void>;
// (undocumented)
addRemote({ dir, url, remote, }: {
dir: string;
remote: string;
url: string;
}): Promise<void>;
// (undocumented)
clone({ url, dir, ref, }: {
url: string;
dir: string;
ref?: string;
}): Promise<void>;
// (undocumented)
commit({ dir, message, author, committer, }: {
dir: string;
message: string;
author: {
name: string;
email: string;
};
committer: {
name: string;
email: string;
};
}): Promise<string>;
// (undocumented)
currentBranch({ dir, fullName, }: {
dir: string;
fullName?: boolean;
}): Promise<string | undefined>;
// (undocumented)
fetch({ dir, remote, }: {
dir: string;
remote?: string;
}): Promise<void>;
// (undocumented)
static fromAuth: ({ username, password, logger, }: {
username?: string | undefined;
password?: string | undefined;
logger?: Logger | undefined;
}) => Git;
// (undocumented)
init({ dir }: {
dir: string;
}): Promise<void>;
// (undocumented)
merge({ dir, theirs, ours, author, committer, }: {
dir: string;
theirs: string;
ours?: string;
author: {
name: string;
email: string;
};
committer: {
name: string;
email: string;
};
}): Promise<MergeResult>;
// (undocumented)
push({ dir, remote }: {
dir: string;
remote: string;
}): Promise<PushResult>;
// (undocumented)
readCommit({ dir, sha, }: {
dir: string;
sha: string;
}): Promise<ReadCommitResult>;
// (undocumented)
resolveRef({ dir, ref, }: {
dir: string;
ref: string;
}): Promise<string>;
}
// @public
export class GithubUrlReader implements UrlReader {
constructor(
integration: GitHubIntegration,
deps: {
treeResponseFactory: ReadTreeResponseFactory;
credentialsProvider: GithubCredentialsProvider;
},
);
// (undocumented)
static factory: ReaderFactory;
// (undocumented)
read(url: string): Promise<Buffer>;
// (undocumented)
readTree(url: string, options?: ReadTreeOptions): Promise<ReadTreeResponse>;
// (undocumented)
search(url: string, options?: SearchOptions): Promise<SearchResponse>;
// (undocumented)
toString(): string;
constructor(integration: GitHubIntegration, deps: {
treeResponseFactory: ReadTreeResponseFactory;
credentialsProvider: GithubCredentialsProvider;
});
// (undocumented)
static factory: ReaderFactory;
// (undocumented)
read(url: string): Promise<Buffer>;
// (undocumented)
readTree(url: string, options?: ReadTreeOptions): Promise<ReadTreeResponse>;
// (undocumented)
search(url: string, options?: SearchOptions): Promise<SearchResponse>;
// (undocumented)
toString(): string;
}
// @public (undocumented)
export class GitlabUrlReader implements UrlReader {
constructor(
integration: GitLabIntegration,
deps: {
treeResponseFactory: ReadTreeResponseFactory;
},
);
// (undocumented)
static factory: ReaderFactory;
// (undocumented)
read(url: string): Promise<Buffer>;
// (undocumented)
readTree(url: string, options?: ReadTreeOptions): Promise<ReadTreeResponse>;
// (undocumented)
search(url: string, options?: SearchOptions): Promise<SearchResponse>;
// (undocumented)
toString(): string;
constructor(integration: GitLabIntegration, deps: {
treeResponseFactory: ReadTreeResponseFactory;
});
// (undocumented)
static factory: ReaderFactory;
// (undocumented)
read(url: string): Promise<Buffer>;
// (undocumented)
readTree(url: string, options?: ReadTreeOptions): Promise<ReadTreeResponse>;
// (undocumented)
search(url: string, options?: SearchOptions): Promise<SearchResponse>;
// (undocumented)
toString(): string;
}
// @public
export function loadBackendConfig(options: Options): Promise<Config>;
// @public
export function normalizeConnection(connection: Knex.StaticConnectionConfig | JsonObject | string, client: string): Record<string, any>;
// @public
export function notFoundHandler(): RequestHandler;
// @public
export function parseConnectionString(connectionString: string, client?: string): Knex.StaticConnectionConfig;
// @public
export type PluginCacheManager = {
getClient: (options?: ClientOptions) => CacheClient;
getClient: (options?: ClientOptions) => CacheClient;
};
// @public (undocumented)
export class PluginConnectionDatabaseManager {
// (undocumented)
static readonly DEFAULT_PREFIX = "backstage_plugin_";
forPlugin(pluginId: string): PluginDatabaseManager;
static fromConfig(config: Config): PluginConnectionDatabaseManager;
getDatabaseName(pluginId: string): string;
}
// @public
export interface PluginDatabaseManager {
getClient(): Promise<Knex>;
getClient(): Promise<Knex>;
}
// @public
export type PluginEndpointDiscovery = {
getBaseUrl(pluginId: string): Promise<string>;
getExternalBaseUrl(pluginId: string): Promise<string>;
getBaseUrl(pluginId: string): Promise<string>;
getExternalBaseUrl(pluginId: string): Promise<string>;
};
// @public (undocumented)
export type ReadTreeResponse = {
files(): Promise<ReadTreeResponseFile[]>;
archive(): Promise<NodeJS.ReadableStream>;
dir(options?: ReadTreeResponseDirOptions): Promise<string>;
etag: string;
files(): Promise<ReadTreeResponseFile[]>;
archive(): Promise<NodeJS.ReadableStream>;
dir(options?: ReadTreeResponseDirOptions): Promise<string>;
etag: string;
};
// @public
export type ReadTreeResponseFile = {
path: string;
content(): Promise<Buffer>;
path: string;
content(): Promise<Buffer>;
};
// @public
@@ -335,37 +309,37 @@ export function resolvePackagePath(name: string, ...paths: string[]): string;
// @public (undocumented)
export type RunContainerOptions = {
imageName: string;
command?: string | string[];
args: string[];
logStream?: Writable;
mountDirs?: Record<string, string>;
workingDir?: string;
envVars?: Record<string, string>;
imageName: string;
command?: string | string[];
args: string[];
logStream?: Writable;
mountDirs?: Record<string, string>;
workingDir?: string;
envVars?: Record<string, string>;
};
// @public
export type SearchResponse = {
files: SearchResponseFile[];
etag: string;
files: SearchResponseFile[];
etag: string;
};
// @public
export type SearchResponseFile = {
url: string;
content(): Promise<Buffer>;
url: string;
content(): Promise<Buffer>;
};
// @public (undocumented)
export type ServiceBuilder = {
loadConfig(config: ConfigReader): ServiceBuilder;
setPort(port: number): ServiceBuilder;
setHost(host: string): ServiceBuilder;
setLogger(logger: Logger): ServiceBuilder;
enableCors(options: cors.CorsOptions): ServiceBuilder;
setHttpsSettings(settings: HttpsSettings): ServiceBuilder;
addRouter(root: string, router: Router | RequestHandler): ServiceBuilder;
start(): Promise<Server>;
loadConfig(config: ConfigReader): ServiceBuilder;
setPort(port: number): ServiceBuilder;
setHost(host: string): ServiceBuilder;
setLogger(logger: Logger): ServiceBuilder;
enableCors(options: cors.CorsOptions): ServiceBuilder;
setHttpsSettings(settings: HttpsSettings): ServiceBuilder;
addRouter(root: string, router: Router | RequestHandler): ServiceBuilder;
start(): Promise<Server>;
};
// @public (undocumented)
@@ -373,58 +347,52 @@ export function setRootLogger(newLogger: winston.Logger): void;
// @public
export class SingleConnectionDatabaseManager {
forPlugin(pluginId: string): PluginDatabaseManager;
static fromConfig(config: Config): SingleConnectionDatabaseManager;
}
forPlugin(pluginId: string): PluginDatabaseManager;
static fromConfig(config: Config): SingleConnectionDatabaseManager;
}
// @public
export class SingleHostDiscovery implements PluginEndpointDiscovery {
static fromConfig(
config: Config,
options?: {
basePath?: string;
},
): SingleHostDiscovery;
// (undocumented)
getBaseUrl(pluginId: string): Promise<string>;
// (undocumented)
getExternalBaseUrl(pluginId: string): Promise<string>;
}
static fromConfig(config: Config, options?: {
basePath?: string;
}): SingleHostDiscovery;
// (undocumented)
getBaseUrl(pluginId: string): Promise<string>;
// (undocumented)
getExternalBaseUrl(pluginId: string): Promise<string>;
}
// @public (undocumented)
export type StatusCheck = () => Promise<any>;
// @public
export function statusCheckHandler(
options?: StatusCheckHandlerOptions,
): Promise<RequestHandler>;
export function statusCheckHandler(options?: StatusCheckHandlerOptions): Promise<RequestHandler>;
// @public (undocumented)
export interface StatusCheckHandlerOptions {
statusCheck?: StatusCheck;
statusCheck?: StatusCheck;
}
// @public
export type UrlReader = {
read(url: string): Promise<Buffer>;
readTree(url: string, options?: ReadTreeOptions): Promise<ReadTreeResponse>;
search(url: string, options?: SearchOptions): Promise<SearchResponse>;
read(url: string): Promise<Buffer>;
readTree(url: string, options?: ReadTreeOptions): Promise<ReadTreeResponse>;
search(url: string, options?: SearchOptions): Promise<SearchResponse>;
};
// @public
export class UrlReaders {
static create({ logger, config, factories }: CreateOptions): UrlReader;
static default({ logger, config, factories }: CreateOptions): UrlReader;
static create({ logger, config, factories }: CreateOptions): UrlReader;
static default({ logger, config, factories }: CreateOptions): UrlReader;
}
// @public
export function useHotCleanup(
_module: NodeModule,
cancelEffect: () => void,
): void;
export function useHotCleanup(_module: NodeModule, cancelEffect: () => void): void;
// @public
export function useHotMemoize<T>(_module: NodeModule, valueFactory: () => T): T;
// (No @packageDocumentation comment for this package)
```
@@ -72,10 +72,7 @@ export async function ensureDatabaseExists(
) {
const client: DatabaseClient = dbConfig.getString('client');
return ConnectorMapping[client]?.ensureDatabaseExists?.(
dbConfig,
...databases,
);
ConnectorMapping[client]?.ensureDatabaseExists?.(dbConfig, ...databases);
}
/**