@lodestar/utils 1.2.2 → 1.3.0-dev.0564bc1581
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/bytes.d.ts +1 -1
- package/lib/logger/format.d.ts +1 -1
- package/lib/logger/interface.d.ts +5 -5
- package/lib/logger/json.d.ts +2 -2
- package/lib/logger/util.d.ts +1 -1
- package/lib/logger/util.js +1 -1
- package/lib/objects.d.ts +1 -1
- package/lib/retry.d.ts +2 -2
- package/lib/types.d.ts +1 -1
- package/package.json +2 -2
package/lib/bytes.d.ts
CHANGED
package/lib/logger/format.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import winston from "winston";
|
|
2
2
|
import { ILoggerOptions } from "./interface.js";
|
|
3
|
-
|
|
3
|
+
type Format = ReturnType<typeof winston.format.combine>;
|
|
4
4
|
export declare function getFormat(opts: ILoggerOptions): Format;
|
|
5
5
|
export {};
|
|
6
6
|
//# sourceMappingURL=format.d.ts.map
|
|
@@ -12,9 +12,9 @@ export declare const logLevelNum: {
|
|
|
12
12
|
};
|
|
13
13
|
export declare const LogLevels: LogLevel[];
|
|
14
14
|
export declare const defaultLogLevel = LogLevel.info;
|
|
15
|
-
export
|
|
15
|
+
export type LogFormat = "human" | "json";
|
|
16
16
|
export declare const logFormats: LogFormat[];
|
|
17
|
-
export
|
|
17
|
+
export type EpochSlotOpts = {
|
|
18
18
|
genesisTime: number;
|
|
19
19
|
secondsPerSlot: number;
|
|
20
20
|
slotsPerEpoch: number;
|
|
@@ -23,7 +23,7 @@ export declare enum TimestampFormatCode {
|
|
|
23
23
|
DateRegular = 0,
|
|
24
24
|
EpochSlot = 1
|
|
25
25
|
}
|
|
26
|
-
export
|
|
26
|
+
export type TimestampFormat = {
|
|
27
27
|
format: TimestampFormatCode.DateRegular;
|
|
28
28
|
} | ({
|
|
29
29
|
format: TimestampFormatCode.EpochSlot;
|
|
@@ -35,10 +35,10 @@ export interface ILoggerOptions {
|
|
|
35
35
|
hideTimestamp?: boolean;
|
|
36
36
|
timestampFormat?: TimestampFormat;
|
|
37
37
|
}
|
|
38
|
-
export
|
|
38
|
+
export type LoggerChildOpts = {
|
|
39
39
|
module: string;
|
|
40
40
|
};
|
|
41
|
-
export
|
|
41
|
+
export type LogHandler = (message: string, context?: LogData, error?: Error) => void;
|
|
42
42
|
export interface ILogger {
|
|
43
43
|
error: LogHandler;
|
|
44
44
|
warn: LogHandler;
|
package/lib/logger/json.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
1
|
+
type LogDataBasic = string | number | bigint | boolean | null | undefined;
|
|
2
|
+
export type LogData = LogDataBasic | Record<string, LogDataBasic> | LogDataBasic[] | Record<string, LogDataBasic>[];
|
|
3
3
|
/**
|
|
4
4
|
* Renders any log Context to JSON up to one level of depth.
|
|
5
5
|
*
|
package/lib/logger/util.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EpochSlotOpts } from "./interface.js";
|
|
2
2
|
/**
|
|
3
|
-
* Formats time as: `EPOCH/SLOT_INDEX SECONDS.
|
|
3
|
+
* Formats time as: `EPOCH/SLOT_INDEX SECONDS.MILLISECONDS
|
|
4
4
|
*/
|
|
5
5
|
export declare function formatEpochSlotTime(opts: EpochSlotOpts, now?: number): string;
|
|
6
6
|
//# sourceMappingURL=util.d.ts.map
|
package/lib/logger/util.js
CHANGED
package/lib/objects.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type KeyCase = "snake" | "constant" | "camel" | "param" | "header" | "pascal" | "dot" | "notransform";
|
|
2
2
|
export declare function toExpectedCase(value: string, expectedCase?: KeyCase, customCasingMap?: Record<string, string>): string;
|
|
3
3
|
export declare function isPlainObject(o: unknown): boolean;
|
|
4
4
|
/**
|
package/lib/retry.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type RetryOptions = {
|
|
2
2
|
/**
|
|
3
3
|
* The maximum amount of times to retry the operation. Default is 5
|
|
4
4
|
*/
|
|
@@ -10,7 +10,7 @@ export declare type RetryOptions = {
|
|
|
10
10
|
*/
|
|
11
11
|
shouldRetry?: (lastError: Error) => boolean;
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* Milliseconds to wait before retrying again
|
|
14
14
|
*/
|
|
15
15
|
retryDelay?: number;
|
|
16
16
|
};
|
package/lib/types.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Recursively make all properties optional
|
|
3
3
|
* From https://stackoverflow.com/questions/45372227/how-to-implement-typescript-deep-partial-mapped-type-not-breaking-array-properti/49936686#49936686
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
5
|
+
export type RecursivePartial<T> = {
|
|
6
6
|
[P in keyof T]?: T[P] extends (infer U)[] ? RecursivePartial<U>[] : T[P] extends Readonly<infer U>[] ? Readonly<RecursivePartial<U>>[] : RecursivePartial<T[P]>;
|
|
7
7
|
};
|
|
8
8
|
/** Type safe wrapper for Number constructor that takes 'any' */
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"bugs": {
|
|
12
12
|
"url": "https://github.com/ChainSafe/lodestar/issues"
|
|
13
13
|
},
|
|
14
|
-
"version": "1.
|
|
14
|
+
"version": "1.3.0-dev.0564bc1581",
|
|
15
15
|
"type": "module",
|
|
16
16
|
"exports": "./lib/index.js",
|
|
17
17
|
"files": [
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"beacon",
|
|
58
58
|
"blockchain"
|
|
59
59
|
],
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "75840d6850d475a30778ab25e577333cfd095e09"
|
|
61
61
|
}
|