@aristid/leav-types 1.4.1-148fd69b → 1.4.1-15ec1cbe

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 (25) hide show
  1. package/apps/core/config/default.d.ts +1 -0
  2. package/apps/core/src/__tests__/e2e/api/e2eUtils.d.ts +3 -1
  3. package/apps/core/src/__tests__/integration/domain/tasksManagerDomain.test.d.ts +1 -0
  4. package/apps/core/src/_constants/attributes.d.ts +2 -1
  5. package/apps/core/src/_types/config.d.ts +1 -0
  6. package/apps/core/src/_types/eventsManager.d.ts +4 -0
  7. package/apps/core/src/app/core/recordApp/_types.d.ts +1 -0
  8. package/apps/core/src/domain/permission/_types.d.ts +8 -19
  9. package/apps/core/src/domain/permission/helpers/defaultPermission.d.ts +6 -1
  10. package/apps/core/src/domain/permission/helpers/globalPermission.d.ts +3 -9
  11. package/apps/core/src/domain/permission/helpers/permissionByUserGroups.d.ts +2 -1
  12. package/apps/core/src/domain/record/_types.d.ts +1 -0
  13. package/apps/core/src/domain/record/helpers/getAccessPermissionFilters.d.ts +7 -1
  14. package/apps/core/src/infra/db/helpers/libraryUtils.d.ts +38 -0
  15. package/apps/core/src/infra/db/migrations/000-init/systemLibraries.d.ts +1 -8
  16. package/apps/core/src/infra/db/migrations/013-threads/comments.d.ts +4 -0
  17. package/apps/core/src/infra/db/migrations/013-threads/constants.d.ts +10 -0
  18. package/apps/core/src/infra/db/migrations/013-threads/index.d.ts +11 -0
  19. package/apps/core/src/infra/db/migrations/013-threads/statuses.d.ts +5 -0
  20. package/apps/core/src/infra/db/migrations/013-threads/threads.d.ts +4 -0
  21. package/apps/core/src/interface/plugins/apolloTracerPlugin.d.ts +5 -0
  22. package/libs/logger/src/logger.d.ts +21 -2
  23. package/package.json +1 -1
  24. package/apps/core/src/__tests__/e2e/api/import/import.test-draft.d.ts +0 -0
  25. /package/apps/core/src/__tests__/{integration/domain/taskManagerDomain.test.d.ts → e2e/api/import/import.test.d.ts} +0 -0
@@ -18,6 +18,7 @@ export declare namespace server {
18
18
  let email_1: string;
19
19
  export { email_1 as email };
20
20
  }
21
+ let enableTracer: boolean;
21
22
  }
22
23
  export declare namespace db {
23
24
  let url: string;
@@ -1,7 +1,7 @@
1
1
  import WebSocket from 'ws';
2
2
  import { type Client as GraphqlWsClient } from 'graphql-ws';
3
3
  import { type AxiosResponse } from 'axios';
4
- import type FormData from 'form-data';
4
+ import FormData from 'form-data';
5
5
  import { type ActionsListConfig } from '_types/actionsList';
6
6
  import { type ITreeElement } from '_types/tree';
7
7
  import { AttributeFormats, type AttributeTypes, type IAttributeVersionsConf, type IEmbeddedAttribute } from '../../../_types/attribute';
@@ -17,8 +17,10 @@ export declare class E2EGraphQLError extends Error {
17
17
  }
18
18
  export interface IMakeGraphQlCallOptions {
19
19
  user?: IE2EUser;
20
+ skipLogErrors?: boolean;
20
21
  }
21
22
  export declare function makeGraphQlCall(query: string | FormData, options?: IMakeGraphQlCallOptions): Promise<any>;
23
+ export declare function importFileGraphQlCall(query: string, filePath: string, sheets?: any): Promise<any>;
22
24
  export declare function gqlSaveLibrary(id: string, label: string, additionalAttributes?: string[], settings?: string): Promise<any>;
23
25
  export declare function gqlSaveApplication(id: string, label: string, endpoint: string): Promise<any>;
24
26
  export declare function gqlSaveAttribute(params: {
@@ -1 +1,2 @@
1
- export declare const baseAttributes: string[];
1
+ export declare const DISCUSSION_THREADS_ATTRIBUTE_ID = "discussion_threads";
2
+ export declare const BASE_ATTRIBUTES: string[];
@@ -62,6 +62,7 @@ export interface IServer {
62
62
  systemUser: {
63
63
  email: string;
64
64
  };
65
+ enableTracer: boolean;
65
66
  }
66
67
  export interface IActions {
67
68
  excel: {
@@ -1,4 +1,5 @@
1
1
  import { type INotificationContent } from './notification';
2
+ import { type ITask } from './tasksManager';
2
3
  export declare enum TriggerNames {
3
4
  APPLICATION_EVENT = "APPLICATION_EVENT",
4
5
  UPLOAD_FILE = "UPLOAD_FILE",
@@ -14,3 +15,6 @@ export interface IPubSubNotificationData {
14
15
  };
15
16
  recipientUserIds: string[];
16
17
  }
18
+ export interface IPubSubTaskData {
19
+ task: ITask;
20
+ }
@@ -33,4 +33,5 @@ export interface IRecordsQueryVariables {
33
33
  pagination?: IRecordsQueryPagination;
34
34
  retrieveInactive?: boolean;
35
35
  searchQuery?: string;
36
+ ignoreAccessRecordByDefaultPermission?: boolean;
36
37
  }
@@ -1,6 +1,7 @@
1
1
  import { type AdminPermissionsActions, type ApplicationPermissionsActions, type AttributePermissionsActions, type IPermissionsTreeTarget, type ITreePermissionsConf, type LibraryPermissionsActions, type PermissionsActions, type PermissionTypes, type RecordAttributePermissionsActions, type RecordPermissionsActions, type TreeNodePermissionsActions, type TreePermissionsActions } from '_types/permissions';
2
2
  import { type IQueryInfos } from '_types/queryInfos';
3
3
  import { type TreePath } from '_types/tree';
4
+ import { type IGetDefaultPermissionParams } from './helpers/defaultPermission';
4
5
  export declare const PERMISSIONS_CACHE_HEADER = "permissions";
5
6
  export declare const PERMISSIONS_NULL_PLACEHOLDER = "__null__";
6
7
  export interface IPermissionTarget {
@@ -50,12 +51,13 @@ export interface IGetTreePermissionParams {
50
51
  userId: string;
51
52
  ctx: IQueryInfos;
52
53
  }
54
+ export type GetDefaultTreeLibraryPermission = (params: IGetDefaultPermissionParams) => boolean | null;
53
55
  export interface IGetTreeLibraryPermissionParams {
54
56
  action: TreeNodePermissionsActions;
55
57
  treeId: string;
56
58
  libraryId: string;
57
59
  userId: string;
58
- getDefaultPermission?: (params?: IGetDefaultTreeLibraryPermissionParams) => Promise<boolean> | boolean;
60
+ getDefaultTreeLibraryPermission?: GetDefaultTreeLibraryPermission;
59
61
  ctx: IQueryInfos;
60
62
  }
61
63
  export interface IGetApplicationPermissionParams {
@@ -64,13 +66,14 @@ export interface IGetApplicationPermissionParams {
64
66
  userId: string;
65
67
  ctx: IQueryInfos;
66
68
  }
67
- export interface IGetDefaultTreeLibraryPermissionParams {
69
+ export interface IGetDefaultGlobalPermissionParams extends IGetDefaultPermissionParams {
68
70
  type?: PermissionTypes;
69
71
  applyTo?: string;
70
72
  userId?: string;
73
+ userGroups?: TreePath[];
71
74
  action?: PermissionsActions;
72
- ctx: IQueryInfos;
73
75
  }
76
+ export type GetDefaultGlobalPermission = (params: IGetDefaultGlobalPermissionParams) => Promise<boolean> | boolean;
74
77
  export interface IGetTreeNodePermissionParams {
75
78
  action: TreeNodePermissionsActions;
76
79
  userId: string;
@@ -105,19 +108,11 @@ export interface IGetInheritedApplicationPermissionParams {
105
108
  userGroupId: string;
106
109
  ctx: IQueryInfos;
107
110
  }
108
- export interface IGetDefaultInheritedTreeLibraryPermissionParams {
109
- type?: PermissionTypes;
110
- applyTo?: string;
111
- userId?: string;
112
- action?: PermissionsActions;
113
- ctx: IQueryInfos;
114
- }
115
111
  export interface IGetInheritedTreeLibraryPermissionParams {
116
112
  action: TreeNodePermissionsActions;
117
113
  treeId: string;
118
114
  libraryId: string;
119
115
  userGroupId: string;
120
- getDefaultPermission?: (params?: IGetDefaultInheritedTreeLibraryPermissionParams) => boolean | null;
121
116
  ctx: IQueryInfos;
122
117
  }
123
118
  export interface IGetAttributePermissionParams {
@@ -159,12 +154,6 @@ export interface IGetRecordAttributeHeritedPermissionsParams {
159
154
  permTree: string;
160
155
  permTreeNode: string;
161
156
  }
162
- export interface IGetDefaultPermissionParams {
163
- action?: any;
164
- applyTo?: string;
165
- userId?: string;
166
- userGroups?: TreePath[];
167
- }
168
157
  export interface IGetTreeBasedPermissionParams {
169
158
  type: PermissionTypes;
170
159
  action: PermissionsActions;
@@ -174,7 +163,7 @@ export interface IGetTreeBasedPermissionParams {
174
163
  [treeAttributeId: string]: string[];
175
164
  };
176
165
  permissions_conf: ITreePermissionsConf;
177
- getDefaultPermission: (params: IGetDefaultPermissionParams) => Promise<boolean> | boolean;
166
+ getDefaultPermission: GetDefaultGlobalPermission;
178
167
  }
179
168
  export interface IGetInheritedTreeBasedPermissionParams {
180
169
  type: PermissionTypes;
@@ -182,7 +171,7 @@ export interface IGetInheritedTreeBasedPermissionParams {
182
171
  userGroupId: string;
183
172
  applyTo: string;
184
173
  permissionTreeTarget: IPermissionsTreeTarget;
185
- getDefaultPermission: (params: IGetDefaultPermissionParams) => Promise<boolean> | boolean;
174
+ getDefaultPermission: GetDefaultGlobalPermission;
186
175
  }
187
176
  export interface IGetRecordPermissionParams {
188
177
  action: RecordPermissionsActions;
@@ -1,9 +1,14 @@
1
1
  import { type IConfig } from '_types/config';
2
+ import { type IQueryInfos } from '_types/queryInfos';
2
3
  interface IDeps {
3
4
  config: IConfig;
4
5
  }
6
+ export interface IGetDefaultPermissionParams {
7
+ ctx: IQueryInfos;
8
+ }
9
+ export type GetDefaultPermission = ({ ctx }: IGetDefaultPermissionParams) => boolean;
5
10
  export interface IDefaultPermissionHelper {
6
- getDefaultPermission: () => boolean;
11
+ getDefaultPermission: GetDefaultPermission;
7
12
  }
8
13
  export default function ({ config }: IDeps): IDefaultPermissionHelper;
9
14
  export {};
@@ -3,25 +3,19 @@ import { type PermissionsActions, type PermissionTypes } from '../../../_types/p
3
3
  import { type IDefaultPermissionHelper } from './defaultPermission';
4
4
  import { type IPermissionByUserGroupsHelper } from './permissionByUserGroups';
5
5
  import { type IElementAncestorsHelper } from 'domain/tree/helpers/elementAncestors';
6
+ import { type GetDefaultGlobalPermission } from '../_types';
6
7
  interface IGetGlobalPermissionParams {
7
8
  type: PermissionTypes;
8
9
  applyTo?: string;
9
10
  action: PermissionsActions;
10
- getDefaultPermission?: (params?: IGetDefaultGlobalPermissionParams) => Promise<boolean> | boolean;
11
+ getDefaultGlobalPermission?: GetDefaultGlobalPermission;
11
12
  }
12
13
  interface IGetInheritedGlobalPermissionParams {
13
14
  type: PermissionTypes;
14
15
  applyTo?: string;
15
16
  userGroupNodeId: string | null;
16
17
  action: PermissionsActions;
17
- getDefaultPermission?: (params?: IGetDefaultGlobalPermissionParams) => boolean;
18
- }
19
- interface IGetDefaultGlobalPermissionParams {
20
- type?: PermissionTypes;
21
- applyTo?: string;
22
- userId?: string;
23
- action?: PermissionsActions;
24
- ctx: IQueryInfos;
18
+ getDefaultGlobalPermission?: GetDefaultGlobalPermission;
25
19
  }
26
20
  export interface IGlobalPermissionHelper {
27
21
  getGlobalPermission(params: IGetGlobalPermissionParams, ctx: IQueryInfos): Promise<boolean>;
@@ -6,6 +6,7 @@ import { type PermissionsActions, type PermissionTypes } from '../../../_types/p
6
6
  import { type IQueryInfos } from '../../../_types/queryInfos';
7
7
  import { type ICachesService } from '../../../infra/cache/cacheService';
8
8
  import { type IConfig } from '_types/config';
9
+ import { type GetDefaultGlobalPermission } from '../_types';
9
10
  export interface IPermissionByUserGroupsHelperDeps {
10
11
  'core.domain.permission.helpers.simplePermission': ISimplePermissionHelper;
11
12
  'core.domain.permission.helpers.reducePermissionsArray': IReducePermissionsArrayHelper;
@@ -22,7 +23,7 @@ interface IGetPermissionByUserGroupsParams {
22
23
  tree: string;
23
24
  path: TreePath;
24
25
  };
25
- getDefaultPermission?: () => Promise<boolean> | boolean;
26
+ getDefaultGlobalPermission?: GetDefaultGlobalPermission;
26
27
  ctx: IQueryInfos;
27
28
  }
28
29
  export interface IPermissionByUserGroupsHelper {
@@ -13,6 +13,7 @@ export interface IFindRecordParams {
13
13
  retrieveInactive?: boolean;
14
14
  fulltextSearch?: string;
15
15
  ignorePermissions?: boolean;
16
+ ignoreAccessRecordByDefaultPermission?: boolean;
16
17
  }
17
18
  export interface ICreateRecordParams {
18
19
  library: string;
@@ -20,6 +20,12 @@ export interface IGetAccessPermissionsValue {
20
20
  attribute: IAttribute;
21
21
  permissions: INodeIdsByPermissions;
22
22
  }
23
- export type IGetAccessPermissions = (groupsIds: string[][], library: string, existingFiltersOnTreeIds: string[], deps: IAccessPermissionFilterDeps, ctx: IQueryInfos) => Promise<IGetAccessPermissionsValue[]>;
23
+ export type IGetAccessPermissions = (params: {
24
+ groupsIds: string[][];
25
+ library: string;
26
+ existingFiltersOnTreeIds: string[];
27
+ deps: IAccessPermissionFilterDeps;
28
+ ignoreAccessRecordByDefaultPermission?: boolean;
29
+ }, ctx: IQueryInfos) => Promise<IGetAccessPermissionsValue[]>;
24
30
  declare const getAccessPermissionsFilters: IGetAccessPermissions;
25
31
  export default getAccessPermissionsFilters;
@@ -0,0 +1,38 @@
1
+ import { type ILibraryRepo } from '../../library/libraryRepo';
2
+ import { type IDbService } from '../dbService';
3
+ import { type IQueryInfos } from '../../../_types/queryInfos';
4
+ import { type IAttributeForRepo, type IAttributeRepo } from '../../attribute/attributeRepo';
5
+ import { type ITree } from '../../../_types/tree';
6
+ import { type Override } from '@leav/utils';
7
+ import { type ILibraryDbEvent } from '../../../_types/library';
8
+ export type MigrationLibraryToCreate = Override<ILibraryDbEvent, {
9
+ attributes: string[];
10
+ fullTextAttributes: string[];
11
+ }> & {
12
+ _key: string;
13
+ };
14
+ export declare const commonAttributeData: {
15
+ system: boolean;
16
+ required: boolean;
17
+ multiple_values: boolean;
18
+ versions_conf: {
19
+ versionable: boolean;
20
+ };
21
+ readonly: boolean;
22
+ actions_list: {
23
+ getValue: any[];
24
+ saveValue: {
25
+ id: string;
26
+ name: string;
27
+ is_system: boolean;
28
+ }[];
29
+ deleteValue: any[];
30
+ };
31
+ };
32
+ export declare const createLibraries: (libraries: MigrationLibraryToCreate[], dbService: IDbService, libraryRepo: ILibraryRepo, ctx: IQueryInfos) => Promise<void>;
33
+ export declare const createAttributes: (attributes: IAttributeForRepo[], attributeRepo: IAttributeRepo, ctx: IQueryInfos) => Promise<void>;
34
+ export declare const linkLibraryAttributes: (attributeRepo: IAttributeRepo, libraryRepo: ILibraryRepo, libraryId: string, attributes: IAttributeForRepo[], ctx: IQueryInfos) => Promise<void>;
35
+ export type MigrationTreeToCreate = ITree & {
36
+ _key: string;
37
+ };
38
+ export declare const createTrees: (trees: MigrationTreeToCreate[], dbService: IDbService, ctx: IQueryInfos) => Promise<void>;
@@ -1,9 +1,2 @@
1
- import { type Override } from '@leav/utils';
2
- import { type ILibrary } from '../../../../_types/library';
3
- export type MigrationLibraryToCreate = Override<ILibrary, {
4
- attributes: string[];
5
- fullTextAttributes: string[];
6
- }> & {
7
- _key: string;
8
- };
1
+ import { type MigrationLibraryToCreate } from '../../helpers/libraryUtils';
9
2
  export declare const systemLibraries: MigrationLibraryToCreate[];
@@ -0,0 +1,4 @@
1
+ import { type MigrationLibraryToCreate } from '../../helpers/libraryUtils';
2
+ import { type IAttributeForRepo } from '../../../attribute/attributeRepo';
3
+ export declare const commentAttributes: IAttributeForRepo[];
4
+ export declare const commentLibrary: MigrationLibraryToCreate;
@@ -0,0 +1,10 @@
1
+ export declare const THREADS_LIBRARY_ID = "discussion_threads";
2
+ export declare const COMMENTS_LIBRARY_ID = "discussion_comments";
3
+ export declare const STATUSES_LIBRARY_ID = "statuses";
4
+ export declare const THREAD_STATUSES_TREE_ID = "discussion_thread_statuses_tree";
5
+ export declare const COMMENT_CONTENT_ATTRIBUTE_ID = "discussion_comments_text";
6
+ export declare const COMMENT_THREAD_ATTRIBUTE_ID = "discussion_comments_thread";
7
+ export declare const THREAD_STATUS_ATTRIBUTE_ID = "discussion_threads_status";
8
+ export declare const THREAD_COMMENTS_ATTRIBUTE_ID = "discussion_threads_comments";
9
+ export declare const STATUSES_LABEL_ATTRIBUTE_ID = "statuses_label";
10
+ export declare const STATUSES_COLOR_ATTRIBUTE_ID = "statuses_color";
@@ -0,0 +1,11 @@
1
+ import { type IMigration } from '../../../../_types/migration';
2
+ import { type IDbService } from '../../dbService';
3
+ import { type ILibraryRepo } from '../../../library/libraryRepo';
4
+ import { type IAttributeRepo } from '../../../attribute/attributeRepo';
5
+ interface IDeps {
6
+ 'core.infra.db.dbService': IDbService;
7
+ 'core.infra.library': ILibraryRepo;
8
+ 'core.infra.attribute': IAttributeRepo;
9
+ }
10
+ export default function ({ 'core.infra.db.dbService': dbService, 'core.infra.library': libraryRepo, 'core.infra.attribute': attributeRepo, }: IDeps): IMigration;
11
+ export {};
@@ -0,0 +1,5 @@
1
+ import { type MigrationLibraryToCreate, type MigrationTreeToCreate } from '../../helpers/libraryUtils';
2
+ import { type IAttributeForRepo } from '../../../attribute/attributeRepo';
3
+ export declare const statusesAttributes: IAttributeForRepo[];
4
+ export declare const statusesLibrary: MigrationLibraryToCreate;
5
+ export declare const threadStatusTree: MigrationTreeToCreate;
@@ -0,0 +1,4 @@
1
+ import { type MigrationLibraryToCreate } from '../../helpers/libraryUtils';
2
+ import { type IAttributeForRepo } from '../../../attribute/attributeRepo';
3
+ export declare const threadsAttributes: IAttributeForRepo[];
4
+ export declare const threadLibrary: MigrationLibraryToCreate;
@@ -0,0 +1,5 @@
1
+ import { type ApolloServerPlugin } from '@apollo/server';
2
+ /**
3
+ * Apollo Server plugin for measuring GraphQL operation and resolver performance.
4
+ */
5
+ export declare const apolloTracerPlugin: ApolloServerPlugin;
@@ -1,5 +1,24 @@
1
- import winston from 'winston';
2
1
  import { type ILoggerConfig } from './config';
3
- export type ILogger = Pick<typeof winston, 'error' | 'warn' | 'info' | 'log' | 'verbose' | 'debug' | 'silly'>;
2
+ type MetaWithoutLoggerProperties = {
3
+ [key: string]: unknown;
4
+ } & {
5
+ message?: never;
6
+ level?: never;
7
+ timestamp?: never;
8
+ location?: never;
9
+ env?: never;
10
+ app?: never;
11
+ client?: never;
12
+ version?: never;
13
+ };
14
+ export interface ILogger {
15
+ error(message: string, ...meta: MetaWithoutLoggerProperties[]): void;
16
+ warn(message: string, ...meta: MetaWithoutLoggerProperties[]): void;
17
+ info(message: string, ...meta: MetaWithoutLoggerProperties[]): void;
18
+ verbose(message: string, ...meta: MetaWithoutLoggerProperties[]): void;
19
+ debug(message: string, ...meta: MetaWithoutLoggerProperties[]): void;
20
+ silly(message: string, ...meta: MetaWithoutLoggerProperties[]): void;
21
+ }
4
22
  export declare function configureLogger(config: ILoggerConfig): void;
5
23
  export declare const logger: ILogger;
24
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aristid/leav-types",
3
- "version": "1.4.1-148fd69b",
3
+ "version": "1.4.1-15ec1cbe",
4
4
  "description": "Shared Leav types",
5
5
  "scripts": {
6
6
  "tscheck": "",