Merge pull request #8405 from backstage/freben/nounpack
Do not unpack arguments directly on exported items 🧹
This commit is contained in:
@@ -188,18 +188,9 @@ export type DatabaseManagerOptions = {
|
||||
|
||||
// @public (undocumented)
|
||||
export class DockerContainerRunner implements ContainerRunner {
|
||||
constructor({ dockerClient }: { dockerClient: Docker });
|
||||
constructor(options: { dockerClient: Docker });
|
||||
// (undocumented)
|
||||
runContainer({
|
||||
imageName,
|
||||
command,
|
||||
args,
|
||||
logStream,
|
||||
mountDirs,
|
||||
workingDir,
|
||||
envVars,
|
||||
pullImage,
|
||||
}: RunContainerOptions): Promise<void>;
|
||||
runContainer(options: RunContainerOptions): Promise<void>;
|
||||
}
|
||||
|
||||
// @public
|
||||
@@ -235,34 +226,17 @@ export function getVoidLogger(): winston.Logger;
|
||||
// @public (undocumented)
|
||||
export class Git {
|
||||
// (undocumented)
|
||||
add({ dir, filepath }: { dir: string; filepath: string }): Promise<void>;
|
||||
add(options: { dir: string; filepath: string }): Promise<void>;
|
||||
// (undocumented)
|
||||
addRemote({
|
||||
dir,
|
||||
url,
|
||||
remote,
|
||||
}: {
|
||||
addRemote(options: {
|
||||
dir: string;
|
||||
remote: string;
|
||||
url: string;
|
||||
}): Promise<void>;
|
||||
// (undocumented)
|
||||
clone({
|
||||
url,
|
||||
dir,
|
||||
ref,
|
||||
}: {
|
||||
url: string;
|
||||
dir: string;
|
||||
ref?: string;
|
||||
}): Promise<void>;
|
||||
clone(options: { url: string; dir: string; ref?: string }): Promise<void>;
|
||||
// (undocumented)
|
||||
commit({
|
||||
dir,
|
||||
message,
|
||||
author,
|
||||
committer,
|
||||
}: {
|
||||
commit(options: {
|
||||
dir: string;
|
||||
message: string;
|
||||
author: {
|
||||
@@ -275,41 +249,22 @@ export class Git {
|
||||
};
|
||||
}): Promise<string>;
|
||||
// (undocumented)
|
||||
currentBranch({
|
||||
dir,
|
||||
fullName,
|
||||
}: {
|
||||
currentBranch(options: {
|
||||
dir: string;
|
||||
fullName?: boolean;
|
||||
}): Promise<string | undefined>;
|
||||
// (undocumented)
|
||||
fetch({ dir, remote }: { dir: string; remote?: string }): Promise<void>;
|
||||
fetch(options: { dir: string; remote?: string }): Promise<void>;
|
||||
// (undocumented)
|
||||
static fromAuth: ({
|
||||
username,
|
||||
password,
|
||||
logger,
|
||||
}: {
|
||||
username?: string | undefined;
|
||||
password?: string | undefined;
|
||||
logger?: Logger_2 | undefined;
|
||||
static fromAuth: (options: {
|
||||
username?: string;
|
||||
password?: string;
|
||||
logger?: Logger_2;
|
||||
}) => Git;
|
||||
// (undocumented)
|
||||
init({
|
||||
dir,
|
||||
defaultBranch,
|
||||
}: {
|
||||
dir: string;
|
||||
defaultBranch?: string;
|
||||
}): Promise<void>;
|
||||
init(options: { dir: string; defaultBranch?: string }): Promise<void>;
|
||||
// (undocumented)
|
||||
merge({
|
||||
dir,
|
||||
theirs,
|
||||
ours,
|
||||
author,
|
||||
committer,
|
||||
}: {
|
||||
merge(options: {
|
||||
dir: string;
|
||||
theirs: string;
|
||||
ours?: string;
|
||||
@@ -323,17 +278,11 @@ export class Git {
|
||||
};
|
||||
}): Promise<MergeResult>;
|
||||
// (undocumented)
|
||||
push({ dir, remote }: { dir: string; remote: string }): Promise<PushResult>;
|
||||
push(options: { dir: string; remote: string }): Promise<PushResult>;
|
||||
// (undocumented)
|
||||
readCommit({
|
||||
dir,
|
||||
sha,
|
||||
}: {
|
||||
dir: string;
|
||||
sha: string;
|
||||
}): Promise<ReadCommitResult>;
|
||||
readCommit(options: { dir: string; sha: string }): Promise<ReadCommitResult>;
|
||||
// (undocumented)
|
||||
resolveRef({ dir, ref }: { dir: string; ref: string }): Promise<string>;
|
||||
resolveRef(options: { dir: string; ref: string }): Promise<string>;
|
||||
}
|
||||
|
||||
// @public
|
||||
@@ -634,8 +583,8 @@ export type UrlReaderPredicateTuple = {
|
||||
|
||||
// @public
|
||||
export class UrlReaders {
|
||||
static create({ logger, config, factories }: UrlReadersOptions): UrlReader;
|
||||
static default({ logger, config, factories }: UrlReadersOptions): UrlReader;
|
||||
static create(options: UrlReadersOptions): UrlReader;
|
||||
static default(options: UrlReadersOptions): UrlReader;
|
||||
}
|
||||
|
||||
// @public (undocumented)
|
||||
|
||||
@@ -46,7 +46,8 @@ export class UrlReaders {
|
||||
/**
|
||||
* Creates a UrlReader without any known types.
|
||||
*/
|
||||
static create({ logger, config, factories }: UrlReadersOptions): UrlReader {
|
||||
static create(options: UrlReadersOptions): UrlReader {
|
||||
const { logger, config, factories } = options;
|
||||
const mux = new UrlReaderPredicateMux(logger);
|
||||
const treeResponseFactory = DefaultReadTreeResponseFactory.create({
|
||||
config,
|
||||
@@ -68,7 +69,8 @@ export class UrlReaders {
|
||||
*
|
||||
* Any additional factories passed will be loaded before the default ones.
|
||||
*/
|
||||
static default({ logger, config, factories = [] }: UrlReadersOptions) {
|
||||
static default(options: UrlReadersOptions) {
|
||||
const { logger, config, factories = [] } = options;
|
||||
return UrlReaders.create({
|
||||
logger,
|
||||
config,
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import git, {
|
||||
ProgressCallback,
|
||||
MergeResult,
|
||||
@@ -42,44 +43,32 @@ export class Git {
|
||||
},
|
||||
) {}
|
||||
|
||||
async add({
|
||||
dir,
|
||||
filepath,
|
||||
}: {
|
||||
dir: string;
|
||||
filepath: string;
|
||||
}): Promise<void> {
|
||||
async add(options: { dir: string; filepath: string }): Promise<void> {
|
||||
const { dir, filepath } = options;
|
||||
this.config.logger?.info(`Adding file {dir=${dir},filepath=${filepath}}`);
|
||||
|
||||
return git.add({ fs, dir, filepath });
|
||||
}
|
||||
|
||||
async addRemote({
|
||||
dir,
|
||||
url,
|
||||
remote,
|
||||
}: {
|
||||
async addRemote(options: {
|
||||
dir: string;
|
||||
remote: string;
|
||||
url: string;
|
||||
}): Promise<void> {
|
||||
const { dir, url, remote } = options;
|
||||
this.config.logger?.info(
|
||||
`Creating new remote {dir=${dir},remote=${remote},url=${url}}`,
|
||||
);
|
||||
return git.addRemote({ fs, dir, remote, url });
|
||||
}
|
||||
|
||||
async commit({
|
||||
dir,
|
||||
message,
|
||||
author,
|
||||
committer,
|
||||
}: {
|
||||
async commit(options: {
|
||||
dir: string;
|
||||
message: string;
|
||||
author: { name: string; email: string };
|
||||
committer: { name: string; email: string };
|
||||
}): Promise<string> {
|
||||
const { dir, message, author, committer } = options;
|
||||
this.config.logger?.info(
|
||||
`Committing file to repo {dir=${dir},message=${message}}`,
|
||||
);
|
||||
@@ -87,15 +76,12 @@ export class Git {
|
||||
return git.commit({ fs, dir, message, author, committer });
|
||||
}
|
||||
|
||||
async clone({
|
||||
url,
|
||||
dir,
|
||||
ref,
|
||||
}: {
|
||||
async clone(options: {
|
||||
url: string;
|
||||
dir: string;
|
||||
ref?: string;
|
||||
}): Promise<void> {
|
||||
const { url, dir, ref } = options;
|
||||
this.config.logger?.info(`Cloning repo {dir=${dir},url=${url}}`);
|
||||
return git.clone({
|
||||
fs,
|
||||
@@ -114,51 +100,35 @@ export class Git {
|
||||
}
|
||||
|
||||
// https://isomorphic-git.org/docs/en/currentBranch
|
||||
async currentBranch({
|
||||
dir,
|
||||
fullName,
|
||||
}: {
|
||||
async currentBranch(options: {
|
||||
dir: string;
|
||||
fullName?: boolean;
|
||||
}): Promise<string | undefined> {
|
||||
const fullname = fullName ?? false;
|
||||
return git.currentBranch({ fs, dir, fullname }) as Promise<
|
||||
const { dir, fullName = false } = options;
|
||||
return git.currentBranch({ fs, dir, fullname: fullName }) as Promise<
|
||||
string | undefined
|
||||
>;
|
||||
}
|
||||
|
||||
// https://isomorphic-git.org/docs/en/fetch
|
||||
async fetch({
|
||||
dir,
|
||||
remote,
|
||||
}: {
|
||||
dir: string;
|
||||
remote?: string;
|
||||
}): Promise<void> {
|
||||
const remoteValue = remote ?? 'origin';
|
||||
async fetch(options: { dir: string; remote?: string }): Promise<void> {
|
||||
const { dir, remote = 'origin' } = options;
|
||||
this.config.logger?.info(
|
||||
`Fetching remote=${remoteValue} for repository {dir=${dir}}`,
|
||||
`Fetching remote=${remote} for repository {dir=${dir}}`,
|
||||
);
|
||||
await git.fetch({
|
||||
fs,
|
||||
http,
|
||||
dir,
|
||||
remote: remoteValue,
|
||||
remote,
|
||||
onProgress: this.onProgressHandler(),
|
||||
headers: {
|
||||
'user-agent': 'git/@isomorphic-git',
|
||||
},
|
||||
headers: { 'user-agent': 'git/@isomorphic-git' },
|
||||
onAuth: this.onAuth,
|
||||
});
|
||||
}
|
||||
|
||||
async init({
|
||||
dir,
|
||||
defaultBranch = 'master',
|
||||
}: {
|
||||
dir: string;
|
||||
defaultBranch?: string;
|
||||
}): Promise<void> {
|
||||
async init(options: { dir: string; defaultBranch?: string }): Promise<void> {
|
||||
const { dir, defaultBranch = 'master' } = options;
|
||||
this.config.logger?.info(`Init git repository {dir=${dir}}`);
|
||||
|
||||
return git.init({
|
||||
@@ -169,19 +139,14 @@ export class Git {
|
||||
}
|
||||
|
||||
// https://isomorphic-git.org/docs/en/merge
|
||||
async merge({
|
||||
dir,
|
||||
theirs,
|
||||
ours,
|
||||
author,
|
||||
committer,
|
||||
}: {
|
||||
async merge(options: {
|
||||
dir: string;
|
||||
theirs: string;
|
||||
ours?: string;
|
||||
author: { name: string; email: string };
|
||||
committer: { name: string; email: string };
|
||||
}): Promise<MergeResult> {
|
||||
const { dir, theirs, ours, author, committer } = options;
|
||||
this.config.logger?.info(
|
||||
`Merging branch '${theirs}' into '${ours}' for repository {dir=${dir}}`,
|
||||
);
|
||||
@@ -197,7 +162,8 @@ export class Git {
|
||||
});
|
||||
}
|
||||
|
||||
async push({ dir, remote }: { dir: string; remote: string }) {
|
||||
async push(options: { dir: string; remote: string }) {
|
||||
const { dir, remote } = options;
|
||||
this.config.logger?.info(
|
||||
`Pushing directory to remote {dir=${dir},remote=${remote}}`,
|
||||
);
|
||||
@@ -215,24 +181,17 @@ export class Git {
|
||||
}
|
||||
|
||||
// https://isomorphic-git.org/docs/en/readCommit
|
||||
async readCommit({
|
||||
dir,
|
||||
sha,
|
||||
}: {
|
||||
async readCommit(options: {
|
||||
dir: string;
|
||||
sha: string;
|
||||
}): Promise<ReadCommitResult> {
|
||||
const { dir, sha } = options;
|
||||
return git.readCommit({ fs, dir, oid: sha });
|
||||
}
|
||||
|
||||
// https://isomorphic-git.org/docs/en/resolveRef
|
||||
async resolveRef({
|
||||
dir,
|
||||
ref,
|
||||
}: {
|
||||
dir: string;
|
||||
ref: string;
|
||||
}): Promise<string> {
|
||||
async resolveRef(options: { dir: string; ref: string }): Promise<string> {
|
||||
const { dir, ref } = options;
|
||||
return git.resolveRef({ fs, dir, ref });
|
||||
}
|
||||
|
||||
@@ -256,13 +215,12 @@ export class Git {
|
||||
};
|
||||
};
|
||||
|
||||
static fromAuth = ({
|
||||
username,
|
||||
password,
|
||||
logger,
|
||||
}: {
|
||||
static fromAuth = (options: {
|
||||
username?: string;
|
||||
password?: string;
|
||||
logger?: Logger;
|
||||
}) => new Git({ username, password, logger });
|
||||
}) => {
|
||||
const { username, password, logger } = options;
|
||||
return new Git({ username, password, logger });
|
||||
};
|
||||
}
|
||||
|
||||
@@ -28,20 +28,22 @@ export type UserOptions = {
|
||||
export class DockerContainerRunner implements ContainerRunner {
|
||||
private readonly dockerClient: Docker;
|
||||
|
||||
constructor({ dockerClient }: { dockerClient: Docker }) {
|
||||
this.dockerClient = dockerClient;
|
||||
constructor(options: { dockerClient: Docker }) {
|
||||
this.dockerClient = options.dockerClient;
|
||||
}
|
||||
|
||||
async runContainer({
|
||||
imageName,
|
||||
command,
|
||||
args,
|
||||
logStream = new PassThrough(),
|
||||
mountDirs = {},
|
||||
workingDir,
|
||||
envVars = {},
|
||||
pullImage = true,
|
||||
}: RunContainerOptions) {
|
||||
async runContainer(options: RunContainerOptions) {
|
||||
const {
|
||||
imageName,
|
||||
command,
|
||||
args,
|
||||
logStream = new PassThrough(),
|
||||
mountDirs = {},
|
||||
workingDir,
|
||||
envVars = {},
|
||||
pullImage = true,
|
||||
} = options;
|
||||
|
||||
// Show a better error message when Docker is unavailable.
|
||||
try {
|
||||
await this.dockerClient.ping();
|
||||
|
||||
@@ -250,24 +250,13 @@ export class AppThemeSelector implements AppThemeApi {
|
||||
// @public
|
||||
export class AtlassianAuth {
|
||||
// (undocumented)
|
||||
static create({
|
||||
discoveryApi,
|
||||
environment,
|
||||
provider,
|
||||
oauthRequestApi,
|
||||
}: OAuthApiCreateOptions): typeof atlassianAuthApiRef.T;
|
||||
static create(options: OAuthApiCreateOptions): typeof atlassianAuthApiRef.T;
|
||||
}
|
||||
|
||||
// @public
|
||||
export class Auth0Auth {
|
||||
// (undocumented)
|
||||
static create({
|
||||
discoveryApi,
|
||||
environment,
|
||||
provider,
|
||||
oauthRequestApi,
|
||||
defaultScopes,
|
||||
}: OAuthApiCreateOptions): typeof auth0AuthApiRef.T;
|
||||
static create(options: OAuthApiCreateOptions): typeof auth0AuthApiRef.T;
|
||||
}
|
||||
|
||||
// @public
|
||||
@@ -303,13 +292,7 @@ export type BackstagePluginWithAnyOutput = Omit<
|
||||
// @public
|
||||
export class BitbucketAuth {
|
||||
// (undocumented)
|
||||
static create({
|
||||
discoveryApi,
|
||||
environment,
|
||||
provider,
|
||||
oauthRequestApi,
|
||||
defaultScopes,
|
||||
}: OAuthApiCreateOptions): typeof bitbucketAuthApiRef.T;
|
||||
static create(options: OAuthApiCreateOptions): typeof bitbucketAuthApiRef.T;
|
||||
}
|
||||
|
||||
// @public
|
||||
@@ -402,13 +385,7 @@ export class GithubAuth implements OAuthApi, SessionApi {
|
||||
// @deprecated
|
||||
constructor(sessionManager: SessionManager<GithubSession>);
|
||||
// (undocumented)
|
||||
static create({
|
||||
discoveryApi,
|
||||
environment,
|
||||
provider,
|
||||
oauthRequestApi,
|
||||
defaultScopes,
|
||||
}: OAuthApiCreateOptions): GithubAuth;
|
||||
static create(options: OAuthApiCreateOptions): GithubAuth;
|
||||
// (undocumented)
|
||||
getAccessToken(scope?: string, options?: AuthRequestOptions): Promise<string>;
|
||||
// (undocumented)
|
||||
@@ -441,25 +418,13 @@ export type GithubSession = {
|
||||
// @public
|
||||
export class GitlabAuth {
|
||||
// (undocumented)
|
||||
static create({
|
||||
discoveryApi,
|
||||
environment,
|
||||
provider,
|
||||
oauthRequestApi,
|
||||
defaultScopes,
|
||||
}: OAuthApiCreateOptions): typeof gitlabAuthApiRef.T;
|
||||
static create(options: OAuthApiCreateOptions): typeof gitlabAuthApiRef.T;
|
||||
}
|
||||
|
||||
// @public
|
||||
export class GoogleAuth {
|
||||
// (undocumented)
|
||||
static create({
|
||||
discoveryApi,
|
||||
oauthRequestApi,
|
||||
environment,
|
||||
provider,
|
||||
defaultScopes,
|
||||
}: OAuthApiCreateOptions): typeof googleAuthApiRef.T;
|
||||
static create(options: OAuthApiCreateOptions): typeof googleAuthApiRef.T;
|
||||
}
|
||||
|
||||
// @public
|
||||
@@ -477,13 +442,7 @@ export class LocalStorageFeatureFlags implements FeatureFlagsApi {
|
||||
// @public
|
||||
export class MicrosoftAuth {
|
||||
// (undocumented)
|
||||
static create({
|
||||
environment,
|
||||
provider,
|
||||
oauthRequestApi,
|
||||
discoveryApi,
|
||||
defaultScopes,
|
||||
}: OAuthApiCreateOptions): typeof microsoftAuthApiRef.T;
|
||||
static create(options: OAuthApiCreateOptions): typeof microsoftAuthApiRef.T;
|
||||
}
|
||||
|
||||
// @public
|
||||
@@ -507,14 +466,7 @@ export class OAuth2
|
||||
scopeTransform: (scopes: string[]) => string[];
|
||||
});
|
||||
// (undocumented)
|
||||
static create({
|
||||
discoveryApi,
|
||||
environment,
|
||||
provider,
|
||||
oauthRequestApi,
|
||||
defaultScopes,
|
||||
scopeTransform,
|
||||
}: OAuth2CreateOptions): OAuth2;
|
||||
static create(options: OAuth2CreateOptions): OAuth2;
|
||||
// (undocumented)
|
||||
getAccessToken(
|
||||
scope?: string | string[],
|
||||
@@ -570,24 +522,15 @@ export class OAuthRequestManager implements OAuthRequestApi {
|
||||
// @public
|
||||
export class OktaAuth {
|
||||
// (undocumented)
|
||||
static create({
|
||||
discoveryApi,
|
||||
environment,
|
||||
provider,
|
||||
oauthRequestApi,
|
||||
defaultScopes,
|
||||
}: OAuthApiCreateOptions): typeof oktaAuthApiRef.T;
|
||||
static create(options: OAuthApiCreateOptions): typeof oktaAuthApiRef.T;
|
||||
}
|
||||
|
||||
// @public
|
||||
export class OneLoginAuth {
|
||||
// (undocumented)
|
||||
static create({
|
||||
discoveryApi,
|
||||
environment,
|
||||
provider,
|
||||
oauthRequestApi,
|
||||
}: OneLoginAuthCreateOptions): typeof oneloginAuthApiRef.T;
|
||||
static create(
|
||||
options: OneLoginAuthCreateOptions,
|
||||
): typeof oneloginAuthApiRef.T;
|
||||
}
|
||||
|
||||
// @public
|
||||
@@ -607,11 +550,7 @@ export class SamlAuth
|
||||
// @deprecated
|
||||
constructor(sessionManager: SessionManager<SamlSession>);
|
||||
// (undocumented)
|
||||
static create({
|
||||
discoveryApi,
|
||||
environment,
|
||||
provider,
|
||||
}: AuthApiCreateOptions): SamlAuth;
|
||||
static create(options: AuthApiCreateOptions): SamlAuth;
|
||||
// (undocumented)
|
||||
getBackstageIdentity(
|
||||
options?: AuthRequestOptions,
|
||||
|
||||
@@ -30,12 +30,14 @@ const DEFAULT_PROVIDER = {
|
||||
* @public
|
||||
*/
|
||||
export default class AtlassianAuth {
|
||||
static create({
|
||||
discoveryApi,
|
||||
environment = 'development',
|
||||
provider = DEFAULT_PROVIDER,
|
||||
oauthRequestApi,
|
||||
}: OAuthApiCreateOptions): typeof atlassianAuthApiRef.T {
|
||||
static create(options: OAuthApiCreateOptions): typeof atlassianAuthApiRef.T {
|
||||
const {
|
||||
discoveryApi,
|
||||
environment = 'development',
|
||||
provider = DEFAULT_PROVIDER,
|
||||
oauthRequestApi,
|
||||
} = options;
|
||||
|
||||
return OAuth2.create({
|
||||
discoveryApi,
|
||||
oauthRequestApi,
|
||||
|
||||
@@ -30,13 +30,15 @@ const DEFAULT_PROVIDER = {
|
||||
* @public
|
||||
*/
|
||||
export default class Auth0Auth {
|
||||
static create({
|
||||
discoveryApi,
|
||||
environment = 'development',
|
||||
provider = DEFAULT_PROVIDER,
|
||||
oauthRequestApi,
|
||||
defaultScopes = ['openid', `email`, `profile`],
|
||||
}: OAuthApiCreateOptions): typeof auth0AuthApiRef.T {
|
||||
static create(options: OAuthApiCreateOptions): typeof auth0AuthApiRef.T {
|
||||
const {
|
||||
discoveryApi,
|
||||
environment = 'development',
|
||||
provider = DEFAULT_PROVIDER,
|
||||
oauthRequestApi,
|
||||
defaultScopes = ['openid', `email`, `profile`],
|
||||
} = options;
|
||||
|
||||
return OAuth2.create({
|
||||
discoveryApi,
|
||||
oauthRequestApi,
|
||||
|
||||
@@ -45,13 +45,15 @@ const DEFAULT_PROVIDER = {
|
||||
* @public
|
||||
*/
|
||||
export default class BitbucketAuth {
|
||||
static create({
|
||||
discoveryApi,
|
||||
environment = 'development',
|
||||
provider = DEFAULT_PROVIDER,
|
||||
oauthRequestApi,
|
||||
defaultScopes = ['team'],
|
||||
}: OAuthApiCreateOptions): typeof bitbucketAuthApiRef.T {
|
||||
static create(options: OAuthApiCreateOptions): typeof bitbucketAuthApiRef.T {
|
||||
const {
|
||||
discoveryApi,
|
||||
environment = 'development',
|
||||
provider = DEFAULT_PROVIDER,
|
||||
oauthRequestApi,
|
||||
defaultScopes = ['team'],
|
||||
} = options;
|
||||
|
||||
return OAuth2.create({
|
||||
discoveryApi,
|
||||
oauthRequestApi,
|
||||
|
||||
@@ -56,13 +56,15 @@ const DEFAULT_PROVIDER = {
|
||||
* @public
|
||||
*/
|
||||
export default class GithubAuth implements OAuthApi, SessionApi {
|
||||
static create({
|
||||
discoveryApi,
|
||||
environment = 'development',
|
||||
provider = DEFAULT_PROVIDER,
|
||||
oauthRequestApi,
|
||||
defaultScopes = ['read:user'],
|
||||
}: OAuthApiCreateOptions) {
|
||||
static create(options: OAuthApiCreateOptions) {
|
||||
const {
|
||||
discoveryApi,
|
||||
environment = 'development',
|
||||
provider = DEFAULT_PROVIDER,
|
||||
oauthRequestApi,
|
||||
defaultScopes = ['read:user'],
|
||||
} = options;
|
||||
|
||||
const connector = new DefaultAuthConnector({
|
||||
discoveryApi,
|
||||
environment,
|
||||
|
||||
@@ -30,13 +30,15 @@ const DEFAULT_PROVIDER = {
|
||||
* @public
|
||||
*/
|
||||
export default class GitlabAuth {
|
||||
static create({
|
||||
discoveryApi,
|
||||
environment = 'development',
|
||||
provider = DEFAULT_PROVIDER,
|
||||
oauthRequestApi,
|
||||
defaultScopes = ['read_user'],
|
||||
}: OAuthApiCreateOptions): typeof gitlabAuthApiRef.T {
|
||||
static create(options: OAuthApiCreateOptions): typeof gitlabAuthApiRef.T {
|
||||
const {
|
||||
discoveryApi,
|
||||
environment = 'development',
|
||||
provider = DEFAULT_PROVIDER,
|
||||
oauthRequestApi,
|
||||
defaultScopes = ['read_user'],
|
||||
} = options;
|
||||
|
||||
return OAuth2.create({
|
||||
discoveryApi,
|
||||
oauthRequestApi,
|
||||
|
||||
@@ -32,17 +32,19 @@ const SCOPE_PREFIX = 'https://www.googleapis.com/auth/';
|
||||
* @public
|
||||
*/
|
||||
export default class GoogleAuth {
|
||||
static create({
|
||||
discoveryApi,
|
||||
oauthRequestApi,
|
||||
environment = 'development',
|
||||
provider = DEFAULT_PROVIDER,
|
||||
defaultScopes = [
|
||||
'openid',
|
||||
`${SCOPE_PREFIX}userinfo.email`,
|
||||
`${SCOPE_PREFIX}userinfo.profile`,
|
||||
],
|
||||
}: OAuthApiCreateOptions): typeof googleAuthApiRef.T {
|
||||
static create(options: OAuthApiCreateOptions): typeof googleAuthApiRef.T {
|
||||
const {
|
||||
discoveryApi,
|
||||
oauthRequestApi,
|
||||
environment = 'development',
|
||||
provider = DEFAULT_PROVIDER,
|
||||
defaultScopes = [
|
||||
'openid',
|
||||
`${SCOPE_PREFIX}userinfo.email`,
|
||||
`${SCOPE_PREFIX}userinfo.profile`,
|
||||
],
|
||||
} = options;
|
||||
|
||||
return OAuth2.create({
|
||||
discoveryApi,
|
||||
oauthRequestApi,
|
||||
|
||||
@@ -30,19 +30,21 @@ const DEFAULT_PROVIDER = {
|
||||
* @public
|
||||
*/
|
||||
export default class MicrosoftAuth {
|
||||
static create({
|
||||
environment = 'development',
|
||||
provider = DEFAULT_PROVIDER,
|
||||
oauthRequestApi,
|
||||
discoveryApi,
|
||||
defaultScopes = [
|
||||
'openid',
|
||||
'offline_access',
|
||||
'profile',
|
||||
'email',
|
||||
'User.Read',
|
||||
],
|
||||
}: OAuthApiCreateOptions): typeof microsoftAuthApiRef.T {
|
||||
static create(options: OAuthApiCreateOptions): typeof microsoftAuthApiRef.T {
|
||||
const {
|
||||
environment = 'development',
|
||||
provider = DEFAULT_PROVIDER,
|
||||
oauthRequestApi,
|
||||
discoveryApi,
|
||||
defaultScopes = [
|
||||
'openid',
|
||||
'offline_access',
|
||||
'profile',
|
||||
'email',
|
||||
'User.Read',
|
||||
],
|
||||
} = options;
|
||||
|
||||
return OAuth2.create({
|
||||
discoveryApi,
|
||||
oauthRequestApi,
|
||||
|
||||
@@ -70,14 +70,16 @@ export default class OAuth2
|
||||
BackstageIdentityApi,
|
||||
SessionApi
|
||||
{
|
||||
static create({
|
||||
discoveryApi,
|
||||
environment = 'development',
|
||||
provider = DEFAULT_PROVIDER,
|
||||
oauthRequestApi,
|
||||
defaultScopes = [],
|
||||
scopeTransform = x => x,
|
||||
}: OAuth2CreateOptions) {
|
||||
static create(options: OAuth2CreateOptions) {
|
||||
const {
|
||||
discoveryApi,
|
||||
environment = 'development',
|
||||
provider = DEFAULT_PROVIDER,
|
||||
oauthRequestApi,
|
||||
defaultScopes = [],
|
||||
scopeTransform = x => x,
|
||||
} = options;
|
||||
|
||||
const connector = new DefaultAuthConnector({
|
||||
discoveryApi,
|
||||
environment,
|
||||
|
||||
@@ -42,13 +42,15 @@ const OKTA_SCOPE_PREFIX: string = 'okta.';
|
||||
* @public
|
||||
*/
|
||||
export default class OktaAuth {
|
||||
static create({
|
||||
discoveryApi,
|
||||
environment = 'development',
|
||||
provider = DEFAULT_PROVIDER,
|
||||
oauthRequestApi,
|
||||
defaultScopes = ['openid', 'email', 'profile', 'offline_access'],
|
||||
}: OAuthApiCreateOptions): typeof oktaAuthApiRef.T {
|
||||
static create(options: OAuthApiCreateOptions): typeof oktaAuthApiRef.T {
|
||||
const {
|
||||
discoveryApi,
|
||||
environment = 'development',
|
||||
provider = DEFAULT_PROVIDER,
|
||||
oauthRequestApi,
|
||||
defaultScopes = ['openid', 'email', 'profile', 'offline_access'],
|
||||
} = options;
|
||||
|
||||
return OAuth2.create({
|
||||
discoveryApi,
|
||||
oauthRequestApi,
|
||||
|
||||
@@ -57,12 +57,16 @@ const SCOPE_PREFIX: string = 'onelogin.';
|
||||
* @public
|
||||
*/
|
||||
export default class OneLoginAuth {
|
||||
static create({
|
||||
discoveryApi,
|
||||
environment = 'development',
|
||||
provider = DEFAULT_PROVIDER,
|
||||
oauthRequestApi,
|
||||
}: OneLoginAuthCreateOptions): typeof oneloginAuthApiRef.T {
|
||||
static create(
|
||||
options: OneLoginAuthCreateOptions,
|
||||
): typeof oneloginAuthApiRef.T {
|
||||
const {
|
||||
discoveryApi,
|
||||
environment = 'development',
|
||||
provider = DEFAULT_PROVIDER,
|
||||
oauthRequestApi,
|
||||
} = options;
|
||||
|
||||
return OAuth2.create({
|
||||
discoveryApi,
|
||||
oauthRequestApi,
|
||||
|
||||
@@ -52,11 +52,13 @@ const DEFAULT_PROVIDER = {
|
||||
export default class SamlAuth
|
||||
implements ProfileInfoApi, BackstageIdentityApi, SessionApi
|
||||
{
|
||||
static create({
|
||||
discoveryApi,
|
||||
environment = 'development',
|
||||
provider = DEFAULT_PROVIDER,
|
||||
}: AuthApiCreateOptions) {
|
||||
static create(options: AuthApiCreateOptions) {
|
||||
const {
|
||||
discoveryApi,
|
||||
environment = 'development',
|
||||
provider = DEFAULT_PROVIDER,
|
||||
} = options;
|
||||
|
||||
const connector = new DirectAuthConnector<SamlSession>({
|
||||
discoveryApi,
|
||||
environment,
|
||||
|
||||
@@ -1982,10 +1982,7 @@ export const SidebarSpacer: React_2.ComponentType<
|
||||
>;
|
||||
|
||||
// @public
|
||||
export const SidebarSubmenu: ({
|
||||
title,
|
||||
children,
|
||||
}: PropsWithChildren<SidebarSubmenuProps>) => JSX.Element;
|
||||
export const SidebarSubmenu: (props: SidebarSubmenuProps) => JSX.Element;
|
||||
|
||||
// @public
|
||||
export const SidebarSubmenuItem: (
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
import { makeStyles } from '@material-ui/core/styles';
|
||||
import Typography from '@material-ui/core/Typography';
|
||||
import clsx from 'clsx';
|
||||
import React, { PropsWithChildren, ReactNode, useContext } from 'react';
|
||||
import React, { ReactNode, useContext } from 'react';
|
||||
import {
|
||||
SidebarItemWithSubmenuContext,
|
||||
sidebarConfig,
|
||||
@@ -83,16 +83,12 @@ export type SidebarSubmenuProps = {
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export const SidebarSubmenu = ({
|
||||
title,
|
||||
children,
|
||||
}: PropsWithChildren<SidebarSubmenuProps>) => {
|
||||
export const SidebarSubmenu = (props: SidebarSubmenuProps) => {
|
||||
const { isOpen } = useContext(SidebarContext);
|
||||
const left = isOpen
|
||||
? sidebarConfig.drawerWidthOpen
|
||||
: sidebarConfig.drawerWidthClosed;
|
||||
const props = { left: left };
|
||||
const classes = useStyles(props)();
|
||||
const classes = useStyles({ left: left })();
|
||||
|
||||
const { isHoveredOn } = useContext(SidebarItemWithSubmenuContext);
|
||||
return (
|
||||
@@ -102,9 +98,9 @@ export const SidebarSubmenu = ({
|
||||
})}
|
||||
>
|
||||
<Typography variant="h5" className={classes.title}>
|
||||
{title}
|
||||
{props.title}
|
||||
</Typography>
|
||||
{children}
|
||||
{props.children}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -43,10 +43,7 @@ export type AnalyticsApi = {
|
||||
export const analyticsApiRef: ApiRef<AnalyticsApi>;
|
||||
|
||||
// @public
|
||||
export const AnalyticsContext: ({
|
||||
attributes,
|
||||
children,
|
||||
}: {
|
||||
export const AnalyticsContext: (options: {
|
||||
attributes: Partial<AnalyticsContextValue>;
|
||||
children: ReactNode;
|
||||
}) => JSX.Element;
|
||||
|
||||
@@ -62,13 +62,12 @@ export const useAnalyticsContext = (): AnalyticsContextValue => {
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export const AnalyticsContext = ({
|
||||
attributes,
|
||||
children,
|
||||
}: {
|
||||
export const AnalyticsContext = (options: {
|
||||
attributes: Partial<AnalyticsContextValue>;
|
||||
children: ReactNode;
|
||||
}) => {
|
||||
const { attributes, children } = options;
|
||||
|
||||
const parentValues = useAnalyticsContext();
|
||||
const combinedValue = {
|
||||
...parentValues,
|
||||
|
||||
@@ -44,11 +44,9 @@ export type DevAppPageOptions = {
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
export const EntityGridItem: ({
|
||||
entity,
|
||||
classes,
|
||||
...rest
|
||||
}: Omit<GridProps<'div', {}>, 'container' | 'item'> & {
|
||||
entity: Entity;
|
||||
}) => JSX.Element;
|
||||
export const EntityGridItem: (
|
||||
props: Omit<GridProps, 'item' | 'container'> & {
|
||||
entity: Entity;
|
||||
},
|
||||
) => JSX.Element;
|
||||
```
|
||||
|
||||
@@ -35,11 +35,10 @@ const useStyles = makeStyles<BackstageTheme, { entity: Entity }>(theme => ({
|
||||
}));
|
||||
|
||||
/** @public */
|
||||
export const EntityGridItem = ({
|
||||
entity,
|
||||
classes,
|
||||
...rest
|
||||
}: Omit<GridProps, 'item' | 'container'> & { entity: Entity }): JSX.Element => {
|
||||
export const EntityGridItem = (
|
||||
props: Omit<GridProps, 'item' | 'container'> & { entity: Entity },
|
||||
): JSX.Element => {
|
||||
const { entity, classes, ...rest } = props;
|
||||
const itemClasses = useStyles({ entity });
|
||||
|
||||
return (
|
||||
|
||||
@@ -49,22 +49,6 @@ export type GeneratorBuilder = {
|
||||
get(entity: Entity): GeneratorBase;
|
||||
};
|
||||
|
||||
// Warning: (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen
|
||||
// Warning: (tsdoc-param-tag-with-invalid-type) The @param block should not include a JSDoc-style '{type}'
|
||||
// Warning: (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen
|
||||
// Warning: (tsdoc-param-tag-with-invalid-type) The @param block should not include a JSDoc-style '{type}'
|
||||
// Warning: (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen
|
||||
// Warning: (tsdoc-param-tag-with-invalid-type) The @param block should not include a JSDoc-style '{type}'
|
||||
// Warning: (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen
|
||||
// Warning: (tsdoc-param-tag-with-invalid-type) The @param block should not include a JSDoc-style '{type}'
|
||||
// Warning: (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen
|
||||
// Warning: (tsdoc-param-tag-with-invalid-optional-name) The @param should not include a JSDoc-style optional name; it must not be enclosed in '[ ]' brackets.
|
||||
// Warning: (tsdoc-param-tag-with-invalid-type) The @param block should not include a JSDoc-style '{type}'
|
||||
// Warning: (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen
|
||||
// Warning: (tsdoc-param-tag-with-invalid-optional-name) The @param should not include a JSDoc-style optional name; it must not be enclosed in '[ ]' brackets.
|
||||
// Warning: (tsdoc-param-tag-with-invalid-type) The @param block should not include a JSDoc-style '{type}'
|
||||
// Warning: (ae-missing-release-tag) "GeneratorRunOptions" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public
|
||||
export type GeneratorRunOptions = {
|
||||
inputDir: string;
|
||||
@@ -82,10 +66,7 @@ export class Generators implements GeneratorBuilder {
|
||||
// (undocumented)
|
||||
static fromConfig(
|
||||
config: Config,
|
||||
{
|
||||
logger,
|
||||
containerRunner,
|
||||
}: {
|
||||
options: {
|
||||
logger: Logger_2;
|
||||
containerRunner: ContainerRunner;
|
||||
},
|
||||
@@ -185,13 +166,10 @@ export class Publisher {
|
||||
): Promise<PublisherBase>;
|
||||
}
|
||||
|
||||
// Warning: (ae-missing-release-tag) "PublisherBase" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public
|
||||
export interface PublisherBase {
|
||||
docsRouter(): express.Handler;
|
||||
fetchTechDocsMetadata(entityName: EntityName): Promise<TechDocsMetadata>;
|
||||
// Warning: (ae-forgotten-export) The symbol "ReadinessResponse" needs to be exported by the entry point index.d.ts
|
||||
getReadiness(): Promise<ReadinessResponse>;
|
||||
hasDocsBeenGenerated(entityName: Entity): Promise<boolean>;
|
||||
// Warning: (tsdoc-escape-right-brace) The "}" character should be escaped using a backslash to avoid confusion with a TSDoc inline tag
|
||||
@@ -202,7 +180,6 @@ export interface PublisherBase {
|
||||
// Warning: (tsdoc-malformed-inline-tag) Expecting a TSDoc tag starting with "{@"
|
||||
// Warning: (ae-forgotten-export) The symbol "MigrateRequest" needs to be exported by the entry point index.d.ts
|
||||
migrateDocsCase?(migrateRequest: MigrateRequest): Promise<void>;
|
||||
// Warning: (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen
|
||||
// Warning: (ae-forgotten-export) The symbol "PublishRequest" needs to be exported by the entry point index.d.ts
|
||||
// Warning: (ae-forgotten-export) The symbol "PublishResponse" needs to be exported by the entry point index.d.ts
|
||||
publish(request: PublishRequest): Promise<PublishResponse>;
|
||||
@@ -218,6 +195,11 @@ export type PublisherType =
|
||||
| 'azureBlobStorage'
|
||||
| 'openStackSwift';
|
||||
|
||||
// @public
|
||||
export type ReadinessResponse = {
|
||||
isAvailable: boolean;
|
||||
};
|
||||
|
||||
// Warning: (ae-missing-release-tag) "RemoteProtocol" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
@@ -245,12 +227,7 @@ export interface TechDocsDocument extends IndexableDocument {
|
||||
//
|
||||
// @public (undocumented)
|
||||
export class TechdocsGenerator implements GeneratorBase {
|
||||
constructor({
|
||||
logger,
|
||||
containerRunner,
|
||||
config,
|
||||
scmIntegrations,
|
||||
}: {
|
||||
constructor(options: {
|
||||
logger: Logger_2;
|
||||
containerRunner: ContainerRunner;
|
||||
config: Config;
|
||||
@@ -260,26 +237,15 @@ export class TechdocsGenerator implements GeneratorBase {
|
||||
// (undocumented)
|
||||
static fromConfig(
|
||||
config: Config,
|
||||
{
|
||||
containerRunner,
|
||||
logger,
|
||||
}: {
|
||||
options: {
|
||||
containerRunner: ContainerRunner;
|
||||
logger: Logger_2;
|
||||
},
|
||||
): TechdocsGenerator;
|
||||
// (undocumented)
|
||||
run({
|
||||
inputDir,
|
||||
outputDir,
|
||||
parsedLocationAnnotation,
|
||||
etag,
|
||||
logger: childLogger,
|
||||
logStream,
|
||||
}: GeneratorRunOptions): Promise<void>;
|
||||
run(options: GeneratorRunOptions): Promise<void>;
|
||||
}
|
||||
|
||||
// Warning: (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen
|
||||
// Warning: (ae-missing-release-tag) "TechDocsMetadata" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public
|
||||
@@ -319,7 +285,7 @@ export class UrlPreparer implements PreparerBase {
|
||||
|
||||
// Warnings were encountered during analysis:
|
||||
//
|
||||
// src/stages/generate/types.d.ts:44:5 - (ae-forgotten-export) The symbol "SupportedGeneratorKey" needs to be exported by the entry point index.d.ts
|
||||
// src/stages/generate/types.d.ts:45:5 - (ae-forgotten-export) The symbol "SupportedGeneratorKey" needs to be exported by the entry point index.d.ts
|
||||
// src/stages/prepare/types.d.ts:18:8 - (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen
|
||||
// src/stages/prepare/types.d.ts:19:8 - (tsdoc-param-tag-with-invalid-name) The @param block should be followed by a valid parameter name: The identifier cannot non-word characters
|
||||
// src/stages/prepare/types.d.ts:21:33 - (tsdoc-escape-right-brace) The "}" character should be escaped using a backslash to avoid confusion with a TSDoc inline tag
|
||||
|
||||
@@ -31,17 +31,11 @@ export class Generators implements GeneratorBuilder {
|
||||
|
||||
static async fromConfig(
|
||||
config: Config,
|
||||
{
|
||||
logger,
|
||||
containerRunner,
|
||||
}: { logger: Logger; containerRunner: ContainerRunner },
|
||||
options: { logger: Logger; containerRunner: ContainerRunner },
|
||||
): Promise<GeneratorBuilder> {
|
||||
const generators = new Generators();
|
||||
|
||||
const techdocsGenerator = TechdocsGenerator.fromConfig(config, {
|
||||
logger,
|
||||
containerRunner,
|
||||
});
|
||||
const techdocsGenerator = TechdocsGenerator.fromConfig(config, options);
|
||||
generators.register('techdocs', techdocsGenerator);
|
||||
|
||||
return generators;
|
||||
|
||||
@@ -52,11 +52,9 @@ export class TechdocsGenerator implements GeneratorBase {
|
||||
|
||||
static fromConfig(
|
||||
config: Config,
|
||||
{
|
||||
containerRunner,
|
||||
logger,
|
||||
}: { containerRunner: ContainerRunner; logger: Logger },
|
||||
options: { containerRunner: ContainerRunner; logger: Logger },
|
||||
) {
|
||||
const { containerRunner, logger } = options;
|
||||
const scmIntegrations = ScmIntegrations.fromConfig(config);
|
||||
return new TechdocsGenerator({
|
||||
logger,
|
||||
@@ -66,31 +64,28 @@ export class TechdocsGenerator implements GeneratorBase {
|
||||
});
|
||||
}
|
||||
|
||||
constructor({
|
||||
logger,
|
||||
containerRunner,
|
||||
config,
|
||||
scmIntegrations,
|
||||
}: {
|
||||
constructor(options: {
|
||||
logger: Logger;
|
||||
containerRunner: ContainerRunner;
|
||||
config: Config;
|
||||
scmIntegrations: ScmIntegrationRegistry;
|
||||
}) {
|
||||
this.logger = logger;
|
||||
this.options = readGeneratorConfig(config, logger);
|
||||
this.containerRunner = containerRunner;
|
||||
this.scmIntegrations = scmIntegrations;
|
||||
this.logger = options.logger;
|
||||
this.options = readGeneratorConfig(options.config, options.logger);
|
||||
this.containerRunner = options.containerRunner;
|
||||
this.scmIntegrations = options.scmIntegrations;
|
||||
}
|
||||
|
||||
public async run({
|
||||
inputDir,
|
||||
outputDir,
|
||||
parsedLocationAnnotation,
|
||||
etag,
|
||||
logger: childLogger,
|
||||
logStream,
|
||||
}: GeneratorRunOptions): Promise<void> {
|
||||
public async run(options: GeneratorRunOptions): Promise<void> {
|
||||
const {
|
||||
inputDir,
|
||||
outputDir,
|
||||
parsedLocationAnnotation,
|
||||
etag,
|
||||
logger: childLogger,
|
||||
logStream,
|
||||
} = options;
|
||||
|
||||
// Do some updates to mkdocs.yml before generating docs e.g. adding repo_url
|
||||
const { path: mkdocsYmlPath, content } = await getMkdocsYml(inputDir);
|
||||
|
||||
|
||||
@@ -34,12 +34,13 @@ export type GeneratorConfig = {
|
||||
/**
|
||||
* The values that the generator will receive.
|
||||
*
|
||||
* @param {string} inputDir The directory of the uncompiled documentation, with the values from the frontend
|
||||
* @param {string} outputDir Directory to store generated docs in. Usually - a newly created temporary directory.
|
||||
* @param {ParsedLocationAnnotation} parsedLocationAnnotation backstage.io/techdocs-ref annotation of an entity
|
||||
* @param {string} etag A unique identifier for the prepared tree e.g. commit SHA. If provided it will be stored in techdocs_metadata.json.
|
||||
* @param {Logger} [logger] A logger that forwards the messages to the caller to be displayed outside of the backend.
|
||||
* @param {Writable} [logStream] A log stream that can send raw log messages to the caller to be displayed outside of the backend..
|
||||
* @public
|
||||
* @param inputDir - The directory of the uncompiled documentation, with the values from the frontend
|
||||
* @param outputDir - Directory to store generated docs in. Usually - a newly created temporary directory.
|
||||
* @param parsedLocationAnnotation - backstage.io/techdocs-ref annotation of an entity
|
||||
* @param etag - A unique identifier for the prepared tree e.g. commit SHA. If provided it will be stored in techdocs_metadata.json.
|
||||
* @param logger - A logger that forwards the messages to the caller to be displayed outside of the backend.
|
||||
* @param logStream - A log stream that can send raw log messages to the caller to be displayed outside of the backend.
|
||||
*/
|
||||
export type GeneratorRunOptions = {
|
||||
inputDir: string;
|
||||
|
||||
@@ -14,4 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
export { Publisher } from './publish';
|
||||
export type { PublisherBase, PublisherType, TechDocsMetadata } from './types';
|
||||
export type {
|
||||
PublisherBase,
|
||||
PublisherType,
|
||||
TechDocsMetadata,
|
||||
ReadinessResponse,
|
||||
} from './types';
|
||||
|
||||
@@ -51,6 +51,8 @@ export type PublishResponse = {
|
||||
|
||||
/**
|
||||
* Result for the validation check.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export type ReadinessResponse = {
|
||||
/** If true, the publisher is able to interact with the backing storage. */
|
||||
@@ -59,7 +61,7 @@ export type ReadinessResponse = {
|
||||
|
||||
/**
|
||||
* Type to hold metadata found in techdocs_metadata.json and associated with each site
|
||||
* @param etag ETag of the resource used to generate the site. Usually the latest commit sha of the source repository.
|
||||
* @param etag - ETag of the resource used to generate the site. Usually the latest commit sha of the source repository.
|
||||
*/
|
||||
export type TechDocsMetadata = {
|
||||
site_name: string;
|
||||
@@ -86,6 +88,8 @@ export type MigrateRequest = {
|
||||
* Base class for a TechDocs publisher (e.g. Local, Google GCS Bucket, AWS S3, etc.)
|
||||
* The publisher handles publishing of the generated static files after the prepare and generate steps of TechDocs.
|
||||
* It also provides APIs to communicate with the storage service.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export interface PublisherBase {
|
||||
/**
|
||||
@@ -99,8 +103,8 @@ export interface PublisherBase {
|
||||
/**
|
||||
* Store the generated static files onto a storage service (either local filesystem or external service).
|
||||
*
|
||||
* @param request Object containing the entity from the service
|
||||
* catalog, and the directory that contains the generated static files from TechDocs.
|
||||
* @param request - Object containing the entity from the service
|
||||
* catalog, and the directory that contains the generated static files from TechDocs.
|
||||
*/
|
||||
publish(request: PublishRequest): Promise<PublishResponse>;
|
||||
|
||||
|
||||
@@ -89,23 +89,13 @@ export type LogFuncs = 'log' | 'warn' | 'error';
|
||||
// @public
|
||||
export class MockAnalyticsApi implements AnalyticsApi {
|
||||
// (undocumented)
|
||||
captureEvent({
|
||||
action,
|
||||
subject,
|
||||
value,
|
||||
attributes,
|
||||
context,
|
||||
}: AnalyticsEvent): void;
|
||||
captureEvent(event: AnalyticsEvent): void;
|
||||
// (undocumented)
|
||||
getEvents(): AnalyticsEvent[];
|
||||
}
|
||||
|
||||
// @public
|
||||
export function mockBreakpoint({
|
||||
matches,
|
||||
}: {
|
||||
matches?: boolean | undefined;
|
||||
}): void;
|
||||
export function mockBreakpoint(options: { matches: boolean }): void;
|
||||
|
||||
// @public
|
||||
export class MockErrorApi implements ErrorApi {
|
||||
@@ -178,10 +168,9 @@ export function setupRequestMockHandlers(worker: {
|
||||
export type SyncLogCollector = () => void;
|
||||
|
||||
// @public
|
||||
export const TestApiProvider: <T extends any[]>({
|
||||
apis,
|
||||
children,
|
||||
}: TestApiProviderProps<T>) => JSX.Element;
|
||||
export const TestApiProvider: <T extends any[]>(
|
||||
props: TestApiProviderProps<T>,
|
||||
) => JSX.Element;
|
||||
|
||||
// @public
|
||||
export type TestApiProviderProps<TApiPairs extends any[]> = {
|
||||
|
||||
@@ -120,11 +120,13 @@ export class TestApiRegistry implements ApiHolder {
|
||||
*
|
||||
* @public
|
||||
**/
|
||||
export const TestApiProvider = <T extends any[]>({
|
||||
apis,
|
||||
children,
|
||||
}: TestApiProviderProps<T>) => {
|
||||
export const TestApiProvider = <T extends any[]>(
|
||||
props: TestApiProviderProps<T>,
|
||||
) => {
|
||||
return (
|
||||
<ApiProvider apis={TestApiRegistry.from(...apis)} children={children} />
|
||||
<ApiProvider
|
||||
apis={TestApiRegistry.from(...props.apis)}
|
||||
children={props.children}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -19,18 +19,15 @@ import { AnalyticsApi, AnalyticsEvent } from '@backstage/core-plugin-api';
|
||||
/**
|
||||
* Mock implementation of {@link core-plugin-api#AnalyticsApi} with helpers to ensure that events are sent correctly.
|
||||
* Use getEvents in tests to verify captured events.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export class MockAnalyticsApi implements AnalyticsApi {
|
||||
private events: AnalyticsEvent[] = [];
|
||||
|
||||
captureEvent({
|
||||
action,
|
||||
subject,
|
||||
value,
|
||||
attributes,
|
||||
context,
|
||||
}: AnalyticsEvent) {
|
||||
captureEvent(event: AnalyticsEvent) {
|
||||
const { action, subject, value, attributes, context } = event;
|
||||
|
||||
this.events.push({
|
||||
action,
|
||||
subject,
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* This is a mocking method suggested in the Jest Doc's, as it is not implemented in JSDOM yet.
|
||||
* It can be used to mock values when the MUI `useMediaQuery` hook if it is used in a tested component.
|
||||
* This is a mocking method suggested in the Jest docs, as it is not implemented in JSDOM yet.
|
||||
* It can be used to mock values for the MUI `useMediaQuery` hook if it is used in a tested component.
|
||||
*
|
||||
* For issues checkout the documentation:
|
||||
* https://jestjs.io/docs/manual-mocks#mocking-methods-which-are-not-implemented-in-jsdom
|
||||
@@ -26,11 +26,11 @@
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export default function mockBreakpoint({ matches = false }) {
|
||||
export default function mockBreakpoint(options: { matches: boolean }) {
|
||||
Object.defineProperty(window, 'matchMedia', {
|
||||
writable: true,
|
||||
value: jest.fn().mockImplementation(query => ({
|
||||
matches: matches,
|
||||
matches: options.matches ?? false,
|
||||
media: query,
|
||||
onchange: null,
|
||||
addListener: jest.fn(), // deprecated
|
||||
|
||||
Reference in New Issue
Block a user