@rentman/rm-core 1.1.6 → 1.1.7
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 +3 -0
- package/dist/dist/classes/ApiFormatter.d.ts +1 -1
- package/dist/dist/classes/CollectionHandler.d.ts +21 -14
- package/dist/dist/classes/CollectionMatcher.d.ts +1 -1
- package/dist/dist/classes/ColumnExpansion.d.ts +10 -7
- package/dist/dist/classes/ColumnSet.d.ts +2 -0
- package/dist/dist/classes/ItemHandler.d.ts +7 -6
- package/dist/dist/classes/ItemRequestService.d.ts +4 -3
- package/dist/dist/factories/CollectionEntryFactory.d.ts +3 -1
- package/dist/dist/models/CollectionEntry.d.ts +11 -6
- package/dist/dist/types/ItemTypesCollection.d.ts +8 -1
- package/dist/rm-core.js +118 -128
- package/dist/rm-core.min.js +1 -1
- package/package.json +1 -1
package/changelog.md
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
#Changelog
|
|
2
2
|
Contains new features, breaking changes and their reasoning
|
|
3
3
|
|
|
4
|
+
##v1.1.7
|
|
5
|
+
- Fixed issue where cached item entries or collection entries wouldn't be added to the local cache.
|
|
6
|
+
|
|
4
7
|
##v1.1.6
|
|
5
8
|
- Fixed issue with deferred item entries.
|
|
6
9
|
- Re-enable changes watcher after save.
|
|
@@ -27,7 +27,7 @@ export declare class ApiFormatter {
|
|
|
27
27
|
formatRequestDate(value: any): any;
|
|
28
28
|
formatRequestDuration(value: any): any;
|
|
29
29
|
formatRequestColor(value: any): any;
|
|
30
|
-
getDefaultValue(columnType: any): false |
|
|
30
|
+
getDefaultValue(columnType: any): false | 0 | "" | moment.Moment | moment.Duration | "0" | "#000000" | null;
|
|
31
31
|
isDefaultValue(columnType: any, value: any): any;
|
|
32
32
|
clone(columnType: any, value: any): any;
|
|
33
33
|
getCloneFunction(columnType: any): (date: any) => any;
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { CollectionCache, CollectionEntryService, CollectionMatcher, ColumnHandler,
|
|
1
|
+
import { CollectionCache, CollectionEntryService, CollectionMatcher, ColumnExpansion, ColumnHandler, ColumnSet, ItemCache, ItemRequestService, KeyService, QueryService } from '../classes';
|
|
2
|
+
import { ENTRY_STATUS } from '../constants';
|
|
2
3
|
import { CollectionCacheFactory, CollectionEntryFactory, CollectionMatcherFactory, ColumnSetFactory, QueryParserFactory } from '../factories';
|
|
3
4
|
import { ErrorHandlerInterface, PromiseInterface } from '../interfaces';
|
|
4
5
|
import { CollectionEntry, CollectionResource, ItemResource } from '../models';
|
|
5
|
-
import { CollectionEntryBatchStatusMap, CollectionEntryParentIdMap, EntryStatus, ItemResourceItemIdMap } from '../types';
|
|
6
|
+
import { CollectionEntryBatchStatusMap, CollectionEntryParentIdMap, EntryStatus, ItemEntryParentIdMap, ItemId, ItemResourceItemIdMap, ItemType } from '../types';
|
|
6
7
|
export declare class CollectionHandler {
|
|
7
8
|
private errorHandler;
|
|
8
9
|
private itemRequestService;
|
|
9
10
|
private columnHandler;
|
|
11
|
+
private columnSetFactory;
|
|
10
12
|
private collectionEntryFactory;
|
|
11
13
|
private collectionCacheFactory;
|
|
12
14
|
private queryParserFactory;
|
|
13
15
|
private collectionEntryService;
|
|
14
|
-
private columnSetFactory;
|
|
15
16
|
private keyService;
|
|
16
17
|
private promiseService;
|
|
17
18
|
private queryService;
|
|
18
|
-
private columnUtil;
|
|
19
19
|
private collectionMatcherFactory;
|
|
20
20
|
entries: CollectionCache;
|
|
21
|
-
constructor(errorHandler: ErrorHandlerInterface, itemRequestService: ItemRequestService, columnHandler: ColumnHandler, collectionEntryFactory: CollectionEntryFactory, collectionCacheFactory: CollectionCacheFactory, queryParserFactory: QueryParserFactory, collectionEntryService: CollectionEntryService,
|
|
21
|
+
constructor(errorHandler: ErrorHandlerInterface, itemRequestService: ItemRequestService, columnHandler: ColumnHandler, columnSetFactory: ColumnSetFactory, collectionEntryFactory: CollectionEntryFactory, collectionCacheFactory: CollectionCacheFactory, queryParserFactory: QueryParserFactory, collectionEntryService: CollectionEntryService, keyService: KeyService, promiseService: PromiseInterface, queryService: QueryService, collectionMatcherFactory: CollectionMatcherFactory);
|
|
22
22
|
getPromises(statusResource: CollectionEntryBatchStatusMap): CollectionEntry[];
|
|
23
23
|
getRequestIds(statusResource: any): number[];
|
|
24
24
|
/**
|
|
@@ -36,14 +36,21 @@ export declare class CollectionHandler {
|
|
|
36
36
|
addToCollections(collectionMap: any, updateInitial: boolean, resultResource?: CollectionResource | null): ItemResource[];
|
|
37
37
|
batchExpand(parentType: string, itemType: string, collections: CollectionResource[], newColumns: any): Promise<CollectionResource[]>;
|
|
38
38
|
batchExtend(parentType: string, itemType: string, options: any, queryCallback: any, collections: CollectionResource[], returnAllItems?: boolean): Promise<ItemResourceItemIdMap>;
|
|
39
|
-
batchFetch(parentType:
|
|
40
|
-
createStatusResource(parentType:
|
|
41
|
-
fetch(itemType:
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
39
|
+
batchFetch(parentType: ItemType, parentIdArray: ItemId[], itemType: ItemType, options: any, itemCache: ItemCache, localCollectionCache: CollectionCache, deferredCollectionCache: CollectionCache): Promise<CollectionEntryParentIdMap>;
|
|
40
|
+
createStatusResource(parentType: ItemType, parentIdArray: ItemId[], itemType: ItemType, options: any, localCollectionCache: CollectionCache, deferredCollectionCache: CollectionCache): CollectionEntryBatchStatusMap;
|
|
41
|
+
fetch(itemType: ItemType, options: any, itemCache: ItemCache, localCollectionCache: CollectionCache, deferredCollectionCache: CollectionCache): Promise<CollectionEntry>;
|
|
42
|
+
getCachedEntryStatus(collectionEntry: CollectionEntry, options: any): ENTRY_STATUS;
|
|
43
|
+
getDeferredEntryStatus(itemType: ItemType, options: any, query: any, deferredEntries: any): {
|
|
44
|
+
entry: CollectionEntry;
|
|
45
|
+
isDeferred: boolean;
|
|
46
|
+
};
|
|
47
|
+
getEntryStatus(itemType: ItemType, options: any, localEntries: CollectionCache, deferredEntries: CollectionCache): EntryStatus<CollectionEntry>;
|
|
48
|
+
handleBatchResponse(statusResource: any, itemEntryCompound: {
|
|
49
|
+
columns: ColumnSet;
|
|
50
|
+
columnExpansion?: ColumnExpansion;
|
|
51
|
+
items?: ItemEntryParentIdMap;
|
|
52
|
+
}, itemCache: ItemCache): CollectionEntryParentIdMap;
|
|
53
|
+
resolveLocal(collectionEntry: CollectionEntry, itemCache: ItemCache): Promise<CollectionEntry>;
|
|
54
|
+
resolveRemote(collectionEntry: CollectionEntry, itemCache: ItemCache): Promise<CollectionEntry>;
|
|
48
55
|
isLocal(options: any): boolean;
|
|
49
56
|
}
|
|
@@ -18,7 +18,7 @@ export declare class CollectionMatcher {
|
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
20
|
constructor(queryMatcherFactory: QueryMatcherFactory, collectionCaches: CollectionCache[], updateInitial: boolean, callOnActivate: boolean);
|
|
21
|
-
expand(itemEntry: ItemEntry):
|
|
21
|
+
expand(itemEntry: ItemEntry): this;
|
|
22
22
|
getCollectionsWithFittingItems(): CollectionEntry[];
|
|
23
23
|
addToCollections(resultResource?: CollectionResource | null): ItemResource[] | null;
|
|
24
24
|
removeFromCollections(resultResource?: CollectionResource | null): ItemResource[] | null;
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
import { ColumnUtil } from '../classes';
|
|
1
|
+
import { ColumnSet, ColumnUtil } from '../classes';
|
|
2
2
|
import { ColumnSetFactory } from '../factories';
|
|
3
|
+
import { ColumnExpansionResult, ItemType, RequestColumns, ResponseColumnMap } from '../types';
|
|
3
4
|
export declare class ColumnExpansion {
|
|
4
5
|
private columnSetFactory;
|
|
5
6
|
private columnUtil;
|
|
6
|
-
itemType:
|
|
7
|
-
requestColumns:
|
|
8
|
-
responseColumns:
|
|
9
|
-
expansionMap:
|
|
7
|
+
itemType: ItemType;
|
|
8
|
+
requestColumns: RequestColumns;
|
|
9
|
+
responseColumns: ResponseColumnMap;
|
|
10
|
+
expansionMap: {
|
|
11
|
+
[columnSetId: number]: ColumnExpansionResult;
|
|
12
|
+
};
|
|
10
13
|
requestColumnsTrue: boolean;
|
|
11
|
-
constructor(columnSetFactory: ColumnSetFactory, columnUtil: ColumnUtil, itemType:
|
|
12
|
-
run(
|
|
14
|
+
constructor(columnSetFactory: ColumnSetFactory, columnUtil: ColumnUtil, itemType: ItemType, requestColumns: RequestColumns, responseColumns: ResponseColumnMap);
|
|
15
|
+
run(columnSet: ColumnSet): ColumnExpansionResult | null;
|
|
13
16
|
private expandColumnInfo(columnSet);
|
|
14
17
|
}
|
|
@@ -27,6 +27,8 @@ export declare class ColumnSet {
|
|
|
27
27
|
enableCaching: boolean;
|
|
28
28
|
constructor(columnHandler: ColumnHandler, columnUtil: ColumnUtil, columnInfoFactory: ColumnInfoFactory, itemType: any, request: RequestColumns);
|
|
29
29
|
resolve(responseColumns: ResponseColumnMap, enableCaching?: boolean, includeIdColumn?: boolean): this;
|
|
30
|
+
expandRequestColumns(columns: RequestColumns): void;
|
|
31
|
+
isSupersetOf(columns: RequestColumns): any;
|
|
30
32
|
private processResponseColumns(responseColumns);
|
|
31
33
|
private processRequestColumns(responseColumns, includeIdColumn);
|
|
32
34
|
private getRequestColumnInfo(requestColumn, itemType, parent, responseColumns);
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { ApiResponseProcessor, BatchStatus, ColumnHandler,
|
|
1
|
+
import { ApiResponseProcessor, BatchStatus, ColumnHandler, ColumnUtil, ItemCache, ItemEntryService, KeyService } from '../classes';
|
|
2
2
|
import { ENTRY_STATUS } from '../constants';
|
|
3
3
|
import { BatchStatusFactory, ColumnExpansionFactory, ColumnSetFactory, ItemCacheFactory, ItemEntryFactory } from '../factories';
|
|
4
4
|
import { ApiRequestServiceInterface, ErrorHandlerInterface, PromiseInterface } from '../interfaces';
|
|
5
5
|
import { ItemEntry } from '../models';
|
|
6
|
-
import { ApiTemplateItemTypeMap, EntryStatus, ItemId, ItemIdConversionMap, ItemType, RequestColumns, TemplateResponseItemEntryMap, TemplateResponseLinkedItemEntryMap } from '../types';
|
|
6
|
+
import { ApiResponse, ApiTemplateItemTypeMap, EntryStatus, ItemId, ItemIdConversionMap, ItemType, RequestColumns, TemplateResponseItemEntryMap, TemplateResponseLinkedItemEntryMap } from '../types';
|
|
7
|
+
import { ColumnExpansion } from './ColumnExpansion';
|
|
8
|
+
import { ColumnSet } from './ColumnSet';
|
|
7
9
|
export declare class ItemHandler {
|
|
8
10
|
private apiRequestService;
|
|
9
11
|
private errorHandler;
|
|
@@ -34,12 +36,11 @@ export declare class ItemHandler {
|
|
|
34
36
|
fetchItems(itemType: any, itemIds: any, options: any, localItemCache: ItemCache): Promise<ItemEntry[]>;
|
|
35
37
|
resolveCached(itemEntry: ItemEntry, status: ENTRY_STATUS, options: any): Promise<ItemEntry>;
|
|
36
38
|
resolveLocal(itemEntry: ItemEntry, parent: any, template: any, localItemCache: ItemCache): TemplateResponseItemEntryMap;
|
|
37
|
-
resolveExpansion(itemEntry:
|
|
38
|
-
resolveRemote(itemEntry:
|
|
39
|
+
resolveExpansion(itemEntry: ItemEntry, columnExpansion: ColumnExpansion, response: ApiResponse): ItemEntry;
|
|
40
|
+
resolveRemote(itemEntry: ItemEntry, columnSet: ColumnSet, response: ApiResponse): ItemEntry | null;
|
|
39
41
|
fetchTemplate(itemType: string, templateOptions?: any, templateColumns?: any): Promise<any>;
|
|
40
42
|
getEntryStatus(itemType: ItemType, itemId: ItemId, options: any, localItemCache: ItemCache): EntryStatus<ItemEntry>;
|
|
41
|
-
|
|
42
|
-
expandColumnSetStub(columnSet: ColumnSet, columns: RequestColumns): void;
|
|
43
|
+
isColumnSuperset(itemEntry: ItemEntry, columns: RequestColumns): any;
|
|
43
44
|
getCachedEntryStatus(itemEntry: ItemEntry, options: any): ENTRY_STATUS;
|
|
44
45
|
/**
|
|
45
46
|
*
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { ApiResponseProcessor, ColumnExpansion, ItemHandler, QueryService } from '../classes';
|
|
1
|
+
import { ApiResponseProcessor, ColumnExpansion, ColumnSet, ItemHandler, QueryService } from '../classes';
|
|
2
2
|
import { ColumnExpansionFactory, ColumnSetFactory, ItemEntryFactory } from '../factories';
|
|
3
3
|
import { ApiRequestServiceInterface, ErrorHandlerInterface, PromiseInterface } from '../interfaces';
|
|
4
4
|
import { CollectionEntry, ItemEntry } from '../models';
|
|
5
|
+
import { ApiResponse, EntryParentNull, ItemId, ItemType } from '../types';
|
|
5
6
|
export declare class ItemRequestService {
|
|
6
7
|
private apiRequestService;
|
|
7
8
|
private errorHandler;
|
|
@@ -16,7 +17,7 @@ export declare class ItemRequestService {
|
|
|
16
17
|
requestItems(collectionEntry: CollectionEntry, query?: any, columns?: any): Promise<ApiResponseProcessor>;
|
|
17
18
|
requestLinkItems(parentType: any, parentIdArray: any, itemType: any, query: any, columns: any): Promise<ApiResponseProcessor>;
|
|
18
19
|
processExpansion(requestColumns: any, response: any, itemType: string, itemEntries: ItemEntry[]): ColumnExpansion;
|
|
19
|
-
processResponse(response:
|
|
20
|
+
processResponse(response: ApiResponse, idArray: ItemId[], parent: EntryParentNull, columnSet: ColumnSet, columnExpansion?: ColumnExpansion): Promise<ItemEntry[]>;
|
|
20
21
|
handleCachedItem(itemEntry: any, response: any, columnExpansion: ColumnExpansion): any;
|
|
21
|
-
processLinkResponse(response:
|
|
22
|
+
processLinkResponse(response: ApiResponse, parentType: ItemType, parentIdArray: ItemId[], itemType: ItemType, options: any): Promise<any>;
|
|
22
23
|
}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { CollectionEntryService, ItemEntryService, ItemRequestService, KeyService, QueryService } from '../classes';
|
|
2
|
+
import { ColumnSetFactory } from '../factories';
|
|
2
3
|
import { ErrorHandlerInterface, PromiseInterface } from '../interfaces';
|
|
3
4
|
import { CollectionEntry } from '../models/';
|
|
4
5
|
export declare class CollectionEntryFactory {
|
|
5
6
|
private collectionEntryService;
|
|
7
|
+
private columnSetFactory;
|
|
6
8
|
private errorHandler;
|
|
7
9
|
private itemEntryService;
|
|
8
10
|
private itemRequestService;
|
|
9
11
|
private keyService;
|
|
10
12
|
private promiseService;
|
|
11
13
|
private queryService;
|
|
12
|
-
constructor(collectionEntryService: CollectionEntryService, errorHandler: ErrorHandlerInterface, itemEntryService: ItemEntryService, itemRequestService: ItemRequestService, keyService: KeyService, promiseService: PromiseInterface, queryService: QueryService);
|
|
14
|
+
constructor(collectionEntryService: CollectionEntryService, columnSetFactory: ColumnSetFactory, errorHandler: ErrorHandlerInterface, itemEntryService: ItemEntryService, itemRequestService: ItemRequestService, keyService: KeyService, promiseService: PromiseInterface, queryService: QueryService);
|
|
13
15
|
construct(itemType: string, options: any): CollectionEntry;
|
|
14
16
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { CollectionEntryService, ColumnInfo, ColumnSet, ItemEntryService, ItemRequestService, KeyService, QueryService } from '../classes';
|
|
2
|
-
import { CollectionEntryFactory } from '../factories';
|
|
1
|
+
import { CollectionEntryService, ColumnExpansion, ColumnInfo, ColumnSet, ItemEntryService, ItemRequestService, KeyService, QueryService } from '../classes';
|
|
2
|
+
import { CollectionEntryFactory, ColumnSetFactory } from '../factories';
|
|
3
3
|
import { ErrorHandlerInterface, PromiseInterface } from '../interfaces';
|
|
4
4
|
import { CollectionResource, ItemEntry, ItemResource } from '../models';
|
|
5
|
-
import { EntryParentNull, ItemId, ItemIdConversionMap, ItemType } from '../types';
|
|
5
|
+
import { EntryParentNull, ItemId, ItemIdConversionMap, ItemType, RequestColumns } from '../types';
|
|
6
6
|
export declare class CollectionEntry {
|
|
7
7
|
private collectionEntryFactory;
|
|
8
8
|
private collectionEntryService;
|
|
9
|
+
private columnSetFactory;
|
|
9
10
|
private errorHandler;
|
|
10
11
|
private itemEntryService;
|
|
11
12
|
private itemRequestService;
|
|
@@ -24,9 +25,12 @@ export declare class CollectionEntry {
|
|
|
24
25
|
deferred: any;
|
|
25
26
|
promise: Promise<CollectionEntry>;
|
|
26
27
|
reloadQueued: boolean;
|
|
27
|
-
constructor(collectionEntryFactory: CollectionEntryFactory, collectionEntryService: CollectionEntryService, errorHandler: ErrorHandlerInterface, itemEntryService: ItemEntryService, itemRequestService: ItemRequestService, keyService: KeyService, promiseService: PromiseInterface, queryService: QueryService, itemType: ItemType, options: any);
|
|
28
|
+
constructor(collectionEntryFactory: CollectionEntryFactory, collectionEntryService: CollectionEntryService, columnSetFactory: ColumnSetFactory, errorHandler: ErrorHandlerInterface, itemEntryService: ItemEntryService, itemRequestService: ItemRequestService, keyService: KeyService, promiseService: PromiseInterface, queryService: QueryService, itemType: ItemType, options: any);
|
|
28
29
|
isDeferred(): boolean;
|
|
29
|
-
resolve(itemEntryCompound:
|
|
30
|
+
resolve(itemEntryCompound: {
|
|
31
|
+
columns: ColumnSet;
|
|
32
|
+
items: ItemEntry[];
|
|
33
|
+
}): CollectionEntry;
|
|
30
34
|
isLocal(): boolean;
|
|
31
35
|
matchParent(itemType: any, itemId: any): boolean;
|
|
32
36
|
forEach(callback: (itemEntry: ItemEntry) => void): void;
|
|
@@ -40,7 +44,8 @@ export declare class CollectionEntry {
|
|
|
40
44
|
extendQuery(callback: any): any;
|
|
41
45
|
extend(queryCallback: any, collectionResource: any, callOnAdd?: any, updateInitial?: any): Promise<any>;
|
|
42
46
|
queueReload(): void;
|
|
43
|
-
|
|
47
|
+
expandColumns(columnExpansion: ColumnExpansion): void;
|
|
48
|
+
expandRequestColumns(requestColumns: RequestColumns): void;
|
|
44
49
|
getAddedItems(returnItemIds?: boolean): (number | ItemEntry)[];
|
|
45
50
|
getRemovedItems(returnItemIds?: boolean): (number | ItemEntry)[];
|
|
46
51
|
getUpdatedItems(): ItemEntry[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CollectionMatcher, RequestColumnExpansion } from '../classes';
|
|
1
|
+
import { CollectionMatcher, ColumnSet, 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 = {
|
|
@@ -20,6 +20,9 @@ export declare type ItemType = string;
|
|
|
20
20
|
export declare type ItemEntryEntryStatusMap = {
|
|
21
21
|
[entryStatus: string]: ItemEntry[];
|
|
22
22
|
};
|
|
23
|
+
export declare type ItemEntryParentIdMap = {
|
|
24
|
+
[parentId: number]: ItemEntry[];
|
|
25
|
+
};
|
|
23
26
|
export declare type ItemIdConversionMap = {
|
|
24
27
|
[itemType: string]: {
|
|
25
28
|
[itemId: number]: number;
|
|
@@ -50,6 +53,10 @@ export declare type ResponseColumnMap = {
|
|
|
50
53
|
};
|
|
51
54
|
};
|
|
52
55
|
export declare type LocalColumn = object;
|
|
56
|
+
export declare type ColumnExpansionResult = {
|
|
57
|
+
merged: ColumnSet;
|
|
58
|
+
difference: ColumnSet;
|
|
59
|
+
};
|
|
53
60
|
export declare type ApiResponse = any;
|
|
54
61
|
export interface ApiTemplate {
|
|
55
62
|
fields: any;
|