@backstage/plugin-catalog-backend-module-github 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +75 -0
- package/dist/index.cjs.js +55 -5
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +66 -10
- package/package.json +11 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,80 @@
|
|
|
1
1
|
# @backstage/plugin-catalog-backend-module-github
|
|
2
2
|
|
|
3
|
+
## 0.1.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- a7de43f648: `GitHubOrgEntityProvider.fromConfig` now supports a `schedule` option like other
|
|
8
|
+
entity providers, that makes it more convenient to leverage using the common
|
|
9
|
+
task scheduler.
|
|
10
|
+
|
|
11
|
+
If you want to use this in your own project, it is used something like the following:
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
// In packages/backend/src/plugins/catalog.ts
|
|
15
|
+
builder.addEntityProvider(
|
|
16
|
+
GitHubOrgEntityProvider.fromConfig(env.config, {
|
|
17
|
+
id: 'production',
|
|
18
|
+
orgUrl: 'https://github.com/backstage',
|
|
19
|
+
schedule: env.scheduler.createScheduledTaskRunner({
|
|
20
|
+
frequency: { cron: '*/30 * * * *' },
|
|
21
|
+
timeout: { minutes: 10 },
|
|
22
|
+
}),
|
|
23
|
+
logger: env.logger,
|
|
24
|
+
}),
|
|
25
|
+
);
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
- Updated dependencies
|
|
29
|
+
- @backstage/backend-common@0.13.3
|
|
30
|
+
- @backstage/plugin-catalog-backend@1.1.2
|
|
31
|
+
- @backstage/backend-tasks@0.3.1
|
|
32
|
+
- @backstage/integration@1.2.0
|
|
33
|
+
- @backstage/config@1.0.1
|
|
34
|
+
- @backstage/catalog-model@1.0.2
|
|
35
|
+
|
|
36
|
+
## 0.1.3-next.1
|
|
37
|
+
|
|
38
|
+
### Patch Changes
|
|
39
|
+
|
|
40
|
+
- a7de43f648: `GitHubOrgEntityProvider.fromConfig` now supports a `schedule` option like other
|
|
41
|
+
entity providers, that makes it more convenient to leverage using the common
|
|
42
|
+
task scheduler.
|
|
43
|
+
|
|
44
|
+
If you want to use this in your own project, it is used something like the following:
|
|
45
|
+
|
|
46
|
+
```ts
|
|
47
|
+
// In packages/backend/src/plugins/catalog.ts
|
|
48
|
+
builder.addEntityProvider(
|
|
49
|
+
GitHubOrgEntityProvider.fromConfig(env.config, {
|
|
50
|
+
id: 'production',
|
|
51
|
+
orgUrl: 'https://github.com/backstage',
|
|
52
|
+
schedule: env.scheduler.createScheduledTaskRunner({
|
|
53
|
+
frequency: { cron: '*/30 * * * *' },
|
|
54
|
+
timeout: { minutes: 10 },
|
|
55
|
+
}),
|
|
56
|
+
logger: env.logger,
|
|
57
|
+
}),
|
|
58
|
+
);
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
- Updated dependencies
|
|
62
|
+
- @backstage/backend-common@0.13.3-next.2
|
|
63
|
+
- @backstage/plugin-catalog-backend@1.1.2-next.2
|
|
64
|
+
- @backstage/backend-tasks@0.3.1-next.1
|
|
65
|
+
- @backstage/config@1.0.1-next.0
|
|
66
|
+
- @backstage/catalog-model@1.0.2-next.0
|
|
67
|
+
- @backstage/integration@1.2.0-next.1
|
|
68
|
+
|
|
69
|
+
## 0.1.3-next.0
|
|
70
|
+
|
|
71
|
+
### Patch Changes
|
|
72
|
+
|
|
73
|
+
- Updated dependencies
|
|
74
|
+
- @backstage/backend-common@0.13.3-next.0
|
|
75
|
+
- @backstage/integration@1.2.0-next.0
|
|
76
|
+
- @backstage/plugin-catalog-backend@1.1.2-next.0
|
|
77
|
+
|
|
3
78
|
## 0.1.2
|
|
4
79
|
|
|
5
80
|
### Patch Changes
|
package/dist/index.cjs.js
CHANGED
|
@@ -7,6 +7,27 @@ var pluginCatalogBackend = require('@backstage/plugin-catalog-backend');
|
|
|
7
7
|
var graphql = require('@octokit/graphql');
|
|
8
8
|
var catalogModel = require('@backstage/catalog-model');
|
|
9
9
|
var lodash = require('lodash');
|
|
10
|
+
var uuid = require('uuid');
|
|
11
|
+
|
|
12
|
+
function _interopNamespace(e) {
|
|
13
|
+
if (e && e.__esModule) return e;
|
|
14
|
+
var n = Object.create(null);
|
|
15
|
+
if (e) {
|
|
16
|
+
Object.keys(e).forEach(function (k) {
|
|
17
|
+
if (k !== 'default') {
|
|
18
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
19
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () { return e[k]; }
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
n["default"] = e;
|
|
27
|
+
return Object.freeze(n);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
var uuid__namespace = /*#__PURE__*/_interopNamespace(uuid);
|
|
10
31
|
|
|
11
32
|
function readGithubMultiOrgConfig(config) {
|
|
12
33
|
var _a;
|
|
@@ -430,7 +451,7 @@ class GithubMultiOrgReaderProcessor {
|
|
|
430
451
|
class GitHubOrgEntityProvider {
|
|
431
452
|
constructor(options) {
|
|
432
453
|
this.options = options;
|
|
433
|
-
this.
|
|
454
|
+
this.credentialsProvider = options.githubCredentialsProvider || integration.SingleInstanceGithubCredentialsProvider.create(this.options.gitHubConfig);
|
|
434
455
|
}
|
|
435
456
|
static fromConfig(config, options) {
|
|
436
457
|
var _a;
|
|
@@ -442,26 +463,32 @@ class GitHubOrgEntityProvider {
|
|
|
442
463
|
const logger = options.logger.child({
|
|
443
464
|
target: options.orgUrl
|
|
444
465
|
});
|
|
445
|
-
|
|
466
|
+
const provider = new GitHubOrgEntityProvider({
|
|
446
467
|
id: options.id,
|
|
447
468
|
orgUrl: options.orgUrl,
|
|
448
469
|
logger,
|
|
449
470
|
gitHubConfig,
|
|
450
471
|
githubCredentialsProvider: options.githubCredentialsProvider || integration.DefaultGithubCredentialsProvider.fromIntegrations(integrations)
|
|
451
472
|
});
|
|
473
|
+
provider.schedule(options.schedule);
|
|
474
|
+
return provider;
|
|
452
475
|
}
|
|
453
476
|
getProviderName() {
|
|
454
477
|
return `GitHubOrgEntityProvider:${this.options.id}`;
|
|
455
478
|
}
|
|
456
479
|
async connect(connection) {
|
|
480
|
+
var _a;
|
|
457
481
|
this.connection = connection;
|
|
482
|
+
await ((_a = this.scheduleFn) == null ? void 0 : _a.call(this));
|
|
458
483
|
}
|
|
459
|
-
async read() {
|
|
484
|
+
async read(options) {
|
|
485
|
+
var _a;
|
|
460
486
|
if (!this.connection) {
|
|
461
487
|
throw new Error("Not initialized");
|
|
462
488
|
}
|
|
463
|
-
const
|
|
464
|
-
const {
|
|
489
|
+
const logger = (_a = options == null ? void 0 : options.logger) != null ? _a : this.options.logger;
|
|
490
|
+
const { markReadComplete } = trackProgress(logger);
|
|
491
|
+
const { headers, type: tokenType } = await this.credentialsProvider.getCredentials({
|
|
465
492
|
url: this.options.orgUrl
|
|
466
493
|
});
|
|
467
494
|
const client = graphql.graphql.defaults({
|
|
@@ -483,6 +510,29 @@ class GitHubOrgEntityProvider {
|
|
|
483
510
|
});
|
|
484
511
|
markCommitComplete();
|
|
485
512
|
}
|
|
513
|
+
schedule(schedule) {
|
|
514
|
+
if (!schedule || schedule === "manual") {
|
|
515
|
+
return;
|
|
516
|
+
}
|
|
517
|
+
this.scheduleFn = async () => {
|
|
518
|
+
const id = `${this.getProviderName()}:refresh`;
|
|
519
|
+
await schedule.run({
|
|
520
|
+
id,
|
|
521
|
+
fn: async () => {
|
|
522
|
+
const logger = this.options.logger.child({
|
|
523
|
+
class: GitHubOrgEntityProvider.prototype.constructor.name,
|
|
524
|
+
taskId: id,
|
|
525
|
+
taskInstanceId: uuid__namespace.v4()
|
|
526
|
+
});
|
|
527
|
+
try {
|
|
528
|
+
await this.read({ logger });
|
|
529
|
+
} catch (error) {
|
|
530
|
+
logger.error(error);
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
});
|
|
534
|
+
};
|
|
535
|
+
}
|
|
486
536
|
}
|
|
487
537
|
function trackProgress(logger) {
|
|
488
538
|
let timestamp = Date.now();
|
package/dist/index.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":["../src/lib/config.ts","../src/lib/github.ts","../src/lib/org.ts","../src/lib/util.ts","../src/GithubDiscoveryProcessor.ts","../src/GithubMultiOrgReaderProcessor.ts","../src/GitHubOrgEntityProvider.ts","../src/GithubOrgReaderProcessor.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Config } from '@backstage/config';\n\n/**\n * The configuration parameters for a multi-org GitHub processor.\n * @public\n */\nexport type GithubMultiOrgConfig = Array<{\n /**\n * The name of the GitHub org to process.\n */\n name: string;\n /**\n * The namespace of the group created for this org.\n */\n groupNamespace: string;\n /**\n * The namespace of the users created for this org. If not specified defaults to undefined.\n */\n userNamespace: string | undefined;\n}>;\n\nexport function readGithubMultiOrgConfig(config: Config): GithubMultiOrgConfig {\n const orgConfigs = config.getOptionalConfigArray('orgs') ?? [];\n return orgConfigs.map(c => ({\n name: c.getString('name'),\n groupNamespace: (\n c.getOptionalString('groupNamespace') ?? c.getString('name')\n ).toLowerCase(),\n userNamespace: c.getOptionalString('userNamespace') ?? undefined,\n }));\n}\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { GroupEntity, UserEntity } from '@backstage/catalog-model';\nimport { GithubCredentialType } from '@backstage/integration';\nimport { graphql } from '@octokit/graphql';\n\n// Graphql types\n\nexport type QueryResponse = {\n organization?: Organization;\n repositoryOwner?: Organization | User;\n};\n\nexport type Organization = {\n membersWithRole?: Connection<User>;\n team?: Team;\n teams?: Connection<Team>;\n repositories?: Connection<Repository>;\n};\n\nexport type PageInfo = {\n hasNextPage: boolean;\n endCursor?: string;\n};\n\nexport type User = {\n login: string;\n bio?: string;\n avatarUrl?: string;\n email?: string;\n name?: string;\n repositories?: Connection<Repository>;\n};\n\nexport type Team = {\n slug: string;\n combinedSlug: string;\n name?: string;\n description?: string;\n avatarUrl?: string;\n parentTeam?: Team;\n members: Connection<User>;\n};\n\nexport type Repository = {\n name: string;\n url: string;\n isArchived: boolean;\n defaultBranchRef: {\n name: string;\n } | null;\n};\n\nexport type Connection<T> = {\n pageInfo: PageInfo;\n nodes: T[];\n};\n\n/**\n * Gets all the users out of a GitHub organization.\n *\n * Note that the users will not have their memberships filled in.\n *\n * @param client - An octokit graphql client\n * @param org - The slug of the org to read\n */\nexport async function getOrganizationUsers(\n client: typeof graphql,\n org: string,\n tokenType: GithubCredentialType,\n userNamespace?: string,\n): Promise<{ users: UserEntity[] }> {\n const query = `\n query users($org: String!, $email: Boolean!, $cursor: String) {\n organization(login: $org) {\n membersWithRole(first: 100, after: $cursor) {\n pageInfo { hasNextPage, endCursor }\n nodes {\n avatarUrl,\n bio,\n email @include(if: $email),\n login,\n name\n }\n }\n }\n }`;\n\n // There is no user -> teams edge, so we leave the memberships empty for\n // now and let the team iteration handle it instead\n const mapper = (user: User) => {\n const entity: UserEntity = {\n apiVersion: 'backstage.io/v1alpha1',\n kind: 'User',\n metadata: {\n name: user.login,\n annotations: {\n 'github.com/user-login': user.login,\n },\n },\n spec: {\n profile: {},\n memberOf: [],\n },\n };\n\n if (userNamespace) entity.metadata.namespace = userNamespace;\n if (user.bio) entity.metadata.description = user.bio;\n if (user.name) entity.spec.profile!.displayName = user.name;\n if (user.email) entity.spec.profile!.email = user.email;\n if (user.avatarUrl) entity.spec.profile!.picture = user.avatarUrl;\n\n return entity;\n };\n\n const users = await queryWithPaging(\n client,\n query,\n r => r.organization?.membersWithRole,\n mapper,\n { org, email: tokenType === 'token' },\n );\n\n return { users };\n}\n\n/**\n * Gets all the teams out of a GitHub organization.\n *\n * Note that the teams will not have any relations apart from parent filled in.\n *\n * @param client - An octokit graphql client\n * @param org - The slug of the org to read\n */\nexport async function getOrganizationTeams(\n client: typeof graphql,\n org: string,\n orgNamespace?: string,\n): Promise<{\n groups: GroupEntity[];\n groupMemberUsers: Map<string, string[]>;\n}> {\n const query = `\n query teams($org: String!, $cursor: String) {\n organization(login: $org) {\n teams(first: 100, after: $cursor) {\n pageInfo { hasNextPage, endCursor }\n nodes {\n slug\n combinedSlug\n name\n description\n avatarUrl\n parentTeam { slug }\n members(first: 100, membership: IMMEDIATE) {\n pageInfo { hasNextPage }\n nodes { login }\n }\n }\n }\n }\n }`;\n\n // Gets populated inside the mapper below\n const groupMemberUsers = new Map<string, string[]>();\n\n const mapper = async (team: Team) => {\n const entity: GroupEntity = {\n apiVersion: 'backstage.io/v1alpha1',\n kind: 'Group',\n metadata: {\n name: team.slug,\n annotations: {\n 'github.com/team-slug': team.combinedSlug,\n },\n },\n spec: {\n type: 'team',\n profile: {},\n children: [],\n },\n };\n\n if (orgNamespace) {\n entity.metadata.namespace = orgNamespace;\n }\n\n if (team.description) {\n entity.metadata.description = team.description;\n }\n if (team.name) {\n entity.spec.profile!.displayName = team.name;\n }\n if (team.avatarUrl) {\n entity.spec.profile!.picture = team.avatarUrl;\n }\n if (team.parentTeam) {\n entity.spec.parent = team.parentTeam.slug;\n }\n\n const memberNames: string[] = [];\n const groupKey = orgNamespace ? `${orgNamespace}/${team.slug}` : team.slug;\n groupMemberUsers.set(groupKey, memberNames);\n\n if (!team.members.pageInfo.hasNextPage) {\n // We got all the members in one go, run the fast path\n for (const user of team.members.nodes) {\n memberNames.push(user.login);\n }\n } else {\n // There were more than a hundred immediate members - run the slow\n // path of fetching them explicitly\n const { members } = await getTeamMembers(client, org, team.slug);\n for (const userLogin of members) {\n memberNames.push(userLogin);\n }\n }\n\n return entity;\n };\n\n const groups = await queryWithPaging(\n client,\n query,\n r => r.organization?.teams,\n mapper,\n { org },\n );\n\n return { groups, groupMemberUsers };\n}\n\nexport async function getOrganizationRepositories(\n client: typeof graphql,\n org: string,\n): Promise<{ repositories: Repository[] }> {\n const query = `\n query repositories($org: String!, $cursor: String) {\n repositoryOwner(login: $org) {\n login\n repositories(first: 100, after: $cursor) {\n nodes {\n name\n url\n isArchived\n defaultBranchRef {\n name\n }\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n }\n }`;\n\n const repositories = await queryWithPaging(\n client,\n query,\n r => r.repositoryOwner?.repositories,\n x => x,\n { org },\n );\n\n return { repositories };\n}\n\n/**\n * Gets all the users out of a GitHub organization.\n *\n * Note that the users will not have their memberships filled in.\n *\n * @param client - An octokit graphql client\n * @param org - The slug of the org to read\n * @param teamSlug - The slug of the team to read\n */\nexport async function getTeamMembers(\n client: typeof graphql,\n org: string,\n teamSlug: string,\n): Promise<{ members: string[] }> {\n const query = `\n query members($org: String!, $teamSlug: String!, $cursor: String) {\n organization(login: $org) {\n team(slug: $teamSlug) {\n members(first: 100, after: $cursor, membership: IMMEDIATE) {\n pageInfo { hasNextPage, endCursor }\n nodes { login }\n }\n }\n }\n }`;\n\n const members = await queryWithPaging(\n client,\n query,\n r => r.organization?.team?.members,\n user => user.login,\n { org, teamSlug },\n );\n\n return { members };\n}\n\n//\n// Helpers\n//\n\n/**\n * Assists in repeatedly executing a query with a paged response.\n *\n * Requires that the query accepts a $cursor variable.\n *\n * @param client - The octokit client\n * @param query - The query to execute\n * @param connection - A function that, given the response, picks out the actual\n * Connection object that's being iterated\n * @param mapper - A function that, given one of the nodes in the Connection,\n * returns the model mapped form of it\n * @param variables - The variable values that the query needs, minus the cursor\n */\nexport async function queryWithPaging<\n GraphqlType,\n OutputType,\n Variables extends {},\n Response = QueryResponse,\n>(\n client: typeof graphql,\n query: string,\n connection: (response: Response) => Connection<GraphqlType> | undefined,\n mapper: (item: GraphqlType) => Promise<OutputType> | OutputType,\n variables: Variables,\n): Promise<OutputType[]> {\n const result: OutputType[] = [];\n\n let cursor: string | undefined = undefined;\n for (let j = 0; j < 1000 /* just for sanity */; ++j) {\n const response: Response = await client(query, {\n ...variables,\n cursor,\n });\n\n const conn = connection(response);\n if (!conn) {\n throw new Error(`Found no match for ${JSON.stringify(variables)}`);\n }\n\n for (const node of conn.nodes) {\n result.push(await mapper(node));\n }\n\n if (!conn.pageInfo.hasNextPage) {\n break;\n } else {\n cursor = conn.pageInfo.endCursor;\n }\n }\n\n return result;\n}\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { GroupEntity, UserEntity } from '@backstage/catalog-model';\n\nexport function buildOrgHierarchy(groups: GroupEntity[]) {\n const groupsByName = new Map(groups.map(g => [g.metadata.name, g]));\n\n //\n // Make sure that g.parent.children contain g\n //\n\n for (const group of groups) {\n const selfName = group.metadata.name;\n const parentName = group.spec.parent;\n if (parentName) {\n const parent = groupsByName.get(parentName);\n if (parent && !parent.spec.children.includes(selfName)) {\n parent.spec.children.push(selfName);\n }\n }\n }\n\n //\n // Make sure that g.children.parent is g\n //\n\n for (const group of groups) {\n const selfName = group.metadata.name;\n for (const childName of group.spec.children) {\n const child = groupsByName.get(childName);\n if (child && !child.spec.parent) {\n child.spec.parent = selfName;\n }\n }\n }\n}\n\n// Ensure that users have their direct group memberships.\nexport function assignGroupsToUsers(\n users: UserEntity[],\n groupMemberUsers: Map<string, string[]>,\n) {\n const usersByName = new Map(users.map(u => [u.metadata.name, u]));\n for (const [groupName, userNames] of groupMemberUsers.entries()) {\n for (const userName of userNames) {\n const user = usersByName.get(userName);\n if (user && !user.spec.memberOf?.includes(groupName)) {\n if (!user.spec.memberOf) {\n user.spec.memberOf = [];\n }\n user.spec.memberOf.push(groupName);\n }\n }\n }\n}\n\n// Ensure that users have their transitive group memberships. Requires that\n// the groups were previously processed with buildOrgHierarchy()\nexport function buildMemberOf(groups: GroupEntity[], users: UserEntity[]) {\n const groupsByName = new Map(groups.map(g => [g.metadata.name, g]));\n\n users.forEach(user => {\n const transitiveMemberOf = new Set<string>();\n\n const todo = [\n ...(user.spec.memberOf ?? []),\n ...groups\n .filter(g => g.spec.members?.includes(user.metadata.name))\n .map(g => g.metadata.name),\n ];\n\n for (;;) {\n const current = todo.pop();\n if (!current) {\n break;\n }\n\n if (!transitiveMemberOf.has(current)) {\n transitiveMemberOf.add(current);\n const group = groupsByName.get(current);\n if (group?.spec.parent) {\n todo.push(group.spec.parent);\n }\n }\n }\n\n user.spec.memberOf = [...transitiveMemberOf];\n });\n}\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport function parseGitHubOrgUrl(urlString: string): { org: string } {\n const path = new URL(urlString).pathname.substr(1).split('/');\n\n // /backstage\n if (path.length === 1 && path[0].length) {\n return { org: decodeURIComponent(path[0]) };\n }\n\n throw new Error(`Expected a URL pointing to /<org>`);\n}\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Config } from '@backstage/config';\nimport {\n DefaultGithubCredentialsProvider,\n GithubCredentialsProvider,\n ScmIntegrationRegistry,\n ScmIntegrations,\n} from '@backstage/integration';\nimport {\n CatalogProcessor,\n CatalogProcessorEmit,\n LocationSpec,\n processingResult,\n} from '@backstage/plugin-catalog-backend';\nimport { graphql } from '@octokit/graphql';\nimport { Logger } from 'winston';\nimport { getOrganizationRepositories } from './lib';\n\n/**\n * Extracts repositories out of a GitHub org.\n *\n * The following will create locations for all projects which have a catalog-info.yaml\n * on the default branch. The first is shorthand for the second.\n *\n * target: \"https://github.com/backstage\"\n * or\n * target: https://github.com/backstage/*\\/blob/-/catalog-info.yaml\n *\n * You may also explicitly specify the source branch:\n *\n * target: https://github.com/backstage/*\\/blob/main/catalog-info.yaml\n *\n * @public\n **/\nexport class GithubDiscoveryProcessor implements CatalogProcessor {\n private readonly integrations: ScmIntegrationRegistry;\n private readonly logger: Logger;\n private readonly githubCredentialsProvider: GithubCredentialsProvider;\n\n static fromConfig(\n config: Config,\n options: {\n logger: Logger;\n githubCredentialsProvider?: GithubCredentialsProvider;\n },\n ) {\n const integrations = ScmIntegrations.fromConfig(config);\n\n return new GithubDiscoveryProcessor({\n ...options,\n integrations,\n });\n }\n\n constructor(options: {\n integrations: ScmIntegrationRegistry;\n logger: Logger;\n githubCredentialsProvider?: GithubCredentialsProvider;\n }) {\n this.integrations = options.integrations;\n this.logger = options.logger;\n this.githubCredentialsProvider =\n options.githubCredentialsProvider ||\n DefaultGithubCredentialsProvider.fromIntegrations(this.integrations);\n }\n getProcessorName(): string {\n return 'GithubDiscoveryProcessor';\n }\n\n async readLocation(\n location: LocationSpec,\n _optional: boolean,\n emit: CatalogProcessorEmit,\n ): Promise<boolean> {\n if (location.type !== 'github-discovery') {\n return false;\n }\n\n const gitHubConfig = this.integrations.github.byUrl(\n location.target,\n )?.config;\n if (!gitHubConfig) {\n throw new Error(\n `There is no GitHub integration that matches ${location.target}. Please add a configuration entry for it under integrations.github`,\n );\n }\n\n const { org, repoSearchPath, catalogPath, branch, host } = parseUrl(\n location.target,\n );\n\n // Building the org url here so that the github creds provider doesn't need to know\n // about how to handle the wild card which is special for this processor.\n const orgUrl = `https://${host}/${org}`;\n\n const { headers } = await this.githubCredentialsProvider.getCredentials({\n url: orgUrl,\n });\n\n const client = graphql.defaults({\n baseUrl: gitHubConfig.apiBaseUrl,\n headers,\n });\n\n // Read out all of the raw data\n const startTimestamp = Date.now();\n this.logger.info(`Reading GitHub repositories from ${location.target}`);\n\n const { repositories } = await getOrganizationRepositories(client, org);\n const matching = repositories.filter(\n r => !r.isArchived && repoSearchPath.test(r.name),\n );\n\n const duration = ((Date.now() - startTimestamp) / 1000).toFixed(1);\n this.logger.debug(\n `Read ${repositories.length} GitHub repositories (${matching.length} matching the pattern) in ${duration} seconds`,\n );\n\n for (const repository of matching) {\n const branchName =\n branch === '-' ? repository.defaultBranchRef?.name : branch;\n\n if (!branchName) {\n this.logger.info(\n `the repository ${repository.url} does not have a default branch, skipping`,\n );\n continue;\n }\n\n const path = `/blob/${branchName}${catalogPath}`;\n\n emit(\n processingResult.location({\n type: 'url',\n target: `${repository.url}${path}`,\n // Not all locations may actually exist, since the user defined them as a wildcard pattern.\n // Thus, we emit them as optional and let the downstream processor find them while not outputting\n // an error if it couldn't.\n presence: 'optional',\n }),\n );\n }\n\n return true;\n }\n}\n\n/*\n * Helpers\n */\n\nexport function parseUrl(urlString: string): {\n org: string;\n repoSearchPath: RegExp;\n catalogPath: string;\n branch: string;\n host: string;\n} {\n const url = new URL(urlString);\n const path = url.pathname.substr(1).split('/');\n\n // /backstage/techdocs-*/blob/master/catalog-info.yaml\n // can also be\n // /backstage\n if (path.length > 2 && path[0].length && path[1].length) {\n return {\n org: decodeURIComponent(path[0]),\n repoSearchPath: escapeRegExp(decodeURIComponent(path[1])),\n branch: decodeURIComponent(path[3]),\n catalogPath: `/${decodeURIComponent(path.slice(4).join('/'))}`,\n host: url.host,\n };\n } else if (path.length === 1 && path[0].length) {\n return {\n org: decodeURIComponent(path[0]),\n host: url.host,\n repoSearchPath: escapeRegExp('*'),\n catalogPath: '/catalog-info.yaml',\n branch: '-',\n };\n }\n\n throw new Error(`Failed to parse ${urlString}`);\n}\n\nexport function escapeRegExp(str: string): RegExp {\n return new RegExp(`^${str.replace(/\\*/g, '.*')}$`);\n}\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Config } from '@backstage/config';\nimport {\n DefaultGithubCredentialsProvider,\n GithubAppCredentialsMux,\n GithubCredentialsProvider,\n GitHubIntegrationConfig,\n ScmIntegrationRegistry,\n ScmIntegrations,\n} from '@backstage/integration';\nimport {\n CatalogProcessor,\n CatalogProcessorEmit,\n LocationSpec,\n processingResult,\n} from '@backstage/plugin-catalog-backend';\nimport { graphql } from '@octokit/graphql';\nimport { Logger } from 'winston';\nimport {\n buildOrgHierarchy,\n getOrganizationTeams,\n getOrganizationUsers,\n GithubMultiOrgConfig,\n readGithubMultiOrgConfig,\n} from './lib';\n\n/**\n * Extracts teams and users out of a multiple GitHub orgs namespaced per org.\n *\n * Be aware that this processor may not be compatible with future org structures in the catalog.\n *\n * @public\n */\nexport class GithubMultiOrgReaderProcessor implements CatalogProcessor {\n private readonly integrations: ScmIntegrationRegistry;\n private readonly orgs: GithubMultiOrgConfig;\n private readonly logger: Logger;\n private readonly githubCredentialsProvider: GithubCredentialsProvider;\n\n static fromConfig(\n config: Config,\n options: {\n logger: Logger;\n githubCredentialsProvider?: GithubCredentialsProvider;\n },\n ) {\n const c = config.getOptionalConfig('catalog.processors.githubMultiOrg');\n const integrations = ScmIntegrations.fromConfig(config);\n\n return new GithubMultiOrgReaderProcessor({\n ...options,\n integrations,\n orgs: c ? readGithubMultiOrgConfig(c) : [],\n });\n }\n\n constructor(options: {\n integrations: ScmIntegrationRegistry;\n logger: Logger;\n orgs: GithubMultiOrgConfig;\n githubCredentialsProvider?: GithubCredentialsProvider;\n }) {\n this.integrations = options.integrations;\n this.logger = options.logger;\n this.orgs = options.orgs;\n this.githubCredentialsProvider =\n options.githubCredentialsProvider ||\n DefaultGithubCredentialsProvider.fromIntegrations(this.integrations);\n }\n getProcessorName(): string {\n return 'GithubMultiOrgReaderProcessor';\n }\n\n async readLocation(\n location: LocationSpec,\n _optional: boolean,\n emit: CatalogProcessorEmit,\n ): Promise<boolean> {\n if (location.type !== 'github-multi-org') {\n return false;\n }\n\n const gitHubConfig = this.integrations.github.byUrl(\n location.target,\n )?.config;\n if (!gitHubConfig) {\n throw new Error(\n `There is no GitHub integration that matches ${location.target}. Please add a configuration entry for it under integrations.github`,\n );\n }\n\n const allUsersMap = new Map();\n const baseUrl = new URL(location.target).origin;\n\n const orgsToProcess = this.orgs.length\n ? this.orgs\n : await this.getAllOrgs(gitHubConfig);\n\n for (const orgConfig of orgsToProcess) {\n try {\n const { headers, type: tokenType } =\n await this.githubCredentialsProvider.getCredentials({\n url: `${baseUrl}/${orgConfig.name}`,\n });\n const client = graphql.defaults({\n baseUrl: gitHubConfig.apiBaseUrl,\n headers,\n });\n\n const startTimestamp = Date.now();\n this.logger.info(\n `Reading GitHub users and teams for org: ${orgConfig.name}`,\n );\n const { users } = await getOrganizationUsers(\n client,\n orgConfig.name,\n tokenType,\n orgConfig.userNamespace,\n );\n const { groups, groupMemberUsers } = await getOrganizationTeams(\n client,\n orgConfig.name,\n orgConfig.groupNamespace,\n );\n\n const duration = ((Date.now() - startTimestamp) / 1000).toFixed(1);\n this.logger.debug(\n `Read ${users.length} GitHub users and ${groups.length} GitHub teams from ${orgConfig.name} in ${duration} seconds`,\n );\n\n let prefix: string = orgConfig.userNamespace ?? '';\n if (prefix.length > 0) prefix += '/';\n\n users.forEach(u => {\n if (!allUsersMap.has(prefix + u.metadata.name)) {\n allUsersMap.set(prefix + u.metadata.name, u);\n }\n });\n\n for (const [groupName, userNames] of groupMemberUsers.entries()) {\n for (const userName of userNames) {\n const user = allUsersMap.get(prefix + userName);\n if (user && !user.spec.memberOf.includes(groupName)) {\n user.spec.memberOf.push(groupName);\n }\n }\n }\n buildOrgHierarchy(groups);\n\n for (const group of groups) {\n emit(processingResult.entity(location, group));\n }\n } catch (e) {\n this.logger.error(\n `Failed to read GitHub org data for ${orgConfig.name}: ${e}`,\n );\n }\n }\n\n const allUsers = Array.from(allUsersMap.values());\n for (const user of allUsers) {\n emit(processingResult.entity(location, user));\n }\n\n return true;\n }\n\n // Note: Does not support usage of PATs\n private async getAllOrgs(\n gitHubConfig: GitHubIntegrationConfig,\n ): Promise<GithubMultiOrgConfig> {\n const githubAppMux = new GithubAppCredentialsMux(gitHubConfig);\n const installs = await githubAppMux.getAllInstallations();\n\n return installs\n .map(install =>\n install.target_type === 'Organization' &&\n install.account &&\n install.account.login\n ? {\n name: install.account.login,\n groupNamespace: install.account.login.toLowerCase(),\n }\n : undefined,\n )\n .filter(Boolean) as GithubMultiOrgConfig;\n }\n}\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n ANNOTATION_LOCATION,\n ANNOTATION_ORIGIN_LOCATION,\n Entity,\n} from '@backstage/catalog-model';\nimport { Config } from '@backstage/config';\nimport {\n DefaultGithubCredentialsProvider,\n GithubCredentialsProvider,\n GitHubIntegrationConfig,\n ScmIntegrations,\n SingleInstanceGithubCredentialsProvider,\n} from '@backstage/integration';\nimport {\n EntityProvider,\n EntityProviderConnection,\n} from '@backstage/plugin-catalog-backend';\nimport { graphql } from '@octokit/graphql';\nimport { merge } from 'lodash';\nimport { Logger } from 'winston';\nimport {\n assignGroupsToUsers,\n buildOrgHierarchy,\n getOrganizationTeams,\n getOrganizationUsers,\n parseGitHubOrgUrl,\n} from './lib';\n\n// TODO: Consider supporting an (optional) webhook that reacts on org changes\n/** @public */\nexport class GitHubOrgEntityProvider implements EntityProvider {\n private connection?: EntityProviderConnection;\n private githubCredentialsProvider: GithubCredentialsProvider;\n\n static fromConfig(\n config: Config,\n options: {\n id: string;\n orgUrl: string;\n logger: Logger;\n githubCredentialsProvider?: GithubCredentialsProvider;\n },\n ) {\n const integrations = ScmIntegrations.fromConfig(config);\n const gitHubConfig = integrations.github.byUrl(options.orgUrl)?.config;\n\n if (!gitHubConfig) {\n throw new Error(\n `There is no GitHub Org provider that matches ${options.orgUrl}. Please add a configuration for an integration.`,\n );\n }\n\n const logger = options.logger.child({\n target: options.orgUrl,\n });\n\n return new GitHubOrgEntityProvider({\n id: options.id,\n orgUrl: options.orgUrl,\n logger,\n gitHubConfig,\n githubCredentialsProvider:\n options.githubCredentialsProvider ||\n DefaultGithubCredentialsProvider.fromIntegrations(integrations),\n });\n }\n\n constructor(\n private options: {\n id: string;\n orgUrl: string;\n gitHubConfig: GitHubIntegrationConfig;\n logger: Logger;\n githubCredentialsProvider?: GithubCredentialsProvider;\n },\n ) {\n this.githubCredentialsProvider =\n options.githubCredentialsProvider ||\n SingleInstanceGithubCredentialsProvider.create(options.gitHubConfig);\n }\n\n getProviderName() {\n return `GitHubOrgEntityProvider:${this.options.id}`;\n }\n\n async connect(connection: EntityProviderConnection) {\n this.connection = connection;\n }\n\n async read() {\n if (!this.connection) {\n throw new Error('Not initialized');\n }\n\n const { markReadComplete } = trackProgress(this.options.logger);\n\n const { headers, type: tokenType } =\n await this.githubCredentialsProvider.getCredentials({\n url: this.options.orgUrl,\n });\n const client = graphql.defaults({\n baseUrl: this.options.gitHubConfig.apiBaseUrl,\n headers,\n });\n\n const { org } = parseGitHubOrgUrl(this.options.orgUrl);\n const { users } = await getOrganizationUsers(client, org, tokenType);\n const { groups, groupMemberUsers } = await getOrganizationTeams(\n client,\n org,\n );\n assignGroupsToUsers(users, groupMemberUsers);\n buildOrgHierarchy(groups);\n\n const { markCommitComplete } = markReadComplete({ users, groups });\n\n await this.connection.applyMutation({\n type: 'full',\n entities: [...users, ...groups].map(entity => ({\n locationKey: `github-org-provider:${this.options.id}`,\n entity: withLocations(\n `https://${this.options.gitHubConfig.host}`,\n org,\n entity,\n ),\n })),\n });\n\n markCommitComplete();\n }\n}\n\n// Helps wrap the timing and logging behaviors\nfunction trackProgress(logger: Logger) {\n let timestamp = Date.now();\n let summary: string;\n\n logger.info('Reading GitHub users and groups');\n\n function markReadComplete(read: { users: unknown[]; groups: unknown[] }) {\n summary = `${read.users.length} GitHub users and ${read.groups.length} GitHub groups`;\n const readDuration = ((Date.now() - timestamp) / 1000).toFixed(1);\n timestamp = Date.now();\n logger.info(`Read ${summary} in ${readDuration} seconds. Committing...`);\n return { markCommitComplete };\n }\n\n function markCommitComplete() {\n const commitDuration = ((Date.now() - timestamp) / 1000).toFixed(1);\n logger.info(`Committed ${summary} in ${commitDuration} seconds.`);\n }\n\n return { markReadComplete };\n}\n\n// Makes sure that emitted entities have a proper location\nexport function withLocations(\n baseUrl: string,\n org: string,\n entity: Entity,\n): Entity {\n const location =\n entity.kind === 'Group'\n ? `url:${baseUrl}/orgs/${org}/teams/${entity.metadata.name}`\n : `url:${baseUrl}/${entity.metadata.name}`;\n return merge(\n {\n metadata: {\n annotations: {\n [ANNOTATION_LOCATION]: location,\n [ANNOTATION_ORIGIN_LOCATION]: location,\n },\n },\n },\n entity,\n ) as Entity;\n}\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Config } from '@backstage/config';\nimport {\n DefaultGithubCredentialsProvider,\n GithubCredentialsProvider,\n GithubCredentialType,\n ScmIntegrationRegistry,\n ScmIntegrations,\n} from '@backstage/integration';\nimport {\n CatalogProcessor,\n CatalogProcessorEmit,\n LocationSpec,\n processingResult,\n} from '@backstage/plugin-catalog-backend';\nimport { graphql } from '@octokit/graphql';\nimport { Logger } from 'winston';\nimport {\n assignGroupsToUsers,\n buildOrgHierarchy,\n getOrganizationTeams,\n getOrganizationUsers,\n parseGitHubOrgUrl,\n} from './lib';\n\ntype GraphQL = typeof graphql;\n\n/**\n * Extracts teams and users out of a GitHub org.\n * @public\n */\nexport class GithubOrgReaderProcessor implements CatalogProcessor {\n private readonly integrations: ScmIntegrationRegistry;\n private readonly logger: Logger;\n private readonly githubCredentialsProvider: GithubCredentialsProvider;\n\n static fromConfig(\n config: Config,\n options: {\n logger: Logger;\n githubCredentialsProvider?: GithubCredentialsProvider;\n },\n ) {\n const integrations = ScmIntegrations.fromConfig(config);\n\n return new GithubOrgReaderProcessor({\n ...options,\n integrations,\n });\n }\n\n constructor(options: {\n integrations: ScmIntegrationRegistry;\n logger: Logger;\n githubCredentialsProvider?: GithubCredentialsProvider;\n }) {\n this.integrations = options.integrations;\n this.githubCredentialsProvider =\n options.githubCredentialsProvider ||\n DefaultGithubCredentialsProvider.fromIntegrations(this.integrations);\n this.logger = options.logger;\n }\n getProcessorName(): string {\n return 'GithubOrgReaderProcessor';\n }\n\n async readLocation(\n location: LocationSpec,\n _optional: boolean,\n emit: CatalogProcessorEmit,\n ): Promise<boolean> {\n if (location.type !== 'github-org') {\n return false;\n }\n\n const { client, tokenType } = await this.createClient(location.target);\n const { org } = parseGitHubOrgUrl(location.target);\n\n // Read out all of the raw data\n const startTimestamp = Date.now();\n this.logger.info('Reading GitHub users and groups');\n\n const { users } = await getOrganizationUsers(client, org, tokenType);\n const { groups, groupMemberUsers } = await getOrganizationTeams(\n client,\n org,\n );\n\n const duration = ((Date.now() - startTimestamp) / 1000).toFixed(1);\n this.logger.debug(\n `Read ${users.length} GitHub users and ${groups.length} GitHub groups in ${duration} seconds`,\n );\n\n assignGroupsToUsers(users, groupMemberUsers);\n buildOrgHierarchy(groups);\n\n // Done!\n for (const group of groups) {\n emit(processingResult.entity(location, group));\n }\n for (const user of users) {\n emit(processingResult.entity(location, user));\n }\n\n return true;\n }\n\n private async createClient(\n orgUrl: string,\n ): Promise<{ client: GraphQL; tokenType: GithubCredentialType }> {\n const gitHubConfig = this.integrations.github.byUrl(orgUrl)?.config;\n\n if (!gitHubConfig) {\n throw new Error(\n `There is no GitHub Org provider that matches ${orgUrl}. Please add a configuration for an integration.`,\n );\n }\n\n const { headers, type: tokenType } =\n await this.githubCredentialsProvider.getCredentials({\n url: orgUrl,\n });\n\n const client = graphql.defaults({\n baseUrl: gitHubConfig.apiBaseUrl,\n headers,\n });\n\n return { client, tokenType };\n }\n}\n"],"names":["ScmIntegrations","DefaultGithubCredentialsProvider","graphql","processingResult","GithubAppCredentialsMux","SingleInstanceGithubCredentialsProvider","merge","ANNOTATION_LOCATION","ANNOTATION_ORIGIN_LOCATION"],"mappings":";;;;;;;;;;AAAO,SAAS,wBAAwB,CAAC,MAAM,EAAE;AACjD,EAAE,IAAI,EAAE,CAAC;AACT,EAAE,MAAM,UAAU,GAAG,CAAC,EAAE,GAAG,MAAM,CAAC,sBAAsB,CAAC,MAAM,CAAC,KAAK,IAAI,GAAG,EAAE,GAAG,EAAE,CAAC;AACpF,EAAE,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK;AAC/B,IAAI,IAAI,GAAG,EAAE,EAAE,CAAC;AAChB,IAAI,OAAO;AACX,MAAM,IAAI,EAAE,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC;AAC/B,MAAM,cAAc,EAAE,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,KAAK,IAAI,GAAG,GAAG,GAAG,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE;AACvH,MAAM,aAAa,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC,iBAAiB,CAAC,eAAe,CAAC,KAAK,IAAI,GAAG,EAAE,GAAG,KAAK,CAAC;AACtF,KAAK,CAAC;AACN,GAAG,CAAC,CAAC;AACL;;ACXO,eAAe,oBAAoB,CAAC,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,aAAa,EAAE;AAClF,EAAE,MAAM,KAAK,GAAG,CAAC;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC,CAAC;AACP,EAAE,MAAM,MAAM,GAAG,CAAC,IAAI,KAAK;AAC3B,IAAI,MAAM,MAAM,GAAG;AACnB,MAAM,UAAU,EAAE,uBAAuB;AACzC,MAAM,IAAI,EAAE,MAAM;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M,KAAK,IAAI,MAAM,EAAE;AAChC,MAAM,IAAI,CAACE,qCAAgB,CAAC,MAAM,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;AACrD,KAAK;AACL,IAAI,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;AAC9B,MAAM,IAAI,CAACA,qCAAgB,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC;AACpD,KAAK;AACL,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,MAAM,YAAY,CAAC,MAAM,EAAE;AAC7B,IAAI,IAAI,EAAE,CAAC;AACX,IAAI,MAAM,YAAY,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC;AACpG,IAAI,IAAI,CAAC,YAAY,EAAE;AACvB,MAAM,MAAM,IAAI,KAAK,CAAC,CAAC,6CAA6C,EAAE,MAAM,CAAC,gDAAgD,CAAC,CAAC,CAAC;AAChI,KAAK;AACL,IAAI,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,MAAM,IAAI,CAAC,yBAAyB,CAAC,cAAc,CAAC;AAC7F,MAAM,GAAG,EAAE,MAAM;AACjB,KAAK,CAAC,CAAC;AACP,IAAI,MAAM,MAAM,GAAGD,eAAO,CAAC,QAAQ,CAAC;AACpC,MAAM,OAAO,EAAE,YAAY,CAAC,UAAU;AACtC,MAAM,OAAO;AACb,KAAK,CAAC,CAAC;AACP,IAAI,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;AACjC,GAAG;AACH;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../src/lib/config.ts","../src/lib/github.ts","../src/lib/org.ts","../src/lib/util.ts","../src/GithubDiscoveryProcessor.ts","../src/GithubMultiOrgReaderProcessor.ts","../src/GitHubOrgEntityProvider.ts","../src/GithubOrgReaderProcessor.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Config } from '@backstage/config';\n\n/**\n * The configuration parameters for a multi-org GitHub processor.\n * @public\n */\nexport type GithubMultiOrgConfig = Array<{\n /**\n * The name of the GitHub org to process.\n */\n name: string;\n /**\n * The namespace of the group created for this org.\n */\n groupNamespace: string;\n /**\n * The namespace of the users created for this org. If not specified defaults to undefined.\n */\n userNamespace: string | undefined;\n}>;\n\nexport function readGithubMultiOrgConfig(config: Config): GithubMultiOrgConfig {\n const orgConfigs = config.getOptionalConfigArray('orgs') ?? [];\n return orgConfigs.map(c => ({\n name: c.getString('name'),\n groupNamespace: (\n c.getOptionalString('groupNamespace') ?? c.getString('name')\n ).toLowerCase(),\n userNamespace: c.getOptionalString('userNamespace') ?? undefined,\n }));\n}\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { GroupEntity, UserEntity } from '@backstage/catalog-model';\nimport { GithubCredentialType } from '@backstage/integration';\nimport { graphql } from '@octokit/graphql';\n\n// Graphql types\n\nexport type QueryResponse = {\n organization?: Organization;\n repositoryOwner?: Organization | User;\n};\n\nexport type Organization = {\n membersWithRole?: Connection<User>;\n team?: Team;\n teams?: Connection<Team>;\n repositories?: Connection<Repository>;\n};\n\nexport type PageInfo = {\n hasNextPage: boolean;\n endCursor?: string;\n};\n\nexport type User = {\n login: string;\n bio?: string;\n avatarUrl?: string;\n email?: string;\n name?: string;\n repositories?: Connection<Repository>;\n};\n\nexport type Team = {\n slug: string;\n combinedSlug: string;\n name?: string;\n description?: string;\n avatarUrl?: string;\n parentTeam?: Team;\n members: Connection<User>;\n};\n\nexport type Repository = {\n name: string;\n url: string;\n isArchived: boolean;\n defaultBranchRef: {\n name: string;\n } | null;\n};\n\nexport type Connection<T> = {\n pageInfo: PageInfo;\n nodes: T[];\n};\n\n/**\n * Gets all the users out of a GitHub organization.\n *\n * Note that the users will not have their memberships filled in.\n *\n * @param client - An octokit graphql client\n * @param org - The slug of the org to read\n */\nexport async function getOrganizationUsers(\n client: typeof graphql,\n org: string,\n tokenType: GithubCredentialType,\n userNamespace?: string,\n): Promise<{ users: UserEntity[] }> {\n const query = `\n query users($org: String!, $email: Boolean!, $cursor: String) {\n organization(login: $org) {\n membersWithRole(first: 100, after: $cursor) {\n pageInfo { hasNextPage, endCursor }\n nodes {\n avatarUrl,\n bio,\n email @include(if: $email),\n login,\n name\n }\n }\n }\n }`;\n\n // There is no user -> teams edge, so we leave the memberships empty for\n // now and let the team iteration handle it instead\n const mapper = (user: User) => {\n const entity: UserEntity = {\n apiVersion: 'backstage.io/v1alpha1',\n kind: 'User',\n metadata: {\n name: user.login,\n annotations: {\n 'github.com/user-login': user.login,\n },\n },\n spec: {\n profile: {},\n memberOf: [],\n },\n };\n\n if (userNamespace) entity.metadata.namespace = userNamespace;\n if (user.bio) entity.metadata.description = user.bio;\n if (user.name) entity.spec.profile!.displayName = user.name;\n if (user.email) entity.spec.profile!.email = user.email;\n if (user.avatarUrl) entity.spec.profile!.picture = user.avatarUrl;\n\n return entity;\n };\n\n const users = await queryWithPaging(\n client,\n query,\n r => r.organization?.membersWithRole,\n mapper,\n { org, email: tokenType === 'token' },\n );\n\n return { users };\n}\n\n/**\n * Gets all the teams out of a GitHub organization.\n *\n * Note that the teams will not have any relations apart from parent filled in.\n *\n * @param client - An octokit graphql client\n * @param org - The slug of the org to read\n */\nexport async function getOrganizationTeams(\n client: typeof graphql,\n org: string,\n orgNamespace?: string,\n): Promise<{\n groups: GroupEntity[];\n groupMemberUsers: Map<string, string[]>;\n}> {\n const query = `\n query teams($org: String!, $cursor: String) {\n organization(login: $org) {\n teams(first: 100, after: $cursor) {\n pageInfo { hasNextPage, endCursor }\n nodes {\n slug\n combinedSlug\n name\n description\n avatarUrl\n parentTeam { slug }\n members(first: 100, membership: IMMEDIATE) {\n pageInfo { hasNextPage }\n nodes { login }\n }\n }\n }\n }\n }`;\n\n // Gets populated inside the mapper below\n const groupMemberUsers = new Map<string, string[]>();\n\n const mapper = async (team: Team) => {\n const entity: GroupEntity = {\n apiVersion: 'backstage.io/v1alpha1',\n kind: 'Group',\n metadata: {\n name: team.slug,\n annotations: {\n 'github.com/team-slug': team.combinedSlug,\n },\n },\n spec: {\n type: 'team',\n profile: {},\n children: [],\n },\n };\n\n if (orgNamespace) {\n entity.metadata.namespace = orgNamespace;\n }\n\n if (team.description) {\n entity.metadata.description = team.description;\n }\n if (team.name) {\n entity.spec.profile!.displayName = team.name;\n }\n if (team.avatarUrl) {\n entity.spec.profile!.picture = team.avatarUrl;\n }\n if (team.parentTeam) {\n entity.spec.parent = team.parentTeam.slug;\n }\n\n const memberNames: string[] = [];\n const groupKey = orgNamespace ? `${orgNamespace}/${team.slug}` : team.slug;\n groupMemberUsers.set(groupKey, memberNames);\n\n if (!team.members.pageInfo.hasNextPage) {\n // We got all the members in one go, run the fast path\n for (const user of team.members.nodes) {\n memberNames.push(user.login);\n }\n } else {\n // There were more than a hundred immediate members - run the slow\n // path of fetching them explicitly\n const { members } = await getTeamMembers(client, org, team.slug);\n for (const userLogin of members) {\n memberNames.push(userLogin);\n }\n }\n\n return entity;\n };\n\n const groups = await queryWithPaging(\n client,\n query,\n r => r.organization?.teams,\n mapper,\n { org },\n );\n\n return { groups, groupMemberUsers };\n}\n\nexport async function getOrganizationRepositories(\n client: typeof graphql,\n org: string,\n): Promise<{ repositories: Repository[] }> {\n const query = `\n query repositories($org: String!, $cursor: String) {\n repositoryOwner(login: $org) {\n login\n repositories(first: 100, after: $cursor) {\n nodes {\n name\n url\n isArchived\n defaultBranchRef {\n name\n }\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n }\n }`;\n\n const repositories = await queryWithPaging(\n client,\n query,\n r => r.repositoryOwner?.repositories,\n x => x,\n { org },\n );\n\n return { repositories };\n}\n\n/**\n * Gets all the users out of a GitHub organization.\n *\n * Note that the users will not have their memberships filled in.\n *\n * @param client - An octokit graphql client\n * @param org - The slug of the org to read\n * @param teamSlug - The slug of the team to read\n */\nexport async function getTeamMembers(\n client: typeof graphql,\n org: string,\n teamSlug: string,\n): Promise<{ members: string[] }> {\n const query = `\n query members($org: String!, $teamSlug: String!, $cursor: String) {\n organization(login: $org) {\n team(slug: $teamSlug) {\n members(first: 100, after: $cursor, membership: IMMEDIATE) {\n pageInfo { hasNextPage, endCursor }\n nodes { login }\n }\n }\n }\n }`;\n\n const members = await queryWithPaging(\n client,\n query,\n r => r.organization?.team?.members,\n user => user.login,\n { org, teamSlug },\n );\n\n return { members };\n}\n\n//\n// Helpers\n//\n\n/**\n * Assists in repeatedly executing a query with a paged response.\n *\n * Requires that the query accepts a $cursor variable.\n *\n * @param client - The octokit client\n * @param query - The query to execute\n * @param connection - A function that, given the response, picks out the actual\n * Connection object that's being iterated\n * @param mapper - A function that, given one of the nodes in the Connection,\n * returns the model mapped form of it\n * @param variables - The variable values that the query needs, minus the cursor\n */\nexport async function queryWithPaging<\n GraphqlType,\n OutputType,\n Variables extends {},\n Response = QueryResponse,\n>(\n client: typeof graphql,\n query: string,\n connection: (response: Response) => Connection<GraphqlType> | undefined,\n mapper: (item: GraphqlType) => Promise<OutputType> | OutputType,\n variables: Variables,\n): Promise<OutputType[]> {\n const result: OutputType[] = [];\n\n let cursor: string | undefined = undefined;\n for (let j = 0; j < 1000 /* just for sanity */; ++j) {\n const response: Response = await client(query, {\n ...variables,\n cursor,\n });\n\n const conn = connection(response);\n if (!conn) {\n throw new Error(`Found no match for ${JSON.stringify(variables)}`);\n }\n\n for (const node of conn.nodes) {\n result.push(await mapper(node));\n }\n\n if (!conn.pageInfo.hasNextPage) {\n break;\n } else {\n cursor = conn.pageInfo.endCursor;\n }\n }\n\n return result;\n}\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { GroupEntity, UserEntity } from '@backstage/catalog-model';\n\nexport function buildOrgHierarchy(groups: GroupEntity[]) {\n const groupsByName = new Map(groups.map(g => [g.metadata.name, g]));\n\n //\n // Make sure that g.parent.children contain g\n //\n\n for (const group of groups) {\n const selfName = group.metadata.name;\n const parentName = group.spec.parent;\n if (parentName) {\n const parent = groupsByName.get(parentName);\n if (parent && !parent.spec.children.includes(selfName)) {\n parent.spec.children.push(selfName);\n }\n }\n }\n\n //\n // Make sure that g.children.parent is g\n //\n\n for (const group of groups) {\n const selfName = group.metadata.name;\n for (const childName of group.spec.children) {\n const child = groupsByName.get(childName);\n if (child && !child.spec.parent) {\n child.spec.parent = selfName;\n }\n }\n }\n}\n\n// Ensure that users have their direct group memberships.\nexport function assignGroupsToUsers(\n users: UserEntity[],\n groupMemberUsers: Map<string, string[]>,\n) {\n const usersByName = new Map(users.map(u => [u.metadata.name, u]));\n for (const [groupName, userNames] of groupMemberUsers.entries()) {\n for (const userName of userNames) {\n const user = usersByName.get(userName);\n if (user && !user.spec.memberOf?.includes(groupName)) {\n if (!user.spec.memberOf) {\n user.spec.memberOf = [];\n }\n user.spec.memberOf.push(groupName);\n }\n }\n }\n}\n\n// Ensure that users have their transitive group memberships. Requires that\n// the groups were previously processed with buildOrgHierarchy()\nexport function buildMemberOf(groups: GroupEntity[], users: UserEntity[]) {\n const groupsByName = new Map(groups.map(g => [g.metadata.name, g]));\n\n users.forEach(user => {\n const transitiveMemberOf = new Set<string>();\n\n const todo = [\n ...(user.spec.memberOf ?? []),\n ...groups\n .filter(g => g.spec.members?.includes(user.metadata.name))\n .map(g => g.metadata.name),\n ];\n\n for (;;) {\n const current = todo.pop();\n if (!current) {\n break;\n }\n\n if (!transitiveMemberOf.has(current)) {\n transitiveMemberOf.add(current);\n const group = groupsByName.get(current);\n if (group?.spec.parent) {\n todo.push(group.spec.parent);\n }\n }\n }\n\n user.spec.memberOf = [...transitiveMemberOf];\n });\n}\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport function parseGitHubOrgUrl(urlString: string): { org: string } {\n const path = new URL(urlString).pathname.substr(1).split('/');\n\n // /backstage\n if (path.length === 1 && path[0].length) {\n return { org: decodeURIComponent(path[0]) };\n }\n\n throw new Error(`Expected a URL pointing to /<org>`);\n}\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Config } from '@backstage/config';\nimport {\n DefaultGithubCredentialsProvider,\n GithubCredentialsProvider,\n ScmIntegrationRegistry,\n ScmIntegrations,\n} from '@backstage/integration';\nimport {\n CatalogProcessor,\n CatalogProcessorEmit,\n LocationSpec,\n processingResult,\n} from '@backstage/plugin-catalog-backend';\nimport { graphql } from '@octokit/graphql';\nimport { Logger } from 'winston';\nimport { getOrganizationRepositories } from './lib';\n\n/**\n * Extracts repositories out of a GitHub org.\n *\n * The following will create locations for all projects which have a catalog-info.yaml\n * on the default branch. The first is shorthand for the second.\n *\n * target: \"https://github.com/backstage\"\n * or\n * target: https://github.com/backstage/*\\/blob/-/catalog-info.yaml\n *\n * You may also explicitly specify the source branch:\n *\n * target: https://github.com/backstage/*\\/blob/main/catalog-info.yaml\n *\n * @public\n **/\nexport class GithubDiscoveryProcessor implements CatalogProcessor {\n private readonly integrations: ScmIntegrationRegistry;\n private readonly logger: Logger;\n private readonly githubCredentialsProvider: GithubCredentialsProvider;\n\n static fromConfig(\n config: Config,\n options: {\n logger: Logger;\n githubCredentialsProvider?: GithubCredentialsProvider;\n },\n ) {\n const integrations = ScmIntegrations.fromConfig(config);\n\n return new GithubDiscoveryProcessor({\n ...options,\n integrations,\n });\n }\n\n constructor(options: {\n integrations: ScmIntegrationRegistry;\n logger: Logger;\n githubCredentialsProvider?: GithubCredentialsProvider;\n }) {\n this.integrations = options.integrations;\n this.logger = options.logger;\n this.githubCredentialsProvider =\n options.githubCredentialsProvider ||\n DefaultGithubCredentialsProvider.fromIntegrations(this.integrations);\n }\n getProcessorName(): string {\n return 'GithubDiscoveryProcessor';\n }\n\n async readLocation(\n location: LocationSpec,\n _optional: boolean,\n emit: CatalogProcessorEmit,\n ): Promise<boolean> {\n if (location.type !== 'github-discovery') {\n return false;\n }\n\n const gitHubConfig = this.integrations.github.byUrl(\n location.target,\n )?.config;\n if (!gitHubConfig) {\n throw new Error(\n `There is no GitHub integration that matches ${location.target}. Please add a configuration entry for it under integrations.github`,\n );\n }\n\n const { org, repoSearchPath, catalogPath, branch, host } = parseUrl(\n location.target,\n );\n\n // Building the org url here so that the github creds provider doesn't need to know\n // about how to handle the wild card which is special for this processor.\n const orgUrl = `https://${host}/${org}`;\n\n const { headers } = await this.githubCredentialsProvider.getCredentials({\n url: orgUrl,\n });\n\n const client = graphql.defaults({\n baseUrl: gitHubConfig.apiBaseUrl,\n headers,\n });\n\n // Read out all of the raw data\n const startTimestamp = Date.now();\n this.logger.info(`Reading GitHub repositories from ${location.target}`);\n\n const { repositories } = await getOrganizationRepositories(client, org);\n const matching = repositories.filter(\n r => !r.isArchived && repoSearchPath.test(r.name),\n );\n\n const duration = ((Date.now() - startTimestamp) / 1000).toFixed(1);\n this.logger.debug(\n `Read ${repositories.length} GitHub repositories (${matching.length} matching the pattern) in ${duration} seconds`,\n );\n\n for (const repository of matching) {\n const branchName =\n branch === '-' ? repository.defaultBranchRef?.name : branch;\n\n if (!branchName) {\n this.logger.info(\n `the repository ${repository.url} does not have a default branch, skipping`,\n );\n continue;\n }\n\n const path = `/blob/${branchName}${catalogPath}`;\n\n emit(\n processingResult.location({\n type: 'url',\n target: `${repository.url}${path}`,\n // Not all locations may actually exist, since the user defined them as a wildcard pattern.\n // Thus, we emit them as optional and let the downstream processor find them while not outputting\n // an error if it couldn't.\n presence: 'optional',\n }),\n );\n }\n\n return true;\n }\n}\n\n/*\n * Helpers\n */\n\nexport function parseUrl(urlString: string): {\n org: string;\n repoSearchPath: RegExp;\n catalogPath: string;\n branch: string;\n host: string;\n} {\n const url = new URL(urlString);\n const path = url.pathname.substr(1).split('/');\n\n // /backstage/techdocs-*/blob/master/catalog-info.yaml\n // can also be\n // /backstage\n if (path.length > 2 && path[0].length && path[1].length) {\n return {\n org: decodeURIComponent(path[0]),\n repoSearchPath: escapeRegExp(decodeURIComponent(path[1])),\n branch: decodeURIComponent(path[3]),\n catalogPath: `/${decodeURIComponent(path.slice(4).join('/'))}`,\n host: url.host,\n };\n } else if (path.length === 1 && path[0].length) {\n return {\n org: decodeURIComponent(path[0]),\n host: url.host,\n repoSearchPath: escapeRegExp('*'),\n catalogPath: '/catalog-info.yaml',\n branch: '-',\n };\n }\n\n throw new Error(`Failed to parse ${urlString}`);\n}\n\nexport function escapeRegExp(str: string): RegExp {\n return new RegExp(`^${str.replace(/\\*/g, '.*')}$`);\n}\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Config } from '@backstage/config';\nimport {\n DefaultGithubCredentialsProvider,\n GithubAppCredentialsMux,\n GithubCredentialsProvider,\n GitHubIntegrationConfig,\n ScmIntegrationRegistry,\n ScmIntegrations,\n} from '@backstage/integration';\nimport {\n CatalogProcessor,\n CatalogProcessorEmit,\n LocationSpec,\n processingResult,\n} from '@backstage/plugin-catalog-backend';\nimport { graphql } from '@octokit/graphql';\nimport { Logger } from 'winston';\nimport {\n buildOrgHierarchy,\n getOrganizationTeams,\n getOrganizationUsers,\n GithubMultiOrgConfig,\n readGithubMultiOrgConfig,\n} from './lib';\n\n/**\n * Extracts teams and users out of a multiple GitHub orgs namespaced per org.\n *\n * Be aware that this processor may not be compatible with future org structures in the catalog.\n *\n * @public\n */\nexport class GithubMultiOrgReaderProcessor implements CatalogProcessor {\n private readonly integrations: ScmIntegrationRegistry;\n private readonly orgs: GithubMultiOrgConfig;\n private readonly logger: Logger;\n private readonly githubCredentialsProvider: GithubCredentialsProvider;\n\n static fromConfig(\n config: Config,\n options: {\n logger: Logger;\n githubCredentialsProvider?: GithubCredentialsProvider;\n },\n ) {\n const c = config.getOptionalConfig('catalog.processors.githubMultiOrg');\n const integrations = ScmIntegrations.fromConfig(config);\n\n return new GithubMultiOrgReaderProcessor({\n ...options,\n integrations,\n orgs: c ? readGithubMultiOrgConfig(c) : [],\n });\n }\n\n constructor(options: {\n integrations: ScmIntegrationRegistry;\n logger: Logger;\n orgs: GithubMultiOrgConfig;\n githubCredentialsProvider?: GithubCredentialsProvider;\n }) {\n this.integrations = options.integrations;\n this.logger = options.logger;\n this.orgs = options.orgs;\n this.githubCredentialsProvider =\n options.githubCredentialsProvider ||\n DefaultGithubCredentialsProvider.fromIntegrations(this.integrations);\n }\n getProcessorName(): string {\n return 'GithubMultiOrgReaderProcessor';\n }\n\n async readLocation(\n location: LocationSpec,\n _optional: boolean,\n emit: CatalogProcessorEmit,\n ): Promise<boolean> {\n if (location.type !== 'github-multi-org') {\n return false;\n }\n\n const gitHubConfig = this.integrations.github.byUrl(\n location.target,\n )?.config;\n if (!gitHubConfig) {\n throw new Error(\n `There is no GitHub integration that matches ${location.target}. Please add a configuration entry for it under integrations.github`,\n );\n }\n\n const allUsersMap = new Map();\n const baseUrl = new URL(location.target).origin;\n\n const orgsToProcess = this.orgs.length\n ? this.orgs\n : await this.getAllOrgs(gitHubConfig);\n\n for (const orgConfig of orgsToProcess) {\n try {\n const { headers, type: tokenType } =\n await this.githubCredentialsProvider.getCredentials({\n url: `${baseUrl}/${orgConfig.name}`,\n });\n const client = graphql.defaults({\n baseUrl: gitHubConfig.apiBaseUrl,\n headers,\n });\n\n const startTimestamp = Date.now();\n this.logger.info(\n `Reading GitHub users and teams for org: ${orgConfig.name}`,\n );\n const { users } = await getOrganizationUsers(\n client,\n orgConfig.name,\n tokenType,\n orgConfig.userNamespace,\n );\n const { groups, groupMemberUsers } = await getOrganizationTeams(\n client,\n orgConfig.name,\n orgConfig.groupNamespace,\n );\n\n const duration = ((Date.now() - startTimestamp) / 1000).toFixed(1);\n this.logger.debug(\n `Read ${users.length} GitHub users and ${groups.length} GitHub teams from ${orgConfig.name} in ${duration} seconds`,\n );\n\n let prefix: string = orgConfig.userNamespace ?? '';\n if (prefix.length > 0) prefix += '/';\n\n users.forEach(u => {\n if (!allUsersMap.has(prefix + u.metadata.name)) {\n allUsersMap.set(prefix + u.metadata.name, u);\n }\n });\n\n for (const [groupName, userNames] of groupMemberUsers.entries()) {\n for (const userName of userNames) {\n const user = allUsersMap.get(prefix + userName);\n if (user && !user.spec.memberOf.includes(groupName)) {\n user.spec.memberOf.push(groupName);\n }\n }\n }\n buildOrgHierarchy(groups);\n\n for (const group of groups) {\n emit(processingResult.entity(location, group));\n }\n } catch (e) {\n this.logger.error(\n `Failed to read GitHub org data for ${orgConfig.name}: ${e}`,\n );\n }\n }\n\n const allUsers = Array.from(allUsersMap.values());\n for (const user of allUsers) {\n emit(processingResult.entity(location, user));\n }\n\n return true;\n }\n\n // Note: Does not support usage of PATs\n private async getAllOrgs(\n gitHubConfig: GitHubIntegrationConfig,\n ): Promise<GithubMultiOrgConfig> {\n const githubAppMux = new GithubAppCredentialsMux(gitHubConfig);\n const installs = await githubAppMux.getAllInstallations();\n\n return installs\n .map(install =>\n install.target_type === 'Organization' &&\n install.account &&\n install.account.login\n ? {\n name: install.account.login,\n groupNamespace: install.account.login.toLowerCase(),\n }\n : undefined,\n )\n .filter(Boolean) as GithubMultiOrgConfig;\n }\n}\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { TaskRunner } from '@backstage/backend-tasks';\nimport {\n ANNOTATION_LOCATION,\n ANNOTATION_ORIGIN_LOCATION,\n Entity,\n} from '@backstage/catalog-model';\nimport { Config } from '@backstage/config';\nimport {\n DefaultGithubCredentialsProvider,\n GithubCredentialsProvider,\n GitHubIntegrationConfig,\n ScmIntegrations,\n SingleInstanceGithubCredentialsProvider,\n} from '@backstage/integration';\nimport {\n EntityProvider,\n EntityProviderConnection,\n} from '@backstage/plugin-catalog-backend';\nimport { graphql } from '@octokit/graphql';\nimport { merge } from 'lodash';\nimport * as uuid from 'uuid';\nimport { Logger } from 'winston';\nimport {\n assignGroupsToUsers,\n buildOrgHierarchy,\n getOrganizationTeams,\n getOrganizationUsers,\n parseGitHubOrgUrl,\n} from './lib';\n\n/**\n * Options for {@link GitHubOrgEntityProvider}.\n *\n * @public\n */\nexport interface GitHubOrgEntityProviderOptions {\n /**\n * A unique, stable identifier for this provider.\n *\n * @example \"production\"\n */\n id: string;\n\n /**\n * The target that this provider should consume.\n *\n * @example \"https://github.com/backstage\"\n */\n orgUrl: string;\n\n /**\n * The refresh schedule to use.\n *\n * @defaultValue \"manual\"\n * @remarks\n *\n * If you pass in 'manual', you are responsible for calling the `read` method\n * manually at some interval.\n *\n * But more commonly you will pass in the result of\n * {@link @backstage/backend-tasks#PluginTaskScheduler.createScheduledTaskRunner}\n * to enable automatic scheduling of tasks.\n */\n schedule?: 'manual' | TaskRunner;\n\n /**\n * The logger to use.\n */\n logger: Logger;\n\n /**\n * Optionally supply a custom credentials provider, replacing the default one.\n */\n githubCredentialsProvider?: GithubCredentialsProvider;\n}\n\n// TODO: Consider supporting an (optional) webhook that reacts on org changes\n/**\n * Ingests org data (users and groups) from GitHub.\n *\n * @public\n */\nexport class GitHubOrgEntityProvider implements EntityProvider {\n private readonly credentialsProvider: GithubCredentialsProvider;\n private connection?: EntityProviderConnection;\n private scheduleFn?: () => Promise<void>;\n\n static fromConfig(config: Config, options: GitHubOrgEntityProviderOptions) {\n const integrations = ScmIntegrations.fromConfig(config);\n const gitHubConfig = integrations.github.byUrl(options.orgUrl)?.config;\n\n if (!gitHubConfig) {\n throw new Error(\n `There is no GitHub Org provider that matches ${options.orgUrl}. Please add a configuration for an integration.`,\n );\n }\n\n const logger = options.logger.child({\n target: options.orgUrl,\n });\n\n const provider = new GitHubOrgEntityProvider({\n id: options.id,\n orgUrl: options.orgUrl,\n logger,\n gitHubConfig,\n githubCredentialsProvider:\n options.githubCredentialsProvider ||\n DefaultGithubCredentialsProvider.fromIntegrations(integrations),\n });\n\n provider.schedule(options.schedule);\n\n return provider;\n }\n\n constructor(\n private options: {\n id: string;\n orgUrl: string;\n gitHubConfig: GitHubIntegrationConfig;\n logger: Logger;\n githubCredentialsProvider?: GithubCredentialsProvider;\n },\n ) {\n this.credentialsProvider =\n options.githubCredentialsProvider ||\n SingleInstanceGithubCredentialsProvider.create(this.options.gitHubConfig);\n }\n\n /** {@inheritdoc @backstage/plugin-catalog-backend#EntityProvider.getProviderName} */\n getProviderName() {\n return `GitHubOrgEntityProvider:${this.options.id}`;\n }\n\n /** {@inheritdoc @backstage/plugin-catalog-backend#EntityProvider.connect} */\n async connect(connection: EntityProviderConnection) {\n this.connection = connection;\n await this.scheduleFn?.();\n }\n\n /**\n * Runs one single complete ingestion. This is only necessary if you use\n * manual scheduling.\n */\n async read(options?: { logger?: Logger }) {\n if (!this.connection) {\n throw new Error('Not initialized');\n }\n\n const logger = options?.logger ?? this.options.logger;\n const { markReadComplete } = trackProgress(logger);\n\n const { headers, type: tokenType } =\n await this.credentialsProvider.getCredentials({\n url: this.options.orgUrl,\n });\n const client = graphql.defaults({\n baseUrl: this.options.gitHubConfig.apiBaseUrl,\n headers,\n });\n\n const { org } = parseGitHubOrgUrl(this.options.orgUrl);\n const { users } = await getOrganizationUsers(client, org, tokenType);\n const { groups, groupMemberUsers } = await getOrganizationTeams(\n client,\n org,\n );\n assignGroupsToUsers(users, groupMemberUsers);\n buildOrgHierarchy(groups);\n\n const { markCommitComplete } = markReadComplete({ users, groups });\n\n await this.connection.applyMutation({\n type: 'full',\n entities: [...users, ...groups].map(entity => ({\n locationKey: `github-org-provider:${this.options.id}`,\n entity: withLocations(\n `https://${this.options.gitHubConfig.host}`,\n org,\n entity,\n ),\n })),\n });\n\n markCommitComplete();\n }\n\n private schedule(schedule: GitHubOrgEntityProviderOptions['schedule']) {\n if (!schedule || schedule === 'manual') {\n return;\n }\n\n this.scheduleFn = async () => {\n const id = `${this.getProviderName()}:refresh`;\n await schedule.run({\n id,\n fn: async () => {\n const logger = this.options.logger.child({\n class: GitHubOrgEntityProvider.prototype.constructor.name,\n taskId: id,\n taskInstanceId: uuid.v4(),\n });\n\n try {\n await this.read({ logger });\n } catch (error) {\n logger.error(error);\n }\n },\n });\n };\n }\n}\n\n// Helps wrap the timing and logging behaviors\nfunction trackProgress(logger: Logger) {\n let timestamp = Date.now();\n let summary: string;\n\n logger.info('Reading GitHub users and groups');\n\n function markReadComplete(read: { users: unknown[]; groups: unknown[] }) {\n summary = `${read.users.length} GitHub users and ${read.groups.length} GitHub groups`;\n const readDuration = ((Date.now() - timestamp) / 1000).toFixed(1);\n timestamp = Date.now();\n logger.info(`Read ${summary} in ${readDuration} seconds. Committing...`);\n return { markCommitComplete };\n }\n\n function markCommitComplete() {\n const commitDuration = ((Date.now() - timestamp) / 1000).toFixed(1);\n logger.info(`Committed ${summary} in ${commitDuration} seconds.`);\n }\n\n return { markReadComplete };\n}\n\n// Makes sure that emitted entities have a proper location\nexport function withLocations(\n baseUrl: string,\n org: string,\n entity: Entity,\n): Entity {\n const location =\n entity.kind === 'Group'\n ? `url:${baseUrl}/orgs/${org}/teams/${entity.metadata.name}`\n : `url:${baseUrl}/${entity.metadata.name}`;\n return merge(\n {\n metadata: {\n annotations: {\n [ANNOTATION_LOCATION]: location,\n [ANNOTATION_ORIGIN_LOCATION]: location,\n },\n },\n },\n entity,\n ) as Entity;\n}\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Config } from '@backstage/config';\nimport {\n DefaultGithubCredentialsProvider,\n GithubCredentialsProvider,\n GithubCredentialType,\n ScmIntegrationRegistry,\n ScmIntegrations,\n} from '@backstage/integration';\nimport {\n CatalogProcessor,\n CatalogProcessorEmit,\n LocationSpec,\n processingResult,\n} from '@backstage/plugin-catalog-backend';\nimport { graphql } from '@octokit/graphql';\nimport { Logger } from 'winston';\nimport {\n assignGroupsToUsers,\n buildOrgHierarchy,\n getOrganizationTeams,\n getOrganizationUsers,\n parseGitHubOrgUrl,\n} from './lib';\n\ntype GraphQL = typeof graphql;\n\n/**\n * Extracts teams and users out of a GitHub org.\n *\n * @remarks\n *\n * Consider using {@link GitHubOrgEntityProvider} instead.\n *\n * @public\n */\nexport class GithubOrgReaderProcessor implements CatalogProcessor {\n private readonly integrations: ScmIntegrationRegistry;\n private readonly logger: Logger;\n private readonly githubCredentialsProvider: GithubCredentialsProvider;\n\n static fromConfig(\n config: Config,\n options: {\n logger: Logger;\n githubCredentialsProvider?: GithubCredentialsProvider;\n },\n ) {\n const integrations = ScmIntegrations.fromConfig(config);\n\n return new GithubOrgReaderProcessor({\n ...options,\n integrations,\n });\n }\n\n constructor(options: {\n integrations: ScmIntegrationRegistry;\n logger: Logger;\n githubCredentialsProvider?: GithubCredentialsProvider;\n }) {\n this.integrations = options.integrations;\n this.githubCredentialsProvider =\n options.githubCredentialsProvider ||\n DefaultGithubCredentialsProvider.fromIntegrations(this.integrations);\n this.logger = options.logger;\n }\n getProcessorName(): string {\n return 'GithubOrgReaderProcessor';\n }\n\n async readLocation(\n location: LocationSpec,\n _optional: boolean,\n emit: CatalogProcessorEmit,\n ): Promise<boolean> {\n if (location.type !== 'github-org') {\n return false;\n }\n\n const { client, tokenType } = await this.createClient(location.target);\n const { org } = parseGitHubOrgUrl(location.target);\n\n // Read out all of the raw data\n const startTimestamp = Date.now();\n this.logger.info('Reading GitHub users and groups');\n\n const { users } = await getOrganizationUsers(client, org, tokenType);\n const { groups, groupMemberUsers } = await getOrganizationTeams(\n client,\n org,\n );\n\n const duration = ((Date.now() - startTimestamp) / 1000).toFixed(1);\n this.logger.debug(\n `Read ${users.length} GitHub users and ${groups.length} GitHub groups in ${duration} seconds`,\n );\n\n assignGroupsToUsers(users, groupMemberUsers);\n buildOrgHierarchy(groups);\n\n // Done!\n for (const group of groups) {\n emit(processingResult.entity(location, group));\n }\n for (const user of users) {\n emit(processingResult.entity(location, user));\n }\n\n return true;\n }\n\n private async createClient(\n orgUrl: string,\n ): Promise<{ client: GraphQL; tokenType: GithubCredentialType }> {\n const gitHubConfig = this.integrations.github.byUrl(orgUrl)?.config;\n\n if (!gitHubConfig) {\n throw new Error(\n `There is no GitHub Org provider that matches ${orgUrl}. Please add a configuration for an integration.`,\n );\n }\n\n const { headers, type: tokenType } =\n await this.githubCredentialsProvider.getCredentials({\n url: orgUrl,\n });\n\n const client = graphql.defaults({\n baseUrl: gitHubConfig.apiBaseUrl,\n headers,\n });\n\n return { client, tokenType };\n }\n}\n"],"names":["ScmIntegrations","DefaultGithubCredentialsProvider","graphql","processingResult","GithubAppCredentialsMux","SingleInstanceGithubCredentialsProvider","uuid","merge","ANNOTATION_LOCATION","ANNOTATION_ORIGIN_LOCATION"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAO,SAAS,wBAAwB,CAAC,MAAM,EAAE;AACjD,EAAE,IAAI,EAAE,CAAC;AACT,EAAE,MAAM,UAAU,GAAG,CAAC,EAAE,GAAG,MAAM,CAAC,sBAAsB,CAAC,MAAM,CAAC,KAAK,IAAI,GAAG,EAAE,GAAG,EAAE,CAAC;AACpF,EAAE,O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K;AACL,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,MAAM,YAAY,CAAC,MAAM,EAAE;AAC7B,IAAI,IAAI,EAAE,CAAC;AACX,IAAI,MAAM,YAAY,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC;AACpG,IAAI,IAAI,CAAC,YAAY,EAAE;AACvB,MAAM,MAAM,IAAI,KAAK,CAAC,CAAC,6CAA6C,EAAE,MAAM,CAAC,gDAAgD,CAAC,CAAC,CAAC;AAChI,KAAK;AACL,IAAI,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,MAAM,IAAI,CAAC,yBAAyB,CAAC,cAAc,CAAC;AAC7F,MAAM,GAAG,EAAE,MAAM;AACjB,KAAK,CAAC,CAAC;AACP,IAAI,MAAM,MAAM,GAAGD,eAAO,CAAC,QAAQ,CAAC;AACpC,MAAM,OAAO,EAAE,YAAY,CAAC,UAAU;AACtC,MAAM,OAAO;AACb,KAAK,CAAC,CAAC;AACP,IAAI,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;AACjC,GAAG;AACH;;;;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { Config } from '@backstage/config';
|
|
|
2
2
|
import { GithubCredentialsProvider, ScmIntegrationRegistry, GitHubIntegrationConfig } from '@backstage/integration';
|
|
3
3
|
import { CatalogProcessor, LocationSpec, CatalogProcessorEmit, EntityProvider, EntityProviderConnection } from '@backstage/plugin-catalog-backend';
|
|
4
4
|
import { Logger } from 'winston';
|
|
5
|
+
import { TaskRunner } from '@backstage/backend-tasks';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Extracts repositories out of a GitHub org.
|
|
@@ -82,17 +83,58 @@ declare class GithubMultiOrgReaderProcessor implements CatalogProcessor {
|
|
|
82
83
|
private getAllOrgs;
|
|
83
84
|
}
|
|
84
85
|
|
|
85
|
-
/**
|
|
86
|
+
/**
|
|
87
|
+
* Options for {@link GitHubOrgEntityProvider}.
|
|
88
|
+
*
|
|
89
|
+
* @public
|
|
90
|
+
*/
|
|
91
|
+
interface GitHubOrgEntityProviderOptions {
|
|
92
|
+
/**
|
|
93
|
+
* A unique, stable identifier for this provider.
|
|
94
|
+
*
|
|
95
|
+
* @example "production"
|
|
96
|
+
*/
|
|
97
|
+
id: string;
|
|
98
|
+
/**
|
|
99
|
+
* The target that this provider should consume.
|
|
100
|
+
*
|
|
101
|
+
* @example "https://github.com/backstage"
|
|
102
|
+
*/
|
|
103
|
+
orgUrl: string;
|
|
104
|
+
/**
|
|
105
|
+
* The refresh schedule to use.
|
|
106
|
+
*
|
|
107
|
+
* @defaultValue "manual"
|
|
108
|
+
* @remarks
|
|
109
|
+
*
|
|
110
|
+
* If you pass in 'manual', you are responsible for calling the `read` method
|
|
111
|
+
* manually at some interval.
|
|
112
|
+
*
|
|
113
|
+
* But more commonly you will pass in the result of
|
|
114
|
+
* {@link @backstage/backend-tasks#PluginTaskScheduler.createScheduledTaskRunner}
|
|
115
|
+
* to enable automatic scheduling of tasks.
|
|
116
|
+
*/
|
|
117
|
+
schedule?: 'manual' | TaskRunner;
|
|
118
|
+
/**
|
|
119
|
+
* The logger to use.
|
|
120
|
+
*/
|
|
121
|
+
logger: Logger;
|
|
122
|
+
/**
|
|
123
|
+
* Optionally supply a custom credentials provider, replacing the default one.
|
|
124
|
+
*/
|
|
125
|
+
githubCredentialsProvider?: GithubCredentialsProvider;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Ingests org data (users and groups) from GitHub.
|
|
129
|
+
*
|
|
130
|
+
* @public
|
|
131
|
+
*/
|
|
86
132
|
declare class GitHubOrgEntityProvider implements EntityProvider {
|
|
87
133
|
private options;
|
|
134
|
+
private readonly credentialsProvider;
|
|
88
135
|
private connection?;
|
|
89
|
-
private
|
|
90
|
-
static fromConfig(config: Config, options:
|
|
91
|
-
id: string;
|
|
92
|
-
orgUrl: string;
|
|
93
|
-
logger: Logger;
|
|
94
|
-
githubCredentialsProvider?: GithubCredentialsProvider;
|
|
95
|
-
}): GitHubOrgEntityProvider;
|
|
136
|
+
private scheduleFn?;
|
|
137
|
+
static fromConfig(config: Config, options: GitHubOrgEntityProviderOptions): GitHubOrgEntityProvider;
|
|
96
138
|
constructor(options: {
|
|
97
139
|
id: string;
|
|
98
140
|
orgUrl: string;
|
|
@@ -100,13 +142,27 @@ declare class GitHubOrgEntityProvider implements EntityProvider {
|
|
|
100
142
|
logger: Logger;
|
|
101
143
|
githubCredentialsProvider?: GithubCredentialsProvider;
|
|
102
144
|
});
|
|
145
|
+
/** {@inheritdoc @backstage/plugin-catalog-backend#EntityProvider.getProviderName} */
|
|
103
146
|
getProviderName(): string;
|
|
147
|
+
/** {@inheritdoc @backstage/plugin-catalog-backend#EntityProvider.connect} */
|
|
104
148
|
connect(connection: EntityProviderConnection): Promise<void>;
|
|
105
|
-
|
|
149
|
+
/**
|
|
150
|
+
* Runs one single complete ingestion. This is only necessary if you use
|
|
151
|
+
* manual scheduling.
|
|
152
|
+
*/
|
|
153
|
+
read(options?: {
|
|
154
|
+
logger?: Logger;
|
|
155
|
+
}): Promise<void>;
|
|
156
|
+
private schedule;
|
|
106
157
|
}
|
|
107
158
|
|
|
108
159
|
/**
|
|
109
160
|
* Extracts teams and users out of a GitHub org.
|
|
161
|
+
*
|
|
162
|
+
* @remarks
|
|
163
|
+
*
|
|
164
|
+
* Consider using {@link GitHubOrgEntityProvider} instead.
|
|
165
|
+
*
|
|
110
166
|
* @public
|
|
111
167
|
*/
|
|
112
168
|
declare class GithubOrgReaderProcessor implements CatalogProcessor {
|
|
@@ -127,4 +183,4 @@ declare class GithubOrgReaderProcessor implements CatalogProcessor {
|
|
|
127
183
|
private createClient;
|
|
128
184
|
}
|
|
129
185
|
|
|
130
|
-
export { GitHubOrgEntityProvider, GithubDiscoveryProcessor, GithubMultiOrgConfig, GithubMultiOrgReaderProcessor, GithubOrgReaderProcessor };
|
|
186
|
+
export { GitHubOrgEntityProvider, GitHubOrgEntityProviderOptions, GithubDiscoveryProcessor, GithubMultiOrgConfig, GithubMultiOrgReaderProcessor, GithubOrgReaderProcessor };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-catalog-backend-module-github",
|
|
3
3
|
"description": "A Backstage catalog backend module that helps integrate towards GitHub",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.3",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"license": "Apache-2.0",
|
|
@@ -33,22 +33,24 @@
|
|
|
33
33
|
"start": "backstage-cli package start"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@backstage/backend-common": "^0.13.
|
|
37
|
-
"@backstage/
|
|
38
|
-
"@backstage/
|
|
36
|
+
"@backstage/backend-common": "^0.13.3",
|
|
37
|
+
"@backstage/backend-tasks": "^0.3.1",
|
|
38
|
+
"@backstage/catalog-model": "^1.0.2",
|
|
39
|
+
"@backstage/config": "^1.0.1",
|
|
39
40
|
"@backstage/errors": "^1.0.0",
|
|
40
|
-
"@backstage/integration": "^1.
|
|
41
|
-
"@backstage/plugin-catalog-backend": "^1.1.
|
|
41
|
+
"@backstage/integration": "^1.2.0",
|
|
42
|
+
"@backstage/plugin-catalog-backend": "^1.1.2",
|
|
42
43
|
"@backstage/types": "^1.0.0",
|
|
43
44
|
"@octokit/graphql": "^4.5.8",
|
|
44
45
|
"lodash": "^4.17.21",
|
|
45
46
|
"msw": "^0.35.0",
|
|
46
47
|
"node-fetch": "^2.6.7",
|
|
48
|
+
"uuid": "^8.0.0",
|
|
47
49
|
"winston": "^3.2.1"
|
|
48
50
|
},
|
|
49
51
|
"devDependencies": {
|
|
50
|
-
"@backstage/backend-test-utils": "^0.1.
|
|
51
|
-
"@backstage/cli": "^0.17.
|
|
52
|
+
"@backstage/backend-test-utils": "^0.1.24",
|
|
53
|
+
"@backstage/cli": "^0.17.1",
|
|
52
54
|
"@types/lodash": "^4.14.151"
|
|
53
55
|
},
|
|
54
56
|
"files": [
|
|
@@ -56,5 +58,5 @@
|
|
|
56
58
|
"config.d.ts"
|
|
57
59
|
],
|
|
58
60
|
"configSchema": "config.d.ts",
|
|
59
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "96323f280ba32ee526c5b151cda42260aee927c9"
|
|
60
62
|
}
|