@aristid/leav-types 1.4.1-79a6219c → 1.4.1-8dd5ba55
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 +21 -8
- package/apps/core/config/development.d.ts +0 -4
- package/apps/core/src/_types/config.d.ts +14 -3
- package/apps/core/src/_types/forms.d.ts +2 -2
- package/apps/core/src/_types/notification.d.ts +51 -0
- package/apps/core/src/domain/export/exportDomain.d.ts +3 -1
- package/apps/core/src/domain/notification/channels/emailChannel.d.ts +6 -0
- package/apps/core/src/domain/notification/channels/webSocketChannel.d.ts +6 -0
- package/apps/core/src/domain/notification/index.d.ts +3 -0
- package/apps/core/src/domain/notification/notificationDomain.d.ts +12 -0
- package/apps/core/src/domain/value/valueDomain.d.ts +0 -5
- package/libs/logger/src/LoggerCallStack.d.ts +14 -0
- package/libs/logger/src/catchErrorFormatter.d.ts +2 -0
- package/libs/logger/src/config.d.ts +32 -3
- package/libs/logger/src/locationInfoFormatter.d.ts +2 -0
- package/libs/message-broker/src/amqpService.d.ts +2 -2
- package/libs/message-broker/src/types/amqp.d.ts +1 -1
- package/package.json +1 -1
- package/libs/logger/src/locationInfoFormatters.d.ts +0 -10
|
@@ -63,6 +63,12 @@ export declare namespace mailer {
|
|
|
63
63
|
export { port_1 as port };
|
|
64
64
|
let secure_1: boolean;
|
|
65
65
|
export { secure_1 as secure };
|
|
66
|
+
export namespace from {
|
|
67
|
+
let name_1: string;
|
|
68
|
+
export { name_1 as name };
|
|
69
|
+
let email_2: string;
|
|
70
|
+
export { email_2 as email };
|
|
71
|
+
}
|
|
66
72
|
export namespace auth_1 {
|
|
67
73
|
export let user: string;
|
|
68
74
|
let password_1: string;
|
|
@@ -90,12 +96,6 @@ export declare namespace lang {
|
|
|
90
96
|
let _default: string;
|
|
91
97
|
export { _default as default };
|
|
92
98
|
}
|
|
93
|
-
export declare namespace logs {
|
|
94
|
-
let level: string;
|
|
95
|
-
let transport: string;
|
|
96
|
-
let destinationFile: string;
|
|
97
|
-
let useJsonFormat: boolean;
|
|
98
|
-
}
|
|
99
99
|
export declare namespace permissions {
|
|
100
100
|
let _default_1: boolean;
|
|
101
101
|
export { _default_1 as default };
|
|
@@ -200,6 +200,19 @@ export declare namespace preview {
|
|
|
200
200
|
let directory_3: string;
|
|
201
201
|
export { directory_3 as directory };
|
|
202
202
|
}
|
|
203
|
+
export declare namespace notification {
|
|
204
|
+
let enable_3: boolean;
|
|
205
|
+
export { enable_3 as enable };
|
|
206
|
+
export namespace email_3 {
|
|
207
|
+
let enable_4: boolean;
|
|
208
|
+
export { enable_4 as enable };
|
|
209
|
+
}
|
|
210
|
+
export { email_3 as email };
|
|
211
|
+
export namespace webSocket {
|
|
212
|
+
let enable_5: boolean;
|
|
213
|
+
export { enable_5 as enable };
|
|
214
|
+
}
|
|
215
|
+
}
|
|
203
216
|
export declare namespace applications {
|
|
204
217
|
let rootFolder: string;
|
|
205
218
|
}
|
|
@@ -208,8 +221,8 @@ export declare namespace files {
|
|
|
208
221
|
let originalsPathPrefix: string;
|
|
209
222
|
}
|
|
210
223
|
export declare namespace dbProfiler {
|
|
211
|
-
let
|
|
212
|
-
export {
|
|
224
|
+
let enable_6: boolean;
|
|
225
|
+
export { enable_6 as enable };
|
|
213
226
|
}
|
|
214
227
|
export declare namespace elasticsearch {
|
|
215
228
|
export let indexPrefix: string;
|
|
@@ -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;
|
|
@@ -18,6 +16,7 @@ export interface IConfig {
|
|
|
18
16
|
indexationManager: IIndexationManager;
|
|
19
17
|
tasksManager: ITasksManager;
|
|
20
18
|
eventsManager: IEventsManager;
|
|
19
|
+
notification: INotificationConfig;
|
|
21
20
|
debug?: boolean;
|
|
22
21
|
env?: string;
|
|
23
22
|
defaultUserId: string;
|
|
@@ -100,6 +99,10 @@ export interface IMailer {
|
|
|
100
99
|
host: string;
|
|
101
100
|
port: number;
|
|
102
101
|
secure: boolean;
|
|
102
|
+
from: {
|
|
103
|
+
name: string;
|
|
104
|
+
email: string;
|
|
105
|
+
};
|
|
103
106
|
auth: {
|
|
104
107
|
user: string;
|
|
105
108
|
password: string;
|
|
@@ -109,7 +112,6 @@ export interface ILang {
|
|
|
109
112
|
available: string[];
|
|
110
113
|
default: string;
|
|
111
114
|
}
|
|
112
|
-
export type ILogs = ILoggerConfig;
|
|
113
115
|
export interface IPermissions {
|
|
114
116
|
default: boolean;
|
|
115
117
|
enableCache: boolean;
|
|
@@ -225,6 +227,15 @@ export interface IFilesConfig {
|
|
|
225
227
|
export interface IDbProfilerConfig {
|
|
226
228
|
enable: boolean;
|
|
227
229
|
}
|
|
230
|
+
export interface INotificationConfig {
|
|
231
|
+
enable: boolean;
|
|
232
|
+
email: {
|
|
233
|
+
enable: boolean;
|
|
234
|
+
};
|
|
235
|
+
webSocket: {
|
|
236
|
+
enable: boolean;
|
|
237
|
+
};
|
|
238
|
+
}
|
|
228
239
|
export interface IElasticsearchConfig {
|
|
229
240
|
indexPrefix: string;
|
|
230
241
|
url: string;
|
|
@@ -22,8 +22,8 @@ export interface IRecordForm {
|
|
|
22
22
|
sidePanel: IFormSidePanel;
|
|
23
23
|
}
|
|
24
24
|
export declare enum FormElementTypes {
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
FIELD = "field",
|
|
26
|
+
LAYOUT = "layout"
|
|
27
27
|
}
|
|
28
28
|
export type IFormStrict = Required<IForm>;
|
|
29
29
|
export interface IFormElementsDependency {
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { type IQueryInfos } from './queryInfos';
|
|
2
|
+
export interface INotification {
|
|
3
|
+
/**
|
|
4
|
+
* Timestamp of the notification creation in milliseconds since epoch
|
|
5
|
+
*/
|
|
6
|
+
date: number;
|
|
7
|
+
/**
|
|
8
|
+
* User ID of the notification recipient
|
|
9
|
+
*/
|
|
10
|
+
recipientUserId: string;
|
|
11
|
+
content: INotificationContent;
|
|
12
|
+
}
|
|
13
|
+
export interface INotificationContent {
|
|
14
|
+
level: 'info' | 'warning';
|
|
15
|
+
title: string;
|
|
16
|
+
message: string;
|
|
17
|
+
relatedEntities?: Array<{
|
|
18
|
+
url: string;
|
|
19
|
+
label: string;
|
|
20
|
+
}>;
|
|
21
|
+
attachments?: Array<{
|
|
22
|
+
url: string;
|
|
23
|
+
label: string;
|
|
24
|
+
}>;
|
|
25
|
+
}
|
|
26
|
+
export interface ICreateNotification {
|
|
27
|
+
emitterUserId: string;
|
|
28
|
+
/**
|
|
29
|
+
* Recipients of the notification, need at least one userId or groupId
|
|
30
|
+
*/
|
|
31
|
+
recipients: {
|
|
32
|
+
userIds: string[];
|
|
33
|
+
/**
|
|
34
|
+
* No implementation yet
|
|
35
|
+
*/
|
|
36
|
+
groupIds: string[];
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Priority of the notification, may change which channel is used to send it (no yet implemented)
|
|
40
|
+
*/
|
|
41
|
+
priority: 'urgent' | 'normal';
|
|
42
|
+
content: INotificationContent;
|
|
43
|
+
}
|
|
44
|
+
export declare enum NotificationChannels {
|
|
45
|
+
EMAIL = "email",
|
|
46
|
+
WEB_SOCKET = "web_socket"
|
|
47
|
+
}
|
|
48
|
+
export interface INotificationChannel {
|
|
49
|
+
type: NotificationChannels;
|
|
50
|
+
sendNotifications(notifications: INotification[], ctx: IQueryInfos): Promise<void>;
|
|
51
|
+
}
|
|
@@ -11,6 +11,7 @@ import { type IQueryInfos } from '../../_types/queryInfos';
|
|
|
11
11
|
import { type IRecordFilterLight } from '../../_types/record';
|
|
12
12
|
import { type ITaskFuncParams } from '../../_types/tasksManager';
|
|
13
13
|
import { type IValidateHelper } from '../helpers/validate';
|
|
14
|
+
import { type INotificationDomain } from 'domain/notification/notificationDomain';
|
|
14
15
|
export interface IExportParams {
|
|
15
16
|
library: string;
|
|
16
17
|
attributes: string[];
|
|
@@ -39,8 +40,9 @@ export interface IExportDomainDeps {
|
|
|
39
40
|
'core.domain.helpers.validate': IValidateHelper;
|
|
40
41
|
'core.domain.helpers.updateTaskProgress': UpdateTaskProgress;
|
|
41
42
|
'core.domain.eventsManager': IEventsManagerDomain;
|
|
43
|
+
'core.domain.notification': INotificationDomain;
|
|
42
44
|
'core.utils': IUtils;
|
|
43
45
|
translator: i18n;
|
|
44
46
|
config: Config.IConfig;
|
|
45
47
|
}
|
|
46
|
-
export default function ({ config, 'core.domain.record': recordDomain, 'core.domain.helpers.validate': validateHelper, 'core.domain.attribute': attributeDomain, 'core.domain.library': libraryDomain, 'core.domain.tasksManager': tasksManager, 'core.domain.helpers.updateTaskProgress': updateTaskProgress, 'core.domain.eventsManager': eventsManagerDomain, 'core.utils': utils, translator }: IExportDomainDeps): IExportDomain;
|
|
48
|
+
export default function ({ config, 'core.domain.record': recordDomain, 'core.domain.helpers.validate': validateHelper, 'core.domain.attribute': attributeDomain, 'core.domain.library': libraryDomain, 'core.domain.tasksManager': tasksManager, 'core.domain.helpers.updateTaskProgress': updateTaskProgress, 'core.domain.eventsManager': eventsManagerDomain, 'core.domain.notification': notificationDomain, 'core.utils': utils, translator }: IExportDomainDeps): IExportDomain;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type INotificationChannel } from '../../../_types/notification';
|
|
2
|
+
import { type IMailerService } from 'infra/mailer/mailerService';
|
|
3
|
+
export interface INotificationByEmailChannelDeps {
|
|
4
|
+
'core.infra.mailer.mailerService': IMailerService;
|
|
5
|
+
}
|
|
6
|
+
export default function ({ 'core.infra.mailer.mailerService': mailerService }: INotificationByEmailChannelDeps): INotificationChannel;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type INotificationChannel } from '../../../_types/notification';
|
|
2
|
+
import { type IEventsManagerDomain } from 'domain/eventsManager/eventsManagerDomain';
|
|
3
|
+
export interface INotificationByWebSocketChannelDeps {
|
|
4
|
+
'core.domain.eventsManager': IEventsManagerDomain;
|
|
5
|
+
}
|
|
6
|
+
export default function ({ 'core.domain.eventsManager': eventsManagerDomain }: INotificationByWebSocketChannelDeps): INotificationChannel;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type IConfig } from '_types/config';
|
|
2
|
+
import { type INotificationChannel, type ICreateNotification } from '_types/notification';
|
|
3
|
+
import { type IQueryInfos } from '_types/queryInfos';
|
|
4
|
+
export interface INotificationDomain {
|
|
5
|
+
createNotification(notification: ICreateNotification, ctx: IQueryInfos): Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
export interface INotificationDomainDeps {
|
|
8
|
+
'core.domain.notification.emailChannel': INotificationChannel;
|
|
9
|
+
'core.domain.notification.webSocketChannel': INotificationChannel;
|
|
10
|
+
config: IConfig;
|
|
11
|
+
}
|
|
12
|
+
export default function ({ 'core.domain.notification.emailChannel': emailChannel, 'core.domain.notification.webSocketChannel': webSocketChannel, config }: INotificationDomainDeps): INotificationDomain;
|
|
@@ -88,11 +88,6 @@ export interface IValueDomain {
|
|
|
88
88
|
ctx: IQueryInfos;
|
|
89
89
|
}): Promise<IValue>;
|
|
90
90
|
runActionsList(params: IRunActionListParams): Promise<IValue[]>;
|
|
91
|
-
runActionsListAndFormatOnValue({ library, value, ctx }: {
|
|
92
|
-
library: string;
|
|
93
|
-
value: IValue;
|
|
94
|
-
ctx: IQueryInfos;
|
|
95
|
-
}): Promise<IValue[]>;
|
|
96
91
|
}
|
|
97
92
|
export interface IValueDomainDeps {
|
|
98
93
|
config: Config.IConfig;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
interface ICallerInfo {
|
|
2
|
+
path: string;
|
|
3
|
+
line: string;
|
|
4
|
+
col: string;
|
|
5
|
+
}
|
|
6
|
+
export declare class LoggerCallStack {
|
|
7
|
+
private callerLineIndexInStack;
|
|
8
|
+
getCallStackTrace(): string | null;
|
|
9
|
+
getLocationInfo(): ICallerInfo | null;
|
|
10
|
+
private getStackLines;
|
|
11
|
+
private detectCallLineIndexInStack;
|
|
12
|
+
private callStackTraceLongEnough;
|
|
13
|
+
}
|
|
14
|
+
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
|
-
|
|
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
|
+
};
|
|
50
|
+
onErrorLog?: (message: string, meta: any, getCallStackTrace: () => string) => 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'>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as amqp from 'amqplib';
|
|
2
|
-
import { type IAmqp, type
|
|
2
|
+
import { type IAmqp, type OnMessageFunc } from './types/amqp';
|
|
3
3
|
export interface IAmqpService {
|
|
4
4
|
publisher: {
|
|
5
5
|
connection: amqp.ChannelModel;
|
|
@@ -10,7 +10,7 @@ export interface IAmqpService {
|
|
|
10
10
|
channel: amqp.ConfirmChannel;
|
|
11
11
|
};
|
|
12
12
|
publish(exchange: string, routingKey: string, msg: string, priority?: number): Promise<void>;
|
|
13
|
-
consume(queue: string, routingKey: string, onMessage:
|
|
13
|
+
consume(queue: string, routingKey: string, onMessage: OnMessageFunc, consumerTag?: string): Promise<amqp.Replies.Consume>;
|
|
14
14
|
close(): Promise<void>;
|
|
15
15
|
}
|
|
16
16
|
interface IDeps {
|
package/package.json
CHANGED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import winston from 'winston';
|
|
2
|
-
interface ICallerInfo {
|
|
3
|
-
path: string;
|
|
4
|
-
line: string;
|
|
5
|
-
col: string;
|
|
6
|
-
}
|
|
7
|
-
export declare function getLocationInfo(): ICallerInfo | null;
|
|
8
|
-
export declare const addLocationInfoInLog: winston.Logform.FormatWrap;
|
|
9
|
-
export declare const mergeLocationInfoInLog: winston.Logform.FormatWrap;
|
|
10
|
-
export {};
|