@backstage/plugin-catalog-backend-module-github 0.3.2-next.0 → 0.3.2

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 CHANGED
@@ -1,5 +1,34 @@
1
1
  # @backstage/plugin-catalog-backend-module-github
2
2
 
3
+ ## 0.3.2
4
+
5
+ ### Patch Changes
6
+
7
+ - b01b869d7158: fixed event handler to respect configured organization
8
+ - 68531cc70e1f: Break some internal circular import chains
9
+ - Updated dependencies
10
+ - @backstage/errors@1.2.1
11
+ - @backstage/backend-common@0.19.1
12
+ - @backstage/plugin-catalog-backend@1.11.0
13
+ - @backstage/plugin-catalog-node@1.4.0
14
+ - @backstage/backend-plugin-api@0.5.4
15
+ - @backstage/backend-tasks@0.5.4
16
+ - @backstage/catalog-client@1.4.3
17
+ - @backstage/catalog-model@1.4.1
18
+ - @backstage/config@1.0.8
19
+ - @backstage/integration@1.5.1
20
+ - @backstage/types@1.1.0
21
+ - @backstage/plugin-catalog-common@1.0.15
22
+ - @backstage/plugin-events-node@0.2.8
23
+
24
+ ## 0.3.2-next.1
25
+
26
+ ### Patch Changes
27
+
28
+ - b01b869d7158: fixed event handler to respect configured organization
29
+ - Updated dependencies
30
+ - @backstage/config@1.0.8
31
+
3
32
  ## 0.3.2-next.0
4
33
 
5
34
  ### Patch Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-catalog-backend-module-github",
3
- "version": "0.3.2-next.0",
3
+ "version": "0.3.2",
4
4
  "main": "../dist/alpha.cjs.js",
5
5
  "types": "../dist/alpha.d.ts"
6
6
  }
package/dist/alpha.cjs.js CHANGED
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var backendPluginApi = require('@backstage/backend-plugin-api');
6
6
  var backendCommon = require('@backstage/backend-common');
7
7
  var alpha = require('@backstage/plugin-catalog-node/alpha');
8
- var GithubEntityProvider = require('./cjs/GithubEntityProvider-a9e12f36.cjs.js');
8
+ var GithubEntityProvider = require('./cjs/GithubEntityProvider-89581fab.cjs.js');
9
9
  require('@backstage/integration');
10
10
  require('@backstage/plugin-catalog-node');
11
11
  require('@octokit/graphql');
@@ -208,9 +208,18 @@ function satisfiesVisibilityFilter(visibilities, visibility) {
208
208
  return visibilities.includes(visibility);
209
209
  }
210
210
 
211
+ var __defProp$1 = Object.defineProperty;
212
+ var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
213
+ var __publicField$1 = (obj, key, value) => {
214
+ __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
215
+ return value;
216
+ };
211
217
  class GithubOrgEntityProvider {
212
218
  constructor(options) {
213
219
  this.options = options;
220
+ __publicField$1(this, "credentialsProvider");
221
+ __publicField$1(this, "connection");
222
+ __publicField$1(this, "scheduleFn");
214
223
  this.credentialsProvider = options.githubCredentialsProvider || integration.SingleInstanceGithubCredentialsProvider.create(this.options.gitHubConfig);
215
224
  }
216
225
  static fromConfig(config, options) {
@@ -1034,8 +1043,29 @@ function compileRegExp(pattern) {
1034
1043
  return new RegExp(fullLinePattern);
1035
1044
  }
1036
1045
 
1046
+ var __defProp = Object.defineProperty;
1047
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1048
+ var __publicField = (obj, key, value) => {
1049
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
1050
+ return value;
1051
+ };
1037
1052
  const TOPIC_REPO_PUSH = "github.push";
1038
1053
  class GithubEntityProvider {
1054
+ constructor(config, integration$1, logger, taskRunner) {
1055
+ __publicField(this, "config");
1056
+ __publicField(this, "logger");
1057
+ __publicField(this, "integration");
1058
+ __publicField(this, "scheduleFn");
1059
+ __publicField(this, "connection");
1060
+ __publicField(this, "githubCredentialsProvider");
1061
+ this.config = config;
1062
+ this.integration = integration$1.config;
1063
+ this.logger = logger.child({
1064
+ target: this.getProviderName()
1065
+ });
1066
+ this.scheduleFn = this.createScheduleFn(taskRunner);
1067
+ this.githubCredentialsProvider = integration.SingleInstanceGithubCredentialsProvider.create(integration$1.config);
1068
+ }
1039
1069
  static fromConfig(config, options) {
1040
1070
  if (!options.schedule && !options.scheduler) {
1041
1071
  throw new Error("Either schedule or scheduler must be provided.");
@@ -1064,15 +1094,6 @@ class GithubEntityProvider {
1064
1094
  );
1065
1095
  });
1066
1096
  }
1067
- constructor(config, integration$1, logger, taskRunner) {
1068
- this.config = config;
1069
- this.integration = integration$1.config;
1070
- this.logger = logger.child({
1071
- target: this.getProviderName()
1072
- });
1073
- this.scheduleFn = this.createScheduleFn(taskRunner);
1074
- this.githubCredentialsProvider = integration.SingleInstanceGithubCredentialsProvider.create(integration$1.config);
1075
- }
1076
1097
  /** {@inheritdoc @backstage/plugin-catalog-backend#EntityProvider.getProviderName} */
1077
1098
  getProviderName() {
1078
1099
  return `github-provider:${this.config.id}`;
@@ -1198,6 +1219,12 @@ class GithubEntityProvider {
1198
1219
  if (!this.connection) {
1199
1220
  throw new Error("Not initialized");
1200
1221
  }
1222
+ if (this.config.organization !== event.repository.organization) {
1223
+ this.logger.debug(
1224
+ `skipping push event from organization ${event.repository.organization}`
1225
+ );
1226
+ return;
1227
+ }
1201
1228
  const repoName = event.repository.name;
1202
1229
  const repoUrl = event.repository.url;
1203
1230
  this.logger.debug(`handle github:push event for ${repoName} - ${repoUrl}`);
@@ -1309,4 +1336,4 @@ exports.getOrganizationUsers = getOrganizationUsers;
1309
1336
  exports.getOrganizationsFromUser = getOrganizationsFromUser;
1310
1337
  exports.parseGithubOrgUrl = parseGithubOrgUrl;
1311
1338
  exports.splitTeamSlug = splitTeamSlug;
1312
- //# sourceMappingURL=GithubEntityProvider-a9e12f36.cjs.js.map
1339
+ //# sourceMappingURL=GithubEntityProvider-89581fab.cjs.js.map