@backstage/plugin-catalog-backend 1.3.2-next.0 → 1.4.0-next.1
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 +15 -0
- package/alpha/package.json +1 -1
- package/dist/index.alpha.d.ts +8 -1
- package/dist/index.beta.d.ts +8 -1
- package/dist/index.cjs.js +34 -8
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +8 -1
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @backstage/plugin-catalog-backend
|
|
2
2
|
|
|
3
|
+
## 1.4.0-next.1
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- dd395335bc: Allow unknown typed location from being registered via the location service by configuration settings
|
|
8
|
+
- 651c9d6800: The search index now does retain fields that have a very long value, but in the form of just a null. This makes it possible to at least filter for their existence.
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- ce77e78c93: Fixes a bug to be able to utilize refresh keys after the entity is loaded from cache
|
|
13
|
+
- 679f7c5e95: Include entity ref into error message when catalog policies fail
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
- @backstage/plugin-permission-node@0.6.5-next.1
|
|
16
|
+
- @backstage/backend-common@0.15.1-next.1
|
|
17
|
+
|
|
3
18
|
## 1.3.2-next.0
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
package/alpha/package.json
CHANGED
package/dist/index.alpha.d.ts
CHANGED
|
@@ -171,7 +171,8 @@ export declare class CatalogBuilder {
|
|
|
171
171
|
private onProcessingError?;
|
|
172
172
|
private processingInterval;
|
|
173
173
|
private locationAnalyzer;
|
|
174
|
-
private permissionRules;
|
|
174
|
+
private readonly permissionRules;
|
|
175
|
+
private allowedLocationType;
|
|
175
176
|
/**
|
|
176
177
|
* Creates a catalog builder.
|
|
177
178
|
*/
|
|
@@ -293,6 +294,12 @@ export declare class CatalogBuilder {
|
|
|
293
294
|
* @alpha
|
|
294
295
|
*/
|
|
295
296
|
addPermissionRules(...permissionRules: Array<CatalogPermissionRule | Array<CatalogPermissionRule>>): void;
|
|
297
|
+
/**
|
|
298
|
+
* Sets up the allowed location types from being registered via the location service.
|
|
299
|
+
*
|
|
300
|
+
* @param allowedLocationTypes - the allowed location types
|
|
301
|
+
*/
|
|
302
|
+
setAllowedLocationTypes(allowedLocationTypes: string[]): CatalogBuilder;
|
|
296
303
|
/**
|
|
297
304
|
* Wires up and returns all of the component parts of the catalog
|
|
298
305
|
*/
|
package/dist/index.beta.d.ts
CHANGED
|
@@ -171,7 +171,8 @@ export declare class CatalogBuilder {
|
|
|
171
171
|
private onProcessingError?;
|
|
172
172
|
private processingInterval;
|
|
173
173
|
private locationAnalyzer;
|
|
174
|
-
private permissionRules;
|
|
174
|
+
private readonly permissionRules;
|
|
175
|
+
private allowedLocationType;
|
|
175
176
|
/**
|
|
176
177
|
* Creates a catalog builder.
|
|
177
178
|
*/
|
|
@@ -285,6 +286,12 @@ export declare class CatalogBuilder {
|
|
|
285
286
|
*/
|
|
286
287
|
setEntityDataParser(parser: CatalogProcessorParser): CatalogBuilder;
|
|
287
288
|
/* Excluded from this release type: addPermissionRules */
|
|
289
|
+
/**
|
|
290
|
+
* Sets up the allowed location types from being registered via the location service.
|
|
291
|
+
*
|
|
292
|
+
* @param allowedLocationTypes - the allowed location types
|
|
293
|
+
*/
|
|
294
|
+
setAllowedLocationTypes(allowedLocationTypes: string[]): CatalogBuilder;
|
|
288
295
|
/**
|
|
289
296
|
* Wires up and returns all of the component parts of the catalog
|
|
290
297
|
*/
|
package/dist/index.cjs.js
CHANGED
|
@@ -754,6 +754,7 @@ class UrlReaderProcessor {
|
|
|
754
754
|
for (const parseResult of cacheItem.value) {
|
|
755
755
|
emit(parseResult);
|
|
756
756
|
}
|
|
757
|
+
emit(pluginCatalogNode.processingResult.refresh(`${location.type}:${location.target}`));
|
|
757
758
|
} else if (error.name === "NotFoundError") {
|
|
758
759
|
if (!optional) {
|
|
759
760
|
emit(pluginCatalogNode.processingResult.notFoundError(location, message));
|
|
@@ -2261,13 +2262,20 @@ function progressTracker() {
|
|
|
2261
2262
|
}
|
|
2262
2263
|
|
|
2263
2264
|
class DefaultLocationService {
|
|
2264
|
-
constructor(store, orchestrator
|
|
2265
|
+
constructor(store, orchestrator, options = {
|
|
2266
|
+
allowedLocationTypes: ["url"]
|
|
2267
|
+
}) {
|
|
2265
2268
|
this.store = store;
|
|
2266
2269
|
this.orchestrator = orchestrator;
|
|
2270
|
+
this.options = options;
|
|
2267
2271
|
}
|
|
2268
2272
|
async createLocation(input, dryRun) {
|
|
2269
|
-
if (input.type
|
|
2270
|
-
throw new errors.InputError(
|
|
2273
|
+
if (!this.options.allowedLocationTypes.includes(input.type)) {
|
|
2274
|
+
throw new errors.InputError(
|
|
2275
|
+
`Registered locations must be of an allowed type ${JSON.stringify(
|
|
2276
|
+
this.options.allowedLocationTypes
|
|
2277
|
+
)}`
|
|
2278
|
+
);
|
|
2271
2279
|
}
|
|
2272
2280
|
if (dryRun) {
|
|
2273
2281
|
return this.dryRunCreateLocation(input);
|
|
@@ -2823,10 +2831,17 @@ class DefaultCatalogProcessingOrchestrator {
|
|
|
2823
2831
|
try {
|
|
2824
2832
|
policyEnforcedEntity = await this.options.policy.enforce(entity);
|
|
2825
2833
|
} catch (e) {
|
|
2826
|
-
throw new errors.InputError(
|
|
2834
|
+
throw new errors.InputError(
|
|
2835
|
+
`Policy check failed for ${catalogModel.stringifyEntityRef(entity)}`,
|
|
2836
|
+
e
|
|
2837
|
+
);
|
|
2827
2838
|
}
|
|
2828
2839
|
if (!policyEnforcedEntity) {
|
|
2829
|
-
throw new Error(
|
|
2840
|
+
throw new Error(
|
|
2841
|
+
`Policy unexpectedly returned no data for ${catalogModel.stringifyEntityRef(
|
|
2842
|
+
entity
|
|
2843
|
+
)}`
|
|
2844
|
+
);
|
|
2830
2845
|
}
|
|
2831
2846
|
return policyEnforcedEntity;
|
|
2832
2847
|
}
|
|
@@ -2996,8 +3011,12 @@ function mapToRows(input, entityId) {
|
|
|
2996
3011
|
result.push({ entity_id: entityId, key, value: null });
|
|
2997
3012
|
} else {
|
|
2998
3013
|
const value = String(rawValue).toLocaleLowerCase("en-US");
|
|
2999
|
-
if (key.length <= MAX_KEY_LENGTH
|
|
3000
|
-
result.push({
|
|
3014
|
+
if (key.length <= MAX_KEY_LENGTH) {
|
|
3015
|
+
result.push({
|
|
3016
|
+
entity_id: entityId,
|
|
3017
|
+
key,
|
|
3018
|
+
value: value.length <= MAX_VALUE_LENGTH ? value : null
|
|
3019
|
+
});
|
|
3001
3020
|
}
|
|
3002
3021
|
}
|
|
3003
3022
|
}
|
|
@@ -3920,6 +3939,7 @@ class CatalogBuilder {
|
|
|
3920
3939
|
this.processorsReplace = false;
|
|
3921
3940
|
this.parser = void 0;
|
|
3922
3941
|
this.permissionRules = Object.values(permissionRules);
|
|
3942
|
+
this.allowedLocationType = ["url"];
|
|
3923
3943
|
}
|
|
3924
3944
|
static create(env) {
|
|
3925
3945
|
return new CatalogBuilder(env);
|
|
@@ -3986,6 +4006,10 @@ class CatalogBuilder {
|
|
|
3986
4006
|
addPermissionRules(...permissionRules) {
|
|
3987
4007
|
this.permissionRules.push(...permissionRules.flat());
|
|
3988
4008
|
}
|
|
4009
|
+
setAllowedLocationTypes(allowedLocationTypes) {
|
|
4010
|
+
this.allowedLocationType = allowedLocationTypes;
|
|
4011
|
+
return this;
|
|
4012
|
+
}
|
|
3989
4013
|
async build() {
|
|
3990
4014
|
var _a, _b;
|
|
3991
4015
|
const { config, database, logger, permissions } = this.env;
|
|
@@ -4071,7 +4095,9 @@ class CatalogBuilder {
|
|
|
4071
4095
|
);
|
|
4072
4096
|
const locationAnalyzer = (_b = this.locationAnalyzer) != null ? _b : new RepoLocationAnalyzer(logger, integrations);
|
|
4073
4097
|
const locationService = new AuthorizedLocationService(
|
|
4074
|
-
new DefaultLocationService(locationStore, orchestrator
|
|
4098
|
+
new DefaultLocationService(locationStore, orchestrator, {
|
|
4099
|
+
allowedLocationTypes: this.allowedLocationType
|
|
4100
|
+
}),
|
|
4075
4101
|
permissionEvaluator
|
|
4076
4102
|
);
|
|
4077
4103
|
const refreshService = new AuthorizedRefreshService(
|