@aristid/leav-types 0.0.7-fb972a7 → 0.0.7-fd9dcf3f

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 (46) hide show
  1. package/apps/core/src/_types/value.d.ts +62 -3
  2. package/apps/core/src/app/application/applicationApp.d.ts +3 -7
  3. package/apps/core/src/app/auth/authApp.d.ts +4 -5
  4. package/apps/core/src/app/core/actionListApp.d.ts +2 -4
  5. package/apps/core/src/app/core/apiKeyApp/apiKeyApp.d.ts +2 -4
  6. package/apps/core/src/app/core/attributeApp/attributeApp.d.ts +2 -5
  7. package/apps/core/src/app/core/coreApp.d.ts +2 -4
  8. package/apps/core/src/app/core/exportApp.d.ts +2 -4
  9. package/apps/core/src/app/core/filesManagerApp.d.ts +3 -5
  10. package/apps/core/src/app/core/formApp/formApp.d.ts +3 -4
  11. package/apps/core/src/app/core/globalSettingsApp.d.ts +3 -6
  12. package/apps/core/src/app/core/importApp.d.ts +2 -4
  13. package/apps/core/src/app/core/libraryApp/libraryApp.d.ts +2 -5
  14. package/apps/core/src/app/core/logApp.d.ts +2 -4
  15. package/apps/core/src/app/core/permissionApp/permissionApp.d.ts +2 -4
  16. package/apps/core/src/app/core/pluginsApp.d.ts +2 -3
  17. package/apps/core/src/app/core/recordApp/recordApp.d.ts +2 -5
  18. package/apps/core/src/app/core/tasksManagerApp.d.ts +2 -3
  19. package/apps/core/src/app/core/treeApp/treeApp.d.ts +5 -6
  20. package/apps/core/src/app/core/userDataApp.d.ts +2 -4
  21. package/apps/core/src/app/core/valueApp.d.ts +2 -4
  22. package/apps/core/src/app/core/versionProfileApp/versionProfileApp.d.ts +2 -4
  23. package/apps/core/src/app/core/viewApp.d.ts +2 -4
  24. package/apps/core/src/app/endpoint/endpointApp.d.ts +3 -8
  25. package/apps/core/src/app/graphql/graphqlApp.d.ts +4 -0
  26. package/apps/core/src/domain/filesManager/helpers/handleFileSystemEvent/handleMoveEvent.d.ts +1 -1
  27. package/apps/core/src/domain/import/importDomain.d.ts +1 -1
  28. package/apps/core/src/domain/indexationManager/indexationManagerDomain.d.ts +1 -1
  29. package/apps/core/src/domain/permission/_types.d.ts +8 -0
  30. package/apps/core/src/domain/permission/recordPermissionDomain.d.ts +4 -1
  31. package/apps/core/src/domain/record/recordDomain.d.ts +2 -2
  32. package/apps/core/src/domain/value/helpers/prepareValue.d.ts +3 -3
  33. package/apps/core/src/domain/value/helpers/saveOneValue.d.ts +2 -2
  34. package/apps/core/src/domain/value/helpers/validateValue.d.ts +3 -3
  35. package/apps/core/src/domain/value/valueDomain.d.ts +3 -3
  36. package/apps/core/src/infra/attributeTypes/attributeAdvancedLinkRepo.d.ts +5 -2
  37. package/apps/core/src/infra/attributeTypes/attributeAdvancedRepo.d.ts +3 -1
  38. package/apps/core/src/infra/attributeTypes/attributeSimpleLinkRepo.d.ts +5 -2
  39. package/apps/core/src/infra/attributeTypes/attributeSimpleRepo.d.ts +3 -1
  40. package/apps/core/src/infra/attributeTypes/attributeTreeRepo.d.ts +3 -1
  41. package/apps/core/src/infra/attributeTypes/attributeTypesRepo.d.ts +27 -21
  42. package/apps/core/src/infra/db/migrations/011-moveSkeletonApptoAppStudio.d.ts +7 -0
  43. package/apps/core/src/infra/record/helpers/getSearchVariableName.d.ts +1 -1
  44. package/apps/core/src/infra/value/valueRepo.d.ts +3 -3
  45. package/apps/core/src/interface/server.d.ts +7 -0
  46. package/package.json +1 -1
@@ -3,6 +3,7 @@ import { IDbEdge } from 'infra/db/_types';
3
3
  import { IRecord } from './record';
4
4
  import { ITreeNode, TreePaths } from './tree';
5
5
  import { EMPTY_VALUE } from 'infra/value/valueRepo';
6
+ import { AttributeTypes } from './attribute';
6
7
  export type IValueFromGql = Override<Omit<IValue, 'version'>, {
7
8
  value: IValue['payload'];
8
9
  metadata: Array<{
@@ -30,8 +31,12 @@ export interface IValueMetadata {
30
31
  [fieldName: string]: IStandardValue | AnyPrimitive;
31
32
  }
32
33
  export type EmptyValue = typeof EMPTY_VALUE;
33
- export interface IGenericValue {
34
- id_value?: string;
34
+ interface ICommonGenericSaveValue {
35
+ /**
36
+ * The id of the edge for advanced, advanced link or tree values
37
+ * In case of advanced reverse link from simple link, this is the id of the linked record
38
+ */
39
+ id_value?: string | null;
35
40
  attribute?: string;
36
41
  created_at?: number;
37
42
  modified_at?: number;
@@ -39,21 +44,60 @@ export interface IGenericValue {
39
44
  modified_by?: string;
40
45
  version?: IValueVersion;
41
46
  metadata?: IValueMetadata;
47
+ }
48
+ export interface IGenericValue extends ICommonGenericSaveValue {
42
49
  isInherited?: boolean;
43
50
  isCalculated?: boolean;
44
51
  }
45
52
  export interface IStandardValue extends IGenericValue {
53
+ /**
54
+ * Computed value after get actions on attribute are done
55
+ * TODO remove that any when possible
56
+ * TODO remove optional when possible
57
+ */
46
58
  payload?: any | EmptyValue;
47
- raw_payload?: any | EmptyValue;
59
+ /**
60
+ * Raw value from the database, before any computation
61
+ * TODO, remove that any when possible
62
+ */
63
+ raw_payload?: any;
48
64
  }
49
65
  export interface ILinkValue extends IGenericValue {
66
+ /**
67
+ * Linked record
68
+ * TODO remove optional when possible
69
+ */
50
70
  payload?: IRecord;
51
71
  }
52
72
  export interface ITreeValue extends IGenericValue {
73
+ /**
74
+ * Linked tree node
75
+ * TODO remove optional when possible
76
+ */
53
77
  payload?: ITreeNode;
54
78
  treeId: string;
55
79
  }
56
80
  export type IValue = IStandardValue | ILinkValue | ITreeValue;
81
+ type IGenericSaveValue = ICommonGenericSaveValue;
82
+ export interface ISaveStandardValue extends IGenericSaveValue {
83
+ /**
84
+ * Any base type value to save
85
+ */
86
+ payload: number | string | boolean | EmptyValue | null;
87
+ }
88
+ export interface ISaveLinkValue extends IGenericSaveValue {
89
+ /**
90
+ * Record id to link
91
+ */
92
+ payload: string | null;
93
+ }
94
+ export interface ISaveTreeValue extends IGenericSaveValue {
95
+ /**
96
+ * Tree node id to link
97
+ */
98
+ payload: string | null;
99
+ }
100
+ export type ISaveValue = ISaveStandardValue | ISaveLinkValue | ISaveTreeValue;
57
101
  export interface IDateRangeValue<T = string | number> {
58
102
  from: T;
59
103
  to: T;
@@ -78,3 +122,18 @@ export interface IValueEdge extends IDbEdge {
78
122
  version?: IDbValueVersion;
79
123
  metadata?: IValueMetadata;
80
124
  }
125
+ export interface IValueByAttributeType {
126
+ [AttributeTypes.SIMPLE]: IStandardValue;
127
+ [AttributeTypes.SIMPLE_LINK]: ILinkValue;
128
+ [AttributeTypes.ADVANCED]: IStandardValue;
129
+ [AttributeTypes.ADVANCED_LINK]: ILinkValue;
130
+ [AttributeTypes.TREE]: ITreeValue;
131
+ }
132
+ export interface ISaveValueByAttributeType {
133
+ [AttributeTypes.SIMPLE]: ISaveStandardValue;
134
+ [AttributeTypes.SIMPLE_LINK]: ISaveLinkValue;
135
+ [AttributeTypes.ADVANCED]: ISaveStandardValue;
136
+ [AttributeTypes.ADVANCED_LINK]: ISaveLinkValue;
137
+ [AttributeTypes.TREE]: ISaveTreeValue;
138
+ }
139
+ export {};
@@ -1,21 +1,17 @@
1
1
  import { ICoreSubscriptionsHelpersApp } from 'app/core/helpers/subscriptions';
2
- import { IGraphqlApp } from 'app/graphql/graphqlApp';
2
+ import { IGraphqlAppModule, IGraphqlApp } from 'app/graphql/graphqlApp';
3
3
  import { InitQueryContextFunc } from 'app/helpers/initQueryContext';
4
4
  import { IEventsManagerDomain } from 'domain/eventsManager/eventsManagerDomain';
5
5
  import { IPermissionDomain } from 'domain/permission/permissionDomain';
6
6
  import { IRecordDomain } from 'domain/record/recordDomain';
7
- import { Express } from 'express';
8
7
  import { IUtils } from 'utils/utils';
9
8
  import winston from 'winston';
10
- import { IAppGraphQLSchema } from '_types/graphql';
11
9
  import { IApplicationDomain } from '../../domain/application/applicationDomain';
12
10
  import { ValidateRequestTokenFunc } from '../helpers/validateRequestToken';
13
11
  import { IAuthApp } from '../auth/authApp';
14
12
  import { IGlobalSettingsDomain } from '../../domain/globalSettings/globalSettingsDomain';
15
- export interface IApplicationApp {
16
- registerRoute(app: Express): void;
17
- getGraphQLSchema(): Promise<IAppGraphQLSchema>;
18
- }
13
+ import { IServerRouteAppModule } from 'interface/server';
14
+ export type IApplicationApp = IGraphqlAppModule & IServerRouteAppModule;
19
15
  export interface IApplicationAppDeps {
20
16
  'core.app.graphql': IGraphqlApp;
21
17
  'core.app.auth': IAuthApp;
@@ -2,9 +2,8 @@ import { IApiKeyDomain } from 'domain/apiKey/apiKeyDomain';
2
2
  import { IRecordDomain } from 'domain/record/recordDomain';
3
3
  import { IUserDomain } from 'domain/user/userDomain';
4
4
  import { IValueDomain } from 'domain/value/valueDomain';
5
- import { Express, Response } from 'express';
5
+ import { Response } from 'express';
6
6
  import { IConfig } from '_types/config';
7
- import { IAppGraphQLSchema } from '_types/graphql';
8
7
  import { ICachesService } from '../../infra/cache/cacheService';
9
8
  import { ITokenUserData } from '../../_types/auth';
10
9
  import { IRequestWithContext } from '../../_types/express';
@@ -14,14 +13,14 @@ import { InitQueryContextFunc } from '../helpers/initQueryContext';
14
13
  import { IConvertOIDCIdentifier } from '../helpers/convertOIDCIdentifier';
15
14
  import { IncomingHttpHeaders } from 'http';
16
15
  import { IRecordRepo } from '../../infra/record/recordRepo';
17
- export interface IAuthApp {
18
- getGraphQLSchema(): IAppGraphQLSchema;
16
+ import { IGraphqlAppModule } from 'app/graphql/graphqlApp';
17
+ import { IServerRouteAppModule } from 'interface/server';
18
+ export interface IAuthApp extends IGraphqlAppModule, IServerRouteAppModule {
19
19
  validateRequestToken(params: {
20
20
  apiKey?: string;
21
21
  headers: IncomingHttpHeaders;
22
22
  cookies?: {};
23
23
  }, res: Response<unknown>): Promise<ITokenUserData>;
24
- registerRoute(app: Express): void;
25
24
  authenticateWithOIDCService(req: IRequestWithContext, res: Response<unknown>): Promise<void | Response>;
26
25
  }
27
26
  export interface IAuthAppDeps {
@@ -1,10 +1,8 @@
1
1
  import { IActionsListDomain } from 'domain/actionsList/actionsListDomain';
2
2
  import { i18n } from 'i18next';
3
- import { IAppGraphQLSchema } from '_types/graphql';
4
3
  import { IAppModule } from '_types/shared';
5
- export interface ICoreActionListApp extends IAppModule {
6
- getGraphQLSchema(): Promise<IAppGraphQLSchema>;
7
- }
4
+ import { IGraphqlAppModule } from 'app/graphql/graphqlApp';
5
+ export type ICoreActionListApp = IAppModule & IGraphqlAppModule;
8
6
  interface IDeps {
9
7
  'core.domain.actionsList': IActionsListDomain;
10
8
  translator: i18n;
@@ -1,9 +1,7 @@
1
1
  import { IApiKeyDomain } from 'domain/apiKey/apiKeyDomain';
2
2
  import { IRecordDomain } from 'domain/record/recordDomain';
3
- import { IAppGraphQLSchema } from '_types/graphql';
4
- export interface ICoreVersionProfileApp {
5
- getGraphQLSchema(): Promise<IAppGraphQLSchema>;
6
- }
3
+ import { IGraphqlAppModule } from 'app/graphql/graphqlApp';
4
+ export type ICoreVersionProfileApp = IGraphqlAppModule;
7
5
  interface IDeps {
8
6
  'core.domain.apiKey': IApiKeyDomain;
9
7
  'core.domain.record': IRecordDomain;
@@ -6,12 +6,9 @@ import { IRecordDomain } from 'domain/record/recordDomain';
6
6
  import { ITreeDomain } from 'domain/tree/treeDomain';
7
7
  import { IVersionProfileDomain } from 'domain/versionProfile/versionProfileDomain';
8
8
  import { IUtils } from 'utils/utils';
9
- import { IAppGraphQLSchema } from '_types/graphql';
10
- import { IGraphqlApp } from '../../graphql/graphqlApp';
9
+ import { IGraphqlAppModule, IGraphqlApp } from '../../graphql/graphqlApp';
11
10
  import { ICoreApp } from '../coreApp';
12
- export interface ICoreAttributeApp {
13
- getGraphQLSchema(): Promise<IAppGraphQLSchema>;
14
- }
11
+ export type ICoreAttributeApp = IGraphqlAppModule;
15
12
  interface IDeps {
16
13
  'core.domain.attribute': IAttributeDomain;
17
14
  'core.domain.library': ILibraryDomain;
@@ -3,12 +3,10 @@ import { ICoreDomain } from 'domain/core/coreDomain';
3
3
  import { IEventsManagerDomain } from 'domain/eventsManager/eventsManagerDomain';
4
4
  import { GraphQLScalarType } from 'graphql';
5
5
  import { i18n } from 'i18next';
6
- import { IAppGraphQLSchema } from '_types/graphql';
7
6
  import { IAppModule } from '_types/shared';
8
7
  import { ISystemTranslation } from '_types/systemTranslation';
9
- import { IGraphqlApp } from '../graphql/graphqlApp';
10
- export interface ICoreApp extends IAppModule {
11
- getGraphQLSchema(): Promise<IAppGraphQLSchema>;
8
+ import { IGraphqlAppModule, IGraphqlApp } from '../graphql/graphqlApp';
9
+ export interface ICoreApp extends IAppModule, IGraphqlAppModule {
12
10
  filterSysTranslationField(fieldData: ISystemTranslation, requestedLangs: string[]): ISystemTranslation | null;
13
11
  initPubSubEventsConsumer(): Promise<void>;
14
12
  }
@@ -1,8 +1,6 @@
1
1
  import { IExportDomain } from 'domain/export/exportDomain';
2
- import { IAppGraphQLSchema } from '_types/graphql';
3
- export interface ICoreExportApp {
4
- getGraphQLSchema(): Promise<IAppGraphQLSchema>;
5
- }
2
+ import { IGraphqlAppModule } from 'app/graphql/graphqlApp';
3
+ export type ICoreExportApp = IGraphqlAppModule;
6
4
  interface IDeps {
7
5
  'core.domain.export': IExportDomain;
8
6
  }
@@ -1,14 +1,12 @@
1
1
  import { InitQueryContextFunc } from 'app/helpers/initQueryContext';
2
2
  import { IEventsManagerDomain } from 'domain/eventsManager/eventsManagerDomain';
3
- import { Express } from 'express';
4
3
  import { IConfig } from '_types/config';
5
- import { IAppGraphQLSchema } from '_types/graphql';
6
4
  import { IFilesManagerDomain } from '../../domain/filesManager/filesManagerDomain';
7
5
  import { ValidateRequestTokenFunc } from '../helpers/validateRequestToken';
8
- export interface IFilesManagerApp {
6
+ import { IGraphqlAppModule } from 'app/graphql/graphqlApp';
7
+ import { IServerRouteAppModule } from 'interface/server';
8
+ export interface IFilesManagerApp extends IGraphqlAppModule, IServerRouteAppModule {
9
9
  init(): Promise<void>;
10
- getGraphQLSchema(): Promise<IAppGraphQLSchema>;
11
- registerRoute(app: Express): void;
12
10
  }
13
11
  interface IDeps {
14
12
  'core.app.helpers.initQueryContext': InitQueryContextFunc;
@@ -5,9 +5,8 @@ import { ILibraryDomain } from 'domain/library/libraryDomain';
5
5
  import { IUtils } from 'utils/utils';
6
6
  import { IAppGraphQLSchema } from '_types/graphql';
7
7
  import { IfLibraryJoinLinkAttribute } from 'domain/attribute/helpers/ifLibraryJoinLinkAttribute';
8
- export interface ICoreFormApp {
9
- getGraphQLSchema(): IAppGraphQLSchema;
10
- }
8
+ import { IGraphqlAppModule } from 'app/graphql/graphqlApp';
9
+ export type ICoreFormApp = IGraphqlAppModule;
11
10
  interface IDeps {
12
11
  'core.domain.attribute': IAttributeDomain;
13
12
  'core.domain.form': IFormDomain;
@@ -17,6 +16,6 @@ interface IDeps {
17
16
  'core.utils': IUtils;
18
17
  }
19
18
  export default function ({ 'core.domain.attribute': attributeDomain, 'core.domain.form': formDomain, 'core.domain.library': libraryDomain, 'core.app.helpers.convertVersionFromGqlFormat': convertVersionFromGqlFormat, 'core.domain.attribute.helpers.ifLibraryJoinLinkAttribute': ifLibraryJoinLinkAttribute, 'core.utils': utils }: IDeps): {
20
- getGraphQLSchema(): IAppGraphQLSchema;
19
+ getGraphQLSchema(): Promise<IAppGraphQLSchema>;
21
20
  };
22
21
  export {};
@@ -1,16 +1,13 @@
1
1
  import { InitQueryContextFunc } from 'app/helpers/initQueryContext';
2
2
  import { IRecordDomain } from 'domain/record/recordDomain';
3
- import { Express } from 'express';
4
3
  import { IUtils } from 'utils/utils';
5
4
  import winston from 'winston';
6
5
  import { IConfig } from '_types/config';
7
- import { IAppGraphQLSchema } from '_types/graphql';
8
6
  import { IAppModule } from '_types/shared';
9
7
  import { IGlobalSettingsDomain } from '../../domain/globalSettings/globalSettingsDomain';
10
- export interface ICoreApp extends IAppModule {
11
- getGraphQLSchema(): Promise<IAppGraphQLSchema>;
12
- registerRoute(app: Express): void;
13
- }
8
+ import { IGraphqlAppModule } from 'app/graphql/graphqlApp';
9
+ import { IServerRouteAppModule } from 'interface/server';
10
+ export type ICoreApp = IAppModule & IGraphqlAppModule & IServerRouteAppModule;
14
11
  interface IDeps {
15
12
  'core.app.helpers.initQueryContext': InitQueryContextFunc;
16
13
  'core.domain.globalSettings': IGlobalSettingsDomain;
@@ -4,10 +4,8 @@ import { IImportDomain } from 'domain/import/importDomain';
4
4
  import { IDbUtils } from 'infra/db/dbUtils';
5
5
  import { IUtils } from 'utils/utils';
6
6
  import * as Config from '_types/config';
7
- import { IAppGraphQLSchema } from '_types/graphql';
8
- import { IGraphqlApp } from '../graphql/graphqlApp';
9
- export interface ICoreImportApp {
10
- getGraphQLSchema(): Promise<IAppGraphQLSchema>;
7
+ import { IGraphqlAppModule, IGraphqlApp } from '../graphql/graphqlApp';
8
+ export interface ICoreImportApp extends IGraphqlAppModule {
11
9
  importConfig(filepath: string, clear: boolean): Promise<void>;
12
10
  importData(filepath: string): Promise<void>;
13
11
  }
@@ -4,12 +4,9 @@ import { IPermissionDomain } from 'domain/permission/permissionDomain';
4
4
  import { IRecordDomain } from 'domain/record/recordDomain';
5
5
  import { ITreeDomain } from 'domain/tree/treeDomain';
6
6
  import { IViewDomain } from 'domain/view/viewDomain';
7
- import { IAppGraphQLSchema } from '_types/graphql';
8
- import { IGraphqlApp } from '../../graphql/graphqlApp';
7
+ import { IGraphqlAppModule, IGraphqlApp } from '../../graphql/graphqlApp';
9
8
  import { ICoreApp } from '../coreApp';
10
- export interface ICoreLibraryApp {
11
- getGraphQLSchema(): Promise<IAppGraphQLSchema>;
12
- }
9
+ export type ICoreLibraryApp = IGraphqlAppModule;
13
10
  interface IDeps {
14
11
  'core.domain.library'?: ILibraryDomain;
15
12
  'core.domain.record'?: IRecordDomain;
@@ -5,11 +5,9 @@ import { ILibraryDomain } from 'domain/library/libraryDomain';
5
5
  import { ILogDomain } from 'domain/log/logDomain';
6
6
  import { ITreeDomain } from 'domain/tree/treeDomain';
7
7
  import { IVersionProfileDomain } from 'domain/versionProfile/versionProfileDomain';
8
- import { IAppGraphQLSchema } from '_types/graphql';
9
8
  import { IAppModule } from '_types/shared';
10
- export interface ICoreLogApp extends IAppModule {
11
- getGraphQLSchema(): IAppGraphQLSchema;
12
- }
9
+ import { IGraphqlAppModule } from 'app/graphql/graphqlApp';
10
+ export type ICoreLogApp = IAppModule & IGraphqlAppModule;
13
11
  interface IDeps {
14
12
  'core.domain.log': ILogDomain;
15
13
  'core.domain.eventsManager': IEventsManagerDomain;
@@ -1,16 +1,14 @@
1
1
  import { IAttributeDomain } from 'domain/attribute/attributeDomain';
2
2
  import { IPermissionDomain } from 'domain/permission/permissionDomain';
3
- import { IAppGraphQLSchema } from '_types/graphql';
4
3
  import { IAppModule } from '_types/shared';
5
4
  import { PermissionTypes } from '../../../_types/permissions';
5
+ import { IGraphqlAppModule } from 'app/graphql/graphqlApp';
6
6
  export interface IPluginPermission {
7
7
  name: string;
8
8
  type: PermissionTypes;
9
9
  applyOn?: string[];
10
10
  }
11
- export interface ICorePermissionApp extends IAppModule {
12
- getGraphQLSchema(): Promise<IAppGraphQLSchema>;
13
- }
11
+ export type ICorePermissionApp = IAppModule & IGraphqlAppModule;
14
12
  interface IDeps {
15
13
  'core.domain.permission'?: IPermissionDomain;
16
14
  'core.domain.attribute'?: IAttributeDomain;
@@ -1,9 +1,8 @@
1
1
  import { IPluginsDomain } from 'domain/plugins/pluginsDomain';
2
- import { IAppGraphQLSchema } from '_types/graphql';
3
2
  import { IPluginInfos } from '../../_types/plugin';
4
- export interface ICorePluginsApp {
3
+ import { IGraphqlAppModule } from 'app/graphql/graphqlApp';
4
+ export interface ICorePluginsApp extends IGraphqlAppModule {
5
5
  registerPlugin(path: string, plugin: IPluginInfos): void;
6
- getGraphQLSchema(): Promise<IAppGraphQLSchema>;
7
6
  }
8
7
  interface IDeps {
9
8
  'core.domain.plugins': IPluginsDomain;
@@ -5,14 +5,11 @@ import { IPermissionDomain } from 'domain/permission/permissionDomain';
5
5
  import { IRecordDomain } from 'domain/record/recordDomain';
6
6
  import { ITreeDomain } from 'domain/tree/treeDomain';
7
7
  import { IUtils } from 'utils/utils';
8
- import { IAppGraphQLSchema } from '_types/graphql';
9
- import { IGraphqlApp } from '../../graphql/graphqlApp';
8
+ import { IGraphqlAppModule, IGraphqlApp } from '../../graphql/graphqlApp';
10
9
  import { ICoreSubscriptionsHelpersApp } from '../helpers/subscriptions';
11
10
  import { IIndexationManagerApp } from '../indexationManagerApp';
12
11
  import { IAttributeDomain } from 'domain/attribute/attributeDomain';
13
- export interface ICoreRecordApp {
14
- getGraphQLSchema(): Promise<IAppGraphQLSchema>;
15
- }
12
+ export type ICoreRecordApp = IGraphqlAppModule;
16
13
  interface IDeps {
17
14
  'core.domain.record': IRecordDomain;
18
15
  'core.domain.tree': ITreeDomain;
@@ -3,14 +3,13 @@ import { IRecordDomain } from 'domain/record/recordDomain';
3
3
  import { IUtils } from 'utils/utils';
4
4
  import winston from 'winston';
5
5
  import { IConfig } from '_types/config';
6
- import { IAppGraphQLSchema } from '_types/graphql';
7
6
  import { IPaginationParams, ISortParams } from '_types/list';
8
7
  import { ITasksManagerDomain } from '../../domain/tasksManager/tasksManagerDomain';
9
8
  import { TaskStatus } from '../../_types/tasksManager';
10
- export interface ITasksManagerApp {
9
+ import { IGraphqlAppModule } from 'app/graphql/graphqlApp';
10
+ export interface ITasksManagerApp extends IGraphqlAppModule {
11
11
  initMaster(): Promise<NodeJS.Timer>;
12
12
  initWorker(): Promise<void>;
13
- getGraphQLSchema(): Promise<IAppGraphQLSchema>;
14
13
  }
15
14
  interface IDeps {
16
15
  'core.domain.tasksManager'?: ITasksManagerDomain;
@@ -2,14 +2,12 @@ import { IAttributeDomain } from 'domain/attribute/attributeDomain';
2
2
  import { IEventsManagerDomain } from 'domain/eventsManager/eventsManagerDomain';
3
3
  import { ILibraryDomain } from 'domain/library/libraryDomain';
4
4
  import { IPermissionDomain } from 'domain/permission/permissionDomain';
5
- import { IAppGraphQLSchema } from '_types/graphql';
6
5
  import { ITreeDomain } from '../../../domain/tree/treeDomain';
7
- import { IGraphqlApp } from '../../graphql/graphqlApp';
6
+ import { IGraphqlAppModule, IGraphqlApp } from '../../graphql/graphqlApp';
8
7
  import { ICoreApp } from '../coreApp';
9
8
  import { ICoreSubscriptionsHelpersApp } from '../helpers/subscriptions';
10
- export interface ITreeAttributeApp {
11
- getGraphQLSchema(): Promise<IAppGraphQLSchema>;
12
- }
9
+ import { IRecordPermissionDomain } from '../../../domain/permission/recordPermissionDomain';
10
+ export type ITreeAttributeApp = IGraphqlAppModule;
13
11
  interface IDeps {
14
12
  'core.domain.tree': ITreeDomain;
15
13
  'core.domain.attribute': IAttributeDomain;
@@ -19,6 +17,7 @@ interface IDeps {
19
17
  'core.app.core': ICoreApp;
20
18
  'core.app.core.subscriptionsHelper': ICoreSubscriptionsHelpersApp;
21
19
  'core.domain.library': ILibraryDomain;
20
+ 'core.domain.permission.record': IRecordPermissionDomain;
22
21
  }
23
- export default function ({ 'core.domain.tree': treeDomain, 'core.domain.attribute': attributeDomain, 'core.domain.permission': permissionDomain, 'core.domain.eventsManager': eventsManagerDomain, 'core.app.core': coreApp, 'core.app.graphql': graphqlApp, 'core.app.core.subscriptionsHelper': subscriptionsHelper, 'core.domain.library': libraryDomain }: IDeps): ITreeAttributeApp;
22
+ export default function ({ 'core.domain.tree': treeDomain, 'core.domain.attribute': attributeDomain, 'core.domain.permission': permissionDomain, 'core.domain.eventsManager': eventsManagerDomain, 'core.app.core': coreApp, 'core.app.graphql': graphqlApp, 'core.app.core.subscriptionsHelper': subscriptionsHelper, 'core.domain.library': libraryDomain, 'core.domain.permission.record': recordPermissionDomain }: IDeps): ITreeAttributeApp;
24
23
  export {};
@@ -1,8 +1,6 @@
1
1
  import { IUserDomain } from '../../domain/user/userDomain';
2
- import { IAppGraphQLSchema } from '_types/graphql';
3
- export interface ICoreImportApp {
4
- getGraphQLSchema(): Promise<IAppGraphQLSchema>;
5
- }
2
+ import { IGraphqlAppModule } from 'app/graphql/graphqlApp';
3
+ export type ICoreImportApp = IGraphqlAppModule;
6
4
  interface IDeps {
7
5
  'core.domain.user': IUserDomain;
8
6
  }
@@ -3,10 +3,8 @@ import { IAttributeDomain } from 'domain/attribute/attributeDomain';
3
3
  import { IRecordDomain } from 'domain/record/recordDomain';
4
4
  import { IValueDomain } from 'domain/value/valueDomain';
5
5
  import { IUtils } from 'utils/utils';
6
- import { IAppGraphQLSchema } from '_types/graphql';
7
- export interface ICoreValueApp {
8
- getGraphQLSchema(): Promise<IAppGraphQLSchema>;
9
- }
6
+ import { IGraphqlAppModule } from 'app/graphql/graphqlApp';
7
+ export type ICoreValueApp = IGraphqlAppModule;
10
8
  interface IDeps {
11
9
  'core.domain.value': IValueDomain;
12
10
  'core.domain.attribute': IAttributeDomain;
@@ -1,9 +1,7 @@
1
1
  import { ITreeDomain } from 'domain/tree/treeDomain';
2
2
  import { IVersionProfileDomain } from 'domain/versionProfile/versionProfileDomain';
3
- import { IAppGraphQLSchema } from '_types/graphql';
4
- export interface ICoreVersionProfileApp {
5
- getGraphQLSchema(): Promise<IAppGraphQLSchema>;
6
- }
3
+ import { IGraphqlAppModule } from 'app/graphql/graphqlApp';
4
+ export type ICoreVersionProfileApp = IGraphqlAppModule;
7
5
  interface IDeps {
8
6
  'core.domain.versionProfile'?: IVersionProfileDomain;
9
7
  'core.domain.tree'?: ITreeDomain;
@@ -1,16 +1,14 @@
1
1
  import { IRecordDomain } from 'domain/record/recordDomain';
2
2
  import { IViewDomain } from 'domain/view/viewDomain';
3
3
  import { IUtils } from 'utils/utils';
4
- import { IAppGraphQLSchema } from '_types/graphql';
5
4
  import { IAttributeDomain } from 'domain/attribute/attributeDomain';
5
+ import { IGraphqlAppModule } from 'app/graphql/graphqlApp';
6
6
  interface IDeps {
7
7
  'core.domain.record': IRecordDomain;
8
8
  'core.domain.view': IViewDomain;
9
9
  'core.domain.attribute': IAttributeDomain;
10
10
  'core.utils': IUtils;
11
11
  }
12
- export interface IViewApp {
13
- getGraphQLSchema(): Promise<IAppGraphQLSchema>;
14
- }
12
+ export type IViewApp = IGraphqlAppModule;
15
13
  export default function ({ 'core.domain.view': viewDomain, 'core.domain.record': recordDomain, 'core.domain.attribute': attributeDomain, 'core.utils': utils }: IDeps): IViewApp;
16
14
  export {};
@@ -1,17 +1,12 @@
1
- import type { Express, RequestHandler } from 'express';
1
+ import type { RequestHandler } from 'express';
2
2
  import type { IAppModule } from '../../_types/shared';
3
3
  import type { ExpressAppMethod } from '../../_types/endpoint';
4
4
  import type { InitQueryContextFunc } from '../helpers/initQueryContext';
5
5
  import type { ValidateRequestTokenFunc } from '../helpers/validateRequestToken';
6
6
  import { IConfig } from '_types/config';
7
7
  import { IValueDomain } from 'domain/value/valueDomain';
8
- interface IEndpointApp extends IAppModule {
9
- /**
10
- * Method call automatically by the LEAV Core: server.ts
11
- * @param app Express instance, can be used to extend the app
12
- */
13
- registerRoute(app: Express): void;
14
- }
8
+ import { IServerRouteAppModule } from 'interface/server';
9
+ type IEndpointApp = IAppModule & IServerRouteAppModule;
15
10
  export interface IPluginRoute {
16
11
  path: string;
17
12
  method: ExpressAppMethod;
@@ -1,12 +1,16 @@
1
1
  import { AwilixContainer } from 'awilix';
2
2
  import { GraphQLResolveInfo, GraphQLSchema } from 'graphql';
3
3
  import { IUtils } from 'utils/utils';
4
+ import { IAppGraphQLSchema } from '_types/graphql';
4
5
  import { IAppModule } from '_types/shared';
5
6
  import { IQueryField } from '../../_types/record';
6
7
  export interface IGraphqlApp extends IAppModule {
7
8
  getSchema(): Promise<GraphQLSchema>;
8
9
  getQueryFields(info: GraphQLResolveInfo): IQueryField[];
9
10
  }
11
+ export interface IGraphqlAppModule {
12
+ getGraphQLSchema(): Promise<IAppGraphQLSchema>;
13
+ }
10
14
  interface IDeps {
11
15
  'core.depsManager'?: AwilixContainer;
12
16
  'core.utils'?: IUtils;
@@ -1,4 +1,4 @@
1
1
  import { IQueryInfos } from '_types/queryInfos';
2
2
  import { IFileEventData } from '../../../../_types/filesManager';
3
3
  import { IHandleFileSystemEventDeps, IHandleFileSystemEventResources } from './_types';
4
- export declare const handleMoveEvent: (scanMsg: IFileEventData, { library }: IHandleFileSystemEventResources, deps: IHandleFileSystemEventDeps, ctx: IQueryInfos) => Promise<boolean>;
4
+ export declare const handleMoveEvent: (scanMsg: IFileEventData, { library }: IHandleFileSystemEventResources, deps: IHandleFileSystemEventDeps, ctx: IQueryInfos) => Promise<boolean | void>;
@@ -42,7 +42,7 @@ interface IImportConfigParams {
42
42
  forceNoTask?: boolean;
43
43
  }
44
44
  export interface IImportDomain {
45
- importConfig(params: IImportConfigParams, task?: ITaskFuncParams): Promise<string>;
45
+ importConfig(params: IImportConfigParams, task?: ITaskFuncParams): Promise<string | undefined>;
46
46
  importData(params: IImportDataParams, task?: ITaskFuncParams): Promise<string>;
47
47
  importExcel({ filename, sheets, startAt }: IImportExcelParams, ctx: IQueryInfos): Promise<string>;
48
48
  }
@@ -22,7 +22,7 @@ interface IIndexDatabaseParams {
22
22
  }
23
23
  export interface IIndexationManagerDomain {
24
24
  init(): Promise<void>;
25
- indexDatabase(params: IIndexDatabaseParams, task?: ITaskFuncParams): Promise<string>;
25
+ indexDatabase(params: IIndexDatabaseParams, task?: ITaskFuncParams): Promise<void>;
26
26
  }
27
27
  export interface IIndexationManagerDomainDeps {
28
28
  config: Config.IConfig;
@@ -199,3 +199,11 @@ export interface IGetInheritedRecordPermissionParams {
199
199
  permTreeNode: string;
200
200
  ctx: IQueryInfos;
201
201
  }
202
+ export interface IEstimateTreeValueRecordPermissionParams {
203
+ action: RecordPermissionsActions;
204
+ userId: string;
205
+ libraryId: string;
206
+ attributeId: string;
207
+ nodeId: string;
208
+ ctx: IQueryInfos;
209
+ }
@@ -5,10 +5,12 @@ import { IDefaultPermissionHelper } from './helpers/defaultPermission';
5
5
  import { IPermissionByUserGroupsHelper } from './helpers/permissionByUserGroups';
6
6
  import { ITreeBasedPermissionHelper } from './helpers/treeBasedPermissions';
7
7
  import { ILibraryPermissionDomain } from './libraryPermissionDomain';
8
- import { IGetInheritedRecordPermissionParams, IGetRecordPermissionParams } from './_types';
8
+ import { IGetInheritedRecordPermissionParams, IGetRecordPermissionParams, IEstimateTreeValueRecordPermissionParams } from './_types';
9
+ import { ITreeRepo } from '../../infra/tree/treeRepo';
9
10
  export interface IRecordPermissionDomain {
10
11
  getRecordPermission(params: IGetRecordPermissionParams): Promise<boolean>;
11
12
  getInheritedRecordPermission(params: IGetInheritedRecordPermissionParams): Promise<boolean>;
13
+ evaluateTreeValueRecordPermission(params: IEstimateTreeValueRecordPermissionParams): Promise<boolean>;
12
14
  }
13
15
  export interface IRecordPermissionDomainDeps {
14
16
  'core.domain.permission.library': ILibraryPermissionDomain;
@@ -18,5 +20,6 @@ export interface IRecordPermissionDomainDeps {
18
20
  'core.domain.attribute': IAttributeDomain;
19
21
  'core.domain.helpers.getCoreEntityById': GetCoreEntityByIdFunc;
20
22
  'core.infra.value': IValueRepo;
23
+ 'core.infra.tree': ITreeRepo;
21
24
  }
22
25
  export default function (deps: IRecordPermissionDomainDeps): IRecordPermissionDomain;
@@ -11,7 +11,7 @@ import { IValueRepo } from 'infra/value/valueRepo';
11
11
  import { IUtils } from 'utils/utils';
12
12
  import * as Config from '_types/config';
13
13
  import { IListWithCursor } from '_types/list';
14
- import { IValue, IValuesOptions } from '_types/value';
14
+ import { ISaveValue, IValue, IValuesOptions } from '_types/value';
15
15
  import { ICachesService } from '../../infra/cache/cacheService';
16
16
  import { IQueryInfos } from '../../_types/queryInfos';
17
17
  import { IRecord, IRecordFilterLight, IRecordIdentity } from '../../_types/record';
@@ -30,7 +30,7 @@ import { IElementAncestorsHelper } from 'domain/tree/helpers/elementAncestors';
30
30
  export interface IRecordDomain {
31
31
  createRecord(params: {
32
32
  library: string;
33
- values?: IValue[];
33
+ values?: ISaveValue[];
34
34
  verifyRequiredAttributes?: boolean;
35
35
  ctx: IQueryInfos;
36
36
  }): Promise<ICreateRecordResult>;
@@ -3,10 +3,10 @@ import { IAttributeDomain } from 'domain/attribute/attributeDomain';
3
3
  import { IUtils } from 'utils/utils';
4
4
  import { IAttribute } from '_types/attribute';
5
5
  import { IQueryInfos } from '_types/queryInfos';
6
- import { IValue } from '_types/value';
6
+ import { ISaveValue } from '_types/value';
7
7
  interface IPrepareValueParams {
8
8
  attributeProps: IAttribute;
9
- value: IValue;
9
+ value: ISaveValue;
10
10
  library: string;
11
11
  recordId: string;
12
12
  infos?: IQueryInfos;
@@ -18,5 +18,5 @@ interface IPrepareValueParams {
18
18
  };
19
19
  ctx: IQueryInfos;
20
20
  }
21
- declare const _default: (params: IPrepareValueParams) => Promise<IValue[]>;
21
+ declare const _default: (params: IPrepareValueParams) => Promise<ISaveValue[]>;
22
22
  export default _default;
@@ -7,7 +7,7 @@ import { ITreeRepo } from 'infra/tree/treeRepo';
7
7
  import { IValueRepo } from 'infra/value/valueRepo';
8
8
  import { IQueryInfos } from '_types/queryInfos';
9
9
  import { IAttribute } from '../../../_types/attribute';
10
- import { IValue } from '../../../_types/value';
10
+ import { ISaveValue, IValue } from '../../../_types/value';
11
11
  interface ISaveOneValueDeps {
12
12
  valueRepo: IValueRepo;
13
13
  recordRepo: IRecordRepo;
@@ -17,5 +17,5 @@ interface ISaveOneValueDeps {
17
17
  attributeDomain: IAttributeDomain;
18
18
  versionProfileDomain: IVersionProfileDomain;
19
19
  }
20
- declare const _default: (library: string, recordId: string, attribute: IAttribute, value: IValue, deps: ISaveOneValueDeps, ctx: IQueryInfos) => Promise<IValue>;
20
+ declare const _default: (library: string, recordId: string, attribute: IAttribute, value: ISaveValue, deps: ISaveOneValueDeps, ctx: IQueryInfos) => Promise<IValue>;
21
21
  export default _default;
@@ -5,10 +5,10 @@ import { IValueRepo } from 'infra/value/valueRepo';
5
5
  import { IAttribute } from '../../../_types/attribute';
6
6
  import { ErrorFieldDetail } from '../../../_types/errors';
7
7
  import { IQueryInfos } from '../../../_types/queryInfos';
8
- import { IValue } from '../../../_types/value';
8
+ import { ISaveValue } from '../../../_types/value';
9
9
  interface IValidateValueParams {
10
10
  attributeProps: IAttribute;
11
- value: IValue;
11
+ value: ISaveValue;
12
12
  library: string;
13
13
  recordId?: string;
14
14
  infos?: IQueryInfos;
@@ -21,5 +21,5 @@ interface IValidateValueParams {
21
21
  };
22
22
  ctx: IQueryInfos;
23
23
  }
24
- declare const _default: (params: IValidateValueParams) => Promise<ErrorFieldDetail<IValue>>;
24
+ declare const _default: (params: IValidateValueParams) => Promise<ErrorFieldDetail<ISaveValue>>;
25
25
  export default _default;
@@ -14,7 +14,7 @@ import * as Config from '_types/config';
14
14
  import { IRecord } from '_types/record';
15
15
  import { IAttribute } from '../../_types/attribute';
16
16
  import { IQueryInfos } from '../../_types/queryInfos';
17
- import { IValue, IValuesOptions } from '../../_types/value';
17
+ import { ISaveValue, IValue, IValuesOptions } from '../../_types/value';
18
18
  import { IActionsListDomain } from '../actionsList/actionsListDomain';
19
19
  import { IAttributeDomain } from '../attribute/attributeDomain';
20
20
  import { IValidateHelper } from '../helpers/validate';
@@ -61,7 +61,7 @@ export interface IValueDomain {
61
61
  library: string;
62
62
  recordId: string;
63
63
  attribute: string;
64
- value: IValue;
64
+ value: ISaveValue;
65
65
  ctx: IQueryInfos;
66
66
  }): Promise<IValue[]>;
67
67
  /**
@@ -73,7 +73,7 @@ export interface IValueDomain {
73
73
  saveValueBatch(params: {
74
74
  library: string;
75
75
  recordId: string;
76
- values: IValue[];
76
+ values: ISaveValue[];
77
77
  ctx: IQueryInfos;
78
78
  keepEmpty?: boolean;
79
79
  skipPermission?: boolean;
@@ -1,16 +1,19 @@
1
1
  import { IFilterTypesHelper } from 'infra/record/helpers/filterTypes';
2
2
  import { IUtils } from 'utils/utils';
3
+ import { AttributeTypes } from '../../_types/attribute';
3
4
  import { IDbService } from '../db/dbService';
4
5
  import { IDbUtils } from '../db/dbUtils';
5
6
  import { IAttributeTypeRepo } from './attributeTypesRepo';
6
7
  import { GetConditionPart } from './helpers/getConditionPart';
8
+ import { IAttributeSimpleLinkRepo } from './attributeSimpleLinkRepo';
9
+ export type IAttributeAdvancedLinkRepo = IAttributeTypeRepo<AttributeTypes.ADVANCED_LINK>;
7
10
  interface IDeps {
8
11
  'core.infra.db.dbService'?: IDbService;
9
12
  'core.infra.db.dbUtils'?: IDbUtils;
10
- 'core.infra.attributeTypes.attributeSimpleLink'?: IAttributeTypeRepo;
13
+ 'core.infra.attributeTypes.attributeSimpleLink'?: IAttributeSimpleLinkRepo;
11
14
  'core.infra.attributeTypes.helpers.getConditionPart'?: GetConditionPart;
12
15
  'core.infra.record.helpers.filterTypes'?: IFilterTypesHelper;
13
16
  'core.utils'?: IUtils;
14
17
  }
15
- export default function ({ 'core.infra.db.dbService': dbService, 'core.infra.db.dbUtils': dbUtils, 'core.infra.attributeTypes.attributeSimpleLink': attributeSimpleLinkRepo, 'core.infra.attributeTypes.helpers.getConditionPart': getConditionPart, 'core.infra.record.helpers.filterTypes': filterTypes, 'core.utils': utils }?: IDeps): IAttributeTypeRepo;
18
+ export default function ({ 'core.infra.db.dbService': dbService, 'core.infra.db.dbUtils': dbUtils, 'core.infra.attributeTypes.attributeSimpleLink': attributeSimpleLinkRepo, 'core.infra.attributeTypes.helpers.getConditionPart': getConditionPart, 'core.infra.record.helpers.filterTypes': filterTypes, 'core.utils': utils }?: IDeps): IAttributeAdvancedLinkRepo;
16
19
  export {};
@@ -1,5 +1,6 @@
1
1
  import { IDbUtils } from 'infra/db/dbUtils';
2
2
  import { IFilterTypesHelper } from 'infra/record/helpers/filterTypes';
3
+ import { AttributeTypes } from '../../_types/attribute';
3
4
  import { IDbService } from '../db/dbService';
4
5
  import { IAttributeTypeRepo } from './attributeTypesRepo';
5
6
  import { GetConditionPart } from './helpers/getConditionPart';
@@ -9,4 +10,5 @@ export interface IAttributeAdvancedRepoDeps {
9
10
  'core.infra.attributeTypes.helpers.getConditionPart': GetConditionPart;
10
11
  'core.infra.record.helpers.filterTypes': IFilterTypesHelper;
11
12
  }
12
- export default function ({ 'core.infra.db.dbService': dbService, 'core.infra.db.dbUtils': dbUtils, 'core.infra.attributeTypes.helpers.getConditionPart': getConditionPart, 'core.infra.record.helpers.filterTypes': filterTypesHelper }: IAttributeAdvancedRepoDeps): IAttributeTypeRepo;
13
+ export type IAttributeAdvancedRepo = IAttributeTypeRepo<AttributeTypes.ADVANCED>;
14
+ export default function ({ 'core.infra.db.dbService': dbService, 'core.infra.db.dbUtils': dbUtils, 'core.infra.attributeTypes.helpers.getConditionPart': getConditionPart, 'core.infra.record.helpers.filterTypes': filterTypesHelper }: IAttributeAdvancedRepoDeps): IAttributeAdvancedRepo;
@@ -1,14 +1,17 @@
1
1
  import { IFilterTypesHelper } from 'infra/record/helpers/filterTypes';
2
+ import { AttributeTypes } from '../../_types/attribute';
2
3
  import { IDbService } from '../db/dbService';
3
4
  import { IDbUtils } from '../db/dbUtils';
4
5
  import { IAttributeTypeRepo } from './attributeTypesRepo';
5
6
  import { GetConditionPart } from './helpers/getConditionPart';
7
+ import { IAttributeSimpleRepo } from './attributeSimpleRepo';
6
8
  interface IDeps {
7
9
  'core.infra.db.dbService'?: IDbService;
8
10
  'core.infra.db.dbUtils'?: IDbUtils;
9
- 'core.infra.attributeTypes.attributeSimple'?: IAttributeTypeRepo;
11
+ 'core.infra.attributeTypes.attributeSimple'?: IAttributeSimpleRepo;
10
12
  'core.infra.attributeTypes.helpers.getConditionPart'?: GetConditionPart;
11
13
  'core.infra.record.helpers.filterTypes'?: IFilterTypesHelper;
12
14
  }
13
- export 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): IAttributeTypeRepo;
15
+ export type IAttributeSimpleLinkRepo = IAttributeTypeRepo<AttributeTypes.SIMPLE_LINK>;
16
+ export default function ({ 'core.infra.db.dbService': dbService, 'core.infra.db.dbUtils': dbUtils, 'core.infra.attributeTypes.attributeSimple': attributeSimpleRepo, 'core.infra.attributeTypes.helpers.getConditionPart': getConditionPart, 'core.infra.record.helpers.filterTypes': filterTypesHelper }?: IDeps): IAttributeSimpleLinkRepo;
14
17
  export {};
@@ -1,4 +1,5 @@
1
1
  import { IFilterTypesHelper } from 'infra/record/helpers/filterTypes';
2
+ import { AttributeTypes } from '../../_types/attribute';
2
3
  import { IDbService } from '../db/dbService';
3
4
  import { IAttributeTypeRepo } from './attributeTypesRepo';
4
5
  import { GetConditionPart } from './helpers/getConditionPart';
@@ -7,5 +8,6 @@ interface IDeps {
7
8
  'core.infra.attributeTypes.helpers.getConditionPart'?: GetConditionPart;
8
9
  'core.infra.record.helpers.filterTypes'?: IFilterTypesHelper;
9
10
  }
10
- export default function ({ 'core.infra.db.dbService': dbService, 'core.infra.attributeTypes.helpers.getConditionPart': getConditionPart, 'core.infra.record.helpers.filterTypes': filterTypesHelper }?: IDeps): IAttributeTypeRepo;
11
+ export type IAttributeSimpleRepo = IAttributeTypeRepo<AttributeTypes.SIMPLE>;
12
+ export default function ({ 'core.infra.db.dbService': dbService, 'core.infra.attributeTypes.helpers.getConditionPart': getConditionPart, 'core.infra.record.helpers.filterTypes': filterTypesHelper }?: IDeps): IAttributeSimpleRepo;
11
13
  export {};
@@ -1,5 +1,6 @@
1
1
  import { IFilterTypesHelper } from 'infra/record/helpers/filterTypes';
2
2
  import { IUtils } from 'utils/utils';
3
+ import { AttributeTypes } from '../../_types/attribute';
3
4
  import { IDbService } from '../db/dbService';
4
5
  import { IDbUtils } from '../db/dbUtils';
5
6
  import { IAttributeTypeRepo } from './attributeTypesRepo';
@@ -11,5 +12,6 @@ interface IDeps {
11
12
  'core.infra.record.helpers.filterTypes'?: IFilterTypesHelper;
12
13
  'core.utils'?: IUtils;
13
14
  }
14
- export default function ({ 'core.infra.db.dbService': dbService, 'core.infra.db.dbUtils': dbUtils, 'core.infra.attributeTypes.helpers.getConditionPart': getConditionPart, 'core.infra.record.helpers.filterTypes': filterTypes, 'core.utils': utils }?: IDeps): IAttributeTypeRepo;
15
+ export type IAttributeTreeRepo = IAttributeTypeRepo<AttributeTypes.TREE>;
16
+ export default function ({ 'core.infra.db.dbService': dbService, 'core.infra.db.dbUtils': dbUtils, 'core.infra.attributeTypes.helpers.getConditionPart': getConditionPart, 'core.infra.record.helpers.filterTypes': filterTypes, 'core.utils': utils }?: IDeps): IAttributeTreeRepo;
15
17
  export {};
@@ -1,13 +1,19 @@
1
1
  import { AqlLiteral, GeneratedAqlQuery } from 'arangojs/aql';
2
2
  import { IQueryInfos } from '_types/queryInfos';
3
- import { IAttribute } from '../../_types/attribute';
3
+ import { AttributeTypes, IAttribute } from '../../_types/attribute';
4
4
  import { AttributeCondition, IRecordFilterOption } from '../../_types/record';
5
- import { IValue, IValuesOptions } from '../../_types/value';
6
- export interface IAttributeWithRepo extends IAttributeWithRevLink {
5
+ import { ISaveValueByAttributeType, IValueByAttributeType, IValuesOptions } from '../../_types/value';
6
+ import { IAttributeSimpleRepo } from './attributeSimpleRepo';
7
+ import { IAttributeSimpleLinkRepo } from './attributeSimpleLinkRepo';
8
+ import { IAttributeAdvancedRepo } from './attributeAdvancedRepo';
9
+ import { IAttributeAdvancedLinkRepo } from './attributeAdvancedLinkRepo';
10
+ import { IAttributeTreeRepo } from './attributeTreeRepo';
11
+ export type IAttributeWithRepo = IAttributeWithRevLink & {
7
12
  _repo: IAttributeTypeRepo;
8
- }
13
+ };
14
+ type IAttributeRepoByType<AttributeType extends AttributeTypes | unknown> = AttributeType extends AttributeTypes.SIMPLE ? IAttributeSimpleRepo : AttributeType extends AttributeTypes.SIMPLE_LINK ? IAttributeSimpleLinkRepo : AttributeType extends AttributeTypes.ADVANCED ? IAttributeAdvancedRepo : AttributeType extends AttributeTypes.ADVANCED_LINK ? IAttributeAdvancedLinkRepo : AttributeType extends AttributeTypes.TREE ? IAttributeTreeRepo : IAttributeTypeRepo;
9
15
  export interface IAttributeTypesRepo {
10
- getTypeRepo?(attribute: IAttribute): IAttributeTypeRepo;
16
+ getTypeRepo<AttributeType extends AttributeTypes | unknown>(attribute: IAttribute): IAttributeRepoByType<AttributeType>;
11
17
  }
12
18
  export interface IAttributeWithRevLink extends IAttribute {
13
19
  reverse_link?: IAttribute;
@@ -17,14 +23,14 @@ export type GetConditionPartFunc = (valueIdentifier: string | AqlLiteral) => Gen
17
23
  /**
18
24
  * Define interface used for all attribute type specific files
19
25
  */
20
- export interface IAttributeTypeRepo {
26
+ export interface IAttributeTypeRepo<AttributeType extends AttributeTypes = AttributeTypes, Value = IValueByAttributeType[AttributeType]> {
21
27
  createValue({ library, recordId, attribute, value, ctx }: {
22
28
  library: string;
23
29
  recordId: string;
24
30
  attribute: IAttributeWithRevLink;
25
- value: IValue;
31
+ value: ISaveValueByAttributeType[AttributeType];
26
32
  ctx: IQueryInfos;
27
- }): Promise<IValue>;
33
+ }): Promise<Value>;
28
34
  /**
29
35
  * Update an existing value. Field "id" is expected on the value
30
36
  */
@@ -32,9 +38,9 @@ export interface IAttributeTypeRepo {
32
38
  library: string;
33
39
  recordId: string;
34
40
  attribute: IAttributeWithRevLink;
35
- value: IValue;
41
+ value: ISaveValueByAttributeType[AttributeType];
36
42
  ctx: IQueryInfos;
37
- }): Promise<IValue>;
43
+ }): Promise<Value>;
38
44
  /**
39
45
  * Delete an existing value. Field "id" is expected on the value
40
46
  */
@@ -42,9 +48,9 @@ export interface IAttributeTypeRepo {
42
48
  library: string;
43
49
  recordId: string;
44
50
  attribute: IAttributeWithRevLink;
45
- value: IValue;
51
+ value: Value;
46
52
  ctx: IQueryInfos;
47
- }): Promise<IValue>;
53
+ }): Promise<Value>;
48
54
  /**
49
55
  * Check if a value is unique
50
56
  */
@@ -52,7 +58,7 @@ export interface IAttributeTypeRepo {
52
58
  library: string;
53
59
  excludedRecordId?: string;
54
60
  attribute: IAttribute;
55
- value: IValue;
61
+ value: Value;
56
62
  ctx: IQueryInfos;
57
63
  }): Promise<boolean>;
58
64
  /**
@@ -67,7 +73,7 @@ export interface IAttributeTypeRepo {
67
73
  forceGetAllValues?: boolean;
68
74
  options?: IValuesOptions;
69
75
  ctx: IQueryInfos;
70
- }): Promise<IValue[]>;
76
+ }): Promise<Value[]>;
71
77
  /**
72
78
  * Get all reverse values for given attribute / value
73
79
  *
@@ -78,7 +84,7 @@ export interface IAttributeTypeRepo {
78
84
  value: string;
79
85
  forceGetAllValues: boolean;
80
86
  ctx: IQueryInfos;
81
- }): Promise<IValue[]>;
87
+ }): Promise<Value[]>;
82
88
  /**
83
89
  * Return a specific value based on its ID. Field "id" is expect on the value
84
90
  *
@@ -90,7 +96,7 @@ export interface IAttributeTypeRepo {
90
96
  attribute: IAttribute;
91
97
  valueId: string;
92
98
  ctx: IQueryInfos;
93
- }): Promise<IValue>;
99
+ }): Promise<Value>;
94
100
  /**
95
101
  * Return AQL query part to retrieve value for this attribute.
96
102
  * If will be concatenate with other filters and full query
@@ -118,11 +124,11 @@ export declare const ATTRIB_COLLECTION_NAME = "core_attributes";
118
124
  export declare const BASE_QUERY_IDENTIFIER = "r";
119
125
  export declare const isValuesCountCondition: (condition: AttributeCondition) => boolean;
120
126
  interface IDeps {
121
- 'core.infra.attributeTypes.attributeSimple'?: IAttributeTypeRepo;
122
- 'core.infra.attributeTypes.attributeSimpleLink'?: IAttributeTypeRepo;
123
- 'core.infra.attributeTypes.attributeAdvanced'?: IAttributeTypeRepo;
124
- 'core.infra.attributeTypes.attributeAdvancedLink'?: IAttributeTypeRepo;
125
- 'core.infra.attributeTypes.attributeTree'?: IAttributeTypeRepo;
127
+ 'core.infra.attributeTypes.attributeSimple'?: IAttributeSimpleRepo;
128
+ 'core.infra.attributeTypes.attributeSimpleLink'?: IAttributeSimpleLinkRepo;
129
+ 'core.infra.attributeTypes.attributeAdvanced'?: IAttributeAdvancedRepo;
130
+ 'core.infra.attributeTypes.attributeAdvancedLink'?: IAttributeAdvancedLinkRepo;
131
+ 'core.infra.attributeTypes.attributeTree'?: IAttributeTreeRepo;
126
132
  }
127
133
  export default function ({ 'core.infra.attributeTypes.attributeSimple': attributeSimpleRepo, 'core.infra.attributeTypes.attributeSimpleLink': attributeSimpleLinkRepo, 'core.infra.attributeTypes.attributeAdvanced': attributeAdvancedRepo, 'core.infra.attributeTypes.attributeAdvancedLink': attributeAdvancedLinkRepo, 'core.infra.attributeTypes.attributeTree': attributeTreeRepo }?: IDeps): IAttributeTypesRepo;
128
134
  export {};
@@ -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 {};
@@ -3,6 +3,6 @@ import { IFilterTypesHelper } from './filterTypes';
3
3
  interface IDeps {
4
4
  'core.infra.record.helpers.filterTypes'?: IFilterTypesHelper;
5
5
  }
6
- export type GetSearchVariableName = (filter: IRecordFilterOption) => string;
6
+ export type GetSearchVariableName = (filter: IRecordFilterOption) => string | undefined;
7
7
  export default function ({ 'core.infra.record.helpers.filterTypes': filterTypesHelper }: IDeps): GetSearchVariableName;
8
8
  export {};
@@ -1,7 +1,7 @@
1
1
  import { IDbService } from 'infra/db/dbService';
2
2
  import { IAttribute } from '_types/attribute';
3
3
  import { IQueryInfos } from '_types/queryInfos';
4
- import { IValue, IValuesOptions } from '_types/value';
4
+ import { ISaveValue, IValue, IValuesOptions } from '_types/value';
5
5
  import { IAttributeTypesRepo, IAttributeWithRevLink } from '../attributeTypes/attributeTypesRepo';
6
6
  export declare const VALUES_LINKS_COLLECTION = "core_edge_values_links";
7
7
  export declare const VALUES_COLLECTION = "core_values";
@@ -11,7 +11,7 @@ export interface IValueRepo {
11
11
  library: string;
12
12
  recordId: string;
13
13
  attribute: IAttributeWithRevLink;
14
- value: IValue;
14
+ value: ISaveValue;
15
15
  ctx: IQueryInfos;
16
16
  }): Promise<IValue>;
17
17
  /**
@@ -21,7 +21,7 @@ export interface IValueRepo {
21
21
  library: string;
22
22
  recordId: string;
23
23
  attribute: IAttributeWithRevLink;
24
- value: IValue;
24
+ value: ISaveValue;
25
25
  ctx: IQueryInfos;
26
26
  }): Promise<IValue>;
27
27
  /**
@@ -3,6 +3,7 @@ import { IAuthApp } from 'app/auth/authApp';
3
3
  import { ICoreApp } from 'app/core/coreApp';
4
4
  import { IGraphqlApp } from 'app/graphql/graphqlApp';
5
5
  import { AwilixContainer } from 'awilix';
6
+ import { Express } from 'express';
6
7
  import { IUtils } from 'utils/utils';
7
8
  import * as winston from 'winston';
8
9
  import { IConfig } from '_types/config';
@@ -13,6 +14,12 @@ export interface IServer {
13
14
  init(): Promise<void>;
14
15
  initConsumers(): Promise<void>;
15
16
  }
17
+ export interface IServerRouteAppModule {
18
+ /**
19
+ * @param app Express instance, can be used to extend the app
20
+ */
21
+ registerRoute(app: Express): void;
22
+ }
16
23
  interface IDeps {
17
24
  config?: IConfig;
18
25
  'core.interface.helpers.handleGraphqlError'?: HandleGraphqlErrorFunc;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aristid/leav-types",
3
- "version": "0.0.7-fb972a7",
3
+ "version": "0.0.7-fd9dcf3f",
4
4
  "description": "Shared Leav types",
5
5
  "scripts": {
6
6
  "tscheck": "",