@aristid/leav-types 1.5.1 → 1.5.2-03b36f67

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 (29) hide show
  1. package/apps/core/config/default.d.ts +4 -0
  2. package/apps/core/src/__tests__/e2e/api/attributes/attributesAdminPermissions.test.d.ts +1 -0
  3. package/apps/core/src/__tests__/e2e/api/constants.d.ts +2 -0
  4. package/apps/core/src/__tests__/e2e/api/discussions/discussions.test.d.ts +1 -0
  5. package/apps/core/src/__tests__/e2e/api/e2eUtils.d.ts +1 -0
  6. package/apps/core/src/__tests__/e2e/api/export/exportNestedAttributes.test.d.ts +1 -0
  7. package/apps/core/src/__tests__/e2e/api/mailpitUtils.d.ts +1 -0
  8. package/apps/core/src/__tests__/e2e/api/permissions/admin/apiKeyAdminPermissions.test.d.ts +1 -0
  9. package/apps/core/src/__tests__/e2e/api/permissions/admin/applicationsAdminPermissions.test.d.ts +1 -0
  10. package/apps/core/src/__tests__/e2e/api/permissions/admin/globalSettingsAdminPermissions.test.d.ts +1 -0
  11. package/apps/core/src/__tests__/e2e/api/permissions/admin/librariesAdminPermissions.test.d.ts +1 -0
  12. package/apps/core/src/__tests__/e2e/api/permissions/admin/permissionsAdminPermissions.test.d.ts +1 -0
  13. package/apps/core/src/__tests__/e2e/api/permissions/admin/treesAdminPermissions.test.d.ts +1 -0
  14. package/apps/core/src/_constants/discussions.d.ts +7 -0
  15. package/apps/core/src/_types/config.d.ts +13 -0
  16. package/apps/core/src/_types/discussion.d.ts +17 -0
  17. package/apps/core/src/_types/notification.d.ts +5 -1
  18. package/apps/core/src/_types/userData.d.ts +1 -0
  19. package/apps/core/src/app/core/discussionApp.d.ts +8 -0
  20. package/apps/core/src/app/core/index.d.ts +1 -0
  21. package/apps/core/src/app/core/permissionApp/permissionApp.d.ts +3 -1
  22. package/apps/core/src/domain/discussion/discussionDomain.d.ts +23 -0
  23. package/apps/core/src/domain/discussion/index.d.ts +1 -0
  24. package/apps/core/src/domain/permission/_types.d.ts +1 -0
  25. package/apps/core/src/domain/permission/permissionDomain.d.ts +1 -1
  26. package/apps/core/src/domain/record/recordDomain.d.ts +15 -1
  27. package/apps/core/src/domain/user/userDomain.d.ts +3 -1
  28. package/apps/core/src/errors/AuthenticationError.d.ts +6 -1
  29. package/package.json +2 -2
@@ -44,6 +44,7 @@ export declare namespace auth {
44
44
  namespace cookie {
45
45
  let sameSite: string;
46
46
  let secure: boolean;
47
+ let withDomain: boolean;
47
48
  }
48
49
  let resetPasswordExpiration: string;
49
50
  namespace oidc {
@@ -54,8 +55,11 @@ export declare namespace auth {
54
55
  let skipLogoutConfirmationPage: boolean;
55
56
  let idTokenUserClaim: string;
56
57
  let enableAutoProvisioning: boolean;
58
+ let retryAuthenticationFlowAfterExpiry: boolean;
59
+ let verificationKeysExpiration: string;
57
60
  }
58
61
  let testApiKey: string;
62
+ let debugLog: boolean;
59
63
  }
60
64
  export declare namespace mailer {
61
65
  let host_1: string;
@@ -0,0 +1,2 @@
1
+ export declare const GUEST_USER_EMAIL = "guest@aristid.com";
2
+ export declare const NON_ADMIN_USER_EMAIL = "non-admin@aristid.com";
@@ -11,6 +11,7 @@ export interface IGlobalThis {
11
11
  nonAdminGroupId: string;
12
12
  }
13
13
  interface IE2EUser {
14
+ userId: string;
14
15
  getAuthToken: () => Promise<string>;
15
16
  }
16
17
  interface IE2EUserParams {
@@ -23,6 +23,7 @@ interface IMailpitSearchResult {
23
23
  unread: number;
24
24
  }
25
25
  export declare function waitMailpitMessage(acceptMessage: (msg: IMailpitMsgLight) => boolean): Promise<IMailpitMsgFull>;
26
+ export declare function getMailpitMessage(messageId: string): Promise<IMailpitMsgFull>;
26
27
  export declare function deleteMailpitMessagesBySearch(search: string): Promise<void>;
27
28
  export declare function searchMailpitMessages(search: string): Promise<IMailpitSearchResult>;
28
29
  export declare function waitForMailpitSearchMessage(search: string, timeoutMs?: number, intervalMs?: number): Promise<IMailpitMsgLight[]>;
@@ -0,0 +1,7 @@
1
+ export declare const DISCUSSION_THREADS_LIBRARY_ID = "discussion_threads";
2
+ export declare const DISCUSSION_COMMENTS_LIBRARY_ID = "discussion_comments";
3
+ export declare const DISCUSSION_COMMENT_CONTENT_ATTRIBUTE_ID = "discussion_comments_text";
4
+ export declare const DISCUSSION_COMMENT_THREAD_ATTRIBUTE_ID = "discussion_comments_thread";
5
+ export declare const DISCUSSION_THREAD_COMMENTS_ATTRIBUTE_ID = "discussion_threads_comments";
6
+ export declare const DISCUSSION_THREAD_STATUS_ATTRIBUTE_ID = "discussion_threads_status";
7
+ export declare const DISCUSSION_THREADS_ATTRIBUTE_ID = "discussion_threads";
@@ -91,6 +91,12 @@ export interface IAuth {
91
91
  cookie: {
92
92
  sameSite: 'none' | 'lax' | 'strict';
93
93
  secure: boolean;
94
+ /**
95
+ * Do not set cookie domain to avoid sharing cookies between subdomains
96
+ * https://developer.mozilla.org/en-US/docs/Web/Security/Practical_implementation_guides/Cookies#domain
97
+ * @default false
98
+ */
99
+ withDomain: boolean;
94
100
  };
95
101
  resetPasswordExpiration: string;
96
102
  oidc: {
@@ -100,6 +106,7 @@ export interface IAuth {
100
106
  postLogoutRedirectUri?: string;
101
107
  skipLogoutConfirmationPage?: boolean;
102
108
  idTokenUserClaim?: string;
109
+ verificationKeysExpiration: string;
103
110
  } | {
104
111
  enable: true;
105
112
  wellKnownEndpoint: string;
@@ -108,8 +115,14 @@ export interface IAuth {
108
115
  skipLogoutConfirmationPage?: boolean;
109
116
  idTokenUserClaim: string;
110
117
  enableAutoProvisioning: boolean;
118
+ retryAuthenticationFlowAfterExpiry: boolean;
119
+ verificationKeysExpiration: string;
111
120
  };
112
121
  testApiKey?: string;
122
+ /**
123
+ * Enable some silly/debug/error logs in auth/oidc services
124
+ */
125
+ debugLog?: boolean;
113
126
  }
114
127
  export interface IMailer {
115
128
  host: string;
@@ -0,0 +1,17 @@
1
+ export interface IDiscussionTargetRecord {
2
+ id: string;
3
+ libraryId: string;
4
+ }
5
+ export interface IDiscussionMentions {
6
+ users?: string[];
7
+ url: string;
8
+ }
9
+ export interface IPostDiscussionCommentParams {
10
+ message: string;
11
+ targetRecord: IDiscussionTargetRecord;
12
+ threadId?: string;
13
+ mentions?: IDiscussionMentions;
14
+ }
15
+ export interface IDiscussionComment {
16
+ id: string;
17
+ }
@@ -11,7 +11,7 @@ export interface INotification {
11
11
  content: INotificationContent;
12
12
  }
13
13
  export interface INotificationContent {
14
- level: 'info' | 'warning';
14
+ level: 'success' | 'info' | 'warning' | 'error';
15
15
  title: string;
16
16
  message: string;
17
17
  relatedEntities?: Array<{
@@ -40,6 +40,10 @@ export interface ICreateNotification {
40
40
  */
41
41
  priority: 'urgent' | 'normal';
42
42
  content: INotificationContent;
43
+ /**
44
+ * Channels to send the notification to (if not set, all channels will be used)
45
+ */
46
+ channels?: NotificationChannels[];
43
47
  }
44
48
  export declare enum NotificationChannels {
45
49
  EMAIL = "email",
@@ -11,4 +11,5 @@ export interface IUserIdentity {
11
11
  * @throw if user have no email
12
12
  */
13
13
  getEmail: () => Promise<string>;
14
+ getLabel: () => Promise<string>;
14
15
  }
@@ -0,0 +1,8 @@
1
+ import { type IGraphqlAppModule } from 'app/graphql/graphqlApp';
2
+ import { type IDiscussionDomain } from 'domain/discussion/discussionDomain';
3
+ export type ICoreImportApp = IGraphqlAppModule;
4
+ interface IDeps {
5
+ 'core.domain.discussion': IDiscussionDomain;
6
+ }
7
+ export default function ({ 'core.domain.discussion': discussionDomain }: IDeps): ICoreImportApp;
8
+ export {};
@@ -23,3 +23,4 @@ export { default as userData } from './userDataApp';
23
23
  export { default as value } from './valueApp';
24
24
  export { default as versionProfile } from './versionProfileApp/versionProfileApp';
25
25
  export { default as view } from './viewApp';
26
+ export { default as discussion } from './discussionApp';
@@ -3,6 +3,7 @@ import { type IPermissionDomain } from 'domain/permission/permissionDomain';
3
3
  import { type IAppModule } from '_types/shared';
4
4
  import { PermissionTypes } from '../../../_types/permissions';
5
5
  import { type IGraphqlAppModule } from 'app/graphql/graphqlApp';
6
+ import { type GetSystemQueryContext } from '../../../utils/helpers/getSystemQueryContext';
6
7
  export interface IPluginPermission {
7
8
  name: string;
8
9
  type: PermissionTypes;
@@ -12,6 +13,7 @@ export type ICorePermissionApp = IAppModule & IGraphqlAppModule;
12
13
  interface IDeps {
13
14
  'core.domain.permission'?: IPermissionDomain;
14
15
  'core.domain.attribute'?: IAttributeDomain;
16
+ 'core.utils.getSystemQueryContext'?: GetSystemQueryContext;
15
17
  }
16
- export default function ({ 'core.domain.permission': permissionDomain, 'core.domain.attribute': attributeDomain, }?: IDeps): ICorePermissionApp;
18
+ export default function ({ 'core.domain.permission': permissionDomain, 'core.domain.attribute': attributeDomain, 'core.utils.getSystemQueryContext': getSystemQueryContext, }?: IDeps): ICorePermissionApp;
17
19
  export {};
@@ -0,0 +1,23 @@
1
+ import { type IDiscussionComment, type IPostDiscussionCommentParams } from '_types/discussion';
2
+ import { type IQueryInfos } from '_types/queryInfos';
3
+ import { type INotificationDomain } from 'domain/notification/notificationDomain';
4
+ import { type IRecordDomain } from 'domain/record/recordDomain';
5
+ import { type IValueDomain } from 'domain/value/valueDomain';
6
+ import { type IUserDomain } from 'domain/user/userDomain';
7
+ import { type i18n } from 'i18next';
8
+ import { type IConfig } from '_types/config';
9
+ export interface IDiscussionDomain {
10
+ postDiscussionComment(params: {
11
+ params?: IPostDiscussionCommentParams;
12
+ ctx: IQueryInfos;
13
+ }): Promise<IDiscussionComment>;
14
+ }
15
+ export interface IDiscussionDomainDeps {
16
+ 'core.domain.notification': INotificationDomain;
17
+ 'core.domain.record': IRecordDomain;
18
+ 'core.domain.value': IValueDomain;
19
+ 'core.domain.user': IUserDomain;
20
+ translator: i18n;
21
+ config: IConfig;
22
+ }
23
+ export default function ({ 'core.domain.notification': notificationDomain, 'core.domain.record': recordDomain, 'core.domain.value': valueDomain, 'core.domain.user': userDomain, translator, config, }: IDiscussionDomainDeps): IDiscussionDomain;
@@ -0,0 +1 @@
1
+ export { default } from './discussionDomain';
@@ -132,6 +132,7 @@ export interface IIsAllowedParams {
132
132
  }
133
133
  export interface IGetActionsByTypeParams {
134
134
  type: PermissionTypes;
135
+ ctx: IQueryInfos;
135
136
  applyOn?: string;
136
137
  skipApplyOn?: boolean;
137
138
  }
@@ -24,7 +24,7 @@ export interface IPermissionDomain {
24
24
  */
25
25
  getInheritedPermissions({ type, applyTo, action, userGroupId, permissionTreeTarget, ctx, }: IGetInheritedPermissionsParams): Promise<boolean>;
26
26
  isAllowed({ type, action, applyTo, target, ctx }: IIsAllowedParams): Promise<boolean>;
27
- getActionsByType(params: IGetActionsByTypeParams): ILabeledPermissionsAction[];
27
+ getActionsByType(params: IGetActionsByTypeParams): Promise<ILabeledPermissionsAction[]>;
28
28
  registerActions(type: PermissionTypes, actions: string[], applyOn?: string[]): void;
29
29
  isAdminOrSystemUser(ctx: IQueryInfos): boolean;
30
30
  }
@@ -14,7 +14,7 @@ import { type IRecord, type IRecordFilterLight, type IRecordIdentity } from '../
14
14
  import { type IAttributeDomain } from '../attribute/attributeDomain';
15
15
  import { type IRecordPermissionDomain } from '../permission/recordPermissionDomain';
16
16
  import { type SendRecordUpdateEventHelper } from './helpers/sendRecordUpdateEvent';
17
- import { type ICreateRecordResult, type IFindRecordParams } from './_types';
17
+ import { type ICreateRecordResult, type ICreateRecordValueError, type IFindRecordParams } from './_types';
18
18
  import { type IFormRepo } from 'infra/form/formRepo';
19
19
  import { type DeleteRecordHelper } from './helpers/deleteRecord';
20
20
  import { type CreateRecordHelper } from './helpers/createRecord';
@@ -22,6 +22,14 @@ import { type IElementAncestorsHelper } from 'domain/tree/helpers/elementAncesto
22
22
  import { type ILogger } from '@leav/logger';
23
23
  import { type FindRecordsHelper } from './helpers/findRecords';
24
24
  export declare const ATTRIBUTE_ACTIVE = "active";
25
+ export interface IDuplicateRecordRules {
26
+ attributesToDuplicate?: Array<{
27
+ attributeId: string;
28
+ overrideValueFn?: (id: string) => Promise<string | Array<string | {
29
+ valuesErrors: ICreateRecordValueError[];
30
+ }>>;
31
+ }>;
32
+ }
25
33
  export interface IRecordDomain {
26
34
  /**
27
35
  * Create empty record
@@ -101,6 +109,12 @@ export interface IRecordDomain {
101
109
  recordId: string;
102
110
  ctx: IQueryInfos;
103
111
  }): Promise<IRecord>;
112
+ duplicateRecords(params: {
113
+ libraryId: string;
114
+ recordIds: string[];
115
+ duplicateRules?: IDuplicateRecordRules;
116
+ ctx: IQueryInfos;
117
+ }): Promise<ICreateRecordResult[]>;
104
118
  }
105
119
  export interface IRecordDomainDeps {
106
120
  config: Config.IConfig;
@@ -1,5 +1,6 @@
1
1
  import { type IGlobalSettingsDomain } from 'domain/globalSettings/globalSettingsDomain';
2
2
  import { type IPermissionDomain } from 'domain/permission/permissionDomain';
3
+ import { type IRecordDomain } from 'domain/record/recordDomain';
3
4
  import { type i18n } from 'i18next';
4
5
  import { type IMailerService } from 'infra/mailer/mailerService';
5
6
  import { type IUserDataRepo } from 'infra/userData/userDataRepo';
@@ -25,6 +26,7 @@ export interface IUserDomain {
25
26
  export interface IUserDomainDeps {
26
27
  config: Config.IConfig;
27
28
  'core.domain.value': IValueDomain;
29
+ 'core.domain.record': IRecordDomain;
28
30
  'core.domain.permissions': IPermissionDomain;
29
31
  'core.infra.userData': IUserDataRepo;
30
32
  'core.domain.permission': IPermissionDomain;
@@ -36,5 +38,5 @@ export interface IUserDomainDeps {
36
38
  export declare enum UserCoreDataKeys {
37
39
  CONSULTED_APPS = "applications_consultation"
38
40
  }
39
- export default function ({ config, 'core.domain.value': valueDomain, 'core.infra.userData': userDataRepo, 'core.domain.permission': permissionDomain, 'core.infra.mailer.mailerService': mailerService, 'core.domain.globalSettings': globalSettingsDomain, 'core.utils': utils, translator, }: IUserDomainDeps): IUserDomain;
41
+ export default function ({ config, 'core.domain.value': valueDomain, 'core.domain.record': recordDomain, 'core.infra.userData': userDataRepo, 'core.domain.permission': permissionDomain, 'core.infra.mailer.mailerService': mailerService, 'core.domain.globalSettings': globalSettingsDomain, 'core.utils': utils, translator, }: IUserDomainDeps): IUserDomain;
40
42
  export {};
@@ -1,3 +1,8 @@
1
+ interface IAuthenticationErrorOptions {
2
+ retryAuthenticationFlow?: boolean;
3
+ }
1
4
  export default class AuthenticationError extends Error {
2
- constructor(message?: string);
5
+ readonly retryAuthenticationFlow: boolean;
6
+ constructor(message?: string, options?: IAuthenticationErrorOptions);
3
7
  }
8
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aristid/leav-types",
3
- "version": "1.5.1",
3
+ "version": "1.5.2-03b36f67",
4
4
  "description": "Shared Leav types",
5
5
  "scripts": {
6
6
  "tscheck": "",
@@ -14,7 +14,7 @@
14
14
  "license": "LGPL3",
15
15
  "repository": "https://github.com/leav-solutions/leav-engine",
16
16
  "dependencies": {
17
- "@leav/utils": "1.5.1",
17
+ "@leav/utils": "1.5.2",
18
18
  "@types/amqplib": "0.10.7",
19
19
  "@types/express": "5.0.0",
20
20
  "@types/jest": "29.5.14",