@rentman/rm-core 1.0.22 → 1.0.23
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 +20 -0
- package/dist/definitions/src/classes/ItemAdministrator.d.ts +10 -33
- package/dist/definitions/src/classes/{ResourceCache.d.ts → LocalCache.d.ts} +3 -6
- package/dist/definitions/src/factories/{ResourceCacheFactory.d.ts → LocalCacheFactory.d.ts} +3 -3
- package/dist/definitions/src/index.d.ts +4 -5
- package/dist/definitions/src/interfaces/LocalCacheManagerInterface.d.ts +6 -0
- package/dist/rm-core.js +311 -356
- package/package.json +1 -1
- package/readme.md +4 -3
- package/dist/definitions/src/interfaces/ResourceCacheInterface.d.ts +0 -6
package/changelog.md
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#Changelog
|
|
2
|
+
Contains new features, breaking changes and their reasoning
|
|
3
|
+
|
|
4
|
+
##v1.0.23
|
|
5
|
+
- Rename ResourceCache to LocalCache
|
|
6
|
+
> LocalCache only caches local items (name better reflects functionality)
|
|
7
|
+
|
|
8
|
+
- Remove getter/setter for hasChanges
|
|
9
|
+
> hasChanges is called in a digest loop in the frontend, so for performance reasons we don't want to recompute the value every time
|
|
10
|
+
|
|
11
|
+
- Remove `_getCollection` from ItemAdministrator
|
|
12
|
+
> `_getCollection` is now named `getCollection` and the old `getCollection` is removed. The query is part of the
|
|
13
|
+
> options and should not be given as a separate argument. This was included to support the frontend
|
|
14
|
+
|
|
15
|
+
- Remove `saveCurrentTab` from ItemAdministrator
|
|
16
|
+
> `saveCurrentTab` makes no sense because the core has no concept of tabs, you should use `saveCurrentLocalCache` instead
|
|
17
|
+
|
|
18
|
+
- Remove `getTabEntry` and `resetTabEntry` from ItemAdministrator
|
|
19
|
+
> `getTabEntry` and `resetTabEntry` make no sense because the core has no concept of tabs, you should use `getLocalCache` and `resetLocalCache` instead
|
|
20
|
+
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import ColumnSetFactory from "../factories/ColumnSetFactory";
|
|
2
2
|
import ModuleChangesCompilerFactory from "../factories/ModuleChangesCompilerFactory";
|
|
3
|
-
import
|
|
3
|
+
import LocalCacheFactory from "../factories/LocalCacheFactory";
|
|
4
4
|
import ApiRequestServiceInterface from '../interfaces/ApiRequestServiceInterface';
|
|
5
5
|
import AuthInterface from '../interfaces/AuthInterface';
|
|
6
6
|
import ErrorHandlerInterface from '../interfaces/ErrorHandlerInterface';
|
|
7
|
-
import
|
|
7
|
+
import LocalCacheManagerInterface from '../interfaces/LocalCacheManagerInterface';
|
|
8
8
|
import CollectionResource from '../models/CollectionResource';
|
|
9
9
|
import ItemResource from '../models/ItemResource';
|
|
10
10
|
import CollectionCache from './CollectionCache';
|
|
@@ -17,26 +17,26 @@ import ItemHandler from './ItemHandler';
|
|
|
17
17
|
import ItemRequestService from "./ItemRequestService";
|
|
18
18
|
import KeyService from "./KeyService";
|
|
19
19
|
import QueryService from "./QueryService";
|
|
20
|
-
import
|
|
20
|
+
import LocalCache from "./LocalCache";
|
|
21
21
|
import ItemEntry from '../models/ItemEntry';
|
|
22
22
|
import { CollectionEntryParentIdMap, CollectionResourceParentIdMap, ItemResourceItemTypeMap, TemplateResponseItemEntryMap } from '../types/ItemTypesCollection';
|
|
23
23
|
export default class ItemAdministrator {
|
|
24
24
|
private apiRequestService;
|
|
25
|
-
private
|
|
25
|
+
private localCacheManager;
|
|
26
26
|
private authInterface;
|
|
27
27
|
private errorHandler;
|
|
28
28
|
private itemHandler;
|
|
29
29
|
private collectionHandler;
|
|
30
30
|
private columnSetFactory;
|
|
31
31
|
private itemRequestService;
|
|
32
|
-
private
|
|
32
|
+
private localCacheFactory;
|
|
33
33
|
private moduleChangesCompilerFactory;
|
|
34
34
|
private collectionEntryService;
|
|
35
35
|
private collectionResourceService;
|
|
36
36
|
private itemEntryService;
|
|
37
37
|
private keyService;
|
|
38
38
|
private queryService;
|
|
39
|
-
constructor(apiRequestService: ApiRequestServiceInterface,
|
|
39
|
+
constructor(apiRequestService: ApiRequestServiceInterface, localCacheManager: LocalCacheManagerInterface, authInterface: AuthInterface, errorHandler: ErrorHandlerInterface, itemHandler: ItemHandler, collectionHandler: CollectionHandler, columnSetFactory: ColumnSetFactory, itemRequestService: ItemRequestService, localCacheFactory: LocalCacheFactory, moduleChangesCompilerFactory: ModuleChangesCompilerFactory, collectionEntryService: CollectionEntryService, collectionResourceService: CollectionResourceService, itemEntryService: ItemEntryService, keyService: KeyService, queryService: QueryService);
|
|
40
40
|
getItemDefinition(itemType: string, itemId: any, options: any): {
|
|
41
41
|
itemType: string;
|
|
42
42
|
options: any;
|
|
@@ -85,9 +85,7 @@ export default class ItemAdministrator {
|
|
|
85
85
|
resource: any;
|
|
86
86
|
};
|
|
87
87
|
};
|
|
88
|
-
|
|
89
|
-
getCollection(itemType: string, query: any, options: any): PromiseLike<any>;
|
|
90
|
-
_getCollection(itemType: string, options: any): PromiseLike<CollectionResource>;
|
|
88
|
+
getCollection(itemType: string, options: any): PromiseLike<CollectionResource>;
|
|
91
89
|
getCollectionFromDef(definition: any): PromiseLike<CollectionResource>;
|
|
92
90
|
getLinkCollection(linkType: string, linkId: number, itemType: string, options: any): PromiseLike<CollectionResource>;
|
|
93
91
|
getLinkCollections(linkType: string, linkIdArray: number[], itemType: string, options: any): PromiseLike<CollectionResourceParentIdMap>;
|
|
@@ -96,11 +94,7 @@ export default class ItemAdministrator {
|
|
|
96
94
|
getItemByDef(definition: any, isRoot: boolean): PromiseLike<any>;
|
|
97
95
|
cloneItem(newItemId: number, itemResource: any, options: any): ItemResource;
|
|
98
96
|
cloneCollection(collectionResource: any, options: any, conversionMap: any): CollectionResource;
|
|
99
|
-
|
|
100
|
-
* @deprecated
|
|
101
|
-
*/
|
|
102
|
-
saveCurrentTab(closeTab: any, parameters: any, breakupByParent: any, onAfterCreateCallback: any, keepTabHeading: any): any;
|
|
103
|
-
saveCurrentResourceCache(closeTab: boolean, parameters: any, breakupByParent: boolean, onAfterCreateCallback: any, keepTabHeading?: boolean): any;
|
|
97
|
+
saveCurrentLocalCache(closeTab: boolean, parameters: any, breakupByParent: boolean, onAfterCreateCallback: any, keepTabHeading?: boolean): any;
|
|
104
98
|
getCurrentCollections(): CollectionCache;
|
|
105
99
|
getCurrentItems(): ItemCache;
|
|
106
100
|
getCurrentChanges(): {
|
|
@@ -113,32 +107,15 @@ export default class ItemAdministrator {
|
|
|
113
107
|
addCollection(collectionEntry: any, resourceOptions: any, processOptions?: any): CollectionResource;
|
|
114
108
|
addCollections(collectionEntries: CollectionEntryParentIdMap, resourceOptions: any): CollectionResourceParentIdMap;
|
|
115
109
|
processLinkedItems(linkedEntries: any[], options: any, addToCollections: boolean): ItemResourceItemTypeMap;
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
*/
|
|
119
|
-
getTabEntry(): ResourceCache;
|
|
120
|
-
getResourceCache(): ResourceCache;
|
|
121
|
-
/**
|
|
122
|
-
* @deprecated
|
|
123
|
-
*/
|
|
124
|
-
resetTabEntry(): void;
|
|
125
|
-
resetResourceCache(): void;
|
|
110
|
+
getLocalCache(): LocalCache;
|
|
111
|
+
resetLocalCache(): void;
|
|
126
112
|
addToCollections(itemEntries: any[], resultCollectionResource: any): ItemResource[];
|
|
127
113
|
removeFromCollections(itemEntries: any[], resultCollectionResource: any): any;
|
|
128
114
|
updateItemIdMap(collectionMap: any, conversionMap: any): void;
|
|
129
115
|
createCollectionResource(collectionEntry: any, resourceOptions: any, processOptions?: any): CollectionResource;
|
|
130
116
|
createItemResource(itemEntry: any, options: any, isRoot: boolean): ItemResource;
|
|
131
117
|
createItemResources(itemEntries: any[], options: any): ItemResource[];
|
|
132
|
-
/**
|
|
133
|
-
* @deprecated
|
|
134
|
-
*/
|
|
135
118
|
onBeforeSave(key: string, callback: any): () => void;
|
|
136
|
-
/**
|
|
137
|
-
* @deprecated
|
|
138
|
-
*/
|
|
139
119
|
onSaveSuccess(key: string, callback: any): () => void;
|
|
140
|
-
/**
|
|
141
|
-
* @deprecated
|
|
142
|
-
*/
|
|
143
120
|
onSaveWithoutClosing(key: string, callback: any): () => void;
|
|
144
121
|
}
|
|
@@ -18,7 +18,7 @@ import ItemHandler from "./ItemHandler";
|
|
|
18
18
|
import ItemResourceService from './ItemResourceService';
|
|
19
19
|
import LockService from "./LockService";
|
|
20
20
|
import PromiseService from "./PromiseService";
|
|
21
|
-
export default class
|
|
21
|
+
export default class LocalCache {
|
|
22
22
|
private apiRequestService;
|
|
23
23
|
private errorHandler;
|
|
24
24
|
private itemHandler;
|
|
@@ -44,7 +44,7 @@ export default class ResourceCache {
|
|
|
44
44
|
onSaveWithoutClosing: {};
|
|
45
45
|
};
|
|
46
46
|
changesInterval: null | number;
|
|
47
|
-
|
|
47
|
+
hasChanges: boolean;
|
|
48
48
|
rootItem: ItemEntry;
|
|
49
49
|
constructor(apiRequestService: ApiRequestServiceInterface, errorHandler: ErrorHandlerInterface, itemHandler: ItemHandler, collectionHandler: CollectionHandler, columnHandler: ColumnHandler, lockService: LockService, itemResourceFactory: ItemResourceFactory, collectionCacheFactory: CollectionCacheFactory, changesProcessorFactory: ChangesProcessorFactory, itemCacheFactory: ItemCacheFactory, collectionResourceFactory: CollectionResourceFactory, itemEntryService: ItemEntryService, itemResourceService: ItemResourceService, promiseService: PromiseService);
|
|
50
50
|
addSingleItem(itemEntry: ItemEntry, options: any, isRoot: any): ItemResource;
|
|
@@ -55,7 +55,7 @@ export default class ResourceCache {
|
|
|
55
55
|
updateSingleItems(conversionMap: any): void;
|
|
56
56
|
revertChanges(): any;
|
|
57
57
|
resetCollection(collectionEntry: CollectionEntry): void;
|
|
58
|
-
|
|
58
|
+
_hasChanges(): boolean;
|
|
59
59
|
detectChanges(): boolean;
|
|
60
60
|
collectionHasChanges(collectionEntry: CollectionEntry): boolean;
|
|
61
61
|
isLockable(): boolean;
|
|
@@ -71,8 +71,5 @@ export default class ResourceCache {
|
|
|
71
71
|
* @deprecated
|
|
72
72
|
*/
|
|
73
73
|
disableWatcher(): void;
|
|
74
|
-
/**
|
|
75
|
-
* @deprecated
|
|
76
|
-
*/
|
|
77
74
|
registerCallback(event: string, key: string, callback: any): () => void;
|
|
78
75
|
}
|
|
@@ -5,7 +5,7 @@ import ItemHandler from "../classes/ItemHandler";
|
|
|
5
5
|
import ItemResourceService from '../classes/ItemResourceService';
|
|
6
6
|
import LockService from "../classes/LockService";
|
|
7
7
|
import PromiseService from '../classes/PromiseService';
|
|
8
|
-
import
|
|
8
|
+
import LocalCache from "../classes/LocalCache";
|
|
9
9
|
import ApiRequestServiceInterface from '../interfaces/ApiRequestServiceInterface';
|
|
10
10
|
import ErrorHandlerInterface from '../interfaces/ErrorHandlerInterface';
|
|
11
11
|
import ChangesProcessorFactory from "./ChangesProcessorFactory";
|
|
@@ -13,7 +13,7 @@ import CollectionCacheFactory from "./CollectionCacheFactory";
|
|
|
13
13
|
import CollectionResourceFactory from "./CollectionResourceFactory";
|
|
14
14
|
import ItemCacheFactory from "./ItemCacheFactory";
|
|
15
15
|
import ItemResourceFactory from "./ItemResourceFactory";
|
|
16
|
-
export default class
|
|
16
|
+
export default class LocalCacheFactory {
|
|
17
17
|
private apiRequestService;
|
|
18
18
|
private errorHandler;
|
|
19
19
|
private itemHandler;
|
|
@@ -29,5 +29,5 @@ export default class ResourceCacheFactory {
|
|
|
29
29
|
private itemResourceService;
|
|
30
30
|
private promiseService;
|
|
31
31
|
constructor(apiRequestService: ApiRequestServiceInterface, errorHandler: ErrorHandlerInterface, itemHandler: ItemHandler, collectionHandler: CollectionHandler, columnHandler: ColumnHandler, lockService: LockService, itemResourceFactory: ItemResourceFactory, collectionCacheFactory: CollectionCacheFactory, changesProcessorFactory: ChangesProcessorFactory, itemCacheFactory: ItemCacheFactory, collectionResourceFactory: CollectionResourceFactory, itemEntryService: ItemEntryService, itemResourceService: ItemResourceService, promiseService: PromiseService);
|
|
32
|
-
construct():
|
|
32
|
+
construct(): LocalCache;
|
|
33
33
|
}
|
|
@@ -33,11 +33,11 @@ import ModuleChangesCompilerFactory from "./factories/ModuleChangesCompilerFacto
|
|
|
33
33
|
import QueryMatcherFactory from "./factories/QueryMatcherFactory";
|
|
34
34
|
import QueryParserFactory from "./factories/QueryParserFactory";
|
|
35
35
|
import RequestColumnExpansionFactory from "./factories/RequestColumnExpansionFactory";
|
|
36
|
-
import
|
|
36
|
+
import LocalCacheFactory from "./factories/LocalCacheFactory";
|
|
37
37
|
import ApiRequestServiceInterface from './interfaces/ApiRequestServiceInterface';
|
|
38
38
|
import AuthInterface from './interfaces/AuthInterface';
|
|
39
39
|
import ErrorHandlerInterface from './interfaces/ErrorHandlerInterface';
|
|
40
|
-
import
|
|
40
|
+
import LocalCacheManagerInterface from './interfaces/LocalCacheManagerInterface';
|
|
41
41
|
export default class RmCore {
|
|
42
42
|
version: string;
|
|
43
43
|
promiseService: PromiseService;
|
|
@@ -70,14 +70,13 @@ export default class RmCore {
|
|
|
70
70
|
columnSetFactory: ColumnSetFactory;
|
|
71
71
|
createRequestFactory: CreateRequestFactory;
|
|
72
72
|
itemResourceFactory: ItemResourceFactory;
|
|
73
|
-
|
|
73
|
+
localCacheFactory: LocalCacheFactory;
|
|
74
74
|
moduleChangesCompilerFactory: ModuleChangesCompilerFactory;
|
|
75
75
|
queryParserFactory: QueryParserFactory;
|
|
76
76
|
batchStatusFactory: BatchStatusFactory;
|
|
77
77
|
socketMessageHandler: SocketMessageHandler;
|
|
78
78
|
apiRequestService: ApiRequestService;
|
|
79
|
-
|
|
80
|
-
constructor(externalApiRequestService: ApiRequestServiceInterface, resourceCacheInterface: ResourceCacheInterface, authInterface: AuthInterface, errorHandlerInterface: ErrorHandlerInterface);
|
|
79
|
+
constructor(externalApiRequestService: ApiRequestServiceInterface, localCacheManager: LocalCacheManagerInterface, authInterface: AuthInterface, errorHandlerInterface: ErrorHandlerInterface);
|
|
81
80
|
}
|
|
82
81
|
export declare function noop(): void;
|
|
83
82
|
export declare function identity(value: any): any;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import LocalCache from '../classes/LocalCache';
|
|
2
|
+
export default interface LocalCacheManagerInterface {
|
|
3
|
+
updateTabParams(conversionMap: any, keepTabHeading: boolean): Promise<any>;
|
|
4
|
+
getCacheManager(userId: string): LocalCache;
|
|
5
|
+
setCacheManager(userId: string, entry: LocalCache): any;
|
|
6
|
+
}
|