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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,53 @@
1
1
  # @backstage/plugin-catalog-backend
2
2
 
3
+ ## 1.30.0-next.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+ - @backstage/types@1.2.1-next.0
9
+ - @backstage/backend-openapi-utils@0.4.1-next.1
10
+ - @backstage/backend-plugin-api@1.1.1-next.1
11
+ - @backstage/catalog-model@1.7.3-next.0
12
+ - @backstage/config@1.3.2-next.0
13
+ - @backstage/errors@1.2.7-next.0
14
+ - @backstage/plugin-catalog-node@1.15.1-next.1
15
+ - @backstage/plugin-events-node@0.4.7-next.1
16
+ - @backstage/plugin-permission-common@0.8.4-next.0
17
+ - @backstage/plugin-permission-node@0.8.7-next.1
18
+ - @backstage/plugin-search-backend-module-catalog@0.3.0-next.1
19
+ - @backstage/catalog-client@1.9.1-next.0
20
+ - @backstage/plugin-catalog-common@1.1.3-next.0
21
+ - @backstage/integration@1.16.1-next.0
22
+
23
+ ## 1.30.0-next.0
24
+
25
+ ### Minor Changes
26
+
27
+ - 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.
28
+
29
+ ### Patch Changes
30
+
31
+ - d9d62ef: Remove some internal usages of the backend-common package
32
+ - 8379bf4: Remove usages of `PluginDatabaseManager` and `PluginEndpointDiscovery` and replace with their equivalent service types
33
+ - be0aae7: Improved concurrency of the `entities` endpoint when using the streamed query mode behind the `catalog.disableRelationsCompatibility` flag.
34
+ - 3d475a0: Updated condition in `resolveCodeOwner` to fix a bug where `normalizeCodeOwner` could potentially be called with an invalid argument causing an error in `CodeOwnersProcessor`
35
+ - Updated dependencies
36
+ - @backstage/plugin-search-backend-module-catalog@0.3.0-next.0
37
+ - @backstage/plugin-permission-node@0.8.7-next.0
38
+ - @backstage/backend-openapi-utils@0.4.1-next.0
39
+ - @backstage/backend-plugin-api@1.1.1-next.0
40
+ - @backstage/catalog-client@1.9.0
41
+ - @backstage/catalog-model@1.7.2
42
+ - @backstage/config@1.3.1
43
+ - @backstage/errors@1.2.6
44
+ - @backstage/integration@1.16.0
45
+ - @backstage/types@1.2.0
46
+ - @backstage/plugin-catalog-common@1.1.2
47
+ - @backstage/plugin-catalog-node@1.15.1-next.0
48
+ - @backstage/plugin-events-node@0.4.7-next.0
49
+ - @backstage/plugin-permission-common@0.8.3
50
+
3
51
  ## 1.29.0
4
52
 
5
53
  ### Minor Changes
@@ -6,10 +6,8 @@ var pluginSearchBackendModuleCatalog = require('@backstage/plugin-search-backend
6
6
  const locationSpecToMetadataName = pluginCatalogNode.locationSpecToMetadataName;
7
7
  const locationSpecToLocationEntity = pluginCatalogNode.locationSpecToLocationEntity;
8
8
  const processingResult = pluginCatalogNode.processingResult;
9
- const DefaultCatalogCollatorFactory = pluginSearchBackendModuleCatalog.DefaultCatalogCollatorFactory;
10
9
  const defaultCatalogCollatorEntityTransformer = pluginSearchBackendModuleCatalog.defaultCatalogCollatorEntityTransformer;
11
10
 
12
- exports.DefaultCatalogCollatorFactory = DefaultCatalogCollatorFactory;
13
11
  exports.defaultCatalogCollatorEntityTransformer = defaultCatalogCollatorEntityTransformer;
14
12
  exports.locationSpecToLocationEntity = locationSpecToLocationEntity;
15
13
  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 DefaultCatalogCollatorFactory as _DefaultCatalogCollatorFactory,\n type CatalogCollatorEntityTransformer as _CatalogCollatorEntityTransformer,\n type DefaultCatalogCollatorFactoryOptions as _DefaultCatalogCollatorFactoryOptions,\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 DefaultCatalogCollatorFactory = _DefaultCatalogCollatorFactory;\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 DefaultCatalogCollatorFactoryOptions =\n _DefaultCatalogCollatorFactoryOptions;\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","_DefaultCatalogCollatorFactory","_defaultCatalogCollatorEntityTransformer"],"mappings":";;;;;AAgEO,MAAM,0BAA6B,GAAAA;AAKnC,MAAM,4BAA+B,GAAAC;AAKrC,MAAM,gBAAmB,GAAAC;AA0LzB,MAAM,6BAAgC,GAAAC;AAMtC,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 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;;;;;;;"}
package/dist/index.cjs.js CHANGED
@@ -34,7 +34,6 @@ 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;
38
37
  exports.defaultCatalogCollatorEntityTransformer = deprecated.defaultCatalogCollatorEntityTransformer;
39
38
  exports.locationSpecToLocationEntity = deprecated.locationSpecToLocationEntity;
40
39
  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,19 +1,19 @@
1
1
  /// <reference types="node" />
2
2
  import * as _backstage_backend_plugin_api from '@backstage/backend-plugin-api';
3
- import { LoggerService, UrlReaderService, DatabaseService, RootConfigService, PermissionsService, SchedulerService, DiscoveryService, AuthService, HttpAuthService } from '@backstage/backend-plugin-api';
3
+ import { LoggerService, UrlReaderService, DiscoveryService, DatabaseService, RootConfigService, PermissionsService, SchedulerService, AuthService, HttpAuthService } from '@backstage/backend-plugin-api';
4
4
  import * as _backstage_catalog_model from '@backstage/catalog-model';
5
5
  import { Entity, EntityPolicy, Validators } from '@backstage/catalog-model';
6
6
  import { ScmIntegrationRegistry } from '@backstage/integration';
7
7
  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';
8
8
  import { CatalogProcessor as CatalogProcessor$1, CatalogProcessorEmit as CatalogProcessorEmit$1, CatalogProcessorParser as CatalogProcessorParser$1, PlaceholderResolver as PlaceholderResolver$1, CatalogProcessorCache as CatalogProcessorCache$1, EntitiesSearchFilter as EntitiesSearchFilter$1, LocationAnalyzer as LocationAnalyzer$1, EntityProvider as EntityProvider$1, ScmLocationAnalyzer as ScmLocationAnalyzer$1, locationSpecToMetadataName as locationSpecToMetadataName$1, locationSpecToLocationEntity as locationSpecToLocationEntity$1, CatalogProcessorResult as CatalogProcessorResult$1, EntityRelationSpec as EntityRelationSpec$1, EntityFilter as EntityFilter$1, DeferredEntity as DeferredEntity$1, CatalogProcessorLocationResult as CatalogProcessorLocationResult$1, CatalogProcessorEntityResult as CatalogProcessorEntityResult$1, CatalogProcessorRelationResult as CatalogProcessorRelationResult$1, CatalogProcessorErrorResult as CatalogProcessorErrorResult$1, CatalogProcessorRefreshKeysResult as CatalogProcessorRefreshKeysResult$1, EntityProviderConnection as EntityProviderConnection$1, EntityProviderMutation as EntityProviderMutation$1, AnalyzeOptions as AnalyzeOptions$1, PlaceholderResolverParams as PlaceholderResolverParams$1, PlaceholderResolverRead as PlaceholderResolverRead$1, PlaceholderResolverResolveUrl as PlaceholderResolverResolveUrl$1 } from '@backstage/plugin-catalog-node';
9
9
  import { Config } from '@backstage/config';
10
- import { PluginEndpointDiscovery, TokenManager } from '@backstage/backend-common';
10
+ import { TokenManager } from '@backstage/backend-common';
11
11
  import { GetEntitiesRequest, CatalogApi } from '@backstage/catalog-client';
12
12
  import { Permission, PermissionRuleParams, PermissionAuthorizer } from '@backstage/plugin-permission-common';
13
13
  import { Router } from 'express';
14
14
  import { PermissionRule } from '@backstage/plugin-permission-node';
15
15
  import { EventBroker, EventsService } from '@backstage/plugin-events-node';
16
- import { DefaultCatalogCollatorFactory as DefaultCatalogCollatorFactory$1, CatalogCollatorEntityTransformer as CatalogCollatorEntityTransformer$1, DefaultCatalogCollatorFactoryOptions as DefaultCatalogCollatorFactoryOptions$1 } from '@backstage/plugin-search-backend-module-catalog';
16
+ import { CatalogCollatorEntityTransformer as CatalogCollatorEntityTransformer$1 } from '@backstage/plugin-search-backend-module-catalog';
17
17
 
18
18
  /**
19
19
  * Catalog plugin
@@ -175,7 +175,7 @@ declare function createRandomProcessingInterval(options: {
175
175
  * use `DefaultCatalogCollatorFactory` instead.
176
176
  */
177
177
  declare class DefaultCatalogCollator {
178
- protected discovery: PluginEndpointDiscovery;
178
+ protected discovery: DiscoveryService;
179
179
  protected locationTemplate: string;
180
180
  protected filter?: GetEntitiesRequest['filter'];
181
181
  protected readonly catalogClient: CatalogApi;
@@ -183,12 +183,12 @@ declare class DefaultCatalogCollator {
183
183
  readonly visibilityPermission: Permission;
184
184
  protected tokenManager: TokenManager;
185
185
  static fromConfig(_config: Config, options: {
186
- discovery: PluginEndpointDiscovery;
186
+ discovery: DiscoveryService;
187
187
  tokenManager: TokenManager;
188
188
  filter?: GetEntitiesRequest['filter'];
189
189
  }): DefaultCatalogCollator;
190
190
  constructor(options: {
191
- discovery: PluginEndpointDiscovery;
191
+ discovery: DiscoveryService;
192
192
  tokenManager: TokenManager;
193
193
  locationTemplate?: string;
194
194
  filter?: GetEntitiesRequest['filter'];
@@ -630,21 +630,11 @@ type AnalyzeLocationGenerateEntity = AnalyzeLocationGenerateEntity$1;
630
630
  * @deprecated use the same type from `@backstage/plugin-catalog-common` instead
631
631
  */
632
632
  type AnalyzeLocationEntityField = AnalyzeLocationEntityField$1;
633
- /**
634
- * @public
635
- * @deprecated import from `@backstage/plugin-search-backend-module-catalog` instead
636
- */
637
- declare const DefaultCatalogCollatorFactory: typeof DefaultCatalogCollatorFactory$1;
638
633
  /**
639
634
  * @public
640
635
  * @deprecated import from `@backstage/plugin-search-backend-module-catalog` instead
641
636
  */
642
637
  declare const defaultCatalogCollatorEntityTransformer: CatalogCollatorEntityTransformer$1;
643
- /**
644
- * @public
645
- * @deprecated import from `@backstage/plugin-search-backend-module-catalog` instead
646
- */
647
- type DefaultCatalogCollatorFactoryOptions = DefaultCatalogCollatorFactoryOptions$1;
648
638
  /**
649
639
  * @public
650
640
  * @deprecated import from `@backstage/plugin-search-backend-module-catalog` instead
@@ -659,4 +649,4 @@ declare const CATALOG_ERRORS_TOPIC = "experimental.catalog.errors";
659
649
  /** @public */
660
650
  declare function parseEntityYaml(data: Buffer, location: LocationSpec$1): Iterable<CatalogProcessorResult$1>;
661
651
 
662
- 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 };
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 };
@@ -33,7 +33,7 @@ function resolveCodeOwner(contents, catalogInfoFileUrl) {
33
33
  const codeOwnerEntries = codeowners__namespace.parse(contents);
34
34
  const { filepath } = parseGitUrl__default.default(catalogInfoFileUrl);
35
35
  const match = codeowners__namespace.matchFile(filepath, codeOwnerEntries);
36
- return match ? normalizeCodeOwner(match.owners[0]) : void 0;
36
+ return match?.owners?.length ? normalizeCodeOwner(match.owners[0]) : void 0;
37
37
  }
38
38
  function normalizeCodeOwner(owner) {
39
39
  if (owner.match(GROUP_PATTERN)) {
@@ -1 +1 @@
1
- {"version":3,"file":"resolve.cjs.js","sources":["../../../src/processors/codeowners/resolve.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 * as codeowners from 'codeowners-utils';\nimport parseGitUrl from 'git-url-parse';\n\nconst USER_PATTERN = /^@.*/;\nconst GROUP_PATTERN = /^@.*\\/.*/;\nconst EMAIL_PATTERN = /^.*@.*\\..*$/;\n\nexport function resolveCodeOwner(\n contents: string,\n catalogInfoFileUrl: string,\n): string | undefined {\n const codeOwnerEntries = codeowners.parse(contents);\n\n const { filepath } = parseGitUrl(catalogInfoFileUrl);\n const match = codeowners.matchFile(filepath, codeOwnerEntries);\n\n return match ? normalizeCodeOwner(match.owners[0]) : undefined;\n}\n\nexport function normalizeCodeOwner(owner: string) {\n if (owner.match(GROUP_PATTERN)) {\n return owner.split('/')[1];\n } else if (owner.match(USER_PATTERN)) {\n return `User:${owner.substring(1)}`;\n } else if (owner.match(EMAIL_PATTERN)) {\n return owner.split('@')[0];\n }\n\n return owner;\n}\n"],"names":["codeowners","parseGitUrl"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBA,MAAM,YAAe,GAAA,MAAA;AACrB,MAAM,aAAgB,GAAA,UAAA;AACtB,MAAM,aAAgB,GAAA,aAAA;AAEN,SAAA,gBAAA,CACd,UACA,kBACoB,EAAA;AACpB,EAAM,MAAA,gBAAA,GAAmBA,qBAAW,CAAA,KAAA,CAAM,QAAQ,CAAA;AAElD,EAAA,MAAM,EAAE,QAAA,EAAa,GAAAC,4BAAA,CAAY,kBAAkB,CAAA;AACnD,EAAA,MAAM,KAAQ,GAAAD,qBAAA,CAAW,SAAU,CAAA,QAAA,EAAU,gBAAgB,CAAA;AAE7D,EAAA,OAAO,QAAQ,kBAAmB,CAAA,KAAA,CAAM,MAAO,CAAA,CAAC,CAAC,CAAI,GAAA,KAAA,CAAA;AACvD;AAEO,SAAS,mBAAmB,KAAe,EAAA;AAChD,EAAI,IAAA,KAAA,CAAM,KAAM,CAAA,aAAa,CAAG,EAAA;AAC9B,IAAA,OAAO,KAAM,CAAA,KAAA,CAAM,GAAG,CAAA,CAAE,CAAC,CAAA;AAAA,GAChB,MAAA,IAAA,KAAA,CAAM,KAAM,CAAA,YAAY,CAAG,EAAA;AACpC,IAAA,OAAO,CAAQ,KAAA,EAAA,KAAA,CAAM,SAAU,CAAA,CAAC,CAAC,CAAA,CAAA;AAAA,GACxB,MAAA,IAAA,KAAA,CAAM,KAAM,CAAA,aAAa,CAAG,EAAA;AACrC,IAAA,OAAO,KAAM,CAAA,KAAA,CAAM,GAAG,CAAA,CAAE,CAAC,CAAA;AAAA;AAG3B,EAAO,OAAA,KAAA;AACT;;;;;"}
1
+ {"version":3,"file":"resolve.cjs.js","sources":["../../../src/processors/codeowners/resolve.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 * as codeowners from 'codeowners-utils';\nimport parseGitUrl from 'git-url-parse';\n\nconst USER_PATTERN = /^@.*/;\nconst GROUP_PATTERN = /^@.*\\/.*/;\nconst EMAIL_PATTERN = /^.*@.*\\..*$/;\n\nexport function resolveCodeOwner(\n contents: string,\n catalogInfoFileUrl: string,\n): string | undefined {\n const codeOwnerEntries = codeowners.parse(contents);\n\n const { filepath } = parseGitUrl(catalogInfoFileUrl);\n const match = codeowners.matchFile(filepath, codeOwnerEntries);\n\n return match?.owners?.length\n ? normalizeCodeOwner(match.owners[0])\n : undefined;\n}\n\nexport function normalizeCodeOwner(owner: string) {\n if (owner.match(GROUP_PATTERN)) {\n return owner.split('/')[1];\n } else if (owner.match(USER_PATTERN)) {\n return `User:${owner.substring(1)}`;\n } else if (owner.match(EMAIL_PATTERN)) {\n return owner.split('@')[0];\n }\n\n return owner;\n}\n"],"names":["codeowners","parseGitUrl"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBA,MAAM,YAAe,GAAA,MAAA;AACrB,MAAM,aAAgB,GAAA,UAAA;AACtB,MAAM,aAAgB,GAAA,aAAA;AAEN,SAAA,gBAAA,CACd,UACA,kBACoB,EAAA;AACpB,EAAM,MAAA,gBAAA,GAAmBA,qBAAW,CAAA,KAAA,CAAM,QAAQ,CAAA;AAElD,EAAA,MAAM,EAAE,QAAA,EAAa,GAAAC,4BAAA,CAAY,kBAAkB,CAAA;AACnD,EAAA,MAAM,KAAQ,GAAAD,qBAAA,CAAW,SAAU,CAAA,QAAA,EAAU,gBAAgB,CAAA;AAE7D,EAAO,OAAA,KAAA,EAAO,QAAQ,MAClB,GAAA,kBAAA,CAAmB,MAAM,MAAO,CAAA,CAAC,CAAC,CAClC,GAAA,KAAA,CAAA;AACN;AAEO,SAAS,mBAAmB,KAAe,EAAA;AAChD,EAAI,IAAA,KAAA,CAAM,KAAM,CAAA,aAAa,CAAG,EAAA;AAC9B,IAAA,OAAO,KAAM,CAAA,KAAA,CAAM,GAAG,CAAA,CAAE,CAAC,CAAA;AAAA,GAChB,MAAA,IAAA,KAAA,CAAM,KAAM,CAAA,YAAY,CAAG,EAAA;AACpC,IAAA,OAAO,CAAQ,KAAA,EAAA,KAAA,CAAM,SAAU,CAAA,CAAC,CAAC,CAAA,CAAA;AAAA,GACxB,MAAA,IAAA,KAAA,CAAM,KAAM,CAAA,aAAa,CAAG,EAAA;AACrC,IAAA,OAAO,KAAM,CAAA,KAAA,CAAM,GAAG,CAAA,CAAE,CAAC,CAAA;AAAA;AAG3B,EAAO,OAAA,KAAA;AACT;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"DefaultCatalogCollator.cjs.js","sources":["../../src/search/DefaultCatalogCollator.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n PluginEndpointDiscovery,\n TokenManager,\n} from '@backstage/backend-common';\nimport {\n Entity,\n isUserEntity,\n stringifyEntityRef,\n} from '@backstage/catalog-model';\nimport { Config } from '@backstage/config';\nimport {\n CatalogApi,\n CatalogClient,\n GetEntitiesRequest,\n} from '@backstage/catalog-client';\nimport { catalogEntityReadPermission } from '@backstage/plugin-catalog-common/alpha';\nimport { CatalogEntityDocument } from '@backstage/plugin-catalog-common';\nimport { Permission } from '@backstage/plugin-permission-common';\n\n/**\n * @public\n * @deprecated Upgrade to a more recent `@backstage/plugin-search-backend-node` and\n * use `DefaultCatalogCollatorFactory` instead.\n */\nexport class DefaultCatalogCollator {\n protected discovery: PluginEndpointDiscovery;\n protected locationTemplate: string;\n protected filter?: GetEntitiesRequest['filter'];\n protected readonly catalogClient: CatalogApi;\n public readonly type: string = 'software-catalog';\n public readonly visibilityPermission: Permission =\n catalogEntityReadPermission;\n protected tokenManager: TokenManager;\n\n static fromConfig(\n _config: Config,\n options: {\n discovery: PluginEndpointDiscovery;\n tokenManager: TokenManager;\n filter?: GetEntitiesRequest['filter'];\n },\n ) {\n return new DefaultCatalogCollator({\n ...options,\n });\n }\n\n constructor(options: {\n discovery: PluginEndpointDiscovery;\n tokenManager: TokenManager;\n locationTemplate?: string;\n filter?: GetEntitiesRequest['filter'];\n catalogClient?: CatalogApi;\n }) {\n const { discovery, locationTemplate, filter, catalogClient, tokenManager } =\n options;\n\n this.discovery = discovery;\n this.locationTemplate =\n locationTemplate || '/catalog/:namespace/:kind/:name';\n this.filter = filter;\n this.catalogClient =\n catalogClient || new CatalogClient({ discoveryApi: discovery });\n this.tokenManager = tokenManager;\n }\n\n protected applyArgsToFormat(\n format: string,\n args: Record<string, string>,\n ): string {\n let formatted = format;\n for (const [key, value] of Object.entries(args)) {\n formatted = formatted.replace(`:${key}`, value);\n }\n return formatted.toLowerCase();\n }\n\n private getDocumentText(entity: Entity): string {\n let documentText = entity.metadata.description || '';\n if (isUserEntity(entity)) {\n if (entity.spec?.profile?.displayName && documentText) {\n // combine displayName and description\n const displayName = entity.spec?.profile?.displayName;\n documentText = displayName.concat(' : ', documentText);\n } else {\n documentText = entity.spec?.profile?.displayName || documentText;\n }\n }\n return documentText;\n }\n\n async execute() {\n const { token } = await this.tokenManager.getToken();\n const response = await this.catalogClient.getEntities(\n {\n filter: this.filter,\n },\n { token },\n );\n return response.items.map((entity: Entity): CatalogEntityDocument => {\n return {\n title: entity.metadata.title\n ? `${entity.metadata.title} (${entity.metadata.name})`\n : entity.metadata.name,\n location: this.applyArgsToFormat(this.locationTemplate, {\n namespace: entity.metadata.namespace || 'default',\n kind: entity.kind,\n name: entity.metadata.name,\n }),\n text: this.getDocumentText(entity),\n componentType: entity.spec?.type?.toString() || 'other',\n type: entity.spec?.type?.toString() || 'other',\n namespace: entity.metadata.namespace || 'default',\n kind: entity.kind,\n lifecycle: (entity.spec?.lifecycle as string) || '',\n owner: (entity.spec?.owner as string) || '',\n authorization: {\n resourceRef: stringifyEntityRef(entity),\n },\n };\n });\n }\n}\n"],"names":["catalogEntityReadPermission","catalogClient","CatalogClient","isUserEntity","stringifyEntityRef"],"mappings":";;;;;;AAwCO,MAAM,sBAAuB,CAAA;AAAA,EACxB,SAAA;AAAA,EACA,gBAAA;AAAA,EACA,MAAA;AAAA,EACS,aAAA;AAAA,EACH,IAAe,GAAA,kBAAA;AAAA,EACf,oBACd,GAAAA,iCAAA;AAAA,EACQ,YAAA;AAAA,EAEV,OAAO,UACL,CAAA,OAAA,EACA,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AAM,SAAwB,IAAA,EAAA;AAAA,QACjD,KAAA,EAAQ,MAAO,CAAA,IAAA,EAAM,KAAoB,IAAA,EAAA;AAAA,QACzC,aAAe,EAAA;AAAA,UACb,WAAA,EAAaC,gCAAmB,MAAM;AAAA;AACxC,OACF;AAAA,KACD,CAAA;AAAA;AAEL;;;;"}
1
+ {"version":3,"file":"DefaultCatalogCollator.cjs.js","sources":["../../src/search/DefaultCatalogCollator.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { TokenManager } from '@backstage/backend-common';\nimport {\n Entity,\n isUserEntity,\n stringifyEntityRef,\n} from '@backstage/catalog-model';\nimport { Config } from '@backstage/config';\nimport {\n CatalogApi,\n CatalogClient,\n GetEntitiesRequest,\n} from '@backstage/catalog-client';\nimport { catalogEntityReadPermission } from '@backstage/plugin-catalog-common/alpha';\nimport { CatalogEntityDocument } from '@backstage/plugin-catalog-common';\nimport { Permission } from '@backstage/plugin-permission-common';\nimport { DiscoveryService } from '@backstage/backend-plugin-api';\n\n/**\n * @public\n * @deprecated Upgrade to a more recent `@backstage/plugin-search-backend-node` and\n * use `DefaultCatalogCollatorFactory` instead.\n */\nexport class DefaultCatalogCollator {\n protected discovery: DiscoveryService;\n protected locationTemplate: string;\n protected filter?: GetEntitiesRequest['filter'];\n protected readonly catalogClient: CatalogApi;\n public readonly type: string = 'software-catalog';\n public readonly visibilityPermission: Permission =\n catalogEntityReadPermission;\n protected tokenManager: TokenManager;\n\n static fromConfig(\n _config: Config,\n options: {\n discovery: DiscoveryService;\n tokenManager: TokenManager;\n filter?: GetEntitiesRequest['filter'];\n },\n ) {\n return new DefaultCatalogCollator({\n ...options,\n });\n }\n\n constructor(options: {\n discovery: DiscoveryService;\n tokenManager: TokenManager;\n locationTemplate?: string;\n filter?: GetEntitiesRequest['filter'];\n catalogClient?: CatalogApi;\n }) {\n const { discovery, locationTemplate, filter, catalogClient, tokenManager } =\n options;\n\n this.discovery = discovery;\n this.locationTemplate =\n locationTemplate || '/catalog/:namespace/:kind/:name';\n this.filter = filter;\n this.catalogClient =\n catalogClient || new CatalogClient({ discoveryApi: discovery });\n this.tokenManager = tokenManager;\n }\n\n protected applyArgsToFormat(\n format: string,\n args: Record<string, string>,\n ): string {\n let formatted = format;\n for (const [key, value] of Object.entries(args)) {\n formatted = formatted.replace(`:${key}`, value);\n }\n return formatted.toLowerCase();\n }\n\n private getDocumentText(entity: Entity): string {\n let documentText = entity.metadata.description || '';\n if (isUserEntity(entity)) {\n if (entity.spec?.profile?.displayName && documentText) {\n // combine displayName and description\n const displayName = entity.spec?.profile?.displayName;\n documentText = displayName.concat(' : ', documentText);\n } else {\n documentText = entity.spec?.profile?.displayName || documentText;\n }\n }\n return documentText;\n }\n\n async execute() {\n const { token } = await this.tokenManager.getToken();\n const response = await this.catalogClient.getEntities(\n {\n filter: this.filter,\n },\n { token },\n );\n return response.items.map((entity: Entity): CatalogEntityDocument => {\n return {\n title: entity.metadata.title\n ? `${entity.metadata.title} (${entity.metadata.name})`\n : entity.metadata.name,\n location: this.applyArgsToFormat(this.locationTemplate, {\n namespace: entity.metadata.namespace || 'default',\n kind: entity.kind,\n name: entity.metadata.name,\n }),\n text: this.getDocumentText(entity),\n componentType: entity.spec?.type?.toString() || 'other',\n type: entity.spec?.type?.toString() || 'other',\n namespace: entity.metadata.namespace || 'default',\n kind: entity.kind,\n lifecycle: (entity.spec?.lifecycle as string) || '',\n owner: (entity.spec?.owner as string) || '',\n authorization: {\n resourceRef: stringifyEntityRef(entity),\n },\n };\n });\n }\n}\n"],"names":["catalogEntityRe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A,CAAO,IAAM,EAAA,IAAA,EAAM,UAAc,IAAA,OAAA;AAAA,QAChD,IAAM,EAAA,MAAA,CAAO,IAAM,EAAA,IAAA,EAAM,UAAc,IAAA,OAAA;AAAA,QACvC,SAAA,EAAW,MAAO,CAAA,QAAA,CAAS,SAAa,IAAA,SAAA;AAAA,QACxC,MAAM,MAAO,CAAA,IAAA;AAAA,QACb,SAAA,EAAY,MAAO,CAAA,IAAA,EAAM,SAAwB,IAAA,EAAA;AAAA,QACjD,KAAA,EAAQ,MAAO,CAAA,IAAA,EAAM,KAAoB,IAAA,EAAA;AAAA,QACzC,aAAe,EAAA;AAAA,UACb,WAAA,EAAaC,gCAAmB,MAAM;AAAA;AACxC,OACF;AAAA,KACD,CAAA;AAAA;AAEL;;;;"}
@@ -1,6 +1,5 @@
1
1
  'use strict';
2
2
 
3
- var backendCommon = require('@backstage/backend-common');
4
3
  var catalogModel = require('@backstage/catalog-model');
5
4
  var errors = require('@backstage/errors');
6
5
  var yn = require('yn');
@@ -96,6 +95,7 @@ async function createRouter(options) {
96
95
  const limit = 1e4;
97
96
  let cursor;
98
97
  try {
98
+ let currentWrite = void 0;
99
99
  do {
100
100
  const result = await entitiesCatalog.queryEntities(
101
101
  !cursor ? {
@@ -107,13 +107,15 @@ async function createRouter(options) {
107
107
  skipTotalItems: true
108
108
  } : { credentials, fields, limit, cursor }
109
109
  );
110
+ if (await currentWrite) {
111
+ return;
112
+ }
110
113
  if (result.items.entities.length) {
111
- if (await responseStream.send(result.items)) {
112
- return;
113
- }
114
+ currentWrite = responseStream.send(result.items);
114
115
  }
115
116
  cursor = result.pageInfo?.nextCursor;
116
117
  } while (cursor);
118
+ await currentWrite;
117
119
  responseStream.complete();
118
120
  } finally {
119
121
  responseStream.close();
@@ -321,7 +323,6 @@ async function createRouter(options) {
321
323
  return res.status(200).end();
322
324
  });
323
325
  }
324
- router$1.use(backendCommon.errorHandler());
325
326
  return router$1;
326
327
  }
327
328
 
@@ -1 +1 @@
1
- {"version":3,"file":"createRouter.cjs.js","sources":["../../src/service/createRouter.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 { errorHandler } from '@backstage/backend-common';\nimport {\n ANNOTATION_LOCATION,\n ANNOTATION_ORIGIN_LOCATION,\n Entity,\n parseLocationRef,\n stringifyEntityRef,\n} from '@backstage/catalog-model';\nimport { Config } from '@backstage/config';\nimport { InputError, serializeError } from '@backstage/errors';\nimport express from 'express';\nimport yn from 'yn';\nimport { z } from 'zod';\nimport { Cursor, EntitiesCatalog } from '../catalog/types';\nimport { CatalogProcessingOrchestrator } from '../processing/types';\nimport { validateEntityEnvelope } from '../processing/util';\nimport {\n basicEntityFilter,\n entitiesBatchRequest,\n parseEntityFilterParams,\n parseEntityTransformParams,\n parseQueryEntitiesParams,\n} from './request';\nimport { parseEntityFacetParams } from './request/parseEntityFacetParams';\nimport { parseEntityOrderParams } from './request/parseEntityOrderParams';\nimport { LocationService, RefreshService } from './types';\nimport {\n disallowReadonlyMode,\n encodeCursor,\n locationInput,\n validateRequestBody,\n} from './util';\nimport { createOpenApiRouter } from '../schema/openapi';\nimport { parseEntityPaginationParams } from './request/parseEntityPaginationParams';\nimport {\n AuthService,\n HttpAuthService,\n LoggerService,\n SchedulerService,\n PermissionsService,\n} from '@backstage/backend-plugin-api';\nimport { LocationAnalyzer } from '@backstage/plugin-catalog-node';\nimport { AuthorizedValidationService } from './AuthorizedValidationService';\nimport {\n createEntityArrayJsonStream,\n writeEntitiesResponse,\n writeSingleEntityResponse,\n} from './response';\n\n/**\n * Options used by {@link createRouter}.\n *\n * @public\n * @deprecated Please migrate to the new backend system as this will be removed in the future.\n */\nexport interface RouterOptions {\n entitiesCatalog?: EntitiesCatalog;\n locationAnalyzer?: LocationAnalyzer;\n locationService: LocationService;\n orchestrator?: CatalogProcessingOrchestrator;\n refreshService?: RefreshService;\n scheduler?: SchedulerService;\n logger: LoggerService;\n config: Config;\n permissionIntegrationRouter?: express.Router;\n auth: AuthService;\n httpAuth: HttpAuthService;\n permissionsService: PermissionsService;\n disableRelationsCompatibility?: boolean;\n}\n\n/**\n * Creates a catalog router.\n */\nexport async function createRouter(\n options: RouterOptions,\n): Promise<express.Router> {\n const router = await createOpenApiRouter({\n validatorOptions: {\n // We want the spec to be up to date with the expected value, but the return type needs\n // to be controlled by the router implementation not the request validator.\n ignorePaths: /^\\/validate-entity\\/?$/,\n },\n });\n const {\n entitiesCatalog,\n locationAnalyzer,\n locationService,\n orchestrator,\n refreshService,\n config,\n logger,\n permissionIntegrationRouter,\n permissionsService,\n auth,\n httpAuth,\n disableRelationsCompatibility = false,\n } = options;\n\n const readonlyEnabled =\n config.getOptionalBoolean('catalog.readonly') || false;\n if (readonlyEnabled) {\n logger.info('Catalog is running in readonly mode');\n }\n\n if (refreshService) {\n router.post('/refresh', async (req, res) => {\n const { authorizationToken, ...restBody } = req.body;\n\n const credentials = authorizationToken\n ? await auth.authenticate(authorizationToken)\n : await httpAuth.credentials(req);\n\n await refreshService.refresh({\n ...restBody,\n credentials,\n });\n res.status(200).end();\n });\n }\n\n if (permissionIntegrationRouter) {\n router.use(permissionIntegrationRouter);\n }\n\n if (entitiesCatalog) {\n router\n .get('/entities', async (req, res) => {\n const filter = parseEntityFilterParams(req.query);\n const fields = parseEntityTransformParams(req.query);\n const order = parseEntityOrderParams(req.query);\n const pagination = parseEntityPaginationParams(req.query);\n const credentials = await httpAuth.credentials(req);\n\n // When pagination parameters are passed in, use the legacy slow path\n // that loads all entities into memory\n\n if (pagination || disableRelationsCompatibility !== true) {\n const { entities, pageInfo } = await entitiesCatalog.entities({\n filter,\n fields,\n order,\n pagination,\n credentials,\n });\n\n // Add a Link header to the next page\n if (pageInfo.hasNextPage) {\n const url = new URL(`http://ignored${req.url}`);\n url.searchParams.delete('offset');\n url.searchParams.set('after', pageInfo.endCursor);\n res.setHeader('link', `<${url.pathname}${url.search}>; rel=\"next\"`);\n }\n\n await writeEntitiesResponse({\n res,\n items: entities,\n alwaysUseObjectMode: !disableRelationsCompatibility,\n });\n return;\n }\n\n const responseStream = createEntityArrayJsonStream(res);\n const limit = 10000;\n let cursor: Cursor | undefined;\n\n try {\n do {\n const result = await entitiesCatalog.queryEntities(\n !cursor\n ? {\n credentials,\n fields,\n limit,\n filter,\n orderFields: order,\n skipTotalItems: true,\n }\n : { credentials, fields, limit, cursor },\n );\n\n if (result.items.entities.length) {\n if (await responseStream.send(result.items)) {\n return; // Client closed connection\n }\n }\n\n cursor = result.pageInfo?.nextCursor;\n } while (cursor);\n\n responseStream.complete();\n } finally {\n responseStream.close();\n }\n })\n .get('/entities/by-query', async (req, res) => {\n const { items, pageInfo, totalItems } =\n await entitiesCatalog.queryEntities({\n limit: req.query.limit,\n offset: req.query.offset,\n ...parseQueryEntitiesParams(req.query),\n credentials: await httpAuth.credentials(req),\n });\n\n await writeEntitiesResponse({\n res,\n items,\n alwaysUseObjectMode: !disableRelationsCompatibility,\n responseWrapper: entities => ({\n items: entities,\n totalItems,\n pageInfo: {\n ...(pageInfo.nextCursor && {\n nextCursor: encodeCursor(pageInfo.nextCursor),\n }),\n ...(pageInfo.prevCursor && {\n prevCursor: encodeCursor(pageInfo.prevCursor),\n }),\n },\n }),\n });\n })\n .get('/entities/by-uid/:uid', async (req, res) => {\n const { uid } = req.params;\n const { entities } = await entitiesCatalog.entities({\n filter: basicEntityFilter({ 'metadata.uid': uid }),\n credentials: await httpAuth.credentials(req),\n });\n writeSingleEntityResponse(res, entities, `No entity with uid ${uid}`);\n })\n .delete('/entities/by-uid/:uid', async (req, res) => {\n const { uid } = req.params;\n await entitiesCatalog.removeEntityByUid(uid, {\n credentials: await httpAuth.credentials(req),\n });\n res.status(204).end();\n })\n .get('/entities/by-name/:kind/:namespace/:name', async (req, res) => {\n const { kind, namespace, name } = req.params;\n const { items } = await entitiesCatalog.entitiesBatch({\n entityRefs: [stringifyEntityRef({ kind, namespace, name })],\n credentials: await httpAuth.credentials(req),\n });\n writeSingleEntityResponse(\n res,\n items,\n `No entity named '${name}' found, with kind '${kind}' in namespace '${namespace}'`,\n );\n })\n .get(\n '/entities/by-name/:kind/:namespace/:name/ancestry',\n async (req, res) => {\n const { kind, namespace, name } = req.params;\n const entityRef = stringifyEntityRef({ kind, namespace, name });\n const response = await entitiesCatalog.entityAncestry(entityRef, {\n credentials: await httpAuth.credentials(req),\n });\n res.status(200).json(response);\n },\n )\n .post('/entities/by-refs', async (req, res) => {\n const request = entitiesBatchRequest(req);\n const { items } = await entitiesCatalog.entitiesBatch({\n entityRefs: request.entityRefs,\n filter: parseEntityFilterParams(req.query),\n fields: parseEntityTransformParams(req.query, request.fields),\n credentials: await httpAuth.credentials(req),\n });\n await writeEntitiesResponse({\n res,\n items,\n alwaysUseObjectMode: !disableRelationsCompatibility,\n responseWrapper: entities => ({\n items: entities,\n }),\n });\n })\n .get('/entity-facets', async (req, res) => {\n const response = await entitiesCatalog.facets({\n filter: parseEntityFilterParams(req.query),\n facets: parseEntityFacetParams(req.query),\n credentials: await httpAuth.credentials(req),\n });\n res.status(200).json(response);\n });\n }\n\n if (locationService) {\n router\n .post('/locations', async (req, res) => {\n const location = await validateRequestBody(req, locationInput);\n const dryRun = yn(req.query.dryRun, { default: false });\n\n // when in dryRun addLocation is effectively a read operation so we don't\n // need to disallow readonly\n if (!dryRun) {\n disallowReadonlyMode(readonlyEnabled);\n }\n\n const output = await locationService.createLocation(location, dryRun, {\n credentials: await httpAuth.credentials(req),\n });\n res.status(201).json(output);\n })\n .get('/locations', async (req, res) => {\n const locations = await locationService.listLocations({\n credentials: await httpAuth.credentials(req),\n });\n res.status(200).json(locations.map(l => ({ data: l })));\n })\n\n .get('/locations/:id', async (req, res) => {\n const { id } = req.params;\n const output = await locationService.getLocation(id, {\n credentials: await httpAuth.credentials(req),\n });\n res.status(200).json(output);\n })\n .delete('/locations/:id', async (req, res) => {\n disallowReadonlyMode(readonlyEnabled);\n\n const { id } = req.params;\n await locationService.deleteLocation(id, {\n credentials: await httpAuth.credentials(req),\n });\n res.status(204).end();\n })\n .get('/locations/by-entity/:kind/:namespace/:name', async (req, res) => {\n const { kind, namespace, name } = req.params;\n const output = await locationService.getLocationByEntity(\n { kind, namespace, name },\n { credentials: await httpAuth.credentials(req) },\n );\n res.status(200).json(output);\n });\n }\n\n if (locationAnalyzer) {\n router.post('/analyze-location', async (req, res) => {\n const body = await validateRequestBody(\n req,\n z.object({\n location: locationInput,\n catalogFilename: z.string().optional(),\n }),\n );\n const schema = z.object({\n location: locationInput,\n catalogFilename: z.string().optional(),\n });\n const credentials = await httpAuth.credentials(req);\n const parsedBody = schema.parse(body);\n try {\n const output = await locationAnalyzer.analyzeLocation(\n parsedBody,\n credentials,\n );\n res.status(200).json(output);\n } catch (err) {\n if (\n // Catch errors from parse-url library.\n err.name === 'Error' &&\n 'subject_url' in err\n ) {\n throw new InputError('The given location.target is not a URL');\n }\n throw err;\n }\n });\n }\n\n if (orchestrator) {\n router.post('/validate-entity', async (req, res) => {\n const bodySchema = z.object({\n entity: z.unknown(),\n location: z.string(),\n });\n\n let body: z.infer<typeof bodySchema>;\n let entity: Entity;\n let location: { type: string; target: string };\n try {\n body = await validateRequestBody(req, bodySchema);\n entity = validateEntityEnvelope(body.entity);\n location = parseLocationRef(body.location);\n if (location.type !== 'url')\n throw new TypeError(\n `Invalid location ref ${body.location}, only 'url:<target>' is supported, e.g. url:https://host/path`,\n );\n } catch (err) {\n return res.status(400).json({\n errors: [serializeError(err)],\n });\n }\n\n const credentials = await httpAuth.credentials(req);\n const authorizedValidationService = new AuthorizedValidationService(\n orchestrator,\n permissionsService,\n );\n const processingResult = await authorizedValidationService.process(\n {\n entity: {\n ...entity,\n metadata: {\n ...entity.metadata,\n annotations: {\n [ANNOTATION_LOCATION]: body.location,\n [ANNOTATION_ORIGIN_LOCATION]: body.location,\n ...entity.metadata.annotations,\n },\n },\n },\n },\n credentials,\n );\n\n if (!processingResult.ok)\n res.status(400).json({\n errors: processingResult.errors.map(e => serializeError(e)),\n });\n return res.status(200).end();\n });\n }\n\n router.use(errorHandler());\n return router;\n}\n"],"names":["router","createOpenApiRouter","parseEntityFilterParams","parseEntityTransformParams","parseEntityOrderParams","parseEntityPaginationParams","writeEntitiesResponse","createEntityArrayJsonStream","parseQueryEntitiesParams","encodeCursor","basicEntityFilter","writeSingleEntityResponse","stringifyEntityRef","entitiesBatchRequest","parseEntityFacetParams","validateRequestBody","locationInput","yn","disallowReadonlyMode","z","InputError","validateEntityEnvelope","parseLocationRef","serializeError","AuthorizedValidationService","ANNOTATION_LOCATION","ANNOTATION_ORIGIN_LOCATION","errorHandler"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA0FA,eAAsB,aACpB,OACyB,EAAA;AACzB,EAAM,MAAAA,QAAA,GAAS,MAAMC,0BAAoB,CAAA;AAAA,IACvC,gBAAkB,EAAA;AAAA;AAAA;AAAA,MAGhB,WAAa,EAAA;AAAA;AACf,GACD,CAAA;AACD,EAAM,MAAA;AAAA,IACJ,eAAA;AAAA,IACA,gBAAA;AAAA,IACA,eAAA;AAAA,IACA,YAAA;AAAA,IACA,cAAA;AAAA,IACA,MAAA;AAAA,IACA,MAAA;AAAA,IACA,2BAAA;AAAA,IACA,kBAAA;AAAA,IACA,IAAA;AAAA,IACA,QAAA;AAAA,IACA,6BAAgC,GAAA;AAAA,GAC9B,GAAA,OAAA;AAEJ,EAAA,MAAM,eACJ,GAAA,MAAA,CAAO,kBAAmB,CAAA,kBAAkB,CAAK,IAAA,KAAA;AACnD,EAAA,IAAI,eAAiB,EAAA;AACnB,IAAA,MAAA,CAAO,KAAK,qCAAqC,CAAA;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B,CAAA,MAAA,CAAO,IAAI,CAAK,CAAA,KAAAH,qBAAA,CAAe,CAAC,CAAC;AAAA,SAC3D,CAAA;AACH,MAAA,OAAO,GAAI,CAAA,MAAA,CAAO,GAAG,CAAA,CAAE,GAAI,EAAA;AAAA,KAC5B,CAAA;AAAA;AAGH,EAAOvB,QAAA,CAAA,GAAA,CAAI2B,4BAAc,CAAA;AACzB,EAAO,OAAA3B,QAAA;AACT;;;;"}
1
+ {"version":3,"file":"createRouter.cjs.js","sources":["../../src/service/createRouter.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 ANNOTATION_LOCATION,\n ANNOTATION_ORIGIN_LOCATION,\n Entity,\n parseLocationRef,\n stringifyEntityRef,\n} from '@backstage/catalog-model';\nimport { Config } from '@backstage/config';\nimport { InputError, serializeError } from '@backstage/errors';\nimport express from 'express';\nimport yn from 'yn';\nimport { z } from 'zod';\nimport { Cursor, EntitiesCatalog } from '../catalog/types';\nimport { CatalogProcessingOrchestrator } from '../processing/types';\nimport { validateEntityEnvelope } from '../processing/util';\nimport {\n basicEntityFilter,\n entitiesBatchRequest,\n parseEntityFilterParams,\n parseEntityTransformParams,\n parseQueryEntitiesParams,\n} from './request';\nimport { parseEntityFacetParams } from './request/parseEntityFacetParams';\nimport { parseEntityOrderParams } from './request/parseEntityOrderParams';\nimport { LocationService, RefreshService } from './types';\nimport {\n disallowReadonlyMode,\n encodeCursor,\n locationInput,\n validateRequestBody,\n} from './util';\nimport { createOpenApiRouter } from '../schema/openapi';\nimport { parseEntityPaginationParams } from './request/parseEntityPaginationParams';\nimport {\n AuthService,\n HttpAuthService,\n LoggerService,\n SchedulerService,\n PermissionsService,\n} from '@backstage/backend-plugin-api';\nimport { LocationAnalyzer } from '@backstage/plugin-catalog-node';\nimport { AuthorizedValidationService } from './AuthorizedValidationService';\nimport {\n createEntityArrayJsonStream,\n writeEntitiesResponse,\n writeSingleEntityResponse,\n} from './response';\n\n/**\n * Options used by {@link createRouter}.\n *\n * @public\n * @deprecated Please migrate to the new backend system as this will be removed in the future.\n */\nexport interface RouterOptions {\n entitiesCatalog?: EntitiesCatalog;\n locationAnalyzer?: LocationAnalyzer;\n locationService: LocationService;\n orchestrator?: CatalogProcessingOrchestrator;\n refreshService?: RefreshService;\n scheduler?: SchedulerService;\n logger: LoggerService;\n config: Config;\n permissionIntegrationRouter?: express.Router;\n auth: AuthService;\n httpAuth: HttpAuthService;\n permissionsService: PermissionsService;\n disableRelationsCompatibility?: boolean;\n}\n\n/**\n * Creates a catalog router.\n */\nexport async function createRouter(\n options: RouterOptions,\n): Promise<express.Router> {\n const router = await createOpenApiRouter({\n validatorOptions: {\n // We want the spec to be up to date with the expected value, but the return type needs\n // to be controlled by the router implementation not the request validator.\n ignorePaths: /^\\/validate-entity\\/?$/,\n },\n });\n const {\n entitiesCatalog,\n locationAnalyzer,\n locationService,\n orchestrator,\n refreshService,\n config,\n logger,\n permissionIntegrationRouter,\n permissionsService,\n auth,\n httpAuth,\n disableRelationsCompatibility = false,\n } = options;\n\n const readonlyEnabled =\n config.getOptionalBoolean('catalog.readonly') || false;\n if (readonlyEnabled) {\n logger.info('Catalog is running in readonly mode');\n }\n\n if (refreshService) {\n router.post('/refresh', async (req, res) => {\n const { authorizationToken, ...restBody } = req.body;\n\n const credentials = authorizationToken\n ? await auth.authenticate(authorizationToken)\n : await httpAuth.credentials(req);\n\n await refreshService.refresh({\n ...restBody,\n credentials,\n });\n res.status(200).end();\n });\n }\n\n if (permissionIntegrationRouter) {\n router.use(permissionIntegrationRouter);\n }\n\n if (entitiesCatalog) {\n router\n .get('/entities', async (req, res) => {\n const filter = parseEntityFilterParams(req.query);\n const fields = parseEntityTransformParams(req.query);\n const order = parseEntityOrderParams(req.query);\n const pagination = parseEntityPaginationParams(req.query);\n const credentials = await httpAuth.credentials(req);\n\n // When pagination parameters are passed in, use the legacy slow path\n // that loads all entities into memory\n\n if (pagination || disableRelationsCompatibility !== true) {\n const { entities, pageInfo } = await entitiesCatalog.entities({\n filter,\n fields,\n order,\n pagination,\n credentials,\n });\n\n // Add a Link header to the next page\n if (pageInfo.hasNextPage) {\n const url = new URL(`http://ignored${req.url}`);\n url.searchParams.delete('offset');\n url.searchParams.set('after', pageInfo.endCursor);\n res.setHeader('link', `<${url.pathname}${url.search}>; rel=\"next\"`);\n }\n\n await writeEntitiesResponse({\n res,\n items: entities,\n alwaysUseObjectMode: !disableRelationsCompatibility,\n });\n return;\n }\n\n const responseStream = createEntityArrayJsonStream(res);\n const limit = 10000;\n let cursor: Cursor | undefined;\n\n try {\n let currentWrite: Promise<boolean> | undefined = undefined;\n do {\n const result = await entitiesCatalog.queryEntities(\n !cursor\n ? {\n credentials,\n fields,\n limit,\n filter,\n orderFields: order,\n skipTotalItems: true,\n }\n : { credentials, fields, limit, cursor },\n );\n\n // Wait for previous write to complete\n if (await currentWrite) {\n return; // Client closed connection\n }\n\n if (result.items.entities.length) {\n currentWrite = responseStream.send(result.items);\n }\n\n cursor = result.pageInfo?.nextCursor;\n } while (cursor);\n\n // Wait for last write to complete\n await currentWrite;\n\n responseStream.complete();\n } finally {\n responseStream.close();\n }\n })\n .get('/entities/by-query', async (req, res) => {\n const { items, pageInfo, totalItems } =\n await entitiesCatalog.queryEntities({\n limit: req.query.limit,\n offset: req.query.offset,\n ...parseQueryEntitiesParams(req.query),\n credentials: await httpAuth.credentials(req),\n });\n\n await writeEntitiesResponse({\n res,\n items,\n alwaysUseObjectMode: !disableRelationsCompatibility,\n responseWrapper: entities => ({\n items: entities,\n totalItems,\n pageInfo: {\n ...(pageInfo.nextCursor && {\n nextCursor: encodeCursor(pageInfo.nextCursor),\n }),\n ...(pageInfo.prevCursor && {\n prevCursor: encodeCursor(pageInfo.prevCursor),\n }),\n },\n }),\n });\n })\n .get('/entities/by-uid/:uid', async (req, res) => {\n const { uid } = req.params;\n const { entities } = await entitiesCatalog.entities({\n filter: basicEntityFilter({ 'metadata.uid': uid }),\n credentials: await httpAuth.credentials(req),\n });\n writeSingleEntityResponse(res, entities, `No entity with uid ${uid}`);\n })\n .delete('/entities/by-uid/:uid', async (req, res) => {\n const { uid } = req.params;\n await entitiesCatalog.removeEntityByUid(uid, {\n credentials: await httpAuth.credentials(req),\n });\n res.status(204).end();\n })\n .get('/entities/by-name/:kind/:namespace/:name', async (req, res) => {\n const { kind, namespace, name } = req.params;\n const { items } = await entitiesCatalog.entitiesBatch({\n entityRefs: [stringifyEntityRef({ kind, namespace, name })],\n credentials: await httpAuth.credentials(req),\n });\n writeSingleEntityResponse(\n res,\n items,\n `No entity named '${name}' found, with kind '${kind}' in namespace '${namespace}'`,\n );\n })\n .get(\n '/entities/by-name/:kind/:namespace/:name/ancestry',\n async (req, res) => {\n const { kind, namespace, name } = req.params;\n const entityRef = stringifyEntityRef({ kind, namespace, name });\n const response = await entitiesCatalog.entityAncestry(entityRef, {\n credentials: await httpAuth.credentials(req),\n });\n res.status(200).json(response);\n },\n )\n .post('/entities/by-refs', async (req, res) => {\n const request = entitiesBatchRequest(req);\n const { items } = await entitiesCatalog.entitiesBatch({\n entityRefs: request.entityRefs,\n filter: parseEntityFilterParams(req.query),\n fields: parseEntityTransformParams(req.query, request.fields),\n credentials: await httpAuth.credentials(req),\n });\n await writeEntitiesResponse({\n res,\n items,\n alwaysUseObjectMode: !disableRelationsCompatibility,\n responseWrapper: entities => ({\n items: entities,\n }),\n });\n })\n .get('/entity-facets', async (req, res) => {\n const response = await entitiesCatalog.facets({\n filter: parseEntityFilterParams(req.query),\n facets: parseEntityFacetParams(req.query),\n credentials: await httpAuth.credentials(req),\n });\n res.status(200).json(response);\n });\n }\n\n if (locationService) {\n router\n .post('/locations', async (req, res) => {\n const location = await validateRequestBody(req, locationInput);\n const dryRun = yn(req.query.dryRun, { default: false });\n\n // when in dryRun addLocation is effectively a read operation so we don't\n // need to disallow readonly\n if (!dryRun) {\n disallowReadonlyMode(readonlyEnabled);\n }\n\n const output = await locationService.createLocation(location, dryRun, {\n credentials: await httpAuth.credentials(req),\n });\n res.status(201).json(output);\n })\n .get('/locations', async (req, res) => {\n const locations = await locationService.listLocations({\n credentials: await httpAuth.credentials(req),\n });\n res.status(200).json(locations.map(l => ({ data: l })));\n })\n\n .get('/locations/:id', async (req, res) => {\n const { id } = req.params;\n const output = await locationService.getLocation(id, {\n credentials: await httpAuth.credentials(req),\n });\n res.status(200).json(output);\n })\n .delete('/locations/:id', async (req, res) => {\n disallowReadonlyMode(readonlyEnabled);\n\n const { id } = req.params;\n await locationService.deleteLocation(id, {\n credentials: await httpAuth.credentials(req),\n });\n res.status(204).end();\n })\n .get('/locations/by-entity/:kind/:namespace/:name', async (req, res) => {\n const { kind, namespace, name } = req.params;\n const output = await locationService.getLocationByEntity(\n { kind, namespace, name },\n { credentials: await httpAuth.credentials(req) },\n );\n res.status(200).json(output);\n });\n }\n\n if (locationAnalyzer) {\n router.post('/analyze-location', async (req, res) => {\n const body = await validateRequestBody(\n req,\n z.object({\n location: locationInput,\n catalogFilename: z.string().optional(),\n }),\n );\n const schema = z.object({\n location: locationInput,\n catalogFilename: z.string().optional(),\n });\n const credentials = await httpAuth.credentials(req);\n const parsedBody = schema.parse(body);\n try {\n const output = await locationAnalyzer.analyzeLocation(\n parsedBody,\n credentials,\n );\n res.status(200).json(output);\n } catch (err) {\n if (\n // Catch errors from parse-url library.\n err.name === 'Error' &&\n 'subject_url' in err\n ) {\n throw new InputError('The given location.target is not a URL');\n }\n throw err;\n }\n });\n }\n\n if (orchestrator) {\n router.post('/validate-entity', async (req, res) => {\n const bodySchema = z.object({\n entity: z.unknown(),\n location: z.string(),\n });\n\n let body: z.infer<typeof bodySchema>;\n let entity: Entity;\n let location: { type: string; target: string };\n try {\n body = await validateRequestBody(req, bodySchema);\n entity = validateEntityEnvelope(body.entity);\n location = parseLocationRef(body.location);\n if (location.type !== 'url')\n throw new TypeError(\n `Invalid location ref ${body.location}, only 'url:<target>' is supported, e.g. url:https://host/path`,\n );\n } catch (err) {\n return res.status(400).json({\n errors: [serializeError(err)],\n });\n }\n\n const credentials = await httpAuth.credentials(req);\n const authorizedValidationService = new AuthorizedValidationService(\n orchestrator,\n permissionsService,\n );\n const processingResult = await authorizedValidationService.process(\n {\n entity: {\n ...entity,\n metadata: {\n ...entity.metadata,\n annotations: {\n [ANNOTATION_LOCATION]: body.location,\n [ANNOTATION_ORIGIN_LOCATION]: body.location,\n ...entity.metadata.annotations,\n },\n },\n },\n },\n credentials,\n );\n\n if (!processingResult.ok)\n res.status(400).json({\n errors: processingResult.errors.map(e => serializeError(e)),\n });\n return res.status(200).end();\n });\n }\n\n return router;\n}\n"],"names":["router","createOpenApiRouter","parseEntityFilterParams","parseEntityTransformParams","parseEntityOrderParams","parseEntityPaginationParams","writeEntitiesResponse","createEntityArrayJsonStream","parseQueryEntitiesParams","encodeCursor","basicEntityFilter","writeSingleEntityResponse","stringifyEntityRef","entitiesBatchRequest","parseEntityFacetParams","validateRequestBody","locationInput","yn","disallowReadonlyMode","z","InputError","validateEntityEnvelope","parseLocationRef","serializeError","AuthorizedValidationService","ANNOTATION_LOCATION","ANNOTATION_ORIGIN_LOCATION"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAyFA,eAAsB,aACpB,OACyB,EAAA;AACzB,EAAM,MAAAA,QAAA,GAAS,MAAMC,0BAAoB,CAAA;AAAA,IACvC,gBAAkB,EAAA;AAAA;AAAA;AAAA,MAGhB,WAAa,EAAA;AAAA;AACf,GACD,CAAA;AACD,EAAM,MAAA;AAAA,IACJ,eAAA;AAAA,IACA,gBAAA;AAAA,IACA,eAAA;AAAA,IACA,YAAA;AA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AAAA,YACN,GAAG,MAAA;AAAA,YACH,QAAU,EAAA;AAAA,cACR,GAAG,MAAO,CAAA,QAAA;AAAA,cACV,WAAa,EAAA;AAAA,gBACX,CAACC,gCAAmB,GAAG,IAAK,CAAA,QAAA;AAAA,gBAC5B,CAACC,uCAA0B,GAAG,IAAK,CAAA,QAAA;AAAA,gBACnC,GAAG,OAAO,QAAS,CAAA;AAAA;AACrB;AACF;AACF,SACF;AAAA,QACA;AAAA,OACF;AAEA,MAAA,IAAI,CAAC,gBAAiB,CAAA,EAAA;AACpB,QAAI,GAAA,CAAA,MAAA,CAAO,GAAG,CAAA,CAAE,IAAK,CAAA;AAAA,UACnB,QAAQ,gBAAiB,CAAA,MAAA,CAAO,IAAI,CAAK,CAAA,KAAAH,qBAAA,CAAe,CAAC,CAAC;AAAA,SAC3D,CAAA;AACH,MAAA,OAAO,GAAI,CAAA,MAAA,CAAO,GAAG,CAAA,CAAE,GAAI,EAAA;AAAA,KAC5B,CAAA;AAAA;AAGH,EAAO,OAAAvB,QAAA;AACT;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-catalog-backend",
3
- "version": "1.29.0",
3
+ "version": "1.30.0-next.1",
4
4
  "description": "The Backstage backend plugin that provides the Backstage catalog",
5
5
  "backstage": {
6
6
  "role": "backend-plugin",
@@ -72,20 +72,20 @@
72
72
  },
73
73
  "dependencies": {
74
74
  "@backstage/backend-common": "^0.25.0",
75
- "@backstage/backend-openapi-utils": "^0.4.0",
76
- "@backstage/backend-plugin-api": "^1.1.0",
77
- "@backstage/catalog-client": "^1.9.0",
78
- "@backstage/catalog-model": "^1.7.2",
79
- "@backstage/config": "^1.3.1",
80
- "@backstage/errors": "^1.2.6",
81
- "@backstage/integration": "^1.16.0",
82
- "@backstage/plugin-catalog-common": "^1.1.2",
83
- "@backstage/plugin-catalog-node": "^1.15.0",
84
- "@backstage/plugin-events-node": "^0.4.6",
85
- "@backstage/plugin-permission-common": "^0.8.3",
86
- "@backstage/plugin-permission-node": "^0.8.6",
87
- "@backstage/plugin-search-backend-module-catalog": "^0.2.6",
88
- "@backstage/types": "^1.2.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",
89
89
  "@opentelemetry/api": "^1.9.0",
90
90
  "@types/express": "^4.17.6",
91
91
  "codeowners-utils": "^1.0.2",
@@ -107,11 +107,11 @@
107
107
  "zod": "^3.22.4"
108
108
  },
109
109
  "devDependencies": {
110
- "@backstage/backend-defaults": "^0.6.0",
111
- "@backstage/backend-test-utils": "^1.2.0",
112
- "@backstage/cli": "^0.29.4",
113
- "@backstage/plugin-permission-common": "^0.8.3",
114
- "@backstage/repo-tools": "^0.12.0",
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",
115
115
  "@types/core-js": "^2.5.4",
116
116
  "@types/git-url-parse": "^9.0.0",
117
117
  "@types/glob": "^8.0.0",