@backstage/plugin-catalog-backend 1.1.1 → 1.1.2-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 CHANGED
@@ -1,10 +1,42 @@
1
1
  # @backstage/plugin-catalog-backend
2
2
 
3
- ## 1.1.1
3
+ ## 1.1.2-next.2
4
4
 
5
5
  ### Patch Changes
6
6
 
7
- - 777f2125ac: Fixed issue in `PermissionEvaluator` instance check that would cause unexpected "invalid union" errors.
7
+ - 16a40ac4c0: Fix wrong return type of the `isGroupEntity` function.
8
+ - 2909746147: Updated parseEntityTransformParams to handle keys with '.' in them. This will allow for querying of entities based off annotations such as 'backstage.io/orgin-location' or other entity field keys that have '.' in them.
9
+ - Updated dependencies
10
+ - @backstage/backend-common@0.13.3-next.2
11
+ - @backstage/plugin-scaffolder-common@1.1.0-next.0
12
+ - @backstage/config@1.0.1-next.0
13
+ - @backstage/plugin-search-common@0.3.4-next.0
14
+ - @backstage/catalog-model@1.0.2-next.0
15
+ - @backstage/integration@1.2.0-next.1
16
+ - @backstage/plugin-permission-common@0.6.1-next.0
17
+ - @backstage/plugin-permission-node@0.6.1-next.1
18
+ - @backstage/catalog-client@1.0.2-next.0
19
+ - @backstage/plugin-catalog-common@1.0.2-next.0
20
+
21
+ ## 1.1.2-next.1
22
+
23
+ ### Patch Changes
24
+
25
+ - 1ccbe081cc: Minor internal tweak to support TypeScript 4.6
26
+ - Updated dependencies
27
+ - @backstage/backend-common@0.13.3-next.1
28
+
29
+ ## 1.1.2-next.0
30
+
31
+ ### Patch Changes
32
+
33
+ - 55e09b29dd: Fixing broken types for `knex` when checking returned rows
34
+ - cfc0f19699: Updated dependency `fs-extra` to `10.1.0`.
35
+ - 8cc75993a6: Fixed issue in `PermissionEvaluator` instance check that would cause unexpected "invalid union" errors.
36
+ - Updated dependencies
37
+ - @backstage/backend-common@0.13.3-next.0
38
+ - @backstage/integration@1.2.0-next.0
39
+ - @backstage/plugin-permission-node@0.6.1-next.0
8
40
 
9
41
  ## 1.1.0
10
42
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-catalog-backend",
3
- "version": "1.1.1",
3
+ "version": "1.1.2-next.2",
4
4
  "main": "../dist/index.cjs.js",
5
5
  "types": "../dist/index.alpha.d.ts"
6
6
  }
package/dist/index.cjs.js CHANGED
@@ -2079,11 +2079,11 @@ class DefaultEntitiesCatalog {
2079
2079
  }
2080
2080
  async entities(request) {
2081
2081
  const db = this.database;
2082
- let entitiesQuery = db("final_entities");
2082
+ let entitiesQuery = db("final_entities").select("final_entities.*");
2083
2083
  if (request == null ? void 0 : request.filter) {
2084
2084
  entitiesQuery = parseFilter(request.filter, entitiesQuery, db);
2085
2085
  }
2086
- entitiesQuery = entitiesQuery.select("final_entities.*").whereNotNull("final_entities.final_entity").orderBy("entity_id", "asc");
2086
+ entitiesQuery = entitiesQuery.whereNotNull("final_entities.final_entity").orderBy("entity_id", "asc");
2087
2087
  const { limit, offset } = parsePagination(request == null ? void 0 : request.pagination);
2088
2088
  if (limit !== void 0) {
2089
2089
  entitiesQuery = entitiesQuery.limit(limit + 1);
@@ -2703,11 +2703,11 @@ class Stitcher {
2703
2703
  entity.metadata.etag = hash;
2704
2704
  }
2705
2705
  const searchEntries = buildEntitySearch(entityId, entity);
2706
- const rowsChanged = await this.database("final_entities").update({
2706
+ const amountOfRowsChanged = await this.database("final_entities").update({
2707
2707
  final_entity: JSON.stringify(entity),
2708
2708
  hash
2709
2709
  }).where("entity_id", entityId).where("stitch_ticket", ticket).onConflict("entity_id").merge(["final_entity", "hash"]);
2710
- if (rowsChanged.length === 0) {
2710
+ if (amountOfRowsChanged === 0) {
2711
2711
  this.logger.debug(`Entity ${entityRef} is already processed, skipping write.`);
2712
2712
  return;
2713
2713
  }
@@ -2815,6 +2815,17 @@ function parseEntityPaginationParams(params) {
2815
2815
  };
2816
2816
  }
2817
2817
 
2818
+ function getPathArrayAndValue(input, field) {
2819
+ return field.split(".").reduce(([pathArray, inputSubset], pathPart, index, fieldParts) => {
2820
+ if (lodash__default["default"].hasIn(inputSubset, pathPart)) {
2821
+ return [pathArray.concat(pathPart), inputSubset[pathPart]];
2822
+ } else if (fieldParts[index + 1] !== void 0) {
2823
+ fieldParts[index + 1] = `${pathPart}.${fieldParts[index + 1]}`;
2824
+ return [pathArray, inputSubset];
2825
+ }
2826
+ return [pathArray, void 0];
2827
+ }, [[], input]);
2828
+ }
2818
2829
  function parseEntityTransformParams(params) {
2819
2830
  const fieldsStrings = parseStringsParam(params.fields, "fields");
2820
2831
  if (!fieldsStrings) {
@@ -2830,9 +2841,9 @@ function parseEntityTransformParams(params) {
2830
2841
  return (input) => {
2831
2842
  const output = {};
2832
2843
  for (const field of fields) {
2833
- const value = lodash__default["default"].get(input, field);
2844
+ const [pathArray, value] = getPathArrayAndValue(input, field);
2834
2845
  if (value !== void 0) {
2835
- lodash__default["default"].set(output, field, value);
2846
+ lodash__default["default"].set(output, pathArray, value);
2836
2847
  }
2837
2848
  }
2838
2849
  return output;