@rentman/rm-core 1.1.18 → 1.1.19
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
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
#Changelog
|
|
2
2
|
Contains new features, breaking changes and their reasoning
|
|
3
3
|
|
|
4
|
+
## v1.1.19
|
|
5
|
+
- **Breaking:** Renamed `getCurrentChanges` to `getModuleChanges` in the `ItemAdministrator` class. Added optional
|
|
6
|
+
`localCache` parameter.
|
|
7
|
+
|
|
8
|
+
### Local cache callback refactoring
|
|
9
|
+
- Removed `onSaveWithoutClosing` event.
|
|
10
|
+
- Added `condition` parameter to `onBeforeSave` and `onSaveSuccess` (possible values are `always`, `onClose` or
|
|
11
|
+
`skipOnClose`, defaults to `always`). Callbacks registered with `condition: always` will get executed before other
|
|
12
|
+
callbacks.
|
|
13
|
+
- Pass the local cache itself to all registered callback functions. Pass the item ID conversion map as second argument
|
|
14
|
+
to `onSaveSuccess` callback functions.
|
|
15
|
+
|
|
4
16
|
## v1.1.18
|
|
5
17
|
- Calling `expand` on a `CollectionEntry` manually no longer defers the collection entry.
|
|
6
18
|
- The `batchFetch` and `batchExpand` functions in the `CollectionHandler` class now properly defer and resolve the
|
|
@@ -2,7 +2,7 @@ import { CollectionCache, CollectionEntryService, CollectionHandler, CollectionM
|
|
|
2
2
|
import { CollectionMatcherFactory, ColumnSetFactory, LocalCacheFactory, ModuleChangesCompilationFactory } from '../factories';
|
|
3
3
|
import { ApiRequestServiceInterface, AuthInterface, ErrorHandlerInterface, LocalCacheManagerInterface, PromiseInterface } from '../interfaces';
|
|
4
4
|
import { CollectionEntry, CollectionResource, ItemEntry, ItemResource } from '../models';
|
|
5
|
-
import { CollectionEntryParentIdMap, CollectionResourceParentIdMap, CreateRequestParameterMap, ItemDefinition, ItemId, ItemIdConversionMap, ItemOptions, ItemResourceItemTypeMap, ItemType, TemplateResponseItemEntryMap, TemplateResponseLinkedItemEntryMap } from '../types';
|
|
5
|
+
import { CollectionEntryParentIdMap, CollectionResourceParentIdMap, CreateRequestParameterMap, ItemDefinition, ItemId, ItemIdConversionMap, ItemOptions, ItemResourceItemTypeMap, ItemType, LocalCacheCallbackCondition, OnSaveCallback, TemplateResponseItemEntryMap, TemplateResponseLinkedItemEntryMap } from '../types';
|
|
6
6
|
export declare class ItemAdministrator {
|
|
7
7
|
private apiRequestService;
|
|
8
8
|
private authInterface;
|
|
@@ -73,7 +73,7 @@ export declare class ItemAdministrator {
|
|
|
73
73
|
saveCurrentLocalCache(closeTab?: boolean, parameters?: CreateRequestParameterMap, breakupByParent?: boolean, onAfterCreateCallback?: (conversionMap: ItemIdConversionMap) => void): any;
|
|
74
74
|
getCurrentCollections(): CollectionCache;
|
|
75
75
|
getCurrentItems(): ItemCache;
|
|
76
|
-
|
|
76
|
+
getModuleChanges(localCache?: LocalCache): {
|
|
77
77
|
itemType: string;
|
|
78
78
|
itemId: number;
|
|
79
79
|
items: any;
|
|
@@ -90,7 +90,6 @@ export declare class ItemAdministrator {
|
|
|
90
90
|
updateItemIdMap(collectionMap: any, conversionMap: any): void;
|
|
91
91
|
createCollectionResource(collectionEntry: CollectionEntry, resourceOptions: any, processOptions?: boolean): CollectionResource;
|
|
92
92
|
createItemResource(itemEntry: ItemEntry, options: any, isRoot: boolean): ItemResource;
|
|
93
|
-
onBeforeSave(key: string, callback: any): () => void;
|
|
94
|
-
onSaveSuccess(key: string, callback:
|
|
95
|
-
onSaveWithoutClosing(key: string, callback: any): () => void;
|
|
93
|
+
onBeforeSave(key: string, callback: (localCache: LocalCache) => any, condition?: LocalCacheCallbackCondition): () => void;
|
|
94
|
+
onSaveSuccess(key: string, callback: OnSaveCallback, condition?: LocalCacheCallbackCondition): () => void;
|
|
96
95
|
}
|
|
@@ -2,7 +2,7 @@ import { CollectionCache, ItemCache, ItemResourceService, LockService } from '..
|
|
|
2
2
|
import { ChangesProcessorFactory, CollectionCacheFactory, CollectionResourceFactory, ItemCacheFactory, ItemResourceFactory } from '../factories';
|
|
3
3
|
import { ErrorHandlerInterface, PromiseInterface } from '../interfaces';
|
|
4
4
|
import { CollectionEntry, CollectionResource, ItemEntry, ItemResource } from '../models';
|
|
5
|
-
import { CollectionEntryParentIdMap, CreateRequestParameterMap, ItemIdConversionMap, ItemOptions } from '../types';
|
|
5
|
+
import { CollectionEntryParentIdMap, CreateRequestParameterMap, ItemIdConversionMap, ItemOptions, OnSaveCallback, LocalCacheCallbackCondition } from '../types';
|
|
6
6
|
export declare class LocalCache {
|
|
7
7
|
private errorHandler;
|
|
8
8
|
private lockService;
|
|
@@ -19,12 +19,8 @@ export declare class LocalCache {
|
|
|
19
19
|
collections: CollectionCache;
|
|
20
20
|
deferredCollections: CollectionCache;
|
|
21
21
|
tabRequestParameters: {};
|
|
22
|
-
callbacks
|
|
23
|
-
|
|
24
|
-
onSaveSuccess: {};
|
|
25
|
-
onSaveWithoutClosing: {};
|
|
26
|
-
};
|
|
27
|
-
changesInterval: null | number;
|
|
22
|
+
private callbacks;
|
|
23
|
+
private changesInterval;
|
|
28
24
|
hasChanges: boolean;
|
|
29
25
|
constructor(errorHandler: ErrorHandlerInterface, lockService: LockService, itemResourceFactory: ItemResourceFactory, collectionCacheFactory: CollectionCacheFactory, changesProcessorFactory: ChangesProcessorFactory, itemCacheFactory: ItemCacheFactory, collectionResourceFactory: CollectionResourceFactory, itemResourceService: ItemResourceService, promiseService: PromiseInterface, id?: string);
|
|
30
26
|
createItemResource(itemEntry: ItemEntry, options: ItemOptions, isRoot?: boolean, isNew?: boolean): ItemResource;
|
|
@@ -42,10 +38,12 @@ export declare class LocalCache {
|
|
|
42
38
|
private collectionHasChanges(collectionEntry);
|
|
43
39
|
isLockable(): boolean;
|
|
44
40
|
save(closeTab?: boolean, parameters?: CreateRequestParameterMap, breakUpByParent?: boolean, onAfterCreateCallback?: (conversionMap: ItemIdConversionMap) => void): any;
|
|
45
|
-
|
|
41
|
+
onBeforeSave(key: string, callback: (localCache: LocalCache) => any, condition?: LocalCacheCallbackCondition): () => void;
|
|
42
|
+
onSaveSuccess(key: string, callback: OnSaveCallback, condition?: LocalCacheCallbackCondition): () => void;
|
|
43
|
+
private executeCallbackEvent<T>(callbacks, execute, closeTab);
|
|
44
|
+
private executeCallbacks<T>(callbacks, execute);
|
|
46
45
|
enableChangesWatcher(): void;
|
|
47
46
|
disableChangesWatcher(): void;
|
|
48
|
-
registerCallback(event: string, key: string, callback: any): () => void;
|
|
49
47
|
onDeactivateItem(itemEntry: any): void;
|
|
50
48
|
onActivateItem(itemEntry: any): void;
|
|
51
49
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ApiResponseProcessor, CollectionMatcher, ColumnSet, RequestColumnExpansion } from '../classes';
|
|
1
|
+
import { ApiResponseProcessor, CollectionMatcher, ColumnSet, LocalCache, RequestColumnExpansion } from '../classes';
|
|
2
2
|
import { ENTRY_STATUS } from '../constants';
|
|
3
3
|
import { CollectionEntry, CollectionResource, ItemEntry, ItemResource } from '../models';
|
|
4
4
|
export declare type EntryParent = {
|
|
@@ -25,6 +25,23 @@ export declare type StateKey = {
|
|
|
25
25
|
template?: string;
|
|
26
26
|
itemId?: string;
|
|
27
27
|
};
|
|
28
|
+
export declare type OnSaveCallback = (localCache: LocalCache, conversionMap: ItemIdConversionMap) => any;
|
|
29
|
+
export declare const enum LocalCacheCallbackCondition {
|
|
30
|
+
Always = "always",
|
|
31
|
+
OnClose = "onClose",
|
|
32
|
+
SkipOnClose = "skipOnClose",
|
|
33
|
+
}
|
|
34
|
+
export declare type LocalCacheCallbacks<T> = {
|
|
35
|
+
always: {
|
|
36
|
+
[key: string]: T;
|
|
37
|
+
};
|
|
38
|
+
onClose: {
|
|
39
|
+
[key: string]: T;
|
|
40
|
+
};
|
|
41
|
+
skipOnClose: {
|
|
42
|
+
[key: string]: T;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
28
45
|
export declare type ItemResourceItemIdMap = {
|
|
29
46
|
[itemId: number]: ItemResource;
|
|
30
47
|
};
|