@aristid/leav-types 0.0.7-202f84c → 0.0.7-210b8d7
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/_types/value.d.ts +61 -3
- package/apps/core/src/domain/record/recordDomain.d.ts +2 -2
- package/apps/core/src/domain/value/helpers/prepareValue.d.ts +3 -3
- package/apps/core/src/domain/value/helpers/saveOneValue.d.ts +2 -2
- package/apps/core/src/domain/value/helpers/validateValue.d.ts +3 -3
- package/apps/core/src/domain/value/valueDomain.d.ts +3 -3
- package/apps/core/src/infra/attributeTypes/attributeAdvancedLinkRepo.d.ts +5 -2
- package/apps/core/src/infra/attributeTypes/attributeAdvancedRepo.d.ts +3 -1
- package/apps/core/src/infra/attributeTypes/attributeSimpleLinkRepo.d.ts +5 -2
- package/apps/core/src/infra/attributeTypes/attributeSimpleRepo.d.ts +3 -1
- package/apps/core/src/infra/attributeTypes/attributeTreeRepo.d.ts +3 -1
- package/apps/core/src/infra/attributeTypes/attributeTypesRepo.d.ts +27 -21
- package/apps/core/src/infra/value/valueRepo.d.ts +3 -3
- package/package.json +5 -2
|
@@ -3,6 +3,7 @@ import { IDbEdge } from 'infra/db/_types';
|
|
|
3
3
|
import { IRecord } from './record';
|
|
4
4
|
import { ITreeNode, TreePaths } from './tree';
|
|
5
5
|
import { EMPTY_VALUE } from 'infra/value/valueRepo';
|
|
6
|
+
import { AttributeTypes } from './attribute';
|
|
6
7
|
export type IValueFromGql = Override<Omit<IValue, 'version'>, {
|
|
7
8
|
value: IValue['payload'];
|
|
8
9
|
metadata: Array<{
|
|
@@ -30,8 +31,11 @@ export interface IValueMetadata {
|
|
|
30
31
|
[fieldName: string]: IStandardValue | AnyPrimitive;
|
|
31
32
|
}
|
|
32
33
|
export type EmptyValue = typeof EMPTY_VALUE;
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
interface ICommonGenericSaveValue {
|
|
35
|
+
/**
|
|
36
|
+
* The id of the edge for advanced, advanced link or tree values
|
|
37
|
+
*/
|
|
38
|
+
id_value?: string | null;
|
|
35
39
|
attribute?: string;
|
|
36
40
|
created_at?: number;
|
|
37
41
|
modified_at?: number;
|
|
@@ -39,21 +43,60 @@ export interface IGenericValue {
|
|
|
39
43
|
modified_by?: string;
|
|
40
44
|
version?: IValueVersion;
|
|
41
45
|
metadata?: IValueMetadata;
|
|
46
|
+
}
|
|
47
|
+
export interface IGenericValue extends ICommonGenericSaveValue {
|
|
42
48
|
isInherited?: boolean;
|
|
43
49
|
isCalculated?: boolean;
|
|
44
50
|
}
|
|
45
51
|
export interface IStandardValue extends IGenericValue {
|
|
52
|
+
/**
|
|
53
|
+
* Computed value after get actions on attribute are done
|
|
54
|
+
* TODO remove that any when possible
|
|
55
|
+
* TODO remove optional when possible
|
|
56
|
+
*/
|
|
46
57
|
payload?: any | EmptyValue;
|
|
47
|
-
|
|
58
|
+
/**
|
|
59
|
+
* Raw value from the database, before any computation
|
|
60
|
+
* TODO, remove that any when possible
|
|
61
|
+
*/
|
|
62
|
+
raw_payload?: any;
|
|
48
63
|
}
|
|
49
64
|
export interface ILinkValue extends IGenericValue {
|
|
65
|
+
/**
|
|
66
|
+
* Linked record
|
|
67
|
+
* TODO remove optional when possible
|
|
68
|
+
*/
|
|
50
69
|
payload?: IRecord;
|
|
51
70
|
}
|
|
52
71
|
export interface ITreeValue extends IGenericValue {
|
|
72
|
+
/**
|
|
73
|
+
* Linked tree node
|
|
74
|
+
* TODO remove optional when possible
|
|
75
|
+
*/
|
|
53
76
|
payload?: ITreeNode;
|
|
54
77
|
treeId: string;
|
|
55
78
|
}
|
|
56
79
|
export type IValue = IStandardValue | ILinkValue | ITreeValue;
|
|
80
|
+
type IGenericSaveValue = ICommonGenericSaveValue;
|
|
81
|
+
export interface ISaveStandardValue extends IGenericSaveValue {
|
|
82
|
+
/**
|
|
83
|
+
* Any base type value to save
|
|
84
|
+
*/
|
|
85
|
+
payload: number | string | boolean | EmptyValue | null;
|
|
86
|
+
}
|
|
87
|
+
export interface ISaveLinkValue extends IGenericSaveValue {
|
|
88
|
+
/**
|
|
89
|
+
* Record id to link
|
|
90
|
+
*/
|
|
91
|
+
payload: string | null;
|
|
92
|
+
}
|
|
93
|
+
export interface ISaveTreeValue extends IGenericSaveValue {
|
|
94
|
+
/**
|
|
95
|
+
* Tree node id to link
|
|
96
|
+
*/
|
|
97
|
+
payload: string | null;
|
|
98
|
+
}
|
|
99
|
+
export type ISaveValue = ISaveStandardValue | ISaveLinkValue | ISaveTreeValue;
|
|
57
100
|
export interface IDateRangeValue<T = string | number> {
|
|
58
101
|
from: T;
|
|
59
102
|
to: T;
|
|
@@ -78,3 +121,18 @@ export interface IValueEdge extends IDbEdge {
|
|
|
78
121
|
version?: IDbValueVersion;
|
|
79
122
|
metadata?: IValueMetadata;
|
|
80
123
|
}
|
|
124
|
+
export interface IValueByAttributeType {
|
|
125
|
+
[AttributeTypes.SIMPLE]: IStandardValue;
|
|
126
|
+
[AttributeTypes.SIMPLE_LINK]: ILinkValue;
|
|
127
|
+
[AttributeTypes.ADVANCED]: IStandardValue;
|
|
128
|
+
[AttributeTypes.ADVANCED_LINK]: ILinkValue;
|
|
129
|
+
[AttributeTypes.TREE]: ITreeValue;
|
|
130
|
+
}
|
|
131
|
+
export interface ISaveValueByAttributeType {
|
|
132
|
+
[AttributeTypes.SIMPLE]: ISaveStandardValue;
|
|
133
|
+
[AttributeTypes.SIMPLE_LINK]: ISaveLinkValue;
|
|
134
|
+
[AttributeTypes.ADVANCED]: ISaveStandardValue;
|
|
135
|
+
[AttributeTypes.ADVANCED_LINK]: ISaveLinkValue;
|
|
136
|
+
[AttributeTypes.TREE]: ISaveTreeValue;
|
|
137
|
+
}
|
|
138
|
+
export {};
|
|
@@ -11,7 +11,7 @@ import { IValueRepo } from 'infra/value/valueRepo';
|
|
|
11
11
|
import { IUtils } from 'utils/utils';
|
|
12
12
|
import * as Config from '_types/config';
|
|
13
13
|
import { IListWithCursor } from '_types/list';
|
|
14
|
-
import { IValue, IValuesOptions } from '_types/value';
|
|
14
|
+
import { ISaveValue, IValue, IValuesOptions } from '_types/value';
|
|
15
15
|
import { ICachesService } from '../../infra/cache/cacheService';
|
|
16
16
|
import { IQueryInfos } from '../../_types/queryInfos';
|
|
17
17
|
import { IRecord, IRecordFilterLight, IRecordIdentity } from '../../_types/record';
|
|
@@ -30,7 +30,7 @@ import { IElementAncestorsHelper } from 'domain/tree/helpers/elementAncestors';
|
|
|
30
30
|
export interface IRecordDomain {
|
|
31
31
|
createRecord(params: {
|
|
32
32
|
library: string;
|
|
33
|
-
values?:
|
|
33
|
+
values?: ISaveValue[];
|
|
34
34
|
verifyRequiredAttributes?: boolean;
|
|
35
35
|
ctx: IQueryInfos;
|
|
36
36
|
}): Promise<ICreateRecordResult>;
|
|
@@ -3,10 +3,10 @@ import { IAttributeDomain } from 'domain/attribute/attributeDomain';
|
|
|
3
3
|
import { IUtils } from 'utils/utils';
|
|
4
4
|
import { IAttribute } from '_types/attribute';
|
|
5
5
|
import { IQueryInfos } from '_types/queryInfos';
|
|
6
|
-
import {
|
|
6
|
+
import { ISaveValue } from '_types/value';
|
|
7
7
|
interface IPrepareValueParams {
|
|
8
8
|
attributeProps: IAttribute;
|
|
9
|
-
value:
|
|
9
|
+
value: ISaveValue;
|
|
10
10
|
library: string;
|
|
11
11
|
recordId: string;
|
|
12
12
|
infos?: IQueryInfos;
|
|
@@ -18,5 +18,5 @@ interface IPrepareValueParams {
|
|
|
18
18
|
};
|
|
19
19
|
ctx: IQueryInfos;
|
|
20
20
|
}
|
|
21
|
-
declare const _default: (params: IPrepareValueParams) => Promise<
|
|
21
|
+
declare const _default: (params: IPrepareValueParams) => Promise<ISaveValue[]>;
|
|
22
22
|
export default _default;
|
|
@@ -7,7 +7,7 @@ import { ITreeRepo } from 'infra/tree/treeRepo';
|
|
|
7
7
|
import { IValueRepo } from 'infra/value/valueRepo';
|
|
8
8
|
import { IQueryInfos } from '_types/queryInfos';
|
|
9
9
|
import { IAttribute } from '../../../_types/attribute';
|
|
10
|
-
import { IValue } from '../../../_types/value';
|
|
10
|
+
import { ISaveValue, IValue } from '../../../_types/value';
|
|
11
11
|
interface ISaveOneValueDeps {
|
|
12
12
|
valueRepo: IValueRepo;
|
|
13
13
|
recordRepo: IRecordRepo;
|
|
@@ -17,5 +17,5 @@ interface ISaveOneValueDeps {
|
|
|
17
17
|
attributeDomain: IAttributeDomain;
|
|
18
18
|
versionProfileDomain: IVersionProfileDomain;
|
|
19
19
|
}
|
|
20
|
-
declare const _default: (library: string, recordId: string, attribute: IAttribute, value:
|
|
20
|
+
declare const _default: (library: string, recordId: string, attribute: IAttribute, value: ISaveValue, deps: ISaveOneValueDeps, ctx: IQueryInfos) => Promise<IValue>;
|
|
21
21
|
export default _default;
|
|
@@ -5,10 +5,10 @@ import { IValueRepo } from 'infra/value/valueRepo';
|
|
|
5
5
|
import { IAttribute } from '../../../_types/attribute';
|
|
6
6
|
import { ErrorFieldDetail } from '../../../_types/errors';
|
|
7
7
|
import { IQueryInfos } from '../../../_types/queryInfos';
|
|
8
|
-
import {
|
|
8
|
+
import { ISaveValue } from '../../../_types/value';
|
|
9
9
|
interface IValidateValueParams {
|
|
10
10
|
attributeProps: IAttribute;
|
|
11
|
-
value:
|
|
11
|
+
value: ISaveValue;
|
|
12
12
|
library: string;
|
|
13
13
|
recordId?: string;
|
|
14
14
|
infos?: IQueryInfos;
|
|
@@ -21,5 +21,5 @@ interface IValidateValueParams {
|
|
|
21
21
|
};
|
|
22
22
|
ctx: IQueryInfos;
|
|
23
23
|
}
|
|
24
|
-
declare const _default: (params: IValidateValueParams) => Promise<ErrorFieldDetail<
|
|
24
|
+
declare const _default: (params: IValidateValueParams) => Promise<ErrorFieldDetail<ISaveValue>>;
|
|
25
25
|
export default _default;
|
|
@@ -14,7 +14,7 @@ import * as Config from '_types/config';
|
|
|
14
14
|
import { IRecord } from '_types/record';
|
|
15
15
|
import { IAttribute } from '../../_types/attribute';
|
|
16
16
|
import { IQueryInfos } from '../../_types/queryInfos';
|
|
17
|
-
import { IValue, IValuesOptions } from '../../_types/value';
|
|
17
|
+
import { ISaveValue, IValue, IValuesOptions } from '../../_types/value';
|
|
18
18
|
import { IActionsListDomain } from '../actionsList/actionsListDomain';
|
|
19
19
|
import { IAttributeDomain } from '../attribute/attributeDomain';
|
|
20
20
|
import { IValidateHelper } from '../helpers/validate';
|
|
@@ -61,7 +61,7 @@ export interface IValueDomain {
|
|
|
61
61
|
library: string;
|
|
62
62
|
recordId: string;
|
|
63
63
|
attribute: string;
|
|
64
|
-
value:
|
|
64
|
+
value: ISaveValue;
|
|
65
65
|
ctx: IQueryInfos;
|
|
66
66
|
}): Promise<IValue[]>;
|
|
67
67
|
/**
|
|
@@ -73,7 +73,7 @@ export interface IValueDomain {
|
|
|
73
73
|
saveValueBatch(params: {
|
|
74
74
|
library: string;
|
|
75
75
|
recordId: string;
|
|
76
|
-
values:
|
|
76
|
+
values: ISaveValue[];
|
|
77
77
|
ctx: IQueryInfos;
|
|
78
78
|
keepEmpty?: boolean;
|
|
79
79
|
skipPermission?: boolean;
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import { IFilterTypesHelper } from 'infra/record/helpers/filterTypes';
|
|
2
2
|
import { IUtils } from 'utils/utils';
|
|
3
|
+
import { AttributeTypes } from '../../_types/attribute';
|
|
3
4
|
import { IDbService } from '../db/dbService';
|
|
4
5
|
import { IDbUtils } from '../db/dbUtils';
|
|
5
6
|
import { IAttributeTypeRepo } from './attributeTypesRepo';
|
|
6
7
|
import { GetConditionPart } from './helpers/getConditionPart';
|
|
8
|
+
import { IAttributeSimpleLinkRepo } from './attributeSimpleLinkRepo';
|
|
9
|
+
export type IAttributeAdvancedLinkRepo = IAttributeTypeRepo<AttributeTypes.ADVANCED_LINK>;
|
|
7
10
|
interface IDeps {
|
|
8
11
|
'core.infra.db.dbService'?: IDbService;
|
|
9
12
|
'core.infra.db.dbUtils'?: IDbUtils;
|
|
10
|
-
'core.infra.attributeTypes.attributeSimpleLink'?:
|
|
13
|
+
'core.infra.attributeTypes.attributeSimpleLink'?: IAttributeSimpleLinkRepo;
|
|
11
14
|
'core.infra.attributeTypes.helpers.getConditionPart'?: GetConditionPart;
|
|
12
15
|
'core.infra.record.helpers.filterTypes'?: IFilterTypesHelper;
|
|
13
16
|
'core.utils'?: IUtils;
|
|
14
17
|
}
|
|
15
|
-
export default function ({ 'core.infra.db.dbService': dbService, 'core.infra.db.dbUtils': dbUtils, 'core.infra.attributeTypes.attributeSimpleLink': attributeSimpleLinkRepo, 'core.infra.attributeTypes.helpers.getConditionPart': getConditionPart, 'core.infra.record.helpers.filterTypes': filterTypes, 'core.utils': utils }?: IDeps):
|
|
18
|
+
export default function ({ 'core.infra.db.dbService': dbService, 'core.infra.db.dbUtils': dbUtils, 'core.infra.attributeTypes.attributeSimpleLink': attributeSimpleLinkRepo, 'core.infra.attributeTypes.helpers.getConditionPart': getConditionPart, 'core.infra.record.helpers.filterTypes': filterTypes, 'core.utils': utils }?: IDeps): IAttributeAdvancedLinkRepo;
|
|
16
19
|
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IDbUtils } from 'infra/db/dbUtils';
|
|
2
2
|
import { IFilterTypesHelper } from 'infra/record/helpers/filterTypes';
|
|
3
|
+
import { AttributeTypes } from '../../_types/attribute';
|
|
3
4
|
import { IDbService } from '../db/dbService';
|
|
4
5
|
import { IAttributeTypeRepo } from './attributeTypesRepo';
|
|
5
6
|
import { GetConditionPart } from './helpers/getConditionPart';
|
|
@@ -9,4 +10,5 @@ export interface IAttributeAdvancedRepoDeps {
|
|
|
9
10
|
'core.infra.attributeTypes.helpers.getConditionPart': GetConditionPart;
|
|
10
11
|
'core.infra.record.helpers.filterTypes': IFilterTypesHelper;
|
|
11
12
|
}
|
|
12
|
-
export
|
|
13
|
+
export type IAttributeAdvancedRepo = IAttributeTypeRepo<AttributeTypes.ADVANCED>;
|
|
14
|
+
export default function ({ 'core.infra.db.dbService': dbService, 'core.infra.db.dbUtils': dbUtils, 'core.infra.attributeTypes.helpers.getConditionPart': getConditionPart, 'core.infra.record.helpers.filterTypes': filterTypesHelper }: IAttributeAdvancedRepoDeps): IAttributeAdvancedRepo;
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import { IFilterTypesHelper } from 'infra/record/helpers/filterTypes';
|
|
2
|
+
import { AttributeTypes } from '../../_types/attribute';
|
|
2
3
|
import { IDbService } from '../db/dbService';
|
|
3
4
|
import { IDbUtils } from '../db/dbUtils';
|
|
4
5
|
import { IAttributeTypeRepo } from './attributeTypesRepo';
|
|
5
6
|
import { GetConditionPart } from './helpers/getConditionPart';
|
|
7
|
+
import { IAttributeSimpleRepo } from './attributeSimpleRepo';
|
|
6
8
|
interface IDeps {
|
|
7
9
|
'core.infra.db.dbService'?: IDbService;
|
|
8
10
|
'core.infra.db.dbUtils'?: IDbUtils;
|
|
9
|
-
'core.infra.attributeTypes.attributeSimple'?:
|
|
11
|
+
'core.infra.attributeTypes.attributeSimple'?: IAttributeSimpleRepo;
|
|
10
12
|
'core.infra.attributeTypes.helpers.getConditionPart'?: GetConditionPart;
|
|
11
13
|
'core.infra.record.helpers.filterTypes'?: IFilterTypesHelper;
|
|
12
14
|
}
|
|
13
|
-
export
|
|
15
|
+
export type IAttributeSimpleLinkRepo = IAttributeTypeRepo<AttributeTypes.SIMPLE_LINK>;
|
|
16
|
+
export default function ({ 'core.infra.db.dbService': dbService, 'core.infra.db.dbUtils': dbUtils, 'core.infra.attributeTypes.attributeSimple': attributeSimpleRepo, 'core.infra.attributeTypes.helpers.getConditionPart': getConditionPart, 'core.infra.record.helpers.filterTypes': filterTypesHelper }?: IDeps): IAttributeSimpleLinkRepo;
|
|
14
17
|
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { IFilterTypesHelper } from 'infra/record/helpers/filterTypes';
|
|
2
|
+
import { AttributeTypes } from '../../_types/attribute';
|
|
2
3
|
import { IDbService } from '../db/dbService';
|
|
3
4
|
import { IAttributeTypeRepo } from './attributeTypesRepo';
|
|
4
5
|
import { GetConditionPart } from './helpers/getConditionPart';
|
|
@@ -7,5 +8,6 @@ interface IDeps {
|
|
|
7
8
|
'core.infra.attributeTypes.helpers.getConditionPart'?: GetConditionPart;
|
|
8
9
|
'core.infra.record.helpers.filterTypes'?: IFilterTypesHelper;
|
|
9
10
|
}
|
|
10
|
-
export
|
|
11
|
+
export type IAttributeSimpleRepo = IAttributeTypeRepo<AttributeTypes.SIMPLE>;
|
|
12
|
+
export default function ({ 'core.infra.db.dbService': dbService, 'core.infra.attributeTypes.helpers.getConditionPart': getConditionPart, 'core.infra.record.helpers.filterTypes': filterTypesHelper }?: IDeps): IAttributeSimpleRepo;
|
|
11
13
|
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IFilterTypesHelper } from 'infra/record/helpers/filterTypes';
|
|
2
2
|
import { IUtils } from 'utils/utils';
|
|
3
|
+
import { AttributeTypes } from '../../_types/attribute';
|
|
3
4
|
import { IDbService } from '../db/dbService';
|
|
4
5
|
import { IDbUtils } from '../db/dbUtils';
|
|
5
6
|
import { IAttributeTypeRepo } from './attributeTypesRepo';
|
|
@@ -11,5 +12,6 @@ interface IDeps {
|
|
|
11
12
|
'core.infra.record.helpers.filterTypes'?: IFilterTypesHelper;
|
|
12
13
|
'core.utils'?: IUtils;
|
|
13
14
|
}
|
|
14
|
-
export
|
|
15
|
+
export type IAttributeTreeRepo = IAttributeTypeRepo<AttributeTypes.TREE>;
|
|
16
|
+
export default function ({ 'core.infra.db.dbService': dbService, 'core.infra.db.dbUtils': dbUtils, 'core.infra.attributeTypes.helpers.getConditionPart': getConditionPart, 'core.infra.record.helpers.filterTypes': filterTypes, 'core.utils': utils }?: IDeps): IAttributeTreeRepo;
|
|
15
17
|
export {};
|
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
import { AqlLiteral, GeneratedAqlQuery } from 'arangojs/aql';
|
|
2
2
|
import { IQueryInfos } from '_types/queryInfos';
|
|
3
|
-
import { IAttribute } from '../../_types/attribute';
|
|
3
|
+
import { AttributeTypes, IAttribute } from '../../_types/attribute';
|
|
4
4
|
import { AttributeCondition, IRecordFilterOption } from '../../_types/record';
|
|
5
|
-
import {
|
|
6
|
-
|
|
5
|
+
import { ISaveValueByAttributeType, IValueByAttributeType, IValuesOptions } from '../../_types/value';
|
|
6
|
+
import { IAttributeSimpleRepo } from './attributeSimpleRepo';
|
|
7
|
+
import { IAttributeSimpleLinkRepo } from './attributeSimpleLinkRepo';
|
|
8
|
+
import { IAttributeAdvancedRepo } from './attributeAdvancedRepo';
|
|
9
|
+
import { IAttributeAdvancedLinkRepo } from './attributeAdvancedLinkRepo';
|
|
10
|
+
import { IAttributeTreeRepo } from './attributeTreeRepo';
|
|
11
|
+
export type IAttributeWithRepo = IAttributeWithRevLink & {
|
|
7
12
|
_repo: IAttributeTypeRepo;
|
|
8
|
-
}
|
|
13
|
+
};
|
|
14
|
+
type IAttributeRepoByType<AttributeType extends AttributeTypes | unknown> = AttributeType extends AttributeTypes.SIMPLE ? IAttributeSimpleRepo : AttributeType extends AttributeTypes.SIMPLE_LINK ? IAttributeSimpleLinkRepo : AttributeType extends AttributeTypes.ADVANCED ? IAttributeAdvancedRepo : AttributeType extends AttributeTypes.ADVANCED_LINK ? IAttributeAdvancedLinkRepo : AttributeType extends AttributeTypes.TREE ? IAttributeTreeRepo : IAttributeTypeRepo;
|
|
9
15
|
export interface IAttributeTypesRepo {
|
|
10
|
-
getTypeRepo
|
|
16
|
+
getTypeRepo<AttributeType extends AttributeTypes | unknown>(attribute: IAttribute): IAttributeRepoByType<AttributeType>;
|
|
11
17
|
}
|
|
12
18
|
export interface IAttributeWithRevLink extends IAttribute {
|
|
13
19
|
reverse_link?: IAttribute;
|
|
@@ -17,14 +23,14 @@ export type GetConditionPartFunc = (valueIdentifier: string | AqlLiteral) => Gen
|
|
|
17
23
|
/**
|
|
18
24
|
* Define interface used for all attribute type specific files
|
|
19
25
|
*/
|
|
20
|
-
export interface IAttributeTypeRepo {
|
|
26
|
+
export interface IAttributeTypeRepo<AttributeType extends AttributeTypes = AttributeTypes, Value = IValueByAttributeType[AttributeType]> {
|
|
21
27
|
createValue({ library, recordId, attribute, value, ctx }: {
|
|
22
28
|
library: string;
|
|
23
29
|
recordId: string;
|
|
24
30
|
attribute: IAttributeWithRevLink;
|
|
25
|
-
value:
|
|
31
|
+
value: ISaveValueByAttributeType[AttributeType];
|
|
26
32
|
ctx: IQueryInfos;
|
|
27
|
-
}): Promise<
|
|
33
|
+
}): Promise<Value>;
|
|
28
34
|
/**
|
|
29
35
|
* Update an existing value. Field "id" is expected on the value
|
|
30
36
|
*/
|
|
@@ -32,9 +38,9 @@ export interface IAttributeTypeRepo {
|
|
|
32
38
|
library: string;
|
|
33
39
|
recordId: string;
|
|
34
40
|
attribute: IAttributeWithRevLink;
|
|
35
|
-
value:
|
|
41
|
+
value: ISaveValueByAttributeType[AttributeType];
|
|
36
42
|
ctx: IQueryInfos;
|
|
37
|
-
}): Promise<
|
|
43
|
+
}): Promise<Value>;
|
|
38
44
|
/**
|
|
39
45
|
* Delete an existing value. Field "id" is expected on the value
|
|
40
46
|
*/
|
|
@@ -42,9 +48,9 @@ export interface IAttributeTypeRepo {
|
|
|
42
48
|
library: string;
|
|
43
49
|
recordId: string;
|
|
44
50
|
attribute: IAttributeWithRevLink;
|
|
45
|
-
value:
|
|
51
|
+
value: Value;
|
|
46
52
|
ctx: IQueryInfos;
|
|
47
|
-
}): Promise<
|
|
53
|
+
}): Promise<Value>;
|
|
48
54
|
/**
|
|
49
55
|
* Check if a value is unique
|
|
50
56
|
*/
|
|
@@ -52,7 +58,7 @@ export interface IAttributeTypeRepo {
|
|
|
52
58
|
library: string;
|
|
53
59
|
excludedRecordId?: string;
|
|
54
60
|
attribute: IAttribute;
|
|
55
|
-
value:
|
|
61
|
+
value: Value;
|
|
56
62
|
ctx: IQueryInfos;
|
|
57
63
|
}): Promise<boolean>;
|
|
58
64
|
/**
|
|
@@ -67,7 +73,7 @@ export interface IAttributeTypeRepo {
|
|
|
67
73
|
forceGetAllValues?: boolean;
|
|
68
74
|
options?: IValuesOptions;
|
|
69
75
|
ctx: IQueryInfos;
|
|
70
|
-
}): Promise<
|
|
76
|
+
}): Promise<Value[]>;
|
|
71
77
|
/**
|
|
72
78
|
* Get all reverse values for given attribute / value
|
|
73
79
|
*
|
|
@@ -78,7 +84,7 @@ export interface IAttributeTypeRepo {
|
|
|
78
84
|
value: string;
|
|
79
85
|
forceGetAllValues: boolean;
|
|
80
86
|
ctx: IQueryInfos;
|
|
81
|
-
}): Promise<
|
|
87
|
+
}): Promise<Value[]>;
|
|
82
88
|
/**
|
|
83
89
|
* Return a specific value based on its ID. Field "id" is expect on the value
|
|
84
90
|
*
|
|
@@ -90,7 +96,7 @@ export interface IAttributeTypeRepo {
|
|
|
90
96
|
attribute: IAttribute;
|
|
91
97
|
valueId: string;
|
|
92
98
|
ctx: IQueryInfos;
|
|
93
|
-
}): Promise<
|
|
99
|
+
}): Promise<Value>;
|
|
94
100
|
/**
|
|
95
101
|
* Return AQL query part to retrieve value for this attribute.
|
|
96
102
|
* If will be concatenate with other filters and full query
|
|
@@ -118,11 +124,11 @@ export declare const ATTRIB_COLLECTION_NAME = "core_attributes";
|
|
|
118
124
|
export declare const BASE_QUERY_IDENTIFIER = "r";
|
|
119
125
|
export declare const isValuesCountCondition: (condition: AttributeCondition) => boolean;
|
|
120
126
|
interface IDeps {
|
|
121
|
-
'core.infra.attributeTypes.attributeSimple'?:
|
|
122
|
-
'core.infra.attributeTypes.attributeSimpleLink'?:
|
|
123
|
-
'core.infra.attributeTypes.attributeAdvanced'?:
|
|
124
|
-
'core.infra.attributeTypes.attributeAdvancedLink'?:
|
|
125
|
-
'core.infra.attributeTypes.attributeTree'?:
|
|
127
|
+
'core.infra.attributeTypes.attributeSimple'?: IAttributeSimpleRepo;
|
|
128
|
+
'core.infra.attributeTypes.attributeSimpleLink'?: IAttributeSimpleLinkRepo;
|
|
129
|
+
'core.infra.attributeTypes.attributeAdvanced'?: IAttributeAdvancedRepo;
|
|
130
|
+
'core.infra.attributeTypes.attributeAdvancedLink'?: IAttributeAdvancedLinkRepo;
|
|
131
|
+
'core.infra.attributeTypes.attributeTree'?: IAttributeTreeRepo;
|
|
126
132
|
}
|
|
127
133
|
export default function ({ 'core.infra.attributeTypes.attributeSimple': attributeSimpleRepo, 'core.infra.attributeTypes.attributeSimpleLink': attributeSimpleLinkRepo, 'core.infra.attributeTypes.attributeAdvanced': attributeAdvancedRepo, 'core.infra.attributeTypes.attributeAdvancedLink': attributeAdvancedLinkRepo, 'core.infra.attributeTypes.attributeTree': attributeTreeRepo }?: IDeps): IAttributeTypesRepo;
|
|
128
134
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IDbService } from 'infra/db/dbService';
|
|
2
2
|
import { IAttribute } from '_types/attribute';
|
|
3
3
|
import { IQueryInfos } from '_types/queryInfos';
|
|
4
|
-
import { IValue, IValuesOptions } from '_types/value';
|
|
4
|
+
import { ISaveValue, 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";
|
|
@@ -11,7 +11,7 @@ export interface IValueRepo {
|
|
|
11
11
|
library: string;
|
|
12
12
|
recordId: string;
|
|
13
13
|
attribute: IAttributeWithRevLink;
|
|
14
|
-
value:
|
|
14
|
+
value: ISaveValue;
|
|
15
15
|
ctx: IQueryInfos;
|
|
16
16
|
}): Promise<IValue>;
|
|
17
17
|
/**
|
|
@@ -21,7 +21,7 @@ export interface IValueRepo {
|
|
|
21
21
|
library: string;
|
|
22
22
|
recordId: string;
|
|
23
23
|
attribute: IAttributeWithRevLink;
|
|
24
|
-
value:
|
|
24
|
+
value: ISaveValue;
|
|
25
25
|
ctx: IQueryInfos;
|
|
26
26
|
}): Promise<IValue>;
|
|
27
27
|
/**
|
package/package.json
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aristid/leav-types",
|
|
3
|
-
"version": "0.0.7-
|
|
3
|
+
"version": "0.0.7-210b8d7",
|
|
4
4
|
"description": "Shared Leav types",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"tscheck": "",
|
|
7
7
|
"test:ci": "",
|
|
8
8
|
"test:commit": "",
|
|
9
|
-
"publish-types": "npm publish --access public"
|
|
9
|
+
"publish-types": "npm publish --access public",
|
|
10
|
+
"generate": "yarn workspace core tsc --emitDeclarationOnly --declaration --outDir dist-types && mv ../../apps/core/dist-types/* . && rmdir ../../apps/core/dist-types",
|
|
11
|
+
"get-version": "jq -r '.version' package.json",
|
|
12
|
+
"set-version": "jq --arg v $1 '.version = $v' package.json > package.tmp.json && mv package.tmp.json package.json"
|
|
10
13
|
},
|
|
11
14
|
"license": "LGPL3",
|
|
12
15
|
"repository": "https://github.com/leav-solutions/leav-engine",
|