Skip to content

Commit

Permalink
chore: fix tsc errors
Browse files Browse the repository at this point in the history
Signed-off-by: Frank Kong <frkong@redhat.com>
  • Loading branch information
Zaperex committed May 10, 2024
1 parent db77af4 commit 1ca413d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 15 deletions.
1 change: 1 addition & 0 deletions plugins/audit-log-common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
13 changes: 1 addition & 12 deletions plugins/audit-log-common/src/DefaultAuditLogger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<PropertyKey, unknown>' is not assignable to type 'JsonValue | undefined'.
* Type 'Record<PropertyKey, unknown>' is missing the following properties from type 'JsonValue[]': length, pop, push, concat, and 35 more.ts
*/

this.logger.info(options.message, auditLogDetails);
}

Expand All @@ -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<PropertyKey, unknown>' is not assignable to type 'JsonValue | undefined'.
* Type 'Record<PropertyKey, unknown>' is missing the following properties from type 'JsonValue[]': length, pop, push, concat, and 35 more.ts
*/
this.logger.error(options.message, auditLogDetails);
}
}
7 changes: 4 additions & 3 deletions plugins/audit-log-common/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -49,7 +50,7 @@ export type AuditLogDetails = {
stage: string;
request?: AuditRequest;
response?: AuditResponse;
meta: Record<PropertyKey, unknown>;
meta: JsonValue;
isAuditLog: true;
} & AuditLogStatus;

Expand All @@ -66,7 +67,7 @@ export type AuditActorOptions =
export type AuditLogDetailsOptions = {
eventName: string;
stage: string;
metadata?: Record<PropertyKey, unknown>;
metadata?: JsonValue;
response?: AuditResponse;
} & AuditActorOptions &
({ status: 'succeeded' } | { status: 'failed'; errors: unknown[] });
Expand All @@ -75,7 +76,7 @@ export type AuditLogOptions = {
eventName: string;
message: string;
stage: string;
metadata?: Record<PropertyKey, unknown>;
metadata?: JsonValue;
response?: AuditResponse;
} & AuditActorOptions;

Expand Down

0 comments on commit 1ca413d

Please sign in to comment.