@backstage/plugin-catalog-node 1.20.1-next.1 → 1.21.0-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,40 @@
1
1
  # @backstage/plugin-catalog-node
2
2
 
3
+ ## 1.21.0-next.0
4
+
5
+ ### Minor Changes
6
+
7
+ - cfd8103: Promoted stable catalog extension points from alpha to main export. The following extension points are now exported from `@backstage/plugin-catalog-node` instead of `@backstage/plugin-catalog-node/alpha`:
8
+
9
+ - `catalogLocationsExtensionPoint` and `CatalogLocationsExtensionPoint`
10
+ - `catalogProcessingExtensionPoint` and `CatalogProcessingExtensionPoint`
11
+ - `catalogAnalysisExtensionPoint` and `CatalogAnalysisExtensionPoint`
12
+
13
+ The old alpha exports for these extension points are now deprecated with `@deprecated` markers pointing to the new stable exports. Please update your imports from `@backstage/plugin-catalog-node/alpha` to `@backstage/plugin-catalog-node`.
14
+
15
+ Note: The `catalogModelExtensionPoint`, `catalogPermissionExtensionPoint`, and related types remain in alpha.
16
+
17
+ ### Patch Changes
18
+
19
+ - 7455dae: Use node prefix on native imports
20
+ - Updated dependencies
21
+ - @backstage/backend-plugin-api@1.7.0-next.0
22
+ - @backstage/plugin-permission-common@0.9.5-next.0
23
+ - @backstage/plugin-permission-node@0.10.9-next.0
24
+ - @backstage/catalog-client@1.12.1
25
+ - @backstage/catalog-model@1.7.6
26
+ - @backstage/errors@1.2.7
27
+ - @backstage/types@1.2.2
28
+ - @backstage/plugin-catalog-common@1.1.8-next.0
29
+
30
+ ## 1.20.1
31
+
32
+ ### Patch Changes
33
+
34
+ - Updated dependencies
35
+ - @backstage/plugin-permission-node@0.10.7
36
+ - @backstage/backend-plugin-api@1.6.0
37
+
3
38
  ## 1.20.1-next.1
4
39
 
5
40
  ### Patch Changes
package/dist/alpha.cjs.js CHANGED
@@ -4,6 +4,7 @@ var backendPluginApi = require('@backstage/backend-plugin-api');
4
4
  var catalogClient = require('@backstage/catalog-client');
5
5
  var alpha = require('@backstage/plugin-catalog-common/alpha');
6
6
  var pluginPermissionNode = require('@backstage/plugin-permission-node');
7
+ var pluginCatalogNode = require('@backstage/plugin-catalog-node');
7
8
  var extensions = require('./extensions.cjs.js');
8
9
 
9
10
  const catalogEntityPermissionResourceRef = pluginPermissionNode.createPermissionResourceRef().with({
@@ -22,12 +23,15 @@ const catalogServiceRef = backendPluginApi.createServiceRef({
22
23
  }
23
24
  })
24
25
  });
26
+ const catalogLocationsExtensionPoint = pluginCatalogNode.catalogLocationsExtensionPoint;
27
+ const catalogProcessingExtensionPoint = pluginCatalogNode.catalogProcessingExtensionPoint;
28
+ const catalogAnalysisExtensionPoint = pluginCatalogNode.catalogAnalysisExtensionPoint;
25
29
 
26
- exports.catalogAnalysisExtensionPoint = extensions.catalogAnalysisExtensionPoint;
27
- exports.catalogLocationsExtensionPoint = extensions.catalogLocationsExtensionPoint;
28
30
  exports.catalogModelExtensionPoint = extensions.catalogModelExtensionPoint;
29
31
  exports.catalogPermissionExtensionPoint = extensions.catalogPermissionExtensionPoint;
30
- exports.catalogProcessingExtensionPoint = extensions.catalogProcessingExtensionPoint;
32
+ exports.catalogAnalysisExtensionPoint = catalogAnalysisExtensionPoint;
31
33
  exports.catalogEntityPermissionResourceRef = catalogEntityPermissionResourceRef;
34
+ exports.catalogLocationsExtensionPoint = catalogLocationsExtensionPoint;
35
+ exports.catalogProcessingExtensionPoint = catalogProcessingExtensionPoint;
32
36
  exports.catalogServiceRef = catalogServiceRef;
33
37
  //# sourceMappingURL=alpha.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"alpha.cjs.js","sources":["../src/alpha.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 coreServices,\n createServiceFactory,\n createServiceRef,\n} from '@backstage/backend-plugin-api';\nimport { catalogServiceRef as _catalogServiceRef } from './catalogService';\nimport { CatalogApi, CatalogClient } from '@backstage/catalog-client';\nimport { RESOURCE_TYPE_CATALOG_ENTITY } from '@backstage/plugin-catalog-common/alpha';\nimport { createPermissionResourceRef } from '@backstage/plugin-permission-node';\nimport { Entity } from '@backstage/catalog-model';\nimport { EntitiesSearchFilter } from '@backstage/plugin-catalog-node';\n\n/** @alpha */\nexport const catalogEntityPermissionResourceRef = createPermissionResourceRef<\n Entity,\n EntitiesSearchFilter\n>().with({\n pluginId: 'catalog',\n resourceType: RESOURCE_TYPE_CATALOG_ENTITY,\n});\n\n/**\n * @alpha\n * @deprecated Use {@link @backstage/plugin-catalog-node#catalogServiceRef} instead\n */\nexport const catalogServiceRef = createServiceRef<CatalogApi>({\n id: 'catalog-client-legacy',\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\nexport type { CatalogLocationsExtensionPoint } from './extensions';\nexport { catalogLocationsExtensionPoint } from './extensions';\nexport type { CatalogProcessingExtensionPoint } from './extensions';\nexport { catalogProcessingExtensionPoint } from './extensions';\nexport type { CatalogAnalysisExtensionPoint } from './extensions';\nexport { catalogAnalysisExtensionPoint } from './extensions';\nexport type { CatalogPermissionRuleInput } from './extensions';\nexport type { CatalogPermissionExtensionPoint } from './extensions';\nexport { catalogPermissionExtensionPoint } from './extensions';\nexport type { CatalogModelExtensionPoint } from './extensions';\nexport { catalogModelExtensionPoint } from './extensions';\n"],"names":["createPermissionResourceRef","RESOURCE_TYPE_CATALOG_ENTITY","createServiceRef","createServiceFactory","coreServices","CatalogClient"],"mappings":";;;;;;;;AA6BO,MAAM,kCAAA,GAAqCA,gDAAA,EAGhD,CAAE,IAAA,CAAK;AAAA,EACP,QAAA,EAAU,SAAA;AAAA,EACV,YAAA,EAAcC;AAChB,CAAC;AAMM,MAAM,oBAAoBC,iCAAA,CAA6B;AAAA,EAC5D,EAAA,EAAI,uBAAA;AAAA,EACJ,cAAA,EAAgB,OAAM,OAAA,KACpBC,qCAAA,CAAqB;AAAA,IACnB,OAAA;AAAA,IACA,IAAA,EAAM;AAAA,MACJ,cAAcC,6BAAA,CAAa;AAAA,KAC7B;AAAA,IACA,MAAM,OAAA,CAAQ,EAAE,YAAA,EAAa,EAAG;AAC9B,MAAA,OAAO,IAAIC,2BAAA,CAAc,EAAE,YAAA,EAAc,CAAA;AAAA,IAC3C;AAAA,GACD;AACL,CAAC;;;;;;;;;;"}
1
+ {"version":3,"file":"alpha.cjs.js","sources":["../src/alpha.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 coreServices,\n createServiceFactory,\n createServiceRef,\n} from '@backstage/backend-plugin-api';\nimport { catalogServiceRef as _catalogServiceRef } from './catalogService';\nimport { CatalogApi, CatalogClient } from '@backstage/catalog-client';\nimport { RESOURCE_TYPE_CATALOG_ENTITY } from '@backstage/plugin-catalog-common/alpha';\nimport { createPermissionResourceRef } from '@backstage/plugin-permission-node';\nimport { Entity } from '@backstage/catalog-model';\nimport { EntitiesSearchFilter } from '@backstage/plugin-catalog-node';\n\n/** @alpha */\nexport const catalogEntityPermissionResourceRef = createPermissionResourceRef<\n Entity,\n EntitiesSearchFilter\n>().with({\n pluginId: 'catalog',\n resourceType: RESOURCE_TYPE_CATALOG_ENTITY,\n});\n\n/**\n * @alpha\n * @deprecated Use {@link @backstage/plugin-catalog-node#catalogServiceRef} instead\n */\nexport const catalogServiceRef = createServiceRef<CatalogApi>({\n id: 'catalog-client-legacy',\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\nimport {\n CatalogLocationsExtensionPoint as _CatalogLocationsExtensionPoint,\n CatalogProcessingExtensionPoint as _CatalogProcessingExtensionPoint,\n CatalogAnalysisExtensionPoint as _CatalogAnalysisExtensionPoint,\n catalogLocationsExtensionPoint as _catalogLocationsExtensionPoint,\n catalogProcessingExtensionPoint as _catalogProcessingExtensionPoint,\n catalogAnalysisExtensionPoint as _catalogAnalysisExtensionPoint,\n} from '@backstage/plugin-catalog-node';\n\n/**\n * @alpha\n * @deprecated Use {@link @backstage/plugin-catalog-node#CatalogLocationsExtensionPoint} instead\n */\nexport type CatalogLocationsExtensionPoint = _CatalogLocationsExtensionPoint;\n\n/**\n * @alpha\n * @deprecated Use {@link @backstage/plugin-catalog-node#catalogLocationsExtensionPoint} instead\n */\nexport const catalogLocationsExtensionPoint = _catalogLocationsExtensionPoint;\n\n/**\n * @alpha\n * @deprecated Use {@link @backstage/plugin-catalog-node#CatalogProcessingExtensionPoint} instead\n */\nexport type CatalogProcessingExtensionPoint = _CatalogProcessingExtensionPoint;\n\n/**\n * @alpha\n * @deprecated Use {@link @backstage/plugin-catalog-node#catalogProcessingExtensionPoint} instead\n */\nexport const catalogProcessingExtensionPoint = _catalogProcessingExtensionPoint;\n\n/**\n * @alpha\n * @deprecated Use {@link @backstage/plugin-catalog-node#CatalogAnalysisExtensionPoint} instead\n */\nexport type CatalogAnalysisExtensionPoint = _CatalogAnalysisExtensionPoint;\n\n/**\n * @alpha\n * @deprecated Use {@link @backstage/plugin-catalog-node#catalogAnalysisExtensionPoint} instead\n */\nexport const catalogAnalysisExtensionPoint = _catalogAnalysisExtensionPoint;\n\nexport type { CatalogModelExtensionPoint } from './extensions';\nexport { catalogModelExtensionPoint } from './extensions';\nexport type { CatalogPermissionRuleInput } from './extensions';\nexport type { CatalogPermissionExtensionPoint } from './extensions';\nexport { catalogPermissionExtensionPoint } from './extensions';\n"],"names":["createPermissionResourceRef","RESOURCE_TYPE_CATALOG_ENTITY","createServiceRef","createServiceFactory","coreServices","CatalogClient","_catalogLocationsExtensionPoint","_catalogProcessingExtensionPoint","_catalogAnalysisExtensionPoint"],"mappings":";;;;;;;;;AA6BO,MAAM,kCAAA,GAAqCA,gDAAA,EAGhD,CAAE,IAAA,CAAK;AAAA,EACP,QAAA,EAAU,SAAA;AAAA,EACV,YAAA,EAAcC;AAChB,CAAC;AAMM,MAAM,oBAAoBC,iCAAA,CAA6B;AAAA,EAC5D,EAAA,EAAI,uBAAA;AAAA,EACJ,cAAA,EAAgB,OAAM,OAAA,KACpBC,qCAAA,CAAqB;AAAA,IACnB,OAAA;AAAA,IACA,IAAA,EAAM;AAAA,MACJ,cAAcC,6BAAA,CAAa;AAAA,KAC7B;AAAA,IACA,MAAM,OAAA,CAAQ,EAAE,YAAA,EAAa,EAAG;AAC9B,MAAA,OAAO,IAAIC,2BAAA,CAAc,EAAE,YAAA,EAAc,CAAA;AAAA,IAC3C;AAAA,GACD;AACL,CAAC;AAqBM,MAAM,8BAAA,GAAiCC;AAYvC,MAAM,+BAAA,GAAkCC;AAYxC,MAAM,6BAAA,GAAgCC;;;;;;;;;;"}
package/dist/alpha.d.ts CHANGED
@@ -1,137 +1,49 @@
1
1
  import * as _backstage_backend_plugin_api from '@backstage/backend-plugin-api';
2
2
  import * as _backstage_plugin_permission_node from '@backstage/plugin-permission-node';
3
- import { PermissionRule } from '@backstage/plugin-permission-node';
4
3
  import { CatalogApi } from '@backstage/catalog-client';
5
- import { Entity, Validators } from '@backstage/catalog-model';
6
- import { CatalogProcessor, EntityProvider, PlaceholderResolver, LocationAnalyzer, ScmLocationAnalyzer, EntitiesSearchFilter, CatalogProcessorParser } from '@backstage/plugin-catalog-node';
7
- import { PermissionRuleParams, Permission } from '@backstage/plugin-permission-common';
4
+ import { Entity } from '@backstage/catalog-model';
5
+ import { EntitiesSearchFilter, CatalogLocationsExtensionPoint as CatalogLocationsExtensionPoint$1, CatalogProcessingExtensionPoint as CatalogProcessingExtensionPoint$1, CatalogAnalysisExtensionPoint as CatalogAnalysisExtensionPoint$1 } from '@backstage/plugin-catalog-node';
6
+ export { f as CatalogModelExtensionPoint, i as CatalogPermissionExtensionPoint, h as CatalogPermissionRuleInput, g as catalogModelExtensionPoint, j as catalogPermissionExtensionPoint } from './types/extensions.d-Cvnx6_V0.js';
7
+ import '@backstage/plugin-permission-common';
8
8
 
9
- /**
10
- * @alpha
11
- */
12
- interface CatalogLocationsExtensionPoint {
13
- /**
14
- * Allows setting custom location types, such as showcased in: https://backstage.io/docs/features/software-catalog/external-integrations/#creating-a-catalog-data-reader-processor
15
- * @param locationTypes - List of location types to allow, default is "url" and "file"
16
- */
17
- setAllowedLocationTypes(locationTypes: Array<string>): void;
18
- }
19
- /**
20
- * @alpha
21
- */
22
- declare const catalogLocationsExtensionPoint: _backstage_backend_plugin_api.ExtensionPoint<CatalogLocationsExtensionPoint>;
23
- /**
24
- * @alpha
25
- */
26
- interface CatalogProcessingExtensionPoint {
27
- /**
28
- * Adds entity processors. These are responsible for reading, parsing, and
29
- * processing entities before they are persisted in the catalog.
30
- *
31
- * This function also can replace a Default processor if the provided processor
32
- * matches the processor name.
33
- *
34
- * @param processors - One or more processors
35
- */
36
- addProcessor(...processors: Array<CatalogProcessor | Array<CatalogProcessor>>): void;
37
- /**
38
- * Adds or replaces entity providers. These are responsible for bootstrapping
39
- * the list of entities out of original data sources. For example, there is
40
- * one entity source for the config locations, and one for the database
41
- * stored locations. If you ingest entities out of a third party system, you
42
- * may want to implement that in terms of an entity provider as well.
43
- *
44
- * @param providers - One or more entity providers
45
- */
46
- addEntityProvider(...providers: Array<EntityProvider | Array<EntityProvider>>): void;
47
- /**
48
- * Adds, or overwrites, a handler for placeholders (e.g. $file) in entity
49
- * definition files.
50
- *
51
- * @param key - The key that identifies the placeholder, e.g. "file"
52
- * @param resolver - The resolver that gets values for this placeholder
53
- */
54
- addPlaceholderResolver(key: string, resolver: PlaceholderResolver): void;
55
- setOnProcessingErrorHandler(handler: (event: {
56
- unprocessedEntity: Entity;
57
- errors: Error[];
58
- }) => Promise<void> | void): void;
59
- }
60
9
  /** @alpha */
61
- interface CatalogModelExtensionPoint {
62
- /**
63
- * Sets the validator function to use for one or more special fields of an
64
- * entity. This is useful if the default rules for formatting of fields are
65
- * not sufficient.
66
- *
67
- * @param validators - The (subset of) validators to set
68
- */
69
- setFieldValidators(validators: Partial<Validators>): void;
70
- /**
71
- * Sets the entity data parser which is used to read raw data from locations
72
- * @param parser - Parser which will used to extract entities from raw data
73
- */
74
- setEntityDataParser(parser: CatalogProcessorParser): void;
75
- }
10
+ declare const catalogEntityPermissionResourceRef: _backstage_plugin_permission_node.PermissionResourceRef<Entity, EntitiesSearchFilter, "catalog-entity", "catalog">;
76
11
  /**
77
12
  * @alpha
13
+ * @deprecated Use {@link @backstage/plugin-catalog-node#catalogServiceRef} instead
78
14
  */
79
- declare const catalogProcessingExtensionPoint: _backstage_backend_plugin_api.ExtensionPoint<CatalogProcessingExtensionPoint>;
15
+ declare const catalogServiceRef: _backstage_backend_plugin_api.ServiceRef<CatalogApi, "plugin", "singleton">;
16
+
80
17
  /**
81
18
  * @alpha
19
+ * @deprecated Use {@link @backstage/plugin-catalog-node#CatalogLocationsExtensionPoint} instead
82
20
  */
83
- interface CatalogAnalysisExtensionPoint {
84
- /**
85
- * Replaces the entire location analyzer with a new one.
86
- *
87
- * @remarks
88
- *
89
- * By providing a factory function you can access all the SCM analyzers that
90
- * have been added through `addScmLocationAnalyzer`. If you provide a
91
- * `LocationAnalyzer` directly, the SCM analyzers will be ignored.
92
- */
93
- setLocationAnalyzer(analyzerOrFactory: LocationAnalyzer | ((options: {
94
- scmLocationAnalyzers: ScmLocationAnalyzer[];
95
- }) => Promise<{
96
- locationAnalyzer: LocationAnalyzer;
97
- }>)): void;
98
- /**
99
- * Adds an analyzer for a specific SCM type to the default location analyzer.
100
- */
101
- addScmLocationAnalyzer(analyzer: ScmLocationAnalyzer): void;
102
- }
21
+ type CatalogLocationsExtensionPoint = CatalogLocationsExtensionPoint$1;
103
22
  /**
104
23
  * @alpha
24
+ * @deprecated Use {@link @backstage/plugin-catalog-node#catalogLocationsExtensionPoint} instead
105
25
  */
106
- declare const catalogAnalysisExtensionPoint: _backstage_backend_plugin_api.ExtensionPoint<CatalogAnalysisExtensionPoint>;
107
- /** @alpha */
108
- declare const catalogModelExtensionPoint: _backstage_backend_plugin_api.ExtensionPoint<CatalogModelExtensionPoint>;
26
+ declare const catalogLocationsExtensionPoint: _backstage_backend_plugin_api.ExtensionPoint<CatalogLocationsExtensionPoint$1>;
109
27
  /**
110
28
  * @alpha
111
- * @deprecated Use the `coreServices.permissionsRegistry` instead.
29
+ * @deprecated Use {@link @backstage/plugin-catalog-node#CatalogProcessingExtensionPoint} instead
112
30
  */
113
- type CatalogPermissionRuleInput<TParams extends PermissionRuleParams = PermissionRuleParams> = PermissionRule<Entity, EntitiesSearchFilter, 'catalog-entity', TParams>;
31
+ type CatalogProcessingExtensionPoint = CatalogProcessingExtensionPoint$1;
114
32
  /**
115
33
  * @alpha
116
- * @deprecated Use the `coreServices.permissionsRegistry` instead.
34
+ * @deprecated Use {@link @backstage/plugin-catalog-node#catalogProcessingExtensionPoint} instead
117
35
  */
118
- interface CatalogPermissionExtensionPoint {
119
- addPermissions(...permissions: Array<Permission | Array<Permission>>): void;
120
- addPermissionRules(...rules: Array<CatalogPermissionRuleInput | Array<CatalogPermissionRuleInput>>): void;
121
- }
36
+ declare const catalogProcessingExtensionPoint: _backstage_backend_plugin_api.ExtensionPoint<CatalogProcessingExtensionPoint$1>;
122
37
  /**
123
38
  * @alpha
124
- * @deprecated Use the `coreServices.permissionsRegistry` instead.
39
+ * @deprecated Use {@link @backstage/plugin-catalog-node#CatalogAnalysisExtensionPoint} instead
125
40
  */
126
- declare const catalogPermissionExtensionPoint: _backstage_backend_plugin_api.ExtensionPoint<CatalogPermissionExtensionPoint>;
127
-
128
- /** @alpha */
129
- declare const catalogEntityPermissionResourceRef: _backstage_plugin_permission_node.PermissionResourceRef<Entity, EntitiesSearchFilter, "catalog-entity", "catalog">;
41
+ type CatalogAnalysisExtensionPoint = CatalogAnalysisExtensionPoint$1;
130
42
  /**
131
43
  * @alpha
132
- * @deprecated Use {@link @backstage/plugin-catalog-node#catalogServiceRef} instead
44
+ * @deprecated Use {@link @backstage/plugin-catalog-node#catalogAnalysisExtensionPoint} instead
133
45
  */
134
- declare const catalogServiceRef: _backstage_backend_plugin_api.ServiceRef<CatalogApi, "plugin", "singleton">;
46
+ declare const catalogAnalysisExtensionPoint: _backstage_backend_plugin_api.ExtensionPoint<CatalogAnalysisExtensionPoint$1>;
135
47
 
136
- export { catalogAnalysisExtensionPoint, catalogEntityPermissionResourceRef, catalogLocationsExtensionPoint, catalogModelExtensionPoint, catalogPermissionExtensionPoint, catalogProcessingExtensionPoint, catalogServiceRef };
137
- export type { CatalogAnalysisExtensionPoint, CatalogLocationsExtensionPoint, CatalogModelExtensionPoint, CatalogPermissionExtensionPoint, CatalogPermissionRuleInput, CatalogProcessingExtensionPoint };
48
+ export { catalogAnalysisExtensionPoint, catalogEntityPermissionResourceRef, catalogLocationsExtensionPoint, catalogProcessingExtensionPoint, catalogServiceRef };
49
+ export type { CatalogAnalysisExtensionPoint, CatalogLocationsExtensionPoint, CatalogProcessingExtensionPoint };
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
3
  var catalogModel = require('@backstage/catalog-model');
4
- var crypto = require('crypto');
4
+ var node_crypto = require('node:crypto');
5
5
 
6
6
  function locationSpecToMetadataName(location) {
7
- const hash = crypto.createHash("sha1").update(`${location.type}:${location.target}`).digest("hex");
7
+ const hash = node_crypto.createHash("sha1").update(`${location.type}:${location.target}`).digest("hex");
8
8
  return `generated-${hash}`;
9
9
  }
10
10
  function locationSpecToLocationEntity(opts) {
@@ -1 +1 @@
1
- {"version":3,"file":"conversion.cjs.js","sources":["../src/conversion.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 Entity,\n LocationEntityV1alpha1,\n ANNOTATION_LOCATION,\n ANNOTATION_ORIGIN_LOCATION,\n stringifyEntityRef,\n stringifyLocationRef,\n} from '@backstage/catalog-model';\nimport { createHash } from 'crypto';\nimport { LocationSpec } from '@backstage/plugin-catalog-common';\n\n/**\n * A standard way of producing a machine generated name for a location.\n *\n * @public\n */\nexport function locationSpecToMetadataName(location: LocationSpec) {\n const hash = createHash('sha1')\n .update(`${location.type}:${location.target}`)\n .digest('hex');\n return `generated-${hash}`;\n}\n\n/**\n * A standard way of producing a machine generated Location kind entity for a\n * location.\n *\n * @public\n */\nexport function locationSpecToLocationEntity(opts: {\n location: LocationSpec;\n parentEntity?: Entity;\n}): LocationEntityV1alpha1 {\n const location = opts.location;\n const parentEntity = opts.parentEntity;\n\n let ownLocation: string;\n let originLocation: string;\n if (parentEntity) {\n const maybeOwnLocation =\n parentEntity.metadata.annotations?.[ANNOTATION_LOCATION];\n if (!maybeOwnLocation) {\n throw new Error(\n `Parent entity '${stringifyEntityRef(\n parentEntity,\n )}' of location '${stringifyLocationRef(\n location,\n )}' does not have a location annotation`,\n );\n }\n ownLocation = maybeOwnLocation;\n const maybeOriginLocation =\n parentEntity.metadata.annotations?.[ANNOTATION_ORIGIN_LOCATION];\n if (!maybeOriginLocation) {\n throw new Error(\n `Parent entity '${stringifyEntityRef(\n parentEntity,\n )}' of location '${stringifyLocationRef(\n location,\n )}' does not have an origin location annotation`,\n );\n }\n originLocation = maybeOriginLocation;\n } else {\n ownLocation = stringifyLocationRef(location);\n originLocation = ownLocation;\n }\n\n const result: LocationEntityV1alpha1 = {\n apiVersion: 'backstage.io/v1alpha1',\n kind: 'Location',\n metadata: {\n name: locationSpecToMetadataName(location),\n annotations: {\n [ANNOTATION_LOCATION]: ownLocation,\n [ANNOTATION_ORIGIN_LOCATION]: originLocation,\n },\n },\n spec: {\n type: location.type,\n target: location.target,\n presence: location.presence,\n },\n };\n\n return result;\n}\n"],"names":["createHash","ANNOTATION_LOCATION","stringifyEntityRef","stringifyLocationRef","ANNOTATION_ORIGIN_LOCATION"],"mappings":";;;;;AAgCO,SAAS,2BAA2B,QAAA,EAAwB;AACjE,EAAA,MAAM,IAAA,GAAOA,iBAAA,CAAW,MAAM,CAAA,CAC3B,OAAO,CAAA,EAAG,QAAA,CAAS,IAAI,CAAA,CAAA,EAAI,QAAA,CAAS,MAAM,CAAA,CAAE,CAAA,CAC5C,OAAO,KAAK,CAAA;AACf,EAAA,OAAO,aAAa,IAAI,CAAA,CAAA;AAC1B;AAQO,SAAS,6BAA6B,IAAA,EAGlB;AACzB,EAAA,MAAM,WAAW,IAAA,CAAK,QAAA;AACtB,EAAA,MAAM,eAAe,IAAA,CAAK,YAAA;AAE1B,EAAA,IAAI,WAAA;AACJ,EAAA,IAAI,cAAA;AACJ,EAAA,IAAI,YAAA,EAAc;AAChB,IAAA,MAAM,gBAAA,GACJ,YAAA,CAAa,QAAA,CAAS,WAAA,GAAcC,gCAAmB,CAAA;AACzD,IAAA,IAAI,CAAC,gBAAA,EAAkB;AACrB,MAAA,MAAM,IAAI,KAAA;AAAA,QACR,CAAA,eAAA,EAAkBC,+BAAA;AAAA,UAChB;AAAA,SACD,CAAA,eAAA,EAAkBC,iCAAA;AAAA,UACjB;AAAA,SACD,CAAA,qCAAA;AAAA,OACH;AAAA,IACF;AACA,IAAA,WAAA,GAAc,gBAAA;AACd,IAAA,MAAM,mBAAA,GACJ,YAAA,CAAa,QAAA,CAAS,WAAA,GAAcC,uCAA0B,CAAA;AAChE,IAAA,IAAI,CAAC,mBAAA,EAAqB;AACxB,MAAA,MAAM,IAAI,KAAA;AAAA,QACR,CAAA,eAAA,EAAkBF,+BAAA;AAAA,UAChB;AAAA,SACD,CAAA,eAAA,EAAkBC,iCAAA;AAAA,UACjB;AAAA,SACD,CAAA,6CAAA;AAAA,OACH;AAAA,IACF;AACA,IAAA,cAAA,GAAiB,mBAAA;AAAA,EACnB,CAAA,MAAO;AACL,IAAA,WAAA,GAAcA,kCAAqB,QAAQ,CAAA;AAC3C,IAAA,cAAA,GAAiB,WAAA;AAAA,EACnB;AAEA,EAAA,MAAM,MAAA,GAAiC;AAAA,IACrC,UAAA,EAAY,uBAAA;AAAA,IACZ,IAAA,EAAM,UAAA;AAAA,IACN,QAAA,EAAU;AAAA,MACR,IAAA,EAAM,2BAA2B,QAAQ,CAAA;AAAA,MACzC,WAAA,EAAa;AAAA,QACX,CAACF,gCAAmB,GAAG,WAAA;AAAA,QACvB,CAACG,uCAA0B,GAAG;AAAA;AAChC,KACF;AAAA,IACA,IAAA,EAAM;AAAA,MACJ,MAAM,QAAA,CAAS,IAAA;AAAA,MACf,QAAQ,QAAA,CAAS,MAAA;AAAA,MACjB,UAAU,QAAA,CAAS;AAAA;AACrB,GACF;AAEA,EAAA,OAAO,MAAA;AACT;;;;;"}
1
+ {"version":3,"file":"conversion.cjs.js","sources":["../src/conversion.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 Entity,\n LocationEntityV1alpha1,\n ANNOTATION_LOCATION,\n ANNOTATION_ORIGIN_LOCATION,\n stringifyEntityRef,\n stringifyLocationRef,\n} from '@backstage/catalog-model';\nimport { createHash } from 'node:crypto';\nimport { LocationSpec } from '@backstage/plugin-catalog-common';\n\n/**\n * A standard way of producing a machine generated name for a location.\n *\n * @public\n */\nexport function locationSpecToMetadataName(location: LocationSpec) {\n const hash = createHash('sha1')\n .update(`${location.type}:${location.target}`)\n .digest('hex');\n return `generated-${hash}`;\n}\n\n/**\n * A standard way of producing a machine generated Location kind entity for a\n * location.\n *\n * @public\n */\nexport function locationSpecToLocationEntity(opts: {\n location: LocationSpec;\n parentEntity?: Entity;\n}): LocationEntityV1alpha1 {\n const location = opts.location;\n const parentEntity = opts.parentEntity;\n\n let ownLocation: string;\n let originLocation: string;\n if (parentEntity) {\n const maybeOwnLocation =\n parentEntity.metadata.annotations?.[ANNOTATION_LOCATION];\n if (!maybeOwnLocation) {\n throw new Error(\n `Parent entity '${stringifyEntityRef(\n parentEntity,\n )}' of location '${stringifyLocationRef(\n location,\n )}' does not have a location annotation`,\n );\n }\n ownLocation = maybeOwnLocation;\n const maybeOriginLocation =\n parentEntity.metadata.annotations?.[ANNOTATION_ORIGIN_LOCATION];\n if (!maybeOriginLocation) {\n throw new Error(\n `Parent entity '${stringifyEntityRef(\n parentEntity,\n )}' of location '${stringifyLocationRef(\n location,\n )}' does not have an origin location annotation`,\n );\n }\n originLocation = maybeOriginLocation;\n } else {\n ownLocation = stringifyLocationRef(location);\n originLocation = ownLocation;\n }\n\n const result: LocationEntityV1alpha1 = {\n apiVersion: 'backstage.io/v1alpha1',\n kind: 'Location',\n metadata: {\n name: locationSpecToMetadataName(location),\n annotations: {\n [ANNOTATION_LOCATION]: ownLocation,\n [ANNOTATION_ORIGIN_LOCATION]: originLocation,\n },\n },\n spec: {\n type: location.type,\n target: location.target,\n presence: location.presence,\n },\n };\n\n return result;\n}\n"],"names":["createHash","ANNOTATION_LOCATION","stringifyEntityRef","stringifyLocationRef","ANNOTATION_ORIGIN_LOCATION"],"mappings":";;;;;AAgCO,SAAS,2BAA2B,QAAA,EAAwB;AACjE,EAAA,MAAM,IAAA,GAAOA,sBAAA,CAAW,MAAM,CAAA,CAC3B,OAAO,CAAA,EAAG,QAAA,CAAS,IAAI,CAAA,CAAA,EAAI,QAAA,CAAS,MAAM,CAAA,CAAE,CAAA,CAC5C,OAAO,KAAK,CAAA;AACf,EAAA,OAAO,aAAa,IAAI,CAAA,CAAA;AAC1B;AAQO,SAAS,6BAA6B,IAAA,EAGlB;AACzB,EAAA,MAAM,WAAW,IAAA,CAAK,QAAA;AACtB,EAAA,MAAM,eAAe,IAAA,CAAK,YAAA;AAE1B,EAAA,IAAI,WAAA;AACJ,EAAA,IAAI,cAAA;AACJ,EAAA,IAAI,YAAA,EAAc;AAChB,IAAA,MAAM,gBAAA,GACJ,YAAA,CAAa,QAAA,CAAS,WAAA,GAAcC,gCAAmB,CAAA;AACzD,IAAA,IAAI,CAAC,gBAAA,EAAkB;AACrB,MAAA,MAAM,IAAI,KAAA;AAAA,QACR,CAAA,eAAA,EAAkBC,+BAAA;AAAA,UAChB;AAAA,SACD,CAAA,eAAA,EAAkBC,iCAAA;AAAA,UACjB;AAAA,SACD,CAAA,qCAAA;AAAA,OACH;AAAA,IACF;AACA,IAAA,WAAA,GAAc,gBAAA;AACd,IAAA,MAAM,mBAAA,GACJ,YAAA,CAAa,QAAA,CAAS,WAAA,GAAcC,uCAA0B,CAAA;AAChE,IAAA,IAAI,CAAC,mBAAA,EAAqB;AACxB,MAAA,MAAM,IAAI,KAAA;AAAA,QACR,CAAA,eAAA,EAAkBF,+BAAA;AAAA,UAChB;AAAA,SACD,CAAA,eAAA,EAAkBC,iCAAA;AAAA,UACjB;AAAA,SACD,CAAA,6CAAA;AAAA,OACH;AAAA,IACF;AACA,IAAA,cAAA,GAAiB,mBAAA;AAAA,EACnB,CAAA,MAAO;AACL,IAAA,WAAA,GAAcA,kCAAqB,QAAQ,CAAA;AAC3C,IAAA,cAAA,GAAiB,WAAA;AAAA,EACnB;AAEA,EAAA,MAAM,MAAA,GAAiC;AAAA,IACrC,UAAA,EAAY,uBAAA;AAAA,IACZ,IAAA,EAAM,UAAA;AAAA,IACN,QAAA,EAAU;AAAA,MACR,IAAA,EAAM,2BAA2B,QAAQ,CAAA;AAAA,MACzC,WAAA,EAAa;AAAA,QACX,CAACF,gCAAmB,GAAG,WAAA;AAAA,QACvB,CAACG,uCAA0B,GAAG;AAAA;AAChC,KACF;AAAA,IACA,IAAA,EAAM;AAAA,MACJ,MAAM,QAAA,CAAS,IAAA;AAAA,MACf,QAAQ,QAAA,CAAS,MAAA;AAAA,MACjB,UAAU,QAAA,CAAS;AAAA;AACrB,GACF;AAEA,EAAA,OAAO,MAAA;AACT;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"extensions.cjs.js","sources":["../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 { 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 CatalogLocationsExtensionPoint {\n /**\n * Allows setting custom location types, such as showcased in: https://backstage.io/docs/features/software-catalog/external-integrations/#creating-a-catalog-data-reader-processor\n * @param locationTypes - List of location types to allow, default is \"url\" and \"file\"\n */\n setAllowedLocationTypes(locationTypes: Array<string>): void;\n}\n\n/**\n * @alpha\n */\nexport const catalogLocationsExtensionPoint =\n createExtensionPoint<CatalogLocationsExtensionPoint>({\n id: 'catalog.locations',\n });\n\n/**\n * @alpha\n */\nexport interface CatalogProcessingExtensionPoint {\n /**\n * Adds entity processors. These are responsible for reading, parsing, and\n * processing entities before they are persisted in the catalog.\n *\n * This function also can replace a Default processor if the provided processor\n * matches the processor name.\n *\n * @param processors - One or more processors\n */\n addProcessor(\n ...processors: Array<CatalogProcessor | Array<CatalogProcessor>>\n ): void;\n\n /**\n * Adds or replaces entity providers. These are responsible for bootstrapping\n * the list of entities out of original data sources. For example, there is\n * one entity source for the config locations, and one for the database\n * stored locations. If you ingest entities out of a third party system, you\n * may want to implement that in terms of an entity provider as well.\n *\n * @param providers - One or more entity providers\n */\n addEntityProvider(\n ...providers: Array<EntityProvider | Array<EntityProvider>>\n ): void;\n\n /**\n * Adds, or overwrites, a handler for placeholders (e.g. $file) in entity\n * definition files.\n *\n * @param key - The key that identifies the placeholder, e.g. \"file\"\n * @param resolver - The resolver that gets values for this placeholder\n */\n addPlaceholderResolver(key: string, resolver: PlaceholderResolver): void;\n\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 * @deprecated Use the `coreServices.permissionsRegistry` instead.\n */\nexport type CatalogPermissionRuleInput<\n TParams extends PermissionRuleParams = PermissionRuleParams,\n> = PermissionRule<Entity, EntitiesSearchFilter, 'catalog-entity', TParams>;\n\n/**\n * @alpha\n * @deprecated Use the `coreServices.permissionsRegistry` instead.\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 * @deprecated Use the `coreServices.permissionsRegistry` instead.\n */\nexport const catalogPermissionExtensionPoint =\n createExtensionPoint<CatalogPermissionExtensionPoint>({\n id: 'catalog.permission',\n });\n"],"names":["createExtensionPoint"],"mappings":";;;;AA+CO,MAAM,iCACXA,qCAAA,CAAqD;AAAA,EACnD,EAAA,EAAI;AACN,CAAC;AAsEI,MAAM,kCACXA,qCAAA,CAAsD;AAAA,EACpD,EAAA,EAAI;AACN,CAAC;AAgCI,MAAM,gCACXA,qCAAA,CAAoD;AAAA,EAClD,EAAA,EAAI;AACN,CAAC;AAGI,MAAM,6BACXA,qCAAA,CAAiD;AAAA,EAC/C,EAAA,EAAI;AACN,CAAC;AA2BI,MAAM,kCACXA,qCAAA,CAAsD;AAAA,EACpD,EAAA,EAAI;AACN,CAAC;;;;;;;;"}
1
+ {"version":3,"file":"extensions.cjs.js","sources":["../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 { 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 * @public\n */\nexport interface CatalogLocationsExtensionPoint {\n /**\n * Allows setting custom location types, such as showcased in: https://backstage.io/docs/features/software-catalog/external-integrations/#creating-a-catalog-data-reader-processor\n * @param locationTypes - List of location types to allow, default is \"url\" and \"file\"\n */\n setAllowedLocationTypes(locationTypes: Array<string>): void;\n}\n\n/**\n * @public\n */\nexport const catalogLocationsExtensionPoint =\n createExtensionPoint<CatalogLocationsExtensionPoint>({\n id: 'catalog.locations',\n });\n\n/**\n * @public\n */\nexport interface CatalogProcessingExtensionPoint {\n /**\n * Adds entity processors. These are responsible for reading, parsing, and\n * processing entities before they are persisted in the catalog.\n *\n * This function also can replace a Default processor if the provided processor\n * matches the processor name.\n *\n * @param processors - One or more processors\n */\n addProcessor(\n ...processors: Array<CatalogProcessor | Array<CatalogProcessor>>\n ): void;\n\n /**\n * Adds or replaces entity providers. These are responsible for bootstrapping\n * the list of entities out of original data sources. For example, there is\n * one entity source for the config locations, and one for the database\n * stored locations. If you ingest entities out of a third party system, you\n * may want to implement that in terms of an entity provider as well.\n *\n * @param providers - One or more entity providers\n */\n addEntityProvider(\n ...providers: Array<EntityProvider | Array<EntityProvider>>\n ): void;\n\n /**\n * Adds, or overwrites, a handler for placeholders (e.g. $file) in entity\n * definition files.\n *\n * @param key - The key that identifies the placeholder, e.g. \"file\"\n * @param resolver - The resolver that gets values for this placeholder\n */\n addPlaceholderResolver(key: string, resolver: PlaceholderResolver): void;\n\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 * @public\n */\nexport const catalogProcessingExtensionPoint =\n createExtensionPoint<CatalogProcessingExtensionPoint>({\n id: 'catalog.processing',\n });\n\n/**\n * @public\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 * @public\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 * @deprecated Use the `coreServices.permissionsRegistry` instead.\n */\nexport type CatalogPermissionRuleInput<\n TParams extends PermissionRuleParams = PermissionRuleParams,\n> = PermissionRule<Entity, EntitiesSearchFilter, 'catalog-entity', TParams>;\n\n/**\n * @alpha\n * @deprecated Use the `coreServices.permissionsRegistry` instead.\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 * @deprecated Use the `coreServices.permissionsRegistry` instead.\n */\nexport const catalogPermissionExtensionPoint =\n createExtensionPoint<CatalogPermissionExtensionPoint>({\n id: 'catalog.permission',\n });\n"],"names":["createExtensionPoint"],"mappings":";;;;AA+CO,MAAM,iCACXA,qCAAA,CAAqD;AAAA,EACnD,EAAA,EAAI;AACN,CAAC;AAsEI,MAAM,kCACXA,qCAAA,CAAsD;AAAA,EACpD,EAAA,EAAI;AACN,CAAC;AAgCI,MAAM,gCACXA,qCAAA,CAAoD;AAAA,EAClD,EAAA,EAAI;AACN,CAAC;AAGI,MAAM,6BACXA,qCAAA,CAAiD;AAAA,EAC/C,EAAA,EAAI;AACN,CAAC;AA2BI,MAAM,kCACXA,qCAAA,CAAsD;AAAA,EACpD,EAAA,EAAI;AACN,CAAC;;;;;;;;"}
package/dist/index.cjs.js CHANGED
@@ -4,6 +4,7 @@ var processingResult = require('./api/processingResult.cjs.js');
4
4
  var conversion = require('./conversion.cjs.js');
5
5
  var parse = require('./processing/parse.cjs.js');
6
6
  var catalogService = require('./catalogService.cjs.js');
7
+ var extensions = require('./extensions.cjs.js');
7
8
 
8
9
 
9
10
 
@@ -12,4 +13,7 @@ exports.locationSpecToLocationEntity = conversion.locationSpecToLocationEntity;
12
13
  exports.locationSpecToMetadataName = conversion.locationSpecToMetadataName;
13
14
  exports.parseEntityYaml = parse.parseEntityYaml;
14
15
  exports.catalogServiceRef = catalogService.catalogServiceRef;
16
+ exports.catalogAnalysisExtensionPoint = extensions.catalogAnalysisExtensionPoint;
17
+ exports.catalogLocationsExtensionPoint = extensions.catalogLocationsExtensionPoint;
18
+ exports.catalogProcessingExtensionPoint = extensions.catalogProcessingExtensionPoint;
15
19
  //# sourceMappingURL=index.cjs.js.map
@@ -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
@@ -4,6 +4,10 @@ import { LocationSpec as LocationSpec$1, AnalyzeLocationRequest, AnalyzeLocation
4
4
  import * as _backstage_backend_plugin_api from '@backstage/backend-plugin-api';
5
5
  import { BackstageCredentials } from '@backstage/backend-plugin-api';
6
6
  import { GetEntitiesRequest, GetEntitiesResponse, GetEntitiesByRefsRequest, GetEntitiesByRefsResponse, QueryEntitiesRequest, QueryEntitiesResponse, GetEntityAncestorsRequest, GetEntityAncestorsResponse, GetEntityFacetsRequest, GetEntityFacetsResponse, GetLocationsResponse, Location, AddLocationRequest, AddLocationResponse, ValidateEntityResponse, StreamEntitiesRequest } from '@backstage/catalog-client';
7
+ export { b as CatalogAnalysisExtensionPoint, C as CatalogLocationsExtensionPoint, a as CatalogProcessingExtensionPoint, e as catalogAnalysisExtensionPoint, c as catalogLocationsExtensionPoint, d as catalogProcessingExtensionPoint } from './types/extensions.d-Cvnx6_V0.js';
8
+ import '@backstage/plugin-catalog-node';
9
+ import '@backstage/plugin-permission-common';
10
+ import '@backstage/plugin-permission-node';
7
11
 
8
12
  /**
9
13
  * Holds the entity location information.
@@ -0,0 +1,127 @@
1
+ import * as _backstage_backend_plugin_api from '@backstage/backend-plugin-api';
2
+ import { Entity, Validators } from '@backstage/catalog-model';
3
+ import { CatalogProcessor, EntityProvider, PlaceholderResolver, LocationAnalyzer, ScmLocationAnalyzer, CatalogProcessorParser, EntitiesSearchFilter } from '@backstage/plugin-catalog-node';
4
+ import { PermissionRuleParams, Permission } from '@backstage/plugin-permission-common';
5
+ import { PermissionRule } from '@backstage/plugin-permission-node';
6
+
7
+ /**
8
+ * @public
9
+ */
10
+ interface CatalogLocationsExtensionPoint {
11
+ /**
12
+ * Allows setting custom location types, such as showcased in: https://backstage.io/docs/features/software-catalog/external-integrations/#creating-a-catalog-data-reader-processor
13
+ * @param locationTypes - List of location types to allow, default is "url" and "file"
14
+ */
15
+ setAllowedLocationTypes(locationTypes: Array<string>): void;
16
+ }
17
+ /**
18
+ * @public
19
+ */
20
+ declare const catalogLocationsExtensionPoint: _backstage_backend_plugin_api.ExtensionPoint<CatalogLocationsExtensionPoint>;
21
+ /**
22
+ * @public
23
+ */
24
+ interface CatalogProcessingExtensionPoint {
25
+ /**
26
+ * Adds entity processors. These are responsible for reading, parsing, and
27
+ * processing entities before they are persisted in the catalog.
28
+ *
29
+ * This function also can replace a Default processor if the provided processor
30
+ * matches the processor name.
31
+ *
32
+ * @param processors - One or more processors
33
+ */
34
+ addProcessor(...processors: Array<CatalogProcessor | Array<CatalogProcessor>>): void;
35
+ /**
36
+ * Adds or replaces entity providers. These are responsible for bootstrapping
37
+ * the list of entities out of original data sources. For example, there is
38
+ * one entity source for the config locations, and one for the database
39
+ * stored locations. If you ingest entities out of a third party system, you
40
+ * may want to implement that in terms of an entity provider as well.
41
+ *
42
+ * @param providers - One or more entity providers
43
+ */
44
+ addEntityProvider(...providers: Array<EntityProvider | Array<EntityProvider>>): void;
45
+ /**
46
+ * Adds, or overwrites, a handler for placeholders (e.g. $file) in entity
47
+ * definition files.
48
+ *
49
+ * @param key - The key that identifies the placeholder, e.g. "file"
50
+ * @param resolver - The resolver that gets values for this placeholder
51
+ */
52
+ addPlaceholderResolver(key: string, resolver: PlaceholderResolver): void;
53
+ setOnProcessingErrorHandler(handler: (event: {
54
+ unprocessedEntity: Entity;
55
+ errors: Error[];
56
+ }) => Promise<void> | void): void;
57
+ }
58
+ /** @alpha */
59
+ interface CatalogModelExtensionPoint {
60
+ /**
61
+ * Sets the validator function to use for one or more special fields of an
62
+ * entity. This is useful if the default rules for formatting of fields are
63
+ * not sufficient.
64
+ *
65
+ * @param validators - The (subset of) validators to set
66
+ */
67
+ setFieldValidators(validators: Partial<Validators>): void;
68
+ /**
69
+ * Sets the entity data parser which is used to read raw data from locations
70
+ * @param parser - Parser which will used to extract entities from raw data
71
+ */
72
+ setEntityDataParser(parser: CatalogProcessorParser): void;
73
+ }
74
+ /**
75
+ * @public
76
+ */
77
+ declare const catalogProcessingExtensionPoint: _backstage_backend_plugin_api.ExtensionPoint<CatalogProcessingExtensionPoint>;
78
+ /**
79
+ * @public
80
+ */
81
+ interface CatalogAnalysisExtensionPoint {
82
+ /**
83
+ * Replaces the entire location analyzer with a new one.
84
+ *
85
+ * @remarks
86
+ *
87
+ * By providing a factory function you can access all the SCM analyzers that
88
+ * have been added through `addScmLocationAnalyzer`. If you provide a
89
+ * `LocationAnalyzer` directly, the SCM analyzers will be ignored.
90
+ */
91
+ setLocationAnalyzer(analyzerOrFactory: LocationAnalyzer | ((options: {
92
+ scmLocationAnalyzers: ScmLocationAnalyzer[];
93
+ }) => Promise<{
94
+ locationAnalyzer: LocationAnalyzer;
95
+ }>)): void;
96
+ /**
97
+ * Adds an analyzer for a specific SCM type to the default location analyzer.
98
+ */
99
+ addScmLocationAnalyzer(analyzer: ScmLocationAnalyzer): void;
100
+ }
101
+ /**
102
+ * @public
103
+ */
104
+ declare const catalogAnalysisExtensionPoint: _backstage_backend_plugin_api.ExtensionPoint<CatalogAnalysisExtensionPoint>;
105
+ /** @alpha */
106
+ declare const catalogModelExtensionPoint: _backstage_backend_plugin_api.ExtensionPoint<CatalogModelExtensionPoint>;
107
+ /**
108
+ * @alpha
109
+ * @deprecated Use the `coreServices.permissionsRegistry` instead.
110
+ */
111
+ type CatalogPermissionRuleInput<TParams extends PermissionRuleParams = PermissionRuleParams> = PermissionRule<Entity, EntitiesSearchFilter, 'catalog-entity', TParams>;
112
+ /**
113
+ * @alpha
114
+ * @deprecated Use the `coreServices.permissionsRegistry` instead.
115
+ */
116
+ interface CatalogPermissionExtensionPoint {
117
+ addPermissions(...permissions: Array<Permission | Array<Permission>>): void;
118
+ addPermissionRules(...rules: Array<CatalogPermissionRuleInput | Array<CatalogPermissionRuleInput>>): void;
119
+ }
120
+ /**
121
+ * @alpha
122
+ * @deprecated Use the `coreServices.permissionsRegistry` instead.
123
+ */
124
+ declare const catalogPermissionExtensionPoint: _backstage_backend_plugin_api.ExtensionPoint<CatalogPermissionExtensionPoint>;
125
+
126
+ export { catalogLocationsExtensionPoint as c, catalogProcessingExtensionPoint as d, catalogAnalysisExtensionPoint as e, catalogModelExtensionPoint as g, catalogPermissionExtensionPoint as j };
127
+ export type { CatalogLocationsExtensionPoint as C, CatalogProcessingExtensionPoint as a, CatalogAnalysisExtensionPoint as b, CatalogModelExtensionPoint as f, CatalogPermissionRuleInput as h, CatalogPermissionExtensionPoint as i };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-catalog-node",
3
- "version": "1.20.1-next.1",
3
+ "version": "1.21.0-next.0",
4
4
  "description": "The plugin-catalog-node module for @backstage/plugin-catalog-backend",
5
5
  "backstage": {
6
6
  "role": "node-library",
@@ -72,20 +72,20 @@
72
72
  "test": "backstage-cli package test"
73
73
  },
74
74
  "dependencies": {
75
- "@backstage/backend-plugin-api": "1.6.0-next.1",
75
+ "@backstage/backend-plugin-api": "1.7.0-next.0",
76
76
  "@backstage/catalog-client": "1.12.1",
77
77
  "@backstage/catalog-model": "1.7.6",
78
78
  "@backstage/errors": "1.2.7",
79
- "@backstage/plugin-catalog-common": "1.1.7",
80
- "@backstage/plugin-permission-common": "0.9.3",
81
- "@backstage/plugin-permission-node": "0.10.7-next.1",
79
+ "@backstage/plugin-catalog-common": "1.1.8-next.0",
80
+ "@backstage/plugin-permission-common": "0.9.5-next.0",
81
+ "@backstage/plugin-permission-node": "0.10.9-next.0",
82
82
  "@backstage/types": "1.2.2",
83
83
  "lodash": "^4.17.21",
84
84
  "yaml": "^2.0.0"
85
85
  },
86
86
  "devDependencies": {
87
- "@backstage/backend-test-utils": "1.10.2-next.1",
88
- "@backstage/cli": "0.35.0-next.2",
87
+ "@backstage/backend-test-utils": "1.10.4-next.0",
88
+ "@backstage/cli": "0.35.3-next.0",
89
89
  "msw": "^1.0.0"
90
90
  }
91
91
  }