@rentman/rm-core 1.0.21 → 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/ApiRequestService.d.ts +10 -9
- package/dist/definitions/src/classes/ApiResponseProcessor.d.ts +4 -3
- package/dist/definitions/src/classes/BatchStatus.d.ts +11 -8
- package/dist/definitions/src/classes/CollectionCache.d.ts +14 -12
- package/dist/definitions/src/classes/CollectionEntryService.d.ts +10 -2
- package/dist/definitions/src/classes/CollectionHandler.d.ts +15 -23
- package/dist/definitions/src/classes/ColumnHandler.d.ts +3 -3
- package/dist/definitions/src/classes/ItemAdministrator.d.ts +49 -50
- package/dist/definitions/src/classes/ItemEntryService.d.ts +4 -3
- package/dist/definitions/src/classes/ItemHandler.d.ts +41 -22
- package/dist/definitions/src/classes/ItemRequestService.d.ts +5 -4
- package/dist/definitions/src/classes/ItemResourceService.d.ts +3 -4
- package/dist/definitions/src/classes/{ResourceCache.d.ts → LocalCache.d.ts} +4 -7
- package/dist/definitions/src/constants.d.ts +8 -8
- package/dist/definitions/src/factories/CollectionResourceFactory.d.ts +3 -1
- 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/ApiRequestServiceInterface.d.ts +8 -8
- package/dist/definitions/src/interfaces/LocalCacheManagerInterface.d.ts +6 -0
- package/dist/definitions/src/models/CollectionEntry.d.ts +7 -6
- package/dist/definitions/src/models/CollectionResource.d.ts +19 -11
- package/dist/definitions/src/models/EditResource.d.ts +0 -1
- package/dist/definitions/src/models/ViewResource.d.ts +0 -1
- package/dist/definitions/src/types/ItemTypesCollection.d.ts +52 -0
- package/dist/rm-core.js +429 -382
- 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,16 +1,17 @@
|
|
|
1
1
|
import ApiResponseProcessorFactory from '../factories/ApiResponseProcessorFactory';
|
|
2
2
|
import ApiRequestServiceInterface from '../interfaces/ApiRequestServiceInterface';
|
|
3
|
+
import ApiResponseProcessor from './ApiResponseProcessor';
|
|
3
4
|
export default class ApiRequestService {
|
|
4
5
|
private externalApiRequestService;
|
|
5
6
|
private apiResponseProcessorFactory;
|
|
6
7
|
constructor(externalApiRequestService: ApiRequestServiceInterface, apiResponseProcessorFactory: ApiResponseProcessorFactory);
|
|
7
|
-
template(itemType: string, params: any):
|
|
8
|
-
create(itemType: string, itemId: number, values: any, parentType?: string, parentId?: number):
|
|
9
|
-
delete(itemType: string, itemIds: number[]):
|
|
10
|
-
updateItems(itemType: string, items: object, columns: any):
|
|
11
|
-
requestSkeleton(params: any, requestCanceler?:
|
|
12
|
-
moveItems(parentType: string, parentId: number, items: object):
|
|
13
|
-
columns(itemType: string, columns: object, params?: any):
|
|
14
|
-
query(itemType: string, query: object, columns: object, allLinks?: boolean, limit?: object):
|
|
15
|
-
processResponse(request: any):
|
|
8
|
+
template(itemType: string, params: any): PromiseLike<ApiResponseProcessor>;
|
|
9
|
+
create(itemType: string, itemId: number, values: any, parentType?: string, parentId?: number): PromiseLike<ApiResponseProcessor>;
|
|
10
|
+
delete(itemType: string, itemIds: number[]): PromiseLike<ApiResponseProcessor>;
|
|
11
|
+
updateItems(itemType: string, items: object, columns: any): PromiseLike<ApiResponseProcessor>;
|
|
12
|
+
requestSkeleton(params: any, requestCanceler?: PromiseLike<any>): PromiseLike<ApiResponseProcessor>;
|
|
13
|
+
moveItems(parentType: string, parentId: number, items: object): PromiseLike<ApiResponseProcessor>;
|
|
14
|
+
columns(itemType: string, columns: object, params?: any): PromiseLike<ApiResponseProcessor>;
|
|
15
|
+
query(itemType: string, query: object, columns: object, allLinks?: boolean, limit?: object): PromiseLike<ApiResponseProcessor>;
|
|
16
|
+
processResponse(request: any): PromiseLike<ApiResponseProcessor>;
|
|
16
17
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import ApiFormatter from './ApiFormatter';
|
|
2
|
+
import { ItemTypeMap } from '../types/ItemTypesCollection';
|
|
2
3
|
export default class ApiResponseProcessor {
|
|
3
4
|
apiFormatter: ApiFormatter;
|
|
4
5
|
response: any;
|
|
5
|
-
columns:
|
|
6
|
-
items:
|
|
7
|
-
links:
|
|
6
|
+
columns: ItemTypeMap;
|
|
7
|
+
items: ItemTypeMap;
|
|
8
|
+
links: ItemTypeMap;
|
|
8
9
|
cacheable: boolean;
|
|
9
10
|
map: any;
|
|
10
11
|
columnIndexMap: any;
|
|
@@ -1,16 +1,19 @@
|
|
|
1
|
+
import { ENTRY_STATUS } from "../constants";
|
|
1
2
|
import ItemEntry from "../models/ItemEntry";
|
|
2
3
|
import PromiseService from "./PromiseService";
|
|
4
|
+
import { EntryStatus } from '../types/ItemTypesCollection';
|
|
5
|
+
import { ItemEntryEntryStatusMap } from '../types/ItemTypesCollection';
|
|
3
6
|
export default class BatchStatus {
|
|
4
7
|
private promiseService;
|
|
5
8
|
getItemId: (itemEntry: ItemEntry) => number;
|
|
6
|
-
getPromise: (itemEntry: ItemEntry) => Promise<
|
|
7
|
-
entries:
|
|
8
|
-
constructor(promiseService: PromiseService, getItemId: (itemEntry: ItemEntry) => number, getPromise: (itemEntry: ItemEntry) => Promise<
|
|
9
|
-
add(entryStatus:
|
|
10
|
-
hasEntries(statusArray:
|
|
9
|
+
getPromise: (itemEntry: ItemEntry) => Promise<ItemEntry>;
|
|
10
|
+
entries: ItemEntryEntryStatusMap;
|
|
11
|
+
constructor(promiseService: PromiseService, getItemId: (itemEntry: ItemEntry) => number, getPromise: (itemEntry: ItemEntry) => Promise<ItemEntry>);
|
|
12
|
+
add(entryStatus: EntryStatus<ItemEntry>): void;
|
|
13
|
+
hasEntries(statusArray: ENTRY_STATUS[]): boolean;
|
|
11
14
|
hasRequests(): boolean;
|
|
12
|
-
forEachEntry(statusArray:
|
|
13
|
-
getPromises():
|
|
15
|
+
forEachEntry(statusArray: ENTRY_STATUS[], callback: (itemEntry: ItemEntry) => void): void;
|
|
16
|
+
getPromises(): PromiseLike<ItemEntry[]>;
|
|
14
17
|
getRequestIds(): number[];
|
|
15
|
-
getArray():
|
|
18
|
+
getArray(): ItemEntry[];
|
|
16
19
|
}
|
|
@@ -1,26 +1,28 @@
|
|
|
1
1
|
import QueryMatcherFactory from "../factories/QueryMatcherFactory";
|
|
2
2
|
import CollectionEntry from "../models/CollectionEntry";
|
|
3
|
+
import CollectionResource from '../models/CollectionResource';
|
|
4
|
+
import { CollectionEntryItemTypeMap } from '../types/ItemTypesCollection';
|
|
3
5
|
export default class CollectionCache {
|
|
4
6
|
private queryMatcherFactory;
|
|
5
|
-
entries:
|
|
7
|
+
entries: CollectionEntryItemTypeMap;
|
|
6
8
|
constructor(queryMatcherFactory: QueryMatcherFactory);
|
|
7
|
-
contains(collectionEntry:
|
|
8
|
-
some(callback:
|
|
9
|
-
forEach(callback:
|
|
10
|
-
toArray():
|
|
9
|
+
contains(collectionEntry: CollectionEntry): boolean;
|
|
10
|
+
some(callback: (entry: CollectionEntry) => void): boolean;
|
|
11
|
+
forEach(callback: (entry: CollectionEntry) => void): void;
|
|
12
|
+
toArray(): CollectionEntry[];
|
|
11
13
|
add(collectionEntry: CollectionEntry): CollectionEntry;
|
|
12
14
|
clear(collectionEntry?: CollectionEntry): boolean;
|
|
13
|
-
getByItemType(itemType:
|
|
14
|
-
getByParent(parentType: any, parentId: any, itemType: any):
|
|
15
|
-
getResourceByParent(parentType: any, parentId: any, itemType: any):
|
|
16
|
-
getCollectionsByParent(parentType: any, parentId: any):
|
|
15
|
+
getByItemType(itemType: string): CollectionEntry[];
|
|
16
|
+
getByParent(parentType: any, parentId: any, itemType: any): CollectionEntry | null;
|
|
17
|
+
getResourceByParent(parentType: any, parentId: any, itemType: any): CollectionResource;
|
|
18
|
+
getCollectionsByParent(parentType: any, parentId: any): CollectionEntry[];
|
|
17
19
|
/**
|
|
18
20
|
* Only resources
|
|
19
21
|
* @param {String} itemType
|
|
20
22
|
* @param {String|Integer} itemId
|
|
21
23
|
* @returns {Object} Array of collections.
|
|
22
24
|
*/
|
|
23
|
-
getByContainingItem(itemType: any, itemId: any):
|
|
25
|
+
getByContainingItem(itemType: any, itemId: any): CollectionEntry[];
|
|
24
26
|
/**
|
|
25
27
|
* Returns an array of collections the item 'belongs' in.
|
|
26
28
|
* @param {String} parentType
|
|
@@ -33,7 +35,7 @@ export default class CollectionCache {
|
|
|
33
35
|
notfitting: any[];
|
|
34
36
|
maybe: any[];
|
|
35
37
|
};
|
|
36
|
-
getByQuery(itemType: any, query: any):
|
|
37
|
-
getByKey(itemType: any, entryKey: any):
|
|
38
|
+
getByQuery(itemType: any, query: any): CollectionEntry;
|
|
39
|
+
getByKey(itemType: any, entryKey: any): CollectionEntry[];
|
|
38
40
|
getResourceByKey(itemType: any, resourceKey: any): any[];
|
|
39
41
|
}
|
|
@@ -10,6 +10,14 @@ export default class CollectionEntryService {
|
|
|
10
10
|
object: any;
|
|
11
11
|
string: any;
|
|
12
12
|
};
|
|
13
|
-
getIdArray(itemEntries: ItemEntry[], accumulator: any):
|
|
14
|
-
|
|
13
|
+
getIdArray(itemEntries: ItemEntry[], accumulator: any): number[];
|
|
14
|
+
/**
|
|
15
|
+
* @param {ItemEntry[]} itemEntries
|
|
16
|
+
* @param {(itemEntry: ItemEntry) => boolean} callback
|
|
17
|
+
* @returns {ItemEntry[]}
|
|
18
|
+
*
|
|
19
|
+
* filter an array according to the callback function. Return the entries that failed the condition
|
|
20
|
+
* Replace the given array with the entries that didn't fail the condition.
|
|
21
|
+
*/
|
|
22
|
+
filterArray(itemEntries: ItemEntry[], callback: (itemEntry: ItemEntry) => boolean): ItemEntry[];
|
|
15
23
|
}
|
|
@@ -18,6 +18,7 @@ import ItemRequestService from "./ItemRequestService";
|
|
|
18
18
|
import KeyService from "./KeyService";
|
|
19
19
|
import PromiseService from "./PromiseService";
|
|
20
20
|
import QueryService from "./QueryService";
|
|
21
|
+
import { CollectionEntryBatchStatusMap, CollectionEntryParentIdMap, EntryStatus, ItemResourceItemIdMap } from '../types/ItemTypesCollection';
|
|
21
22
|
export default class CollectionHandler {
|
|
22
23
|
private errorHandler;
|
|
23
24
|
private itemRequestService;
|
|
@@ -35,37 +36,28 @@ export default class CollectionHandler {
|
|
|
35
36
|
private columnUtil;
|
|
36
37
|
entries: CollectionCache;
|
|
37
38
|
constructor(errorHandler: ErrorHandlerInterface, itemRequestService: ItemRequestService, itemHandler: ItemHandler, columnHandler: ColumnHandler, collectionEntryFactory: CollectionEntryFactory, collectionCacheFactory: CollectionCacheFactory, queryParserFactory: QueryParserFactory, collectionEntryService: CollectionEntryService, columnSetFactory: ColumnSetFactory, itemEntryService: ItemEntryService, keyService: KeyService, promiseService: PromiseService, queryService: QueryService, columnUtil: ColumnUtil);
|
|
38
|
-
getPromises(statusResource:
|
|
39
|
+
getPromises(statusResource: CollectionEntryBatchStatusMap): any[];
|
|
39
40
|
getRequestIds(statusResource: any): any[];
|
|
40
41
|
removeFromAndAddToCollections(collectionMap: any, updateInitial?: any): void;
|
|
41
42
|
removeFromCollections(collectionMap: any, updateInitial?: any, resultResource?: CollectionResource | null): any;
|
|
42
43
|
/**
|
|
43
44
|
* @deprecated
|
|
44
45
|
*/
|
|
45
|
-
addItemsToCollections(itemEntries: ItemEntry[]):
|
|
46
|
-
addToCollections(collectionMap: any, updateInitial: boolean, resultResource?: ItemResource | null):
|
|
47
|
-
batchExpand(parentType: string, itemType: string, collections: CollectionResource[], newColumns: any):
|
|
48
|
-
batchExtend(parentType: string, itemType: string, options: any, queryCallback: any, collections: CollectionResource[], returnAllItems?: boolean):
|
|
49
|
-
batchFetch(parentType: string, parentIdArray: number[], itemType: string, options: any, deferredCollectionCache: CollectionCache):
|
|
46
|
+
addItemsToCollections(itemEntries: ItemEntry[]): ItemResource[];
|
|
47
|
+
addToCollections(collectionMap: any, updateInitial: boolean, resultResource?: ItemResource | null): ItemResource[];
|
|
48
|
+
batchExpand(parentType: string, itemType: string, collections: CollectionResource[], newColumns: any): PromiseLike<CollectionResource[]>;
|
|
49
|
+
batchExtend(parentType: string, itemType: string, options: any, queryCallback: any, collections: CollectionResource[], returnAllItems?: boolean): PromiseLike<ItemResourceItemIdMap>;
|
|
50
|
+
batchFetch(parentType: string, parentIdArray: number[], itemType: string, options: any, deferredCollectionCache: CollectionCache): PromiseLike<CollectionEntryParentIdMap>;
|
|
50
51
|
clone(collectionEntry: CollectionEntry, options: any, conversionMap?: {}): CollectionEntry;
|
|
51
52
|
create(itemType: string, options: any, columns: any, items: ItemEntry[]): CollectionEntry;
|
|
52
53
|
createCollectionMap(itemEntries: ItemEntry[]): {};
|
|
53
|
-
createStatusResource(parentType: string, parentIdArray: number[], itemType: string, options: any, deferredCollectionCache: CollectionCache):
|
|
54
|
+
createStatusResource(parentType: string, parentIdArray: number[], itemType: string, options: any, deferredCollectionCache: CollectionCache): CollectionEntryBatchStatusMap;
|
|
54
55
|
expandCollectionMap(itemEntry: ItemEntry, accumulator: any, collectionCache?: CollectionCache): void;
|
|
55
|
-
fetch(itemType: string, options: any, itemCache: ItemCache, deferredCollectionCache: CollectionCache):
|
|
56
|
-
getDeferredEntryStatus(collectionEntry: CollectionEntry, options: any):
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
getEntryStatus(itemType: string, options: any, deferredEntries: CollectionCache): {
|
|
61
|
-
entry: any;
|
|
62
|
-
status: string;
|
|
63
|
-
};
|
|
64
|
-
getNewEntryStatus(itemType: string, query: any, options: any, deferredEntries: CollectionCache): {
|
|
65
|
-
entry: any;
|
|
66
|
-
status: string;
|
|
67
|
-
};
|
|
68
|
-
handleBatchResponse(statusResource: any, itemEntryResource: any): {};
|
|
56
|
+
fetch(itemType: string, options: any, itemCache: ItemCache, deferredCollectionCache: CollectionCache): PromiseLike<CollectionEntry>;
|
|
57
|
+
getDeferredEntryStatus(collectionEntry: CollectionEntry, options: any): EntryStatus<CollectionEntry>;
|
|
58
|
+
getEntryStatus(itemType: string, options: any, deferredEntries: CollectionCache): EntryStatus<CollectionEntry>;
|
|
59
|
+
getNewEntryStatus(itemType: string, query: any, options: any, deferredEntries: CollectionCache): EntryStatus<CollectionEntry>;
|
|
60
|
+
handleBatchResponse(statusResource: any, itemEntryResource: any): CollectionEntryParentIdMap;
|
|
69
61
|
/**
|
|
70
62
|
* @deprecated
|
|
71
63
|
*/
|
|
@@ -74,6 +66,6 @@ export default class CollectionHandler {
|
|
|
74
66
|
* @deprecated
|
|
75
67
|
*/
|
|
76
68
|
removeItemsFromCollections(itemEntries: ItemEntry[]): any;
|
|
77
|
-
resolveLocal(collectionEntry: CollectionEntry, itemCache: any):
|
|
78
|
-
resolveRemote(collectionEntry: any, itemCache: any):
|
|
69
|
+
resolveLocal(collectionEntry: CollectionEntry, itemCache: any): PromiseLike<CollectionEntry>;
|
|
70
|
+
resolveRemote(collectionEntry: any, itemCache: any): PromiseLike<CollectionEntry>;
|
|
79
71
|
}
|
|
@@ -13,7 +13,7 @@ export default class ColumnHandler {
|
|
|
13
13
|
setColumn(itemType: any, responseColumn: any): any;
|
|
14
14
|
setColumns(itemType: any, requestColumns: any, responseColumns: any): {};
|
|
15
15
|
fetchItemTypeTranslations(itemTypes: any): Promise<any>;
|
|
16
|
-
request(itemType: any, columns: any, params?: {}):
|
|
17
|
-
fetch(itemType: any, requestColumns: any, params?: {}):
|
|
18
|
-
fetchAll(itemType: any):
|
|
16
|
+
request(itemType: any, columns: any, params?: {}): PromiseLike<any>;
|
|
17
|
+
fetch(itemType: any, requestColumns: any, params?: {}): PromiseLike<any>;
|
|
18
|
+
fetchAll(itemType: any): PromiseLike<any>;
|
|
19
19
|
}
|
|
@@ -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,35 +17,57 @@ 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
|
+
import ItemEntry from '../models/ItemEntry';
|
|
22
|
+
import { CollectionEntryParentIdMap, CollectionResourceParentIdMap, ItemResourceItemTypeMap, TemplateResponseItemEntryMap } from '../types/ItemTypesCollection';
|
|
21
23
|
export default class ItemAdministrator {
|
|
22
24
|
private apiRequestService;
|
|
23
|
-
private
|
|
25
|
+
private localCacheManager;
|
|
24
26
|
private authInterface;
|
|
25
27
|
private errorHandler;
|
|
26
28
|
private itemHandler;
|
|
27
29
|
private collectionHandler;
|
|
28
30
|
private columnSetFactory;
|
|
29
31
|
private itemRequestService;
|
|
30
|
-
private
|
|
32
|
+
private localCacheFactory;
|
|
31
33
|
private moduleChangesCompilerFactory;
|
|
32
34
|
private collectionEntryService;
|
|
33
35
|
private collectionResourceService;
|
|
34
36
|
private itemEntryService;
|
|
35
37
|
private keyService;
|
|
36
38
|
private queryService;
|
|
37
|
-
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);
|
|
38
40
|
getItemDefinition(itemType: string, itemId: any, options: any): {
|
|
39
41
|
itemType: string;
|
|
40
42
|
options: any;
|
|
41
43
|
itemId: any;
|
|
42
44
|
};
|
|
43
45
|
createCollectionMap(itemEntries: any[], addToTab: boolean): {};
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
/**
|
|
47
|
+
*
|
|
48
|
+
* @param {string} itemType
|
|
49
|
+
* @param {number} itemId
|
|
50
|
+
* @param options
|
|
51
|
+
* @returns {PromiseLike<ItemResource>}
|
|
52
|
+
*
|
|
53
|
+
* I expect not a template request from itemhandler.fetchItem because addSingleItem does not handle the
|
|
54
|
+
* TemplateResponseItemEntryMap
|
|
55
|
+
*/
|
|
56
|
+
getItemById(itemType: string, itemId: number, options: any): PromiseLike<ItemResource>;
|
|
57
|
+
getItemsById(itemType: string, itemIds: number[], options: any): PromiseLike<ItemResource[]>;
|
|
58
|
+
getItemsByQuery(itemType: string, query: any, options: any): PromiseLike<ItemResource[]>;
|
|
59
|
+
getDuplicateById(itemType: string, duplicateId: number, options: any): PromiseLike<any>;
|
|
60
|
+
/**
|
|
61
|
+
* The return value is depended on the return links boolean. true returns the TemplateResponseItemEntryMap.
|
|
62
|
+
* The type has to be asserted at use since you only know the type of the return value when the function is called
|
|
63
|
+
*
|
|
64
|
+
* @param {string} itemType
|
|
65
|
+
* @param options
|
|
66
|
+
* @param {boolean} returnLinks
|
|
67
|
+
* @param {boolean} isRoot
|
|
68
|
+
* @returns {PromiseLike<ItemResource> | PromiseLike<TemplateResponseItemEntryMap>}
|
|
69
|
+
*/
|
|
70
|
+
getNewResource(itemType: string, options: any, returnLinks: boolean, isRoot: boolean): PromiseLike<ItemResource> | PromiseLike<TemplateResponseItemEntryMap>;
|
|
49
71
|
getCollectionDef(itemType: string, options: any): {
|
|
50
72
|
itemType: string;
|
|
51
73
|
options: {
|
|
@@ -63,22 +85,16 @@ export default class ItemAdministrator {
|
|
|
63
85
|
resource: any;
|
|
64
86
|
};
|
|
65
87
|
};
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
getAllLinkCollections(linkType: string, itemType: string, options: any): Promise<any>;
|
|
74
|
-
getItemByDef(definition: any, isRoot: boolean): any;
|
|
88
|
+
getCollection(itemType: string, options: any): PromiseLike<CollectionResource>;
|
|
89
|
+
getCollectionFromDef(definition: any): PromiseLike<CollectionResource>;
|
|
90
|
+
getLinkCollection(linkType: string, linkId: number, itemType: string, options: any): PromiseLike<CollectionResource>;
|
|
91
|
+
getLinkCollections(linkType: string, linkIdArray: number[], itemType: string, options: any): PromiseLike<CollectionResourceParentIdMap>;
|
|
92
|
+
getLinkCollectionsFromDef(definition: any): PromiseLike<CollectionResourceParentIdMap>;
|
|
93
|
+
getAllLinkCollections(linkType: string, itemType: string, options: any): PromiseLike<CollectionEntryParentIdMap>;
|
|
94
|
+
getItemByDef(definition: any, isRoot: boolean): PromiseLike<any>;
|
|
75
95
|
cloneItem(newItemId: number, itemResource: any, options: any): ItemResource;
|
|
76
96
|
cloneCollection(collectionResource: any, options: any, conversionMap: any): CollectionResource;
|
|
77
|
-
|
|
78
|
-
* @deprecated
|
|
79
|
-
*/
|
|
80
|
-
saveCurrentTab(closeTab: any, parameters: any, breakupByParent: any, onAfterCreateCallback: any, keepTabHeading: any): any;
|
|
81
|
-
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;
|
|
82
98
|
getCurrentCollections(): CollectionCache;
|
|
83
99
|
getCurrentItems(): ItemCache;
|
|
84
100
|
getCurrentChanges(): {
|
|
@@ -86,37 +102,20 @@ export default class ItemAdministrator {
|
|
|
86
102
|
itemId: number;
|
|
87
103
|
items: any;
|
|
88
104
|
};
|
|
89
|
-
addSingleItem(itemEntry:
|
|
90
|
-
addSingleItems(itemEntries:
|
|
105
|
+
addSingleItem(itemEntry: ItemEntry, options: any, isRoot?: boolean): ItemResource;
|
|
106
|
+
addSingleItems(itemEntries: ItemEntry[], options: any): ItemResource[];
|
|
91
107
|
addCollection(collectionEntry: any, resourceOptions: any, processOptions?: any): CollectionResource;
|
|
92
|
-
addCollections(collectionEntries:
|
|
93
|
-
processLinkedItems(linkedEntries: any[], options: any, addToCollections: boolean):
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
getTabEntry(): ResourceCache;
|
|
98
|
-
getResourceCache(): ResourceCache;
|
|
99
|
-
/**
|
|
100
|
-
* @deprecated
|
|
101
|
-
*/
|
|
102
|
-
resetTabEntry(): void;
|
|
103
|
-
resetResourceCache(): void;
|
|
104
|
-
addToCollections(itemEntries: any[], resultCollectionResource: any): any;
|
|
108
|
+
addCollections(collectionEntries: CollectionEntryParentIdMap, resourceOptions: any): CollectionResourceParentIdMap;
|
|
109
|
+
processLinkedItems(linkedEntries: any[], options: any, addToCollections: boolean): ItemResourceItemTypeMap;
|
|
110
|
+
getLocalCache(): LocalCache;
|
|
111
|
+
resetLocalCache(): void;
|
|
112
|
+
addToCollections(itemEntries: any[], resultCollectionResource: any): ItemResource[];
|
|
105
113
|
removeFromCollections(itemEntries: any[], resultCollectionResource: any): any;
|
|
106
114
|
updateItemIdMap(collectionMap: any, conversionMap: any): void;
|
|
107
115
|
createCollectionResource(collectionEntry: any, resourceOptions: any, processOptions?: any): CollectionResource;
|
|
108
116
|
createItemResource(itemEntry: any, options: any, isRoot: boolean): ItemResource;
|
|
109
|
-
createItemResources(itemEntries: any[], options: any):
|
|
110
|
-
/**
|
|
111
|
-
* @deprecated
|
|
112
|
-
*/
|
|
117
|
+
createItemResources(itemEntries: any[], options: any): ItemResource[];
|
|
113
118
|
onBeforeSave(key: string, callback: any): () => void;
|
|
114
|
-
/**
|
|
115
|
-
* @deprecated
|
|
116
|
-
*/
|
|
117
119
|
onSaveSuccess(key: string, callback: any): () => void;
|
|
118
|
-
/**
|
|
119
|
-
* @deprecated
|
|
120
|
-
*/
|
|
121
120
|
onSaveWithoutClosing(key: string, callback: any): () => void;
|
|
122
121
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import ApiFormatter from './ApiFormatter';
|
|
2
2
|
import KeyService from './KeyService';
|
|
3
3
|
import PromiseService from "./PromiseService";
|
|
4
|
+
import ItemEntry from '../models/ItemEntry';
|
|
4
5
|
export default class ItemEntryService {
|
|
5
6
|
private apiFormatter;
|
|
6
7
|
private keyService;
|
|
@@ -9,9 +10,9 @@ export default class ItemEntryService {
|
|
|
9
10
|
ALL_PERMISSIONS: number;
|
|
10
11
|
constructor(apiFormatter: ApiFormatter, keyService: KeyService, promiseService: PromiseService);
|
|
11
12
|
resetDerived(itemEntry: any, columnIds: any): void;
|
|
12
|
-
defer(itemEntry:
|
|
13
|
-
resolve(itemEntry: any):
|
|
14
|
-
reject(itemEntry: any, error?: string):
|
|
13
|
+
defer(itemEntry: ItemEntry, deferRequest: any): ItemEntry;
|
|
14
|
+
resolve(itemEntry: any): ItemEntry;
|
|
15
|
+
reject(itemEntry: any, error?: string): ItemEntry;
|
|
15
16
|
clearResources(itemEntry: any): void;
|
|
16
17
|
deactivateResources(itemEntry: any): void;
|
|
17
18
|
getFields(itemEntry: any): any;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ENTRY_STATUS } from "../constants";
|
|
1
2
|
import BatchStatusFactory from "../factories/BatchStatusFactory";
|
|
2
3
|
import ColumnExpansionFactory from "../factories/ColumnExpansionFactory";
|
|
3
4
|
import ColumnSetFactory from "../factories/ColumnSetFactory";
|
|
@@ -14,6 +15,9 @@ import ItemCache from "./ItemCache";
|
|
|
14
15
|
import ItemEntryService from "./ItemEntryService";
|
|
15
16
|
import KeyService from "./KeyService";
|
|
16
17
|
import PromiseService from "./PromiseService";
|
|
18
|
+
import BatchStatus from './BatchStatus';
|
|
19
|
+
import ApiResponseProcessor from './ApiResponseProcessor';
|
|
20
|
+
import { ApiTemplateItemTypeMap, EntryStatus, TemplateResponseItemEntryMap, TemplateResponseLinkedItemEntryMap } from '../types/ItemTypesCollection';
|
|
17
21
|
export default class ItemHandler {
|
|
18
22
|
private apiRequestService;
|
|
19
23
|
private authInterface;
|
|
@@ -30,41 +34,56 @@ export default class ItemHandler {
|
|
|
30
34
|
private promiseService;
|
|
31
35
|
private columnUtil;
|
|
32
36
|
entries: ItemCache;
|
|
33
|
-
templates:
|
|
37
|
+
templates: ApiTemplateItemTypeMap;
|
|
34
38
|
constructor(apiRequestService: ApiRequestServiceInterface, authInterface: AuthInterface, errorHandler: ErrorHandlerInterface, itemEntryFactory: ItemEntryFactory, columnHandler: ColumnHandler, itemCacheFactory: ItemCacheFactory, batchStatusFactory: BatchStatusFactory, columnExpansionFactory: ColumnExpansionFactory, columnSetFactory: ColumnSetFactory, itemEntryService: ItemEntryService, apiFormatter: ApiFormatter, keyService: KeyService, promiseService: PromiseService, columnUtil: ColumnUtil);
|
|
35
39
|
getItemId(itemEntry: ItemEntry): number;
|
|
36
40
|
getPromise(itemEntry: ItemEntry): any;
|
|
37
|
-
fetchItem(itemType: string, itemId: number, options: any):
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
fetchItem(itemType: string, itemId: number, options: any): PromiseLike<ItemEntry | TemplateResponseItemEntryMap>;
|
|
42
|
+
/**
|
|
43
|
+
*
|
|
44
|
+
* @param itemType
|
|
45
|
+
* @param itemIds
|
|
46
|
+
* @param options
|
|
47
|
+
* @returns {PromiseLike<ItemEntry[]>}
|
|
48
|
+
*
|
|
49
|
+
* For every itemid find the status of the ItemEntry and resolve the promises so the result is
|
|
50
|
+
* a usable ItemEntry
|
|
51
|
+
*/
|
|
52
|
+
fetchItems(itemType: any, itemIds: any, options: any): PromiseLike<ItemEntry[]>;
|
|
53
|
+
resolveCached(itemEntry: ItemEntry, status: ENTRY_STATUS, options: any): PromiseLike<ItemEntry>;
|
|
54
|
+
resolveLocal(itemEntry: ItemEntry, parent: any, template: any): TemplateResponseItemEntryMap;
|
|
55
|
+
resolveExpansion(itemEntry: any, columnExpansion: any, response: any): ItemEntry;
|
|
56
|
+
resolveRemote(itemEntry: any, columnInfo: any, response: any): ItemEntry;
|
|
46
57
|
fetchTemplate(itemType: string, templateOptions?: any, templateColumns?: any): Promise<any>;
|
|
47
|
-
getEntryStatus(itemType: string, itemId: number, options: any):
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
};
|
|
51
|
-
getCachedEntryStatus(itemEntry: ItemEntry, options: any): string;
|
|
52
|
-
createDeferredEntry(itemType: string, itemId: number, requestColumns: any, deferRequest: any): any;
|
|
58
|
+
getEntryStatus(itemType: string, itemId: number, options: any): EntryStatus<ItemEntry>;
|
|
59
|
+
getCachedEntryStatus(itemEntry: ItemEntry, options: any): ENTRY_STATUS;
|
|
60
|
+
createDeferredEntry(itemType: string, itemId: number, requestColumns: any, deferRequest: any): ItemEntry;
|
|
53
61
|
createEntryStub(itemType: string, itemId: number): ItemEntry;
|
|
54
|
-
createEntry(itemId: number, initial: any, derived: any, columnInfo: any):
|
|
55
|
-
resolveDeferredEntry(itemEntry: any, initial: any, derived: any, columns: any):
|
|
56
|
-
|
|
62
|
+
createEntry(itemId: number, initial: any, derived: any, columnInfo: any): ItemEntry;
|
|
63
|
+
resolveDeferredEntry(itemEntry: any, initial: any, derived: any, columns: any): ItemEntry;
|
|
64
|
+
/**
|
|
65
|
+
*
|
|
66
|
+
* @param itemType
|
|
67
|
+
* @param {BatchStatus} batchStatus
|
|
68
|
+
* @param requestColumns
|
|
69
|
+
* @param resolved
|
|
70
|
+
* @returns {ItemEntry[]}
|
|
71
|
+
*
|
|
72
|
+
* for every type of entry status there is in this batch request make sure the entries get resolved.
|
|
73
|
+
* then return a array of the resulting ItemEntryArray
|
|
74
|
+
*/
|
|
75
|
+
batchResolve(itemType: any, batchStatus: BatchStatus, requestColumns: any, resolved: any): ItemEntry[] | PromiseLike<any>;
|
|
57
76
|
cloneItem(newItemId: any, itemEntry: any, conversionMap?: any): any;
|
|
58
77
|
createConversionMap(itemType: string, itemId: number, extend: boolean, response: any): {
|
|
59
78
|
[x: string]: {
|
|
60
79
|
[x: number]: number;
|
|
61
80
|
};
|
|
62
81
|
};
|
|
63
|
-
createLocalEntries(parentType: string, localParentId: number, template: any, conversionMap: any):
|
|
82
|
+
createLocalEntries(parentType: string, localParentId: number, template: any, conversionMap: any): TemplateResponseLinkedItemEntryMap[];
|
|
64
83
|
createLocalEntry(itemId: number, template: any, modified: any, derived: any, parent?: any): ItemEntry;
|
|
65
84
|
extendConversionMap(conversionMap: any, links: any, apiResponse: any): void;
|
|
66
|
-
fetchTitle(itemType: string, itemId: number, deferRequest?: boolean): any
|
|
67
|
-
requestItem(itemType: string, itemId: number | number[], columns: any):
|
|
85
|
+
fetchTitle(itemType: string, itemId: number, deferRequest?: boolean): PromiseLike<any>;
|
|
86
|
+
requestItem(itemType: string, itemId: number | number[], columns: any): PromiseLike<ApiResponseProcessor>;
|
|
68
87
|
updateItemId(itemEntry: any, itemId: any): ItemEntry;
|
|
69
88
|
private setCreator(itemEntry);
|
|
70
89
|
}
|
|
@@ -10,6 +10,7 @@ import ItemEntryService from "./ItemEntryService";
|
|
|
10
10
|
import ItemHandler from "./ItemHandler";
|
|
11
11
|
import PromiseService from "./PromiseService";
|
|
12
12
|
import QueryService from "./QueryService";
|
|
13
|
+
import ApiResponseProcessor from './ApiResponseProcessor';
|
|
13
14
|
export default class ItemRequestService {
|
|
14
15
|
private apiRequestService;
|
|
15
16
|
private errorHandler;
|
|
@@ -21,11 +22,11 @@ export default class ItemRequestService {
|
|
|
21
22
|
private queryService;
|
|
22
23
|
private promiseService;
|
|
23
24
|
constructor(apiRequestService: ApiRequestServiceInterface, errorHandler: ErrorHandlerInterface, itemHandler: ItemHandler, columnHandler: ColumnHandler, columnExpansionFactory: ColumnExpansionFactory, columnSetFactory: ColumnSetFactory, itemEntryService: ItemEntryService, queryService: QueryService, promiseService: PromiseService);
|
|
24
|
-
requestItem(itemType: any, itemId: any, columns: any):
|
|
25
|
-
requestItems(collectionEntry: CollectionEntry, query?: any, columns?: any):
|
|
26
|
-
requestLinkItems(parentType: any, parentIdArray: any, itemType: any, query: any, columns: any):
|
|
25
|
+
requestItem(itemType: any, itemId: any, columns: any): PromiseLike<ApiResponseProcessor>;
|
|
26
|
+
requestItems(collectionEntry: CollectionEntry, query?: any, columns?: any): PromiseLike<ApiResponseProcessor>;
|
|
27
|
+
requestLinkItems(parentType: any, parentIdArray: any, itemType: any, query: any, columns: any): PromiseLike<ApiResponseProcessor>;
|
|
27
28
|
processExpansion(requestColumns: any, response: any, itemType: string, itemEntries: ItemEntry[]): ColumnExpansion;
|
|
28
|
-
processResponse(response: any, idArray: any, parent: any, columnInfo: any, columnExpansion?: any):
|
|
29
|
+
processResponse(response: any, idArray: any, parent: any, columnInfo: any, columnExpansion?: any): PromiseLike<ItemEntry[]>;
|
|
29
30
|
handleCachedItem(itemEntry: any, response: any, columnExpansion: ColumnExpansion): any;
|
|
30
31
|
processLinkResponse(response: any, parentType: any, parentIdArray: any, itemType: any, options: any): any;
|
|
31
32
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { EditResource } from '../models/EditResource';
|
|
2
2
|
export default class ItemResourceService {
|
|
3
|
-
|
|
4
|
-
constructor(itemEntryService: ItemEntryService);
|
|
3
|
+
constructor();
|
|
5
4
|
processOptions(options: any): any;
|
|
6
5
|
compareOptions(first: any, second: any): boolean;
|
|
7
|
-
|
|
6
|
+
isNewResource(resource: EditResource): boolean;
|
|
8
7
|
}
|
|
@@ -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;
|
|
@@ -53,9 +53,9 @@ export default class ResourceCache {
|
|
|
53
53
|
clearItem(itemResource: ItemResource): void;
|
|
54
54
|
clearResources(isSubTabChange?: boolean): void;
|
|
55
55
|
updateSingleItems(conversionMap: any): void;
|
|
56
|
-
revertChanges():
|
|
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
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export declare
|
|
2
|
-
CACHED
|
|
3
|
-
PROMISED
|
|
4
|
-
EXPAND
|
|
5
|
-
PROMISED_EXPAND
|
|
6
|
-
RESOLVE
|
|
7
|
-
LOCAL
|
|
8
|
-
}
|
|
1
|
+
export declare enum ENTRY_STATUS {
|
|
2
|
+
CACHED = "cached",
|
|
3
|
+
PROMISED = "promised",
|
|
4
|
+
EXPAND = "expand",
|
|
5
|
+
PROMISED_EXPAND = "promised-expand",
|
|
6
|
+
RESOLVE = "resolve",
|
|
7
|
+
LOCAL = "local",
|
|
8
|
+
}
|
|
9
9
|
export declare const COLUMN_SEPERATOR = ">";
|
|
10
10
|
export declare const RENDER_AS_SEPERATOR = ":";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import CollectionResourceService from '../classes/CollectionResourceService';
|
|
1
2
|
import ItemHandler from "../classes/ItemHandler";
|
|
2
3
|
import KeyService from '../classes/KeyService';
|
|
3
4
|
import PromiseService from '../classes/PromiseService';
|
|
@@ -13,6 +14,7 @@ export default class CollectionResourceFactory {
|
|
|
13
14
|
private changesProcessorFactory;
|
|
14
15
|
private keyService;
|
|
15
16
|
private promiseService;
|
|
16
|
-
|
|
17
|
+
private collectionResourceService;
|
|
18
|
+
constructor(errorHandler: ErrorHandlerInterface, itemHandler: ItemHandler, itemResourceFactory: ItemResourceFactory, changesProcessorFactory: ChangesProcessorFactory, keyService: KeyService, promiseService: PromiseService, collectionResourceService: CollectionResourceService);
|
|
17
19
|
construct(collectionEntry: CollectionEntry, options: any): CollectionResource;
|
|
18
20
|
}
|