@backstage/plugin-catalog-backend 1.30.0-next.1 → 1.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # @backstage/plugin-catalog-backend
2
2
 
3
+ ## 1.30.0
4
+
5
+ ### Patch Changes
6
+
7
+ - d9d62ef: Remove some internal usages of the backend-common package
8
+ - 8379bf4: Remove usages of `PluginDatabaseManager` and `PluginEndpointDiscovery` and replace with their equivalent service types
9
+ - be0aae7: Improved concurrency of the `entities` endpoint when using the streamed query mode behind the `catalog.disableRelationsCompatibility` flag.
10
+ - dd515e3: Internalize the deprecated collator types since they were removed from the collator itself during new-backend-system migration.
11
+ - 3d475a0: Updated condition in `resolveCodeOwner` to fix a bug where `normalizeCodeOwner` could potentially be called with an invalid argument causing an error in `CodeOwnersProcessor`
12
+ - Updated dependencies
13
+ - @backstage/plugin-search-backend-module-catalog@0.3.0
14
+ - @backstage/types@1.2.1
15
+ - @backstage/plugin-permission-node@0.8.7
16
+ - @backstage/integration@1.16.1
17
+ - @backstage/backend-openapi-utils@0.4.1
18
+ - @backstage/backend-plugin-api@1.1.1
19
+ - @backstage/catalog-client@1.9.1
20
+ - @backstage/catalog-model@1.7.3
21
+ - @backstage/config@1.3.2
22
+ - @backstage/errors@1.2.7
23
+ - @backstage/plugin-catalog-common@1.1.3
24
+ - @backstage/plugin-catalog-node@1.15.1
25
+ - @backstage/plugin-events-node@0.4.7
26
+ - @backstage/plugin-permission-common@0.8.4
27
+ - @backstage/plugin-search-common@1.2.17
28
+
3
29
  ## 1.30.0-next.1
4
30
 
5
31
  ### Patch Changes
@@ -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,E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,KAAM,CAAA,MAAA;AAEpC,MAAW,KAAA,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
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';
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
@@ -455,7 +456,7 @@ declare const processingResult: Readonly<{
455
456
  readonly inputError: (atLocation: LocationSpec$1, message: string) => CatalogProcessorResult$1;
456
457
  readonly generalError: (atLocation: LocationSpec$1, message: string) => CatalogProcessorResult$1;
457
458
  readonly location: (newLocation: LocationSpec$1) => CatalogProcessorResult$1;
458
- readonly entity: (atLocation: LocationSpec$1, newEntity: _backstage_catalog_model.Entity) => CatalogProcessorResult$1;
459
+ readonly entity: (atLocation: LocationSpec$1, newEntity: Entity) => CatalogProcessorResult$1;
459
460
  readonly relation: (spec: EntityRelationSpec$1) => CatalogProcessorResult$1;
460
461
  readonly refresh: (key: string) => CatalogProcessorResult$1;
461
462
  }>;
@@ -635,6 +636,51 @@ type AnalyzeLocationEntityField = AnalyzeLocationEntityField$1;
635
636
  * @deprecated import from `@backstage/plugin-search-backend-module-catalog` instead
636
637
  */
637
638
  declare const defaultCatalogCollatorEntityTransformer: CatalogCollatorEntityTransformer$1;
639
+ /**
640
+ * @public
641
+ * @deprecated This is no longer supported since the new backend system migration
642
+ */
643
+ declare class DefaultCatalogCollatorFactory implements DocumentCollatorFactory {
644
+ readonly type = "software-catalog";
645
+ readonly visibilityPermission: Permission;
646
+ private locationTemplate;
647
+ private filter?;
648
+ private batchSize;
649
+ private readonly catalogClient;
650
+ private entityTransformer;
651
+ private auth;
652
+ static fromConfig(configRoot: Config, options: DefaultCatalogCollatorFactoryOptions): DefaultCatalogCollatorFactory;
653
+ private constructor();
654
+ getCollator(): Promise<Readable>;
655
+ private execute;
656
+ private applyArgsToFormat;
657
+ }
658
+ /**
659
+ * @public
660
+ * @deprecated This is no longer supported since the new backend system migration
661
+ */
662
+ type DefaultCatalogCollatorFactoryOptions = {
663
+ auth?: AuthService;
664
+ discovery: DiscoveryService;
665
+ tokenManager?: TokenManager;
666
+ /**
667
+ * @deprecated Use the config key `search.collators.catalog.locationTemplate` instead.
668
+ */
669
+ locationTemplate?: string;
670
+ /**
671
+ * @deprecated Use the config key `search.collators.catalog.filter` instead.
672
+ */
673
+ filter?: GetEntitiesRequest['filter'];
674
+ /**
675
+ * @deprecated Use the config key `search.collators.catalog.batchSize` instead.
676
+ */
677
+ batchSize?: number;
678
+ catalogClient?: CatalogApi;
679
+ /**
680
+ * Allows you to customize how entities are shaped into documents.
681
+ */
682
+ entityTransformer?: CatalogCollatorEntityTransformer;
683
+ };
638
684
  /**
639
685
  * @public
640
686
  * @deprecated import from `@backstage/plugin-search-backend-module-catalog` instead
@@ -649,4 +695,4 @@ declare const CATALOG_ERRORS_TOPIC = "experimental.catalog.errors";
649
695
  /** @public */
650
696
  declare function parseEntityYaml(data: Buffer, location: LocationSpec$1): Iterable<CatalogProcessorResult$1>;
651
697
 
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 };
698
+ 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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-catalog-backend",
3
- "version": "1.30.0-next.1",
3
+ "version": "1.30.0",
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.4.1-next.1",
76
- "@backstage/backend-plugin-api": "1.1.1-next.1",
77
- "@backstage/catalog-client": "1.9.1-next.0",
78
- "@backstage/catalog-model": "1.7.3-next.0",
79
- "@backstage/config": "1.3.2-next.0",
80
- "@backstage/errors": "1.2.7-next.0",
81
- "@backstage/integration": "1.16.1-next.0",
82
- "@backstage/plugin-catalog-common": "1.1.3-next.0",
83
- "@backstage/plugin-catalog-node": "1.15.1-next.1",
84
- "@backstage/plugin-events-node": "0.4.7-next.1",
85
- "@backstage/plugin-permission-common": "0.8.4-next.0",
86
- "@backstage/plugin-permission-node": "0.8.7-next.1",
87
- "@backstage/plugin-search-backend-module-catalog": "0.3.0-next.1",
88
- "@backstage/types": "1.2.1-next.0",
75
+ "@backstage/backend-openapi-utils": "^0.4.1",
76
+ "@backstage/backend-plugin-api": "^1.1.1",
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": "^1.15.1",
84
+ "@backstage/plugin-events-node": "^0.4.7",
85
+ "@backstage/plugin-permission-common": "^0.8.4",
86
+ "@backstage/plugin-permission-node": "^0.8.7",
87
+ "@backstage/plugin-search-backend-module-catalog": "^0.3.0",
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.7.0-next.1",
111
- "@backstage/backend-test-utils": "1.2.1-next.1",
112
- "@backstage/cli": "0.29.5-next.1",
113
- "@backstage/plugin-permission-common": "0.8.4-next.0",
114
- "@backstage/repo-tools": "0.12.1-next.1",
111
+ "@backstage/backend-defaults": "^0.7.0",
112
+ "@backstage/backend-test-utils": "^1.2.1",
113
+ "@backstage/cli": "^0.29.5",
114
+ "@backstage/plugin-permission-common": "^0.8.4",
115
+ "@backstage/repo-tools": "^0.12.1",
115
116
  "@types/core-js": "^2.5.4",
116
117
  "@types/git-url-parse": "^9.0.0",
117
118
  "@types/glob": "^8.0.0",