@aristid/leav-types 0.0.7-0bbb804 → 0.0.7-0cc4b7b

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 (60) hide show
  1. package/apps/core/config/default.d.ts +3 -1
  2. package/apps/core/config/test.d.ts +1 -0
  3. package/apps/core/src/__tests__/e2e/api/joinLibraries/joinLibraries.test.d.ts +1 -0
  4. package/apps/core/src/__tests__/mockers/amqp.d.ts +8 -0
  5. package/apps/core/src/__tests__/mockers/logger.d.ts +7 -0
  6. package/apps/core/src/__tests__/mocks/attribute.d.ts +4 -1
  7. package/apps/core/src/__tests__/mocks/cache.d.ts +4 -0
  8. package/apps/core/src/_constants/attributes.d.ts +1 -0
  9. package/apps/core/src/_types/attribute.d.ts +8 -1
  10. package/apps/core/src/_types/config.d.ts +3 -1
  11. package/apps/core/src/_types/forms.d.ts +10 -0
  12. package/apps/core/src/_types/globalSettings.d.ts +2 -0
  13. package/apps/core/src/_types/library.d.ts +5 -1
  14. package/apps/core/src/_types/queryInfos.d.ts +1 -1
  15. package/apps/core/src/_types/tree.d.ts +1 -0
  16. package/apps/core/src/_types/value.d.ts +63 -3
  17. package/apps/core/src/_types/views.d.ts +4 -0
  18. package/apps/core/src/app/auth/authApp.d.ts +3 -1
  19. package/apps/core/src/app/core/formApp/formApp.d.ts +3 -1
  20. package/apps/core/src/domain/attribute/helpers/ifLibraryJoinLinkAttribute.d.ts +11 -0
  21. package/apps/core/src/domain/attribute/helpers/ifLibraryJoinLinkAttribute.spec.d.ts +1 -0
  22. package/apps/core/src/domain/attribute/helpers/index.d.ts +1 -0
  23. package/apps/core/src/domain/globalSettings/globalSettingsDomain.d.ts +5 -1
  24. package/apps/core/src/domain/permission/_types.d.ts +1 -9
  25. package/apps/core/src/domain/permission/helpers/globalPermission.d.ts +1 -1
  26. package/apps/core/src/domain/permission/helpers/permissionByUserGroups.d.ts +22 -4
  27. package/apps/core/src/domain/permission/helpers/reducePermissionsArray.d.ts +1 -1
  28. package/apps/core/src/domain/record/_types.d.ts +4 -3
  29. package/apps/core/src/domain/record/helpers/createRecord.d.ts +21 -0
  30. package/apps/core/src/domain/record/helpers/deleteRecord.d.ts +19 -0
  31. package/apps/core/src/domain/record/helpers/getAccessPermissionFilters.d.ts +24 -0
  32. package/apps/core/src/domain/record/helpers/index.d.ts +3 -0
  33. package/apps/core/src/domain/record/recordDomain.d.ts +23 -3
  34. package/apps/core/src/domain/value/helpers/{canSaveValue.d.ts → canSaveRecordValue.d.ts} +3 -3
  35. package/apps/core/src/domain/value/helpers/isEmptyValue.d.ts +5 -0
  36. package/apps/core/src/domain/value/helpers/prepareValue.d.ts +3 -3
  37. package/apps/core/src/domain/value/helpers/saveOneValue.d.ts +2 -2
  38. package/apps/core/src/domain/value/helpers/validateValue.d.ts +4 -4
  39. package/apps/core/src/domain/value/valueDomain.d.ts +11 -4
  40. package/apps/core/src/errors/LeavError.d.ts +6 -0
  41. package/apps/core/src/infra/attributeTypes/attributeAdvancedLinkRepo.d.ts +5 -2
  42. package/apps/core/src/infra/attributeTypes/attributeAdvancedRepo.d.ts +3 -1
  43. package/apps/core/src/infra/attributeTypes/attributeSimpleLinkRepo.d.ts +5 -2
  44. package/apps/core/src/infra/attributeTypes/attributeSimpleRepo.d.ts +3 -1
  45. package/apps/core/src/infra/attributeTypes/attributeTreeRepo.d.ts +3 -1
  46. package/apps/core/src/infra/attributeTypes/attributeTypesRepo.d.ts +29 -23
  47. package/apps/core/src/infra/db/dbUtils.d.ts +1 -3
  48. package/apps/core/src/infra/db/migrations/008-addSkeletonApp.d.ts +7 -0
  49. package/apps/core/src/infra/db/migrations/009-addDisplayMultiLinkOptAttributeProperty.d.ts +11 -0
  50. package/apps/core/src/infra/db/migrations/010-formSidePanel.d.ts +8 -0
  51. package/apps/core/src/infra/db/migrations/011-moveSkeletonApptoAppStudio.d.ts +7 -0
  52. package/apps/core/src/infra/oidc/oidcClientService.d.ts +1 -1
  53. package/apps/core/src/infra/permission/permissionRepo.d.ts +9 -1
  54. package/apps/core/src/infra/record/recordRepo.d.ts +2 -0
  55. package/apps/core/src/infra/tree/treeRepo.d.ts +1 -1
  56. package/apps/core/src/infra/value/valueRepo.d.ts +10 -5
  57. package/apps/core/src/pluginsLoader.d.ts +1 -1
  58. package/apps/core/src/utils/utils.d.ts +1 -0
  59. package/libs/utils/src/types/forms.d.ts +7 -1
  60. package/package.json +5 -2
@@ -42,6 +42,7 @@ export declare namespace auth {
42
42
  let clientId: string;
43
43
  let postLogoutRedirectUri: string;
44
44
  let skipLogoutConfirmationPage: string | boolean;
45
+ let idTokenUserClaim: string;
45
46
  }
46
47
  let testApiKey: string;
47
48
  }
@@ -68,6 +69,7 @@ export declare namespace logs {
68
69
  let level: string;
69
70
  let transport: string;
70
71
  let destinationFile: string;
72
+ let useJsonFormat: string | boolean;
71
73
  }
72
74
  export declare namespace permissions {
73
75
  let _default_1: boolean;
@@ -187,5 +189,5 @@ export declare namespace elasticSearch {
187
189
  let url_1: string;
188
190
  export { url_1 as url };
189
191
  }
190
- export declare let pluginsPath: string;
192
+ export declare let pluginsPath: string | any[];
191
193
  export { _export as export, _import as import };
@@ -50,3 +50,4 @@ export let debug: boolean;
50
50
  export namespace redis {
51
51
  let database: number;
52
52
  }
53
+ export let pluginsPath: string[];
@@ -0,0 +1,8 @@
1
+ declare const _default: {
2
+ consumer: {
3
+ channel: {
4
+ ack: jest.Mock<any, any, any>;
5
+ };
6
+ };
7
+ };
8
+ export default _default;
@@ -0,0 +1,7 @@
1
+ declare const _default: {
2
+ info: jest.Mock<any, any, any>;
3
+ warn: jest.Mock<any, any, any>;
4
+ error: jest.Mock<any, any, any>;
5
+ debug: jest.Mock<any, any, any>;
6
+ };
7
+ export default _default;
@@ -1,5 +1,6 @@
1
- import { AttributeFormats, AttributeTypes, IAttribute } from '../../_types/attribute';
1
+ import { AttributeFormats, AttributeTypes, MultiLinkDisplayOption, IAttribute } from '../../_types/attribute';
2
2
  export declare const mockAttrSimple: IAttribute;
3
+ export declare const mockUniqueAttrSimple: IAttribute;
3
4
  export declare const mockAttrId: IAttribute;
4
5
  export declare const mockAttrAdv: IAttribute;
5
6
  export declare const mockAttrAdvMultiVal: IAttribute;
@@ -29,6 +30,8 @@ export declare const mockAttrTree: {
29
30
  reverse_link?: string | IAttribute;
30
31
  unique?: boolean;
31
32
  description?: import("../../_types/systemTranslation").ISystemTranslation;
33
+ settings?: import("../../_types/shared").IKeyValue<any>;
34
+ multi_link_display_option?: MultiLinkDisplayOption;
32
35
  label?: import("../../_types/systemTranslation").ISystemTranslation | string;
33
36
  };
34
37
  export declare const mockAttrTreeVersionable: IAttribute;
@@ -0,0 +1,4 @@
1
+ import { Mockify } from '@leav/utils';
2
+ import { ICacheService, ICachesService } from '../../infra/cache/cacheService';
3
+ export declare const mockCacheService: Mockify<ICacheService>;
4
+ export declare const mockCachesService: Mockify<ICachesService>;
@@ -0,0 +1 @@
1
+ export declare const baseAttributes: string[];
@@ -1,7 +1,7 @@
1
1
  import { ActionsListEvents, ActionsListIOTypes, ActionsListConfig } from './actionsList';
2
2
  import { ITreePermissionsConf } from './permissions';
3
3
  import { IRecord } from './record';
4
- import { IGetCoreEntitiesParams } from './shared';
4
+ import { IGetCoreEntitiesParams, IKeyValue } from './shared';
5
5
  import { ISystemTranslation } from './systemTranslation';
6
6
  import { ITreeElement } from './tree';
7
7
  import { IDateRangeValue } from './value';
@@ -24,6 +24,8 @@ export interface IAttribute extends ICoreEntity {
24
24
  reverse_link?: string | IAttribute;
25
25
  unique?: boolean;
26
26
  description?: ISystemTranslation;
27
+ settings?: IKeyValue<any>;
28
+ multi_link_display_option?: MultiLinkDisplayOption;
27
29
  }
28
30
  export declare enum ValueVersionMode {
29
31
  SIMPLE = "simple",
@@ -87,6 +89,11 @@ export declare enum AttributeFormats {
87
89
  COLOR = "color",
88
90
  RICH_TEXT = "rich_text"
89
91
  }
92
+ export declare enum MultiLinkDisplayOption {
93
+ AVATAR = "avatar",
94
+ TAG = "tag",
95
+ BADGE_QTY = "badge_qty"
96
+ }
90
97
  export declare enum IOTypes {
91
98
  STRING = "string",
92
99
  NUMBER = "number",
@@ -28,7 +28,7 @@ export interface IConfig {
28
28
  dbProfiler: IDbProfilerConfig;
29
29
  instanceId: string;
30
30
  elasticSearch: IElasticSearchConfig;
31
- pluginsPath: string;
31
+ pluginsPath: string[];
32
32
  }
33
33
  export declare enum CoreMode {
34
34
  SERVER = "server",
@@ -76,12 +76,14 @@ export interface IAuth {
76
76
  clientId?: string;
77
77
  postLogoutRedirectUri?: string;
78
78
  skipLogoutConfirmationPage?: boolean;
79
+ idTokenUserClaim?: string;
79
80
  } | {
80
81
  enable: true;
81
82
  wellKnownEndpoint: string;
82
83
  clientId: string;
83
84
  postLogoutRedirectUri: string;
84
85
  skipLogoutConfirmationPage?: boolean;
86
+ idTokenUserClaim: string;
85
87
  };
86
88
  testApiKey?: string;
87
89
  }
@@ -1,3 +1,4 @@
1
+ import { IAttribute } from './attribute';
1
2
  import { IKeyValue } from './shared';
2
3
  import { IValue } from './value';
3
4
  export interface IForm extends ICoreEntity {
@@ -5,6 +6,11 @@ export interface IForm extends ICoreEntity {
5
6
  system?: boolean;
6
7
  dependencyAttributes?: string[];
7
8
  elements?: IFormDependentElements[];
9
+ sidePanel: IFormSidePanel;
10
+ }
11
+ export interface IFormSidePanel {
12
+ enable: boolean;
13
+ isOpenByDefault: boolean;
8
14
  }
9
15
  export interface IRecordForm {
10
16
  id: string;
@@ -13,6 +19,7 @@ export interface IRecordForm {
13
19
  recordId: string;
14
20
  dependencyAttributes?: string[];
15
21
  elements: IFormElementWithValues[];
22
+ sidePanel: IFormSidePanel;
16
23
  }
17
24
  export declare enum FormElementTypes {
18
25
  field = "field",
@@ -48,3 +55,6 @@ export type IFormElementWithValuesAndChildren = IFormElementWithValues & {
48
55
  export interface IFormFilterOptions extends ICoreEntityFilterOptions {
49
56
  library?: string;
50
57
  }
58
+ export interface IFormElementJoinLibraryContext {
59
+ mandatoryAttribute: IAttribute;
60
+ }
@@ -1,3 +1,4 @@
1
+ import { IKeyValue } from './shared';
1
2
  export interface IGlobalSettings {
2
3
  defaultApp: string;
3
4
  name: string;
@@ -9,4 +10,5 @@ export interface IGlobalSettings {
9
10
  library: string;
10
11
  recordId: string;
11
12
  };
13
+ settings?: IKeyValue<any>;
12
14
  }
@@ -3,9 +3,11 @@ import { IPreviewVersion } from './filesManager';
3
3
  import { ITreePermissionsConf } from './permissions';
4
4
  import { IRecordIdentityConf } from './record';
5
5
  import { ISystemTranslation } from './systemTranslation';
6
+ import { IKeyValue } from './shared';
6
7
  export interface ILibrary extends ICoreEntity {
7
8
  system?: boolean;
8
9
  behavior?: LibraryBehavior;
10
+ mandatoryAttribute?: string;
9
11
  /**
10
12
  * List of attributes usable in this library
11
13
  */
@@ -31,6 +33,7 @@ export interface ILibrary extends ICoreEntity {
31
33
  recordId: string;
32
34
  };
33
35
  previewsSettings?: ILibraryPreviewsSettings[];
36
+ settings?: IKeyValue<any>;
34
37
  }
35
38
  export interface ILibraryFilterOptions extends ICoreEntityFilterOptions {
36
39
  system?: boolean;
@@ -43,8 +46,9 @@ export interface ILibraryPreviewsSettings {
43
46
  }
44
47
  export declare enum LibraryBehavior {
45
48
  STANDARD = "standard",
49
+ DIRECTORIES = "directories",
46
50
  FILES = "files",
47
- DIRECTORIES = "directories"
51
+ JOIN = "join"
48
52
  }
49
53
  export declare const USERS_LIBRARY = "users";
50
54
  export declare const USERS_GROUPS_LIBRARY = "users_groups";
@@ -3,12 +3,12 @@ import { IDbProfiler } from './dbProfiler';
3
3
  import { IValueVersion } from './value';
4
4
  export interface IQueryInfos {
5
5
  userId: string;
6
+ groupsId?: string[];
6
7
  lang?: string;
7
8
  defaultLang?: string;
8
9
  queryId?: string;
9
10
  version?: IValueVersion;
10
11
  treeId?: string;
11
- groupsId?: string[];
12
12
  applicationId?: string;
13
13
  dbProfiler?: IDbProfiler;
14
14
  trigger?: string;
@@ -11,6 +11,7 @@ export interface ITree extends ICoreEntity {
11
11
  behavior?: TreeBehavior;
12
12
  system?: boolean;
13
13
  permissions_conf?: ITreeNodePermissionsConf;
14
+ settings?: IKeyValue<any>;
14
15
  }
15
16
  export interface ITreeFilterOptions extends ICoreEntityFilterOptions {
16
17
  system?: boolean;
@@ -2,6 +2,8 @@ import { AnyPrimitive, Override } from '@leav/utils';
2
2
  import { IDbEdge } from 'infra/db/_types';
3
3
  import { IRecord } from './record';
4
4
  import { ITreeNode, TreePaths } from './tree';
5
+ import { EMPTY_VALUE } from 'infra/value/valueRepo';
6
+ import { AttributeTypes } from './attribute';
5
7
  export type IValueFromGql = Override<Omit<IValue, 'version'>, {
6
8
  value: IValue['payload'];
7
9
  metadata: Array<{
@@ -28,8 +30,12 @@ export interface IDbValueVersion {
28
30
  export interface IValueMetadata {
29
31
  [fieldName: string]: IStandardValue | AnyPrimitive;
30
32
  }
31
- export interface IGenericValue {
32
- id_value?: string;
33
+ export type EmptyValue = typeof EMPTY_VALUE;
34
+ interface ICommonGenericSaveValue {
35
+ /**
36
+ * The id of the edge for advanced, advanced link or tree values
37
+ */
38
+ id_value?: string | null;
33
39
  attribute?: string;
34
40
  created_at?: number;
35
41
  modified_at?: number;
@@ -37,21 +43,60 @@ export interface IGenericValue {
37
43
  modified_by?: string;
38
44
  version?: IValueVersion;
39
45
  metadata?: IValueMetadata;
46
+ }
47
+ export interface IGenericValue extends ICommonGenericSaveValue {
40
48
  isInherited?: boolean;
41
49
  isCalculated?: boolean;
42
50
  }
43
51
  export interface IStandardValue extends IGenericValue {
44
- payload?: any;
52
+ /**
53
+ * Computed value after get actions on attribute are done
54
+ * TODO remove that any when possible
55
+ * TODO remove optional when possible
56
+ */
57
+ payload?: any | EmptyValue;
58
+ /**
59
+ * Raw value from the database, before any computation
60
+ * TODO, remove that any when possible
61
+ */
45
62
  raw_payload?: any;
46
63
  }
47
64
  export interface ILinkValue extends IGenericValue {
65
+ /**
66
+ * Linked record
67
+ * TODO remove optional when possible
68
+ */
48
69
  payload?: IRecord;
49
70
  }
50
71
  export interface ITreeValue extends IGenericValue {
72
+ /**
73
+ * Linked tree node
74
+ * TODO remove optional when possible
75
+ */
51
76
  payload?: ITreeNode;
52
77
  treeId: string;
53
78
  }
54
79
  export type IValue = IStandardValue | ILinkValue | ITreeValue;
80
+ type IGenericSaveValue = ICommonGenericSaveValue;
81
+ export interface ISaveStandardValue extends IGenericSaveValue {
82
+ /**
83
+ * Any base type value to save
84
+ */
85
+ payload: number | string | boolean | EmptyValue | null;
86
+ }
87
+ export interface ISaveLinkValue extends IGenericSaveValue {
88
+ /**
89
+ * Record id to link
90
+ */
91
+ payload: string | null;
92
+ }
93
+ export interface ISaveTreeValue extends IGenericSaveValue {
94
+ /**
95
+ * Tree node id to link
96
+ */
97
+ payload: string | null;
98
+ }
99
+ export type ISaveValue = ISaveStandardValue | ISaveLinkValue | ISaveTreeValue;
55
100
  export interface IDateRangeValue<T = string | number> {
56
101
  from: T;
57
102
  to: T;
@@ -76,3 +121,18 @@ export interface IValueEdge extends IDbEdge {
76
121
  version?: IDbValueVersion;
77
122
  metadata?: IValueMetadata;
78
123
  }
124
+ export interface IValueByAttributeType {
125
+ [AttributeTypes.SIMPLE]: IStandardValue;
126
+ [AttributeTypes.SIMPLE_LINK]: ILinkValue;
127
+ [AttributeTypes.ADVANCED]: IStandardValue;
128
+ [AttributeTypes.ADVANCED_LINK]: ILinkValue;
129
+ [AttributeTypes.TREE]: ITreeValue;
130
+ }
131
+ export interface ISaveValueByAttributeType {
132
+ [AttributeTypes.SIMPLE]: ISaveStandardValue;
133
+ [AttributeTypes.SIMPLE_LINK]: ISaveLinkValue;
134
+ [AttributeTypes.ADVANCED]: ISaveStandardValue;
135
+ [AttributeTypes.ADVANCED_LINK]: ISaveLinkValue;
136
+ [AttributeTypes.TREE]: ISaveTreeValue;
137
+ }
138
+ export {};
@@ -40,6 +40,10 @@ export interface IViewValuesVersionForGraphql {
40
40
  export type ViewFromGraphQL = Omit<IView, 'valuesVersions' | 'settings'> & {
41
41
  valuesVersions: IViewValuesVersionForGraphql[];
42
42
  };
43
+ export type PartialViewFromGraphQL = Omit<IView, 'id' | 'valuesVersions' | 'settings'> & {
44
+ id: string;
45
+ valuesVersions: IViewValuesVersionForGraphql[];
46
+ };
43
47
  export interface IViewFilterOptions extends ICoreEntityFilterOptions {
44
48
  created_by?: string;
45
49
  library?: string;
@@ -13,6 +13,7 @@ import { IOIDCClientService } from '../../infra/oidc/oidcClientService';
13
13
  import { InitQueryContextFunc } from '../helpers/initQueryContext';
14
14
  import { IConvertOIDCIdentifier } from '../helpers/convertOIDCIdentifier';
15
15
  import { IncomingHttpHeaders } from 'http';
16
+ import { IRecordRepo } from '../../infra/record/recordRepo';
16
17
  export interface IAuthApp {
17
18
  getGraphQLSchema(): IAppGraphQLSchema;
18
19
  validateRequestToken(params: {
@@ -26,6 +27,7 @@ export interface IAuthApp {
26
27
  export interface IAuthAppDeps {
27
28
  'core.domain.value': IValueDomain;
28
29
  'core.domain.record': IRecordDomain;
30
+ 'core.infra.record': IRecordRepo;
29
31
  'core.domain.apiKey': IApiKeyDomain;
30
32
  'core.domain.user': IUserDomain;
31
33
  'core.infra.cache.cacheService': ICachesService;
@@ -35,4 +37,4 @@ export interface IAuthAppDeps {
35
37
  'core.app.helpers.convertOIDCIdentifier': IConvertOIDCIdentifier;
36
38
  config: IConfig;
37
39
  }
38
- export default function ({ 'core.domain.value': valueDomain, 'core.domain.record': recordDomain, 'core.domain.apiKey': apiKeyDomain, 'core.domain.user': userDomain, 'core.utils.logger': logger, 'core.infra.cache.cacheService': cacheService, 'core.infra.oidc.oidcClientService': oidcClientService, 'core.app.helpers.initQueryContext': initQueryContext, 'core.app.helpers.convertOIDCIdentifier': convertOIDCIdentifier, config }: IAuthAppDeps): IAuthApp;
40
+ export default function ({ 'core.domain.value': valueDomain, 'core.domain.record': recordDomain, 'core.infra.record': recordRepo, 'core.domain.apiKey': apiKeyDomain, 'core.domain.user': userDomain, 'core.utils.logger': logger, 'core.infra.cache.cacheService': cacheService, 'core.infra.oidc.oidcClientService': oidcClientService, 'core.app.helpers.initQueryContext': initQueryContext, 'core.app.helpers.convertOIDCIdentifier': convertOIDCIdentifier, config }: IAuthAppDeps): IAuthApp;
@@ -4,6 +4,7 @@ import { IFormDomain } from 'domain/form/formDomain';
4
4
  import { ILibraryDomain } from 'domain/library/libraryDomain';
5
5
  import { IUtils } from 'utils/utils';
6
6
  import { IAppGraphQLSchema } from '_types/graphql';
7
+ import { IfLibraryJoinLinkAttribute } from 'domain/attribute/helpers/ifLibraryJoinLinkAttribute';
7
8
  export interface ICoreFormApp {
8
9
  getGraphQLSchema(): IAppGraphQLSchema;
9
10
  }
@@ -12,9 +13,10 @@ interface IDeps {
12
13
  'core.domain.form': IFormDomain;
13
14
  'core.domain.library': ILibraryDomain;
14
15
  'core.app.helpers.convertVersionFromGqlFormat': ConvertVersionFromGqlFormatFunc;
16
+ 'core.domain.attribute.helpers.ifLibraryJoinLinkAttribute': IfLibraryJoinLinkAttribute;
15
17
  'core.utils': IUtils;
16
18
  }
17
- export default function ({ 'core.domain.attribute': attributeDomain, 'core.domain.form': formDomain, 'core.domain.library': libraryDomain, 'core.app.helpers.convertVersionFromGqlFormat': convertVersionFromGqlFormat, 'core.utils': utils }: IDeps): {
19
+ 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): {
18
20
  getGraphQLSchema(): IAppGraphQLSchema;
19
21
  };
20
22
  export {};
@@ -0,0 +1,11 @@
1
+ import { IAttribute } from '../../../_types/attribute';
2
+ import { IQueryInfos } from '../../../_types/queryInfos';
3
+ import { IAttributeDomain } from 'domain/attribute/attributeDomain';
4
+ import { GetCoreEntityByIdFunc } from 'domain/helpers/getCoreEntityById';
5
+ export type IfLibraryJoinLinkAttributeCallback<R> = (joinLibId: string, joinAttributeProps: IAttribute) => Promise<R>;
6
+ export type IfLibraryJoinLinkAttribute = <R = unknown>(attributeProps: IAttribute, callback: IfLibraryJoinLinkAttributeCallback<R>, ctx: IQueryInfos) => Promise<R | void>;
7
+ export interface IIfLibraryJoinLinkDeps {
8
+ 'core.domain.helpers.getCoreEntityById': GetCoreEntityByIdFunc;
9
+ 'core.domain.attribute': IAttributeDomain;
10
+ }
11
+ export default function ({ 'core.domain.helpers.getCoreEntityById': getCoreEntityById, 'core.domain.attribute': attributeDomain }: IIfLibraryJoinLinkDeps): IfLibraryJoinLinkAttribute;
@@ -0,0 +1 @@
1
+ export { default as ifLibraryJoinLinkAttribute } from './ifLibraryJoinLinkAttribute';
@@ -3,6 +3,8 @@ import { IAdminPermissionDomain } from 'domain/permission/adminPermissionDomain'
3
3
  import { IGlobalSettingsRepo } from 'infra/globalSettings/globalSettingsRepo';
4
4
  import { IGlobalSettings } from '_types/globalSettings';
5
5
  import { IQueryInfos } from '_types/queryInfos';
6
+ import { IUtils } from '../../utils/utils';
7
+ import { ICachesService } from '../../infra/cache/cacheService';
6
8
  export interface IGlobalSettingsDomain {
7
9
  saveSettings({ settings, ctx }: {
8
10
  settings: IGlobalSettings;
@@ -14,5 +16,7 @@ export interface IGlobalSettingsDomainDeps {
14
16
  'core.domain.permission.admin': IAdminPermissionDomain;
15
17
  'core.domain.eventsManager': IEventsManagerDomain;
16
18
  'core.infra.globalSettings': IGlobalSettingsRepo;
19
+ 'core.infra.cache.cacheService': ICachesService;
20
+ 'core.utils': IUtils;
17
21
  }
18
- export default function ({ 'core.domain.permission.admin': adminPermissionDomain, 'core.domain.eventsManager': eventsManagerDomain, 'core.infra.globalSettings': globalSettingsRepo }: IGlobalSettingsDomainDeps): IGlobalSettingsDomain;
22
+ export default function ({ 'core.domain.permission.admin': adminPermissionDomain, 'core.domain.eventsManager': eventsManagerDomain, 'core.infra.globalSettings': globalSettingsRepo, 'core.infra.cache.cacheService': cacheService, 'core.utils': utils }: IGlobalSettingsDomainDeps): IGlobalSettingsDomain;
@@ -28,14 +28,6 @@ export interface IGetPermissionsByActionsParams {
28
28
  export type PermByActionsRes = {
29
29
  [name: string]: boolean | null;
30
30
  } | null;
31
- export interface IGetPermissionByUserGroupsParams {
32
- type: PermissionTypes;
33
- action: PermissionsActions;
34
- userGroupsPaths: TreePaths[];
35
- applyTo?: string;
36
- permissionTreeTarget?: IPermissionsTreeTarget;
37
- ctx: IQueryInfos;
38
- }
39
31
  export interface IGetAdminPermissionParams {
40
32
  action: AdminPermissionsActions;
41
33
  userId: string;
@@ -63,7 +55,7 @@ export interface IGetTreeLibraryPermissionParams {
63
55
  treeId: string;
64
56
  libraryId: string;
65
57
  userId: string;
66
- getDefaultPermission?: (params?: IGetDefaultTreeLibraryPermissionParams) => boolean | null;
58
+ getDefaultPermission?: (params?: IGetDefaultTreeLibraryPermissionParams) => Promise<boolean> | boolean;
67
59
  ctx: IQueryInfos;
68
60
  }
69
61
  export interface IGetApplicationPermissionParams {
@@ -12,7 +12,7 @@ interface IGetGlobalPermissionParams {
12
12
  applyTo?: string;
13
13
  userId: string;
14
14
  action: PermissionsActions;
15
- getDefaultPermission?: (params?: IGetDefaultGlobalPermissionParams) => boolean;
15
+ getDefaultPermission?: (params?: IGetDefaultGlobalPermissionParams) => Promise<boolean> | boolean;
16
16
  }
17
17
  interface IGetInheritedGlobalPermissionParams {
18
18
  type: PermissionTypes;
@@ -1,14 +1,32 @@
1
1
  import { IPermissionRepo } from 'infra/permission/permissionRepo';
2
- import { IGetPermissionByUserGroupsParams } from '../_types';
3
2
  import { IReducePermissionsArrayHelper } from './reducePermissionsArray';
4
3
  import { ISimplePermissionHelper } from './simplePermission';
5
- interface IDeps {
4
+ import { IDefaultPermissionHelper } from './defaultPermission';
5
+ import { IElementAncestorsHelper } from 'domain/tree/helpers/elementAncestors';
6
+ import { ITreeNode, TreePaths } from '../../../_types/tree';
7
+ import { PermissionsActions, PermissionTypes } from '../../../_types/permissions';
8
+ import { IQueryInfos } from '../../../_types/queryInfos';
9
+ export interface IPermissionByUserGroupsHelperDeps {
6
10
  'core.domain.permission.helpers.simplePermission': ISimplePermissionHelper;
7
11
  'core.domain.permission.helpers.reducePermissionsArray': IReducePermissionsArrayHelper;
12
+ 'core.domain.permission.helpers.defaultPermission': IDefaultPermissionHelper;
13
+ 'core.domain.tree.helpers.elementAncestors': IElementAncestorsHelper;
8
14
  'core.infra.permission'?: IPermissionRepo;
9
15
  }
16
+ interface IGetPermissionByUserGroupsParams {
17
+ type: PermissionTypes;
18
+ action: PermissionsActions;
19
+ userGroupsPaths: TreePaths[];
20
+ applyTo?: string;
21
+ treeTarget?: {
22
+ tree: string;
23
+ path: ITreeNode[];
24
+ };
25
+ getDefaultPermission?: () => Promise<boolean> | boolean;
26
+ ctx: IQueryInfos;
27
+ }
10
28
  export interface IPermissionByUserGroupsHelper {
11
- getPermissionByUserGroups: (params: IGetPermissionByUserGroupsParams) => Promise<boolean | null>;
29
+ getPermissionByUserGroups: (params: IGetPermissionByUserGroupsParams) => Promise<boolean>;
12
30
  }
13
- export default function (deps: IDeps): IPermissionByUserGroupsHelper;
31
+ export default function (deps: IPermissionByUserGroupsHelperDeps): IPermissionByUserGroupsHelper;
14
32
  export {};
@@ -1,4 +1,4 @@
1
1
  export interface IReducePermissionsArrayHelper {
2
- reducePermissionsArray: (permissions: Array<boolean | null>) => boolean | null;
2
+ reducePermissionsArray: (permissions: boolean[]) => boolean;
3
3
  }
4
4
  export default function (): IReducePermissionsArrayHelper;
@@ -1,4 +1,5 @@
1
1
  import { ErrorTypes } from '@leav/utils';
2
+ import { Errors } from '_types/errors';
2
3
  import { ICursorPaginationParams, IPaginationParams } from '_types/list';
3
4
  import { IRecord, IRecordFilterLight, IRecordSortLight } from '_types/record';
4
5
  import { IValue, IValuesOptions, IValueVersion } from '_types/value';
@@ -11,6 +12,7 @@ export interface IFindRecordParams {
11
12
  withCount?: boolean;
12
13
  retrieveInactive?: boolean;
13
14
  fulltextSearch?: string;
15
+ ignorePermissions?: boolean;
14
16
  }
15
17
  export interface ICreateRecordParams {
16
18
  library: string;
@@ -20,10 +22,9 @@ export interface ICreateRecordParams {
20
22
  };
21
23
  }
22
24
  export interface ICreateRecordValueError {
23
- attributeId: string;
24
- type: ErrorTypes;
25
+ attribute: string;
26
+ type: ErrorTypes | Errors;
25
27
  message: string;
26
- id_value?: string;
27
28
  input?: any;
28
29
  }
29
30
  export interface ICreateRecordResult {
@@ -0,0 +1,21 @@
1
+ import { IEventsManagerDomain } from 'domain/eventsManager/eventsManagerDomain';
2
+ import { ILibraryPermissionDomain } from 'domain/permission/libraryPermissionDomain';
3
+ import { IRecordRepo } from 'infra/record/recordRepo';
4
+ import { IQueryInfos } from '../../../_types/queryInfos';
5
+ import { ICreateRecordResult, ICreateRecordValueError } from '../_types';
6
+ export type IPreCreateRecordCallback = () => Promise<ICreateRecordValueError[]>;
7
+ export type CreateRecordHelper = (params: {
8
+ library: string;
9
+ /**
10
+ * Can be use to validate potential values to post create insert to record
11
+ */
12
+ preCreateCallback?: IPreCreateRecordCallback;
13
+ ctx: IQueryInfos;
14
+ }) => Promise<ICreateRecordResult>;
15
+ interface IDeps {
16
+ 'core.domain.eventsManager': IEventsManagerDomain;
17
+ 'core.domain.permission.library': ILibraryPermissionDomain;
18
+ 'core.infra.record': IRecordRepo;
19
+ }
20
+ export default function ({ 'core.domain.eventsManager': eventsManager, 'core.domain.permission.library': libraryPermissionDomain, 'core.infra.record': recordRepo }: IDeps): CreateRecordHelper;
21
+ export {};
@@ -0,0 +1,19 @@
1
+ import { IEventsManagerDomain } from 'domain/eventsManager/eventsManagerDomain';
2
+ import { IQueryInfos } from '../../../_types/queryInfos';
3
+ import { IRecordPermissionDomain } from 'domain/permission/recordPermissionDomain';
4
+ import { IValidateHelper } from 'domain/helpers/validate';
5
+ import { IRecordRepo } from 'infra/record/recordRepo';
6
+ import { ITreeRepo } from 'infra/tree/treeRepo';
7
+ import { IValueRepo } from 'infra/value/valueRepo';
8
+ import { IRecord } from '../../../_types/record';
9
+ export type DeleteRecordHelper = (library: string, id: string, ctx: IQueryInfos) => Promise<IRecord>;
10
+ interface IDeps {
11
+ 'core.domain.helpers.validate': IValidateHelper;
12
+ 'core.domain.eventsManager': IEventsManagerDomain;
13
+ 'core.domain.permission.record': IRecordPermissionDomain;
14
+ 'core.infra.record': IRecordRepo;
15
+ 'core.infra.tree': ITreeRepo;
16
+ 'core.infra.value': IValueRepo;
17
+ }
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;
19
+ export {};
@@ -0,0 +1,24 @@
1
+ import { IAttribute } from '_types/attribute';
2
+ import { IQueryInfos } from '_types/queryInfos';
3
+ import { ITreeNode } from '_types/tree';
4
+ import { GetCoreEntityByIdFunc } from 'domain/helpers/getCoreEntityById';
5
+ import { IPermissionRepo } from 'infra/permission/permissionRepo';
6
+ import { ITreeRepo } from 'infra/tree/treeRepo';
7
+ import { IDefaultPermissionHelper } from 'domain/permission/helpers/defaultPermission';
8
+ interface IAccessPermissionFilterDeps {
9
+ 'core.domain.helpers.getCoreEntityById': GetCoreEntityByIdFunc;
10
+ 'core.infra.tree': ITreeRepo;
11
+ 'core.infra.permission': IPermissionRepo;
12
+ 'core.domain.permission.helpers.defaultPermission': IDefaultPermissionHelper;
13
+ }
14
+ export interface IGetAccessPermissionsValue {
15
+ treeId: string;
16
+ attribute: IAttribute;
17
+ permissions: {
18
+ true: Array<ITreeNode['id']>;
19
+ false: Array<ITreeNode['id']>;
20
+ };
21
+ }
22
+ export type IGetAccessPermissions = (groupsIds: string[][], library: string, deps: IAccessPermissionFilterDeps, ctx: IQueryInfos) => Promise<IGetAccessPermissionsValue[]>;
23
+ declare const getAccessPermissionsFilters: IGetAccessPermissions;
24
+ export default getAccessPermissionsFilters;
@@ -1 +1,4 @@
1
+ export { default as createRecord } from './createRecord';
2
+ export { default as deleteRecord } from './deleteRecord';
1
3
  export { default as sendRecordUpdateEvent } from './sendRecordUpdateEvent';
4
+ export { default as getAccessPermissionFilters } from './getAccessPermissionFilters';