@rentman/rm-core 2.2.0 → 2.3.0

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.
@@ -19,6 +19,7 @@ import { QueryService } from '../../QueryService';
19
19
  import { TemplateCache } from '../../TemplateCache';
20
20
  import { AbstractCache } from '../AbstractCache';
21
21
  import { ServerCache } from '../server/ServerCache';
22
+ import { TransactionEventHandler } from './TransactionEventHandler';
22
23
  declare type EditResourceLinks<ItemTypeType extends ItemType> = {
23
24
  main: EditResource<ItemTypeType>;
24
25
  linked: ItemResourcesItemTypeMap;
@@ -50,6 +51,7 @@ export declare class TransactionCache extends AbstractCache {
50
51
  [itemEntryId: string]: {
51
52
  [columnId: string]: {
52
53
  [errorKey: string]: {
54
+ fieldString: string;
53
55
  string: string;
54
56
  level: TransactionErrorLevel;
55
57
  };
@@ -94,9 +96,9 @@ export declare class TransactionCache extends AbstractCache {
94
96
  readonly parent: AbstractCache;
95
97
  readonly itemHandler: TransactionItemHandler;
96
98
  readonly collectionHandler: TransactionCollectionHandler;
97
- private readonly eventHandler;
99
+ readonly eventHandler: TransactionEventHandler;
100
+ private readonly validator?;
98
101
  private changesInterval;
99
- private validator?;
100
102
  constructor(core: RmCore, columnCache: ColumnCache, requestBufferManager: RequestBufferManager, requestColumnExpansionFactory: RequestColumnExpansionFactory, queryMatcherFactory: QueryMatcherFactory, authInterface: AuthInterface, changesDeltaFactory: ChangesDeltaFactory, lockService: LockService, moduleChangesCompilationFactory: ModuleChangesCompilationFactory, collectionResourceFactory: CollectionResourceFactory, itemResourceFactory: ItemResourceFactory, templateCache: TemplateCache, itemCacheFactory: ItemCacheFactory, collectionCacheFactory: CollectionCacheFactory, errorHandler: ErrorHandlerInterface, exceptionHandler: ExceptionHandlerInterface, promiseService: PromiseLibraryInterface, apiRequestService: ApiRequestService, columnExpansionFactory: ColumnExpansionFactory, columnHandler: ColumnHandler, columnSetFactory: ColumnSetFactory, columnSubsetCacheFactory: ColumnSubsetCacheFactory, columnUtil: ColumnUtil, itemEntryFactory: ItemEntryFactory, itemEntryService: ItemEntryService, keyService: KeyService, collectionEntryFactory: CollectionEntryFactory, collectionEntryService: CollectionEntryService, collectionMatcherFactory: CollectionMatcherFactory, queryParserFactory: QueryParserFactory, queryService: QueryService, apiFormatter: ApiFormatter, linkTreeService: LinkTreeServiceInterface, changesDeltaService: ItemCreateService, parent: AbstractCache,
101
103
  /**
102
104
  * @description
@@ -111,13 +113,13 @@ export declare class TransactionCache extends AbstractCache {
111
113
  * Should only be called by {@link TransactionValidator TransactionValidator}
112
114
  * @internal
113
115
  */
114
- _setGlobalError(key: string, isInvalid: boolean, errorTranslation: string, level: TransactionErrorLevel): void;
116
+ _setGlobalError(key: string, isInvalid: boolean, saveButtonErrorTranslationFn: () => string, level: TransactionErrorLevel): void;
115
117
  /**
116
118
  * @description
117
119
  * Should only be called by {@link TransactionValidator TransactionValidator}
118
120
  * @internal
119
121
  */
120
- _setItemError(itemEntryId: ItemEntry['id'], columnId: string, errorKey: string, isInvalid: boolean, errorTranslation: string, level: TransactionErrorLevel): void;
122
+ _setItemError(itemEntryId: ItemEntry['id'], columnId: string, errorKey: string, isInvalid: boolean, fieldErrorTranslationFn: () => string, saveButtonErrorTranslationFn: () => string, level: TransactionErrorLevel): void;
121
123
  /**
122
124
  * @internal
123
125
  */
@@ -1,10 +1,15 @@
1
1
  import { ErrorHandlerInterface, ExceptionHandlerInterface, PromiseLibraryInterface } from '../../../interfaces';
2
+ import { ItemEntry } from '../../../models';
2
3
  import { ItemIdConversionMap, PromiseInterface } from '../../../types';
3
- import { TransactionCache } from './TransactionCache';
4
+ import { TransactionCache, TransactionErrorLevel } from './TransactionCache';
4
5
  export declare type TransactionCacheCallbackCondition = 'always' | 'onClose' | 'skipOnClose';
5
6
  export declare type TransactionCacheCallbackType = {
6
7
  onBeforeSave: (transaction: TransactionCache) => any;
7
8
  onSaveSuccess: (transaction: TransactionCache, conversionMap: ItemIdConversionMap) => any;
9
+ onSetItemError: (itemEntryId: ItemEntry['id'], columnId: string, key: string) => void;
10
+ onClearItemError: (itemEntryId: ItemEntry['id'], columnId: string, key: string) => void;
11
+ onSetGlobalError: (key: string, level: TransactionErrorLevel) => void;
12
+ onClearGlobalError: (key: string) => void;
8
13
  };
9
14
  export declare class TransactionEventHandler {
10
15
  private errorHandler;
@@ -22,7 +22,7 @@ export declare abstract class TransactionValidator {
22
22
  * @param previous
23
23
  */
24
24
  abstract validateItem<ItemTypeType extends ItemType>(itemEntry: ItemEntry<ItemTypeType>, fields: FieldMap<ItemTypeType>, previous: FieldMap<ItemTypeType>): void;
25
- protected setGlobalError(key: string, isInvalid: boolean | PromiseInterface<boolean>, errorTranslation: string, level: TransactionErrorLevel): void;
26
- protected setItemError(itemEntryId: ItemEntry['id'], columnId: string, errorKey: string, isInvalid: boolean | PromiseInterface<boolean>, errorTranslation: string, level: TransactionErrorLevel): void;
25
+ protected setGlobalError(key: string, isInvalid: boolean | PromiseInterface<boolean>, saveButtonErrorTranslationFn: () => string, level: TransactionErrorLevel): void;
26
+ protected setItemError(itemEntryId: ItemEntry['id'], columnId: string, errorKey: string, isInvalid: boolean | PromiseInterface<boolean>, fieldErrorTranslationFn: () => string, saveButtonErrorTranslationFn: () => string, level: TransactionErrorLevel): void;
27
27
  private getRandomId;
28
28
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rentman/rm-core",
3
- "version": "2.2.0",
3
+ "version": "2.3.0",
4
4
  "description": "Rentman core functionalities",
5
5
  "main": "./dist/rm-core.js",
6
6
  "types": "./dist/src/index.d.ts",