@backstage/plugin-catalog-backend 1.4.0 → 1.4.1-next.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 +23 -0
- package/alpha/package.json +1 -1
- package/dist/index.cjs.js +22 -8
- package/dist/index.cjs.js.map +1 -1
- package/package.json +20 -21
- package/LICENSE +0 -201
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @backstage/plugin-catalog-backend
|
|
2
2
|
|
|
3
|
+
## 1.4.1-next.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 8cb6e10105: Fixed a bug where entities provided without a location key would always replace existing entities, rather than updating them.
|
|
8
|
+
- 63296ebcd4: Allow Placeholder value to be any value, not only string.
|
|
9
|
+
- 74022e0163: Make sure to stitch entities correctly after deletion, to ensure that their relations are updated.
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
- @backstage/catalog-model@1.1.2-next.0
|
|
12
|
+
- @backstage/backend-plugin-api@0.1.3-next.0
|
|
13
|
+
- @backstage/catalog-client@1.1.1-next.0
|
|
14
|
+
- @backstage/plugin-catalog-node@1.1.1-next.0
|
|
15
|
+
- @backstage/plugin-scaffolder-common@1.2.1-next.0
|
|
16
|
+
- @backstage/backend-common@0.15.2-next.0
|
|
17
|
+
- @backstage/plugin-permission-node@0.6.6-next.0
|
|
18
|
+
- @backstage/config@1.0.3-next.0
|
|
19
|
+
- @backstage/errors@1.1.2-next.0
|
|
20
|
+
- @backstage/integration@1.3.2-next.0
|
|
21
|
+
- @backstage/types@1.0.0
|
|
22
|
+
- @backstage/plugin-catalog-common@1.0.7-next.0
|
|
23
|
+
- @backstage/plugin-permission-common@0.6.5-next.0
|
|
24
|
+
- @backstage/plugin-search-common@1.0.2-next.0
|
|
25
|
+
|
|
3
26
|
## 1.4.0
|
|
4
27
|
|
|
5
28
|
### Minor Changes
|
package/alpha/package.json
CHANGED
package/dist/index.cjs.js
CHANGED
|
@@ -608,7 +608,7 @@ class PlaceholderProcessor {
|
|
|
608
608
|
const resolverKey = keys[0].substr(1);
|
|
609
609
|
const resolverValue = data[keys[0]];
|
|
610
610
|
const resolver = this.options.resolvers[resolverKey];
|
|
611
|
-
if (!resolver
|
|
611
|
+
if (!resolver) {
|
|
612
612
|
return [data, false];
|
|
613
613
|
}
|
|
614
614
|
const read = async (url) => {
|
|
@@ -1872,6 +1872,7 @@ class DefaultProcessingDatabase {
|
|
|
1872
1872
|
);
|
|
1873
1873
|
}
|
|
1874
1874
|
async createDelta(tx, options) {
|
|
1875
|
+
var _a, _b;
|
|
1875
1876
|
if (options.type === "delta") {
|
|
1876
1877
|
return {
|
|
1877
1878
|
toAdd: [],
|
|
@@ -1914,7 +1915,7 @@ class DefaultProcessingDatabase {
|
|
|
1914
1915
|
const upsertItem = { deferred: item.deferred, hash: item.hash };
|
|
1915
1916
|
if (!oldRef) {
|
|
1916
1917
|
toAdd.push(upsertItem);
|
|
1917
|
-
} else if (oldRef.locationKey !== item.deferred.locationKey) {
|
|
1918
|
+
} else if (((_a = oldRef == null ? void 0 : oldRef.locationKey) != null ? _a : void 0) !== ((_b = item.deferred.locationKey) != null ? _b : void 0)) {
|
|
1918
1919
|
toRemove.push(item.ref);
|
|
1919
1920
|
toAdd.push(upsertItem);
|
|
1920
1921
|
} else if (oldRef.oldEntityHash !== item.hash) {
|
|
@@ -2032,7 +2033,7 @@ function startTaskPipeline(options) {
|
|
|
2032
2033
|
|
|
2033
2034
|
const CACHE_TTL = 5;
|
|
2034
2035
|
class DefaultCatalogProcessingEngine {
|
|
2035
|
-
constructor(logger, processingDatabase, orchestrator, stitcher, createHash, pollingIntervalMs = 1e3, onProcessingError) {
|
|
2036
|
+
constructor(logger, processingDatabase, orchestrator, stitcher, createHash, pollingIntervalMs = 1e3, onProcessingError, tracker = progressTracker()) {
|
|
2036
2037
|
this.logger = logger;
|
|
2037
2038
|
this.processingDatabase = processingDatabase;
|
|
2038
2039
|
this.orchestrator = orchestrator;
|
|
@@ -2040,7 +2041,7 @@ class DefaultCatalogProcessingEngine {
|
|
|
2040
2041
|
this.createHash = createHash;
|
|
2041
2042
|
this.pollingIntervalMs = pollingIntervalMs;
|
|
2042
2043
|
this.onProcessingError = onProcessingError;
|
|
2043
|
-
this.tracker =
|
|
2044
|
+
this.tracker = tracker;
|
|
2044
2045
|
}
|
|
2045
2046
|
async start() {
|
|
2046
2047
|
if (this.stopFunc) {
|
|
@@ -2443,8 +2444,9 @@ function parseFilter(filter, query, db, negate = false) {
|
|
|
2443
2444
|
});
|
|
2444
2445
|
}
|
|
2445
2446
|
class DefaultEntitiesCatalog {
|
|
2446
|
-
constructor(database) {
|
|
2447
|
+
constructor(database, stitcher) {
|
|
2447
2448
|
this.database = database;
|
|
2449
|
+
this.stitcher = stitcher;
|
|
2448
2450
|
}
|
|
2449
2451
|
async entities(request) {
|
|
2450
2452
|
const db = this.database;
|
|
@@ -2496,13 +2498,22 @@ class DefaultEntitiesCatalog {
|
|
|
2496
2498
|
}
|
|
2497
2499
|
async removeEntityByUid(uid) {
|
|
2498
2500
|
await this.database("refresh_state").update({
|
|
2499
|
-
result_hash: "child-was-deleted"
|
|
2501
|
+
result_hash: "child-was-deleted",
|
|
2502
|
+
next_update_at: this.database.fn.now()
|
|
2500
2503
|
}).whereIn("entity_ref", function parents(builder) {
|
|
2501
2504
|
return builder.from("refresh_state").innerJoin("refresh_state_references", {
|
|
2502
2505
|
"refresh_state_references.target_entity_ref": "refresh_state.entity_ref"
|
|
2503
2506
|
}).where("refresh_state.entity_id", "=", uid).select("refresh_state_references.source_entity_ref");
|
|
2504
2507
|
});
|
|
2508
|
+
const relationPeers = await this.database.from("relations").innerJoin("refresh_state", {
|
|
2509
|
+
"refresh_state.entity_ref": "relations.target_entity_ref"
|
|
2510
|
+
}).where("relations.originating_entity_id", "=", uid).andWhere("refresh_state.entity_id", "!=", uid).select({ ref: "relations.target_entity_ref" }).union(
|
|
2511
|
+
(other) => other.from("relations").innerJoin("refresh_state", {
|
|
2512
|
+
"refresh_state.entity_ref": "relations.source_entity_ref"
|
|
2513
|
+
}).where("relations.originating_entity_id", "=", uid).andWhere("refresh_state.entity_id", "!=", uid).select({ ref: "relations.source_entity_ref" })
|
|
2514
|
+
);
|
|
2505
2515
|
await this.database("refresh_state").where("entity_id", uid).delete();
|
|
2516
|
+
await this.stitcher.stitch(new Set(relationPeers.map((p) => p.ref)));
|
|
2506
2517
|
}
|
|
2507
2518
|
async entityAncestry(rootRef) {
|
|
2508
2519
|
const [rootRow] = await this.database("refresh_state").leftJoin("final_entities", {
|
|
@@ -4050,7 +4061,11 @@ class CatalogBuilder {
|
|
|
4050
4061
|
parser,
|
|
4051
4062
|
policy
|
|
4052
4063
|
});
|
|
4053
|
-
const
|
|
4064
|
+
const stitcher = new Stitcher(dbClient, logger);
|
|
4065
|
+
const unauthorizedEntitiesCatalog = new DefaultEntitiesCatalog(
|
|
4066
|
+
dbClient,
|
|
4067
|
+
stitcher
|
|
4068
|
+
);
|
|
4054
4069
|
let permissionEvaluator;
|
|
4055
4070
|
if ("authorizeConditional" in permissions) {
|
|
4056
4071
|
permissionEvaluator = permissions;
|
|
@@ -4088,7 +4103,6 @@ class CatalogBuilder {
|
|
|
4088
4103
|
permissions: pluginCatalogCommon.catalogPermissions,
|
|
4089
4104
|
rules: this.permissionRules
|
|
4090
4105
|
});
|
|
4091
|
-
const stitcher = new Stitcher(dbClient, logger);
|
|
4092
4106
|
const locationStore = new DefaultLocationStore(dbClient);
|
|
4093
4107
|
const configLocationProvider = new ConfigLocationEntityProvider(config);
|
|
4094
4108
|
const entityProviders = lodash__default["default"].uniqBy(
|