@aristid/leav-types 1.5.0-d954f801 → 1.5.0-e0f0cfb7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/apps/core/config/default.d.ts +16 -2
- package/apps/core/src/__tests__/e2e/api/e2eUtils.d.ts +12 -3
- package/apps/core/src/_constants/values.d.ts +1 -0
- package/apps/core/src/_types/config.d.ts +21 -1
- package/apps/core/src/domain/actions/maskValueAction.d.ts +0 -1
- package/apps/core/src/domain/filesManager/filesManagerDomain.d.ts +1 -1
- package/apps/core/src/domain/helpers/storeUploadFile.d.ts +1 -1
- package/apps/core/src/domain/library/helpers/checkSavePermission.d.ts +1 -1
- package/apps/core/src/domain/permission/_types.d.ts +0 -15
- package/apps/core/src/domain/permission/adminPermissionDomain.d.ts +1 -1
- package/apps/core/src/domain/permission/helpers/defaultPermission.d.ts +7 -1
- package/apps/core/src/domain/permission/permissionDomain.d.ts +3 -1
- package/apps/core/src/domain/permission/recordAttributePermissionDomain.d.ts +2 -4
- package/apps/core/src/domain/permission/recordPermissionDomain.d.ts +0 -2
- package/apps/core/src/domain/record/helpers/findRecords.d.ts +38 -0
- package/apps/core/src/domain/record/helpers/findRecords.spec.d.ts +1 -0
- package/apps/core/src/domain/record/helpers/getRecordFieldValue.d.ts +31 -0
- package/apps/core/src/domain/record/helpers/getRecordFieldValue.spec.d.ts +1 -0
- package/apps/core/src/domain/record/helpers/index.d.ts +2 -0
- package/apps/core/src/domain/record/recordDomain.d.ts +5 -13
- package/libs/logger/src/config.d.ts +2 -2
- package/libs/utils/src/types/files.d.ts +1 -1
- package/libs/utils/src/utils.d.ts +2 -4
- package/package.json +1 -1
|
@@ -105,8 +105,22 @@ export declare namespace lang {
|
|
|
105
105
|
export { _default as default };
|
|
106
106
|
}
|
|
107
107
|
export declare namespace permissions {
|
|
108
|
-
|
|
109
|
-
|
|
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: () =>
|
|
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
|
*
|
|
@@ -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
|
-
|
|
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 {};
|
|
@@ -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,
|
|
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,
|
|
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,
|
|
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 {
|
|
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,
|
|
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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type IQueryInfos } from '../../../_types/queryInfos';
|
|
2
|
+
import { type IRecord } from '../../../_types/record';
|
|
3
|
+
import { type IAttributeDomain } from '../../attribute/attributeDomain';
|
|
4
|
+
import { type IValue, type IValuesOptions } from '../../../_types/value';
|
|
5
|
+
import { type IRecordAttributePermissionDomain } from '../../permission/recordAttributePermissionDomain';
|
|
6
|
+
import { type IValueDomain } from '../../value/valueDomain';
|
|
7
|
+
/**
|
|
8
|
+
* Get the value of targeted attribute with actions applied on it including metadata.
|
|
9
|
+
*
|
|
10
|
+
* Avoid requesting DB if attribute already found in `record` param.
|
|
11
|
+
*
|
|
12
|
+
* @param {Object} params
|
|
13
|
+
* @param params.library
|
|
14
|
+
* @param params.record Could be emulated with only `{ id: <real_id> }`
|
|
15
|
+
* @param params.attributeId
|
|
16
|
+
* @param params.options
|
|
17
|
+
* @param params.ctx
|
|
18
|
+
*/
|
|
19
|
+
export type GetRecordFieldValueHelper = ({ library, record, attributeId, options, ctx, }: {
|
|
20
|
+
library: string;
|
|
21
|
+
record: IRecord;
|
|
22
|
+
attributeId: string;
|
|
23
|
+
options?: IValuesOptions;
|
|
24
|
+
ctx: IQueryInfos;
|
|
25
|
+
}) => Promise<IValue[]>;
|
|
26
|
+
export interface IGetRecordFieldValueHelperDeps {
|
|
27
|
+
'core.domain.attribute': IAttributeDomain;
|
|
28
|
+
'core.domain.value': IValueDomain;
|
|
29
|
+
'core.domain.permission.recordAttribute': IRecordAttributePermissionDomain;
|
|
30
|
+
}
|
|
31
|
+
export default function ({ 'core.domain.attribute': attributeDomain, 'core.domain.value': valueDomain, 'core.domain.permission.recordAttribute': recordAttributePermissionDomain, }: IGetRecordFieldValueHelperDeps): GetRecordFieldValueHelper;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -2,3 +2,5 @@ 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';
|
|
6
|
+
export { default as getRecordFieldValue } from './getRecordFieldValue';
|
|
@@ -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,12 @@ 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';
|
|
24
|
+
import { type GetRecordFieldValueHelper } from './helpers/getRecordFieldValue';
|
|
29
25
|
export declare const ATTRIBUTE_ACTIVE = "active";
|
|
30
26
|
export interface IRecordDomain {
|
|
31
27
|
/**
|
|
@@ -122,23 +118,19 @@ export interface IRecordDomainDeps {
|
|
|
122
118
|
'core.domain.attribute': IAttributeDomain;
|
|
123
119
|
'core.domain.value': IValueDomain;
|
|
124
120
|
'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
121
|
'core.domain.helpers.getCoreEntityById': GetCoreEntityByIdFunc;
|
|
129
122
|
'core.domain.helpers.validate': IValidateHelper;
|
|
130
123
|
'core.domain.record.helpers.createRecord': CreateRecordHelper;
|
|
131
124
|
'core.domain.record.helpers.deleteRecord': DeleteRecordHelper;
|
|
125
|
+
'core.domain.record.helpers.findRecords': FindRecordsHelper;
|
|
126
|
+
'core.domain.record.helpers.getRecordFieldValue': GetRecordFieldValueHelper;
|
|
132
127
|
'core.domain.record.helpers.sendRecordUpdateEvent': SendRecordUpdateEventHelper;
|
|
133
|
-
'core.infra.library': ILibraryRepo;
|
|
134
|
-
'core.infra.tree': ITreeRepo;
|
|
135
128
|
'core.domain.tree.helpers.elementAncestors': IElementAncestorsHelper;
|
|
136
129
|
'core.infra.form': IFormRepo;
|
|
137
|
-
'core.infra.permission': IPermissionRepo;
|
|
138
130
|
'core.domain.eventsManager': IEventsManagerDomain;
|
|
139
131
|
'core.infra.cache.cacheService': ICachesService;
|
|
140
132
|
'core.utils.logger': ILogger;
|
|
141
133
|
'core.utils': IUtils;
|
|
142
134
|
translator: i18n;
|
|
143
135
|
}
|
|
144
|
-
export default function ({ config, 'core.infra.record': recordRepo, 'core.domain.attribute': attributeDomain, 'core.domain.value': valueDomain, 'core.domain.permission.record': recordPermissionDomain, 'core.domain.
|
|
136
|
+
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.record.helpers.getRecordFieldValue': getRecordFieldValueHelper, '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;
|
|
@@ -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
|
|
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'>>;
|
|
@@ -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<
|
|
33
|
-
|
|
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
|
*
|