@backstage/plugin-catalog-backend 1.1.0-next.3 → 1.1.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 CHANGED
@@ -1,5 +1,80 @@
1
1
  # @backstage/plugin-catalog-backend
2
2
 
3
+ ## 1.1.2-next.0
4
+
5
+ ### Patch Changes
6
+
7
+ - 55e09b29dd: Fixing broken types for `knex` when checking returned rows
8
+ - cfc0f19699: Updated dependency `fs-extra` to `10.1.0`.
9
+ - 8cc75993a6: Fixed issue in `PermissionEvaluator` instance check that would cause unexpected "invalid union" errors.
10
+ - Updated dependencies
11
+ - @backstage/backend-common@0.13.3-next.0
12
+ - @backstage/integration@1.2.0-next.0
13
+ - @backstage/plugin-permission-node@0.6.1-next.0
14
+
15
+ ## 1.1.0
16
+
17
+ ### Minor Changes
18
+
19
+ - 8012ac46a0: **BREAKING (alpha api):** Replace `createCatalogPolicyDecision` export with `createCatalogConditionalDecision`, which accepts a permission parameter of type `ResourcePermission<'catalog-entity'>` along with conditions. The permission passed is expected to be the handled permission in `PermissionPolicy#handle`, whose type must first be narrowed using methods like `isPermission` and `isResourcePermission`:
20
+
21
+ ```typescript
22
+ class TestPermissionPolicy implements PermissionPolicy {
23
+ async handle(
24
+ request: PolicyQuery<Permission>,
25
+ _user?: BackstageIdentityResponse,
26
+ ): Promise<PolicyDecision> {
27
+ if (
28
+ // Narrow type of `request.permission` to `ResourcePermission<'catalog-entity'>
29
+ isResourcePermission(request.permission, RESOURCE_TYPE_CATALOG_ENTITY)
30
+ ) {
31
+ return createCatalogConditionalDecision(
32
+ request.permission,
33
+ catalogConditions.isEntityOwner(
34
+ _user?.identity.ownershipEntityRefs ?? [],
35
+ ),
36
+ );
37
+ }
38
+
39
+ return {
40
+ result: AuthorizeResult.ALLOW,
41
+ };
42
+ ```
43
+
44
+ - 8012ac46a0: **BREAKING:** Mark CatalogBuilder#addPermissionRules as @alpha.
45
+ - fb02d2d94d: export `locationSpecToLocationEntity`
46
+ - bf82edf4c9: Added `/validate-entity` endpoint
47
+
48
+ ### Patch Changes
49
+
50
+ - ada4446733: Specify type of `visibilityPermission` property on collators and collator factories.
51
+ - 1691c6c5c2: Clarify that config locations that emit User and Group kinds now need to declare so in the `catalog.locations.[].rules`
52
+ - 8592cacfd3: Fixed an issue where sometimes entities would have stale relations "stuck" and
53
+ not getting removed as expected, after the other end of the relation had stopped
54
+ referring to them.
55
+ - 23646e51a5: Use new `PermissionEvaluator#authorizeConditional` method when retrieving permission conditions.
56
+ - 9fe24b0fc8: Adjust the error messages when entities fail validation, to clearly state what entity that failed it
57
+ - 48405ed232: Added `spec.profile.displayName` to search index for Group kinds
58
+ - 95408dbe99: Enable internal batching of very large deletions, to not run into SQL binding limits
59
+ - 8012ac46a0: Handle changes to @alpha permission-related types.
60
+
61
+ - All exported permission rules and conditions now have a `resourceType`.
62
+ - `createCatalogConditionalDecision` now expects supplied conditions to have the appropriate `resourceType`.
63
+ - `createCatalogPermissionRule` now expects `resourceType` as part of the supplied rule object.
64
+ - Introduce new `CatalogPermissionRule` convenience type.
65
+
66
+ - ffec894ed0: add gitlab to AnnotateScmSlugEntityProcessor
67
+ - Updated dependencies
68
+ - @backstage/integration@1.1.0
69
+ - @backstage/plugin-permission-common@0.6.0
70
+ - @backstage/plugin-permission-node@0.6.0
71
+ - @backstage/catalog-model@1.0.1
72
+ - @backstage/plugin-search-common@0.3.3
73
+ - @backstage/backend-common@0.13.2
74
+ - @backstage/plugin-catalog-common@1.0.1
75
+ - @backstage/catalog-client@1.0.1
76
+ - @backstage/plugin-scaffolder-common@1.0.1
77
+
3
78
  ## 1.1.0-next.3
4
79
 
5
80
  ### Patch Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-catalog-backend",
3
- "version": "1.1.0-next.3",
3
+ "version": "1.1.2-next.0",
4
4
  "main": "../dist/index.cjs.js",
5
5
  "types": "../dist/index.alpha.d.ts"
6
6
  }
package/dist/index.cjs.js CHANGED
@@ -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
  }
@@ -3475,7 +3475,7 @@ class CatalogBuilder {
3475
3475
  });
3476
3476
  const unauthorizedEntitiesCatalog = new DefaultEntitiesCatalog(dbClient);
3477
3477
  let permissionEvaluator;
3478
- if ("query" in permissions) {
3478
+ if ("authorizeConditional" in permissions) {
3479
3479
  permissionEvaluator = permissions;
3480
3480
  } else {
3481
3481
  logger.warn("PermissionAuthorizer is deprecated. Please use an instance of PermissionEvaluator instead of PermissionAuthorizer in PluginEnvironment#permissions");