@backstage/plugin-catalog-node 1.11.2-next.1 → 1.12.0-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/alpha/package.json +1 -1
- package/dist/alpha.cjs.js.map +1 -1
- package/dist/alpha.d.ts +19 -2
- package/dist/index.d.ts +12 -2
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @backstage/plugin-catalog-node
|
|
2
2
|
|
|
3
|
+
## 1.12.0-next.2
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- f2a2a83: Added `LocationAnalyzer` type, moved from `@backstage/plugin-catalog-backend`.
|
|
8
|
+
- f2a2a83: Breaking change to `/alpha` API where the `catalogAnalysisExtensionPoint` has been reworked. The `addLocationAnalyzer` method has been renamed to `addScmLocationAnalyzer`, and a new `setLocationAnalyzer` method has been added which allows the full `LocationAnalyzer` implementation to be overridden.
|
|
9
|
+
|
|
3
10
|
## 1.11.2-next.1
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
package/alpha/package.json
CHANGED
package/dist/alpha.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alpha.cjs.js","sources":["../src/catalogService.ts","../src/extensions.ts"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n createServiceFactory,\n createServiceRef,\n coreServices,\n} from '@backstage/backend-plugin-api';\nimport { CatalogApi, CatalogClient } from '@backstage/catalog-client';\n\n/**\n * The catalogService provides the catalog API.\n * @alpha\n */\nexport const catalogServiceRef = createServiceRef<CatalogApi>({\n id: 'catalog-client',\n defaultFactory: async service =>\n createServiceFactory({\n service,\n deps: {\n discoveryApi: coreServices.discovery,\n },\n async factory({ discoveryApi }) {\n return new CatalogClient({ discoveryApi });\n },\n }),\n});\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createExtensionPoint } from '@backstage/backend-plugin-api';\nimport { Entity, Validators } from '@backstage/catalog-model';\nimport {\n CatalogProcessor,\n CatalogProcessorParser,\n EntitiesSearchFilter,\n EntityProvider,\n PlaceholderResolver,\n ScmLocationAnalyzer,\n} from '@backstage/plugin-catalog-node';\nimport {\n Permission,\n PermissionRuleParams,\n} from '@backstage/plugin-permission-common';\nimport { PermissionRule } from '@backstage/plugin-permission-node';\n\n/**\n * @alpha\n */\nexport interface CatalogProcessingExtensionPoint {\n addProcessor(\n ...processors: Array<CatalogProcessor | Array<CatalogProcessor>>\n ): void;\n addEntityProvider(\n ...providers: Array<EntityProvider | Array<EntityProvider>>\n ): void;\n addPlaceholderResolver(key: string, resolver: PlaceholderResolver): void;\n setOnProcessingErrorHandler(\n handler: (event: {\n unprocessedEntity: Entity;\n errors: Error[];\n }) => Promise<void> | void,\n ): void;\n}\n\n/** @alpha */\nexport interface CatalogModelExtensionPoint {\n /**\n * Sets the validator function to use for one or more special fields of an\n * entity. This is useful if the default rules for formatting of fields are\n * not sufficient.\n *\n * @param validators - The (subset of) validators to set\n */\n setFieldValidators(validators: Partial<Validators>): void;\n\n /**\n * Sets the entity data parser which is used to read raw data from locations\n * @param parser - Parser which will used to extract entities from raw data\n */\n setEntityDataParser(parser: CatalogProcessorParser): void;\n}\n\n/**\n * @alpha\n */\nexport const catalogProcessingExtensionPoint =\n createExtensionPoint<CatalogProcessingExtensionPoint>({\n id: 'catalog.processing',\n });\n\n/**\n * @alpha\n */\nexport interface CatalogAnalysisExtensionPoint {\n
|
|
1
|
+
{"version":3,"file":"alpha.cjs.js","sources":["../src/catalogService.ts","../src/extensions.ts"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n createServiceFactory,\n createServiceRef,\n coreServices,\n} from '@backstage/backend-plugin-api';\nimport { CatalogApi, CatalogClient } from '@backstage/catalog-client';\n\n/**\n * The catalogService provides the catalog API.\n * @alpha\n */\nexport const catalogServiceRef = createServiceRef<CatalogApi>({\n id: 'catalog-client',\n defaultFactory: async service =>\n createServiceFactory({\n service,\n deps: {\n discoveryApi: coreServices.discovery,\n },\n async factory({ discoveryApi }) {\n return new CatalogClient({ discoveryApi });\n },\n }),\n});\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createExtensionPoint } from '@backstage/backend-plugin-api';\nimport { Entity, Validators } from '@backstage/catalog-model';\nimport {\n CatalogProcessor,\n CatalogProcessorParser,\n EntitiesSearchFilter,\n EntityProvider,\n PlaceholderResolver,\n LocationAnalyzer,\n ScmLocationAnalyzer,\n} from '@backstage/plugin-catalog-node';\nimport {\n Permission,\n PermissionRuleParams,\n} from '@backstage/plugin-permission-common';\nimport { PermissionRule } from '@backstage/plugin-permission-node';\n\n/**\n * @alpha\n */\nexport interface CatalogProcessingExtensionPoint {\n addProcessor(\n ...processors: Array<CatalogProcessor | Array<CatalogProcessor>>\n ): void;\n addEntityProvider(\n ...providers: Array<EntityProvider | Array<EntityProvider>>\n ): void;\n addPlaceholderResolver(key: string, resolver: PlaceholderResolver): void;\n setOnProcessingErrorHandler(\n handler: (event: {\n unprocessedEntity: Entity;\n errors: Error[];\n }) => Promise<void> | void,\n ): void;\n}\n\n/** @alpha */\nexport interface CatalogModelExtensionPoint {\n /**\n * Sets the validator function to use for one or more special fields of an\n * entity. This is useful if the default rules for formatting of fields are\n * not sufficient.\n *\n * @param validators - The (subset of) validators to set\n */\n setFieldValidators(validators: Partial<Validators>): void;\n\n /**\n * Sets the entity data parser which is used to read raw data from locations\n * @param parser - Parser which will used to extract entities from raw data\n */\n setEntityDataParser(parser: CatalogProcessorParser): void;\n}\n\n/**\n * @alpha\n */\nexport const catalogProcessingExtensionPoint =\n createExtensionPoint<CatalogProcessingExtensionPoint>({\n id: 'catalog.processing',\n });\n\n/**\n * @alpha\n */\nexport interface CatalogAnalysisExtensionPoint {\n /**\n * Replaces the entire location analyzer with a new one.\n *\n * @remarks\n *\n * By providing a factory function you can access all the SCM analyzers that\n * have been added through `addScmLocationAnalyzer`. If you provide a\n * `LocationAnalyzer` directly, the SCM analyzers will be ignored.\n */\n setLocationAnalyzer(\n analyzerOrFactory:\n | LocationAnalyzer\n | ((options: {\n scmLocationAnalyzers: ScmLocationAnalyzer[];\n }) => Promise<{ locationAnalyzer: LocationAnalyzer }>),\n ): void;\n\n /**\n * Adds an analyzer for a specific SCM type to the default location analyzer.\n */\n addScmLocationAnalyzer(analyzer: ScmLocationAnalyzer): void;\n}\n\n/**\n * @alpha\n */\nexport const catalogAnalysisExtensionPoint =\n createExtensionPoint<CatalogAnalysisExtensionPoint>({\n id: 'catalog.analysis',\n });\n\n/** @alpha */\nexport const catalogModelExtensionPoint =\n createExtensionPoint<CatalogModelExtensionPoint>({\n id: 'catalog.model',\n });\n\n/**\n * @alpha\n */\nexport type CatalogPermissionRuleInput<\n TParams extends PermissionRuleParams = PermissionRuleParams,\n> = PermissionRule<Entity, EntitiesSearchFilter, 'catalog-entity', TParams>;\n\n/**\n * @alpha\n */\nexport interface CatalogPermissionExtensionPoint {\n addPermissions(...permissions: Array<Permission | Array<Permission>>): void;\n addPermissionRules(\n ...rules: Array<\n CatalogPermissionRuleInput | Array<CatalogPermissionRuleInput>\n >\n ): void;\n}\n\n/**\n * @alpha\n */\nexport const catalogPermissionExtensionPoint =\n createExtensionPoint<CatalogPermissionExtensionPoint>({\n id: 'catalog.permission',\n });\n"],"names":["createServiceRef","createServiceFactory","coreServices","CatalogClient","createExtensionPoint"],"mappings":";;;;;AA2BO,MAAM,oBAAoBA,iCAA6B,CAAA;AAAA,EAC5D,EAAI,EAAA,gBAAA;AAAA,EACJ,cAAA,EAAgB,OAAM,OAAA,KACpBC,qCAAqB,CAAA;AAAA,IACnB,OAAA;AAAA,IACA,IAAM,EAAA;AAAA,MACJ,cAAcC,6BAAa,CAAA,SAAA;AAAA,KAC7B;AAAA,IACA,MAAM,OAAA,CAAQ,EAAE,YAAA,EAAgB,EAAA;AAC9B,MAAA,OAAO,IAAIC,2BAAA,CAAc,EAAE,YAAA,EAAc,CAAA,CAAA;AAAA,KAC3C;AAAA,GACD,CAAA;AACL,CAAC;;ACkCM,MAAM,kCACXC,qCAAsD,CAAA;AAAA,EACpD,EAAI,EAAA,oBAAA;AACN,CAAC,EAAA;AAgCI,MAAM,gCACXA,qCAAoD,CAAA;AAAA,EAClD,EAAI,EAAA,kBAAA;AACN,CAAC,EAAA;AAGI,MAAM,6BACXA,qCAAiD,CAAA;AAAA,EAC/C,EAAI,EAAA,eAAA;AACN,CAAC,EAAA;AAwBI,MAAM,kCACXA,qCAAsD,CAAA;AAAA,EACpD,EAAI,EAAA,oBAAA;AACN,CAAC;;;;;;;;"}
|
package/dist/alpha.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _backstage_backend_plugin_api from '@backstage/backend-plugin-api';
|
|
2
2
|
import { CatalogApi } from '@backstage/catalog-client';
|
|
3
3
|
import { Entity, Validators } from '@backstage/catalog-model';
|
|
4
|
-
import { CatalogProcessor, EntityProvider, PlaceholderResolver, CatalogProcessorParser, ScmLocationAnalyzer, EntitiesSearchFilter } from '@backstage/plugin-catalog-node';
|
|
4
|
+
import { CatalogProcessor, EntityProvider, PlaceholderResolver, CatalogProcessorParser, LocationAnalyzer, ScmLocationAnalyzer, EntitiesSearchFilter } from '@backstage/plugin-catalog-node';
|
|
5
5
|
import { PermissionRuleParams, Permission } from '@backstage/plugin-permission-common';
|
|
6
6
|
import { PermissionRule } from '@backstage/plugin-permission-node';
|
|
7
7
|
|
|
@@ -47,7 +47,24 @@ declare const catalogProcessingExtensionPoint: _backstage_backend_plugin_api.Ext
|
|
|
47
47
|
* @alpha
|
|
48
48
|
*/
|
|
49
49
|
interface CatalogAnalysisExtensionPoint {
|
|
50
|
-
|
|
50
|
+
/**
|
|
51
|
+
* Replaces the entire location analyzer with a new one.
|
|
52
|
+
*
|
|
53
|
+
* @remarks
|
|
54
|
+
*
|
|
55
|
+
* By providing a factory function you can access all the SCM analyzers that
|
|
56
|
+
* have been added through `addScmLocationAnalyzer`. If you provide a
|
|
57
|
+
* `LocationAnalyzer` directly, the SCM analyzers will be ignored.
|
|
58
|
+
*/
|
|
59
|
+
setLocationAnalyzer(analyzerOrFactory: LocationAnalyzer | ((options: {
|
|
60
|
+
scmLocationAnalyzers: ScmLocationAnalyzer[];
|
|
61
|
+
}) => Promise<{
|
|
62
|
+
locationAnalyzer: LocationAnalyzer;
|
|
63
|
+
}>)): void;
|
|
64
|
+
/**
|
|
65
|
+
* Adds an analyzer for a specific SCM type to the default location analyzer.
|
|
66
|
+
*/
|
|
67
|
+
addScmLocationAnalyzer(analyzer: ScmLocationAnalyzer): void;
|
|
51
68
|
}
|
|
52
69
|
/**
|
|
53
70
|
* @alpha
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { CompoundEntityRef, Entity, LocationEntityV1alpha1 } from '@backstage/catalog-model';
|
|
3
3
|
import { JsonValue } from '@backstage/types';
|
|
4
|
-
import { LocationSpec as LocationSpec$1, AnalyzeLocationExistingEntity } from '@backstage/plugin-catalog-common';
|
|
4
|
+
import { LocationSpec as LocationSpec$1, AnalyzeLocationRequest, AnalyzeLocationResponse, AnalyzeLocationExistingEntity } from '@backstage/plugin-catalog-common';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Holds the entity location information.
|
|
@@ -263,6 +263,16 @@ type PlaceholderResolverParams = {
|
|
|
263
263
|
/** @public */
|
|
264
264
|
type PlaceholderResolver = (params: PlaceholderResolverParams) => Promise<JsonValue>;
|
|
265
265
|
/** @public */
|
|
266
|
+
type LocationAnalyzer = {
|
|
267
|
+
/**
|
|
268
|
+
* Generates an entity configuration for given git repository. It's used for
|
|
269
|
+
* importing new component to the backstage app.
|
|
270
|
+
*
|
|
271
|
+
* @param location - Git repository to analyze and generate config for.
|
|
272
|
+
*/
|
|
273
|
+
analyzeLocation(location: AnalyzeLocationRequest): Promise<AnalyzeLocationResponse>;
|
|
274
|
+
};
|
|
275
|
+
/** @public */
|
|
266
276
|
type AnalyzeOptions = {
|
|
267
277
|
url: string;
|
|
268
278
|
catalogFilename?: string;
|
|
@@ -356,4 +366,4 @@ declare function locationSpecToLocationEntity(opts: {
|
|
|
356
366
|
parentEntity?: Entity;
|
|
357
367
|
}): LocationEntityV1alpha1;
|
|
358
368
|
|
|
359
|
-
export { type AnalyzeOptions, type CatalogProcessor, type CatalogProcessorCache, type CatalogProcessorEmit, type CatalogProcessorEntityResult, type CatalogProcessorErrorResult, type CatalogProcessorLocationResult, type CatalogProcessorParser, type CatalogProcessorRefreshKeysResult, type CatalogProcessorRelationResult, type CatalogProcessorResult, type DeferredEntity, type EntitiesSearchFilter, type EntityFilter, type EntityProvider, type EntityProviderConnection, type EntityProviderMutation, type EntityProviderRefreshOptions, type EntityRelationSpec, type LocationSpec, type PlaceholderResolver, type PlaceholderResolverParams, type PlaceholderResolverRead, type PlaceholderResolverResolveUrl, type ScmLocationAnalyzer, locationSpecToLocationEntity, locationSpecToMetadataName, processingResult };
|
|
369
|
+
export { type AnalyzeOptions, type CatalogProcessor, type CatalogProcessorCache, type CatalogProcessorEmit, type CatalogProcessorEntityResult, type CatalogProcessorErrorResult, type CatalogProcessorLocationResult, type CatalogProcessorParser, type CatalogProcessorRefreshKeysResult, type CatalogProcessorRelationResult, type CatalogProcessorResult, type DeferredEntity, type EntitiesSearchFilter, type EntityFilter, type EntityProvider, type EntityProviderConnection, type EntityProviderMutation, type EntityProviderRefreshOptions, type EntityRelationSpec, type LocationAnalyzer, type LocationSpec, type PlaceholderResolver, type PlaceholderResolverParams, type PlaceholderResolverRead, type PlaceholderResolverResolveUrl, type ScmLocationAnalyzer, locationSpecToLocationEntity, locationSpecToMetadataName, processingResult };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-catalog-node",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.0-next.2",
|
|
4
4
|
"description": "The plugin-catalog-node module for @backstage/plugin-catalog-backend",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "node-library"
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@backstage/types": "^1.1.1"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@backstage/backend-test-utils": "^0.3.8-next.
|
|
58
|
-
"@backstage/cli": "^0.26.5-next.
|
|
57
|
+
"@backstage/backend-test-utils": "^0.3.8-next.2",
|
|
58
|
+
"@backstage/cli": "^0.26.5-next.1"
|
|
59
59
|
}
|
|
60
60
|
}
|