@aristid/leav-types 1.5.0 → 1.5.1-1929c505

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 (40) hide show
  1. package/apps/core/config/default.d.ts +16 -2
  2. package/apps/core/src/__tests__/e2e/api/e2eUtils.d.ts +12 -3
  3. package/apps/core/src/__tests__/e2e/api/mailpitUtils.d.ts +8 -0
  4. package/apps/core/src/__tests__/e2e/api/userData/maskUserPassword.test.d.ts +1 -0
  5. package/apps/core/src/__tests__/e2e/api/values/countValuesOccurrences.test.d.ts +1 -0
  6. package/apps/core/src/__tests__/e2e/api/values/saveValueBulk.test.d.ts +1 -0
  7. package/apps/core/src/_constants/values.d.ts +1 -0
  8. package/apps/core/src/_types/config.d.ts +21 -1
  9. package/apps/core/src/_types/errors.d.ts +3 -0
  10. package/apps/core/src/_types/events.d.ts +7 -6
  11. package/apps/core/src/_types/notification.d.ts +1 -1
  12. package/apps/core/src/_types/tasksManager.d.ts +2 -1
  13. package/apps/core/src/_types/tree.d.ts +5 -0
  14. package/apps/core/src/_types/value.d.ts +26 -3
  15. package/apps/core/src/app/core/valueApp.d.ts +3 -1
  16. package/apps/core/src/domain/filesManager/filesManagerDomain.d.ts +1 -1
  17. package/apps/core/src/domain/helpers/storeUploadFile.d.ts +1 -1
  18. package/apps/core/src/domain/library/helpers/checkSavePermission.d.ts +1 -1
  19. package/apps/core/src/domain/permission/_types.d.ts +0 -15
  20. package/apps/core/src/domain/permission/adminPermissionDomain.d.ts +1 -1
  21. package/apps/core/src/domain/permission/helpers/defaultPermission.d.ts +7 -1
  22. package/apps/core/src/domain/permission/permissionDomain.d.ts +3 -1
  23. package/apps/core/src/domain/permission/recordAttributePermissionDomain.d.ts +2 -4
  24. package/apps/core/src/domain/permission/recordPermissionDomain.d.ts +0 -2
  25. package/apps/core/src/domain/record/helpers/findRecords.d.ts +38 -0
  26. package/apps/core/src/domain/record/helpers/findRecords.spec.d.ts +1 -0
  27. package/apps/core/src/domain/record/helpers/getRecordFieldValue.spec.d.ts +0 -0
  28. package/apps/core/src/domain/record/helpers/index.d.ts +1 -0
  29. package/apps/core/src/domain/record/recordDomain.d.ts +4 -23
  30. package/apps/core/src/domain/user/userDomain.d.ts +1 -0
  31. package/apps/core/src/domain/value/tasks/index.d.ts +1 -0
  32. package/apps/core/src/domain/value/tasks/saveValueBulk.d.ts +36 -0
  33. package/apps/core/src/domain/value/valueDomain.d.ts +34 -5
  34. package/apps/core/src/infra/attributeTypes/attributeTypesRepo.d.ts +10 -1
  35. package/apps/core/src/infra/db/migrations/013-passwordAttributeMaskValue.d.ts +7 -0
  36. package/apps/core/src/infra/value/valueRepo.d.ts +10 -1
  37. package/libs/logger/src/config.d.ts +2 -2
  38. package/libs/utils/src/types/files.d.ts +1 -1
  39. package/libs/utils/src/utils.d.ts +2 -4
  40. package/package.json +2 -2
@@ -105,8 +105,22 @@ export declare namespace lang {
105
105
  export { _default as default };
106
106
  }
107
107
  export declare namespace permissions {
108
- let _default_1: boolean;
109
- export { _default_1 as default };
108
+ export namespace everybody {
109
+ let _default_1: boolean;
110
+ export { _default_1 as default };
111
+ export namespace admin_1 {
112
+ let _default_2: boolean;
113
+ export { _default_2 as default };
114
+ }
115
+ export { admin_1 as admin };
116
+ export namespace application {
117
+ let admin_application: boolean;
118
+ }
119
+ }
120
+ export namespace adminGroup {
121
+ let _default_3: boolean;
122
+ export { _default_3 as default };
123
+ }
110
124
  let enableCache_1: boolean;
111
125
  export { enableCache_1 as enableCache };
112
126
  }
@@ -5,11 +5,22 @@ import FormData from 'form-data';
5
5
  import { type ActionsListConfig } from '_types/actionsList';
6
6
  import { type ITreeElement } from '_types/tree';
7
7
  import { AttributeFormats, type AttributeTypes, type IAttributeVersionsConf, type IEmbeddedAttribute } from '../../../_types/attribute';
8
+ export interface IGlobalThis {
9
+ guestUser: IE2EUserParams;
10
+ nonAdminUser: IE2EUserParams;
11
+ nonAdminGroupId: string;
12
+ }
8
13
  interface IE2EUser {
9
14
  getAuthToken: () => Promise<string>;
10
15
  }
16
+ interface IE2EUserParams {
17
+ userId: string;
18
+ groupsId: string[];
19
+ }
11
20
  export declare const e2eAdminUser: () => IE2EUser;
12
- export declare const e2eGuestUser: () => Promise<IE2EUser>;
21
+ export declare const e2eGuestUser: () => IE2EUser;
22
+ export declare const e2eNonAdminUser: () => IE2EUser;
23
+ export declare const e2eNonAdminGroupId: () => string;
13
24
  export declare function getGraphQLUrl(): Promise<string>;
14
25
  export declare class E2EGraphQLError extends Error {
15
26
  readonly response: AxiosResponse;
@@ -42,8 +53,6 @@ export declare function gqlSaveAttribute(params: {
42
53
  }): Promise<any>;
43
54
  export declare function gqlSaveTree(id: string, label: string, libraries: string[]): Promise<any>;
44
55
  export declare function gqlCreateRecord(library: string): Promise<string>;
45
- export declare function gqlGetAdminsGroupNodeId(): Promise<string>;
46
- export declare function gqlAddUserToGroup(groupNodeId: string): Promise<void>;
47
56
  /**
48
57
  * Add an element to the tree
49
58
  *
@@ -17,5 +17,13 @@ interface IMailpitMsgFull extends IMailpitMsgLight {
17
17
  HTML: string;
18
18
  Text: string;
19
19
  }
20
+ interface IMailpitSearchResult {
21
+ messages: IMailpitMsgLight[];
22
+ total: number;
23
+ unread: number;
24
+ }
20
25
  export declare function waitMailpitMessage(acceptMessage: (msg: IMailpitMsgLight) => boolean): Promise<IMailpitMsgFull>;
26
+ export declare function deleteMailpitMessagesBySearch(search: string): Promise<void>;
27
+ export declare function searchMailpitMessages(search: string): Promise<IMailpitSearchResult>;
28
+ export declare function waitForMailpitSearchMessage(search: string, timeoutMs?: number, intervalMs?: number): Promise<IMailpitMsgLight[]>;
21
29
  export {};
@@ -0,0 +1 @@
1
+ export declare const MASKED_VALUE = "\u25CF\u25CF\u25CF\u25CF\u25CF\u25CF\u25CF";
@@ -1,5 +1,6 @@
1
1
  import { type Options } from 'amqplib';
2
2
  import { type IKeyValue } from './shared';
3
+ import { type PermissionsActions, type AdminPermissionsActions, type ApplicationPermissionsActions, type AttributePermissionsActions, type LibraryPermissionsActions, type PermissionTypes, type RecordAttributePermissionsActions, type RecordPermissionsActions, type TreeNodePermissionsActions, type TreePermissionsActions } from './permissions';
3
4
  export interface IConfig {
4
5
  coreMode: CoreMode;
5
6
  server: IServer;
@@ -134,8 +135,26 @@ export interface ILang {
134
135
  available: string[];
135
136
  default: string;
136
137
  }
137
- export interface IPermissions {
138
+ type IPermissionsByActions<PermissionActions extends PermissionsActions> = {
139
+ [P in PermissionActions]?: boolean;
140
+ } & {
141
+ default?: boolean;
142
+ };
143
+ interface IPermissionsByTypesAndActions {
138
144
  default: boolean;
145
+ [PermissionTypes.ADMIN]?: IPermissionsByActions<AdminPermissionsActions>;
146
+ [PermissionTypes.APPLICATION]?: IPermissionsByActions<ApplicationPermissionsActions>;
147
+ [PermissionTypes.ATTRIBUTE]?: IPermissionsByActions<AttributePermissionsActions>;
148
+ [PermissionTypes.LIBRARY]?: IPermissionsByActions<LibraryPermissionsActions>;
149
+ [PermissionTypes.RECORD]?: IPermissionsByActions<RecordPermissionsActions>;
150
+ [PermissionTypes.RECORD_ATTRIBUTE]?: IPermissionsByActions<RecordAttributePermissionsActions>;
151
+ [PermissionTypes.TREE]?: IPermissionsByActions<TreePermissionsActions>;
152
+ [PermissionTypes.TREE_NODE]?: IPermissionsByActions<TreeNodePermissionsActions>;
153
+ [PermissionTypes.TREE_LIBRARY]?: IPermissionsByActions<TreeNodePermissionsActions>;
154
+ }
155
+ export interface IPermissions {
156
+ everybody: IPermissionsByTypesAndActions;
157
+ adminGroup: IPermissionsByTypesAndActions;
139
158
  enableCache: boolean;
140
159
  }
141
160
  export interface IAmqp {
@@ -280,3 +299,4 @@ export interface IMatomo {
280
299
  export interface ILogsCollector {
281
300
  queue: string;
282
301
  }
302
+ export {};
@@ -77,6 +77,9 @@ export declare enum Errors {
77
77
  TOO_MUCH_LIBRARIES_ON_FILES_TREE = "TOO_MUCH_LIBRARIES_ON_FILES_TREE",
78
78
  UNBINDED_ATTRIBUTES = "UNBINDED_ATTRIBUTES",
79
79
  UNIQUE_VALUE_NOT_ALLOWED = "UNIQUE_VALUE_NOT_ALLOWED",
80
+ UNSUPPORTED_ATTRIBUTE_TYPE = "UNSUPPORTED_ATTRIBUTE_TYPE",
81
+ UNSUPPORTED_ATTRIBUTE_MULTI_VALUE = "UNSUPPORTED_ATTRIBUTE_MULTI_VALUE",
82
+ UNSUPPORTED_ATTRIBUTE_WITH_ACTIONS = "UNSUPPORTED_ATTRIBUTE_WITH_ACTIONS",
80
83
  UNKNOWN_API_KEY = "UNKNOWN_API_KEY",
81
84
  UNKNOWN_APPLICATION = "UNKNOWN_APPLICATION",
82
85
  UNKNOWN_ATTRIBUTE = "UNKNOWN_ATTRIBUTE",
@@ -8,15 +8,16 @@ import { type IRecord } from './record';
8
8
  import { type IValue } from './value';
9
9
  import { type IVersionProfile } from './versionProfile';
10
10
  import { type IPermission } from './permissions';
11
- import { type ITree } from './tree';
11
+ import { type ITreeDbEvent, type ITree } from './tree';
12
+ type OnlyObject<T> = T extends object ? T : never;
12
13
  /**
13
14
  * Maybe move all DBPayloadData types in @leav/utils type to allow event consumers outside core to use them
14
15
  * without having to redeclare them. For now before and after are any in @leav/utils
15
16
  */
16
17
  export interface IDbPayloadInternal<DBPayloadAction extends EventAction> extends IDbPayload {
17
18
  action: DBPayloadAction;
18
- before?: IDBPayloadData<DBPayloadAction>;
19
- after?: IDBPayloadData<DBPayloadAction>;
19
+ before?: OnlyObject<IDBPayloadData<DBPayloadAction>>;
20
+ after?: OnlyObject<IDBPayloadData<DBPayloadAction>>;
20
21
  }
21
22
  interface IDBPayloadDataMap {
22
23
  [EventAction.VALUE_SAVE]: IValue;
@@ -34,9 +35,9 @@ interface IDBPayloadDataMap {
34
35
  [EventAction.LIBRARY_DELETE]: ILibraryDbEvent;
35
36
  [EventAction.VERSION_PROFILE_SAVE]: IVersionProfile;
36
37
  [EventAction.VERSION_PROFILE_DELETE]: IVersionProfile;
37
- [EventAction.TREE_ADD_ELEMENT]: string;
38
- [EventAction.TREE_DELETE_ELEMENT]: string;
39
- [EventAction.TREE_MOVE_ELEMENT]: string;
38
+ [EventAction.TREE_ADD_ELEMENT]: ITreeDbEvent;
39
+ [EventAction.TREE_DELETE_ELEMENT]: ITreeDbEvent;
40
+ [EventAction.TREE_MOVE_ELEMENT]: ITreeDbEvent;
40
41
  [EventAction.TREE_SAVE]: ITree;
41
42
  [EventAction.TREE_DELETE]: ITree;
42
43
  [EventAction.PERMISSION_SAVE]: IPermission;
@@ -11,7 +11,7 @@ export interface INotification {
11
11
  content: INotificationContent;
12
12
  }
13
13
  export interface INotificationContent {
14
- level: 'info' | 'warning';
14
+ level: 'success' | 'info' | 'warning' | 'error';
15
15
  title: string;
16
16
  message: string;
17
17
  relatedEntities?: Array<{
@@ -63,7 +63,8 @@ export declare enum TaskType {
63
63
  EXPORT = "EXPORT",
64
64
  IMPORT_CONFIG = "IMPORT_CONFIG",
65
65
  IMPORT_DATA = "IMPORT_DATA",
66
- INDEXATION = "INDEXATION"
66
+ INDEXATION = "INDEXATION",
67
+ SAVE_VALUE_BULK = "SAVE_VALUE_BULK"
67
68
  }
68
69
  export interface ITaskRole {
69
70
  type: TaskType;
@@ -62,3 +62,8 @@ export interface ITreeEvent {
62
62
  };
63
63
  order: number;
64
64
  }
65
+ export interface ITreeDbEvent {
66
+ parentNode: {
67
+ id: string;
68
+ };
69
+ }
@@ -49,7 +49,7 @@ export interface IGenericValue extends ICommonGenericSaveValue {
49
49
  isInherited?: boolean;
50
50
  isCalculated?: boolean;
51
51
  }
52
- export interface IStandardValue extends IGenericValue {
52
+ export interface IStandardBaseValue {
53
53
  /**
54
54
  * Computed value after get actions on attribute are done
55
55
  * TODO remove that any when possible
@@ -62,14 +62,14 @@ export interface IStandardValue extends IGenericValue {
62
62
  */
63
63
  raw_payload?: any;
64
64
  }
65
- export interface ILinkValue extends IGenericValue {
65
+ export interface ILinkBaseValue {
66
66
  /**
67
67
  * Linked record
68
68
  * TODO remove optional when possible
69
69
  */
70
70
  payload?: IRecord;
71
71
  }
72
- export interface ITreeValue extends IGenericValue {
72
+ export interface ITreeBaseValue {
73
73
  /**
74
74
  * Linked tree node
75
75
  * TODO remove optional when possible
@@ -77,6 +77,13 @@ export interface ITreeValue extends IGenericValue {
77
77
  payload?: ITreeNode;
78
78
  treeId: string;
79
79
  }
80
+ export interface IStandardValue extends IGenericValue, IStandardBaseValue {
81
+ }
82
+ export interface ILinkValue extends IGenericValue, ILinkBaseValue {
83
+ }
84
+ export interface ITreeValue extends IGenericValue, ITreeBaseValue {
85
+ }
86
+ export type IBaseValue = IStandardBaseValue | ILinkBaseValue | ITreeBaseValue;
80
87
  export type IValue = IStandardValue | ILinkValue | ITreeValue;
81
88
  type IGenericSaveValue = ICommonGenericSaveValue;
82
89
  export interface ISaveStandardValue extends IGenericSaveValue {
@@ -106,6 +113,7 @@ export interface IValuesOptions {
106
113
  version?: IValueVersion;
107
114
  forceArray?: boolean;
108
115
  forceGetAllValues?: boolean;
116
+ skipActions?: boolean;
109
117
  [optionName: string]: any;
110
118
  }
111
119
  export interface IFindValueTree {
@@ -136,4 +144,19 @@ export interface ISaveValueByAttributeType {
136
144
  [AttributeTypes.ADVANCED_LINK]: ISaveLinkValue;
137
145
  [AttributeTypes.TREE]: ISaveTreeValue;
138
146
  }
147
+ export interface IBaseValueByAttributeType {
148
+ [AttributeTypes.SIMPLE]: IStandardBaseValue;
149
+ [AttributeTypes.SIMPLE_LINK]: ILinkBaseValue;
150
+ [AttributeTypes.ADVANCED]: IStandardBaseValue;
151
+ [AttributeTypes.ADVANCED_LINK]: ILinkBaseValue;
152
+ [AttributeTypes.TREE]: ITreeBaseValue;
153
+ }
154
+ export type IValuesOccurrences<SimpleValueType extends IBaseValue = IBaseValue> = Array<{
155
+ value: SimpleValueType;
156
+ count: number;
157
+ }>;
158
+ export interface IValuesOccurrencesResult<BaseValueType extends IBaseValue = IBaseValue> {
159
+ occurrences: IValuesOccurrences<BaseValueType>;
160
+ noValueCount: number;
161
+ }
139
162
  export {};
@@ -4,13 +4,15 @@ import { type IRecordDomain } from 'domain/record/recordDomain';
4
4
  import { type IValueDomain } from 'domain/value/valueDomain';
5
5
  import { type IUtils } from 'utils/utils';
6
6
  import { type IGraphqlAppModule } from 'app/graphql/graphqlApp';
7
+ import { type ISaveValueBulkTask } from '../../domain/value/tasks/saveValueBulk';
7
8
  export type ICoreValueApp = IGraphqlAppModule;
8
9
  interface IDeps {
9
10
  'core.domain.value': IValueDomain;
10
11
  'core.domain.attribute': IAttributeDomain;
11
12
  'core.domain.record': IRecordDomain;
13
+ 'core.domain.value.tasks.saveValueBulk': ISaveValueBulkTask;
12
14
  'core.app.helpers.convertVersionFromGqlFormat': ConvertVersionFromGqlFormatFunc;
13
15
  'core.utils': IUtils;
14
16
  }
15
- export default function ({ 'core.domain.value': valueDomain, 'core.domain.record': recordDomain, 'core.domain.attribute': attributeDomain, 'core.app.helpers.convertVersionFromGqlFormat': convertVersionFromGqlFormat, 'core.utils': utils, }: IDeps): ICoreValueApp;
17
+ export default function ({ 'core.domain.value': valueDomain, 'core.domain.record': recordDomain, 'core.domain.value.tasks.saveValueBulk': saveValueBulkTask, 'core.domain.attribute': attributeDomain, 'core.app.helpers.convertVersionFromGqlFormat': convertVersionFromGqlFormat, 'core.utils': utils, }: IDeps): ICoreValueApp;
16
18
  export {};
@@ -8,7 +8,7 @@ import { type ILibraryPermissionDomain } from 'domain/permission/libraryPermissi
8
8
  import { type SendRecordUpdateEventHelper } from 'domain/record/helpers/sendRecordUpdateEvent';
9
9
  import { type ITreeDomain } from 'domain/tree/treeDomain';
10
10
  import { type IValueDomain } from 'domain/value/valueDomain';
11
- import { type FileUpload } from 'graphql-upload';
11
+ import { type FileUpload } from 'graphql-upload/Upload.mjs';
12
12
  import { type i18n } from 'i18next';
13
13
  import { type IRecordRepo } from 'infra/record/recordRepo';
14
14
  import { type IUtils } from 'utils/utils';
@@ -1,4 +1,4 @@
1
- import { type FileUpload } from 'graphql-upload';
1
+ import { type FileUpload } from 'graphql-upload/Upload.mjs';
2
2
  import { type Progress } from 'progress-stream';
3
3
  export type StoreUploadFileFunc = (fileData: FileUpload, path: string, onProgress?: (progress: Progress) => Promise<void>, size?: number) => Promise<void>;
4
4
  export default function (): (fileData: FileUpload, path: string, onProgress?: (progress: Progress) => void, size?: number) => Promise<void>;
@@ -1,7 +1,7 @@
1
1
  import { type IAdminPermissionDomain } from 'domain/permission/adminPermissionDomain';
2
2
  import { type IQueryInfos } from '_types/queryInfos';
3
3
  import { AdminPermissionsActions } from '../../../_types/permissions';
4
- declare const _default: (existingLib: boolean, userId: string, deps: {
4
+ declare const _default: (existingLib: boolean, deps: {
5
5
  adminPermissionDomain: IAdminPermissionDomain;
6
6
  }, ctx: IQueryInfos) => Promise<{
7
7
  canSave: boolean;
@@ -1,6 +1,5 @@
1
1
  import { type AdminPermissionsActions, type ApplicationPermissionsActions, type AttributePermissionsActions, type IPermissionsTreeTarget, type ITreePermissionsConf, type LibraryPermissionsActions, type PermissionsActions, type PermissionTypes, type RecordAttributePermissionsActions, type RecordPermissionsActions, type TreeNodePermissionsActions, type TreePermissionsActions } from '_types/permissions';
2
2
  import { type IQueryInfos } from '_types/queryInfos';
3
- import { type TreePath } from '_types/tree';
4
3
  import { type IGetDefaultPermissionParams } from './helpers/defaultPermission';
5
4
  export declare const PERMISSIONS_CACHE_HEADER = "permissions";
6
5
  export declare const PERMISSIONS_NULL_PLACEHOLDER = "__null__";
@@ -31,7 +30,6 @@ export type PermByActionsRes = {
31
30
  } | null;
32
31
  export interface IGetAdminPermissionParams {
33
32
  action: AdminPermissionsActions;
34
- userId: string;
35
33
  ctx: IQueryInfos;
36
34
  }
37
35
  export interface IGetInheritedAdminPermissionParams {
@@ -42,13 +40,11 @@ export interface IGetInheritedAdminPermissionParams {
42
40
  export interface IGetLibraryPermissionParams {
43
41
  action: LibraryPermissionsActions;
44
42
  libraryId: string;
45
- userId: string;
46
43
  ctx: IQueryInfos;
47
44
  }
48
45
  export interface IGetTreePermissionParams {
49
46
  action: TreePermissionsActions;
50
47
  treeId: string;
51
- userId: string;
52
48
  ctx: IQueryInfos;
53
49
  }
54
50
  export type GetDefaultTreeLibraryPermission = (params: IGetDefaultPermissionParams) => boolean | null;
@@ -56,27 +52,20 @@ export interface IGetTreeLibraryPermissionParams {
56
52
  action: TreeNodePermissionsActions;
57
53
  treeId: string;
58
54
  libraryId: string;
59
- userId: string;
60
55
  getDefaultTreeLibraryPermission?: GetDefaultTreeLibraryPermission;
61
56
  ctx: IQueryInfos;
62
57
  }
63
58
  export interface IGetApplicationPermissionParams {
64
59
  action: ApplicationPermissionsActions;
65
60
  applicationId: string;
66
- userId: string;
67
61
  ctx: IQueryInfos;
68
62
  }
69
63
  export interface IGetDefaultGlobalPermissionParams extends IGetDefaultPermissionParams {
70
- type?: PermissionTypes;
71
64
  applyTo?: string;
72
- userId?: string;
73
- userGroups?: TreePath[];
74
- action?: PermissionsActions;
75
65
  }
76
66
  export type GetDefaultGlobalPermission = (params: IGetDefaultGlobalPermissionParams) => Promise<boolean> | boolean;
77
67
  export interface IGetTreeNodePermissionParams {
78
68
  action: TreeNodePermissionsActions;
79
- userId: string;
80
69
  nodeId: string;
81
70
  treeId: string;
82
71
  ctx: IQueryInfos;
@@ -137,7 +126,6 @@ export interface IGetInheritedPermissionsParams {
137
126
  export interface IIsAllowedParams {
138
127
  type: PermissionTypes;
139
128
  action: PermissionsActions;
140
- userId: string;
141
129
  applyTo?: string;
142
130
  target?: IPermissionTarget;
143
131
  ctx: IQueryInfos;
@@ -157,7 +145,6 @@ export interface IGetRecordAttributeHeritedPermissionsParams {
157
145
  export interface IGetTreeBasedPermissionParams {
158
146
  type: PermissionTypes;
159
147
  action: PermissionsActions;
160
- userId: string;
161
148
  applyTo: string;
162
149
  treeValues: {
163
150
  [treeAttributeId: string]: string[];
@@ -175,7 +162,6 @@ export interface IGetInheritedTreeBasedPermissionParams {
175
162
  }
176
163
  export interface IGetRecordPermissionParams {
177
164
  action: RecordPermissionsActions;
178
- userId: string;
179
165
  library: string;
180
166
  recordId: string;
181
167
  ctx: IQueryInfos;
@@ -190,7 +176,6 @@ export interface IGetInheritedRecordPermissionParams {
190
176
  }
191
177
  export interface IEstimateTreeValueRecordPermissionParams {
192
178
  action: RecordPermissionsActions;
193
- userId: string;
194
179
  libraryId: string;
195
180
  attributeId: string;
196
181
  nodeId: string;
@@ -1,7 +1,7 @@
1
1
  import { type IGlobalPermissionHelper } from './helpers/globalPermission';
2
2
  import { type IGetAdminPermissionParams, type IGetInheritedAdminPermissionParams } from './_types';
3
3
  export interface IAdminPermissionDomain {
4
- getAdminPermission({ action, userId, ctx }: IGetAdminPermissionParams): Promise<boolean>;
4
+ getAdminPermission({ action, ctx }: IGetAdminPermissionParams): Promise<boolean>;
5
5
  getInheritedAdminPermission({ action, userGroupId, ctx }: IGetInheritedAdminPermissionParams): Promise<boolean>;
6
6
  }
7
7
  interface IDeps {
@@ -1,14 +1,20 @@
1
1
  import { type IConfig } from '_types/config';
2
+ import { PermissionTypes, type PermissionsActions } from '../../../_types/permissions';
2
3
  import { type IQueryInfos } from '_types/queryInfos';
4
+ import { type TreePath } from '_types/tree';
3
5
  interface IDeps {
4
6
  config: IConfig;
5
7
  }
6
8
  export interface IGetDefaultPermissionParams {
9
+ type: PermissionTypes;
10
+ action: PermissionsActions;
11
+ userGroups: TreePath[];
7
12
  ctx: IQueryInfos;
8
13
  }
9
- export type GetDefaultPermission = ({ ctx }: IGetDefaultPermissionParams) => boolean;
14
+ export type GetDefaultPermission = ({ ctx, type, action, userGroups }: IGetDefaultPermissionParams) => boolean;
10
15
  export interface IDefaultPermissionHelper {
11
16
  getDefaultPermission: GetDefaultPermission;
17
+ getAdminDefaultPermissionOrNull: GetDefaultPermission;
12
18
  }
13
19
  export default function ({ config }: IDeps): IDefaultPermissionHelper;
14
20
  export {};
@@ -15,6 +15,7 @@ import { type ITreeLibraryPermissionDomain } from './treeLibraryPermissionDomain
15
15
  import { type ITreeNodePermissionDomain } from './treeNodePermissionDomain';
16
16
  import { type ITreePermissionDomain } from './treePermissionDomain';
17
17
  import { type IGetActionsByTypeParams, type IGetInheritedPermissionsParams, type IGetPermissionsByActionsParams, type IIsAllowedParams, type PermByActionsRes } from './_types';
18
+ import { type IDefaultPermissionHelper } from './helpers/defaultPermission';
18
19
  export interface IPermissionDomain {
19
20
  savePermission(permData: IPermission, ctx: IQueryInfos): Promise<IPermission>;
20
21
  getPermissionsByActions({ type, applyTo, actions, usersGroupNodeId, permissionTreeTarget, ctx, }: IGetPermissionsByActionsParams): Promise<PermByActionsRes>;
@@ -22,7 +23,7 @@ export interface IPermissionDomain {
22
23
  * Retrieve herited permission: ignore permission defined on given element, force retrieval of herited permission
23
24
  */
24
25
  getInheritedPermissions({ type, applyTo, action, userGroupId, permissionTreeTarget, ctx, }: IGetInheritedPermissionsParams): Promise<boolean>;
25
- isAllowed({ type, action, userId, applyTo, target, ctx }: IIsAllowedParams): Promise<boolean>;
26
+ isAllowed({ type, action, applyTo, target, ctx }: IIsAllowedParams): Promise<boolean>;
26
27
  getActionsByType(params: IGetActionsByTypeParams): ILabeledPermissionsAction[];
27
28
  registerActions(type: PermissionTypes, actions: string[], applyOn?: string[]): void;
28
29
  isAdminOrSystemUser(ctx: IQueryInfos): boolean;
@@ -37,6 +38,7 @@ export interface IPermissionDomainDeps {
37
38
  'core.domain.permission.treeNode': ITreeNodePermissionDomain;
38
39
  'core.domain.permission.treeLibrary': ITreeLibraryPermissionDomain;
39
40
  'core.domain.permission.application': IApplicationPermissionDomain;
41
+ 'core.domain.permission.helpers.defaultPermission': IDefaultPermissionHelper;
40
42
  'core.domain.eventsManager': IEventsManagerDomain;
41
43
  'core.infra.permission': IPermissionRepo;
42
44
  'core.infra.cache.cacheService': ICachesService;
@@ -1,23 +1,21 @@
1
1
  import { type IValueRepo } from 'infra/value/valueRepo';
2
2
  import { type IQueryInfos } from '_types/queryInfos';
3
- import { type RecordAttributePermissionsActions } from '../../_types/permissions';
3
+ import { RecordAttributePermissionsActions } from '../../_types/permissions';
4
4
  import { type IAttributeDomain } from '../attribute/attributeDomain';
5
5
  import { type IAttributePermissionDomain } from './attributePermissionDomain';
6
- import { type IDefaultPermissionHelper } from './helpers/defaultPermission';
7
6
  import { type IPermissionByUserGroupsHelper } from './helpers/permissionByUserGroups';
8
7
  import { type ITreeBasedPermissionHelper } from './helpers/treeBasedPermissions';
9
8
  import { type IGetRecordAttributeHeritedPermissionsParams as IGetRecordAttributeInheritedPermissionsParams } from './_types';
10
9
  import { type IRecordRepo } from '../../infra/record/recordRepo';
11
10
  import { type IRecordInCreationBypassHelper } from './helpers/recordInCreationBypass';
12
11
  export interface IRecordAttributePermissionDomain {
13
- getRecordAttributePermission(action: RecordAttributePermissionsActions, userGroupId: string, attributeId: string, recordLibrary: string, recordId: string, ctx: IQueryInfos): Promise<boolean>;
12
+ getRecordAttributePermission(action: RecordAttributePermissionsActions, attributeId: string, recordLibrary: string, recordId: string, ctx: IQueryInfos): Promise<boolean>;
14
13
  getInheritedRecordAttributePermission(params: IGetRecordAttributeInheritedPermissionsParams, ctx: IQueryInfos): Promise<boolean>;
15
14
  }
16
15
  export interface IRecordAttributePermissionDomainDeps {
17
16
  'core.domain.permission.attribute': IAttributePermissionDomain;
18
17
  'core.domain.permission.helpers.treeBasedPermissions': ITreeBasedPermissionHelper;
19
18
  'core.domain.permission.helpers.permissionByUserGroups': IPermissionByUserGroupsHelper;
20
- 'core.domain.permission.helpers.defaultPermission': IDefaultPermissionHelper;
21
19
  'core.domain.permission.helpers.recordInCreationBypass': IRecordInCreationBypassHelper;
22
20
  'core.domain.attribute': IAttributeDomain;
23
21
  'core.infra.value': IValueRepo;
@@ -1,7 +1,6 @@
1
1
  import { type GetCoreEntityByIdFunc } from 'domain/helpers/getCoreEntityById';
2
2
  import { type IValueRepo } from 'infra/value/valueRepo';
3
3
  import { type IAttributeDomain } from '../attribute/attributeDomain';
4
- import { type IDefaultPermissionHelper } from './helpers/defaultPermission';
5
4
  import { type IPermissionByUserGroupsHelper } from './helpers/permissionByUserGroups';
6
5
  import { type ITreeBasedPermissionHelper } from './helpers/treeBasedPermissions';
7
6
  import { type ILibraryPermissionDomain } from './libraryPermissionDomain';
@@ -18,7 +17,6 @@ export interface IRecordPermissionDomainDeps {
18
17
  'core.domain.permission.library': ILibraryPermissionDomain;
19
18
  'core.domain.permission.helpers.treeBasedPermissions': ITreeBasedPermissionHelper;
20
19
  'core.domain.permission.helpers.permissionByUserGroups': IPermissionByUserGroupsHelper;
21
- 'core.domain.permission.helpers.defaultPermission': IDefaultPermissionHelper;
22
20
  'core.domain.permission.helpers.recordInCreationBypass': IRecordInCreationBypassHelper;
23
21
  'core.domain.attribute': IAttributeDomain;
24
22
  'core.domain.helpers.getCoreEntityById': GetCoreEntityByIdFunc;
@@ -0,0 +1,38 @@
1
+ import { type ILibraryPermissionDomain } from 'domain/permission/libraryPermissionDomain';
2
+ import { type IRecordRepo } from 'infra/record/recordRepo';
3
+ import { type IQueryInfos } from '../../../_types/queryInfos';
4
+ import { type IRecord } from '../../../_types/record';
5
+ import { type IFindRecordParams } from '../_types';
6
+ import { type IPermissionRepo } from '../../../infra/permission/permissionRepo';
7
+ import { type IListWithCursor } from '../../../_types/list';
8
+ import { type IValidateHelper } from '../../helpers/validate';
9
+ import { type IUtils } from '../../../utils/utils';
10
+ import { type IAttributeDomain } from '../../attribute/attributeDomain';
11
+ import { type ILibraryRepo } from '../../../infra/library/libraryRepo';
12
+ import { type ITreeRepo } from '../../../infra/tree/treeRepo';
13
+ import { type GetCoreEntityByIdFunc } from '../../helpers/getCoreEntityById';
14
+ import { type IElementAncestorsHelper } from '../../tree/helpers/elementAncestors';
15
+ import { type IDefaultPermissionHelper } from '../../permission/helpers/defaultPermission';
16
+ /**
17
+ * Search records
18
+ * Filters to apply on records selection
19
+ * Fields to retrieve on each records
20
+ */
21
+ export type FindRecordsHelper = ({ params, ctx, }: {
22
+ params: IFindRecordParams;
23
+ ctx: IQueryInfos;
24
+ }) => Promise<IListWithCursor<IRecord>>;
25
+ export interface IFindRecordsHelperDeps {
26
+ 'core.domain.helpers.validate': IValidateHelper;
27
+ 'core.domain.permission.library': ILibraryPermissionDomain;
28
+ 'core.domain.attribute': IAttributeDomain;
29
+ 'core.infra.record': IRecordRepo;
30
+ 'core.infra.library': ILibraryRepo;
31
+ 'core.infra.tree': ITreeRepo;
32
+ 'core.utils': IUtils;
33
+ 'core.domain.helpers.getCoreEntityById': GetCoreEntityByIdFunc;
34
+ 'core.domain.tree.helpers.elementAncestors': IElementAncestorsHelper;
35
+ 'core.domain.permission.helpers.defaultPermission': IDefaultPermissionHelper;
36
+ 'core.infra.permission': IPermissionRepo;
37
+ }
38
+ export default function ({ 'core.domain.helpers.validate': validateHelper, 'core.domain.attribute': attributeDomain, 'core.domain.permission.helpers.defaultPermission': defaultPermHelper, 'core.infra.library': libraryRepo, 'core.domain.permission.library': libraryPermissionDomain, 'core.infra.record': recordRepo, 'core.domain.helpers.getCoreEntityById': getCoreEntityById, 'core.infra.tree': treeRepo, 'core.domain.tree.helpers.elementAncestors': elementAncestorsHelper, 'core.infra.permission': permissionRepo, 'core.utils': utils, }: IFindRecordsHelperDeps): FindRecordsHelper;
@@ -2,3 +2,4 @@ export { default as createRecord } from './createRecord';
2
2
  export { default as deleteRecord } from './deleteRecord';
3
3
  export { default as sendRecordUpdateEvent } from './sendRecordUpdateEvent';
4
4
  export { default as getAccessPermissionFilters } from './getAccessPermissionFilters';
5
+ export { default as findRecords } from './findRecords';
@@ -1,12 +1,9 @@
1
1
  import { type IEventsManagerDomain } from 'domain/eventsManager/eventsManagerDomain';
2
2
  import { type GetCoreEntityByIdFunc } from 'domain/helpers/getCoreEntityById';
3
3
  import { type IValidateHelper } from 'domain/helpers/validate';
4
- import { type ILibraryPermissionDomain } from 'domain/permission/libraryPermissionDomain';
5
4
  import { type IValueDomain } from 'domain/value/valueDomain';
6
5
  import { type i18n } from 'i18next';
7
- import { type ILibraryRepo } from 'infra/library/libraryRepo';
8
6
  import { type IRecordRepo } from 'infra/record/recordRepo';
9
- import { type ITreeRepo } from 'infra/tree/treeRepo';
10
7
  import { type IUtils } from 'utils/utils';
11
8
  import type * as Config from '_types/config';
12
9
  import { type IListWithCursor } from '_types/list';
@@ -19,13 +16,11 @@ import { type IRecordPermissionDomain } from '../permission/recordPermissionDoma
19
16
  import { type SendRecordUpdateEventHelper } from './helpers/sendRecordUpdateEvent';
20
17
  import { type ICreateRecordResult, type IFindRecordParams } from './_types';
21
18
  import { type IFormRepo } from 'infra/form/formRepo';
22
- import { type IRecordAttributePermissionDomain } from '../permission/recordAttributePermissionDomain';
23
- import { type IPermissionRepo } from '../../infra/permission/permissionRepo';
24
- import { type IDefaultPermissionHelper } from 'domain/permission/helpers/defaultPermission';
25
19
  import { type DeleteRecordHelper } from './helpers/deleteRecord';
26
20
  import { type CreateRecordHelper } from './helpers/createRecord';
27
21
  import { type IElementAncestorsHelper } from 'domain/tree/helpers/elementAncestors';
28
22
  import { type ILogger } from '@leav/logger';
23
+ import { type FindRecordsHelper } from './helpers/findRecords';
29
24
  export declare const ATTRIBUTE_ACTIVE = "active";
30
25
  export interface IRecordDomain {
31
26
  /**
@@ -73,16 +68,7 @@ export interface IRecordDomain {
73
68
  ctx: IQueryInfos;
74
69
  }): Promise<IListWithCursor<IRecord>>;
75
70
  /**
76
- * Get the value of targeted attribute with actions applied on it including metadata.
77
- *
78
- * Avoid requesting DB if attribute already found in `record` param.
79
- *
80
- * @param {Object} params
81
- * @param params.library
82
- * @param params.record Could be emulated with only `{ id: <real_id> }`
83
- * @param params.attributeId
84
- * @param params.options
85
- * @param params.ctx
71
+ * @deprecated use valueDomain.getRecordFieldValue instead
86
72
  */
87
73
  getRecordFieldValue({ library, record, attributeId, options, ctx, }: {
88
74
  library: string;
@@ -122,23 +108,18 @@ export interface IRecordDomainDeps {
122
108
  'core.domain.attribute': IAttributeDomain;
123
109
  'core.domain.value': IValueDomain;
124
110
  'core.domain.permission.record': IRecordPermissionDomain;
125
- 'core.domain.permission.library': ILibraryPermissionDomain;
126
- 'core.domain.permission.recordAttribute': IRecordAttributePermissionDomain;
127
- 'core.domain.permission.helpers.defaultPermission': IDefaultPermissionHelper;
128
111
  'core.domain.helpers.getCoreEntityById': GetCoreEntityByIdFunc;
129
112
  'core.domain.helpers.validate': IValidateHelper;
130
113
  'core.domain.record.helpers.createRecord': CreateRecordHelper;
131
114
  'core.domain.record.helpers.deleteRecord': DeleteRecordHelper;
115
+ 'core.domain.record.helpers.findRecords': FindRecordsHelper;
132
116
  'core.domain.record.helpers.sendRecordUpdateEvent': SendRecordUpdateEventHelper;
133
- 'core.infra.library': ILibraryRepo;
134
- 'core.infra.tree': ITreeRepo;
135
117
  'core.domain.tree.helpers.elementAncestors': IElementAncestorsHelper;
136
118
  'core.infra.form': IFormRepo;
137
- 'core.infra.permission': IPermissionRepo;
138
119
  'core.domain.eventsManager': IEventsManagerDomain;
139
120
  'core.infra.cache.cacheService': ICachesService;
140
121
  'core.utils.logger': ILogger;
141
122
  'core.utils': IUtils;
142
123
  translator: i18n;
143
124
  }
144
- export default function ({ config, 'core.infra.record': recordRepo, 'core.domain.attribute': attributeDomain, 'core.domain.value': valueDomain, 'core.domain.permission.record': recordPermissionDomain, 'core.domain.permission.library': libraryPermissionDomain, 'core.domain.permission.recordAttribute': recordAttributePermissionDomain, 'core.domain.permission.helpers.defaultPermission': defaultPermHelper, 'core.domain.helpers.getCoreEntityById': getCoreEntityById, 'core.domain.helpers.validate': validateHelper, 'core.domain.record.helpers.createRecord': createRecordHelper, 'core.domain.record.helpers.deleteRecord': deleteRecordHelper, 'core.domain.record.helpers.sendRecordUpdateEvent': sendRecordUpdateEvent, 'core.infra.library': libraryRepo, 'core.infra.tree': treeRepo, 'core.domain.tree.helpers.elementAncestors': elementAncestorsHelper, 'core.infra.form': formRepo, 'core.infra.permission': permissionRepo, 'core.domain.eventsManager': eventsManager, 'core.infra.cache.cacheService': cacheService, 'core.utils.logger': logger, 'core.utils': utils, translator, }: IRecordDomainDeps): IRecordDomain;
125
+ export default function ({ config, 'core.infra.record': recordRepo, 'core.domain.attribute': attributeDomain, 'core.domain.value': valueDomain, 'core.domain.permission.record': recordPermissionDomain, 'core.domain.record.helpers.findRecords': findRecordsHelper, 'core.domain.helpers.getCoreEntityById': getCoreEntityById, 'core.domain.helpers.validate': validateHelper, 'core.domain.record.helpers.createRecord': createRecordHelper, 'core.domain.record.helpers.deleteRecord': deleteRecordHelper, 'core.domain.record.helpers.sendRecordUpdateEvent': sendRecordUpdateEvent, 'core.domain.tree.helpers.elementAncestors': elementAncestorsHelper, 'core.infra.form': formRepo, 'core.domain.eventsManager': eventsManager, 'core.infra.cache.cacheService': cacheService, 'core.utils.logger': logger, 'core.utils': utils, translator, }: IRecordDomainDeps): IRecordDomain;
@@ -20,6 +20,7 @@ export interface IUserDomain {
20
20
  saveUserData(params: ISaveUserDataParams): Promise<IUserData>;
21
21
  getUserData(keys: string[], global: boolean, ctx: IQueryInfos): Promise<IUserData>;
22
22
  sendResetPasswordEmail(email: string, token: string, login: string, browser: string, os: string, lang: 'fr' | 'en', ctx: IQueryInfos): Promise<void>;
23
+ verifyPassword(userId: string, password: string, ctx: IQueryInfos): Promise<boolean>;
23
24
  }
24
25
  export interface IUserDomainDeps {
25
26
  config: Config.IConfig;
@@ -0,0 +1 @@
1
+ export { default as saveValueBulk } from './saveValueBulk';
@@ -0,0 +1,36 @@
1
+ import { type IValidateHelper } from 'domain/helpers/validate';
2
+ import { type IValueDomain } from 'domain/value/valueDomain';
3
+ import { type i18n } from 'i18next';
4
+ import type * as Config from '_types/config';
5
+ import { type IQueryInfos } from '../../../_types/queryInfos';
6
+ import { type IRecordFilterLight } from '../../../_types/record';
7
+ import { type ITreeNode } from '../../../_types/tree';
8
+ import { type IAttributeDomain } from '../../attribute/attributeDomain';
9
+ import { type FindRecordsHelper } from '../../record/helpers/findRecords';
10
+ import { type ITaskFuncParams } from '../../../_types/tasksManager';
11
+ import { type ITasksManagerDomain } from '../../tasksManager/tasksManagerDomain';
12
+ import { type INotificationDomain } from '../../notification/notificationDomain';
13
+ export interface ISaveValueBulkParams {
14
+ libraryId: string;
15
+ recordsFilters: IRecordFilterLight[];
16
+ attributeId: string;
17
+ mapValues: Array<{
18
+ before: ITreeNode['id'] | null;
19
+ after: ITreeNode['id'] | null;
20
+ }>;
21
+ ctx: IQueryInfos;
22
+ }
23
+ export interface ISaveValueBulkTask {
24
+ saveValueBulk: (params: ISaveValueBulkParams, task?: ITaskFuncParams) => Promise<string>;
25
+ }
26
+ export interface ISaveValueBulkTaskDeps {
27
+ config: Config.IConfig;
28
+ 'core.domain.helpers.validate': IValidateHelper;
29
+ 'core.domain.attribute': IAttributeDomain;
30
+ 'core.domain.tasksManager': ITasksManagerDomain;
31
+ 'core.domain.record.helpers.findRecords': FindRecordsHelper;
32
+ 'core.domain.notification': INotificationDomain;
33
+ translator: i18n;
34
+ 'core.domain.value': IValueDomain;
35
+ }
36
+ export default function ({ config, 'core.domain.helpers.validate': validate, 'core.domain.attribute': attributeDomain, 'core.domain.tasksManager': tasksManagerDomain, 'core.domain.notification': notificationDomain, 'core.domain.record.helpers.findRecords': findRecordsHelper, 'core.domain.value': valueDomain, translator, }: ISaveValueBulkTaskDeps): ISaveValueBulkTask;
@@ -11,20 +11,21 @@ import { type IValueRepo } from 'infra/value/valueRepo';
11
11
  import { type IUtils } from 'utils/utils';
12
12
  import { type ILogger } from '@leav/logger';
13
13
  import type * as Config from '_types/config';
14
- import { type IRecord } from '_types/record';
14
+ import { type IRecordFilterLight, type IRecord } from '_types/record';
15
15
  import { type IAttribute } from '../../_types/attribute';
16
16
  import { type IQueryInfos } from '../../_types/queryInfos';
17
- import { type ISaveValue, type IValue, type IValuesOptions } from '../../_types/value';
17
+ import { type IValueVersion, type ISaveValue, type IValue, type IValuesOptions, type IValuesOccurrencesResult } from '../../_types/value';
18
18
  import { type IActionsListDomain } from '../actionsList/actionsListDomain';
19
19
  import { type IAttributeDomain } from '../attribute/attributeDomain';
20
20
  import { type IValidateHelper } from '../helpers/validate';
21
21
  import { type IRecordAttributePermissionDomain } from '../permission/recordAttributePermissionDomain';
22
22
  import { type IRecordPermissionDomain } from '../permission/recordPermissionDomain';
23
- import { type IDeleteValueParams, type IRunActionListParams } from './_types';
23
+ import { type IDeleteValueParams } from './_types';
24
24
  import { type DeleteRecordHelper } from 'domain/record/helpers/deleteRecord';
25
25
  import { type CreateRecordHelper } from 'domain/record/helpers/createRecord';
26
26
  import { type IfLibraryJoinLinkAttribute } from '../attribute/helpers/ifLibraryJoinLinkAttribute';
27
27
  import { type IRecordInCreationBypassHelper } from '../permission/helpers/recordInCreationBypass';
28
+ import { type FindRecordsHelper } from 'domain/record/helpers/findRecords';
28
29
  export interface ISaveBatchValueError {
29
30
  type: string;
30
31
  message: string;
@@ -87,7 +88,34 @@ export interface IValueDomain {
87
88
  library: string;
88
89
  ctx: IQueryInfos;
89
90
  }): Promise<IValue>;
90
- runActionsList(params: IRunActionListParams): Promise<IValue[]>;
91
+ /**
92
+ * Get the value of targeted attribute with actions applied on it including metadata.
93
+ *
94
+ * Avoid requesting DB if attribute already found in `record` param.
95
+ *
96
+ * @param {Object} params
97
+ * @param params.library
98
+ * @param params.record Could be emulated with only `{ id: <real_id> }`
99
+ * @param params.attributeId
100
+ * @param params.options
101
+ * @param params.ctx
102
+ */
103
+ getRecordFieldValue(params: {
104
+ library: string;
105
+ record: IRecord;
106
+ attributeId: string;
107
+ options?: IValuesOptions;
108
+ ctx: IQueryInfos;
109
+ }): Promise<IValue[]>;
110
+ countValuesOccurrences({ libraryId, attributeId, recordFilters, options, ctx, }: {
111
+ libraryId: string;
112
+ attributeId: string;
113
+ recordFilters: IRecordFilterLight[];
114
+ options?: {
115
+ version?: IValueVersion;
116
+ };
117
+ ctx: IQueryInfos;
118
+ }): Promise<IValuesOccurrencesResult>;
91
119
  }
92
120
  export interface IValueDomainDeps {
93
121
  config: Config.IConfig;
@@ -103,6 +131,7 @@ export interface IValueDomainDeps {
103
131
  'core.domain.record.helpers.sendRecordUpdateEvent': SendRecordUpdateEventHelper;
104
132
  'core.domain.record.helpers.createRecord': CreateRecordHelper;
105
133
  'core.domain.record.helpers.deleteRecord': DeleteRecordHelper;
134
+ 'core.domain.record.helpers.findRecords': FindRecordsHelper;
106
135
  'core.domain.permission.helpers.recordInCreationBypass': IRecordInCreationBypassHelper;
107
136
  'core.domain.attribute.helpers.ifLibraryJoinLinkAttribute': IfLibraryJoinLinkAttribute;
108
137
  'core.domain.versionProfile': IVersionProfileDomain;
@@ -113,5 +142,5 @@ export interface IValueDomainDeps {
113
142
  'core.utils.logger': ILogger;
114
143
  'core.domain.tree': ITreeDomain;
115
144
  }
116
- declare const valueDomain: ({ config, "core.domain.actionsList": actionsListDomain, "core.domain.attribute": attributeDomain, "core.domain.permission.recordAttribute": recordAttributePermissionDomain, "core.domain.permission.record": recordPermissionDomain, "core.domain.eventsManager": eventsManager, "core.domain.helpers.validate": validate, "core.domain.helpers.updateRecordLastModif": updateRecordLastModif, "core.domain.tree.helpers.elementAncestors": elementAncestors, "core.domain.tree.helpers.getDefaultElement": getDefaultElementHelper, "core.domain.record.helpers.sendRecordUpdateEvent": sendRecordUpdateEvent, "core.domain.record.helpers.createRecord": createRecordHelper, "core.domain.permission.helpers.recordInCreationBypass": recordInCreationBypassHelper, "core.domain.record.helpers.deleteRecord": deleteRecordHelper, "core.domain.attribute.helpers.ifLibraryJoinLinkAttribute": ifLibraryJoinLinkAttribute, "core.domain.versionProfile": versionProfileDomain, "core.infra.record": recordRepo, "core.infra.tree": treeRepo, "core.infra.value": valueRepo, "core.utils": utils, "core.utils.logger": logger, }: IValueDomainDeps) => IValueDomain;
145
+ declare const valueDomain: ({ config, "core.domain.actionsList": actionsListDomain, "core.domain.attribute": attributeDomain, "core.domain.permission.recordAttribute": recordAttributePermissionDomain, "core.domain.permission.record": recordPermissionDomain, "core.domain.eventsManager": eventsManager, "core.domain.helpers.validate": validate, "core.domain.helpers.updateRecordLastModif": updateRecordLastModif, "core.domain.tree.helpers.elementAncestors": elementAncestors, "core.domain.tree.helpers.getDefaultElement": getDefaultElementHelper, "core.domain.record.helpers.sendRecordUpdateEvent": sendRecordUpdateEvent, "core.domain.record.helpers.createRecord": createRecordHelper, "core.domain.record.helpers.findRecords": findRecordsHelper, "core.domain.permission.helpers.recordInCreationBypass": recordInCreationBypassHelper, "core.domain.record.helpers.deleteRecord": deleteRecordHelper, "core.domain.attribute.helpers.ifLibraryJoinLinkAttribute": ifLibraryJoinLinkAttribute, "core.domain.versionProfile": versionProfileDomain, "core.infra.record": recordRepo, "core.infra.tree": treeRepo, "core.infra.value": valueRepo, "core.utils": utils, "core.utils.logger": logger, }: IValueDomainDeps) => IValueDomain;
117
146
  export default valueDomain;
@@ -2,7 +2,7 @@ import { type AqlLiteral, type GeneratedAqlQuery } from 'arangojs/aql';
2
2
  import { type IQueryInfos } from '_types/queryInfos';
3
3
  import { AttributeTypes, type IAttribute } from '../../_types/attribute';
4
4
  import { AttributeCondition, type IRecordFilterOption } from '../../_types/record';
5
- import { type ISaveValueByAttributeType, type IValueByAttributeType, type IValuesOptions } from '../../_types/value';
5
+ import { type IBaseValueByAttributeType, type IValuesOccurrences, type ISaveValueByAttributeType, type IValueByAttributeType, type IValuesOptions, type IValueVersion } from '../../_types/value';
6
6
  import { type IAttributeSimpleRepo } from './attributeSimpleRepo';
7
7
  import { type IAttributeSimpleLinkRepo } from './attributeSimpleLinkRepo';
8
8
  import { type IAttributeAdvancedRepo } from './attributeAdvancedRepo';
@@ -109,6 +109,15 @@ export interface IAttributeTypeRepo<AttributeType extends AttributeTypes = Attri
109
109
  forceGetAllValues: boolean;
110
110
  ctx: IQueryInfos;
111
111
  }): Promise<Value[][]>;
112
+ countValuesOccurrences?({ library, attribute, recordIds, options, ctx, }: {
113
+ library: string;
114
+ attribute: IAttribute;
115
+ recordIds: string[];
116
+ options?: {
117
+ version?: IValueVersion;
118
+ };
119
+ ctx: IQueryInfos;
120
+ }): Promise<IValuesOccurrences<IBaseValueByAttributeType[AttributeType]>>;
112
121
  /**
113
122
  * Return a specific value based on its ID. Field "id" is expect on the value
114
123
  *
@@ -0,0 +1,7 @@
1
+ import { type IAttributeRepo } from 'infra/attribute/attributeRepo';
2
+ import { type IMigration } from '../../../_types/migration';
3
+ interface IDeps {
4
+ 'core.infra.attribute'?: IAttributeRepo;
5
+ }
6
+ export default function ({ 'core.infra.attribute': attributeRepo }: IDeps): IMigration;
7
+ export {};
@@ -2,7 +2,7 @@ import { type IDbService } from 'infra/db/dbService';
2
2
  import { type IConfig } from '_types/config';
3
3
  import { type IAttribute } from '_types/attribute';
4
4
  import { type IQueryInfos } from '_types/queryInfos';
5
- import { type ISaveValue, type IValue } from '_types/value';
5
+ import { type IValuesOccurrences, type ISaveValue, type IValue, type IValueVersion } from '_types/value';
6
6
  import { type IAttributeTypesRepo, type IAttributeWithRevLink, type IGetValuesOptions } from '../attributeTypes/attributeTypesRepo';
7
7
  export declare const VALUES_LINKS_COLLECTION = "core_edge_values_links";
8
8
  export declare const VALUES_COLLECTION = "core_values";
@@ -71,6 +71,15 @@ export interface IValueRepo {
71
71
  valueId: string;
72
72
  ctx: IQueryInfos;
73
73
  }): Promise<IValue>;
74
+ countValuesOccurrences?({ library, attribute, recordIds, options, ctx, }: {
75
+ library: string;
76
+ attribute: IAttribute;
77
+ recordIds: string[];
78
+ options?: {
79
+ version?: IValueVersion;
80
+ };
81
+ ctx: IQueryInfos;
82
+ }): Promise<IValuesOccurrences>;
74
83
  clearAllValues({ attribute, ctx }: {
75
84
  attribute: IAttribute;
76
85
  ctx: IQueryInfos;
@@ -49,5 +49,5 @@ export interface ILoggerConfig {
49
49
  };
50
50
  onErrorLog?: (message: string, meta: any, getCallStackTrace: () => string) => void;
51
51
  }
52
- export declare function envToBool(value: string, defaultValue?: boolean): boolean;
53
- export declare const defaultLoggerConfig: ILoggerConfig & Required<Omit<ILoggerConfig, 'onErrorLog'>>;
52
+ export declare function envToBool(value?: string, defaultValue?: boolean): boolean;
53
+ export declare const defaultLoggerConfig: ILoggerConfig & Required<Omit<ILoggerConfig, 'onErrorLog' | 'destinationFile'>>;
@@ -12,5 +12,5 @@ export interface IPreviewScalar {
12
12
  pdf?: string;
13
13
  file: FileRecord;
14
14
  original: string;
15
- [key: string]: string | FileRecord;
15
+ [key: string]: string | FileRecord | undefined;
16
16
  }
@@ -29,10 +29,8 @@ export declare const objectToNameValueArray: <T>(obj: IKeyValue<T>) => Array<{
29
29
  name: string;
30
30
  value: T;
31
31
  }>;
32
- export declare const nameValArrayToObj: (arr?: Array<{}>, keyFieldName?: string, valueFieldName?: string) => {
33
- [key: string]: any;
34
- };
35
- export declare const getFileType: (fileName: string) => FileType;
32
+ export declare const nameValArrayToObj: (arr?: Array<Record<string, any>>, keyFieldName?: string, valueFieldName?: string) => Record<string, any> | null;
33
+ export declare const getFileType: (fileName: string) => FileType | null;
36
34
  /**
37
35
  * Return a simplified call stack (for the function who called this function, not this one, obviously)
38
36
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aristid/leav-types",
3
- "version": "1.5.0",
3
+ "version": "1.5.1-1929c505",
4
4
  "description": "Shared Leav types",
5
5
  "scripts": {
6
6
  "tscheck": "",
@@ -14,7 +14,7 @@
14
14
  "license": "LGPL3",
15
15
  "repository": "https://github.com/leav-solutions/leav-engine",
16
16
  "dependencies": {
17
- "@leav/utils": "1.5.0",
17
+ "@leav/utils": "1.5.1",
18
18
  "@types/amqplib": "0.10.7",
19
19
  "@types/express": "5.0.0",
20
20
  "@types/jest": "29.5.14",