@rentman/rm-core 7.0.5 → 7.0.6
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 +820 -817
- package/dist/rm-core.js +9804 -9800
- package/dist/rm-core.min.js +1 -1
- package/dist/types/classes/ApiFormatter.d.ts +65 -65
- 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 +61 -61
- package/dist/types/classes/ChangesDeltaBase.d.ts +51 -51
- 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 +16 -16
- 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/QueryContainsLocalIdParser.d.ts +17 -17
- 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 +31 -31
- package/dist/types/classes/cache/AbstractCache.d.ts +103 -103
- package/dist/types/classes/cache/CachedQueryHandlerBase.d.ts +74 -74
- package/dist/types/classes/cache/CollectionMatcherCachedQueryProcessor.d.ts +35 -35
- package/dist/types/classes/cache/ItemHandlerBase.d.ts +105 -105
- 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 +324 -324
- 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 +34 -34
- 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 +13 -13
- 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 -27
- 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 +262 -262
- package/dist/types/types/PromiseInterface.d.ts +2 -2
- package/dist/types/types/index.d.ts +2 -2
- package/package.json +36 -36
- package/readme.md +15 -15
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { PromiseInterface } from '../types';
|
|
2
|
-
export declare function findIndex<T>(haystack: T[], callback: (item: T) => boolean): number;
|
|
3
|
-
export declare function instantiateOptions(options: {
|
|
4
|
-
[key: string]: any;
|
|
5
|
-
}, values: object): void;
|
|
6
|
-
export declare function shallowMerge(object: any, defaults: any): any;
|
|
7
|
-
export declare function hasProperties(object: any): boolean;
|
|
8
|
-
export declare function getFirstProperty(object: any): string | null;
|
|
9
|
-
export declare function inArray(needle: any, haystack: any): boolean;
|
|
10
|
-
export declare function filterArray<T>(source: T[], callback: (elem: T) => boolean): boolean;
|
|
11
|
-
export declare function emptyArray(array: any): void;
|
|
12
|
-
export declare function pathExists(source: any, path: any): boolean;
|
|
13
|
-
export declare function createPath<T>(object: any, path: Array<number | string>, defaults: any[]): T;
|
|
14
|
-
export declare function getPath(object: {}, path: Array<number | string>, create?: boolean): any;
|
|
15
|
-
export declare function extend(dst: any, ...args: any[]): any;
|
|
16
|
-
export declare function merge(dst: any, ...args: any[]): any;
|
|
17
|
-
export declare function isObject(value: any): boolean;
|
|
18
|
-
export declare function isBlankObject(value: any): boolean;
|
|
19
|
-
export declare function isString(value: any): boolean;
|
|
20
|
-
export declare function isNumber(value: any): boolean;
|
|
21
|
-
export declare function isDate(value: any): boolean;
|
|
22
|
-
export declare const isArray: (arg: any) => arg is any[];
|
|
23
|
-
export declare function isFunction<T>(value: any): value is T;
|
|
24
|
-
export declare function isPromiseLike<T = any>(obj: any): obj is PromiseInterface<T>;
|
|
25
|
-
export declare function isRegExp(value: any): boolean;
|
|
26
|
-
export declare function isBoolean(value: any): boolean;
|
|
27
|
-
export declare function isElement(node: any): boolean;
|
|
28
|
-
export declare function isWindow(obj: any): boolean;
|
|
29
|
-
export declare function isDefined(value: any): boolean;
|
|
30
|
-
export declare function equals(o1: any, o2: any): boolean;
|
|
31
|
-
export declare function copy(source: any, destination?: any, maxDepth?: any): any;
|
|
1
|
+
import { PromiseInterface } from '../types';
|
|
2
|
+
export declare function findIndex<T>(haystack: T[], callback: (item: T) => boolean): number;
|
|
3
|
+
export declare function instantiateOptions(options: {
|
|
4
|
+
[key: string]: any;
|
|
5
|
+
}, values: object): void;
|
|
6
|
+
export declare function shallowMerge(object: any, defaults: any): any;
|
|
7
|
+
export declare function hasProperties(object: any): boolean;
|
|
8
|
+
export declare function getFirstProperty(object: any): string | null;
|
|
9
|
+
export declare function inArray(needle: any, haystack: any): boolean;
|
|
10
|
+
export declare function filterArray<T>(source: T[], callback: (elem: T) => boolean): boolean;
|
|
11
|
+
export declare function emptyArray(array: any): void;
|
|
12
|
+
export declare function pathExists(source: any, path: any): boolean;
|
|
13
|
+
export declare function createPath<T>(object: any, path: Array<number | string>, defaults: any[]): T;
|
|
14
|
+
export declare function getPath(object: {}, path: Array<number | string>, create?: boolean): any;
|
|
15
|
+
export declare function extend(dst: any, ...args: any[]): any;
|
|
16
|
+
export declare function merge(dst: any, ...args: any[]): any;
|
|
17
|
+
export declare function isObject(value: any): boolean;
|
|
18
|
+
export declare function isBlankObject(value: any): boolean;
|
|
19
|
+
export declare function isString(value: any): boolean;
|
|
20
|
+
export declare function isNumber(value: any): boolean;
|
|
21
|
+
export declare function isDate(value: any): boolean;
|
|
22
|
+
export declare const isArray: (arg: any) => arg is any[];
|
|
23
|
+
export declare function isFunction<T>(value: any): value is T;
|
|
24
|
+
export declare function isPromiseLike<T = any>(obj: any): obj is PromiseInterface<T>;
|
|
25
|
+
export declare function isRegExp(value: any): boolean;
|
|
26
|
+
export declare function isBoolean(value: any): boolean;
|
|
27
|
+
export declare function isElement(node: any): boolean;
|
|
28
|
+
export declare function isWindow(obj: any): boolean;
|
|
29
|
+
export declare function isDefined(value: any): boolean;
|
|
30
|
+
export declare function equals(o1: any, o2: any): boolean;
|
|
31
|
+
export declare function copy(source: any, destination?: any, maxDepth?: any): any;
|
|
@@ -1,103 +1,103 @@
|
|
|
1
|
-
import { RmCore } from '../../core';
|
|
2
|
-
import { AbstractCacheDependencyInterface } from '../../interfaces';
|
|
3
|
-
import { ItemEntry } from '../../models';
|
|
4
|
-
import { ApiRequestColumn, CollectionQuery, CollectionResourceParentIdMap, EntryParentNull, FieldMap, ItemIdConversionMap, ItemType, PromiseInterface } from '../../types';
|
|
5
|
-
import { ChangesDelta } from '../ChangesDelta';
|
|
6
|
-
import { ChangesDeltaResult } from '../ChangesDeltaBase';
|
|
7
|
-
import { OnAfterCreateCallback } from '../ChangesProcessor';
|
|
8
|
-
import { InternalChangesDelta } from '../InternalChangesDelta';
|
|
9
|
-
import { ItemCache } from '../ItemCache';
|
|
10
|
-
import { CachedQueryItem } from './CachedQueryHandlerBase';
|
|
11
|
-
import { ItemHandlerBase } from './ItemHandlerBase';
|
|
12
|
-
import { ServerCache } from './server/ServerCache';
|
|
13
|
-
import { ServerCachedQueryHandler } from './server/ServerCachedQueryHandler';
|
|
14
|
-
import { ServerItemEntryChanges } from './server/ServerItemHandler';
|
|
15
|
-
import { TransactionCache } from './transaction/TransactionCache';
|
|
16
|
-
import { TransactionCachedQueryHandler } from './transaction/TransactionCachedQueryHandler';
|
|
17
|
-
import { TransactionItemEntryChanges } from './transaction/TransactionItemHandler';
|
|
18
|
-
import { TransactionValidatorFactory } from './transaction/TransactionValidator';
|
|
19
|
-
export declare abstract class AbstractCache {
|
|
20
|
-
dependencies: AbstractCacheDependencyInterface;
|
|
21
|
-
core: RmCore;
|
|
22
|
-
children: TransactionCache[];
|
|
23
|
-
readonly itemHandler: ItemHandlerBase;
|
|
24
|
-
readonly cachedQueryHandler: TransactionCachedQueryHandler | ServerCachedQueryHandler;
|
|
25
|
-
parent: AbstractCache | null;
|
|
26
|
-
protected constructor(dependencies: AbstractCacheDependencyInterface, core: RmCore);
|
|
27
|
-
abstract createChild(id?: string, validatorFactory?: TransactionValidatorFactory): TransactionCache;
|
|
28
|
-
onChildDestroy(cache: TransactionCache): void;
|
|
29
|
-
/**
|
|
30
|
-
* @description
|
|
31
|
-
* Expands the items in the collections with the passed columns
|
|
32
|
-
*
|
|
33
|
-
* todo[limit] move to TransactionCache ?
|
|
34
|
-
*/
|
|
35
|
-
abstract expandCollectionResources<ItemTypeType extends ItemType>(itemType: ItemTypeType, collections: CollectionResourceParentIdMap<ItemTypeType>, newColumns: ApiRequestColumn[]): PromiseInterface<CollectionResourceParentIdMap>;
|
|
36
|
-
/**
|
|
37
|
-
* @description
|
|
38
|
-
* Returns {@link ItemEntry ItemEntries} that fit the collection's query, copies over the collectionChanges on all transactions in the chain.
|
|
39
|
-
*/
|
|
40
|
-
abstract getCollectionChangesRecursively<ItemTypeType extends ItemType>(itemType: ItemTypeType, parsedQuery: CollectionQuery): CachedQueryItem<ItemTypeType> | undefined;
|
|
41
|
-
/**
|
|
42
|
-
* @description
|
|
43
|
-
* Returns this transaction and all parents
|
|
44
|
-
*/
|
|
45
|
-
getTransactionChain(): AbstractCache[];
|
|
46
|
-
/**
|
|
47
|
-
* @description
|
|
48
|
-
* Returns the {@link TransactionItemHandler.entries ItemCache} of the transaction
|
|
49
|
-
*/
|
|
50
|
-
getCurrentItemEntryCache(): ItemCache;
|
|
51
|
-
abstract getServerCache(): ServerCache;
|
|
52
|
-
abstract getLocalItemEntry(itemEntryId: ItemEntry['id']): ItemEntry | undefined;
|
|
53
|
-
abstract getLocalItemEntryByItemId(itemType: ItemType, itemId: ItemEntry['itemId']): ItemEntry | undefined;
|
|
54
|
-
/**
|
|
55
|
-
* @description
|
|
56
|
-
* Applies changes from a child transaction to a parent
|
|
57
|
-
*/
|
|
58
|
-
abstract applyChangesFromChild(transaction: TransactionCache, breakUpByParent?: boolean, onAfterCreateCallback?: OnAfterCreateCallback): PromiseInterface<ItemIdConversionMap>;
|
|
59
|
-
/**
|
|
60
|
-
* @description
|
|
61
|
-
* Called by a parent transaction, propagates changes downwards to all child caches
|
|
62
|
-
*
|
|
63
|
-
* @remarks
|
|
64
|
-
* - Should only be used by the core
|
|
65
|
-
*
|
|
66
|
-
* todo[cache] Should we refetch derived values just like in applyChangesDelta ?
|
|
67
|
-
*
|
|
68
|
-
* @internal
|
|
69
|
-
*/
|
|
70
|
-
abstract applyChangesFromParent(internalChangesDelta: InternalChangesDelta, isCalledAfterApiSave: boolean, isCalledAfterSocketUpdate: boolean): void;
|
|
71
|
-
abstract getParent<ItemTypeType extends ItemType = any>(itemEntry: ItemEntry<ItemTypeType>, fromInitial?: boolean, providedFields?: FieldMap<ItemTypeType>): EntryParentNull;
|
|
72
|
-
abstract getItemChangesRecursively(itemEntryId: ItemEntry['id'], copyFields?: boolean): FieldMap;
|
|
73
|
-
abstract getLocalItemEntryChangesTuple(itemEntryId: ItemEntry['id']): any;
|
|
74
|
-
/**
|
|
75
|
-
* @description
|
|
76
|
-
* 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
|
|
77
|
-
*
|
|
78
|
-
* @remarks
|
|
79
|
-
* - Should only be used by the core
|
|
80
|
-
*
|
|
81
|
-
* @internal
|
|
82
|
-
*/
|
|
83
|
-
abstract getChangesFromItemChanges<ItemTypeType extends ItemType = any>(changesObject: ServerItemEntryChanges<ItemTypeType> | TransactionItemEntryChanges<ItemTypeType>): FieldMap<ItemTypeType>;
|
|
84
|
-
abstract applyChangesDelta(changesDelta: ChangesDelta): PromiseInterface<ChangesDeltaResult>;
|
|
85
|
-
protected getParentFromFields<ItemTypeType extends ItemType = any>(itemEntry: ItemEntry<ItemTypeType>, fields: FieldMap<ItemTypeType>): EntryParentNull;
|
|
86
|
-
/**
|
|
87
|
-
* @description
|
|
88
|
-
* Called by applyChangesDelta from ServerCache and TransactionCache. Applies creates, updates and moves, doesn't apply deletes
|
|
89
|
-
*
|
|
90
|
-
* @private
|
|
91
|
-
*/
|
|
92
|
-
protected _applyChangesDelta(changesDelta: ChangesDelta): {
|
|
93
|
-
result: ChangesDeltaResult;
|
|
94
|
-
internalChangesDelta: InternalChangesDelta;
|
|
95
|
-
matchingDelta: InternalChangesDelta;
|
|
96
|
-
rollbackFunctions: Array<(changesDelta: ChangesDelta) => void>;
|
|
97
|
-
};
|
|
98
|
-
/**
|
|
99
|
-
* @description
|
|
100
|
-
* Ensures that for all updated items in the delta the required derived values are present
|
|
101
|
-
*/
|
|
102
|
-
protected fetchUpdatedDerivedValuesFromDelta(changesDelta: ChangesDelta): PromiseInterface<void>;
|
|
103
|
-
}
|
|
1
|
+
import { RmCore } from '../../core';
|
|
2
|
+
import { AbstractCacheDependencyInterface } from '../../interfaces';
|
|
3
|
+
import { ItemEntry } from '../../models';
|
|
4
|
+
import { ApiRequestColumn, CollectionQuery, CollectionResourceParentIdMap, EntryParentNull, FieldMap, ItemIdConversionMap, ItemType, PromiseInterface } from '../../types';
|
|
5
|
+
import { ChangesDelta } from '../ChangesDelta';
|
|
6
|
+
import { ChangesDeltaResult } from '../ChangesDeltaBase';
|
|
7
|
+
import { OnAfterCreateCallback } from '../ChangesProcessor';
|
|
8
|
+
import { InternalChangesDelta } from '../InternalChangesDelta';
|
|
9
|
+
import { ItemCache } from '../ItemCache';
|
|
10
|
+
import { CachedQueryItem } from './CachedQueryHandlerBase';
|
|
11
|
+
import { ItemHandlerBase } from './ItemHandlerBase';
|
|
12
|
+
import { ServerCache } from './server/ServerCache';
|
|
13
|
+
import { ServerCachedQueryHandler } from './server/ServerCachedQueryHandler';
|
|
14
|
+
import { ServerItemEntryChanges } from './server/ServerItemHandler';
|
|
15
|
+
import { TransactionCache } from './transaction/TransactionCache';
|
|
16
|
+
import { TransactionCachedQueryHandler } from './transaction/TransactionCachedQueryHandler';
|
|
17
|
+
import { TransactionItemEntryChanges } from './transaction/TransactionItemHandler';
|
|
18
|
+
import { TransactionValidatorFactory } from './transaction/TransactionValidator';
|
|
19
|
+
export declare abstract class AbstractCache {
|
|
20
|
+
dependencies: AbstractCacheDependencyInterface;
|
|
21
|
+
core: RmCore;
|
|
22
|
+
children: TransactionCache[];
|
|
23
|
+
readonly itemHandler: ItemHandlerBase;
|
|
24
|
+
readonly cachedQueryHandler: TransactionCachedQueryHandler | ServerCachedQueryHandler;
|
|
25
|
+
parent: AbstractCache | null;
|
|
26
|
+
protected constructor(dependencies: AbstractCacheDependencyInterface, core: RmCore);
|
|
27
|
+
abstract createChild(id?: string, validatorFactory?: TransactionValidatorFactory): TransactionCache;
|
|
28
|
+
onChildDestroy(cache: TransactionCache): void;
|
|
29
|
+
/**
|
|
30
|
+
* @description
|
|
31
|
+
* Expands the items in the collections with the passed columns
|
|
32
|
+
*
|
|
33
|
+
* todo[limit] move to TransactionCache ?
|
|
34
|
+
*/
|
|
35
|
+
abstract expandCollectionResources<ItemTypeType extends ItemType>(itemType: ItemTypeType, collections: CollectionResourceParentIdMap<ItemTypeType>, newColumns: ApiRequestColumn[]): PromiseInterface<CollectionResourceParentIdMap>;
|
|
36
|
+
/**
|
|
37
|
+
* @description
|
|
38
|
+
* Returns {@link ItemEntry ItemEntries} that fit the collection's query, copies over the collectionChanges on all transactions in the chain.
|
|
39
|
+
*/
|
|
40
|
+
abstract getCollectionChangesRecursively<ItemTypeType extends ItemType>(itemType: ItemTypeType, parsedQuery: CollectionQuery): CachedQueryItem<ItemTypeType> | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* @description
|
|
43
|
+
* Returns this transaction and all parents
|
|
44
|
+
*/
|
|
45
|
+
getTransactionChain(): AbstractCache[];
|
|
46
|
+
/**
|
|
47
|
+
* @description
|
|
48
|
+
* Returns the {@link TransactionItemHandler.entries ItemCache} of the transaction
|
|
49
|
+
*/
|
|
50
|
+
getCurrentItemEntryCache(): ItemCache;
|
|
51
|
+
abstract getServerCache(): ServerCache;
|
|
52
|
+
abstract getLocalItemEntry(itemEntryId: ItemEntry['id']): ItemEntry | undefined;
|
|
53
|
+
abstract getLocalItemEntryByItemId(itemType: ItemType, itemId: ItemEntry['itemId']): ItemEntry | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* @description
|
|
56
|
+
* Applies changes from a child transaction to a parent
|
|
57
|
+
*/
|
|
58
|
+
abstract applyChangesFromChild(transaction: TransactionCache, breakUpByParent?: boolean, onAfterCreateCallback?: OnAfterCreateCallback): PromiseInterface<ItemIdConversionMap>;
|
|
59
|
+
/**
|
|
60
|
+
* @description
|
|
61
|
+
* Called by a parent transaction, propagates changes downwards to all child caches
|
|
62
|
+
*
|
|
63
|
+
* @remarks
|
|
64
|
+
* - Should only be used by the core
|
|
65
|
+
*
|
|
66
|
+
* todo[cache] Should we refetch derived values just like in applyChangesDelta ?
|
|
67
|
+
*
|
|
68
|
+
* @internal
|
|
69
|
+
*/
|
|
70
|
+
abstract applyChangesFromParent(internalChangesDelta: InternalChangesDelta, isCalledAfterApiSave: boolean, isCalledAfterSocketUpdate: boolean): void;
|
|
71
|
+
abstract getParent<ItemTypeType extends ItemType = any>(itemEntry: ItemEntry<ItemTypeType>, fromInitial?: boolean, providedFields?: FieldMap<ItemTypeType>): EntryParentNull;
|
|
72
|
+
abstract getItemChangesRecursively(itemEntryId: ItemEntry['id'], copyFields?: boolean): FieldMap;
|
|
73
|
+
abstract getLocalItemEntryChangesTuple(itemEntryId: ItemEntry['id']): any;
|
|
74
|
+
/**
|
|
75
|
+
* @description
|
|
76
|
+
* 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
|
|
77
|
+
*
|
|
78
|
+
* @remarks
|
|
79
|
+
* - Should only be used by the core
|
|
80
|
+
*
|
|
81
|
+
* @internal
|
|
82
|
+
*/
|
|
83
|
+
abstract getChangesFromItemChanges<ItemTypeType extends ItemType = any>(changesObject: ServerItemEntryChanges<ItemTypeType> | TransactionItemEntryChanges<ItemTypeType>): FieldMap<ItemTypeType>;
|
|
84
|
+
abstract applyChangesDelta(changesDelta: ChangesDelta): PromiseInterface<ChangesDeltaResult>;
|
|
85
|
+
protected getParentFromFields<ItemTypeType extends ItemType = any>(itemEntry: ItemEntry<ItemTypeType>, fields: FieldMap<ItemTypeType>): EntryParentNull;
|
|
86
|
+
/**
|
|
87
|
+
* @description
|
|
88
|
+
* Called by applyChangesDelta from ServerCache and TransactionCache. Applies creates, updates and moves, doesn't apply deletes
|
|
89
|
+
*
|
|
90
|
+
* @private
|
|
91
|
+
*/
|
|
92
|
+
protected _applyChangesDelta(changesDelta: ChangesDelta): {
|
|
93
|
+
result: ChangesDeltaResult;
|
|
94
|
+
internalChangesDelta: InternalChangesDelta;
|
|
95
|
+
matchingDelta: InternalChangesDelta;
|
|
96
|
+
rollbackFunctions: Array<(changesDelta: ChangesDelta) => void>;
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* @description
|
|
100
|
+
* Ensures that for all updated items in the delta the required derived values are present
|
|
101
|
+
*/
|
|
102
|
+
protected fetchUpdatedDerivedValuesFromDelta(changesDelta: ChangesDelta): PromiseInterface<void>;
|
|
103
|
+
}
|
|
@@ -1,74 +1,74 @@
|
|
|
1
|
-
import { RequestColumnExpansionFactory } from '../../factories';
|
|
2
|
-
import { PromiseLibraryInterface } from '../../interfaces';
|
|
3
|
-
import { ItemEntry } from '../../models';
|
|
4
|
-
import { CollectionOptions } from '../../models/CollectionOptions';
|
|
5
|
-
import { ApiQuery, ApiRequestColumns, CollectionQuery, ItemId, ItemType, ParentIdMap, PromiseInterface } from '../../types';
|
|
6
|
-
import { CollectionEntryService } from '../CollectionEntryService';
|
|
7
|
-
import { ColumnSubsetCache } from '../ColumnSubsetCache';
|
|
8
|
-
import { ColumnUtil } from '../ColumnUtil';
|
|
9
|
-
import { AbstractCache } from './AbstractCache';
|
|
10
|
-
export declare type CachedQueryItem<ItemTypeType extends ItemType = any> = {
|
|
11
|
-
itemType: ItemTypeType;
|
|
12
|
-
query: CollectionQuery;
|
|
13
|
-
items: Array<ItemEntry<ItemTypeType>>;
|
|
14
|
-
requestColumns: ApiRequestColumns;
|
|
15
|
-
promise: PromiseInterface<CachedQueryItem<ItemTypeType>>;
|
|
16
|
-
resolve: () => void;
|
|
17
|
-
reject: (reason: string) => void;
|
|
18
|
-
};
|
|
19
|
-
export declare abstract class CachedQueryHandlerBase {
|
|
20
|
-
protected collectionEntryService: CollectionEntryService;
|
|
21
|
-
protected columnUtil: ColumnUtil;
|
|
22
|
-
protected requestColumnExpansionFactory: RequestColumnExpansionFactory;
|
|
23
|
-
protected promiseService: PromiseLibraryInterface;
|
|
24
|
-
protected transaction: AbstractCache;
|
|
25
|
-
/**
|
|
26
|
-
* @description
|
|
27
|
-
* Items (per ItemType) that fit in a query
|
|
28
|
-
*
|
|
29
|
-
* @remark
|
|
30
|
-
* Contains the requestColumns so that new items can include these columns (saving requests when they match)
|
|
31
|
-
*/
|
|
32
|
-
cachedQueries: {
|
|
33
|
-
[itemType: string]: {
|
|
34
|
-
[queryString: string]: CachedQueryItem;
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
protected constructor(collectionEntryService: CollectionEntryService, columnUtil: ColumnUtil, requestColumnExpansionFactory: RequestColumnExpansionFactory, promiseService: PromiseLibraryInterface, transaction: AbstractCache);
|
|
38
|
-
setCachedQuery<ItemTypeType extends ItemType>(itemType: ItemTypeType, parsedQuery: CollectionQuery, itemEntries: Array<ItemEntry<ItemTypeType>>, requestColumns: ApiRequestColumns): CachedQueryItem<ItemTypeType>;
|
|
39
|
-
getCachedQueryItems<ItemTypeType extends ItemType>(itemType: ItemTypeType, queryString: string): undefined | Array<ItemEntry<ItemTypeType>>;
|
|
40
|
-
getCachedQueryObjectsByItemType(itemType: ItemType): CachedQueryItem[];
|
|
41
|
-
initCachedQuery<ItemTypeType extends ItemType = string>(itemType: ItemTypeType, parsedQuery: CollectionQuery, requestColumns: ApiRequestColumns): CachedQueryItem<ItemTypeType>;
|
|
42
|
-
/**
|
|
43
|
-
* @description
|
|
44
|
-
* Fetches a {@link CollectionEntry CollectionEntry} with the given options
|
|
45
|
-
*/
|
|
46
|
-
abstract __fetchCachedQueryItem<ItemTypeType extends ItemType>(itemType: ItemTypeType, options: CollectionOptions): PromiseInterface<CachedQueryItem<ItemTypeType>>;
|
|
47
|
-
/**
|
|
48
|
-
* @description
|
|
49
|
-
* Fetches collections linked to the passed parents
|
|
50
|
-
*/
|
|
51
|
-
abstract __fetchItemEntriesByQueryData<ItemTypeType extends ItemType>(itemType: ItemTypeType, options: CollectionOptions<ItemTypeType>, columnSubsetCache: ColumnSubsetCache<ItemTypeType>, collectionQuery: CollectionQuery): PromiseInterface<CachedQueryItem<ItemTypeType>>;
|
|
52
|
-
/**
|
|
53
|
-
* @description
|
|
54
|
-
* Fetches collections linked to the passed parents
|
|
55
|
-
*/
|
|
56
|
-
abstract __fetchLinkedCachedQueryItems<ItemTypeType extends ItemType>(parentType: ItemType, parentIdArray: ItemId[] | (() => ItemId[]), itemType: ItemTypeType, options: CollectionOptions): PromiseInterface<ParentIdMap<CachedQueryItem<ItemTypeType>>>;
|
|
57
|
-
/**
|
|
58
|
-
* @description
|
|
59
|
-
* Adds the passed {@link ItemEntry ItemEntries} to the Transaction's query cache,
|
|
60
|
-
* will skip the ItemEntry if the `skipEntryFilterFn` callback returns `true`
|
|
61
|
-
*/
|
|
62
|
-
protected __addItemEntriesToCachedQueries<ItemTypeType extends ItemType>(itemType: ItemTypeType, parsedQuery: CollectionQuery, itemEntries: Array<ItemEntry<ItemTypeType>>, skipEntryFilterFn: (temEntry: ItemEntry) => boolean): void;
|
|
63
|
-
/**
|
|
64
|
-
* @description
|
|
65
|
-
* Removes the passed {@link ItemId ItemIds} from the Transaction's query cache
|
|
66
|
-
*/
|
|
67
|
-
__removeItemEntriesFromCachedQueries<ItemTypeType extends ItemType>(itemType: ItemTypeType, parsedQuery: CollectionQuery, itemEntries: Array<ItemEntry<ItemTypeType>>): Array<ItemEntry<ItemTypeType>>;
|
|
68
|
-
/**
|
|
69
|
-
* @description
|
|
70
|
-
* Expands the option's {@link CollectionOptions.columns columns} with the columns required for the {@link CollectionMatcherCachedCollectionProcessor CollectionMatcher} to function.
|
|
71
|
-
* 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
|
|
72
|
-
*/
|
|
73
|
-
expandColumnsWithQueryColumns(itemType: ItemType, options: CollectionOptions, query: ApiQuery): void;
|
|
74
|
-
}
|
|
1
|
+
import { RequestColumnExpansionFactory } from '../../factories';
|
|
2
|
+
import { PromiseLibraryInterface } from '../../interfaces';
|
|
3
|
+
import { ItemEntry } from '../../models';
|
|
4
|
+
import { CollectionOptions } from '../../models/CollectionOptions';
|
|
5
|
+
import { ApiQuery, ApiRequestColumns, CollectionQuery, ItemId, ItemType, ParentIdMap, PromiseInterface } from '../../types';
|
|
6
|
+
import { CollectionEntryService } from '../CollectionEntryService';
|
|
7
|
+
import { ColumnSubsetCache } from '../ColumnSubsetCache';
|
|
8
|
+
import { ColumnUtil } from '../ColumnUtil';
|
|
9
|
+
import { AbstractCache } from './AbstractCache';
|
|
10
|
+
export declare type CachedQueryItem<ItemTypeType extends ItemType = any> = {
|
|
11
|
+
itemType: ItemTypeType;
|
|
12
|
+
query: CollectionQuery;
|
|
13
|
+
items: Array<ItemEntry<ItemTypeType>>;
|
|
14
|
+
requestColumns: ApiRequestColumns;
|
|
15
|
+
promise: PromiseInterface<CachedQueryItem<ItemTypeType>>;
|
|
16
|
+
resolve: () => void;
|
|
17
|
+
reject: (reason: string) => void;
|
|
18
|
+
};
|
|
19
|
+
export declare abstract class CachedQueryHandlerBase {
|
|
20
|
+
protected collectionEntryService: CollectionEntryService;
|
|
21
|
+
protected columnUtil: ColumnUtil;
|
|
22
|
+
protected requestColumnExpansionFactory: RequestColumnExpansionFactory;
|
|
23
|
+
protected promiseService: PromiseLibraryInterface;
|
|
24
|
+
protected transaction: AbstractCache;
|
|
25
|
+
/**
|
|
26
|
+
* @description
|
|
27
|
+
* Items (per ItemType) that fit in a query
|
|
28
|
+
*
|
|
29
|
+
* @remark
|
|
30
|
+
* Contains the requestColumns so that new items can include these columns (saving requests when they match)
|
|
31
|
+
*/
|
|
32
|
+
cachedQueries: {
|
|
33
|
+
[itemType: string]: {
|
|
34
|
+
[queryString: string]: CachedQueryItem;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
protected constructor(collectionEntryService: CollectionEntryService, columnUtil: ColumnUtil, requestColumnExpansionFactory: RequestColumnExpansionFactory, promiseService: PromiseLibraryInterface, transaction: AbstractCache);
|
|
38
|
+
setCachedQuery<ItemTypeType extends ItemType>(itemType: ItemTypeType, parsedQuery: CollectionQuery, itemEntries: Array<ItemEntry<ItemTypeType>>, requestColumns: ApiRequestColumns): CachedQueryItem<ItemTypeType>;
|
|
39
|
+
getCachedQueryItems<ItemTypeType extends ItemType>(itemType: ItemTypeType, queryString: string): undefined | Array<ItemEntry<ItemTypeType>>;
|
|
40
|
+
getCachedQueryObjectsByItemType(itemType: ItemType): CachedQueryItem[];
|
|
41
|
+
initCachedQuery<ItemTypeType extends ItemType = string>(itemType: ItemTypeType, parsedQuery: CollectionQuery, requestColumns: ApiRequestColumns): CachedQueryItem<ItemTypeType>;
|
|
42
|
+
/**
|
|
43
|
+
* @description
|
|
44
|
+
* Fetches a {@link CollectionEntry CollectionEntry} with the given options
|
|
45
|
+
*/
|
|
46
|
+
abstract __fetchCachedQueryItem<ItemTypeType extends ItemType>(itemType: ItemTypeType, options: CollectionOptions): PromiseInterface<CachedQueryItem<ItemTypeType>>;
|
|
47
|
+
/**
|
|
48
|
+
* @description
|
|
49
|
+
* Fetches collections linked to the passed parents
|
|
50
|
+
*/
|
|
51
|
+
abstract __fetchItemEntriesByQueryData<ItemTypeType extends ItemType>(itemType: ItemTypeType, options: CollectionOptions<ItemTypeType>, columnSubsetCache: ColumnSubsetCache<ItemTypeType>, collectionQuery: CollectionQuery): PromiseInterface<CachedQueryItem<ItemTypeType>>;
|
|
52
|
+
/**
|
|
53
|
+
* @description
|
|
54
|
+
* Fetches collections linked to the passed parents
|
|
55
|
+
*/
|
|
56
|
+
abstract __fetchLinkedCachedQueryItems<ItemTypeType extends ItemType>(parentType: ItemType, parentIdArray: ItemId[] | (() => ItemId[]), itemType: ItemTypeType, options: CollectionOptions): PromiseInterface<ParentIdMap<CachedQueryItem<ItemTypeType>>>;
|
|
57
|
+
/**
|
|
58
|
+
* @description
|
|
59
|
+
* Adds the passed {@link ItemEntry ItemEntries} to the Transaction's query cache,
|
|
60
|
+
* will skip the ItemEntry if the `skipEntryFilterFn` callback returns `true`
|
|
61
|
+
*/
|
|
62
|
+
protected __addItemEntriesToCachedQueries<ItemTypeType extends ItemType>(itemType: ItemTypeType, parsedQuery: CollectionQuery, itemEntries: Array<ItemEntry<ItemTypeType>>, skipEntryFilterFn: (temEntry: ItemEntry) => boolean): void;
|
|
63
|
+
/**
|
|
64
|
+
* @description
|
|
65
|
+
* Removes the passed {@link ItemId ItemIds} from the Transaction's query cache
|
|
66
|
+
*/
|
|
67
|
+
__removeItemEntriesFromCachedQueries<ItemTypeType extends ItemType>(itemType: ItemTypeType, parsedQuery: CollectionQuery, itemEntries: Array<ItemEntry<ItemTypeType>>): Array<ItemEntry<ItemTypeType>>;
|
|
68
|
+
/**
|
|
69
|
+
* @description
|
|
70
|
+
* Expands the option's {@link CollectionOptions.columns columns} with the columns required for the {@link CollectionMatcherCachedCollectionProcessor CollectionMatcher} to function.
|
|
71
|
+
* 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
|
|
72
|
+
*/
|
|
73
|
+
expandColumnsWithQueryColumns(itemType: ItemType, options: CollectionOptions, query: ApiQuery): void;
|
|
74
|
+
}
|
|
@@ -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
|
+
}
|