@rentman/rm-core 8.1.9 → 8.2.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 +931 -926
- package/dist/rm-core.js +1010 -836
- package/dist/rm-core.min.js +1 -1
- package/dist/types/classes/ApiFormatter.d.ts +73 -73
- package/dist/types/classes/ApiRequestService.d.ts +18 -18
- package/dist/types/classes/ApiResponseProcessor.d.ts +29 -29
- package/dist/types/classes/CacheSyncer.d.ts +36 -34
- package/dist/types/classes/ChangesCompilation.d.ts +33 -33
- package/dist/types/classes/ChangesDelta.d.ts +61 -61
- package/dist/types/classes/ChangesDeltaBase.d.ts +76 -76
- package/dist/types/classes/ChangesProcessor.d.ts +40 -40
- package/dist/types/classes/CollectionEntryService.d.ts +23 -23
- package/dist/types/classes/CollectionResourceService.d.ts +6 -6
- package/dist/types/classes/ColumnCache.d.ts +21 -21
- package/dist/types/classes/ColumnExpansion.d.ts +21 -21
- package/dist/types/classes/ColumnHandler.d.ts +20 -20
- package/dist/types/classes/ColumnInfo.d.ts +14 -14
- package/dist/types/classes/ColumnSet.d.ts +37 -37
- package/dist/types/classes/ColumnSubsetCache.d.ts +14 -14
- package/dist/types/classes/ColumnUtil.d.ts +100 -100
- package/dist/types/classes/ConversionMapService.d.ts +25 -25
- package/dist/types/classes/CreateRequest.d.ts +17 -17
- package/dist/types/classes/CreatedChangesDelta.d.ts +17 -17
- package/dist/types/classes/InternalChangesDelta.d.ts +47 -47
- package/dist/types/classes/ItemCache.d.ts +27 -27
- package/dist/types/classes/ItemCreateService.d.ts +18 -18
- package/dist/types/classes/ItemEntryService.d.ts +32 -32
- package/dist/types/classes/KeyService.d.ts +18 -18
- package/dist/types/classes/LockService.d.ts +29 -29
- package/dist/types/classes/ModuleChangesCompilation.d.ts +18 -18
- package/dist/types/classes/ParentChangesDelta.d.ts +39 -39
- package/dist/types/classes/QueryColumnExtractor.d.ts +18 -18
- package/dist/types/classes/QueryContainsLocalIdParser.d.ts +15 -15
- package/dist/types/classes/QueryLinkedToParser.d.ts +15 -15
- package/dist/types/classes/QueryLocallyMatchableParser.d.ts +18 -18
- package/dist/types/classes/QueryMatcher.d.ts +18 -18
- package/dist/types/classes/QueryParser.d.ts +25 -25
- package/dist/types/classes/QueryParserBase.d.ts +20 -20
- package/dist/types/classes/QueryParserIdUpdater.d.ts +15 -15
- package/dist/types/classes/QueryService.d.ts +12 -12
- package/dist/types/classes/RequestBuffer.d.ts +24 -24
- package/dist/types/classes/RequestBufferManager.d.ts +20 -20
- package/dist/types/classes/RequestColumnExpansion.d.ts +15 -15
- package/dist/types/classes/SocketMessageHandler.d.ts +34 -34
- package/dist/types/classes/TemplateCache.d.ts +63 -63
- package/dist/types/classes/Util.d.ts +28 -31
- package/dist/types/classes/cache/AbstractCache.d.ts +95 -95
- package/dist/types/classes/cache/CachedQueryHandlerBase.d.ts +68 -64
- package/dist/types/classes/cache/ItemHandlerBase.d.ts +95 -95
- package/dist/types/classes/cache/server/ServerCache.d.ts +82 -82
- package/dist/types/classes/cache/server/ServerCachedQueryHandler.d.ts +25 -25
- package/dist/types/classes/cache/server/ServerItemHandler.d.ts +44 -44
- package/dist/types/classes/cache/transaction/TransactionCache.d.ts +319 -314
- package/dist/types/classes/cache/transaction/TransactionCachedQueryHandler.d.ts +31 -29
- package/dist/types/classes/cache/transaction/TransactionCollectionHandler.d.ts +24 -24
- package/dist/types/classes/cache/transaction/TransactionEventHandler.d.ts +21 -21
- package/dist/types/classes/cache/transaction/TransactionItemHandler.d.ts +89 -89
- package/dist/types/classes/cache/transaction/TransactionValidator.d.ts +33 -33
- package/dist/types/constants.d.ts +7 -7
- package/dist/types/core.d.ts +45 -44
- package/dist/types/factories/ApiResponseProcessorFactory.d.ts +6 -6
- package/dist/types/factories/CacheSyncerFactory.d.ts +10 -10
- package/dist/types/factories/ChangesCompilationFactory.d.ts +5 -5
- package/dist/types/factories/ChangesDeltaFactory.d.ts +13 -13
- package/dist/types/factories/ChangesProcessorFactory.d.ts +13 -13
- package/dist/types/factories/CollectionEntryFactory.d.ts +11 -11
- package/dist/types/factories/CollectionResourceFactory.d.ts +18 -15
- package/dist/types/factories/ColumnExpansionFactory.d.ts +7 -7
- package/dist/types/factories/ColumnInfoFactory.d.ts +7 -7
- package/dist/types/factories/ColumnSetFactory.d.ts +18 -18
- package/dist/types/factories/ColumnSubsetCacheFactory.d.ts +8 -8
- package/dist/types/factories/CreateRequestFactory.d.ts +9 -9
- package/dist/types/factories/ItemCacheFactory.d.ts +6 -6
- package/dist/types/factories/ItemEntryFactory.d.ts +12 -12
- package/dist/types/factories/ItemResourceFactory.d.ts +11 -11
- package/dist/types/factories/ModuleChangesCompilationFactory.d.ts +4 -4
- package/dist/types/factories/QueryMatcherFactory.d.ts +7 -7
- package/dist/types/factories/QueryParserFactory.d.ts +5 -5
- package/dist/types/factories/RequestColumnExpansionFactory.d.ts +8 -8
- package/dist/types/factories/TemplateFactory.d.ts +8 -8
- package/dist/types/factories/TransactionCacheFactory.d.ts +13 -13
- package/dist/types/index.d.ts +1 -1
- package/dist/types/interfaces/AbstractCacheDependencyInterface.d.ts +36 -36
- package/dist/types/interfaces/ApiRequestServiceInterface.d.ts +12 -12
- package/dist/types/interfaces/AuthInterface.d.ts +10 -10
- package/dist/types/interfaces/ErrorHandlerInterface.d.ts +5 -5
- package/dist/types/interfaces/ExceptionHandlerInterface.d.ts +3 -3
- package/dist/types/interfaces/LinkTreeServiceInterface.d.ts +4 -4
- package/dist/types/interfaces/PromiseLibraryInterface.d.ts +25 -25
- package/dist/types/interfaces/ServerCacheDependencyInterface.d.ts +5 -5
- package/dist/types/interfaces/SocketMessageInterface.d.ts +3 -3
- package/dist/types/interfaces/TransactionCollectionHandlerDependencyInterface.d.ts +17 -17
- package/dist/types/interfaces/TransactionItemHandlerDependencyInterface.d.ts +22 -22
- package/dist/types/internal.d.ts +104 -104
- package/dist/types/models/CachedQueryItem.d.ts +19 -19
- package/dist/types/models/CollectionEntry.d.ts +21 -21
- package/dist/types/models/CollectionOptions.d.ts +42 -23
- package/dist/types/models/CollectionResource.d.ts +87 -74
- package/dist/types/models/ItemEntry.d.ts +18 -18
- package/dist/types/models/ItemEntryOptions.d.ts +8 -8
- package/dist/types/models/ItemResource.d.ts +90 -85
- package/dist/types/models/Template.d.ts +11 -11
- package/dist/types/types/ItemTypesCollection.d.ts +343 -343
- package/dist/types/types/PromiseInterface.d.ts +2 -2
- package/package.json +48 -48
- package/readme.md +15 -15
|
@@ -1,95 +1,95 @@
|
|
|
1
|
-
import { ApiEnumItemType, ItemId } from '@rentman/backend-types';
|
|
2
|
-
import { AbstractCache, ApiFormatter, ApiQuery, ChangesDeltaBase, ChangesDeltaItemCreateDelta, ChangesDeltaItemUpdateDelta, ColumnInfo, ColumnUtil, ErrorHandlerInterface, FieldMap, ItemCache, ItemCacheFactory, ItemEntry, ItemEntryFactory, ItemEntryOptions, PromiseInterface, PromiseLibraryInterface, RequestColumnExpansionFactory, TransactionItemEntryChanges } from '../../internal';
|
|
3
|
-
export declare enum ItemCacheStatus {
|
|
4
|
-
CACHED = "cached",
|
|
5
|
-
NOT_CACHED = "not_cached",
|
|
6
|
-
NO_CHANGES = "no_changes"
|
|
7
|
-
}
|
|
8
|
-
export declare type ProcessItemEntryChangesResult<ItemTypeType extends ApiEnumItemType> = {
|
|
9
|
-
status: ItemCacheStatus.NO_CHANGES | ItemCacheStatus.NOT_CACHED;
|
|
10
|
-
previous: null;
|
|
11
|
-
} | {
|
|
12
|
-
status: ItemCacheStatus.CACHED;
|
|
13
|
-
previous: FieldMap<ItemTypeType>;
|
|
14
|
-
};
|
|
15
|
-
export declare abstract class ItemHandlerBase {
|
|
16
|
-
protected columnUtil: ColumnUtil;
|
|
17
|
-
protected apiFormatter: ApiFormatter;
|
|
18
|
-
protected itemEntryFactory: ItemEntryFactory;
|
|
19
|
-
protected promiseService: PromiseLibraryInterface;
|
|
20
|
-
protected errorHandler: ErrorHandlerInterface;
|
|
21
|
-
protected requestColumnExpansionFactory: RequestColumnExpansionFactory;
|
|
22
|
-
protected transaction: AbstractCache;
|
|
23
|
-
readonly entries: ItemCache;
|
|
24
|
-
abstract itemChanges: {
|
|
25
|
-
[itemEntryId: string]: any;
|
|
26
|
-
};
|
|
27
|
-
protected constructor(columnUtil: ColumnUtil, apiFormatter: ApiFormatter, itemEntryFactory: ItemEntryFactory, promiseService: PromiseLibraryInterface, errorHandler: ErrorHandlerInterface, requestColumnExpansionFactory: RequestColumnExpansionFactory, itemCacheFactory: ItemCacheFactory, transaction: AbstractCache);
|
|
28
|
-
/**
|
|
29
|
-
* @description
|
|
30
|
-
* Copies the passed ItemEntryChanges into a format the implementing ItemHandler can put in his ItemChanges
|
|
31
|
-
* @param itemEntryChanges
|
|
32
|
-
* @param entry
|
|
33
|
-
*/
|
|
34
|
-
abstract copyTransactionItemEntryChanges(itemEntryChanges: TransactionItemEntryChanges, entry: ItemEntry): any;
|
|
35
|
-
/**
|
|
36
|
-
* @description
|
|
37
|
-
* Fetches the ItemEntries for the given query, does not look in the cache, since we don't know which ItemIds belong to the query !
|
|
38
|
-
*/
|
|
39
|
-
abstract fetchItemEntriesByQuery<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, query: ApiQuery, entryOptions: ItemEntryOptions): PromiseInterface<Array<ItemEntry<ItemTypeType>>>;
|
|
40
|
-
/**
|
|
41
|
-
* @description
|
|
42
|
-
* Fetches the ItemEntries for the given ItemIds
|
|
43
|
-
*/
|
|
44
|
-
abstract fetchItemEntries<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, itemIds: ItemId[], options: ItemEntryOptions): PromiseInterface<Array<ItemEntry<ItemTypeType>>>;
|
|
45
|
-
/**
|
|
46
|
-
* @description
|
|
47
|
-
* Fetches an ItemEntry with the given itemId
|
|
48
|
-
*/
|
|
49
|
-
abstract fetchItemEntry<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, itemId: ItemId, options: ItemEntryOptions, isRoot?: boolean): PromiseInterface<ItemEntry<ItemTypeType>>;
|
|
50
|
-
/**
|
|
51
|
-
* @description
|
|
52
|
-
* Processes the passed {@link ChangesDeltaItemUpdateDelta update delta} on the transaction, if there are no {@link TransactionItemHandler.itemChanges itemChanges} the new values will not be processed
|
|
53
|
-
*/
|
|
54
|
-
abstract processItemEntryChanges<ItemTypeType extends ApiEnumItemType>(itemEntryChangesTuple: ChangesDeltaItemUpdateDelta<ItemTypeType>, isCalledAfterSocketUpdate: boolean, createItemChangesIfNoneExist: boolean): ProcessItemEntryChangesResult<ItemTypeType>;
|
|
55
|
-
/**
|
|
56
|
-
* @description
|
|
57
|
-
* Traverses the column path and returns the fields of the derived item, returns undefined if the item isn't found
|
|
58
|
-
*
|
|
59
|
-
* ---------------------
|
|
60
|
-
*
|
|
61
|
-
* @remark
|
|
62
|
-
* Assumes the derived item's values are already cached
|
|
63
|
-
*/
|
|
64
|
-
getDerivedValues(itemEntry: ItemEntry, columnPath: string[]): Readonly<FieldMap> | undefined;
|
|
65
|
-
/**
|
|
66
|
-
* @description
|
|
67
|
-
* Returns the value of the columnPath, or undefined when the path couldn't be traversed
|
|
68
|
-
*
|
|
69
|
-
* @param itemEntry The root entry to start the path from
|
|
70
|
-
* @param columnPath Can either be an array of columnIds (['column', 'column2']) or a config column string ('column>column2')
|
|
71
|
-
*/
|
|
72
|
-
getDerivedValue<T extends any = any>(itemEntry: ItemEntry, columnPath: string[] | string): T | undefined;
|
|
73
|
-
/**
|
|
74
|
-
* @description
|
|
75
|
-
* Clears the entry from this transaction, removing it from the {@link ItemCache ItemCache} and removing all changes
|
|
76
|
-
*/
|
|
77
|
-
clearItemEntry(entry: ItemEntry): void;
|
|
78
|
-
/**
|
|
79
|
-
* @description
|
|
80
|
-
* Recursively fetches derived values as separate requests, instead of as columns of a primary item
|
|
81
|
-
* Can be used when derived values of a local item have to be fetched, since a local item can't be used as root item of a query
|
|
82
|
-
*/
|
|
83
|
-
fetchDerivedValuesByColumn<ItemTypeType extends ApiEnumItemType>(itemEntries: Array<ItemEntry<ItemTypeType>>, rootColumn: ColumnInfo<ItemTypeType>, changesDelta?: ChangesDeltaBase): PromiseInterface<void | Array<ItemEntry<ItemTypeType>>>;
|
|
84
|
-
resolveDerivedValues<ItemTypeType extends ApiEnumItemType>(itemEntries: Array<ItemEntry<ItemTypeType>>, columns: Array<ColumnInfo<ItemTypeType>>, changesDelta?: ChangesDeltaBase): PromiseInterface<Array<ItemEntry<ItemTypeType>>>;
|
|
85
|
-
/**
|
|
86
|
-
* @description
|
|
87
|
-
* Creates a new {@link ItemEntry ItemEntry} from the passed {@link ChangesDeltaItemCreateDelta ChangesDeltaItemCreateDelta} and stores it in this transaction's {@link ItemCache ItemCache}
|
|
88
|
-
*/
|
|
89
|
-
createItemEntry(createTuple: ChangesDeltaItemCreateDelta): ItemEntry;
|
|
90
|
-
/**
|
|
91
|
-
* @description
|
|
92
|
-
* Gets the value of the given column, will look into the current delta before attempting to read itemChanges
|
|
93
|
-
*/
|
|
94
|
-
protected getItemIdByColumn<ItemTypeType extends ApiEnumItemType>(itemEntry: ItemEntry<ItemTypeType>, column: ColumnInfo<ItemTypeType>, changesDelta?: ChangesDeltaBase): ItemId;
|
|
95
|
-
}
|
|
1
|
+
import { ApiEnumItemType, ItemId } from '@rentman/backend-types';
|
|
2
|
+
import { AbstractCache, ApiFormatter, ApiQuery, ChangesDeltaBase, ChangesDeltaItemCreateDelta, ChangesDeltaItemUpdateDelta, ColumnInfo, ColumnUtil, ErrorHandlerInterface, FieldMap, ItemCache, ItemCacheFactory, ItemEntry, ItemEntryFactory, ItemEntryOptions, PromiseInterface, PromiseLibraryInterface, RequestColumnExpansionFactory, TransactionItemEntryChanges } from '../../internal';
|
|
3
|
+
export declare enum ItemCacheStatus {
|
|
4
|
+
CACHED = "cached",
|
|
5
|
+
NOT_CACHED = "not_cached",
|
|
6
|
+
NO_CHANGES = "no_changes"
|
|
7
|
+
}
|
|
8
|
+
export declare type ProcessItemEntryChangesResult<ItemTypeType extends ApiEnumItemType> = {
|
|
9
|
+
status: ItemCacheStatus.NO_CHANGES | ItemCacheStatus.NOT_CACHED;
|
|
10
|
+
previous: null;
|
|
11
|
+
} | {
|
|
12
|
+
status: ItemCacheStatus.CACHED;
|
|
13
|
+
previous: FieldMap<ItemTypeType>;
|
|
14
|
+
};
|
|
15
|
+
export declare abstract class ItemHandlerBase {
|
|
16
|
+
protected columnUtil: ColumnUtil;
|
|
17
|
+
protected apiFormatter: ApiFormatter;
|
|
18
|
+
protected itemEntryFactory: ItemEntryFactory;
|
|
19
|
+
protected promiseService: PromiseLibraryInterface;
|
|
20
|
+
protected errorHandler: ErrorHandlerInterface;
|
|
21
|
+
protected requestColumnExpansionFactory: RequestColumnExpansionFactory;
|
|
22
|
+
protected transaction: AbstractCache;
|
|
23
|
+
readonly entries: ItemCache;
|
|
24
|
+
abstract itemChanges: {
|
|
25
|
+
[itemEntryId: string]: any;
|
|
26
|
+
};
|
|
27
|
+
protected constructor(columnUtil: ColumnUtil, apiFormatter: ApiFormatter, itemEntryFactory: ItemEntryFactory, promiseService: PromiseLibraryInterface, errorHandler: ErrorHandlerInterface, requestColumnExpansionFactory: RequestColumnExpansionFactory, itemCacheFactory: ItemCacheFactory, transaction: AbstractCache);
|
|
28
|
+
/**
|
|
29
|
+
* @description
|
|
30
|
+
* Copies the passed ItemEntryChanges into a format the implementing ItemHandler can put in his ItemChanges
|
|
31
|
+
* @param itemEntryChanges
|
|
32
|
+
* @param entry
|
|
33
|
+
*/
|
|
34
|
+
abstract copyTransactionItemEntryChanges(itemEntryChanges: TransactionItemEntryChanges, entry: ItemEntry): any;
|
|
35
|
+
/**
|
|
36
|
+
* @description
|
|
37
|
+
* Fetches the ItemEntries for the given query, does not look in the cache, since we don't know which ItemIds belong to the query !
|
|
38
|
+
*/
|
|
39
|
+
abstract fetchItemEntriesByQuery<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, query: ApiQuery, entryOptions: ItemEntryOptions): PromiseInterface<Array<ItemEntry<ItemTypeType>>>;
|
|
40
|
+
/**
|
|
41
|
+
* @description
|
|
42
|
+
* Fetches the ItemEntries for the given ItemIds
|
|
43
|
+
*/
|
|
44
|
+
abstract fetchItemEntries<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, itemIds: ItemId[], options: ItemEntryOptions): PromiseInterface<Array<ItemEntry<ItemTypeType>>>;
|
|
45
|
+
/**
|
|
46
|
+
* @description
|
|
47
|
+
* Fetches an ItemEntry with the given itemId
|
|
48
|
+
*/
|
|
49
|
+
abstract fetchItemEntry<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, itemId: ItemId, options: ItemEntryOptions, isRoot?: boolean): PromiseInterface<ItemEntry<ItemTypeType>>;
|
|
50
|
+
/**
|
|
51
|
+
* @description
|
|
52
|
+
* Processes the passed {@link ChangesDeltaItemUpdateDelta update delta} on the transaction, if there are no {@link TransactionItemHandler.itemChanges itemChanges} the new values will not be processed
|
|
53
|
+
*/
|
|
54
|
+
abstract processItemEntryChanges<ItemTypeType extends ApiEnumItemType>(itemEntryChangesTuple: ChangesDeltaItemUpdateDelta<ItemTypeType>, isCalledAfterSocketUpdate: boolean, createItemChangesIfNoneExist: boolean): ProcessItemEntryChangesResult<ItemTypeType>;
|
|
55
|
+
/**
|
|
56
|
+
* @description
|
|
57
|
+
* Traverses the column path and returns the fields of the derived item, returns undefined if the item isn't found
|
|
58
|
+
*
|
|
59
|
+
* ---------------------
|
|
60
|
+
*
|
|
61
|
+
* @remark
|
|
62
|
+
* Assumes the derived item's values are already cached
|
|
63
|
+
*/
|
|
64
|
+
getDerivedValues(itemEntry: ItemEntry, columnPath: string[]): Readonly<FieldMap> | undefined;
|
|
65
|
+
/**
|
|
66
|
+
* @description
|
|
67
|
+
* Returns the value of the columnPath, or undefined when the path couldn't be traversed
|
|
68
|
+
*
|
|
69
|
+
* @param itemEntry The root entry to start the path from
|
|
70
|
+
* @param columnPath Can either be an array of columnIds (['column', 'column2']) or a config column string ('column>column2')
|
|
71
|
+
*/
|
|
72
|
+
getDerivedValue<T extends any = any>(itemEntry: ItemEntry, columnPath: string[] | string): T | undefined;
|
|
73
|
+
/**
|
|
74
|
+
* @description
|
|
75
|
+
* Clears the entry from this transaction, removing it from the {@link ItemCache ItemCache} and removing all changes
|
|
76
|
+
*/
|
|
77
|
+
clearItemEntry(entry: ItemEntry): void;
|
|
78
|
+
/**
|
|
79
|
+
* @description
|
|
80
|
+
* Recursively fetches derived values as separate requests, instead of as columns of a primary item
|
|
81
|
+
* Can be used when derived values of a local item have to be fetched, since a local item can't be used as root item of a query
|
|
82
|
+
*/
|
|
83
|
+
fetchDerivedValuesByColumn<ItemTypeType extends ApiEnumItemType>(itemEntries: Array<ItemEntry<ItemTypeType>>, rootColumn: ColumnInfo<ItemTypeType>, changesDelta?: ChangesDeltaBase): PromiseInterface<void | Array<ItemEntry<ItemTypeType>>>;
|
|
84
|
+
resolveDerivedValues<ItemTypeType extends ApiEnumItemType>(itemEntries: Array<ItemEntry<ItemTypeType>>, columns: Array<ColumnInfo<ItemTypeType>>, changesDelta?: ChangesDeltaBase): PromiseInterface<Array<ItemEntry<ItemTypeType>>>;
|
|
85
|
+
/**
|
|
86
|
+
* @description
|
|
87
|
+
* Creates a new {@link ItemEntry ItemEntry} from the passed {@link ChangesDeltaItemCreateDelta ChangesDeltaItemCreateDelta} and stores it in this transaction's {@link ItemCache ItemCache}
|
|
88
|
+
*/
|
|
89
|
+
createItemEntry(createTuple: ChangesDeltaItemCreateDelta): ItemEntry;
|
|
90
|
+
/**
|
|
91
|
+
* @description
|
|
92
|
+
* Gets the value of the given column, will look into the current delta before attempting to read itemChanges
|
|
93
|
+
*/
|
|
94
|
+
protected getItemIdByColumn<ItemTypeType extends ApiEnumItemType>(itemEntry: ItemEntry<ItemTypeType>, column: ColumnInfo<ItemTypeType>, changesDelta?: ChangesDeltaBase): ItemId;
|
|
95
|
+
}
|
|
@@ -1,82 +1,82 @@
|
|
|
1
|
-
import { ApiEnumItemType } from '@rentman/backend-types';
|
|
2
|
-
import { AbstractCache, ApiRequestColumn, ApiRequestColumnMap, ApiResponseProcessor, CachedQueryItem, ChangesDelta, ChangesDeltaResult, CollectionQuery, CollectionResourceParentIdMap, EntryParent, EntryParentNull, FieldMap, ItemEntry, ItemIdConversionMap, ItemTypeMap, OnAfterCreateCallback, ParentChangesDelta, PromiseInterface, RmCore, ServerCacheDependencyInterface, ServerCachedQueryHandler, ServerItemEntryChanges, ServerItemHandler, TransactionCache, TransactionOptions, TransactionValidatorFactory } from '../../../internal';
|
|
3
|
-
/**
|
|
4
|
-
* @description
|
|
5
|
-
* The {@link ServerCache ServerCache} is responsible for keeping track of {@link ItemEntry ItemEntries} and {@link CollectionEntry CollectionEntries}
|
|
6
|
-
* which are saved on the server.
|
|
7
|
-
*
|
|
8
|
-
* It's basically a local representation of the database
|
|
9
|
-
*/
|
|
10
|
-
export declare class ServerCache extends AbstractCache {
|
|
11
|
-
dependencies: ServerCacheDependencyInterface;
|
|
12
|
-
readonly itemHandler: ServerItemHandler;
|
|
13
|
-
readonly cachedQueryHandler: ServerCachedQueryHandler;
|
|
14
|
-
parent: null;
|
|
15
|
-
constructor(dependencies: ServerCacheDependencyInterface, core: RmCore);
|
|
16
|
-
getServerCache(): ServerCache;
|
|
17
|
-
createChild(id?: string, validatorFactory?: TransactionValidatorFactory, options?: TransactionOptions): TransactionCache;
|
|
18
|
-
expandCollectionResources<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, collections: CollectionResourceParentIdMap<ItemTypeType>, newRequestColumns: ApiRequestColumn[]): PromiseInterface<CollectionResourceParentIdMap>;
|
|
19
|
-
/**
|
|
20
|
-
*
|
|
21
|
-
* @param response
|
|
22
|
-
* @param requestColumnMap
|
|
23
|
-
* @param isCalledAfterSocketUpdate
|
|
24
|
-
* @param changesDelta
|
|
25
|
-
* @param conversionMap
|
|
26
|
-
* @param directRequestItemMap Should be a map of ItemType->ItemId of items that were directly part of the create/update request (queries should be excluded from this because we don't want to overwrite the user's changes (derived values are also queries))
|
|
27
|
-
*/
|
|
28
|
-
processResponse(response: ApiResponseProcessor, requestColumnMap: ApiRequestColumnMap, isCalledAfterSocketUpdate?: boolean, changesDelta?: ChangesDelta, directRequestItemMap?: ItemTypeMap<Record<string, boolean>>, conversionMap?: ItemIdConversionMap): PromiseInterface<ChangesDeltaResult>;
|
|
29
|
-
/**
|
|
30
|
-
* @description
|
|
31
|
-
* Applies changes to this transaction and its children
|
|
32
|
-
* ServerCache.applyChangesFromParent should be used when processing an API update/create/delete
|
|
33
|
-
*/
|
|
34
|
-
applyChangesFromParent(parentChangesDelta: ParentChangesDelta, isCalledAfterSocketUpdate?: boolean): PromiseInterface<void>;
|
|
35
|
-
/**
|
|
36
|
-
* @description
|
|
37
|
-
* Gets the fields required to set the parent
|
|
38
|
-
*/
|
|
39
|
-
getLinkFieldsByParent<ItemTypeType extends ApiEnumItemType>(parent: EntryParent, itemType: ItemTypeType): Partial<FieldMap<ItemTypeType>>;
|
|
40
|
-
/**
|
|
41
|
-
* @description
|
|
42
|
-
* Gets the entry's parent
|
|
43
|
-
*
|
|
44
|
-
* @param itemEntry The entry to get the parent from
|
|
45
|
-
* @param _fromInitial Unused parameter, there for alignment with {@link TransactionCache.getParent TransactionCache.getParent]
|
|
46
|
-
* @param _providedFields Unused parameter, there for alignment with {@link TransactionCache.getParent TransactionCache.getParent]
|
|
47
|
-
*
|
|
48
|
-
* @remark
|
|
49
|
-
* Use {@link CollectionResource.getParent CollectionResource.getParent} instead of {@link TransactionCache.getParent TransactionCache.getParent} if you're getting the parent in the onRemove callback
|
|
50
|
-
*/
|
|
51
|
-
getParent<ItemTypeType extends ApiEnumItemType = any>(itemEntry: ItemEntry<ItemTypeType>, _fromInitial?: boolean, _providedFields?: FieldMap<ItemTypeType>): EntryParentNull;
|
|
52
|
-
getItemChangesRecursively(itemEntryId: ItemEntry['id'], copyFields?: boolean): FieldMap;
|
|
53
|
-
/**
|
|
54
|
-
* @description
|
|
55
|
-
* Only takes the local changes into account, used for saving
|
|
56
|
-
*/
|
|
57
|
-
getLocalItemEntryChangesTuple(itemEntryId: ItemEntry['id']): {
|
|
58
|
-
entry: ItemEntry;
|
|
59
|
-
changes: ServerItemEntryChanges;
|
|
60
|
-
};
|
|
61
|
-
getCollectionChangesRecursively<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, parsedQuery: CollectionQuery): CachedQueryItem<ItemTypeType> | undefined;
|
|
62
|
-
/**
|
|
63
|
-
* @description
|
|
64
|
-
* Invalidates the complete server cache, all items will be re-fetched whenever they are requested
|
|
65
|
-
*/
|
|
66
|
-
invalidateCache(): void;
|
|
67
|
-
/**
|
|
68
|
-
* @description
|
|
69
|
-
* Merges the passed changes from the child Transaction into this Transaction's own changes and then propagates
|
|
70
|
-
* them to all child Transactions
|
|
71
|
-
*/
|
|
72
|
-
applyChangesFromChild(transaction: TransactionCache, breakUpByParent?: boolean, onAfterCreateCallback?: OnAfterCreateCallback): PromiseInterface<ItemIdConversionMap>;
|
|
73
|
-
/**
|
|
74
|
-
* @description
|
|
75
|
-
* Applies changes to this transaction and its children
|
|
76
|
-
* ServerCache.applyChangesDelta should be used when processing an API response which should create new entries on the ServerCache (such as a Query)
|
|
77
|
-
*/
|
|
78
|
-
applyChangesDelta(changesDelta: ChangesDelta, isCalledAfterSocketUpdate?: boolean, conversionMap?: ItemIdConversionMap): PromiseInterface<ChangesDeltaResult>;
|
|
79
|
-
getLocalItemEntry(itemEntryId: ItemEntry['id']): ItemEntry | undefined;
|
|
80
|
-
getLocalItemEntryByItemId(itemType: ApiEnumItemType, itemId: ItemEntry['itemId']): ItemEntry | undefined;
|
|
81
|
-
getChangesFromItemChanges<ItemTypeType extends ApiEnumItemType = any>(changesObject: ServerItemEntryChanges<ItemTypeType>): FieldMap<ItemTypeType>;
|
|
82
|
-
}
|
|
1
|
+
import { ApiEnumItemType } from '@rentman/backend-types';
|
|
2
|
+
import { AbstractCache, ApiRequestColumn, ApiRequestColumnMap, ApiResponseProcessor, CachedQueryItem, ChangesDelta, ChangesDeltaResult, CollectionQuery, CollectionResourceParentIdMap, EntryParent, EntryParentNull, FieldMap, ItemEntry, ItemIdConversionMap, ItemTypeMap, OnAfterCreateCallback, ParentChangesDelta, PromiseInterface, RmCore, ServerCacheDependencyInterface, ServerCachedQueryHandler, ServerItemEntryChanges, ServerItemHandler, TransactionCache, TransactionOptions, TransactionValidatorFactory } from '../../../internal';
|
|
3
|
+
/**
|
|
4
|
+
* @description
|
|
5
|
+
* The {@link ServerCache ServerCache} is responsible for keeping track of {@link ItemEntry ItemEntries} and {@link CollectionEntry CollectionEntries}
|
|
6
|
+
* which are saved on the server.
|
|
7
|
+
*
|
|
8
|
+
* It's basically a local representation of the database
|
|
9
|
+
*/
|
|
10
|
+
export declare class ServerCache extends AbstractCache {
|
|
11
|
+
dependencies: ServerCacheDependencyInterface;
|
|
12
|
+
readonly itemHandler: ServerItemHandler;
|
|
13
|
+
readonly cachedQueryHandler: ServerCachedQueryHandler;
|
|
14
|
+
parent: null;
|
|
15
|
+
constructor(dependencies: ServerCacheDependencyInterface, core: RmCore);
|
|
16
|
+
getServerCache(): ServerCache;
|
|
17
|
+
createChild(id?: string, validatorFactory?: TransactionValidatorFactory, options?: TransactionOptions): TransactionCache;
|
|
18
|
+
expandCollectionResources<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, collections: CollectionResourceParentIdMap<ItemTypeType>, newRequestColumns: ApiRequestColumn[]): PromiseInterface<CollectionResourceParentIdMap>;
|
|
19
|
+
/**
|
|
20
|
+
*
|
|
21
|
+
* @param response
|
|
22
|
+
* @param requestColumnMap
|
|
23
|
+
* @param isCalledAfterSocketUpdate
|
|
24
|
+
* @param changesDelta
|
|
25
|
+
* @param conversionMap
|
|
26
|
+
* @param directRequestItemMap Should be a map of ItemType->ItemId of items that were directly part of the create/update request (queries should be excluded from this because we don't want to overwrite the user's changes (derived values are also queries))
|
|
27
|
+
*/
|
|
28
|
+
processResponse(response: ApiResponseProcessor, requestColumnMap: ApiRequestColumnMap, isCalledAfterSocketUpdate?: boolean, changesDelta?: ChangesDelta, directRequestItemMap?: ItemTypeMap<Record<string, boolean>>, conversionMap?: ItemIdConversionMap): PromiseInterface<ChangesDeltaResult>;
|
|
29
|
+
/**
|
|
30
|
+
* @description
|
|
31
|
+
* Applies changes to this transaction and its children
|
|
32
|
+
* ServerCache.applyChangesFromParent should be used when processing an API update/create/delete
|
|
33
|
+
*/
|
|
34
|
+
applyChangesFromParent(parentChangesDelta: ParentChangesDelta, isCalledAfterSocketUpdate?: boolean): PromiseInterface<void>;
|
|
35
|
+
/**
|
|
36
|
+
* @description
|
|
37
|
+
* Gets the fields required to set the parent
|
|
38
|
+
*/
|
|
39
|
+
getLinkFieldsByParent<ItemTypeType extends ApiEnumItemType>(parent: EntryParent, itemType: ItemTypeType): Partial<FieldMap<ItemTypeType>>;
|
|
40
|
+
/**
|
|
41
|
+
* @description
|
|
42
|
+
* Gets the entry's parent
|
|
43
|
+
*
|
|
44
|
+
* @param itemEntry The entry to get the parent from
|
|
45
|
+
* @param _fromInitial Unused parameter, there for alignment with {@link TransactionCache.getParent TransactionCache.getParent]
|
|
46
|
+
* @param _providedFields Unused parameter, there for alignment with {@link TransactionCache.getParent TransactionCache.getParent]
|
|
47
|
+
*
|
|
48
|
+
* @remark
|
|
49
|
+
* Use {@link CollectionResource.getParent CollectionResource.getParent} instead of {@link TransactionCache.getParent TransactionCache.getParent} if you're getting the parent in the onRemove callback
|
|
50
|
+
*/
|
|
51
|
+
getParent<ItemTypeType extends ApiEnumItemType = any>(itemEntry: ItemEntry<ItemTypeType>, _fromInitial?: boolean, _providedFields?: FieldMap<ItemTypeType>): EntryParentNull;
|
|
52
|
+
getItemChangesRecursively(itemEntryId: ItemEntry['id'], copyFields?: boolean): FieldMap;
|
|
53
|
+
/**
|
|
54
|
+
* @description
|
|
55
|
+
* Only takes the local changes into account, used for saving
|
|
56
|
+
*/
|
|
57
|
+
getLocalItemEntryChangesTuple(itemEntryId: ItemEntry['id']): {
|
|
58
|
+
entry: ItemEntry;
|
|
59
|
+
changes: ServerItemEntryChanges;
|
|
60
|
+
};
|
|
61
|
+
getCollectionChangesRecursively<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, parsedQuery: CollectionQuery): CachedQueryItem<ItemTypeType> | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* @description
|
|
64
|
+
* Invalidates the complete server cache, all items will be re-fetched whenever they are requested
|
|
65
|
+
*/
|
|
66
|
+
invalidateCache(): void;
|
|
67
|
+
/**
|
|
68
|
+
* @description
|
|
69
|
+
* Merges the passed changes from the child Transaction into this Transaction's own changes and then propagates
|
|
70
|
+
* them to all child Transactions
|
|
71
|
+
*/
|
|
72
|
+
applyChangesFromChild(transaction: TransactionCache, breakUpByParent?: boolean, onAfterCreateCallback?: OnAfterCreateCallback): PromiseInterface<ItemIdConversionMap>;
|
|
73
|
+
/**
|
|
74
|
+
* @description
|
|
75
|
+
* Applies changes to this transaction and its children
|
|
76
|
+
* ServerCache.applyChangesDelta should be used when processing an API response which should create new entries on the ServerCache (such as a Query)
|
|
77
|
+
*/
|
|
78
|
+
applyChangesDelta(changesDelta: ChangesDelta, isCalledAfterSocketUpdate?: boolean, conversionMap?: ItemIdConversionMap): PromiseInterface<ChangesDeltaResult>;
|
|
79
|
+
getLocalItemEntry(itemEntryId: ItemEntry['id']): ItemEntry | undefined;
|
|
80
|
+
getLocalItemEntryByItemId(itemType: ApiEnumItemType, itemId: ItemEntry['itemId']): ItemEntry | undefined;
|
|
81
|
+
getChangesFromItemChanges<ItemTypeType extends ApiEnumItemType = any>(changesObject: ServerItemEntryChanges<ItemTypeType>): FieldMap<ItemTypeType>;
|
|
82
|
+
}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { ApiEnumItemType, ItemId } from '@rentman/backend-types';
|
|
2
|
-
import { ApiRequestColumns, ApiRequestService, CachedQueryHandlerBase, CachedQueryItem, CollectionEntryService, CollectionOptions, CollectionQuery, ColumnSubsetCache, ColumnSubsetCacheFactory, ColumnUtil, ErrorHandlerInterface, ItemEntry, ParentIdMap, PromiseInterface, PromiseLibraryInterface, RequestBufferManager, RequestColumnExpansionFactory, ServerCache, ServerItemHandler } from '../../../internal';
|
|
3
|
-
export declare class ServerCachedQueryHandler extends CachedQueryHandlerBase {
|
|
4
|
-
private columnSubsetCacheFactory;
|
|
5
|
-
private requestBufferManager;
|
|
6
|
-
private apiRequestService;
|
|
7
|
-
private errorHandler;
|
|
8
|
-
private itemHandler;
|
|
9
|
-
protected transaction: ServerCache;
|
|
10
|
-
constructor(columnSubsetCacheFactory: ColumnSubsetCacheFactory, requestBufferManager: RequestBufferManager, requestColumnExpansionFactory: RequestColumnExpansionFactory, apiRequestService: ApiRequestService, collectionEntryService: CollectionEntryService, errorHandler: ErrorHandlerInterface, itemHandler: ServerItemHandler, promiseService: PromiseLibraryInterface, columnUtil: ColumnUtil, transaction: ServerCache);
|
|
11
|
-
__fetchCachedQueryItem<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, options: CollectionOptions): PromiseInterface<CachedQueryItem<ItemTypeType>>;
|
|
12
|
-
__fetchLinkedCachedQueryItems<ItemTypeType extends ApiEnumItemType>(parentType: ApiEnumItemType, parentIdArray: ItemId[] | (() => ItemId[]), itemType: ItemTypeType, options: CollectionOptions): PromiseInterface<ParentIdMap<CachedQueryItem<ItemTypeType>>>;
|
|
13
|
-
__addItemEntriesToCachedQueries<ItemTypeType extends ApiEnumItemType = any>(itemType: ItemTypeType, parsedQuery: CollectionQuery, itemEntries: Array<ItemEntry<ItemTypeType>>): void;
|
|
14
|
-
/**
|
|
15
|
-
* @description
|
|
16
|
-
* Expands the columns of the items in the cached query
|
|
17
|
-
*/
|
|
18
|
-
__expandCachedQuery<ItemTypeType extends ApiEnumItemType = any>(cachedQuery: CachedQueryItem<ItemTypeType>, newColumns: ApiRequestColumns, force?: boolean): PromiseInterface<CachedQueryItem<ItemTypeType>>;
|
|
19
|
-
/**
|
|
20
|
-
* @description
|
|
21
|
-
* Fetches the data for the passed ItemType/options, will do nothing if the requested CollectionEntry/columns are already cached.
|
|
22
|
-
* Will create a new {@link CollectionEntry CollectionEntry} if the CollectionEntry didn't exist yet
|
|
23
|
-
*/
|
|
24
|
-
__fetchItemEntriesByQueryData<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, options: CollectionOptions<ItemTypeType>, columnSubsetCache: ColumnSubsetCache<ItemTypeType>, collectionQuery: CollectionQuery): PromiseInterface<CachedQueryItem<ItemTypeType>>;
|
|
25
|
-
}
|
|
1
|
+
import { ApiEnumItemType, ItemId } from '@rentman/backend-types';
|
|
2
|
+
import { ApiRequestColumns, ApiRequestService, CachedQueryHandlerBase, CachedQueryItem, CollectionEntryService, CollectionOptions, CollectionQuery, ColumnSubsetCache, ColumnSubsetCacheFactory, ColumnUtil, ErrorHandlerInterface, ItemEntry, ParentIdMap, PromiseInterface, PromiseLibraryInterface, RequestBufferManager, RequestColumnExpansionFactory, ServerCache, ServerItemHandler } from '../../../internal';
|
|
3
|
+
export declare class ServerCachedQueryHandler extends CachedQueryHandlerBase {
|
|
4
|
+
private columnSubsetCacheFactory;
|
|
5
|
+
private requestBufferManager;
|
|
6
|
+
private apiRequestService;
|
|
7
|
+
private errorHandler;
|
|
8
|
+
private itemHandler;
|
|
9
|
+
protected transaction: ServerCache;
|
|
10
|
+
constructor(columnSubsetCacheFactory: ColumnSubsetCacheFactory, requestBufferManager: RequestBufferManager, requestColumnExpansionFactory: RequestColumnExpansionFactory, apiRequestService: ApiRequestService, collectionEntryService: CollectionEntryService, errorHandler: ErrorHandlerInterface, itemHandler: ServerItemHandler, promiseService: PromiseLibraryInterface, columnUtil: ColumnUtil, transaction: ServerCache);
|
|
11
|
+
__fetchCachedQueryItem<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, options: CollectionOptions): PromiseInterface<CachedQueryItem<ItemTypeType>>;
|
|
12
|
+
__fetchLinkedCachedQueryItems<ItemTypeType extends ApiEnumItemType>(parentType: ApiEnumItemType, parentIdArray: ItemId[] | (() => ItemId[]), itemType: ItemTypeType, options: CollectionOptions): PromiseInterface<ParentIdMap<CachedQueryItem<ItemTypeType>>>;
|
|
13
|
+
__addItemEntriesToCachedQueries<ItemTypeType extends ApiEnumItemType = any>(itemType: ItemTypeType, parsedQuery: CollectionQuery, itemEntries: Array<ItemEntry<ItemTypeType>>): void;
|
|
14
|
+
/**
|
|
15
|
+
* @description
|
|
16
|
+
* Expands the columns of the items in the cached query
|
|
17
|
+
*/
|
|
18
|
+
__expandCachedQuery<ItemTypeType extends ApiEnumItemType = any>(cachedQuery: CachedQueryItem<ItemTypeType>, newColumns: ApiRequestColumns, force?: boolean): PromiseInterface<CachedQueryItem<ItemTypeType>>;
|
|
19
|
+
/**
|
|
20
|
+
* @description
|
|
21
|
+
* Fetches the data for the passed ItemType/options, will do nothing if the requested CollectionEntry/columns are already cached.
|
|
22
|
+
* Will create a new {@link CollectionEntry CollectionEntry} if the CollectionEntry didn't exist yet
|
|
23
|
+
*/
|
|
24
|
+
__fetchItemEntriesByQueryData<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, options: CollectionOptions<ItemTypeType>, columnSubsetCache: ColumnSubsetCache<ItemTypeType>, collectionQuery: CollectionQuery): PromiseInterface<CachedQueryItem<ItemTypeType>>;
|
|
25
|
+
}
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
import { ApiEnumItemType, ItemId } from '@rentman/backend-types';
|
|
2
|
-
import { ApiFormatter, ApiQuery, ApiRequestColumns, ApiResponseProcessor, ChangesDelta, ChangesDeltaItemCreateDelta, ChangesDeltaItemUpdateDelta, ColumnExpansion, ColumnSet, ColumnSubsetCacheFactory, ColumnUtil, ErrorHandlerInterface, FieldMap, ItemCacheFactory, ItemEntry, ItemEntryFactory, ItemEntryOptions, ItemHandlerBase, ProcessItemEntryChangesResult, PromiseInterface, PromiseLibraryInterface, QueryParserFactory, QueryService, RequestBufferManager, RequestBufferResponse, RequestColumnExpansionFactory, ServerCache, TransactionItemEntryChanges } from '../../../internal';
|
|
3
|
-
export declare type ServerItemEntryChanges<ItemTypeType extends ApiEnumItemType = any> = FieldMap<ItemTypeType>;
|
|
4
|
-
export declare class ServerItemHandler extends ItemHandlerBase {
|
|
5
|
-
private requestBufferManager;
|
|
6
|
-
private queryParserFactory;
|
|
7
|
-
private queryService;
|
|
8
|
-
private columnSubsetCacheFactory;
|
|
9
|
-
protected transaction: ServerCache;
|
|
10
|
-
itemChanges: {
|
|
11
|
-
[itemEntryId: number]: ServerItemEntryChanges;
|
|
12
|
-
};
|
|
13
|
-
constructor(requestBufferManager: RequestBufferManager, queryParserFactory: QueryParserFactory, queryService: QueryService, columnSubsetCacheFactory: ColumnSubsetCacheFactory, errorHandler: ErrorHandlerInterface, promiseService: PromiseLibraryInterface, columnUtil: ColumnUtil, apiFormatter: ApiFormatter, itemEntryFactory: ItemEntryFactory, itemCacheFactory: ItemCacheFactory, requestColumnExpansionFactory: RequestColumnExpansionFactory, transaction: ServerCache);
|
|
14
|
-
createItemEntry(createTuple: ChangesDeltaItemCreateDelta): ItemEntry;
|
|
15
|
-
/**
|
|
16
|
-
* @description
|
|
17
|
-
* Processes updates on a cached entry
|
|
18
|
-
*/
|
|
19
|
-
processItemEntryChanges<ItemTypeType extends ApiEnumItemType = any>(itemEntryChangesTuple: ChangesDeltaItemUpdateDelta<ItemTypeType>, _isCalledAfterSocketUpdate?: boolean, _createItemChangesIfNoneExist?: boolean): ProcessItemEntryChangesResult<ItemTypeType>;
|
|
20
|
-
copyTransactionItemEntryChanges(itemEntryChanges: TransactionItemEntryChanges, entry: ItemEntry): ServerItemEntryChanges;
|
|
21
|
-
fetchItemEntry<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, itemId: ItemId, options: ItemEntryOptions): PromiseInterface<ItemEntry<ItemTypeType>>;
|
|
22
|
-
fetchItemEntriesByQuery<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, query: ApiQuery, entryOptions: ItemEntryOptions): PromiseInterface<Array<ItemEntry<ItemTypeType>>>;
|
|
23
|
-
extendItemEntries<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, itemEntries: Array<ItemEntry<ItemTypeType>>, newColumns: ApiRequestColumns): PromiseInterface<Array<ItemEntry<ItemTypeType>>>;
|
|
24
|
-
fetchItemEntries<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, itemIds: ItemId[], options: ItemEntryOptions): PromiseInterface<Array<ItemEntry<ItemTypeType>>>;
|
|
25
|
-
/**
|
|
26
|
-
* @description
|
|
27
|
-
* Fetches the data for the ItemEntries linked to the parent Items
|
|
28
|
-
*
|
|
29
|
-
* @param columns should contain a derived column that refers to the parent
|
|
30
|
-
*/
|
|
31
|
-
fetchLinkedItemEntriesData(parentType: ApiEnumItemType, parentIdArray: ItemId[], itemType: ApiEnumItemType, query: ApiQuery | null, columns: ApiRequestColumns): PromiseInterface<RequestBufferResponse>;
|
|
32
|
-
/**
|
|
33
|
-
* @description
|
|
34
|
-
* General way to process an API response.
|
|
35
|
-
* Will call {@link ChangesDelta.setItemCreated setItemCreated} if an entry doesn't exist yet, and otherwise {@link ChangesDelta.setItemUpdated setItemUpdated} if it does.
|
|
36
|
-
*/
|
|
37
|
-
processApiResponse<ItemTypeType extends ApiEnumItemType>(changesDelta: ChangesDelta, response: ApiResponseProcessor, itemType: ItemTypeType, itemIdOfExistingItem: ItemId, itemIdInResponse: ItemId, columnSet: ColumnSet<ItemTypeType>, columnExpansion: ColumnExpansion<ItemTypeType>, updateModified?: boolean): void;
|
|
38
|
-
/**
|
|
39
|
-
* @description
|
|
40
|
-
* Fetches the data for the passed ItemType/ItemId/columns, will do nothing if the requested ItemEntry/columns are already cached.
|
|
41
|
-
* Will create a new {@link ItemEntry ItemEntry} if the ItemEntry didn't exist yet
|
|
42
|
-
*/
|
|
43
|
-
private fetchItemEntryData;
|
|
44
|
-
}
|
|
1
|
+
import { ApiEnumItemType, ItemId } from '@rentman/backend-types';
|
|
2
|
+
import { ApiFormatter, ApiQuery, ApiRequestColumns, ApiResponseProcessor, ChangesDelta, ChangesDeltaItemCreateDelta, ChangesDeltaItemUpdateDelta, ColumnExpansion, ColumnSet, ColumnSubsetCacheFactory, ColumnUtil, ErrorHandlerInterface, FieldMap, ItemCacheFactory, ItemEntry, ItemEntryFactory, ItemEntryOptions, ItemHandlerBase, ProcessItemEntryChangesResult, PromiseInterface, PromiseLibraryInterface, QueryParserFactory, QueryService, RequestBufferManager, RequestBufferResponse, RequestColumnExpansionFactory, ServerCache, TransactionItemEntryChanges } from '../../../internal';
|
|
3
|
+
export declare type ServerItemEntryChanges<ItemTypeType extends ApiEnumItemType = any> = FieldMap<ItemTypeType>;
|
|
4
|
+
export declare class ServerItemHandler extends ItemHandlerBase {
|
|
5
|
+
private requestBufferManager;
|
|
6
|
+
private queryParserFactory;
|
|
7
|
+
private queryService;
|
|
8
|
+
private columnSubsetCacheFactory;
|
|
9
|
+
protected transaction: ServerCache;
|
|
10
|
+
itemChanges: {
|
|
11
|
+
[itemEntryId: number]: ServerItemEntryChanges;
|
|
12
|
+
};
|
|
13
|
+
constructor(requestBufferManager: RequestBufferManager, queryParserFactory: QueryParserFactory, queryService: QueryService, columnSubsetCacheFactory: ColumnSubsetCacheFactory, errorHandler: ErrorHandlerInterface, promiseService: PromiseLibraryInterface, columnUtil: ColumnUtil, apiFormatter: ApiFormatter, itemEntryFactory: ItemEntryFactory, itemCacheFactory: ItemCacheFactory, requestColumnExpansionFactory: RequestColumnExpansionFactory, transaction: ServerCache);
|
|
14
|
+
createItemEntry(createTuple: ChangesDeltaItemCreateDelta): ItemEntry;
|
|
15
|
+
/**
|
|
16
|
+
* @description
|
|
17
|
+
* Processes updates on a cached entry
|
|
18
|
+
*/
|
|
19
|
+
processItemEntryChanges<ItemTypeType extends ApiEnumItemType = any>(itemEntryChangesTuple: ChangesDeltaItemUpdateDelta<ItemTypeType>, _isCalledAfterSocketUpdate?: boolean, _createItemChangesIfNoneExist?: boolean): ProcessItemEntryChangesResult<ItemTypeType>;
|
|
20
|
+
copyTransactionItemEntryChanges(itemEntryChanges: TransactionItemEntryChanges, entry: ItemEntry): ServerItemEntryChanges;
|
|
21
|
+
fetchItemEntry<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, itemId: ItemId, options: ItemEntryOptions): PromiseInterface<ItemEntry<ItemTypeType>>;
|
|
22
|
+
fetchItemEntriesByQuery<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, query: ApiQuery, entryOptions: ItemEntryOptions): PromiseInterface<Array<ItemEntry<ItemTypeType>>>;
|
|
23
|
+
extendItemEntries<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, itemEntries: Array<ItemEntry<ItemTypeType>>, newColumns: ApiRequestColumns): PromiseInterface<Array<ItemEntry<ItemTypeType>>>;
|
|
24
|
+
fetchItemEntries<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, itemIds: ItemId[], options: ItemEntryOptions): PromiseInterface<Array<ItemEntry<ItemTypeType>>>;
|
|
25
|
+
/**
|
|
26
|
+
* @description
|
|
27
|
+
* Fetches the data for the ItemEntries linked to the parent Items
|
|
28
|
+
*
|
|
29
|
+
* @param columns should contain a derived column that refers to the parent
|
|
30
|
+
*/
|
|
31
|
+
fetchLinkedItemEntriesData(parentType: ApiEnumItemType, parentIdArray: ItemId[], itemType: ApiEnumItemType, query: ApiQuery | null, columns: ApiRequestColumns): PromiseInterface<RequestBufferResponse>;
|
|
32
|
+
/**
|
|
33
|
+
* @description
|
|
34
|
+
* General way to process an API response.
|
|
35
|
+
* Will call {@link ChangesDelta.setItemCreated setItemCreated} if an entry doesn't exist yet, and otherwise {@link ChangesDelta.setItemUpdated setItemUpdated} if it does.
|
|
36
|
+
*/
|
|
37
|
+
processApiResponse<ItemTypeType extends ApiEnumItemType>(changesDelta: ChangesDelta, response: ApiResponseProcessor, itemType: ItemTypeType, itemIdOfExistingItem: ItemId, itemIdInResponse: ItemId, columnSet: ColumnSet<ItemTypeType>, columnExpansion: ColumnExpansion<ItemTypeType>, updateModified?: boolean): void;
|
|
38
|
+
/**
|
|
39
|
+
* @description
|
|
40
|
+
* Fetches the data for the passed ItemType/ItemId/columns, will do nothing if the requested ItemEntry/columns are already cached.
|
|
41
|
+
* Will create a new {@link ItemEntry ItemEntry} if the ItemEntry didn't exist yet
|
|
42
|
+
*/
|
|
43
|
+
private fetchItemEntryData;
|
|
44
|
+
}
|