@aristid/leav-types 0.0.7-68fec6f → 0.0.7-6dadf1d
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 +1 -0
- package/apps/core/src/__tests__/mocks/attribute.d.ts +1 -0
- package/apps/core/src/_types/config.d.ts +2 -0
- package/apps/core/src/_types/value.d.ts +4 -2
- package/apps/core/src/domain/record/recordDomain.d.ts +5 -1
- package/apps/core/src/domain/value/helpers/{canSaveValue.d.ts → canSaveRecordValue.d.ts} +3 -3
- package/apps/core/src/domain/value/helpers/isEmptyValue.d.ts +5 -0
- 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 +7 -2
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AttributeFormats, AttributeTypes, IAttribute } from '../../_types/attribute';
|
|
2
2
|
export declare const mockAttrSimple: IAttribute;
|
|
3
|
+
export declare const mockUniqueAttrSimple: IAttribute;
|
|
3
4
|
export declare const mockAttrId: IAttribute;
|
|
4
5
|
export declare const mockAttrAdv: IAttribute;
|
|
5
6
|
export declare const mockAttrAdvMultiVal: IAttribute;
|
|
@@ -76,12 +76,14 @@ export interface IAuth {
|
|
|
76
76
|
clientId?: string;
|
|
77
77
|
postLogoutRedirectUri?: string;
|
|
78
78
|
skipLogoutConfirmationPage?: boolean;
|
|
79
|
+
idTokenUserClaim?: string;
|
|
79
80
|
} | {
|
|
80
81
|
enable: true;
|
|
81
82
|
wellKnownEndpoint: string;
|
|
82
83
|
clientId: string;
|
|
83
84
|
postLogoutRedirectUri: string;
|
|
84
85
|
skipLogoutConfirmationPage?: boolean;
|
|
86
|
+
idTokenUserClaim: string;
|
|
85
87
|
};
|
|
86
88
|
testApiKey?: string;
|
|
87
89
|
}
|
|
@@ -2,6 +2,7 @@ import { AnyPrimitive, Override } from '@leav/utils';
|
|
|
2
2
|
import { IDbEdge } from 'infra/db/_types';
|
|
3
3
|
import { IRecord } from './record';
|
|
4
4
|
import { ITreeNode, TreePaths } from './tree';
|
|
5
|
+
import { EMPTY_VALUE } from 'infra/value/valueRepo';
|
|
5
6
|
export type IValueFromGql = Override<Omit<IValue, 'version'>, {
|
|
6
7
|
value: IValue['payload'];
|
|
7
8
|
metadata: Array<{
|
|
@@ -28,6 +29,7 @@ export interface IDbValueVersion {
|
|
|
28
29
|
export interface IValueMetadata {
|
|
29
30
|
[fieldName: string]: IStandardValue | AnyPrimitive;
|
|
30
31
|
}
|
|
32
|
+
export type EmptyValue = typeof EMPTY_VALUE;
|
|
31
33
|
export interface IGenericValue {
|
|
32
34
|
id_value?: string;
|
|
33
35
|
attribute?: string;
|
|
@@ -41,8 +43,8 @@ export interface IGenericValue {
|
|
|
41
43
|
isCalculated?: boolean;
|
|
42
44
|
}
|
|
43
45
|
export interface IStandardValue extends IGenericValue {
|
|
44
|
-
payload?: any;
|
|
45
|
-
raw_payload?: any;
|
|
46
|
+
payload?: any | EmptyValue;
|
|
47
|
+
raw_payload?: any | EmptyValue;
|
|
46
48
|
}
|
|
47
49
|
export interface ILinkValue extends IGenericValue {
|
|
48
50
|
payload?: IRecord;
|
|
@@ -20,6 +20,8 @@ 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 '../permission/recordAttributePermissionDomain';
|
|
24
|
+
import { IAttributePermissionDomain } from '../permission/attributePermissionDomain';
|
|
23
25
|
export interface IRecordDomain {
|
|
24
26
|
createRecord(params: {
|
|
25
27
|
library: string;
|
|
@@ -90,6 +92,8 @@ export interface IRecordDomainDeps {
|
|
|
90
92
|
'core.domain.value': IValueDomain;
|
|
91
93
|
'core.domain.permission.record': IRecordPermissionDomain;
|
|
92
94
|
'core.domain.permission.library': ILibraryPermissionDomain;
|
|
95
|
+
'core.domain.permission.attribute': IAttributePermissionDomain;
|
|
96
|
+
'core.domain.permission.recordAttribute': IRecordAttributePermissionDomain;
|
|
93
97
|
'core.domain.helpers.getCoreEntityById': GetCoreEntityByIdFunc;
|
|
94
98
|
'core.domain.helpers.validate': IValidateHelper;
|
|
95
99
|
'core.domain.record.helpers.sendRecordUpdateEvent': SendRecordUpdateEventHelper;
|
|
@@ -102,4 +106,4 @@ export interface IRecordDomainDeps {
|
|
|
102
106
|
'core.utils': IUtils;
|
|
103
107
|
translator: i18n;
|
|
104
108
|
}
|
|
105
|
-
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.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;
|
|
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.attribute': attrPermissionDomain, '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 ICanSaveRecordValueRes {
|
|
10
10
|
canSave: boolean;
|
|
11
11
|
reason?: RecordAttributePermissionsActions | RecordPermissionsActions | Errors;
|
|
12
12
|
fields?: ErrorFieldDetail<IValue>;
|
|
13
13
|
}
|
|
14
|
-
interface
|
|
14
|
+
interface ICanSaveRecordValueParams {
|
|
15
15
|
attributeProps: IAttribute;
|
|
16
16
|
value: IValue;
|
|
17
17
|
library: string;
|
|
@@ -24,5 +24,5 @@ interface ICanSaveValueParams {
|
|
|
24
24
|
config: IConfig;
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
|
-
declare const _default: (params:
|
|
27
|
+
declare const _default: (params: ICanSaveRecordValueParams) => Promise<ICanSaveRecordValueRes>;
|
|
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
|
+
isValueUsed?({ library, excludedRecordId, attribute, value, ctx }: {
|
|
52
52
|
library: string;
|
|
53
|
-
|
|
53
|
+
excludedRecordId?: string;
|
|
54
54
|
attribute: IAttribute;
|
|
55
55
|
value: IValue;
|
|
56
56
|
ctx: IQueryInfos;
|
|
@@ -5,6 +5,7 @@ import { IValue, IValuesOptions } from '_types/value';
|
|
|
5
5
|
import { IAttributeTypesRepo, IAttributeWithRevLink } from '../attributeTypes/attributeTypesRepo';
|
|
6
6
|
export declare const VALUES_LINKS_COLLECTION = "core_edge_values_links";
|
|
7
7
|
export declare const VALUES_COLLECTION = "core_values";
|
|
8
|
+
export declare const EMPTY_VALUE = "__empty_value__";
|
|
8
9
|
export interface IValueRepo {
|
|
9
10
|
createValue({ library, recordId, attribute, value, ctx }: {
|
|
10
11
|
library: string;
|
|
@@ -33,9 +34,13 @@ export interface IValueRepo {
|
|
|
33
34
|
value: IValue;
|
|
34
35
|
ctx: IQueryInfos;
|
|
35
36
|
}): Promise<IValue>;
|
|
36
|
-
|
|
37
|
+
/**
|
|
38
|
+
* Check if a value is unique expeted for the given record
|
|
39
|
+
* if recordId is null, it will check for the whole library
|
|
40
|
+
*/
|
|
41
|
+
isValueUsed({ library, excludedRecordId, attribute, value, ctx }: {
|
|
37
42
|
library: string;
|
|
38
|
-
|
|
43
|
+
excludedRecordId?: string;
|
|
39
44
|
attribute: IAttribute;
|
|
40
45
|
value: IValue;
|
|
41
46
|
ctx: IQueryInfos;
|