Wrap Bitbucket types into separate namespace

Signed-off-by: Mathias Åhsberg <mathias.ahsberg@resurs.se>
This commit is contained in:
Mathias Åhsberg
2021-04-28 15:18:55 +00:00
parent b219821a01
commit d5b892d041
5 changed files with 21 additions and 20 deletions
@@ -22,7 +22,7 @@ import {
} from '@backstage/integration';
import { LocationSpec } from '@backstage/catalog-model';
import {
Repository,
Bitbucket,
BitbucketRepositoryParser,
BitbucketClient,
defaultRepositoryParser,
@@ -159,5 +159,5 @@ function escapeRegExp(str: string): RegExp {
type Result = {
scanned: number;
matches: Repository[];
matches: Bitbucket.Repository[];
};
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import { defaultRepositoryParser } from './BitbucketRepositoryParser';
import { Project, Repository } from './types';
import { Bitbucket } from './types';
import { BitbucketClient } from './client';
import { results } from '../index';
@@ -36,12 +36,12 @@ describe('BitbucketRepositoryParser', () => {
const actual = await defaultRepositoryParser({
client: {} as BitbucketClient,
repository: {
project: {} as Project,
project: {} as Bitbucket.Project,
slug: 'repo-slug',
links: {
self: [{ href: browseUrl }],
},
} as Repository,
} as Bitbucket.Repository,
path: path,
});
@@ -13,14 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Repository } from './types';
import { Bitbucket } from './types';
import { CatalogProcessorResult } from '../types';
import { results } from '../index';
import { BitbucketClient } from './client';
export type BitbucketRepositoryParser = (options: {
client: BitbucketClient;
repository: Repository;
repository: Bitbucket.Repository;
path: string;
}) => AsyncIterable<CatalogProcessorResult>;
@@ -13,16 +13,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export type Project = {
key: string;
};
export namespace Bitbucket {
export type Project = {
key: string;
};
export type Repository = {
project: Project;
slug: string;
links: Record<string, Link[]>;
};
export type Repository = {
project: Project;
slug: string;
links: Record<string, Link[]>;
};
export type Link = {
href: string;
};
export type Link = {
href: string;
};
}
@@ -36,6 +36,5 @@ export { UrlReaderProcessor } from './UrlReaderProcessor';
export { parseEntityYaml } from './util/parse';
export { results };
export * from './bitbucket/types';
export { BitbucketClient } from './bitbucket';
export type { BitbucketRepositoryParser } from './bitbucket';
export type { BitbucketRepositoryParser, Bitbucket } from './bitbucket';