@rentman/rm-core 8.2.0 → 8.2.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 +934 -931
- package/dist/rm-core.js +677 -680
- package/dist/rm-core.min.js +1 -1
- package/dist/types/classes/ApiFormatter.d.ts +73 -73
- package/dist/types/classes/ApiRequestService.d.ts +18 -18
- package/dist/types/classes/ApiResponseProcessor.d.ts +29 -29
- package/dist/types/classes/CacheSyncer.d.ts +36 -36
- package/dist/types/classes/ChangesCompilation.d.ts +33 -33
- package/dist/types/classes/ChangesDelta.d.ts +61 -61
- package/dist/types/classes/ChangesDeltaBase.d.ts +76 -76
- package/dist/types/classes/ChangesProcessor.d.ts +40 -40
- package/dist/types/classes/CollectionEntryService.d.ts +23 -23
- package/dist/types/classes/CollectionResourceService.d.ts +6 -6
- package/dist/types/classes/ColumnCache.d.ts +21 -21
- package/dist/types/classes/ColumnExpansion.d.ts +21 -21
- package/dist/types/classes/ColumnHandler.d.ts +20 -20
- package/dist/types/classes/ColumnInfo.d.ts +14 -14
- package/dist/types/classes/ColumnSet.d.ts +37 -37
- package/dist/types/classes/ColumnSubsetCache.d.ts +14 -14
- package/dist/types/classes/ColumnUtil.d.ts +100 -100
- package/dist/types/classes/ConversionMapService.d.ts +25 -25
- package/dist/types/classes/CreateRequest.d.ts +17 -17
- package/dist/types/classes/CreatedChangesDelta.d.ts +17 -17
- package/dist/types/classes/InternalChangesDelta.d.ts +47 -47
- package/dist/types/classes/ItemCache.d.ts +27 -27
- package/dist/types/classes/ItemCreateService.d.ts +18 -18
- package/dist/types/classes/ItemEntryService.d.ts +32 -32
- package/dist/types/classes/KeyService.d.ts +18 -18
- package/dist/types/classes/LockService.d.ts +29 -29
- package/dist/types/classes/ModuleChangesCompilation.d.ts +18 -18
- package/dist/types/classes/ParentChangesDelta.d.ts +39 -39
- package/dist/types/classes/QueryColumnExtractor.d.ts +18 -18
- package/dist/types/classes/QueryContainsLocalIdParser.d.ts +15 -15
- package/dist/types/classes/QueryLinkedToParser.d.ts +15 -15
- package/dist/types/classes/QueryLocallyMatchableParser.d.ts +18 -18
- package/dist/types/classes/QueryMatcher.d.ts +18 -18
- package/dist/types/classes/QueryParser.d.ts +25 -25
- package/dist/types/classes/QueryParserBase.d.ts +20 -20
- package/dist/types/classes/QueryParserIdUpdater.d.ts +15 -15
- package/dist/types/classes/QueryService.d.ts +12 -12
- package/dist/types/classes/RequestBuffer.d.ts +24 -24
- package/dist/types/classes/RequestBufferManager.d.ts +20 -20
- package/dist/types/classes/RequestColumnExpansion.d.ts +15 -15
- package/dist/types/classes/SocketMessageHandler.d.ts +34 -34
- package/dist/types/classes/TemplateCache.d.ts +62 -63
- package/dist/types/classes/Util.d.ts +28 -28
- package/dist/types/classes/cache/AbstractCache.d.ts +95 -95
- package/dist/types/classes/cache/CachedQueryHandlerBase.d.ts +68 -68
- package/dist/types/classes/cache/ItemHandlerBase.d.ts +95 -95
- package/dist/types/classes/cache/server/ServerCache.d.ts +82 -82
- package/dist/types/classes/cache/server/ServerCachedQueryHandler.d.ts +25 -25
- package/dist/types/classes/cache/server/ServerItemHandler.d.ts +44 -44
- package/dist/types/classes/cache/transaction/TransactionCache.d.ts +319 -319
- package/dist/types/classes/cache/transaction/TransactionCachedQueryHandler.d.ts +31 -31
- package/dist/types/classes/cache/transaction/TransactionCollectionHandler.d.ts +24 -24
- package/dist/types/classes/cache/transaction/TransactionEventHandler.d.ts +21 -21
- package/dist/types/classes/cache/transaction/TransactionItemHandler.d.ts +89 -89
- package/dist/types/classes/cache/transaction/TransactionValidator.d.ts +33 -33
- package/dist/types/constants.d.ts +7 -7
- package/dist/types/core.d.ts +45 -45
- package/dist/types/factories/ApiResponseProcessorFactory.d.ts +6 -6
- package/dist/types/factories/CacheSyncerFactory.d.ts +10 -10
- package/dist/types/factories/ChangesCompilationFactory.d.ts +5 -5
- package/dist/types/factories/ChangesDeltaFactory.d.ts +13 -13
- package/dist/types/factories/ChangesProcessorFactory.d.ts +13 -13
- package/dist/types/factories/CollectionEntryFactory.d.ts +11 -11
- package/dist/types/factories/CollectionResourceFactory.d.ts +18 -18
- package/dist/types/factories/ColumnExpansionFactory.d.ts +7 -7
- package/dist/types/factories/ColumnInfoFactory.d.ts +7 -7
- package/dist/types/factories/ColumnSetFactory.d.ts +18 -18
- package/dist/types/factories/ColumnSubsetCacheFactory.d.ts +8 -8
- package/dist/types/factories/CreateRequestFactory.d.ts +9 -9
- package/dist/types/factories/ItemCacheFactory.d.ts +6 -6
- package/dist/types/factories/ItemEntryFactory.d.ts +12 -12
- package/dist/types/factories/ItemResourceFactory.d.ts +11 -11
- package/dist/types/factories/ModuleChangesCompilationFactory.d.ts +4 -4
- package/dist/types/factories/QueryMatcherFactory.d.ts +7 -7
- package/dist/types/factories/QueryParserFactory.d.ts +5 -5
- package/dist/types/factories/RequestColumnExpansionFactory.d.ts +8 -8
- package/dist/types/factories/TemplateFactory.d.ts +8 -8
- package/dist/types/factories/TransactionCacheFactory.d.ts +13 -13
- package/dist/types/index.d.ts +1 -1
- package/dist/types/interfaces/AbstractCacheDependencyInterface.d.ts +36 -36
- package/dist/types/interfaces/ApiRequestServiceInterface.d.ts +12 -12
- package/dist/types/interfaces/AuthInterface.d.ts +10 -10
- package/dist/types/interfaces/ErrorHandlerInterface.d.ts +5 -5
- package/dist/types/interfaces/ExceptionHandlerInterface.d.ts +3 -3
- package/dist/types/interfaces/LinkTreeServiceInterface.d.ts +4 -4
- package/dist/types/interfaces/PromiseLibraryInterface.d.ts +25 -25
- package/dist/types/interfaces/ServerCacheDependencyInterface.d.ts +5 -5
- package/dist/types/interfaces/SocketMessageInterface.d.ts +3 -3
- package/dist/types/interfaces/TransactionCollectionHandlerDependencyInterface.d.ts +17 -17
- package/dist/types/interfaces/TransactionItemHandlerDependencyInterface.d.ts +22 -22
- package/dist/types/internal.d.ts +104 -104
- package/dist/types/models/CachedQueryItem.d.ts +19 -19
- package/dist/types/models/CollectionEntry.d.ts +21 -21
- package/dist/types/models/CollectionOptions.d.ts +42 -42
- package/dist/types/models/CollectionResource.d.ts +87 -87
- package/dist/types/models/ItemEntry.d.ts +18 -18
- package/dist/types/models/ItemEntryOptions.d.ts +8 -8
- package/dist/types/models/ItemResource.d.ts +90 -90
- package/dist/types/models/Template.d.ts +11 -11
- package/dist/types/types/ItemTypesCollection.d.ts +343 -343
- package/dist/types/types/PromiseInterface.d.ts +2 -2
- package/package.json +48 -48
- package/readme.md +15 -15
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { ApiEnumItemType } from '@rentman/backend-types';
|
|
2
|
-
import { ApiRequestColumns, ColumnSet, ColumnUtil, RequestColumnMergeResult } from '../internal';
|
|
3
|
-
declare type RequestColumnMap = {
|
|
4
|
-
[itemType: string]: ApiRequestColumns;
|
|
5
|
-
};
|
|
6
|
-
export declare class RequestColumnExpansion {
|
|
7
|
-
private columnUtil;
|
|
8
|
-
private columns;
|
|
9
|
-
private columnSetIdMap;
|
|
10
|
-
constructor(columnUtil: ColumnUtil);
|
|
11
|
-
expandWithRequestColumns(itemType: ApiEnumItemType, requestColumns: ApiRequestColumns): RequestColumnMergeResult;
|
|
12
|
-
expand<T extends ColumnSet<ApiEnumItemType>>(columnSet: T): void;
|
|
13
|
-
get(): RequestColumnMap;
|
|
14
|
-
}
|
|
15
|
-
export {};
|
|
1
|
+
import { ApiEnumItemType } from '@rentman/backend-types';
|
|
2
|
+
import { ApiRequestColumns, ColumnSet, ColumnUtil, RequestColumnMergeResult } from '../internal';
|
|
3
|
+
declare type RequestColumnMap = {
|
|
4
|
+
[itemType: string]: ApiRequestColumns;
|
|
5
|
+
};
|
|
6
|
+
export declare class RequestColumnExpansion {
|
|
7
|
+
private columnUtil;
|
|
8
|
+
private columns;
|
|
9
|
+
private columnSetIdMap;
|
|
10
|
+
constructor(columnUtil: ColumnUtil);
|
|
11
|
+
expandWithRequestColumns(itemType: ApiEnumItemType, requestColumns: ApiRequestColumns): RequestColumnMergeResult;
|
|
12
|
+
expand<T extends ColumnSet<ApiEnumItemType>>(columnSet: T): void;
|
|
13
|
+
get(): RequestColumnMap;
|
|
14
|
+
}
|
|
15
|
+
export {};
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import { ApiEnumItemType } from '@rentman/backend-types';
|
|
2
|
-
import { ApiFormatter, ApiRequestService, CachedQueryItem, ChangesDeltaFactory, ErrorHandlerInterface, PromiseLibraryInterface, QueryMatcherFactory, RequestBufferManager, RequestColumnExpansionFactory, SocketMessage, TransactionCacheFactory } from '../internal';
|
|
3
|
-
export declare type CachedQueryMatchingResult<ItemTypeType extends ApiEnumItemType> = {
|
|
4
|
-
fitting: Array<CachedQueryItem<ItemTypeType>>;
|
|
5
|
-
notfitting: Array<CachedQueryItem<ItemTypeType>>;
|
|
6
|
-
maybe: Array<CachedQueryItem<ItemTypeType>>;
|
|
7
|
-
};
|
|
8
|
-
export declare class SocketMessageHandler {
|
|
9
|
-
private requestBufferManager;
|
|
10
|
-
private changesDeltaFactory;
|
|
11
|
-
private apiFormatter;
|
|
12
|
-
private errorHandler;
|
|
13
|
-
private transactionCacheFactory;
|
|
14
|
-
private promiseService;
|
|
15
|
-
private requestColumnExpansionFactory;
|
|
16
|
-
private apiRequestService;
|
|
17
|
-
private queryMatcherFactory;
|
|
18
|
-
constructor(requestBufferManager: RequestBufferManager, changesDeltaFactory: ChangesDeltaFactory, apiFormatter: ApiFormatter, errorHandler: ErrorHandlerInterface, transactionCacheFactory: TransactionCacheFactory, promiseService: PromiseLibraryInterface, requestColumnExpansionFactory: RequestColumnExpansionFactory, apiRequestService: ApiRequestService, queryMatcherFactory: QueryMatcherFactory);
|
|
19
|
-
onMessageReceived(message: SocketMessage): any;
|
|
20
|
-
private formatMessageValues;
|
|
21
|
-
private getCollectionsWithLimitByItemType;
|
|
22
|
-
/**
|
|
23
|
-
* @description
|
|
24
|
-
* When an item is created or updated, we should check if it fits in any of the cached queries (using the values provided by the socket message)
|
|
25
|
-
* If we think it fits (or maybe) we should fetch the complete item with the superset of columns (the socket message might not have all values)
|
|
26
|
-
*/
|
|
27
|
-
private processMessage;
|
|
28
|
-
private processFunctionChangesResolve;
|
|
29
|
-
private isFunctionChangesResolveMessage;
|
|
30
|
-
private handleCreate;
|
|
31
|
-
private handleUpdate;
|
|
32
|
-
private handleDelete;
|
|
33
|
-
private handleLinkMove;
|
|
34
|
-
}
|
|
1
|
+
import { ApiEnumItemType } from '@rentman/backend-types';
|
|
2
|
+
import { ApiFormatter, ApiRequestService, CachedQueryItem, ChangesDeltaFactory, ErrorHandlerInterface, PromiseLibraryInterface, QueryMatcherFactory, RequestBufferManager, RequestColumnExpansionFactory, SocketMessage, TransactionCacheFactory } from '../internal';
|
|
3
|
+
export declare type CachedQueryMatchingResult<ItemTypeType extends ApiEnumItemType> = {
|
|
4
|
+
fitting: Array<CachedQueryItem<ItemTypeType>>;
|
|
5
|
+
notfitting: Array<CachedQueryItem<ItemTypeType>>;
|
|
6
|
+
maybe: Array<CachedQueryItem<ItemTypeType>>;
|
|
7
|
+
};
|
|
8
|
+
export declare class SocketMessageHandler {
|
|
9
|
+
private requestBufferManager;
|
|
10
|
+
private changesDeltaFactory;
|
|
11
|
+
private apiFormatter;
|
|
12
|
+
private errorHandler;
|
|
13
|
+
private transactionCacheFactory;
|
|
14
|
+
private promiseService;
|
|
15
|
+
private requestColumnExpansionFactory;
|
|
16
|
+
private apiRequestService;
|
|
17
|
+
private queryMatcherFactory;
|
|
18
|
+
constructor(requestBufferManager: RequestBufferManager, changesDeltaFactory: ChangesDeltaFactory, apiFormatter: ApiFormatter, errorHandler: ErrorHandlerInterface, transactionCacheFactory: TransactionCacheFactory, promiseService: PromiseLibraryInterface, requestColumnExpansionFactory: RequestColumnExpansionFactory, apiRequestService: ApiRequestService, queryMatcherFactory: QueryMatcherFactory);
|
|
19
|
+
onMessageReceived(message: SocketMessage): any;
|
|
20
|
+
private formatMessageValues;
|
|
21
|
+
private getCollectionsWithLimitByItemType;
|
|
22
|
+
/**
|
|
23
|
+
* @description
|
|
24
|
+
* When an item is created or updated, we should check if it fits in any of the cached queries (using the values provided by the socket message)
|
|
25
|
+
* If we think it fits (or maybe) we should fetch the complete item with the superset of columns (the socket message might not have all values)
|
|
26
|
+
*/
|
|
27
|
+
private processMessage;
|
|
28
|
+
private processFunctionChangesResolve;
|
|
29
|
+
private isFunctionChangesResolveMessage;
|
|
30
|
+
private handleCreate;
|
|
31
|
+
private handleUpdate;
|
|
32
|
+
private handleDelete;
|
|
33
|
+
private handleLinkMove;
|
|
34
|
+
}
|
|
@@ -1,63 +1,62 @@
|
|
|
1
|
-
import { ApiEnumItemType, ApiFields, ItemId } from '@rentman/backend-types';
|
|
2
|
-
import { ApiRequestService, ApiResponse, ColumnHandler, ColumnUtil, EntryParentNull, ErrorHandlerInterface, PromiseInterface, PromiseLibraryInterface, RequestColumnExpansionFactory,
|
|
3
|
-
export declare class TemplateCache {
|
|
4
|
-
private
|
|
5
|
-
private
|
|
6
|
-
private
|
|
7
|
-
private
|
|
8
|
-
private
|
|
9
|
-
private
|
|
10
|
-
private
|
|
11
|
-
private
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
* @
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* @param
|
|
23
|
-
* @param
|
|
24
|
-
* @param
|
|
25
|
-
* @param
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
* {},
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
* template.
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
private
|
|
62
|
-
|
|
63
|
-
}
|
|
1
|
+
import { ApiEnumItemType, ApiFields, ItemId } from '@rentman/backend-types';
|
|
2
|
+
import { ApiRequestService, ApiResponse, ColumnHandler, ColumnUtil, EntryParentNull, ErrorHandlerInterface, PromiseInterface, PromiseLibraryInterface, RequestColumnExpansionFactory, Template, TemplateFactory } from '../internal';
|
|
3
|
+
export declare class TemplateCache {
|
|
4
|
+
private columnUtil;
|
|
5
|
+
private promiseService;
|
|
6
|
+
private columnHandler;
|
|
7
|
+
private templateFactory;
|
|
8
|
+
private errorHandler;
|
|
9
|
+
private requestColumnExpansionFactory;
|
|
10
|
+
private apiRequestService;
|
|
11
|
+
private pendingTemplateBufferMap;
|
|
12
|
+
templateResponses: {
|
|
13
|
+
[itemType: string]: ApiResponse;
|
|
14
|
+
};
|
|
15
|
+
constructor(columnUtil: ColumnUtil, promiseService: PromiseLibraryInterface, columnHandler: ColumnHandler, templateFactory: TemplateFactory, errorHandler: ErrorHandlerInterface, requestColumnExpansionFactory: RequestColumnExpansionFactory, apiRequestService: ApiRequestService);
|
|
16
|
+
/**
|
|
17
|
+
* @description
|
|
18
|
+
* Fetches a {@link Template template}, use {@link ItemCreateService.createItemsFromValues createItemsFromValues} to easily create new items from a set of values.
|
|
19
|
+
* The best way to process the template's values is to call {@link ItemCreateService.processTemplate processTemplate}
|
|
20
|
+
*
|
|
21
|
+
* @param itemType The {@link ApiEnumItemType ItemType} of the template item
|
|
22
|
+
* @param itemId Used for caching, multiple concurrent template calls for the same itemId will return the same template
|
|
23
|
+
* @param templateOptions
|
|
24
|
+
* @param templateColumns Additional columns to be fetched, will be stored in the template - warning - the Template won't have values for those columns
|
|
25
|
+
* @param entryParentOrParentItemType An optional {@link EntryParentNull entry parent} or {@link ApiEnumItemType parent itemType}, if the parent is passed the templateColumns will be expanded with the proper link columns (Through {@link ColumnUtil.getColumnsFromLink ColumnUtil.getColumnsFromLink})
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```
|
|
29
|
+
* const parent: EntryParent = {
|
|
30
|
+
* itemType: 'Functie',
|
|
31
|
+
* itemId: 10,
|
|
32
|
+
* };
|
|
33
|
+
*
|
|
34
|
+
* return core.templateCache
|
|
35
|
+
* .fetchTemplate(
|
|
36
|
+
* 'Planningpersoneel',
|
|
37
|
+
* undefined,
|
|
38
|
+
* {},
|
|
39
|
+
* {},
|
|
40
|
+
* parent,
|
|
41
|
+
* )
|
|
42
|
+
* .then(
|
|
43
|
+
* (template: Template<'Planningpersoneel'>) => {
|
|
44
|
+
* const changesDelta = transaction.createChangesDelta();
|
|
45
|
+
*
|
|
46
|
+
* for (const itemResource of selectedItems) {
|
|
47
|
+
* changesDelta.setItemCreated(
|
|
48
|
+
* core.keyService.getLocalId(),
|
|
49
|
+
* template.getFields(),
|
|
50
|
+
* template.columns,
|
|
51
|
+
* parent,
|
|
52
|
+
* );
|
|
53
|
+
* }
|
|
54
|
+
*
|
|
55
|
+
* return transaction.applyChangesDelta(changesDelta);
|
|
56
|
+
* );
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
fetchTemplate<ItemTypeType extends ApiEnumItemType, ColumnIds extends Array<keyof ApiFields[ItemTypeType]> = Array<keyof ApiFields[ItemTypeType]>>(itemType: ItemTypeType, itemId?: ItemId, templateOptions?: any, templateColumns?: any, entryParentOrParentItemType?: EntryParentNull | ApiEnumItemType): PromiseInterface<Template<ItemTypeType, ColumnIds>>;
|
|
60
|
+
private fetchTemplateById;
|
|
61
|
+
private constructTemplateBuffer;
|
|
62
|
+
}
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { PromiseInterface } from '../internal';
|
|
2
|
-
export declare function findIndex<T>(haystack: T[], callback: (item: T) => boolean): number;
|
|
3
|
-
export declare function shallowMerge(object: any, defaults: any): any;
|
|
4
|
-
export declare function hasProperties(object: any): boolean;
|
|
5
|
-
export declare function getFirstProperty(object: any): string | null;
|
|
6
|
-
export declare function inArray(needle: any, haystack: any): boolean;
|
|
7
|
-
export declare function filterArray<T>(source: T[], callback: (elem: T) => boolean): boolean;
|
|
8
|
-
export declare function emptyArray(array: any): void;
|
|
9
|
-
export declare function pathExists(source: any, path: any): boolean;
|
|
10
|
-
export declare function createPath<T>(object: any, path: Array<number | string>, defaults: any[]): T;
|
|
11
|
-
export declare function getPath(object: {}, path: Array<number | string>, create?: boolean): any;
|
|
12
|
-
export declare function extend(dst: any, ...args: any[]): any;
|
|
13
|
-
export declare function merge(dst: any, ...args: any[]): any;
|
|
14
|
-
export declare function isObject(value: any): boolean;
|
|
15
|
-
export declare function isBlankObject(value: any): boolean;
|
|
16
|
-
export declare function isString(value: any): boolean;
|
|
17
|
-
export declare function isNumber(value: any): boolean;
|
|
18
|
-
export declare function isDate(value: any): boolean;
|
|
19
|
-
export declare const isArray: (arg: any) => arg is any[];
|
|
20
|
-
export declare function isFunction<T>(value: any): value is T;
|
|
21
|
-
export declare function isPromiseLike<T = any>(obj: any): obj is PromiseInterface<T>;
|
|
22
|
-
export declare function isRegExp(value: any): boolean;
|
|
23
|
-
export declare function isBoolean(value: any): boolean;
|
|
24
|
-
export declare function isElement(node: any): boolean;
|
|
25
|
-
export declare function isWindow(obj: any): boolean;
|
|
26
|
-
export declare function isDefined(value: any): boolean;
|
|
27
|
-
export declare function equals(o1: any, o2: any): boolean;
|
|
28
|
-
export declare function copy(source: object, destination?: object, maxDepth?: any): any;
|
|
1
|
+
import { PromiseInterface } from '../internal';
|
|
2
|
+
export declare function findIndex<T>(haystack: T[], callback: (item: T) => boolean): number;
|
|
3
|
+
export declare function shallowMerge(object: any, defaults: any): any;
|
|
4
|
+
export declare function hasProperties(object: any): boolean;
|
|
5
|
+
export declare function getFirstProperty(object: any): string | null;
|
|
6
|
+
export declare function inArray(needle: any, haystack: any): boolean;
|
|
7
|
+
export declare function filterArray<T>(source: T[], callback: (elem: T) => boolean): boolean;
|
|
8
|
+
export declare function emptyArray(array: any): void;
|
|
9
|
+
export declare function pathExists(source: any, path: any): boolean;
|
|
10
|
+
export declare function createPath<T>(object: any, path: Array<number | string>, defaults: any[]): T;
|
|
11
|
+
export declare function getPath(object: {}, path: Array<number | string>, create?: boolean): any;
|
|
12
|
+
export declare function extend(dst: any, ...args: any[]): any;
|
|
13
|
+
export declare function merge(dst: any, ...args: any[]): any;
|
|
14
|
+
export declare function isObject(value: any): boolean;
|
|
15
|
+
export declare function isBlankObject(value: any): boolean;
|
|
16
|
+
export declare function isString(value: any): boolean;
|
|
17
|
+
export declare function isNumber(value: any): boolean;
|
|
18
|
+
export declare function isDate(value: any): boolean;
|
|
19
|
+
export declare const isArray: (arg: any) => arg is any[];
|
|
20
|
+
export declare function isFunction<T>(value: any): value is T;
|
|
21
|
+
export declare function isPromiseLike<T = any>(obj: any): obj is PromiseInterface<T>;
|
|
22
|
+
export declare function isRegExp(value: any): boolean;
|
|
23
|
+
export declare function isBoolean(value: any): boolean;
|
|
24
|
+
export declare function isElement(node: any): boolean;
|
|
25
|
+
export declare function isWindow(obj: any): boolean;
|
|
26
|
+
export declare function isDefined(value: any): boolean;
|
|
27
|
+
export declare function equals(o1: any, o2: any): boolean;
|
|
28
|
+
export declare function copy(source: object, destination?: object, maxDepth?: any): any;
|
|
@@ -1,95 +1,95 @@
|
|
|
1
|
-
import { ApiEnumItemType } from '@rentman/backend-types';
|
|
2
|
-
import { RmCore } from '../../core';
|
|
3
|
-
import { AbstractCacheDependencyInterface, ApiRequestColumn, CachedQueryItem, ChangesDelta, ChangesDeltaBase, ChangesDeltaResult, CollectionQuery, CollectionResourceParentIdMap, EntryParentNull, FieldMap, InternalChangesDelta, ItemCache, ItemEntry, ItemHandlerBase, ItemIdConversionMap, OnAfterCreateCallback, ParentChangesDelta, PromiseInterface, ServerCache, ServerCachedQueryHandler, ServerItemEntryChanges, TransactionCache, TransactionCachedQueryHandler, TransactionItemEntryChanges, TransactionValidatorFactory } from '../../internal';
|
|
4
|
-
export declare type TransactionOptions = {
|
|
5
|
-
/**
|
|
6
|
-
* @description
|
|
7
|
-
* Sets the TransactionCache to 'transparent' mode, whenever {@link AbstractCache.createChild createChild} is called it will actually be called on the parent
|
|
8
|
-
*/
|
|
9
|
-
transparent: boolean;
|
|
10
|
-
};
|
|
11
|
-
export declare abstract class AbstractCache {
|
|
12
|
-
dependencies: AbstractCacheDependencyInterface;
|
|
13
|
-
core: RmCore;
|
|
14
|
-
children: TransactionCache[];
|
|
15
|
-
readonly itemHandler: ItemHandlerBase;
|
|
16
|
-
readonly cachedQueryHandler: TransactionCachedQueryHandler | ServerCachedQueryHandler;
|
|
17
|
-
parent: AbstractCache | null;
|
|
18
|
-
protected constructor(dependencies: AbstractCacheDependencyInterface, core: RmCore);
|
|
19
|
-
abstract createChild(id?: string, validatorFactory?: TransactionValidatorFactory, options?: TransactionOptions): TransactionCache;
|
|
20
|
-
onChildDestroy(cache: TransactionCache): void;
|
|
21
|
-
/**
|
|
22
|
-
* @description
|
|
23
|
-
* Expands the items in the collections with the passed columns
|
|
24
|
-
*
|
|
25
|
-
* todo[limit] move to TransactionCache ?
|
|
26
|
-
*/
|
|
27
|
-
abstract expandCollectionResources<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, collections: CollectionResourceParentIdMap<ItemTypeType>, newColumns: ApiRequestColumn[]): PromiseInterface<CollectionResourceParentIdMap>;
|
|
28
|
-
/**
|
|
29
|
-
* @description
|
|
30
|
-
* Returns {@link ItemEntry ItemEntries} that fit the collection's query, copies over the collectionChanges on all transactions in the chain.
|
|
31
|
-
*/
|
|
32
|
-
abstract getCollectionChangesRecursively<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, parsedQuery: CollectionQuery): CachedQueryItem<ItemTypeType> | undefined;
|
|
33
|
-
/**
|
|
34
|
-
* @description
|
|
35
|
-
* Returns this transaction and all parents
|
|
36
|
-
*/
|
|
37
|
-
getTransactionChain(): AbstractCache[];
|
|
38
|
-
/**
|
|
39
|
-
* @description
|
|
40
|
-
* Returns the {@link TransactionItemHandler.entries ItemCache} of the transaction
|
|
41
|
-
*/
|
|
42
|
-
getCurrentItemEntryCache(): ItemCache;
|
|
43
|
-
abstract getServerCache(): ServerCache;
|
|
44
|
-
abstract getLocalItemEntry(itemEntryId: ItemEntry['id']): ItemEntry | undefined;
|
|
45
|
-
abstract getLocalItemEntryByItemId(itemType: ApiEnumItemType, itemId: ItemEntry['itemId']): ItemEntry | undefined;
|
|
46
|
-
/**
|
|
47
|
-
* @description
|
|
48
|
-
* Applies changes from a child transaction to a parent
|
|
49
|
-
*/
|
|
50
|
-
abstract applyChangesFromChild(transaction: TransactionCache, breakUpByParent?: boolean, onAfterCreateCallback?: OnAfterCreateCallback): PromiseInterface<ItemIdConversionMap>;
|
|
51
|
-
/**
|
|
52
|
-
* @description
|
|
53
|
-
* Called by a parent transaction, propagates changes downwards to all child caches
|
|
54
|
-
*
|
|
55
|
-
* @remarks
|
|
56
|
-
* - Should only be used by the core
|
|
57
|
-
*
|
|
58
|
-
* todo[cache] Should we refetch derived values just like in applyChangesDelta ?
|
|
59
|
-
*
|
|
60
|
-
* @internal
|
|
61
|
-
*/
|
|
62
|
-
abstract applyChangesFromParent(parentChangesDelta: ParentChangesDelta, isCalledAfterSocketUpdate: boolean): void;
|
|
63
|
-
abstract getParent<ItemTypeType extends ApiEnumItemType = any>(itemEntry: ItemEntry<ItemTypeType>, fromInitial?: boolean, providedFields?: FieldMap<ItemTypeType>): EntryParentNull;
|
|
64
|
-
abstract getItemChangesRecursively(itemEntryId: ItemEntry['id'], copyFields?: boolean): FieldMap;
|
|
65
|
-
abstract getLocalItemEntryChangesTuple(itemEntryId: ItemEntry['id']): any;
|
|
66
|
-
/**
|
|
67
|
-
* @description
|
|
68
|
-
* Because the `itemChanges` object differs between the {@link ServerItemHandler.itemChanges ServerItemHandler} and the {@link TransactionItemHandler.itemChanges TransactionItemHandler} we need a function to normalise those values
|
|
69
|
-
*
|
|
70
|
-
* @remarks
|
|
71
|
-
* - Should only be used by the core
|
|
72
|
-
*
|
|
73
|
-
* @internal
|
|
74
|
-
*/
|
|
75
|
-
abstract getChangesFromItemChanges<ItemTypeType extends ApiEnumItemType = any>(changesObject: ServerItemEntryChanges<ItemTypeType> | TransactionItemEntryChanges<FieldMap<ItemTypeType>>): FieldMap<ItemTypeType>;
|
|
76
|
-
abstract applyChangesDelta(changesDelta: ChangesDelta): PromiseInterface<ChangesDeltaResult>;
|
|
77
|
-
protected getParentFromFields<ItemTypeType extends ApiEnumItemType = any>(itemEntry: ItemEntry<ItemTypeType>, fields: FieldMap<ItemTypeType>): EntryParentNull;
|
|
78
|
-
/**
|
|
79
|
-
* @description
|
|
80
|
-
* Called by applyChangesDelta from ServerCache and TransactionCache. Applies creates, updates and moves, doesn't apply deletes
|
|
81
|
-
*
|
|
82
|
-
* @private
|
|
83
|
-
*/
|
|
84
|
-
protected _applyChangesDelta(changesDelta: ChangesDelta | InternalChangesDelta): {
|
|
85
|
-
result: ChangesDeltaResult;
|
|
86
|
-
parentChangesDelta: ParentChangesDelta;
|
|
87
|
-
matchingDelta: ParentChangesDelta;
|
|
88
|
-
undoFunctions: Array<(changesDelta: InternalChangesDelta) => void>;
|
|
89
|
-
};
|
|
90
|
-
/**
|
|
91
|
-
* @description
|
|
92
|
-
* Ensures that for all updated items in the delta the required derived values are present
|
|
93
|
-
*/
|
|
94
|
-
protected fetchUpdatedDerivedValuesFromDelta(changesDelta: ChangesDeltaBase): PromiseInterface<void>;
|
|
95
|
-
}
|
|
1
|
+
import { ApiEnumItemType } from '@rentman/backend-types';
|
|
2
|
+
import { RmCore } from '../../core';
|
|
3
|
+
import { AbstractCacheDependencyInterface, ApiRequestColumn, CachedQueryItem, ChangesDelta, ChangesDeltaBase, ChangesDeltaResult, CollectionQuery, CollectionResourceParentIdMap, EntryParentNull, FieldMap, InternalChangesDelta, ItemCache, ItemEntry, ItemHandlerBase, ItemIdConversionMap, OnAfterCreateCallback, ParentChangesDelta, PromiseInterface, ServerCache, ServerCachedQueryHandler, ServerItemEntryChanges, TransactionCache, TransactionCachedQueryHandler, TransactionItemEntryChanges, TransactionValidatorFactory } from '../../internal';
|
|
4
|
+
export declare type TransactionOptions = {
|
|
5
|
+
/**
|
|
6
|
+
* @description
|
|
7
|
+
* Sets the TransactionCache to 'transparent' mode, whenever {@link AbstractCache.createChild createChild} is called it will actually be called on the parent
|
|
8
|
+
*/
|
|
9
|
+
transparent: boolean;
|
|
10
|
+
};
|
|
11
|
+
export declare abstract class AbstractCache {
|
|
12
|
+
dependencies: AbstractCacheDependencyInterface;
|
|
13
|
+
core: RmCore;
|
|
14
|
+
children: TransactionCache[];
|
|
15
|
+
readonly itemHandler: ItemHandlerBase;
|
|
16
|
+
readonly cachedQueryHandler: TransactionCachedQueryHandler | ServerCachedQueryHandler;
|
|
17
|
+
parent: AbstractCache | null;
|
|
18
|
+
protected constructor(dependencies: AbstractCacheDependencyInterface, core: RmCore);
|
|
19
|
+
abstract createChild(id?: string, validatorFactory?: TransactionValidatorFactory, options?: TransactionOptions): TransactionCache;
|
|
20
|
+
onChildDestroy(cache: TransactionCache): void;
|
|
21
|
+
/**
|
|
22
|
+
* @description
|
|
23
|
+
* Expands the items in the collections with the passed columns
|
|
24
|
+
*
|
|
25
|
+
* todo[limit] move to TransactionCache ?
|
|
26
|
+
*/
|
|
27
|
+
abstract expandCollectionResources<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, collections: CollectionResourceParentIdMap<ItemTypeType>, newColumns: ApiRequestColumn[]): PromiseInterface<CollectionResourceParentIdMap>;
|
|
28
|
+
/**
|
|
29
|
+
* @description
|
|
30
|
+
* Returns {@link ItemEntry ItemEntries} that fit the collection's query, copies over the collectionChanges on all transactions in the chain.
|
|
31
|
+
*/
|
|
32
|
+
abstract getCollectionChangesRecursively<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, parsedQuery: CollectionQuery): CachedQueryItem<ItemTypeType> | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* @description
|
|
35
|
+
* Returns this transaction and all parents
|
|
36
|
+
*/
|
|
37
|
+
getTransactionChain(): AbstractCache[];
|
|
38
|
+
/**
|
|
39
|
+
* @description
|
|
40
|
+
* Returns the {@link TransactionItemHandler.entries ItemCache} of the transaction
|
|
41
|
+
*/
|
|
42
|
+
getCurrentItemEntryCache(): ItemCache;
|
|
43
|
+
abstract getServerCache(): ServerCache;
|
|
44
|
+
abstract getLocalItemEntry(itemEntryId: ItemEntry['id']): ItemEntry | undefined;
|
|
45
|
+
abstract getLocalItemEntryByItemId(itemType: ApiEnumItemType, itemId: ItemEntry['itemId']): ItemEntry | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* @description
|
|
48
|
+
* Applies changes from a child transaction to a parent
|
|
49
|
+
*/
|
|
50
|
+
abstract applyChangesFromChild(transaction: TransactionCache, breakUpByParent?: boolean, onAfterCreateCallback?: OnAfterCreateCallback): PromiseInterface<ItemIdConversionMap>;
|
|
51
|
+
/**
|
|
52
|
+
* @description
|
|
53
|
+
* Called by a parent transaction, propagates changes downwards to all child caches
|
|
54
|
+
*
|
|
55
|
+
* @remarks
|
|
56
|
+
* - Should only be used by the core
|
|
57
|
+
*
|
|
58
|
+
* todo[cache] Should we refetch derived values just like in applyChangesDelta ?
|
|
59
|
+
*
|
|
60
|
+
* @internal
|
|
61
|
+
*/
|
|
62
|
+
abstract applyChangesFromParent(parentChangesDelta: ParentChangesDelta, isCalledAfterSocketUpdate: boolean): void;
|
|
63
|
+
abstract getParent<ItemTypeType extends ApiEnumItemType = any>(itemEntry: ItemEntry<ItemTypeType>, fromInitial?: boolean, providedFields?: FieldMap<ItemTypeType>): EntryParentNull;
|
|
64
|
+
abstract getItemChangesRecursively(itemEntryId: ItemEntry['id'], copyFields?: boolean): FieldMap;
|
|
65
|
+
abstract getLocalItemEntryChangesTuple(itemEntryId: ItemEntry['id']): any;
|
|
66
|
+
/**
|
|
67
|
+
* @description
|
|
68
|
+
* Because the `itemChanges` object differs between the {@link ServerItemHandler.itemChanges ServerItemHandler} and the {@link TransactionItemHandler.itemChanges TransactionItemHandler} we need a function to normalise those values
|
|
69
|
+
*
|
|
70
|
+
* @remarks
|
|
71
|
+
* - Should only be used by the core
|
|
72
|
+
*
|
|
73
|
+
* @internal
|
|
74
|
+
*/
|
|
75
|
+
abstract getChangesFromItemChanges<ItemTypeType extends ApiEnumItemType = any>(changesObject: ServerItemEntryChanges<ItemTypeType> | TransactionItemEntryChanges<FieldMap<ItemTypeType>>): FieldMap<ItemTypeType>;
|
|
76
|
+
abstract applyChangesDelta(changesDelta: ChangesDelta): PromiseInterface<ChangesDeltaResult>;
|
|
77
|
+
protected getParentFromFields<ItemTypeType extends ApiEnumItemType = any>(itemEntry: ItemEntry<ItemTypeType>, fields: FieldMap<ItemTypeType>): EntryParentNull;
|
|
78
|
+
/**
|
|
79
|
+
* @description
|
|
80
|
+
* Called by applyChangesDelta from ServerCache and TransactionCache. Applies creates, updates and moves, doesn't apply deletes
|
|
81
|
+
*
|
|
82
|
+
* @private
|
|
83
|
+
*/
|
|
84
|
+
protected _applyChangesDelta(changesDelta: ChangesDelta | InternalChangesDelta): {
|
|
85
|
+
result: ChangesDeltaResult;
|
|
86
|
+
parentChangesDelta: ParentChangesDelta;
|
|
87
|
+
matchingDelta: ParentChangesDelta;
|
|
88
|
+
undoFunctions: Array<(changesDelta: InternalChangesDelta) => void>;
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* @description
|
|
92
|
+
* Ensures that for all updated items in the delta the required derived values are present
|
|
93
|
+
*/
|
|
94
|
+
protected fetchUpdatedDerivedValuesFromDelta(changesDelta: ChangesDeltaBase): PromiseInterface<void>;
|
|
95
|
+
}
|
|
@@ -1,68 +1,68 @@
|
|
|
1
|
-
import { ApiEnumItemType, ItemId } from '@rentman/backend-types';
|
|
2
|
-
import { AbstractCache, ApiQuery, ApiRequestColumns, CachedQueryItem, CollectionEntryService, CollectionOptions, CollectionQuery, ColumnSubsetCache, ColumnUtil, ItemEntry, ParentIdMap, ParentItemMap, PromiseInterface, PromiseLibraryInterface, RequestColumnExpansionFactory } from '../../internal';
|
|
3
|
-
export declare type CachedQueryItemTree<ItemTypeType extends ApiEnumItemType = any> = {
|
|
4
|
-
item: CachedQueryItem<ItemTypeType>;
|
|
5
|
-
children: ParentItemMap<CachedQueryItemTree> | null;
|
|
6
|
-
};
|
|
7
|
-
export declare abstract class CachedQueryHandlerBase {
|
|
8
|
-
protected collectionEntryService: CollectionEntryService;
|
|
9
|
-
protected columnUtil: ColumnUtil;
|
|
10
|
-
protected requestColumnExpansionFactory: RequestColumnExpansionFactory;
|
|
11
|
-
protected promiseService: PromiseLibraryInterface;
|
|
12
|
-
protected transaction: AbstractCache;
|
|
13
|
-
/**
|
|
14
|
-
* @description
|
|
15
|
-
* Items (per ItemType) that fit in a query
|
|
16
|
-
*
|
|
17
|
-
* @remark
|
|
18
|
-
* Contains the requestColumns so that new items can include these columns (saving requests when they match)
|
|
19
|
-
*/
|
|
20
|
-
cachedQueries: {
|
|
21
|
-
[itemType: string]: {
|
|
22
|
-
[queryString: string]: CachedQueryItem;
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
protected constructor(collectionEntryService: CollectionEntryService, columnUtil: ColumnUtil, requestColumnExpansionFactory: RequestColumnExpansionFactory, promiseService: PromiseLibraryInterface, transaction: AbstractCache);
|
|
26
|
-
/**
|
|
27
|
-
* Every time a cached query item is created, either 'resolve' or 'reject' has to be called on the cached query item.
|
|
28
|
-
*/
|
|
29
|
-
setCachedQuery<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, parsedQuery: CollectionQuery, requestColumns: ApiRequestColumns, itemEntries?: Array<ItemEntry<ItemTypeType>>): CachedQueryItem<ItemTypeType>;
|
|
30
|
-
/**
|
|
31
|
-
* Every time a cached query item is created, either 'resolve' or 'reject' has to be called on the cached query item.
|
|
32
|
-
*/
|
|
33
|
-
protected constructCachedQuery<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, parsedQuery: CollectionQuery, itemEntries: Array<ItemEntry<ItemTypeType>>, requestColumns: ApiRequestColumns): CachedQueryItem<ItemTypeType>;
|
|
34
|
-
getCachedQueryItems<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, queryString: string): undefined | Array<ItemEntry<ItemTypeType>>;
|
|
35
|
-
getCachedQueryObjectsByItemType(itemType: ApiEnumItemType): CachedQueryItem[];
|
|
36
|
-
/**
|
|
37
|
-
* @description
|
|
38
|
-
* Fetches a {@link CollectionEntry CollectionEntry} with the given options
|
|
39
|
-
*/
|
|
40
|
-
abstract __fetchCachedQueryItem<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, options: CollectionOptions): PromiseInterface<CachedQueryItem<ItemTypeType>>;
|
|
41
|
-
/**
|
|
42
|
-
* @description
|
|
43
|
-
* Fetches collections linked to the passed parents
|
|
44
|
-
*/
|
|
45
|
-
abstract __fetchItemEntriesByQueryData<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, options: CollectionOptions<ItemTypeType>, columnSubsetCache: ColumnSubsetCache<ItemTypeType>, collectionQuery: CollectionQuery): PromiseInterface<CachedQueryItem<ItemTypeType>>;
|
|
46
|
-
/**
|
|
47
|
-
* @description
|
|
48
|
-
* Fetches collections linked to the passed parents
|
|
49
|
-
*/
|
|
50
|
-
abstract __fetchLinkedCachedQueryItems<ItemTypeType extends ApiEnumItemType>(parentType: ApiEnumItemType, parentIdArray: ItemId[] | (() => ItemId[]), itemType: ItemTypeType, options: CollectionOptions): PromiseInterface<ParentIdMap<CachedQueryItem<ItemTypeType>>>;
|
|
51
|
-
/**
|
|
52
|
-
* @description
|
|
53
|
-
* Adds the passed {@link ItemEntry ItemEntries} to the Transaction's query cache,
|
|
54
|
-
* will skip the ItemEntry if the `skipEntryFilterFn` callback returns `true`
|
|
55
|
-
*/
|
|
56
|
-
protected __addItemEntriesToCachedQueries<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, parsedQuery: CollectionQuery, itemEntries: Array<ItemEntry<ItemTypeType>>, skipEntryFilterFn: (temEntry: ItemEntry) => boolean): void;
|
|
57
|
-
/**
|
|
58
|
-
* @description
|
|
59
|
-
* Removes the passed {@link ItemId ItemIds} from the Transaction's query cache
|
|
60
|
-
*/
|
|
61
|
-
__removeItemEntriesFromCachedQueries<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, parsedQuery: CollectionQuery, itemEntries: Array<ItemEntry<ItemTypeType>>): Array<ItemEntry<ItemTypeType>>;
|
|
62
|
-
/**
|
|
63
|
-
* @description
|
|
64
|
-
* Expands the option's {@link CollectionOptions.columns columns} with the columns required for the {@link CollectionMatcherCachedCollectionProcessor CollectionMatcher} to function.
|
|
65
|
-
* Data fetched for a parent transaction might also fit in a child transaction, so those {@link CollectionOptions.queryColumns queryColumns} should also be taken into account
|
|
66
|
-
*/
|
|
67
|
-
expandColumnsWithQueryColumns(itemType: ApiEnumItemType, options: CollectionOptions, query: ApiQuery): void;
|
|
68
|
-
}
|
|
1
|
+
import { ApiEnumItemType, ItemId } from '@rentman/backend-types';
|
|
2
|
+
import { AbstractCache, ApiQuery, ApiRequestColumns, CachedQueryItem, CollectionEntryService, CollectionOptions, CollectionQuery, ColumnSubsetCache, ColumnUtil, ItemEntry, ParentIdMap, ParentItemMap, PromiseInterface, PromiseLibraryInterface, RequestColumnExpansionFactory } from '../../internal';
|
|
3
|
+
export declare type CachedQueryItemTree<ItemTypeType extends ApiEnumItemType = any> = {
|
|
4
|
+
item: CachedQueryItem<ItemTypeType>;
|
|
5
|
+
children: ParentItemMap<CachedQueryItemTree> | null;
|
|
6
|
+
};
|
|
7
|
+
export declare abstract class CachedQueryHandlerBase {
|
|
8
|
+
protected collectionEntryService: CollectionEntryService;
|
|
9
|
+
protected columnUtil: ColumnUtil;
|
|
10
|
+
protected requestColumnExpansionFactory: RequestColumnExpansionFactory;
|
|
11
|
+
protected promiseService: PromiseLibraryInterface;
|
|
12
|
+
protected transaction: AbstractCache;
|
|
13
|
+
/**
|
|
14
|
+
* @description
|
|
15
|
+
* Items (per ItemType) that fit in a query
|
|
16
|
+
*
|
|
17
|
+
* @remark
|
|
18
|
+
* Contains the requestColumns so that new items can include these columns (saving requests when they match)
|
|
19
|
+
*/
|
|
20
|
+
cachedQueries: {
|
|
21
|
+
[itemType: string]: {
|
|
22
|
+
[queryString: string]: CachedQueryItem;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
protected constructor(collectionEntryService: CollectionEntryService, columnUtil: ColumnUtil, requestColumnExpansionFactory: RequestColumnExpansionFactory, promiseService: PromiseLibraryInterface, transaction: AbstractCache);
|
|
26
|
+
/**
|
|
27
|
+
* Every time a cached query item is created, either 'resolve' or 'reject' has to be called on the cached query item.
|
|
28
|
+
*/
|
|
29
|
+
setCachedQuery<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, parsedQuery: CollectionQuery, requestColumns: ApiRequestColumns, itemEntries?: Array<ItemEntry<ItemTypeType>>): CachedQueryItem<ItemTypeType>;
|
|
30
|
+
/**
|
|
31
|
+
* Every time a cached query item is created, either 'resolve' or 'reject' has to be called on the cached query item.
|
|
32
|
+
*/
|
|
33
|
+
protected constructCachedQuery<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, parsedQuery: CollectionQuery, itemEntries: Array<ItemEntry<ItemTypeType>>, requestColumns: ApiRequestColumns): CachedQueryItem<ItemTypeType>;
|
|
34
|
+
getCachedQueryItems<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, queryString: string): undefined | Array<ItemEntry<ItemTypeType>>;
|
|
35
|
+
getCachedQueryObjectsByItemType(itemType: ApiEnumItemType): CachedQueryItem[];
|
|
36
|
+
/**
|
|
37
|
+
* @description
|
|
38
|
+
* Fetches a {@link CollectionEntry CollectionEntry} with the given options
|
|
39
|
+
*/
|
|
40
|
+
abstract __fetchCachedQueryItem<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, options: CollectionOptions): PromiseInterface<CachedQueryItem<ItemTypeType>>;
|
|
41
|
+
/**
|
|
42
|
+
* @description
|
|
43
|
+
* Fetches collections linked to the passed parents
|
|
44
|
+
*/
|
|
45
|
+
abstract __fetchItemEntriesByQueryData<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, options: CollectionOptions<ItemTypeType>, columnSubsetCache: ColumnSubsetCache<ItemTypeType>, collectionQuery: CollectionQuery): PromiseInterface<CachedQueryItem<ItemTypeType>>;
|
|
46
|
+
/**
|
|
47
|
+
* @description
|
|
48
|
+
* Fetches collections linked to the passed parents
|
|
49
|
+
*/
|
|
50
|
+
abstract __fetchLinkedCachedQueryItems<ItemTypeType extends ApiEnumItemType>(parentType: ApiEnumItemType, parentIdArray: ItemId[] | (() => ItemId[]), itemType: ItemTypeType, options: CollectionOptions): PromiseInterface<ParentIdMap<CachedQueryItem<ItemTypeType>>>;
|
|
51
|
+
/**
|
|
52
|
+
* @description
|
|
53
|
+
* Adds the passed {@link ItemEntry ItemEntries} to the Transaction's query cache,
|
|
54
|
+
* will skip the ItemEntry if the `skipEntryFilterFn` callback returns `true`
|
|
55
|
+
*/
|
|
56
|
+
protected __addItemEntriesToCachedQueries<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, parsedQuery: CollectionQuery, itemEntries: Array<ItemEntry<ItemTypeType>>, skipEntryFilterFn: (temEntry: ItemEntry) => boolean): void;
|
|
57
|
+
/**
|
|
58
|
+
* @description
|
|
59
|
+
* Removes the passed {@link ItemId ItemIds} from the Transaction's query cache
|
|
60
|
+
*/
|
|
61
|
+
__removeItemEntriesFromCachedQueries<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, parsedQuery: CollectionQuery, itemEntries: Array<ItemEntry<ItemTypeType>>): Array<ItemEntry<ItemTypeType>>;
|
|
62
|
+
/**
|
|
63
|
+
* @description
|
|
64
|
+
* Expands the option's {@link CollectionOptions.columns columns} with the columns required for the {@link CollectionMatcherCachedCollectionProcessor CollectionMatcher} to function.
|
|
65
|
+
* Data fetched for a parent transaction might also fit in a child transaction, so those {@link CollectionOptions.queryColumns queryColumns} should also be taken into account
|
|
66
|
+
*/
|
|
67
|
+
expandColumnsWithQueryColumns(itemType: ApiEnumItemType, options: CollectionOptions, query: ApiQuery): void;
|
|
68
|
+
}
|