Skip to content

Commit 667ae6c

Browse files
committed
chore: clean up and fix signatures
1 parent 452ad79 commit 667ae6c

File tree

3 files changed

+12
-16
lines changed

3 files changed

+12
-16
lines changed

packages/logger/src/Logger.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { Utility, isNullOrUndefined } from '@aws-lambda-powertools/commons';
44
import type {
55
AsyncHandler,
66
HandlerMethodDecorator,
7+
JSONObject,
78
SyncHandler,
89
} from '@aws-lambda-powertools/commons/types';
910
import type { Context, Handler } from 'aws-lambda';
@@ -218,7 +219,7 @@ class Logger extends Utility implements LoggerInterface {
218219
/**
219220
* Search function for the correlation ID.
220221
*/
221-
#correlationIdSearchFn?: (expression: string, data: unknown) => unknown;
222+
#correlationIdSearchFn?: (expression: string, data: JSONObject) => unknown;
222223

223224
/**
224225
* The debug sampling rate configuration.
@@ -1455,9 +1456,9 @@ class Logger extends Utility implements LoggerInterface {
14551456
* @param correlationIdPath - The path to the correlation ID in the event object
14561457
* @param event - The event object
14571458
*/
1458-
protected setCorrelationIdFromPath(
1459+
public setCorrelationIdFromPath(
14591460
correlationIdPath: string,
1460-
event: unknown
1461+
event: JSONObject
14611462
): void {
14621463
if (!this.#correlationIdSearchFn) {
14631464
this.warn(

packages/logger/src/middleware/middy.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { LOGGER_KEY } from '@aws-lambda-powertools/commons';
22
import type {
3+
JSONObject,
34
MiddlewareLikeObj,
45
MiddyLikeRequest,
56
} from '@aws-lambda-powertools/commons/types';
@@ -99,7 +100,7 @@ const injectLambdaContext = (
99100
if (options?.correlationIdPath) {
100101
logger.setCorrelationIdFromPath(
101102
options.correlationIdPath,
102-
request.event
103+
request.event as JSONObject
103104
);
104105
}
105106
}

packages/logger/src/types/index.ts

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,12 @@
11
export type {
2-
Environment,
3-
LogAttributes,
4-
LogLevel,
5-
LogItemMessage,
6-
LogItemExtraInput,
72
ConstructorOptions,
8-
InjectLambdaContextOptions,
93
CustomJsonReplacerFn,
4+
Environment,
5+
InjectLambdaContextOptions,
6+
LogAttributes,
107
LoggerInterface,
8+
LogItemExtraInput,
9+
LogItemMessage,
10+
LogLevel,
1111
} from './Logger.js';
1212
export type { UnformattedAttributes } from './logKeys.js';
13-
export type {
14-
JSONPrimitive,
15-
JSONObject,
16-
JSONArray,
17-
JSONValue,
18-
} from './json.js';

0 commit comments

Comments
 (0)