@backstage/plugin-catalog-backend 1.21.0 → 1.21.1-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 +79 -0
- package/alpha/package.json +1 -1
- package/dist/alpha.cjs.js +1 -1
- package/dist/cjs/{CatalogBuilder-B30bgu7A.cjs.js → CatalogBuilder-WfXI1o7H.cjs.js} +30 -10
- package/dist/cjs/CatalogBuilder-WfXI1o7H.cjs.js.map +1 -0
- package/dist/index.cjs.js +2 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/package.json +15 -14
- package/dist/cjs/CatalogBuilder-B30bgu7A.cjs.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,84 @@
|
|
|
1
1
|
# @backstage/plugin-catalog-backend
|
|
2
2
|
|
|
3
|
+
## 1.21.1-next.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- c52f7ac: Make entity collection errors a little quieter in the logs.
|
|
8
|
+
|
|
9
|
+
Instead of logging a warning line when an entity has an error
|
|
10
|
+
during processing, it will now instead emit an event on the event
|
|
11
|
+
broker.
|
|
12
|
+
|
|
13
|
+
This only removes a single log line, however it is possible to
|
|
14
|
+
add the log line back if it is required by subscribing to the
|
|
15
|
+
`CATALOG_ERRORS_TOPIC` as shown below.
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
env.eventBroker.subscribe({
|
|
19
|
+
supportsEventTopics(): string[] {
|
|
20
|
+
return [CATALOG_ERRORS_TOPIC];
|
|
21
|
+
},
|
|
22
|
+
|
|
23
|
+
async onEvent(
|
|
24
|
+
params: EventParams<{
|
|
25
|
+
entity: string;
|
|
26
|
+
location?: string;
|
|
27
|
+
errors: Array<Error>;
|
|
28
|
+
}>,
|
|
29
|
+
): Promise<void> {
|
|
30
|
+
const { entity, location, errors } = params.eventPayload;
|
|
31
|
+
for (const error of errors) {
|
|
32
|
+
env.logger.warn(error.message, {
|
|
33
|
+
entity,
|
|
34
|
+
location,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
- Updated dependencies
|
|
42
|
+
- @backstage/backend-common@0.21.7-next.1
|
|
43
|
+
- @backstage/backend-plugin-api@0.6.17-next.1
|
|
44
|
+
- @backstage/catalog-client@1.6.4-next.0
|
|
45
|
+
- @backstage/backend-tasks@0.5.22-next.1
|
|
46
|
+
- @backstage/plugin-events-node@0.3.3-next.1
|
|
47
|
+
- @backstage/plugin-permission-node@0.7.28-next.1
|
|
48
|
+
- @backstage/plugin-search-backend-module-catalog@0.1.22-next.1
|
|
49
|
+
- @backstage/backend-openapi-utils@0.1.10-next.1
|
|
50
|
+
- @backstage/catalog-model@1.4.5
|
|
51
|
+
- @backstage/config@1.2.0
|
|
52
|
+
- @backstage/errors@1.2.4
|
|
53
|
+
- @backstage/integration@1.10.0-next.0
|
|
54
|
+
- @backstage/types@1.1.1
|
|
55
|
+
- @backstage/plugin-catalog-common@1.0.22
|
|
56
|
+
- @backstage/plugin-catalog-node@1.11.1-next.1
|
|
57
|
+
- @backstage/plugin-permission-common@0.7.13
|
|
58
|
+
|
|
59
|
+
## 1.21.1-next.0
|
|
60
|
+
|
|
61
|
+
### Patch Changes
|
|
62
|
+
|
|
63
|
+
- cfdc5e7: Fixes an issue where `/analyze-location` would incorrectly throw a 500 error on an invalid url.
|
|
64
|
+
- Updated dependencies
|
|
65
|
+
- @backstage/backend-common@0.21.7-next.0
|
|
66
|
+
- @backstage/integration@1.10.0-next.0
|
|
67
|
+
- @backstage/backend-openapi-utils@0.1.10-next.0
|
|
68
|
+
- @backstage/backend-plugin-api@0.6.17-next.0
|
|
69
|
+
- @backstage/backend-tasks@0.5.22-next.0
|
|
70
|
+
- @backstage/catalog-client@1.6.3
|
|
71
|
+
- @backstage/catalog-model@1.4.5
|
|
72
|
+
- @backstage/config@1.2.0
|
|
73
|
+
- @backstage/errors@1.2.4
|
|
74
|
+
- @backstage/types@1.1.1
|
|
75
|
+
- @backstage/plugin-catalog-common@1.0.22
|
|
76
|
+
- @backstage/plugin-catalog-node@1.11.1-next.0
|
|
77
|
+
- @backstage/plugin-events-node@0.3.3-next.0
|
|
78
|
+
- @backstage/plugin-permission-common@0.7.13
|
|
79
|
+
- @backstage/plugin-permission-node@0.7.28-next.0
|
|
80
|
+
- @backstage/plugin-search-backend-module-catalog@0.1.22-next.0
|
|
81
|
+
|
|
3
82
|
## 1.21.0
|
|
4
83
|
|
|
5
84
|
### Minor Changes
|
package/alpha/package.json
CHANGED
package/dist/alpha.cjs.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var alpha = require('@backstage/plugin-catalog-common/alpha');
|
|
6
6
|
var pluginPermissionNode = require('@backstage/plugin-permission-node');
|
|
7
|
-
var CatalogBuilder = require('./cjs/CatalogBuilder-
|
|
7
|
+
var CatalogBuilder = require('./cjs/CatalogBuilder-WfXI1o7H.cjs.js');
|
|
8
8
|
var backendPluginApi = require('@backstage/backend-plugin-api');
|
|
9
9
|
var alpha$1 = require('@backstage/plugin-catalog-node/alpha');
|
|
10
10
|
var backendCommon = require('@backstage/backend-common');
|
|
@@ -1267,6 +1267,7 @@ function generateStableHash$1(entity) {
|
|
|
1267
1267
|
}
|
|
1268
1268
|
|
|
1269
1269
|
const CATALOG_CONFLICTS_TOPIC = "experimental.catalog.conflict";
|
|
1270
|
+
const CATALOG_ERRORS_TOPIC = "experimental.catalog.errors";
|
|
1270
1271
|
|
|
1271
1272
|
const BATCH_SIZE$2 = 50;
|
|
1272
1273
|
class DefaultProcessingDatabase {
|
|
@@ -1785,6 +1786,7 @@ class DefaultCatalogProcessingEngine {
|
|
|
1785
1786
|
__publicField$8(this, "orphanCleanupIntervalMs");
|
|
1786
1787
|
__publicField$8(this, "onProcessingError");
|
|
1787
1788
|
__publicField$8(this, "tracker");
|
|
1789
|
+
__publicField$8(this, "eventBroker");
|
|
1788
1790
|
__publicField$8(this, "stopFunc");
|
|
1789
1791
|
var _a, _b, _c;
|
|
1790
1792
|
this.config = options.config;
|
|
@@ -1799,6 +1801,7 @@ class DefaultCatalogProcessingEngine {
|
|
|
1799
1801
|
this.orphanCleanupIntervalMs = (_b = options.orphanCleanupIntervalMs) != null ? _b : 3e4;
|
|
1800
1802
|
this.onProcessingError = options.onProcessingError;
|
|
1801
1803
|
this.tracker = (_c = options.tracker) != null ? _c : progressTracker$1();
|
|
1804
|
+
this.eventBroker = options.eventBroker;
|
|
1802
1805
|
this.stopFunc = void 0;
|
|
1803
1806
|
}
|
|
1804
1807
|
async start() {
|
|
@@ -1840,7 +1843,7 @@ class DefaultCatalogProcessingEngine {
|
|
|
1840
1843
|
},
|
|
1841
1844
|
processTask: async (item) => {
|
|
1842
1845
|
await withActiveSpan(tracer$1, "ProcessingRun", async (span) => {
|
|
1843
|
-
var _a, _b;
|
|
1846
|
+
var _a, _b, _c;
|
|
1844
1847
|
const track = this.tracker.processStart(item, this.logger);
|
|
1845
1848
|
addEntityAttributes(span, item.unprocessedEntity);
|
|
1846
1849
|
try {
|
|
@@ -1881,10 +1884,14 @@ class DefaultCatalogProcessingEngine {
|
|
|
1881
1884
|
});
|
|
1882
1885
|
}
|
|
1883
1886
|
const location = (_b = (_a = unprocessedEntity == null ? void 0 : unprocessedEntity.metadata) == null ? void 0 : _a.annotations) == null ? void 0 : _b[catalogModel.ANNOTATION_LOCATION];
|
|
1884
|
-
|
|
1885
|
-
this.
|
|
1886
|
-
|
|
1887
|
-
|
|
1887
|
+
if (result.errors.length) {
|
|
1888
|
+
(_c = this.eventBroker) == null ? void 0 : _c.publish({
|
|
1889
|
+
topic: CATALOG_ERRORS_TOPIC,
|
|
1890
|
+
eventPayload: {
|
|
1891
|
+
entity: entityRef,
|
|
1892
|
+
location,
|
|
1893
|
+
errors: result.errors
|
|
1894
|
+
}
|
|
1888
1895
|
});
|
|
1889
1896
|
}
|
|
1890
1897
|
const errorsString = JSON.stringify(
|
|
@@ -5423,7 +5430,7 @@ const spec = {
|
|
|
5423
5430
|
"400": {
|
|
5424
5431
|
description: "Validation errors.",
|
|
5425
5432
|
content: {
|
|
5426
|
-
"application/json
|
|
5433
|
+
"application/json": {
|
|
5427
5434
|
schema: {
|
|
5428
5435
|
type: "object",
|
|
5429
5436
|
properties: {
|
|
@@ -5690,8 +5697,19 @@ async function createRouter(options) {
|
|
|
5690
5697
|
location: locationInput,
|
|
5691
5698
|
catalogFilename: zod.z.string().optional()
|
|
5692
5699
|
});
|
|
5693
|
-
const
|
|
5694
|
-
|
|
5700
|
+
const parsedBody = schema.parse(body);
|
|
5701
|
+
try {
|
|
5702
|
+
const output = await locationAnalyzer.analyzeLocation(parsedBody);
|
|
5703
|
+
res.status(200).json(output);
|
|
5704
|
+
} catch (err) {
|
|
5705
|
+
if (
|
|
5706
|
+
// Catch errors from parse-url library.
|
|
5707
|
+
err.name === "Error" && "subject_url" in err
|
|
5708
|
+
) {
|
|
5709
|
+
throw new errors.InputError("The given location.target is not a URL");
|
|
5710
|
+
}
|
|
5711
|
+
throw err;
|
|
5712
|
+
}
|
|
5695
5713
|
});
|
|
5696
5714
|
}
|
|
5697
5715
|
if (orchestrator) {
|
|
@@ -7156,7 +7174,8 @@ class CatalogBuilder {
|
|
|
7156
7174
|
onProcessingError: (event) => {
|
|
7157
7175
|
var _a2;
|
|
7158
7176
|
(_a2 = this.onProcessingError) == null ? void 0 : _a2.call(this, event);
|
|
7159
|
-
}
|
|
7177
|
+
},
|
|
7178
|
+
eventBroker: this.eventBroker
|
|
7160
7179
|
});
|
|
7161
7180
|
const locationAnalyzer = (_b = this.locationAnalyzer) != null ? _b : new RepoLocationAnalyzer(logger, integrations, this.locationAnalyzers);
|
|
7162
7181
|
const locationService = new AuthorizedLocationService(
|
|
@@ -7363,6 +7382,7 @@ class CatalogBuilder {
|
|
|
7363
7382
|
exports.AnnotateLocationEntityProcessor = AnnotateLocationEntityProcessor;
|
|
7364
7383
|
exports.BuiltinKindsEntityProcessor = BuiltinKindsEntityProcessor;
|
|
7365
7384
|
exports.CATALOG_CONFLICTS_TOPIC = CATALOG_CONFLICTS_TOPIC;
|
|
7385
|
+
exports.CATALOG_ERRORS_TOPIC = CATALOG_ERRORS_TOPIC;
|
|
7366
7386
|
exports.CatalogBuilder = CatalogBuilder;
|
|
7367
7387
|
exports.CodeOwnersProcessor = CodeOwnersProcessor;
|
|
7368
7388
|
exports.FileReaderProcessor = FileReaderProcessor;
|
|
@@ -7372,4 +7392,4 @@ exports.createCatalogPermissionRule = createCatalogPermissionRule;
|
|
|
7372
7392
|
exports.createRandomProcessingInterval = createRandomProcessingInterval;
|
|
7373
7393
|
exports.parseEntityYaml = parseEntityYaml;
|
|
7374
7394
|
exports.permissionRules = permissionRules;
|
|
7375
|
-
//# sourceMappingURL=CatalogBuilder-
|
|
7395
|
+
//# sourceMappingURL=CatalogBuilder-WfXI1o7H.cjs.js.map
|