@rentman/rm-core 6.0.1 → 6.0.2
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 +713 -710
- package/dist/rm-core.js +9559 -9558
- 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/CollectionEntryService.d.ts +26 -26
- package/dist/types/classes/CollectionMatcherBase.d.ts +21 -21
- package/dist/types/classes/CollectionMatcherCachedCollectionProcessor.d.ts +31 -31
- package/dist/types/classes/CollectionResourceService.d.ts +7 -7
- 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 +38 -38
- package/dist/types/classes/ColumnSubsetCache.d.ts +10 -10
- 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 +17 -17
- 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/QueryLinkedToParser.d.ts +16 -16
- package/dist/types/classes/QueryLocallyMatchableParser.d.ts +19 -19
- package/dist/types/classes/QueryMatcher.d.ts +18 -18
- package/dist/types/classes/QueryParser.d.ts +24 -24
- package/dist/types/classes/QueryParserBase.d.ts +29 -29
- package/dist/types/classes/QueryParserIdUpdater.d.ts +16 -16
- package/dist/types/classes/QueryService.d.ts +18 -18
- package/dist/types/classes/RequestBuffer.d.ts +28 -28
- package/dist/types/classes/RequestBufferManager.d.ts +25 -25
- package/dist/types/classes/RequestColumnExpansion.d.ts +15 -15
- package/dist/types/classes/SocketMessageHandler.d.ts +39 -39
- 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 +102 -102
- package/dist/types/classes/cache/CachedQueryHandlerBase.d.ts +73 -73
- package/dist/types/classes/cache/CollectionMatcherCachedQueryProcessor.d.ts +35 -35
- package/dist/types/classes/cache/ItemHandlerBase.d.ts +93 -93
- package/dist/types/classes/cache/server/ServerCache.d.ts +82 -82
- package/dist/types/classes/cache/server/ServerCachedQueryHandler.d.ts +34 -34
- package/dist/types/classes/cache/server/ServerItemHandler.d.ts +52 -52
- package/dist/types/classes/cache/transaction/TransactionCache.d.ts +330 -330
- package/dist/types/classes/cache/transaction/TransactionCachedQueryHandler.d.ts +23 -23
- package/dist/types/classes/cache/transaction/TransactionCollectionHandler.d.ts +28 -28
- package/dist/types/classes/cache/transaction/TransactionEventHandler.d.ts +24 -24
- package/dist/types/classes/cache/transaction/TransactionItemHandler.d.ts +90 -90
- 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 +51 -51
- 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/CollectionEntryFactory.d.ts +14 -14
- package/dist/types/factories/CollectionMatcherFactory.d.ts +19 -19
- package/dist/types/factories/CollectionResourceFactory.d.ts +22 -22
- 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 +7 -7
- 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 -14
- 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 +21 -21
- package/dist/types/index.d.ts +7 -7
- package/dist/types/interfaces/AbstractCacheDependencyInterface.d.ts +43 -43
- 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 -11
- package/dist/types/models/CollectionEntry.d.ts +23 -23
- package/dist/types/models/CollectionOptions.d.ts +18 -18
- package/dist/types/models/CollectionResource.d.ts +72 -72
- 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 -84
- package/dist/types/models/Template.d.ts +11 -11
- package/dist/types/models/index.d.ts +7 -7
- package/dist/types/types/ItemTypesCollection.d.ts +263 -263
- 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
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import { QueryMatcherFactory } from '../../factories';
|
|
2
|
-
import { PromiseLibraryInterface } from '../../interfaces';
|
|
3
|
-
import { ItemEntry } from '../../models';
|
|
4
|
-
import { CollectionQuery, ItemType, PromiseInterface } from '../../types';
|
|
5
|
-
import { ApiRequestService } from '../ApiRequestService';
|
|
6
|
-
import { ChangesDeltaBase } from '../ChangesDeltaBase';
|
|
7
|
-
import { CollectionMatcherBase, CollectionMatcherMatches } from '../CollectionMatcherBase';
|
|
8
|
-
import { QueryService } from '../QueryService';
|
|
9
|
-
import { AbstractCache } from './AbstractCache';
|
|
10
|
-
import { CachedQueryItem } from './CachedQueryHandlerBase';
|
|
11
|
-
export declare type GroupedCollectionMatcherResult<ItemTypeType extends ItemType> = {
|
|
12
|
-
fitting: Array<ItemEntry<ItemTypeType>>;
|
|
13
|
-
notFitting: Array<ItemEntry<ItemTypeType>>;
|
|
14
|
-
maybe: Array<ItemEntry<ItemTypeType>>;
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* @description
|
|
18
|
-
* Processes all cached queries and adds/removes item entries that do/don't fit the query
|
|
19
|
-
*/
|
|
20
|
-
export declare class CollectionMatcherCachedQueryProcessor extends CollectionMatcherBase {
|
|
21
|
-
private apiRequestService;
|
|
22
|
-
private promiseService;
|
|
23
|
-
private getQueries;
|
|
24
|
-
protected map: {
|
|
25
|
-
[itemTypeAndQueryString: string]: {
|
|
26
|
-
itemType: ItemType;
|
|
27
|
-
query: CollectionQuery;
|
|
28
|
-
matches: CollectionMatcherMatches;
|
|
29
|
-
cachedQuery: CachedQueryItem;
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
constructor(apiRequestService: ApiRequestService, promiseService: PromiseLibraryInterface, queryService: QueryService, queryMatcherFactory: QueryMatcherFactory, transaction: AbstractCache, getQueries: (itemType: ItemType) => CachedQueryItem[]);
|
|
33
|
-
__removeFromAndAddToCachedQueries(_isCalledAfterSocketUpdate?: boolean, changesDelta?: ChangesDeltaBase): PromiseInterface<void[]>;
|
|
34
|
-
protected _expand<ItemTypeType extends ItemType = string>(itemEntry: ItemEntry<ItemTypeType>, matchFunction: (itemType: ItemTypeType, parsedQuery: CollectionQuery) => boolean | 'maybe'): this;
|
|
35
|
-
}
|
|
1
|
+
import { QueryMatcherFactory } from '../../factories';
|
|
2
|
+
import { PromiseLibraryInterface } from '../../interfaces';
|
|
3
|
+
import { ItemEntry } from '../../models';
|
|
4
|
+
import { CollectionQuery, ItemType, PromiseInterface } from '../../types';
|
|
5
|
+
import { ApiRequestService } from '../ApiRequestService';
|
|
6
|
+
import { ChangesDeltaBase } from '../ChangesDeltaBase';
|
|
7
|
+
import { CollectionMatcherBase, CollectionMatcherMatches } from '../CollectionMatcherBase';
|
|
8
|
+
import { QueryService } from '../QueryService';
|
|
9
|
+
import { AbstractCache } from './AbstractCache';
|
|
10
|
+
import { CachedQueryItem } from './CachedQueryHandlerBase';
|
|
11
|
+
export declare type GroupedCollectionMatcherResult<ItemTypeType extends ItemType> = {
|
|
12
|
+
fitting: Array<ItemEntry<ItemTypeType>>;
|
|
13
|
+
notFitting: Array<ItemEntry<ItemTypeType>>;
|
|
14
|
+
maybe: Array<ItemEntry<ItemTypeType>>;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* @description
|
|
18
|
+
* Processes all cached queries and adds/removes item entries that do/don't fit the query
|
|
19
|
+
*/
|
|
20
|
+
export declare class CollectionMatcherCachedQueryProcessor extends CollectionMatcherBase {
|
|
21
|
+
private apiRequestService;
|
|
22
|
+
private promiseService;
|
|
23
|
+
private getQueries;
|
|
24
|
+
protected map: {
|
|
25
|
+
[itemTypeAndQueryString: string]: {
|
|
26
|
+
itemType: ItemType;
|
|
27
|
+
query: CollectionQuery;
|
|
28
|
+
matches: CollectionMatcherMatches;
|
|
29
|
+
cachedQuery: CachedQueryItem;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
constructor(apiRequestService: ApiRequestService, promiseService: PromiseLibraryInterface, queryService: QueryService, queryMatcherFactory: QueryMatcherFactory, transaction: AbstractCache, getQueries: (itemType: ItemType) => CachedQueryItem[]);
|
|
33
|
+
__removeFromAndAddToCachedQueries(_isCalledAfterSocketUpdate?: boolean, changesDelta?: ChangesDeltaBase): PromiseInterface<void[]>;
|
|
34
|
+
protected _expand<ItemTypeType extends ItemType = string>(itemEntry: ItemEntry<ItemTypeType>, matchFunction: (itemType: ItemTypeType, parsedQuery: CollectionQuery) => boolean | 'maybe'): this;
|
|
35
|
+
}
|
|
@@ -1,93 +1,93 @@
|
|
|
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
|
-
abstract fetchItemEntriesByQuery<ItemTypeType extends ItemType>(itemType: ItemTypeType, query: ApiQuery, entryOptions: ItemEntryOptions): PromiseInterface<Array<ItemEntry<ItemTypeType>>>;
|
|
37
|
-
/**
|
|
38
|
-
* @description
|
|
39
|
-
* Fetches the ItemEntries for the given ItemIds
|
|
40
|
-
*/
|
|
41
|
-
abstract fetchItemEntries<ItemTypeType extends ItemType>(itemType: ItemTypeType, itemIds: ItemId[], options: ItemEntryOptions): PromiseInterface<Array<ItemEntry<ItemTypeType>>>;
|
|
42
|
-
/**
|
|
43
|
-
* @description
|
|
44
|
-
* Fetches an ItemEntry with the given itemId
|
|
45
|
-
*/
|
|
46
|
-
abstract fetchItemEntry<ItemTypeType extends ItemType>(itemType: ItemTypeType, itemId: ItemId, options: ItemEntryOptions): PromiseInterface<ItemEntry<ItemTypeType>>;
|
|
47
|
-
/**
|
|
48
|
-
* @description
|
|
49
|
-
* 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
|
|
50
|
-
*/
|
|
51
|
-
abstract processItemEntryChanges<ItemTypeType extends ItemType>(itemEntryChangesTuple: ChangesDeltaItemUpdateDelta<ItemTypeType>, forceOverwrite: boolean, updateInitial: boolean, isCalledAfterSocketUpdate: boolean, createItemChangesIfNoneExist: boolean): FieldMap<ItemTypeType> | null;
|
|
52
|
-
/**
|
|
53
|
-
* @description
|
|
54
|
-
* Traverses the column path and returns the fields of the derived item, returns undefined if the item isn't found
|
|
55
|
-
*
|
|
56
|
-
* ---------------------
|
|
57
|
-
*
|
|
58
|
-
* @remark
|
|
59
|
-
* Assumes the derived item's values are already cached
|
|
60
|
-
*/
|
|
61
|
-
getDerivedValues(itemEntry: ItemEntry, columnPath: string[]): Readonly<FieldMap> | undefined;
|
|
62
|
-
/**
|
|
63
|
-
* @description
|
|
64
|
-
* Returns the value of the columnPath, or undefined when the path couldn't be traversed
|
|
65
|
-
*
|
|
66
|
-
* @param itemEntry The root entry to start the path from
|
|
67
|
-
* @param columnPath Can either be an array of columnIds (['column', 'column2']) or a config column string ('column>column2')
|
|
68
|
-
*/
|
|
69
|
-
getDerivedValue<T extends any = any>(itemEntry: ItemEntry, columnPath: string[] | string): T | undefined;
|
|
70
|
-
/**
|
|
71
|
-
* @description
|
|
72
|
-
* Clears the entry from this transaction, removing it from the {@link ItemCache ItemCache} and removing all changes
|
|
73
|
-
*/
|
|
74
|
-
clearItemEntry(entry: ItemEntry): void;
|
|
75
|
-
/**
|
|
76
|
-
* @description
|
|
77
|
-
* Recursively fetches derived values as separate requests, instead of as columns of a primary item
|
|
78
|
-
* 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
|
|
79
|
-
*/
|
|
80
|
-
fetchDerivedValuesByColumn<ItemTypeType extends ItemType>(itemEntries: Array<ItemEntry<ItemTypeType>>, rootColumn: ColumnInfo<ItemTypeType>, changesDelta?: ChangesDeltaBase): PromiseInterface<void | Array<ItemEntry<ItemTypeType>>>;
|
|
81
|
-
resolveDerivedValues<ItemTypeType extends ItemType>(itemEntries: Array<ItemEntry<ItemTypeType>>, columns: Array<ColumnInfo<ItemTypeType>>, changesDelta?: ChangesDeltaBase): PromiseInterface<Array<ItemEntry<ItemTypeType>>>;
|
|
82
|
-
/**
|
|
83
|
-
* @description
|
|
84
|
-
* Creates a new {@link ItemEntry ItemEntry} from the passed {@link ChangesDeltaItemCreateDelta ChangesDeltaItemCreateDelta} and stores it in this transaction's {@link ItemCache ItemCache}
|
|
85
|
-
*/
|
|
86
|
-
createItemEntry(createTuple: ChangesDeltaItemCreateDelta): ItemEntry;
|
|
87
|
-
/**
|
|
88
|
-
* @description
|
|
89
|
-
* Gets the value of the given column, will look into the current delta before attempting to read itemChanges
|
|
90
|
-
*/
|
|
91
|
-
protected getItemIdByColumn<ItemTypeType extends ItemType>(itemEntry: ItemEntry<ItemTypeType>, column: ColumnInfo<ItemTypeType>, changesDelta?: ChangesDeltaBase): ItemId;
|
|
92
|
-
protected expandColumnsWithCachedQueryColumns(itemType: ItemType, requestColumns?: ApiRequestColumns): ApiRequestColumns;
|
|
93
|
-
}
|
|
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
|
+
abstract fetchItemEntriesByQuery<ItemTypeType extends ItemType>(itemType: ItemTypeType, query: ApiQuery, entryOptions: ItemEntryOptions): PromiseInterface<Array<ItemEntry<ItemTypeType>>>;
|
|
37
|
+
/**
|
|
38
|
+
* @description
|
|
39
|
+
* Fetches the ItemEntries for the given ItemIds
|
|
40
|
+
*/
|
|
41
|
+
abstract fetchItemEntries<ItemTypeType extends ItemType>(itemType: ItemTypeType, itemIds: ItemId[], options: ItemEntryOptions): PromiseInterface<Array<ItemEntry<ItemTypeType>>>;
|
|
42
|
+
/**
|
|
43
|
+
* @description
|
|
44
|
+
* Fetches an ItemEntry with the given itemId
|
|
45
|
+
*/
|
|
46
|
+
abstract fetchItemEntry<ItemTypeType extends ItemType>(itemType: ItemTypeType, itemId: ItemId, options: ItemEntryOptions): PromiseInterface<ItemEntry<ItemTypeType>>;
|
|
47
|
+
/**
|
|
48
|
+
* @description
|
|
49
|
+
* 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
|
|
50
|
+
*/
|
|
51
|
+
abstract processItemEntryChanges<ItemTypeType extends ItemType>(itemEntryChangesTuple: ChangesDeltaItemUpdateDelta<ItemTypeType>, forceOverwrite: boolean, updateInitial: boolean, isCalledAfterSocketUpdate: boolean, createItemChangesIfNoneExist: boolean): FieldMap<ItemTypeType> | null;
|
|
52
|
+
/**
|
|
53
|
+
* @description
|
|
54
|
+
* Traverses the column path and returns the fields of the derived item, returns undefined if the item isn't found
|
|
55
|
+
*
|
|
56
|
+
* ---------------------
|
|
57
|
+
*
|
|
58
|
+
* @remark
|
|
59
|
+
* Assumes the derived item's values are already cached
|
|
60
|
+
*/
|
|
61
|
+
getDerivedValues(itemEntry: ItemEntry, columnPath: string[]): Readonly<FieldMap> | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* @description
|
|
64
|
+
* Returns the value of the columnPath, or undefined when the path couldn't be traversed
|
|
65
|
+
*
|
|
66
|
+
* @param itemEntry The root entry to start the path from
|
|
67
|
+
* @param columnPath Can either be an array of columnIds (['column', 'column2']) or a config column string ('column>column2')
|
|
68
|
+
*/
|
|
69
|
+
getDerivedValue<T extends any = any>(itemEntry: ItemEntry, columnPath: string[] | string): T | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* @description
|
|
72
|
+
* Clears the entry from this transaction, removing it from the {@link ItemCache ItemCache} and removing all changes
|
|
73
|
+
*/
|
|
74
|
+
clearItemEntry(entry: ItemEntry): void;
|
|
75
|
+
/**
|
|
76
|
+
* @description
|
|
77
|
+
* Recursively fetches derived values as separate requests, instead of as columns of a primary item
|
|
78
|
+
* 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
|
|
79
|
+
*/
|
|
80
|
+
fetchDerivedValuesByColumn<ItemTypeType extends ItemType>(itemEntries: Array<ItemEntry<ItemTypeType>>, rootColumn: ColumnInfo<ItemTypeType>, changesDelta?: ChangesDeltaBase): PromiseInterface<void | Array<ItemEntry<ItemTypeType>>>;
|
|
81
|
+
resolveDerivedValues<ItemTypeType extends ItemType>(itemEntries: Array<ItemEntry<ItemTypeType>>, columns: Array<ColumnInfo<ItemTypeType>>, changesDelta?: ChangesDeltaBase): PromiseInterface<Array<ItemEntry<ItemTypeType>>>;
|
|
82
|
+
/**
|
|
83
|
+
* @description
|
|
84
|
+
* Creates a new {@link ItemEntry ItemEntry} from the passed {@link ChangesDeltaItemCreateDelta ChangesDeltaItemCreateDelta} and stores it in this transaction's {@link ItemCache ItemCache}
|
|
85
|
+
*/
|
|
86
|
+
createItemEntry(createTuple: ChangesDeltaItemCreateDelta): ItemEntry;
|
|
87
|
+
/**
|
|
88
|
+
* @description
|
|
89
|
+
* Gets the value of the given column, will look into the current delta before attempting to read itemChanges
|
|
90
|
+
*/
|
|
91
|
+
protected getItemIdByColumn<ItemTypeType extends ItemType>(itemEntry: ItemEntry<ItemTypeType>, column: ColumnInfo<ItemTypeType>, changesDelta?: ChangesDeltaBase): ItemId;
|
|
92
|
+
protected expandColumnsWithCachedQueryColumns(itemType: ItemType, requestColumns?: ApiRequestColumns): ApiRequestColumns;
|
|
93
|
+
}
|
|
@@ -1,82 +1,82 @@
|
|
|
1
|
-
import { ChangesDelta, InternalChangesDelta, TransactionCache, TransactionValidatorFactory } from '../..';
|
|
2
|
-
import { RmCore } from '../../../core';
|
|
3
|
-
import { ServerCacheDependencyInterface } from '../../../interfaces/ServerCacheDependencyInterface';
|
|
4
|
-
import { ItemEntry } from '../../../models';
|
|
5
|
-
import { ApiRequestColumn, ApiRequestColumnMap, CollectionQuery, CollectionResourceParentIdMap, EntryParent, EntryParentNull, FieldMap, ItemIdConversionMap, ItemType, PromiseInterface } from '../../../types';
|
|
6
|
-
import { ApiResponseProcessor } from '../../ApiResponseProcessor';
|
|
7
|
-
import { ChangesDeltaResult } from '../../ChangesDeltaBase';
|
|
8
|
-
import { OnAfterCreateCallback } from '../../ChangesProcessor';
|
|
9
|
-
import { AbstractCache } from '../AbstractCache';
|
|
10
|
-
import { CachedQueryItem } from '../CachedQueryHandlerBase';
|
|
11
|
-
import { ServerCachedQueryHandler } from './ServerCachedQueryHandler';
|
|
12
|
-
import { ServerItemEntryChanges, ServerItemHandler } from './ServerItemHandler';
|
|
13
|
-
/**
|
|
14
|
-
* @description
|
|
15
|
-
* The {@link ServerCache ServerCache} is responsible for keeping track of {@link ItemEntry ItemEntries} and {@link CollectionEntry CollectionEntries}
|
|
16
|
-
* which are saved on the server.
|
|
17
|
-
*
|
|
18
|
-
* It's basically a local representation of the database
|
|
19
|
-
*/
|
|
20
|
-
export declare class ServerCache extends AbstractCache {
|
|
21
|
-
dependencies: ServerCacheDependencyInterface;
|
|
22
|
-
readonly itemHandler: ServerItemHandler;
|
|
23
|
-
readonly cachedQueryHandler: ServerCachedQueryHandler;
|
|
24
|
-
parent: null;
|
|
25
|
-
constructor(dependencies: ServerCacheDependencyInterface, core: RmCore);
|
|
26
|
-
getServerCache(): ServerCache;
|
|
27
|
-
createChild(id?: string, validatorFactory?: TransactionValidatorFactory): TransactionCache;
|
|
28
|
-
expandCollectionResources<ItemTypeType extends ItemType>(itemType: ItemTypeType, collections: CollectionResourceParentIdMap<ItemTypeType>, newRequestColumns: ApiRequestColumn[]): PromiseInterface<CollectionResourceParentIdMap>;
|
|
29
|
-
processResponse(response: ApiResponseProcessor, requestColumnMap: ApiRequestColumnMap, isCalledAfterApiSave?: boolean, isCalledAfterSocketUpdate?: boolean, changesDelta?: ChangesDelta): PromiseInterface<ChangesDeltaResult>;
|
|
30
|
-
/**
|
|
31
|
-
* @description
|
|
32
|
-
* 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
|
|
33
|
-
*/
|
|
34
|
-
applyChangesFromParent(internalChangesDelta: InternalChangesDelta, isCalledAfterApiSave?: boolean, isCalledAfterSocketUpdate?: boolean): PromiseInterface<void>;
|
|
35
|
-
/**
|
|
36
|
-
* @description
|
|
37
|
-
* Gets the fields required to set the parent
|
|
38
|
-
*/
|
|
39
|
-
getLinkFieldsByParent<ItemTypeType extends ItemType>(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 ItemType = 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 ItemType>(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
|
-
* Differs from {@link TransactionCache.applyChangesDelta TransactionCache.applyChangesDelta} in the handling of deleted entries and the applyChangesFromParent call
|
|
77
|
-
*/
|
|
78
|
-
applyChangesDelta(changesDelta: ChangesDelta, isCalledAfterApiSave?: boolean, isCalledAfterSocketUpdate?: boolean): PromiseInterface<ChangesDeltaResult>;
|
|
79
|
-
getLocalItemEntry(itemEntryId: ItemEntry['id']): ItemEntry | undefined;
|
|
80
|
-
getLocalItemEntryByItemId(itemType: ItemType, itemId: ItemEntry['itemId']): ItemEntry | undefined;
|
|
81
|
-
getChangesFromItemChanges<ItemTypeType extends ItemType = any>(changesObject: ServerItemEntryChanges<ItemTypeType>): FieldMap<ItemTypeType>;
|
|
82
|
-
}
|
|
1
|
+
import { ChangesDelta, InternalChangesDelta, TransactionCache, TransactionValidatorFactory } from '../..';
|
|
2
|
+
import { RmCore } from '../../../core';
|
|
3
|
+
import { ServerCacheDependencyInterface } from '../../../interfaces/ServerCacheDependencyInterface';
|
|
4
|
+
import { ItemEntry } from '../../../models';
|
|
5
|
+
import { ApiRequestColumn, ApiRequestColumnMap, CollectionQuery, CollectionResourceParentIdMap, EntryParent, EntryParentNull, FieldMap, ItemIdConversionMap, ItemType, PromiseInterface } from '../../../types';
|
|
6
|
+
import { ApiResponseProcessor } from '../../ApiResponseProcessor';
|
|
7
|
+
import { ChangesDeltaResult } from '../../ChangesDeltaBase';
|
|
8
|
+
import { OnAfterCreateCallback } from '../../ChangesProcessor';
|
|
9
|
+
import { AbstractCache } from '../AbstractCache';
|
|
10
|
+
import { CachedQueryItem } from '../CachedQueryHandlerBase';
|
|
11
|
+
import { ServerCachedQueryHandler } from './ServerCachedQueryHandler';
|
|
12
|
+
import { ServerItemEntryChanges, ServerItemHandler } from './ServerItemHandler';
|
|
13
|
+
/**
|
|
14
|
+
* @description
|
|
15
|
+
* The {@link ServerCache ServerCache} is responsible for keeping track of {@link ItemEntry ItemEntries} and {@link CollectionEntry CollectionEntries}
|
|
16
|
+
* which are saved on the server.
|
|
17
|
+
*
|
|
18
|
+
* It's basically a local representation of the database
|
|
19
|
+
*/
|
|
20
|
+
export declare class ServerCache extends AbstractCache {
|
|
21
|
+
dependencies: ServerCacheDependencyInterface;
|
|
22
|
+
readonly itemHandler: ServerItemHandler;
|
|
23
|
+
readonly cachedQueryHandler: ServerCachedQueryHandler;
|
|
24
|
+
parent: null;
|
|
25
|
+
constructor(dependencies: ServerCacheDependencyInterface, core: RmCore);
|
|
26
|
+
getServerCache(): ServerCache;
|
|
27
|
+
createChild(id?: string, validatorFactory?: TransactionValidatorFactory): TransactionCache;
|
|
28
|
+
expandCollectionResources<ItemTypeType extends ItemType>(itemType: ItemTypeType, collections: CollectionResourceParentIdMap<ItemTypeType>, newRequestColumns: ApiRequestColumn[]): PromiseInterface<CollectionResourceParentIdMap>;
|
|
29
|
+
processResponse(response: ApiResponseProcessor, requestColumnMap: ApiRequestColumnMap, isCalledAfterApiSave?: boolean, isCalledAfterSocketUpdate?: boolean, changesDelta?: ChangesDelta): PromiseInterface<ChangesDeltaResult>;
|
|
30
|
+
/**
|
|
31
|
+
* @description
|
|
32
|
+
* 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
|
|
33
|
+
*/
|
|
34
|
+
applyChangesFromParent(internalChangesDelta: InternalChangesDelta, isCalledAfterApiSave?: boolean, isCalledAfterSocketUpdate?: boolean): PromiseInterface<void>;
|
|
35
|
+
/**
|
|
36
|
+
* @description
|
|
37
|
+
* Gets the fields required to set the parent
|
|
38
|
+
*/
|
|
39
|
+
getLinkFieldsByParent<ItemTypeType extends ItemType>(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 ItemType = 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 ItemType>(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
|
+
* Differs from {@link TransactionCache.applyChangesDelta TransactionCache.applyChangesDelta} in the handling of deleted entries and the applyChangesFromParent call
|
|
77
|
+
*/
|
|
78
|
+
applyChangesDelta(changesDelta: ChangesDelta, isCalledAfterApiSave?: boolean, isCalledAfterSocketUpdate?: boolean): PromiseInterface<ChangesDeltaResult>;
|
|
79
|
+
getLocalItemEntry(itemEntryId: ItemEntry['id']): ItemEntry | undefined;
|
|
80
|
+
getLocalItemEntryByItemId(itemType: ItemType, itemId: ItemEntry['itemId']): ItemEntry | undefined;
|
|
81
|
+
getChangesFromItemChanges<ItemTypeType extends ItemType = any>(changesObject: ServerItemEntryChanges<ItemTypeType>): FieldMap<ItemTypeType>;
|
|
82
|
+
}
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import { ColumnSubsetCacheFactory, RequestColumnExpansionFactory } from '../../../factories';
|
|
2
|
-
import { ApiRequestColumns, ApiRequestService, CollectionQuery, ColumnSubsetCache, ColumnUtil, ParentIdMap, PromiseInterface } from '../../../index';
|
|
3
|
-
import { ErrorHandlerInterface, PromiseLibraryInterface } from '../../../interfaces';
|
|
4
|
-
import { ItemEntry } from '../../../models';
|
|
5
|
-
import { CollectionOptions } from '../../../models/CollectionOptions';
|
|
6
|
-
import { ItemId, ItemType } from '../../../types';
|
|
7
|
-
import { CollectionEntryService } from '../../index';
|
|
8
|
-
import { RequestBufferManager } from '../../RequestBufferManager';
|
|
9
|
-
import { CachedQueryHandlerBase, CachedQueryItem } from '../CachedQueryHandlerBase';
|
|
10
|
-
import { ServerCache } from './ServerCache';
|
|
11
|
-
import { ServerItemHandler } from './ServerItemHandler';
|
|
12
|
-
export declare class ServerCachedQueryHandler extends CachedQueryHandlerBase {
|
|
13
|
-
private columnSubsetCacheFactory;
|
|
14
|
-
private requestBufferManager;
|
|
15
|
-
private apiRequestService;
|
|
16
|
-
private errorHandler;
|
|
17
|
-
private itemHandler;
|
|
18
|
-
protected transaction: ServerCache;
|
|
19
|
-
constructor(columnSubsetCacheFactory: ColumnSubsetCacheFactory, requestBufferManager: RequestBufferManager, requestColumnExpansionFactory: RequestColumnExpansionFactory, apiRequestService: ApiRequestService, collectionEntryService: CollectionEntryService, errorHandler: ErrorHandlerInterface, itemHandler: ServerItemHandler, promiseService: PromiseLibraryInterface, columnUtil: ColumnUtil, transaction: ServerCache);
|
|
20
|
-
__fetchCachedQueryItem<ItemTypeType extends ItemType>(itemType: ItemTypeType, options: CollectionOptions): PromiseInterface<CachedQueryItem<ItemTypeType>>;
|
|
21
|
-
__fetchLinkedCachedQueryItems<ItemTypeType extends ItemType>(parentType: ItemType, parentIdArray: ItemId[] | (() => ItemId[]), itemType: ItemTypeType, options: CollectionOptions): PromiseInterface<ParentIdMap<CachedQueryItem<ItemTypeType>>>;
|
|
22
|
-
__addItemEntriesToCachedQueries<ItemTypeType extends ItemType>(itemType: ItemTypeType, parsedQuery: CollectionQuery, itemEntries: Array<ItemEntry<ItemTypeType>>): void;
|
|
23
|
-
/**
|
|
24
|
-
* @description
|
|
25
|
-
* Expands the columns of the items in the cached query
|
|
26
|
-
*/
|
|
27
|
-
__expandCachedQuery<ItemTypeType extends ItemType = any>(cachedQuery: CachedQueryItem<ItemTypeType>, newColumns: ApiRequestColumns): PromiseInterface<CachedQueryItem<ItemTypeType>>;
|
|
28
|
-
/**
|
|
29
|
-
* @description
|
|
30
|
-
* Fetches the data for the passed ItemType/options, will do nothing if the requested CollectionEntry/columns are already cached.
|
|
31
|
-
* Will create a new {@link CollectionEntry CollectionEntry} if the CollectionEntry didn't exist yet
|
|
32
|
-
*/
|
|
33
|
-
__fetchItemEntriesByQueryData<ItemTypeType extends ItemType>(itemType: ItemTypeType, options: CollectionOptions<ItemTypeType>, columnSubsetCache: ColumnSubsetCache<ItemTypeType>, collectionQuery: CollectionQuery): PromiseInterface<CachedQueryItem<ItemTypeType>>;
|
|
34
|
-
}
|
|
1
|
+
import { ColumnSubsetCacheFactory, RequestColumnExpansionFactory } from '../../../factories';
|
|
2
|
+
import { ApiRequestColumns, ApiRequestService, CollectionQuery, ColumnSubsetCache, ColumnUtil, ParentIdMap, PromiseInterface } from '../../../index';
|
|
3
|
+
import { ErrorHandlerInterface, PromiseLibraryInterface } from '../../../interfaces';
|
|
4
|
+
import { ItemEntry } from '../../../models';
|
|
5
|
+
import { CollectionOptions } from '../../../models/CollectionOptions';
|
|
6
|
+
import { ItemId, ItemType } from '../../../types';
|
|
7
|
+
import { CollectionEntryService } from '../../index';
|
|
8
|
+
import { RequestBufferManager } from '../../RequestBufferManager';
|
|
9
|
+
import { CachedQueryHandlerBase, CachedQueryItem } from '../CachedQueryHandlerBase';
|
|
10
|
+
import { ServerCache } from './ServerCache';
|
|
11
|
+
import { ServerItemHandler } from './ServerItemHandler';
|
|
12
|
+
export declare class ServerCachedQueryHandler extends CachedQueryHandlerBase {
|
|
13
|
+
private columnSubsetCacheFactory;
|
|
14
|
+
private requestBufferManager;
|
|
15
|
+
private apiRequestService;
|
|
16
|
+
private errorHandler;
|
|
17
|
+
private itemHandler;
|
|
18
|
+
protected transaction: ServerCache;
|
|
19
|
+
constructor(columnSubsetCacheFactory: ColumnSubsetCacheFactory, requestBufferManager: RequestBufferManager, requestColumnExpansionFactory: RequestColumnExpansionFactory, apiRequestService: ApiRequestService, collectionEntryService: CollectionEntryService, errorHandler: ErrorHandlerInterface, itemHandler: ServerItemHandler, promiseService: PromiseLibraryInterface, columnUtil: ColumnUtil, transaction: ServerCache);
|
|
20
|
+
__fetchCachedQueryItem<ItemTypeType extends ItemType>(itemType: ItemTypeType, options: CollectionOptions): PromiseInterface<CachedQueryItem<ItemTypeType>>;
|
|
21
|
+
__fetchLinkedCachedQueryItems<ItemTypeType extends ItemType>(parentType: ItemType, parentIdArray: ItemId[] | (() => ItemId[]), itemType: ItemTypeType, options: CollectionOptions): PromiseInterface<ParentIdMap<CachedQueryItem<ItemTypeType>>>;
|
|
22
|
+
__addItemEntriesToCachedQueries<ItemTypeType extends ItemType>(itemType: ItemTypeType, parsedQuery: CollectionQuery, itemEntries: Array<ItemEntry<ItemTypeType>>): void;
|
|
23
|
+
/**
|
|
24
|
+
* @description
|
|
25
|
+
* Expands the columns of the items in the cached query
|
|
26
|
+
*/
|
|
27
|
+
__expandCachedQuery<ItemTypeType extends ItemType = any>(cachedQuery: CachedQueryItem<ItemTypeType>, newColumns: ApiRequestColumns): PromiseInterface<CachedQueryItem<ItemTypeType>>;
|
|
28
|
+
/**
|
|
29
|
+
* @description
|
|
30
|
+
* Fetches the data for the passed ItemType/options, will do nothing if the requested CollectionEntry/columns are already cached.
|
|
31
|
+
* Will create a new {@link CollectionEntry CollectionEntry} if the CollectionEntry didn't exist yet
|
|
32
|
+
*/
|
|
33
|
+
__fetchItemEntriesByQueryData<ItemTypeType extends ItemType>(itemType: ItemTypeType, options: CollectionOptions<ItemTypeType>, columnSubsetCache: ColumnSubsetCache<ItemTypeType>, collectionQuery: CollectionQuery): PromiseInterface<CachedQueryItem<ItemTypeType>>;
|
|
34
|
+
}
|
|
@@ -1,52 +1,52 @@
|
|
|
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
|
-
extendItemEntries<ItemTypeType extends ItemType>(itemType: ItemTypeType, itemEntries: Array<ItemEntry<ItemTypeType>>, newColumns: ApiRequestColumns): PromiseInterface<Array<ItemEntry<ItemTypeType>>>;
|
|
32
|
-
fetchItemEntries<ItemTypeType extends ItemType>(itemType: ItemTypeType, itemIds: ItemId[], options: ItemEntryOptions): PromiseInterface<Array<ItemEntry<ItemTypeType>>>;
|
|
33
|
-
/**
|
|
34
|
-
* @description
|
|
35
|
-
* Fetches the data for the ItemEntries linked to the parent Items
|
|
36
|
-
*
|
|
37
|
-
* @param columns should contain a derived column that refers to the parent
|
|
38
|
-
*/
|
|
39
|
-
fetchLinkedItemEntriesData(parentType: ItemType, parentIdArray: ItemId[], itemType: ItemType, query: ApiQuery | null, columns: ApiRequestColumns): PromiseInterface<RequestBufferResponse>;
|
|
40
|
-
/**
|
|
41
|
-
* @description
|
|
42
|
-
* General way to process an API response.
|
|
43
|
-
* Will call {@link ChangesDelta.setItemCreated setItemCreated} if an entry doesn't exist yet, and otherwise {@link ChangesDelta.setItemUpdated setItemUpdated} if it does.
|
|
44
|
-
*/
|
|
45
|
-
processApiResponse<ItemTypeType extends ItemType>(changesDelta: ChangesDelta, response: ApiResponseProcessor, itemType: ItemTypeType, itemId: ItemId, columnSet: ColumnSet<ItemTypeType>, columnExpansion: ColumnExpansion<ItemTypeType>): void;
|
|
46
|
-
/**
|
|
47
|
-
* @description
|
|
48
|
-
* Fetches the data for the passed ItemType/ItemId/columns, will do nothing if the requested ItemEntry/columns are already cached.
|
|
49
|
-
* Will create a new {@link ItemEntry ItemEntry} if the ItemEntry didn't exist yet
|
|
50
|
-
*/
|
|
51
|
-
private fetchItemEntryData;
|
|
52
|
-
}
|
|
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
|
+
extendItemEntries<ItemTypeType extends ItemType>(itemType: ItemTypeType, itemEntries: Array<ItemEntry<ItemTypeType>>, newColumns: ApiRequestColumns): PromiseInterface<Array<ItemEntry<ItemTypeType>>>;
|
|
32
|
+
fetchItemEntries<ItemTypeType extends ItemType>(itemType: ItemTypeType, itemIds: ItemId[], options: ItemEntryOptions): PromiseInterface<Array<ItemEntry<ItemTypeType>>>;
|
|
33
|
+
/**
|
|
34
|
+
* @description
|
|
35
|
+
* Fetches the data for the ItemEntries linked to the parent Items
|
|
36
|
+
*
|
|
37
|
+
* @param columns should contain a derived column that refers to the parent
|
|
38
|
+
*/
|
|
39
|
+
fetchLinkedItemEntriesData(parentType: ItemType, parentIdArray: ItemId[], itemType: ItemType, query: ApiQuery | null, columns: ApiRequestColumns): PromiseInterface<RequestBufferResponse>;
|
|
40
|
+
/**
|
|
41
|
+
* @description
|
|
42
|
+
* General way to process an API response.
|
|
43
|
+
* Will call {@link ChangesDelta.setItemCreated setItemCreated} if an entry doesn't exist yet, and otherwise {@link ChangesDelta.setItemUpdated setItemUpdated} if it does.
|
|
44
|
+
*/
|
|
45
|
+
processApiResponse<ItemTypeType extends ItemType>(changesDelta: ChangesDelta, response: ApiResponseProcessor, itemType: ItemTypeType, itemId: ItemId, columnSet: ColumnSet<ItemTypeType>, columnExpansion: ColumnExpansion<ItemTypeType>): void;
|
|
46
|
+
/**
|
|
47
|
+
* @description
|
|
48
|
+
* Fetches the data for the passed ItemType/ItemId/columns, will do nothing if the requested ItemEntry/columns are already cached.
|
|
49
|
+
* Will create a new {@link ItemEntry ItemEntry} if the ItemEntry didn't exist yet
|
|
50
|
+
*/
|
|
51
|
+
private fetchItemEntryData;
|
|
52
|
+
}
|