@aristid/leav-types 1.4.1-9f9ebbe9 → 1.4.1-a44cd133

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.
@@ -63,6 +63,13 @@ 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 let requireTLS: boolean;
67
+ export namespace from {
68
+ let name_1: string;
69
+ export { name_1 as name };
70
+ let email_2: string;
71
+ export { email_2 as email };
72
+ }
66
73
  export namespace auth_1 {
67
74
  export let user: string;
68
75
  let password_1: string;
@@ -194,6 +201,19 @@ export declare namespace preview {
194
201
  let directory_3: string;
195
202
  export { directory_3 as directory };
196
203
  }
204
+ export declare namespace notification {
205
+ let enable_3: boolean;
206
+ export { enable_3 as enable };
207
+ export namespace email_3 {
208
+ let enable_4: boolean;
209
+ export { enable_4 as enable };
210
+ }
211
+ export { email_3 as email };
212
+ export namespace webSocket {
213
+ let enable_5: boolean;
214
+ export { enable_5 as enable };
215
+ }
216
+ }
197
217
  export declare namespace applications {
198
218
  let rootFolder: string;
199
219
  }
@@ -202,8 +222,8 @@ export declare namespace files {
202
222
  let originalsPathPrefix: string;
203
223
  }
204
224
  export declare namespace dbProfiler {
205
- let enable_3: boolean;
206
- export { enable_3 as enable };
225
+ let enable_6: boolean;
226
+ export { enable_6 as enable };
207
227
  }
208
228
  export declare namespace elasticsearch {
209
229
  export let indexPrefix: string;
@@ -6,6 +6,10 @@ export namespace server {
6
6
  let password: string;
7
7
  let email: string;
8
8
  }
9
+ namespace systemUser {
10
+ let email_1: string;
11
+ export { email_1 as email };
12
+ }
9
13
  let allowIntrospection: boolean;
10
14
  }
11
15
  export namespace db {
@@ -34,19 +38,43 @@ export namespace indexationManager {
34
38
  export { queues_1 as queues };
35
39
  }
36
40
  export namespace tasksManager {
41
+ export let checkingInterval: number;
37
42
  export namespace queues_2 {
38
- let orders: string;
43
+ let execOrders: string;
44
+ let cancelOrders: string;
39
45
  }
40
46
  export { queues_2 as queues };
41
47
  export namespace routingKeys_1 {
42
- let orders_1: string;
43
- export { orders_1 as orders };
48
+ let execOrders_1: string;
49
+ export { execOrders_1 as execOrders };
50
+ let cancelOrders_1: string;
51
+ export { cancelOrders_1 as cancelOrders };
44
52
  }
45
53
  export { routingKeys_1 as routingKeys };
46
54
  }
47
55
  export namespace logs {
48
56
  let transport: string;
49
57
  }
58
+ export namespace notification {
59
+ export let enable: boolean;
60
+ export namespace email_2 {
61
+ let enable_1: boolean;
62
+ export { enable_1 as enable };
63
+ }
64
+ export { email_2 as email };
65
+ export namespace webSocket {
66
+ let enable_2: boolean;
67
+ export { enable_2 as enable };
68
+ }
69
+ }
70
+ export namespace mailer {
71
+ namespace from {
72
+ let name_1: string;
73
+ export { name_1 as name };
74
+ let email_3: string;
75
+ export { email_3 as email };
76
+ }
77
+ }
50
78
  export let debug: boolean;
51
79
  export namespace redis {
52
80
  let database: number;
@@ -1,3 +1,4 @@
1
+ import type WebSocket from 'ws';
1
2
  import type FormData from 'form-data';
2
3
  import { type ActionsListConfig } from '_types/actionsList';
3
4
  import { type ITreeElement } from '_types/tree';
@@ -41,3 +42,6 @@ export declare function gqlSaveVersionProfile(profileId: string, label: string,
41
42
  * Convert object to JSON, escaping quotes to be able to use it in a graphql query
42
43
  **/
43
44
  export declare function toCleanJSON(obj: {}): string;
45
+ export declare function waitWebSocketMessage<T>(webSocket: WebSocket, acceptMessage: (msg: T) => boolean, { timeoutMs }: {
46
+ timeoutMs: any;
47
+ }): Promise<T>;
@@ -0,0 +1,21 @@
1
+ interface IMailpitMsgLight {
2
+ From: {
3
+ Name: string;
4
+ Address: string;
5
+ };
6
+ ID: string;
7
+ MessageID: string;
8
+ Read: boolean;
9
+ Size: number;
10
+ Subject: string;
11
+ To: Array<{
12
+ Name: string;
13
+ Address: string;
14
+ }>;
15
+ }
16
+ interface IMailpitMsgFull extends IMailpitMsgLight {
17
+ HTML: string;
18
+ Text: string;
19
+ }
20
+ export declare function waitMailpitMessage(acceptMessage: (msg: IMailpitMsgLight) => boolean): Promise<IMailpitMsgFull>;
21
+ export {};
@@ -16,6 +16,7 @@ export interface IConfig {
16
16
  indexationManager: IIndexationManager;
17
17
  tasksManager: ITasksManager;
18
18
  eventsManager: IEventsManager;
19
+ notification: INotificationConfig;
19
20
  debug?: boolean;
20
21
  env?: string;
21
22
  defaultUserId: string;
@@ -97,7 +98,18 @@ export interface IAuth {
97
98
  export interface IMailer {
98
99
  host: string;
99
100
  port: number;
101
+ /**
102
+ * If true, use SSL/TLS connection (usually port 465). If false, use STARTTLS (usually port 587)
103
+ */
100
104
  secure: boolean;
105
+ /**
106
+ * If true, require TLS for the connection (STARTTLS). Only used if secure is false
107
+ */
108
+ requireTLS: boolean;
109
+ from: {
110
+ name: string;
111
+ email: string;
112
+ };
101
113
  auth: {
102
114
  user: string;
103
115
  password: string;
@@ -222,6 +234,15 @@ export interface IFilesConfig {
222
234
  export interface IDbProfilerConfig {
223
235
  enable: boolean;
224
236
  }
237
+ export interface INotificationConfig {
238
+ enable: boolean;
239
+ email: {
240
+ enable: boolean;
241
+ };
242
+ webSocket: {
243
+ enable: boolean;
244
+ };
245
+ }
225
246
  export interface IElasticsearchConfig {
226
247
  indexPrefix: string;
227
248
  url: string;
@@ -22,8 +22,8 @@ export interface IRecordForm {
22
22
  sidePanel: IFormSidePanel;
23
23
  }
24
24
  export declare enum FormElementTypes {
25
- field = "field",
26
- layout = "layout"
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
+ }
@@ -2,3 +2,13 @@ export interface IUserData {
2
2
  global: boolean;
3
3
  data: any;
4
4
  }
5
+ /**
6
+ * Same idea as IRecordIdentity but for users
7
+ */
8
+ export interface IUserIdentity {
9
+ id: string;
10
+ /**
11
+ * @throw if user have no email
12
+ */
13
+ getEmail: () => Promise<string>;
14
+ }
@@ -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,12 @@
1
+ import { type INotificationChannel } from '../../../_types/notification';
2
+ import { type IMailerService } from 'infra/mailer/mailerService';
3
+ import { type IUserDomain } from 'domain/user/userDomain';
4
+ import { type IGlobalSettingsDomain } from 'domain/globalSettings/globalSettingsDomain';
5
+ import { type IConfig } from '_types/config';
6
+ export interface INotificationByEmailChannelDeps {
7
+ config: IConfig;
8
+ 'core.infra.mailer.mailerService': IMailerService;
9
+ 'core.domain.globalSettings': IGlobalSettingsDomain;
10
+ 'core.domain.user': IUserDomain;
11
+ }
12
+ export default function ({ config, 'core.infra.mailer.mailerService': mailerService, 'core.domain.globalSettings': globalSettingsDomain, 'core.domain.user': userDomain }: 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,3 @@
1
+ export { default } from './notificationDomain';
2
+ export { default as emailChannel } from './channels/emailChannel';
3
+ export { default as webSocketChannel } from './channels/webSocketChannel';
@@ -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;
@@ -6,7 +6,8 @@ import { type IUserDataRepo } from 'infra/userData/userDataRepo';
6
6
  import { type IUtils } from 'utils/utils';
7
7
  import type * as Config from '_types/config';
8
8
  import { type IQueryInfos } from '_types/queryInfos';
9
- import { type IUserData } from '_types/userData';
9
+ import { type IUserIdentity, type IUserData } from '_types/userData';
10
+ import { type IValueDomain } from 'domain/value/valueDomain';
10
11
  interface ISaveUserDataParams {
11
12
  key: string;
12
13
  value: any;
@@ -15,12 +16,14 @@ interface ISaveUserDataParams {
15
16
  ctx: IQueryInfos;
16
17
  }
17
18
  export interface IUserDomain {
19
+ getUserIdentity(userId: string, ctx: IQueryInfos): Promise<IUserIdentity>;
18
20
  saveUserData(params: ISaveUserDataParams): Promise<IUserData>;
19
21
  getUserData(keys: string[], global: boolean, ctx: IQueryInfos): Promise<IUserData>;
20
22
  sendResetPasswordEmail(email: string, token: string, login: string, browser: string, os: string, lang: 'fr' | 'en', ctx: IQueryInfos): Promise<void>;
21
23
  }
22
24
  export interface IUserDomainDeps {
23
25
  config: Config.IConfig;
26
+ 'core.domain.value': IValueDomain;
24
27
  'core.domain.permissions': IPermissionDomain;
25
28
  'core.infra.userData': IUserDataRepo;
26
29
  'core.domain.permission': IPermissionDomain;
@@ -32,5 +35,5 @@ export interface IUserDomainDeps {
32
35
  export declare enum UserCoreDataKeys {
33
36
  CONSULTED_APPS = "applications_consultation"
34
37
  }
35
- export default function ({ config, 'core.infra.userData': userDataRepo, 'core.domain.permission': permissionDomain, 'core.infra.mailer.mailerService': mailerService, 'core.domain.globalSettings': globalSettingsDomain, 'core.utils': utils, translator }: IUserDomainDeps): IUserDomain;
38
+ export default function ({ config, 'core.domain.value': valueDomain, 'core.infra.userData': userDataRepo, 'core.domain.permission': permissionDomain, 'core.infra.mailer.mailerService': mailerService, 'core.domain.globalSettings': globalSettingsDomain, 'core.utils': utils, translator }: IUserDomainDeps): IUserDomain;
36
39
  export {};
@@ -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;
@@ -1,5 +1,5 @@
1
1
  import * as amqp from 'amqplib';
2
- import { type IAmqp, type onMessageFunc } from './types/amqp';
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: onMessageFunc, consumerTag?: string): Promise<amqp.Replies.Consume>;
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 {
@@ -12,4 +12,4 @@ export interface IAmqpConn {
12
12
  export interface IMessageBody {
13
13
  [key: string]: any;
14
14
  }
15
- export type onMessageFunc = (msg: amqp.ConsumeMessage) => Promise<void>;
15
+ export type OnMessageFunc = (msg: amqp.ConsumeMessage) => Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aristid/leav-types",
3
- "version": "1.4.1-9f9ebbe9",
3
+ "version": "1.4.1-a44cd133",
4
4
  "description": "Shared Leav types",
5
5
  "scripts": {
6
6
  "tscheck": "",