@backstage/plugin-catalog-backend-module-github 0.1.6-next.2 → 0.1.7-next.1

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,46 @@
1
1
  # @backstage/plugin-catalog-backend-module-github
2
2
 
3
+ ## 0.1.7-next.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 287a64bf97: Added the ability to configure the host for the `GitHubEntityProvider` to use against GitHub Enterprise
8
+ - Updated dependencies
9
+ - @backstage/backend-common@0.15.1-next.1
10
+ - @backstage/plugin-catalog-backend@1.4.0-next.1
11
+
12
+ ## 0.1.7-next.0
13
+
14
+ ### Patch Changes
15
+
16
+ - 3c4a388537: New experimental alpha exports for use with the upcoming backend system.
17
+ - bf5e9030eb: Updated dependency `msw` to `^0.45.0`.
18
+ - Updated dependencies
19
+ - @backstage/backend-common@0.15.1-next.0
20
+ - @backstage/backend-tasks@0.3.5-next.0
21
+ - @backstage/plugin-catalog-backend@1.3.2-next.0
22
+ - @backstage/backend-plugin-api@0.1.2-next.0
23
+ - @backstage/integration@1.3.1-next.0
24
+ - @backstage/plugin-catalog-node@1.0.2-next.0
25
+
26
+ ## 0.1.6
27
+
28
+ ### Patch Changes
29
+
30
+ - f48950e34b: Github Entity Provider functionality for adding entities to the catalog.
31
+
32
+ This provider replaces the GithubDiscoveryProcessor functionality as providers offer more flexibility with scheduling ingestion, removing and preventing orphaned entities.
33
+
34
+ More information can be found on the [GitHub Discovery](https://backstage.io/docs/integrations/github/discovery) page.
35
+
36
+ - c59d1ce487: Fixed bug where repository filter was including all archived repositories
37
+ - 97f0a37378: Improved support for wildcards in `catalogPath`
38
+ - Updated dependencies
39
+ - @backstage/backend-common@0.15.0
40
+ - @backstage/integration@1.3.0
41
+ - @backstage/backend-tasks@0.3.4
42
+ - @backstage/plugin-catalog-backend@1.3.1
43
+
3
44
  ## 0.1.6-next.2
4
45
 
5
46
  ### Patch Changes
@@ -0,0 +1,6 @@
1
+ {
2
+ "name": "@backstage/plugin-catalog-backend-module-github",
3
+ "version": "0.1.7-next.1",
4
+ "main": "../dist/index.cjs.js",
5
+ "types": "../dist/index.alpha.d.ts"
6
+ }
@@ -0,0 +1,249 @@
1
+ /**
2
+ * A Backstage catalog backend module that helps integrate towards GitHub
3
+ *
4
+ * @packageDocumentation
5
+ */
6
+
7
+ import { BackendFeature } from '@backstage/backend-plugin-api';
8
+ import { CatalogProcessor } from '@backstage/plugin-catalog-backend';
9
+ import { CatalogProcessorEmit } from '@backstage/plugin-catalog-backend';
10
+ import { Config } from '@backstage/config';
11
+ import { EntityProvider } from '@backstage/plugin-catalog-backend';
12
+ import { EntityProviderConnection } from '@backstage/plugin-catalog-backend';
13
+ import { GithubCredentialsProvider } from '@backstage/integration';
14
+ import { GitHubIntegrationConfig } from '@backstage/integration';
15
+ import { LocationSpec } from '@backstage/plugin-catalog-backend';
16
+ import { Logger } from 'winston';
17
+ import { ScmIntegrationRegistry } from '@backstage/integration';
18
+ import { TaskRunner } from '@backstage/backend-tasks';
19
+ import { TaskScheduleDefinition } from '@backstage/backend-tasks';
20
+
21
+ /**
22
+ * Extracts repositories out of a GitHub org.
23
+ *
24
+ * The following will create locations for all projects which have a catalog-info.yaml
25
+ * on the default branch. The first is shorthand for the second.
26
+ *
27
+ * target: "https://github.com/backstage"
28
+ * or
29
+ * target: https://github.com/backstage/*\/blob/-/catalog-info.yaml
30
+ *
31
+ * You may also explicitly specify the source branch:
32
+ *
33
+ * target: https://github.com/backstage/*\/blob/main/catalog-info.yaml
34
+ *
35
+ * @public
36
+ **/
37
+ export declare class GithubDiscoveryProcessor implements CatalogProcessor {
38
+ private readonly integrations;
39
+ private readonly logger;
40
+ private readonly githubCredentialsProvider;
41
+ static fromConfig(config: Config, options: {
42
+ logger: Logger;
43
+ githubCredentialsProvider?: GithubCredentialsProvider;
44
+ }): GithubDiscoveryProcessor;
45
+ constructor(options: {
46
+ integrations: ScmIntegrationRegistry;
47
+ logger: Logger;
48
+ githubCredentialsProvider?: GithubCredentialsProvider;
49
+ });
50
+ getProcessorName(): string;
51
+ readLocation(location: LocationSpec, _optional: boolean, emit: CatalogProcessorEmit): Promise<boolean>;
52
+ }
53
+
54
+ /**
55
+ * Discovers catalog files located in [GitHub](https://github.com).
56
+ * The provider will search your GitHub account and register catalog files matching the configured path
57
+ * as Location entity and via following processing steps add all contained catalog entities.
58
+ * This can be useful as an alternative to static locations or manually adding things to the catalog.
59
+ *
60
+ * @public
61
+ */
62
+ export declare class GitHubEntityProvider implements EntityProvider {
63
+ private readonly config;
64
+ private readonly logger;
65
+ private readonly integration;
66
+ private readonly scheduleFn;
67
+ private connection?;
68
+ private readonly githubCredentialsProvider;
69
+ static fromConfig(config: Config, options: {
70
+ logger: Logger;
71
+ schedule: TaskRunner;
72
+ }): GitHubEntityProvider[];
73
+ private constructor();
74
+ /** {@inheritdoc @backstage/plugin-catalog-backend#EntityProvider.getProviderName} */
75
+ getProviderName(): string;
76
+ /** {@inheritdoc @backstage/plugin-catalog-backend#EntityProvider.connect} */
77
+ connect(connection: EntityProviderConnection): Promise<void>;
78
+ private createScheduleFn;
79
+ refresh(logger: Logger): Promise<void>;
80
+ private findCatalogFiles;
81
+ private matchesFilters;
82
+ private createLocationUrl;
83
+ private static toLocationSpec;
84
+ }
85
+
86
+ /**
87
+ * Registers the GitHubEntityProvider with the catalog processing extension point.
88
+ *
89
+ * @alpha
90
+ */
91
+ export declare const githubEntityProviderCatalogModule: (options?: GithubEntityProviderCatalogModuleOptions | undefined) => BackendFeature;
92
+
93
+ /**
94
+ * Options for {@link githubEntityProviderCatalogModule}.
95
+ *
96
+ * @alpha
97
+ */
98
+ export declare type GithubEntityProviderCatalogModuleOptions = {
99
+ schedule?: TaskScheduleDefinition;
100
+ };
101
+
102
+ /**
103
+ * The configuration parameters for a multi-org GitHub processor.
104
+ * @public
105
+ */
106
+ export declare type GithubMultiOrgConfig = Array<{
107
+ /**
108
+ * The name of the GitHub org to process.
109
+ */
110
+ name: string;
111
+ /**
112
+ * The namespace of the group created for this org.
113
+ */
114
+ groupNamespace: string;
115
+ /**
116
+ * The namespace of the users created for this org. If not specified defaults to undefined.
117
+ */
118
+ userNamespace: string | undefined;
119
+ }>;
120
+
121
+ /**
122
+ * Extracts teams and users out of a multiple GitHub orgs namespaced per org.
123
+ *
124
+ * Be aware that this processor may not be compatible with future org structures in the catalog.
125
+ *
126
+ * @public
127
+ */
128
+ export declare class GithubMultiOrgReaderProcessor implements CatalogProcessor {
129
+ private readonly integrations;
130
+ private readonly orgs;
131
+ private readonly logger;
132
+ private readonly githubCredentialsProvider;
133
+ static fromConfig(config: Config, options: {
134
+ logger: Logger;
135
+ githubCredentialsProvider?: GithubCredentialsProvider;
136
+ }): GithubMultiOrgReaderProcessor;
137
+ constructor(options: {
138
+ integrations: ScmIntegrationRegistry;
139
+ logger: Logger;
140
+ orgs: GithubMultiOrgConfig;
141
+ githubCredentialsProvider?: GithubCredentialsProvider;
142
+ });
143
+ getProcessorName(): string;
144
+ readLocation(location: LocationSpec, _optional: boolean, emit: CatalogProcessorEmit): Promise<boolean>;
145
+ private getAllOrgs;
146
+ }
147
+
148
+ /**
149
+ * Ingests org data (users and groups) from GitHub.
150
+ *
151
+ * @public
152
+ */
153
+ export declare class GitHubOrgEntityProvider implements EntityProvider {
154
+ private options;
155
+ private readonly credentialsProvider;
156
+ private connection?;
157
+ private scheduleFn?;
158
+ static fromConfig(config: Config, options: GitHubOrgEntityProviderOptions): GitHubOrgEntityProvider;
159
+ constructor(options: {
160
+ id: string;
161
+ orgUrl: string;
162
+ gitHubConfig: GitHubIntegrationConfig;
163
+ logger: Logger;
164
+ githubCredentialsProvider?: GithubCredentialsProvider;
165
+ });
166
+ /** {@inheritdoc @backstage/plugin-catalog-backend#EntityProvider.getProviderName} */
167
+ getProviderName(): string;
168
+ /** {@inheritdoc @backstage/plugin-catalog-backend#EntityProvider.connect} */
169
+ connect(connection: EntityProviderConnection): Promise<void>;
170
+ /**
171
+ * Runs one single complete ingestion. This is only necessary if you use
172
+ * manual scheduling.
173
+ */
174
+ read(options?: {
175
+ logger?: Logger;
176
+ }): Promise<void>;
177
+ private schedule;
178
+ }
179
+
180
+ /**
181
+ * Options for {@link GitHubOrgEntityProvider}.
182
+ *
183
+ * @public
184
+ */
185
+ export declare interface GitHubOrgEntityProviderOptions {
186
+ /**
187
+ * A unique, stable identifier for this provider.
188
+ *
189
+ * @example "production"
190
+ */
191
+ id: string;
192
+ /**
193
+ * The target that this provider should consume.
194
+ *
195
+ * @example "https://github.com/backstage"
196
+ */
197
+ orgUrl: string;
198
+ /**
199
+ * The refresh schedule to use.
200
+ *
201
+ * @defaultValue "manual"
202
+ * @remarks
203
+ *
204
+ * If you pass in 'manual', you are responsible for calling the `read` method
205
+ * manually at some interval.
206
+ *
207
+ * But more commonly you will pass in the result of
208
+ * {@link @backstage/backend-tasks#PluginTaskScheduler.createScheduledTaskRunner}
209
+ * to enable automatic scheduling of tasks.
210
+ */
211
+ schedule?: 'manual' | TaskRunner;
212
+ /**
213
+ * The logger to use.
214
+ */
215
+ logger: Logger;
216
+ /**
217
+ * Optionally supply a custom credentials provider, replacing the default one.
218
+ */
219
+ githubCredentialsProvider?: GithubCredentialsProvider;
220
+ }
221
+
222
+ /**
223
+ * Extracts teams and users out of a GitHub org.
224
+ *
225
+ * @remarks
226
+ *
227
+ * Consider using {@link GitHubOrgEntityProvider} instead.
228
+ *
229
+ * @public
230
+ */
231
+ export declare class GithubOrgReaderProcessor implements CatalogProcessor {
232
+ private readonly integrations;
233
+ private readonly logger;
234
+ private readonly githubCredentialsProvider;
235
+ static fromConfig(config: Config, options: {
236
+ logger: Logger;
237
+ githubCredentialsProvider?: GithubCredentialsProvider;
238
+ }): GithubOrgReaderProcessor;
239
+ constructor(options: {
240
+ integrations: ScmIntegrationRegistry;
241
+ logger: Logger;
242
+ githubCredentialsProvider?: GithubCredentialsProvider;
243
+ });
244
+ getProcessorName(): string;
245
+ readLocation(location: LocationSpec, _optional: boolean, emit: CatalogProcessorEmit): Promise<boolean>;
246
+ private createClient;
247
+ }
248
+
249
+ export { }
@@ -0,0 +1,237 @@
1
+ /**
2
+ * A Backstage catalog backend module that helps integrate towards GitHub
3
+ *
4
+ * @packageDocumentation
5
+ */
6
+
7
+ import { BackendFeature } from '@backstage/backend-plugin-api';
8
+ import { CatalogProcessor } from '@backstage/plugin-catalog-backend';
9
+ import { CatalogProcessorEmit } from '@backstage/plugin-catalog-backend';
10
+ import { Config } from '@backstage/config';
11
+ import { EntityProvider } from '@backstage/plugin-catalog-backend';
12
+ import { EntityProviderConnection } from '@backstage/plugin-catalog-backend';
13
+ import { GithubCredentialsProvider } from '@backstage/integration';
14
+ import { GitHubIntegrationConfig } from '@backstage/integration';
15
+ import { LocationSpec } from '@backstage/plugin-catalog-backend';
16
+ import { Logger } from 'winston';
17
+ import { ScmIntegrationRegistry } from '@backstage/integration';
18
+ import { TaskRunner } from '@backstage/backend-tasks';
19
+ import { TaskScheduleDefinition } from '@backstage/backend-tasks';
20
+
21
+ /**
22
+ * Extracts repositories out of a GitHub org.
23
+ *
24
+ * The following will create locations for all projects which have a catalog-info.yaml
25
+ * on the default branch. The first is shorthand for the second.
26
+ *
27
+ * target: "https://github.com/backstage"
28
+ * or
29
+ * target: https://github.com/backstage/*\/blob/-/catalog-info.yaml
30
+ *
31
+ * You may also explicitly specify the source branch:
32
+ *
33
+ * target: https://github.com/backstage/*\/blob/main/catalog-info.yaml
34
+ *
35
+ * @public
36
+ **/
37
+ export declare class GithubDiscoveryProcessor implements CatalogProcessor {
38
+ private readonly integrations;
39
+ private readonly logger;
40
+ private readonly githubCredentialsProvider;
41
+ static fromConfig(config: Config, options: {
42
+ logger: Logger;
43
+ githubCredentialsProvider?: GithubCredentialsProvider;
44
+ }): GithubDiscoveryProcessor;
45
+ constructor(options: {
46
+ integrations: ScmIntegrationRegistry;
47
+ logger: Logger;
48
+ githubCredentialsProvider?: GithubCredentialsProvider;
49
+ });
50
+ getProcessorName(): string;
51
+ readLocation(location: LocationSpec, _optional: boolean, emit: CatalogProcessorEmit): Promise<boolean>;
52
+ }
53
+
54
+ /**
55
+ * Discovers catalog files located in [GitHub](https://github.com).
56
+ * The provider will search your GitHub account and register catalog files matching the configured path
57
+ * as Location entity and via following processing steps add all contained catalog entities.
58
+ * This can be useful as an alternative to static locations or manually adding things to the catalog.
59
+ *
60
+ * @public
61
+ */
62
+ export declare class GitHubEntityProvider implements EntityProvider {
63
+ private readonly config;
64
+ private readonly logger;
65
+ private readonly integration;
66
+ private readonly scheduleFn;
67
+ private connection?;
68
+ private readonly githubCredentialsProvider;
69
+ static fromConfig(config: Config, options: {
70
+ logger: Logger;
71
+ schedule: TaskRunner;
72
+ }): GitHubEntityProvider[];
73
+ private constructor();
74
+ /** {@inheritdoc @backstage/plugin-catalog-backend#EntityProvider.getProviderName} */
75
+ getProviderName(): string;
76
+ /** {@inheritdoc @backstage/plugin-catalog-backend#EntityProvider.connect} */
77
+ connect(connection: EntityProviderConnection): Promise<void>;
78
+ private createScheduleFn;
79
+ refresh(logger: Logger): Promise<void>;
80
+ private findCatalogFiles;
81
+ private matchesFilters;
82
+ private createLocationUrl;
83
+ private static toLocationSpec;
84
+ }
85
+
86
+ /* Excluded from this release type: githubEntityProviderCatalogModule */
87
+
88
+ /* Excluded from this release type: GithubEntityProviderCatalogModuleOptions */
89
+
90
+ /**
91
+ * The configuration parameters for a multi-org GitHub processor.
92
+ * @public
93
+ */
94
+ export declare type GithubMultiOrgConfig = Array<{
95
+ /**
96
+ * The name of the GitHub org to process.
97
+ */
98
+ name: string;
99
+ /**
100
+ * The namespace of the group created for this org.
101
+ */
102
+ groupNamespace: string;
103
+ /**
104
+ * The namespace of the users created for this org. If not specified defaults to undefined.
105
+ */
106
+ userNamespace: string | undefined;
107
+ }>;
108
+
109
+ /**
110
+ * Extracts teams and users out of a multiple GitHub orgs namespaced per org.
111
+ *
112
+ * Be aware that this processor may not be compatible with future org structures in the catalog.
113
+ *
114
+ * @public
115
+ */
116
+ export declare class GithubMultiOrgReaderProcessor implements CatalogProcessor {
117
+ private readonly integrations;
118
+ private readonly orgs;
119
+ private readonly logger;
120
+ private readonly githubCredentialsProvider;
121
+ static fromConfig(config: Config, options: {
122
+ logger: Logger;
123
+ githubCredentialsProvider?: GithubCredentialsProvider;
124
+ }): GithubMultiOrgReaderProcessor;
125
+ constructor(options: {
126
+ integrations: ScmIntegrationRegistry;
127
+ logger: Logger;
128
+ orgs: GithubMultiOrgConfig;
129
+ githubCredentialsProvider?: GithubCredentialsProvider;
130
+ });
131
+ getProcessorName(): string;
132
+ readLocation(location: LocationSpec, _optional: boolean, emit: CatalogProcessorEmit): Promise<boolean>;
133
+ private getAllOrgs;
134
+ }
135
+
136
+ /**
137
+ * Ingests org data (users and groups) from GitHub.
138
+ *
139
+ * @public
140
+ */
141
+ export declare class GitHubOrgEntityProvider implements EntityProvider {
142
+ private options;
143
+ private readonly credentialsProvider;
144
+ private connection?;
145
+ private scheduleFn?;
146
+ static fromConfig(config: Config, options: GitHubOrgEntityProviderOptions): GitHubOrgEntityProvider;
147
+ constructor(options: {
148
+ id: string;
149
+ orgUrl: string;
150
+ gitHubConfig: GitHubIntegrationConfig;
151
+ logger: Logger;
152
+ githubCredentialsProvider?: GithubCredentialsProvider;
153
+ });
154
+ /** {@inheritdoc @backstage/plugin-catalog-backend#EntityProvider.getProviderName} */
155
+ getProviderName(): string;
156
+ /** {@inheritdoc @backstage/plugin-catalog-backend#EntityProvider.connect} */
157
+ connect(connection: EntityProviderConnection): Promise<void>;
158
+ /**
159
+ * Runs one single complete ingestion. This is only necessary if you use
160
+ * manual scheduling.
161
+ */
162
+ read(options?: {
163
+ logger?: Logger;
164
+ }): Promise<void>;
165
+ private schedule;
166
+ }
167
+
168
+ /**
169
+ * Options for {@link GitHubOrgEntityProvider}.
170
+ *
171
+ * @public
172
+ */
173
+ export declare interface GitHubOrgEntityProviderOptions {
174
+ /**
175
+ * A unique, stable identifier for this provider.
176
+ *
177
+ * @example "production"
178
+ */
179
+ id: string;
180
+ /**
181
+ * The target that this provider should consume.
182
+ *
183
+ * @example "https://github.com/backstage"
184
+ */
185
+ orgUrl: string;
186
+ /**
187
+ * The refresh schedule to use.
188
+ *
189
+ * @defaultValue "manual"
190
+ * @remarks
191
+ *
192
+ * If you pass in 'manual', you are responsible for calling the `read` method
193
+ * manually at some interval.
194
+ *
195
+ * But more commonly you will pass in the result of
196
+ * {@link @backstage/backend-tasks#PluginTaskScheduler.createScheduledTaskRunner}
197
+ * to enable automatic scheduling of tasks.
198
+ */
199
+ schedule?: 'manual' | TaskRunner;
200
+ /**
201
+ * The logger to use.
202
+ */
203
+ logger: Logger;
204
+ /**
205
+ * Optionally supply a custom credentials provider, replacing the default one.
206
+ */
207
+ githubCredentialsProvider?: GithubCredentialsProvider;
208
+ }
209
+
210
+ /**
211
+ * Extracts teams and users out of a GitHub org.
212
+ *
213
+ * @remarks
214
+ *
215
+ * Consider using {@link GitHubOrgEntityProvider} instead.
216
+ *
217
+ * @public
218
+ */
219
+ export declare class GithubOrgReaderProcessor implements CatalogProcessor {
220
+ private readonly integrations;
221
+ private readonly logger;
222
+ private readonly githubCredentialsProvider;
223
+ static fromConfig(config: Config, options: {
224
+ logger: Logger;
225
+ githubCredentialsProvider?: GithubCredentialsProvider;
226
+ }): GithubOrgReaderProcessor;
227
+ constructor(options: {
228
+ integrations: ScmIntegrationRegistry;
229
+ logger: Logger;
230
+ githubCredentialsProvider?: GithubCredentialsProvider;
231
+ });
232
+ getProcessorName(): string;
233
+ readLocation(location: LocationSpec, _optional: boolean, emit: CatalogProcessorEmit): Promise<boolean>;
234
+ private createClient;
235
+ }
236
+
237
+ export { }
package/dist/index.cjs.js CHANGED
@@ -8,6 +8,8 @@ var graphql = require('@octokit/graphql');
8
8
  var uuid = require('uuid');
9
9
  var catalogModel = require('@backstage/catalog-model');
10
10
  var lodash = require('lodash');
11
+ var backendPluginApi = require('@backstage/backend-plugin-api');
12
+ var pluginCatalogNode = require('@backstage/plugin-catalog-node');
11
13
 
12
14
  function _interopNamespace(e) {
13
15
  if (e && e.__esModule) return e;
@@ -590,15 +592,17 @@ function readProviderConfigs(config) {
590
592
  });
591
593
  }
592
594
  function readProviderConfig(id, config) {
593
- var _a;
595
+ var _a, _b;
594
596
  const organization = config.getString("organization");
595
597
  const catalogPath = (_a = config.getOptionalString("catalogPath")) != null ? _a : DEFAULT_CATALOG_PATH;
598
+ const host = (_b = config.getOptionalString("host")) != null ? _b : "github.com";
596
599
  const repositoryPattern = config.getOptionalString("filters.repository");
597
600
  const branchPattern = config.getOptionalString("filters.branch");
598
601
  return {
599
602
  id,
600
603
  catalogPath,
601
604
  organization,
605
+ host,
602
606
  filters: {
603
607
  repository: repositoryPattern ? compileRegExp(repositoryPattern) : void 0,
604
608
  branch: branchPattern || void 0
@@ -619,20 +623,21 @@ function compileRegExp(pattern) {
619
623
  class GitHubEntityProvider {
620
624
  static fromConfig(config, options) {
621
625
  const integrations = integration.ScmIntegrations.fromConfig(config);
622
- const integration$1 = integrations.github.byHost("github.com");
623
- if (!integration$1) {
624
- throw new Error(
625
- `There is no GitHub config that matches github. Please add a configuration entry for it under integrations.github`
626
- );
627
- }
628
- return readProviderConfigs(config).map(
629
- (providerConfig) => new GitHubEntityProvider(
626
+ return readProviderConfigs(config).map((providerConfig) => {
627
+ const integrationHost = providerConfig.host;
628
+ const integration = integrations.github.byHost(integrationHost);
629
+ if (!integration) {
630
+ throw new Error(
631
+ `There is no GitHub config that matches host ${integrationHost}. Please add a configuration entry for it under integrations.github`
632
+ );
633
+ }
634
+ return new GitHubEntityProvider(
630
635
  providerConfig,
631
- integration$1,
636
+ integration,
632
637
  options.logger,
633
638
  options.schedule
634
- )
635
- );
639
+ );
640
+ });
636
641
  }
637
642
  constructor(config, integration$1, logger, schedule) {
638
643
  this.config = config;
@@ -713,7 +718,7 @@ class GitHubEntityProvider {
713
718
  const repositoryFilter = (_a = this.config.filters) == null ? void 0 : _a.repository;
714
719
  const matchingRepositories = repositories.filter((r) => {
715
720
  var _a2;
716
- return !r.isArchived && repositoryFilter ? repositoryFilter == null ? void 0 : repositoryFilter.test(r.name) : (_a2 = r.defaultBranchRef) == null ? void 0 : _a2.name;
721
+ return !r.isArchived && (!repositoryFilter || repositoryFilter.test(r.name)) && ((_a2 = r.defaultBranchRef) == null ? void 0 : _a2.name);
717
722
  });
718
723
  return matchingRepositories;
719
724
  }
@@ -859,9 +864,39 @@ function withLocations(baseUrl, org, entity) {
859
864
  );
860
865
  }
861
866
 
867
+ const githubEntityProviderCatalogModule = backendPluginApi.createBackendModule({
868
+ pluginId: "catalog",
869
+ moduleId: "github-entity-provider",
870
+ register(env, options) {
871
+ env.registerInit({
872
+ deps: {
873
+ config: backendPluginApi.configServiceRef,
874
+ catalog: pluginCatalogNode.catalogProcessingExtensionPoint,
875
+ logger: backendPluginApi.loggerServiceRef,
876
+ scheduler: backendPluginApi.schedulerServiceRef
877
+ },
878
+ async init({ config, catalog, logger, scheduler }) {
879
+ var _a;
880
+ const scheduleDef = (_a = options == null ? void 0 : options.schedule) != null ? _a : {
881
+ frequency: { seconds: 600 },
882
+ timeout: { seconds: 900 },
883
+ initialDelay: { seconds: 3 }
884
+ };
885
+ catalog.addEntityProvider(
886
+ GitHubEntityProvider.fromConfig(config, {
887
+ logger: backendPluginApi.loggerToWinstonLogger(logger),
888
+ schedule: scheduler.createScheduledTaskRunner(scheduleDef)
889
+ })
890
+ );
891
+ }
892
+ });
893
+ }
894
+ });
895
+
862
896
  exports.GitHubEntityProvider = GitHubEntityProvider;
863
897
  exports.GitHubOrgEntityProvider = GitHubOrgEntityProvider;
864
898
  exports.GithubDiscoveryProcessor = GithubDiscoveryProcessor;
865
899
  exports.GithubMultiOrgReaderProcessor = GithubMultiOrgReaderProcessor;
866
900
  exports.GithubOrgReaderProcessor = GithubOrgReaderProcessor;
901
+ exports.githubEntityProviderCatalogModule = githubEntityProviderCatalogModule;
867
902
  //# sourceMappingURL=index.cjs.js.map