diff --git a/plugins/audit-log-common/package.json b/plugins/audit-log-common/package.json index a265adf7ea..04389502bb 100644 --- a/plugins/audit-log-common/package.json +++ b/plugins/audit-log-common/package.json @@ -46,6 +46,7 @@ "dependencies": { "@backstage/backend-plugin-api": "^0.6.17", "@backstage/errors": "^1.2.4", + "@backstage/types": "^1.1.1", "express": "^4.19.2" } } diff --git a/plugins/audit-log-common/src/DefaultAuditLogger.ts b/plugins/audit-log-common/src/DefaultAuditLogger.ts index 7af403ffb7..dd2ab79b6c 100644 --- a/plugins/audit-log-common/src/DefaultAuditLogger.ts +++ b/plugins/audit-log-common/src/DefaultAuditLogger.ts @@ -114,12 +114,7 @@ export class DefaultAuditLogger implements AuditLogger { response: options.response, metadata: options.metadata, }); - /** - * FIXME: yarn tsc is currently complaining about the following: - * Property 'meta' is incompatible with index signature. - * Type 'Record' is not assignable to type 'JsonValue | undefined'. - * Type 'Record' is missing the following properties from type 'JsonValue[]': length, pop, push, concat, and 35 more.ts - */ + this.logger.info(options.message, auditLogDetails); } @@ -138,12 +133,6 @@ export class DefaultAuditLogger implements AuditLogger { metadata: options.metadata, }); - /** - * FIXME: yarn tsc is currently complaining about the following: - * Property 'meta' is incompatible with index signature. - * Type 'Record' is not assignable to type 'JsonValue | undefined'. - * Type 'Record' is missing the following properties from type 'JsonValue[]': length, pop, push, concat, and 35 more.ts - */ this.logger.error(options.message, auditLogDetails); } } diff --git a/plugins/audit-log-common/src/types.ts b/plugins/audit-log-common/src/types.ts index ec8c35d101..c5a3633d09 100644 --- a/plugins/audit-log-common/src/types.ts +++ b/plugins/audit-log-common/src/types.ts @@ -4,6 +4,7 @@ import { LoggerService, } from '@backstage/backend-plugin-api'; import { ErrorLike } from '@backstage/errors'; +import { JsonValue } from '@backstage/types'; import { Request } from 'express'; @@ -49,7 +50,7 @@ export type AuditLogDetails = { stage: string; request?: AuditRequest; response?: AuditResponse; - meta: Record; + meta: JsonValue; isAuditLog: true; } & AuditLogStatus; @@ -66,7 +67,7 @@ export type AuditActorOptions = export type AuditLogDetailsOptions = { eventName: string; stage: string; - metadata?: Record; + metadata?: JsonValue; response?: AuditResponse; } & AuditActorOptions & ({ status: 'succeeded' } | { status: 'failed'; errors: unknown[] }); @@ -75,7 +76,7 @@ export type AuditLogOptions = { eventName: string; message: string; stage: string; - metadata?: Record; + metadata?: JsonValue; response?: AuditResponse; } & AuditActorOptions;