@rentman/rm-core 3.0.1 → 4.0.0
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 +13 -0
- package/dist/rm-core.js +8452 -8668
- package/dist/rm-core.min.js +2 -2
- package/dist/types/classes/ApiResponseProcessor.d.ts +2 -1
- package/dist/types/classes/ChangesDelta.d.ts +3 -6
- package/dist/types/classes/ChangesDeltaBase.d.ts +1 -0
- package/dist/types/classes/ConversionMapService.d.ts +27 -0
- package/dist/types/classes/CreatedChangesDelta.d.ts +15 -0
- package/dist/types/classes/InternalChangesDelta.d.ts +1 -0
- package/dist/types/classes/ItemCache.d.ts +1 -1
- package/dist/types/classes/ItemCreateService.d.ts +6 -10
- package/dist/types/classes/ItemEntryService.d.ts +2 -9
- package/dist/types/classes/cache/AbstractCache.d.ts +3 -51
- package/dist/types/classes/cache/ItemHandlerBase.d.ts +1 -1
- package/dist/types/classes/cache/server/ServerCache.d.ts +3 -20
- package/dist/types/classes/cache/server/ServerItemHandler.d.ts +2 -1
- package/dist/types/classes/cache/transaction/TransactionCache.d.ts +14 -44
- package/dist/types/classes/cache/transaction/TransactionCollectionHandler.d.ts +6 -17
- package/dist/types/classes/cache/transaction/TransactionItemHandler.d.ts +14 -34
- package/dist/types/classes/index.d.ts +2 -0
- package/dist/types/core.d.ts +5 -4
- package/dist/types/factories/ItemResourceFactory.d.ts +2 -5
- package/dist/types/factories/TransactionCacheFactory.d.ts +4 -47
- package/dist/types/interfaces/AbstractCacheDependencyInterface.d.ts +44 -0
- package/dist/types/interfaces/ServerCacheDependencyInterface.d.ts +7 -0
- package/dist/types/interfaces/TransactionCollectionHandlerDependencyInterface.d.ts +20 -0
- package/dist/types/interfaces/TransactionItemHandlerDependencyInterface.d.ts +26 -0
- package/dist/types/interfaces/index.d.ts +4 -0
- package/dist/types/models/CollectionResource.d.ts +2 -1
- package/dist/types/models/CollectionResourceOptions.d.ts +3 -3
- package/dist/types/models/ItemResource.d.ts +3 -12
- package/dist/types/models/Template.d.ts +1 -1
- package/dist/types/models/index.d.ts +0 -1
- package/dist/types/types/ItemTypesCollection.d.ts +9 -8
- package/package.json +1 -1
- package/dist/types/models/ItemResourceOptions.d.ts +0 -6
|
@@ -16,7 +16,6 @@ export declare class ApiResponseProcessor {
|
|
|
16
16
|
};
|
|
17
17
|
columnMap: any;
|
|
18
18
|
constructor(apiFormatter: ApiFormatter, response: any);
|
|
19
|
-
private createColumnMaps;
|
|
20
19
|
fetchColumnObject(itemType: ItemType): ResponseColumn;
|
|
21
20
|
fetchValue(itemType: ItemType, itemId: ItemId, columnId: string): any;
|
|
22
21
|
fetchColumnArray(itemType: ItemType): ResponseColumn[];
|
|
@@ -27,4 +26,6 @@ export declare class ApiResponseProcessor {
|
|
|
27
26
|
fetchColumnsObject(): {
|
|
28
27
|
[itemType: string]: ResponseColumn;
|
|
29
28
|
};
|
|
29
|
+
private addLazyFormattingFunction;
|
|
30
|
+
private createColumnMaps;
|
|
30
31
|
}
|
|
@@ -2,13 +2,9 @@ import { ItemEntry } from '../models';
|
|
|
2
2
|
import { EntryParent, EntryParentNull, FieldMap, ItemId, ItemType, PromiseInterface } from '../types';
|
|
3
3
|
import { ChangesDeltaBase } from './ChangesDeltaBase';
|
|
4
4
|
import { ColumnSet } from './ColumnSet';
|
|
5
|
+
import { CreatedChangesDelta } from './CreatedChangesDelta';
|
|
5
6
|
import { ItemCreateService } from './ItemCreateService';
|
|
6
7
|
import { ItemEntryService } from './ItemEntryService';
|
|
7
|
-
export declare type ChangesDeltaItemCreateDelta<ItemTypeType extends ItemType = any> = {
|
|
8
|
-
itemId: ItemId;
|
|
9
|
-
fields: FieldMap<ItemTypeType>;
|
|
10
|
-
columns: ColumnSet<ItemTypeType>;
|
|
11
|
-
};
|
|
12
8
|
/**
|
|
13
9
|
* @description
|
|
14
10
|
* ChangesDelta used to apply changes from outside of the core to a transaction
|
|
@@ -22,7 +18,7 @@ export declare type ChangesDeltaItemCreateDelta<ItemTypeType extends ItemType =
|
|
|
22
18
|
*/
|
|
23
19
|
export declare class ChangesDelta extends ChangesDeltaBase {
|
|
24
20
|
private itemCreateService;
|
|
25
|
-
created:
|
|
21
|
+
created: CreatedChangesDelta;
|
|
26
22
|
constructor(itemCreateService: ItemCreateService, itemEntryService: ItemEntryService);
|
|
27
23
|
/**
|
|
28
24
|
* @description
|
|
@@ -59,4 +55,5 @@ export declare class ChangesDelta extends ChangesDeltaBase {
|
|
|
59
55
|
* Convenience function to assign the proper parent fields, will call {@link ChangesDeltaBase.setItemUpdated setItemUpdated} internally
|
|
60
56
|
*/
|
|
61
57
|
setItemMoved(entry: ItemEntry, to: EntryParent): void;
|
|
58
|
+
isEmpty(): boolean;
|
|
62
59
|
}
|
|
@@ -46,4 +46,5 @@ export declare abstract class ChangesDeltaBase {
|
|
|
46
46
|
setItemUpdated<ItemEntryType extends ItemEntry>(entry: ItemEntryType, fields: FieldMap<ItemEntryType['itemType']>, columnExpansionResult?: ColumnExpansionResult<ItemEntryType['itemType']> | null, parent?: EntryParentNull): void;
|
|
47
47
|
setItemDeleted(deleted: ItemEntry): void;
|
|
48
48
|
setItemsDeleted(deleted: ItemEntry[]): void;
|
|
49
|
+
isEmpty(): boolean;
|
|
49
50
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ItemEntry } from '../models';
|
|
2
|
+
import { ApiResponse, EntryParentNull, FieldMap, ItemId, ItemIdConversionMap, ItemType } from '../types';
|
|
3
|
+
import { ColumnInfo } from './ColumnInfo';
|
|
4
|
+
import { KeyService } from './KeyService';
|
|
5
|
+
/**
|
|
6
|
+
* @description A 'ConversionMap' is used to update a set of item IDs to another. This happens when processing back-end
|
|
7
|
+
* responses (create / template) or cloning items in the front-end. A conversion map is grouped by item type, as item
|
|
8
|
+
* ID's are not unique across types.
|
|
9
|
+
*
|
|
10
|
+
* TODO: In the future, we should create a class and a 'ConversionMapFactory'.
|
|
11
|
+
*/
|
|
12
|
+
export declare class ConversionMapService {
|
|
13
|
+
private keyService;
|
|
14
|
+
constructor(keyService: KeyService);
|
|
15
|
+
createLocalConversionMap(itemType: ItemType, itemId: ItemId, doExtend: boolean | undefined, apiResponse: ApiResponse): ItemIdConversionMap;
|
|
16
|
+
expandLocalConversionMap(parentType: ItemType, parentId: ItemId, apiResponse: ApiResponse, conversionMap: ItemIdConversionMap): void;
|
|
17
|
+
expandConversionMap(itemEntry: ItemEntry, conversionMap: ItemIdConversionMap, newItemId?: ItemId): ItemId;
|
|
18
|
+
batchExpandConversionMap(itemEntries: Array<ItemEntry<any>>, conversionMap: ItemIdConversionMap): ItemIdConversionMap;
|
|
19
|
+
getConversionValue(itemType: ItemType, itemId: ItemId, map: ItemIdConversionMap): ItemId | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* @description
|
|
22
|
+
* Updates the columns in `fields` using the `parent` and `conversionMap`.
|
|
23
|
+
* @param parent - When retrieving an item the 'link' column is not present in the template response, and is
|
|
24
|
+
* added at a later stage. The value for this column can be read from this parameter.
|
|
25
|
+
*/
|
|
26
|
+
updateItemValues<ItemTypeType extends ItemType>(source: FieldMap<ItemTypeType>, destination: FieldMap<ItemTypeType>, itemColumns: Array<ColumnInfo<ItemTypeType>>, conversionMap: ItemIdConversionMap, parent?: EntryParentNull): void;
|
|
27
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { FieldMap, ItemId, ItemType } from '../types';
|
|
2
|
+
import { ColumnSet } from './ColumnSet';
|
|
3
|
+
export declare type ChangesDeltaItemCreateDelta<ItemTypeType extends ItemType = any> = {
|
|
4
|
+
itemId: ItemId;
|
|
5
|
+
fields: FieldMap<ItemTypeType>;
|
|
6
|
+
columns: ColumnSet<ItemTypeType>;
|
|
7
|
+
};
|
|
8
|
+
export declare class CreatedChangesDelta {
|
|
9
|
+
private tuples;
|
|
10
|
+
constructor();
|
|
11
|
+
add<ItemTypeType extends ItemType>(itemId: ItemId, fields: FieldMap<ItemTypeType>, columns: ColumnSet<ItemTypeType>): void;
|
|
12
|
+
isEmpty(): boolean;
|
|
13
|
+
forEach(callback: (tuple: ChangesDeltaItemCreateDelta, itemType: ItemType, index: number) => void): void;
|
|
14
|
+
contains(itemType: ItemType): boolean;
|
|
15
|
+
}
|
|
@@ -35,4 +35,5 @@ export declare class InternalChangesDelta extends ChangesDeltaBase {
|
|
|
35
35
|
* Parent fields are non-writable so we need to keep track of moved entries another way (to do a linkTo request)
|
|
36
36
|
*/
|
|
37
37
|
setItemMoved(entry: ItemEntry, to: EntryParent): void;
|
|
38
|
+
isEmpty(): boolean;
|
|
38
39
|
}
|
|
@@ -17,7 +17,7 @@ export declare class ItemCache {
|
|
|
17
17
|
getLocalByQuery<ItemTypeType extends ItemType>(itemType: ItemTypeType, query: CollectionQuery): ItemEntry<ItemTypeType>[];
|
|
18
18
|
getByParent<ItemTypeType extends ItemType>(parentType: ItemType, parentId: ItemId, itemType: ItemTypeType): ItemEntry<ItemTypeType>[];
|
|
19
19
|
batchGetLocalByParent<ItemTypeType extends ItemType>(parentType: ItemType, parentIds: ItemId[], itemType: ItemTypeType, additionalQuery: any): ItemEntryParentIdMap<ItemTypeType>;
|
|
20
|
-
forEach(callback: (itemEntry: ItemEntry
|
|
20
|
+
forEach(callback: (itemEntry: ItemEntry) => void): void;
|
|
21
21
|
toArray(): ItemEntry<string>[];
|
|
22
22
|
add<ItemTypeType extends ItemType>(itemEntry: ItemEntry<ItemTypeType>): ItemEntry<ItemTypeType>;
|
|
23
23
|
get<ItemTypeType extends ItemType>(itemType: ItemTypeType, itemId: string | ItemId): undefined | ItemEntry<ItemTypeType>;
|
|
@@ -2,21 +2,18 @@ import { ColumnSetFactory } from '../factories';
|
|
|
2
2
|
import { ErrorHandlerInterface, PromiseLibraryInterface } from '../interfaces';
|
|
3
3
|
import { Template } from '../models';
|
|
4
4
|
import { EntryParentNull, FieldMap, FilterItemEntryCallback, ItemId, ItemIdConversionMap, ItemType, ModifyFieldsCallback, PromiseInterface } from '../types';
|
|
5
|
-
import { ApiFormatter } from './ApiFormatter';
|
|
6
5
|
import { ChangesDelta } from './ChangesDelta';
|
|
7
|
-
import {
|
|
8
|
-
import { ItemEntryService } from './ItemEntryService';
|
|
6
|
+
import { ConversionMapService } from './ConversionMapService';
|
|
9
7
|
import { KeyService } from './KeyService';
|
|
10
8
|
import { TemplateCache } from './TemplateCache';
|
|
11
9
|
export declare class ItemCreateService {
|
|
10
|
+
private columnSetFactory;
|
|
11
|
+
private conversionMapService;
|
|
12
|
+
private errorHandler;
|
|
12
13
|
private keyService;
|
|
13
|
-
private templateCache;
|
|
14
14
|
private promiseService;
|
|
15
|
-
private
|
|
16
|
-
|
|
17
|
-
private apiFormatter;
|
|
18
|
-
private columnSetFactory;
|
|
19
|
-
constructor(keyService: KeyService, templateCache: TemplateCache, promiseService: PromiseLibraryInterface, errorHandler: ErrorHandlerInterface, itemEntryService: ItemEntryService, apiFormatter: ApiFormatter, columnSetFactory: ColumnSetFactory);
|
|
15
|
+
private templateCache;
|
|
16
|
+
constructor(columnSetFactory: ColumnSetFactory, conversionMapService: ConversionMapService, errorHandler: ErrorHandlerInterface, keyService: KeyService, promiseService: PromiseLibraryInterface, templateCache: TemplateCache);
|
|
20
17
|
/**
|
|
21
18
|
* @description
|
|
22
19
|
* Fetches a new {@link Template template} and sets the items created on the passed {@link ChangesDelta}
|
|
@@ -24,5 +21,4 @@ export declare class ItemCreateService {
|
|
|
24
21
|
createItemsFromValues<ItemTypeType extends ItemType>(changesDelta: ChangesDelta, itemType: ItemTypeType, valuesArray: Array<FieldMap<ItemTypeType>>, parent?: EntryParentNull): PromiseInterface<void>;
|
|
25
22
|
processTemplate<ItemTypeType extends ItemType>(changesDelta: ChangesDelta, itemType: ItemTypeType, itemId: ItemId, parent: EntryParentNull, template: Template<ItemTypeType>, filterItemEntryCallback?: FilterItemEntryCallback, modifyFieldsCallback?: ModifyFieldsCallback): void;
|
|
26
23
|
processTemplateLinkItems<ParentItemType extends ItemType>(changesDelta: ChangesDelta, parentType: ParentItemType, localParentId: ItemId, template: Template<ParentItemType>, itemIdConversion: ItemIdConversionMap, filterItemEntryCallback?: FilterItemEntryCallback, modifyFieldsCallback?: ModifyFieldsCallback): void;
|
|
27
|
-
updateItemValues<ItemTypeType extends ItemType>(changes: FieldMap<ItemTypeType>, parent: EntryParentNull, itemColumns: Array<ColumnInfo<ItemTypeType>>, conversionMap: ItemIdConversionMap): FieldMap<ItemTypeType>;
|
|
28
24
|
}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import { KeyService } from '../classes';
|
|
2
1
|
import { AuthInterface } from '../interfaces';
|
|
3
2
|
import { LinkTreeServiceInterface } from '../interfaces/LinkTreeServiceInterface';
|
|
4
3
|
import { ItemEntry, ItemEntryOptions } from '../models';
|
|
5
|
-
import {
|
|
4
|
+
import { EntryParent, EntryParentNull, FieldMap, ItemError, ItemOptionsInterface, ItemType } from '../types';
|
|
6
5
|
export declare class ItemEntryService {
|
|
7
6
|
private authInterface;
|
|
8
|
-
private keyService;
|
|
9
7
|
private linkTreeService;
|
|
10
|
-
constructor(authInterface: AuthInterface,
|
|
8
|
+
constructor(authInterface: AuthInterface, linkTreeService: LinkTreeServiceInterface);
|
|
11
9
|
matchParent(oldParent: EntryParentNull, newParent: EntryParentNull): boolean;
|
|
12
10
|
/**
|
|
13
11
|
* @description
|
|
@@ -30,11 +28,6 @@ export declare class ItemEntryService {
|
|
|
30
28
|
createUnfoundRemoteItemError(): ItemError;
|
|
31
29
|
createUnfoundLocalItemError(itemType: ItemType): ItemError;
|
|
32
30
|
createExistingLocalItemError(itemType: ItemType): ItemError;
|
|
33
|
-
createLocalConversionMap(itemType: ItemType, itemId: ItemId, doExtend: boolean | undefined, apiResponse: ApiResponse): ItemIdConversionMap;
|
|
34
|
-
expandLocalConversionMap(parentType: ItemType, parentId: ItemId, apiResponse: ApiResponse, conversionMap: ItemIdConversionMap): void;
|
|
35
|
-
expandConversionMap(itemEntry: ItemEntry<any>, conversionMap: ItemIdConversionMap, newItemId?: ItemId): ItemId;
|
|
36
|
-
batchExpandConversionMap(itemEntries: Array<ItemEntry<any>>, conversionMap: ItemIdConversionMap): ItemIdConversionMap;
|
|
37
|
-
getConversionValue(itemType: ItemType, itemId: ItemId, map: ItemIdConversionMap): ItemId | undefined;
|
|
38
31
|
getFullName(firstName?: string, infix?: string, lastName?: string): string;
|
|
39
32
|
getTitleField(itemType: ItemType): string;
|
|
40
33
|
getLocalDefaultValues(): FieldMap;
|
|
@@ -1,29 +1,13 @@
|
|
|
1
1
|
import { RmCore } from '../../core';
|
|
2
|
-
import {
|
|
3
|
-
import { ChangesDeltaFactory } from '../../factories/ChangesDeltaFactory';
|
|
4
|
-
import { AuthInterface, ErrorHandlerInterface, ExceptionHandlerInterface, PromiseLibraryInterface } from '../../interfaces';
|
|
5
|
-
import { LinkTreeServiceInterface } from '../../interfaces/LinkTreeServiceInterface';
|
|
2
|
+
import { AbstractCacheDependencyInterface } from '../../interfaces';
|
|
6
3
|
import { CollectionEntry, ItemEntry } from '../../models';
|
|
7
4
|
import { EntryParentNull, FieldMap, ItemIdConversionMap, ItemType, PromiseInterface } from '../../types';
|
|
8
|
-
import { ApiFormatter } from '../ApiFormatter';
|
|
9
|
-
import { ApiRequestService } from '../ApiRequestService';
|
|
10
5
|
import { ChangesDelta } from '../ChangesDelta';
|
|
11
6
|
import { ChangesDeltaResult } from '../ChangesDeltaBase';
|
|
12
7
|
import { OnAfterCreateCallback } from '../ChangesProcessor';
|
|
13
8
|
import { CollectionCache } from '../CollectionCache';
|
|
14
|
-
import { CollectionEntryService } from '../CollectionEntryService';
|
|
15
|
-
import { ColumnCache } from '../ColumnCache';
|
|
16
|
-
import { ColumnHandler } from '../ColumnHandler';
|
|
17
|
-
import { ColumnUtil } from '../ColumnUtil';
|
|
18
9
|
import { InternalChangesDelta } from '../InternalChangesDelta';
|
|
19
10
|
import { ItemCache } from '../ItemCache';
|
|
20
|
-
import { ItemCreateService } from '../ItemCreateService';
|
|
21
|
-
import { ItemEntryService } from '../ItemEntryService';
|
|
22
|
-
import { KeyService } from '../KeyService';
|
|
23
|
-
import { LockService } from '../LockService';
|
|
24
|
-
import { QueryService } from '../QueryService';
|
|
25
|
-
import { RequestBufferManager } from '../RequestBufferManager';
|
|
26
|
-
import { TemplateCache } from '../TemplateCache';
|
|
27
11
|
import { ServerCache } from './server/ServerCache';
|
|
28
12
|
import { ServerCollectionHandler } from './server/ServerCollectionHandler';
|
|
29
13
|
import { ServerItemEntryChanges, ServerItemHandler } from './server/ServerItemHandler';
|
|
@@ -32,45 +16,13 @@ import { TransactionCollectionHandler } from './transaction/TransactionCollectio
|
|
|
32
16
|
import { TransactionItemEntryChanges, TransactionItemHandler } from './transaction/TransactionItemHandler';
|
|
33
17
|
import { TransactionValidatorFactory } from './transaction/TransactionValidator';
|
|
34
18
|
export declare abstract class AbstractCache {
|
|
19
|
+
protected dependencies: AbstractCacheDependencyInterface;
|
|
35
20
|
core: RmCore;
|
|
36
|
-
protected columnCache: ColumnCache;
|
|
37
|
-
protected requestBufferManager: RequestBufferManager;
|
|
38
|
-
protected requestColumnExpansionFactory: RequestColumnExpansionFactory;
|
|
39
|
-
protected queryMatcherFactory: QueryMatcherFactory;
|
|
40
|
-
protected authInterface: AuthInterface;
|
|
41
|
-
protected changesDeltaFactory: ChangesDeltaFactory;
|
|
42
|
-
protected lockService: LockService;
|
|
43
|
-
protected moduleChangesCompilationFactory: ModuleChangesCompilationFactory;
|
|
44
|
-
protected collectionResourceFactory: CollectionResourceFactory;
|
|
45
|
-
protected itemResourceFactory: ItemResourceFactory;
|
|
46
|
-
protected templateCache: TemplateCache;
|
|
47
|
-
protected itemCacheFactory: ItemCacheFactory;
|
|
48
|
-
protected collectionCacheFactory: CollectionCacheFactory;
|
|
49
|
-
protected errorHandler: ErrorHandlerInterface;
|
|
50
|
-
protected exceptionHandler: ExceptionHandlerInterface;
|
|
51
|
-
protected promiseService: PromiseLibraryInterface;
|
|
52
|
-
protected apiRequestService: ApiRequestService;
|
|
53
|
-
protected columnExpansionFactory: ColumnExpansionFactory;
|
|
54
|
-
protected columnHandler: ColumnHandler;
|
|
55
|
-
protected columnSetFactory: ColumnSetFactory;
|
|
56
|
-
protected columnSubsetCacheFactory: ColumnSubsetCacheFactory;
|
|
57
|
-
protected columnUtil: ColumnUtil;
|
|
58
|
-
protected itemEntryFactory: ItemEntryFactory;
|
|
59
|
-
protected itemEntryService: ItemEntryService;
|
|
60
|
-
protected keyService: KeyService;
|
|
61
|
-
protected collectionEntryFactory: CollectionEntryFactory;
|
|
62
|
-
protected collectionEntryService: CollectionEntryService;
|
|
63
|
-
protected collectionMatcherFactory: CollectionMatcherFactory;
|
|
64
|
-
protected queryParserFactory: QueryParserFactory;
|
|
65
|
-
protected queryService: QueryService;
|
|
66
|
-
protected apiFormatter: ApiFormatter;
|
|
67
|
-
protected linkTreeService: LinkTreeServiceInterface;
|
|
68
|
-
protected changesDeltaService: ItemCreateService;
|
|
69
21
|
children: TransactionCache[];
|
|
70
22
|
readonly itemHandler: TransactionItemHandler | ServerItemHandler;
|
|
71
23
|
readonly collectionHandler: TransactionCollectionHandler | ServerCollectionHandler;
|
|
72
24
|
parent: AbstractCache | null;
|
|
73
|
-
protected constructor(
|
|
25
|
+
protected constructor(dependencies: AbstractCacheDependencyInterface, core: RmCore);
|
|
74
26
|
createChild(id?: string, validatorFactory?: TransactionValidatorFactory): TransactionCache;
|
|
75
27
|
onChildDestroy(cache: TransactionCache): void;
|
|
76
28
|
abstract getLocalCollectionEntryByQueryString(itemType: ItemType, queryString: string): CollectionEntry | undefined;
|
|
@@ -3,10 +3,10 @@ import { ErrorHandlerInterface, PromiseLibraryInterface } from '../../interfaces
|
|
|
3
3
|
import { ItemEntry, ItemEntryOptions } from '../../models';
|
|
4
4
|
import { ApiQuery, ApiRequestColumns, FieldMap, ItemId, ItemType, PromiseInterface } from '../../types';
|
|
5
5
|
import { ApiFormatter } from '../ApiFormatter';
|
|
6
|
-
import { ChangesDeltaItemCreateDelta } from '../ChangesDelta';
|
|
7
6
|
import { ChangesDeltaBase, ChangesDeltaItemUpdateDelta } from '../ChangesDeltaBase';
|
|
8
7
|
import { ColumnInfo } from '../ColumnInfo';
|
|
9
8
|
import { ColumnUtil } from '../ColumnUtil';
|
|
9
|
+
import { ChangesDeltaItemCreateDelta } from '../CreatedChangesDelta';
|
|
10
10
|
import { ItemCache } from '../ItemCache';
|
|
11
11
|
import { AbstractCache } from './AbstractCache';
|
|
12
12
|
import { ServerItemEntryChanges } from './server/ServerItemHandler';
|
|
@@ -1,29 +1,12 @@
|
|
|
1
1
|
import { RmCore } from '../../../core';
|
|
2
|
-
import {
|
|
3
|
-
import { ChangesDeltaFactory } from '../../../factories/ChangesDeltaFactory';
|
|
4
|
-
import { ChangesProcessorFactory } from '../../../factories/ChangesProcessorFactory';
|
|
5
|
-
import { AuthInterface, ErrorHandlerInterface, ExceptionHandlerInterface, PromiseLibraryInterface } from '../../../interfaces';
|
|
6
|
-
import { LinkTreeServiceInterface } from '../../../interfaces/LinkTreeServiceInterface';
|
|
2
|
+
import { ServerCacheDependencyInterface } from '../../../interfaces';
|
|
7
3
|
import { CollectionEntry, ItemEntry } from '../../../models';
|
|
8
4
|
import { ApiRequestColumnMap, EntryParent, EntryParentNull, FieldMap, ItemIdConversionMap, ItemType, PromiseInterface } from '../../../types';
|
|
9
|
-
import { ApiFormatter } from '../../ApiFormatter';
|
|
10
|
-
import { ApiRequestService } from '../../ApiRequestService';
|
|
11
5
|
import { ApiResponseProcessor } from '../../ApiResponseProcessor';
|
|
12
6
|
import { ChangesDelta } from '../../ChangesDelta';
|
|
13
7
|
import { ChangesDeltaResult } from '../../ChangesDeltaBase';
|
|
14
8
|
import { OnAfterCreateCallback } from '../../ChangesProcessor';
|
|
15
|
-
import { CollectionEntryService } from '../../CollectionEntryService';
|
|
16
|
-
import { ColumnCache } from '../../ColumnCache';
|
|
17
|
-
import { ColumnHandler } from '../../ColumnHandler';
|
|
18
|
-
import { ColumnUtil } from '../../ColumnUtil';
|
|
19
9
|
import { InternalChangesDelta } from '../../InternalChangesDelta';
|
|
20
|
-
import { ItemCreateService } from '../../ItemCreateService';
|
|
21
|
-
import { ItemEntryService } from '../../ItemEntryService';
|
|
22
|
-
import { KeyService } from '../../KeyService';
|
|
23
|
-
import { LockService } from '../../LockService';
|
|
24
|
-
import { QueryService } from '../../QueryService';
|
|
25
|
-
import { RequestBufferManager } from '../../RequestBufferManager';
|
|
26
|
-
import { TemplateCache } from '../../TemplateCache';
|
|
27
10
|
import { AbstractCache } from '../AbstractCache';
|
|
28
11
|
import { TransactionCache } from '../transaction/TransactionCache';
|
|
29
12
|
import { ServerCollectionHandler } from './ServerCollectionHandler';
|
|
@@ -36,11 +19,11 @@ import { ServerItemEntryChanges, ServerItemHandler } from './ServerItemHandler';
|
|
|
36
19
|
* It's basically a local representation of the database
|
|
37
20
|
*/
|
|
38
21
|
export declare class ServerCache extends AbstractCache {
|
|
39
|
-
|
|
22
|
+
protected dependencies: ServerCacheDependencyInterface;
|
|
40
23
|
readonly itemHandler: ServerItemHandler;
|
|
41
24
|
readonly collectionHandler: ServerCollectionHandler;
|
|
42
25
|
parent: null;
|
|
43
|
-
constructor(
|
|
26
|
+
constructor(dependencies: ServerCacheDependencyInterface, core: RmCore);
|
|
44
27
|
getServerCache(): ServerCache;
|
|
45
28
|
processResponse(response: ApiResponseProcessor, requestColumnMap: ApiRequestColumnMap, isCalledAfterApiSave?: boolean, isCalledAfterSocketUpdate?: boolean, changesDelta?: ChangesDelta): PromiseInterface<ChangesDeltaResult>;
|
|
46
29
|
/**
|
|
@@ -2,8 +2,9 @@ import { ColumnSubsetCacheFactory, ItemCacheFactory, ItemEntryFactory, QueryPars
|
|
|
2
2
|
import { ErrorHandlerInterface, PromiseLibraryInterface } from '../../../interfaces';
|
|
3
3
|
import { ItemEntry, ItemEntryOptions } from '../../../models';
|
|
4
4
|
import { ApiQuery, ApiRequestColumns, FieldMap, ItemId, ItemType, PromiseInterface } from '../../../types';
|
|
5
|
-
import { ChangesDelta
|
|
5
|
+
import { ChangesDelta } from '../../ChangesDelta';
|
|
6
6
|
import { ChangesDeltaItemUpdateDelta } from '../../ChangesDeltaBase';
|
|
7
|
+
import { ChangesDeltaItemCreateDelta } from '../../CreatedChangesDelta';
|
|
7
8
|
import { ApiFormatter, ApiResponseProcessor, ColumnExpansion, ColumnSet, ColumnUtil, QueryService, RequestBufferManager, RequestBufferResponse, TransactionItemEntryChanges } from '../../index';
|
|
8
9
|
import { ItemHandlerBase } from '../ItemHandlerBase';
|
|
9
10
|
import { ServerCache } from './ServerCache';
|
|
@@ -1,22 +1,11 @@
|
|
|
1
1
|
import { RmCore } from '../../../core';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { LinkTreeServiceInterface } from '../../../interfaces/LinkTreeServiceInterface';
|
|
6
|
-
import { CollectionEntry, CollectionResource, CollectionResourceOptionsInterface, ItemEntry, ItemResource } from '../../../models';
|
|
7
|
-
import { ApiQuery, CollectionDefinition, CollectionOptionsInterface, CollectionResourceParentIdMap, ConversionMap, CreateRequestParameterMap, EntryParentNull, FieldMap, ItemId, ItemIdConversionMap, ItemOptionsInterface, ItemResourcesItemTypeMap, ItemType, ItemTypeMap, LinkCollectionDefinition, PromiseInterface } from '../../../types';
|
|
2
|
+
import { AbstractCacheDependencyInterface } from '../../../interfaces/AbstractCacheDependencyInterface';
|
|
3
|
+
import { CollectionEntry, CollectionResource, CollectionResourceOptionsInterface, ItemEntry, ItemEntryOptions, ItemResource } from '../../../models';
|
|
4
|
+
import { ApiQuery, CollectionDefinition, CollectionOptionsInterface, CollectionResourceParentIdMap, ConversionMap, CreateRequestParameterMap, DeregFunction, EntryParentNull, FieldChangeCallback, FieldMap, ItemId, ItemIdConversionMap, ItemOptionsInterface, ItemResourcesItemTypeMap, ItemType, ItemTypeMap, LinkCollectionDefinition, PromiseInterface } from '../../../types';
|
|
8
5
|
import { ChangesDelta } from '../../ChangesDelta';
|
|
9
6
|
import { ChangesDeltaResult } from '../../ChangesDeltaBase';
|
|
10
|
-
import {
|
|
11
|
-
import { ColumnHandler } from '../../ColumnHandler';
|
|
12
|
-
import { ColumnUtil } from '../../ColumnUtil';
|
|
13
|
-
import { ApiFormatter, ApiRequestService, ColumnCache, LockService, ModuleChangesCompilationResult, OnAfterCreateCallback, RequestBufferManager, TransactionCacheCallbackCondition, TransactionCacheCallbackType, TransactionCollectionHandler, TransactionItemEntryChanges, TransactionItemHandler, TransactionValidatorFactory } from '../../index';
|
|
7
|
+
import { ModuleChangesCompilationResult, OnAfterCreateCallback, TransactionCacheCallbackCondition, TransactionCacheCallbackType, TransactionCollectionHandler, TransactionItemEntryChanges, TransactionItemHandler, TransactionValidatorFactory } from '../../index';
|
|
14
8
|
import { InternalChangesDelta } from '../../InternalChangesDelta';
|
|
15
|
-
import { ItemCreateService } from '../../ItemCreateService';
|
|
16
|
-
import { ItemEntryService } from '../../ItemEntryService';
|
|
17
|
-
import { KeyService } from '../../KeyService';
|
|
18
|
-
import { QueryService } from '../../QueryService';
|
|
19
|
-
import { TemplateCache } from '../../TemplateCache';
|
|
20
9
|
import { AbstractCache } from '../AbstractCache';
|
|
21
10
|
import { ServerCache } from '../server/ServerCache';
|
|
22
11
|
import { TransactionEventHandler } from './TransactionEventHandler';
|
|
@@ -99,13 +88,14 @@ export declare class TransactionCache extends AbstractCache {
|
|
|
99
88
|
readonly eventHandler: TransactionEventHandler;
|
|
100
89
|
private readonly validator?;
|
|
101
90
|
private changesInterval;
|
|
102
|
-
constructor(
|
|
91
|
+
constructor(dependencies: AbstractCacheDependencyInterface, core: RmCore, parent: AbstractCache,
|
|
103
92
|
/**
|
|
104
93
|
* @description
|
|
105
94
|
* For debugging purposes
|
|
106
95
|
*/
|
|
107
96
|
id?: string | undefined, validatorFactory?: TransactionValidatorFactory);
|
|
108
97
|
destroy(): void;
|
|
98
|
+
registerFieldChangeCallback<ItemTypeType extends ItemType>(itemType: ItemTypeType, itemId: ItemId, callback: FieldChangeCallback<ItemTypeType>): DeregFunction;
|
|
109
99
|
createChangesDelta(): ChangesDelta;
|
|
110
100
|
getFirstErrorString(): undefined | string;
|
|
111
101
|
/**
|
|
@@ -177,15 +167,6 @@ export declare class TransactionCache extends AbstractCache {
|
|
|
177
167
|
* @param copyFields If set, will call {@link ApiFormatter.copyFields ApiFormatter.copyFields}, otherwise just returns the object
|
|
178
168
|
*/
|
|
179
169
|
getItemChangesRecursively(itemEntryId: ItemEntry['id'], copyFields?: boolean): FieldMap;
|
|
180
|
-
/**
|
|
181
|
-
* @description
|
|
182
|
-
* Removes the {@link ItemResource ItemResource} from the transaction, preventing the {@link ItemResource.options.onChange the onChange callback} from being called.
|
|
183
|
-
* You should call this function when the resource is no longer needed
|
|
184
|
-
*
|
|
185
|
-
* @remark
|
|
186
|
-
* Does not remove changes
|
|
187
|
-
*/
|
|
188
|
-
clearItemResource(resource: ItemResource): void;
|
|
189
170
|
/**
|
|
190
171
|
* @description
|
|
191
172
|
* Removes the {@link CollectionResource CollectionResource} from the transaction, preventing the {@link CollectionResource.options.onAdd onAdd} and {@link CollectionResource.options.onRemove onRemove} callbacks from being called.
|
|
@@ -256,17 +237,6 @@ export declare class TransactionCache extends AbstractCache {
|
|
|
256
237
|
updateItemIdMap(collectionMap: {
|
|
257
238
|
[itemId: number]: any;
|
|
258
239
|
}, conversionMap: ConversionMap): void;
|
|
259
|
-
/**
|
|
260
|
-
* @description
|
|
261
|
-
* Clones the {@link CollectionEntry CollectionEntry} and all {@link ItemEntry ItemEntries} in it, and sets the parent of the new entries.
|
|
262
|
-
* Returns a {@link CollectionResource CollectionResource} of the newly cloned {@link CollectionEntry CollectionEntry}
|
|
263
|
-
*/
|
|
264
|
-
cloneCollection<ItemTypeType extends ItemType>(collectionResource: CollectionResource<ItemTypeType>, options: CollectionOptionsInterface<ItemTypeType>, conversionMap: ItemIdConversionMap): CollectionResource<ItemTypeType>;
|
|
265
|
-
/**
|
|
266
|
-
* @description
|
|
267
|
-
* Clones the {@link ItemEntry ItemEntry} and returns a {@link ItemResource ItemResource} of the newly cloned {@link ItemEntry ItemEntry}
|
|
268
|
-
*/
|
|
269
|
-
cloneItem<ItemTypeType extends ItemType>(itemResource: ItemResource<ItemTypeType>, options: ItemOptionsInterface): PromiseInterface<ItemResource<ItemTypeType>>;
|
|
270
240
|
getAllLinkCollections<ItemTypeType extends ItemType>(linkType: ItemType, itemType: ItemTypeType, options: CollectionOptionsInterface<ItemTypeType>): PromiseInterface<CollectionResourceParentIdMap<ItemTypeType>>;
|
|
271
241
|
getLinkCollectionsFromDef<ItemTypeType extends ItemType>(linkType: ItemType, linkIdArray: ItemId[], definition: LinkCollectionDefinition<ItemTypeType>): PromiseInterface<CollectionResourceParentIdMap<ItemTypeType>>;
|
|
272
242
|
getLinkCollections<ItemTypeType extends ItemType>(linkType: ItemType, linkIdArray: ItemId[], itemType: ItemTypeType, options: CollectionOptionsInterface<ItemTypeType>): PromiseInterface<CollectionResourceParentIdMap<ItemTypeType>>;
|
|
@@ -284,27 +254,27 @@ export declare class TransactionCache extends AbstractCache {
|
|
|
284
254
|
getItemByState<ItemTypeType extends ItemType>(itemType: ItemTypeType, stateKey: ItemId | string, options?: ItemOptionsInterface, isRoot?: boolean): PromiseInterface<ItemResource<ItemTypeType>>;
|
|
285
255
|
getDuplicateById<ItemTypeType extends ItemType>(itemType: ItemTypeType, duplicateId: ItemId, options: ItemOptionsInterface, returnLinks: true, isRoot?: boolean): PromiseInterface<ItemResourceLinks<ItemTypeType>>;
|
|
286
256
|
getDuplicateById<ItemTypeType extends ItemType>(itemType: ItemTypeType, duplicateId: ItemId, options: ItemOptionsInterface, returnLinks?: boolean, isRoot?: boolean): PromiseInterface<ItemResource<ItemTypeType>>;
|
|
287
|
-
getNewResourceWithId<ItemTypeType extends ItemType>(itemType: ItemTypeType, itemId: ItemId, options:
|
|
288
|
-
getNewResourceWithId<ItemTypeType extends ItemType>(itemType: ItemTypeType, itemId: ItemId, options:
|
|
257
|
+
getNewResourceWithId<ItemTypeType extends ItemType>(itemType: ItemTypeType, itemId: ItemId, options: Partial<ItemEntryOptions>, returnLinks: true, isRoot?: boolean): PromiseInterface<ItemResourceLinks<ItemTypeType>>;
|
|
258
|
+
getNewResourceWithId<ItemTypeType extends ItemType>(itemType: ItemTypeType, itemId: ItemId, options: Partial<ItemEntryOptions>, returnLinks?: boolean, isRoot?: boolean): PromiseInterface<ItemResource<ItemTypeType>>;
|
|
289
259
|
getNewResource<ItemTypeType extends ItemType>(itemType: ItemTypeType, options: ItemOptionsInterface, returnLinks: true, isRoot?: boolean): PromiseInterface<ItemResourceLinks<ItemTypeType>>;
|
|
290
260
|
getNewResource<ItemTypeType extends ItemType>(itemType: ItemTypeType, options: ItemOptionsInterface, returnLinks?: boolean, isRoot?: boolean): PromiseInterface<ItemResource<ItemTypeType>>;
|
|
291
261
|
/**
|
|
292
262
|
* @description
|
|
293
263
|
* Fetches multiple items with their respective changes of the current {@link TransactionCache transaction}
|
|
294
264
|
*/
|
|
295
|
-
getItemsByQuery<ItemTypeType extends ItemType>(itemType: ItemTypeType, query: ApiQuery, options?:
|
|
265
|
+
getItemsByQuery<ItemTypeType extends ItemType>(itemType: ItemTypeType, query: ApiQuery, options?: Partial<ItemEntryOptions>): PromiseInterface<Array<ItemResource<ItemTypeType>>>;
|
|
296
266
|
/**
|
|
297
267
|
* @description
|
|
298
268
|
* Fetches multiple items with their respective changes of the current {@link TransactionCache transaction}
|
|
299
269
|
*/
|
|
300
|
-
getItemsById<ItemTypeType extends ItemType>(itemType: ItemTypeType, itemIds: ItemId[], options?:
|
|
270
|
+
getItemsById<ItemTypeType extends ItemType>(itemType: ItemTypeType, itemIds: ItemId[], options?: Partial<ItemEntryOptions>): PromiseInterface<Array<ItemResource<ItemTypeType>>>;
|
|
301
271
|
/**
|
|
302
272
|
* @description
|
|
303
273
|
* Fetches the item with the changes of the current {@link TransactionCache transaction}
|
|
304
274
|
*
|
|
305
275
|
* @param isRoot Sets the item as the root item of the transaction, new items will be linked to this item (if there's a connection in the LinkTree)
|
|
306
276
|
*/
|
|
307
|
-
getItemById<ItemTypeType extends ItemType>(itemType: ItemTypeType, itemId: ItemId, options?:
|
|
277
|
+
getItemById<ItemTypeType extends ItemType>(itemType: ItemTypeType, itemId: ItemId, options?: Partial<ItemEntryOptions>, isRoot?: boolean): PromiseInterface<ItemResource<ItemTypeType>>;
|
|
308
278
|
/**
|
|
309
279
|
* @description
|
|
310
280
|
* Fetches the title of an item, does not create an {@link ItemResource ItemResource}
|
|
@@ -349,9 +319,9 @@ export declare class TransactionCache extends AbstractCache {
|
|
|
349
319
|
* won't be included
|
|
350
320
|
*/
|
|
351
321
|
getDelta(): InternalChangesDelta;
|
|
352
|
-
createItemResource<ItemTypeType extends ItemType>(itemEntry: ItemEntry<ItemTypeType>,
|
|
353
|
-
createItemResources<ItemTypeType extends ItemType>(itemEntries: Array<ItemEntry<ItemTypeType
|
|
354
|
-
processLinkedItems<ItemTypeType extends ItemType>(linkedEntries: ItemTypeMap<ItemEntry[]
|
|
322
|
+
createItemResource<ItemTypeType extends ItemType>(itemEntry: ItemEntry<ItemTypeType>, isRoot?: boolean, isNew?: boolean): ItemResource<ItemTypeType>;
|
|
323
|
+
createItemResources<ItemTypeType extends ItemType>(itemEntries: Array<ItemEntry<ItemTypeType>>): Array<ItemResource<ItemTypeType>>;
|
|
324
|
+
processLinkedItems<ItemTypeType extends ItemType>(linkedEntries: ItemTypeMap<ItemEntry[]>): ItemResourcesItemTypeMap<ItemResource<ItemTypeType>>;
|
|
355
325
|
createCollectionResource<ItemTypeType extends ItemType>(collectionEntry: CollectionEntry<ItemTypeType>, resourceOptions: CollectionResourceOptionsInterface<ItemTypeType>): CollectionResource<ItemTypeType>;
|
|
356
326
|
getChangesFromItemChanges<ItemTypeType extends ItemType = any>(changesObject: TransactionItemEntryChanges<ItemTypeType>): FieldMap<ItemTypeType>;
|
|
357
327
|
private createCollectionResources;
|
|
@@ -1,28 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ChangesDeltaFactory } from '../../../factories/ChangesDeltaFactory';
|
|
3
|
-
import { ApiQuery, ApiRequestColumns, ChangesDelta, CollectionEntryOptions, CollectionResource, ColumnUtil, ConversionMap, EntryParent, ExceptionHandlerInterface, ItemEntryOptions, ItemIdConversionMap, PromiseInterface } from '../../../index';
|
|
4
|
-
import { ErrorHandlerInterface, PromiseLibraryInterface } from '../../../interfaces';
|
|
1
|
+
import { ApiQuery, ApiRequestColumns, ChangesDelta, CollectionEntryOptions, CollectionResource, ConversionMap, ItemEntryOptions, ItemIdConversionMap, ModifyFieldsCallback, PromiseInterface, TransactionCollectionHandlerDependencyInterface, TransactionItemHandler } from '../../../index';
|
|
5
2
|
import { CollectionEntry, ItemEntry } from '../../../models';
|
|
6
3
|
import { ApiRequestColumn, CollectionEntryParentIdMap, CollectionResourceParentIdMap, ItemId, ItemType, QueryCallback } from '../../../types';
|
|
7
|
-
import {
|
|
4
|
+
import { CollectionMatcher } from '../../index';
|
|
8
5
|
import { CollectionHandlerBase } from '../CollectionHandlerBase';
|
|
9
6
|
import { TransactionCache } from './TransactionCache';
|
|
10
7
|
export declare class TransactionCollectionHandler extends CollectionHandlerBase {
|
|
11
|
-
private
|
|
12
|
-
private columnExpansionFactory;
|
|
13
|
-
private changesDeltaFactory;
|
|
14
|
-
private collectionMatcherFactory;
|
|
15
|
-
private columnHandler;
|
|
16
|
-
private errorHandler;
|
|
8
|
+
private dependencies;
|
|
17
9
|
private itemHandler;
|
|
18
|
-
private keyService;
|
|
19
|
-
private promiseService;
|
|
20
|
-
private exceptionHandler;
|
|
21
10
|
protected transaction: TransactionCache;
|
|
22
11
|
collectionResources: {
|
|
23
12
|
[collectionEntryId: number]: CollectionResource[];
|
|
24
13
|
};
|
|
25
|
-
constructor(
|
|
14
|
+
constructor(dependencies: TransactionCollectionHandlerDependencyInterface, itemHandler: TransactionItemHandler, transaction: TransactionCache);
|
|
26
15
|
fetchItemEntriesByQuery<ItemTypeType extends ItemType>(itemType: ItemTypeType, query: ApiQuery, options: ItemEntryOptions): PromiseInterface<Array<ItemEntry<ItemTypeType>>>;
|
|
27
16
|
getAllCollectionsByItemType<ItemTypeType extends ItemType>(itemType: ItemTypeType): Array<CollectionEntry<ItemTypeType>>;
|
|
28
17
|
createCollectionEntry<ItemTypeType extends ItemType>(itemType: ItemTypeType, options: CollectionEntryOptions): CollectionEntry<ItemTypeType>;
|
|
@@ -32,7 +21,7 @@ export declare class TransactionCollectionHandler extends CollectionHandlerBase
|
|
|
32
21
|
* Can be used to update maps that use {@link ItemEntry.itemId ItemEntry.itemId}
|
|
33
22
|
*
|
|
34
23
|
* @deprecated
|
|
35
|
-
* You should use
|
|
24
|
+
* You should use register a {@link TransactionCache.registerFieldChangeCallback field change callback} and compare previous.id with fields.id
|
|
36
25
|
*/
|
|
37
26
|
onItemEntriesCreated(collectionEntry: CollectionEntry, conversionMap: ConversionMap): void;
|
|
38
27
|
clearEntry(entry: CollectionEntry): void;
|
|
@@ -44,7 +33,7 @@ export declare class TransactionCollectionHandler extends CollectionHandlerBase
|
|
|
44
33
|
*/
|
|
45
34
|
moveItems<CollectionEntryType extends CollectionEntry>(sourceCollectionEntry: CollectionEntryType, destinationCollectionEntry: CollectionEntryType, itemEntries: Array<ItemEntry<CollectionEntryType['itemType']>>): void;
|
|
46
35
|
extendCollectionEntry<CollectionEntryType extends CollectionEntry>(collectionEntry: CollectionEntryType, queryCallback: QueryCallback): PromiseInterface<CollectionEntryType>;
|
|
47
|
-
cloneCollectionEntry<CollectionEntryType extends CollectionEntry>(
|
|
36
|
+
cloneCollectionEntry<CollectionEntryType extends CollectionEntry>(changesDelta: ChangesDelta, sourceEntry: CollectionEntryType, conversionMap?: ItemIdConversionMap, modifyFieldsCallback?: ModifyFieldsCallback): void;
|
|
48
37
|
getCollectionMatcher(): CollectionMatcher;
|
|
49
38
|
fetchCollectionEntry<ItemTypeType extends ItemType>(itemType: ItemTypeType, options: CollectionEntryOptions): PromiseInterface<CollectionEntry<ItemTypeType>>;
|
|
50
39
|
fetchLinkedCollectionEntries<ItemTypeType extends ItemType>(parentType: ItemType, parentIdArray: ItemId[] | (() => ItemId[]), itemType: ItemTypeType, options: CollectionEntryOptions): PromiseInterface<CollectionEntryParentIdMap<ItemTypeType>>;
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { ChangesDelta, ChangesDeltaItemCreateDelta } from '../../ChangesDelta';
|
|
1
|
+
import { TransactionItemHandlerDependencyInterface } from '../../../interfaces';
|
|
2
|
+
import { ItemEntry, ItemEntryOptions } from '../../../models';
|
|
3
|
+
import { ApiQuery, ApiRequestColumns, DeregFunction, FieldChangeCallback, FieldMap, ItemId, ItemIdConversionMap, ItemType, ItemTypeMap, ModifyFieldsCallback, PromiseInterface, ResponseColumnItemTypeMap } from '../../../types';
|
|
4
|
+
import { ChangesDelta } from '../../ChangesDelta';
|
|
6
5
|
import { ChangesDeltaBase, ChangesDeltaItemUpdateDelta, ChangesDeltaResult } from '../../ChangesDeltaBase';
|
|
7
|
-
import {
|
|
8
|
-
import { ItemCreateService } from '../../ItemCreateService';
|
|
9
|
-
import { TemplateCache } from '../../TemplateCache';
|
|
6
|
+
import { ChangesDeltaItemCreateDelta, ColumnSubsetCache } from '../../index';
|
|
10
7
|
import { ItemHandlerBase } from '../ItemHandlerBase';
|
|
11
8
|
import { TransactionCache } from './TransactionCache';
|
|
12
9
|
import { TransactionValidator } from './TransactionValidator';
|
|
@@ -20,25 +17,20 @@ export declare type TransactionItemEntryChanges<ItemTypeType extends ItemType =
|
|
|
20
17
|
* If a non-local entry is requested it should be passed on to the {@link ServerItemHandler ServerItemHandler} which will fetchCollectionEntry the entry from the server
|
|
21
18
|
*/
|
|
22
19
|
export declare class TransactionItemHandler extends ItemHandlerBase {
|
|
23
|
-
private
|
|
24
|
-
private exceptionHandler;
|
|
25
|
-
private templateCache;
|
|
26
|
-
private columnExpansionFactory;
|
|
27
|
-
private columnHandler;
|
|
28
|
-
private columnSubsetCacheFactory;
|
|
29
|
-
private itemEntryService;
|
|
30
|
-
private keyService;
|
|
31
|
-
private changesDeltaService;
|
|
20
|
+
private dependencies;
|
|
32
21
|
protected transaction: TransactionCache;
|
|
33
22
|
private validator?;
|
|
34
23
|
deletedItems: ItemTypeMap<ItemEntry[]>;
|
|
35
24
|
itemChanges: {
|
|
36
25
|
[itemEntryId: number]: TransactionItemEntryChanges;
|
|
37
26
|
};
|
|
38
|
-
|
|
39
|
-
[
|
|
27
|
+
fieldChangeCallbacks: {
|
|
28
|
+
[itemType: string]: {
|
|
29
|
+
[itemId: string]: FieldChangeCallback[];
|
|
30
|
+
};
|
|
40
31
|
};
|
|
41
|
-
constructor(
|
|
32
|
+
constructor(dependencies: TransactionItemHandlerDependencyInterface, transaction: TransactionCache, validator?: TransactionValidator | undefined);
|
|
33
|
+
registerFieldChangeCallback<ItemTypeType extends ItemType>(itemType: ItemTypeType, itemId: ItemId, callback: FieldChangeCallback<ItemTypeType>): DeregFunction;
|
|
42
34
|
copyTransactionItemEntryChanges(itemEntryChanges: TransactionItemEntryChanges, entry: ItemEntry): TransactionItemEntryChanges;
|
|
43
35
|
createItemEntry(createTuple: ChangesDeltaItemCreateDelta): ItemEntry;
|
|
44
36
|
/**
|
|
@@ -46,18 +38,6 @@ export declare class TransactionItemHandler extends ItemHandlerBase {
|
|
|
46
38
|
* Gets the local {@link FieldMap changes} of the {@link ItemEntry entry} on the {@link TransactionCache transaction} in a formatted way the API accepts
|
|
47
39
|
*/
|
|
48
40
|
formatRequest<ItemEntryType extends ItemEntry>(entry: ItemEntryType): FieldMap<ItemEntryType['itemType']>;
|
|
49
|
-
clearItemEntry(entry: ItemEntry): void;
|
|
50
|
-
/**
|
|
51
|
-
* @description
|
|
52
|
-
* Stores am {@link ItemResource ItemResource} on the transaction, used to call {@link ItemResource.options.onChange the onChange callback}
|
|
53
|
-
*/
|
|
54
|
-
addResource(resource: ItemResource): void;
|
|
55
|
-
/**
|
|
56
|
-
* @description
|
|
57
|
-
* Removes a resource from the transaction, preventing the {@link ItemResource.options.onChange the onChange callback} from being called.
|
|
58
|
-
* You should call this function when the resource is no longer needed
|
|
59
|
-
*/
|
|
60
|
-
clearResource(resource: ItemResource): void;
|
|
61
41
|
detectChanges(): boolean;
|
|
62
42
|
/**
|
|
63
43
|
* @description
|
|
@@ -82,8 +62,8 @@ export declare class TransactionItemHandler extends ItemHandlerBase {
|
|
|
82
62
|
* The previous changes {@link FieldMap FieldMap}
|
|
83
63
|
*/
|
|
84
64
|
processItemEntryChanges<ItemTypeType extends ItemType = any>(itemEntryChangesTuple: ChangesDeltaItemUpdateDelta<ItemTypeType>, forceOverwrite?: boolean, updateInitial?: boolean, isCalledAfterSocketUpdate?: boolean, createItemChangesIfNoneExist?: boolean): FieldMap<ItemTypeType> | null;
|
|
85
|
-
cloneItemEntries<ItemTypeType extends ItemType>(itemEntries: Array<ItemEntry<ItemTypeType>>, conversionMap?: ItemIdConversionMap, modifyFieldsCallback?: ModifyFieldsCallback):
|
|
86
|
-
cloneItemEntry<ItemTypeType extends ItemType>(changesDelta: ChangesDelta, sourceEntry: ItemEntry<ItemTypeType>,
|
|
65
|
+
cloneItemEntries<ItemTypeType extends ItemType>(changesDelta: ChangesDelta, itemEntries: Array<ItemEntry<ItemTypeType>>, conversionMap?: ItemIdConversionMap, modifyFieldsCallback?: ModifyFieldsCallback): ItemId[];
|
|
66
|
+
cloneItemEntry<ItemTypeType extends ItemType>(changesDelta: ChangesDelta, sourceEntry: ItemEntry<ItemTypeType>, conversionMap?: ItemIdConversionMap, modifyFieldsCallback?: ModifyFieldsCallback): ItemId;
|
|
87
67
|
fetchItemEntriesByQuery<ItemTypeType extends ItemType>(itemType: ItemTypeType, query: ApiQuery, entryOptions: ItemEntryOptions): PromiseInterface<Array<ItemEntry<ItemTypeType>>>;
|
|
88
68
|
fetchItemEntry<ItemTypeType extends ItemType>(itemType: ItemTypeType, itemId: ItemId, options: ItemEntryOptions): PromiseInterface<ItemEntry<ItemTypeType>>;
|
|
89
69
|
/**
|