@aristid/leav-types 1.4.0 → 1.4.1-0a2c336f

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.
Files changed (69) hide show
  1. package/apps/core/config/default.d.ts +42 -16
  2. package/apps/core/config/development.d.ts +7 -4
  3. package/apps/core/config/test.d.ts +43 -9
  4. package/apps/core/src/__tests__/e2e/api/e2eUtils.d.ts +27 -2
  5. package/apps/core/src/__tests__/e2e/api/export/export.test.d.ts +1 -0
  6. package/apps/core/src/__tests__/e2e/api/mailpitUtils.d.ts +21 -0
  7. package/apps/core/src/__tests__/e2e/api/permissions/extendedLibraryPermissions.test.d.ts +1 -0
  8. package/apps/core/src/__tests__/integration/domain/taskManagerDomain.test.d.ts +1 -0
  9. package/apps/core/src/__tests__/integration/infra/integrationTestRepoUtils.d.ts +1 -1
  10. package/apps/core/src/__tests__/integration/infra/ramService.test.d.ts +1 -0
  11. package/apps/core/src/__tests__/integration/integrationTestUtils.d.ts +7 -0
  12. package/apps/core/src/_types/config.d.ts +48 -7
  13. package/apps/core/src/_types/elasticSearch.d.ts +2 -0
  14. package/apps/core/src/_types/errors.d.ts +2 -1
  15. package/apps/core/src/_types/eventsManager.d.ts +9 -1
  16. package/apps/core/src/_types/forms.d.ts +2 -2
  17. package/apps/core/src/_types/notification.d.ts +51 -0
  18. package/apps/core/src/_types/userData.d.ts +10 -0
  19. package/apps/core/src/app/auth/authApp.d.ts +5 -3
  20. package/apps/core/src/app/core/index.d.ts +2 -0
  21. package/apps/core/src/app/core/logsCollectorApp.d.ts +9 -0
  22. package/apps/core/src/app/core/notificationApp.d.ts +10 -0
  23. package/apps/core/src/app/core/tasksManagerApp.d.ts +1 -1
  24. package/apps/core/src/domain/actions/excelCalculationAction.d.ts +6 -4
  25. package/apps/core/src/domain/export/exportDomain.d.ts +6 -2
  26. package/apps/core/src/domain/export/exportProfileDomain.d.ts +23 -0
  27. package/apps/core/src/domain/export/exportProfileDomain.spec.d.ts +1 -0
  28. package/apps/core/src/domain/export/index.d.ts +1 -0
  29. package/apps/core/src/domain/logsCollector/index.d.ts +1 -0
  30. package/apps/core/src/domain/logsCollector/logsCollectorDomain.d.ts +16 -0
  31. package/apps/core/src/domain/notification/channels/emailChannel.d.ts +12 -0
  32. package/apps/core/src/domain/notification/channels/webSocketChannel.d.ts +6 -0
  33. package/apps/core/src/domain/notification/index.d.ts +3 -0
  34. package/apps/core/src/domain/notification/notificationDomain.d.ts +12 -0
  35. package/apps/core/src/domain/permission/helpers/index.d.ts +1 -1
  36. package/apps/core/src/domain/permission/helpers/recordInCreationBypass.d.ts +8 -3
  37. package/apps/core/src/domain/permission/recordAttributePermissionDomain.d.ts +2 -2
  38. package/apps/core/src/domain/permission/recordPermissionDomain.d.ts +2 -2
  39. package/apps/core/src/domain/record/helpers/getAccessPermissionFilters.d.ts +6 -5
  40. package/apps/core/src/domain/record/recordDomain.d.ts +1 -0
  41. package/apps/core/src/domain/tasksManager/tasksManagerDomain.d.ts +1 -1
  42. package/apps/core/src/domain/user/userDomain.d.ts +5 -2
  43. package/apps/core/src/domain/value/valueDomain.d.ts +3 -6
  44. package/apps/core/src/infra/cache/cacheService.d.ts +4 -3
  45. package/apps/core/src/infra/cache/index.d.ts +1 -2
  46. package/apps/core/src/infra/cache/ramService.d.ts +1 -7
  47. package/apps/core/src/infra/cache/redis.d.ts +5 -1
  48. package/apps/core/src/infra/{elasticSearch/elasticSearchService.d.ts → elasticsearch/elasticsearchService.d.ts} +7 -6
  49. package/apps/core/src/infra/elasticsearch/index.d.ts +1 -0
  50. package/apps/core/src/infra/log/logRepo.d.ts +3 -3
  51. package/apps/core/src/infra/oidc/oidcClientService.d.ts +3 -3
  52. package/apps/core/src/infra/session/index.d.ts +1 -0
  53. package/apps/core/src/infra/session/sessionRepo.d.ts +8 -0
  54. package/apps/core/src/interface/index.d.ts +1 -0
  55. package/apps/core/src/interface/logsCollector.d.ts +9 -0
  56. package/apps/core/src/interface/tasksManager.d.ts +1 -1
  57. package/apps/core/src/utils/helpers/getExcelData.d.ts +3 -0
  58. package/apps/core/src/utils/helpers/getFileDataBuffer.d.ts +2 -0
  59. package/libs/config-manager/src/envTo.d.ts +4 -0
  60. package/libs/logger/src/LoggerCallStack.d.ts +14 -0
  61. package/libs/logger/src/catchErrorFormatter.d.ts +2 -0
  62. package/libs/logger/src/config.d.ts +32 -3
  63. package/libs/logger/src/locationInfoFormatter.d.ts +2 -0
  64. package/libs/logger/src/logger.d.ts +1 -1
  65. package/libs/message-broker/src/amqpService.d.ts +2 -2
  66. package/libs/message-broker/src/types/amqp.d.ts +1 -1
  67. package/package.json +2 -2
  68. package/apps/core/src/infra/elasticSearch/index.d.ts +0 -1
  69. /package/apps/core/src/infra/{elasticSearch/elasticSearchClient.d.ts → elasticsearch/elasticsearchClient.d.ts} +0 -0
@@ -3,6 +3,7 @@ export declare let coreMode: string;
3
3
  export declare namespace server {
4
4
  let host: string;
5
5
  let port: number;
6
+ let keepAliveTimeout: number;
6
7
  let publicUrl: string;
7
8
  let basePath: string;
8
9
  let allowIntrospection: boolean;
@@ -62,6 +63,13 @@ export declare namespace mailer {
62
63
  export { port_1 as port };
63
64
  let secure_1: boolean;
64
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
+ }
65
73
  export namespace auth_1 {
66
74
  export let user: string;
67
75
  let password_1: string;
@@ -69,6 +77,12 @@ export declare namespace mailer {
69
77
  }
70
78
  export { auth_1 as auth };
71
79
  }
80
+ export declare namespace actions {
81
+ namespace excel {
82
+ let useNewHyperformula: boolean;
83
+ let debug: boolean;
84
+ }
85
+ }
72
86
  export declare namespace bugsnag {
73
87
  let enable_1: boolean;
74
88
  export { enable_1 as enable };
@@ -85,16 +99,10 @@ export declare namespace matomo {
85
99
  export let siteId: string;
86
100
  }
87
101
  export declare namespace lang {
88
- export let available: string | string[];
102
+ export let available: string[];
89
103
  let _default: string;
90
104
  export { _default as default };
91
105
  }
92
- export declare namespace logs {
93
- let level: string;
94
- let transport: string;
95
- let destinationFile: string;
96
- let useJsonFormat: boolean;
97
- }
98
106
  export declare namespace permissions {
99
107
  let _default_1: boolean;
100
108
  export { _default_1 as default };
@@ -120,7 +128,8 @@ export declare namespace redis {
120
128
  export { host_2 as host };
121
129
  let port_3: string;
122
130
  export { port_3 as port };
123
- export let database: number;
131
+ export let cacheDatabase: number;
132
+ export let sessionDatabase: number;
124
133
  }
125
134
  export declare namespace filesManager {
126
135
  namespace queues {
@@ -166,8 +175,7 @@ export declare namespace eventsManager {
166
175
  }
167
176
  export { routingKeys_2 as routingKeys };
168
177
  export namespace queues_2 {
169
- let pubsub_events_1: string;
170
- export { pubsub_events_1 as pubsub_events };
178
+ let pubsub_events_prefix: string;
171
179
  }
172
180
  export { queues_2 as queues };
173
181
  }
@@ -178,7 +186,7 @@ export declare namespace indexationManager {
178
186
  }
179
187
  export { queues_3 as queues };
180
188
  }
181
- export declare let debug: boolean;
189
+ declare let debug_1: boolean;
182
190
  export declare let defaultUserId: string;
183
191
  export declare namespace _export {
184
192
  let directory_1: string;
@@ -199,6 +207,19 @@ export declare namespace preview {
199
207
  let directory_3: string;
200
208
  export { directory_3 as directory };
201
209
  }
210
+ export declare namespace notification {
211
+ let enable_3: boolean;
212
+ export { enable_3 as enable };
213
+ export namespace email_3 {
214
+ let enable_4: boolean;
215
+ export { enable_4 as enable };
216
+ }
217
+ export { email_3 as email };
218
+ export namespace webSocket {
219
+ let enable_5: boolean;
220
+ export { enable_5 as enable };
221
+ }
222
+ }
202
223
  export declare namespace applications {
203
224
  let rootFolder: string;
204
225
  }
@@ -207,13 +228,18 @@ export declare namespace files {
207
228
  let originalsPathPrefix: string;
208
229
  }
209
230
  export declare namespace dbProfiler {
210
- let enable_3: boolean;
211
- export { enable_3 as enable };
231
+ let enable_6: boolean;
232
+ export { enable_6 as enable };
212
233
  }
213
- export declare namespace elasticSearch {
234
+ export declare namespace elasticsearch {
214
235
  export let indexPrefix: string;
215
236
  let url_2: string;
216
237
  export { url_2 as url };
238
+ export let ilmPolicyName: string;
239
+ export let templateName: string;
240
+ }
241
+ export declare namespace logsCollector {
242
+ let queue: string;
217
243
  }
218
- export declare let pluginsPath: string | any[];
219
- export { _export as export, _import as import };
244
+ export declare let pluginsPath: string[];
245
+ export { debug_1 as debug, _export as export, _import as import };
@@ -1,10 +1,6 @@
1
1
  export namespace server {
2
2
  let allowIntrospection: boolean;
3
3
  }
4
- export namespace logs {
5
- let level: string;
6
- let transport: string;
7
- }
8
4
  export namespace auth {
9
5
  let refreshTokenExpiration: string;
10
6
  namespace cookie {
@@ -18,3 +14,10 @@ export namespace dbProfiler {
18
14
  export namespace bugsnag {
19
15
  let releaseStage: string;
20
16
  }
17
+ export namespace actions {
18
+ namespace excel {
19
+ export let useNewHyperformula: boolean;
20
+ let debug_1: boolean;
21
+ export { debug_1 as debug };
22
+ }
23
+ }
@@ -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 {
@@ -22,33 +26,63 @@ export namespace filesManager {
22
26
  }
23
27
  }
24
28
  export namespace eventsManager {
25
- namespace routingKeys {
29
+ export namespace routingKeys {
26
30
  let data_events: string;
31
+ let pubsub_events: string;
32
+ }
33
+ export namespace queues_1 {
34
+ let pubsub_events_prefix: string;
27
35
  }
36
+ export { queues_1 as queues };
28
37
  }
29
38
  export namespace indexationManager {
30
- export namespace queues_1 {
39
+ export namespace queues_2 {
31
40
  let events_1: string;
32
41
  export { events_1 as events };
33
42
  }
34
- export { queues_1 as queues };
43
+ export { queues_2 as queues };
35
44
  }
36
45
  export namespace tasksManager {
37
- export namespace queues_2 {
38
- let orders: string;
46
+ export let checkingInterval: number;
47
+ export namespace queues_3 {
48
+ let execOrders: string;
49
+ let cancelOrders: string;
39
50
  }
40
- export { queues_2 as queues };
51
+ export { queues_3 as queues };
41
52
  export namespace routingKeys_1 {
42
- let orders_1: string;
43
- export { orders_1 as orders };
53
+ let execOrders_1: string;
54
+ export { execOrders_1 as execOrders };
55
+ let cancelOrders_1: string;
56
+ export { cancelOrders_1 as cancelOrders };
44
57
  }
45
58
  export { routingKeys_1 as routingKeys };
46
59
  }
47
60
  export namespace logs {
48
61
  let transport: string;
49
62
  }
63
+ export namespace notification {
64
+ export let enable: boolean;
65
+ export namespace email_2 {
66
+ let enable_1: boolean;
67
+ export { enable_1 as enable };
68
+ }
69
+ export { email_2 as email };
70
+ export namespace webSocket {
71
+ let enable_2: boolean;
72
+ export { enable_2 as enable };
73
+ }
74
+ }
75
+ export namespace mailer {
76
+ namespace from {
77
+ let name_1: string;
78
+ export { name_1 as name };
79
+ let email_3: string;
80
+ export { email_3 as email };
81
+ }
82
+ }
50
83
  export let debug: boolean;
51
84
  export namespace redis {
52
- let database: number;
85
+ let cacheDatabase: number;
86
+ let sessionDatabase: number;
53
87
  }
54
88
  export let pluginsPath: string[];
@@ -1,10 +1,25 @@
1
+ import WebSocket from 'ws';
2
+ import { type Client as GraphqlWsClient } from 'graphql-ws';
3
+ import { type AxiosResponse } from 'axios';
1
4
  import type FormData from 'form-data';
2
5
  import { type ActionsListConfig } from '_types/actionsList';
3
6
  import { type ITreeElement } from '_types/tree';
4
7
  import { AttributeFormats, type AttributeTypes, type IAttributeVersionsConf, type IEmbeddedAttribute } from '../../../_types/attribute';
8
+ interface IE2EUser {
9
+ getAuthToken: () => Promise<string>;
10
+ }
11
+ export declare const e2eAdminUser: () => IE2EUser;
12
+ export declare const e2eGuestUser: () => Promise<IE2EUser>;
5
13
  export declare function getGraphQLUrl(): Promise<string>;
6
- export declare function makeGraphQlCall(query: string | FormData, throwOnErrors?: boolean): Promise<any>;
7
- export declare function gqlSaveLibrary(id: string, label: string, additionalAttributes?: string[]): Promise<any>;
14
+ export declare class E2EGraphQLError extends Error {
15
+ readonly response: AxiosResponse;
16
+ constructor(message: string, response: AxiosResponse);
17
+ }
18
+ export interface IMakeGraphQlCallOptions {
19
+ user?: IE2EUser;
20
+ }
21
+ export declare function makeGraphQlCall(query: string | FormData, options?: IMakeGraphQlCallOptions): Promise<any>;
22
+ export declare function gqlSaveLibrary(id: string, label: string, additionalAttributes?: string[], settings?: string): Promise<any>;
8
23
  export declare function gqlSaveApplication(id: string, label: string, endpoint: string): Promise<any>;
9
24
  export declare function gqlSaveAttribute(params: {
10
25
  id: string;
@@ -41,3 +56,13 @@ export declare function gqlSaveVersionProfile(profileId: string, label: string,
41
56
  * Convert object to JSON, escaping quotes to be able to use it in a graphql query
42
57
  **/
43
58
  export declare function toCleanJSON(obj: {}): string;
59
+ export declare function makeWebSocketGraphQlCall(options?: {
60
+ user: IE2EUser;
61
+ }): Promise<GraphqlWsClient>;
62
+ export declare function waitGraphqlWebSocketMessage<T>(client: GraphqlWsClient, query: string, variables: Record<string, any>, acceptMessage: (msg: T) => boolean, { timeoutMs }: {
63
+ timeoutMs: any;
64
+ }): Promise<T>;
65
+ export declare function waitWebSocketMessage<T>(webSocket: WebSocket, acceptMessage: (msg: T) => boolean, { timeoutMs }: {
66
+ timeoutMs: any;
67
+ }): Promise<T>;
68
+ export {};
@@ -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 {};
@@ -1,7 +1,7 @@
1
1
  import { type ILibraryRepo } from 'infra/library/libraryRepo';
2
2
  import { type IRecordRepo } from 'infra/record/recordRepo';
3
3
  import { type ITreeRepo } from 'infra/tree/treeRepo';
4
- export declare const getCoreDep: <T>(path: any) => T;
5
4
  export declare const getLibraryRepo: () => ILibraryRepo;
6
5
  export declare const getRecordRepo: () => IRecordRepo;
7
6
  export declare const getTreeRepo: () => ITreeRepo;
7
+ export * from '../integrationTestUtils';
@@ -0,0 +1,7 @@
1
+ import { type AwilixContainer } from 'awilix';
2
+ export interface IGlobalThis {
3
+ coreContainer: AwilixContainer;
4
+ taskManagerMasterTimer: NodeJS.Timeout;
5
+ }
6
+ export declare const getCoreContainer: () => AwilixContainer;
7
+ export declare const getCoreDep: <T>(path: any) => T;
@@ -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;
@@ -26,10 +25,12 @@ export interface IConfig {
26
25
  plugins: IKeyValue<IKeyValue<any>>;
27
26
  preview: IPreview;
28
27
  applications: IApplicationsConfig;
28
+ actions: IActions;
29
29
  files: IFilesConfig;
30
30
  dbProfiler: IDbProfilerConfig;
31
31
  instanceId: string;
32
- elasticSearch: IElasticSearchConfig;
32
+ elasticsearch: IElasticsearchConfig;
33
+ logsCollector: ILogsCollector;
33
34
  pluginsPath: string[];
34
35
  bugsnag: IBugsnag;
35
36
  matomo: IMatomo;
@@ -41,11 +42,13 @@ export declare enum CoreMode {
41
42
  INDEXATION_MANAGER = "indexationManager",
42
43
  TASKS_MANAGER_MASTER = "tasksManager:master",
43
44
  TASKS_MANAGER_WORKER = "tasksManager:worker",
45
+ LOGS_COLLECTOR = "logsCollector",
44
46
  CLI = "cli"
45
47
  }
46
48
  export interface IServer {
47
49
  host: string;
48
50
  port: number;
51
+ keepAliveTimeout: number;
49
52
  publicUrl: string;
50
53
  basePath: string;
51
54
  allowIntrospection: boolean;
@@ -60,6 +63,19 @@ export interface IServer {
60
63
  email: string;
61
64
  };
62
65
  }
66
+ export interface IActions {
67
+ excel: {
68
+ /**
69
+ * Replace deprecated hot-formula-parser npm module by new hyperformula npm module
70
+ * Formulas should be compatible
71
+ */
72
+ useNewHyperformula: boolean;
73
+ /**
74
+ * Add debug log for each calculation with formula and result or error
75
+ */
76
+ debug: boolean;
77
+ };
78
+ }
63
79
  export interface IDb {
64
80
  url: string;
65
81
  name: string;
@@ -96,7 +112,18 @@ export interface IAuth {
96
112
  export interface IMailer {
97
113
  host: string;
98
114
  port: number;
115
+ /**
116
+ * If true, use SSL/TLS connection (usually port 465). If false, use STARTTLS (usually port 587)
117
+ */
99
118
  secure: boolean;
119
+ /**
120
+ * If true, require TLS for the connection (STARTTLS). Only used if secure is false
121
+ */
122
+ requireTLS: boolean;
123
+ from: {
124
+ name: string;
125
+ email: string;
126
+ };
100
127
  auth: {
101
128
  user: string;
102
129
  password: string;
@@ -106,7 +133,6 @@ export interface ILang {
106
133
  available: string[];
107
134
  default: string;
108
135
  }
109
- export type ILogs = ILoggerConfig;
110
136
  export interface IPermissions {
111
137
  default: boolean;
112
138
  enableCache: boolean;
@@ -120,7 +146,8 @@ export interface IAmqp {
120
146
  export interface IRedis {
121
147
  host: string;
122
148
  port: number;
123
- database: number;
149
+ cacheDatabase: number;
150
+ sessionDatabase: number;
124
151
  }
125
152
  export interface IFilesManager {
126
153
  queues: {
@@ -145,7 +172,7 @@ export interface IEventsManager {
145
172
  pubsub_events: string;
146
173
  };
147
174
  queues: {
148
- pubsub_events: string;
175
+ pubsub_events_prefix: string;
149
176
  };
150
177
  }
151
178
  export interface IIndexationManager {
@@ -222,9 +249,20 @@ export interface IFilesConfig {
222
249
  export interface IDbProfilerConfig {
223
250
  enable: boolean;
224
251
  }
225
- export interface IElasticSearchConfig {
252
+ export interface INotificationConfig {
253
+ enable: boolean;
254
+ email: {
255
+ enable: boolean;
256
+ };
257
+ webSocket: {
258
+ enable: boolean;
259
+ };
260
+ }
261
+ export interface IElasticsearchConfig {
226
262
  indexPrefix: string;
227
263
  url: string;
264
+ ilmPolicyName: string;
265
+ templateName: string;
228
266
  }
229
267
  export interface IBugsnag {
230
268
  enable: boolean;
@@ -238,3 +276,6 @@ export interface IMatomo {
238
276
  url?: string;
239
277
  siteId?: string;
240
278
  }
279
+ export interface ILogsCollector {
280
+ queue: string;
281
+ }
@@ -0,0 +1,2 @@
1
+ import { type IDbEvent, type IDbPayload } from '@leav/utils';
2
+ export type WritableMessage = Omit<IDbEvent, 'payload' | 'emitter'> & IDbPayload;
@@ -1,9 +1,11 @@
1
1
  export declare enum ErrorTypes {
2
2
  VALIDATION_ERROR = "VALIDATION_ERROR",
3
3
  PERMISSION_ERROR = "PERMISSION_ERROR",
4
+ CUSTOM_CONFIG_ERROR = "CUSTOM_CONFIG_ERROR",
4
5
  INTERNAL_ERROR = "INTERNAL_ERROR"
5
6
  }
6
7
  export declare enum Errors {
8
+ ATTRIBUTE_USED_BY_LIBRARY = "ATTRIBUTE_USED_BY_LIBRARY",
7
9
  ATTRIBUTE_USED_IN_METADATA = "ATTRIBUTE_USED_IN_METADATA",
8
10
  CANNOT_SAVE_METADATA = "CANNOT_SAVE_METADATA",
9
11
  DUPLICATE_DIRECTORY_NAMES = "DUPLICATE_DIRECTORY_NAMES",
@@ -15,7 +17,6 @@ export declare enum Errors {
15
17
  ENCRYPT_ERROR = "ENCRYPT_ERROR",
16
18
  ERROR = "ERROR",
17
19
  EXCEL_CALCULATION_ERROR = "EXCEL_CALCULATION_ERROR",
18
- FILE_ERROR = "FILE_ERROR",
19
20
  FILE_NOT_FOUND = "FILE_NOT_FOUND",
20
21
  FORBIDDEN_FILES = "FORBIDDEN_FILES",
21
22
  FORBIDDEN_ID = "FORBIDDEN_ID",
@@ -1,8 +1,16 @@
1
+ import { type INotificationContent } from './notification';
1
2
  export declare enum TriggerNames {
2
3
  APPLICATION_EVENT = "APPLICATION_EVENT",
3
4
  UPLOAD_FILE = "UPLOAD_FILE",
4
5
  INDEXATION = "INDEXATION",
5
6
  TASK = "TASK",
6
7
  TREE_EVENT = "TREE_EVENT",
7
- RECORD_UPDATE = "RECORD_UPDATE"
8
+ RECORD_UPDATE = "RECORD_UPDATE",
9
+ NOTIFICATION = "NOTIFICATION"
10
+ }
11
+ export interface IPubSubNotificationData {
12
+ notification: INotificationContent & {
13
+ date: number;
14
+ };
15
+ recipientUserIds: string[];
8
16
  }
@@ -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
+ }
@@ -4,7 +4,6 @@ import { type IUserDomain } from 'domain/user/userDomain';
4
4
  import { type IValueDomain } from 'domain/value/valueDomain';
5
5
  import { type Response } from 'express';
6
6
  import { type IConfig } from '_types/config';
7
- import { type ICachesService } from '../../infra/cache/cacheService';
8
7
  import { type ITokenUserData } from '../../_types/auth';
9
8
  import { type IRequestWithContext } from '../../_types/express';
10
9
  import { type ILogger } from '@leav/logger';
@@ -15,6 +14,8 @@ import { type IncomingHttpHeaders } from 'http';
15
14
  import { type IRecordRepo } from '../../infra/record/recordRepo';
16
15
  import { type IGraphqlAppModule } from 'app/graphql/graphqlApp';
17
16
  import { type IServerRouteAppModule } from 'interface/server';
17
+ import { type GetSystemQueryContext } from 'utils/helpers/getSystemQueryContext';
18
+ import { type ISessionRepo } from '../../infra/session/sessionRepo';
18
19
  export interface IAuthApp extends IGraphqlAppModule, IServerRouteAppModule {
19
20
  validateRequestToken(params: {
20
21
  apiKey?: string;
@@ -29,11 +30,12 @@ export interface IAuthAppDeps {
29
30
  'core.infra.record': IRecordRepo;
30
31
  'core.domain.apiKey': IApiKeyDomain;
31
32
  'core.domain.user': IUserDomain;
32
- 'core.infra.cache.cacheService': ICachesService;
33
33
  'core.utils.logger': ILogger;
34
34
  'core.infra.oidc.oidcClientService': IOIDCClientService;
35
35
  'core.app.helpers.initQueryContext': InitQueryContextFunc;
36
36
  'core.app.helpers.convertOIDCIdentifier': IConvertOIDCIdentifier;
37
+ 'core.utils.getSystemQueryContext': GetSystemQueryContext;
37
38
  config: IConfig;
39
+ 'core.infra.session': ISessionRepo;
38
40
  }
39
- export default function ({ 'core.domain.value': valueDomain, 'core.domain.record': recordDomain, 'core.infra.record': recordRepo, 'core.domain.apiKey': apiKeyDomain, 'core.domain.user': userDomain, 'core.utils.logger': logger, 'core.infra.cache.cacheService': cacheService, 'core.infra.oidc.oidcClientService': oidcClientService, 'core.app.helpers.initQueryContext': initQueryContext, 'core.app.helpers.convertOIDCIdentifier': convertOIDCIdentifier, config }: IAuthAppDeps): IAuthApp;
41
+ export default function ({ 'core.domain.value': valueDomain, 'core.domain.record': recordDomain, 'core.infra.record': recordRepo, 'core.domain.apiKey': apiKeyDomain, 'core.domain.user': userDomain, 'core.utils.logger': logger, 'core.infra.oidc.oidcClientService': oidcClientService, 'core.app.helpers.initQueryContext': initQueryContext, 'core.app.helpers.convertOIDCIdentifier': convertOIDCIdentifier, 'core.utils.getSystemQueryContext': getSystemQueryContext, 'core.infra.session': sessionRepo, config }: IAuthAppDeps): IAuthApp;
@@ -10,12 +10,14 @@ export { default as globalSettings } from './globalSettingsApp';
10
10
  export { default as subscriptionsHelper } from './helpers/subscriptions';
11
11
  export { default as import } from './importApp';
12
12
  export { default as indexationManager } from './indexationManagerApp';
13
+ export { default as logsCollector } from './logsCollectorApp';
13
14
  export { default as library } from './libraryApp/libraryApp';
14
15
  export { default as log } from './logApp';
15
16
  export { default as permission } from './permissionApp/permissionApp';
16
17
  export { default as plugins } from './pluginsApp';
17
18
  export { default as record } from './recordApp/recordApp';
18
19
  export { default as tasksManager } from './tasksManagerApp';
20
+ export { default as notification } from './notificationApp';
19
21
  export { default as tree } from './treeApp/treeApp';
20
22
  export { default as userData } from './userDataApp';
21
23
  export { default as value } from './valueApp';
@@ -0,0 +1,9 @@
1
+ import { type ILogsCollectorDomain } from 'domain/logsCollector/logsCollectorDomain';
2
+ export interface ILogsCollectorApp {
3
+ init(): Promise<void>;
4
+ }
5
+ interface IDeps {
6
+ 'core.domain.logsCollector': ILogsCollectorDomain;
7
+ }
8
+ export default function ({ 'core.domain.logsCollector': logsCollector }: IDeps): ILogsCollectorApp;
9
+ export {};
@@ -0,0 +1,10 @@
1
+ import { type IGraphqlAppModule } from 'app/graphql/graphqlApp';
2
+ import { type IEventsManagerDomain } from 'domain/eventsManager/eventsManagerDomain';
3
+ import { type IUtils } from 'utils/utils';
4
+ export type INotificationApp = IGraphqlAppModule;
5
+ interface IDeps {
6
+ 'core.utils'?: IUtils;
7
+ 'core.domain.eventsManager'?: IEventsManagerDomain;
8
+ }
9
+ export default function ({ 'core.domain.eventsManager': eventsManager }: IDeps): INotificationApp;
10
+ export {};
@@ -8,7 +8,7 @@ import { type ITasksManagerDomain } from '../../domain/tasksManager/tasksManager
8
8
  import { TaskStatus } from '../../_types/tasksManager';
9
9
  import { type IGraphqlAppModule } from 'app/graphql/graphqlApp';
10
10
  export interface ITasksManagerApp extends IGraphqlAppModule {
11
- initMaster(): Promise<NodeJS.Timer>;
11
+ initMaster(): Promise<NodeJS.Timeout>;
12
12
  initWorker(): Promise<void>;
13
13
  }
14
14
  interface IDeps {