@aristid/leav-types 1.8.0 → 1.9.0-0bcd6a55

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.
Files changed (39) hide show
  1. package/apps/core/codegen.d.ts +3 -0
  2. package/apps/core/config/default.d.ts +1 -0
  3. package/apps/core/config/test.d.ts +4 -0
  4. package/apps/core/src/__tests__/e2e/_gqlTypes/index.d.ts +1034 -0
  5. package/apps/core/src/__tests__/e2e/api/_fixtures/applications/login/index-hashed.d.ts +0 -0
  6. package/apps/core/src/__tests__/e2e/api/e2eUtils.d.ts +22 -1
  7. package/apps/core/src/__tests__/setup.d.ts +1 -0
  8. package/apps/core/src/_constants/globalSettings.d.ts +1 -0
  9. package/apps/core/src/_types/config.d.ts +1 -0
  10. package/apps/core/src/_types/errors.d.ts +3 -0
  11. package/apps/core/src/_types/tasksManager.d.ts +2 -1
  12. package/apps/core/src/_types/value.d.ts +1 -1
  13. package/apps/core/src/app/core/recordApp/_types.d.ts +1 -0
  14. package/apps/core/src/app/core/valueApp.d.ts +3 -1
  15. package/apps/core/src/domain/application/appStudioDomain.d.ts +24 -5
  16. package/apps/core/src/domain/application/applicationDomain.d.ts +4 -2
  17. package/apps/core/src/domain/application/helpers/getLibrarySystemPanels.d.ts +11 -0
  18. package/apps/core/src/domain/application/helpers/index.d.ts +1 -0
  19. package/apps/core/src/domain/attribute/attributeDomain.d.ts +3 -1
  20. package/apps/core/src/domain/permission/recordPermissionDomain.d.ts +2 -0
  21. package/apps/core/src/domain/record/helpers/deleteRecord.d.ts +5 -1
  22. package/apps/core/src/domain/record/recordDomain.d.ts +1 -0
  23. package/apps/core/src/domain/value/tasks/index.d.ts +1 -0
  24. package/apps/core/src/domain/value/tasks/purgeMultipleValues.d.ts +25 -0
  25. package/apps/core/src/domain/value/valueDomain.d.ts +3 -3
  26. package/apps/core/src/infra/attributeTypes/attributeSimpleLinkRepo.d.ts +5 -2
  27. package/apps/core/src/infra/attributeTypes/attributeTypesRepo.d.ts +15 -6
  28. package/apps/core/src/infra/db/migrations/013-threads/constants.d.ts +1 -0
  29. package/apps/core/src/infra/db/migrations/015-addExplorerStudioApp.d.ts +7 -0
  30. package/apps/core/src/infra/db/migrations/016-addStatusIconAttribute.d.ts +9 -0
  31. package/apps/core/src/infra/db/migrations/017-moveLibrariesPanelsFromApplicationsToLibrariesSettings.d.ts +9 -0
  32. package/apps/core/src/infra/value/valueRepo.d.ts +9 -4
  33. package/apps/core/src/utils/configureDayjs.d.ts +2 -0
  34. package/apps/core/src/utils/utils.d.ts +1 -0
  35. package/apps/core/tsconfig.types.tsbuildinfo +1 -1
  36. package/package.json +4 -4
  37. package/apps/core/src/domain/application/appStudioDomain.spec.d.ts +0 -1
  38. package/apps/core/src/domain/record/helpers/validateLibrary.d.ts +0 -6
  39. /package/apps/core/src/__tests__/e2e/api/values/{countValuesOccurrences.test.d.ts → purgeMultipleValues.test.d.ts} +0 -0
@@ -2,6 +2,7 @@ import WebSocket from 'ws';
2
2
  import { type Client as GraphqlWsClient } from 'graphql-ws';
3
3
  import { type AxiosResponse } from 'axios';
4
4
  import FormData from 'form-data';
5
+ import { getSdk } from '../_gqlTypes';
5
6
  import { type ActionsListConfig } from '_types/actionsList';
6
7
  import { type ITreeElement } from '_types/tree';
7
8
  import { AttributeFormats, type AttributeTypes, type IAttributeVersionsConf, type IEmbeddedAttribute } from '../../../_types/attribute';
@@ -11,6 +12,7 @@ export interface IGlobalThis {
11
12
  guestUser: IE2EUserParams;
12
13
  nonAdminUser: IE2EUserParams;
13
14
  nonAdminGroupId: string;
15
+ graphqlUrl: string;
14
16
  }
15
17
  export interface IE2EUser {
16
18
  userId: string;
@@ -24,7 +26,7 @@ export declare const e2eAdminUser: () => IE2EUser;
24
26
  export declare const e2eGuestUser: () => IE2EUser;
25
27
  export declare const e2eNonAdminUser: () => IE2EUser;
26
28
  export declare const e2eNonAdminGroupId: () => string;
27
- export declare function getGraphQLUrl(): Promise<string>;
29
+ export declare const getGraphQLUrl: () => string;
28
30
  export declare class E2EGraphQLError extends Error {
29
31
  readonly response: AxiosResponse;
30
32
  constructor(message: string, response: AxiosResponse);
@@ -33,6 +35,25 @@ export interface IMakeGraphQlCallOptions {
33
35
  user?: IE2EUser;
34
36
  skipLogErrors?: boolean;
35
37
  }
38
+ export declare const getSdkWithUser: (user: IE2EUser) => ReturnType<typeof getSdk>;
39
+ export declare const adminUserSdk: {
40
+ SaveApiKey(variables: import("../_gqlTypes").SaveApiKeyMutationVariables, requestHeaders?: HeadersInit, signal?: RequestInit["signal"]): Promise<import("../_gqlTypes").SaveApiKeyMutation>;
41
+ GetApiKeys(variables?: import("../_gqlTypes").GetApiKeysQueryVariables, requestHeaders?: HeadersInit, signal?: RequestInit["signal"]): Promise<import("../_gqlTypes").GetApiKeysQuery>;
42
+ DeleteApiKey(variables: import("../_gqlTypes").DeleteApiKeyMutationVariables, requestHeaders?: HeadersInit, signal?: RequestInit["signal"]): Promise<import("../_gqlTypes").DeleteApiKeyMutation>;
43
+ Me(variables?: import("../_gqlTypes").MeQueryVariables, requestHeaders?: HeadersInit, signal?: RequestInit["signal"]): Promise<import("../_gqlTypes").MeQuery>;
44
+ };
45
+ export declare const guestUserSdk: {
46
+ SaveApiKey(variables: import("../_gqlTypes").SaveApiKeyMutationVariables, requestHeaders?: HeadersInit, signal?: RequestInit["signal"]): Promise<import("../_gqlTypes").SaveApiKeyMutation>;
47
+ GetApiKeys(variables?: import("../_gqlTypes").GetApiKeysQueryVariables, requestHeaders?: HeadersInit, signal?: RequestInit["signal"]): Promise<import("../_gqlTypes").GetApiKeysQuery>;
48
+ DeleteApiKey(variables: import("../_gqlTypes").DeleteApiKeyMutationVariables, requestHeaders?: HeadersInit, signal?: RequestInit["signal"]): Promise<import("../_gqlTypes").DeleteApiKeyMutation>;
49
+ Me(variables?: import("../_gqlTypes").MeQueryVariables, requestHeaders?: HeadersInit, signal?: RequestInit["signal"]): Promise<import("../_gqlTypes").MeQuery>;
50
+ };
51
+ export declare const nonAdminUserSdk: {
52
+ SaveApiKey(variables: import("../_gqlTypes").SaveApiKeyMutationVariables, requestHeaders?: HeadersInit, signal?: RequestInit["signal"]): Promise<import("../_gqlTypes").SaveApiKeyMutation>;
53
+ GetApiKeys(variables?: import("../_gqlTypes").GetApiKeysQueryVariables, requestHeaders?: HeadersInit, signal?: RequestInit["signal"]): Promise<import("../_gqlTypes").GetApiKeysQuery>;
54
+ DeleteApiKey(variables: import("../_gqlTypes").DeleteApiKeyMutationVariables, requestHeaders?: HeadersInit, signal?: RequestInit["signal"]): Promise<import("../_gqlTypes").DeleteApiKeyMutation>;
55
+ Me(variables?: import("../_gqlTypes").MeQueryVariables, requestHeaders?: HeadersInit, signal?: RequestInit["signal"]): Promise<import("../_gqlTypes").MeQuery>;
56
+ };
36
57
  export declare function makeGraphQlCall(query: string | FormData, options?: IMakeGraphQlCallOptions): Promise<any>;
37
58
  export declare function importFileGraphQlCall(query: string, filePath: string, sheets?: any): Promise<any>;
38
59
  export declare function gqlSaveLibrary(id: string, label: string, additionalAttributes?: string[], settings?: string): Promise<any>;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,2 +1,3 @@
1
1
  export declare const APP_DEFAULT_NAME = "LEAV Engine";
2
2
  export declare const DEFAULT_APPLICATION = "portal";
3
+ export declare const EXPLORER_STUDIO_APPLICATION = "explorer_studio";
@@ -278,6 +278,7 @@ export interface IPreview {
278
278
  }
279
279
  export interface IApplicationsConfig {
280
280
  rootFolder: string;
281
+ assetsMaxAge?: string;
281
282
  }
282
283
  export interface IFilesConfig {
283
284
  rootPaths: string;
@@ -5,6 +5,8 @@ export declare enum ErrorTypes {
5
5
  INTERNAL_ERROR = "INTERNAL_ERROR"
6
6
  }
7
7
  export declare enum Errors {
8
+ APP_STUDIO_WORKSPACE_LIBRARY_ID_REQUIRED = "APP_STUDIO_WORKSPACE_LIBRARY_ID_REQUIRED",
9
+ APP_STUDIO_WORKSPACE_RECORD_ID_REQUIRED = "APP_STUDIO_WORKSPACE_RECORD_ID_REQUIRED",
8
10
  ATTRIBUTE_USED_BY_LIBRARY = "ATTRIBUTE_USED_BY_LIBRARY",
9
11
  ATTRIBUTE_USED_IN_METADATA = "ATTRIBUTE_USED_IN_METADATA",
10
12
  CANNOT_SAVE_METADATA = "CANNOT_SAVE_METADATA",
@@ -75,6 +77,7 @@ export declare enum Errors {
75
77
  REQUIRED_ATTRIBUTE_TYPE = "REQUIRED_ATTRIBUTE_TYPE",
76
78
  SYSTEM_ATTRIBUTE_DELETION = "SYSTEM_ATTRIBUTE_DELETION",
77
79
  SYSTEM_LIBRARY_DELETION = "SYSTEM_LIBRARY_DELETION",
80
+ SYSTEM_APPLICATION_DELETION = "SYSTEM_APPLICATION_DELETION",
78
81
  SYSTEM_TREE_DELETION = "SYSTEM_TREE_DELETION",
79
82
  TOO_MUCH_LIBRARIES_ON_FILES_TREE = "TOO_MUCH_LIBRARIES_ON_FILES_TREE",
80
83
  UNBINDED_ATTRIBUTES = "UNBINDED_ATTRIBUTES",
@@ -63,7 +63,8 @@ export declare enum TaskType {
63
63
  IMPORT_CONFIG = "IMPORT_CONFIG",
64
64
  IMPORT_DATA = "IMPORT_DATA",
65
65
  INDEXATION = "INDEXATION",
66
- SAVE_VALUE_BULK = "SAVE_VALUE_BULK"
66
+ SAVE_VALUE_BULK = "SAVE_VALUE_BULK",
67
+ PURGE_MULTIPLE_VALUES = "PURGE_MULTIPLE_VALUES"
67
68
  }
68
69
  export interface ITaskRole {
69
70
  type: TaskType | string;
@@ -151,7 +151,7 @@ export interface IBaseValueByAttributeType {
151
151
  [AttributeTypes.ADVANCED_LINK]: ILinkBaseValue;
152
152
  [AttributeTypes.TREE]: ITreeBaseValue;
153
153
  }
154
- export type IValuesOccurrences<SimpleValueType extends IBaseValue = IBaseValue> = Array<{
154
+ export type IDistinctValue<SimpleValueType extends IBaseValue = IBaseValue> = Array<{
155
155
  value: SimpleValueType['payload'] | null;
156
156
  count: number;
157
157
  }>;
@@ -10,6 +10,7 @@ export type ICreateRecordValue = Override<Omit<IValue, 'version'>, {
10
10
  }>;
11
11
  export interface ICreateRecordParams {
12
12
  library: string;
13
+ skipActivate?: boolean;
13
14
  data?: {
14
15
  values: ICreateRecordValue[];
15
16
  version: IValueVersionFromGql;
@@ -5,6 +5,7 @@ import { type IValueDomain } from 'domain/value/valueDomain';
5
5
  import { type IUtils } from 'utils/utils';
6
6
  import { type IGraphqlAppModule } from 'app/graphql/graphqlApp';
7
7
  import { type ISaveValueBulkTask } from '../../domain/value/tasks/saveValueBulk';
8
+ import { type IPurgeMultipleValuesTask } from '../../domain/value/tasks/purgeMultipleValues';
8
9
  export type ICoreValueApp = IGraphqlAppModule;
9
10
  interface IDeps {
10
11
  'core.domain.value': IValueDomain;
@@ -13,6 +14,7 @@ interface IDeps {
13
14
  'core.domain.value.tasks.saveValueBulk': ISaveValueBulkTask;
14
15
  'core.app.helpers.convertVersionFromGqlFormat': ConvertVersionFromGqlFormatFunc;
15
16
  'core.utils': IUtils;
17
+ 'core.domain.value.tasks.purgeMultipleValues': IPurgeMultipleValuesTask;
16
18
  }
17
- export default function ({ 'core.domain.value': valueDomain, 'core.domain.record': recordDomain, 'core.domain.value.tasks.saveValueBulk': saveValueBulkTask, 'core.domain.attribute': attributeDomain, 'core.app.helpers.convertVersionFromGqlFormat': convertVersionFromGqlFormat, 'core.utils': utils, }: IDeps): ICoreValueApp;
19
+ export default function ({ 'core.domain.value': valueDomain, 'core.domain.record': recordDomain, 'core.domain.value.tasks.saveValueBulk': saveValueBulkTask, 'core.domain.attribute': attributeDomain, 'core.app.helpers.convertVersionFromGqlFormat': convertVersionFromGqlFormat, 'core.utils': utils, 'core.domain.value.tasks.purgeMultipleValues': purgeMultipleValuesTask, }: IDeps): ICoreValueApp;
18
20
  export {};
@@ -1,17 +1,36 @@
1
- import { type IPermissionDomain } from 'domain/permission/permissionDomain';
2
- import { type IQueryInfos } from '_types/queryInfos';
1
+ import { type IPermissionDomain } from '../../domain/permission/permissionDomain';
2
+ import { type IQueryInfos } from '../../_types/queryInfos';
3
3
  import { type IApplication } from '../../_types/application';
4
+ import { type ILibraryDomain } from '../../domain/library/libraryDomain';
5
+ import { type IRecordDomain } from '../../domain/record/recordDomain';
6
+ import { type IConfig } from '../../_types/config';
7
+ import { type IGetLibrarySystemPanelsHelper } from './helpers/getLibrarySystemPanels';
4
8
  export interface IAppStudioDomain {
5
9
  /**
6
- * Extract and filter appStudioSettings from application settings.
7
- * Filters workspaces based on user permissions (ACCESS_LIBRARY for library type, ACCESS_RECORD for record type)
10
+ * Extract and dynamically generate appStudioSettings from application and libraries settings.
11
+ *
12
+ * Also:
13
+ * - Filters workspaces based on user permissions (ACCESS_LIBRARY for library type, ACCESS_RECORD for record type).
14
+ * - Sets titles for workspaces if not provided.
15
+ * - Recursively gets library panels based on workspaces and library recordsPanels.
8
16
  */
9
17
  getAppStudioSettings(params: {
10
18
  application: IApplication;
11
19
  ctx: IQueryInfos;
12
20
  }): Promise<IApplication['appStudioSettings']>;
21
+ /**
22
+ * Check if application has defined panels on each library and delete them
23
+ */
24
+ deleteLibraryPanelsForApplication(params: {
25
+ applicationId: string;
26
+ ctx: IQueryInfos;
27
+ }): Promise<void>;
13
28
  }
14
29
  export interface IAppStudioDomainDeps {
30
+ config: IConfig;
15
31
  'core.domain.permission': IPermissionDomain;
32
+ 'core.domain.library': ILibraryDomain;
33
+ 'core.domain.record': IRecordDomain;
34
+ 'core.domain.application.helpers.getLibrarySystemPanels': IGetLibrarySystemPanelsHelper;
16
35
  }
17
- export default function ({ 'core.domain.permission': permissionDomain }: IAppStudioDomainDeps): IAppStudioDomain;
36
+ export default function ({ config, 'core.domain.permission': permissionDomain, 'core.domain.library': libraryDomain, 'core.domain.record': recordDomain, 'core.domain.application.helpers.getLibrarySystemPanels': librarySystemPanelsHelper, }: IAppStudioDomainDeps): IAppStudioDomain;
@@ -8,6 +8,7 @@ import { type IConfig } from '_types/config';
8
8
  import { type IQueryInfos } from '_types/queryInfos';
9
9
  import { type IApplication, type IApplicationModule, type IGetCoreApplicationsParams } from '../../_types/application';
10
10
  import { type IList } from '../../_types/list';
11
+ import { type IAppStudioDomain } from './appStudioDomain';
11
12
  export declare const MAX_CONSULTATION_HISTORY_SIZE = 10;
12
13
  export interface IApplicationDomain {
13
14
  getApplicationProperties(params: {
@@ -50,8 +51,9 @@ export interface IApplicationDomainDeps {
50
51
  'core.domain.user': IUserDomain;
51
52
  'core.domain.eventsManager': IEventsManagerDomain;
52
53
  'core.infra.application': IApplicationRepo;
54
+ 'core.domain.application.appStudio': IAppStudioDomain;
53
55
  'core.utils': IUtils;
54
- translator: i18n;
55
56
  config: IConfig;
57
+ translator: i18n;
56
58
  }
57
- export default function ({ 'core.domain.permission.admin': adminPermissionDomain, 'core.domain.user': userDomain, 'core.domain.eventsManager': eventsManagerDomain, 'core.infra.application': applicationRepo, 'core.utils': utils, translator, config, }: IApplicationDomainDeps): IApplicationDomain;
59
+ export default function ({ 'core.domain.permission.admin': adminPermissionDomain, 'core.domain.user': userDomain, 'core.domain.eventsManager': eventsManagerDomain, 'core.infra.application': applicationRepo, 'core.domain.application.appStudio': appStudioDomain, 'core.utils': utils, config, translator, }: IApplicationDomainDeps): IApplicationDomain;
@@ -0,0 +1,11 @@
1
+ import { type IApplication } from '_types/application';
2
+ import { type i18n } from 'i18next';
3
+ import { type IConfig } from '_types/config';
4
+ export interface IGetLibrarySystemPanelsHelperDeps {
5
+ translator: i18n;
6
+ config: IConfig;
7
+ }
8
+ export interface IGetLibrarySystemPanelsHelper {
9
+ getLibrarySystemPanels: (libraryId: string, applicationId: string) => IApplication['appStudioSettings'];
10
+ }
11
+ export default function ({ translator, config }: IGetLibrarySystemPanelsHelperDeps): IGetLibrarySystemPanelsHelper;
@@ -0,0 +1 @@
1
+ export { default as getLibrarySystemPanels } from './getLibrarySystemPanels';
@@ -13,6 +13,7 @@ import { type ICachesService } from '../../infra/cache/cacheService';
13
13
  import { type IAttribute, type IGetCoreAttributesParams, type IGetCoreFormAttributesParams, type IOAllowedTypes } from '../../_types/attribute';
14
14
  import { type IList } from '../../_types/list';
15
15
  import { type IActionsListDomain } from '../actionsList/actionsListDomain';
16
+ import { type IValidateHelper } from 'domain/helpers/validate';
16
17
  export interface IAttributeDomain {
17
18
  getAttributeProperties({ id, ctx }: {
18
19
  id: string;
@@ -67,6 +68,7 @@ export interface IAttributeDomainDeps {
67
68
  'core.domain.helpers.getCoreEntityById': GetCoreEntityByIdFunc;
68
69
  'core.domain.versionProfile': IVersionProfileDomain;
69
70
  'core.domain.eventsManager': IEventsManagerDomain;
71
+ 'core.domain.helpers.validate': IValidateHelper;
70
72
  'core.infra.form': IFormRepo;
71
73
  'core.infra.library': ILibraryRepo;
72
74
  'core.infra.tree': ITreeRepo;
@@ -74,4 +76,4 @@ export interface IAttributeDomainDeps {
74
76
  'core.utils': IUtils;
75
77
  config: any;
76
78
  }
77
- export default function ({ 'core.infra.attribute': attributeRepo, 'core.domain.actionsList': actionsListDomain, 'core.domain.permission.admin': adminPermissionDomain, 'core.domain.helpers.getCoreEntityById': getCoreEntityById, 'core.domain.versionProfile': versionProfileDomain, 'core.domain.eventsManager': eventsManagerDomain, 'core.infra.form': formRepo, 'core.infra.library': libraryRepo, 'core.infra.tree': treeRepo, 'core.infra.cache.cacheService': cacheService, 'core.utils': utils, config, }: IAttributeDomainDeps): IAttributeDomain;
79
+ export default function ({ 'core.infra.attribute': attributeRepo, 'core.domain.actionsList': actionsListDomain, 'core.domain.permission.admin': adminPermissionDomain, 'core.domain.helpers.getCoreEntityById': getCoreEntityById, 'core.domain.versionProfile': versionProfileDomain, 'core.domain.eventsManager': eventsManagerDomain, 'core.domain.helpers.validate': validateHelper, 'core.infra.form': formRepo, 'core.infra.library': libraryRepo, 'core.infra.tree': treeRepo, 'core.infra.cache.cacheService': cacheService, 'core.utils': utils, config, }: IAttributeDomainDeps): IAttributeDomain;
@@ -8,6 +8,7 @@ import { type IEstimateTreeValueRecordPermissionParams, type IGetInheritedRecord
8
8
  import { type ITreeRepo } from '../../infra/tree/treeRepo';
9
9
  import { type IRecordRepo } from '../../infra/record/recordRepo';
10
10
  import { type IRecordInCreationBypassHelper } from './helpers/recordInCreationBypass';
11
+ import { type IUtils } from 'utils/utils';
11
12
  export interface IRecordPermissionDomain {
12
13
  getRecordPermission(params: IGetRecordPermissionParams): Promise<boolean>;
13
14
  getInheritedRecordPermission(params: IGetInheritedRecordPermissionParams): Promise<boolean>;
@@ -23,5 +24,6 @@ export interface IRecordPermissionDomainDeps {
23
24
  'core.infra.value': IValueRepo;
24
25
  'core.infra.tree': ITreeRepo;
25
26
  'core.infra.record': IRecordRepo;
27
+ 'core.utils': IUtils;
26
28
  }
27
29
  export default function (deps: IRecordPermissionDomainDeps): IRecordPermissionDomain;
@@ -6,14 +6,18 @@ import { type IRecordRepo } from 'infra/record/recordRepo';
6
6
  import { type ITreeRepo } from 'infra/tree/treeRepo';
7
7
  import { type IValueRepo } from 'infra/value/valueRepo';
8
8
  import { type IRecord } from '../../../_types/record';
9
+ import { type IAttributeDomain } from 'domain/attribute/attributeDomain';
10
+ import { type IAttributeSimpleLinkRepo } from 'infra/attributeTypes/attributeSimpleLinkRepo';
9
11
  export type DeleteRecordHelper = (library: string, id: string, ctx: IQueryInfos) => Promise<IRecord>;
10
12
  interface IDeps {
11
13
  'core.domain.helpers.validate': IValidateHelper;
12
14
  'core.domain.eventsManager': IEventsManagerDomain;
13
15
  'core.domain.permission.record': IRecordPermissionDomain;
16
+ 'core.domain.attribute': IAttributeDomain;
17
+ 'core.infra.attributeTypes.attributeSimpleLink'?: IAttributeSimpleLinkRepo;
14
18
  'core.infra.record': IRecordRepo;
15
19
  'core.infra.tree': ITreeRepo;
16
20
  'core.infra.value': IValueRepo;
17
21
  }
18
- export default function ({ 'core.domain.eventsManager': eventsManager, 'core.domain.helpers.validate': validateHelper, 'core.domain.permission.record': recordPermissionDomain, 'core.infra.record': recordRepo, 'core.infra.tree': treeRepo, 'core.infra.value': valueRepo, }: IDeps): DeleteRecordHelper;
22
+ export default function ({ 'core.domain.eventsManager': eventsManager, 'core.domain.helpers.validate': validateHelper, 'core.domain.permission.record': recordPermissionDomain, 'core.domain.attribute': attributeDomain, 'core.infra.attributeTypes.attributeSimpleLink': attributeSimpleLinkRepo, 'core.infra.record': recordRepo, 'core.infra.tree': treeRepo, 'core.infra.value': valueRepo, }: IDeps): DeleteRecordHelper;
19
23
  export {};
@@ -50,6 +50,7 @@ export interface IRecordDomain {
50
50
  library: string;
51
51
  values?: ISaveValue[];
52
52
  verifyRequiredAttributes?: boolean;
53
+ skipActivate?: boolean;
53
54
  ctx: IQueryInfos;
54
55
  }): Promise<ICreateRecordResult>;
55
56
  /**
@@ -1 +1,2 @@
1
1
  export { default as saveValueBulk } from './saveValueBulk';
2
+ export { default as purgeMultipleValues } from './purgeMultipleValues';
@@ -0,0 +1,25 @@
1
+ import { type IValueRepo } from 'infra/value/valueRepo';
2
+ import { type IQueryInfos } from '../../../_types/queryInfos';
3
+ import { type IAttributeDomain } from '../../attribute/attributeDomain';
4
+ import { type IAdminPermissionDomain } from '../../permission/adminPermissionDomain';
5
+ import { type ITaskFuncParams } from '../../../_types/tasksManager';
6
+ import { type ITasksManagerDomain } from '../../tasksManager/tasksManagerDomain';
7
+ import type * as Config from '../../../_types/config';
8
+ import { type i18n } from 'i18next';
9
+ import { type INotificationDomain } from '../../notification/notificationDomain';
10
+ export interface IPurgeMultipleValuesTask {
11
+ purgeMultipleValues(params: {
12
+ attributeId: string;
13
+ ctx: IQueryInfos;
14
+ }, task?: ITaskFuncParams): Promise<string>;
15
+ }
16
+ export interface IPurgeMultipleValuesTaskDeps {
17
+ 'core.domain.attribute': IAttributeDomain;
18
+ 'core.infra.value': IValueRepo;
19
+ 'core.domain.permission.admin': IAdminPermissionDomain;
20
+ 'core.domain.tasksManager': ITasksManagerDomain;
21
+ config: Config.IConfig;
22
+ translator: i18n;
23
+ 'core.domain.notification': INotificationDomain;
24
+ }
25
+ export default function ({ config, 'core.domain.permission.admin': adminPermissionDomain, 'core.domain.attribute': attributeDomain, 'core.infra.value': valueRepo, 'core.domain.tasksManager': tasksManager, translator, 'core.domain.notification': notificationDomain, }: IPurgeMultipleValuesTaskDeps): IPurgeMultipleValuesTask;
@@ -14,7 +14,7 @@ import type * as Config from '_types/config';
14
14
  import { type IRecordFilterLight, type IRecord } from '_types/record';
15
15
  import { type IAttribute } from '../../_types/attribute';
16
16
  import { type IQueryInfos } from '../../_types/queryInfos';
17
- import { type IValueVersion, type ISaveValue, type IValue, type IValuesOptions, type IValuesOccurrences } from '../../_types/value';
17
+ import { type IValueVersion, type ISaveValue, type IValue, type IValuesOptions, type IDistinctValue } from '../../_types/value';
18
18
  import { type IActionsListDomain } from '../actionsList/actionsListDomain';
19
19
  import { type IAttributeDomain } from '../attribute/attributeDomain';
20
20
  import { type IValidateHelper } from '../helpers/validate';
@@ -110,7 +110,7 @@ export interface IValueDomain {
110
110
  options?: IValuesOptions;
111
111
  ctx: IQueryInfos;
112
112
  }): Promise<IValue[]>;
113
- countValuesOccurrences({ libraryId, attributeId, recordFilters, options, ctx, }: {
113
+ listDistinctValues({ libraryId, attributeId, recordFilters, options, ctx, }: {
114
114
  libraryId: string;
115
115
  attributeId: string;
116
116
  recordFilters: IRecordFilterLight[];
@@ -118,7 +118,7 @@ export interface IValueDomain {
118
118
  version?: IValueVersion;
119
119
  };
120
120
  ctx: IQueryInfos;
121
- }): Promise<IValuesOccurrences>;
121
+ }): Promise<IDistinctValue>;
122
122
  }
123
123
  export interface IValueDomainDeps {
124
124
  config: Config.IConfig;
@@ -1,10 +1,11 @@
1
1
  import { type IFilterTypesHelper } from 'infra/record/helpers/filterTypes';
2
- import { AttributeTypes } from '../../_types/attribute';
2
+ import { AttributeTypes, type IAttribute } from '../../_types/attribute';
3
3
  import { type IDbService } from '../db/dbService';
4
4
  import { type IDbUtils } from '../db/dbUtils';
5
5
  import { type IAttributeTypeRepo } from './attributeTypesRepo';
6
6
  import { type GetConditionPart } from './helpers/getConditionPart';
7
7
  import { type IAttributeSimpleRepo } from './attributeSimpleRepo';
8
+ import { type IQueryInfos } from '_types/queryInfos';
8
9
  interface IDeps {
9
10
  'core.infra.db.dbService'?: IDbService;
10
11
  'core.infra.db.dbUtils'?: IDbUtils;
@@ -12,6 +13,8 @@ interface IDeps {
12
13
  'core.infra.attributeTypes.helpers.getConditionPart'?: GetConditionPart;
13
14
  'core.infra.record.helpers.filterTypes'?: IFilterTypesHelper;
14
15
  }
15
- export type IAttributeSimpleLinkRepo = IAttributeTypeRepo<AttributeTypes.SIMPLE_LINK>;
16
+ export type IAttributeSimpleLinkRepo = IAttributeTypeRepo<AttributeTypes.SIMPLE_LINK> & {
17
+ deleteAllLinkValueTo(library: string, attribute: IAttribute, linkedRecordId: string, ctx: IQueryInfos): Promise<void>;
18
+ };
16
19
  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;
17
20
  export {};
@@ -2,7 +2,7 @@ import { type AqlLiteral, type GeneratedAqlQuery } from 'arangojs/aql';
2
2
  import { type IQueryInfos } from '_types/queryInfos';
3
3
  import { AttributeTypes, type IAttribute } from '../../_types/attribute';
4
4
  import { AttributeCondition, type IRecordFilterOption } from '../../_types/record';
5
- import { type IBaseValueByAttributeType, type IValuesOccurrences, type ISaveValueByAttributeType, type IValueByAttributeType, type IValuesOptions, type IValueVersion } from '../../_types/value';
5
+ import { type IBaseValueByAttributeType, type IDistinctValue, type ISaveValueByAttributeType, type IValueByAttributeType, type IValuesOptions, type IValueVersion } from '../../_types/value';
6
6
  import { type IAttributeSimpleRepo } from './attributeSimpleRepo';
7
7
  import { type IAttributeSimpleLinkRepo } from './attributeSimpleLinkRepo';
8
8
  import { type IAttributeAdvancedRepo } from './attributeAdvancedRepo';
@@ -51,7 +51,7 @@ export interface IAttributeTypeRepo<AttributeType extends AttributeTypes = Attri
51
51
  attribute: IAttributeWithRevLink;
52
52
  value: Value;
53
53
  ctx: IQueryInfos;
54
- }): Promise<Value>;
54
+ }): Promise<Value | null>;
55
55
  /**
56
56
  * Check if a value is unique
57
57
  */
@@ -109,7 +109,7 @@ export interface IAttributeTypeRepo<AttributeType extends AttributeTypes = Attri
109
109
  forceGetAllValues: boolean;
110
110
  ctx: IQueryInfos;
111
111
  }): Promise<Value[][]>;
112
- countValuesOccurrences?({ library, attribute, recordIds, options, ctx, }: {
112
+ listDistinctValues?({ library, attribute, recordIds, options, ctx, }: {
113
113
  library: string;
114
114
  attribute: IAttributeWithRevLink;
115
115
  recordIds: string[];
@@ -117,7 +117,7 @@ export interface IAttributeTypeRepo<AttributeType extends AttributeTypes = Attri
117
117
  version?: IValueVersion;
118
118
  };
119
119
  ctx: IQueryInfos;
120
- }): Promise<IValuesOccurrences<IBaseValueByAttributeType[AttributeType]>>;
120
+ }): Promise<IDistinctValue<IBaseValueByAttributeType[AttributeType]>>;
121
121
  /**
122
122
  * Count occurrences of reverse link values for given records
123
123
  * Only for simple link reverse attributes
@@ -126,7 +126,7 @@ export interface IAttributeTypeRepo<AttributeType extends AttributeTypes = Attri
126
126
  advancedLinkAttr: IAttributeWithRevLink;
127
127
  recordIds: string[];
128
128
  ctx: IQueryInfos;
129
- }): Promise<IValuesOccurrences<IBaseValueByAttributeType[AttributeType]>>;
129
+ }): Promise<IDistinctValue<IBaseValueByAttributeType[AttributeType]>>;
130
130
  /**
131
131
  * Return a specific value based on its ID. Field "id" is expect on the value
132
132
  *
@@ -155,12 +155,21 @@ export interface IAttributeTypeRepo<AttributeType extends AttributeTypes = Attri
155
155
  * Clear all values of given attribute. Can be used to cleanup values when an attribute is deleted for example.
156
156
  *
157
157
  * @param attribute
158
- * @return Promise<number> TRUE if operation succeed
158
+ * @return Promise<boolean> TRUE if operation succeed
159
159
  */
160
160
  clearAllValues({ attribute, ctx }: {
161
161
  attribute: IAttribute;
162
162
  ctx: IQueryInfos;
163
163
  }): Promise<boolean>;
164
+ /**
165
+ * Delete all multiple values of an attribute and keep only the most recent one.
166
+ * @return Promise<boolean> TRUE if operation succeed
167
+ */
168
+ clearMultipleValues?({ libraryId, attribute, ctx, }: {
169
+ libraryId: string;
170
+ attribute: IAttribute;
171
+ ctx: IQueryInfos;
172
+ }): Promise<void>;
164
173
  }
165
174
  export declare const ATTRIB_COLLECTION_NAME = "core_attributes";
166
175
  export declare const BASE_QUERY_IDENTIFIER = "r";
@@ -8,3 +8,4 @@ export declare const THREAD_STATUS_ATTRIBUTE_ID = "discussion_threads_status";
8
8
  export declare const THREAD_COMMENTS_ATTRIBUTE_ID = "discussion_threads_comments";
9
9
  export declare const STATUSES_LABEL_ATTRIBUTE_ID = "statuses_label";
10
10
  export declare const STATUSES_COLOR_ATTRIBUTE_ID = "statuses_color";
11
+ export declare const STATUSES_ICON_ID_ATTRIBUTE_ID = "statuses_id_icon";
@@ -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 {};
@@ -0,0 +1,9 @@
1
+ import { type IMigration } from '../../../_types/migration';
2
+ import { type IAttributeRepo } from '../../attribute/attributeRepo';
3
+ import { type ILibraryRepo } from '../../library/libraryRepo';
4
+ interface IDeps {
5
+ 'core.infra.attribute': IAttributeRepo;
6
+ 'core.infra.library': ILibraryRepo;
7
+ }
8
+ export default function ({ 'core.infra.attribute': attributeRepo, 'core.infra.library': libraryRepo, }: IDeps): IMigration;
9
+ export {};
@@ -0,0 +1,9 @@
1
+ import { type IMigration } from '../../../_types/migration';
2
+ import { type IDbService } from '../dbService';
3
+ import { type ILogger } from '@leav/logger';
4
+ interface IDeps {
5
+ 'core.infra.db.dbService'?: IDbService;
6
+ 'core.utils.logger'?: ILogger;
7
+ }
8
+ export default function ({ 'core.infra.db.dbService': dbService, 'core.utils.logger': logger, }?: IDeps): IMigration;
9
+ export {};
@@ -2,7 +2,7 @@ import { type IDbService } from 'infra/db/dbService';
2
2
  import { type IConfig } from '_types/config';
3
3
  import { type IAttribute } from '_types/attribute';
4
4
  import { type IQueryInfos } from '_types/queryInfos';
5
- import { type IValuesOccurrences, type ISaveValue, type IValue, type IValueVersion } from '_types/value';
5
+ import { type IDistinctValue, type ISaveValue, type IValue, type IValueVersion } from '_types/value';
6
6
  import { type IAttributeTypesRepo, type IAttributeWithRevLink, type IGetValuesOptions } from '../attributeTypes/attributeTypesRepo';
7
7
  export declare const VALUES_LINKS_COLLECTION = "core_edge_values_links";
8
8
  export declare const VALUES_COLLECTION = "core_values";
@@ -34,7 +34,7 @@ export interface IValueRepo {
34
34
  attribute: IAttributeWithRevLink;
35
35
  value: IValue;
36
36
  ctx: IQueryInfos;
37
- }): Promise<IValue>;
37
+ }): Promise<IValue | null>;
38
38
  /**
39
39
  * Check if a value is unique expeted for the given record
40
40
  * if recordId is null, it will check for the whole library
@@ -71,7 +71,7 @@ export interface IValueRepo {
71
71
  valueId: string;
72
72
  ctx: IQueryInfos;
73
73
  }): Promise<IValue>;
74
- countValuesOccurrences?({ library, attribute, recordIds, options, ctx, }: {
74
+ listDistinctValues?({ library, attribute, recordIds, options, ctx, }: {
75
75
  library: string;
76
76
  attribute: IAttributeWithRevLink;
77
77
  recordIds: string[];
@@ -79,7 +79,7 @@ export interface IValueRepo {
79
79
  version?: IValueVersion;
80
80
  };
81
81
  ctx: IQueryInfos;
82
- }): Promise<IValuesOccurrences>;
82
+ }): Promise<IDistinctValue>;
83
83
  clearAllValues({ attribute, ctx }: {
84
84
  attribute: IAttribute;
85
85
  ctx: IQueryInfos;
@@ -89,6 +89,11 @@ export interface IValueRepo {
89
89
  recordId: string;
90
90
  ctx: IQueryInfos;
91
91
  }): Promise<void>;
92
+ clearMultipleValues?({ libraryId, attribute, ctx, }: {
93
+ libraryId: string;
94
+ attribute: IAttribute;
95
+ ctx: IQueryInfos;
96
+ }): Promise<void>;
92
97
  }
93
98
  interface IDeps {
94
99
  config?: IConfig;
@@ -0,0 +1,2 @@
1
+ import { type ILang } from '_types/config';
2
+ export declare function loadLocalesForDayjs(langConfig: ILang): void;
@@ -7,6 +7,7 @@ import { type IValue } from '_types/value';
7
7
  import ValidationError from '../errors/ValidationError';
8
8
  import { type IAttribute } from '../_types/attribute';
9
9
  import { type IPreviewAttributesSettings, type IPreviewVersion } from '../_types/filesManager';
10
+ import './configureDayjs';
10
11
  export type ToAny<T> = {
11
12
  [P in keyof T]: any;
12
13
  };