@aristid/leav-types 1.12.0-2d940dfc → 1.12.0-36182f39
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/CLAUDE.md +42 -0
- package/apps/core/config/default.d.ts +4 -0
- package/apps/core/config/development.d.ts +4 -0
- package/apps/core/config/test.d.ts +4 -0
- package/apps/core/src/__tests__/e2e/_gqlTypes/index.d.ts +217 -37
- package/apps/core/src/__tests__/e2e/api/_fixtures/fakeplugin/domain/fakeDomain.d.ts +6 -2
- package/apps/core/src/__tests__/e2e/api/automation/automation.test.d.ts +1 -0
- package/apps/core/src/__tests__/e2e/api/e2eUtils.d.ts +12 -7
- package/apps/core/src/__tests__/integration/infra/automationRuleRepo.test.d.ts +1 -0
- package/apps/core/src/__tests__/integration/infra/integrationTestRepoUtils.d.ts +3 -0
- package/apps/core/src/_types/automation.d.ts +33 -0
- package/apps/core/src/_types/config.d.ts +4 -0
- package/apps/core/src/_types/cronTask.d.ts +14 -0
- package/apps/core/src/_types/errors.d.ts +1 -0
- package/apps/core/src/_types/events.d.ts +3 -0
- package/apps/core/src/_types/extensionPoints.d.ts +5 -0
- package/apps/core/src/app/core/attributeApp/attributeApp.d.ts +2 -0
- package/apps/core/src/app/core/automationApp.d.ts +22 -0
- package/apps/core/src/app/core/eventsManagerApp.d.ts +2 -1
- package/apps/core/src/app/core/filesManagerApp.d.ts +3 -1
- package/apps/core/src/app/core/index.d.ts +1 -0
- package/apps/core/src/app/core/logApp.d.ts +3 -1
- package/apps/core/src/app/core/tasksManagerApp.d.ts +3 -1
- package/apps/core/src/domain/automation/automationDomain.d.ts +41 -0
- package/apps/core/src/domain/automation/index.d.ts +1 -0
- package/apps/core/src/domain/library/helpers/index.d.ts +0 -1
- package/apps/core/src/domain/record/helpers/createRecord.d.ts +3 -1
- package/apps/core/src/domain/record/helpers/getRecordIdentity.d.ts +27 -0
- package/apps/core/src/domain/record/helpers/getRecordIdentity.spec.d.ts +1 -0
- package/apps/core/src/domain/record/helpers/index.d.ts +1 -1
- package/apps/core/src/domain/record/recordDomain.d.ts +3 -11
- package/apps/core/src/domain/tasksManager/cronTasksManagerDomain.d.ts +13 -0
- package/apps/core/src/domain/tasksManager/cronTasksManagerDomain.spec.d.ts +1 -0
- package/apps/core/src/domain/tasksManager/index.d.ts +1 -0
- package/apps/core/src/domain/value/helpers/formatValue.d.ts +17 -0
- package/apps/core/src/domain/value/helpers/getRecordFieldValue.d.ts +27 -0
- package/apps/core/src/domain/value/helpers/getRecordFieldValue.spec.d.ts +1 -0
- package/apps/core/src/domain/value/helpers/getValues.d.ts +26 -0
- package/apps/core/src/domain/value/helpers/getValues.spec.d.ts +1 -0
- package/apps/core/src/domain/value/helpers/index.d.ts +7 -0
- package/apps/core/src/domain/value/helpers/manageEventMetadata.d.ts +4 -0
- package/apps/core/src/domain/value/helpers/runActionsList.d.ts +10 -0
- package/apps/core/src/domain/value/tasks/saveValueBulk.d.ts +7 -4
- package/apps/core/src/domain/value/valueDomain.d.ts +11 -1
- package/apps/core/src/infra/automation/automationRuleRepo.d.ts +29 -0
- package/apps/core/src/infra/automation/index.d.ts +1 -0
- package/apps/core/src/infra/db/dbUtils.d.ts +5 -1
- package/apps/core/src/infra/db/migrations/019-automationRuleCollection.d.ts +7 -0
- package/apps/core/tsconfig.types.tsbuildinfo +1 -1
- package/libs/utils/src/types/events.d.ts +3 -0
- package/package.json +1 -1
- package/apps/core/src/domain/record/helpers/getRecordFieldValue.spec.d.ts +0 -0
|
@@ -3,6 +3,7 @@ import { type IAttributeDomain } from '../../../domain/attribute/attributeDomain
|
|
|
3
3
|
import { type ILibraryDomain } from '../../../domain/library/libraryDomain';
|
|
4
4
|
import { type IPermissionDomain } from '../../../domain/permission/permissionDomain';
|
|
5
5
|
import { type IAttributeDependentValuesPermissionDomain } from '../../../domain/permission/attributeDependentValuesPermissionDomain';
|
|
6
|
+
import { type IfLibraryJoinLinkAttribute } from '../../../domain/attribute/helpers/ifLibraryJoinLinkAttribute';
|
|
6
7
|
import { type IRecordDomain } from '../../../domain/record/recordDomain';
|
|
7
8
|
import { type ITreeDomain } from '../../../domain/tree/treeDomain';
|
|
8
9
|
import { type IVersionProfileDomain } from '../../../domain/versionProfile/versionProfileDomain';
|
|
@@ -12,6 +13,7 @@ import { type ICoreApp } from '../coreApp';
|
|
|
12
13
|
export type ICoreAttributeApp = IGraphqlAppModule;
|
|
13
14
|
interface IDeps {
|
|
14
15
|
'core.domain.attribute': IAttributeDomain;
|
|
16
|
+
'core.domain.attribute.helpers.ifLibraryJoinLinkAttribute': IfLibraryJoinLinkAttribute;
|
|
15
17
|
'core.domain.library': ILibraryDomain;
|
|
16
18
|
'core.domain.record': IRecordDomain;
|
|
17
19
|
'core.domain.tree': ITreeDomain;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type IGraphqlAppModule } from '../graphql/graphqlApp';
|
|
2
|
+
import { type IAutomationDomain } from '../../domain/automation/automationDomain';
|
|
3
|
+
import { type IAutomationRule } from '../../_types/automation';
|
|
4
|
+
import { type IPaginationParams, type ISortParams } from '../../_types/list';
|
|
5
|
+
import { type IEventsManagerDomain } from '../../domain/eventsManager/eventsManagerDomain';
|
|
6
|
+
export type ICoreImportApp = IGraphqlAppModule;
|
|
7
|
+
interface IAutomationAppDeps {
|
|
8
|
+
'core.domain.automation': IAutomationDomain;
|
|
9
|
+
'core.domain.eventsManager': IEventsManagerDomain;
|
|
10
|
+
}
|
|
11
|
+
export interface IGetAutomationRulesArgs {
|
|
12
|
+
filters?: ICoreEntityFilterOptions & {
|
|
13
|
+
active?: boolean;
|
|
14
|
+
synchronous?: boolean;
|
|
15
|
+
eventAction?: IAutomationRule['trigger']['eventAction'];
|
|
16
|
+
eventTopic?: IAutomationRule['trigger']['eventTopic'];
|
|
17
|
+
};
|
|
18
|
+
pagination?: IPaginationParams;
|
|
19
|
+
sort?: ISortParams;
|
|
20
|
+
}
|
|
21
|
+
export default function ({ 'core.domain.automation': automationDomain, 'core.domain.eventsManager': eventsManagerDomain, }: IAutomationAppDeps): ICoreImportApp;
|
|
22
|
+
export {};
|
|
@@ -2,7 +2,8 @@ import { type InitQueryContextFunc } from '../helpers/initQueryContext';
|
|
|
2
2
|
import { type IEventsManagerDomain } from '../../domain/eventsManager/eventsManagerDomain';
|
|
3
3
|
import { type IConfig } from '../../_types/config';
|
|
4
4
|
import { type IAppModule } from '../../_types/shared';
|
|
5
|
-
|
|
5
|
+
import { type IGraphqlAppModule } from '../graphql/graphqlApp';
|
|
6
|
+
export type IEventsManagerApp = IAppModule & IGraphqlAppModule;
|
|
6
7
|
interface IDeps {
|
|
7
8
|
'core.domain.eventsManager': IEventsManagerDomain;
|
|
8
9
|
'core.app.helpers.initQueryContext': InitQueryContextFunc;
|
|
@@ -5,6 +5,7 @@ import { type IFilesManagerDomain } from '../../domain/filesManager/filesManager
|
|
|
5
5
|
import { type ValidateRequestTokenFunc } from '../helpers/validateRequestToken';
|
|
6
6
|
import { type IGraphqlAppModule } from '../graphql/graphqlApp';
|
|
7
7
|
import { type IServerRouteAppModule } from '../../interface/server';
|
|
8
|
+
import { type IRecordPermissionDomain } from '../../domain/permission/recordPermissionDomain';
|
|
8
9
|
export interface IFilesManagerApp extends IGraphqlAppModule, IServerRouteAppModule {
|
|
9
10
|
init(): Promise<void>;
|
|
10
11
|
}
|
|
@@ -13,7 +14,8 @@ interface IDeps {
|
|
|
13
14
|
'core.app.helpers.validateRequestToken': ValidateRequestTokenFunc;
|
|
14
15
|
'core.domain.filesManager': IFilesManagerDomain;
|
|
15
16
|
'core.domain.eventsManager': IEventsManagerDomain;
|
|
17
|
+
'core.domain.permission.record': IRecordPermissionDomain;
|
|
16
18
|
config: IConfig;
|
|
17
19
|
}
|
|
18
|
-
export default function ({ 'core.app.helpers.initQueryContext': initQueryContext, 'core.app.helpers.validateRequestToken': validateRequestToken, 'core.domain.filesManager': filesManagerDomain, 'core.domain.eventsManager': eventsManager, config, }: IDeps): IFilesManagerApp;
|
|
20
|
+
export default function ({ 'core.app.helpers.initQueryContext': initQueryContext, 'core.app.helpers.validateRequestToken': validateRequestToken, 'core.domain.filesManager': filesManagerDomain, 'core.domain.eventsManager': eventsManager, 'core.domain.permission.record': recordPermissionDomain, config, }: IDeps): IFilesManagerApp;
|
|
19
21
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { default as actionList } from './actionListApp';
|
|
2
2
|
export { default as apiKey } from './apiKeyApp/apiKeyApp';
|
|
3
3
|
export { default as attribute } from './attributeApp/attributeApp';
|
|
4
|
+
export { default as automation } from './automationApp';
|
|
4
5
|
export { default } from './coreApp';
|
|
5
6
|
export { default as eventsManager } from './eventsManagerApp';
|
|
6
7
|
export { default as export } from './exportApp';
|
|
@@ -3,6 +3,7 @@ import { type IAttributeDomain } from '../../domain/attribute/attributeDomain';
|
|
|
3
3
|
import { type IEventsManagerDomain } from '../../domain/eventsManager/eventsManagerDomain';
|
|
4
4
|
import { type ILibraryDomain } from '../../domain/library/libraryDomain';
|
|
5
5
|
import { type ILogDomain } from '../../domain/log/logDomain';
|
|
6
|
+
import { type IAutomationDomain } from '../../domain/automation/automationDomain';
|
|
6
7
|
import { type ITreeDomain } from '../../domain/tree/treeDomain';
|
|
7
8
|
import { type IVersionProfileDomain } from '../../domain/versionProfile/versionProfileDomain';
|
|
8
9
|
import { type IAppModule } from '../../_types/shared';
|
|
@@ -21,9 +22,10 @@ interface IDeps {
|
|
|
21
22
|
'core.domain.value.helpers.formatLogValue': IFormatLogValueHelper;
|
|
22
23
|
'core.domain.versionProfile': IVersionProfileDomain;
|
|
23
24
|
'core.domain.application': IApplicationDomain;
|
|
25
|
+
'core.domain.automation': IAutomationDomain;
|
|
24
26
|
'core.domain.record': IRecordDomain;
|
|
25
27
|
translator: i18n;
|
|
26
28
|
config: IConfig;
|
|
27
29
|
}
|
|
28
|
-
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, 'core.domain.record': recordDomain, translator, config, }: IDeps): ICoreLogApp;
|
|
30
|
+
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, 'core.domain.automation': automationDomain, 'core.domain.record': recordDomain, translator, config, }: IDeps): ICoreLogApp;
|
|
29
31
|
export {};
|
|
@@ -9,6 +9,7 @@ import { TaskStatus } from '../../_types/tasksManager';
|
|
|
9
9
|
import { type IGraphqlAppModule } from '../graphql/graphqlApp';
|
|
10
10
|
import { type IAdminPermissionDomain } from '../../domain/permission/adminPermissionDomain';
|
|
11
11
|
import { type IExtensionPoints } from '../../_types/extensionPoints';
|
|
12
|
+
import { type ICronTasksManagerDomain } from '../../domain/tasksManager/cronTasksManagerDomain';
|
|
12
13
|
export interface ITasksManagerApp extends IGraphqlAppModule {
|
|
13
14
|
initMaster(): Promise<NodeJS.Timeout>;
|
|
14
15
|
initWorker(): Promise<void>;
|
|
@@ -16,6 +17,7 @@ export interface ITasksManagerApp extends IGraphqlAppModule {
|
|
|
16
17
|
}
|
|
17
18
|
interface IDeps {
|
|
18
19
|
'core.domain.tasksManager'?: ITasksManagerDomain;
|
|
20
|
+
'core.domain.tasksManager.cron'?: ICronTasksManagerDomain;
|
|
19
21
|
'core.utils.logger'?: ILogger;
|
|
20
22
|
config?: IConfig;
|
|
21
23
|
'core.utils'?: IUtils;
|
|
@@ -32,5 +34,5 @@ export interface IGetTasksArgs {
|
|
|
32
34
|
pagination?: IPaginationParams;
|
|
33
35
|
sort?: ISortParams;
|
|
34
36
|
}
|
|
35
|
-
export default function ({ 'core.domain.record': recordDomain, 'core.domain.tasksManager': tasksManagerDomain, 'core.domain.eventsManager': eventsManager, 'core.domain.permission.admin': adminPermissionDomain, }: IDeps): ITasksManagerApp;
|
|
37
|
+
export default function ({ 'core.domain.record': recordDomain, 'core.domain.tasksManager': tasksManagerDomain, 'core.domain.tasksManager.cron': cronTasksManagerDomain, 'core.domain.eventsManager': eventsManager, 'core.domain.permission.admin': adminPermissionDomain, }: IDeps): ITasksManagerApp;
|
|
36
38
|
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type ICreateAutomationRule, type IAutomationRule, type IUpdateAutomationRule } from '../../_types/automation';
|
|
2
|
+
import { type IList } from '../../_types/list';
|
|
3
|
+
import { type IQueryInfos } from '../../_types/queryInfos';
|
|
4
|
+
import { type IGetCoreEntitiesParams } from '../../_types/shared';
|
|
5
|
+
import { type IAutomationRuleRepo } from '../../infra/automation/automationRuleRepo';
|
|
6
|
+
import { type IAdminPermissionDomain } from '../permission/adminPermissionDomain';
|
|
7
|
+
import { type IEventsManagerDomain } from '../eventsManager/eventsManagerDomain';
|
|
8
|
+
import { type IConfig } from '../../_types/config';
|
|
9
|
+
export interface IGetAutomationRulesParams extends IGetCoreEntitiesParams {
|
|
10
|
+
filters?: ICoreEntityFilterOptions & {
|
|
11
|
+
active?: boolean;
|
|
12
|
+
synchronous?: boolean;
|
|
13
|
+
eventAction?: IAutomationRule['trigger']['eventAction'];
|
|
14
|
+
eventTopic?: IAutomationRule['trigger']['eventTopic'];
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export interface IAutomationDomain {
|
|
18
|
+
getAutomationRules({ params, ctx, }: {
|
|
19
|
+
params: IGetAutomationRulesParams;
|
|
20
|
+
ctx: IQueryInfos;
|
|
21
|
+
}): Promise<IList<IAutomationRule>>;
|
|
22
|
+
createAutomationRule({ rule, ctx }: {
|
|
23
|
+
rule: ICreateAutomationRule;
|
|
24
|
+
ctx: IQueryInfos;
|
|
25
|
+
}): Promise<IAutomationRule>;
|
|
26
|
+
updateAutomationRule({ rule, ctx }: {
|
|
27
|
+
rule: IUpdateAutomationRule;
|
|
28
|
+
ctx: IQueryInfos;
|
|
29
|
+
}): Promise<IAutomationRule>;
|
|
30
|
+
triggerRules(event: {
|
|
31
|
+
action: IAutomationRule['trigger']['eventAction'];
|
|
32
|
+
topic?: IAutomationRule['trigger']['eventTopic'];
|
|
33
|
+
}, synchronous: boolean, ctx: IQueryInfos): Promise<void>;
|
|
34
|
+
}
|
|
35
|
+
export interface IAutomationDomainDeps {
|
|
36
|
+
'core.domain.permission.admin': IAdminPermissionDomain;
|
|
37
|
+
'core.domain.eventsManager': IEventsManagerDomain;
|
|
38
|
+
'core.infra.automation.rule': IAutomationRuleRepo;
|
|
39
|
+
config: IConfig;
|
|
40
|
+
}
|
|
41
|
+
export default function ({ 'core.domain.permission.admin': adminPermissionDomain, 'core.domain.eventsManager': eventsManagerDomain, 'core.infra.automation.rule': automationRuleRepo, config, }: IAutomationDomainDeps): IAutomationDomain;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './automationDomain';
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
export { default as deleteAssociatedValues } from './deleteAssociatedValues';
|
|
2
|
-
export { default as runBehaviorPostSave } from './runBehaviorPostSave';
|
|
3
2
|
export { default as runPreDelete } from './runPreDelete';
|
|
4
3
|
export { default as updateAssociatedForms } from './updateAssociatedForms';
|
|
@@ -4,6 +4,7 @@ import { type IRecordRepo } from '../../../infra/record/recordRepo';
|
|
|
4
4
|
import { type IQueryInfos } from '../../../_types/queryInfos';
|
|
5
5
|
import { type IRecord } from '../../../_types/record';
|
|
6
6
|
import { type ICreateRecordValueError } from '../_types';
|
|
7
|
+
import { type IAutomationDomain } from '../../automation/automationDomain';
|
|
7
8
|
export type IPreCreateRecordCallback = () => Promise<ICreateRecordValueError[]>;
|
|
8
9
|
export type CreateRecordHelper = (params: {
|
|
9
10
|
library: string;
|
|
@@ -14,6 +15,7 @@ interface IDeps {
|
|
|
14
15
|
'core.domain.eventsManager': IEventsManagerDomain;
|
|
15
16
|
'core.domain.permission.library': ILibraryPermissionDomain;
|
|
16
17
|
'core.infra.record': IRecordRepo;
|
|
18
|
+
'core.domain.automation': IAutomationDomain;
|
|
17
19
|
}
|
|
18
|
-
export default function ({ 'core.domain.eventsManager': eventsManager, 'core.domain.permission.library': libraryPermissionDomain, 'core.infra.record': recordRepo, }: IDeps): CreateRecordHelper;
|
|
20
|
+
export default function ({ 'core.domain.eventsManager': eventsManager, 'core.domain.permission.library': libraryPermissionDomain, 'core.infra.record': recordRepo, 'core.domain.automation': automationDomain, }: IDeps): CreateRecordHelper;
|
|
19
21
|
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type i18n } from 'i18next';
|
|
2
|
+
import { type IAttributeDomain } from '../../attribute/attributeDomain';
|
|
3
|
+
import { type IElementAncestorsHelper } from '../../tree/helpers/elementAncestors';
|
|
4
|
+
import { type GetCoreEntityByIdFunc } from '../../helpers/getCoreEntityById';
|
|
5
|
+
import { type IValidateHelper } from '../../helpers/validate';
|
|
6
|
+
import { type FindRecordsHelper } from './findRecords';
|
|
7
|
+
import { type ICachesService } from '../../../infra/cache/cacheService';
|
|
8
|
+
import { type IQueryInfos } from '../../../_types/queryInfos';
|
|
9
|
+
import { type IRecord, type IRecordIdentity } from '../../../_types/record';
|
|
10
|
+
import { type IUtils } from '../../../utils/utils';
|
|
11
|
+
import type * as Config from '../../../_types/config';
|
|
12
|
+
import { type GetRecordFieldValueHelper } from '../../value/helpers/getRecordFieldValue';
|
|
13
|
+
export type GetRecordIdentityHelper = (record: IRecord, ctx: IQueryInfos) => Promise<IRecordIdentity>;
|
|
14
|
+
interface IDeps {
|
|
15
|
+
config: Config.IConfig;
|
|
16
|
+
'core.domain.attribute': IAttributeDomain;
|
|
17
|
+
'core.domain.value.helpers.getRecordFieldValue': GetRecordFieldValueHelper;
|
|
18
|
+
'core.domain.helpers.validate': IValidateHelper;
|
|
19
|
+
'core.domain.helpers.getCoreEntityById': GetCoreEntityByIdFunc;
|
|
20
|
+
'core.domain.tree.helpers.elementAncestors': IElementAncestorsHelper;
|
|
21
|
+
'core.domain.record.helpers.findRecords': FindRecordsHelper;
|
|
22
|
+
'core.infra.cache.cacheService': ICachesService;
|
|
23
|
+
'core.utils': IUtils;
|
|
24
|
+
translator: i18n;
|
|
25
|
+
}
|
|
26
|
+
export default function ({ config, 'core.domain.attribute': attributeDomain, 'core.domain.value.helpers.getRecordFieldValue': getRecordFieldValueHelper, 'core.domain.helpers.validate': validateHelper, 'core.domain.helpers.getCoreEntityById': getCoreEntityById, 'core.domain.tree.helpers.elementAncestors': elementAncestorsHelper, 'core.domain.record.helpers.findRecords': findRecordsHelper, 'core.infra.cache.cacheService': cacheService, 'core.utils': utils, translator, }: IDeps): GetRecordIdentityHelper;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { default as createRecord } from './createRecord';
|
|
2
2
|
export { default as deleteRecord } from './deleteRecord';
|
|
3
3
|
export { default as sendRecordUpdateEvent } from './sendRecordUpdateEvent';
|
|
4
|
-
export { default as getAccessPermissionFilters } from './getAccessPermissionFilters';
|
|
5
4
|
export { default as findRecords } from './findRecords';
|
|
5
|
+
export { default as getRecordIdentity } from './getRecordIdentity';
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import { type IEventsManagerDomain } from '../eventsManager/eventsManagerDomain';
|
|
2
|
-
import { type GetCoreEntityByIdFunc } from '../helpers/getCoreEntityById';
|
|
3
|
-
import { type IValidateHelper } from '../helpers/validate';
|
|
4
2
|
import { type IValueDomain } from '../value/valueDomain';
|
|
5
|
-
import { type i18n } from 'i18next';
|
|
6
3
|
import { type IRecordRepo } from '../../infra/record/recordRepo';
|
|
7
4
|
import { type IUtils } from '../../utils/utils';
|
|
8
|
-
import type * as Config from '../../_types/config';
|
|
9
5
|
import { type IListWithCursor } from '../../_types/list';
|
|
10
6
|
import { type ISaveValue, type IValue, type IValuesOptions } from '../../_types/value';
|
|
11
7
|
import { type ICachesService } from '../../infra/cache/cacheService';
|
|
@@ -18,9 +14,9 @@ import { type IDuplicateRecordResult, type ICreateRecordResult, type ICreateReco
|
|
|
18
14
|
import { type IFormRepo } from '../../infra/form/formRepo';
|
|
19
15
|
import { type DeleteRecordHelper } from './helpers/deleteRecord';
|
|
20
16
|
import { type CreateRecordHelper } from './helpers/createRecord';
|
|
21
|
-
import { type IElementAncestorsHelper } from '../tree/helpers/elementAncestors';
|
|
22
17
|
import { type ILogger } from '@leav/logger';
|
|
23
18
|
import { type FindRecordsHelper } from './helpers/findRecords';
|
|
19
|
+
import { type GetRecordIdentityHelper } from './helpers/getRecordIdentity';
|
|
24
20
|
export declare const ATTRIBUTE_ACTIVE = "active";
|
|
25
21
|
export interface IDuplicateRecordRules {
|
|
26
22
|
attributesToDuplicate?: Array<{
|
|
@@ -118,23 +114,19 @@ export interface IRecordDomain {
|
|
|
118
114
|
}): Promise<IDuplicateRecordResult[]>;
|
|
119
115
|
}
|
|
120
116
|
export interface IRecordDomainDeps {
|
|
121
|
-
config: Config.IConfig;
|
|
122
117
|
'core.infra.record': IRecordRepo;
|
|
123
118
|
'core.domain.attribute': IAttributeDomain;
|
|
124
119
|
'core.domain.value': IValueDomain;
|
|
125
120
|
'core.domain.permission.record': IRecordPermissionDomain;
|
|
126
|
-
'core.domain.helpers.getCoreEntityById': GetCoreEntityByIdFunc;
|
|
127
|
-
'core.domain.helpers.validate': IValidateHelper;
|
|
128
121
|
'core.domain.record.helpers.createRecord': CreateRecordHelper;
|
|
129
122
|
'core.domain.record.helpers.deleteRecord': DeleteRecordHelper;
|
|
130
123
|
'core.domain.record.helpers.findRecords': FindRecordsHelper;
|
|
124
|
+
'core.domain.record.helpers.getRecordIdentity': GetRecordIdentityHelper;
|
|
131
125
|
'core.domain.record.helpers.sendRecordUpdateEvent': SendRecordUpdateEventHelper;
|
|
132
|
-
'core.domain.tree.helpers.elementAncestors': IElementAncestorsHelper;
|
|
133
126
|
'core.infra.form': IFormRepo;
|
|
134
127
|
'core.domain.eventsManager': IEventsManagerDomain;
|
|
135
128
|
'core.infra.cache.cacheService': ICachesService;
|
|
136
129
|
'core.utils.logger': ILogger;
|
|
137
130
|
'core.utils': IUtils;
|
|
138
|
-
translator: i18n;
|
|
139
131
|
}
|
|
140
|
-
export default function ({
|
|
132
|
+
export default function ({ '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.getRecordIdentity': getRecordIdentityHelper, 'core.domain.record.helpers.createRecord': createRecordHelper, 'core.domain.record.helpers.deleteRecord': deleteRecordHelper, 'core.domain.record.helpers.sendRecordUpdateEvent': sendRecordUpdateEvent, 'core.infra.form': formRepo, 'core.domain.eventsManager': eventsManager, 'core.infra.cache.cacheService': cacheService, 'core.utils.logger': logger, 'core.utils': utils, }: IRecordDomainDeps): IRecordDomain;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type GetSystemQueryContext } from '../../utils/helpers/getSystemQueryContext';
|
|
2
|
+
import { type ITasksManagerDomain } from './tasksManagerDomain';
|
|
3
|
+
import { type RegisterCronTask } from '../../_types/cronTask';
|
|
4
|
+
export interface ICronTasksManagerDomain {
|
|
5
|
+
initCronTasksManager(): Promise<void>;
|
|
6
|
+
stopCronTasksManager(): Promise<void>;
|
|
7
|
+
registerCronTask(registerCronTask: RegisterCronTask): void;
|
|
8
|
+
}
|
|
9
|
+
export interface ITasksManagerDomainDeps {
|
|
10
|
+
'core.domain.tasksManager': ITasksManagerDomain;
|
|
11
|
+
'core.utils.getSystemQueryContext': GetSystemQueryContext;
|
|
12
|
+
}
|
|
13
|
+
export default function ({ 'core.domain.tasksManager': tasksManagerDomain, 'core.utils.getSystemQueryContext': getSystemQueryContext, }: ITasksManagerDomainDeps): ICronTasksManagerDomain;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type ILogger } from '@leav/logger';
|
|
2
|
+
import { type IAttributeDomain } from '../../attribute/attributeDomain';
|
|
3
|
+
import { type IUtils } from '../../../utils/utils';
|
|
4
|
+
import { type IAttribute } from '../../../_types/attribute';
|
|
5
|
+
import { type IQueryInfos } from '../../../_types/queryInfos';
|
|
6
|
+
import { type IValue } from '../../../_types/value';
|
|
7
|
+
export type FormatValueHelper = (params: {
|
|
8
|
+
attribute: IAttribute;
|
|
9
|
+
value: IValue;
|
|
10
|
+
ctx: IQueryInfos;
|
|
11
|
+
}) => Promise<IValue>;
|
|
12
|
+
export interface IFormatValueHelperDeps {
|
|
13
|
+
'core.domain.attribute': IAttributeDomain;
|
|
14
|
+
'core.utils': IUtils;
|
|
15
|
+
'core.utils.logger': ILogger;
|
|
16
|
+
}
|
|
17
|
+
export default function ({ 'core.domain.attribute': attributeDomain, 'core.utils': utils, 'core.utils.logger': logger, }: IFormatValueHelperDeps): FormatValueHelper;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type ILogger } from '@leav/logger';
|
|
2
|
+
import { type IAttributeDomain } from '../../attribute/attributeDomain';
|
|
3
|
+
import { type IRecordAttributePermissionDomain } from '../../permission/recordAttributePermissionDomain';
|
|
4
|
+
import { type GetValuesHelper } from './getValues';
|
|
5
|
+
import { type IRecordRepo } from '../../../infra/record/recordRepo';
|
|
6
|
+
import { type IQueryInfos } from '../../../_types/queryInfos';
|
|
7
|
+
import { type IRecord } from '../../../_types/record';
|
|
8
|
+
import { type IValue, type IValuesOptions } from '../../../_types/value';
|
|
9
|
+
import { type FormatValueHelper } from './formatValue';
|
|
10
|
+
import { type RunActionsListHelper } from './runActionsList';
|
|
11
|
+
export type GetRecordFieldValueHelper = (params: {
|
|
12
|
+
library: string;
|
|
13
|
+
record: IRecord;
|
|
14
|
+
attributeId: string;
|
|
15
|
+
options?: IValuesOptions;
|
|
16
|
+
ctx: IQueryInfos;
|
|
17
|
+
}) => Promise<IValue[]>;
|
|
18
|
+
export interface IGetRecordFieldValueHelperDeps {
|
|
19
|
+
'core.domain.attribute': IAttributeDomain;
|
|
20
|
+
'core.domain.permission.recordAttribute': IRecordAttributePermissionDomain;
|
|
21
|
+
'core.domain.value.helpers.getValues': GetValuesHelper;
|
|
22
|
+
'core.domain.value.helpers.runActionsList': RunActionsListHelper;
|
|
23
|
+
'core.domain.value.helpers.formatValue': FormatValueHelper;
|
|
24
|
+
'core.infra.record': IRecordRepo;
|
|
25
|
+
'core.utils.logger': ILogger;
|
|
26
|
+
}
|
|
27
|
+
export default function ({ 'core.domain.attribute': attributeDomain, 'core.domain.permission.recordAttribute': recordAttributePermissionDomain, 'core.domain.value.helpers.getValues': getValuesHelper, 'core.domain.value.helpers.runActionsList': runActionsListHelper, 'core.domain.value.helpers.formatValue': formatValueHelper, 'core.infra.record': recordRepo, 'core.utils.logger': logger, }: IGetRecordFieldValueHelperDeps): GetRecordFieldValueHelper;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type IAttributeDomain } from '../../attribute/attributeDomain';
|
|
2
|
+
import { type IValidateHelper } from '../../helpers/validate';
|
|
3
|
+
import { type IGetDefaultElementHelper } from '../../tree/helpers/getDefaultElement';
|
|
4
|
+
import { type IElementAncestorsHelper } from '../../tree/helpers/elementAncestors';
|
|
5
|
+
import { type IVersionProfileDomain } from '../../versionProfile/versionProfileDomain';
|
|
6
|
+
import { type IValueRepo } from '../../../infra/value/valueRepo';
|
|
7
|
+
import { type IQueryInfos } from '../../../_types/queryInfos';
|
|
8
|
+
import { type IValue, type IValuesOptions } from '../../../_types/value';
|
|
9
|
+
import { type RunActionsListHelper } from './runActionsList';
|
|
10
|
+
export type GetValuesHelper = (params: {
|
|
11
|
+
library: string;
|
|
12
|
+
recordId: string;
|
|
13
|
+
attribute: string;
|
|
14
|
+
options?: IValuesOptions;
|
|
15
|
+
ctx: IQueryInfos;
|
|
16
|
+
}) => Promise<IValue[]>;
|
|
17
|
+
export interface IGetValuesHelperDeps {
|
|
18
|
+
'core.domain.attribute': IAttributeDomain;
|
|
19
|
+
'core.domain.helpers.validate': IValidateHelper;
|
|
20
|
+
'core.domain.tree.helpers.elementAncestors': IElementAncestorsHelper;
|
|
21
|
+
'core.domain.tree.helpers.getDefaultElement': IGetDefaultElementHelper;
|
|
22
|
+
'core.domain.versionProfile': IVersionProfileDomain;
|
|
23
|
+
'core.domain.value.helpers.runActionsList': RunActionsListHelper;
|
|
24
|
+
'core.infra.value': IValueRepo;
|
|
25
|
+
}
|
|
26
|
+
export default function ({ 'core.domain.attribute': attributeDomain, 'core.domain.helpers.validate': validate, 'core.domain.tree.helpers.elementAncestors': elementAncestors, 'core.domain.tree.helpers.getDefaultElement': getDefaultElementHelper, 'core.domain.versionProfile': versionProfileDomain, 'core.domain.value.helpers.runActionsList': runActionsListHelper, 'core.infra.value': valueRepo, }: IGetValuesHelperDeps): GetValuesHelper;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1 +1,8 @@
|
|
|
1
1
|
export { default as formatLogValue } from './formatLogValue';
|
|
2
|
+
export { default as formatValue } from './formatValue';
|
|
3
|
+
export type { FormatValueHelper } from './formatValue';
|
|
4
|
+
export { default as getRecordFieldValue } from './getRecordFieldValue';
|
|
5
|
+
export { default as getValues } from './getValues';
|
|
6
|
+
export type { GetValuesHelper } from './getValues';
|
|
7
|
+
export { default as runActionsList } from './runActionsList';
|
|
8
|
+
export type { RunActionsListHelper } from './runActionsList';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type IActionsListDomain } from '../../actionsList/actionsListDomain';
|
|
2
|
+
import { type IUtils } from '../../../utils/utils';
|
|
3
|
+
import { type IValue } from '../../../_types/value';
|
|
4
|
+
import { type IRunActionListParams } from '../_types';
|
|
5
|
+
export type RunActionsListHelper = (params: IRunActionListParams) => Promise<IValue[]>;
|
|
6
|
+
export interface IRunActionsListHelperDeps {
|
|
7
|
+
'core.domain.actionsList': IActionsListDomain;
|
|
8
|
+
'core.utils': IUtils;
|
|
9
|
+
}
|
|
10
|
+
export default function ({ 'core.domain.actionsList': actionsListDomain, 'core.utils': utils, }: IRunActionsListHelperDeps): RunActionsListHelper;
|
|
@@ -12,11 +12,14 @@ import { type ITasksManagerDomain } from '../../tasksManager/tasksManagerDomain'
|
|
|
12
12
|
import { type INotificationDomain } from '../../notification/notificationDomain';
|
|
13
13
|
export interface ISaveValueBulkParams {
|
|
14
14
|
libraryId: string;
|
|
15
|
-
recordsFilters
|
|
15
|
+
recordsFilters?: IRecordFilterLight[];
|
|
16
16
|
attributeId: string;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
mapping: Array<{
|
|
18
|
+
dependenciesFilters?: IRecordFilterLight[];
|
|
19
|
+
values: Array<{
|
|
20
|
+
before: ITreeNode['id'] | null;
|
|
21
|
+
after: ITreeNode['id'] | null;
|
|
22
|
+
}>;
|
|
20
23
|
}>;
|
|
21
24
|
ctx: IQueryInfos;
|
|
22
25
|
}
|
|
@@ -23,6 +23,11 @@ import { type IRecordAttributePermissionDomain } from '../permission/recordAttri
|
|
|
23
23
|
import { type IRecordPermissionDomain } from '../permission/recordPermissionDomain';
|
|
24
24
|
import { type IDeleteValueParams } from './_types';
|
|
25
25
|
import { type CreateRecordHelper } from '../record/helpers/createRecord';
|
|
26
|
+
import { type GetRecordIdentityHelper } from '../record/helpers/getRecordIdentity';
|
|
27
|
+
import { type GetRecordFieldValueHelper } from './helpers/getRecordFieldValue';
|
|
28
|
+
import { type GetValuesHelper } from './helpers/getValues';
|
|
29
|
+
import { type RunActionsListHelper } from './helpers/runActionsList';
|
|
30
|
+
import { type FormatValueHelper } from './helpers/formatValue';
|
|
26
31
|
import { type IfLibraryJoinLinkAttribute } from '../attribute/helpers/ifLibraryJoinLinkAttribute';
|
|
27
32
|
import { type IRecordInCreationBypassHelper } from '../permission/helpers/recordInCreationBypass';
|
|
28
33
|
import { type FindRecordsHelper } from '../record/helpers/findRecords';
|
|
@@ -131,6 +136,11 @@ export interface IValueDomainDeps {
|
|
|
131
136
|
'core.domain.tree.helpers.getDefaultElement': IGetDefaultElementHelper;
|
|
132
137
|
'core.domain.record.helpers.sendRecordUpdateEvent': SendRecordUpdateEventHelper;
|
|
133
138
|
'core.domain.record.helpers.createRecord': CreateRecordHelper;
|
|
139
|
+
'core.domain.record.helpers.getRecordIdentity': GetRecordIdentityHelper;
|
|
140
|
+
'core.domain.value.helpers.getRecordFieldValue': GetRecordFieldValueHelper;
|
|
141
|
+
'core.domain.value.helpers.getValues': GetValuesHelper;
|
|
142
|
+
'core.domain.value.helpers.runActionsList': RunActionsListHelper;
|
|
143
|
+
'core.domain.value.helpers.formatValue': FormatValueHelper;
|
|
134
144
|
'core.domain.record.helpers.findRecords': FindRecordsHelper;
|
|
135
145
|
'core.domain.permission.helpers.recordInCreationBypass': IRecordInCreationBypassHelper;
|
|
136
146
|
'core.domain.attribute.helpers.ifLibraryJoinLinkAttribute': IfLibraryJoinLinkAttribute;
|
|
@@ -142,5 +152,5 @@ export interface IValueDomainDeps {
|
|
|
142
152
|
'core.utils.logger': ILogger;
|
|
143
153
|
'core.domain.tree': ITreeDomain;
|
|
144
154
|
}
|
|
145
|
-
declare const valueDomain: ({ config, "core.domain.actionsList": actionsListDomain, "core.domain.attribute": attributeDomain, "core.domain.permission.attributeDependentValues": attributeDependentValuesPermissionDomain, "core.domain.permission.recordAttribute": recordAttributePermissionDomain, "core.domain.permission.record": recordPermissionDomain, "core.domain.eventsManager": eventsManager, "core.domain.helpers.validate": validate, "core.domain.helpers.updateRecordLastModif": updateRecordLastModif, "core.domain.tree.helpers.elementAncestors": elementAncestors, "core.domain.tree.helpers.getDefaultElement": getDefaultElementHelper, "core.domain.record.helpers.sendRecordUpdateEvent": sendRecordUpdateEvent, "core.domain.record.helpers.createRecord": createRecordHelper, "core.domain.record.helpers.findRecords": findRecordsHelper, "core.domain.permission.helpers.recordInCreationBypass": recordInCreationBypassHelper, "core.domain.attribute.helpers.ifLibraryJoinLinkAttribute": ifLibraryJoinLinkAttribute, "core.domain.versionProfile": versionProfileDomain, "core.infra.record": recordRepo, "core.infra.tree": treeRepo, "core.infra.value": valueRepo, "core.utils": utils, "core.utils.logger": logger, }: IValueDomainDeps) => IValueDomain;
|
|
155
|
+
declare const valueDomain: ({ config, "core.domain.actionsList": actionsListDomain, "core.domain.attribute": attributeDomain, "core.domain.permission.attributeDependentValues": attributeDependentValuesPermissionDomain, "core.domain.permission.recordAttribute": recordAttributePermissionDomain, "core.domain.permission.record": recordPermissionDomain, "core.domain.eventsManager": eventsManager, "core.domain.helpers.validate": validate, "core.domain.helpers.updateRecordLastModif": updateRecordLastModif, "core.domain.tree.helpers.elementAncestors": elementAncestors, "core.domain.tree.helpers.getDefaultElement": getDefaultElementHelper, "core.domain.record.helpers.sendRecordUpdateEvent": sendRecordUpdateEvent, "core.domain.record.helpers.createRecord": createRecordHelper, "core.domain.record.helpers.getRecordIdentity": getRecordIdentity, "core.domain.value.helpers.getRecordFieldValue": getRecordFieldValueHelper, "core.domain.value.helpers.getValues": getValuesHelper, "core.domain.value.helpers.runActionsList": runActionsListHelper, "core.domain.value.helpers.formatValue": formatValueHelper, "core.domain.record.helpers.findRecords": findRecordsHelper, "core.domain.permission.helpers.recordInCreationBypass": recordInCreationBypassHelper, "core.domain.attribute.helpers.ifLibraryJoinLinkAttribute": ifLibraryJoinLinkAttribute, "core.domain.versionProfile": versionProfileDomain, "core.infra.record": recordRepo, "core.infra.tree": treeRepo, "core.infra.value": valueRepo, "core.utils": utils, "core.utils.logger": logger, }: IValueDomainDeps) => IValueDomain;
|
|
146
156
|
export default valueDomain;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type ICreateAutomationRule, type IAutomationRule, type IUpdateAutomationRule, type SyncAutomationRuleEventAction } from '../../_types/automation';
|
|
2
|
+
import { type IList } from '../../_types/list';
|
|
3
|
+
import { type IQueryInfos } from '../../_types/queryInfos';
|
|
4
|
+
import { type IGetCoreEntitiesParams } from '../../_types/shared';
|
|
5
|
+
import { type IDbService } from '../db/dbService';
|
|
6
|
+
import { type IDbUtils } from '../db/dbUtils';
|
|
7
|
+
import { type EventAction, type IDbPayload } from '@leav/utils';
|
|
8
|
+
export declare const AUTOMATION_RULES_COLLECTION_NAME = "core_automation_rules";
|
|
9
|
+
export type IAutomationRuleFilterOptionsInRepo = ICoreEntityFilterOptions & {
|
|
10
|
+
active?: boolean;
|
|
11
|
+
trigger?: {
|
|
12
|
+
synchronous?: boolean;
|
|
13
|
+
eventAction?: EventAction | SyncAutomationRuleEventAction;
|
|
14
|
+
eventTopic?: IDbPayload['topic'];
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export type IGetAutomationRulesParams = IGetCoreEntitiesParams & {
|
|
18
|
+
filters?: IAutomationRuleFilterOptionsInRepo;
|
|
19
|
+
};
|
|
20
|
+
export interface IAutomationRuleRepo {
|
|
21
|
+
createAutomationRule(rule: ICreateAutomationRule, ctx: IQueryInfos): Promise<IAutomationRule>;
|
|
22
|
+
updateAutomationRule(rule: IUpdateAutomationRule, ctx: IQueryInfos): Promise<IAutomationRule>;
|
|
23
|
+
getAutomationRules(params: IGetAutomationRulesParams, ctx: IQueryInfos): Promise<IList<IAutomationRule>>;
|
|
24
|
+
}
|
|
25
|
+
export interface IAutomationRuleRepoDeps {
|
|
26
|
+
'core.infra.db.dbService': IDbService;
|
|
27
|
+
'core.infra.db.dbUtils': IDbUtils;
|
|
28
|
+
}
|
|
29
|
+
export default function ({ 'core.infra.db.dbService': dbService, 'core.infra.db.dbUtils': dbUtils, }: IAutomationRuleRepoDeps): IAutomationRuleRepo;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as rule } from './automationRuleRepo';
|
|
@@ -26,7 +26,11 @@ export interface IFindCoreEntityParams<T extends ICoreEntity, DbDocument extends
|
|
|
26
26
|
export interface IDbUtils {
|
|
27
27
|
migrate?(depsManager: AwilixContainer): Promise<void>;
|
|
28
28
|
cleanup?<T extends {}>(record: {}): T;
|
|
29
|
-
convertToDoc
|
|
29
|
+
convertToDoc?<T extends {
|
|
30
|
+
id?: string | string[];
|
|
31
|
+
}>(obj: T): Omit<T, 'id'> & {
|
|
32
|
+
_key?: string | string[];
|
|
33
|
+
};
|
|
30
34
|
isCollectionExists?(name: string): Promise<boolean>;
|
|
31
35
|
findCoreEntity?<T extends ICoreEntity, DbDocument extends IDbDocument = IDbDocument>(params: IFindCoreEntityParams<T, DbDocument>): Promise<IList<T>>;
|
|
32
36
|
clearDatabase?(): Promise<void>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type IMigration } from '../../../_types/migration';
|
|
2
|
+
import { type IDbService } from '../dbService';
|
|
3
|
+
interface IDeps {
|
|
4
|
+
'core.infra.db.dbService'?: IDbService;
|
|
5
|
+
}
|
|
6
|
+
export default function ({ 'core.infra.db.dbService': dbService }?: IDeps): IMigration;
|
|
7
|
+
export {};
|