@backstage/plugin-catalog-node 0.0.0-nightly-20220709024234
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 +18 -0
- package/README.md +3 -0
- package/alpha/package.json +6 -0
- package/dist/index.alpha.d.ts +265 -0
- package/dist/index.beta.d.ts +256 -0
- package/dist/index.cjs.js +46 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +256 -0
- package/package.json +41 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# @backstage/plugin-catalog-node
|
|
2
|
+
|
|
3
|
+
## 0.0.0-nightly-20220709024234
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- 9a6aba1d85: This package houses stable types from the `@backstage/plugin-catalog-backend` package and is intended for creation of catalog modules. Prefer importing from this package over the `@backstage/plugin-catalog-backend` package.
|
|
8
|
+
|
|
9
|
+
### Minor Changes
|
|
10
|
+
|
|
11
|
+
- 91c1d12123: Added alpha exports for the new experimental backend system.
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
- @backstage/backend-plugin-api@0.0.0-nightly-20220709024234
|
|
17
|
+
- @backstage/catalog-model@0.0.0-nightly-20220709024234
|
|
18
|
+
- @backstage/errors@0.0.0-nightly-20220709024234
|
package/README.md
ADDED
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The catalog-backend-node module for `@backstage/plugin-catalog-backend`.
|
|
3
|
+
*
|
|
4
|
+
* @packageDocumentation
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/// <reference types="node" />
|
|
8
|
+
|
|
9
|
+
import { CompoundEntityRef } from '@backstage/catalog-model';
|
|
10
|
+
import { Entity } from '@backstage/catalog-model';
|
|
11
|
+
import { JsonValue } from '@backstage/types';
|
|
12
|
+
import { ServiceRef } from '@backstage/backend-plugin-api';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @alpha
|
|
16
|
+
*/
|
|
17
|
+
export declare interface CatalogProcessingExtensionPoint {
|
|
18
|
+
addProcessor(processor: CatalogProcessor): void;
|
|
19
|
+
addEntityProvider(provider: EntityProvider): void;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @alpha
|
|
24
|
+
*/
|
|
25
|
+
export declare const catalogProcessingExtentionPoint: ServiceRef<CatalogProcessingExtensionPoint>;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* @public
|
|
29
|
+
*/
|
|
30
|
+
export declare type CatalogProcessor = {
|
|
31
|
+
/**
|
|
32
|
+
* A unique identifier for the Catalog Processor.
|
|
33
|
+
*/
|
|
34
|
+
getProcessorName(): string;
|
|
35
|
+
/**
|
|
36
|
+
* Reads the contents of a location.
|
|
37
|
+
*
|
|
38
|
+
* @param location - The location to read
|
|
39
|
+
* @param optional - Whether a missing target should trigger an error
|
|
40
|
+
* @param emit - A sink for items resulting from the read
|
|
41
|
+
* @param parser - A parser, that is able to take the raw catalog descriptor
|
|
42
|
+
* data and turn it into the actual result pieces.
|
|
43
|
+
* @param cache - A cache for storing values local to this processor and the current entity.
|
|
44
|
+
* @returns True if handled by this processor, false otherwise
|
|
45
|
+
*/
|
|
46
|
+
readLocation?(location: LocationSpec, optional: boolean, emit: CatalogProcessorEmit, parser: CatalogProcessorParser, cache: CatalogProcessorCache): Promise<boolean>;
|
|
47
|
+
/**
|
|
48
|
+
* Pre-processes an emitted entity, after it has been emitted but before it
|
|
49
|
+
* has been validated.
|
|
50
|
+
*
|
|
51
|
+
* This type of processing usually involves enriching the entity with
|
|
52
|
+
* additional data, and the input entity may actually still be incomplete
|
|
53
|
+
* when the processor is invoked.
|
|
54
|
+
*
|
|
55
|
+
* @param entity - The (possibly partial) entity to process
|
|
56
|
+
* @param location - The location that the entity came from
|
|
57
|
+
* @param emit - A sink for auxiliary items resulting from the processing
|
|
58
|
+
* @param originLocation - The location that the entity originally came from.
|
|
59
|
+
* While location resolves to the direct parent location, originLocation
|
|
60
|
+
* tells which location was used to start the ingestion loop.
|
|
61
|
+
* @param cache - A cache for storing values local to this processor and the current entity.
|
|
62
|
+
* @returns The same entity or a modified version of it
|
|
63
|
+
*/
|
|
64
|
+
preProcessEntity?(entity: Entity, location: LocationSpec, emit: CatalogProcessorEmit, originLocation: LocationSpec, cache: CatalogProcessorCache): Promise<Entity>;
|
|
65
|
+
/**
|
|
66
|
+
* Validates the entity as a known entity kind, after it has been pre-
|
|
67
|
+
* processed and has passed through basic overall validation.
|
|
68
|
+
*
|
|
69
|
+
* @param entity - The entity to validate
|
|
70
|
+
* @returns Resolves to true, if the entity was of a kind that was known and
|
|
71
|
+
* handled by this processor, and was found to be valid. Resolves to false,
|
|
72
|
+
* if the entity was not of a kind that was known by this processor.
|
|
73
|
+
* Rejects to an Error describing the problem, if the entity was of a kind
|
|
74
|
+
* that was known by this processor and was not valid.
|
|
75
|
+
*/
|
|
76
|
+
validateEntityKind?(entity: Entity): Promise<boolean>;
|
|
77
|
+
/**
|
|
78
|
+
* Post-processes an emitted entity, after it has been validated.
|
|
79
|
+
*
|
|
80
|
+
* @param entity - The entity to process
|
|
81
|
+
* @param location - The location that the entity came from
|
|
82
|
+
* @param emit - A sink for auxiliary items resulting from the processing
|
|
83
|
+
* @param cache - A cache for storing values local to this processor and the current entity.
|
|
84
|
+
* @returns The same entity or a modified version of it
|
|
85
|
+
*/
|
|
86
|
+
postProcessEntity?(entity: Entity, location: LocationSpec, emit: CatalogProcessorEmit, cache: CatalogProcessorCache): Promise<Entity>;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* A cache for storing data during processing.
|
|
91
|
+
*
|
|
92
|
+
* The values stored in the cache are always local to each processor, meaning
|
|
93
|
+
* no processor can see cache values from other processors.
|
|
94
|
+
*
|
|
95
|
+
* The cache instance provided to the CatalogProcessor is also scoped to the
|
|
96
|
+
* entity being processed, meaning that each processor run can't see cache
|
|
97
|
+
* values from processing runs for other entities.
|
|
98
|
+
*
|
|
99
|
+
* Values that are set during a processing run will only be visible in the directly
|
|
100
|
+
* following run. The cache will be overwritten every run unless no new cache items
|
|
101
|
+
* are written, in which case the existing values remain in the cache.
|
|
102
|
+
*
|
|
103
|
+
* @public
|
|
104
|
+
*/
|
|
105
|
+
export declare interface CatalogProcessorCache {
|
|
106
|
+
/**
|
|
107
|
+
* Retrieve a value from the cache.
|
|
108
|
+
*/
|
|
109
|
+
get<ItemType extends JsonValue>(key: string): Promise<ItemType | undefined>;
|
|
110
|
+
/**
|
|
111
|
+
* Store a value in the cache.
|
|
112
|
+
*/
|
|
113
|
+
set<ItemType extends JsonValue>(key: string, value: ItemType): Promise<void>;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/** @public */
|
|
117
|
+
export declare type CatalogProcessorEmit = (generated: CatalogProcessorResult) => void;
|
|
118
|
+
|
|
119
|
+
/** @public */
|
|
120
|
+
export declare type CatalogProcessorEntityResult = {
|
|
121
|
+
type: 'entity';
|
|
122
|
+
entity: Entity;
|
|
123
|
+
location: LocationSpec;
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
/** @public */
|
|
127
|
+
export declare type CatalogProcessorErrorResult = {
|
|
128
|
+
type: 'error';
|
|
129
|
+
error: Error;
|
|
130
|
+
location: LocationSpec;
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
/** @public */
|
|
134
|
+
export declare type CatalogProcessorLocationResult = {
|
|
135
|
+
type: 'location';
|
|
136
|
+
location: LocationSpec;
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* A parser, that is able to take the raw catalog descriptor data and turn it
|
|
141
|
+
* into the actual result pieces. The default implementation performs a YAML
|
|
142
|
+
* document parsing.
|
|
143
|
+
* @public
|
|
144
|
+
*/
|
|
145
|
+
export declare type CatalogProcessorParser = (options: {
|
|
146
|
+
data: Buffer;
|
|
147
|
+
location: LocationSpec;
|
|
148
|
+
}) => AsyncIterable<CatalogProcessorResult>;
|
|
149
|
+
|
|
150
|
+
/** @public */
|
|
151
|
+
export declare type CatalogProcessorRefreshKeysResult = {
|
|
152
|
+
type: 'refresh';
|
|
153
|
+
key: string;
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
/** @public */
|
|
157
|
+
export declare type CatalogProcessorRelationResult = {
|
|
158
|
+
type: 'relation';
|
|
159
|
+
relation: EntityRelationSpec;
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
/** @public */
|
|
163
|
+
export declare type CatalogProcessorResult = CatalogProcessorLocationResult | CatalogProcessorEntityResult | CatalogProcessorRelationResult | CatalogProcessorErrorResult | CatalogProcessorRefreshKeysResult;
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Entities that are not yet processed.
|
|
167
|
+
* @public
|
|
168
|
+
*/
|
|
169
|
+
export declare type DeferredEntity = {
|
|
170
|
+
entity: Entity;
|
|
171
|
+
locationKey?: string;
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* An EntityProvider is able to provide entities to the catalog.
|
|
176
|
+
* See https://backstage.io/docs/features/software-catalog/life-of-an-entity for more details.
|
|
177
|
+
* @public
|
|
178
|
+
*/
|
|
179
|
+
export declare interface EntityProvider {
|
|
180
|
+
/** Unique provider name used internally for caching. */
|
|
181
|
+
getProviderName(): string;
|
|
182
|
+
/** Connect is called upon initialization by the catalog engine. */
|
|
183
|
+
connect(connection: EntityProviderConnection): Promise<void>;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* The EntityProviderConnection is the connection between the catalog and the entity provider.
|
|
188
|
+
* The EntityProvider use this connection to add and remove entities from the catalog.
|
|
189
|
+
* @public
|
|
190
|
+
*/
|
|
191
|
+
export declare interface EntityProviderConnection {
|
|
192
|
+
/**
|
|
193
|
+
* Applies either a full or delta update to the catalog engine.
|
|
194
|
+
*/
|
|
195
|
+
applyMutation(mutation: EntityProviderMutation): Promise<void>;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* @public
|
|
200
|
+
* A 'full' mutation replaces all existing entities created by this entity provider with new ones.
|
|
201
|
+
* A 'delta' mutation can both add and remove entities provided by this provider. Previously provided
|
|
202
|
+
* entities from a 'full' mutation are not removed.
|
|
203
|
+
*/
|
|
204
|
+
export declare type EntityProviderMutation = {
|
|
205
|
+
type: 'full';
|
|
206
|
+
entities: DeferredEntity[];
|
|
207
|
+
} | {
|
|
208
|
+
type: 'delta';
|
|
209
|
+
added: DeferredEntity[];
|
|
210
|
+
removed: DeferredEntity[];
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Holds the relation data for entities.
|
|
215
|
+
*
|
|
216
|
+
* @public
|
|
217
|
+
*/
|
|
218
|
+
export declare type EntityRelationSpec = {
|
|
219
|
+
/**
|
|
220
|
+
* The source entity of this relation.
|
|
221
|
+
*/
|
|
222
|
+
source: CompoundEntityRef;
|
|
223
|
+
/**
|
|
224
|
+
* The type of the relation.
|
|
225
|
+
*/
|
|
226
|
+
type: string;
|
|
227
|
+
/**
|
|
228
|
+
* The target entity of this relation.
|
|
229
|
+
*/
|
|
230
|
+
target: CompoundEntityRef;
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Holds the entity location information.
|
|
235
|
+
*
|
|
236
|
+
* @remarks
|
|
237
|
+
*
|
|
238
|
+
* `presence` flag: when using repo importer plugin, location is being created before the component yaml file is merged to the main branch.
|
|
239
|
+
* This flag is then set to indicate that the file can be not present.
|
|
240
|
+
* default value: 'required'.
|
|
241
|
+
*
|
|
242
|
+
* @public
|
|
243
|
+
*/
|
|
244
|
+
export declare type LocationSpec = {
|
|
245
|
+
type: string;
|
|
246
|
+
target: string;
|
|
247
|
+
presence?: 'optional' | 'required';
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Factory functions for the standard processing result types.
|
|
252
|
+
*
|
|
253
|
+
* @public
|
|
254
|
+
*/
|
|
255
|
+
export declare const processingResult: Readonly<{
|
|
256
|
+
readonly notFoundError: (atLocation: LocationSpec, message: string) => CatalogProcessorResult;
|
|
257
|
+
readonly inputError: (atLocation: LocationSpec, message: string) => CatalogProcessorResult;
|
|
258
|
+
readonly generalError: (atLocation: LocationSpec, message: string) => CatalogProcessorResult;
|
|
259
|
+
readonly location: (newLocation: LocationSpec) => CatalogProcessorResult;
|
|
260
|
+
readonly entity: (atLocation: LocationSpec, newEntity: Entity) => CatalogProcessorResult;
|
|
261
|
+
readonly relation: (spec: EntityRelationSpec) => CatalogProcessorResult;
|
|
262
|
+
readonly refresh: (key: string) => CatalogProcessorResult;
|
|
263
|
+
}>;
|
|
264
|
+
|
|
265
|
+
export { }
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The catalog-backend-node module for `@backstage/plugin-catalog-backend`.
|
|
3
|
+
*
|
|
4
|
+
* @packageDocumentation
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/// <reference types="node" />
|
|
8
|
+
|
|
9
|
+
import { CompoundEntityRef } from '@backstage/catalog-model';
|
|
10
|
+
import { Entity } from '@backstage/catalog-model';
|
|
11
|
+
import { JsonValue } from '@backstage/types';
|
|
12
|
+
import { ServiceRef } from '@backstage/backend-plugin-api';
|
|
13
|
+
|
|
14
|
+
/* Excluded from this release type: CatalogProcessingExtensionPoint */
|
|
15
|
+
|
|
16
|
+
/* Excluded from this release type: catalogProcessingExtentionPoint */
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
export declare type CatalogProcessor = {
|
|
22
|
+
/**
|
|
23
|
+
* A unique identifier for the Catalog Processor.
|
|
24
|
+
*/
|
|
25
|
+
getProcessorName(): string;
|
|
26
|
+
/**
|
|
27
|
+
* Reads the contents of a location.
|
|
28
|
+
*
|
|
29
|
+
* @param location - The location to read
|
|
30
|
+
* @param optional - Whether a missing target should trigger an error
|
|
31
|
+
* @param emit - A sink for items resulting from the read
|
|
32
|
+
* @param parser - A parser, that is able to take the raw catalog descriptor
|
|
33
|
+
* data and turn it into the actual result pieces.
|
|
34
|
+
* @param cache - A cache for storing values local to this processor and the current entity.
|
|
35
|
+
* @returns True if handled by this processor, false otherwise
|
|
36
|
+
*/
|
|
37
|
+
readLocation?(location: LocationSpec, optional: boolean, emit: CatalogProcessorEmit, parser: CatalogProcessorParser, cache: CatalogProcessorCache): Promise<boolean>;
|
|
38
|
+
/**
|
|
39
|
+
* Pre-processes an emitted entity, after it has been emitted but before it
|
|
40
|
+
* has been validated.
|
|
41
|
+
*
|
|
42
|
+
* This type of processing usually involves enriching the entity with
|
|
43
|
+
* additional data, and the input entity may actually still be incomplete
|
|
44
|
+
* when the processor is invoked.
|
|
45
|
+
*
|
|
46
|
+
* @param entity - The (possibly partial) entity to process
|
|
47
|
+
* @param location - The location that the entity came from
|
|
48
|
+
* @param emit - A sink for auxiliary items resulting from the processing
|
|
49
|
+
* @param originLocation - The location that the entity originally came from.
|
|
50
|
+
* While location resolves to the direct parent location, originLocation
|
|
51
|
+
* tells which location was used to start the ingestion loop.
|
|
52
|
+
* @param cache - A cache for storing values local to this processor and the current entity.
|
|
53
|
+
* @returns The same entity or a modified version of it
|
|
54
|
+
*/
|
|
55
|
+
preProcessEntity?(entity: Entity, location: LocationSpec, emit: CatalogProcessorEmit, originLocation: LocationSpec, cache: CatalogProcessorCache): Promise<Entity>;
|
|
56
|
+
/**
|
|
57
|
+
* Validates the entity as a known entity kind, after it has been pre-
|
|
58
|
+
* processed and has passed through basic overall validation.
|
|
59
|
+
*
|
|
60
|
+
* @param entity - The entity to validate
|
|
61
|
+
* @returns Resolves to true, if the entity was of a kind that was known and
|
|
62
|
+
* handled by this processor, and was found to be valid. Resolves to false,
|
|
63
|
+
* if the entity was not of a kind that was known by this processor.
|
|
64
|
+
* Rejects to an Error describing the problem, if the entity was of a kind
|
|
65
|
+
* that was known by this processor and was not valid.
|
|
66
|
+
*/
|
|
67
|
+
validateEntityKind?(entity: Entity): Promise<boolean>;
|
|
68
|
+
/**
|
|
69
|
+
* Post-processes an emitted entity, after it has been validated.
|
|
70
|
+
*
|
|
71
|
+
* @param entity - The entity to process
|
|
72
|
+
* @param location - The location that the entity came from
|
|
73
|
+
* @param emit - A sink for auxiliary items resulting from the processing
|
|
74
|
+
* @param cache - A cache for storing values local to this processor and the current entity.
|
|
75
|
+
* @returns The same entity or a modified version of it
|
|
76
|
+
*/
|
|
77
|
+
postProcessEntity?(entity: Entity, location: LocationSpec, emit: CatalogProcessorEmit, cache: CatalogProcessorCache): Promise<Entity>;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* A cache for storing data during processing.
|
|
82
|
+
*
|
|
83
|
+
* The values stored in the cache are always local to each processor, meaning
|
|
84
|
+
* no processor can see cache values from other processors.
|
|
85
|
+
*
|
|
86
|
+
* The cache instance provided to the CatalogProcessor is also scoped to the
|
|
87
|
+
* entity being processed, meaning that each processor run can't see cache
|
|
88
|
+
* values from processing runs for other entities.
|
|
89
|
+
*
|
|
90
|
+
* Values that are set during a processing run will only be visible in the directly
|
|
91
|
+
* following run. The cache will be overwritten every run unless no new cache items
|
|
92
|
+
* are written, in which case the existing values remain in the cache.
|
|
93
|
+
*
|
|
94
|
+
* @public
|
|
95
|
+
*/
|
|
96
|
+
export declare interface CatalogProcessorCache {
|
|
97
|
+
/**
|
|
98
|
+
* Retrieve a value from the cache.
|
|
99
|
+
*/
|
|
100
|
+
get<ItemType extends JsonValue>(key: string): Promise<ItemType | undefined>;
|
|
101
|
+
/**
|
|
102
|
+
* Store a value in the cache.
|
|
103
|
+
*/
|
|
104
|
+
set<ItemType extends JsonValue>(key: string, value: ItemType): Promise<void>;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/** @public */
|
|
108
|
+
export declare type CatalogProcessorEmit = (generated: CatalogProcessorResult) => void;
|
|
109
|
+
|
|
110
|
+
/** @public */
|
|
111
|
+
export declare type CatalogProcessorEntityResult = {
|
|
112
|
+
type: 'entity';
|
|
113
|
+
entity: Entity;
|
|
114
|
+
location: LocationSpec;
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
/** @public */
|
|
118
|
+
export declare type CatalogProcessorErrorResult = {
|
|
119
|
+
type: 'error';
|
|
120
|
+
error: Error;
|
|
121
|
+
location: LocationSpec;
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
/** @public */
|
|
125
|
+
export declare type CatalogProcessorLocationResult = {
|
|
126
|
+
type: 'location';
|
|
127
|
+
location: LocationSpec;
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* A parser, that is able to take the raw catalog descriptor data and turn it
|
|
132
|
+
* into the actual result pieces. The default implementation performs a YAML
|
|
133
|
+
* document parsing.
|
|
134
|
+
* @public
|
|
135
|
+
*/
|
|
136
|
+
export declare type CatalogProcessorParser = (options: {
|
|
137
|
+
data: Buffer;
|
|
138
|
+
location: LocationSpec;
|
|
139
|
+
}) => AsyncIterable<CatalogProcessorResult>;
|
|
140
|
+
|
|
141
|
+
/** @public */
|
|
142
|
+
export declare type CatalogProcessorRefreshKeysResult = {
|
|
143
|
+
type: 'refresh';
|
|
144
|
+
key: string;
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
/** @public */
|
|
148
|
+
export declare type CatalogProcessorRelationResult = {
|
|
149
|
+
type: 'relation';
|
|
150
|
+
relation: EntityRelationSpec;
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
/** @public */
|
|
154
|
+
export declare type CatalogProcessorResult = CatalogProcessorLocationResult | CatalogProcessorEntityResult | CatalogProcessorRelationResult | CatalogProcessorErrorResult | CatalogProcessorRefreshKeysResult;
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Entities that are not yet processed.
|
|
158
|
+
* @public
|
|
159
|
+
*/
|
|
160
|
+
export declare type DeferredEntity = {
|
|
161
|
+
entity: Entity;
|
|
162
|
+
locationKey?: string;
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* An EntityProvider is able to provide entities to the catalog.
|
|
167
|
+
* See https://backstage.io/docs/features/software-catalog/life-of-an-entity for more details.
|
|
168
|
+
* @public
|
|
169
|
+
*/
|
|
170
|
+
export declare interface EntityProvider {
|
|
171
|
+
/** Unique provider name used internally for caching. */
|
|
172
|
+
getProviderName(): string;
|
|
173
|
+
/** Connect is called upon initialization by the catalog engine. */
|
|
174
|
+
connect(connection: EntityProviderConnection): Promise<void>;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* The EntityProviderConnection is the connection between the catalog and the entity provider.
|
|
179
|
+
* The EntityProvider use this connection to add and remove entities from the catalog.
|
|
180
|
+
* @public
|
|
181
|
+
*/
|
|
182
|
+
export declare interface EntityProviderConnection {
|
|
183
|
+
/**
|
|
184
|
+
* Applies either a full or delta update to the catalog engine.
|
|
185
|
+
*/
|
|
186
|
+
applyMutation(mutation: EntityProviderMutation): Promise<void>;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* @public
|
|
191
|
+
* A 'full' mutation replaces all existing entities created by this entity provider with new ones.
|
|
192
|
+
* A 'delta' mutation can both add and remove entities provided by this provider. Previously provided
|
|
193
|
+
* entities from a 'full' mutation are not removed.
|
|
194
|
+
*/
|
|
195
|
+
export declare type EntityProviderMutation = {
|
|
196
|
+
type: 'full';
|
|
197
|
+
entities: DeferredEntity[];
|
|
198
|
+
} | {
|
|
199
|
+
type: 'delta';
|
|
200
|
+
added: DeferredEntity[];
|
|
201
|
+
removed: DeferredEntity[];
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Holds the relation data for entities.
|
|
206
|
+
*
|
|
207
|
+
* @public
|
|
208
|
+
*/
|
|
209
|
+
export declare type EntityRelationSpec = {
|
|
210
|
+
/**
|
|
211
|
+
* The source entity of this relation.
|
|
212
|
+
*/
|
|
213
|
+
source: CompoundEntityRef;
|
|
214
|
+
/**
|
|
215
|
+
* The type of the relation.
|
|
216
|
+
*/
|
|
217
|
+
type: string;
|
|
218
|
+
/**
|
|
219
|
+
* The target entity of this relation.
|
|
220
|
+
*/
|
|
221
|
+
target: CompoundEntityRef;
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Holds the entity location information.
|
|
226
|
+
*
|
|
227
|
+
* @remarks
|
|
228
|
+
*
|
|
229
|
+
* `presence` flag: when using repo importer plugin, location is being created before the component yaml file is merged to the main branch.
|
|
230
|
+
* This flag is then set to indicate that the file can be not present.
|
|
231
|
+
* default value: 'required'.
|
|
232
|
+
*
|
|
233
|
+
* @public
|
|
234
|
+
*/
|
|
235
|
+
export declare type LocationSpec = {
|
|
236
|
+
type: string;
|
|
237
|
+
target: string;
|
|
238
|
+
presence?: 'optional' | 'required';
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Factory functions for the standard processing result types.
|
|
243
|
+
*
|
|
244
|
+
* @public
|
|
245
|
+
*/
|
|
246
|
+
export declare const processingResult: Readonly<{
|
|
247
|
+
readonly notFoundError: (atLocation: LocationSpec, message: string) => CatalogProcessorResult;
|
|
248
|
+
readonly inputError: (atLocation: LocationSpec, message: string) => CatalogProcessorResult;
|
|
249
|
+
readonly generalError: (atLocation: LocationSpec, message: string) => CatalogProcessorResult;
|
|
250
|
+
readonly location: (newLocation: LocationSpec) => CatalogProcessorResult;
|
|
251
|
+
readonly entity: (atLocation: LocationSpec, newEntity: Entity) => CatalogProcessorResult;
|
|
252
|
+
readonly relation: (spec: EntityRelationSpec) => CatalogProcessorResult;
|
|
253
|
+
readonly refresh: (key: string) => CatalogProcessorResult;
|
|
254
|
+
}>;
|
|
255
|
+
|
|
256
|
+
export { }
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var backendPluginApi = require('@backstage/backend-plugin-api');
|
|
6
|
+
var errors = require('@backstage/errors');
|
|
7
|
+
|
|
8
|
+
const catalogProcessingExtentionPoint = backendPluginApi.createServiceRef({
|
|
9
|
+
id: "catalog.processing"
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
const processingResult = Object.freeze({
|
|
13
|
+
notFoundError(atLocation, message) {
|
|
14
|
+
return {
|
|
15
|
+
type: "error",
|
|
16
|
+
location: atLocation,
|
|
17
|
+
error: new errors.NotFoundError(message)
|
|
18
|
+
};
|
|
19
|
+
},
|
|
20
|
+
inputError(atLocation, message) {
|
|
21
|
+
return {
|
|
22
|
+
type: "error",
|
|
23
|
+
location: atLocation,
|
|
24
|
+
error: new errors.InputError(message)
|
|
25
|
+
};
|
|
26
|
+
},
|
|
27
|
+
generalError(atLocation, message) {
|
|
28
|
+
return { type: "error", location: atLocation, error: new Error(message) };
|
|
29
|
+
},
|
|
30
|
+
location(newLocation) {
|
|
31
|
+
return { type: "location", location: newLocation };
|
|
32
|
+
},
|
|
33
|
+
entity(atLocation, newEntity) {
|
|
34
|
+
return { type: "entity", location: atLocation, entity: newEntity };
|
|
35
|
+
},
|
|
36
|
+
relation(spec) {
|
|
37
|
+
return { type: "relation", relation: spec };
|
|
38
|
+
},
|
|
39
|
+
refresh(key) {
|
|
40
|
+
return { type: "refresh", key };
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
exports.catalogProcessingExtentionPoint = catalogProcessingExtentionPoint;
|
|
45
|
+
exports.processingResult = processingResult;
|
|
46
|
+
//# sourceMappingURL=index.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../src/extensions.ts","../src/api/processingResult.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 */\nimport { createServiceRef } from '@backstage/backend-plugin-api';\nimport { EntityProvider } from './api';\nimport { CatalogProcessor } from './api/processor';\n\n/**\n * @alpha\n */\nexport interface CatalogProcessingExtensionPoint {\n addProcessor(processor: CatalogProcessor): void;\n addEntityProvider(provider: EntityProvider): void;\n}\n\n/**\n * @alpha\n */\nexport const catalogProcessingExtentionPoint =\n createServiceRef<CatalogProcessingExtensionPoint>({\n id: 'catalog.processing',\n });\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { InputError, NotFoundError } from '@backstage/errors';\nimport { Entity } from '@backstage/catalog-model';\nimport { CatalogProcessorResult } from './processor';\nimport { EntityRelationSpec, LocationSpec } from './common';\n\n/**\n * Factory functions for the standard processing result types.\n *\n * @public\n */\nexport const processingResult = Object.freeze({\n notFoundError(\n atLocation: LocationSpec,\n message: string,\n ): CatalogProcessorResult {\n return {\n type: 'error',\n location: atLocation,\n error: new NotFoundError(message),\n };\n },\n\n inputError(\n atLocation: LocationSpec,\n message: string,\n ): CatalogProcessorResult {\n return {\n type: 'error',\n location: atLocation,\n error: new InputError(message),\n };\n },\n\n generalError(\n atLocation: LocationSpec,\n message: string,\n ): CatalogProcessorResult {\n return { type: 'error', location: atLocation, error: new Error(message) };\n },\n\n location(newLocation: LocationSpec): CatalogProcessorResult {\n return { type: 'location', location: newLocation };\n },\n\n entity(atLocation: LocationSpec, newEntity: Entity): CatalogProcessorResult {\n return { type: 'entity', location: atLocation, entity: newEntity };\n },\n\n relation(spec: EntityRelationSpec): CatalogProcessorResult {\n return { type: 'relation', relation: spec };\n },\n\n refresh(key: string): CatalogProcessorResult {\n return { type: 'refresh', key };\n },\n} as const);\n"],"names":["createServiceRef","NotFoundError","InputError"],"mappings":";;;;;;;AACY,MAAC,+BAA+B,GAAGA,iCAAgB,CAAC;AAChE,EAAE,EAAE,EAAE,oBAAoB;AAC1B,CAAC;;ACFW,MAAC,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC;AAC9C,EAAE,aAAa,CAAC,UAAU,EAAE,OAAO,EAAE;AACrC,IAAI,OAAO;AACX,MAAM,IAAI,EAAE,OAAO;AACnB,MAAM,QAAQ,EAAE,UAAU;AAC1B,MAAM,KAAK,EAAE,IAAIC,oBAAa,CAAC,OAAO,CAAC;AACvC,KAAK,CAAC;AACN,GAAG;AACH,EAAE,UAAU,CAAC,UAAU,EAAE,OAAO,EAAE;AAClC,IAAI,OAAO;AACX,MAAM,IAAI,EAAE,OAAO;AACnB,MAAM,QAAQ,EAAE,UAAU;AAC1B,MAAM,KAAK,EAAE,IAAIC,iBAAU,CAAC,OAAO,CAAC;AACpC,KAAK,CAAC;AACN,GAAG;AACH,EAAE,YAAY,CAAC,UAAU,EAAE,OAAO,EAAE;AACpC,IAAI,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,KAAK,EAAE,IAAI,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;AAC9E,GAAG;AACH,EAAE,QAAQ,CAAC,WAAW,EAAE;AACxB,IAAI,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC;AACvD,GAAG;AACH,EAAE,MAAM,CAAC,UAAU,EAAE,SAAS,EAAE;AAChC,IAAI,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;AACvE,GAAG;AACH,EAAE,QAAQ,CAAC,IAAI,EAAE;AACjB,IAAI,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AAChD,GAAG;AACH,EAAE,OAAO,CAAC,GAAG,EAAE;AACf,IAAI,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC;AACpC,GAAG;AACH,CAAC;;;;;"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The catalog-backend-node module for `@backstage/plugin-catalog-backend`.
|
|
3
|
+
*
|
|
4
|
+
* @packageDocumentation
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/// <reference types="node" />
|
|
8
|
+
|
|
9
|
+
import { CompoundEntityRef } from '@backstage/catalog-model';
|
|
10
|
+
import { Entity } from '@backstage/catalog-model';
|
|
11
|
+
import { JsonValue } from '@backstage/types';
|
|
12
|
+
import { ServiceRef } from '@backstage/backend-plugin-api';
|
|
13
|
+
|
|
14
|
+
/* Excluded from this release type: CatalogProcessingExtensionPoint */
|
|
15
|
+
|
|
16
|
+
/* Excluded from this release type: catalogProcessingExtentionPoint */
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
export declare type CatalogProcessor = {
|
|
22
|
+
/**
|
|
23
|
+
* A unique identifier for the Catalog Processor.
|
|
24
|
+
*/
|
|
25
|
+
getProcessorName(): string;
|
|
26
|
+
/**
|
|
27
|
+
* Reads the contents of a location.
|
|
28
|
+
*
|
|
29
|
+
* @param location - The location to read
|
|
30
|
+
* @param optional - Whether a missing target should trigger an error
|
|
31
|
+
* @param emit - A sink for items resulting from the read
|
|
32
|
+
* @param parser - A parser, that is able to take the raw catalog descriptor
|
|
33
|
+
* data and turn it into the actual result pieces.
|
|
34
|
+
* @param cache - A cache for storing values local to this processor and the current entity.
|
|
35
|
+
* @returns True if handled by this processor, false otherwise
|
|
36
|
+
*/
|
|
37
|
+
readLocation?(location: LocationSpec, optional: boolean, emit: CatalogProcessorEmit, parser: CatalogProcessorParser, cache: CatalogProcessorCache): Promise<boolean>;
|
|
38
|
+
/**
|
|
39
|
+
* Pre-processes an emitted entity, after it has been emitted but before it
|
|
40
|
+
* has been validated.
|
|
41
|
+
*
|
|
42
|
+
* This type of processing usually involves enriching the entity with
|
|
43
|
+
* additional data, and the input entity may actually still be incomplete
|
|
44
|
+
* when the processor is invoked.
|
|
45
|
+
*
|
|
46
|
+
* @param entity - The (possibly partial) entity to process
|
|
47
|
+
* @param location - The location that the entity came from
|
|
48
|
+
* @param emit - A sink for auxiliary items resulting from the processing
|
|
49
|
+
* @param originLocation - The location that the entity originally came from.
|
|
50
|
+
* While location resolves to the direct parent location, originLocation
|
|
51
|
+
* tells which location was used to start the ingestion loop.
|
|
52
|
+
* @param cache - A cache for storing values local to this processor and the current entity.
|
|
53
|
+
* @returns The same entity or a modified version of it
|
|
54
|
+
*/
|
|
55
|
+
preProcessEntity?(entity: Entity, location: LocationSpec, emit: CatalogProcessorEmit, originLocation: LocationSpec, cache: CatalogProcessorCache): Promise<Entity>;
|
|
56
|
+
/**
|
|
57
|
+
* Validates the entity as a known entity kind, after it has been pre-
|
|
58
|
+
* processed and has passed through basic overall validation.
|
|
59
|
+
*
|
|
60
|
+
* @param entity - The entity to validate
|
|
61
|
+
* @returns Resolves to true, if the entity was of a kind that was known and
|
|
62
|
+
* handled by this processor, and was found to be valid. Resolves to false,
|
|
63
|
+
* if the entity was not of a kind that was known by this processor.
|
|
64
|
+
* Rejects to an Error describing the problem, if the entity was of a kind
|
|
65
|
+
* that was known by this processor and was not valid.
|
|
66
|
+
*/
|
|
67
|
+
validateEntityKind?(entity: Entity): Promise<boolean>;
|
|
68
|
+
/**
|
|
69
|
+
* Post-processes an emitted entity, after it has been validated.
|
|
70
|
+
*
|
|
71
|
+
* @param entity - The entity to process
|
|
72
|
+
* @param location - The location that the entity came from
|
|
73
|
+
* @param emit - A sink for auxiliary items resulting from the processing
|
|
74
|
+
* @param cache - A cache for storing values local to this processor and the current entity.
|
|
75
|
+
* @returns The same entity or a modified version of it
|
|
76
|
+
*/
|
|
77
|
+
postProcessEntity?(entity: Entity, location: LocationSpec, emit: CatalogProcessorEmit, cache: CatalogProcessorCache): Promise<Entity>;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* A cache for storing data during processing.
|
|
82
|
+
*
|
|
83
|
+
* The values stored in the cache are always local to each processor, meaning
|
|
84
|
+
* no processor can see cache values from other processors.
|
|
85
|
+
*
|
|
86
|
+
* The cache instance provided to the CatalogProcessor is also scoped to the
|
|
87
|
+
* entity being processed, meaning that each processor run can't see cache
|
|
88
|
+
* values from processing runs for other entities.
|
|
89
|
+
*
|
|
90
|
+
* Values that are set during a processing run will only be visible in the directly
|
|
91
|
+
* following run. The cache will be overwritten every run unless no new cache items
|
|
92
|
+
* are written, in which case the existing values remain in the cache.
|
|
93
|
+
*
|
|
94
|
+
* @public
|
|
95
|
+
*/
|
|
96
|
+
export declare interface CatalogProcessorCache {
|
|
97
|
+
/**
|
|
98
|
+
* Retrieve a value from the cache.
|
|
99
|
+
*/
|
|
100
|
+
get<ItemType extends JsonValue>(key: string): Promise<ItemType | undefined>;
|
|
101
|
+
/**
|
|
102
|
+
* Store a value in the cache.
|
|
103
|
+
*/
|
|
104
|
+
set<ItemType extends JsonValue>(key: string, value: ItemType): Promise<void>;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/** @public */
|
|
108
|
+
export declare type CatalogProcessorEmit = (generated: CatalogProcessorResult) => void;
|
|
109
|
+
|
|
110
|
+
/** @public */
|
|
111
|
+
export declare type CatalogProcessorEntityResult = {
|
|
112
|
+
type: 'entity';
|
|
113
|
+
entity: Entity;
|
|
114
|
+
location: LocationSpec;
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
/** @public */
|
|
118
|
+
export declare type CatalogProcessorErrorResult = {
|
|
119
|
+
type: 'error';
|
|
120
|
+
error: Error;
|
|
121
|
+
location: LocationSpec;
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
/** @public */
|
|
125
|
+
export declare type CatalogProcessorLocationResult = {
|
|
126
|
+
type: 'location';
|
|
127
|
+
location: LocationSpec;
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* A parser, that is able to take the raw catalog descriptor data and turn it
|
|
132
|
+
* into the actual result pieces. The default implementation performs a YAML
|
|
133
|
+
* document parsing.
|
|
134
|
+
* @public
|
|
135
|
+
*/
|
|
136
|
+
export declare type CatalogProcessorParser = (options: {
|
|
137
|
+
data: Buffer;
|
|
138
|
+
location: LocationSpec;
|
|
139
|
+
}) => AsyncIterable<CatalogProcessorResult>;
|
|
140
|
+
|
|
141
|
+
/** @public */
|
|
142
|
+
export declare type CatalogProcessorRefreshKeysResult = {
|
|
143
|
+
type: 'refresh';
|
|
144
|
+
key: string;
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
/** @public */
|
|
148
|
+
export declare type CatalogProcessorRelationResult = {
|
|
149
|
+
type: 'relation';
|
|
150
|
+
relation: EntityRelationSpec;
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
/** @public */
|
|
154
|
+
export declare type CatalogProcessorResult = CatalogProcessorLocationResult | CatalogProcessorEntityResult | CatalogProcessorRelationResult | CatalogProcessorErrorResult | CatalogProcessorRefreshKeysResult;
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Entities that are not yet processed.
|
|
158
|
+
* @public
|
|
159
|
+
*/
|
|
160
|
+
export declare type DeferredEntity = {
|
|
161
|
+
entity: Entity;
|
|
162
|
+
locationKey?: string;
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* An EntityProvider is able to provide entities to the catalog.
|
|
167
|
+
* See https://backstage.io/docs/features/software-catalog/life-of-an-entity for more details.
|
|
168
|
+
* @public
|
|
169
|
+
*/
|
|
170
|
+
export declare interface EntityProvider {
|
|
171
|
+
/** Unique provider name used internally for caching. */
|
|
172
|
+
getProviderName(): string;
|
|
173
|
+
/** Connect is called upon initialization by the catalog engine. */
|
|
174
|
+
connect(connection: EntityProviderConnection): Promise<void>;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* The EntityProviderConnection is the connection between the catalog and the entity provider.
|
|
179
|
+
* The EntityProvider use this connection to add and remove entities from the catalog.
|
|
180
|
+
* @public
|
|
181
|
+
*/
|
|
182
|
+
export declare interface EntityProviderConnection {
|
|
183
|
+
/**
|
|
184
|
+
* Applies either a full or delta update to the catalog engine.
|
|
185
|
+
*/
|
|
186
|
+
applyMutation(mutation: EntityProviderMutation): Promise<void>;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* @public
|
|
191
|
+
* A 'full' mutation replaces all existing entities created by this entity provider with new ones.
|
|
192
|
+
* A 'delta' mutation can both add and remove entities provided by this provider. Previously provided
|
|
193
|
+
* entities from a 'full' mutation are not removed.
|
|
194
|
+
*/
|
|
195
|
+
export declare type EntityProviderMutation = {
|
|
196
|
+
type: 'full';
|
|
197
|
+
entities: DeferredEntity[];
|
|
198
|
+
} | {
|
|
199
|
+
type: 'delta';
|
|
200
|
+
added: DeferredEntity[];
|
|
201
|
+
removed: DeferredEntity[];
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Holds the relation data for entities.
|
|
206
|
+
*
|
|
207
|
+
* @public
|
|
208
|
+
*/
|
|
209
|
+
export declare type EntityRelationSpec = {
|
|
210
|
+
/**
|
|
211
|
+
* The source entity of this relation.
|
|
212
|
+
*/
|
|
213
|
+
source: CompoundEntityRef;
|
|
214
|
+
/**
|
|
215
|
+
* The type of the relation.
|
|
216
|
+
*/
|
|
217
|
+
type: string;
|
|
218
|
+
/**
|
|
219
|
+
* The target entity of this relation.
|
|
220
|
+
*/
|
|
221
|
+
target: CompoundEntityRef;
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Holds the entity location information.
|
|
226
|
+
*
|
|
227
|
+
* @remarks
|
|
228
|
+
*
|
|
229
|
+
* `presence` flag: when using repo importer plugin, location is being created before the component yaml file is merged to the main branch.
|
|
230
|
+
* This flag is then set to indicate that the file can be not present.
|
|
231
|
+
* default value: 'required'.
|
|
232
|
+
*
|
|
233
|
+
* @public
|
|
234
|
+
*/
|
|
235
|
+
export declare type LocationSpec = {
|
|
236
|
+
type: string;
|
|
237
|
+
target: string;
|
|
238
|
+
presence?: 'optional' | 'required';
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Factory functions for the standard processing result types.
|
|
243
|
+
*
|
|
244
|
+
* @public
|
|
245
|
+
*/
|
|
246
|
+
export declare const processingResult: Readonly<{
|
|
247
|
+
readonly notFoundError: (atLocation: LocationSpec, message: string) => CatalogProcessorResult;
|
|
248
|
+
readonly inputError: (atLocation: LocationSpec, message: string) => CatalogProcessorResult;
|
|
249
|
+
readonly generalError: (atLocation: LocationSpec, message: string) => CatalogProcessorResult;
|
|
250
|
+
readonly location: (newLocation: LocationSpec) => CatalogProcessorResult;
|
|
251
|
+
readonly entity: (atLocation: LocationSpec, newEntity: Entity) => CatalogProcessorResult;
|
|
252
|
+
readonly relation: (spec: EntityRelationSpec) => CatalogProcessorResult;
|
|
253
|
+
readonly refresh: (key: string) => CatalogProcessorResult;
|
|
254
|
+
}>;
|
|
255
|
+
|
|
256
|
+
export { }
|
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@backstage/plugin-catalog-node",
|
|
3
|
+
"description": "The plugin-catalog-node module for @backstage/plugin-catalog-backend",
|
|
4
|
+
"version": "0.0.0-nightly-20220709024234",
|
|
5
|
+
"main": "dist/index.cjs.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"license": "Apache-2.0",
|
|
8
|
+
"private": false,
|
|
9
|
+
"publishConfig": {
|
|
10
|
+
"access": "public",
|
|
11
|
+
"main": "dist/index.cjs.js",
|
|
12
|
+
"types": "dist/index.d.ts",
|
|
13
|
+
"alphaTypes": "dist/index.alpha.d.ts"
|
|
14
|
+
},
|
|
15
|
+
"backstage": {
|
|
16
|
+
"role": "node-library"
|
|
17
|
+
},
|
|
18
|
+
"scripts": {
|
|
19
|
+
"start": "backstage-cli package start",
|
|
20
|
+
"build": "backstage-cli package build --experimental-type-build",
|
|
21
|
+
"lint": "backstage-cli package lint",
|
|
22
|
+
"test": "backstage-cli package test",
|
|
23
|
+
"clean": "backstage-cli package clean",
|
|
24
|
+
"prepack": "backstage-cli package prepack",
|
|
25
|
+
"postpack": "backstage-cli package postpack"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@backstage/backend-plugin-api": "0.0.0-nightly-20220709024234",
|
|
29
|
+
"@backstage/catalog-model": "0.0.0-nightly-20220709024234",
|
|
30
|
+
"@backstage/errors": "0.0.0-nightly-20220709024234",
|
|
31
|
+
"@backstage/types": "^1.0.0"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@backstage/backend-common": "0.0.0-nightly-20220709024234",
|
|
35
|
+
"@backstage/cli": "0.0.0-nightly-20220709024234"
|
|
36
|
+
},
|
|
37
|
+
"files": [
|
|
38
|
+
"dist",
|
|
39
|
+
"alpha"
|
|
40
|
+
]
|
|
41
|
+
}
|