@backstage/plugin-catalog-backend 1.9.1-next.0 → 1.9.1-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 +26 -0
- package/alpha/package.json +1 -1
- package/dist/alpha.cjs.js +1 -1
- package/dist/cjs/{CatalogBuilder-ecfd2db6.cjs.js → CatalogBuilder-77581d41.cjs.js} +42 -43
- package/dist/cjs/CatalogBuilder-77581d41.cjs.js.map +1 -0
- package/dist/index.cjs.js +1 -1
- package/package.json +11 -11
- package/dist/cjs/CatalogBuilder-ecfd2db6.cjs.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @backstage/plugin-catalog-backend
|
|
2
2
|
|
|
3
|
+
## 1.9.1-next.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- ce8d203235b: Ensure that entity cache state is only written to the database when actually changed
|
|
8
|
+
- 485a6c5f7b5: Internal refactoring for performance in the service handlers
|
|
9
|
+
- 3587a968dcd: Fixed a bug in the `queryEntities` endpoint that was causing filtered entities to be included in cursor requests.
|
|
10
|
+
- 12a345317ab: Remove unnecessary join in the entity facets endpoint, exclude nulls
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
- @backstage/plugin-scaffolder-common@1.3.0-next.0
|
|
13
|
+
- @backstage/config@1.0.7
|
|
14
|
+
|
|
15
|
+
## 1.9.1-next.1
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- 27956d78671: Adjusted the OpenAPI schema file name according to the new structure
|
|
20
|
+
- Updated dependencies
|
|
21
|
+
- @backstage/backend-common@0.18.5-next.1
|
|
22
|
+
- @backstage/backend-tasks@0.5.2-next.1
|
|
23
|
+
- @backstage/plugin-catalog-node@1.3.6-next.1
|
|
24
|
+
- @backstage/plugin-permission-node@0.7.8-next.1
|
|
25
|
+
- @backstage/plugin-search-backend-module-catalog@0.1.1-next.1
|
|
26
|
+
- @backstage/backend-plugin-api@0.5.2-next.1
|
|
27
|
+
- @backstage/config@1.0.7
|
|
28
|
+
|
|
3
29
|
## 1.9.1-next.0
|
|
4
30
|
|
|
5
31
|
### Patch 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-77581d41.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');
|
|
@@ -1563,7 +1563,8 @@ class DefaultCatalogProcessingEngine {
|
|
|
1563
1563
|
});
|
|
1564
1564
|
track.markProcessorsCompleted(result);
|
|
1565
1565
|
if (result.ok) {
|
|
1566
|
-
|
|
1566
|
+
const { ttl: _, ...stateWithoutTtl } = state != null ? state : {};
|
|
1567
|
+
if (stableStringify__default["default"](stateWithoutTtl) !== stableStringify__default["default"](result.state)) {
|
|
1567
1568
|
await this.processingDatabase.transaction(async (tx) => {
|
|
1568
1569
|
await this.processingDatabase.updateEntityCache(tx, {
|
|
1569
1570
|
id,
|
|
@@ -2018,46 +2019,45 @@ function parsePagination(input) {
|
|
|
2018
2019
|
return {};
|
|
2019
2020
|
}
|
|
2020
2021
|
let { limit, offset } = input;
|
|
2021
|
-
if (input.after
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2022
|
+
if (input.after === void 0) {
|
|
2023
|
+
return { limit, offset };
|
|
2024
|
+
}
|
|
2025
|
+
let cursor;
|
|
2026
|
+
try {
|
|
2027
|
+
const json = Buffer.from(input.after, "base64").toString("utf8");
|
|
2028
|
+
cursor = JSON.parse(json);
|
|
2029
|
+
} catch {
|
|
2030
|
+
throw new errors.InputError("Malformed after cursor, could not be parsed");
|
|
2031
|
+
}
|
|
2032
|
+
if (cursor.limit !== void 0) {
|
|
2033
|
+
if (!Number.isInteger(cursor.limit)) {
|
|
2034
|
+
throw new errors.InputError("Malformed after cursor, limit was not an number");
|
|
2034
2035
|
}
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2036
|
+
limit = cursor.limit;
|
|
2037
|
+
}
|
|
2038
|
+
if (cursor.offset !== void 0) {
|
|
2039
|
+
if (!Number.isInteger(cursor.offset)) {
|
|
2040
|
+
throw new errors.InputError("Malformed after cursor, offset was not a number");
|
|
2040
2041
|
}
|
|
2042
|
+
offset = cursor.offset;
|
|
2041
2043
|
}
|
|
2042
2044
|
return { limit, offset };
|
|
2043
2045
|
}
|
|
2044
2046
|
function stringifyPagination(input) {
|
|
2045
|
-
const
|
|
2047
|
+
const { limit, offset } = input;
|
|
2048
|
+
const json = JSON.stringify({ limit, offset });
|
|
2046
2049
|
const base64 = Buffer.from(json, "utf8").toString("base64");
|
|
2047
2050
|
return base64;
|
|
2048
2051
|
}
|
|
2049
2052
|
function addCondition(queryBuilder, db, filter, negate = false, entityIdField = "entity_id") {
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
filter.values.map((v) => v.toLowerCase())
|
|
2059
|
-
);
|
|
2060
|
-
}
|
|
2053
|
+
var _a;
|
|
2054
|
+
const key = filter.key.toLowerCase();
|
|
2055
|
+
const values = (_a = filter.values) == null ? void 0 : _a.map((v) => v.toLowerCase());
|
|
2056
|
+
const matchQuery = db("search").select("search.entity_id").where({ key }).andWhere(function keyFilter() {
|
|
2057
|
+
if ((values == null ? void 0 : values.length) === 1) {
|
|
2058
|
+
this.where({ value: values.at(0) });
|
|
2059
|
+
} else if (values) {
|
|
2060
|
+
this.andWhere("value", "in", values);
|
|
2061
2061
|
}
|
|
2062
2062
|
});
|
|
2063
2063
|
queryBuilder.andWhere(entityIdField, negate ? "not in" : "in", matchQuery);
|
|
@@ -2072,14 +2072,14 @@ function isNegationEntityFilter(filter) {
|
|
|
2072
2072
|
return filter.hasOwnProperty("not");
|
|
2073
2073
|
}
|
|
2074
2074
|
function parseFilter(filter, query, db, negate = false, entityIdField = "entity_id") {
|
|
2075
|
+
if (isNegationEntityFilter(filter)) {
|
|
2076
|
+
return parseFilter(filter.not, query, db, !negate, entityIdField);
|
|
2077
|
+
}
|
|
2075
2078
|
if (isEntitiesSearchFilter(filter)) {
|
|
2076
2079
|
return query.andWhere(function filterFunction() {
|
|
2077
2080
|
addCondition(this, db, filter, negate, entityIdField);
|
|
2078
2081
|
});
|
|
2079
2082
|
}
|
|
2080
|
-
if (isNegationEntityFilter(filter)) {
|
|
2081
|
-
return parseFilter(filter.not, query, db, !negate, entityIdField);
|
|
2082
|
-
}
|
|
2083
2083
|
return query[negate ? "andWhereNot" : "andWhere"](function filterFunction() {
|
|
2084
2084
|
var _a, _b;
|
|
2085
2085
|
if (isOrEntityFilter(filter)) {
|
|
@@ -2256,13 +2256,12 @@ class DefaultEntitiesCatalog {
|
|
|
2256
2256
|
const countQuery = dbQuery.clone();
|
|
2257
2257
|
const isOrderingDescending = sortField.order === "desc";
|
|
2258
2258
|
if (prevItemOrderFieldValue) {
|
|
2259
|
-
dbQuery.andWhere(
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
this.where("value", "=", prevItemOrderFieldValue).andWhere(
|
|
2259
|
+
dbQuery.andWhere(function nested() {
|
|
2260
|
+
this.where(
|
|
2261
|
+
"value",
|
|
2262
|
+
isFetchingBackwards !== isOrderingDescending ? "<" : ">",
|
|
2263
|
+
prevItemOrderFieldValue
|
|
2264
|
+
).orWhere("value", "=", prevItemOrderFieldValue).andWhere(
|
|
2266
2265
|
"search.entity_id",
|
|
2267
2266
|
isFetchingBackwards !== isOrderingDescending ? "<" : ">",
|
|
2268
2267
|
prevItemUid
|
|
@@ -2416,7 +2415,7 @@ class DefaultEntitiesCatalog {
|
|
|
2416
2415
|
const facets = {};
|
|
2417
2416
|
const db = this.database;
|
|
2418
2417
|
for (const facet of request.facets) {
|
|
2419
|
-
const dbQuery = db("search").
|
|
2418
|
+
const dbQuery = db("search").where("search.key", facet.toLocaleLowerCase("en-US")).whereNotNull("search.original_value").select({ value: "search.original_value", count: db.raw("count(*)") }).groupBy("search.original_value");
|
|
2420
2419
|
if (request == null ? void 0 : request.filter) {
|
|
2421
2420
|
parseFilter(request.filter, dbQuery, db, false, "search.entity_id");
|
|
2422
2421
|
}
|
|
@@ -5056,4 +5055,4 @@ exports.createCatalogPermissionRule = createCatalogPermissionRule;
|
|
|
5056
5055
|
exports.createRandomProcessingInterval = createRandomProcessingInterval;
|
|
5057
5056
|
exports.parseEntityYaml = parseEntityYaml;
|
|
5058
5057
|
exports.permissionRules = permissionRules;
|
|
5059
|
-
//# sourceMappingURL=CatalogBuilder-
|
|
5058
|
+
//# sourceMappingURL=CatalogBuilder-77581d41.cjs.js.map
|