@aristid/leav-types 0.0.7-03daa35 → 0.0.7-049caba
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/src/__tests__/mocks/attribute.d.ts +0 -1
- package/apps/core/src/domain/record/recordDomain.d.ts +2 -4
- package/apps/core/src/domain/value/helpers/{canSaveRecordValue.d.ts → canSaveValue.d.ts} +3 -3
- package/apps/core/src/domain/value/helpers/validateValue.d.ts +1 -1
- package/apps/core/src/infra/attributeTypes/attributeTypesRepo.d.ts +2 -2
- package/apps/core/src/infra/value/valueRepo.d.ts +2 -6
- package/package.json +1 -1
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { AttributeFormats, AttributeTypes, IAttribute } from '../../_types/attribute';
|
|
2
2
|
export declare const mockAttrSimple: IAttribute;
|
|
3
|
-
export declare const mockUniqueAttrSimple: IAttribute;
|
|
4
3
|
export declare const mockAttrId: IAttribute;
|
|
5
4
|
export declare const mockAttrAdv: IAttribute;
|
|
6
5
|
export declare const mockAttrAdvMultiVal: IAttribute;
|
|
@@ -20,8 +20,7 @@ import { IRecordPermissionDomain } from '../permission/recordPermissionDomain';
|
|
|
20
20
|
import { SendRecordUpdateEventHelper } from './helpers/sendRecordUpdateEvent';
|
|
21
21
|
import { ICreateRecordResult, IFindRecordParams } from './_types';
|
|
22
22
|
import { IFormRepo } from 'infra/form/formRepo';
|
|
23
|
-
import { IRecordAttributePermissionDomain } from '
|
|
24
|
-
import { IAttributePermissionDomain } from '../permission/attributePermissionDomain';
|
|
23
|
+
import { IRecordAttributePermissionDomain } from 'domain/permission/recordAttributePermissionDomain';
|
|
25
24
|
export interface IRecordDomain {
|
|
26
25
|
createRecord(params: {
|
|
27
26
|
library: string;
|
|
@@ -92,7 +91,6 @@ export interface IRecordDomainDeps {
|
|
|
92
91
|
'core.domain.value': IValueDomain;
|
|
93
92
|
'core.domain.permission.record': IRecordPermissionDomain;
|
|
94
93
|
'core.domain.permission.library': ILibraryPermissionDomain;
|
|
95
|
-
'core.domain.permission.attribute': IAttributePermissionDomain;
|
|
96
94
|
'core.domain.permission.recordAttribute': IRecordAttributePermissionDomain;
|
|
97
95
|
'core.domain.helpers.getCoreEntityById': GetCoreEntityByIdFunc;
|
|
98
96
|
'core.domain.helpers.validate': IValidateHelper;
|
|
@@ -106,4 +104,4 @@ export interface IRecordDomainDeps {
|
|
|
106
104
|
'core.utils': IUtils;
|
|
107
105
|
translator: i18n;
|
|
108
106
|
}
|
|
109
|
-
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.
|
|
107
|
+
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.helpers.getCoreEntityById': getCoreEntityById, 'core.domain.helpers.validate': validateHelper, 'core.domain.record.helpers.sendRecordUpdateEvent': sendRecordUpdateEvent, 'core.infra.library': libraryRepo, 'core.infra.tree': treeRepo, 'core.infra.value': valueRepo, 'core.infra.form': formRepo, 'core.domain.eventsManager': eventsManager, 'core.infra.cache.cacheService': cacheService, 'core.utils': utils, translator }: IRecordDomainDeps): IRecordDomain;
|
|
@@ -6,12 +6,12 @@ import { IQueryInfos } from '_types/queryInfos';
|
|
|
6
6
|
import { IValue } from '_types/value';
|
|
7
7
|
import { ErrorFieldDetail, Errors } from '../../../_types/errors';
|
|
8
8
|
import { RecordAttributePermissionsActions, RecordPermissionsActions } from '../../../_types/permissions';
|
|
9
|
-
interface
|
|
9
|
+
interface ICanSaveValueRes {
|
|
10
10
|
canSave: boolean;
|
|
11
11
|
reason?: RecordAttributePermissionsActions | RecordPermissionsActions | Errors;
|
|
12
12
|
fields?: ErrorFieldDetail<IValue>;
|
|
13
13
|
}
|
|
14
|
-
interface
|
|
14
|
+
interface ICanSaveValueParams {
|
|
15
15
|
attributeProps: IAttribute;
|
|
16
16
|
value: IValue;
|
|
17
17
|
library: string;
|
|
@@ -24,5 +24,5 @@ interface ICanSaveRecordValueParams {
|
|
|
24
24
|
config: IConfig;
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
|
-
declare const _default: (params:
|
|
27
|
+
declare const _default: (params: ICanSaveValueParams) => Promise<ICanSaveValueRes>;
|
|
28
28
|
export default _default;
|
|
@@ -48,9 +48,9 @@ export interface IAttributeTypeRepo {
|
|
|
48
48
|
/**
|
|
49
49
|
* Check if a value is unique
|
|
50
50
|
*/
|
|
51
|
-
|
|
51
|
+
isValueUnique?({ library, recordId, attribute, value, ctx }: {
|
|
52
52
|
library: string;
|
|
53
|
-
|
|
53
|
+
recordId: string;
|
|
54
54
|
attribute: IAttribute;
|
|
55
55
|
value: IValue;
|
|
56
56
|
ctx: IQueryInfos;
|
|
@@ -33,13 +33,9 @@ export interface IValueRepo {
|
|
|
33
33
|
value: IValue;
|
|
34
34
|
ctx: IQueryInfos;
|
|
35
35
|
}): Promise<IValue>;
|
|
36
|
-
|
|
37
|
-
* Check if a value is unique expeted for the given record
|
|
38
|
-
* if recordId is null, it will check for the whole library
|
|
39
|
-
*/
|
|
40
|
-
isValueUsed({ library, excludedRecordId, attribute, value, ctx }: {
|
|
36
|
+
isValueUnique({ library, recordId, attribute, value, ctx }: {
|
|
41
37
|
library: string;
|
|
42
|
-
|
|
38
|
+
recordId: string;
|
|
43
39
|
attribute: IAttribute;
|
|
44
40
|
value: IValue;
|
|
45
41
|
ctx: IQueryInfos;
|