@backstage/plugin-catalog-backend 1.3.1 → 1.3.2-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 +19 -0
- package/alpha/package.json +1 -1
- package/dist/index.cjs.js +22 -7
- package/dist/index.cjs.js.map +1 -1
- package/package.json +17 -17
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @backstage/plugin-catalog-backend
|
|
2
2
|
|
|
3
|
+
## 1.3.2-next.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 243533ecdc: Added support to mysql on some raw queries
|
|
8
|
+
- bf5e9030eb: Updated dependency `msw` to `^0.45.0`.
|
|
9
|
+
- 62788b2ee8: The experimental `CatalogProcessingExtensionPoint` now accepts multiple providers and processors at once.
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
- @backstage/backend-common@0.15.1-next.0
|
|
12
|
+
- @backstage/backend-plugin-api@0.1.2-next.0
|
|
13
|
+
- @backstage/catalog-client@1.0.5-next.0
|
|
14
|
+
- @backstage/integration@1.3.1-next.0
|
|
15
|
+
- @backstage/plugin-permission-common@0.6.4-next.0
|
|
16
|
+
- @backstage/plugin-permission-node@0.6.5-next.0
|
|
17
|
+
- @backstage/plugin-scaffolder-common@1.2.0-next.0
|
|
18
|
+
- @backstage/plugin-catalog-node@1.0.2-next.0
|
|
19
|
+
- @backstage/plugin-catalog-common@1.0.6-next.0
|
|
20
|
+
- @backstage/plugin-search-common@1.0.1-next.0
|
|
21
|
+
|
|
3
22
|
## 1.3.1
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
package/alpha/package.json
CHANGED
package/dist/index.cjs.js
CHANGED
|
@@ -1506,7 +1506,7 @@ class DefaultProcessingDatabase {
|
|
|
1506
1506
|
sourceEntityRef
|
|
1507
1507
|
});
|
|
1508
1508
|
let previousRelationRows;
|
|
1509
|
-
if (tx.client.config.client.includes("sqlite3")) {
|
|
1509
|
+
if (tx.client.config.client.includes("sqlite3") || tx.client.config.client.includes("mysql")) {
|
|
1510
1510
|
previousRelationRows = await tx("relations").select("*").where({ originating_entity_id: id });
|
|
1511
1511
|
await tx("relations").where({ originating_entity_id: id }).delete();
|
|
1512
1512
|
} else {
|
|
@@ -1558,6 +1558,12 @@ class DefaultProcessingDatabase {
|
|
|
1558
1558
|
const { toAdd, toUpsert, toRemove } = await this.createDelta(tx, options);
|
|
1559
1559
|
if (toRemove.length) {
|
|
1560
1560
|
let removedCount = 0;
|
|
1561
|
+
const rootId = () => {
|
|
1562
|
+
if (tx.client.config.client.includes("mysql")) {
|
|
1563
|
+
return tx.raw("CAST(NULL as UNSIGNED INT)", []);
|
|
1564
|
+
}
|
|
1565
|
+
return tx.raw("CAST(NULL as INT)", []);
|
|
1566
|
+
};
|
|
1561
1567
|
for (const refs of lodash__default["default"].chunk(toRemove, 1e3)) {
|
|
1562
1568
|
removedCount += await tx("refresh_state").whereIn("entity_ref", function orphanedEntityRefs(orphans) {
|
|
1563
1569
|
return orphans.withRecursive("descendants", function descendants(outer) {
|
|
@@ -1571,7 +1577,7 @@ class DefaultProcessingDatabase {
|
|
|
1571
1577
|
});
|
|
1572
1578
|
}).withRecursive("ancestors", function ancestors(outer) {
|
|
1573
1579
|
return outer.select({
|
|
1574
|
-
root_id:
|
|
1580
|
+
root_id: rootId(),
|
|
1575
1581
|
via_entity_ref: "entity_ref",
|
|
1576
1582
|
to_entity_ref: "entity_ref"
|
|
1577
1583
|
}).from("descendants").union(function recursive(inner) {
|
|
@@ -1695,11 +1701,20 @@ class DefaultProcessingDatabase {
|
|
|
1695
1701
|
}
|
|
1696
1702
|
const items = await itemsQuery.where("next_update_at", "<=", tx.fn.now()).limit(request.processBatchSize).orderBy("next_update_at", "asc");
|
|
1697
1703
|
const interval = this.options.refreshInterval();
|
|
1704
|
+
const nextUpdateAt = (refreshInterval) => {
|
|
1705
|
+
if (tx.client.config.client.includes("sqlite3")) {
|
|
1706
|
+
return tx.raw(`datetime('now', ?)`, [`${refreshInterval} seconds`]);
|
|
1707
|
+
}
|
|
1708
|
+
if (tx.client.config.client.includes("mysql")) {
|
|
1709
|
+
return tx.raw(`now() + interval ${refreshInterval} second`);
|
|
1710
|
+
}
|
|
1711
|
+
return tx.raw(`now() + interval '${refreshInterval} seconds'`);
|
|
1712
|
+
};
|
|
1698
1713
|
await tx("refresh_state").whereIn(
|
|
1699
1714
|
"entity_ref",
|
|
1700
1715
|
items.map((i) => i.entity_ref)
|
|
1701
1716
|
).update({
|
|
1702
|
-
next_update_at:
|
|
1717
|
+
next_update_at: nextUpdateAt(interval)
|
|
1703
1718
|
});
|
|
1704
1719
|
return {
|
|
1705
1720
|
items: items.map(
|
|
@@ -4234,11 +4249,11 @@ class CatalogExtensionPointImpl {
|
|
|
4234
4249
|
__privateAdd(this, _processors, new Array());
|
|
4235
4250
|
__privateAdd(this, _entityProviders, new Array());
|
|
4236
4251
|
}
|
|
4237
|
-
addProcessor(
|
|
4238
|
-
__privateGet(this, _processors).push(
|
|
4252
|
+
addProcessor(...processors) {
|
|
4253
|
+
__privateGet(this, _processors).push(...processors.flat());
|
|
4239
4254
|
}
|
|
4240
|
-
addEntityProvider(
|
|
4241
|
-
__privateGet(this, _entityProviders).push(
|
|
4255
|
+
addEntityProvider(...providers) {
|
|
4256
|
+
__privateGet(this, _entityProviders).push(...providers.flat());
|
|
4242
4257
|
}
|
|
4243
4258
|
get processors() {
|
|
4244
4259
|
return __privateGet(this, _processors);
|