@rentman/rm-core 3.1.0 → 4.0.1
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 +685 -668
- package/dist/rm-core.js +9449 -9520
- package/dist/rm-core.min.js +2 -2
- package/dist/types/classes/ApiFormatter.d.ts +55 -55
- package/dist/types/classes/ApiRequestService.d.ts +20 -20
- package/dist/types/classes/ApiResponseProcessor.d.ts +31 -31
- package/dist/types/classes/ChangesCompilation.d.ts +34 -34
- package/dist/types/classes/ChangesDelta.d.ts +59 -59
- package/dist/types/classes/ChangesDeltaBase.d.ts +50 -50
- package/dist/types/classes/ChangesProcessor.d.ts +47 -47
- package/dist/types/classes/CollectionCache.d.ts +38 -38
- package/dist/types/classes/CollectionEntryService.d.ts +25 -25
- package/dist/types/classes/CollectionMatcher.d.ts +9 -9
- package/dist/types/classes/CollectionMatcherBase.d.ts +26 -26
- 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 +22 -22
- package/dist/types/classes/ColumnHandler.d.ts +21 -21
- package/dist/types/classes/ColumnInfo.d.ts +14 -14
- package/dist/types/classes/ColumnSet.d.ts +39 -39
- package/dist/types/classes/ColumnSubsetCache.d.ts +8 -8
- package/dist/types/classes/ColumnUtil.d.ts +99 -99
- package/dist/types/classes/ConversionMapService.d.ts +27 -27
- package/dist/types/classes/CreateRequest.d.ts +19 -19
- package/dist/types/classes/CreatedChangesDelta.d.ts +15 -15
- package/dist/types/classes/InternalChangesDelta.d.ts +39 -39
- package/dist/types/classes/ItemCache.d.ts +29 -29
- package/dist/types/classes/ItemCreateService.d.ts +24 -24
- package/dist/types/classes/ItemEntryService.d.ts +34 -34
- package/dist/types/classes/KeyService.d.ts +16 -16
- package/dist/types/classes/LockService.d.ts +32 -32
- package/dist/types/classes/ModuleChangesCompilation.d.ts +18 -18
- package/dist/types/classes/QueryColumnExtractor.d.ts +20 -20
- package/dist/types/classes/QueryMatcher.d.ts +14 -14
- package/dist/types/classes/QueryParser.d.ts +25 -25
- package/dist/types/classes/QueryParserBase.d.ts +29 -29
- package/dist/types/classes/QueryService.d.ts +14 -14
- package/dist/types/classes/RequestBuffer.d.ts +28 -28
- package/dist/types/classes/RequestBufferManager.d.ts +24 -24
- package/dist/types/classes/RequestColumnExpansion.d.ts +15 -15
- package/dist/types/classes/SocketMessageHandler.d.ts +31 -31
- package/dist/types/classes/TemplateCache.d.ts +66 -66
- package/dist/types/classes/Util.d.ts +30 -30
- package/dist/types/classes/cache/AbstractCache.d.ts +101 -101
- package/dist/types/classes/cache/CollectionHandlerBase.d.ts +68 -68
- package/dist/types/classes/cache/CollectionMatcherCacheProcessor.d.ts +26 -26
- package/dist/types/classes/cache/ItemHandlerBase.d.ts +95 -95
- package/dist/types/classes/cache/server/ServerCache.d.ts +83 -83
- package/dist/types/classes/cache/server/ServerCollectionHandler.d.ts +44 -44
- package/dist/types/classes/cache/server/ServerItemHandler.d.ts +51 -51
- package/dist/types/classes/cache/transaction/TransactionCache.d.ts +336 -344
- package/dist/types/classes/cache/transaction/TransactionCollectionHandler.d.ts +62 -62
- package/dist/types/classes/cache/transaction/TransactionEventHandler.d.ts +24 -24
- package/dist/types/classes/cache/transaction/TransactionItemHandler.d.ts +90 -99
- package/dist/types/classes/cache/transaction/TransactionValidator.d.ts +28 -28
- package/dist/types/classes/index.d.ts +46 -46
- package/dist/types/constants.d.ts +7 -7
- package/dist/types/core.d.ts +52 -52
- package/dist/types/factories/ApiResponseProcessorFactory.d.ts +6 -6
- package/dist/types/factories/ChangesCompilationFactory.d.ts +6 -6
- package/dist/types/factories/ChangesDeltaFactory.d.ts +11 -11
- package/dist/types/factories/ChangesProcessorFactory.d.ts +22 -22
- package/dist/types/factories/CollectionCacheFactory.d.ts +8 -8
- package/dist/types/factories/CollectionEntryFactory.d.ts +11 -11
- package/dist/types/factories/CollectionMatcherFactory.d.ts +9 -9
- package/dist/types/factories/CollectionResourceFactory.d.ts +16 -16
- package/dist/types/factories/ColumnExpansionFactory.d.ts +8 -8
- package/dist/types/factories/ColumnInfoFactory.d.ts +7 -7
- package/dist/types/factories/ColumnSetFactory.d.ts +19 -19
- package/dist/types/factories/ColumnSubsetCacheFactory.d.ts +6 -6
- package/dist/types/factories/CreateRequestFactory.d.ts +11 -11
- package/dist/types/factories/ItemCacheFactory.d.ts +8 -8
- package/dist/types/factories/ItemEntryFactory.d.ts +15 -15
- package/dist/types/factories/ItemResourceFactory.d.ts +14 -17
- package/dist/types/factories/ModuleChangesCompilationFactory.d.ts +5 -5
- package/dist/types/factories/QueryMatcherFactory.d.ts +7 -7
- package/dist/types/factories/QueryParserFactory.d.ts +6 -6
- package/dist/types/factories/RequestColumnExpansionFactory.d.ts +6 -6
- package/dist/types/factories/TemplateFactory.d.ts +10 -10
- package/dist/types/factories/TransactionCacheFactory.d.ts +15 -15
- package/dist/types/factories/index.d.ts +22 -22
- package/dist/types/index.d.ts +7 -7
- package/dist/types/interfaces/AbstractCacheDependencyInterface.d.ts +44 -44
- package/dist/types/interfaces/ApiRequestServiceInterface.d.ts +11 -11
- package/dist/types/interfaces/AuthInterface.d.ts +9 -9
- 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 +7 -7
- package/dist/types/interfaces/SocketMessageInterface.d.ts +3 -3
- package/dist/types/interfaces/TransactionCollectionHandlerDependencyInterface.d.ts +20 -20
- package/dist/types/interfaces/TransactionItemHandlerDependencyInterface.d.ts +26 -26
- package/dist/types/interfaces/index.d.ts +11 -12
- package/dist/types/models/CollectionEntry.d.ts +27 -27
- package/dist/types/models/CollectionEntryOptions.d.ts +13 -13
- package/dist/types/models/CollectionResource.d.ts +63 -62
- package/dist/types/models/CollectionResourceOptions.d.ts +23 -23
- package/dist/types/models/ItemEntry.d.ts +19 -19
- package/dist/types/models/ItemEntryOptions.d.ts +8 -8
- package/dist/types/models/ItemResource.d.ts +84 -93
- package/dist/types/models/Template.d.ts +11 -11
- package/dist/types/models/index.d.ts +8 -9
- package/dist/types/types/ItemTypesCollection.d.ts +263 -262
- package/dist/types/types/PromiseInterface.d.ts +2 -2
- package/dist/types/types/index.d.ts +2 -2
- package/package.json +36 -36
- package/readme.md +15 -15
- package/dist/types/interfaces/TransactionCacheDependencyInterface.d.ts +0 -3
- package/dist/types/models/ItemResourceOptions.d.ts +0 -6
|
@@ -1,95 +1,95 @@
|
|
|
1
|
-
import { ItemCacheFactory, ItemEntryFactory, RequestColumnExpansionFactory } from '../../factories';
|
|
2
|
-
import { ErrorHandlerInterface, PromiseLibraryInterface } from '../../interfaces';
|
|
3
|
-
import { ItemEntry, ItemEntryOptions } from '../../models';
|
|
4
|
-
import { ApiQuery, ApiRequestColumns, FieldMap, ItemId, ItemType, PromiseInterface } from '../../types';
|
|
5
|
-
import { ApiFormatter } from '../ApiFormatter';
|
|
6
|
-
import { ChangesDeltaBase, ChangesDeltaItemUpdateDelta } from '../ChangesDeltaBase';
|
|
7
|
-
import { ColumnInfo } from '../ColumnInfo';
|
|
8
|
-
import { ColumnUtil } from '../ColumnUtil';
|
|
9
|
-
import { ChangesDeltaItemCreateDelta } from '../CreatedChangesDelta';
|
|
10
|
-
import { ItemCache } from '../ItemCache';
|
|
11
|
-
import { AbstractCache } from './AbstractCache';
|
|
12
|
-
import { ServerItemEntryChanges } from './server/ServerItemHandler';
|
|
13
|
-
import { TransactionItemEntryChanges } from './transaction/TransactionItemHandler';
|
|
14
|
-
export declare abstract class ItemHandlerBase {
|
|
15
|
-
protected columnUtil: ColumnUtil;
|
|
16
|
-
protected apiFormatter: ApiFormatter;
|
|
17
|
-
protected itemEntryFactory: ItemEntryFactory;
|
|
18
|
-
protected promiseService: PromiseLibraryInterface;
|
|
19
|
-
protected errorHandler: ErrorHandlerInterface;
|
|
20
|
-
protected requestColumnExpansionFactory: RequestColumnExpansionFactory;
|
|
21
|
-
protected transaction: AbstractCache;
|
|
22
|
-
readonly entries: ItemCache;
|
|
23
|
-
abstract itemChanges: ServerItemEntryChanges | TransactionItemEntryChanges;
|
|
24
|
-
protected constructor(columnUtil: ColumnUtil, apiFormatter: ApiFormatter, itemEntryFactory: ItemEntryFactory, promiseService: PromiseLibraryInterface, errorHandler: ErrorHandlerInterface, requestColumnExpansionFactory: RequestColumnExpansionFactory, itemCacheFactory: ItemCacheFactory, transaction: AbstractCache);
|
|
25
|
-
/**
|
|
26
|
-
* @description
|
|
27
|
-
* Copies the passed ItemEntryChanges into a format the implementing ItemHandler can put in his ItemChanges
|
|
28
|
-
* @param itemEntryChanges
|
|
29
|
-
* @param entry
|
|
30
|
-
*/
|
|
31
|
-
abstract copyTransactionItemEntryChanges(itemEntryChanges: TransactionItemEntryChanges, entry: ItemEntry): any;
|
|
32
|
-
/**
|
|
33
|
-
* @description
|
|
34
|
-
* Fetches the ItemEntries for the given query, does not look in the cache, since we don't know which ItemIds belong to the query !
|
|
35
|
-
*
|
|
36
|
-
* todo: We could store collections by their query string, and then see if the query is already cached
|
|
37
|
-
*/
|
|
38
|
-
abstract fetchItemEntriesByQuery<ItemTypeType extends ItemType>(itemType: ItemTypeType, query: ApiQuery, entryOptions: ItemEntryOptions): PromiseInterface<Array<ItemEntry<ItemTypeType>>>;
|
|
39
|
-
/**
|
|
40
|
-
* @description
|
|
41
|
-
* Fetches the ItemEntries for the given ItemIds
|
|
42
|
-
*/
|
|
43
|
-
abstract fetchItemEntries<ItemTypeType extends ItemType>(itemType: ItemTypeType, itemIds: ItemId[], options: ItemEntryOptions): PromiseInterface<Array<ItemEntry<ItemTypeType>>>;
|
|
44
|
-
/**
|
|
45
|
-
* @description
|
|
46
|
-
* Fetches an ItemEntry with the given itemId
|
|
47
|
-
*/
|
|
48
|
-
abstract fetchItemEntry<ItemTypeType extends ItemType>(itemType: ItemTypeType, itemId: ItemId, options: ItemEntryOptions): PromiseInterface<ItemEntry<ItemTypeType>>;
|
|
49
|
-
/**
|
|
50
|
-
* @description
|
|
51
|
-
* 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
|
|
52
|
-
*/
|
|
53
|
-
abstract processItemEntryChanges(itemEntryChangesTuple: ChangesDeltaItemUpdateDelta, forceOverwrite: boolean, updateInitial: boolean, isCalledAfterSocketUpdate: boolean, createItemChangesIfNoneExist: boolean): void;
|
|
54
|
-
/**
|
|
55
|
-
* @description
|
|
56
|
-
* Traverses the column path and returns the fields of the derived item, returns undefined if the item isn't found
|
|
57
|
-
*
|
|
58
|
-
* ---------------------
|
|
59
|
-
*
|
|
60
|
-
* @remark
|
|
61
|
-
* Assumes the derived item's values are already cached
|
|
62
|
-
*/
|
|
63
|
-
getDerivedValues(itemEntry: ItemEntry, columnPath: string[]): Readonly<FieldMap> | undefined;
|
|
64
|
-
/**
|
|
65
|
-
* @description
|
|
66
|
-
* Returns the value of the columnPath, or undefined when the path couldn't be traversed
|
|
67
|
-
*
|
|
68
|
-
* @param itemEntry The root entry to start the path from
|
|
69
|
-
* @param columnPath Can either be an array of columnIds (['column', 'column2']) or a config column string ('column>column2')
|
|
70
|
-
*/
|
|
71
|
-
getDerivedValue<T extends any = any>(itemEntry: ItemEntry, columnPath: string[] | string): T | undefined;
|
|
72
|
-
/**
|
|
73
|
-
* @description
|
|
74
|
-
* Clears the entry from this transaction, removing it from the {@link ItemCache ItemCache} and removing all changes
|
|
75
|
-
*/
|
|
76
|
-
clearItemEntry(entry: ItemEntry): void;
|
|
77
|
-
/**
|
|
78
|
-
* @description
|
|
79
|
-
* Recursively fetches derived values as separate requests, instead of as columns of a primary item
|
|
80
|
-
* 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
|
|
81
|
-
*/
|
|
82
|
-
fetchDerivedValuesByColumn<ItemTypeType extends ItemType>(itemEntries: Array<ItemEntry<ItemTypeType>>, rootColumn: ColumnInfo<ItemTypeType>, changesDelta?: ChangesDeltaBase): PromiseInterface<void | Array<ItemEntry<ItemTypeType>>>;
|
|
83
|
-
resolveDerivedValues<ItemTypeType extends ItemType>(itemEntries: Array<ItemEntry<ItemTypeType>>, columns: Array<ColumnInfo<ItemTypeType>>, changesDelta?: ChangesDeltaBase): PromiseInterface<Array<ItemEntry<ItemTypeType>>>;
|
|
84
|
-
/**
|
|
85
|
-
* @description
|
|
86
|
-
* Creates a new {@link ItemEntry ItemEntry} from the passed {@link ChangesDeltaItemCreateDelta ChangesDeltaItemCreateDelta} and stores it in this transaction's {@link ItemCache ItemCache}
|
|
87
|
-
*/
|
|
88
|
-
protected createItemEntry(createTuple: ChangesDeltaItemCreateDelta): ItemEntry;
|
|
89
|
-
/**
|
|
90
|
-
* @description
|
|
91
|
-
* Gets the value of the given column, will look into the current delta before attempting to read itemChanges
|
|
92
|
-
*/
|
|
93
|
-
protected getItemIdByColumn<ItemTypeType extends ItemType>(itemEntry: ItemEntry<ItemTypeType>, column: ColumnInfo<ItemTypeType>, changesDelta?: ChangesDeltaBase): ItemId;
|
|
94
|
-
protected expandColumnsWithCollectionColumns(itemType: ItemType, requestColumns?: ApiRequestColumns): ApiRequestColumns;
|
|
95
|
-
}
|
|
1
|
+
import { ItemCacheFactory, ItemEntryFactory, RequestColumnExpansionFactory } from '../../factories';
|
|
2
|
+
import { ErrorHandlerInterface, PromiseLibraryInterface } from '../../interfaces';
|
|
3
|
+
import { ItemEntry, ItemEntryOptions } from '../../models';
|
|
4
|
+
import { ApiQuery, ApiRequestColumns, FieldMap, ItemId, ItemType, PromiseInterface } from '../../types';
|
|
5
|
+
import { ApiFormatter } from '../ApiFormatter';
|
|
6
|
+
import { ChangesDeltaBase, ChangesDeltaItemUpdateDelta } from '../ChangesDeltaBase';
|
|
7
|
+
import { ColumnInfo } from '../ColumnInfo';
|
|
8
|
+
import { ColumnUtil } from '../ColumnUtil';
|
|
9
|
+
import { ChangesDeltaItemCreateDelta } from '../CreatedChangesDelta';
|
|
10
|
+
import { ItemCache } from '../ItemCache';
|
|
11
|
+
import { AbstractCache } from './AbstractCache';
|
|
12
|
+
import { ServerItemEntryChanges } from './server/ServerItemHandler';
|
|
13
|
+
import { TransactionItemEntryChanges } from './transaction/TransactionItemHandler';
|
|
14
|
+
export declare abstract class ItemHandlerBase {
|
|
15
|
+
protected columnUtil: ColumnUtil;
|
|
16
|
+
protected apiFormatter: ApiFormatter;
|
|
17
|
+
protected itemEntryFactory: ItemEntryFactory;
|
|
18
|
+
protected promiseService: PromiseLibraryInterface;
|
|
19
|
+
protected errorHandler: ErrorHandlerInterface;
|
|
20
|
+
protected requestColumnExpansionFactory: RequestColumnExpansionFactory;
|
|
21
|
+
protected transaction: AbstractCache;
|
|
22
|
+
readonly entries: ItemCache;
|
|
23
|
+
abstract itemChanges: ServerItemEntryChanges | TransactionItemEntryChanges;
|
|
24
|
+
protected constructor(columnUtil: ColumnUtil, apiFormatter: ApiFormatter, itemEntryFactory: ItemEntryFactory, promiseService: PromiseLibraryInterface, errorHandler: ErrorHandlerInterface, requestColumnExpansionFactory: RequestColumnExpansionFactory, itemCacheFactory: ItemCacheFactory, transaction: AbstractCache);
|
|
25
|
+
/**
|
|
26
|
+
* @description
|
|
27
|
+
* Copies the passed ItemEntryChanges into a format the implementing ItemHandler can put in his ItemChanges
|
|
28
|
+
* @param itemEntryChanges
|
|
29
|
+
* @param entry
|
|
30
|
+
*/
|
|
31
|
+
abstract copyTransactionItemEntryChanges(itemEntryChanges: TransactionItemEntryChanges, entry: ItemEntry): any;
|
|
32
|
+
/**
|
|
33
|
+
* @description
|
|
34
|
+
* Fetches the ItemEntries for the given query, does not look in the cache, since we don't know which ItemIds belong to the query !
|
|
35
|
+
*
|
|
36
|
+
* todo: We could store collections by their query string, and then see if the query is already cached
|
|
37
|
+
*/
|
|
38
|
+
abstract fetchItemEntriesByQuery<ItemTypeType extends ItemType>(itemType: ItemTypeType, query: ApiQuery, entryOptions: ItemEntryOptions): PromiseInterface<Array<ItemEntry<ItemTypeType>>>;
|
|
39
|
+
/**
|
|
40
|
+
* @description
|
|
41
|
+
* Fetches the ItemEntries for the given ItemIds
|
|
42
|
+
*/
|
|
43
|
+
abstract fetchItemEntries<ItemTypeType extends ItemType>(itemType: ItemTypeType, itemIds: ItemId[], options: ItemEntryOptions): PromiseInterface<Array<ItemEntry<ItemTypeType>>>;
|
|
44
|
+
/**
|
|
45
|
+
* @description
|
|
46
|
+
* Fetches an ItemEntry with the given itemId
|
|
47
|
+
*/
|
|
48
|
+
abstract fetchItemEntry<ItemTypeType extends ItemType>(itemType: ItemTypeType, itemId: ItemId, options: ItemEntryOptions): PromiseInterface<ItemEntry<ItemTypeType>>;
|
|
49
|
+
/**
|
|
50
|
+
* @description
|
|
51
|
+
* 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
|
|
52
|
+
*/
|
|
53
|
+
abstract processItemEntryChanges(itemEntryChangesTuple: ChangesDeltaItemUpdateDelta, forceOverwrite: boolean, updateInitial: boolean, isCalledAfterSocketUpdate: boolean, createItemChangesIfNoneExist: boolean): void;
|
|
54
|
+
/**
|
|
55
|
+
* @description
|
|
56
|
+
* Traverses the column path and returns the fields of the derived item, returns undefined if the item isn't found
|
|
57
|
+
*
|
|
58
|
+
* ---------------------
|
|
59
|
+
*
|
|
60
|
+
* @remark
|
|
61
|
+
* Assumes the derived item's values are already cached
|
|
62
|
+
*/
|
|
63
|
+
getDerivedValues(itemEntry: ItemEntry, columnPath: string[]): Readonly<FieldMap> | undefined;
|
|
64
|
+
/**
|
|
65
|
+
* @description
|
|
66
|
+
* Returns the value of the columnPath, or undefined when the path couldn't be traversed
|
|
67
|
+
*
|
|
68
|
+
* @param itemEntry The root entry to start the path from
|
|
69
|
+
* @param columnPath Can either be an array of columnIds (['column', 'column2']) or a config column string ('column>column2')
|
|
70
|
+
*/
|
|
71
|
+
getDerivedValue<T extends any = any>(itemEntry: ItemEntry, columnPath: string[] | string): T | undefined;
|
|
72
|
+
/**
|
|
73
|
+
* @description
|
|
74
|
+
* Clears the entry from this transaction, removing it from the {@link ItemCache ItemCache} and removing all changes
|
|
75
|
+
*/
|
|
76
|
+
clearItemEntry(entry: ItemEntry): void;
|
|
77
|
+
/**
|
|
78
|
+
* @description
|
|
79
|
+
* Recursively fetches derived values as separate requests, instead of as columns of a primary item
|
|
80
|
+
* 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
|
|
81
|
+
*/
|
|
82
|
+
fetchDerivedValuesByColumn<ItemTypeType extends ItemType>(itemEntries: Array<ItemEntry<ItemTypeType>>, rootColumn: ColumnInfo<ItemTypeType>, changesDelta?: ChangesDeltaBase): PromiseInterface<void | Array<ItemEntry<ItemTypeType>>>;
|
|
83
|
+
resolveDerivedValues<ItemTypeType extends ItemType>(itemEntries: Array<ItemEntry<ItemTypeType>>, columns: Array<ColumnInfo<ItemTypeType>>, changesDelta?: ChangesDeltaBase): PromiseInterface<Array<ItemEntry<ItemTypeType>>>;
|
|
84
|
+
/**
|
|
85
|
+
* @description
|
|
86
|
+
* Creates a new {@link ItemEntry ItemEntry} from the passed {@link ChangesDeltaItemCreateDelta ChangesDeltaItemCreateDelta} and stores it in this transaction's {@link ItemCache ItemCache}
|
|
87
|
+
*/
|
|
88
|
+
protected createItemEntry(createTuple: ChangesDeltaItemCreateDelta): ItemEntry;
|
|
89
|
+
/**
|
|
90
|
+
* @description
|
|
91
|
+
* Gets the value of the given column, will look into the current delta before attempting to read itemChanges
|
|
92
|
+
*/
|
|
93
|
+
protected getItemIdByColumn<ItemTypeType extends ItemType>(itemEntry: ItemEntry<ItemTypeType>, column: ColumnInfo<ItemTypeType>, changesDelta?: ChangesDeltaBase): ItemId;
|
|
94
|
+
protected expandColumnsWithCollectionColumns(itemType: ItemType, requestColumns?: ApiRequestColumns): ApiRequestColumns;
|
|
95
|
+
}
|
|
@@ -1,83 +1,83 @@
|
|
|
1
|
-
import { RmCore } from '../../../core';
|
|
2
|
-
import { ServerCacheDependencyInterface } from '../../../interfaces';
|
|
3
|
-
import { CollectionEntry, ItemEntry } from '../../../models';
|
|
4
|
-
import { ApiRequestColumnMap, EntryParent, EntryParentNull, FieldMap, ItemIdConversionMap, ItemType, PromiseInterface } from '../../../types';
|
|
5
|
-
import { ApiResponseProcessor } from '../../ApiResponseProcessor';
|
|
6
|
-
import { ChangesDelta } from '../../ChangesDelta';
|
|
7
|
-
import { ChangesDeltaResult } from '../../ChangesDeltaBase';
|
|
8
|
-
import { OnAfterCreateCallback } from '../../ChangesProcessor';
|
|
9
|
-
import { InternalChangesDelta } from '../../InternalChangesDelta';
|
|
10
|
-
import { AbstractCache } from '../AbstractCache';
|
|
11
|
-
import { TransactionCache } from '../transaction/TransactionCache';
|
|
12
|
-
import { ServerCollectionHandler } from './ServerCollectionHandler';
|
|
13
|
-
import { ServerItemEntryChanges, ServerItemHandler } from './ServerItemHandler';
|
|
14
|
-
/**
|
|
15
|
-
* @description
|
|
16
|
-
* The {@link ServerCache ServerCache} is responsible for keeping track of {@link ItemEntry ItemEntries} and {@link CollectionEntry CollectionEntries}
|
|
17
|
-
* which are saved on the server.
|
|
18
|
-
*
|
|
19
|
-
* It's basically a local representation of the database
|
|
20
|
-
*/
|
|
21
|
-
export declare class ServerCache extends AbstractCache {
|
|
22
|
-
protected dependencies: ServerCacheDependencyInterface;
|
|
23
|
-
readonly itemHandler: ServerItemHandler;
|
|
24
|
-
readonly collectionHandler: ServerCollectionHandler;
|
|
25
|
-
parent: null;
|
|
26
|
-
constructor(dependencies: ServerCacheDependencyInterface, core: RmCore);
|
|
27
|
-
getServerCache(): ServerCache;
|
|
28
|
-
processResponse(response: ApiResponseProcessor, requestColumnMap: ApiRequestColumnMap, isCalledAfterApiSave?: boolean, isCalledAfterSocketUpdate?: boolean, changesDelta?: ChangesDelta): PromiseInterface<ChangesDeltaResult>;
|
|
29
|
-
/**
|
|
30
|
-
* @description
|
|
31
|
-
* Applies the changes of the changesDelta created by the API call ({@link ChangesProcessor ChangesProcessor}/{@link SocketMessageHandler SocketMessageHandler}, or manually through a module function) on all caches
|
|
32
|
-
*/
|
|
33
|
-
applyChangesFromParent(internalChangesDelta: InternalChangesDelta, isCalledAfterApiSave?: boolean, isCalledAfterSocketUpdate?: boolean): void;
|
|
34
|
-
/**
|
|
35
|
-
* @description
|
|
36
|
-
* Gets the fields required to set the parent
|
|
37
|
-
*/
|
|
38
|
-
getLinkFieldsByParent<ItemTypeType extends ItemType>(parent: EntryParent, itemType: ItemTypeType): Partial<FieldMap<ItemTypeType>>;
|
|
39
|
-
/**
|
|
40
|
-
* @description
|
|
41
|
-
* Gets the entry's parent
|
|
42
|
-
*
|
|
43
|
-
* @param itemEntry The entry to get the parent from
|
|
44
|
-
* @param _fromInitial Unused parameter, there for alignment with {@link TransactionCache.getParent TransactionCache.getParent]
|
|
45
|
-
* @param _providedFields Unused parameter, there for alignment with {@link TransactionCache.getParent TransactionCache.getParent]
|
|
46
|
-
*
|
|
47
|
-
* @remark
|
|
48
|
-
* Use {@link CollectionResource.getParent CollectionResource.getParent} instead of {@link TransactionCache.getParent TransactionCache.getParent} if you're getting the parent in the onRemove callback
|
|
49
|
-
*/
|
|
50
|
-
getParent<ItemTypeType extends ItemType = any>(itemEntry: ItemEntry<ItemTypeType>, _fromInitial?: boolean, _providedFields?: FieldMap<ItemTypeType>): EntryParentNull;
|
|
51
|
-
getItemChangesRecursively(itemEntryId: ItemEntry['id'], copyFields?: boolean): FieldMap;
|
|
52
|
-
/**
|
|
53
|
-
* @description
|
|
54
|
-
* Only takes the local changes into account, used for saving
|
|
55
|
-
*/
|
|
56
|
-
getLocalItemEntryChangesTuple(itemEntryId: ItemEntry['id']): {
|
|
57
|
-
entry: ItemEntry;
|
|
58
|
-
changes: ServerItemEntryChanges;
|
|
59
|
-
};
|
|
60
|
-
getCollectionChangesRecursively(collectionEntryId: CollectionEntry['id']): ItemEntry[];
|
|
61
|
-
/**
|
|
62
|
-
* @description
|
|
63
|
-
* Invalidates the complete server cache, all items will be re-fetched whenever they are requested
|
|
64
|
-
*/
|
|
65
|
-
invalidateCache(): void;
|
|
66
|
-
/**
|
|
67
|
-
* @description
|
|
68
|
-
* Merges the passed changes from the child Transaction into this Transaction's own changes and then propagates
|
|
69
|
-
* them to all child Transactions
|
|
70
|
-
*/
|
|
71
|
-
applyChangesFromChild(transaction: TransactionCache, breakUpByParent?: boolean, onAfterCreateCallback?: OnAfterCreateCallback): PromiseInterface<ItemIdConversionMap>;
|
|
72
|
-
/**
|
|
73
|
-
* @description
|
|
74
|
-
* Applies changes to this transaction and its children
|
|
75
|
-
* Differs from {@link TransactionCache.applyChangesDelta TransactionCache.applyChangesDelta} in the handling of deleted entries and the applyChangesFromParent call
|
|
76
|
-
*/
|
|
77
|
-
applyChangesDelta(changesDelta: ChangesDelta, isCalledAfterApiSave?: boolean, isCalledAfterSocketUpdate?: boolean): PromiseInterface<ChangesDeltaResult>;
|
|
78
|
-
getLocalItemEntry(itemEntryId: ItemEntry['id']): ItemEntry | undefined;
|
|
79
|
-
getLocalItemEntryByItemId(itemType: ItemType, itemId: ItemEntry['itemId']): ItemEntry | undefined;
|
|
80
|
-
getLocalCollectionEntryByQueryString(itemType: ItemType, queryString: string): CollectionEntry | undefined;
|
|
81
|
-
getLocalCollectionEntry(collectionEntryId: CollectionEntry['id']): CollectionEntry | undefined;
|
|
82
|
-
getChangesFromItemChanges<ItemTypeType extends ItemType = any>(changesObject: ServerItemEntryChanges<ItemTypeType>): FieldMap<ItemTypeType>;
|
|
83
|
-
}
|
|
1
|
+
import { RmCore } from '../../../core';
|
|
2
|
+
import { ServerCacheDependencyInterface } from '../../../interfaces';
|
|
3
|
+
import { CollectionEntry, ItemEntry } from '../../../models';
|
|
4
|
+
import { ApiRequestColumnMap, EntryParent, EntryParentNull, FieldMap, ItemIdConversionMap, ItemType, PromiseInterface } from '../../../types';
|
|
5
|
+
import { ApiResponseProcessor } from '../../ApiResponseProcessor';
|
|
6
|
+
import { ChangesDelta } from '../../ChangesDelta';
|
|
7
|
+
import { ChangesDeltaResult } from '../../ChangesDeltaBase';
|
|
8
|
+
import { OnAfterCreateCallback } from '../../ChangesProcessor';
|
|
9
|
+
import { InternalChangesDelta } from '../../InternalChangesDelta';
|
|
10
|
+
import { AbstractCache } from '../AbstractCache';
|
|
11
|
+
import { TransactionCache } from '../transaction/TransactionCache';
|
|
12
|
+
import { ServerCollectionHandler } from './ServerCollectionHandler';
|
|
13
|
+
import { ServerItemEntryChanges, ServerItemHandler } from './ServerItemHandler';
|
|
14
|
+
/**
|
|
15
|
+
* @description
|
|
16
|
+
* The {@link ServerCache ServerCache} is responsible for keeping track of {@link ItemEntry ItemEntries} and {@link CollectionEntry CollectionEntries}
|
|
17
|
+
* which are saved on the server.
|
|
18
|
+
*
|
|
19
|
+
* It's basically a local representation of the database
|
|
20
|
+
*/
|
|
21
|
+
export declare class ServerCache extends AbstractCache {
|
|
22
|
+
protected dependencies: ServerCacheDependencyInterface;
|
|
23
|
+
readonly itemHandler: ServerItemHandler;
|
|
24
|
+
readonly collectionHandler: ServerCollectionHandler;
|
|
25
|
+
parent: null;
|
|
26
|
+
constructor(dependencies: ServerCacheDependencyInterface, core: RmCore);
|
|
27
|
+
getServerCache(): ServerCache;
|
|
28
|
+
processResponse(response: ApiResponseProcessor, requestColumnMap: ApiRequestColumnMap, isCalledAfterApiSave?: boolean, isCalledAfterSocketUpdate?: boolean, changesDelta?: ChangesDelta): PromiseInterface<ChangesDeltaResult>;
|
|
29
|
+
/**
|
|
30
|
+
* @description
|
|
31
|
+
* Applies the changes of the changesDelta created by the API call ({@link ChangesProcessor ChangesProcessor}/{@link SocketMessageHandler SocketMessageHandler}, or manually through a module function) on all caches
|
|
32
|
+
*/
|
|
33
|
+
applyChangesFromParent(internalChangesDelta: InternalChangesDelta, isCalledAfterApiSave?: boolean, isCalledAfterSocketUpdate?: boolean): void;
|
|
34
|
+
/**
|
|
35
|
+
* @description
|
|
36
|
+
* Gets the fields required to set the parent
|
|
37
|
+
*/
|
|
38
|
+
getLinkFieldsByParent<ItemTypeType extends ItemType>(parent: EntryParent, itemType: ItemTypeType): Partial<FieldMap<ItemTypeType>>;
|
|
39
|
+
/**
|
|
40
|
+
* @description
|
|
41
|
+
* Gets the entry's parent
|
|
42
|
+
*
|
|
43
|
+
* @param itemEntry The entry to get the parent from
|
|
44
|
+
* @param _fromInitial Unused parameter, there for alignment with {@link TransactionCache.getParent TransactionCache.getParent]
|
|
45
|
+
* @param _providedFields Unused parameter, there for alignment with {@link TransactionCache.getParent TransactionCache.getParent]
|
|
46
|
+
*
|
|
47
|
+
* @remark
|
|
48
|
+
* Use {@link CollectionResource.getParent CollectionResource.getParent} instead of {@link TransactionCache.getParent TransactionCache.getParent} if you're getting the parent in the onRemove callback
|
|
49
|
+
*/
|
|
50
|
+
getParent<ItemTypeType extends ItemType = any>(itemEntry: ItemEntry<ItemTypeType>, _fromInitial?: boolean, _providedFields?: FieldMap<ItemTypeType>): EntryParentNull;
|
|
51
|
+
getItemChangesRecursively(itemEntryId: ItemEntry['id'], copyFields?: boolean): FieldMap;
|
|
52
|
+
/**
|
|
53
|
+
* @description
|
|
54
|
+
* Only takes the local changes into account, used for saving
|
|
55
|
+
*/
|
|
56
|
+
getLocalItemEntryChangesTuple(itemEntryId: ItemEntry['id']): {
|
|
57
|
+
entry: ItemEntry;
|
|
58
|
+
changes: ServerItemEntryChanges;
|
|
59
|
+
};
|
|
60
|
+
getCollectionChangesRecursively(collectionEntryId: CollectionEntry['id']): ItemEntry[];
|
|
61
|
+
/**
|
|
62
|
+
* @description
|
|
63
|
+
* Invalidates the complete server cache, all items will be re-fetched whenever they are requested
|
|
64
|
+
*/
|
|
65
|
+
invalidateCache(): void;
|
|
66
|
+
/**
|
|
67
|
+
* @description
|
|
68
|
+
* Merges the passed changes from the child Transaction into this Transaction's own changes and then propagates
|
|
69
|
+
* them to all child Transactions
|
|
70
|
+
*/
|
|
71
|
+
applyChangesFromChild(transaction: TransactionCache, breakUpByParent?: boolean, onAfterCreateCallback?: OnAfterCreateCallback): PromiseInterface<ItemIdConversionMap>;
|
|
72
|
+
/**
|
|
73
|
+
* @description
|
|
74
|
+
* Applies changes to this transaction and its children
|
|
75
|
+
* Differs from {@link TransactionCache.applyChangesDelta TransactionCache.applyChangesDelta} in the handling of deleted entries and the applyChangesFromParent call
|
|
76
|
+
*/
|
|
77
|
+
applyChangesDelta(changesDelta: ChangesDelta, isCalledAfterApiSave?: boolean, isCalledAfterSocketUpdate?: boolean): PromiseInterface<ChangesDeltaResult>;
|
|
78
|
+
getLocalItemEntry(itemEntryId: ItemEntry['id']): ItemEntry | undefined;
|
|
79
|
+
getLocalItemEntryByItemId(itemType: ItemType, itemId: ItemEntry['itemId']): ItemEntry | undefined;
|
|
80
|
+
getLocalCollectionEntryByQueryString(itemType: ItemType, queryString: string): CollectionEntry | undefined;
|
|
81
|
+
getLocalCollectionEntry(collectionEntryId: CollectionEntry['id']): CollectionEntry | undefined;
|
|
82
|
+
getChangesFromItemChanges<ItemTypeType extends ItemType = any>(changesObject: ServerItemEntryChanges<ItemTypeType>): FieldMap<ItemTypeType>;
|
|
83
|
+
}
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
import { CollectionCacheFactory, CollectionMatcherFactory, ColumnExpansionFactory, ColumnSubsetCacheFactory, RequestColumnExpansionFactory } from '../../../factories';
|
|
2
|
-
import { ApiQuery, ApiRequestColumns, ApiRequestService, CollectionEntryOptions, CollectionMatcher, ColumnUtil, ItemEntryOptions, PromiseInterface } from '../../../index';
|
|
3
|
-
import { ErrorHandlerInterface, PromiseLibraryInterface } from '../../../interfaces';
|
|
4
|
-
import { CollectionEntry, ItemEntry } from '../../../models';
|
|
5
|
-
import { ApiRequestColumn, CollectionEntryParentIdMap, CollectionResourceParentIdMap, ItemId, ItemType, QueryCallback } from '../../../types';
|
|
6
|
-
import { CollectionEntryService, QueryService } from '../../index';
|
|
7
|
-
import { RequestBufferManager } from '../../RequestBufferManager';
|
|
8
|
-
import { CollectionHandlerBase } from '../CollectionHandlerBase';
|
|
9
|
-
import { ServerCache } from './ServerCache';
|
|
10
|
-
import { ServerItemHandler } from './ServerItemHandler';
|
|
11
|
-
export declare class ServerCollectionHandler extends CollectionHandlerBase {
|
|
12
|
-
private columnSubsetCacheFactory;
|
|
13
|
-
private requestBufferManager;
|
|
14
|
-
private columnExpansionFactory;
|
|
15
|
-
private apiRequestService;
|
|
16
|
-
private collectionMatcherFactory;
|
|
17
|
-
private errorHandler;
|
|
18
|
-
private itemHandler;
|
|
19
|
-
private promiseService;
|
|
20
|
-
private queryService;
|
|
21
|
-
protected transaction: ServerCache;
|
|
22
|
-
constructor(columnSubsetCacheFactory: ColumnSubsetCacheFactory, requestBufferManager: RequestBufferManager, requestColumnExpansionFactory: RequestColumnExpansionFactory, columnExpansionFactory: ColumnExpansionFactory, apiRequestService: ApiRequestService, collectionCacheFactory: CollectionCacheFactory, collectionEntryService: CollectionEntryService, collectionMatcherFactory: CollectionMatcherFactory, errorHandler: ErrorHandlerInterface, itemHandler: ServerItemHandler, promiseService: PromiseLibraryInterface, queryService: QueryService, columnUtil: ColumnUtil, transaction: ServerCache);
|
|
23
|
-
fetchItemEntriesByQuery<ItemTypeType extends ItemType>(itemType: ItemTypeType, query: ApiQuery, options: ItemEntryOptions): PromiseInterface<Array<ItemEntry<ItemTypeType>>>;
|
|
24
|
-
getCollectionMatcher(): CollectionMatcher;
|
|
25
|
-
fetchCollectionEntry<ItemTypeType extends ItemType>(itemType: ItemTypeType, options: CollectionEntryOptions): PromiseInterface<CollectionEntry<ItemTypeType>>;
|
|
26
|
-
fetchLinkedCollectionEntries<ItemTypeType extends ItemType>(parentType: ItemType, parentIdArray: ItemId[] | (() => ItemId[]), itemType: ItemTypeType, options: CollectionEntryOptions): PromiseInterface<CollectionEntryParentIdMap<ItemTypeType>>;
|
|
27
|
-
extendCollectionEntry<CollectionEntryType extends CollectionEntry>(collectionEntry: CollectionEntryType, queryCallback: QueryCallback): PromiseInterface<CollectionEntryType>;
|
|
28
|
-
expandCollectionEntries<ItemTypeType extends ItemType>(parentType: ItemType, itemType: ItemTypeType, collections: CollectionResourceParentIdMap, newRequestColumns: ApiRequestColumn[]): PromiseInterface<CollectionResourceParentIdMap>;
|
|
29
|
-
extendCollectionEntries<T extends CollectionResourceParentIdMap>(parentType: ItemType, itemType: ItemType, options: CollectionEntryOptions, queryCallback: QueryCallback, collections: T): PromiseInterface<void>;
|
|
30
|
-
addItemEntriesToCollectionChanges<CollectionEntryType extends CollectionEntry>(collectionEntry: CollectionEntryType, itemEntries: Array<ItemEntry<CollectionEntryType['itemType']>>, isCalledAfterSocketUpdate?: boolean): void;
|
|
31
|
-
/**
|
|
32
|
-
* @description
|
|
33
|
-
* Expands the columns of the items in the collection
|
|
34
|
-
*/
|
|
35
|
-
expandCollectionEntry<CollectionEntryType extends CollectionEntry>(collectionEntry: CollectionEntryType, newColumns: ApiRequestColumns): PromiseInterface<CollectionEntryType>;
|
|
36
|
-
protected handleAddedItemEntriesCallback<CollectionEntryType extends CollectionEntry>(_collectionEntry: CollectionEntryType, addedEntries: Array<ItemEntry<CollectionEntryType['itemType']>>): void;
|
|
37
|
-
protected handleRemovedItemEntriesCallback<CollectionEntryType extends CollectionEntry>(_collectionEntry: CollectionEntryType, removedItemEntries: Array<ItemEntry<CollectionEntryType['itemType']>>): void;
|
|
38
|
-
/**
|
|
39
|
-
* @description
|
|
40
|
-
* Fetches the data for the passed ItemType/options, will do nothing if the requested CollectionEntry/columns are already cached.
|
|
41
|
-
* Will create a new {@link CollectionEntry CollectionEntry} if the CollectionEntry didn't exist yet
|
|
42
|
-
*/
|
|
43
|
-
private fetchCollectionData;
|
|
44
|
-
}
|
|
1
|
+
import { CollectionCacheFactory, CollectionMatcherFactory, ColumnExpansionFactory, ColumnSubsetCacheFactory, RequestColumnExpansionFactory } from '../../../factories';
|
|
2
|
+
import { ApiQuery, ApiRequestColumns, ApiRequestService, CollectionEntryOptions, CollectionMatcher, ColumnUtil, ItemEntryOptions, PromiseInterface } from '../../../index';
|
|
3
|
+
import { ErrorHandlerInterface, PromiseLibraryInterface } from '../../../interfaces';
|
|
4
|
+
import { CollectionEntry, ItemEntry } from '../../../models';
|
|
5
|
+
import { ApiRequestColumn, CollectionEntryParentIdMap, CollectionResourceParentIdMap, ItemId, ItemType, QueryCallback } from '../../../types';
|
|
6
|
+
import { CollectionEntryService, QueryService } from '../../index';
|
|
7
|
+
import { RequestBufferManager } from '../../RequestBufferManager';
|
|
8
|
+
import { CollectionHandlerBase } from '../CollectionHandlerBase';
|
|
9
|
+
import { ServerCache } from './ServerCache';
|
|
10
|
+
import { ServerItemHandler } from './ServerItemHandler';
|
|
11
|
+
export declare class ServerCollectionHandler extends CollectionHandlerBase {
|
|
12
|
+
private columnSubsetCacheFactory;
|
|
13
|
+
private requestBufferManager;
|
|
14
|
+
private columnExpansionFactory;
|
|
15
|
+
private apiRequestService;
|
|
16
|
+
private collectionMatcherFactory;
|
|
17
|
+
private errorHandler;
|
|
18
|
+
private itemHandler;
|
|
19
|
+
private promiseService;
|
|
20
|
+
private queryService;
|
|
21
|
+
protected transaction: ServerCache;
|
|
22
|
+
constructor(columnSubsetCacheFactory: ColumnSubsetCacheFactory, requestBufferManager: RequestBufferManager, requestColumnExpansionFactory: RequestColumnExpansionFactory, columnExpansionFactory: ColumnExpansionFactory, apiRequestService: ApiRequestService, collectionCacheFactory: CollectionCacheFactory, collectionEntryService: CollectionEntryService, collectionMatcherFactory: CollectionMatcherFactory, errorHandler: ErrorHandlerInterface, itemHandler: ServerItemHandler, promiseService: PromiseLibraryInterface, queryService: QueryService, columnUtil: ColumnUtil, transaction: ServerCache);
|
|
23
|
+
fetchItemEntriesByQuery<ItemTypeType extends ItemType>(itemType: ItemTypeType, query: ApiQuery, options: ItemEntryOptions): PromiseInterface<Array<ItemEntry<ItemTypeType>>>;
|
|
24
|
+
getCollectionMatcher(): CollectionMatcher;
|
|
25
|
+
fetchCollectionEntry<ItemTypeType extends ItemType>(itemType: ItemTypeType, options: CollectionEntryOptions): PromiseInterface<CollectionEntry<ItemTypeType>>;
|
|
26
|
+
fetchLinkedCollectionEntries<ItemTypeType extends ItemType>(parentType: ItemType, parentIdArray: ItemId[] | (() => ItemId[]), itemType: ItemTypeType, options: CollectionEntryOptions): PromiseInterface<CollectionEntryParentIdMap<ItemTypeType>>;
|
|
27
|
+
extendCollectionEntry<CollectionEntryType extends CollectionEntry>(collectionEntry: CollectionEntryType, queryCallback: QueryCallback): PromiseInterface<CollectionEntryType>;
|
|
28
|
+
expandCollectionEntries<ItemTypeType extends ItemType>(parentType: ItemType, itemType: ItemTypeType, collections: CollectionResourceParentIdMap, newRequestColumns: ApiRequestColumn[]): PromiseInterface<CollectionResourceParentIdMap>;
|
|
29
|
+
extendCollectionEntries<T extends CollectionResourceParentIdMap>(parentType: ItemType, itemType: ItemType, options: CollectionEntryOptions, queryCallback: QueryCallback, collections: T): PromiseInterface<void>;
|
|
30
|
+
addItemEntriesToCollectionChanges<CollectionEntryType extends CollectionEntry>(collectionEntry: CollectionEntryType, itemEntries: Array<ItemEntry<CollectionEntryType['itemType']>>, isCalledAfterSocketUpdate?: boolean): void;
|
|
31
|
+
/**
|
|
32
|
+
* @description
|
|
33
|
+
* Expands the columns of the items in the collection
|
|
34
|
+
*/
|
|
35
|
+
expandCollectionEntry<CollectionEntryType extends CollectionEntry>(collectionEntry: CollectionEntryType, newColumns: ApiRequestColumns): PromiseInterface<CollectionEntryType>;
|
|
36
|
+
protected handleAddedItemEntriesCallback<CollectionEntryType extends CollectionEntry>(_collectionEntry: CollectionEntryType, addedEntries: Array<ItemEntry<CollectionEntryType['itemType']>>): void;
|
|
37
|
+
protected handleRemovedItemEntriesCallback<CollectionEntryType extends CollectionEntry>(_collectionEntry: CollectionEntryType, removedItemEntries: Array<ItemEntry<CollectionEntryType['itemType']>>): void;
|
|
38
|
+
/**
|
|
39
|
+
* @description
|
|
40
|
+
* Fetches the data for the passed ItemType/options, will do nothing if the requested CollectionEntry/columns are already cached.
|
|
41
|
+
* Will create a new {@link CollectionEntry CollectionEntry} if the CollectionEntry didn't exist yet
|
|
42
|
+
*/
|
|
43
|
+
private fetchCollectionData;
|
|
44
|
+
}
|
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
import { ColumnSubsetCacheFactory, ItemCacheFactory, ItemEntryFactory, QueryParserFactory, RequestColumnExpansionFactory } from '../../../factories';
|
|
2
|
-
import { ErrorHandlerInterface, PromiseLibraryInterface } from '../../../interfaces';
|
|
3
|
-
import { ItemEntry, ItemEntryOptions } from '../../../models';
|
|
4
|
-
import { ApiQuery, ApiRequestColumns, FieldMap, ItemId, ItemType, PromiseInterface } from '../../../types';
|
|
5
|
-
import { ChangesDelta } from '../../ChangesDelta';
|
|
6
|
-
import { ChangesDeltaItemUpdateDelta } from '../../ChangesDeltaBase';
|
|
7
|
-
import { ChangesDeltaItemCreateDelta } from '../../CreatedChangesDelta';
|
|
8
|
-
import { ApiFormatter, ApiResponseProcessor, ColumnExpansion, ColumnSet, ColumnUtil, QueryService, RequestBufferManager, RequestBufferResponse, TransactionItemEntryChanges } from '../../index';
|
|
9
|
-
import { ItemHandlerBase } from '../ItemHandlerBase';
|
|
10
|
-
import { ServerCache } from './ServerCache';
|
|
11
|
-
export declare type ServerItemEntryChanges<ItemTypeType extends ItemType = any> = FieldMap<ItemTypeType>;
|
|
12
|
-
export declare class ServerItemHandler extends ItemHandlerBase {
|
|
13
|
-
private requestBufferManager;
|
|
14
|
-
private queryParserFactory;
|
|
15
|
-
private queryService;
|
|
16
|
-
private columnSubsetCacheFactory;
|
|
17
|
-
protected transaction: ServerCache;
|
|
18
|
-
itemChanges: {
|
|
19
|
-
[itemEntryId: number]: ServerItemEntryChanges;
|
|
20
|
-
};
|
|
21
|
-
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);
|
|
22
|
-
createItemEntry(createTuple: ChangesDeltaItemCreateDelta): ItemEntry;
|
|
23
|
-
/**
|
|
24
|
-
* @description
|
|
25
|
-
* Processes updates on a cached entry
|
|
26
|
-
*/
|
|
27
|
-
processItemEntryChanges<ItemTypeType extends ItemType = any>(itemEntryChangesTuple: ChangesDeltaItemUpdateDelta<ItemTypeType>, _forceOverwrite?: boolean, _updateInitial?: boolean, _isCalledAfterSocketUpdate?: boolean, _createItemChangesIfNoneExist?: boolean): FieldMap<ItemTypeType> | null;
|
|
28
|
-
copyTransactionItemEntryChanges(itemEntryChanges: TransactionItemEntryChanges, entry: ItemEntry): ServerItemEntryChanges;
|
|
29
|
-
fetchItemEntry<ItemTypeType extends ItemType>(itemType: ItemTypeType, itemId: ItemId, options: ItemEntryOptions): PromiseInterface<ItemEntry<ItemTypeType>>;
|
|
30
|
-
fetchItemEntriesByQuery<ItemTypeType extends ItemType>(itemType: ItemTypeType, query: ApiQuery, entryOptions: ItemEntryOptions): PromiseInterface<Array<ItemEntry<ItemTypeType>>>;
|
|
31
|
-
fetchItemEntries<ItemTypeType extends ItemType>(itemType: ItemTypeType, itemIds: ItemId[], options: ItemEntryOptions): PromiseInterface<Array<ItemEntry<ItemTypeType>>>;
|
|
32
|
-
/**
|
|
33
|
-
* @description
|
|
34
|
-
* Fetches the data for the ItemEntries linked to the parent Items
|
|
35
|
-
*
|
|
36
|
-
* @param columns should contain a derived column that refers to the parent
|
|
37
|
-
*/
|
|
38
|
-
fetchLinkedItemEntriesData(parentType: ItemType, parentIdArray: ItemId[], itemType: ItemType, query: ApiQuery, columns: ApiRequestColumns): PromiseInterface<RequestBufferResponse>;
|
|
39
|
-
/**
|
|
40
|
-
* @description
|
|
41
|
-
* General way to process an API response.
|
|
42
|
-
* Will call {@link ChangesDelta.setItemCreated setItemCreated} if an entry doesn't exist yet, and otherwise {@link ChangesDelta.setItemUpdated setItemUpdated} if it does.
|
|
43
|
-
*/
|
|
44
|
-
processApiResponse<ItemTypeType extends ItemType>(changesDelta: ChangesDelta, response: ApiResponseProcessor, itemType: ItemTypeType, itemId: ItemId, columnSet: ColumnSet<ItemTypeType>, columnExpansion: ColumnExpansion<ItemTypeType>): void;
|
|
45
|
-
/**
|
|
46
|
-
* @description
|
|
47
|
-
* Fetches the data for the passed ItemType/ItemId/columns, will do nothing if the requested ItemEntry/columns are already cached.
|
|
48
|
-
* Will create a new {@link ItemEntry ItemEntry} if the ItemEntry didn't exist yet
|
|
49
|
-
*/
|
|
50
|
-
private fetchItemEntryData;
|
|
51
|
-
}
|
|
1
|
+
import { ColumnSubsetCacheFactory, ItemCacheFactory, ItemEntryFactory, QueryParserFactory, RequestColumnExpansionFactory } from '../../../factories';
|
|
2
|
+
import { ErrorHandlerInterface, PromiseLibraryInterface } from '../../../interfaces';
|
|
3
|
+
import { ItemEntry, ItemEntryOptions } from '../../../models';
|
|
4
|
+
import { ApiQuery, ApiRequestColumns, FieldMap, ItemId, ItemType, PromiseInterface } from '../../../types';
|
|
5
|
+
import { ChangesDelta } from '../../ChangesDelta';
|
|
6
|
+
import { ChangesDeltaItemUpdateDelta } from '../../ChangesDeltaBase';
|
|
7
|
+
import { ChangesDeltaItemCreateDelta } from '../../CreatedChangesDelta';
|
|
8
|
+
import { ApiFormatter, ApiResponseProcessor, ColumnExpansion, ColumnSet, ColumnUtil, QueryService, RequestBufferManager, RequestBufferResponse, TransactionItemEntryChanges } from '../../index';
|
|
9
|
+
import { ItemHandlerBase } from '../ItemHandlerBase';
|
|
10
|
+
import { ServerCache } from './ServerCache';
|
|
11
|
+
export declare type ServerItemEntryChanges<ItemTypeType extends ItemType = any> = FieldMap<ItemTypeType>;
|
|
12
|
+
export declare class ServerItemHandler extends ItemHandlerBase {
|
|
13
|
+
private requestBufferManager;
|
|
14
|
+
private queryParserFactory;
|
|
15
|
+
private queryService;
|
|
16
|
+
private columnSubsetCacheFactory;
|
|
17
|
+
protected transaction: ServerCache;
|
|
18
|
+
itemChanges: {
|
|
19
|
+
[itemEntryId: number]: ServerItemEntryChanges;
|
|
20
|
+
};
|
|
21
|
+
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);
|
|
22
|
+
createItemEntry(createTuple: ChangesDeltaItemCreateDelta): ItemEntry;
|
|
23
|
+
/**
|
|
24
|
+
* @description
|
|
25
|
+
* Processes updates on a cached entry
|
|
26
|
+
*/
|
|
27
|
+
processItemEntryChanges<ItemTypeType extends ItemType = any>(itemEntryChangesTuple: ChangesDeltaItemUpdateDelta<ItemTypeType>, _forceOverwrite?: boolean, _updateInitial?: boolean, _isCalledAfterSocketUpdate?: boolean, _createItemChangesIfNoneExist?: boolean): FieldMap<ItemTypeType> | null;
|
|
28
|
+
copyTransactionItemEntryChanges(itemEntryChanges: TransactionItemEntryChanges, entry: ItemEntry): ServerItemEntryChanges;
|
|
29
|
+
fetchItemEntry<ItemTypeType extends ItemType>(itemType: ItemTypeType, itemId: ItemId, options: ItemEntryOptions): PromiseInterface<ItemEntry<ItemTypeType>>;
|
|
30
|
+
fetchItemEntriesByQuery<ItemTypeType extends ItemType>(itemType: ItemTypeType, query: ApiQuery, entryOptions: ItemEntryOptions): PromiseInterface<Array<ItemEntry<ItemTypeType>>>;
|
|
31
|
+
fetchItemEntries<ItemTypeType extends ItemType>(itemType: ItemTypeType, itemIds: ItemId[], options: ItemEntryOptions): PromiseInterface<Array<ItemEntry<ItemTypeType>>>;
|
|
32
|
+
/**
|
|
33
|
+
* @description
|
|
34
|
+
* Fetches the data for the ItemEntries linked to the parent Items
|
|
35
|
+
*
|
|
36
|
+
* @param columns should contain a derived column that refers to the parent
|
|
37
|
+
*/
|
|
38
|
+
fetchLinkedItemEntriesData(parentType: ItemType, parentIdArray: ItemId[], itemType: ItemType, query: ApiQuery, columns: ApiRequestColumns): PromiseInterface<RequestBufferResponse>;
|
|
39
|
+
/**
|
|
40
|
+
* @description
|
|
41
|
+
* General way to process an API response.
|
|
42
|
+
* Will call {@link ChangesDelta.setItemCreated setItemCreated} if an entry doesn't exist yet, and otherwise {@link ChangesDelta.setItemUpdated setItemUpdated} if it does.
|
|
43
|
+
*/
|
|
44
|
+
processApiResponse<ItemTypeType extends ItemType>(changesDelta: ChangesDelta, response: ApiResponseProcessor, itemType: ItemTypeType, itemId: ItemId, columnSet: ColumnSet<ItemTypeType>, columnExpansion: ColumnExpansion<ItemTypeType>): void;
|
|
45
|
+
/**
|
|
46
|
+
* @description
|
|
47
|
+
* Fetches the data for the passed ItemType/ItemId/columns, will do nothing if the requested ItemEntry/columns are already cached.
|
|
48
|
+
* Will create a new {@link ItemEntry ItemEntry} if the ItemEntry didn't exist yet
|
|
49
|
+
*/
|
|
50
|
+
private fetchItemEntryData;
|
|
51
|
+
}
|