@backstage/plugin-catalog-backend 1.3.1-next.0 → 1.3.1

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,42 @@
1
1
  # @backstage/plugin-catalog-backend
2
2
 
3
+ ## 1.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 56e1b4b89c: Fixed typos in alpha types.
8
+ - e3d3018531: Fix issue for conditional decisions based on properties stored as arrays, like tags.
9
+
10
+ Before this change, having a permission policy returning conditional decisions based on metadata like tags, such like `createCatalogConditionalDecision(permission, catalogConditions.hasMetadata('tags', 'java'),)`, was producing wrong results. The issue occurred when authorizing entities already loaded from the database, for example when authorizing `catalogEntityDeletePermission`.
11
+
12
+ - 059ae348b4: Use the non-deprecated form of table.unique in knex
13
+ - Updated dependencies
14
+ - @backstage/backend-common@0.15.0
15
+ - @backstage/backend-plugin-api@0.1.1
16
+ - @backstage/plugin-catalog-node@1.0.1
17
+ - @backstage/integration@1.3.0
18
+ - @backstage/plugin-catalog-common@1.0.5
19
+ - @backstage/plugin-permission-node@0.6.4
20
+
21
+ ## 1.3.1-next.2
22
+
23
+ ### Patch Changes
24
+
25
+ - 059ae348b4: Use the non-deprecated form of table.unique in knex
26
+
27
+ ## 1.3.1-next.1
28
+
29
+ ### Patch Changes
30
+
31
+ - e3d3018531: Fix issue for conditional decisions based on properties stored as arrays, like tags.
32
+
33
+ Before this change, having a permission policy returning conditional decisions based on metadata like tags, such like `createCatalogConditionalDecision(permission, catalogConditions.hasMetadata('tags', 'java'),)`, was producing wrong results. The issue occurred when authorizing entities already loaded from the database, for example when authorizing `catalogEntityDeletePermission`.
34
+
35
+ - Updated dependencies
36
+ - @backstage/plugin-catalog-common@1.0.5-next.0
37
+ - @backstage/backend-common@0.15.0-next.1
38
+ - @backstage/integration@1.3.0-next.1
39
+
3
40
  ## 1.3.1-next.0
4
41
 
5
42
  ### Patch Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-catalog-backend",
3
- "version": "1.3.1-next.0",
3
+ "version": "1.3.1",
4
4
  "main": "../dist/index.cjs.js",
5
5
  "types": "../dist/index.alpha.d.ts"
6
6
  }
@@ -6,7 +6,7 @@
6
6
 
7
7
  /// <reference types="node" />
8
8
 
9
- import { BackendRegistrable } from '@backstage/backend-plugin-api';
9
+ import { BackendFeature } from '@backstage/backend-plugin-api';
10
10
  import { CatalogApi } from '@backstage/catalog-client';
11
11
  import { CatalogEntityDocument } from '@backstage/plugin-catalog-common';
12
12
  import { CatalogProcessor } from '@backstage/plugin-catalog-node';
@@ -349,7 +349,7 @@ export declare type CatalogPermissionRule<TParams extends unknown[] = unknown[]>
349
349
  * Catalog plugin
350
350
  * @alpha
351
351
  */
352
- export declare const catalogPlugin: (option: unknown) => BackendRegistrable;
352
+ export declare const catalogPlugin: (options?: unknown) => BackendFeature;
353
353
 
354
354
  /** @public */
355
355
  export declare interface CatalogProcessingEngine {
@@ -6,7 +6,7 @@
6
6
 
7
7
  /// <reference types="node" />
8
8
 
9
- import { BackendRegistrable } from '@backstage/backend-plugin-api';
9
+ import { BackendFeature } from '@backstage/backend-plugin-api';
10
10
  import { CatalogApi } from '@backstage/catalog-client';
11
11
  import { CatalogEntityDocument } from '@backstage/plugin-catalog-common';
12
12
  import { CatalogProcessor } from '@backstage/plugin-catalog-node';
package/dist/index.cjs.js CHANGED
@@ -886,6 +886,12 @@ const createPropertyRule = (propertyType) => createCatalogPermissionRule({
886
886
  resourceType: pluginCatalogCommon.RESOURCE_TYPE_CATALOG_ENTITY,
887
887
  apply: (resource, key, value) => {
888
888
  const foundValue = lodash.get(resource[propertyType], key);
889
+ if (Array.isArray(foundValue)) {
890
+ if (value !== void 0) {
891
+ return foundValue.includes(value);
892
+ }
893
+ return foundValue.length > 0;
894
+ }
889
895
  if (value !== void 0) {
890
896
  return value === foundValue;
891
897
  }
@@ -4026,6 +4032,7 @@ class CatalogBuilder {
4026
4032
  (resourceRef) => entitiesByRef[catalogModel.stringifyEntityRef(catalogModel.parseEntityRef(resourceRef))]
4027
4033
  );
4028
4034
  },
4035
+ permissions: pluginCatalogCommon.catalogPermissions,
4029
4036
  rules: this.permissionRules
4030
4037
  });
4031
4038
  const stitcher = new Stitcher(dbClient, logger);
@@ -4247,7 +4254,7 @@ const catalogPlugin = backendPluginApi.createBackendPlugin({
4247
4254
  register(env) {
4248
4255
  const processingExtensions = new CatalogExtensionPointImpl();
4249
4256
  env.registerExtensionPoint(
4250
- pluginCatalogNode.catalogProcessingExtentionPoint,
4257
+ pluginCatalogNode.catalogProcessingExtensionPoint,
4251
4258
  processingExtensions
4252
4259
  );
4253
4260
  env.registerInit({