@aristid/leav-types 1.2.1-9b5b2ec3 → 1.3.0-7deb6b23

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.
@@ -5,6 +5,7 @@ export declare namespace server {
5
5
  let port: number;
6
6
  let publicUrl: string;
7
7
  let wsUrl: string;
8
+ let basePath: string;
8
9
  let allowIntrospection: boolean;
9
10
  let uploadLimit: string;
10
11
  let supportEmail: string;
@@ -70,7 +71,7 @@ export declare namespace mailer {
70
71
  export { auth_1 as auth };
71
72
  }
72
73
  export declare namespace bugsnag {
73
- let enable_1: string | boolean;
74
+ let enable_1: boolean;
74
75
  export { enable_1 as enable };
75
76
  export let apiKey: string;
76
77
  export let appVersion: string;
@@ -1,5 +1,4 @@
1
1
  export namespace server {
2
- let publicUrl: string;
3
2
  let allowIntrospection: boolean;
4
3
  }
5
4
  export namespace logs {
@@ -45,6 +45,7 @@ export interface IServer {
45
45
  host: string;
46
46
  port: number;
47
47
  publicUrl: string;
48
+ basePath: string;
48
49
  allowIntrospection: boolean;
49
50
  wsUrl: string;
50
51
  uploadLimit: number | string;
@@ -10,8 +10,10 @@ export interface IRecord {
10
10
  modified_at?: number;
11
11
  modified_by?: string;
12
12
  active?: boolean;
13
+ [CORE_IN_CREATION_BY]?: string;
13
14
  [attributeName: string]: any;
14
15
  }
16
+ export declare const CORE_IN_CREATION_BY = "__in_creation_by__";
15
17
  export declare enum Operator {
16
18
  AND = "AND",
17
19
  OR = "OR",
@@ -11,6 +11,7 @@ import { type ValidateRequestTokenFunc } from '../helpers/validateRequestToken';
11
11
  import { type IAuthApp } from '../auth/authApp';
12
12
  import { type IGlobalSettingsDomain } from '../../domain/globalSettings/globalSettingsDomain';
13
13
  import { type IServerRouteAppModule } from 'interface/server';
14
+ import { type IConfig } from '_types/config';
14
15
  export type IApplicationApp = IGraphqlAppModule & IServerRouteAppModule;
15
16
  export interface IApplicationAppDeps {
16
17
  'core.app.graphql': IGraphqlApp;
@@ -25,6 +26,6 @@ export interface IApplicationAppDeps {
25
26
  'core.domain.globalSettings': IGlobalSettingsDomain;
26
27
  'core.utils.logger': winston.Winston;
27
28
  'core.utils': IUtils;
28
- config: any;
29
+ config: IConfig;
29
30
  }
30
31
  export default function ({ 'core.app.graphql': graphqlApp, 'core.app.auth': authApp, 'core.app.helpers.initQueryContext': initQueryContext, 'core.app.helpers.validateRequestToken': validateRequestToken, 'core.app.core.subscriptionsHelper': subscriptionsHelper, 'core.domain.application': applicationDomain, 'core.domain.permission': permissionDomain, 'core.domain.record': recordDomain, 'core.domain.eventsManager': eventsManagerDomain, 'core.domain.globalSettings': globalSettings, 'core.utils.logger': logger, 'core.utils': utils, config }: IApplicationAppDeps): IApplicationApp;
@@ -5,7 +5,7 @@ import { type GraphQLScalarType } from 'graphql';
5
5
  import { type i18n } from 'i18next';
6
6
  import { type IAppModule } from '_types/shared';
7
7
  import { type ISystemTranslation } from '_types/systemTranslation';
8
- import { type IGraphqlAppModule, type IGraphqlApp } from '../graphql/graphqlApp';
8
+ import { type IGraphqlAppModule } from '../graphql/graphqlApp';
9
9
  export interface ICoreApp extends IAppModule, IGraphqlAppModule {
10
10
  filterSysTranslationField(fieldData: ISystemTranslation, requestedLangs: string[]): ISystemTranslation | null;
11
11
  initPubSubEventsConsumer(): Promise<void>;
@@ -13,11 +13,10 @@ export interface ICoreApp extends IAppModule, IGraphqlAppModule {
13
13
  export interface ICoreAppDeps {
14
14
  'core.domain.core': ICoreDomain;
15
15
  'core.domain.eventsManager': IEventsManagerDomain;
16
- 'core.app.graphql': IGraphqlApp;
17
16
  'core.app.graphql.customScalars.systemTranslation': ISystemTranslationGenerator;
18
17
  'core.app.graphql.customScalars.dateTime': GraphQLScalarType;
19
18
  'core.app.graphql.customScalars.any': GraphQLScalarType;
20
19
  config: any;
21
20
  translator: i18n;
22
21
  }
23
- export default function ({ 'core.domain.core': coreDomain, 'core.domain.eventsManager': eventsManagerDomain, 'core.app.graphql': graphqlApp, 'core.app.graphql.customScalars.systemTranslation': systemTranslation, 'core.app.graphql.customScalars.dateTime': DateTime, 'core.app.graphql.customScalars.any': Any, config, translator }: ICoreAppDeps): ICoreApp;
22
+ export default function ({ 'core.domain.core': coreDomain, 'core.domain.eventsManager': eventsManagerDomain, 'core.app.graphql.customScalars.systemTranslation': systemTranslation, 'core.app.graphql.customScalars.dateTime': DateTime, 'core.app.graphql.customScalars.any': Any, config, translator }: ICoreAppDeps): ICoreApp;
@@ -1,10 +1,8 @@
1
- import { type AwilixContainer } from 'awilix';
2
1
  import { type StoreUploadFileFunc } from 'domain/helpers/storeUploadFile';
3
2
  import { type IImportDomain } from 'domain/import/importDomain';
4
- import { type IDbUtils } from 'infra/db/dbUtils';
5
3
  import { type IUtils } from 'utils/utils';
6
4
  import type * as Config from '_types/config';
7
- import { type IGraphqlAppModule, type IGraphqlApp } from '../graphql/graphqlApp';
5
+ import { type IGraphqlAppModule } from '../graphql/graphqlApp';
8
6
  export interface ICoreImportApp extends IGraphqlAppModule {
9
7
  importConfig(filepath: string, clear: boolean): Promise<void>;
10
8
  importData(filepath: string): Promise<void>;
@@ -12,11 +10,8 @@ export interface ICoreImportApp extends IGraphqlAppModule {
12
10
  interface IDeps {
13
11
  'core.domain.import': IImportDomain;
14
12
  'core.domain.helpers.storeUploadFile': StoreUploadFileFunc;
15
- 'core.infra.db.dbUtils': IDbUtils;
16
13
  'core.utils': IUtils;
17
- 'core.depsManager': AwilixContainer;
18
- 'core.app.graphql': IGraphqlApp;
19
14
  config: Config.IConfig;
20
15
  }
21
- export default function ({ 'core.domain.import': importDomain, 'core.domain.helpers.storeUploadFile': storeUploadFile, 'core.utils': utils, 'core.depsManager': depsManager, 'core.app.graphql': graphqlApp, 'core.infra.db.dbUtils': dbUtils, config }: IDeps): ICoreImportApp;
16
+ export default function ({ 'core.domain.import': importDomain, 'core.domain.helpers.storeUploadFile': storeUploadFile, 'core.utils': utils, config }: IDeps): ICoreImportApp;
22
17
  export {};
@@ -1,10 +1,8 @@
1
- import type * as Config from '_types/config';
2
1
  import { type IUtils } from 'utils/utils';
3
2
  import { type IQueryInfos } from '_types/queryInfos';
4
3
  export type CreateDirectoryFunc = (name: string, path: string, ctx: IQueryInfos) => Promise<void>;
5
4
  interface IDeps {
6
- config: Config.IConfig;
7
5
  'core.utils': IUtils;
8
6
  }
9
- export default function ({ config, 'core.utils': utils }: IDeps): (name: string, path: string, ctx: IQueryInfos) => Promise<void>;
7
+ export default function ({ 'core.utils': utils }: IDeps): (name: string, path: string, ctx: IQueryInfos) => Promise<void>;
10
8
  export {};
@@ -5,3 +5,4 @@ export { default as permissionsByActions } from './permissionsByActions';
5
5
  export { default as reducePermissionsArray } from './reducePermissionsArray';
6
6
  export { default as simplePermission } from './simplePermission';
7
7
  export { default as treeBasedPermissions } from './treeBasedPermissions';
8
+ export { default as recordInCreationByPass } from './recordInCreationBypass';
@@ -0,0 +1,6 @@
1
+ import { type IRecord } from '../../../_types/record';
2
+ import { type IQueryInfos } from '../../../_types/queryInfos';
3
+ export interface IRecordInCreationByPassHelper {
4
+ recordInCreationByPass: (record: IRecord, ctx: IQueryInfos) => boolean;
5
+ }
6
+ export default function (): IRecordInCreationByPassHelper;
@@ -7,6 +7,8 @@ import { type IDefaultPermissionHelper } from './helpers/defaultPermission';
7
7
  import { type IPermissionByUserGroupsHelper } from './helpers/permissionByUserGroups';
8
8
  import { type ITreeBasedPermissionHelper } from './helpers/treeBasedPermissions';
9
9
  import { type IGetRecordAttributeHeritedPermissionsParams as IGetRecordAttributeInheritedPermissionsParams } from './_types';
10
+ import { type IRecordRepo } from '../../infra/record/recordRepo';
11
+ import { type IRecordInCreationByPassHelper } from './helpers/recordInCreationBypass';
10
12
  export interface IRecordAttributePermissionDomain {
11
13
  getRecordAttributePermission(action: RecordAttributePermissionsActions, userGroupId: string, attributeId: string, recordLibrary: string, recordId: string, ctx: IQueryInfos): Promise<boolean>;
12
14
  getInheritedRecordAttributePermission(params: IGetRecordAttributeInheritedPermissionsParams, ctx: IQueryInfos): Promise<boolean>;
@@ -16,7 +18,9 @@ export interface IRecordAttributePermissionDomainDeps {
16
18
  'core.domain.permission.helpers.treeBasedPermissions': ITreeBasedPermissionHelper;
17
19
  'core.domain.permission.helpers.permissionByUserGroups': IPermissionByUserGroupsHelper;
18
20
  'core.domain.permission.helpers.defaultPermission': IDefaultPermissionHelper;
21
+ 'core.domain.permission.helpers.recordInCreationByPass': IRecordInCreationByPassHelper;
19
22
  'core.domain.attribute': IAttributeDomain;
20
23
  'core.infra.value': IValueRepo;
24
+ 'core.infra.record': IRecordRepo;
21
25
  }
22
26
  export default function (deps: IRecordAttributePermissionDomainDeps): IRecordAttributePermissionDomain;
@@ -5,8 +5,10 @@ import { type IDefaultPermissionHelper } from './helpers/defaultPermission';
5
5
  import { type IPermissionByUserGroupsHelper } from './helpers/permissionByUserGroups';
6
6
  import { type ITreeBasedPermissionHelper } from './helpers/treeBasedPermissions';
7
7
  import { type ILibraryPermissionDomain } from './libraryPermissionDomain';
8
- import { type IGetInheritedRecordPermissionParams, type IGetRecordPermissionParams, type IEstimateTreeValueRecordPermissionParams } from './_types';
8
+ import { type IEstimateTreeValueRecordPermissionParams, type IGetInheritedRecordPermissionParams, type IGetRecordPermissionParams } from './_types';
9
9
  import { type ITreeRepo } from '../../infra/tree/treeRepo';
10
+ import { type IRecordRepo } from '../../infra/record/recordRepo';
11
+ import { type IRecordInCreationByPassHelper } from './helpers/recordInCreationBypass';
10
12
  export interface IRecordPermissionDomain {
11
13
  getRecordPermission(params: IGetRecordPermissionParams): Promise<boolean>;
12
14
  getInheritedRecordPermission(params: IGetInheritedRecordPermissionParams): Promise<boolean>;
@@ -17,9 +19,11 @@ export interface IRecordPermissionDomainDeps {
17
19
  'core.domain.permission.helpers.treeBasedPermissions': ITreeBasedPermissionHelper;
18
20
  'core.domain.permission.helpers.permissionByUserGroups': IPermissionByUserGroupsHelper;
19
21
  'core.domain.permission.helpers.defaultPermission': IDefaultPermissionHelper;
22
+ 'core.domain.permission.helpers.recordInCreationByPass': IRecordInCreationByPassHelper;
20
23
  'core.domain.attribute': IAttributeDomain;
21
24
  'core.domain.helpers.getCoreEntityById': GetCoreEntityByIdFunc;
22
25
  'core.infra.value': IValueRepo;
23
26
  'core.infra.tree': ITreeRepo;
27
+ 'core.infra.record': IRecordRepo;
24
28
  }
25
29
  export default function (deps: IRecordPermissionDomainDeps): IRecordPermissionDomain;
@@ -5,7 +5,7 @@ import { type IConfig } from '_types/config';
5
5
  import { type IList, type IPaginationParams, type ISortParams } from '_types/list';
6
6
  import { type IQueryInfos } from '_types/queryInfos';
7
7
  import { type IKeyValue } from '_types/shared';
8
- import { type ICachesService } from '../../infra/cache/cacheService';
8
+ import { type ICachesService } from '../cache/cacheService';
9
9
  import { type IDbService } from './dbService';
10
10
  export declare const MIGRATIONS_COLLECTION_NAME = "core_db_migrations";
11
11
  export type CustomFilterConditionsFunc = (filterKey: string, filterVal: string | boolean | string[], strictFilters: boolean) => GeneratedAqlQuery;
@@ -25,7 +25,6 @@ export interface IRecordRepo {
25
25
  updateRecord({ libraryId, recordData, ctx }: {
26
26
  libraryId: string;
27
27
  recordData: IRecord;
28
- mergeObjects?: boolean;
29
28
  ctx: IQueryInfos;
30
29
  }): Promise<{
31
30
  old: IRecord;
@@ -3,7 +3,7 @@ import { type IAuthApp } from 'app/auth/authApp';
3
3
  import { type ICoreApp } from 'app/core/coreApp';
4
4
  import { type IGraphqlApp } from 'app/graphql/graphqlApp';
5
5
  import { type AwilixContainer } from 'awilix';
6
- import { type Express } from 'express';
6
+ import express from 'express';
7
7
  import { type IUtils } from 'utils/utils';
8
8
  import type * as winston from 'winston';
9
9
  import { type IConfig } from '_types/config';
@@ -18,7 +18,7 @@ export interface IServerRouteAppModule {
18
18
  /**
19
19
  * @param app Express instance, can be used to extend the app
20
20
  */
21
- registerRoute(app: Express): void;
21
+ registerRoute(app: express.Router): void;
22
22
  }
23
23
  interface IDeps {
24
24
  config?: IConfig;
@@ -82,9 +82,11 @@ export interface IUtils {
82
82
  getGlobalSettingsCacheKey(): string;
83
83
  generateExplicitValidationError<T>(field: keyof T, message: ErrorFieldDetailMessage, lang?: string): ValidationError<T>;
84
84
  deleteFile(path: string): Promise<void>;
85
+ fileExists(path: string): Promise<boolean>;
85
86
  getUnixTime(): number;
86
87
  getFileExtension(filename: string): string | null;
87
88
  getProcessIdentifier(): string;
89
+ getPreviewUrl(relativeUrl: string): string;
88
90
  getPreviewsAttributeName(libraryId: string): string;
89
91
  getPreviewsStatusAttributeName(libraryId: string): string;
90
92
  getPreviewAttributesSettings(library: ILibrary): IPreviewAttributesSettings;
@@ -0,0 +1,18 @@
1
+ export interface ILoggerConfig {
2
+ /**
3
+ * Log level (error, warn, info, log, verbose, debug, silly)
4
+ * @default info
5
+ */
6
+ level: string;
7
+ /**
8
+ * If transport is file, destination file path
9
+ */
10
+ destinationFile?: string;
11
+ /**
12
+ * If true, use json format for logging, both in console and file
13
+ * Default: false (plain text)
14
+ */
15
+ useJsonFormat?: boolean;
16
+ }
17
+ export declare function envToBool(value: string, defaultValue?: boolean): boolean;
18
+ export declare const loggerConfig: ILoggerConfig;
@@ -0,0 +1,2 @@
1
+ export * from './logger';
2
+ export type { ILoggerConfig } from './config';
@@ -0,0 +1,5 @@
1
+ import * as winston from 'winston';
2
+ import { type ILoggerConfig } from './config';
3
+ export type ILogger = Pick<typeof winston, 'error' | 'warn' | 'info' | 'log' | 'verbose' | 'debug' | 'silly'>;
4
+ export declare function configureLogger(config: ILoggerConfig): void;
5
+ export declare const logger: ILogger;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aristid/leav-types",
3
- "version": "1.2.1-9b5b2ec3",
3
+ "version": "1.3.0-7deb6b23",
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.2.1",
17
+ "@leav/utils": "1.3.0",
18
18
  "@types/amqplib": "0.10.7",
19
19
  "@types/express": "5.0.0",
20
20
  "@types/jest": "29.5.14",
@@ -1 +0,0 @@
1
- export declare const getPreviewUrl: () => string;