discovery processor to use gh creds interface
Signed-off-by: Brian Fletcher <brian@roadie.io>
This commit is contained in:
@@ -203,6 +203,11 @@ export interface GithubCredentialsProvider {
|
||||
getCredentials(opts: { url: string }): Promise<GithubCredentials>;
|
||||
}
|
||||
|
||||
// @public
|
||||
export type GithubCredentialsProviderFactory = (
|
||||
config: GitHubIntegrationConfig,
|
||||
) => GithubCredentialsProvider;
|
||||
|
||||
// @public
|
||||
export type GithubCredentialType = 'app' | 'token';
|
||||
|
||||
@@ -427,7 +432,7 @@ export class SingleInstanceGithubCredentialsProvider
|
||||
implements GithubCredentialsProvider
|
||||
{
|
||||
// (undocumented)
|
||||
static create: (config: GitHubIntegrationConfig) => GithubCredentialsProvider;
|
||||
static create: GithubCredentialsProviderFactory;
|
||||
getCredentials(opts: { url: string }): Promise<GithubCredentials>;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ import { DateTime } from 'luxon';
|
||||
import {
|
||||
GithubCredentials,
|
||||
GithubCredentialsProvider,
|
||||
GithubCredentialsProviderFactory,
|
||||
GithubCredentialType,
|
||||
} from './types';
|
||||
|
||||
@@ -231,9 +232,7 @@ export class GithubAppCredentialsMux {
|
||||
export class SingleInstanceGithubCredentialsProvider
|
||||
implements GithubCredentialsProvider
|
||||
{
|
||||
static create: (
|
||||
config: GitHubIntegrationConfig,
|
||||
) => GithubCredentialsProvider = config => {
|
||||
static create: GithubCredentialsProviderFactory = config => {
|
||||
return new SingleInstanceGithubCredentialsProvider(
|
||||
new GithubAppCredentialsMux(config),
|
||||
config.token,
|
||||
|
||||
@@ -27,6 +27,7 @@ export {
|
||||
export type {
|
||||
GithubCredentials,
|
||||
GithubCredentialsProvider,
|
||||
GithubCredentialsProviderFactory,
|
||||
GithubCredentialType,
|
||||
} from './types';
|
||||
export { GitHubIntegration, replaceGitHubUrlType } from './GitHubIntegration';
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { GitHubIntegrationConfig } from './config';
|
||||
|
||||
/**
|
||||
* The type of credentials produced by the credential provider.
|
||||
*
|
||||
@@ -41,3 +43,13 @@ export type GithubCredentials = {
|
||||
export interface GithubCredentialsProvider {
|
||||
getCredentials(opts: { url: string }): Promise<GithubCredentials>;
|
||||
}
|
||||
|
||||
/**
|
||||
* This allows implementations to be provided to create credentials providers.
|
||||
*
|
||||
* @public
|
||||
*
|
||||
*/
|
||||
export type GithubCredentialsProviderFactory = (
|
||||
config: GitHubIntegrationConfig,
|
||||
) => GithubCredentialsProvider;
|
||||
|
||||
Reference in New Issue
Block a user