@rentman/rm-core 9.1.2 → 9.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/changelog.md +6 -0
- package/dist/rm-core.js +1617 -1475
- package/dist/rm-core.min.js +1 -1
- package/dist/types/classes/ApiFormatter.d.ts +9 -9
- package/dist/types/classes/ApiResponseProcessor.d.ts +4 -4
- package/dist/types/classes/CacheSyncer.d.ts +6 -6
- package/dist/types/classes/ChangesDelta.d.ts +3 -3
- package/dist/types/classes/ChangesDeltaBase.d.ts +9 -4
- package/dist/types/classes/CollectionEntryService.d.ts +3 -3
- package/dist/types/classes/ColumnCache.d.ts +2 -4
- package/dist/types/classes/ColumnExpansion.d.ts +6 -8
- package/dist/types/classes/ColumnInfo.d.ts +5 -4
- package/dist/types/classes/ColumnSet.d.ts +12 -12
- package/dist/types/classes/ConversionMapService.d.ts +4 -4
- package/dist/types/classes/CreateRequest.d.ts +1 -1
- package/dist/types/classes/InternalChangesDelta.d.ts +3 -3
- package/dist/types/classes/ItemCache.d.ts +5 -5
- package/dist/types/classes/ItemCreateService.d.ts +2 -2
- package/dist/types/classes/KeyService.d.ts +1 -1
- package/dist/types/classes/LockService.d.ts +1 -1
- package/dist/types/classes/ParentChangesDelta.d.ts +2 -2
- package/dist/types/classes/QueryColumnExtractor.d.ts +11 -11
- package/dist/types/classes/QueryContainsLocalIdParser.d.ts +13 -11
- package/dist/types/classes/QueryLinkedToParser.d.ts +11 -9
- package/dist/types/classes/QueryLocallyMatchableParser.d.ts +11 -9
- package/dist/types/classes/QueryMatcher.d.ts +9 -3
- package/dist/types/classes/QueryParser.d.ts +1 -1
- package/dist/types/classes/QueryParserIdUpdater.d.ts +11 -9
- package/dist/types/classes/RequestBufferManager.d.ts +14 -2
- package/dist/types/classes/SocketMessageHandler.d.ts +3 -3
- package/dist/types/classes/TemplateCache.d.ts +3 -3
- package/dist/types/classes/Util.d.ts +4 -4
- package/dist/types/classes/cache/AbstractCache.d.ts +1 -1
- package/dist/types/classes/cache/CachedQueryHandlerBase.d.ts +14 -14
- package/dist/types/classes/cache/ItemHandlerBase.d.ts +4 -4
- package/dist/types/classes/cache/server/ServerCachedQueryHandler.d.ts +1 -1
- package/dist/types/classes/cache/server/ServerItemHandler.d.ts +3 -3
- package/dist/types/classes/cache/transaction/TransactionCache.d.ts +14 -13
- package/dist/types/classes/cache/transaction/TransactionCachedQueryHandler.d.ts +6 -4
- package/dist/types/classes/cache/transaction/TransactionCollectionHandler.d.ts +2 -2
- package/dist/types/classes/cache/transaction/TransactionItemHandler.d.ts +6 -7
- package/dist/types/core.d.ts +1 -1
- package/dist/types/factories/ApiResponseProcessorFactory.d.ts +2 -2
- package/dist/types/factories/CollectionEntryFactory.d.ts +3 -3
- package/dist/types/factories/CollectionResourceFactory.d.ts +1 -1
- package/dist/types/factories/ColumnInfoFactory.d.ts +2 -2
- package/dist/types/factories/ItemResourceFactory.d.ts +3 -3
- package/dist/types/factories/QueryMatcherFactory.d.ts +1 -1
- package/dist/types/interfaces/PromiseLibraryInterface.d.ts +3 -3
- package/dist/types/models/CollectionEntry.d.ts +3 -3
- package/dist/types/models/CollectionOptions.d.ts +8 -6
- package/dist/types/models/CollectionResource.d.ts +20 -20
- package/dist/types/models/ItemResource.d.ts +2 -2
- package/dist/types/models/Template.d.ts +1 -1
- package/dist/types/types/ItemTypesCollection.d.ts +23 -21
- package/package.json +8 -6
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { ApiQueryConditionLinkedTo, ApiQueryConditionSubQuery } from '@rentman/backend-types';
|
|
2
2
|
import { ApiQuery, ApiQueryConditionComparator, ApiQueryWithConditions, ItemIdConversionMap, QueryParserBase } from '../internal';
|
|
3
|
-
|
|
3
|
+
declare type ReturnType = boolean;
|
|
4
|
+
export declare class QueryParserIdUpdater extends QueryParserBase<ReturnType> {
|
|
4
5
|
private itemIdConversionMap;
|
|
5
6
|
constructor(itemIdConversionMap: ItemIdConversionMap, query: ApiQuery);
|
|
6
|
-
protected parseEmptyQuery():
|
|
7
|
-
protected parseSubQuery<T extends ApiQueryConditionSubQuery>(_key: T['key'], subQuery: T['query']):
|
|
8
|
-
protected parseSubFieldQuery():
|
|
9
|
-
protected parseSearchQuery():
|
|
10
|
-
protected parseCustomQuery():
|
|
11
|
-
protected parseSimpleQuery<T extends ApiQueryConditionComparator>(_key: T['key'], value: T['value'], _comparator: T['comparator'], _not: T['not'], queryPart: T):
|
|
12
|
-
protected parseLinkedToQuery<T extends ApiQueryConditionLinkedTo>(_linkedTo: T['linkedTo'], query?: T['query']):
|
|
13
|
-
protected parseComplexQuery<T extends ApiQueryWithConditions>(conditions: T['conditions']):
|
|
7
|
+
protected parseEmptyQuery(): ReturnType;
|
|
8
|
+
protected parseSubQuery<T extends ApiQueryConditionSubQuery>(_key: T['key'], subQuery: T['query']): ReturnType;
|
|
9
|
+
protected parseSubFieldQuery(): ReturnType;
|
|
10
|
+
protected parseSearchQuery(): ReturnType;
|
|
11
|
+
protected parseCustomQuery(): ReturnType;
|
|
12
|
+
protected parseSimpleQuery<T extends ApiQueryConditionComparator>(_key: T['key'], value: T['value'], _comparator: T['comparator'], _not: T['not'], queryPart: T): ReturnType;
|
|
13
|
+
protected parseLinkedToQuery<T extends ApiQueryConditionLinkedTo>(_linkedTo: T['linkedTo'], query?: T['query']): ReturnType;
|
|
14
|
+
protected parseComplexQuery<T extends ApiQueryWithConditions>(conditions: T['conditions']): ReturnType;
|
|
14
15
|
private parseConditions;
|
|
15
16
|
}
|
|
17
|
+
export {};
|
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
import { ApiEnumItemType, ApiQuery, ItemId } from '@rentman/backend-types';
|
|
2
2
|
import { ApiRequestColumns, ApiRequestService, ChangesDeltaFactory, KeyService, PromiseInterface, PromiseLibraryInterface, RequestBufferResponse, RequestColumnExpansionFactory, ServerCache } from '../internal';
|
|
3
|
+
/**
|
|
4
|
+
* @description
|
|
5
|
+
* Allows to have finer control over the RequestBuffer and to merge specific requests
|
|
6
|
+
*
|
|
7
|
+
* @param maxTimeout The maximum timeout to wait (if expectedSize is not reached) before doing the query anyways.
|
|
8
|
+
* @param expectedSize The amount of items expected to be in the query, when this amount is reached the buffer will flush before the maxTimeout is reached.
|
|
9
|
+
*/
|
|
10
|
+
export declare type RequestBufferManagerPrioritySettings = {
|
|
11
|
+
maxTimeout: number;
|
|
12
|
+
expectedSize: number;
|
|
13
|
+
};
|
|
3
14
|
export declare class RequestBufferManager {
|
|
4
15
|
private promiseLibrary;
|
|
5
16
|
private apiRequestService;
|
|
@@ -8,13 +19,14 @@ export declare class RequestBufferManager {
|
|
|
8
19
|
private changesDeltaFactory;
|
|
9
20
|
private pendingBufferMap;
|
|
10
21
|
private pendingTrueBufferMap;
|
|
22
|
+
private pendingPriorityBufferMap;
|
|
11
23
|
private serverCache;
|
|
12
24
|
constructor(promiseLibrary: PromiseLibraryInterface, apiRequestService: ApiRequestService, requestColumnExpansionFactory: RequestColumnExpansionFactory, keyService: KeyService, changesDeltaFactory: ChangesDeltaFactory);
|
|
13
25
|
setServerCache(serverCache: ServerCache): void;
|
|
14
26
|
fetchByIds(itemType: ApiEnumItemType, itemIds: ItemId[], requestColumns: ApiRequestColumns): PromiseInterface<RequestBufferResponse>;
|
|
15
27
|
fetchById(itemType: ApiEnumItemType, itemId: ItemId, requestColumns: ApiRequestColumns): PromiseInterface<RequestBufferResponse>;
|
|
16
|
-
fetchByQuery(itemType: ApiEnumItemType, query: [ApiQuery, string],
|
|
17
|
-
|
|
28
|
+
fetchByQuery(itemType: ApiEnumItemType, query: [ApiQuery, string], requestColumns: ApiRequestColumns, priorityBufferSettings: RequestBufferManagerPrioritySettings | null): PromiseInterface<RequestBufferResponse>;
|
|
29
|
+
private constructPriorityBuffer;
|
|
18
30
|
private constructBuffer;
|
|
19
31
|
private _constructBuffer;
|
|
20
32
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ApiEnumItemType } from '@rentman/backend-types';
|
|
2
2
|
import { ApiFormatter, ApiRequestService, CachedQueryItem, ChangesDeltaFactory, ErrorHandlerInterface, PromiseLibraryInterface, QueryMatcherFactory, RequestBufferManager, RequestColumnExpansionFactory, SocketMessage, TransactionCacheFactory } from '../internal';
|
|
3
3
|
export declare type CachedQueryMatchingResult<ItemTypeType extends ApiEnumItemType> = {
|
|
4
|
-
fitting:
|
|
5
|
-
notfitting:
|
|
6
|
-
maybe:
|
|
4
|
+
fitting: CachedQueryItem<ItemTypeType>[];
|
|
5
|
+
notfitting: CachedQueryItem<ItemTypeType>[];
|
|
6
|
+
maybe: CachedQueryItem<ItemTypeType>[];
|
|
7
7
|
};
|
|
8
8
|
export declare class SocketMessageHandler {
|
|
9
9
|
private requestBufferManager;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ApiEnumItemType,
|
|
2
|
-
import { ApiRequestService, ApiResponse, ColumnHandler, ColumnUtil, EntryParentNull, ErrorHandlerInterface, PromiseInterface, PromiseLibraryInterface, RequestColumnExpansionFactory, Template, TemplateFactory } from '../internal';
|
|
1
|
+
import { ApiEnumItemType, ItemId } from '@rentman/backend-types';
|
|
2
|
+
import { ApiRequestService, ApiResponse, ColumnHandler, ColumnUtil, EntryParentNull, ErrorHandlerInterface, ItemTypeColumnIds, PromiseInterface, PromiseLibraryInterface, RequestColumnExpansionFactory, Template, TemplateFactory } from '../internal';
|
|
3
3
|
export declare class TemplateCache {
|
|
4
4
|
private columnUtil;
|
|
5
5
|
private promiseService;
|
|
@@ -56,7 +56,7 @@ export declare class TemplateCache {
|
|
|
56
56
|
* );
|
|
57
57
|
* ```
|
|
58
58
|
*/
|
|
59
|
-
fetchTemplate<ItemTypeType extends ApiEnumItemType, ColumnIds extends
|
|
59
|
+
fetchTemplate<ItemTypeType extends ApiEnumItemType, ColumnIds extends ItemTypeColumnIds<ItemTypeType> = ItemTypeColumnIds<ItemTypeType>>(itemType: ItemTypeType, itemId?: ItemId, templateOptions?: any, templateColumns?: any, entryParentOrParentItemType?: EntryParentNull | ApiEnumItemType): PromiseInterface<Template<ItemTypeType, ColumnIds>>;
|
|
60
60
|
private fetchTemplateById;
|
|
61
61
|
private constructTemplateBuffer;
|
|
62
62
|
}
|
|
@@ -5,10 +5,10 @@ export declare function hasProperties(object: any): boolean;
|
|
|
5
5
|
export declare function getFirstProperty(object: any): string | null;
|
|
6
6
|
export declare function inArray(needle: any, haystack: any): boolean;
|
|
7
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:
|
|
10
|
-
export declare function createPath<T>(object: any, path:
|
|
11
|
-
export declare function getPath(object: {}, path:
|
|
8
|
+
export declare function emptyArray(array: any[]): void;
|
|
9
|
+
export declare function pathExists(source: any, path: string[]): boolean;
|
|
10
|
+
export declare function createPath<T>(object: any, path: (number | string)[], defaults: any[]): T;
|
|
11
|
+
export declare function getPath(object: {}, path: (number | string)[], create?: boolean): any;
|
|
12
12
|
export declare function extend(dst: any, ...args: any[]): any;
|
|
13
13
|
export declare function merge(dst: any, ...args: any[]): any;
|
|
14
14
|
export declare function isObject(value: any): boolean;
|
|
@@ -75,7 +75,7 @@ export declare abstract class AbstractCache {
|
|
|
75
75
|
result: ChangesDeltaResult;
|
|
76
76
|
parentChangesDelta: ParentChangesDelta;
|
|
77
77
|
matchingDelta: ParentChangesDelta;
|
|
78
|
-
undoFunctions:
|
|
78
|
+
undoFunctions: ((changesDelta: InternalChangesDelta) => void)[];
|
|
79
79
|
};
|
|
80
80
|
/**
|
|
81
81
|
* @description
|
|
@@ -26,12 +26,8 @@ export declare abstract class CachedQueryHandlerBase {
|
|
|
26
26
|
/**
|
|
27
27
|
* Every time a cached query item is created, either 'resolve' or 'reject' has to be called on the cached query item.
|
|
28
28
|
*/
|
|
29
|
-
setCachedQuery<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, parsedQuery: CollectionQuery, requestColumns: ApiRequestColumns, itemEntries?:
|
|
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>>;
|
|
29
|
+
setCachedQuery<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, parsedQuery: CollectionQuery, requestColumns: ApiRequestColumns, itemEntries?: ItemEntry<ItemTypeType>[]): CachedQueryItem<ItemTypeType>;
|
|
30
|
+
getCachedQueryItems<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, queryString: string): undefined | ItemEntry<ItemTypeType>[];
|
|
35
31
|
getCachedQueryObjectsByItemType(itemType: ApiEnumItemType): CachedQueryItem[];
|
|
36
32
|
/**
|
|
37
33
|
* @description
|
|
@@ -48,21 +44,25 @@ export declare abstract class CachedQueryHandlerBase {
|
|
|
48
44
|
* Fetches collections linked to the passed parents
|
|
49
45
|
*/
|
|
50
46
|
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
47
|
/**
|
|
58
48
|
* @description
|
|
59
49
|
* Removes the passed {@link ItemId ItemIds} from the Transaction's query cache
|
|
60
50
|
*/
|
|
61
|
-
__removeItemEntriesFromCachedQueries<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, parsedQuery: CollectionQuery, itemEntries:
|
|
51
|
+
__removeItemEntriesFromCachedQueries<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, parsedQuery: CollectionQuery, itemEntries: ItemEntry<ItemTypeType>[]): ItemEntry<ItemTypeType>[];
|
|
62
52
|
/**
|
|
63
53
|
* @description
|
|
64
|
-
* Expands the option's {@link CollectionOptions.columns columns} with the columns required for the {@link
|
|
54
|
+
* Expands the option's {@link CollectionOptions.columns columns} with the columns required for the {@link CacheSyncer CacheSyncer} to function.
|
|
65
55
|
* 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
56
|
*/
|
|
67
57
|
expandColumnsWithQueryColumns(itemType: ApiEnumItemType, options: CollectionOptions, query: ApiQuery): void;
|
|
58
|
+
/**
|
|
59
|
+
* Every time a cached query item is created, either 'resolve' or 'reject' has to be called on the cached query item.
|
|
60
|
+
*/
|
|
61
|
+
protected constructCachedQuery<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, parsedQuery: CollectionQuery, itemEntries: ItemEntry<ItemTypeType>[], requestColumns: ApiRequestColumns): CachedQueryItem<ItemTypeType>;
|
|
62
|
+
/**
|
|
63
|
+
* @description
|
|
64
|
+
* Adds the passed {@link ItemEntry ItemEntries} to the Transaction's query cache,
|
|
65
|
+
* will skip the ItemEntry if the `skipEntryFilterFn` callback returns `true`
|
|
66
|
+
*/
|
|
67
|
+
protected __addItemEntriesToCachedQueries<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, parsedQuery: CollectionQuery, itemEntries: ItemEntry<ItemTypeType>[], skipEntryFilterFn: (temEntry: ItemEntry) => boolean): void;
|
|
68
68
|
}
|
|
@@ -43,12 +43,12 @@ export declare abstract class ItemHandlerBase {
|
|
|
43
43
|
* @description
|
|
44
44
|
* Fetches the ItemEntries for the given query, does not look in the cache, since we don't know which ItemIds belong to the query !
|
|
45
45
|
*/
|
|
46
|
-
abstract fetchItemEntriesByQuery<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, query: ApiQuery, entryOptions: ItemEntryOptions): PromiseInterface<
|
|
46
|
+
abstract fetchItemEntriesByQuery<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, query: ApiQuery, entryOptions: ItemEntryOptions): PromiseInterface<ItemEntry<ItemTypeType>[]>;
|
|
47
47
|
/**
|
|
48
48
|
* @description
|
|
49
49
|
* Fetches the ItemEntries for the given ItemIds
|
|
50
50
|
*/
|
|
51
|
-
abstract fetchItemEntries<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, itemIds: ItemId[], options: ItemEntryOptions): PromiseInterface<
|
|
51
|
+
abstract fetchItemEntries<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, itemIds: ItemId[], options: ItemEntryOptions): PromiseInterface<ItemEntry<ItemTypeType>[]>;
|
|
52
52
|
/**
|
|
53
53
|
* @description
|
|
54
54
|
* Fetches an ItemEntry with the given itemId
|
|
@@ -87,8 +87,8 @@ export declare abstract class ItemHandlerBase {
|
|
|
87
87
|
* Recursively fetches derived values as separate requests, instead of as columns of a primary item
|
|
88
88
|
* 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
|
|
89
89
|
*/
|
|
90
|
-
fetchDerivedValuesByColumn<ItemTypeType extends ApiEnumItemType>(itemEntries:
|
|
91
|
-
resolveDerivedValues<ItemTypeType extends ApiEnumItemType>(itemEntries:
|
|
90
|
+
fetchDerivedValuesByColumn<ItemTypeType extends ApiEnumItemType>(itemEntries: ItemEntry<ItemTypeType>[], rootColumn: ColumnInfo<ItemTypeType>, changesDelta?: ChangesDeltaBase): PromiseInterface<void | ItemEntry<ItemTypeType>[]>;
|
|
91
|
+
resolveDerivedValues<ItemTypeType extends ApiEnumItemType>(itemEntries: ItemEntry<ItemTypeType>[], columns: ColumnInfo<ItemTypeType>[], changesDelta?: ChangesDeltaBase): PromiseInterface<ItemEntry<ItemTypeType>[]>;
|
|
92
92
|
/**
|
|
93
93
|
* @description
|
|
94
94
|
* Creates a new {@link ItemEntry ItemEntry} from the passed {@link ChangesDeltaItemCreateDelta ChangesDeltaItemCreateDelta} and stores it in this transaction's {@link ItemCache ItemCache}
|
|
@@ -10,7 +10,7 @@ export declare class ServerCachedQueryHandler extends CachedQueryHandlerBase {
|
|
|
10
10
|
constructor(columnSubsetCacheFactory: ColumnSubsetCacheFactory, requestBufferManager: RequestBufferManager, requestColumnExpansionFactory: RequestColumnExpansionFactory, apiRequestService: ApiRequestService, collectionEntryService: CollectionEntryService, errorHandler: ErrorHandlerInterface, itemHandler: ServerItemHandler, promiseService: PromiseLibraryInterface, columnUtil: ColumnUtil, transaction: ServerCache);
|
|
11
11
|
__fetchCachedQueryItem<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, options: CollectionOptions): PromiseInterface<CachedQueryItem<ItemTypeType>>;
|
|
12
12
|
__fetchLinkedCachedQueryItems<ItemTypeType extends ApiEnumItemType>(parentType: ApiEnumItemType, parentIdArray: ItemId[] | (() => ItemId[]), itemType: ItemTypeType, options: CollectionOptions): PromiseInterface<ParentIdMap<CachedQueryItem<ItemTypeType>>>;
|
|
13
|
-
__addItemEntriesToCachedQueries<ItemTypeType extends ApiEnumItemType = any>(itemType: ItemTypeType, parsedQuery: CollectionQuery, itemEntries:
|
|
13
|
+
__addItemEntriesToCachedQueries<ItemTypeType extends ApiEnumItemType = any>(itemType: ItemTypeType, parsedQuery: CollectionQuery, itemEntries: ItemEntry<ItemTypeType>[]): void;
|
|
14
14
|
/**
|
|
15
15
|
* @description
|
|
16
16
|
* Expands the columns of the items in the cached query
|
|
@@ -18,9 +18,9 @@ export declare class ServerItemHandler extends ItemHandlerBase {
|
|
|
18
18
|
processItemEntryChanges<ItemTypeType extends ApiEnumItemType = any>(itemEntryChangesTuple: ChangesDeltaItemUpdateDelta<ItemTypeType>, _isCalledAfterSocketUpdate?: boolean, _createItemChangesIfNoneExist?: boolean): ProcessItemEntryChangesResult<ItemTypeType>;
|
|
19
19
|
copyTransactionItemEntryChanges<ItemTypeType extends ApiEnumItemType>(itemEntryChanges: TransactionItemEntryChanges<ItemTypeType>, entry: ItemEntry<ItemTypeType>): ItemEntryChanges<ItemTypeType>;
|
|
20
20
|
fetchItemEntry<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, itemId: ItemId, options: ItemEntryOptions): PromiseInterface<ItemEntry<ItemTypeType>>;
|
|
21
|
-
fetchItemEntriesByQuery<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, query: ApiQuery, entryOptions: ItemEntryOptions): PromiseInterface<
|
|
22
|
-
extendItemEntries<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, itemEntries:
|
|
23
|
-
fetchItemEntries<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, itemIds: ItemId[], options: ItemEntryOptions): PromiseInterface<
|
|
21
|
+
fetchItemEntriesByQuery<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, query: ApiQuery, entryOptions: ItemEntryOptions): PromiseInterface<ItemEntry<ItemTypeType>[]>;
|
|
22
|
+
extendItemEntries<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, itemEntries: ItemEntry<ItemTypeType>[], newColumns: ApiRequestColumns): PromiseInterface<ItemEntry<ItemTypeType>[]>;
|
|
23
|
+
fetchItemEntries<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, itemIds: ItemId[], options: ItemEntryOptions): PromiseInterface<ItemEntry<ItemTypeType>[]>;
|
|
24
24
|
/**
|
|
25
25
|
* @description
|
|
26
26
|
* Fetches the data for the ItemEntries linked to the parent Items
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ApiEnumItemType,
|
|
2
|
-
import { AbstractCache, AbstractCacheDependencyInterface, ApiQuery, ApiRequestColumn, ApiRequestColumns, CachedQueryItem, CachedQueryItemTree, ChangesDelta, ChangesDeltaResult, ChildCollectionOptions, ChildCollectionResources, ChildCollectionResourcesNull, CollectionDefinition, CollectionOptionsInterface, CollectionQuery, CollectionResource, CollectionResourceParentIdMap, ConversionMap, CreateRequestParameterMap, DeregFunction, EntryParentNull, FieldChangeCallback, FieldMap, InternalChangesDelta, ItemEntry, ItemEntryOptions, ItemIdConversionMap, ItemOptionsInterface, ItemResource, ItemResourcesItemTypeMap, ItemTypeMap, LinkCollectionDefinition, ModuleChangesCompilationResult, OnAfterCreateCallback, ParentChangesDelta, ParentItemMap, PromiseInterface, RmCore, ServerCache, TransactionCacheCallbackCondition, TransactionCacheCallbackType, TransactionCachedQueryHandler, TransactionCollectionHandler, TransactionEventHandler, TransactionItemEntryChangesTuple, TransactionItemHandler, TransactionOptions, TransactionValidatorFactory } from '../../../internal';
|
|
1
|
+
import { ApiEnumItemType, ItemId } from '@rentman/backend-types';
|
|
2
|
+
import { AbstractCache, AbstractCacheDependencyInterface, ApiQuery, ApiRequestColumn, ApiRequestColumns, CachedQueryItem, CachedQueryItemTree, ChangesDelta, ChangesDeltaResult, ChildCollectionOptions, ChildCollectionResources, ChildCollectionResourcesNull, CollectionDefinition, CollectionOptionsInterface, CollectionQuery, CollectionResource, CollectionResourceParentIdMap, ConversionMap, CreateRequestParameterMap, DeregFunction, EntryParentNull, FieldChangeCallback, FieldMap, InternalChangesDelta, ItemEntry, ItemEntryOptions, ItemIdConversionMap, ItemOptionsInterface, ItemResource, ItemResourcesItemTypeMap, ItemTypeColumnIds, ItemTypeMap, LinkCollectionDefinition, ModuleChangesCompilationResult, OnAfterCreateCallback, ParentChangesDelta, ParentItemMap, PromiseInterface, RmCore, ServerCache, TransactionCacheCallbackCondition, TransactionCacheCallbackType, TransactionCachedQueryHandler, TransactionCollectionHandler, TransactionEventHandler, TransactionItemEntryChangesTuple, TransactionItemHandler, TransactionOptions, TransactionValidatorFactory } from '../../../internal';
|
|
3
3
|
declare type ItemResourceLinks<ItemTypeType extends ApiEnumItemType> = {
|
|
4
4
|
main: ItemResource<ItemTypeType>;
|
|
5
5
|
linked: ItemResourcesItemTypeMap;
|
|
@@ -46,7 +46,6 @@ export declare class TransactionCache extends AbstractCache {
|
|
|
46
46
|
};
|
|
47
47
|
};
|
|
48
48
|
};
|
|
49
|
-
get isValid(): boolean;
|
|
50
49
|
/**
|
|
51
50
|
* @description
|
|
52
51
|
* Stores the 'root' {@link ItemEntry ItemEntry}, this {@link ItemEntry ItemEntry} can be used as request parent to store the whole transaction at once
|
|
@@ -81,16 +80,17 @@ export declare class TransactionCache extends AbstractCache {
|
|
|
81
80
|
readonly eventHandler: TransactionEventHandler;
|
|
82
81
|
private readonly validator?;
|
|
83
82
|
private readonly options;
|
|
84
|
-
private _isValid;
|
|
85
83
|
private historyStep;
|
|
86
84
|
private undoDeltas;
|
|
87
85
|
private appliedDeltas;
|
|
86
|
+
private _isValid;
|
|
88
87
|
constructor(dependencies: AbstractCacheDependencyInterface, core: RmCore, parent: AbstractCache,
|
|
89
88
|
/**
|
|
90
89
|
* @description
|
|
91
90
|
* For debugging purposes
|
|
92
91
|
*/
|
|
93
92
|
id?: string | undefined, validatorFactory?: TransactionValidatorFactory, options?: Partial<TransactionOptions>);
|
|
93
|
+
get isValid(): boolean;
|
|
94
94
|
undo(): ReturnType<UndoFunction>;
|
|
95
95
|
redo(): ReturnType<TransactionCache['applyChangesDelta']>;
|
|
96
96
|
createChild(id?: string, validatorFactory?: TransactionValidatorFactory, options?: TransactionOptions): TransactionCache;
|
|
@@ -163,6 +163,7 @@ export declare class TransactionCache extends AbstractCache {
|
|
|
163
163
|
* @description
|
|
164
164
|
* Traverses the transaction chain and returns the changes of the item on the first transaction
|
|
165
165
|
*
|
|
166
|
+
* @param itemEntryId The entry ID of the ItemEntry you want to get the changes from
|
|
166
167
|
* @param copyFields If set, will call {@link ApiFormatter.copyFields ApiFormatter.copyFields}, otherwise just returns the object
|
|
167
168
|
*/
|
|
168
169
|
getItemChangesRecursively<ItemTypeType extends ApiEnumItemType>(itemEntryId: ItemEntry<ItemTypeType>['id'], copyFields?: boolean): FieldMap<ItemTypeType>;
|
|
@@ -179,7 +180,7 @@ export declare class TransactionCache extends AbstractCache {
|
|
|
179
180
|
* @description
|
|
180
181
|
* Returns whether or not the {@link TransactionCache.rootItem rootItem} is uses locks
|
|
181
182
|
*/
|
|
182
|
-
isLockable():
|
|
183
|
+
isLockable(rootItem?: ItemEntry | undefined): rootItem is ItemEntry;
|
|
183
184
|
/**
|
|
184
185
|
* @description
|
|
185
186
|
* Saves the transaction, this has a different effect depending on the transaction's parent.
|
|
@@ -202,7 +203,7 @@ export declare class TransactionCache extends AbstractCache {
|
|
|
202
203
|
* @description
|
|
203
204
|
* Removes an {@link ItemEntry ItemEntry} from the {@link TransactionCache TransactionCache} which means that changes on this entry will no longer be tracked.
|
|
204
205
|
*/
|
|
205
|
-
clearItemEntry(itemEntry: ItemEntry
|
|
206
|
+
clearItemEntry(itemEntry: ItemEntry): void;
|
|
206
207
|
/**
|
|
207
208
|
* @description
|
|
208
209
|
* Adds a callback that will fire before the transaction is saved, rejecting this callback will prevent the transaction from saving
|
|
@@ -232,7 +233,7 @@ export declare class TransactionCache extends AbstractCache {
|
|
|
232
233
|
*/
|
|
233
234
|
getLinkCollections<ItemTypeType extends ApiEnumItemType>(linkType: ApiEnumItemType, linkIdArray: ItemId[], itemType: ItemTypeType, options: CollectionOptionsInterface<ItemTypeType>): PromiseInterface<CollectionResourceParentIdMap<ItemTypeType>>;
|
|
234
235
|
getCollectionFromDef<ItemTypeType extends ApiEnumItemType>(definition: CollectionDefinition<ItemTypeType>): PromiseInterface<CollectionResource<ItemTypeType>>;
|
|
235
|
-
getCollection<ItemTypeType extends ApiEnumItemType, ColumnIds extends
|
|
236
|
+
getCollection<ItemTypeType extends ApiEnumItemType, ColumnIds extends ItemTypeColumnIds<ItemTypeType> = ItemTypeColumnIds<ItemTypeType>>(itemType: ItemTypeType, options: CollectionOptionsInterface<ItemTypeType>): PromiseInterface<CollectionResource<ItemTypeType, ColumnIds>>;
|
|
236
237
|
getCollectionDef<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, options: CollectionOptionsInterface<ItemTypeType>): CollectionDefinition<ItemTypeType>;
|
|
237
238
|
getLinkCollectionsDef<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, linkField: string, options: CollectionOptionsInterface<ItemTypeType>): LinkCollectionDefinition<ItemTypeType>;
|
|
238
239
|
/**
|
|
@@ -253,19 +254,19 @@ export declare class TransactionCache extends AbstractCache {
|
|
|
253
254
|
* @description
|
|
254
255
|
* Fetches multiple items with their respective changes of the current {@link TransactionCache transaction}
|
|
255
256
|
*/
|
|
256
|
-
getItemsByQuery<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, query: ApiQuery, options?: Partial<ItemEntryOptions>): PromiseInterface<
|
|
257
|
+
getItemsByQuery<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, query: ApiQuery, options?: Partial<ItemEntryOptions>): PromiseInterface<ItemResource<ItemTypeType>[]>;
|
|
257
258
|
/**
|
|
258
259
|
* @description
|
|
259
260
|
* Fetches multiple items with their respective changes of the current {@link TransactionCache transaction}
|
|
260
261
|
*/
|
|
261
|
-
getItemsById<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, itemIds: ItemId[], options?: Partial<ItemEntryOptions>): PromiseInterface<
|
|
262
|
+
getItemsById<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, itemIds: ItemId[], options?: Partial<ItemEntryOptions>): PromiseInterface<ItemResource<ItemTypeType>[]>;
|
|
262
263
|
/**
|
|
263
264
|
* @description
|
|
264
265
|
* Fetches the item with the changes of the current {@link TransactionCache transaction}
|
|
265
266
|
*
|
|
266
267
|
* @param isRoot Sets the item as the root item of the transaction, new items will be linked to this item (if there's a connection in the LinkTree)
|
|
267
268
|
*/
|
|
268
|
-
getItemById<ItemTypeType extends ApiEnumItemType, ColumnIds extends
|
|
269
|
+
getItemById<ItemTypeType extends ApiEnumItemType, ColumnIds extends ItemTypeColumnIds<ItemTypeType> = ItemTypeColumnIds<ItemTypeType>>(itemType: ItemTypeType, itemId: ItemId, options?: Partial<ItemEntryOptions>, isRoot?: boolean): PromiseInterface<ItemResource<ItemTypeType, ColumnIds>>;
|
|
269
270
|
/**
|
|
270
271
|
* @description
|
|
271
272
|
* Fetches the title of an item, does not create an {@link ItemResource ItemResource}
|
|
@@ -298,10 +299,11 @@ export declare class TransactionCache extends AbstractCache {
|
|
|
298
299
|
*/
|
|
299
300
|
getDelta(): InternalChangesDelta;
|
|
300
301
|
createItemResource<ItemTypeType extends ApiEnumItemType>(itemEntry: ItemEntry<ItemTypeType>, childCollectionMap?: ChildCollectionResourcesNull, isNew?: boolean): ItemResource<ItemTypeType>;
|
|
301
|
-
createItemResources<ItemTypeType extends ApiEnumItemType, ColumnIds extends
|
|
302
|
+
createItemResources<ItemTypeType extends ApiEnumItemType, ColumnIds extends ItemTypeColumnIds<ItemTypeType>>(itemEntries: ItemEntry<ItemTypeType>[], childCollectionResourceMap?: ChildCollectionResourcesNull): ItemResource<ItemTypeType, ColumnIds>[];
|
|
302
303
|
processLinkedItems<ItemTypeType extends ApiEnumItemType>(linkedEntries: ItemTypeMap<ItemEntry[]>): ItemResourcesItemTypeMap<ItemResource<ItemTypeType>>;
|
|
303
|
-
createCollectionResource<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, options: CollectionOptionsInterface<ItemTypeType>, initialEntries:
|
|
304
|
+
createCollectionResource<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, options: CollectionOptionsInterface<ItemTypeType>, initialEntries: ItemEntry<ItemTypeType>[], childCollectionResourceMap?: ParentItemMap<CollectionResource> | null): CollectionResource<ItemTypeType>;
|
|
304
305
|
createChildCollectionResources(parentType: ApiEnumItemType, options: ChildCollectionOptions, cachedQueryItems: ParentItemMap<CachedQueryItemTree>): ChildCollectionResources;
|
|
306
|
+
clearItemError(itemEntryId?: ItemEntry['id'], columnId?: string, errorKey?: string): void;
|
|
305
307
|
private createChildCollectionResource;
|
|
306
308
|
/**
|
|
307
309
|
* @description
|
|
@@ -309,7 +311,6 @@ export declare class TransactionCache extends AbstractCache {
|
|
|
309
311
|
*/
|
|
310
312
|
private expandItemsFromDelta;
|
|
311
313
|
private clearGlobalError;
|
|
312
|
-
clearItemError(itemEntryId?: ItemEntry['id'], columnId?: string, errorKey?: string): void;
|
|
313
314
|
private handleRemovedItemEntry;
|
|
314
315
|
private handleCascadingDeletes;
|
|
315
316
|
private cascadeDeleteByItemType;
|
|
@@ -14,7 +14,7 @@ export declare class TransactionCachedQueryHandler extends CachedQueryHandlerBas
|
|
|
14
14
|
updateLocalItemIdReferences(conversionMap: ItemIdConversionMap): void;
|
|
15
15
|
__fetchCachedQueryItem<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, options: CollectionOptions, batchedLinkedToQuery?: CollectionQuery): PromiseInterface<CachedQueryItem<ItemTypeType>>;
|
|
16
16
|
__expandCachedQuery<ItemTypeType extends ApiEnumItemType>(cachedQuery: CachedQueryItem<ItemTypeType>, newColumns: ApiRequestColumns, force?: boolean): PromiseInterface<CachedQueryItem<ItemTypeType>>;
|
|
17
|
-
__addItemEntriesToCachedQueries<ItemTypeType extends ApiEnumItemType = any>(itemType: ItemTypeType, parsedQuery: CollectionQuery, itemEntries:
|
|
17
|
+
__addItemEntriesToCachedQueries<ItemTypeType extends ApiEnumItemType = any>(itemType: ItemTypeType, parsedQuery: CollectionQuery, itemEntries: ItemEntry<ItemTypeType>[]): void;
|
|
18
18
|
/**
|
|
19
19
|
* @remark
|
|
20
20
|
* todo not only linkedTo should be checked, but it should check if there's a local ID anywhere in the query
|
|
@@ -22,13 +22,15 @@ export declare class TransactionCachedQueryHandler extends CachedQueryHandlerBas
|
|
|
22
22
|
*/
|
|
23
23
|
isLocal(options: CollectionOptions | ItemEntryOptions, query: ApiQuery): boolean;
|
|
24
24
|
__fetchItemEntriesByQueryData<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, options: CollectionOptions<ItemTypeType>, columnSubsetCache: ColumnSubsetCache<ItemTypeType>, collectionQuery: CollectionQuery, batchedLinkedToQuery?: CollectionQuery): PromiseInterface<CachedQueryItem<ItemTypeType>>;
|
|
25
|
+
__fetchLinkedCachedQueryItems<ItemTypeType extends ApiEnumItemType>(parentType: ApiEnumItemType, parentIdArray: ItemId[] | (() => ItemId[]), itemType: ItemTypeType, options: CollectionOptions): PromiseInterface<ParentIdMap<CachedQueryItem<ItemTypeType>>>;
|
|
26
|
+
__fetchParentCachedQueryItem<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, options: CollectionOptions, batchedLinkToQuery?: CollectionQuery): PromiseInterface<CachedQueryItemTree<ItemTypeType>>;
|
|
27
|
+
__fetchChildCachedQueryItems(parentType: ApiEnumItemType, parentIds: ItemId[], childCollectionOptions: ChildCollectionOptions): PromiseInterface<ParentItemMap<CachedQueryItemTree>>;
|
|
25
28
|
private resolveLocalCachedQueryItem;
|
|
26
29
|
/**
|
|
30
|
+
* @param itemType - The itemType of the entries you want to expand
|
|
27
31
|
* @param itemEntries - All item entries passed to this function should be local.
|
|
32
|
+
* @param requestColumns - Columns to expand with
|
|
28
33
|
*/
|
|
29
34
|
private expandLocalItemEntries;
|
|
30
35
|
private syncCachedQueryWithLocalItems;
|
|
31
|
-
__fetchLinkedCachedQueryItems<ItemTypeType extends ApiEnumItemType>(parentType: ApiEnumItemType, parentIdArray: ItemId[] | (() => ItemId[]), itemType: ItemTypeType, options: CollectionOptions): PromiseInterface<ParentIdMap<CachedQueryItem<ItemTypeType>>>;
|
|
32
|
-
__fetchParentCachedQueryItem<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, options: CollectionOptions, batchedLinkToQuery?: CollectionQuery): PromiseInterface<CachedQueryItemTree<ItemTypeType>>;
|
|
33
|
-
__fetchChildCachedQueryItems(parentType: ApiEnumItemType, parentIds: ItemId[], childCollectionOptions: ChildCollectionOptions): PromiseInterface<ParentItemMap<CachedQueryItemTree>>;
|
|
34
36
|
}
|
|
@@ -17,8 +17,8 @@ export declare class TransactionCollectionHandler {
|
|
|
17
17
|
clearResource(resource: CollectionResource): void;
|
|
18
18
|
/**
|
|
19
19
|
* @description
|
|
20
|
-
* Updates the parents of the passed {@link ItemEntry ItemEntries}, returns `void` because you should use the {@link
|
|
20
|
+
* Updates the parents of the passed {@link ItemEntry ItemEntries}, returns `void` because you should use the {@link CollectionOptions.onAdd onAdd} and {@link CollectionOptions.onRemove onRemove} callbacks
|
|
21
21
|
*/
|
|
22
|
-
moveItems<CollectionEntryType extends CollectionEntry>(sourceCollectionEntry: CollectionEntryType, destinationCollectionEntry: CollectionEntryType, itemEntries:
|
|
22
|
+
moveItems<CollectionEntryType extends CollectionEntry>(sourceCollectionEntry: CollectionEntryType, destinationCollectionEntry: CollectionEntryType, itemEntries: ItemEntry<CollectionEntryType['itemType']>[]): void;
|
|
23
23
|
cloneCollectionEntry<CollectionEntryType extends CollectionEntry>(changesDelta: ChangesDelta, sourceEntry: CollectionEntryType, conversionMap?: ItemIdConversionMap, modifyFieldsCallback?: ModifyFieldsCallback): void;
|
|
24
24
|
}
|
|
@@ -57,25 +57,24 @@ export declare class TransactionItemHandler extends ItemHandlerBase {
|
|
|
57
57
|
* @param itemEntryChangesTuple The changes tuple
|
|
58
58
|
* @param isCalledAfterSocketUpdate Indicates that the change is done by a different user
|
|
59
59
|
* @param createItemChangesIfNoneExist Is `true` when called from `applyChangesDelta`, we can assume that when you call `applyChangesDelta` with updates that aren't on the transaction yet you want to add those
|
|
60
|
-
* @param changesDelta Will be used to check which items should/shouldn't be updated when updating local ID references
|
|
61
60
|
*
|
|
62
61
|
* @returns
|
|
63
62
|
* The previous changes {@link FieldMap FieldMap}, returns `null` when the item was not cached or no fields were changed.
|
|
64
63
|
*/
|
|
65
64
|
processItemEntryChanges<ItemTypeType extends ApiEnumItemType = any>(itemEntryChangesTuple: ChangesDeltaItemUpdateDelta<ItemTypeType>, isCalledAfterSocketUpdate?: boolean, createItemChangesIfNoneExist?: boolean): ProcessItemEntryChangesResult<ItemTypeType>;
|
|
66
|
-
cloneItemEntries<ItemTypeType extends ApiEnumItemType>(changesDelta: ChangesDelta, itemEntries:
|
|
65
|
+
cloneItemEntries<ItemTypeType extends ApiEnumItemType>(changesDelta: ChangesDelta, itemEntries: ItemEntry<ItemTypeType>[], conversionMap?: ItemIdConversionMap, modifyFieldsCallback?: ModifyFieldsCallback): ItemId[];
|
|
67
66
|
cloneItemEntry<ItemTypeType extends ApiEnumItemType>(changesDelta: ChangesDelta, sourceEntry: ItemEntry<ItemTypeType>, conversionMap?: ItemIdConversionMap, modifyFieldsCallback?: ModifyFieldsCallback): ItemId;
|
|
68
|
-
fetchItemEntriesByQuery<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, query: ApiQuery, entryOptions: ItemEntryOptions): PromiseInterface<
|
|
67
|
+
fetchItemEntriesByQuery<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, query: ApiQuery, entryOptions: ItemEntryOptions): PromiseInterface<ItemEntry<ItemTypeType>[]>;
|
|
69
68
|
fetchItemEntry<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, itemId: ItemId, options: ItemEntryOptions, isRoot?: boolean): PromiseInterface<ItemEntry<ItemTypeType>>;
|
|
70
69
|
/**
|
|
71
70
|
* @description
|
|
72
71
|
* Fetches a template and creates a new {@link ItemEntry ItemEntry}, will error if the ItemEntry with the given ItemId already exists
|
|
73
72
|
*/
|
|
74
73
|
fetchNewItemEntry<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, itemId: ItemId, options: ItemEntryOptions, isRoot?: boolean): PromiseInterface<ChangesDeltaResult>;
|
|
75
|
-
fetchItemEntries<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, itemIds: ItemId[], options: ItemEntryOptions): PromiseInterface<
|
|
74
|
+
fetchItemEntries<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, itemIds: ItemId[], options: ItemEntryOptions): PromiseInterface<ItemEntry<ItemTypeType>[]>;
|
|
76
75
|
fetchTitle(itemType: ApiEnumItemType, itemId: ItemId): PromiseInterface<string>;
|
|
77
76
|
resolveLocalItemEntry<ItemTypeType extends ApiEnumItemType>(changesDelta: ChangesDelta, itemEntry: ItemEntry<ItemTypeType>, columnSubsetCache: ColumnSubsetCache<ItemTypeType>, options: ItemEntryOptions): PromiseInterface<ItemEntry<ItemTypeType>>;
|
|
78
|
-
expandLocalItemEntries<ItemTypeType extends ApiEnumItemType>(changesDelta: ChangesDeltaBase, itemType: ItemTypeType, itemEntries:
|
|
77
|
+
expandLocalItemEntries<ItemTypeType extends ApiEnumItemType>(changesDelta: ChangesDeltaBase, itemType: ItemTypeType, itemEntries: ItemEntry<ItemTypeType>[], requestColumns: ApiRequestColumns, responseColumns: ResponseColumnItemTypeMap): PromiseInterface<ItemEntry<ItemTypeType>[]>;
|
|
79
78
|
/**
|
|
80
79
|
* @description
|
|
81
80
|
* Fetches the data for the passed ItemType/ItemId/columns, is able to __fetchCachedQueryItem non-local derived values.
|
|
@@ -83,8 +82,8 @@ export declare class TransactionItemHandler extends ItemHandlerBase {
|
|
|
83
82
|
* @remark
|
|
84
83
|
* Assumes the the ItemEntry with the given ItemType-ItemId is already cached
|
|
85
84
|
*/
|
|
86
|
-
fetchLocalItemEntryData<ItemTypeType extends ApiEnumItemType>(changesDelta: ChangesDelta, itemType: ItemTypeType, itemId: ItemId, columnSubsetCache: ColumnSubsetCache<ItemTypeType>, options: ItemEntryOptions): PromiseInterface<
|
|
87
|
-
fetchLocalItemEntries<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, itemIds: ItemId[], options: ItemEntryOptions): PromiseInterface<
|
|
85
|
+
fetchLocalItemEntryData<ItemTypeType extends ApiEnumItemType>(changesDelta: ChangesDelta, itemType: ItemTypeType, itemId: ItemId, columnSubsetCache: ColumnSubsetCache<ItemTypeType>, options: ItemEntryOptions): PromiseInterface<ItemEntry<ItemTypeType>>;
|
|
86
|
+
fetchLocalItemEntries<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, itemIds: ItemId[], options: ItemEntryOptions): PromiseInterface<ItemEntry<ItemTypeType>[]>;
|
|
88
87
|
private getColumnDifference;
|
|
89
88
|
private expandLocalItemEntry;
|
|
90
89
|
private getLocalValues;
|
package/dist/types/core.d.ts
CHANGED
|
@@ -41,5 +41,5 @@ export declare class RmCore {
|
|
|
41
41
|
constructor(_apiRequestService: ApiRequestServiceInterface, authInterface: AuthInterface, errorHandler: ErrorHandlerInterface, exceptionHandler: ExceptionHandlerInterface, promiseLibrary: PromiseLibraryInterface, linkTreeService: LinkTreeServiceInterface);
|
|
42
42
|
}
|
|
43
43
|
export declare function noop(): void;
|
|
44
|
-
export declare function identity(value:
|
|
44
|
+
export declare function identity<T extends any>(value: T): T;
|
|
45
45
|
export declare function nullFunction(): null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ApiFormatter, ApiResponseProcessor } from '../internal';
|
|
1
|
+
import { ApiFormatter, ApiResponse, ApiResponseProcessor } from '../internal';
|
|
2
2
|
export declare class ApiResponseProcessorFactory {
|
|
3
3
|
private apiFormatter;
|
|
4
4
|
constructor(apiFormatter: ApiFormatter);
|
|
5
|
-
construct(response:
|
|
5
|
+
construct(response: ApiResponse): ApiResponseProcessor;
|
|
6
6
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ApiEnumItemType
|
|
2
|
-
import { CollectionEntry, CollectionEntryService, CollectionOptionsInterface, ColumnCache, ColumnSetFactory, KeyService, QueryService } from '../internal';
|
|
1
|
+
import { ApiEnumItemType } from '@rentman/backend-types';
|
|
2
|
+
import { CollectionEntry, CollectionEntryService, CollectionOptionsInterface, ColumnCache, ColumnSetFactory, ItemTypeColumnIds, KeyService, QueryService } from '../internal';
|
|
3
3
|
export declare class CollectionEntryFactory {
|
|
4
4
|
private collectionEntryService;
|
|
5
5
|
private columnSetFactory;
|
|
@@ -7,5 +7,5 @@ export declare class CollectionEntryFactory {
|
|
|
7
7
|
private queryService;
|
|
8
8
|
private columnCache;
|
|
9
9
|
constructor(collectionEntryService: CollectionEntryService, columnSetFactory: ColumnSetFactory, keyService: KeyService, queryService: QueryService, columnCache: ColumnCache);
|
|
10
|
-
construct<ItemTypeType extends ApiEnumItemType, ColumnIds extends
|
|
10
|
+
construct<ItemTypeType extends ApiEnumItemType, ColumnIds extends ItemTypeColumnIds<ItemTypeType> = ItemTypeColumnIds<ItemTypeType>>(itemType: ItemTypeType, options: CollectionOptionsInterface<ItemTypeType, ColumnIds>): CollectionEntry<ItemTypeType, ColumnIds>;
|
|
11
11
|
}
|
|
@@ -14,5 +14,5 @@ export declare class CollectionResourceFactory {
|
|
|
14
14
|
/**
|
|
15
15
|
* @internal
|
|
16
16
|
*/
|
|
17
|
-
construct<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, options: CollectionOptions<ItemTypeType>, transaction: TransactionCache, initialItemEntries:
|
|
17
|
+
construct<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, options: CollectionOptions<ItemTypeType>, transaction: TransactionCache, initialItemEntries: ItemEntry<ItemTypeType>[], childCollectionResourceMap: ParentItemMap<CollectionResource> | null): CollectionResource<ItemTypeType>;
|
|
18
18
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ApiEnumItemType, ApiFields, GetColumnType } from '@rentman/backend-types';
|
|
2
|
-
import { ColumnInfo, RootColumnMap } from '../internal';
|
|
2
|
+
import { ColumnInfo, ItemTypeColumnIds, RootColumnMap } from '../internal';
|
|
3
3
|
export declare class ColumnInfoFactory {
|
|
4
4
|
constructor();
|
|
5
5
|
construct<ItemTypeType extends ApiEnumItemType = any, ColumnId extends keyof ApiFields[ItemTypeType] = any>(apiColumn: GetColumnType<ItemTypeType, ColumnId>, parent: ColumnInfo | null): ColumnInfo<ItemTypeType>;
|
|
6
|
-
constructFromRootMap<ItemTypeType extends ApiEnumItemType = any, ColumnIds extends
|
|
6
|
+
constructFromRootMap<ItemTypeType extends ApiEnumItemType = any, ColumnIds extends ItemTypeColumnIds<ItemTypeType> = any>(rootColumnMap: RootColumnMap<ItemTypeType, ColumnIds>, parent?: ColumnInfo | null): ColumnInfo<ItemTypeType, ColumnIds[number]>[];
|
|
7
7
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ApiEnumItemType
|
|
2
|
-
import { ApiFormatter, ChildCollectionResourcesNull, ColumnUtil, ErrorHandlerInterface, ExceptionHandlerInterface, ItemEntry, ItemResource, PromiseLibraryInterface, TransactionCache } from '../internal';
|
|
1
|
+
import { ApiEnumItemType } from '@rentman/backend-types';
|
|
2
|
+
import { ApiFormatter, ChildCollectionResourcesNull, ColumnUtil, ErrorHandlerInterface, ExceptionHandlerInterface, ItemEntry, ItemResource, ItemTypeColumnIds, PromiseLibraryInterface, TransactionCache } from '../internal';
|
|
3
3
|
export declare class ItemResourceFactory {
|
|
4
4
|
apiFormatter: ApiFormatter;
|
|
5
5
|
errorHandler: ErrorHandlerInterface;
|
|
@@ -7,5 +7,5 @@ export declare class ItemResourceFactory {
|
|
|
7
7
|
exceptionHandler: ExceptionHandlerInterface;
|
|
8
8
|
columnUtil: ColumnUtil;
|
|
9
9
|
constructor(apiFormatter: ApiFormatter, errorHandler: ErrorHandlerInterface, promiseService: PromiseLibraryInterface, exceptionHandler: ExceptionHandlerInterface, columnUtil: ColumnUtil);
|
|
10
|
-
construct<ItemTypeType extends ApiEnumItemType, ColumnIds extends
|
|
10
|
+
construct<ItemTypeType extends ApiEnumItemType, ColumnIds extends ItemTypeColumnIds<ItemTypeType> = ItemTypeColumnIds<ItemTypeType>, Children extends ChildCollectionResourcesNull = any>(itemEntry: ItemEntry<ItemTypeType>, transaction: TransactionCache, childCollections: Children, isNew?: boolean): ItemResource<ItemTypeType, ColumnIds, Children>;
|
|
11
11
|
}
|
|
@@ -3,5 +3,5 @@ import { ApiFormatter, EntryParentNull, FieldMap, QueryMatcher } from '../intern
|
|
|
3
3
|
export declare class QueryMatcherFactory {
|
|
4
4
|
private apiFormatter;
|
|
5
5
|
constructor(apiFormatter: ApiFormatter);
|
|
6
|
-
construct(itemType: ApiEnumItemType, fields: FieldMap, parent: EntryParentNull): QueryMatcher;
|
|
6
|
+
construct(itemType: ApiEnumItemType, fields: FieldMap | [FieldMap, FieldMap], parent: EntryParentNull): QueryMatcher;
|
|
7
7
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { PromiseInterface } from '../internal';
|
|
2
2
|
export interface Deferred<T> {
|
|
3
|
+
promise: PromiseInterface<T>;
|
|
3
4
|
resolve(value?: T | PromiseInterface<T>): void;
|
|
4
5
|
reject(reason?: any): void;
|
|
5
|
-
promise: PromiseInterface<T>;
|
|
6
6
|
}
|
|
7
7
|
export interface PromiseLibraryInterface {
|
|
8
8
|
all<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(values: [T1 | PromiseInterface<T1>, T2 | PromiseInterface<T2>, T3 | PromiseInterface<T3>, T4 | PromiseInterface<T4>, T5 | PromiseInterface<T5>, T6 | PromiseInterface<T6>, T7 | PromiseInterface<T7>, T8 | PromiseInterface<T8>, T9 | PromiseInterface<T9>, T10 | PromiseInterface<T10>]): PromiseInterface<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>;
|
|
@@ -14,8 +14,8 @@ export interface PromiseLibraryInterface {
|
|
|
14
14
|
all<T1, T2, T3, T4>(values: [T1 | PromiseInterface<T1>, T2 | PromiseInterface<T2>, T3 | PromiseInterface<T3>, T4 | PromiseInterface<T4>]): PromiseInterface<[T1, T2, T3, T4]>;
|
|
15
15
|
all<T1, T2, T3>(values: [T1 | PromiseInterface<T1>, T2 | PromiseInterface<T2>, T3 | PromiseInterface<T3>]): PromiseInterface<[T1, T2, T3]>;
|
|
16
16
|
all<T1, T2>(values: [T1 | PromiseInterface<T1>, T2 | PromiseInterface<T2>]): PromiseInterface<[T1, T2]>;
|
|
17
|
-
all<TAll>(promises:
|
|
18
|
-
all(iterable:
|
|
17
|
+
all<TAll>(promises: (TAll | PromiseInterface<TAll>)[]): PromiseInterface<TAll[]>;
|
|
18
|
+
all(iterable: (PromiseInterface<any> | any)[]): PromiseInterface<any[]>;
|
|
19
19
|
all<T>(promises: {
|
|
20
20
|
[K in keyof T]: (PromiseInterface<T[K]> | T[K] | null);
|
|
21
21
|
}): PromiseInterface<T>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ApiEnumItemType
|
|
2
|
-
import { CollectionEntryService, CollectionOptions, CollectionQuery, ColumnCache, ColumnExpansion, ColumnSet, ColumnSetFactory, EntryParentNull, KeyService, PromiseInterface, QueryService } from '../internal';
|
|
3
|
-
export declare class CollectionEntry<ItemTypeType extends ApiEnumItemType = any, ColumnIds extends
|
|
1
|
+
import { ApiEnumItemType } from '@rentman/backend-types';
|
|
2
|
+
import { CollectionEntryService, CollectionOptions, CollectionQuery, ColumnCache, ColumnExpansion, ColumnSet, ColumnSetFactory, EntryParentNull, ItemTypeColumnIds, KeyService, PromiseInterface, QueryService } from '../internal';
|
|
3
|
+
export declare class CollectionEntry<ItemTypeType extends ApiEnumItemType = any, ColumnIds extends ItemTypeColumnIds<ItemTypeType> = ItemTypeColumnIds<ItemTypeType>> {
|
|
4
4
|
private collectionEntryService;
|
|
5
5
|
private queryService;
|
|
6
6
|
private columnSetFactory;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { ApiEnumItemType
|
|
2
|
-
import { ApiQuery, ApiRequestColumns, ApiRequestLimit, ChildCollectionResourcesNull, CollectionResource, EntryParentNull, FieldChangeCallback, ItemResource } from '../internal';
|
|
3
|
-
export declare type CollectionResourceOnRemoveCallback<ItemTypeType extends ApiEnumItemType, ColumnIds extends
|
|
4
|
-
export declare type CollectionResourceOnAddCallback<ItemTypeType extends ApiEnumItemType, ColumnIds extends
|
|
1
|
+
import { ApiEnumItemType } from '@rentman/backend-types';
|
|
2
|
+
import { ApiQuery, ApiRequestColumns, ApiRequestLimit, ChildCollectionResourcesNull, CollectionResource, EntryParentNull, FieldChangeCallback, ItemResource, ItemTypeColumnIds, RequestBufferManagerPrioritySettings } from '../internal';
|
|
3
|
+
export declare type CollectionResourceOnRemoveCallback<ItemTypeType extends ApiEnumItemType, ColumnIds extends ItemTypeColumnIds<ItemTypeType> = ItemTypeColumnIds<ItemTypeType>, Children extends ChildCollectionResourcesNull = any> = (itemResources: ItemResource<ItemTypeType, ColumnIds, Children>[], collectionResource: CollectionResource<ItemTypeType, ColumnIds, Children>, isCalledAfterSocketUpdate: boolean) => void;
|
|
4
|
+
export declare type CollectionResourceOnAddCallback<ItemTypeType extends ApiEnumItemType, ColumnIds extends ItemTypeColumnIds<ItemTypeType> = ItemTypeColumnIds<ItemTypeType>, Children extends ChildCollectionResourcesNull = any> = (itemResources: ItemResource<ItemTypeType, ColumnIds, Children>[], collectionResource: CollectionResource<ItemTypeType, ColumnIds, Children>, isInitialCall: boolean, isCalledAfterSocketUpdate: boolean) => void;
|
|
5
5
|
export declare type ChildCollectionOptions = {
|
|
6
6
|
[ChildItemType in ApiEnumItemType]?: CollectionOptions<ChildItemType>;
|
|
7
7
|
};
|
|
8
|
-
export interface CollectionOptionsInterface<ItemTypeType extends ApiEnumItemType = any, ColumnIds extends
|
|
8
|
+
export interface CollectionOptionsInterface<ItemTypeType extends ApiEnumItemType = any, ColumnIds extends ItemTypeColumnIds<ItemTypeType> = ItemTypeColumnIds<ItemTypeType>> {
|
|
9
9
|
columns?: ApiRequestColumns;
|
|
10
10
|
query?: ApiQuery | null;
|
|
11
11
|
queryColumns?: ApiRequestColumns;
|
|
@@ -20,8 +20,9 @@ export interface CollectionOptionsInterface<ItemTypeType extends ApiEnumItemType
|
|
|
20
20
|
[ChildItemType in ApiEnumItemType]?: CollectionOptionsInterface<ChildItemType>;
|
|
21
21
|
} | null;
|
|
22
22
|
preventCaching?: boolean;
|
|
23
|
+
priorityBufferSettings?: RequestBufferManagerPrioritySettings | null;
|
|
23
24
|
}
|
|
24
|
-
export declare class CollectionOptions<ItemTypeType extends ApiEnumItemType = any, ColumnIds extends
|
|
25
|
+
export declare class CollectionOptions<ItemTypeType extends ApiEnumItemType = any, ColumnIds extends ItemTypeColumnIds<ItemTypeType> = ItemTypeColumnIds<ItemTypeType>> implements Required<CollectionOptionsInterface> {
|
|
25
26
|
columns: ApiRequestColumns;
|
|
26
27
|
query: ApiQuery | null;
|
|
27
28
|
queryColumns: ApiRequestColumns;
|
|
@@ -38,5 +39,6 @@ export declare class CollectionOptions<ItemTypeType extends ApiEnumItemType = an
|
|
|
38
39
|
* Prevents a CachedQueryItem from being cached (the CollectionResource will still be cached), you can use this when you fetch an Itemtype for which the backend doesn't send socket messages (so it never automatically updates)
|
|
39
40
|
*/
|
|
40
41
|
preventCaching: boolean;
|
|
42
|
+
priorityBufferSettings: RequestBufferManagerPrioritySettings | null;
|
|
41
43
|
constructor(optionsInterface: CollectionOptionsInterface<ItemTypeType, ColumnIds>);
|
|
42
44
|
}
|