@backstage/plugin-catalog-backend 0.0.0-nightly-20250114022708 → 0.0.0-nightly-20250116022939

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,32 +1,46 @@
1
1
  # @backstage/plugin-catalog-backend
2
2
 
3
- ## 0.0.0-nightly-20250114022708
3
+ ## 0.0.0-nightly-20250116022939
4
4
 
5
5
  ### Minor Changes
6
6
 
7
- - dd515e3: Removed the long-deprecated `DefaultCatalogCollatorFactory` and `DefaultCatalogCollatorFactoryOptions` exports, which now no longer exist in the search plugin's offerings. If you were using these, you want to migrate to [the new backend system](https://backstage.io/docs/backend-system/) and use the [catalog collator](https://backstage.io/docs/features/search/collators#catalog) directly.
7
+ - 8805f93: The catalog backend now supports the new `PermissionsRegistryService`, which can be used to add custom permission rules.
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+ - @backstage/plugin-permission-node@0.0.0-nightly-20250116022939
13
+ - @backstage/plugin-catalog-node@0.0.0-nightly-20250116022939
14
+ - @backstage/backend-plugin-api@0.0.0-nightly-20250116022939
15
+ - @backstage/plugin-events-node@0.0.0-nightly-20250116022939
16
+ - @backstage/plugin-search-backend-module-catalog@0.0.0-nightly-20250116022939
17
+ - @backstage/backend-openapi-utils@0.0.0-nightly-20250116022939
18
+
19
+ ## 1.30.0
8
20
 
9
21
  ### Patch Changes
10
22
 
11
23
  - d9d62ef: Remove some internal usages of the backend-common package
12
24
  - 8379bf4: Remove usages of `PluginDatabaseManager` and `PluginEndpointDiscovery` and replace with their equivalent service types
13
25
  - be0aae7: Improved concurrency of the `entities` endpoint when using the streamed query mode behind the `catalog.disableRelationsCompatibility` flag.
26
+ - dd515e3: Internalize the deprecated collator types since they were removed from the collator itself during new-backend-system migration.
14
27
  - 3d475a0: Updated condition in `resolveCodeOwner` to fix a bug where `normalizeCodeOwner` could potentially be called with an invalid argument causing an error in `CodeOwnersProcessor`
15
28
  - Updated dependencies
16
- - @backstage/plugin-search-backend-module-catalog@0.0.0-nightly-20250114022708
17
- - @backstage/types@0.0.0-nightly-20250114022708
18
- - @backstage/plugin-permission-node@0.0.0-nightly-20250114022708
19
- - @backstage/backend-openapi-utils@0.0.0-nightly-20250114022708
20
- - @backstage/backend-plugin-api@0.0.0-nightly-20250114022708
21
- - @backstage/catalog-client@0.0.0-nightly-20250114022708
22
- - @backstage/catalog-model@0.0.0-nightly-20250114022708
23
- - @backstage/config@0.0.0-nightly-20250114022708
24
- - @backstage/errors@0.0.0-nightly-20250114022708
25
- - @backstage/integration@0.0.0-nightly-20250114022708
26
- - @backstage/plugin-catalog-common@0.0.0-nightly-20250114022708
27
- - @backstage/plugin-catalog-node@0.0.0-nightly-20250114022708
28
- - @backstage/plugin-events-node@0.0.0-nightly-20250114022708
29
- - @backstage/plugin-permission-common@0.0.0-nightly-20250114022708
29
+ - @backstage/plugin-search-backend-module-catalog@0.3.0
30
+ - @backstage/types@1.2.1
31
+ - @backstage/plugin-permission-node@0.8.7
32
+ - @backstage/integration@1.16.1
33
+ - @backstage/backend-openapi-utils@0.4.1
34
+ - @backstage/backend-plugin-api@1.1.1
35
+ - @backstage/catalog-client@1.9.1
36
+ - @backstage/catalog-model@1.7.3
37
+ - @backstage/config@1.3.2
38
+ - @backstage/errors@1.2.7
39
+ - @backstage/plugin-catalog-common@1.1.3
40
+ - @backstage/plugin-catalog-node@1.15.1
41
+ - @backstage/plugin-events-node@0.4.7
42
+ - @backstage/plugin-permission-common@0.8.4
43
+ - @backstage/plugin-search-common@1.2.17
30
44
 
31
45
  ## 1.30.0-next.1
32
46
 
@@ -1,13 +1,150 @@
1
1
  'use strict';
2
2
 
3
+ var backendCommon = require('@backstage/backend-common');
4
+ var catalogClient = require('@backstage/catalog-client');
5
+ var catalogModel = require('@backstage/catalog-model');
6
+ var alpha = require('@backstage/plugin-catalog-common/alpha');
3
7
  var pluginCatalogNode = require('@backstage/plugin-catalog-node');
4
8
  var pluginSearchBackendModuleCatalog = require('@backstage/plugin-search-backend-module-catalog');
9
+ var stream = require('stream');
5
10
 
6
11
  const locationSpecToMetadataName = pluginCatalogNode.locationSpecToMetadataName;
7
12
  const locationSpecToLocationEntity = pluginCatalogNode.locationSpecToLocationEntity;
8
13
  const processingResult = pluginCatalogNode.processingResult;
14
+ var search;
15
+ ((search2) => {
16
+ const configKey = "search.collators.catalog";
17
+ const defaults = {
18
+ schedule: {
19
+ frequency: { minutes: 10 },
20
+ timeout: { minutes: 15 },
21
+ initialDelay: { seconds: 3 }
22
+ },
23
+ collatorOptions: {
24
+ locationTemplate: "/catalog/:namespace/:kind/:name",
25
+ filter: void 0,
26
+ batchSize: 500
27
+ }
28
+ };
29
+ search2.readCollatorConfigOptions = (configRoot) => {
30
+ const config = configRoot.getOptionalConfig(configKey);
31
+ if (!config) {
32
+ return defaults.collatorOptions;
33
+ }
34
+ return {
35
+ locationTemplate: config.getOptionalString("locationTemplate") ?? defaults.collatorOptions.locationTemplate,
36
+ filter: config.getOptional("filter") ?? defaults.collatorOptions.filter,
37
+ batchSize: config.getOptionalNumber("batchSize") ?? defaults.collatorOptions.batchSize
38
+ };
39
+ };
40
+ search2.getDocumentText = (entity) => {
41
+ const documentTexts = [];
42
+ if (entity.metadata.description) {
43
+ documentTexts.push(entity.metadata.description);
44
+ }
45
+ if (catalogModel.isUserEntity(entity) || catalogModel.isGroupEntity(entity)) {
46
+ if (entity.spec?.profile?.displayName) {
47
+ documentTexts.push(entity.spec.profile.displayName);
48
+ }
49
+ }
50
+ if (catalogModel.isUserEntity(entity)) {
51
+ if (entity.spec?.profile?.email) {
52
+ documentTexts.push(entity.spec.profile.email);
53
+ }
54
+ }
55
+ return documentTexts.join(" : ");
56
+ };
57
+ })(search || (search = {}));
9
58
  const defaultCatalogCollatorEntityTransformer = pluginSearchBackendModuleCatalog.defaultCatalogCollatorEntityTransformer;
59
+ class DefaultCatalogCollatorFactory {
60
+ type = "software-catalog";
61
+ visibilityPermission = alpha.catalogEntityReadPermission;
62
+ locationTemplate;
63
+ filter;
64
+ batchSize;
65
+ catalogClient;
66
+ entityTransformer;
67
+ auth;
68
+ static fromConfig(configRoot, options) {
69
+ const configOptions = search.readCollatorConfigOptions(configRoot);
70
+ const { auth: adaptedAuth } = backendCommon.createLegacyAuthAdapters({
71
+ auth: options.auth,
72
+ discovery: options.discovery,
73
+ tokenManager: options.tokenManager
74
+ });
75
+ return new DefaultCatalogCollatorFactory({
76
+ locationTemplate: options.locationTemplate ?? configOptions.locationTemplate,
77
+ filter: options.filter ?? configOptions.filter,
78
+ batchSize: options.batchSize ?? configOptions.batchSize,
79
+ entityTransformer: options.entityTransformer,
80
+ auth: adaptedAuth,
81
+ discovery: options.discovery,
82
+ catalogClient: options.catalogClient
83
+ });
84
+ }
85
+ constructor(options) {
86
+ const {
87
+ auth,
88
+ batchSize,
89
+ discovery,
90
+ locationTemplate,
91
+ filter,
92
+ catalogClient: catalogClient$1,
93
+ entityTransformer
94
+ } = options;
95
+ this.locationTemplate = locationTemplate;
96
+ this.filter = filter;
97
+ this.batchSize = batchSize;
98
+ this.catalogClient = catalogClient$1 || new catalogClient.CatalogClient({ discoveryApi: discovery });
99
+ this.entityTransformer = entityTransformer ?? defaultCatalogCollatorEntityTransformer;
100
+ this.auth = auth;
101
+ }
102
+ async getCollator() {
103
+ return stream.Readable.from(this.execute());
104
+ }
105
+ async *execute() {
106
+ let entitiesRetrieved = 0;
107
+ let cursor = void 0;
108
+ do {
109
+ const { token } = await this.auth.getPluginRequestToken({
110
+ onBehalfOf: await this.auth.getOwnServiceCredentials(),
111
+ targetPluginId: "catalog"
112
+ });
113
+ const response = await this.catalogClient.queryEntities(
114
+ {
115
+ filter: this.filter,
116
+ limit: this.batchSize,
117
+ ...cursor ? { cursor } : {}
118
+ },
119
+ { token }
120
+ );
121
+ cursor = response.pageInfo.nextCursor;
122
+ entitiesRetrieved += response.items.length;
123
+ for (const entity of response.items) {
124
+ yield {
125
+ ...this.entityTransformer(entity),
126
+ authorization: {
127
+ resourceRef: catalogModel.stringifyEntityRef(entity)
128
+ },
129
+ location: this.applyArgsToFormat(this.locationTemplate, {
130
+ namespace: entity.metadata.namespace || "default",
131
+ kind: entity.kind,
132
+ name: entity.metadata.name
133
+ })
134
+ };
135
+ }
136
+ } while (cursor);
137
+ }
138
+ applyArgsToFormat(format, args) {
139
+ let formatted = format;
140
+ for (const [key, value] of Object.entries(args)) {
141
+ formatted = formatted.replace(`:${key}`, value);
142
+ }
143
+ return formatted.toLowerCase();
144
+ }
145
+ }
10
146
 
147
+ exports.DefaultCatalogCollatorFactory = DefaultCatalogCollatorFactory;
11
148
  exports.defaultCatalogCollatorEntityTransformer = defaultCatalogCollatorEntityTransformer;
12
149
  exports.locationSpecToLocationEntity = locationSpecToLocationEntity;
13
150
  exports.locationSpecToMetadataName = locationSpecToMetadataName;
@@ -1 +1 @@
1
- {"version":3,"file":"deprecated.cjs.js","sources":["../src/deprecated.ts"],"sourcesContent":["/*\n * Copyright 2023 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 type AnalyzeLocationEntityField as _AnalyzeLocationEntityField,\n type AnalyzeLocationExistingEntity as _AnalyzeLocationExistingEntity,\n type AnalyzeLocationGenerateEntity as _AnalyzeLocationGenerateEntity,\n type AnalyzeLocationRequest as _AnalyzeLocationRequest,\n type AnalyzeLocationResponse as _AnalyzeLocationResponse,\n type LocationSpec as _LocationSpec,\n} from '@backstage/plugin-catalog-common';\nimport {\n locationSpecToMetadataName as _locationSpecToMetadataName,\n locationSpecToLocationEntity as _locationSpecToLocationEntity,\n processingResult as _processingResult,\n type EntitiesSearchFilter as _EntitiesSearchFilter,\n type EntityFilter as _EntityFilter,\n type DeferredEntity as _DeferredEntity,\n type EntityRelationSpec as _EntityRelationSpec,\n type CatalogProcessor as _CatalogProcessor,\n type CatalogProcessorParser as _CatalogProcessorParser,\n type CatalogProcessorCache as _CatalogProcessorCache,\n type CatalogProcessorEmit as _CatalogProcessorEmit,\n type CatalogProcessorLocationResult as _CatalogProcessorLocationResult,\n type CatalogProcessorEntityResult as _CatalogProcessorEntityResult,\n type CatalogProcessorRelationResult as _CatalogProcessorRelationResult,\n type CatalogProcessorErrorResult as _CatalogProcessorErrorResult,\n type CatalogProcessorRefreshKeysResult as _CatalogProcessorRefreshKeysResult,\n type CatalogProcessorResult as _CatalogProcessorResult,\n type EntityProvider as _EntityProvider,\n type EntityProviderConnection as _EntityProviderConnection,\n type EntityProviderMutation as _EntityProviderMutation,\n type AnalyzeOptions as _AnalyzeOptions,\n type PlaceholderResolver as _PlaceholderResolver,\n type PlaceholderResolverParams as _PlaceholderResolverParams,\n type PlaceholderResolverRead as _PlaceholderResolverRead,\n type PlaceholderResolverResolveUrl as _PlaceholderResolverResolveUrl,\n type LocationAnalyzer as _LocationAnalyzer,\n type ScmLocationAnalyzer as _ScmLocationAnalyzer,\n} from '@backstage/plugin-catalog-node';\nimport {\n defaultCatalogCollatorEntityTransformer as _defaultCatalogCollatorEntityTransformer,\n type CatalogCollatorEntityTransformer as _CatalogCollatorEntityTransformer,\n} from '@backstage/plugin-search-backend-module-catalog';\n\n/**\n * @public\n * @deprecated import from `@backstage/plugin-catalog-node` instead\n */\nexport const locationSpecToMetadataName = _locationSpecToMetadataName;\n/**\n * @public\n * @deprecated import from `@backstage/plugin-catalog-node` instead\n */\nexport const locationSpecToLocationEntity = _locationSpecToLocationEntity;\n/**\n * @public\n * @deprecated import from `@backstage/plugin-catalog-node` instead\n */\nexport const processingResult = _processingResult;\n/**\n * @public\n * @deprecated import from `@backstage/plugin-catalog-node` instead\n */\nexport type EntitiesSearchFilter = _EntitiesSearchFilter;\n/**\n * @public\n * @deprecated import from `@backstage/plugin-catalog-node` instead\n */\nexport type EntityFilter = _EntityFilter;\n/**\n * @public\n * @deprecated import from `@backstage/plugin-catalog-node` instead\n */\nexport type DeferredEntity = _DeferredEntity;\n/**\n * @public\n * @deprecated import from `@backstage/plugin-catalog-node` instead\n */\nexport type EntityRelationSpec = _EntityRelationSpec;\n/**\n * @public\n * @deprecated import from `@backstage/plugin-catalog-node` instead\n */\nexport type CatalogProcessor = _CatalogProcessor;\n/**\n * @public\n * @deprecated import from `@backstage/plugin-catalog-node` instead\n */\nexport type CatalogProcessorParser = _CatalogProcessorParser;\n/**\n * @public\n * @deprecated import from `@backstage/plugin-catalog-node` instead\n */\nexport type CatalogProcessorCache = _CatalogProcessorCache;\n/**\n * @public\n * @deprecated import from `@backstage/plugin-catalog-node` instead\n */\nexport type CatalogProcessorEmit = _CatalogProcessorEmit;\n/**\n * @public\n * @deprecated import from `@backstage/plugin-catalog-node` instead\n */\nexport type CatalogProcessorLocationResult = _CatalogProcessorLocationResult;\n/**\n * @public\n * @deprecated import from `@backstage/plugin-catalog-node` instead\n */\nexport type CatalogProcessorEntityResult = _CatalogProcessorEntityResult;\n/**\n * @public\n * @deprecated import from `@backstage/plugin-catalog-node` instead\n */\nexport type CatalogProcessorRelationResult = _CatalogProcessorRelationResult;\n/**\n * @public\n * @deprecated import from `@backstage/plugin-catalog-node` instead\n */\nexport type CatalogProcessorErrorResult = _CatalogProcessorErrorResult;\n/**\n * @public\n * @deprecated import from `@backstage/plugin-catalog-node` instead\n */\nexport type CatalogProcessorRefreshKeysResult =\n _CatalogProcessorRefreshKeysResult;\n/**\n * @public\n * @deprecated import from `@backstage/plugin-catalog-node` instead\n */\nexport type CatalogProcessorResult = _CatalogProcessorResult;\n/**\n * @public\n * @deprecated import from `@backstage/plugin-catalog-node` instead\n */\nexport type EntityProvider = _EntityProvider;\n/**\n * @public\n * @deprecated import from `@backstage/plugin-catalog-node` instead\n */\nexport type EntityProviderConnection = _EntityProviderConnection;\n/**\n * @public\n * @deprecated import from `@backstage/plugin-catalog-node` instead\n */\nexport type EntityProviderMutation = _EntityProviderMutation;\n\n/**\n * Holds the entity location information.\n *\n * @remarks\n *\n * `presence` flag: when using repo importer plugin, location is being created before the component yaml file is merged to the main branch.\n * This flag is then set to indicate that the file can be not present.\n * default value: 'required'.\n *\n * @public\n * @deprecated use the same type from `@backstage/plugin-catalog-common` instead\n */\nexport type LocationSpec = _LocationSpec;\n/**\n * @public\n * @deprecated import from `@backstage/plugin-catalog-node` instead\n */\nexport type AnalyzeOptions = _AnalyzeOptions;\n/**\n * @public\n * @deprecated import from `@backstage/plugin-catalog-node` instead\n */\nexport type LocationAnalyzer = _LocationAnalyzer;\n/**\n * @public\n * @deprecated import from `@backstage/plugin-catalog-node` instead\n */\nexport type ScmLocationAnalyzer = _ScmLocationAnalyzer;\n\n/**\n * @public\n * @deprecated import from `@backstage/plugin-catalog-node` instead\n */\nexport type PlaceholderResolver = _PlaceholderResolver;\n\n/**\n * @public\n * @deprecated import from `@backstage/plugin-catalog-node` instead\n */\nexport type PlaceholderResolverParams = _PlaceholderResolverParams;\n\n/**\n * @public\n * @deprecated import from `@backstage/plugin-catalog-node` instead\n */\nexport type PlaceholderResolverRead = _PlaceholderResolverRead;\n\n/**\n * @public\n * @deprecated import from `@backstage/plugin-catalog-node` instead\n */\nexport type PlaceholderResolverResolveUrl = _PlaceholderResolverResolveUrl;\n\n/**\n * @public\n * @deprecated use the same type from `@backstage/plugin-catalog-common` instead\n */\nexport type AnalyzeLocationRequest = _AnalyzeLocationRequest;\n/**\n * @public\n * @deprecated use the same type from `@backstage/plugin-catalog-common` instead\n */\nexport type AnalyzeLocationResponse = _AnalyzeLocationResponse;\n\n/**\n * If the folder pointed to already contained catalog info yaml files, they are\n * read and emitted like this so that the frontend can inform the user that it\n * located them and can make sure to register them as well if they weren't\n * already\n * @public\n * @deprecated use the same type from `@backstage/plugin-catalog-common` instead\n */\nexport type AnalyzeLocationExistingEntity = _AnalyzeLocationExistingEntity;\n/**\n * This is some form of representation of what the analyzer could deduce.\n * We should probably have a chat about how this can best be conveyed to\n * the frontend. It'll probably contain a (possibly incomplete) entity, plus\n * enough info for the frontend to know what form data to show to the user\n * for overriding/completing the info.\n * @public\n * @deprecated use the same type from `@backstage/plugin-catalog-common` instead\n */\nexport type AnalyzeLocationGenerateEntity = _AnalyzeLocationGenerateEntity;\n\n/**\n *\n * This is where I get really vague. Something like this perhaps? Or it could be\n * something like a json-schema that contains enough info for the frontend to\n * be able to present a form and explanations\n * @public\n * @deprecated use the same type from `@backstage/plugin-catalog-common` instead\n */\nexport type AnalyzeLocationEntityField = _AnalyzeLocationEntityField;\n\n/**\n * @public\n * @deprecated import from `@backstage/plugin-search-backend-module-catalog` instead\n */\nexport const defaultCatalogCollatorEntityTransformer =\n _defaultCatalogCollatorEntityTransformer;\n\n/**\n * @public\n * @deprecated import from `@backstage/plugin-search-backend-module-catalog` instead\n */\nexport type CatalogCollatorEntityTransformer =\n _CatalogCollatorEntityTransformer;\n"],"names":["_locationSpecToMetadataName","_locationSpecToLocationEntity","_processingResult","_defaultCatalogCollatorEntityTransformer"],"mappings":";;;;;AA8DO,MAAM,0BAA6B,GAAAA;AAKnC,MAAM,4BAA+B,GAAAC;AAKrC,MAAM,gBAAmB,GAAAC;AA0LzB,MAAM,uCACX,GAAAC;;;;;;;"}
1
+ {"version":3,"file":"deprecated.cjs.js","sources":["../src/deprecated.ts"],"sourcesContent":["/*\n * Copyright 2023 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 TokenManager,\n createLegacyAuthAdapters,\n} from '@backstage/backend-common';\nimport { AuthService, DiscoveryService } from '@backstage/backend-plugin-api';\nimport {\n CatalogApi,\n CatalogClient,\n EntityFilterQuery,\n GetEntitiesRequest,\n} from '@backstage/catalog-client';\nimport {\n Entity,\n isGroupEntity,\n isUserEntity,\n stringifyEntityRef,\n} from '@backstage/catalog-model';\nimport { Config } from '@backstage/config';\nimport {\n CatalogEntityDocument,\n type AnalyzeLocationEntityField as _AnalyzeLocationEntityField,\n type AnalyzeLocationExistingEntity as _AnalyzeLocationExistingEntity,\n type AnalyzeLocationGenerateEntity as _AnalyzeLocationGenerateEntity,\n type AnalyzeLocationRequest as _AnalyzeLocationRequest,\n type AnalyzeLocationResponse as _AnalyzeLocationResponse,\n type LocationSpec as _LocationSpec,\n} from '@backstage/plugin-catalog-common';\nimport { catalogEntityReadPermission } from '@backstage/plugin-catalog-common/alpha';\nimport {\n locationSpecToMetadataName as _locationSpecToMetadataName,\n locationSpecToLocationEntity as _locationSpecToLocationEntity,\n processingResult as _processingResult,\n type EntitiesSearchFilter as _EntitiesSearchFilter,\n type EntityFilter as _EntityFilter,\n type DeferredEntity as _DeferredEntity,\n type EntityRelationSpec as _EntityRelationSpec,\n type CatalogProcessor as _CatalogProcessor,\n type CatalogProcessorParser as _CatalogProcessorParser,\n type CatalogProcessorCache as _CatalogProcessorCache,\n type CatalogProcessorEmit as _CatalogProcessorEmit,\n type CatalogProcessorLocationResult as _CatalogProcessorLocationResult,\n type CatalogProcessorEntityResult as _CatalogProcessorEntityResult,\n type CatalogProcessorRelationResult as _CatalogProcessorRelationResult,\n type CatalogProcessorErrorResult as _CatalogProcessorErrorResult,\n type CatalogProcessorRefreshKeysResult as _CatalogProcessorRefreshKeysResult,\n type CatalogProcessorResult as _CatalogProcessorResult,\n type EntityProvider as _EntityProvider,\n type EntityProviderConnection as _EntityProviderConnection,\n type EntityProviderMutation as _EntityProviderMutation,\n type AnalyzeOptions as _AnalyzeOptions,\n type PlaceholderResolver as _PlaceholderResolver,\n type PlaceholderResolverParams as _PlaceholderResolverParams,\n type PlaceholderResolverRead as _PlaceholderResolverRead,\n type PlaceholderResolverResolveUrl as _PlaceholderResolverResolveUrl,\n type LocationAnalyzer as _LocationAnalyzer,\n type ScmLocationAnalyzer as _ScmLocationAnalyzer,\n} from '@backstage/plugin-catalog-node';\nimport { Permission } from '@backstage/plugin-permission-common';\nimport {\n defaultCatalogCollatorEntityTransformer as _defaultCatalogCollatorEntityTransformer,\n type CatalogCollatorEntityTransformer as _CatalogCollatorEntityTransformer,\n} from '@backstage/plugin-search-backend-module-catalog';\nimport { DocumentCollatorFactory } from '@backstage/plugin-search-common';\nimport { Readable } from 'stream';\n\n/**\n * @public\n * @deprecated import from `@backstage/plugin-catalog-node` instead\n */\nexport const locationSpecToMetadataName = _locationSpecToMetadataName;\n/**\n * @public\n * @deprecated import from `@backstage/plugin-catalog-node` instead\n */\nexport const locationSpecToLocationEntity = _locationSpecToLocationEntity;\n/**\n * @public\n * @deprecated import from `@backstage/plugin-catalog-node` instead\n */\nexport const processingResult = _processingResult;\n/**\n * @public\n * @deprecated import from `@backstage/plugin-catalog-node` instead\n */\nexport type EntitiesSearchFilter = _EntitiesSearchFilter;\n/**\n * @public\n * @deprecated import from `@backstage/plugin-catalog-node` instead\n */\nexport type EntityFilter = _EntityFilter;\n/**\n * @public\n * @deprecated import from `@backstage/plugin-catalog-node` instead\n */\nexport type DeferredEntity = _DeferredEntity;\n/**\n * @public\n * @deprecated import from `@backstage/plugin-catalog-node` instead\n */\nexport type EntityRelationSpec = _EntityRelationSpec;\n/**\n * @public\n * @deprecated import from `@backstage/plugin-catalog-node` instead\n */\nexport type CatalogProcessor = _CatalogProcessor;\n/**\n * @public\n * @deprecated import from `@backstage/plugin-catalog-node` instead\n */\nexport type CatalogProcessorParser = _CatalogProcessorParser;\n/**\n * @public\n * @deprecated import from `@backstage/plugin-catalog-node` instead\n */\nexport type CatalogProcessorCache = _CatalogProcessorCache;\n/**\n * @public\n * @deprecated import from `@backstage/plugin-catalog-node` instead\n */\nexport type CatalogProcessorEmit = _CatalogProcessorEmit;\n/**\n * @public\n * @deprecated import from `@backstage/plugin-catalog-node` instead\n */\nexport type CatalogProcessorLocationResult = _CatalogProcessorLocationResult;\n/**\n * @public\n * @deprecated import from `@backstage/plugin-catalog-node` instead\n */\nexport type CatalogProcessorEntityResult = _CatalogProcessorEntityResult;\n/**\n * @public\n * @deprecated import from `@backstage/plugin-catalog-node` instead\n */\nexport type CatalogProcessorRelationResult = _CatalogProcessorRelationResult;\n/**\n * @public\n * @deprecated import from `@backstage/plugin-catalog-node` instead\n */\nexport type CatalogProcessorErrorResult = _CatalogProcessorErrorResult;\n/**\n * @public\n * @deprecated import from `@backstage/plugin-catalog-node` instead\n */\nexport type CatalogProcessorRefreshKeysResult =\n _CatalogProcessorRefreshKeysResult;\n/**\n * @public\n * @deprecated import from `@backstage/plugin-catalog-node` instead\n */\nexport type CatalogProcessorResult = _CatalogProcessorResult;\n/**\n * @public\n * @deprecated import from `@backstage/plugin-catalog-node` instead\n */\nexport type EntityProvider = _EntityProvider;\n/**\n * @public\n * @deprecated import from `@backstage/plugin-catalog-node` instead\n */\nexport type EntityProviderConnection = _EntityProviderConnection;\n/**\n * @public\n * @deprecated import from `@backstage/plugin-catalog-node` instead\n */\nexport type EntityProviderMutation = _EntityProviderMutation;\n\n/**\n * Holds the entity location information.\n *\n * @remarks\n *\n * `presence` flag: when using repo importer plugin, location is being created before the component yaml file is merged to the main branch.\n * This flag is then set to indicate that the file can be not present.\n * default value: 'required'.\n *\n * @public\n * @deprecated use the same type from `@backstage/plugin-catalog-common` instead\n */\nexport type LocationSpec = _LocationSpec;\n/**\n * @public\n * @deprecated import from `@backstage/plugin-catalog-node` instead\n */\nexport type AnalyzeOptions = _AnalyzeOptions;\n/**\n * @public\n * @deprecated import from `@backstage/plugin-catalog-node` instead\n */\nexport type LocationAnalyzer = _LocationAnalyzer;\n/**\n * @public\n * @deprecated import from `@backstage/plugin-catalog-node` instead\n */\nexport type ScmLocationAnalyzer = _ScmLocationAnalyzer;\n\n/**\n * @public\n * @deprecated import from `@backstage/plugin-catalog-node` instead\n */\nexport type PlaceholderResolver = _PlaceholderResolver;\n\n/**\n * @public\n * @deprecated import from `@backstage/plugin-catalog-node` instead\n */\nexport type PlaceholderResolverParams = _PlaceholderResolverParams;\n\n/**\n * @public\n * @deprecated import from `@backstage/plugin-catalog-node` instead\n */\nexport type PlaceholderResolverRead = _PlaceholderResolverRead;\n\n/**\n * @public\n * @deprecated import from `@backstage/plugin-catalog-node` instead\n */\nexport type PlaceholderResolverResolveUrl = _PlaceholderResolverResolveUrl;\n\n/**\n * @public\n * @deprecated use the same type from `@backstage/plugin-catalog-common` instead\n */\nexport type AnalyzeLocationRequest = _AnalyzeLocationRequest;\n/**\n * @public\n * @deprecated use the same type from `@backstage/plugin-catalog-common` instead\n */\nexport type AnalyzeLocationResponse = _AnalyzeLocationResponse;\n\n/**\n * If the folder pointed to already contained catalog info yaml files, they are\n * read and emitted like this so that the frontend can inform the user that it\n * located them and can make sure to register them as well if they weren't\n * already\n * @public\n * @deprecated use the same type from `@backstage/plugin-catalog-common` instead\n */\nexport type AnalyzeLocationExistingEntity = _AnalyzeLocationExistingEntity;\n/**\n * This is some form of representation of what the analyzer could deduce.\n * We should probably have a chat about how this can best be conveyed to\n * the frontend. It'll probably contain a (possibly incomplete) entity, plus\n * enough info for the frontend to know what form data to show to the user\n * for overriding/completing the info.\n * @public\n * @deprecated use the same type from `@backstage/plugin-catalog-common` instead\n */\nexport type AnalyzeLocationGenerateEntity = _AnalyzeLocationGenerateEntity;\n\n/**\n *\n * This is where I get really vague. Something like this perhaps? Or it could be\n * something like a json-schema that contains enough info for the frontend to\n * be able to present a form and explanations\n * @public\n * @deprecated use the same type from `@backstage/plugin-catalog-common` instead\n */\nexport type AnalyzeLocationEntityField = _AnalyzeLocationEntityField;\n\nnamespace search {\n const configKey = 'search.collators.catalog';\n\n const defaults = {\n schedule: {\n frequency: { minutes: 10 },\n timeout: { minutes: 15 },\n initialDelay: { seconds: 3 },\n },\n collatorOptions: {\n locationTemplate: '/catalog/:namespace/:kind/:name',\n filter: undefined,\n batchSize: 500,\n },\n };\n\n export const readCollatorConfigOptions = (\n configRoot: Config,\n ): {\n locationTemplate: string;\n filter: EntityFilterQuery | undefined;\n batchSize: number;\n } => {\n const config = configRoot.getOptionalConfig(configKey);\n if (!config) {\n return defaults.collatorOptions;\n }\n\n return {\n locationTemplate:\n config.getOptionalString('locationTemplate') ??\n defaults.collatorOptions.locationTemplate,\n filter:\n config.getOptional<EntityFilterQuery>('filter') ??\n defaults.collatorOptions.filter,\n batchSize:\n config.getOptionalNumber('batchSize') ??\n defaults.collatorOptions.batchSize,\n };\n };\n\n export const getDocumentText = (entity: Entity): string => {\n const documentTexts: string[] = [];\n if (entity.metadata.description) {\n documentTexts.push(entity.metadata.description);\n }\n\n if (isUserEntity(entity) || isGroupEntity(entity)) {\n if (entity.spec?.profile?.displayName) {\n documentTexts.push(entity.spec.profile.displayName);\n }\n }\n\n if (isUserEntity(entity)) {\n if (entity.spec?.profile?.email) {\n documentTexts.push(entity.spec.profile.email);\n }\n }\n\n return documentTexts.join(' : ');\n };\n}\n\n/**\n * @public\n * @deprecated import from `@backstage/plugin-search-backend-module-catalog` instead\n */\nexport const defaultCatalogCollatorEntityTransformer =\n _defaultCatalogCollatorEntityTransformer;\n\n/**\n * @public\n * @deprecated This is no longer supported since the new backend system migration\n */\nexport class DefaultCatalogCollatorFactory implements DocumentCollatorFactory {\n public readonly type = 'software-catalog';\n public readonly visibilityPermission: Permission =\n catalogEntityReadPermission;\n\n private locationTemplate: string;\n private filter?: GetEntitiesRequest['filter'];\n private batchSize: number;\n private readonly catalogClient: CatalogApi;\n private entityTransformer: CatalogCollatorEntityTransformer;\n private auth: AuthService;\n\n static fromConfig(\n configRoot: Config,\n options: DefaultCatalogCollatorFactoryOptions,\n ) {\n const configOptions = search.readCollatorConfigOptions(configRoot);\n const { auth: adaptedAuth } = createLegacyAuthAdapters({\n auth: options.auth,\n discovery: options.discovery,\n tokenManager: options.tokenManager,\n });\n return new DefaultCatalogCollatorFactory({\n locationTemplate:\n options.locationTemplate ?? configOptions.locationTemplate,\n filter: options.filter ?? configOptions.filter,\n batchSize: options.batchSize ?? configOptions.batchSize,\n entityTransformer: options.entityTransformer,\n auth: adaptedAuth,\n discovery: options.discovery,\n catalogClient: options.catalogClient,\n });\n }\n\n private constructor(options: {\n locationTemplate: string;\n filter: GetEntitiesRequest['filter'];\n batchSize: number;\n entityTransformer?: CatalogCollatorEntityTransformer;\n auth: AuthService;\n discovery: DiscoveryService;\n catalogClient?: CatalogApi;\n }) {\n const {\n auth,\n batchSize,\n discovery,\n locationTemplate,\n filter,\n catalogClient,\n entityTransformer,\n } = options;\n\n this.locationTemplate = locationTemplate;\n this.filter = filter;\n this.batchSize = batchSize;\n this.catalogClient =\n catalogClient || new CatalogClient({ discoveryApi: discovery });\n this.entityTransformer =\n entityTransformer ?? defaultCatalogCollatorEntityTransformer;\n this.auth = auth;\n }\n\n async getCollator(): Promise<Readable> {\n return Readable.from(this.execute());\n }\n\n private async *execute(): AsyncGenerator<CatalogEntityDocument> {\n let entitiesRetrieved = 0;\n let cursor: string | undefined = undefined;\n\n do {\n const { token } = await this.auth.getPluginRequestToken({\n onBehalfOf: await this.auth.getOwnServiceCredentials(),\n targetPluginId: 'catalog',\n });\n const response = await this.catalogClient.queryEntities(\n {\n filter: this.filter,\n limit: this.batchSize,\n ...(cursor ? { cursor } : {}),\n },\n { token },\n );\n cursor = response.pageInfo.nextCursor;\n entitiesRetrieved += response.items.length;\n\n for (const entity of response.items) {\n yield {\n ...this.entityTransformer(entity),\n authorization: {\n resourceRef: stringifyEntityRef(entity),\n },\n location: this.applyArgsToFormat(this.locationTemplate, {\n namespace: entity.metadata.namespace || 'default',\n kind: entity.kind,\n name: entity.metadata.name,\n }),\n };\n }\n } while (cursor);\n }\n\n private applyArgsToFormat(\n format: string,\n args: Record<string, string>,\n ): string {\n let formatted = format;\n\n for (const [key, value] of Object.entries(args)) {\n formatted = formatted.replace(`:${key}`, value);\n }\n\n return formatted.toLowerCase();\n }\n}\n\n/**\n * @public\n * @deprecated This is no longer supported since the new backend system migration\n */\nexport type DefaultCatalogCollatorFactoryOptions = {\n auth?: AuthService;\n discovery: DiscoveryService;\n tokenManager?: TokenManager;\n /**\n * @deprecated Use the config key `search.collators.catalog.locationTemplate` instead.\n */\n locationTemplate?: string;\n /**\n * @deprecated Use the config key `search.collators.catalog.filter` instead.\n */\n filter?: GetEntitiesRequest['filter'];\n /**\n * @deprecated Use the config key `search.collators.catalog.batchSize` instead.\n */\n batchSize?: number;\n // TODO(freben): Change to required CatalogService instead when fully migrated to the new backend system.\n catalogClient?: CatalogApi;\n /**\n * Allows you to customize how entities are shaped into documents.\n */\n entityTransformer?: CatalogCollatorEntityTransformer;\n};\n\n/**\n * @public\n * @deprecated import from `@backstage/plugin-search-backend-module-catalog` instead\n */\nexport type CatalogCollatorEntityTransformer =\n _CatalogCollatorEntityTransformer;\n"],"names":["_locationSpecToMetadataName","_locationSpecToLocationEntity","_processingResult","search","isUserEntity","isGroupEntity","_defaultCatalogCollatorEntityTransformer","catalogEntityReadPermission","createLegacyAuthAdapters","catalogClient","CatalogClient","Readable","stringifyEntityRef"],"mappings":";;;;;;;;;;AAqFO,MAAM,0BAA6B,GAAAA;AAKnC,MAAM,4BAA+B,GAAAC;AAKrC,MAAM,gBAAmB,GAAAC;AAsLhC,IAAU,MAAA;AAAA,CAAV,CAAUC,OAAV,KAAA;AACE,EAAA,MAAM,SAAY,GAAA,0BAAA;AAElB,EAAA,MAAM,QAAW,GAAA;AAAA,IACf,QAAU,EAAA;AAAA,MACR,SAAA,EAAW,EAAE,OAAA,EAAS,EAAG,EAAA;AAAA,MACzB,OAAA,EAAS,EAAE,OAAA,EAAS,EAAG,EAAA;AAAA,MACvB,YAAA,EAAc,EAAE,OAAA,EAAS,CAAE;AAAA,K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A,MAAA,MAAA,IAAU,SAAS,KAAO,EAAA;AACnC,QAAM,MAAA;AAAA,UACJ,GAAG,IAAK,CAAA,iBAAA,CAAkB,MAAM,CAAA;AAAA,UAChC,aAAe,EAAA;AAAA,YACb,WAAA,EAAaC,gCAAmB,MAAM;AAAA,WACxC;AAAA,UACA,QAAU,EAAA,IAAA,CAAK,iBAAkB,CAAA,IAAA,CAAK,gBAAkB,EAAA;AAAA,YACtD,SAAA,EAAW,MAAO,CAAA,QAAA,CAAS,SAAa,IAAA,SAAA;AAAA,YACxC,MAAM,MAAO,CAAA,IAAA;AAAA,YACb,IAAA,EAAM,OAAO,QAAS,CAAA;AAAA,WACvB;AAAA,SACH;AAAA;AACF,KACO,QAAA,MAAA;AAAA;AACX,EAEQ,iBAAA,CACN,QACA,IACQ,EAAA;AACR,IAAA,IAAI,SAAY,GAAA,MAAA;AAEhB,IAAA,KAAA,MAAW,CAAC,GAAK,EAAA,KAAK,KAAK,MAAO,CAAA,OAAA,CAAQ,IAAI,CAAG,EAAA;AAC/C,MAAA,SAAA,GAAY,SAAU,CAAA,OAAA,CAAQ,CAAI,CAAA,EAAA,GAAG,IAAI,KAAK,CAAA;AAAA;AAGhD,IAAA,OAAO,UAAU,WAAY,EAAA;AAAA;AAEjC;;;;;;;;"}
package/dist/index.cjs.js CHANGED
@@ -34,6 +34,7 @@ exports.transformLegacyPolicyToProcessor = transformLegacyPolicyToProcessor.tran
34
34
  exports.createRandomProcessingInterval = refresh.createRandomProcessingInterval;
35
35
  exports.DefaultCatalogCollator = DefaultCatalogCollator.DefaultCatalogCollator;
36
36
  exports.CatalogBuilder = CatalogBuilder.CatalogBuilder;
37
+ exports.DefaultCatalogCollatorFactory = deprecated.DefaultCatalogCollatorFactory;
37
38
  exports.defaultCatalogCollatorEntityTransformer = deprecated.defaultCatalogCollatorEntityTransformer;
38
39
  exports.locationSpecToLocationEntity = deprecated.locationSpecToLocationEntity;
39
40
  exports.locationSpecToMetadataName = deprecated.locationSpecToMetadataName;
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/index.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  import * as _backstage_backend_plugin_api from '@backstage/backend-plugin-api';
3
- import { LoggerService, UrlReaderService, DiscoveryService, DatabaseService, RootConfigService, PermissionsService, SchedulerService, AuthService, HttpAuthService } from '@backstage/backend-plugin-api';
4
- import * as _backstage_catalog_model from '@backstage/catalog-model';
3
+ import { LoggerService, UrlReaderService, DiscoveryService, DatabaseService, RootConfigService, PermissionsService, PermissionsRegistryService, SchedulerService, AuthService, HttpAuthService } from '@backstage/backend-plugin-api';
5
4
  import { Entity, EntityPolicy, Validators } from '@backstage/catalog-model';
6
5
  import { ScmIntegrationRegistry } from '@backstage/integration';
7
6
  import { LocationSpec as LocationSpec$1, CatalogEntityDocument, AnalyzeLocationRequest as AnalyzeLocationRequest$1, AnalyzeLocationResponse as AnalyzeLocationResponse$1, AnalyzeLocationExistingEntity as AnalyzeLocationExistingEntity$1, AnalyzeLocationGenerateEntity as AnalyzeLocationGenerateEntity$1, AnalyzeLocationEntityField as AnalyzeLocationEntityField$1 } from '@backstage/plugin-catalog-common';
@@ -14,6 +13,8 @@ import { Router } from 'express';
14
13
  import { PermissionRule } from '@backstage/plugin-permission-node';
15
14
  import { EventBroker, EventsService } from '@backstage/plugin-events-node';
16
15
  import { CatalogCollatorEntityTransformer as CatalogCollatorEntityTransformer$1 } from '@backstage/plugin-search-backend-module-catalog';
16
+ import { DocumentCollatorFactory } from '@backstage/plugin-search-common';
17
+ import { Readable } from 'stream';
17
18
 
18
19
  /**
19
20
  * Catalog plugin
@@ -215,6 +216,7 @@ type CatalogEnvironment = {
215
216
  config: RootConfigService;
216
217
  reader: UrlReaderService;
217
218
  permissions: PermissionsService | PermissionAuthorizer;
219
+ permissionsRegistry?: PermissionsRegistryService;
218
220
  scheduler?: SchedulerService;
219
221
  discovery?: DiscoveryService;
220
222
  auth?: AuthService;
@@ -455,7 +457,7 @@ declare const processingResult: Readonly<{
455
457
  readonly inputError: (atLocation: LocationSpec$1, message: string) => CatalogProcessorResult$1;
456
458
  readonly generalError: (atLocation: LocationSpec$1, message: string) => CatalogProcessorResult$1;
457
459
  readonly location: (newLocation: LocationSpec$1) => CatalogProcessorResult$1;
458
- readonly entity: (atLocation: LocationSpec$1, newEntity: _backstage_catalog_model.Entity) => CatalogProcessorResult$1;
460
+ readonly entity: (atLocation: LocationSpec$1, newEntity: Entity) => CatalogProcessorResult$1;
459
461
  readonly relation: (spec: EntityRelationSpec$1) => CatalogProcessorResult$1;
460
462
  readonly refresh: (key: string) => CatalogProcessorResult$1;
461
463
  }>;
@@ -635,6 +637,51 @@ type AnalyzeLocationEntityField = AnalyzeLocationEntityField$1;
635
637
  * @deprecated import from `@backstage/plugin-search-backend-module-catalog` instead
636
638
  */
637
639
  declare const defaultCatalogCollatorEntityTransformer: CatalogCollatorEntityTransformer$1;
640
+ /**
641
+ * @public
642
+ * @deprecated This is no longer supported since the new backend system migration
643
+ */
644
+ declare class DefaultCatalogCollatorFactory implements DocumentCollatorFactory {
645
+ readonly type = "software-catalog";
646
+ readonly visibilityPermission: Permission;
647
+ private locationTemplate;
648
+ private filter?;
649
+ private batchSize;
650
+ private readonly catalogClient;
651
+ private entityTransformer;
652
+ private auth;
653
+ static fromConfig(configRoot: Config, options: DefaultCatalogCollatorFactoryOptions): DefaultCatalogCollatorFactory;
654
+ private constructor();
655
+ getCollator(): Promise<Readable>;
656
+ private execute;
657
+ private applyArgsToFormat;
658
+ }
659
+ /**
660
+ * @public
661
+ * @deprecated This is no longer supported since the new backend system migration
662
+ */
663
+ type DefaultCatalogCollatorFactoryOptions = {
664
+ auth?: AuthService;
665
+ discovery: DiscoveryService;
666
+ tokenManager?: TokenManager;
667
+ /**
668
+ * @deprecated Use the config key `search.collators.catalog.locationTemplate` instead.
669
+ */
670
+ locationTemplate?: string;
671
+ /**
672
+ * @deprecated Use the config key `search.collators.catalog.filter` instead.
673
+ */
674
+ filter?: GetEntitiesRequest['filter'];
675
+ /**
676
+ * @deprecated Use the config key `search.collators.catalog.batchSize` instead.
677
+ */
678
+ batchSize?: number;
679
+ catalogClient?: CatalogApi;
680
+ /**
681
+ * Allows you to customize how entities are shaped into documents.
682
+ */
683
+ entityTransformer?: CatalogCollatorEntityTransformer;
684
+ };
638
685
  /**
639
686
  * @public
640
687
  * @deprecated import from `@backstage/plugin-search-backend-module-catalog` instead
@@ -649,4 +696,4 @@ declare const CATALOG_ERRORS_TOPIC = "experimental.catalog.errors";
649
696
  /** @public */
650
697
  declare function parseEntityYaml(data: Buffer, location: LocationSpec$1): Iterable<CatalogProcessorResult$1>;
651
698
 
652
- export { type AnalyzeLocationEntityField, type AnalyzeLocationExistingEntity, type AnalyzeLocationGenerateEntity, type AnalyzeLocationRequest, type AnalyzeLocationResponse, type AnalyzeOptions, AnnotateLocationEntityProcessor, AnnotateScmSlugEntityProcessor, BuiltinKindsEntityProcessor, CATALOG_CONFLICTS_TOPIC, CATALOG_ERRORS_TOPIC, CatalogBuilder, type CatalogCollatorEntityTransformer, type CatalogEnvironment, type CatalogPermissionRuleInput, type CatalogProcessingEngine, type CatalogProcessor, type CatalogProcessorCache, type CatalogProcessorEmit, type CatalogProcessorEntityResult, type CatalogProcessorErrorResult, type CatalogProcessorLocationResult, type CatalogProcessorParser, type CatalogProcessorRefreshKeysResult, type CatalogProcessorRelationResult, type CatalogProcessorResult, CodeOwnersProcessor, DefaultCatalogCollator, type DeferredEntity, type EntitiesSearchFilter, type EntityFilter, type EntityProvider, type EntityProviderConnection, type EntityProviderMutation, type EntityRelationSpec, FileReaderProcessor, type LocationAnalyzer, LocationEntityProcessor, type LocationEntityProcessorOptions, type LocationSpec, PlaceholderProcessor, type PlaceholderProcessorOptions, type PlaceholderResolver, type PlaceholderResolverParams, type PlaceholderResolverRead, type PlaceholderResolverResolveUrl, type ProcessingIntervalFunction, type ScmLocationAnalyzer, UrlReaderProcessor, createRandomProcessingInterval, catalogPlugin as default, defaultCatalogCollatorEntityTransformer, locationSpecToLocationEntity, locationSpecToMetadataName, parseEntityYaml, processingResult, transformLegacyPolicyToProcessor };
699
+ export { type AnalyzeLocationEntityField, type AnalyzeLocationExistingEntity, type AnalyzeLocationGenerateEntity, type AnalyzeLocationRequest, type AnalyzeLocationResponse, type AnalyzeOptions, AnnotateLocationEntityProcessor, AnnotateScmSlugEntityProcessor, BuiltinKindsEntityProcessor, CATALOG_CONFLICTS_TOPIC, CATALOG_ERRORS_TOPIC, CatalogBuilder, type CatalogCollatorEntityTransformer, type CatalogEnvironment, type CatalogPermissionRuleInput, type CatalogProcessingEngine, type CatalogProcessor, type CatalogProcessorCache, type CatalogProcessorEmit, type CatalogProcessorEntityResult, type CatalogProcessorErrorResult, type CatalogProcessorLocationResult, type CatalogProcessorParser, type CatalogProcessorRefreshKeysResult, type CatalogProcessorRelationResult, type CatalogProcessorResult, CodeOwnersProcessor, DefaultCatalogCollator, DefaultCatalogCollatorFactory, type DefaultCatalogCollatorFactoryOptions, type DeferredEntity, type EntitiesSearchFilter, type EntityFilter, type EntityProvider, type EntityProviderConnection, type EntityProviderMutation, type EntityRelationSpec, FileReaderProcessor, type LocationAnalyzer, LocationEntityProcessor, type LocationEntityProcessorOptions, type LocationSpec, PlaceholderProcessor, type PlaceholderProcessorOptions, type PlaceholderResolver, type PlaceholderResolverParams, type PlaceholderResolverRead, type PlaceholderResolverResolveUrl, type ProcessingIntervalFunction, type ScmLocationAnalyzer, UrlReaderProcessor, createRandomProcessingInterval, catalogPlugin as default, defaultCatalogCollatorEntityTransformer, locationSpecToLocationEntity, locationSpecToMetadataName, parseEntityYaml, processingResult, transformLegacyPolicyToProcessor };
@@ -316,6 +316,7 @@ class CatalogBuilder {
316
316
  logger,
317
317
  permissions,
318
318
  scheduler,
319
+ permissionsRegistry,
319
320
  discovery = backendCommon.HostDiscovery.fromConfig(config)
320
321
  } = this.env;
321
322
  const { auth, httpAuth } = backendCommon.createLegacyAuthAdapters({
@@ -382,7 +383,7 @@ class CatalogBuilder {
382
383
  permissionsService,
383
384
  pluginPermissionNode.createConditionTransformer(this.permissionRules)
384
385
  );
385
- const permissionIntegrationRouter = pluginPermissionNode.createPermissionIntegrationRouter({
386
+ const catalogPermissionResource = {
386
387
  resourceType: alpha.RESOURCE_TYPE_CATALOG_ENTITY,
387
388
  getResources: async (resourceRefs) => {
388
389
  const { entities } = await unauthorizedEntitiesCatalog.entities({
@@ -408,7 +409,15 @@ class CatalogBuilder {
408
409
  },
409
410
  permissions: this.permissions,
410
411
  rules: this.permissionRules
411
- });
412
+ };
413
+ let permissionIntegrationRouter;
414
+ if (permissionsRegistry) {
415
+ permissionsRegistry.addResourceType(catalogPermissionResource);
416
+ } else {
417
+ permissionIntegrationRouter = pluginPermissionNode.createPermissionIntegrationRouter(
418
+ catalogPermissionResource
419
+ );
420
+ }
412
421
  const locationStore = new DefaultLocationStore.DefaultLocationStore(dbClient);
413
422
  const configLocationProvider = new ConfigLocationEntityProvider.ConfigLocationEntityProvider(config);
414
423
  const entityProviders = lodash__default.default.uniqBy(
@@ -1 +1 @@
1
- {"version":3,"file":"CatalogBuilder.cjs.js","sources":["../../src/service/CatalogBuilder.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 {\n createLegacyAuthAdapters,\n HostDiscovery,\n} from '@backstage/backend-common';\nimport {\n DefaultNamespaceEntityPolicy,\n Entity,\n EntityPolicies,\n EntityPolicy,\n FieldFormatEntityPolicy,\n makeValidator,\n NoForeignRootFieldsEntityPolicy,\n parseEntityRef,\n SchemaValidEntityPolicy,\n stringifyEntityRef,\n Validators,\n} from '@backstage/catalog-model';\nimport { ScmIntegrations } from '@backstage/integration';\nimport { createHash } from 'crypto';\nimport { Router } from 'express';\nimport lodash, { keyBy } from 'lodash';\n\nimport {\n CatalogProcessor,\n CatalogProcessorParser,\n EntitiesSearchFilter,\n EntityProvider,\n PlaceholderResolver,\n LocationAnalyzer,\n ScmLocationAnalyzer,\n} from '@backstage/plugin-catalog-node';\nimport {\n AnnotateLocationEntityProcessor,\n BuiltinKindsEntityProcessor,\n CodeOwnersProcessor,\n FileReaderProcessor,\n PlaceholderProcessor,\n UrlReaderProcessor,\n} from '../processors';\nimport { ConfigLocationEntityProvider } from '../providers/ConfigLocationEntityProvider';\nimport { DefaultLocationStore } from '../providers/DefaultLocationStore';\nimport { RepoLocationAnalyzer } from '../ingestion/LocationAnalyzer';\nimport { AuthorizedLocationAnalyzer } from './AuthorizedLocationAnalyzer';\nimport {\n jsonPlaceholderResolver,\n textPlaceholderResolver,\n yamlPlaceholderResolver,\n} from '../processors/PlaceholderProcessor';\nimport { defaultEntityDataParser } from '../util/parse';\nimport {\n CatalogProcessingEngine,\n createRandomProcessingInterval,\n ProcessingIntervalFunction,\n} from '../processing';\nimport { DefaultProcessingDatabase } from '../database/DefaultProcessingDatabase';\nimport { applyDatabaseMigrations } from '../database/migrations';\nimport { DefaultCatalogProcessingEngine } from '../processing/DefaultCatalogProcessingEngine';\nimport { DefaultLocationService } from './DefaultLocationService';\nimport { DefaultEntitiesCatalog } from './DefaultEntitiesCatalog';\nimport { DefaultCatalogProcessingOrchestrator } from '../processing/DefaultCatalogProcessingOrchestrator';\nimport { DefaultStitcher } from '../stitching/DefaultStitcher';\nimport { createRouter } from './createRouter';\nimport { DefaultRefreshService } from './DefaultRefreshService';\nimport { AuthorizedRefreshService } from './AuthorizedRefreshService';\nimport { DefaultCatalogRulesEnforcer } from '../ingestion/CatalogRules';\nimport { Config, readDurationFromConfig } from '@backstage/config';\nimport { connectEntityProviders } from '../processing/connectEntityProviders';\nimport {\n Permission,\n PermissionAuthorizer,\n PermissionRuleParams,\n toPermissionEvaluator,\n} from '@backstage/plugin-permission-common';\nimport { permissionRules as catalogPermissionRules } from '../permissions/rules';\nimport {\n createConditionTransformer,\n createPermissionIntegrationRouter,\n PermissionRule,\n} from '@backstage/plugin-permission-node';\nimport { AuthorizedEntitiesCatalog } from './AuthorizedEntitiesCatalog';\nimport { basicEntityFilter } from './request';\nimport {\n catalogPermissions,\n RESOURCE_TYPE_CATALOG_ENTITY,\n} from '@backstage/plugin-catalog-common/alpha';\nimport { AuthorizedLocationService } from './AuthorizedLocationService';\nimport { DefaultProviderDatabase } from '../database/DefaultProviderDatabase';\nimport { DefaultCatalogDatabase } from '../database/DefaultCatalogDatabase';\nimport { EventBroker, EventsService } from '@backstage/plugin-events-node';\nimport { durationToMilliseconds } from '@backstage/types';\nimport {\n AuthService,\n DatabaseService,\n DiscoveryService,\n HttpAuthService,\n LoggerService,\n PermissionsService,\n RootConfigService,\n UrlReaderService,\n SchedulerService,\n} from '@backstage/backend-plugin-api';\nimport { entitiesResponseToObjects } from './response';\n\n/**\n * This is a duplicate of the alpha `CatalogPermissionRule` type, for use in the stable API.\n *\n * @public\n */\nexport type CatalogPermissionRuleInput<\n TParams extends PermissionRuleParams = PermissionRuleParams,\n> = PermissionRule<Entity, EntitiesSearchFilter, 'catalog-entity', TParams>;\n\n/**\n * @deprecated Please migrate to the new backend system as this will be removed in the future.\n * @public\n */\nexport type CatalogEnvironment = {\n logger: LoggerService;\n database: DatabaseService;\n config: RootConfigService;\n reader: UrlReaderService;\n permissions: PermissionsService | PermissionAuthorizer;\n scheduler?: SchedulerService;\n discovery?: DiscoveryService;\n auth?: AuthService;\n httpAuth?: HttpAuthService;\n};\n\n/**\n * A builder that helps wire up all of the component parts of the catalog.\n *\n * The touch points where you can replace or extend behavior are as follows:\n *\n * - Entity policies can be added or replaced. These are automatically run\n * after the processors' pre-processing steps. All policies are given the\n * chance to inspect the entity, and all of them have to pass in order for\n * the entity to be considered valid from an overall point of view.\n * - Location analyzers can be added. These are responsible for analyzing\n * repositories when onboarding them into the catalog, by finding\n * catalog-info.yaml files and other artifacts that can help automatically\n * register or create catalog data on the user's behalf.\n * - Placeholder resolvers can be replaced or added. These run on the raw\n * structured data between the parsing and pre-processing steps, to replace\n * dollar-prefixed entries with their actual values (like $file).\n * - Field format validators can be replaced. These check the format of\n * individual core fields such as metadata.name, to ensure that they adhere\n * to certain rules.\n * - Processors can be added or replaced. These implement the functionality of\n * reading, parsing, validating, and processing the entity data before it is\n * persisted in the catalog.\n *\n * @public\n * @deprecated Please migrate to the new backend system as this will be removed in the future.\n */\nexport class CatalogBuilder {\n private readonly env: CatalogEnvironment;\n private entityPolicies: EntityPolicy[];\n private entityPoliciesReplace: boolean;\n private placeholderResolvers: Record<string, PlaceholderResolver>;\n private fieldFormatValidators: Partial<Validators>;\n private entityProviders: EntityProvider[];\n private processors: CatalogProcessor[];\n private locationAnalyzers: ScmLocationAnalyzer[];\n private processorsReplace: boolean;\n private parser: CatalogProcessorParser | undefined;\n private onProcessingError?: (event: {\n unprocessedEntity: Entity;\n errors: Error[];\n }) => Promise<void> | void;\n private processingInterval: ProcessingIntervalFunction;\n private locationAnalyzer: LocationAnalyzer | undefined = undefined;\n private readonly permissions: Permission[];\n private readonly permissionRules: CatalogPermissionRuleInput[];\n private allowedLocationType: string[];\n private legacySingleProcessorValidation = false;\n private eventBroker?: EventBroker | EventsService;\n\n /**\n * Creates a catalog builder.\n */\n static create(env: CatalogEnvironment): CatalogBuilder {\n return new CatalogBuilder(env);\n }\n\n private constructor(env: CatalogEnvironment) {\n this.env = env;\n this.entityPolicies = [];\n this.entityPoliciesReplace = false;\n this.placeholderResolvers = {};\n this.fieldFormatValidators = {};\n this.entityProviders = [];\n this.processors = [];\n this.locationAnalyzers = [];\n this.processorsReplace = false;\n this.parser = undefined;\n this.permissions = [...catalogPermissions];\n this.permissionRules = Object.values(catalogPermissionRules);\n this.allowedLocationType = ['url'];\n\n this.processingInterval = CatalogBuilder.getDefaultProcessingInterval(\n env.config,\n );\n }\n\n /**\n * Adds policies that are used to validate entities between the pre-\n * processing and post-processing stages. All such policies must pass for the\n * entity to be considered valid.\n *\n * If what you want to do is to replace the rules for what format is allowed\n * in various core entity fields (such as metadata.name), you may want to use\n * {@link CatalogBuilder#setFieldFormatValidators} instead.\n *\n * @param policies - One or more policies\n */\n addEntityPolicy(\n ...policies: Array<EntityPolicy | Array<EntityPolicy>>\n ): CatalogBuilder {\n this.entityPolicies.push(...policies.flat());\n return this;\n }\n\n /**\n * Processing interval determines how often entities should be processed.\n * Seconds provided will be multiplied by 1.5\n * The default processing interval is 100-150 seconds.\n * setting this too low will potentially deplete request quotas to upstream services.\n */\n setProcessingIntervalSeconds(seconds: number): CatalogBuilder {\n this.processingInterval = createRandomProcessingInterval({\n minSeconds: seconds,\n maxSeconds: seconds * 1.5,\n });\n return this;\n }\n\n /**\n * Overwrites the default processing interval function used to spread\n * entity updates in the catalog.\n */\n setProcessingInterval(\n processingInterval: ProcessingIntervalFunction,\n ): CatalogBuilder {\n this.processingInterval = processingInterval;\n return this;\n }\n\n /**\n * Overwrites the default location analyzer.\n */\n setLocationAnalyzer(locationAnalyzer: LocationAnalyzer): CatalogBuilder {\n this.locationAnalyzer = locationAnalyzer;\n return this;\n }\n\n /**\n * Sets what policies to use for validation of entities between the pre-\n * processing and post-processing stages. All such policies must pass for the\n * entity to be considered valid.\n *\n * If what you want to do is to replace the rules for what format is allowed\n * in various core entity fields (such as metadata.name), you may want to use\n * {@link CatalogBuilder#setFieldFormatValidators} instead.\n *\n * This function replaces the default set of policies; use with care.\n *\n * @param policies - One or more policies\n */\n replaceEntityPolicies(policies: EntityPolicy[]): CatalogBuilder {\n this.entityPolicies = [...policies];\n this.entityPoliciesReplace = true;\n return this;\n }\n\n /**\n * Adds, or overwrites, a handler for placeholders (e.g. $file) in entity\n * definition files.\n *\n * @param key - The key that identifies the placeholder, e.g. \"file\"\n * @param resolver - The resolver that gets values for this placeholder\n */\n setPlaceholderResolver(\n key: string,\n resolver: PlaceholderResolver,\n ): CatalogBuilder {\n this.placeholderResolvers[key] = resolver;\n return this;\n }\n\n /**\n * Sets the validator function to use for one or more special fields of an\n * entity. This is useful if the default rules for formatting of fields are\n * not sufficient.\n *\n * This function has no effect if used together with\n * {@link CatalogBuilder#replaceEntityPolicies}.\n *\n * @param validators - The (subset of) validators to set\n */\n setFieldFormatValidators(validators: Partial<Validators>): CatalogBuilder {\n lodash.merge(this.fieldFormatValidators, validators);\n return this;\n }\n\n /**\n * Adds or replaces entity providers. These are responsible for bootstrapping\n * the list of entities out of original data sources. For example, there is\n * one entity source for the config locations, and one for the database\n * stored locations. If you ingest entities out of a third party system, you\n * may want to implement that in terms of an entity provider as well.\n *\n * @param providers - One or more entity providers\n */\n addEntityProvider(\n ...providers: Array<EntityProvider | Array<EntityProvider>>\n ): CatalogBuilder {\n this.entityProviders.push(...providers.flat());\n return this;\n }\n\n /**\n * Adds entity processors. These are responsible for reading, parsing, and\n * processing entities before they are persisted in the catalog.\n *\n * @param processors - One or more processors\n */\n addProcessor(\n ...processors: Array<CatalogProcessor | Array<CatalogProcessor>>\n ): CatalogBuilder {\n this.processors.push(...processors.flat());\n return this;\n }\n\n /**\n * Sets what entity processors to use. These are responsible for reading,\n * parsing, and processing entities before they are persisted in the catalog.\n *\n * This function replaces the default set of processors, consider using with\n * {@link CatalogBuilder#getDefaultProcessors}; use with care.\n *\n * @param processors - One or more processors\n */\n replaceProcessors(processors: CatalogProcessor[]): CatalogBuilder {\n this.processors = [...processors];\n this.processorsReplace = true;\n return this;\n }\n\n /**\n * Returns the default list of entity processors. These are responsible for reading,\n * parsing, and processing entities before they are persisted in the catalog. Changing\n * the order of processing can give more control to custom processors.\n *\n * Consider using with {@link CatalogBuilder#replaceProcessors}\n *\n */\n getDefaultProcessors(): CatalogProcessor[] {\n const { config, logger, reader } = this.env;\n const integrations = ScmIntegrations.fromConfig(config);\n\n return [\n new FileReaderProcessor(),\n new UrlReaderProcessor({ reader, logger }),\n CodeOwnersProcessor.fromConfig(config, { logger, reader }),\n new AnnotateLocationEntityProcessor({ integrations }),\n ];\n }\n\n /**\n * Adds Location Analyzers. These are responsible for analyzing\n * repositories when onboarding them into the catalog, by finding\n * catalog-info.yaml files and other artifacts that can help automatically\n * register or create catalog data on the user's behalf.\n *\n * @param locationAnalyzers - One or more location analyzers\n */\n addLocationAnalyzers(\n ...analyzers: Array<ScmLocationAnalyzer | Array<ScmLocationAnalyzer>>\n ): CatalogBuilder {\n this.locationAnalyzers.push(...analyzers.flat());\n return this;\n }\n\n /**\n * Sets up the catalog to use a custom parser for entity data.\n *\n * This is the function that gets called immediately after some raw entity\n * specification data has been read from a remote source, and needs to be\n * parsed and emitted as structured data.\n *\n * @param parser - The custom parser\n */\n setEntityDataParser(parser: CatalogProcessorParser): CatalogBuilder {\n this.parser = parser;\n return this;\n }\n\n /**\n * Adds additional permissions. See\n * {@link @backstage/plugin-permission-node#Permission}.\n *\n * @param permissions - Additional permissions\n */\n addPermissions(...permissions: Array<Permission | Array<Permission>>) {\n this.permissions.push(...permissions.flat());\n return this;\n }\n\n /**\n * Adds additional permission rules. Permission rules are used to evaluate\n * catalog resources against queries. See\n * {@link @backstage/plugin-permission-node#PermissionRule}.\n *\n * @param permissionRules - Additional permission rules\n */\n addPermissionRules(\n ...permissionRules: Array<\n CatalogPermissionRuleInput | Array<CatalogPermissionRuleInput>\n >\n ) {\n this.permissionRules.push(...permissionRules.flat());\n return this;\n }\n\n /**\n * Sets up the allowed location types from being registered via the location service.\n *\n * @param allowedLocationTypes - the allowed location types\n */\n setAllowedLocationTypes(allowedLocationTypes: string[]): CatalogBuilder {\n this.allowedLocationType = allowedLocationTypes;\n return this;\n }\n\n /**\n * Enables the legacy behaviour of canceling validation early whenever only a\n * single processor declares an entity kind to be valid.\n */\n useLegacySingleProcessorValidation(): this {\n this.legacySingleProcessorValidation = true;\n return this;\n }\n\n /**\n * Enables the publishing of events for conflicts in the DefaultProcessingDatabase\n */\n setEventBroker(broker: EventBroker | EventsService): CatalogBuilder {\n this.eventBroker = broker;\n return this;\n }\n\n /**\n * Wires up and returns all of the component parts of the catalog\n */\n async build(): Promise<{\n processingEngine: CatalogProcessingEngine;\n router: Router;\n }> {\n const {\n config,\n database,\n logger,\n permissions,\n scheduler,\n discovery = HostDiscovery.fromConfig(config),\n } = this.env;\n\n const { auth, httpAuth } = createLegacyAuthAdapters({\n ...this.env,\n discovery,\n });\n\n const disableRelationsCompatibility = config.getOptionalBoolean(\n 'catalog.disableRelationsCompatibility',\n );\n\n const policy = this.buildEntityPolicy();\n const processors = this.buildProcessors();\n const parser = this.parser || defaultEntityDataParser;\n\n const dbClient = await database.getClient();\n if (!database.migrations?.skip) {\n logger.info('Performing database migration');\n await applyDatabaseMigrations(dbClient);\n }\n\n const stitcher = DefaultStitcher.fromConfig(config, {\n knex: dbClient,\n logger,\n });\n\n const processingDatabase = new DefaultProcessingDatabase({\n database: dbClient,\n logger,\n refreshInterval: this.processingInterval,\n eventBroker: this.eventBroker,\n });\n const providerDatabase = new DefaultProviderDatabase({\n database: dbClient,\n logger,\n });\n const catalogDatabase = new DefaultCatalogDatabase({\n database: dbClient,\n logger,\n });\n const integrations = ScmIntegrations.fromConfig(config);\n const rulesEnforcer = DefaultCatalogRulesEnforcer.fromConfig(config);\n\n const unauthorizedEntitiesCatalog = new DefaultEntitiesCatalog({\n database: dbClient,\n logger,\n stitcher,\n disableRelationsCompatibility,\n });\n\n let permissionsService: PermissionsService;\n if ('authorizeConditional' in permissions) {\n permissionsService = permissions as PermissionsService;\n } else {\n logger.warn(\n 'PermissionAuthorizer is deprecated. Please use an instance of PermissionEvaluator instead of PermissionAuthorizer in PluginEnvironment#permissions',\n );\n permissionsService = toPermissionEvaluator(permissions);\n }\n\n const orchestrator = new DefaultCatalogProcessingOrchestrator({\n processors,\n integrations,\n rulesEnforcer,\n logger,\n parser,\n policy,\n legacySingleProcessorValidation: this.legacySingleProcessorValidation,\n });\n\n const entitiesCatalog = new AuthorizedEntitiesCatalog(\n unauthorizedEntitiesCatalog,\n permissionsService,\n createConditionTransformer(this.permissionRules),\n );\n const permissionIntegrationRouter = createPermissionIntegrationRouter({\n resourceType: RESOURCE_TYPE_CATALOG_ENTITY,\n getResources: async (resourceRefs: string[]) => {\n const { entities } = await unauthorizedEntitiesCatalog.entities({\n credentials: await auth.getOwnServiceCredentials(),\n filter: {\n anyOf: resourceRefs.map(resourceRef => {\n const { kind, namespace, name } = parseEntityRef(resourceRef);\n\n return basicEntityFilter({\n kind,\n 'metadata.namespace': namespace,\n 'metadata.name': name,\n });\n }),\n },\n });\n\n const entitiesByRef = keyBy(\n entitiesResponseToObjects(entities),\n stringifyEntityRef,\n );\n\n return resourceRefs.map(\n resourceRef =>\n entitiesByRef[stringifyEntityRef(parseEntityRef(resourceRef))],\n );\n },\n permissions: this.permissions,\n rules: this.permissionRules,\n });\n\n const locationStore = new DefaultLocationStore(dbClient);\n const configLocationProvider = new ConfigLocationEntityProvider(config);\n const entityProviders = lodash.uniqBy(\n [...this.entityProviders, locationStore, configLocationProvider],\n provider => provider.getProviderName(),\n );\n\n const processingEngine = new DefaultCatalogProcessingEngine({\n config,\n scheduler,\n logger,\n knex: dbClient,\n processingDatabase,\n orchestrator,\n stitcher,\n createHash: () => createHash('sha1'),\n pollingIntervalMs: 1000,\n onProcessingError: event => {\n this.onProcessingError?.(event);\n },\n eventBroker: this.eventBroker,\n });\n\n const locationAnalyzer =\n this.locationAnalyzer ??\n new AuthorizedLocationAnalyzer(\n new RepoLocationAnalyzer(logger, integrations, this.locationAnalyzers),\n permissionsService,\n );\n const locationService = new AuthorizedLocationService(\n new DefaultLocationService(locationStore, orchestrator, {\n allowedLocationTypes: this.allowedLocationType,\n }),\n permissionsService,\n );\n const refreshService = new AuthorizedRefreshService(\n new DefaultRefreshService({ database: catalogDatabase }),\n permissionsService,\n );\n\n const router = await createRouter({\n entitiesCatalog,\n locationAnalyzer,\n locationService,\n orchestrator,\n refreshService,\n logger,\n config,\n permissionIntegrationRouter,\n auth,\n httpAuth,\n permissionsService,\n disableRelationsCompatibility,\n });\n\n await connectEntityProviders(providerDatabase, entityProviders);\n\n return {\n processingEngine: {\n async start() {\n await processingEngine.start();\n await stitcher.start();\n },\n async stop() {\n await processingEngine.stop();\n await stitcher.stop();\n },\n },\n router,\n };\n }\n\n subscribe(options: {\n onProcessingError: (event: {\n unprocessedEntity: Entity;\n errors: Error[];\n }) => Promise<void> | void;\n }) {\n this.onProcessingError = options.onProcessingError;\n }\n\n private buildEntityPolicy(): EntityPolicy {\n const entityPolicies: EntityPolicy[] = this.entityPoliciesReplace\n ? [new SchemaValidEntityPolicy(), ...this.entityPolicies]\n : [\n new SchemaValidEntityPolicy(),\n new DefaultNamespaceEntityPolicy(),\n new NoForeignRootFieldsEntityPolicy(),\n new FieldFormatEntityPolicy(\n makeValidator(this.fieldFormatValidators),\n ),\n ...this.entityPolicies,\n ];\n\n return EntityPolicies.allOf(entityPolicies);\n }\n\n private buildProcessors(): CatalogProcessor[] {\n const { config, reader } = this.env;\n const integrations = ScmIntegrations.fromConfig(config);\n\n this.checkDeprecatedReaderProcessors();\n\n const placeholderResolvers: Record<string, PlaceholderResolver> = {\n json: jsonPlaceholderResolver,\n yaml: yamlPlaceholderResolver,\n text: textPlaceholderResolver,\n ...this.placeholderResolvers,\n };\n\n // The placeholder is always there no matter what\n const processors: CatalogProcessor[] = [\n new PlaceholderProcessor({\n resolvers: placeholderResolvers,\n reader,\n integrations,\n }),\n ];\n\n const builtinKindsEntityProcessor = new BuiltinKindsEntityProcessor();\n // If the user adds a processor named 'BuiltinKindsEntityProcessor',\n // skip inclusion of the catalog-backend version.\n if (\n !this.processors.some(\n processor =>\n processor.getProcessorName() ===\n builtinKindsEntityProcessor.getProcessorName(),\n )\n ) {\n processors.push(builtinKindsEntityProcessor);\n }\n\n // These are only added unless the user replaced them all\n if (!this.processorsReplace) {\n processors.push(...this.getDefaultProcessors());\n }\n\n // Add the ones (if any) that the user added\n processors.push(...this.processors);\n\n this.checkMissingExternalProcessors(processors);\n\n return processors;\n }\n\n // TODO(Rugvip): These old processors are removed, for a while we'll be throwing\n // errors here to make sure people know where to move the config\n private checkDeprecatedReaderProcessors() {\n const pc = this.env.config.getOptionalConfig('catalog.processors');\n if (pc?.has('github')) {\n throw new Error(\n `Using deprecated configuration for catalog.processors.github, move to using integrations.github instead`,\n );\n }\n if (pc?.has('gitlabApi')) {\n throw new Error(\n `Using deprecated configuration for catalog.processors.gitlabApi, move to using integrations.gitlab instead`,\n );\n }\n if (pc?.has('bitbucketApi')) {\n throw new Error(\n `Using deprecated configuration for catalog.processors.bitbucketApi, move to using integrations.bitbucket instead`,\n );\n }\n if (pc?.has('azureApi')) {\n throw new Error(\n `Using deprecated configuration for catalog.processors.azureApi, move to using integrations.azure instead`,\n );\n }\n }\n\n // TODO(freben): This can be removed no sooner than June 2022, after adopters have had some time to adapt to the new package structure\n private checkMissingExternalProcessors(processors: CatalogProcessor[]) {\n const skipCheckVarName = 'BACKSTAGE_CATALOG_SKIP_MISSING_PROCESSORS_CHECK';\n if (process.env[skipCheckVarName]) {\n return;\n }\n\n const locationTypes = new Set(\n this.env.config\n .getOptionalConfigArray('catalog.locations')\n ?.map(l => l.getString('type')) ?? [],\n );\n const processorNames = new Set(processors.map(p => p.getProcessorName()));\n\n function check(\n locationType: string,\n processorName: string,\n installationUrl: string,\n ) {\n if (\n locationTypes.has(locationType) &&\n !processorNames.has(processorName)\n ) {\n throw new Error(\n [\n `Your config contains a \"catalog.locations\" entry of type ${locationType},`,\n `but does not have the corresponding catalog processor ${processorName} installed.`,\n `This processor used to be built into the catalog itself, but is now moved to an`,\n `external module that has to be installed manually. Please follow the installation`,\n `instructions at ${installationUrl} if you are using this ability, or remove the`,\n `location from your app config if you do not. You can also silence this check entirely`,\n `by setting the environment variable ${skipCheckVarName} to 'true'.`,\n ].join(' '),\n );\n }\n }\n\n check(\n 'aws-cloud-accounts',\n 'AwsOrganizationCloudAccountProcessor',\n 'https://backstage.io/docs/integrations',\n );\n check(\n 's3-discovery',\n 'AwsS3DiscoveryProcessor',\n 'https://backstage.io/docs/integrations/aws-s3/discovery',\n );\n check(\n 'azure-discovery',\n 'AzureDevOpsDiscoveryProcessor',\n 'https://backstage.io/docs/integrations/azure/discovery',\n );\n check(\n 'bitbucket-discovery',\n 'BitbucketDiscoveryProcessor',\n 'https://backstage.io/docs/integrations/bitbucket/discovery',\n );\n check(\n 'github-discovery',\n 'GithubDiscoveryProcessor',\n 'https://backstage.io/docs/integrations/github/discovery',\n );\n check(\n 'github-org',\n 'GithubOrgReaderProcessor',\n 'https://backstage.io/docs/integrations/github/org',\n );\n check(\n 'gitlab-discovery',\n 'GitLabDiscoveryProcessor',\n 'https://backstage.io/docs/integrations/gitlab/discovery',\n );\n check(\n 'ldap-org',\n 'LdapOrgReaderProcessor',\n 'https://backstage.io/docs/integrations/ldap/org',\n );\n check(\n 'microsoft-graph-org',\n 'MicrosoftGraphOrgReaderProcessor',\n 'https://backstage.io/docs/integrations/azure/org',\n );\n }\n\n private static getDefaultProcessingInterval(\n config: Config,\n ): ProcessingIntervalFunction {\n const processingIntervalKey = 'catalog.processingInterval';\n\n if (!config.has(processingIntervalKey)) {\n return createRandomProcessingInterval({\n minSeconds: 100,\n maxSeconds: 150,\n });\n }\n\n if (!Boolean(config.get('catalog.processingInterval'))) {\n return () => {\n throw new Error(\n 'catalog.processingInterval is set to false, processing is disabled.',\n );\n };\n }\n\n const duration = readDurationFromConfig(config, {\n key: processingIntervalKey,\n });\n\n const seconds = Math.max(\n 1,\n Math.round(durationToMilliseconds(duration) / 1000),\n );\n\n return createRandomProcessingInterval({\n minSeconds: seconds,\n maxSeconds: seconds * 1.5,\n });\n }\n}\n"],"names":["catalogPermissions","catalogPermissionRules","createRandomProcessingInterval","lodash","ScmIntegrations","FileReaderProcessor","UrlReaderProcessor","CodeOwnersProcessor","AnnotateLocationEntityProcessor","HostDiscovery","createLegacyAuthAdapters","defaultEntityDataParser","applyDatabaseMigrations","DefaultStitcher","DefaultProcessingDatabase","DefaultProviderDatabase","DefaultCatalogDatabase","DefaultCatalogRulesEnforcer","DefaultEntitiesCatalog","toPermissionEvaluator","DefaultCatalogProcessingOrchestrator","AuthorizedEntitiesCatalog","createConditionTransformer","createPermissionIntegrationRouter","RESOURCE_TYPE_CATALOG_ENTITY","parseEntityRef","basicEntityFilter","keyBy","entitiesResponseToObjects","stringifyEntityRef","DefaultLocationStore","ConfigLocationEntityProvider","DefaultCatalogProcessingEngine","createHash","AuthorizedLocationAnalyzer","RepoLocationAnalyzer","AuthorizedLocationService","DefaultLocationService","AuthorizedRefreshService","DefaultRefreshService","createRouter","connectEntityProviders","SchemaValidEntityPolicy","DefaultNamespaceEntityPolicy","NoForeignRootFieldsEntityPolicy","FieldFormatEntityPolicy","makeValidator","EntityPolicies","jsonPlaceholderResolver","yamlPlaceholderResolver","textPlaceholderResolver","PlaceholderProcessor","BuiltinKindsEntityProcessor","config","readDurationFromConfig","durationToMilliseconds"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0KO,MAAM,cAAe,CAAA;AAAA,EACT,GAAA;AAAA,EACT,cAAA;AAAA,EACA,qBAAA;AAAA,EACA,oBAAA;AAAA,EACA,qBAAA;AAAA,EACA,eAAA;AAAA,EACA,UAAA;AAAA,EACA,iBAAA;AAAA,EACA,iBAAA;AAAA,EACA,MAAA;AAAA,EACA,iBAAA;AAAA,EAIA,kBAAA;AAAA,EACA,gBAAiD,GAAA,KAAA,CAAA;AAAA,EACxC,WAAA;AAAA,EACA,eAAA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ACtD,MAAA,OAAO,MAAM;AACX,QAAA,MAAM,IAAI,KAAA;AAAA,UACR;AAAA,SACF;AAAA,OACF;AAAA;AAGF,IAAM,MAAA,QAAA,GAAWC,8BAAuBD,QAAQ,EAAA;AAAA,MAC9C,GAAK,EAAA;AAAA,KACN,CAAA;AAED,IAAA,MAAM,UAAU,IAAK,CAAA,GAAA;AAAA,MACnB,CAAA;AAAA,MACA,IAAK,CAAA,KAAA,CAAME,4BAAuB,CAAA,QAAQ,IAAI,GAAI;AAAA,KACpD;AAEA,IAAA,OAAOrD,sCAA+B,CAAA;AAAA,MACpC,UAAY,EAAA,OAAA;AAAA,MACZ,YAAY,OAAU,GAAA;AAAA,KACvB,CAAA;AAAA;AAEL;;;;"}
1
+ {"version":3,"file":"CatalogBuilder.cjs.js","sources":["../../src/service/CatalogBuilder.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 {\n createLegacyAuthAdapters,\n HostDiscovery,\n} from '@backstage/backend-common';\nimport {\n DefaultNamespaceEntityPolicy,\n Entity,\n EntityPolicies,\n EntityPolicy,\n FieldFormatEntityPolicy,\n makeValidator,\n NoForeignRootFieldsEntityPolicy,\n parseEntityRef,\n SchemaValidEntityPolicy,\n stringifyEntityRef,\n Validators,\n} from '@backstage/catalog-model';\nimport { ScmIntegrations } from '@backstage/integration';\nimport { createHash } from 'crypto';\nimport { Router } from 'express';\nimport lodash, { keyBy } from 'lodash';\n\nimport {\n CatalogProcessor,\n CatalogProcessorParser,\n EntitiesSearchFilter,\n EntityProvider,\n PlaceholderResolver,\n LocationAnalyzer,\n ScmLocationAnalyzer,\n} from '@backstage/plugin-catalog-node';\nimport {\n AnnotateLocationEntityProcessor,\n BuiltinKindsEntityProcessor,\n CodeOwnersProcessor,\n FileReaderProcessor,\n PlaceholderProcessor,\n UrlReaderProcessor,\n} from '../processors';\nimport { ConfigLocationEntityProvider } from '../providers/ConfigLocationEntityProvider';\nimport { DefaultLocationStore } from '../providers/DefaultLocationStore';\nimport { RepoLocationAnalyzer } from '../ingestion/LocationAnalyzer';\nimport { AuthorizedLocationAnalyzer } from './AuthorizedLocationAnalyzer';\nimport {\n jsonPlaceholderResolver,\n textPlaceholderResolver,\n yamlPlaceholderResolver,\n} from '../processors/PlaceholderProcessor';\nimport { defaultEntityDataParser } from '../util/parse';\nimport {\n CatalogProcessingEngine,\n createRandomProcessingInterval,\n ProcessingIntervalFunction,\n} from '../processing';\nimport { DefaultProcessingDatabase } from '../database/DefaultProcessingDatabase';\nimport { applyDatabaseMigrations } from '../database/migrations';\nimport { DefaultCatalogProcessingEngine } from '../processing/DefaultCatalogProcessingEngine';\nimport { DefaultLocationService } from './DefaultLocationService';\nimport { DefaultEntitiesCatalog } from './DefaultEntitiesCatalog';\nimport { DefaultCatalogProcessingOrchestrator } from '../processing/DefaultCatalogProcessingOrchestrator';\nimport { DefaultStitcher } from '../stitching/DefaultStitcher';\nimport { createRouter } from './createRouter';\nimport { DefaultRefreshService } from './DefaultRefreshService';\nimport { AuthorizedRefreshService } from './AuthorizedRefreshService';\nimport { DefaultCatalogRulesEnforcer } from '../ingestion/CatalogRules';\nimport { Config, readDurationFromConfig } from '@backstage/config';\nimport { connectEntityProviders } from '../processing/connectEntityProviders';\nimport {\n Permission,\n PermissionAuthorizer,\n PermissionRuleParams,\n toPermissionEvaluator,\n} from '@backstage/plugin-permission-common';\nimport { permissionRules as catalogPermissionRules } from '../permissions/rules';\nimport {\n createConditionTransformer,\n createPermissionIntegrationRouter,\n PermissionRule,\n} from '@backstage/plugin-permission-node';\nimport { AuthorizedEntitiesCatalog } from './AuthorizedEntitiesCatalog';\nimport { basicEntityFilter } from './request';\nimport {\n catalogPermissions,\n RESOURCE_TYPE_CATALOG_ENTITY,\n} from '@backstage/plugin-catalog-common/alpha';\nimport { AuthorizedLocationService } from './AuthorizedLocationService';\nimport { DefaultProviderDatabase } from '../database/DefaultProviderDatabase';\nimport { DefaultCatalogDatabase } from '../database/DefaultCatalogDatabase';\nimport { EventBroker, EventsService } from '@backstage/plugin-events-node';\nimport { durationToMilliseconds } from '@backstage/types';\nimport {\n AuthService,\n DatabaseService,\n DiscoveryService,\n HttpAuthService,\n LoggerService,\n PermissionsService,\n RootConfigService,\n UrlReaderService,\n SchedulerService,\n PermissionsRegistryService,\n} from '@backstage/backend-plugin-api';\nimport { entitiesResponseToObjects } from './response';\n\n/**\n * This is a duplicate of the alpha `CatalogPermissionRule` type, for use in the stable API.\n *\n * @public\n */\nexport type CatalogPermissionRuleInput<\n TParams extends PermissionRuleParams = PermissionRuleParams,\n> = PermissionRule<Entity, EntitiesSearchFilter, 'catalog-entity', TParams>;\n\n/**\n * @deprecated Please migrate to the new backend system as this will be removed in the future.\n * @public\n */\nexport type CatalogEnvironment = {\n logger: LoggerService;\n database: DatabaseService;\n config: RootConfigService;\n reader: UrlReaderService;\n permissions: PermissionsService | PermissionAuthorizer;\n permissionsRegistry?: PermissionsRegistryService;\n scheduler?: SchedulerService;\n discovery?: DiscoveryService;\n auth?: AuthService;\n httpAuth?: HttpAuthService;\n};\n\n/**\n * A builder that helps wire up all of the component parts of the catalog.\n *\n * The touch points where you can replace or extend behavior are as follows:\n *\n * - Entity policies can be added or replaced. These are automatically run\n * after the processors' pre-processing steps. All policies are given the\n * chance to inspect the entity, and all of them have to pass in order for\n * the entity to be considered valid from an overall point of view.\n * - Location analyzers can be added. These are responsible for analyzing\n * repositories when onboarding them into the catalog, by finding\n * catalog-info.yaml files and other artifacts that can help automatically\n * register or create catalog data on the user's behalf.\n * - Placeholder resolvers can be replaced or added. These run on the raw\n * structured data between the parsing and pre-processing steps, to replace\n * dollar-prefixed entries with their actual values (like $file).\n * - Field format validators can be replaced. These check the format of\n * individual core fields such as metadata.name, to ensure that they adhere\n * to certain rules.\n * - Processors can be added or replaced. These implement the functionality of\n * reading, parsing, validating, and processing the entity data before it is\n * persisted in the catalog.\n *\n * @public\n * @deprecated Please migrate to the new backend system as this will be removed in the future.\n */\nexport class CatalogBuilder {\n private readonly env: CatalogEnvironment;\n private entityPolicies: EntityPolicy[];\n private entityPoliciesReplace: boolean;\n private placeholderResolvers: Record<string, PlaceholderResolver>;\n private fieldFormatValidators: Partial<Validators>;\n private entityProviders: EntityProvider[];\n private processors: CatalogProcessor[];\n private locationAnalyzers: ScmLocationAnalyzer[];\n private processorsReplace: boolean;\n private parser: CatalogProcessorParser | undefined;\n private onProcessingError?: (event: {\n unprocessedEntity: Entity;\n errors: Error[];\n }) => Promise<void> | void;\n private processingInterval: ProcessingIntervalFunction;\n private locationAnalyzer: LocationAnalyzer | undefined = undefined;\n private readonly permissions: Permission[];\n private readonly permissionRules: CatalogPermissionRuleInput[];\n private allowedLocationType: string[];\n private legacySingleProcessorValidation = false;\n private eventBroker?: EventBroker | EventsService;\n\n /**\n * Creates a catalog builder.\n */\n static create(env: CatalogEnvironment): CatalogBuilder {\n return new CatalogBuilder(env);\n }\n\n private constructor(env: CatalogEnvironment) {\n this.env = env;\n this.entityPolicies = [];\n this.entityPoliciesReplace = false;\n this.placeholderResolvers = {};\n this.fieldFormatValidators = {};\n this.entityProviders = [];\n this.processors = [];\n this.locationAnalyzers = [];\n this.processorsReplace = false;\n this.parser = undefined;\n this.permissions = [...catalogPermissions];\n this.permissionRules = Object.values(catalogPermissionRules);\n this.allowedLocationType = ['url'];\n\n this.processingInterval = CatalogBuilder.getDefaultProcessingInterval(\n env.config,\n );\n }\n\n /**\n * Adds policies that are used to validate entities between the pre-\n * processing and post-processing stages. All such policies must pass for the\n * entity to be considered valid.\n *\n * If what you want to do is to replace the rules for what format is allowed\n * in various core entity fields (such as metadata.name), you may want to use\n * {@link CatalogBuilder#setFieldFormatValidators} instead.\n *\n * @param policies - One or more policies\n */\n addEntityPolicy(\n ...policies: Array<EntityPolicy | Array<EntityPolicy>>\n ): CatalogBuilder {\n this.entityPolicies.push(...policies.flat());\n return this;\n }\n\n /**\n * Processing interval determines how often entities should be processed.\n * Seconds provided will be multiplied by 1.5\n * The default processing interval is 100-150 seconds.\n * setting this too low will potentially deplete request quotas to upstream services.\n */\n setProcessingIntervalSeconds(seconds: number): CatalogBuilder {\n this.processingInterval = createRandomProcessingInterval({\n minSeconds: seconds,\n maxSeconds: seconds * 1.5,\n });\n return this;\n }\n\n /**\n * Overwrites the default processing interval function used to spread\n * entity updates in the catalog.\n */\n setProcessingInterval(\n processingInterval: ProcessingIntervalFunction,\n ): CatalogBuilder {\n this.processingInterval = processingInterval;\n return this;\n }\n\n /**\n * Overwrites the default location analyzer.\n */\n setLocationAnalyzer(locationAnalyzer: LocationAnalyzer): CatalogBuilder {\n this.locationAnalyzer = locationAnalyzer;\n return this;\n }\n\n /**\n * Sets what policies to use for validation of entities between the pre-\n * processing and post-processing stages. All such policies must pass for the\n * entity to be considered valid.\n *\n * If what you want to do is to replace the rules for what format is allowed\n * in various core entity fields (such as metadata.name), you may want to use\n * {@link CatalogBuilder#setFieldFormatValidators} instead.\n *\n * This function replaces the default set of policies; use with care.\n *\n * @param policies - One or more policies\n */\n replaceEntityPolicies(policies: EntityPolicy[]): CatalogBuilder {\n this.entityPolicies = [...policies];\n this.entityPoliciesReplace = true;\n return this;\n }\n\n /**\n * Adds, or overwrites, a handler for placeholders (e.g. $file) in entity\n * definition files.\n *\n * @param key - The key that identifies the placeholder, e.g. \"file\"\n * @param resolver - The resolver that gets values for this placeholder\n */\n setPlaceholderResolver(\n key: string,\n resolver: PlaceholderResolver,\n ): CatalogBuilder {\n this.placeholderResolvers[key] = resolver;\n return this;\n }\n\n /**\n * Sets the validator function to use for one or more special fields of an\n * entity. This is useful if the default rules for formatting of fields are\n * not sufficient.\n *\n * This function has no effect if used together with\n * {@link CatalogBuilder#replaceEntityPolicies}.\n *\n * @param validators - The (subset of) validators to set\n */\n setFieldFormatValidators(validators: Partial<Validators>): CatalogBuilder {\n lodash.merge(this.fieldFormatValidators, validators);\n return this;\n }\n\n /**\n * Adds or replaces entity providers. These are responsible for bootstrapping\n * the list of entities out of original data sources. For example, there is\n * one entity source for the config locations, and one for the database\n * stored locations. If you ingest entities out of a third party system, you\n * may want to implement that in terms of an entity provider as well.\n *\n * @param providers - One or more entity providers\n */\n addEntityProvider(\n ...providers: Array<EntityProvider | Array<EntityProvider>>\n ): CatalogBuilder {\n this.entityProviders.push(...providers.flat());\n return this;\n }\n\n /**\n * Adds entity processors. These are responsible for reading, parsing, and\n * processing entities before they are persisted in the catalog.\n *\n * @param processors - One or more processors\n */\n addProcessor(\n ...processors: Array<CatalogProcessor | Array<CatalogProcessor>>\n ): CatalogBuilder {\n this.processors.push(...processors.flat());\n return this;\n }\n\n /**\n * Sets what entity processors to use. These are responsible for reading,\n * parsing, and processing entities before they are persisted in the catalog.\n *\n * This function replaces the default set of processors, consider using with\n * {@link CatalogBuilder#getDefaultProcessors}; use with care.\n *\n * @param processors - One or more processors\n */\n replaceProcessors(processors: CatalogProcessor[]): CatalogBuilder {\n this.processors = [...processors];\n this.processorsReplace = true;\n return this;\n }\n\n /**\n * Returns the default list of entity processors. These are responsible for reading,\n * parsing, and processing entities before they are persisted in the catalog. Changing\n * the order of processing can give more control to custom processors.\n *\n * Consider using with {@link CatalogBuilder#replaceProcessors}\n *\n */\n getDefaultProcessors(): CatalogProcessor[] {\n const { config, logger, reader } = this.env;\n const integrations = ScmIntegrations.fromConfig(config);\n\n return [\n new FileReaderProcessor(),\n new UrlReaderProcessor({ reader, logger }),\n CodeOwnersProcessor.fromConfig(config, { logger, reader }),\n new AnnotateLocationEntityProcessor({ integrations }),\n ];\n }\n\n /**\n * Adds Location Analyzers. These are responsible for analyzing\n * repositories when onboarding them into the catalog, by finding\n * catalog-info.yaml files and other artifacts that can help automatically\n * register or create catalog data on the user's behalf.\n *\n * @param locationAnalyzers - One or more location analyzers\n */\n addLocationAnalyzers(\n ...analyzers: Array<ScmLocationAnalyzer | Array<ScmLocationAnalyzer>>\n ): CatalogBuilder {\n this.locationAnalyzers.push(...analyzers.flat());\n return this;\n }\n\n /**\n * Sets up the catalog to use a custom parser for entity data.\n *\n * This is the function that gets called immediately after some raw entity\n * specification data has been read from a remote source, and needs to be\n * parsed and emitted as structured data.\n *\n * @param parser - The custom parser\n */\n setEntityDataParser(parser: CatalogProcessorParser): CatalogBuilder {\n this.parser = parser;\n return this;\n }\n\n /**\n * Adds additional permissions. See\n * {@link @backstage/plugin-permission-node#Permission}.\n *\n * @param permissions - Additional permissions\n */\n addPermissions(...permissions: Array<Permission | Array<Permission>>) {\n this.permissions.push(...permissions.flat());\n return this;\n }\n\n /**\n * Adds additional permission rules. Permission rules are used to evaluate\n * catalog resources against queries. See\n * {@link @backstage/plugin-permission-node#PermissionRule}.\n *\n * @param permissionRules - Additional permission rules\n */\n addPermissionRules(\n ...permissionRules: Array<\n CatalogPermissionRuleInput | Array<CatalogPermissionRuleInput>\n >\n ) {\n this.permissionRules.push(...permissionRules.flat());\n return this;\n }\n\n /**\n * Sets up the allowed location types from being registered via the location service.\n *\n * @param allowedLocationTypes - the allowed location types\n */\n setAllowedLocationTypes(allowedLocationTypes: string[]): CatalogBuilder {\n this.allowedLocationType = allowedLocationTypes;\n return this;\n }\n\n /**\n * Enables the legacy behaviour of canceling validation early whenever only a\n * single processor declares an entity kind to be valid.\n */\n useLegacySingleProcessorValidation(): this {\n this.legacySingleProcessorValidation = true;\n return this;\n }\n\n /**\n * Enables the publishing of events for conflicts in the DefaultProcessingDatabase\n */\n setEventBroker(broker: EventBroker | EventsService): CatalogBuilder {\n this.eventBroker = broker;\n return this;\n }\n\n /**\n * Wires up and returns all of the component parts of the catalog\n */\n async build(): Promise<{\n processingEngine: CatalogProcessingEngine;\n router: Router;\n }> {\n const {\n config,\n database,\n logger,\n permissions,\n scheduler,\n permissionsRegistry,\n discovery = HostDiscovery.fromConfig(config),\n } = this.env;\n\n const { auth, httpAuth } = createLegacyAuthAdapters({\n ...this.env,\n discovery,\n });\n\n const disableRelationsCompatibility = config.getOptionalBoolean(\n 'catalog.disableRelationsCompatibility',\n );\n\n const policy = this.buildEntityPolicy();\n const processors = this.buildProcessors();\n const parser = this.parser || defaultEntityDataParser;\n\n const dbClient = await database.getClient();\n if (!database.migrations?.skip) {\n logger.info('Performing database migration');\n await applyDatabaseMigrations(dbClient);\n }\n\n const stitcher = DefaultStitcher.fromConfig(config, {\n knex: dbClient,\n logger,\n });\n\n const processingDatabase = new DefaultProcessingDatabase({\n database: dbClient,\n logger,\n refreshInterval: this.processingInterval,\n eventBroker: this.eventBroker,\n });\n const providerDatabase = new DefaultProviderDatabase({\n database: dbClient,\n logger,\n });\n const catalogDatabase = new DefaultCatalogDatabase({\n database: dbClient,\n logger,\n });\n const integrations = ScmIntegrations.fromConfig(config);\n const rulesEnforcer = DefaultCatalogRulesEnforcer.fromConfig(config);\n\n const unauthorizedEntitiesCatalog = new DefaultEntitiesCatalog({\n database: dbClient,\n logger,\n stitcher,\n disableRelationsCompatibility,\n });\n\n let permissionsService: PermissionsService;\n if ('authorizeConditional' in permissions) {\n permissionsService = permissions as PermissionsService;\n } else {\n logger.warn(\n 'PermissionAuthorizer is deprecated. Please use an instance of PermissionEvaluator instead of PermissionAuthorizer in PluginEnvironment#permissions',\n );\n permissionsService = toPermissionEvaluator(permissions);\n }\n\n const orchestrator = new DefaultCatalogProcessingOrchestrator({\n processors,\n integrations,\n rulesEnforcer,\n logger,\n parser,\n policy,\n legacySingleProcessorValidation: this.legacySingleProcessorValidation,\n });\n\n const entitiesCatalog = new AuthorizedEntitiesCatalog(\n unauthorizedEntitiesCatalog,\n permissionsService,\n createConditionTransformer(this.permissionRules),\n );\n\n const catalogPermissionResource = {\n resourceType: RESOURCE_TYPE_CATALOG_ENTITY,\n getResources: async (resourceRefs: string[]) => {\n const { entities } = await unauthorizedEntitiesCatalog.entities({\n credentials: await auth.getOwnServiceCredentials(),\n filter: {\n anyOf: resourceRefs.map(resourceRef => {\n const { kind, namespace, name } = parseEntityRef(resourceRef);\n\n return basicEntityFilter({\n kind,\n 'metadata.namespace': namespace,\n 'metadata.name': name,\n });\n }),\n },\n });\n\n const entitiesByRef = keyBy(\n entitiesResponseToObjects(entities),\n stringifyEntityRef,\n );\n\n return resourceRefs.map(\n resourceRef =>\n entitiesByRef[stringifyEntityRef(parseEntityRef(resourceRef))],\n );\n },\n permissions: this.permissions,\n rules: this.permissionRules,\n } as const;\n\n let permissionIntegrationRouter:\n | ReturnType<typeof createPermissionIntegrationRouter>\n | undefined;\n if (permissionsRegistry) {\n permissionsRegistry.addResourceType(catalogPermissionResource);\n } else {\n permissionIntegrationRouter = createPermissionIntegrationRouter(\n catalogPermissionResource,\n );\n }\n\n const locationStore = new DefaultLocationStore(dbClient);\n const configLocationProvider = new ConfigLocationEntityProvider(config);\n const entityProviders = lodash.uniqBy(\n [...this.entityProviders, locationStore, configLocationProvider],\n provider => provider.getProviderName(),\n );\n\n const processingEngine = new DefaultCatalogProcessingEngine({\n config,\n scheduler,\n logger,\n knex: dbClient,\n processingDatabase,\n orchestrator,\n stitcher,\n createHash: () => createHash('sha1'),\n pollingIntervalMs: 1000,\n onProcessingError: event => {\n this.onProcessingError?.(event);\n },\n eventBroker: this.eventBroker,\n });\n\n const locationAnalyzer =\n this.locationAnalyzer ??\n new AuthorizedLocationAnalyzer(\n new RepoLocationAnalyzer(logger, integrations, this.locationAnalyzers),\n permissionsService,\n );\n const locationService = new AuthorizedLocationService(\n new DefaultLocationService(locationStore, orchestrator, {\n allowedLocationTypes: this.allowedLocationType,\n }),\n permissionsService,\n );\n const refreshService = new AuthorizedRefreshService(\n new DefaultRefreshService({ database: catalogDatabase }),\n permissionsService,\n );\n\n const router = await createRouter({\n entitiesCatalog,\n locationAnalyzer,\n locationService,\n orchestrator,\n refreshService,\n logger,\n config,\n permissionIntegrationRouter,\n auth,\n httpAuth,\n permissionsService,\n disableRelationsCompatibility,\n });\n\n await connectEntityProviders(providerDatabase, entityProviders);\n\n return {\n processingEngine: {\n async start() {\n await processingEngine.start();\n await stitcher.start();\n },\n async stop() {\n await processingEngine.stop();\n await stitcher.stop();\n },\n },\n router,\n };\n }\n\n subscribe(options: {\n onProcessingError: (event: {\n unprocessedEntity: Entity;\n errors: Error[];\n }) => Promise<void> | void;\n }) {\n this.onProcessingError = options.onProcessingError;\n }\n\n private buildEntityPolicy(): EntityPolicy {\n const entityPolicies: EntityPolicy[] = this.entityPoliciesReplace\n ? [new SchemaValidEntityPolicy(), ...this.entityPolicies]\n : [\n new SchemaValidEntityPolicy(),\n new DefaultNamespaceEntityPolicy(),\n new NoForeignRootFieldsEntityPolicy(),\n new FieldFormatEntityPolicy(\n makeValidator(this.fieldFormatValidators),\n ),\n ...this.entityPolicies,\n ];\n\n return EntityPolicies.allOf(entityPolicies);\n }\n\n private buildProcessors(): CatalogProcessor[] {\n const { config, reader } = this.env;\n const integrations = ScmIntegrations.fromConfig(config);\n\n this.checkDeprecatedReaderProcessors();\n\n const placeholderResolvers: Record<string, PlaceholderResolver> = {\n json: jsonPlaceholderResolver,\n yaml: yamlPlaceholderResolver,\n text: textPlaceholderResolver,\n ...this.placeholderResolvers,\n };\n\n // The placeholder is always there no matter what\n const processors: CatalogProcessor[] = [\n new PlaceholderProcessor({\n resolvers: placeholderResolvers,\n reader,\n integrations,\n }),\n ];\n\n const builtinKindsEntityProcessor = new BuiltinKindsEntityProcessor();\n // If the user adds a processor named 'BuiltinKindsEntityProcessor',\n // skip inclusion of the catalog-backend version.\n if (\n !this.processors.some(\n processor =>\n processor.getProcessorName() ===\n builtinKindsEntityProcessor.getProcessorName(),\n )\n ) {\n processors.push(builtinKindsEntityProcessor);\n }\n\n // These are only added unless the user replaced them all\n if (!this.processorsReplace) {\n processors.push(...this.getDefaultProcessors());\n }\n\n // Add the ones (if any) that the user added\n processors.push(...this.processors);\n\n this.checkMissingExternalProcessors(processors);\n\n return processors;\n }\n\n // TODO(Rugvip): These old processors are removed, for a while we'll be throwing\n // errors here to make sure people know where to move the config\n private checkDeprecatedReaderProcessors() {\n const pc = this.env.config.getOptionalConfig('catalog.processors');\n if (pc?.has('github')) {\n throw new Error(\n `Using deprecated configuration for catalog.processors.github, move to using integrations.github instead`,\n );\n }\n if (pc?.has('gitlabApi')) {\n throw new Error(\n `Using deprecated configuration for catalog.processors.gitlabApi, move to using integrations.gitlab instead`,\n );\n }\n if (pc?.has('bitbucketApi')) {\n throw new Error(\n `Using deprecated configuration for catalog.processors.bitbucketApi, move to using integrations.bitbucket instead`,\n );\n }\n if (pc?.has('azureApi')) {\n throw new Error(\n `Using deprecated configuration for catalog.processors.azureApi, move to using integrations.azure instead`,\n );\n }\n }\n\n // TODO(freben): This can be removed no sooner than June 2022, after adopters have had some time to adapt to the new package structure\n private checkMissingExternalProcessors(processors: CatalogProcessor[]) {\n const skipCheckVarName = 'BACKSTAGE_CATALOG_SKIP_MISSING_PROCESSORS_CHECK';\n if (process.env[skipCheckVarName]) {\n return;\n }\n\n const locationTypes = new Set(\n this.env.config\n .getOptionalConfigArray('catalog.locations')\n ?.map(l => l.getString('type')) ?? [],\n );\n const processorNames = new Set(processors.map(p => p.getProcessorName()));\n\n function check(\n locationType: string,\n processorName: string,\n installationUrl: string,\n ) {\n if (\n locationTypes.has(locationType) &&\n !processorNames.has(processorName)\n ) {\n throw new Error(\n [\n `Your config contains a \"catalog.locations\" entry of type ${locationType},`,\n `but does not have the corresponding catalog processor ${processorName} installed.`,\n `This processor used to be built into the catalog itself, but is now moved to an`,\n `external module that has to be installed manually. Please follow the installation`,\n `instructions at ${installationUrl} if you are using this ability, or remove the`,\n `location from your app config if you do not. You can also silence this check entirely`,\n `by setting the environment variable ${skipCheckVarName} to 'true'.`,\n ].join(' '),\n );\n }\n }\n\n check(\n 'aws-cloud-accounts',\n 'AwsOrganizationCloudAccountProcessor',\n 'https://backstage.io/docs/integrations',\n );\n check(\n 's3-discovery',\n 'AwsS3DiscoveryProcessor',\n 'https://backstage.io/docs/integrations/aws-s3/discovery',\n );\n check(\n 'azure-discovery',\n 'AzureDevOpsDiscoveryProcessor',\n 'https://backstage.io/docs/integrations/azure/discovery',\n );\n check(\n 'bitbucket-discovery',\n 'BitbucketDiscoveryProcessor',\n 'https://backstage.io/docs/integrations/bitbucket/discovery',\n );\n check(\n 'github-discovery',\n 'GithubDiscoveryProcessor',\n 'https://backstage.io/docs/integrations/github/discovery',\n );\n check(\n 'github-org',\n 'GithubOrgReaderProcessor',\n 'https://backstage.io/docs/integrations/github/org',\n );\n check(\n 'gitlab-discovery',\n 'GitLabDiscoveryProcessor',\n 'https://backstage.io/docs/integrations/gitlab/discovery',\n );\n check(\n 'ldap-org',\n 'LdapOrgReaderProcessor',\n 'https://backstage.io/docs/integrations/ldap/org',\n );\n check(\n 'microsoft-graph-org',\n 'MicrosoftGraphOrgReaderProcessor',\n 'https://backstage.io/docs/integrations/azure/org',\n );\n }\n\n private static getDefaultProcessingInterval(\n config: Config,\n ): ProcessingIntervalFunction {\n const processingIntervalKey = 'catalog.processingInterval';\n\n if (!config.has(processingIntervalKey)) {\n return createRandomProcessingInterval({\n minSeconds: 100,\n maxSeconds: 150,\n });\n }\n\n if (!Boolean(config.get('catalog.processingInterval'))) {\n return () => {\n throw new Error(\n 'catalog.processingInterval is set to false, processing is disabled.',\n );\n };\n }\n\n const duration = readDurationFromConfig(config, {\n key: processingIntervalKey,\n });\n\n const seconds = Math.max(\n 1,\n Math.round(durationToMilliseconds(duration) / 1000),\n );\n\n return createRandomProcessingInterval({\n minSeconds: seconds,\n maxSeconds: seconds * 1.5,\n });\n }\n}\n"],"names":["catalogPermissions","catalogPermissionRules","createRandomProcessingInterval","lodash","ScmIntegrations","FileReaderProcessor","UrlReaderProcessor","CodeOwnersProcessor","AnnotateLocationEntityProcessor","HostDiscovery","createLegacyAuthAdapters","defaultEntityDataParser","applyDatabaseMigrations","DefaultStitcher","DefaultProcessingDatabase","DefaultProviderDatabase","DefaultCatalogDatabase","DefaultCatalogRulesEnforcer","DefaultEntitiesCatalog","toPermissionEvaluator","DefaultCatalogProcessingOrchestrator","AuthorizedEntitiesCatalog","createConditionTransformer","RESOURCE_TYPE_CATALOG_ENTITY","parseEntityRef","basicEntityFilter","keyBy","entitiesResponseToObjects","stringifyEntityRef","createPermissionIntegrationRouter","DefaultLocationStore","ConfigLocationEntityProvider","DefaultCatalogProcessingEngine","createHash","AuthorizedLocationAnalyzer","RepoLocationAnalyzer","AuthorizedLocationService","DefaultLocationService","AuthorizedRefreshService","DefaultRefreshService","createRouter","connectEntityProviders","SchemaValidEntityPolicy","DefaultNamespaceEntityPolicy","NoForeignRootFieldsEntityPolicy","FieldFormatEntityPolicy","makeValidator","EntityPolicies","jsonPlaceholderResolver","yamlPlaceholderResolver","textPlaceholderResolver","PlaceholderProcessor","BuiltinKindsEntityProcessor","config","readDurationFromConfig","durationToMilliseconds"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4KO,MAAM,cAAe,CAAA;AAAA,EACT,GAAA;AAAA,EACT,cAAA;AAAA,EACA,qBAAA;AAAA,EACA,oBAAA;AAAA,EACA,qBAAA;AAAA,EACA,eAAA;AAAA,EACA,UAAA;AAAA,EACA,iBAAA;AAAA,EACA,iBAAA;AAAA,EACA,MAAA;AAAA,EACA,iBAAA;AAAA,EAIA,kBAAA;AAAA,EACA,gBAAiD,GAAA,KAAA,CAAA;AAAA,EACxC,WAAA;AAAA,EACA,eAAA;AAAA,EACT,mBAAA;AAAA,EACA,+BAAkC,GAAA,KAAA;AAAA,EAClC,WAAA;AAAA;AAAA;AAAA;AAAA,EAKR,OAAO,OAAO,GAAyC,EAAA;AACrD,IAAO,OAAA,IAAI,eAAe,GAAG,CAAA;AAAA;AAC/B,EAEQ,YAAY,GAAyB,EAAA;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OAAO,MAAM;AACX,QAAA,MAAM,IAAI,KAAA;AAAA,UACR;AAAA,SACF;AAAA,OACF;AAAA;AAGF,IAAM,MAAA,QAAA,GAAWC,8BAAuBD,QAAQ,EAAA;AAAA,MAC9C,GAAK,EAAA;AAAA,KACN,CAAA;AAED,IAAA,MAAM,UAAU,IAAK,CAAA,GAAA;AAAA,MACnB,CAAA;AAAA,MACA,IAAK,CAAA,KAAA,CAAME,4BAAuB,CAAA,QAAQ,IAAI,GAAI;AAAA,KACpD;AAEA,IAAA,OAAOrD,sCAA+B,CAAA;AAAA,MACpC,UAAY,EAAA,OAAA;AAAA,MACZ,YAAY,OAAU,GAAA;AAAA,KACvB,CAAA;AAAA;AAEL;;;;"}
@@ -132,6 +132,7 @@ const catalogPlugin = backendPluginApi.createBackendPlugin({
132
132
  config: backendPluginApi.coreServices.rootConfig,
133
133
  reader: backendPluginApi.coreServices.urlReader,
134
134
  permissions: backendPluginApi.coreServices.permissions,
135
+ permissionsRegistry: backendPluginApi.coreServices.permissionsRegistry,
135
136
  database: backendPluginApi.coreServices.database,
136
137
  httpRouter: backendPluginApi.coreServices.httpRouter,
137
138
  lifecycle: backendPluginApi.coreServices.rootLifecycle,
@@ -147,6 +148,7 @@ const catalogPlugin = backendPluginApi.createBackendPlugin({
147
148
  reader,
148
149
  database,
149
150
  permissions,
151
+ permissionsRegistry,
150
152
  httpRouter,
151
153
  lifecycle,
152
154
  scheduler,
@@ -159,6 +161,7 @@ const catalogPlugin = backendPluginApi.createBackendPlugin({
159
161
  config,
160
162
  reader,
161
163
  permissions,
164
+ permissionsRegistry,
162
165
  database,
163
166
  scheduler,
164
167
  logger,
@@ -1 +1 @@
1
- {"version":3,"file":"CatalogPlugin.cjs.js","sources":["../../src/service/CatalogPlugin.ts"],"sourcesContent":["/*\n * Copyright 2022 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 */\nimport {\n coreServices,\n createBackendPlugin,\n} from '@backstage/backend-plugin-api';\nimport { eventsServiceRef } from '@backstage/plugin-events-node';\nimport { Entity, Validators } from '@backstage/catalog-model';\nimport { CatalogBuilder, CatalogPermissionRuleInput } from './CatalogBuilder';\nimport {\n catalogAnalysisExtensionPoint,\n CatalogModelExtensionPoint,\n catalogModelExtensionPoint,\n CatalogPermissionExtensionPoint,\n catalogPermissionExtensionPoint,\n CatalogProcessingExtensionPoint,\n catalogProcessingExtensionPoint,\n CatalogLocationsExtensionPoint,\n catalogLocationsExtensionPoint,\n} from '@backstage/plugin-catalog-node/alpha';\nimport {\n CatalogProcessor,\n CatalogProcessorParser,\n EntityProvider,\n LocationAnalyzer,\n PlaceholderResolver,\n ScmLocationAnalyzer,\n} from '@backstage/plugin-catalog-node';\nimport { merge } from 'lodash';\nimport { Permission } from '@backstage/plugin-permission-common';\nimport { ForwardedError } from '@backstage/errors';\n\nclass CatalogLocationsExtensionPointImpl\n implements CatalogLocationsExtensionPoint\n{\n #locationTypes: string[] | undefined;\n\n setAllowedLocationTypes(locationTypes: Array<string>) {\n this.#locationTypes = locationTypes;\n }\n\n get allowedLocationTypes() {\n return this.#locationTypes;\n }\n}\n\nclass CatalogProcessingExtensionPointImpl\n implements CatalogProcessingExtensionPoint\n{\n #processors = new Array<CatalogProcessor>();\n #entityProviders = new Array<EntityProvider>();\n #placeholderResolvers: Record<string, PlaceholderResolver> = {};\n #onProcessingErrorHandler?: (event: {\n unprocessedEntity: Entity;\n errors: Error[];\n }) => Promise<void> | void;\n\n addProcessor(\n ...processors: Array<CatalogProcessor | Array<CatalogProcessor>>\n ): void {\n this.#processors.push(...processors.flat());\n }\n\n addEntityProvider(\n ...providers: Array<EntityProvider | Array<EntityProvider>>\n ): void {\n this.#entityProviders.push(...providers.flat());\n }\n\n addPlaceholderResolver(key: string, resolver: PlaceholderResolver) {\n if (key in this.#placeholderResolvers)\n throw new Error(\n `A placeholder resolver for '${key}' has already been set up, please check your config.`,\n );\n this.#placeholderResolvers[key] = resolver;\n }\n\n setOnProcessingErrorHandler(\n handler: (event: {\n unprocessedEntity: Entity;\n errors: Error[];\n }) => Promise<void> | void,\n ) {\n this.#onProcessingErrorHandler = handler;\n }\n\n get processors() {\n return this.#processors;\n }\n\n get entityProviders() {\n return this.#entityProviders;\n }\n\n get placeholderResolvers() {\n return this.#placeholderResolvers;\n }\n\n get onProcessingErrorHandler() {\n return this.#onProcessingErrorHandler;\n }\n}\n\nclass CatalogPermissionExtensionPointImpl\n implements CatalogPermissionExtensionPoint\n{\n #permissions = new Array<Permission>();\n #permissionRules = new Array<CatalogPermissionRuleInput>();\n\n addPermissions(...permission: Array<Permission | Array<Permission>>): void {\n this.#permissions.push(...permission.flat());\n }\n\n addPermissionRules(\n ...rules: Array<\n CatalogPermissionRuleInput | Array<CatalogPermissionRuleInput>\n >\n ): void {\n this.#permissionRules.push(...rules.flat());\n }\n\n get permissions() {\n return this.#permissions;\n }\n\n get permissionRules() {\n return this.#permissionRules;\n }\n}\n\nclass CatalogModelExtensionPointImpl implements CatalogModelExtensionPoint {\n #fieldValidators: Partial<Validators> = {};\n\n setFieldValidators(validators: Partial<Validators>): void {\n merge(this.#fieldValidators, validators);\n }\n\n get fieldValidators() {\n return this.#fieldValidators;\n }\n\n #entityDataParser?: CatalogProcessorParser;\n\n setEntityDataParser(parser: CatalogProcessorParser): void {\n if (this.#entityDataParser) {\n throw new Error(\n 'Attempted to install second EntityDataParser. Only one can be set.',\n );\n }\n this.#entityDataParser = parser;\n }\n\n get entityDataParser() {\n return this.#entityDataParser;\n }\n}\n\n/**\n * Catalog plugin\n * @public\n */\nexport const catalogPlugin = createBackendPlugin({\n pluginId: 'catalog',\n register(env) {\n const processingExtensions = new CatalogProcessingExtensionPointImpl();\n // plugins depending on this API will be initialized before this plugins init method is executed.\n env.registerExtensionPoint(\n catalogProcessingExtensionPoint,\n processingExtensions,\n );\n\n let locationAnalyzerFactory:\n | ((options: {\n scmLocationAnalyzers: ScmLocationAnalyzer[];\n }) => Promise<{ locationAnalyzer: LocationAnalyzer }>)\n | undefined = undefined;\n const scmLocationAnalyzers = new Array<ScmLocationAnalyzer>();\n env.registerExtensionPoint(catalogAnalysisExtensionPoint, {\n setLocationAnalyzer(analyzerOrFactory) {\n if (locationAnalyzerFactory) {\n throw new Error('LocationAnalyzer has already been set');\n }\n if (typeof analyzerOrFactory === 'function') {\n locationAnalyzerFactory = analyzerOrFactory;\n } else {\n locationAnalyzerFactory = async () => ({\n locationAnalyzer: analyzerOrFactory,\n });\n }\n },\n addScmLocationAnalyzer(analyzer: ScmLocationAnalyzer) {\n scmLocationAnalyzers.push(analyzer);\n },\n });\n\n const permissionExtensions = new CatalogPermissionExtensionPointImpl();\n env.registerExtensionPoint(\n catalogPermissionExtensionPoint,\n permissionExtensions,\n );\n\n const modelExtensions = new CatalogModelExtensionPointImpl();\n env.registerExtensionPoint(catalogModelExtensionPoint, modelExtensions);\n\n const locationTypeExtensions = new CatalogLocationsExtensionPointImpl();\n env.registerExtensionPoint(\n catalogLocationsExtensionPoint,\n locationTypeExtensions,\n );\n\n env.registerInit({\n deps: {\n logger: coreServices.logger,\n config: coreServices.rootConfig,\n reader: coreServices.urlReader,\n permissions: coreServices.permissions,\n database: coreServices.database,\n httpRouter: coreServices.httpRouter,\n lifecycle: coreServices.rootLifecycle,\n scheduler: coreServices.scheduler,\n discovery: coreServices.discovery,\n auth: coreServices.auth,\n httpAuth: coreServices.httpAuth,\n events: eventsServiceRef,\n },\n async init({\n logger,\n config,\n reader,\n database,\n permissions,\n httpRouter,\n lifecycle,\n scheduler,\n discovery,\n auth,\n httpAuth,\n events,\n }) {\n const builder = await CatalogBuilder.create({\n config,\n reader,\n permissions,\n database,\n scheduler,\n logger,\n discovery,\n auth,\n httpAuth,\n });\n\n builder.setEventBroker(events);\n\n if (processingExtensions.onProcessingErrorHandler) {\n builder.subscribe({\n onProcessingError: processingExtensions.onProcessingErrorHandler,\n });\n }\n builder.addProcessor(...processingExtensions.processors);\n builder.addEntityProvider(...processingExtensions.entityProviders);\n\n if (modelExtensions.entityDataParser) {\n builder.setEntityDataParser(modelExtensions.entityDataParser);\n }\n\n Object.entries(processingExtensions.placeholderResolvers).forEach(\n ([key, resolver]) => builder.setPlaceholderResolver(key, resolver),\n );\n if (locationAnalyzerFactory) {\n const { locationAnalyzer } = await locationAnalyzerFactory({\n scmLocationAnalyzers,\n }).catch(e => {\n throw new ForwardedError('Failed to create LocationAnalyzer', e);\n });\n builder.setLocationAnalyzer(locationAnalyzer);\n } else {\n builder.addLocationAnalyzers(...scmLocationAnalyzers);\n }\n builder.addPermissions(...permissionExtensions.permissions);\n builder.addPermissionRules(...permissionExtensions.permissionRules);\n builder.setFieldFormatValidators(modelExtensions.fieldValidators);\n\n if (locationTypeExtensions.allowedLocationTypes) {\n builder.setAllowedLocationTypes(\n locationTypeExtensions.allowedLocationTypes,\n );\n }\n\n const { processingEngine, router } = await builder.build();\n\n if (config.getOptional('catalog.processingInterval') ?? true) {\n lifecycle.addStartupHook(async () => {\n await processingEngine.start();\n });\n lifecycle.addShutdownHook(() => processingEngine.stop());\n }\n\n httpRouter.use(router);\n },\n });\n },\n});\n"],"names":["merge","createBackendPlugin","catalogProcessingExtensionPoint","catalogAnalysisExtensionPoint","catalogPermissionExtensionPoint","catalogModelExtensionPoint","catalogLocationsExtensionPoint","coreServices","eventsServiceRef","CatalogBuilder","ForwardedError"],"mappings":";;;;;;;;;AA6CA,MAAM,kCAEN,CAAA;AAAA,EACE,cAAA;AAAA,EAEA,wBAAwB,aAA8B,EAAA;AACpD,IAAA,IAAA,CAAK,cAAiB,GAAA,aAAA;AAAA;AACxB,EAEA,IAAI,oBAAuB,GAAA;AACzB,IAAA,OAAO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KAAA,CAAM,CAAK,CAAA,KAAA;AACZ,YAAM,MAAA,IAAIC,qBAAe,CAAA,mCAAA,EAAqC,CAAC,CAAA;AAAA,WAChE,CAAA;AACD,UAAA,OAAA,CAAQ,oBAAoB,gBAAgB,CAAA;AAAA,SACvC,MAAA;AACL,UAAQ,OAAA,CAAA,oBAAA,CAAqB,GAAG,oBAAoB,CAAA;AAAA;AAEtD,QAAQ,OAAA,CAAA,cAAA,CAAe,GAAG,oBAAA,CAAqB,WAAW,CAAA;AAC1D,QAAQ,OAAA,CAAA,kBAAA,CAAmB,GAAG,oBAAA,CAAqB,eAAe,CAAA;AAClE,QAAQ,OAAA,CAAA,wBAAA,CAAyB,gBAAgB,eAAe,CAAA;AAEhE,QAAA,IAAI,uBAAuB,oBAAsB,EAAA;AAC/C,UAAQ,OAAA,CAAA,uBAAA;AAAA,YACN,sBAAuB,CAAA;AAAA,WACzB;AAAA;AAGF,QAAA,MAAM,EAAE,gBAAkB,EAAA,MAAA,EAAW,GAAA,MAAM,QAAQ,KAAM,EAAA;AAEzD,QAAA,IAAI,MAAO,CAAA,WAAA,CAAY,4BAA4B,CAAA,IAAK,IAAM,EAAA;AAC5D,UAAA,SAAA,CAAU,eAAe,YAAY;AACnC,YAAA,MAAM,iBAAiB,KAAM,EAAA;AAAA,WAC9B,CAAA;AACD,UAAA,SAAA,CAAU,eAAgB,CAAA,MAAM,gBAAiB,CAAA,IAAA,EAAM,CAAA;AAAA;AAGzD,QAAA,UAAA,CAAW,IAAI,MAAM,CAAA;AAAA;AACvB,KACD,CAAA;AAAA;AAEL,CAAC;;;;"}
1
+ {"version":3,"file":"CatalogPlugin.cjs.js","sources":["../../src/service/CatalogPlugin.ts"],"sourcesContent":["/*\n * Copyright 2022 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 */\nimport {\n coreServices,\n createBackendPlugin,\n} from '@backstage/backend-plugin-api';\nimport { eventsServiceRef } from '@backstage/plugin-events-node';\nimport { Entity, Validators } from '@backstage/catalog-model';\nimport { CatalogBuilder, CatalogPermissionRuleInput } from './CatalogBuilder';\nimport {\n catalogAnalysisExtensionPoint,\n CatalogModelExtensionPoint,\n catalogModelExtensionPoint,\n CatalogPermissionExtensionPoint,\n catalogPermissionExtensionPoint,\n CatalogProcessingExtensionPoint,\n catalogProcessingExtensionPoint,\n CatalogLocationsExtensionPoint,\n catalogLocationsExtensionPoint,\n} from '@backstage/plugin-catalog-node/alpha';\nimport {\n CatalogProcessor,\n CatalogProcessorParser,\n EntityProvider,\n LocationAnalyzer,\n PlaceholderResolver,\n ScmLocationAnalyzer,\n} from '@backstage/plugin-catalog-node';\nimport { merge } from 'lodash';\nimport { Permission } from '@backstage/plugin-permission-common';\nimport { ForwardedError } from '@backstage/errors';\n\nclass CatalogLocationsExtensionPointImpl\n implements CatalogLocationsExtensionPoint\n{\n #locationTypes: string[] | undefined;\n\n setAllowedLocationTypes(locationTypes: Array<string>) {\n this.#locationTypes = locationTypes;\n }\n\n get allowedLocationTypes() {\n return this.#locationTypes;\n }\n}\n\nclass CatalogProcessingExtensionPointImpl\n implements CatalogProcessingExtensionPoint\n{\n #processors = new Array<CatalogProcessor>();\n #entityProviders = new Array<EntityProvider>();\n #placeholderResolvers: Record<string, PlaceholderResolver> = {};\n #onProcessingErrorHandler?: (event: {\n unprocessedEntity: Entity;\n errors: Error[];\n }) => Promise<void> | void;\n\n addProcessor(\n ...processors: Array<CatalogProcessor | Array<CatalogProcessor>>\n ): void {\n this.#processors.push(...processors.flat());\n }\n\n addEntityProvider(\n ...providers: Array<EntityProvider | Array<EntityProvider>>\n ): void {\n this.#entityProviders.push(...providers.flat());\n }\n\n addPlaceholderResolver(key: string, resolver: PlaceholderResolver) {\n if (key in this.#placeholderResolvers)\n throw new Error(\n `A placeholder resolver for '${key}' has already been set up, please check your config.`,\n );\n this.#placeholderResolvers[key] = resolver;\n }\n\n setOnProcessingErrorHandler(\n handler: (event: {\n unprocessedEntity: Entity;\n errors: Error[];\n }) => Promise<void> | void,\n ) {\n this.#onProcessingErrorHandler = handler;\n }\n\n get processors() {\n return this.#processors;\n }\n\n get entityProviders() {\n return this.#entityProviders;\n }\n\n get placeholderResolvers() {\n return this.#placeholderResolvers;\n }\n\n get onProcessingErrorHandler() {\n return this.#onProcessingErrorHandler;\n }\n}\n\nclass CatalogPermissionExtensionPointImpl\n implements CatalogPermissionExtensionPoint\n{\n #permissions = new Array<Permission>();\n #permissionRules = new Array<CatalogPermissionRuleInput>();\n\n addPermissions(...permission: Array<Permission | Array<Permission>>): void {\n this.#permissions.push(...permission.flat());\n }\n\n addPermissionRules(\n ...rules: Array<\n CatalogPermissionRuleInput | Array<CatalogPermissionRuleInput>\n >\n ): void {\n this.#permissionRules.push(...rules.flat());\n }\n\n get permissions() {\n return this.#permissions;\n }\n\n get permissionRules() {\n return this.#permissionRules;\n }\n}\n\nclass CatalogModelExtensionPointImpl implements CatalogModelExtensionPoint {\n #fieldValidators: Partial<Validators> = {};\n\n setFieldValidators(validators: Partial<Validators>): void {\n merge(this.#fieldValidators, validators);\n }\n\n get fieldValidators() {\n return this.#fieldValidators;\n }\n\n #entityDataParser?: CatalogProcessorParser;\n\n setEntityDataParser(parser: CatalogProcessorParser): void {\n if (this.#entityDataParser) {\n throw new Error(\n 'Attempted to install second EntityDataParser. Only one can be set.',\n );\n }\n this.#entityDataParser = parser;\n }\n\n get entityDataParser() {\n return this.#entityDataParser;\n }\n}\n\n/**\n * Catalog plugin\n * @public\n */\nexport const catalogPlugin = createBackendPlugin({\n pluginId: 'catalog',\n register(env) {\n const processingExtensions = new CatalogProcessingExtensionPointImpl();\n // plugins depending on this API will be initialized before this plugins init method is executed.\n env.registerExtensionPoint(\n catalogProcessingExtensionPoint,\n processingExtensions,\n );\n\n let locationAnalyzerFactory:\n | ((options: {\n scmLocationAnalyzers: ScmLocationAnalyzer[];\n }) => Promise<{ locationAnalyzer: LocationAnalyzer }>)\n | undefined = undefined;\n const scmLocationAnalyzers = new Array<ScmLocationAnalyzer>();\n env.registerExtensionPoint(catalogAnalysisExtensionPoint, {\n setLocationAnalyzer(analyzerOrFactory) {\n if (locationAnalyzerFactory) {\n throw new Error('LocationAnalyzer has already been set');\n }\n if (typeof analyzerOrFactory === 'function') {\n locationAnalyzerFactory = analyzerOrFactory;\n } else {\n locationAnalyzerFactory = async () => ({\n locationAnalyzer: analyzerOrFactory,\n });\n }\n },\n addScmLocationAnalyzer(analyzer: ScmLocationAnalyzer) {\n scmLocationAnalyzers.push(analyzer);\n },\n });\n\n const permissionExtensions = new CatalogPermissionExtensionPointImpl();\n env.registerExtensionPoint(\n catalogPermissionExtensionPoint,\n permissionExtensions,\n );\n\n const modelExtensions = new CatalogModelExtensionPointImpl();\n env.registerExtensionPoint(catalogModelExtensionPoint, modelExtensions);\n\n const locationTypeExtensions = new CatalogLocationsExtensionPointImpl();\n env.registerExtensionPoint(\n catalogLocationsExtensionPoint,\n locationTypeExtensions,\n );\n\n env.registerInit({\n deps: {\n logger: coreServices.logger,\n config: coreServices.rootConfig,\n reader: coreServices.urlReader,\n permissions: coreServices.permissions,\n permissionsRegistry: coreServices.permissionsRegistry,\n database: coreServices.database,\n httpRouter: coreServices.httpRouter,\n lifecycle: coreServices.rootLifecycle,\n scheduler: coreServices.scheduler,\n discovery: coreServices.discovery,\n auth: coreServices.auth,\n httpAuth: coreServices.httpAuth,\n events: eventsServiceRef,\n },\n async init({\n logger,\n config,\n reader,\n database,\n permissions,\n permissionsRegistry,\n httpRouter,\n lifecycle,\n scheduler,\n discovery,\n auth,\n httpAuth,\n events,\n }) {\n const builder = await CatalogBuilder.create({\n config,\n reader,\n permissions,\n permissionsRegistry,\n database,\n scheduler,\n logger,\n discovery,\n auth,\n httpAuth,\n });\n\n builder.setEventBroker(events);\n\n if (processingExtensions.onProcessingErrorHandler) {\n builder.subscribe({\n onProcessingError: processingExtensions.onProcessingErrorHandler,\n });\n }\n builder.addProcessor(...processingExtensions.processors);\n builder.addEntityProvider(...processingExtensions.entityProviders);\n\n if (modelExtensions.entityDataParser) {\n builder.setEntityDataParser(modelExtensions.entityDataParser);\n }\n\n Object.entries(processingExtensions.placeholderResolvers).forEach(\n ([key, resolver]) => builder.setPlaceholderResolver(key, resolver),\n );\n if (locationAnalyzerFactory) {\n const { locationAnalyzer } = await locationAnalyzerFactory({\n scmLocationAnalyzers,\n }).catch(e => {\n throw new ForwardedError('Failed to create LocationAnalyzer', e);\n });\n builder.setLocationAnalyzer(locationAnalyzer);\n } else {\n builder.addLocationAnalyzers(...scmLocationAnalyzers);\n }\n builder.addPermissions(...permissionExtensions.permissions);\n builder.addPermissionRules(...permissionExtensions.permissionRules);\n builder.setFieldFormatValidators(modelExtensions.fieldValidators);\n\n if (locationTypeExtensions.allowedLocationTypes) {\n builder.setAllowedLocationTypes(\n locationTypeExtensions.allowedLocationTypes,\n );\n }\n\n const { processingEngine, router } = await builder.build();\n\n if (config.getOptional('catalog.processingInterval') ?? true) {\n lifecycle.addStartupHook(async () => {\n await processingEngine.start();\n });\n lifecycle.addShutdownHook(() => processingEngine.stop());\n }\n\n httpRouter.use(router);\n },\n });\n },\n});\n"],"names":["merge","createBackendPlugin","catalogProcessingExtensionPoint","catalogAnalysisExtensionPoint","catalogPermissionExtensionPoint","catalogModelExtensionPoint","catalogLocationsExtensionPoint","coreServices","eventsServiceRef","CatalogBuilder","ForwardedError"],"mappings":";;;;;;;;;AA6CA,MAAM,kCAEN,CAAA;AAAA,EACE,cAAA;AAAA,EAEA,wBAAwB,aAA8B,EAAA;AACpD,IAAA,IAAA,CAAK,cAAiB,GAAA,aAAA;AAAA;AACxB,EAEA,IAAI,oBAAuB,GAAA;AACzB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A,MAAM,EAAE,gBAAA,EAAqB,GAAA,MAAM,uBAAwB,CAAA;AAAA,YACzD;AAAA,WACD,CAAE,CAAA,KAAA,CAAM,CAAK,CAAA,KAAA;AACZ,YAAM,MAAA,IAAIC,qBAAe,CAAA,mCAAA,EAAqC,CAAC,CAAA;AAAA,WAChE,CAAA;AACD,UAAA,OAAA,CAAQ,oBAAoB,gBAAgB,CAAA;AAAA,SACvC,MAAA;AACL,UAAQ,OAAA,CAAA,oBAAA,CAAqB,GAAG,oBAAoB,CAAA;AAAA;AAEtD,QAAQ,OAAA,CAAA,cAAA,CAAe,GAAG,oBAAA,CAAqB,WAAW,CAAA;AAC1D,QAAQ,OAAA,CAAA,kBAAA,CAAmB,GAAG,oBAAA,CAAqB,eAAe,CAAA;AAClE,QAAQ,OAAA,CAAA,wBAAA,CAAyB,gBAAgB,eAAe,CAAA;AAEhE,QAAA,IAAI,uBAAuB,oBAAsB,EAAA;AAC/C,UAAQ,OAAA,CAAA,uBAAA;AAAA,YACN,sBAAuB,CAAA;AAAA,WACzB;AAAA;AAGF,QAAA,MAAM,EAAE,gBAAkB,EAAA,MAAA,EAAW,GAAA,MAAM,QAAQ,KAAM,EAAA;AAEzD,QAAA,IAAI,MAAO,CAAA,WAAA,CAAY,4BAA4B,CAAA,IAAK,IAAM,EAAA;AAC5D,UAAA,SAAA,CAAU,eAAe,YAAY;AACnC,YAAA,MAAM,iBAAiB,KAAM,EAAA;AAAA,WAC9B,CAAA;AACD,UAAA,SAAA,CAAU,eAAgB,CAAA,MAAM,gBAAiB,CAAA,IAAA,EAAM,CAAA;AAAA;AAGzD,QAAA,UAAA,CAAW,IAAI,MAAM,CAAA;AAAA;AACvB,KACD,CAAA;AAAA;AAEL,CAAC;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-catalog-backend",
3
- "version": "0.0.0-nightly-20250114022708",
3
+ "version": "0.0.0-nightly-20250116022939",
4
4
  "description": "The Backstage backend plugin that provides the Backstage catalog",
5
5
  "backstage": {
6
6
  "role": "backend-plugin",
@@ -72,20 +72,21 @@
72
72
  },
73
73
  "dependencies": {
74
74
  "@backstage/backend-common": "^0.25.0",
75
- "@backstage/backend-openapi-utils": "0.0.0-nightly-20250114022708",
76
- "@backstage/backend-plugin-api": "0.0.0-nightly-20250114022708",
77
- "@backstage/catalog-client": "0.0.0-nightly-20250114022708",
78
- "@backstage/catalog-model": "0.0.0-nightly-20250114022708",
79
- "@backstage/config": "0.0.0-nightly-20250114022708",
80
- "@backstage/errors": "0.0.0-nightly-20250114022708",
81
- "@backstage/integration": "0.0.0-nightly-20250114022708",
82
- "@backstage/plugin-catalog-common": "0.0.0-nightly-20250114022708",
83
- "@backstage/plugin-catalog-node": "0.0.0-nightly-20250114022708",
84
- "@backstage/plugin-events-node": "0.0.0-nightly-20250114022708",
85
- "@backstage/plugin-permission-common": "0.0.0-nightly-20250114022708",
86
- "@backstage/plugin-permission-node": "0.0.0-nightly-20250114022708",
87
- "@backstage/plugin-search-backend-module-catalog": "0.0.0-nightly-20250114022708",
88
- "@backstage/types": "0.0.0-nightly-20250114022708",
75
+ "@backstage/backend-openapi-utils": "0.0.0-nightly-20250116022939",
76
+ "@backstage/backend-plugin-api": "0.0.0-nightly-20250116022939",
77
+ "@backstage/catalog-client": "1.9.1",
78
+ "@backstage/catalog-model": "1.7.3",
79
+ "@backstage/config": "1.3.2",
80
+ "@backstage/errors": "1.2.7",
81
+ "@backstage/integration": "1.16.1",
82
+ "@backstage/plugin-catalog-common": "1.1.3",
83
+ "@backstage/plugin-catalog-node": "0.0.0-nightly-20250116022939",
84
+ "@backstage/plugin-events-node": "0.0.0-nightly-20250116022939",
85
+ "@backstage/plugin-permission-common": "0.8.4",
86
+ "@backstage/plugin-permission-node": "0.0.0-nightly-20250116022939",
87
+ "@backstage/plugin-search-backend-module-catalog": "0.0.0-nightly-20250116022939",
88
+ "@backstage/plugin-search-common": "1.2.17",
89
+ "@backstage/types": "1.2.1",
89
90
  "@opentelemetry/api": "^1.9.0",
90
91
  "@types/express": "^4.17.6",
91
92
  "codeowners-utils": "^1.0.2",
@@ -107,11 +108,11 @@
107
108
  "zod": "^3.22.4"
108
109
  },
109
110
  "devDependencies": {
110
- "@backstage/backend-defaults": "0.0.0-nightly-20250114022708",
111
- "@backstage/backend-test-utils": "0.0.0-nightly-20250114022708",
112
- "@backstage/cli": "0.0.0-nightly-20250114022708",
113
- "@backstage/plugin-permission-common": "0.0.0-nightly-20250114022708",
114
- "@backstage/repo-tools": "0.0.0-nightly-20250114022708",
111
+ "@backstage/backend-defaults": "0.0.0-nightly-20250116022939",
112
+ "@backstage/backend-test-utils": "0.0.0-nightly-20250116022939",
113
+ "@backstage/cli": "0.29.5",
114
+ "@backstage/plugin-permission-common": "0.8.4",
115
+ "@backstage/repo-tools": "0.0.0-nightly-20250116022939",
115
116
  "@types/core-js": "^2.5.4",
116
117
  "@types/git-url-parse": "^9.0.0",
117
118
  "@types/glob": "^8.0.0",