@aristid/leav-types 1.0.0-e073ed8e → 1.0.0-e2953ae0
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 +3 -2
- package/apps/core/src/_types/attribute.d.ts +3 -2
- package/apps/core/src/_types/events.d.ts +1 -1
- package/apps/core/src/_types/log.d.ts +7 -1
- package/apps/core/src/app/core/logApp.d.ts +3 -1
- package/apps/core/src/domain/log/logDomain.d.ts +5 -4
- package/apps/core/src/domain/value/helpers/formatLogValue.d.ts +23 -0
- package/apps/core/src/domain/value/helpers/formatLogValue.spec.d.ts +1 -0
- package/apps/core/src/domain/value/helpers/index.d.ts +1 -0
- package/apps/core/src/infra/db/migrations/012-addDisplayMultiTreeOptAttributeProperty.d.ts +7 -0
- package/apps/core/src/infra/elasticSearch/elasticSearchService.d.ts +15 -10
- package/apps/core/src/infra/log/logRepo.d.ts +2 -3
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AttributeFormats, AttributeTypes,
|
|
1
|
+
import { AttributeFormats, AttributeTypes, MultiDisplayOption, IAttribute } from '../../_types/attribute';
|
|
2
2
|
export declare const mockAttrSimple: IAttribute;
|
|
3
3
|
export declare const mockUniqueAttrSimple: IAttribute;
|
|
4
4
|
export declare const mockAttrId: IAttribute;
|
|
@@ -31,7 +31,8 @@ export declare const mockAttrTree: {
|
|
|
31
31
|
unique?: boolean;
|
|
32
32
|
description?: import("../../_types/systemTranslation").ISystemTranslation;
|
|
33
33
|
settings?: import("../../_types/shared").IKeyValue<any>;
|
|
34
|
-
multi_link_display_option?:
|
|
34
|
+
multi_link_display_option?: MultiDisplayOption;
|
|
35
|
+
multi_tree_display_option?: MultiDisplayOption;
|
|
35
36
|
label?: import("../../_types/systemTranslation").ISystemTranslation | string;
|
|
36
37
|
};
|
|
37
38
|
export declare const mockAttrTreeVersionable: IAttribute;
|
|
@@ -25,7 +25,8 @@ export interface IAttribute extends ICoreEntity {
|
|
|
25
25
|
unique?: boolean;
|
|
26
26
|
description?: ISystemTranslation;
|
|
27
27
|
settings?: IKeyValue<any>;
|
|
28
|
-
multi_link_display_option?:
|
|
28
|
+
multi_link_display_option?: MultiDisplayOption;
|
|
29
|
+
multi_tree_display_option?: MultiDisplayOption;
|
|
29
30
|
}
|
|
30
31
|
export declare enum ValueVersionMode {
|
|
31
32
|
SIMPLE = "simple",
|
|
@@ -89,7 +90,7 @@ export declare enum AttributeFormats {
|
|
|
89
90
|
COLOR = "color",
|
|
90
91
|
RICH_TEXT = "rich_text"
|
|
91
92
|
}
|
|
92
|
-
export declare enum
|
|
93
|
+
export declare enum MultiDisplayOption {
|
|
93
94
|
AVATAR = "avatar",
|
|
94
95
|
TAG = "tag",
|
|
95
96
|
BADGE_QTY = "badge_qty"
|
|
@@ -41,5 +41,5 @@ interface IDBPayloadDataMap {
|
|
|
41
41
|
[EventAction.TREE_DELETE]: ITree;
|
|
42
42
|
[EventAction.PERMISSION_SAVE]: IPermission;
|
|
43
43
|
}
|
|
44
|
-
type IDBPayloadData<DBPayloadAction extends EventAction> = DBPayloadAction extends keyof IDBPayloadDataMap ? IDBPayloadDataMap[DBPayloadAction] : never;
|
|
44
|
+
export type IDBPayloadData<DBPayloadAction extends EventAction> = DBPayloadAction extends keyof IDBPayloadDataMap ? IDBPayloadDataMap[DBPayloadAction] : never;
|
|
45
45
|
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { EventAction } from '@leav/utils';
|
|
1
|
+
import { EventAction, Log as LogExternal } from '@leav/utils';
|
|
2
|
+
import { IDbPayloadInternal } from './events';
|
|
2
3
|
export interface ILogTopicFilter {
|
|
3
4
|
record?: {
|
|
4
5
|
id: string;
|
|
@@ -35,3 +36,8 @@ export interface ILogPagination {
|
|
|
35
36
|
limit: number;
|
|
36
37
|
offset: number;
|
|
37
38
|
}
|
|
39
|
+
export type Log<EA extends EventAction = EventAction> = LogExternal & IDbPayloadInternal<EA>;
|
|
40
|
+
export interface ILogResponse {
|
|
41
|
+
logs: Log[];
|
|
42
|
+
total: number;
|
|
43
|
+
}
|
|
@@ -7,6 +7,7 @@ import { ITreeDomain } from 'domain/tree/treeDomain';
|
|
|
7
7
|
import { IVersionProfileDomain } from 'domain/versionProfile/versionProfileDomain';
|
|
8
8
|
import { IAppModule } from '_types/shared';
|
|
9
9
|
import { IGraphqlAppModule } from 'app/graphql/graphqlApp';
|
|
10
|
+
import { IFormatLogValueHelper } from 'domain/value/helpers/formatLogValue';
|
|
10
11
|
export type ICoreLogApp = IAppModule & IGraphqlAppModule;
|
|
11
12
|
interface IDeps {
|
|
12
13
|
'core.domain.log': ILogDomain;
|
|
@@ -14,8 +15,9 @@ interface IDeps {
|
|
|
14
15
|
'core.domain.library': ILibraryDomain;
|
|
15
16
|
'core.domain.attribute': IAttributeDomain;
|
|
16
17
|
'core.domain.tree': ITreeDomain;
|
|
18
|
+
'core.domain.value.helpers.formatLogValue': IFormatLogValueHelper;
|
|
17
19
|
'core.domain.versionProfile': IVersionProfileDomain;
|
|
18
20
|
'core.domain.application': IApplicationDomain;
|
|
19
21
|
}
|
|
20
|
-
export default function ({ 'core.domain.log': logDomain, 'core.domain.eventsManager': eventsManagerDomain, 'core.domain.library': libraryDomain, 'core.domain.attribute': attributeDomain, 'core.domain.tree': treeDomain, 'core.domain.versionProfile': versionProfileDomain, 'core.domain.application': applicationDomain }: IDeps): ICoreLogApp;
|
|
22
|
+
export default function ({ 'core.domain.log': logDomain, 'core.domain.eventsManager': eventsManagerDomain, 'core.domain.library': libraryDomain, 'core.domain.attribute': attributeDomain, 'core.domain.tree': treeDomain, 'core.domain.value.helpers.formatLogValue': formatLogValue, 'core.domain.versionProfile': versionProfileDomain, 'core.domain.application': applicationDomain }: IDeps): ICoreLogApp;
|
|
21
23
|
export {};
|
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import { Log } from '@leav/utils';
|
|
2
1
|
import { ILogRepo } from 'infra/log/logRepo';
|
|
3
|
-
import { ILogFilters, ILogPagination, ILogSort } from '_types/log';
|
|
2
|
+
import { ILogFilters, ILogPagination, ILogResponse, ILogSort } from '_types/log';
|
|
4
3
|
import { IQueryInfos } from '_types/queryInfos';
|
|
5
4
|
import { IPermissionDomain } from 'domain/permission/permissionDomain';
|
|
5
|
+
import { IRecordPermissionDomain } from 'domain/permission/recordPermissionDomain';
|
|
6
6
|
export interface ILogDomain {
|
|
7
7
|
getLogs: (params: {
|
|
8
8
|
filters?: ILogFilters;
|
|
9
9
|
sort?: ILogSort;
|
|
10
10
|
pagination?: ILogPagination;
|
|
11
|
-
}, ctx: IQueryInfos) => Promise<
|
|
11
|
+
}, ctx: IQueryInfos) => Promise<ILogResponse>;
|
|
12
12
|
}
|
|
13
13
|
interface IDeps {
|
|
14
14
|
'core.infra.log': ILogRepo;
|
|
15
15
|
'core.domain.permission': IPermissionDomain;
|
|
16
|
+
'core.domain.permission.record': IRecordPermissionDomain;
|
|
16
17
|
}
|
|
17
|
-
export default function ({ 'core.infra.log': logRepo, 'core.domain.permission': permissionDomain }: IDeps): ILogDomain;
|
|
18
|
+
export default function ({ 'core.infra.log': logRepo, 'core.domain.permission': permissionDomain, 'core.domain.permission.record': recordPermissionDomain }: IDeps): ILogDomain;
|
|
18
19
|
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { EventAction } from '@leav/utils';
|
|
2
|
+
import { IDBPayloadData } from '_types/events';
|
|
3
|
+
import { Log } from '_types/log';
|
|
4
|
+
import { IActionsListDomain } from 'domain/actionsList/actionsListDomain';
|
|
5
|
+
import { IAttributeDomain } from 'domain/attribute/attributeDomain';
|
|
6
|
+
import { IRecordDomain } from 'domain/record/recordDomain';
|
|
7
|
+
import { ITreeDomain } from 'domain/tree/treeDomain';
|
|
8
|
+
import { i18n } from 'i18next';
|
|
9
|
+
import winston from 'winston';
|
|
10
|
+
import { IQueryInfos } from '../../../_types/queryInfos';
|
|
11
|
+
export interface IFormatLogValueHelper {
|
|
12
|
+
formatAsString(log: Log, rawData: IDBPayloadData<EventAction.VALUE_DELETE | EventAction.VALUE_SAVE>, ctx: IQueryInfos): Promise<string | null>;
|
|
13
|
+
}
|
|
14
|
+
interface IDeps {
|
|
15
|
+
'core.domain.actionsList': IActionsListDomain;
|
|
16
|
+
'core.domain.record': IRecordDomain;
|
|
17
|
+
'core.domain.attribute': IAttributeDomain;
|
|
18
|
+
'core.domain.tree': ITreeDomain;
|
|
19
|
+
'core.utils.logger': winston.Winston;
|
|
20
|
+
translator: i18n;
|
|
21
|
+
}
|
|
22
|
+
export default function ({ 'core.domain.actionsList': actionsListDomain, 'core.domain.record': recordDomain, 'core.domain.attribute': attributeDomain, 'core.domain.tree': treeDomain, 'core.utils.logger': logger, translator }: IDeps): IFormatLogValueHelper;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as formatLogValue } from './formatLogValue';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type IDbService } from '../dbService';
|
|
2
|
+
import { type IMigration } from '../../../_types/migration';
|
|
3
|
+
interface IDeps {
|
|
4
|
+
'core.infra.db.dbService': IDbService;
|
|
5
|
+
}
|
|
6
|
+
export default function ({ 'core.infra.db.dbService': dbService }: IDeps): IMigration;
|
|
7
|
+
export {};
|
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
import { Client, estypes } from '@elastic/elasticsearch';
|
|
2
2
|
import { IConfig } from '_types/config';
|
|
3
3
|
import { IQueryInfos } from '_types/queryInfos';
|
|
4
|
+
export interface IElasticsearchServiceSearchResponse<T> {
|
|
5
|
+
total: number;
|
|
6
|
+
hits: T[];
|
|
7
|
+
}
|
|
8
|
+
interface IElasticsearchServiceSearchParams {
|
|
9
|
+
index: string;
|
|
10
|
+
offset?: number;
|
|
11
|
+
limit?: number;
|
|
12
|
+
sort?: {
|
|
13
|
+
field: string;
|
|
14
|
+
order: 'asc' | 'desc';
|
|
15
|
+
};
|
|
16
|
+
query?: estypes.QueryDslQueryContainer;
|
|
17
|
+
}
|
|
4
18
|
export interface IElasticSearchService {
|
|
5
19
|
client: Client;
|
|
6
|
-
search: (params:
|
|
7
|
-
index: string;
|
|
8
|
-
offset?: number;
|
|
9
|
-
limit?: number;
|
|
10
|
-
sort?: {
|
|
11
|
-
field: string;
|
|
12
|
-
order: 'asc' | 'desc';
|
|
13
|
-
};
|
|
14
|
-
query?: estypes.QueryDslQueryContainer;
|
|
15
|
-
}, ctx: IQueryInfos) => Promise<Array<Record<string, any>>>;
|
|
20
|
+
search: <T>(params: IElasticsearchServiceSearchParams, ctx: IQueryInfos) => Promise<IElasticsearchServiceSearchResponse<T>>;
|
|
16
21
|
}
|
|
17
22
|
interface IDeps {
|
|
18
23
|
'core.infra.elasticSearch.client'?: Client;
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { Log } from '@leav/utils';
|
|
2
1
|
import { IElasticSearchService } from 'infra/elasticSearch/elasticSearchService';
|
|
3
2
|
import { IConfig } from '_types/config';
|
|
4
|
-
import { ILogFilters, ILogPagination, ILogSort } from '_types/log';
|
|
3
|
+
import { ILogFilters, ILogPagination, ILogResponse, ILogSort } from '_types/log';
|
|
5
4
|
import { IQueryInfos } from '_types/queryInfos';
|
|
6
5
|
export interface ILogRepo {
|
|
7
6
|
getLogs(params: {
|
|
8
7
|
filters?: ILogFilters;
|
|
9
8
|
sort?: ILogSort;
|
|
10
9
|
pagination?: ILogPagination;
|
|
11
|
-
}, ctx: IQueryInfos): Promise<
|
|
10
|
+
}, ctx: IQueryInfos): Promise<ILogResponse>;
|
|
12
11
|
}
|
|
13
12
|
interface IDeps {
|
|
14
13
|
'core.infra.elasticSearch.service'?: IElasticSearchService;
|