@backstage/plugin-catalog-backend 1.4.1-next.1 → 1.5.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,78 @@
1
1
  # @backstage/plugin-catalog-backend
2
2
 
3
+ ## 1.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - b2e6cb6acf: Added a new method `addLocationAnalyzers` to the `CatalogBuilder`. With this you can add location analyzers to your catalog. These analyzers will be used by the /analyze-location endpoint to decide if the provided URL contains any catalog-info.yaml files already or not.
8
+
9
+ Moved the following types from this package to `@backstage/plugin-catalog-backend`.
10
+
11
+ - AnalyzeLocationResponse
12
+ - AnalyzeLocationRequest
13
+ - AnalyzeLocationExistingEntity
14
+ - AnalyzeLocationGenerateEntity
15
+ - AnalyzeLocationEntityField
16
+
17
+ - eb25f7e12d: The exported permission rules and the API of `createCatalogConditionalDecision` have changed to reflect the breaking changes made to the `PermissionRule` type. Note that all involved types are exported from `@backstage/plugin-catalog-backend/alpha`
18
+
19
+ ### Patch Changes
20
+
21
+ - 8cb6e10105: Fixed a bug where entities provided without a location key would always replace existing entities, rather than updating them.
22
+ - 2d3a5f09ab: Use `response.json` rather than `response.send` where appropriate, as outlined in `SECURITY.md`
23
+ - 63296ebcd4: Allow Placeholder value to be any value, not only string.
24
+ - 74022e0163: Make sure to stitch entities correctly after deletion, to ensure that their relations are updated.
25
+ - Updated dependencies
26
+ - @backstage/plugin-catalog-node@1.2.0
27
+ - @backstage/catalog-model@1.1.2
28
+ - @backstage/backend-common@0.15.2
29
+ - @backstage/plugin-catalog-common@1.0.7
30
+ - @backstage/plugin-permission-node@0.7.0
31
+ - @backstage/backend-plugin-api@0.1.3
32
+ - @backstage/plugin-permission-common@0.7.0
33
+ - @backstage/catalog-client@1.1.1
34
+ - @backstage/plugin-search-common@1.1.0
35
+ - @backstage/plugin-scaffolder-common@1.2.1
36
+ - @backstage/config@1.0.3
37
+ - @backstage/errors@1.1.2
38
+ - @backstage/integration@1.3.2
39
+ - @backstage/types@1.0.0
40
+
41
+ ## 1.5.0-next.2
42
+
43
+ ### Minor Changes
44
+
45
+ - b2e6cb6acf: Added a new method `addLocationAnalyzers` to the `CatalogBuilder`. With this you can add location analyzers to your catalog. These analyzers will be used by the /analyze-location endpoint to decide if the provided URL contains any catalog-info.yaml files already or not.
46
+
47
+ Moved the following types from this package to `@backstage/plugin-catalog-backend`.
48
+
49
+ - AnalyzeLocationResponse
50
+ - AnalyzeLocationRequest
51
+ - AnalyzeLocationExistingEntity
52
+ - AnalyzeLocationGenerateEntity
53
+ - AnalyzeLocationEntityField
54
+
55
+ - eb25f7e12d: The exported permission rules and the API of `createCatalogConditionalDecision` have changed to reflect the breaking changes made to the `PermissionRule` type. Note that all involved types are exported from `@backstage/plugin-catalog-backend/alpha`
56
+
57
+ ### Patch Changes
58
+
59
+ - 2d3a5f09ab: Use `response.json` rather than `response.send` where appropriate, as outlined in `SECURITY.md`
60
+ - Updated dependencies
61
+ - @backstage/plugin-catalog-node@1.2.0-next.2
62
+ - @backstage/plugin-catalog-common@1.0.7-next.2
63
+ - @backstage/backend-common@0.15.2-next.2
64
+ - @backstage/plugin-permission-common@0.7.0-next.2
65
+ - @backstage/plugin-permission-node@0.7.0-next.2
66
+ - @backstage/backend-plugin-api@0.1.3-next.2
67
+ - @backstage/plugin-search-common@1.1.0-next.2
68
+ - @backstage/catalog-client@1.1.1-next.2
69
+ - @backstage/catalog-model@1.1.2-next.2
70
+ - @backstage/config@1.0.3-next.2
71
+ - @backstage/errors@1.1.2-next.2
72
+ - @backstage/integration@1.3.2-next.2
73
+ - @backstage/types@1.0.0
74
+ - @backstage/plugin-scaffolder-common@1.2.1-next.2
75
+
3
76
  ## 1.4.1-next.1
4
77
 
5
78
  ### Patch Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-catalog-backend",
3
- "version": "1.4.1-next.1",
3
+ "version": "1.5.0",
4
4
  "main": "../dist/index.cjs.js",
5
5
  "types": "../dist/index.alpha.d.ts"
6
6
  }
@@ -6,6 +6,11 @@
6
6
 
7
7
  /// <reference types="node" />
8
8
 
9
+ import { AnalyzeLocationEntityField as AnalyzeLocationEntityField_2 } from '@backstage/plugin-catalog-common';
10
+ import { AnalyzeLocationExistingEntity as AnalyzeLocationExistingEntity_2 } from '@backstage/plugin-catalog-common';
11
+ import { AnalyzeLocationGenerateEntity as AnalyzeLocationGenerateEntity_2 } from '@backstage/plugin-catalog-common';
12
+ import { AnalyzeLocationRequest as AnalyzeLocationRequest_2 } from '@backstage/plugin-catalog-common';
13
+ import { AnalyzeLocationResponse as AnalyzeLocationResponse_2 } from '@backstage/plugin-catalog-common';
9
14
  import { BackendFeature } from '@backstage/backend-plugin-api';
10
15
  import { CatalogApi } from '@backstage/catalog-client';
11
16
  import { CatalogEntityDocument } from '@backstage/plugin-catalog-common';
@@ -41,6 +46,7 @@ import { PermissionCondition } from '@backstage/plugin-permission-common';
41
46
  import { PermissionCriteria } from '@backstage/plugin-permission-common';
42
47
  import { PermissionEvaluator } from '@backstage/plugin-permission-common';
43
48
  import { PermissionRule } from '@backstage/plugin-permission-node';
49
+ import { PermissionRuleParams } from '@backstage/plugin-permission-common';
44
50
  import { PluginDatabaseManager } from '@backstage/backend-common';
45
51
  import { PluginEndpointDiscovery } from '@backstage/backend-common';
46
52
  import { processingResult } from '@backstage/plugin-catalog-node';
@@ -52,24 +58,15 @@ import { TokenManager } from '@backstage/backend-common';
52
58
  import { UrlReader } from '@backstage/backend-common';
53
59
  import { Validators } from '@backstage/catalog-model';
54
60
 
55
- /** @public */
56
- export declare type AnalyzeLocationEntityField = {
57
- /**
58
- * e.g. "spec.owner"? The frontend needs to know how to "inject" the field into the
59
- * entity again if the user wants to change it
60
- */
61
- field: string;
62
- /** The outcome of the analysis for this particular field */
63
- state: 'analysisSuggestedValue' | 'analysisSuggestedNoValue' | 'needsUserInput';
64
- value: string | null;
65
- /**
66
- * A text to show to the user to inform about the choices made. Like, it could say
67
- * "Found a CODEOWNERS file that covers this target, so we suggest leaving this
68
- * field empty; which would currently make it owned by X" where X is taken from the
69
- * codeowners file.
70
- */
71
- description: string;
72
- };
61
+ /**
62
+ *
63
+ * This is where I get really vague. Something like this perhaps? Or it could be
64
+ * something like a json-schema that contains enough info for the frontend to
65
+ * be able to present a form and explanations
66
+ * @public
67
+ * @deprecated use the same type from `@backstage/plugin-catalog-common` instead
68
+ */
69
+ export declare type AnalyzeLocationEntityField = AnalyzeLocationEntityField_2;
73
70
 
74
71
  /**
75
72
  * If the folder pointed to already contained catalog info yaml files, they are
@@ -77,12 +74,9 @@ export declare type AnalyzeLocationEntityField = {
77
74
  * located them and can make sure to register them as well if they weren't
78
75
  * already
79
76
  * @public
77
+ * @deprecated use the same type from `@backstage/plugin-catalog-common` instead
80
78
  */
81
- export declare type AnalyzeLocationExistingEntity = {
82
- location: LocationSpec;
83
- isRegistered: boolean;
84
- entity: Entity;
85
- };
79
+ export declare type AnalyzeLocationExistingEntity = AnalyzeLocationExistingEntity_2;
86
80
 
87
81
  /**
88
82
  * This is some form of representation of what the analyzer could deduce.
@@ -91,21 +85,26 @@ export declare type AnalyzeLocationExistingEntity = {
91
85
  * enough info for the frontend to know what form data to show to the user
92
86
  * for overriding/completing the info.
93
87
  * @public
88
+ * @deprecated use the same type from `@backstage/plugin-catalog-common` instead
94
89
  */
95
- export declare type AnalyzeLocationGenerateEntity = {
96
- entity: RecursivePartial<Entity>;
97
- fields: AnalyzeLocationEntityField[];
98
- };
90
+ export declare type AnalyzeLocationGenerateEntity = AnalyzeLocationGenerateEntity_2;
99
91
 
100
- /** @public */
101
- export declare type AnalyzeLocationRequest = {
102
- location: LocationSpec;
103
- };
92
+ /**
93
+ * @public
94
+ * @deprecated use the same type from `@backstage/plugin-catalog-common` instead
95
+ */
96
+ export declare type AnalyzeLocationRequest = AnalyzeLocationRequest_2;
97
+
98
+ /**
99
+ * @public
100
+ * @deprecated use the same type from `@backstage/plugin-catalog-common` instead
101
+ */
102
+ export declare type AnalyzeLocationResponse = AnalyzeLocationResponse_2;
104
103
 
105
104
  /** @public */
106
- export declare type AnalyzeLocationResponse = {
107
- existingEntityFiles: AnalyzeLocationExistingEntity[];
108
- generateEntities: AnalyzeLocationGenerateEntity[];
105
+ export declare type AnalyzeOptions = {
106
+ url: string;
107
+ catalogFilename?: string;
109
108
  };
110
109
 
111
110
  /** @public */
@@ -146,6 +145,10 @@ export declare class BuiltinKindsEntityProcessor implements CatalogProcessor {
146
145
  * after the processors' pre-processing steps. All policies are given the
147
146
  * chance to inspect the entity, and all of them have to pass in order for
148
147
  * the entity to be considered valid from an overall point of view.
148
+ * - Location analyzers can be added. These are responsible for analyzing
149
+ * repositories when onboarding them into the catalog, by finding
150
+ * catalog-info.yaml files and other artifacts that can help automatically
151
+ * register or create catalog data on the user's behalf.
149
152
  * - Placeholder resolvers can be replaced or added. These run on the raw
150
153
  * structured data between the parsing and pre-processing steps, to replace
151
154
  * dollar-prefixed entries with their actual values (like $file).
@@ -166,6 +169,7 @@ export declare class CatalogBuilder {
166
169
  private fieldFormatValidators;
167
170
  private entityProviders;
168
171
  private processors;
172
+ private locationAnalyzers;
169
173
  private processorsReplace;
170
174
  private parser;
171
175
  private onProcessingError?;
@@ -275,6 +279,15 @@ export declare class CatalogBuilder {
275
279
  *
276
280
  */
277
281
  getDefaultProcessors(): CatalogProcessor[];
282
+ /**
283
+ * Adds Location Analyzers. These are responsible for analyzing
284
+ * repositories when onboarding them into the catalog, by finding
285
+ * catalog-info.yaml files and other artifacts that can help automatically
286
+ * register or create catalog data on the user's behalf.
287
+ *
288
+ * @param locationAnalyzers - One or more location analyzers
289
+ */
290
+ addLocationAnalyzers(...analyzers: Array<ScmLocationAnalyzer | Array<ScmLocationAnalyzer>>): CatalogBuilder;
278
291
  /**
279
292
  * Sets up the catalog to use a custom parser for entity data.
280
293
  *
@@ -326,12 +339,27 @@ export declare class CatalogBuilder {
326
339
  * @alpha
327
340
  */
328
341
  export declare const catalogConditions: Conditions< {
329
- hasAnnotation: PermissionRule<Entity, EntitiesSearchFilter, "catalog-entity", [annotation: string, value?: string | undefined]>;
330
- hasLabel: PermissionRule<Entity, EntitiesSearchFilter, "catalog-entity", [label: string]>;
331
- hasMetadata: PermissionRule<Entity, EntitiesSearchFilter, "catalog-entity", [key: string, value?: string | undefined]>;
332
- hasSpec: PermissionRule<Entity, EntitiesSearchFilter, "catalog-entity", [key: string, value?: string | undefined]>;
333
- isEntityKind: PermissionRule<Entity, EntitiesSearchFilter, "catalog-entity", [kinds: string[]]>;
334
- isEntityOwner: PermissionRule<Entity, EntitiesSearchFilter, "catalog-entity", [claims: string[]]>;
342
+ hasAnnotation: PermissionRule<Entity, EntitiesSearchFilter, "catalog-entity", {
343
+ value?: string | undefined;
344
+ annotation: string;
345
+ }>;
346
+ hasLabel: PermissionRule<Entity, EntitiesSearchFilter, "catalog-entity", {
347
+ label: string;
348
+ }>;
349
+ hasMetadata: PermissionRule<Entity, EntitiesSearchFilter, "catalog-entity", {
350
+ value?: string | undefined;
351
+ key: string;
352
+ }>;
353
+ hasSpec: PermissionRule<Entity, EntitiesSearchFilter, "catalog-entity", {
354
+ value?: string | undefined;
355
+ key: string;
356
+ }>;
357
+ isEntityKind: PermissionRule<Entity, EntitiesSearchFilter, "catalog-entity", {
358
+ kinds: string[];
359
+ }>;
360
+ isEntityOwner: PermissionRule<Entity, EntitiesSearchFilter, "catalog-entity", {
361
+ claims: string[];
362
+ }>;
335
363
  }>;
336
364
 
337
365
  /** @public */
@@ -350,7 +378,7 @@ export declare type CatalogEnvironment = {
350
378
  *
351
379
  * @alpha
352
380
  */
353
- export declare type CatalogPermissionRule<TParams extends unknown[] = unknown[]> = PermissionRule<Entity, EntitiesSearchFilter, 'catalog-entity', TParams>;
381
+ export declare type CatalogPermissionRule<TParams extends PermissionRuleParams = PermissionRuleParams> = PermissionRule<Entity, EntitiesSearchFilter, 'catalog-entity', TParams>;
354
382
 
355
383
  /**
356
384
  * Catalog plugin
@@ -433,7 +461,7 @@ export declare class CodeOwnersProcessor implements CatalogProcessor {
433
461
  *
434
462
  * @alpha
435
463
  */
436
- export declare const createCatalogConditionalDecision: (permission: ResourcePermission<"catalog-entity">, conditions: PermissionCriteria<PermissionCondition<"catalog-entity", unknown[]>>) => ConditionalPolicyDecision;
464
+ export declare const createCatalogConditionalDecision: (permission: ResourcePermission<"catalog-entity">, conditions: PermissionCriteria<PermissionCondition<"catalog-entity", PermissionRuleParams>>) => ConditionalPolicyDecision;
437
465
 
438
466
  /**
439
467
  * Helper function for creating correctly-typed
@@ -442,7 +470,7 @@ export declare const createCatalogConditionalDecision: (permission: ResourcePerm
442
470
  *
443
471
  * @alpha
444
472
  */
445
- export declare const createCatalogPermissionRule: <TParams extends unknown[]>(rule: PermissionRule<Entity, EntitiesSearchFilter, "catalog-entity", TParams>) => PermissionRule<Entity, EntitiesSearchFilter, "catalog-entity", TParams>;
473
+ export declare const createCatalogPermissionRule: <TParams extends PermissionRuleParams = undefined>(rule: PermissionRule<Entity, EntitiesSearchFilter, "catalog-entity", TParams>) => PermissionRule<Entity, EntitiesSearchFilter, "catalog-entity", TParams>;
446
474
 
447
475
  /**
448
476
  * Creates a function that returns a random processing interval between minSeconds and maxSeconds.
@@ -603,12 +631,27 @@ export declare function parseEntityYaml(data: Buffer, location: LocationSpec): I
603
631
  * @alpha
604
632
  */
605
633
  export declare const permissionRules: {
606
- hasAnnotation: PermissionRule<Entity, EntitiesSearchFilter, "catalog-entity", [annotation: string, value?: string | undefined]>;
607
- hasLabel: PermissionRule<Entity, EntitiesSearchFilter, "catalog-entity", [label: string]>;
608
- hasMetadata: PermissionRule<Entity, EntitiesSearchFilter, "catalog-entity", [key: string, value?: string | undefined]>;
609
- hasSpec: PermissionRule<Entity, EntitiesSearchFilter, "catalog-entity", [key: string, value?: string | undefined]>;
610
- isEntityKind: PermissionRule<Entity, EntitiesSearchFilter, "catalog-entity", [kinds: string[]]>;
611
- isEntityOwner: PermissionRule<Entity, EntitiesSearchFilter, "catalog-entity", [claims: string[]]>;
634
+ hasAnnotation: PermissionRule<Entity, EntitiesSearchFilter, "catalog-entity", {
635
+ value?: string | undefined;
636
+ annotation: string;
637
+ }>;
638
+ hasLabel: PermissionRule<Entity, EntitiesSearchFilter, "catalog-entity", {
639
+ label: string;
640
+ }>;
641
+ hasMetadata: PermissionRule<Entity, EntitiesSearchFilter, "catalog-entity", {
642
+ value?: string | undefined;
643
+ key: string;
644
+ }>;
645
+ hasSpec: PermissionRule<Entity, EntitiesSearchFilter, "catalog-entity", {
646
+ value?: string | undefined;
647
+ key: string;
648
+ }>;
649
+ isEntityKind: PermissionRule<Entity, EntitiesSearchFilter, "catalog-entity", {
650
+ kinds: string[];
651
+ }>;
652
+ isEntityOwner: PermissionRule<Entity, EntitiesSearchFilter, "catalog-entity", {
653
+ claims: string[];
654
+ }>;
612
655
  };
613
656
 
614
657
  /**
@@ -657,12 +700,15 @@ export declare type ProcessingIntervalFunction = () => number;
657
700
 
658
701
  export { processingResult }
659
702
 
660
- /**
661
- * Makes all keys of an entire hierarchy optional.
662
- * @ignore
663
- */
664
- declare type RecursivePartial<T> = {
665
- [P in keyof T]?: T[P] extends (infer U)[] ? RecursivePartial<U>[] : T[P] extends object ? RecursivePartial<T[P]> : T[P];
703
+ /** @public */
704
+ export declare type ScmLocationAnalyzer = {
705
+ /** The method that decides if this analyzer can work with the provided url */
706
+ supports(url: string): boolean;
707
+ /** This function can return an array of already existing entities */
708
+ analyze(options: AnalyzeOptions): Promise<{
709
+ /** Existing entities in the analyzed location */
710
+ existing: AnalyzeLocationExistingEntity[];
711
+ }>;
666
712
  };
667
713
 
668
714
  /** @public */
@@ -6,6 +6,11 @@
6
6
 
7
7
  /// <reference types="node" />
8
8
 
9
+ import { AnalyzeLocationEntityField as AnalyzeLocationEntityField_2 } from '@backstage/plugin-catalog-common';
10
+ import { AnalyzeLocationExistingEntity as AnalyzeLocationExistingEntity_2 } from '@backstage/plugin-catalog-common';
11
+ import { AnalyzeLocationGenerateEntity as AnalyzeLocationGenerateEntity_2 } from '@backstage/plugin-catalog-common';
12
+ import { AnalyzeLocationRequest as AnalyzeLocationRequest_2 } from '@backstage/plugin-catalog-common';
13
+ import { AnalyzeLocationResponse as AnalyzeLocationResponse_2 } from '@backstage/plugin-catalog-common';
9
14
  import { BackendFeature } from '@backstage/backend-plugin-api';
10
15
  import { CatalogApi } from '@backstage/catalog-client';
11
16
  import { CatalogEntityDocument } from '@backstage/plugin-catalog-common';
@@ -41,6 +46,7 @@ import { PermissionCondition } from '@backstage/plugin-permission-common';
41
46
  import { PermissionCriteria } from '@backstage/plugin-permission-common';
42
47
  import { PermissionEvaluator } from '@backstage/plugin-permission-common';
43
48
  import { PermissionRule } from '@backstage/plugin-permission-node';
49
+ import { PermissionRuleParams } from '@backstage/plugin-permission-common';
44
50
  import { PluginDatabaseManager } from '@backstage/backend-common';
45
51
  import { PluginEndpointDiscovery } from '@backstage/backend-common';
46
52
  import { processingResult } from '@backstage/plugin-catalog-node';
@@ -52,24 +58,15 @@ import { TokenManager } from '@backstage/backend-common';
52
58
  import { UrlReader } from '@backstage/backend-common';
53
59
  import { Validators } from '@backstage/catalog-model';
54
60
 
55
- /** @public */
56
- export declare type AnalyzeLocationEntityField = {
57
- /**
58
- * e.g. "spec.owner"? The frontend needs to know how to "inject" the field into the
59
- * entity again if the user wants to change it
60
- */
61
- field: string;
62
- /** The outcome of the analysis for this particular field */
63
- state: 'analysisSuggestedValue' | 'analysisSuggestedNoValue' | 'needsUserInput';
64
- value: string | null;
65
- /**
66
- * A text to show to the user to inform about the choices made. Like, it could say
67
- * "Found a CODEOWNERS file that covers this target, so we suggest leaving this
68
- * field empty; which would currently make it owned by X" where X is taken from the
69
- * codeowners file.
70
- */
71
- description: string;
72
- };
61
+ /**
62
+ *
63
+ * This is where I get really vague. Something like this perhaps? Or it could be
64
+ * something like a json-schema that contains enough info for the frontend to
65
+ * be able to present a form and explanations
66
+ * @public
67
+ * @deprecated use the same type from `@backstage/plugin-catalog-common` instead
68
+ */
69
+ export declare type AnalyzeLocationEntityField = AnalyzeLocationEntityField_2;
73
70
 
74
71
  /**
75
72
  * If the folder pointed to already contained catalog info yaml files, they are
@@ -77,12 +74,9 @@ export declare type AnalyzeLocationEntityField = {
77
74
  * located them and can make sure to register them as well if they weren't
78
75
  * already
79
76
  * @public
77
+ * @deprecated use the same type from `@backstage/plugin-catalog-common` instead
80
78
  */
81
- export declare type AnalyzeLocationExistingEntity = {
82
- location: LocationSpec;
83
- isRegistered: boolean;
84
- entity: Entity;
85
- };
79
+ export declare type AnalyzeLocationExistingEntity = AnalyzeLocationExistingEntity_2;
86
80
 
87
81
  /**
88
82
  * This is some form of representation of what the analyzer could deduce.
@@ -91,21 +85,26 @@ export declare type AnalyzeLocationExistingEntity = {
91
85
  * enough info for the frontend to know what form data to show to the user
92
86
  * for overriding/completing the info.
93
87
  * @public
88
+ * @deprecated use the same type from `@backstage/plugin-catalog-common` instead
94
89
  */
95
- export declare type AnalyzeLocationGenerateEntity = {
96
- entity: RecursivePartial<Entity>;
97
- fields: AnalyzeLocationEntityField[];
98
- };
90
+ export declare type AnalyzeLocationGenerateEntity = AnalyzeLocationGenerateEntity_2;
99
91
 
100
- /** @public */
101
- export declare type AnalyzeLocationRequest = {
102
- location: LocationSpec;
103
- };
92
+ /**
93
+ * @public
94
+ * @deprecated use the same type from `@backstage/plugin-catalog-common` instead
95
+ */
96
+ export declare type AnalyzeLocationRequest = AnalyzeLocationRequest_2;
97
+
98
+ /**
99
+ * @public
100
+ * @deprecated use the same type from `@backstage/plugin-catalog-common` instead
101
+ */
102
+ export declare type AnalyzeLocationResponse = AnalyzeLocationResponse_2;
104
103
 
105
104
  /** @public */
106
- export declare type AnalyzeLocationResponse = {
107
- existingEntityFiles: AnalyzeLocationExistingEntity[];
108
- generateEntities: AnalyzeLocationGenerateEntity[];
105
+ export declare type AnalyzeOptions = {
106
+ url: string;
107
+ catalogFilename?: string;
109
108
  };
110
109
 
111
110
  /** @public */
@@ -146,6 +145,10 @@ export declare class BuiltinKindsEntityProcessor implements CatalogProcessor {
146
145
  * after the processors' pre-processing steps. All policies are given the
147
146
  * chance to inspect the entity, and all of them have to pass in order for
148
147
  * the entity to be considered valid from an overall point of view.
148
+ * - Location analyzers can be added. These are responsible for analyzing
149
+ * repositories when onboarding them into the catalog, by finding
150
+ * catalog-info.yaml files and other artifacts that can help automatically
151
+ * register or create catalog data on the user's behalf.
149
152
  * - Placeholder resolvers can be replaced or added. These run on the raw
150
153
  * structured data between the parsing and pre-processing steps, to replace
151
154
  * dollar-prefixed entries with their actual values (like $file).
@@ -166,6 +169,7 @@ export declare class CatalogBuilder {
166
169
  private fieldFormatValidators;
167
170
  private entityProviders;
168
171
  private processors;
172
+ private locationAnalyzers;
169
173
  private processorsReplace;
170
174
  private parser;
171
175
  private onProcessingError?;
@@ -275,6 +279,15 @@ export declare class CatalogBuilder {
275
279
  *
276
280
  */
277
281
  getDefaultProcessors(): CatalogProcessor[];
282
+ /**
283
+ * Adds Location Analyzers. These are responsible for analyzing
284
+ * repositories when onboarding them into the catalog, by finding
285
+ * catalog-info.yaml files and other artifacts that can help automatically
286
+ * register or create catalog data on the user's behalf.
287
+ *
288
+ * @param locationAnalyzers - One or more location analyzers
289
+ */
290
+ addLocationAnalyzers(...analyzers: Array<ScmLocationAnalyzer | Array<ScmLocationAnalyzer>>): CatalogBuilder;
278
291
  /**
279
292
  * Sets up the catalog to use a custom parser for entity data.
280
293
  *
@@ -574,12 +587,15 @@ export declare type ProcessingIntervalFunction = () => number;
574
587
 
575
588
  export { processingResult }
576
589
 
577
- /**
578
- * Makes all keys of an entire hierarchy optional.
579
- * @ignore
580
- */
581
- declare type RecursivePartial<T> = {
582
- [P in keyof T]?: T[P] extends (infer U)[] ? RecursivePartial<U>[] : T[P] extends object ? RecursivePartial<T[P]> : T[P];
590
+ /** @public */
591
+ export declare type ScmLocationAnalyzer = {
592
+ /** The method that decides if this analyzer can work with the provided url */
593
+ supports(url: string): boolean;
594
+ /** This function can return an array of already existing entities */
595
+ analyze(options: AnalyzeOptions): Promise<{
596
+ /** Existing entities in the analyzed location */
597
+ existing: AnalyzeLocationExistingEntity[];
598
+ }>;
583
599
  };
584
600
 
585
601
  /** @public */