Skip to content

Commit 41dc497

Browse files
chore: add missing typescript generic for endpoint handler
change output for gateway log driver
1 parent de95402 commit 41dc497

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/interfaces/services/i-abstract-microservice.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,15 @@ interface IEndpointOptions {
6666
sender?: string;
6767
}
6868

69-
interface IEndpointHandler<TParams = Record<string, any>, TPayload = Record<string, any>> {
69+
interface IEndpointHandler<
70+
TParams = Record<string, any>,
71+
TPayload = Record<string, any>,
72+
TResult = Record<string, any>,
73+
> {
7074
(
7175
params: NonNullable<IMicroserviceRequest<TParams, TPayload>['params']>,
7276
options: IEndpointOptions,
73-
): IMicroserviceResponseResult;
77+
): IMicroserviceResponseResult<TResult>;
7478
}
7579

7680
interface IEndpointHandlerOptions {

src/services/abstract-microservice.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,10 @@ abstract class AbstractMicroservice {
455455
throw error;
456456
} finally {
457457
this.logDriver(
458-
() => `${logPadding}<-- to ${sender}: ${response.toString() ?? 'async (notification?)'}`,
458+
() =>
459+
`${logPadding}<-- to ${isInternal ? 'client' : sender}: ${
460+
response.toString() ?? 'async (notification?)'
461+
}`,
459462
LogType.RES_EXTERNAL,
460463
request.getId(),
461464
);

0 commit comments

Comments
 (0)