@rentman/rm-core 1.0.20 → 1.0.22
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/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/ColumnUtil.d.ts +1 -0
- package/dist/definitions/src/classes/ItemAdministrator.d.ts +46 -20
- package/dist/definitions/src/classes/ItemCache.d.ts +1 -1
- 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/ModuleChangesCompiler.d.ts +5 -1
- package/dist/definitions/src/classes/QueryParser.d.ts +1 -1
- package/dist/definitions/src/classes/ResourceCache.d.ts +2 -2
- package/dist/definitions/src/classes/SocketMessageHandler.d.ts +1 -5
- package/dist/definitions/src/classes/Util.d.ts +1 -1
- package/dist/definitions/src/constants.d.ts +8 -8
- package/dist/definitions/src/factories/CollectionResourceFactory.d.ts +3 -1
- package/dist/definitions/src/factories/QueryParserFactory.d.ts +1 -1
- package/dist/definitions/src/index.d.ts +2 -2
- package/dist/definitions/src/interfaces/ApiRequestServiceInterface.d.ts +8 -8
- 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 +185 -75
- package/package.json +1 -1
- package/readme.md +2 -2
- package/dist/definitions/src/models/Column.d.ts +0 -2
|
@@ -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
|
}
|
|
@@ -18,6 +18,8 @@ import ItemRequestService from "./ItemRequestService";
|
|
|
18
18
|
import KeyService from "./KeyService";
|
|
19
19
|
import QueryService from "./QueryService";
|
|
20
20
|
import ResourceCache from "./ResourceCache";
|
|
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
25
|
private resourceCacheInterface;
|
|
@@ -41,11 +43,31 @@ export default class ItemAdministrator {
|
|
|
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: {
|
|
@@ -64,14 +86,14 @@ export default class ItemAdministrator {
|
|
|
64
86
|
};
|
|
65
87
|
};
|
|
66
88
|
/** @deprecated */
|
|
67
|
-
getCollection(itemType: string, query: any, options: any): any
|
|
68
|
-
_getCollection(itemType: string, options: any):
|
|
69
|
-
getCollectionFromDef(definition: any):
|
|
70
|
-
getLinkCollection(linkType: string, linkId: number, itemType: string, options: any):
|
|
71
|
-
getLinkCollections(linkType: string, linkIdArray: number[], itemType: string, options: any):
|
|
72
|
-
getLinkCollectionsFromDef(definition: any):
|
|
73
|
-
getAllLinkCollections(linkType: string, itemType: string, options: any):
|
|
74
|
-
getItemByDef(definition: any, isRoot: boolean): any
|
|
89
|
+
getCollection(itemType: string, query: any, options: any): PromiseLike<any>;
|
|
90
|
+
_getCollection(itemType: string, options: any): PromiseLike<CollectionResource>;
|
|
91
|
+
getCollectionFromDef(definition: any): PromiseLike<CollectionResource>;
|
|
92
|
+
getLinkCollection(linkType: string, linkId: number, itemType: string, options: any): PromiseLike<CollectionResource>;
|
|
93
|
+
getLinkCollections(linkType: string, linkIdArray: number[], itemType: string, options: any): PromiseLike<CollectionResourceParentIdMap>;
|
|
94
|
+
getLinkCollectionsFromDef(definition: any): PromiseLike<CollectionResourceParentIdMap>;
|
|
95
|
+
getAllLinkCollections(linkType: string, itemType: string, options: any): PromiseLike<CollectionEntryParentIdMap>;
|
|
96
|
+
getItemByDef(definition: any, isRoot: boolean): PromiseLike<any>;
|
|
75
97
|
cloneItem(newItemId: number, itemResource: any, options: any): ItemResource;
|
|
76
98
|
cloneCollection(collectionResource: any, options: any, conversionMap: any): CollectionResource;
|
|
77
99
|
/**
|
|
@@ -81,12 +103,16 @@ export default class ItemAdministrator {
|
|
|
81
103
|
saveCurrentResourceCache(closeTab: boolean, parameters: any, breakupByParent: boolean, onAfterCreateCallback: any, keepTabHeading?: boolean): any;
|
|
82
104
|
getCurrentCollections(): CollectionCache;
|
|
83
105
|
getCurrentItems(): ItemCache;
|
|
84
|
-
getCurrentChanges():
|
|
85
|
-
|
|
86
|
-
|
|
106
|
+
getCurrentChanges(): {
|
|
107
|
+
itemType: string;
|
|
108
|
+
itemId: number;
|
|
109
|
+
items: any;
|
|
110
|
+
};
|
|
111
|
+
addSingleItem(itemEntry: ItemEntry, options: any, isRoot?: boolean): ItemResource;
|
|
112
|
+
addSingleItems(itemEntries: ItemEntry[], options: any): ItemResource[];
|
|
87
113
|
addCollection(collectionEntry: any, resourceOptions: any, processOptions?: any): CollectionResource;
|
|
88
|
-
addCollections(collectionEntries:
|
|
89
|
-
processLinkedItems(linkedEntries: any[], options: any, addToCollections: boolean):
|
|
114
|
+
addCollections(collectionEntries: CollectionEntryParentIdMap, resourceOptions: any): CollectionResourceParentIdMap;
|
|
115
|
+
processLinkedItems(linkedEntries: any[], options: any, addToCollections: boolean): ItemResourceItemTypeMap;
|
|
90
116
|
/**
|
|
91
117
|
* @deprecated
|
|
92
118
|
*/
|
|
@@ -97,12 +123,12 @@ export default class ItemAdministrator {
|
|
|
97
123
|
*/
|
|
98
124
|
resetTabEntry(): void;
|
|
99
125
|
resetResourceCache(): void;
|
|
100
|
-
addToCollections(itemEntries: any[], resultCollectionResource: any):
|
|
126
|
+
addToCollections(itemEntries: any[], resultCollectionResource: any): ItemResource[];
|
|
101
127
|
removeFromCollections(itemEntries: any[], resultCollectionResource: any): any;
|
|
102
128
|
updateItemIdMap(collectionMap: any, conversionMap: any): void;
|
|
103
129
|
createCollectionResource(collectionEntry: any, resourceOptions: any, processOptions?: any): CollectionResource;
|
|
104
130
|
createItemResource(itemEntry: any, options: any, isRoot: boolean): ItemResource;
|
|
105
|
-
createItemResources(itemEntries: any[], options: any):
|
|
131
|
+
createItemResources(itemEntries: any[], options: any): ItemResource[];
|
|
106
132
|
/**
|
|
107
133
|
* @deprecated
|
|
108
134
|
*/
|
|
@@ -6,7 +6,7 @@ export default class ItemCache {
|
|
|
6
6
|
private itemEntryService;
|
|
7
7
|
entries: {};
|
|
8
8
|
constructor(queryMatcherFactory: QueryMatcherFactory, itemEntryService: ItemEntryService);
|
|
9
|
-
some(callback:
|
|
9
|
+
some(callback: (itemEntry) => boolean): boolean;
|
|
10
10
|
getByItemType(itemType: any): any[];
|
|
11
11
|
getByQuery(itemType: any, query: any): any[];
|
|
12
12
|
getLocalByQuery(itemType: any, query: any): any[];
|
|
@@ -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
|
}
|
|
@@ -10,7 +10,11 @@ export default class ModuleChangesCompiler {
|
|
|
10
10
|
parentMap: any;
|
|
11
11
|
destination: any;
|
|
12
12
|
constructor(itemEntryService: ItemEntryService, rootItemEntry: ItemEntry, singleItemCache: ItemCache, collectionCache: CollectionCache);
|
|
13
|
-
process():
|
|
13
|
+
process(): {
|
|
14
|
+
itemType: string;
|
|
15
|
+
itemId: number;
|
|
16
|
+
items: any;
|
|
17
|
+
};
|
|
14
18
|
private createParentMap(itemCache);
|
|
15
19
|
private processItems(itemType, itemEntries, linkAccumulator);
|
|
16
20
|
private processItem(itemEntry);
|
|
@@ -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
|
-
hasChanges
|
|
58
|
+
hasChanges: boolean;
|
|
59
59
|
detectChanges(): boolean;
|
|
60
60
|
collectionHasChanges(collectionEntry: CollectionEntry): boolean;
|
|
61
61
|
isLockable(): boolean;
|
|
@@ -3,7 +3,6 @@ import ColumnSetFactory from '../factories/ColumnSetFactory';
|
|
|
3
3
|
import RequestColumnExpansionFactory from '../factories/RequestColumnExpansionFactory';
|
|
4
4
|
import ApiRequestServiceInterface from '../interfaces/ApiRequestServiceInterface';
|
|
5
5
|
import ErrorHandlerInterface from '../interfaces/ErrorHandlerInterface';
|
|
6
|
-
import SocketMessageInterface from '../interfaces/SocketMessageInterface';
|
|
7
6
|
import ApiFormatter from './ApiFormatter';
|
|
8
7
|
import CollectionHandler from './CollectionHandler';
|
|
9
8
|
import ItemEntryService from './ItemEntryService';
|
|
@@ -12,7 +11,6 @@ import PromiseService from './PromiseService';
|
|
|
12
11
|
export default class SocketMessageHandler {
|
|
13
12
|
private promiseService;
|
|
14
13
|
private apiRequestService;
|
|
15
|
-
private socketMessageService;
|
|
16
14
|
private itemHandler;
|
|
17
15
|
private itemEntryService;
|
|
18
16
|
private collectionHandler;
|
|
@@ -21,9 +19,7 @@ export default class SocketMessageHandler {
|
|
|
21
19
|
private requestColumnExpansionFactory;
|
|
22
20
|
private apiFormatter;
|
|
23
21
|
private errorHandler;
|
|
24
|
-
|
|
25
|
-
constructor(promiseService: PromiseService, apiRequestService: ApiRequestServiceInterface, socketMessageService: SocketMessageInterface, itemHandler: ItemHandler, itemEntryService: ItemEntryService, collectionHandler: CollectionHandler, columnSetFactory: ColumnSetFactory, columnExpansionFactory: ColumnExpansionFactory, requestColumnExpansionFactory: RequestColumnExpansionFactory, apiFormatter: ApiFormatter, errorHandler: ErrorHandlerInterface);
|
|
26
|
-
destroy(): void;
|
|
22
|
+
constructor(promiseService: PromiseService, apiRequestService: ApiRequestServiceInterface, itemHandler: ItemHandler, itemEntryService: ItemEntryService, collectionHandler: CollectionHandler, columnSetFactory: ColumnSetFactory, columnExpansionFactory: ColumnExpansionFactory, requestColumnExpansionFactory: RequestColumnExpansionFactory, apiFormatter: ApiFormatter, errorHandler: ErrorHandlerInterface);
|
|
27
23
|
onMessageReceived(message: any): void;
|
|
28
24
|
formatMessageValues(values: any, columns: any): {};
|
|
29
25
|
createCollectionMap(itemType: any, items: any, columns: any): {};
|
|
@@ -22,4 +22,4 @@ export declare function isElement(node: any): boolean;
|
|
|
22
22
|
export declare function isWindow(obj: any): boolean;
|
|
23
23
|
export declare function isDefined(value: any): boolean;
|
|
24
24
|
export declare function equals(o1: any, o2: any): boolean;
|
|
25
|
-
export declare function copy(source: any, destination?: any, maxDepth?:
|
|
25
|
+
export declare function copy(source: any, destination?: any, maxDepth?: any): any;
|
|
@@ -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
|
}
|