@backstage/plugin-catalog-common 1.0.7-next.0 → 1.0.7-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 CHANGED
@@ -1,5 +1,30 @@
1
1
  # @backstage/plugin-catalog-common
2
2
 
3
+ ## 1.0.7-next.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 823acaa88b: Moved the following types from `@backstage/plugin-catalog-backend` to this package.
8
+
9
+ - AnalyzeLocationResponse
10
+ - AnalyzeLocationRequest
11
+ - AnalyzeLocationExistingEntity
12
+ - AnalyzeLocationGenerateEntity
13
+ - AnalyzeLocationEntityField
14
+
15
+ - Updated dependencies
16
+ - @backstage/plugin-permission-common@0.7.0-next.2
17
+ - @backstage/plugin-search-common@1.1.0-next.2
18
+ - @backstage/catalog-model@1.1.2-next.2
19
+
20
+ ## 1.0.7-next.1
21
+
22
+ ### Patch Changes
23
+
24
+ - Updated dependencies
25
+ - @backstage/plugin-search-common@1.1.0-next.1
26
+ - @backstage/plugin-permission-common@0.6.5-next.1
27
+
3
28
  ## 1.0.7-next.0
4
29
 
5
30
  ### Patch Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-catalog-common",
3
- "version": "1.0.7-next.0",
3
+ "version": "1.0.7-next.2",
4
4
  "main": "../dist/index.cjs.js",
5
5
  "module": "../dist/index.esm.js",
6
6
  "types": "../dist/index.alpha.d.ts"
@@ -6,9 +6,67 @@
6
6
  */
7
7
 
8
8
  import { BasicPermission } from '@backstage/plugin-permission-common';
9
+ import { Entity } from '@backstage/catalog-model';
9
10
  import { IndexableDocument } from '@backstage/plugin-search-common';
10
11
  import { ResourcePermission } from '@backstage/plugin-permission-common';
11
12
 
13
+ /** @public */
14
+ export declare type AnalyzeLocationEntityField = {
15
+ /**
16
+ * e.g. "spec.owner"? The frontend needs to know how to "inject" the field into the
17
+ * entity again if the user wants to change it
18
+ */
19
+ field: string;
20
+ /** The outcome of the analysis for this particular field */
21
+ state: 'analysisSuggestedValue' | 'analysisSuggestedNoValue' | 'needsUserInput';
22
+ value: string | null;
23
+ /**
24
+ * A text to show to the user to inform about the choices made. Like, it could say
25
+ * "Found a CODEOWNERS file that covers this target, so we suggest leaving this
26
+ * field empty; which would currently make it owned by X" where X is taken from the
27
+ * codeowners file.
28
+ */
29
+ description: string;
30
+ };
31
+
32
+ /**
33
+ * If the folder pointed to already contained catalog info yaml files, they are
34
+ * read and emitted like this so that the frontend can inform the user that it
35
+ * located them and can make sure to register them as well if they weren't
36
+ * already
37
+ * @public
38
+ */
39
+ export declare type AnalyzeLocationExistingEntity = {
40
+ location: LocationSpec;
41
+ isRegistered: boolean;
42
+ entity: Entity;
43
+ };
44
+
45
+ /**
46
+ * This is some form of representation of what the analyzer could deduce.
47
+ * We should probably have a chat about how this can best be conveyed to
48
+ * the frontend. It'll probably contain a (possibly incomplete) entity, plus
49
+ * enough info for the frontend to know what form data to show to the user
50
+ * for overriding/completing the info.
51
+ * @public
52
+ */
53
+ export declare type AnalyzeLocationGenerateEntity = {
54
+ entity: RecursivePartial<Entity>;
55
+ fields: AnalyzeLocationEntityField[];
56
+ };
57
+
58
+ /** @public */
59
+ export declare type AnalyzeLocationRequest = {
60
+ location: LocationSpec;
61
+ catalogFilename?: string;
62
+ };
63
+
64
+ /** @public */
65
+ export declare type AnalyzeLocationResponse = {
66
+ existingEntityFiles: AnalyzeLocationExistingEntity[];
67
+ generateEntities: AnalyzeLocationGenerateEntity[];
68
+ };
69
+
12
70
  /**
13
71
  * This permission is used to authorize actions that involve creating a new
14
72
  * catalog entity. This includes registering an existing component into the
@@ -93,6 +151,31 @@ export declare const catalogLocationReadPermission: BasicPermission;
93
151
  */
94
152
  export declare const catalogPermissions: (BasicPermission | ResourcePermission<"catalog-entity">)[];
95
153
 
154
+ /**
155
+ * Holds the entity location information.
156
+ *
157
+ * @remarks
158
+ *
159
+ * `presence` flag: when using repo importer plugin, location is being created before the component yaml file is merged to the main branch.
160
+ * This flag is then set to indicate that the file can be not present.
161
+ * default value: 'required'.
162
+ *
163
+ * @public
164
+ */
165
+ export declare type LocationSpec = {
166
+ type: string;
167
+ target: string;
168
+ presence?: 'optional' | 'required';
169
+ };
170
+
171
+ /**
172
+ * Makes all keys of an entire hierarchy optional.
173
+ * @ignore
174
+ */
175
+ declare type RecursivePartial<T> = {
176
+ [P in keyof T]?: T[P] extends (infer U)[] ? RecursivePartial<U>[] : T[P] extends object ? RecursivePartial<T[P]> : T[P];
177
+ };
178
+
96
179
  /**
97
180
  * Permission resource type which corresponds to catalog entities.
98
181
  *
@@ -6,9 +6,67 @@
6
6
  */
7
7
 
8
8
  import { BasicPermission } from '@backstage/plugin-permission-common';
9
+ import { Entity } from '@backstage/catalog-model';
9
10
  import { IndexableDocument } from '@backstage/plugin-search-common';
10
11
  import { ResourcePermission } from '@backstage/plugin-permission-common';
11
12
 
13
+ /** @public */
14
+ export declare type AnalyzeLocationEntityField = {
15
+ /**
16
+ * e.g. "spec.owner"? The frontend needs to know how to "inject" the field into the
17
+ * entity again if the user wants to change it
18
+ */
19
+ field: string;
20
+ /** The outcome of the analysis for this particular field */
21
+ state: 'analysisSuggestedValue' | 'analysisSuggestedNoValue' | 'needsUserInput';
22
+ value: string | null;
23
+ /**
24
+ * A text to show to the user to inform about the choices made. Like, it could say
25
+ * "Found a CODEOWNERS file that covers this target, so we suggest leaving this
26
+ * field empty; which would currently make it owned by X" where X is taken from the
27
+ * codeowners file.
28
+ */
29
+ description: string;
30
+ };
31
+
32
+ /**
33
+ * If the folder pointed to already contained catalog info yaml files, they are
34
+ * read and emitted like this so that the frontend can inform the user that it
35
+ * located them and can make sure to register them as well if they weren't
36
+ * already
37
+ * @public
38
+ */
39
+ export declare type AnalyzeLocationExistingEntity = {
40
+ location: LocationSpec;
41
+ isRegistered: boolean;
42
+ entity: Entity;
43
+ };
44
+
45
+ /**
46
+ * This is some form of representation of what the analyzer could deduce.
47
+ * We should probably have a chat about how this can best be conveyed to
48
+ * the frontend. It'll probably contain a (possibly incomplete) entity, plus
49
+ * enough info for the frontend to know what form data to show to the user
50
+ * for overriding/completing the info.
51
+ * @public
52
+ */
53
+ export declare type AnalyzeLocationGenerateEntity = {
54
+ entity: RecursivePartial<Entity>;
55
+ fields: AnalyzeLocationEntityField[];
56
+ };
57
+
58
+ /** @public */
59
+ export declare type AnalyzeLocationRequest = {
60
+ location: LocationSpec;
61
+ catalogFilename?: string;
62
+ };
63
+
64
+ /** @public */
65
+ export declare type AnalyzeLocationResponse = {
66
+ existingEntityFiles: AnalyzeLocationExistingEntity[];
67
+ generateEntities: AnalyzeLocationGenerateEntity[];
68
+ };
69
+
12
70
  /* Excluded from this release type: catalogEntityCreatePermission */
13
71
 
14
72
  /* Excluded from this release type: catalogEntityDeletePermission */
@@ -42,6 +100,31 @@ export declare interface CatalogEntityDocument extends IndexableDocument {
42
100
 
43
101
  /* Excluded from this release type: catalogPermissions */
44
102
 
103
+ /**
104
+ * Holds the entity location information.
105
+ *
106
+ * @remarks
107
+ *
108
+ * `presence` flag: when using repo importer plugin, location is being created before the component yaml file is merged to the main branch.
109
+ * This flag is then set to indicate that the file can be not present.
110
+ * default value: 'required'.
111
+ *
112
+ * @public
113
+ */
114
+ export declare type LocationSpec = {
115
+ type: string;
116
+ target: string;
117
+ presence?: 'optional' | 'required';
118
+ };
119
+
120
+ /**
121
+ * Makes all keys of an entire hierarchy optional.
122
+ * @ignore
123
+ */
124
+ declare type RecursivePartial<T> = {
125
+ [P in keyof T]?: T[P] extends (infer U)[] ? RecursivePartial<U>[] : T[P] extends object ? RecursivePartial<T[P]> : T[P];
126
+ };
127
+
45
128
  /* Excluded from this release type: RESOURCE_TYPE_CATALOG_ENTITY */
46
129
 
47
130
  export { }
package/dist/index.d.ts CHANGED
@@ -6,9 +6,67 @@
6
6
  */
7
7
 
8
8
  import { BasicPermission } from '@backstage/plugin-permission-common';
9
+ import { Entity } from '@backstage/catalog-model';
9
10
  import { IndexableDocument } from '@backstage/plugin-search-common';
10
11
  import { ResourcePermission } from '@backstage/plugin-permission-common';
11
12
 
13
+ /** @public */
14
+ export declare type AnalyzeLocationEntityField = {
15
+ /**
16
+ * e.g. "spec.owner"? The frontend needs to know how to "inject" the field into the
17
+ * entity again if the user wants to change it
18
+ */
19
+ field: string;
20
+ /** The outcome of the analysis for this particular field */
21
+ state: 'analysisSuggestedValue' | 'analysisSuggestedNoValue' | 'needsUserInput';
22
+ value: string | null;
23
+ /**
24
+ * A text to show to the user to inform about the choices made. Like, it could say
25
+ * "Found a CODEOWNERS file that covers this target, so we suggest leaving this
26
+ * field empty; which would currently make it owned by X" where X is taken from the
27
+ * codeowners file.
28
+ */
29
+ description: string;
30
+ };
31
+
32
+ /**
33
+ * If the folder pointed to already contained catalog info yaml files, they are
34
+ * read and emitted like this so that the frontend can inform the user that it
35
+ * located them and can make sure to register them as well if they weren't
36
+ * already
37
+ * @public
38
+ */
39
+ export declare type AnalyzeLocationExistingEntity = {
40
+ location: LocationSpec;
41
+ isRegistered: boolean;
42
+ entity: Entity;
43
+ };
44
+
45
+ /**
46
+ * This is some form of representation of what the analyzer could deduce.
47
+ * We should probably have a chat about how this can best be conveyed to
48
+ * the frontend. It'll probably contain a (possibly incomplete) entity, plus
49
+ * enough info for the frontend to know what form data to show to the user
50
+ * for overriding/completing the info.
51
+ * @public
52
+ */
53
+ export declare type AnalyzeLocationGenerateEntity = {
54
+ entity: RecursivePartial<Entity>;
55
+ fields: AnalyzeLocationEntityField[];
56
+ };
57
+
58
+ /** @public */
59
+ export declare type AnalyzeLocationRequest = {
60
+ location: LocationSpec;
61
+ catalogFilename?: string;
62
+ };
63
+
64
+ /** @public */
65
+ export declare type AnalyzeLocationResponse = {
66
+ existingEntityFiles: AnalyzeLocationExistingEntity[];
67
+ generateEntities: AnalyzeLocationGenerateEntity[];
68
+ };
69
+
12
70
  /* Excluded from this release type: catalogEntityCreatePermission */
13
71
 
14
72
  /* Excluded from this release type: catalogEntityDeletePermission */
@@ -42,6 +100,31 @@ export declare interface CatalogEntityDocument extends IndexableDocument {
42
100
 
43
101
  /* Excluded from this release type: catalogPermissions */
44
102
 
103
+ /**
104
+ * Holds the entity location information.
105
+ *
106
+ * @remarks
107
+ *
108
+ * `presence` flag: when using repo importer plugin, location is being created before the component yaml file is merged to the main branch.
109
+ * This flag is then set to indicate that the file can be not present.
110
+ * default value: 'required'.
111
+ *
112
+ * @public
113
+ */
114
+ export declare type LocationSpec = {
115
+ type: string;
116
+ target: string;
117
+ presence?: 'optional' | 'required';
118
+ };
119
+
120
+ /**
121
+ * Makes all keys of an entire hierarchy optional.
122
+ * @ignore
123
+ */
124
+ declare type RecursivePartial<T> = {
125
+ [P in keyof T]?: T[P] extends (infer U)[] ? RecursivePartial<U>[] : T[P] extends object ? RecursivePartial<T[P]> : T[P];
126
+ };
127
+
45
128
  /* Excluded from this release type: RESOURCE_TYPE_CATALOG_ENTITY */
46
129
 
47
130
  export { }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@backstage/plugin-catalog-common",
3
3
  "description": "Common functionalities for the catalog plugin",
4
- "version": "1.0.7-next.0",
4
+ "version": "1.0.7-next.2",
5
5
  "main": "dist/index.cjs.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "license": "Apache-2.0",
@@ -33,11 +33,12 @@
33
33
  "clean": "backstage-cli package clean"
34
34
  },
35
35
  "dependencies": {
36
- "@backstage/plugin-permission-common": "^0.6.5-next.0",
37
- "@backstage/plugin-search-common": "^1.0.2-next.0"
36
+ "@backstage/catalog-model": "^1.1.2-next.2",
37
+ "@backstage/plugin-permission-common": "^0.7.0-next.2",
38
+ "@backstage/plugin-search-common": "^1.1.0-next.2"
38
39
  },
39
40
  "devDependencies": {
40
- "@backstage/cli": "^0.20.0-next.0"
41
+ "@backstage/cli": "^0.20.0-next.2"
41
42
  },
42
43
  "files": [
43
44
  "dist",