@rentman/rm-core 12.0.0 → 12.0.2
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.
- package/changelog.md +8 -0
- package/dist/rm-core.js +416 -347
- package/dist/rm-core.min.js +1 -1
- package/dist/types/src/classes/ChangesDelta.d.ts +1 -1
- package/dist/types/src/classes/ChangesDeltaBase.d.ts +3 -1
- package/dist/types/src/classes/ModuleChangesCompilation.d.ts +3 -4
- package/dist/types/src/classes/cache/AbstractCache.d.ts +7 -0
- package/dist/types/src/classes/cache/ItemHandlerBase.d.ts +8 -2
- package/dist/types/src/classes/cache/transaction/TransactionValidator.d.ts +2 -2
- package/dist/types/src/factories/ModuleChangesCompilationFactory.d.ts +3 -1
- package/package.json +1 -1
|
@@ -32,7 +32,7 @@ export declare class ChangesDelta extends ChangesDeltaBase {
|
|
|
32
32
|
* - If you want to set a parent set the proper field, you can't pass it as a separate object
|
|
33
33
|
*/
|
|
34
34
|
setItemCreated<ItemTypeType extends ApiEnumItemType, Fields extends Partial<FieldMap<ItemTypeType>>>(itemType: ItemTypeType, values: Fields): PromiseInterface<this>;
|
|
35
|
-
setItemUpdated<ItemTypeType extends ApiEnumItemType>(entry: ItemEntry<ItemTypeType>, fields: Partial<FieldMap<ItemTypeType>>, columnExpansionResult?: ColumnExpansionResult<ItemTypeType> | null, parent?: EntryParentNull, mode?: ChangesDeltaItemUpdateMode): this;
|
|
35
|
+
setItemUpdated<ItemTypeType extends ApiEnumItemType>(entry: ItemEntry<ItemTypeType>, fields: Partial<FieldMap<ItemTypeType>>, columnExpansionResult?: ColumnExpansionResult<ItemTypeType> | null, parent?: EntryParentNull, mode?: ChangesDeltaItemUpdateMode, didChangeAnyFieldOnParentTransaction?: boolean, previous?: FieldMap<ItemTypeType> | null): this;
|
|
36
36
|
setItemDeleted(deleted: ChangesDeltaItemDeleteDelta): this;
|
|
37
37
|
setItemsDeleted(deleted: ChangesDeltaItemDeleteDelta[]): this;
|
|
38
38
|
/**
|
|
@@ -20,7 +20,9 @@ export declare type ChangesDeltaItemUpdateDelta<ItemTypeType extends ApiEnumItem
|
|
|
20
20
|
fields: FieldMap<ItemTypeType>;
|
|
21
21
|
parent: EntryParentNull;
|
|
22
22
|
};
|
|
23
|
+
previous: FieldMap<ItemTypeType> | null;
|
|
23
24
|
mode: ChangesDeltaItemUpdateMode;
|
|
25
|
+
didChangeAnyField: boolean;
|
|
24
26
|
};
|
|
25
27
|
export declare abstract class ChangesDeltaBase {
|
|
26
28
|
protected itemEntryService: ItemEntryService;
|
|
@@ -78,7 +80,7 @@ export declare abstract class ChangesDeltaBase {
|
|
|
78
80
|
_setQueryResult(itemType: ApiEnumItemType, queryString: string, itemIds: ItemId[] | {
|
|
79
81
|
[itemId: string]: true;
|
|
80
82
|
}): this;
|
|
81
|
-
setItemUpdated<ItemTypeType extends ApiEnumItemType>(entry: ItemEntry<ItemTypeType>, fields: Partial<FieldMap<ItemTypeType>>, columnExpansionResult?: ColumnExpansionResult<ItemTypeType> | null, parent?: EntryParentNull, mode?: ChangesDeltaItemUpdateMode): this;
|
|
83
|
+
setItemUpdated<ItemTypeType extends ApiEnumItemType>(entry: ItemEntry<ItemTypeType>, fields: Partial<FieldMap<ItemTypeType>>, columnExpansionResult?: ColumnExpansionResult<ItemTypeType> | null, parent?: EntryParentNull, mode?: ChangesDeltaItemUpdateMode, didChangeAnyFieldOnParentTransaction?: boolean, previous?: FieldMap<ItemTypeType> | null): this;
|
|
82
84
|
setItemRestored<ItemTypeType extends ApiEnumItemType>(itemEntry: ItemEntry<ItemTypeType>, transactionItemEntryChanges: FieldMap<ItemTypeType>): void;
|
|
83
85
|
isEmpty(): boolean;
|
|
84
86
|
}
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import { ApiEnumItemType, ItemId } from '@rentman/backend-types';
|
|
2
|
-
import { ApiRequestItemMap, TransactionCache } from '../internal';
|
|
2
|
+
import { ApiRequestItemMap, LinkTreeServiceInterface, TransactionCache } from '../internal';
|
|
3
3
|
export declare type ModuleChangesCompilationResult = {
|
|
4
4
|
itemType: ApiEnumItemType;
|
|
5
5
|
itemId: ItemId;
|
|
6
6
|
items: ApiRequestItemMap;
|
|
7
7
|
};
|
|
8
8
|
export declare class ModuleChangesCompilation {
|
|
9
|
+
private linkTreeService;
|
|
9
10
|
private transaction;
|
|
10
|
-
parentMap: any;
|
|
11
11
|
destination: ApiRequestItemMap;
|
|
12
|
-
constructor(transaction: TransactionCache);
|
|
12
|
+
constructor(linkTreeService: LinkTreeServiceInterface, transaction: TransactionCache);
|
|
13
13
|
process(): ModuleChangesCompilationResult;
|
|
14
|
-
private createParentMap;
|
|
15
14
|
private processItems;
|
|
16
15
|
private processItem;
|
|
17
16
|
private getItemsByParent;
|
|
@@ -64,6 +64,13 @@ export declare abstract class AbstractCache {
|
|
|
64
64
|
abstract getParent<ItemTypeType extends ApiEnumItemType = any>(itemEntry: ItemEntry<ItemTypeType>, fromInitial?: boolean, providedFields?: FieldMap<ItemTypeType>): EntryParentNull;
|
|
65
65
|
abstract getLocalItemEntryChangesTuple<ItemTypeType extends ApiEnumItemType>(itemEntryId: ItemEntry<ItemTypeType>['id']): ItemEntryChangesTuple<ItemTypeType>;
|
|
66
66
|
abstract applyChangesDelta(changesDelta: ChangesDelta): PromiseInterface<ChangesDeltaResult>;
|
|
67
|
+
/**
|
|
68
|
+
* Differs from {@link getParent getParent} that it only does minimal field lookups (but you cannot provide it with fields) instead of doing {@link ItemHandlerBase.collectFields collectFields}
|
|
69
|
+
* todo: clean this up some time (merge the 2 functions)
|
|
70
|
+
*
|
|
71
|
+
* @param itemEntry
|
|
72
|
+
*/
|
|
73
|
+
getParentFast(itemEntry: ItemEntry): EntryParentNull;
|
|
67
74
|
protected getParentFromFields<ItemTypeType extends ApiEnumItemType = any>(itemEntry: ItemEntry<ItemTypeType>, fields?: FieldMap<ItemTypeType>): EntryParentNull;
|
|
68
75
|
/**
|
|
69
76
|
* @description
|
|
@@ -11,10 +11,16 @@ export interface ItemEntryChangesTuple<ItemTypeType extends ApiEnumItemType> {
|
|
|
11
11
|
}
|
|
12
12
|
export declare type ProcessItemEntryChangesResult<ItemTypeType extends ApiEnumItemType> = {
|
|
13
13
|
status: ItemCacheStatus.NO_CHANGES | ItemCacheStatus.NOT_CACHED;
|
|
14
|
-
previous:
|
|
14
|
+
previous: {
|
|
15
|
+
rollback: null;
|
|
16
|
+
complete: null | FieldMap<ItemTypeType>;
|
|
17
|
+
};
|
|
15
18
|
} | {
|
|
16
19
|
status: ItemCacheStatus.CACHED;
|
|
17
|
-
previous:
|
|
20
|
+
previous: {
|
|
21
|
+
rollback: Partial<FieldMap<ItemTypeType>>;
|
|
22
|
+
complete: null | FieldMap<ItemTypeType>;
|
|
23
|
+
};
|
|
18
24
|
};
|
|
19
25
|
export declare abstract class ItemHandlerBase {
|
|
20
26
|
protected columnUtil: ColumnUtil;
|
|
@@ -24,9 +24,9 @@ export declare abstract class TransactionValidator {
|
|
|
24
24
|
* Will be called whenever an item is changed, allows you to set errors on the transaction
|
|
25
25
|
* @param itemEntry
|
|
26
26
|
* @param fields
|
|
27
|
-
* @param previous
|
|
27
|
+
* @param previous Previous contain only fields changed on this transaction
|
|
28
28
|
*/
|
|
29
|
-
abstract validateItem<ItemTypeType extends ApiEnumItemType>(itemEntry: ItemEntry<ItemTypeType>, fields: FieldMap<ItemTypeType>, previous: FieldMap<ItemTypeType
|
|
29
|
+
abstract validateItem<ItemTypeType extends ApiEnumItemType>(itemEntry: ItemEntry<ItemTypeType>, fields: FieldMap<ItemTypeType>, previous: Partial<FieldMap<ItemTypeType>>): void;
|
|
30
30
|
protected setGlobalError(key: string, isInvalid: boolean | PromiseInterface<boolean>, saveButtonErrorTranslationFn: () => string, level: TransactionErrorLevel): void;
|
|
31
31
|
protected setItemError(itemEntryId: ItemEntry['id'], columnId: string, errorKey: string, isInvalid: boolean | PromiseInterface<boolean>, fieldErrorTranslationFn: () => string, saveButtonErrorTranslationFn: () => string, level: TransactionErrorLevel): void;
|
|
32
32
|
private getHash;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { ModuleChangesCompilation, TransactionCache } from '../internal';
|
|
1
|
+
import { LinkTreeServiceInterface, ModuleChangesCompilation, TransactionCache } from '../internal';
|
|
2
2
|
export declare class ModuleChangesCompilationFactory {
|
|
3
|
+
private linkTreeService;
|
|
4
|
+
constructor(linkTreeService: LinkTreeServiceInterface);
|
|
3
5
|
construct(transaction: TransactionCache): ModuleChangesCompilation;
|
|
4
6
|
}
|