@rentman/rm-core 1.2.2 → 1.2.4
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 +14 -0
- package/dist/dist/classes/ItemAdministrator.d.ts +7 -8
- package/dist/dist/classes/ItemEntryService.d.ts +4 -2
- package/dist/dist/classes/ItemHandler.d.ts +10 -6
- package/dist/dist/classes/KeyService.d.ts +0 -1
- package/dist/dist/types/ItemTypesCollection.d.ts +5 -11
- package/dist/rm-core.js +893 -1217
- package/dist/rm-core.min.js +1 -1
- package/package.json +1 -1
package/changelog.md
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
#Changelog
|
|
2
2
|
Contains new features, breaking changes and their reasoning
|
|
3
3
|
|
|
4
|
+
## v1.2.4
|
|
5
|
+
- **Breaking:** When a local item cannot by found, instead of a new item being created an error is thrown. This means it
|
|
6
|
+
is no longer possible to create local items using `getItemById` or `getItemsById` in the `ItemAdministrator` class.
|
|
7
|
+
- **Breaking:** Removed `getItemDefinition` and `getItemByDef` in the `ItemAdministrator` class. Added `getItemByState`.
|
|
8
|
+
- Renamed types `TemplateResponseItemEntryMap` to `TemplateItemEntryMap` and `TemplateResponseLinkedItemEntryMap` to
|
|
9
|
+
`TemplateLinkedItemEntryMap`.
|
|
10
|
+
- Removed `getCollectionCacheKey` in `KeyService`. (Legacy code.)
|
|
11
|
+
|
|
12
|
+
## v1.2.3
|
|
13
|
+
- Fixed issue where derived values deeper than one layer couldn't be resolved.
|
|
14
|
+
|
|
15
|
+
## v1.2.2
|
|
16
|
+
- Fixed issue where in derived values weren't set after create request.
|
|
17
|
+
|
|
4
18
|
## v1.2.1
|
|
5
19
|
- **Breaking:** Replaced the `initial` parameter with the `callOnChange` parameter (`true` by default) in the `commit`
|
|
6
20
|
function of the `EditResource` class.
|
|
@@ -2,7 +2,7 @@ import { CollectionCache, CollectionEntryService, CollectionHandler, CollectionM
|
|
|
2
2
|
import { CollectionMatcherFactory, ColumnSetFactory, LocalCacheFactory, ModuleChangesCompilationFactory } from '../factories';
|
|
3
3
|
import { ApiRequestServiceInterface, AuthInterface, ErrorHandlerInterface, LocalCacheManagerInterface, PromiseInterface } from '../interfaces';
|
|
4
4
|
import { CollectionEntry, CollectionResource, ItemEntry, ItemResource } from '../models';
|
|
5
|
-
import { CollectionEntryParentIdMap, CollectionResourceParentIdMap, CreateRequestParameterMap,
|
|
5
|
+
import { CollectionEntryParentIdMap, CollectionResourceParentIdMap, CreateRequestParameterMap, ItemId, ItemIdConversionMap, ItemOptions, ItemResourceItemTypeMap, ItemType, LocalCacheCallbackCondition, OnSaveCallback, TemplateItemEntryMap, TemplateLinkedItemEntryMap } from '../types';
|
|
6
6
|
export declare class ItemAdministrator {
|
|
7
7
|
private apiRequestService;
|
|
8
8
|
private authInterface;
|
|
@@ -23,13 +23,11 @@ export declare class ItemAdministrator {
|
|
|
23
23
|
private queryService;
|
|
24
24
|
constructor(apiRequestService: ApiRequestServiceInterface, authInterface: AuthInterface, collectionEntryService: CollectionEntryService, collectionHandler: CollectionHandler, collectionMatcherFactory: CollectionMatcherFactory, collectionResourceService: CollectionResourceService, columnSetFactory: ColumnSetFactory, errorHandler: ErrorHandlerInterface, itemEntryService: ItemEntryService, itemHandler: ItemHandler, itemRequestService: ItemRequestService, keyService: KeyService, localCacheFactory: LocalCacheFactory, localCacheManager: LocalCacheManagerInterface, moduleChangesCompilationFactory: ModuleChangesCompilationFactory, promiseInterface: PromiseInterface, queryService: QueryService);
|
|
25
25
|
invalidateCache(): void;
|
|
26
|
-
getItemDefinition(itemType: ItemType, stateKey: number | string, options: ItemOptions): ItemDefinition;
|
|
27
26
|
getCollectionMatcher(itemEntries: ItemEntry[], addToTab: boolean): CollectionMatcher;
|
|
28
27
|
fetchTitle(itemType: any, itemId: any, deferRequest: any): Promise<any>;
|
|
29
|
-
getItemById(itemType: ItemType, itemId: ItemId, options:
|
|
28
|
+
getItemById(itemType: ItemType, itemId: ItemId, options: ItemOptions, isRoot?: boolean): Promise<ItemResource>;
|
|
30
29
|
getItemsById(itemType: string, itemIds: number[], options: any): Promise<ItemResource[]>;
|
|
31
30
|
getItemsByQuery(itemType: string, query: any, options: any): Promise<ItemResource[]>;
|
|
32
|
-
getDuplicateById(itemType: string, duplicateId: number, options: any): Promise<any>;
|
|
33
31
|
/**
|
|
34
32
|
* The return value is depended on the return links boolean. true returns the TemplateResponseItemEntryMap.
|
|
35
33
|
* The type has to be asserted at use since you only know the type of the return value when the function is called
|
|
@@ -38,9 +36,11 @@ export declare class ItemAdministrator {
|
|
|
38
36
|
* @param options
|
|
39
37
|
* @param {boolean} returnLinks
|
|
40
38
|
* @param {boolean} isRoot
|
|
41
|
-
* @returns {Promise<ItemResource
|
|
39
|
+
* @returns {Promise<ItemResource | TemplateItemEntryMap>}
|
|
42
40
|
*/
|
|
43
|
-
getNewResource(itemType:
|
|
41
|
+
getNewResource(itemType: ItemType, options?: ItemOptions, returnLinks?: boolean, isRoot?: boolean): Promise<ItemResource | TemplateItemEntryMap>;
|
|
42
|
+
getDuplicateById(itemType: ItemType, duplicateId: ItemId, options?: ItemOptions, returnLinks?: boolean, isRoot?: boolean): Promise<ItemResource | TemplateItemEntryMap>;
|
|
43
|
+
getItemByState(itemType: ItemType, stateKey: ItemId | string, options?: ItemOptions, isRoot?: boolean): Promise<ItemResource>;
|
|
44
44
|
getCollectionDef(itemType: string, options: any): {
|
|
45
45
|
itemType: string;
|
|
46
46
|
options: {
|
|
@@ -67,7 +67,6 @@ export declare class ItemAdministrator {
|
|
|
67
67
|
getLinkCollections(linkType: string, linkIdArray: number[], itemType: string, options: any): Promise<CollectionResourceParentIdMap>;
|
|
68
68
|
getLinkCollectionsFromDef(definition: any): Promise<CollectionResourceParentIdMap>;
|
|
69
69
|
getAllLinkCollections(linkType: string, itemType: string, options: any): Promise<CollectionEntryParentIdMap>;
|
|
70
|
-
getItemByDef(definition: ItemDefinition, isRoot?: boolean): Promise<any>;
|
|
71
70
|
cloneItem(itemResource: ItemResource, options: any): ItemResource;
|
|
72
71
|
cloneCollection(collectionResource: CollectionResource, options: any, conversionMap: any): CollectionResource;
|
|
73
72
|
saveCurrentLocalCache(closeTab?: boolean, parameters?: CreateRequestParameterMap, breakupByParent?: boolean, onAfterCreateCallback?: (conversionMap: ItemIdConversionMap) => void): any;
|
|
@@ -81,7 +80,7 @@ export declare class ItemAdministrator {
|
|
|
81
80
|
addSingleItem(itemEntry: ItemEntry, options: ItemOptions, isRoot?: boolean, localCache?: LocalCache): ItemResource;
|
|
82
81
|
addSingleItems(itemEntries: ItemEntry[], options: ItemOptions): ItemResource[];
|
|
83
82
|
addCollection(collectionEntry: CollectionEntry, options: any): CollectionResource;
|
|
84
|
-
processLinkedItems(linkedEntries:
|
|
83
|
+
processLinkedItems(linkedEntries: TemplateLinkedItemEntryMap[], options: ItemOptions, addToCollections: boolean): ItemResourceItemTypeMap;
|
|
85
84
|
getLocalCache(): LocalCache;
|
|
86
85
|
resetLocalCache(): void;
|
|
87
86
|
addToCollections(itemEntries: ItemEntry[], resultCollectionResource?: CollectionResource): ItemResource[] | null;
|
|
@@ -6,9 +6,11 @@ export declare class ItemEntryService {
|
|
|
6
6
|
private authInterface;
|
|
7
7
|
private keyService;
|
|
8
8
|
undefinedItemError: string;
|
|
9
|
-
ALL_PERMISSIONS: number;
|
|
10
9
|
constructor(authInterface: AuthInterface, keyService: KeyService);
|
|
11
|
-
processOptions(options
|
|
10
|
+
processOptions(options?: any): any;
|
|
11
|
+
createUnfoundLocalItemError(itemType: ItemType): {
|
|
12
|
+
message: string;
|
|
13
|
+
};
|
|
12
14
|
createLocalConversionMap(itemType: ItemType, itemId: ItemId, doExtend: boolean | undefined, apiResponse: ApiResponse): ItemIdConversionMap;
|
|
13
15
|
expandLocalConversionMap(parentType: ItemType, parentId: ItemId, apiResponse: ApiResponse, conversionMap: ItemIdConversionMap): void;
|
|
14
16
|
expandConversionMap(itemEntry: ItemEntry, conversionMap: ItemIdConversionMap, newItemId?: ItemId): any;
|
|
@@ -3,7 +3,7 @@ import { ENTRY_STATUS } from '../constants';
|
|
|
3
3
|
import { BatchStatusFactory, ColumnExpansionFactory, ColumnSetFactory, ItemCacheFactory, ItemEntryFactory, TemplateFactory } from '../factories';
|
|
4
4
|
import { ApiRequestServiceInterface, ErrorHandlerInterface, PromiseInterface } from '../interfaces';
|
|
5
5
|
import { ItemEntry, Template } from '../models';
|
|
6
|
-
import { ApiResponse, EntryStatus, FieldMap, ItemId, ItemIdConversionMap, ItemType, RequestColumns,
|
|
6
|
+
import { ApiResponse, EntryStatus, FieldMap, ItemId, ItemIdConversionMap, ItemOptions, ItemType, RequestColumns, TemplateItemEntryMap, TemplateLinkedItemEntryMap } from '../types';
|
|
7
7
|
export declare class ItemHandler {
|
|
8
8
|
private apiFormatter;
|
|
9
9
|
private apiRequestService;
|
|
@@ -24,7 +24,8 @@ export declare class ItemHandler {
|
|
|
24
24
|
[itemType: string]: Template;
|
|
25
25
|
};
|
|
26
26
|
constructor(apiFormatter: ApiFormatter, apiRequestService: ApiRequestServiceInterface, batchStatusFactory: BatchStatusFactory, columnExpansionFactory: ColumnExpansionFactory, columnHandler: ColumnHandler, columnSetFactory: ColumnSetFactory, columnUtil: ColumnUtil, errorHandler: ErrorHandlerInterface, itemCacheFactory: ItemCacheFactory, itemEntryFactory: ItemEntryFactory, itemEntryService: ItemEntryService, keyService: KeyService, promiseService: PromiseInterface, templateFactory: TemplateFactory);
|
|
27
|
-
fetchItem(itemType: ItemType, itemId: ItemId, options: any, localItemCache: ItemCache): Promise<ItemEntry
|
|
27
|
+
fetchItem(itemType: ItemType, itemId: ItemId, options: any, localItemCache: ItemCache): Promise<ItemEntry>;
|
|
28
|
+
fetchNewItem(itemType: ItemType, options: ItemOptions, localItemCache: ItemCache): Promise<TemplateItemEntryMap>;
|
|
28
29
|
/**
|
|
29
30
|
*
|
|
30
31
|
* @param itemType
|
|
@@ -37,7 +38,7 @@ export declare class ItemHandler {
|
|
|
37
38
|
*/
|
|
38
39
|
fetchItems(itemType: ItemType, itemIds: ItemId[], options: any, localItemCache: ItemCache): Promise<ItemEntry[]>;
|
|
39
40
|
resolveCached(itemEntry: ItemEntry, status: ENTRY_STATUS, options: any): Promise<ItemEntry>;
|
|
40
|
-
resolveLocal(itemEntry: ItemEntry, parent: any, template: any, localItemCache: ItemCache):
|
|
41
|
+
resolveLocal(itemEntry: ItemEntry, parent: any, template: any, localItemCache: ItemCache): TemplateItemEntryMap;
|
|
41
42
|
resolveExpansion(itemEntry: ItemEntry, columnExpansion: ColumnExpansion, response: ApiResponse): ItemEntry;
|
|
42
43
|
resolveRemote(itemEntry: ItemEntry, columnSet: ColumnSet, response: ApiResponse): ItemEntry | null;
|
|
43
44
|
resolveRemoteValues(itemEntry: ItemEntry, response: ApiResponse): ItemEntry | null;
|
|
@@ -46,7 +47,7 @@ export declare class ItemHandler {
|
|
|
46
47
|
derived: FieldMap;
|
|
47
48
|
} | null;
|
|
48
49
|
fetchTemplate(itemType: string, templateOptions?: any, templateColumns?: any): Promise<Template>;
|
|
49
|
-
getEntryStatus(itemType: ItemType, itemId: ItemId, options: any, localItemCache: ItemCache): EntryStatus<ItemEntry
|
|
50
|
+
getEntryStatus(itemType: ItemType, itemId: ItemId, options: any, localItemCache: ItemCache): EntryStatus<ItemEntry> | null;
|
|
50
51
|
isColumnSuperset(itemEntry: ItemEntry, columns: RequestColumns): any;
|
|
51
52
|
getCachedEntryStatus(itemEntry: ItemEntry, options: any): ENTRY_STATUS;
|
|
52
53
|
/**
|
|
@@ -60,8 +61,11 @@ export declare class ItemHandler {
|
|
|
60
61
|
* for every type of entry status there is in this batch request make sure the entries get resolved.
|
|
61
62
|
* then return a array of the resulting ItemEntryArray
|
|
62
63
|
*/
|
|
63
|
-
batchResolve(itemType: ItemType, batchStatus: BatchStatus, requestColumns: RequestColumns, resolved:
|
|
64
|
-
|
|
64
|
+
batchResolve(itemType: ItemType, batchStatus: BatchStatus, requestColumns: RequestColumns, resolved: {
|
|
65
|
+
entries: ItemEntry[];
|
|
66
|
+
requests?: ApiResponseProcessor;
|
|
67
|
+
}): ItemEntry[] | Promise<any>;
|
|
68
|
+
createLocalEntries(parentType: ItemType, localParentId: ItemId, template: any, itemIdConversion: ItemIdConversionMap, localItemCache: ItemCache, excludeItemTypes?: ItemType[]): TemplateLinkedItemEntryMap[];
|
|
65
69
|
fetchTitle(itemType: ItemType, itemId: ItemId, deferRequest: boolean | undefined, localItemCache: ItemCache): Promise<any>;
|
|
66
70
|
resolveDerivedValues(itemEntries: ItemEntry[], columns: ColumnInfo[], localItemCache: ItemCache): Promise<ItemEntry[]>;
|
|
67
71
|
private getDefaultValuesByColumn(itemEntries, rootColumn);
|
|
@@ -3,7 +3,6 @@ export declare class KeyService {
|
|
|
3
3
|
separator: string;
|
|
4
4
|
constructor();
|
|
5
5
|
getSingleKey(itemType: string, itemId: number | string): string;
|
|
6
|
-
getCollectionCacheKey(parentType: string, parentId: number, childType: string): string;
|
|
7
6
|
getCssKey(): any;
|
|
8
7
|
parseStateKey(stateKey: string): StateKey | null;
|
|
9
8
|
getDuplicateStateKey(itemId: string | number): string;
|
|
@@ -10,12 +10,6 @@ export declare type FieldMap = {
|
|
|
10
10
|
[key: string]: any;
|
|
11
11
|
};
|
|
12
12
|
export declare type ItemOptions = any;
|
|
13
|
-
export declare type ItemDefinition = {
|
|
14
|
-
itemType: ItemType;
|
|
15
|
-
itemId: ItemId;
|
|
16
|
-
options: ItemOptions;
|
|
17
|
-
isNew: boolean;
|
|
18
|
-
};
|
|
19
13
|
export declare const enum StateKeyType {
|
|
20
14
|
New = "new",
|
|
21
15
|
Duplicate = "duplicate",
|
|
@@ -23,10 +17,10 @@ export declare const enum StateKeyType {
|
|
|
23
17
|
export declare type StateKey = {
|
|
24
18
|
type: StateKeyType;
|
|
25
19
|
template?: string;
|
|
26
|
-
itemId?:
|
|
20
|
+
itemId?: number;
|
|
27
21
|
};
|
|
28
22
|
export declare type OnSaveCallback = (localCache: LocalCache, conversionMap: ItemIdConversionMap) => any;
|
|
29
|
-
export declare
|
|
23
|
+
export declare enum LocalCacheCallbackCondition {
|
|
30
24
|
Always = "always",
|
|
31
25
|
OnClose = "onClose",
|
|
32
26
|
SkipOnClose = "skipOnClose",
|
|
@@ -94,11 +88,11 @@ export declare type ColumnExpansionResult = {
|
|
|
94
88
|
difference: ColumnSet;
|
|
95
89
|
};
|
|
96
90
|
export declare type ApiResponse = ApiResponseProcessor;
|
|
97
|
-
export declare type
|
|
91
|
+
export declare type TemplateItemEntryMap = {
|
|
98
92
|
main: ItemEntry;
|
|
99
|
-
linked:
|
|
93
|
+
linked: TemplateLinkedItemEntryMap[];
|
|
100
94
|
};
|
|
101
|
-
export declare type
|
|
95
|
+
export declare type TemplateLinkedItemEntryMap = {
|
|
102
96
|
itemType: string;
|
|
103
97
|
itemEntries: ItemEntry[];
|
|
104
98
|
};
|