From 708ff4761a26d76466f5ce6a91f7d163f6c571a9 Mon Sep 17 00:00:00 2001 From: Harry Hogg Date: Mon, 3 Oct 2022 13:05:16 +0100 Subject: [PATCH] Explicitly type optional parameters so the definitions are accurate Signed-off-by: Harry Hogg --- .../src/permissions/rules/createPropertyRule.ts | 5 ++++- .../catalog-backend/src/permissions/rules/hasAnnotation.ts | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/plugins/catalog-backend/src/permissions/rules/createPropertyRule.ts b/plugins/catalog-backend/src/permissions/rules/createPropertyRule.ts index da487c112c..9ea67ec0b2 100644 --- a/plugins/catalog-backend/src/permissions/rules/createPropertyRule.ts +++ b/plugins/catalog-backend/src/permissions/rules/createPropertyRule.ts @@ -20,7 +20,10 @@ import { createCatalogPermissionRule } from './util'; import { z } from 'zod'; export const createPropertyRule = (propertyType: 'metadata' | 'spec') => - createCatalogPermissionRule({ + createCatalogPermissionRule<{ + key: string; + value?: string; + }>({ name: `HAS_${propertyType.toUpperCase()}`, description: `Allow entities which have the specified ${propertyType} subfield.`, resourceType: RESOURCE_TYPE_CATALOG_ENTITY, diff --git a/plugins/catalog-backend/src/permissions/rules/hasAnnotation.ts b/plugins/catalog-backend/src/permissions/rules/hasAnnotation.ts index 9651e9d925..28c99e39a1 100644 --- a/plugins/catalog-backend/src/permissions/rules/hasAnnotation.ts +++ b/plugins/catalog-backend/src/permissions/rules/hasAnnotation.ts @@ -26,7 +26,10 @@ import { createCatalogPermissionRule } from './util'; * * @alpha */ -export const hasAnnotation = createCatalogPermissionRule({ +export const hasAnnotation = createCatalogPermissionRule<{ + annotation: string; + value?: string; +}>({ name: 'HAS_ANNOTATION', description: 'Allow entities which are annotated with the specified annotation',