@aristid/leav-types 1.4.1-396671ca → 1.4.1-95cadab0
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/apps/core/config/default.d.ts +1 -7
- package/apps/core/config/development.d.ts +0 -4
- package/apps/core/src/_types/config.d.ts +2 -5
- package/apps/core/src/domain/logsCollector/logsCollectorDomain.d.ts +3 -3
- package/apps/core/src/infra/{elasticSearch/elasticSearchService.d.ts → elasticsearch/elasticsearchService.d.ts} +4 -4
- package/apps/core/src/infra/elasticsearch/index.d.ts +1 -0
- package/apps/core/src/infra/log/logRepo.d.ts +3 -3
- package/libs/logger/src/config.d.ts +31 -2
- package/libs/logger/src/locationInfoFormatters.d.ts +0 -1
- package/package.json +1 -1
- package/apps/core/src/infra/elasticSearch/index.d.ts +0 -1
- /package/apps/core/src/infra/{elasticSearch/elasticSearchClient.d.ts → elasticsearch/elasticsearchClient.d.ts} +0 -0
|
@@ -90,12 +90,6 @@ export declare namespace lang {
|
|
|
90
90
|
let _default: string;
|
|
91
91
|
export { _default as default };
|
|
92
92
|
}
|
|
93
|
-
export declare namespace logs {
|
|
94
|
-
let level: string;
|
|
95
|
-
let transport: string;
|
|
96
|
-
let destinationFile: string;
|
|
97
|
-
let useJsonFormat: boolean;
|
|
98
|
-
}
|
|
99
93
|
export declare namespace permissions {
|
|
100
94
|
let _default_1: boolean;
|
|
101
95
|
export { _default_1 as default };
|
|
@@ -211,7 +205,7 @@ export declare namespace dbProfiler {
|
|
|
211
205
|
let enable_3: boolean;
|
|
212
206
|
export { enable_3 as enable };
|
|
213
207
|
}
|
|
214
|
-
export declare namespace
|
|
208
|
+
export declare namespace elasticsearch {
|
|
215
209
|
export let indexPrefix: string;
|
|
216
210
|
let url_2: string;
|
|
217
211
|
export { url_2 as url };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { type ILoggerConfig } from '@leav/logger';
|
|
2
1
|
import { type Options } from 'amqplib';
|
|
3
2
|
import { type IKeyValue } from './shared';
|
|
4
3
|
export interface IConfig {
|
|
@@ -10,7 +9,6 @@ export interface IConfig {
|
|
|
10
9
|
auth: IAuth;
|
|
11
10
|
mailer: IMailer;
|
|
12
11
|
lang: ILang;
|
|
13
|
-
logs: ILogs;
|
|
14
12
|
permissions: IPermissions;
|
|
15
13
|
amqp: IAmqp;
|
|
16
14
|
redis: IRedis;
|
|
@@ -29,7 +27,7 @@ export interface IConfig {
|
|
|
29
27
|
files: IFilesConfig;
|
|
30
28
|
dbProfiler: IDbProfilerConfig;
|
|
31
29
|
instanceId: string;
|
|
32
|
-
|
|
30
|
+
elasticsearch: IElasticsearchConfig;
|
|
33
31
|
logsCollector: ILogsCollector;
|
|
34
32
|
pluginsPath: string[];
|
|
35
33
|
bugsnag: IBugsnag;
|
|
@@ -109,7 +107,6 @@ export interface ILang {
|
|
|
109
107
|
available: string[];
|
|
110
108
|
default: string;
|
|
111
109
|
}
|
|
112
|
-
export type ILogs = ILoggerConfig;
|
|
113
110
|
export interface IPermissions {
|
|
114
111
|
default: boolean;
|
|
115
112
|
enableCache: boolean;
|
|
@@ -225,7 +222,7 @@ export interface IFilesConfig {
|
|
|
225
222
|
export interface IDbProfilerConfig {
|
|
226
223
|
enable: boolean;
|
|
227
224
|
}
|
|
228
|
-
export interface
|
|
225
|
+
export interface IElasticsearchConfig {
|
|
229
226
|
indexPrefix: string;
|
|
230
227
|
url: string;
|
|
231
228
|
ilmPolicyName: string;
|
|
@@ -2,7 +2,7 @@ import { type IAmqpService } from '@leav/message-broker';
|
|
|
2
2
|
import { type ILogger } from '@leav/logger';
|
|
3
3
|
import type * as Config from '_types/config';
|
|
4
4
|
import { type IIndexationService } from '../../infra/indexation/indexationService';
|
|
5
|
-
import { type
|
|
5
|
+
import { type IElasticsearchService } from '../../infra/elasticsearch/elasticsearchService';
|
|
6
6
|
export interface ILogsCollectorDomain {
|
|
7
7
|
init(): Promise<void>;
|
|
8
8
|
}
|
|
@@ -11,6 +11,6 @@ export interface ILogsCollectorDomainDeps {
|
|
|
11
11
|
'core.infra.amqpService': IAmqpService;
|
|
12
12
|
'core.infra.indexation.indexationService': IIndexationService;
|
|
13
13
|
'core.utils.logger': ILogger;
|
|
14
|
-
'core.infra.
|
|
14
|
+
'core.infra.elasticsearch.service': IElasticsearchService;
|
|
15
15
|
}
|
|
16
|
-
export default function ({ config, 'core.infra.amqpService': amqpService, 'core.infra.indexation.indexationService': indexationService, 'core.utils.logger': logger, 'core.infra.
|
|
16
|
+
export default function ({ config, 'core.infra.amqpService': amqpService, 'core.infra.indexation.indexationService': indexationService, 'core.utils.logger': logger, 'core.infra.elasticsearch.service': esService }: ILogsCollectorDomainDeps): ILogsCollectorDomain;
|
|
@@ -15,14 +15,14 @@ interface IElasticsearchServiceSearchParams {
|
|
|
15
15
|
};
|
|
16
16
|
query?: estypes.QueryDslQueryContainer;
|
|
17
17
|
}
|
|
18
|
-
export interface
|
|
18
|
+
export interface IElasticsearchService {
|
|
19
19
|
client: Client;
|
|
20
20
|
search: <T>(params: IElasticsearchServiceSearchParams) => Promise<IElasticsearchServiceSearchResponse<T>>;
|
|
21
21
|
writeData: (indexName: string, data: Log) => Promise<void>;
|
|
22
22
|
}
|
|
23
|
-
export interface
|
|
24
|
-
'core.infra.
|
|
23
|
+
export interface IElasticsearchServiceDeps {
|
|
24
|
+
'core.infra.elasticsearch.client'?: Client;
|
|
25
25
|
config?: IConfig;
|
|
26
26
|
}
|
|
27
|
-
export default function ({ config }:
|
|
27
|
+
export default function ({ config }: IElasticsearchServiceDeps): IElasticsearchService;
|
|
28
28
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as service } from './elasticsearchService';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type IElasticsearchService } from 'infra/elasticsearch/elasticsearchService';
|
|
2
2
|
import { type IConfig } from '_types/config';
|
|
3
3
|
import { type ILogFilters, type ILogPagination, type ILogResponse, type ILogSort } from '_types/log';
|
|
4
4
|
import { type IQueryInfos } from '_types/queryInfos';
|
|
@@ -10,8 +10,8 @@ export interface ILogRepo {
|
|
|
10
10
|
}, ctx: IQueryInfos): Promise<ILogResponse>;
|
|
11
11
|
}
|
|
12
12
|
interface IDeps {
|
|
13
|
-
'core.infra.
|
|
13
|
+
'core.infra.elasticsearch.service'?: IElasticsearchService;
|
|
14
14
|
config?: IConfig;
|
|
15
15
|
}
|
|
16
|
-
export default function ({ 'core.infra.
|
|
16
|
+
export default function ({ 'core.infra.elasticsearch.service': esService, config }: IDeps): ILogRepo;
|
|
17
17
|
export {};
|
|
@@ -3,7 +3,7 @@ export interface ILoggerConfig {
|
|
|
3
3
|
* Log level (error, warn, info, log, verbose, debug, silly)
|
|
4
4
|
* @default info
|
|
5
5
|
*/
|
|
6
|
-
level
|
|
6
|
+
level?: string;
|
|
7
7
|
/**
|
|
8
8
|
* If true, disable all logging
|
|
9
9
|
* Default: true if TS_JEST=1 (tests), false otherwise
|
|
@@ -18,7 +18,36 @@ export interface ILoggerConfig {
|
|
|
18
18
|
* Default: false (plain text)
|
|
19
19
|
*/
|
|
20
20
|
useJsonFormat?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* If true, add timestamp to each log line, ISO format
|
|
23
|
+
*/
|
|
24
|
+
addTimestamp?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* If true, add file and line number of the code that called the logger function (error, warn, info, debug, etc.)
|
|
27
|
+
*/
|
|
28
|
+
addLocationInfo?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Add those metadata to all logs
|
|
31
|
+
*/
|
|
32
|
+
additionalMeta?: {
|
|
33
|
+
/**
|
|
34
|
+
* any string to identify the application those logs came from
|
|
35
|
+
*/
|
|
36
|
+
app?: string;
|
|
37
|
+
/**
|
|
38
|
+
* any string to identify each client those logs came from
|
|
39
|
+
*/
|
|
40
|
+
client?: string;
|
|
41
|
+
/**
|
|
42
|
+
* environment, like production, development, test, integration
|
|
43
|
+
*/
|
|
44
|
+
env?: string;
|
|
45
|
+
/**
|
|
46
|
+
* application version, maybe semver format
|
|
47
|
+
*/
|
|
48
|
+
version?: string;
|
|
49
|
+
};
|
|
21
50
|
onErrorLog?: (message: string, meta: any) => void;
|
|
22
51
|
}
|
|
23
52
|
export declare function envToBool(value: string, defaultValue?: boolean): boolean;
|
|
24
|
-
export declare const defaultLoggerConfig: ILoggerConfig
|
|
53
|
+
export declare const defaultLoggerConfig: ILoggerConfig & Required<Omit<ILoggerConfig, 'onErrorLog'>>;
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as service } from './elasticSearchService';
|
|
File without changes
|