@aristid/leav-types 1.9.0 → 1.10.0-1

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 (43) 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 +1048 -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/_fixtures/fakeplugin/domain/fakeDomain.d.ts +6 -1
  7. package/apps/core/src/__tests__/e2e/api/_fixtures/fakeplugin/index.d.ts +4 -0
  8. package/apps/core/src/__tests__/e2e/api/e2eUtils.d.ts +32 -2
  9. package/apps/core/src/__tests__/setup.d.ts +1 -0
  10. package/apps/core/src/_constants/globalSettings.d.ts +1 -0
  11. package/apps/core/src/_types/config.d.ts +1 -0
  12. package/apps/core/src/_types/errors.d.ts +7 -2
  13. package/apps/core/src/_types/events.d.ts +3 -3
  14. package/apps/core/src/_types/value.d.ts +1 -1
  15. package/apps/core/src/app/core/recordApp/_types.d.ts +1 -0
  16. package/apps/core/src/domain/application/appStudioDomain.d.ts +24 -5
  17. package/apps/core/src/domain/application/applicationDomain.d.ts +4 -2
  18. package/apps/core/src/domain/application/helpers/getLibrarySystemPanels.d.ts +11 -0
  19. package/apps/core/src/domain/application/helpers/index.d.ts +1 -0
  20. package/apps/core/src/domain/attribute/attributeDomain.d.ts +3 -1
  21. package/apps/core/src/domain/eventsManager/eventsManagerDomain.d.ts +1 -1
  22. package/apps/core/src/domain/permission/recordPermissionDomain.d.ts +2 -0
  23. package/apps/core/src/domain/record/_types.d.ts +6 -0
  24. package/apps/core/src/domain/record/helpers/deleteRecord.d.ts +5 -1
  25. package/apps/core/src/domain/record/recordDomain.d.ts +3 -2
  26. package/apps/core/src/domain/value/helpers/areValuesIdentical.d.ts +4 -0
  27. package/apps/core/src/domain/value/valueDomain.d.ts +3 -3
  28. package/apps/core/src/infra/attributeTypes/attributeSimpleLinkRepo.d.ts +5 -2
  29. package/apps/core/src/infra/attributeTypes/attributeTypesRepo.d.ts +5 -5
  30. package/apps/core/src/infra/db/migrations/013-threads/constants.d.ts +1 -0
  31. package/apps/core/src/infra/db/migrations/015-addExplorerStudioApp.d.ts +7 -0
  32. package/apps/core/src/infra/db/migrations/016-addStatusIconAttribute.d.ts +9 -0
  33. package/apps/core/src/infra/db/migrations/017-moveLibrariesPanelsFromApplicationsToLibrariesSettings.d.ts +9 -0
  34. package/apps/core/src/infra/db/migrations/018-moveAppStudioToCampaignsManager.d.ts +7 -0
  35. package/apps/core/src/infra/value/valueRepo.d.ts +4 -4
  36. package/apps/core/src/utils/configureDayjs.d.ts +2 -0
  37. package/apps/core/src/utils/utils.d.ts +1 -2
  38. package/apps/core/tsconfig.types.tsbuildinfo +1 -1
  39. package/package.json +4 -4
  40. package/apps/core/src/domain/application/appStudioDomain.spec.d.ts +0 -1
  41. package/apps/core/src/domain/record/helpers/validateLibrary.d.ts +0 -6
  42. /package/apps/core/src/__tests__/e2e/api/trees/{treeNodeChildrenQuery.test.d.ts → treeNodeChildrenAndContentQuery.test.d.ts} +0 -0
  43. /package/apps/core/src/{__tests__/e2e/api/values/countValuesOccurrences.test.d.ts → domain/value/helpers/areValuesIdentical.spec.d.ts} +0 -0
@@ -1,3 +1,4 @@
1
+ import { type IEventsManagerDomain } from '../../../../../../domain/eventsManager/eventsManagerDomain';
1
2
  export interface IFakeDomain {
2
3
  execWorker({ fromTask }: {
3
4
  fromTask: string;
@@ -5,4 +6,8 @@ export interface IFakeDomain {
5
6
  startPlugin(): void;
6
7
  getPluginStarted(): boolean;
7
8
  }
8
- export default function (): IFakeDomain;
9
+ interface IDeps {
10
+ 'core.domain.eventsManager': IEventsManagerDomain;
11
+ }
12
+ export default function ({ 'core.domain.eventsManager': eventsManagerDomain }: IDeps): IFakeDomain;
13
+ export {};
@@ -13,5 +13,9 @@ interface IDeps {
13
13
  'core.domain.notification': INotificationDomain;
14
14
  'fakeplugin.domain': IFakeDomain;
15
15
  }
16
+ export declare enum FakePluginActions {
17
+ FAKE_PLUGIN_ACTION = "fakeplugin_FAKE_PLUGIN_ACTION",
18
+ FAKE_PLUGIN_ACTION2 = "fakeplugin_FAKE_PLUGIN_ACTION2"
19
+ }
16
20
  export default function ({ translator, 'core.infra.value': valueRepo, 'core.domain.attribute': attributeDomain, 'core.domain.tasksManager': tasksManagerDomain, 'core.domain.notification': notificationDomain, 'fakeplugin.domain': fakeDomain, }: IDeps): IPluginInitModule;
17
21
  export {};
@@ -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,9 +35,37 @@ 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
+ GetRecord(variables: import("../_gqlTypes").GetRecordQueryVariables, requestHeaders?: HeadersInit, signal?: RequestInit["signal"]): Promise<import("../_gqlTypes").GetRecordQuery>;
45
+ };
46
+ export declare const guestUserSdk: {
47
+ SaveApiKey(variables: import("../_gqlTypes").SaveApiKeyMutationVariables, requestHeaders?: HeadersInit, signal?: RequestInit["signal"]): Promise<import("../_gqlTypes").SaveApiKeyMutation>;
48
+ GetApiKeys(variables?: import("../_gqlTypes").GetApiKeysQueryVariables, requestHeaders?: HeadersInit, signal?: RequestInit["signal"]): Promise<import("../_gqlTypes").GetApiKeysQuery>;
49
+ DeleteApiKey(variables: import("../_gqlTypes").DeleteApiKeyMutationVariables, requestHeaders?: HeadersInit, signal?: RequestInit["signal"]): Promise<import("../_gqlTypes").DeleteApiKeyMutation>;
50
+ Me(variables?: import("../_gqlTypes").MeQueryVariables, requestHeaders?: HeadersInit, signal?: RequestInit["signal"]): Promise<import("../_gqlTypes").MeQuery>;
51
+ GetRecord(variables: import("../_gqlTypes").GetRecordQueryVariables, requestHeaders?: HeadersInit, signal?: RequestInit["signal"]): Promise<import("../_gqlTypes").GetRecordQuery>;
52
+ };
53
+ export declare const nonAdminUserSdk: {
54
+ SaveApiKey(variables: import("../_gqlTypes").SaveApiKeyMutationVariables, requestHeaders?: HeadersInit, signal?: RequestInit["signal"]): Promise<import("../_gqlTypes").SaveApiKeyMutation>;
55
+ GetApiKeys(variables?: import("../_gqlTypes").GetApiKeysQueryVariables, requestHeaders?: HeadersInit, signal?: RequestInit["signal"]): Promise<import("../_gqlTypes").GetApiKeysQuery>;
56
+ DeleteApiKey(variables: import("../_gqlTypes").DeleteApiKeyMutationVariables, requestHeaders?: HeadersInit, signal?: RequestInit["signal"]): Promise<import("../_gqlTypes").DeleteApiKeyMutation>;
57
+ Me(variables?: import("../_gqlTypes").MeQueryVariables, requestHeaders?: HeadersInit, signal?: RequestInit["signal"]): Promise<import("../_gqlTypes").MeQuery>;
58
+ GetRecord(variables: import("../_gqlTypes").GetRecordQueryVariables, requestHeaders?: HeadersInit, signal?: RequestInit["signal"]): Promise<import("../_gqlTypes").GetRecordQuery>;
59
+ };
36
60
  export declare function makeGraphQlCall(query: string | FormData, options?: IMakeGraphQlCallOptions): Promise<any>;
37
61
  export declare function importFileGraphQlCall(query: string, filePath: string, sheets?: any): Promise<any>;
38
- export declare function gqlSaveLibrary(id: string, label: string, additionalAttributes?: string[], settings?: string): Promise<any>;
62
+ export declare function gqlSaveLibrary(id: string, label: string, additionalAttributes?: string[], settings?: string, recordIdentityConf?: {
63
+ label: string;
64
+ subLabel?: string;
65
+ preview?: string;
66
+ color?: string;
67
+ treeColorPreview?: string;
68
+ }): Promise<any>;
39
69
  export declare function gqlSaveApplication(id: string, label: string, endpoint: string): Promise<any>;
40
70
  export declare function gqlSaveAttribute(params: {
41
71
  id: string;
@@ -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",
@@ -13,7 +15,8 @@ export declare enum Errors {
13
15
  DUPLICATE_FILENAMES = "DUPLICATE_FILENAMES",
14
16
  ELEMENT_ALREADY_PRESENT = "ELEMENT_ALREADY_PRESENT",
15
17
  ELEMENT_ALREADY_PRESENT_IN_ANCESTORS = "ELEMENT_ALREADY_PRESENT_IN_ANCESTORS",
16
- ELEMENT_NOT_IN_TREE = "ELEMENT_NOT_IN_TREE",
18
+ NODE_NOT_IN_TREE = "NODE_NOT_IN_TREE",
19
+ RECORD_NOT_IN_TREE = "RECORD_NOT_IN_TREE",
17
20
  ELEMENT_WITH_SAME_PATH_ALREADY_PRESENT = "ELEMENT_WITH_SAME_PATH_ALREADY_PRESENT",
18
21
  ENCRYPT_ERROR = "ENCRYPT_ERROR",
19
22
  ERROR = "ERROR",
@@ -51,7 +54,7 @@ export declare enum Errors {
51
54
  LIBRARY_FORBIDDEN_AS_CHILD = "LIBRARY FORBIDDEN AS CHILD",
52
55
  METADATA_PERMISSION_ERROR = "METADATA_PERMISSION_ERROR",
53
56
  MISSING_ACTION_PREFIX = "MISSING_ACTION_PREFIX",
54
- MISSING_ELEMENTS = "MISSING_ELEMENTS",
57
+ MISSING_IMPORT_ELEMENTS = "MISSING_IMPORT_ELEMENTS",
55
58
  MISSING_FIELDS = "MISSING_FIELDS",
56
59
  MISSING_LIBRARY_ID = "MISSING_LIBRARY_ID",
57
60
  MISSING_RECORD_ID = "MISSING_RECORD_ID",
@@ -67,6 +70,7 @@ export declare enum Errors {
67
70
  PROTECTED_ENDPOINT = "PROTECTED_ENDPOINT",
68
71
  READONLY_ATTRIBUTE = "READONLY_ATTRIBUTE",
69
72
  RECORD_ACTIVATION_FAILED = "RECORD_ACTIVATION_FAILED",
73
+ RECORD_NOT_FOUND_FOR_IMPORT_MATCH = "RECORD_NOT_FOUND_FOR_IMPORT_MATCH",
70
74
  REQUIRED_ATTRIBUTE = "REQUIRED_ATTRIBUTE",
71
75
  REQUIRED_ATTRIBUTE_FORMAT = "REQUIRED_ATTRIBUTE_FORMAT",
72
76
  REQUIRED_ATTRIBUTE_LABEL = "REQUIRED_ATTRIBUTE_LABEL",
@@ -75,6 +79,7 @@ export declare enum Errors {
75
79
  REQUIRED_ATTRIBUTE_TYPE = "REQUIRED_ATTRIBUTE_TYPE",
76
80
  SYSTEM_ATTRIBUTE_DELETION = "SYSTEM_ATTRIBUTE_DELETION",
77
81
  SYSTEM_LIBRARY_DELETION = "SYSTEM_LIBRARY_DELETION",
82
+ SYSTEM_APPLICATION_DELETION = "SYSTEM_APPLICATION_DELETION",
78
83
  SYSTEM_TREE_DELETION = "SYSTEM_TREE_DELETION",
79
84
  TOO_MUCH_LIBRARIES_ON_FILES_TREE = "TOO_MUCH_LIBRARIES_ON_FILES_TREE",
80
85
  UNBINDED_ATTRIBUTES = "UNBINDED_ATTRIBUTES",
@@ -14,8 +14,8 @@ type OnlyObject<T> = T extends object ? T : never;
14
14
  * Maybe move all DBPayloadData types in @leav/utils type to allow event consumers outside core to use them
15
15
  * without having to redeclare them. For now before and after are any in @leav/utils
16
16
  */
17
- export interface IDbPayloadInternal<DBPayloadAction extends EventAction> extends IDbPayload {
18
- action: DBPayloadAction;
17
+ export interface IDbPayloadInternal<DBPayloadAction extends EventAction | unknown> extends IDbPayload {
18
+ action: DBPayloadAction extends EventAction ? DBPayloadAction : string;
19
19
  before?: OnlyObject<IDBPayloadData<DBPayloadAction>>;
20
20
  after?: OnlyObject<IDBPayloadData<DBPayloadAction>>;
21
21
  }
@@ -42,5 +42,5 @@ interface IDBPayloadDataMap {
42
42
  [EventAction.TREE_DELETE]: ITree;
43
43
  [EventAction.PERMISSION_SAVE]: IPermission;
44
44
  }
45
- export type IDBPayloadData<DBPayloadAction extends EventAction> = DBPayloadAction extends keyof IDBPayloadDataMap ? IDBPayloadDataMap[DBPayloadAction] : never;
45
+ export type IDBPayloadData<DBPayloadAction extends EventAction | unknown> = DBPayloadAction extends keyof IDBPayloadDataMap ? IDBPayloadDataMap[DBPayloadAction] : DBPayloadAction extends string ? object : never;
46
46
  export {};
@@ -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;
@@ -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;
@@ -7,7 +7,7 @@ import type * as Config from '_types/config';
7
7
  import { type IQueryInfos } from '_types/queryInfos';
8
8
  import { type IDbPayloadInternal } from '_types/events';
9
9
  export interface IEventsManagerDomain {
10
- sendDatabaseEvent<DBPayloadAction extends EventAction>(payload: IDbPayloadInternal<DBPayloadAction>, ctx: IQueryInfos): Promise<void>;
10
+ sendDatabaseEvent<DBPayloadAction extends EventAction | unknown>(payload: IDbPayloadInternal<DBPayloadAction>, ctx: IQueryInfos): Promise<void>;
11
11
  sendPubSubEvent(payload: IPubSubPayload, ctx: IQueryInfos): Promise<void>;
12
12
  subscribe(triggersName: string[]): AsyncIterator<any>;
13
13
  initPubSubEventsConsumer(): Promise<void>;
@@ -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;
@@ -32,3 +32,9 @@ export interface ICreateRecordResult {
32
32
  record?: IRecord;
33
33
  valuesErrors?: ICreateRecordValueError[];
34
34
  }
35
+ export interface IDuplicateRecordValueError extends ICreateRecordValueError {
36
+ originalId?: string;
37
+ }
38
+ export interface IDuplicateRecordResult extends ICreateRecordResult {
39
+ valuesErrors?: IDuplicateRecordValueError[];
40
+ }
@@ -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 {};
@@ -14,7 +14,7 @@ import { type IRecord, type IRecordFilterLight, type IRecordIdentity } from '../
14
14
  import { type IAttributeDomain } from '../attribute/attributeDomain';
15
15
  import { type IRecordPermissionDomain } from '../permission/recordPermissionDomain';
16
16
  import { type SendRecordUpdateEventHelper } from './helpers/sendRecordUpdateEvent';
17
- import { type ICreateRecordResult, type ICreateRecordValueError, type IFindRecordParams } from './_types';
17
+ import { type IDuplicateRecordResult, type ICreateRecordResult, type ICreateRecordValueError, type IFindRecordParams } from './_types';
18
18
  import { type IFormRepo } from 'infra/form/formRepo';
19
19
  import { type DeleteRecordHelper } from './helpers/deleteRecord';
20
20
  import { type CreateRecordHelper } from './helpers/createRecord';
@@ -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
  /**
@@ -114,7 +115,7 @@ export interface IRecordDomain {
114
115
  recordIds: string[];
115
116
  duplicateRules?: IDuplicateRecordRules;
116
117
  ctx: IQueryInfos;
117
- }): Promise<ICreateRecordResult[]>;
118
+ }): Promise<IDuplicateRecordResult[]>;
118
119
  }
119
120
  export interface IRecordDomainDeps {
120
121
  config: Config.IConfig;
@@ -0,0 +1,4 @@
1
+ import { type ISaveValue, type IValue } from '_types/value';
2
+ import { type IAttribute } from '../../../_types/attribute';
3
+ declare const _default: (attribute: IAttribute, value: IValue, saveValue: ISaveValue) => boolean;
4
+ export default _default;
@@ -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
  *
@@ -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 {};
@@ -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 {};
@@ -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;
@@ -0,0 +1,2 @@
1
+ import { type ILang } from '_types/config';
2
+ export declare function loadLocalesForDayjs(langConfig: ILang): void;
@@ -3,10 +3,10 @@ import { type ActionsListConfig } from '_types/actionsList';
3
3
  import { type IConfig } from '_types/config';
4
4
  import { type ErrorFieldDetailMessage, Errors, type IExtendedErrorMsg } from '../_types/errors';
5
5
  import { type ILibrary, type ILibraryPreviewsSettings, type LibraryBehavior } from '_types/library';
6
- import { type IValue } from '_types/value';
7
6
  import ValidationError from '../errors/ValidationError';
8
7
  import { type IAttribute } from '../_types/attribute';
9
8
  import { type IPreviewAttributesSettings, type IPreviewVersion } from '../_types/filesManager';
9
+ import './configureDayjs';
10
10
  export type ToAny<T> = {
11
11
  [P in keyof T]: any;
12
12
  };
@@ -91,7 +91,6 @@ export interface IUtils {
91
91
  getPreviewsStatusAttributeName(libraryId: string): string;
92
92
  getPreviewAttributesSettings(library: ILibrary): IPreviewAttributesSettings;
93
93
  previewsSettingsToVersions(previewsSettings: ILibraryPreviewsSettings[]): IPreviewVersion[];
94
- areValuesIdentical(value1: IValue, value2: IValue): boolean;
95
94
  }
96
95
  export interface IUtilsDeps {
97
96
  config?: IConfig;