@rentman/rm-core 8.0.0 → 8.0.1-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/changelog.md +875 -865
- package/dist/rm-core.js +10027 -10055
- package/dist/rm-core.min.js +2 -2
- package/dist/types/classes/ApiFormatter.d.ts +66 -66
- package/dist/types/classes/ApiRequestService.d.ts +21 -21
- package/dist/types/classes/ApiResponseProcessor.d.ts +30 -30
- package/dist/types/classes/ChangesCompilation.d.ts +36 -36
- package/dist/types/classes/ChangesDelta.d.ts +62 -62
- 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 +27 -27
- package/dist/types/classes/CollectionMatcherBase.d.ts +22 -22
- package/dist/types/classes/CollectionMatcherCachedCollectionProcessor.d.ts +32 -32
- package/dist/types/classes/CollectionResourceService.d.ts +7 -7
- package/dist/types/classes/ColumnCache.d.ts +22 -22
- package/dist/types/classes/ColumnExpansion.d.ts +23 -23
- package/dist/types/classes/ColumnHandler.d.ts +22 -22
- package/dist/types/classes/ColumnInfo.d.ts +14 -14
- package/dist/types/classes/ColumnSet.d.ts +39 -39
- package/dist/types/classes/ColumnSubsetCache.d.ts +15 -15
- package/dist/types/classes/ColumnUtil.d.ts +101 -101
- package/dist/types/classes/ConversionMapService.d.ts +28 -28
- package/dist/types/classes/CreateRequest.d.ts +20 -20
- package/dist/types/classes/CreatedChangesDelta.d.ts +17 -17
- package/dist/types/classes/InternalChangesDelta.d.ts +40 -40
- package/dist/types/classes/ItemCache.d.ts +30 -30
- package/dist/types/classes/ItemCreateService.d.ts +25 -25
- package/dist/types/classes/ItemEntryService.d.ts +35 -35
- package/dist/types/classes/KeyService.d.ts +18 -18
- package/dist/types/classes/LockService.d.ts +32 -32
- package/dist/types/classes/ModuleChangesCompilation.d.ts +19 -19
- 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 +19 -19
- package/dist/types/classes/QueryParser.d.ts +26 -26
- package/dist/types/classes/QueryParserBase.d.ts +20 -20
- package/dist/types/classes/QueryParserIdUpdater.d.ts +16 -16
- package/dist/types/classes/QueryService.d.ts +13 -13
- package/dist/types/classes/RequestBuffer.d.ts +29 -29
- package/dist/types/classes/RequestBufferManager.d.ts +26 -26
- package/dist/types/classes/RequestColumnExpansion.d.ts +16 -16
- package/dist/types/classes/SocketMessageHandler.d.ts +43 -43
- package/dist/types/classes/TemplateCache.d.ts +67 -67
- 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 +75 -75
- package/dist/types/classes/cache/CollectionMatcherCachedQueryProcessor.d.ts +36 -36
- package/dist/types/classes/cache/ItemHandlerBase.d.ts +108 -108
- package/dist/types/classes/cache/server/ServerCache.d.ts +83 -83
- package/dist/types/classes/cache/server/ServerCachedQueryHandler.d.ts +34 -34
- package/dist/types/classes/cache/server/ServerItemHandler.d.ts +53 -53
- package/dist/types/classes/cache/transaction/TransactionCache.d.ts +325 -325
- package/dist/types/classes/cache/transaction/TransactionCachedQueryHandler.d.ts +23 -23
- package/dist/types/classes/cache/transaction/TransactionCollectionHandler.d.ts +29 -29
- package/dist/types/classes/cache/transaction/TransactionEventHandler.d.ts +24 -24
- package/dist/types/classes/cache/transaction/TransactionItemHandler.d.ts +94 -94
- package/dist/types/classes/cache/transaction/TransactionValidator.d.ts +35 -35
- 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 +9 -9
- package/dist/types/factories/ColumnInfoFactory.d.ts +8 -8
- package/dist/types/factories/ColumnSetFactory.d.ts +20 -20
- package/dist/types/factories/ColumnSubsetCacheFactory.d.ts +9 -9
- 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 +8 -8
- 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 +11 -11
- 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 +12 -12
- package/dist/types/interfaces/AuthInterface.d.ts +10 -10
- package/dist/types/interfaces/ErrorHandlerInterface.d.ts +5 -5
- package/dist/types/interfaces/ExceptionHandlerInterface.d.ts +3 -3
- package/dist/types/interfaces/LinkTreeServiceInterface.d.ts +4 -4
- package/dist/types/interfaces/PromiseLibraryInterface.d.ts +25 -25
- package/dist/types/interfaces/ServerCacheDependencyInterface.d.ts +7 -7
- package/dist/types/interfaces/SocketMessageInterface.d.ts +3 -3
- package/dist/types/interfaces/TransactionCollectionHandlerDependencyInterface.d.ts +20 -20
- package/dist/types/interfaces/TransactionItemHandlerDependencyInterface.d.ts +26 -26
- package/dist/types/interfaces/index.d.ts +11 -11
- package/dist/types/models/CollectionEntry.d.ts +24 -24
- package/dist/types/models/CollectionOptions.d.ts +24 -24
- package/dist/types/models/CollectionResource.d.ts +78 -78
- 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 +88 -88
- package/dist/types/models/Template.d.ts +12 -12
- package/dist/types/models/index.d.ts +7 -7
- package/dist/types/types/ItemTypesCollection.d.ts +345 -345
- package/dist/types/types/PromiseInterface.d.ts +2 -2
- package/dist/types/types/index.d.ts +2 -2
- package/package.json +38 -38
- package/readme.md +15 -15
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { ApiEnumItemType } from '@rentman/backend-types';
|
|
2
|
-
import { ColumnSet, ColumnUtil, RequestColumnMergeResult } from '../classes';
|
|
3
|
-
import { ApiRequestColumns } from '../types';
|
|
4
|
-
declare type RequestColumnMap = {
|
|
5
|
-
[itemType: string]: ApiRequestColumns;
|
|
6
|
-
};
|
|
7
|
-
export declare class RequestColumnExpansion {
|
|
8
|
-
private columnUtil;
|
|
9
|
-
private columns;
|
|
10
|
-
private columnSetIdMap;
|
|
11
|
-
constructor(columnUtil: ColumnUtil);
|
|
12
|
-
expandWithRequestColumns(itemType: ApiEnumItemType, requestColumns: ApiRequestColumns): RequestColumnMergeResult;
|
|
13
|
-
expand<T extends ColumnSet<ApiEnumItemType>>(columnSet: T): void;
|
|
14
|
-
get(): RequestColumnMap;
|
|
15
|
-
}
|
|
16
|
-
export {};
|
|
1
|
+
import { ApiEnumItemType } from '@rentman/backend-types';
|
|
2
|
+
import { ColumnSet, ColumnUtil, RequestColumnMergeResult } from '../classes';
|
|
3
|
+
import { ApiRequestColumns } from '../types';
|
|
4
|
+
declare type RequestColumnMap = {
|
|
5
|
+
[itemType: string]: ApiRequestColumns;
|
|
6
|
+
};
|
|
7
|
+
export declare class RequestColumnExpansion {
|
|
8
|
+
private columnUtil;
|
|
9
|
+
private columns;
|
|
10
|
+
private columnSetIdMap;
|
|
11
|
+
constructor(columnUtil: ColumnUtil);
|
|
12
|
+
expandWithRequestColumns(itemType: ApiEnumItemType, requestColumns: ApiRequestColumns): RequestColumnMergeResult;
|
|
13
|
+
expand<T extends ColumnSet<ApiEnumItemType>>(columnSet: T): void;
|
|
14
|
+
get(): RequestColumnMap;
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
import { ApiEnumItemType } from '@rentman/backend-types';
|
|
2
|
-
import { ApiFormatter, ApiRequestService } from '../classes';
|
|
3
|
-
import { QueryMatcherFactory, RequestColumnExpansionFactory, TransactionCacheFactory } from '../factories';
|
|
4
|
-
import { ChangesDeltaFactory } from '../factories/ChangesDeltaFactory';
|
|
5
|
-
import { ErrorHandlerInterface, PromiseLibraryInterface } from '../interfaces';
|
|
6
|
-
import { SocketMessage } from '../types';
|
|
7
|
-
import { CachedQueryItem } from './cache/CachedQueryHandlerBase';
|
|
8
|
-
import { RequestBufferManager } from './RequestBufferManager';
|
|
9
|
-
export declare type CachedQueryMatchingResult<ItemTypeType extends ApiEnumItemType> = {
|
|
10
|
-
fitting: Array<CachedQueryItem<ItemTypeType>>;
|
|
11
|
-
notfitting: Array<CachedQueryItem<ItemTypeType>>;
|
|
12
|
-
maybe: Array<CachedQueryItem<ItemTypeType>>;
|
|
13
|
-
};
|
|
14
|
-
export declare type CachedQueryMatchingResultItemIdMap<ItemTypeType extends ApiEnumItemType> = {
|
|
15
|
-
[itemId: number]: CachedQueryMatchingResult<ItemTypeType>;
|
|
16
|
-
};
|
|
17
|
-
export declare class SocketMessageHandler {
|
|
18
|
-
private requestBufferManager;
|
|
19
|
-
private changesDeltaFactory;
|
|
20
|
-
private apiFormatter;
|
|
21
|
-
private errorHandler;
|
|
22
|
-
private transactionCacheFactory;
|
|
23
|
-
private promiseService;
|
|
24
|
-
private requestColumnExpansionFactory;
|
|
25
|
-
private apiRequestService;
|
|
26
|
-
private queryMatcherFactory;
|
|
27
|
-
constructor(requestBufferManager: RequestBufferManager, changesDeltaFactory: ChangesDeltaFactory, apiFormatter: ApiFormatter, errorHandler: ErrorHandlerInterface, transactionCacheFactory: TransactionCacheFactory, promiseService: PromiseLibraryInterface, requestColumnExpansionFactory: RequestColumnExpansionFactory, apiRequestService: ApiRequestService, queryMatcherFactory: QueryMatcherFactory);
|
|
28
|
-
onMessageReceived(message: SocketMessage): any;
|
|
29
|
-
private formatMessageValues;
|
|
30
|
-
private getCollectionsWithLimitByItemType;
|
|
31
|
-
/**
|
|
32
|
-
* @description
|
|
33
|
-
* When an item is created or updated, we should check if it fits in any of the cached queries (using the values provided by the socket message)
|
|
34
|
-
* If we think it fits (or maybe) we should fetch the complete item with the superset of columns (the socket message might not have all values)
|
|
35
|
-
*/
|
|
36
|
-
private processMessage;
|
|
37
|
-
private processFunctionChangesResolve;
|
|
38
|
-
private isFunctionChangesResolveMessage;
|
|
39
|
-
private handleCreate;
|
|
40
|
-
private handleUpdate;
|
|
41
|
-
private handleDelete;
|
|
42
|
-
private handleLinkMove;
|
|
43
|
-
}
|
|
1
|
+
import { ApiEnumItemType } from '@rentman/backend-types';
|
|
2
|
+
import { ApiFormatter, ApiRequestService } from '../classes';
|
|
3
|
+
import { QueryMatcherFactory, RequestColumnExpansionFactory, TransactionCacheFactory } from '../factories';
|
|
4
|
+
import { ChangesDeltaFactory } from '../factories/ChangesDeltaFactory';
|
|
5
|
+
import { ErrorHandlerInterface, PromiseLibraryInterface } from '../interfaces';
|
|
6
|
+
import { SocketMessage } from '../types';
|
|
7
|
+
import { CachedQueryItem } from './cache/CachedQueryHandlerBase';
|
|
8
|
+
import { RequestBufferManager } from './RequestBufferManager';
|
|
9
|
+
export declare type CachedQueryMatchingResult<ItemTypeType extends ApiEnumItemType> = {
|
|
10
|
+
fitting: Array<CachedQueryItem<ItemTypeType>>;
|
|
11
|
+
notfitting: Array<CachedQueryItem<ItemTypeType>>;
|
|
12
|
+
maybe: Array<CachedQueryItem<ItemTypeType>>;
|
|
13
|
+
};
|
|
14
|
+
export declare type CachedQueryMatchingResultItemIdMap<ItemTypeType extends ApiEnumItemType> = {
|
|
15
|
+
[itemId: number]: CachedQueryMatchingResult<ItemTypeType>;
|
|
16
|
+
};
|
|
17
|
+
export declare class SocketMessageHandler {
|
|
18
|
+
private requestBufferManager;
|
|
19
|
+
private changesDeltaFactory;
|
|
20
|
+
private apiFormatter;
|
|
21
|
+
private errorHandler;
|
|
22
|
+
private transactionCacheFactory;
|
|
23
|
+
private promiseService;
|
|
24
|
+
private requestColumnExpansionFactory;
|
|
25
|
+
private apiRequestService;
|
|
26
|
+
private queryMatcherFactory;
|
|
27
|
+
constructor(requestBufferManager: RequestBufferManager, changesDeltaFactory: ChangesDeltaFactory, apiFormatter: ApiFormatter, errorHandler: ErrorHandlerInterface, transactionCacheFactory: TransactionCacheFactory, promiseService: PromiseLibraryInterface, requestColumnExpansionFactory: RequestColumnExpansionFactory, apiRequestService: ApiRequestService, queryMatcherFactory: QueryMatcherFactory);
|
|
28
|
+
onMessageReceived(message: SocketMessage): any;
|
|
29
|
+
private formatMessageValues;
|
|
30
|
+
private getCollectionsWithLimitByItemType;
|
|
31
|
+
/**
|
|
32
|
+
* @description
|
|
33
|
+
* When an item is created or updated, we should check if it fits in any of the cached queries (using the values provided by the socket message)
|
|
34
|
+
* If we think it fits (or maybe) we should fetch the complete item with the superset of columns (the socket message might not have all values)
|
|
35
|
+
*/
|
|
36
|
+
private processMessage;
|
|
37
|
+
private processFunctionChangesResolve;
|
|
38
|
+
private isFunctionChangesResolveMessage;
|
|
39
|
+
private handleCreate;
|
|
40
|
+
private handleUpdate;
|
|
41
|
+
private handleDelete;
|
|
42
|
+
private handleLinkMove;
|
|
43
|
+
}
|
|
@@ -1,67 +1,67 @@
|
|
|
1
|
-
import { ApiEnumItemType, ApiFields, ItemId } from '@rentman/backend-types';
|
|
2
|
-
import { RequestColumnExpansionFactory, TemplateFactory } from '../factories';
|
|
3
|
-
import { ErrorHandlerInterface, PromiseLibraryInterface } from '../interfaces';
|
|
4
|
-
import { Template } from '../models';
|
|
5
|
-
import { EntryParentNull, PromiseInterface } from '../types';
|
|
6
|
-
import { ApiRequestService } from './ApiRequestService';
|
|
7
|
-
import { ColumnHandler } from './ColumnHandler';
|
|
8
|
-
import { ColumnUtil } from './ColumnUtil';
|
|
9
|
-
export declare class TemplateCache {
|
|
10
|
-
private columnUtil;
|
|
11
|
-
private promiseService;
|
|
12
|
-
private columnHandler;
|
|
13
|
-
private templateFactory;
|
|
14
|
-
private errorHandler;
|
|
15
|
-
private requestColumnExpansionFactory;
|
|
16
|
-
private apiRequestService;
|
|
17
|
-
private pendingTemplateBufferMap;
|
|
18
|
-
templates: {
|
|
19
|
-
[itemType: string]: Template<any>;
|
|
20
|
-
};
|
|
21
|
-
constructor(columnUtil: ColumnUtil, promiseService: PromiseLibraryInterface, columnHandler: ColumnHandler, templateFactory: TemplateFactory, errorHandler: ErrorHandlerInterface, requestColumnExpansionFactory: RequestColumnExpansionFactory, apiRequestService: ApiRequestService);
|
|
22
|
-
/**
|
|
23
|
-
* @description
|
|
24
|
-
* Fetches a {@link Template template}, {@link TransactionItemHandler.createItems TransactionItemHandler.createItems} is a convenience function for this
|
|
25
|
-
*
|
|
26
|
-
* @param itemType The {@link ApiEnumItemType ItemType} of the template item
|
|
27
|
-
* @param itemId Used for caching, multiple concurrent template calls for the same itemId will return the same template
|
|
28
|
-
* @param templateOptions
|
|
29
|
-
* @param templateColumns Additional columns to be fetched, will be stored in the template - warning - the Template won't have values for those columns
|
|
30
|
-
* @param entryParentOrParentItemType An optional {@link EntryParentNull entry parent} or {@link ItemType parent itemType}, if the parent is passed the templateColumns will be expanded with the proper link columns (Through {@link ColumnUtil.getColumnsFromLink ColumnUtil.getColumnsFromLink})
|
|
31
|
-
*
|
|
32
|
-
* @example
|
|
33
|
-
* ```
|
|
34
|
-
* const parent: EntryParent = {
|
|
35
|
-
* itemType: 'Functie',
|
|
36
|
-
* itemId: 10,
|
|
37
|
-
* };
|
|
38
|
-
*
|
|
39
|
-
* return core.templateCache
|
|
40
|
-
* .fetchTemplate(
|
|
41
|
-
* 'Planningpersoneel',
|
|
42
|
-
* undefined,
|
|
43
|
-
* {},
|
|
44
|
-
* {},
|
|
45
|
-
* parent,
|
|
46
|
-
* )
|
|
47
|
-
* .then(
|
|
48
|
-
* (template: Template<'Planningpersoneel'>) => {
|
|
49
|
-
* const changesDelta = transaction.createChangesDelta();
|
|
50
|
-
*
|
|
51
|
-
* for (const itemResource of selectedItems) {
|
|
52
|
-
* changesDelta.setItemCreated(
|
|
53
|
-
* core.keyService.getLocalId(),
|
|
54
|
-
* template.fields,
|
|
55
|
-
* template.columns,
|
|
56
|
-
* parent,
|
|
57
|
-
* );
|
|
58
|
-
* }
|
|
59
|
-
*
|
|
60
|
-
* transaction.applyChangesDelta(changesDelta);
|
|
61
|
-
* );
|
|
62
|
-
* ```
|
|
63
|
-
*/
|
|
64
|
-
fetchTemplate<ItemTypeType extends ApiEnumItemType, ColumnIds extends Array<keyof ApiFields[ItemTypeType]> = Array<keyof ApiFields[ItemTypeType]>>(itemType: ItemTypeType, itemId?: ItemId, templateOptions?: any, templateColumns?: any, entryParentOrParentItemType?: EntryParentNull | ApiEnumItemType): PromiseInterface<Template<ItemTypeType, ColumnIds>>;
|
|
65
|
-
private fetchTemplateById;
|
|
66
|
-
private constructTemplateBuffer;
|
|
67
|
-
}
|
|
1
|
+
import { ApiEnumItemType, ApiFields, ItemId } from '@rentman/backend-types';
|
|
2
|
+
import { RequestColumnExpansionFactory, TemplateFactory } from '../factories';
|
|
3
|
+
import { ErrorHandlerInterface, PromiseLibraryInterface } from '../interfaces';
|
|
4
|
+
import { Template } from '../models';
|
|
5
|
+
import { EntryParentNull, PromiseInterface } from '../types';
|
|
6
|
+
import { ApiRequestService } from './ApiRequestService';
|
|
7
|
+
import { ColumnHandler } from './ColumnHandler';
|
|
8
|
+
import { ColumnUtil } from './ColumnUtil';
|
|
9
|
+
export declare class TemplateCache {
|
|
10
|
+
private columnUtil;
|
|
11
|
+
private promiseService;
|
|
12
|
+
private columnHandler;
|
|
13
|
+
private templateFactory;
|
|
14
|
+
private errorHandler;
|
|
15
|
+
private requestColumnExpansionFactory;
|
|
16
|
+
private apiRequestService;
|
|
17
|
+
private pendingTemplateBufferMap;
|
|
18
|
+
templates: {
|
|
19
|
+
[itemType: string]: Template<any>;
|
|
20
|
+
};
|
|
21
|
+
constructor(columnUtil: ColumnUtil, promiseService: PromiseLibraryInterface, columnHandler: ColumnHandler, templateFactory: TemplateFactory, errorHandler: ErrorHandlerInterface, requestColumnExpansionFactory: RequestColumnExpansionFactory, apiRequestService: ApiRequestService);
|
|
22
|
+
/**
|
|
23
|
+
* @description
|
|
24
|
+
* Fetches a {@link Template template}, {@link TransactionItemHandler.createItems TransactionItemHandler.createItems} is a convenience function for this
|
|
25
|
+
*
|
|
26
|
+
* @param itemType The {@link ApiEnumItemType ItemType} of the template item
|
|
27
|
+
* @param itemId Used for caching, multiple concurrent template calls for the same itemId will return the same template
|
|
28
|
+
* @param templateOptions
|
|
29
|
+
* @param templateColumns Additional columns to be fetched, will be stored in the template - warning - the Template won't have values for those columns
|
|
30
|
+
* @param entryParentOrParentItemType An optional {@link EntryParentNull entry parent} or {@link ItemType parent itemType}, if the parent is passed the templateColumns will be expanded with the proper link columns (Through {@link ColumnUtil.getColumnsFromLink ColumnUtil.getColumnsFromLink})
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```
|
|
34
|
+
* const parent: EntryParent = {
|
|
35
|
+
* itemType: 'Functie',
|
|
36
|
+
* itemId: 10,
|
|
37
|
+
* };
|
|
38
|
+
*
|
|
39
|
+
* return core.templateCache
|
|
40
|
+
* .fetchTemplate(
|
|
41
|
+
* 'Planningpersoneel',
|
|
42
|
+
* undefined,
|
|
43
|
+
* {},
|
|
44
|
+
* {},
|
|
45
|
+
* parent,
|
|
46
|
+
* )
|
|
47
|
+
* .then(
|
|
48
|
+
* (template: Template<'Planningpersoneel'>) => {
|
|
49
|
+
* const changesDelta = transaction.createChangesDelta();
|
|
50
|
+
*
|
|
51
|
+
* for (const itemResource of selectedItems) {
|
|
52
|
+
* changesDelta.setItemCreated(
|
|
53
|
+
* core.keyService.getLocalId(),
|
|
54
|
+
* template.fields,
|
|
55
|
+
* template.columns,
|
|
56
|
+
* parent,
|
|
57
|
+
* );
|
|
58
|
+
* }
|
|
59
|
+
*
|
|
60
|
+
* transaction.applyChangesDelta(changesDelta);
|
|
61
|
+
* );
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
fetchTemplate<ItemTypeType extends ApiEnumItemType, ColumnIds extends Array<keyof ApiFields[ItemTypeType]> = Array<keyof ApiFields[ItemTypeType]>>(itemType: ItemTypeType, itemId?: ItemId, templateOptions?: any, templateColumns?: any, entryParentOrParentItemType?: EntryParentNull | ApiEnumItemType): PromiseInterface<Template<ItemTypeType, ColumnIds>>;
|
|
65
|
+
private fetchTemplateById;
|
|
66
|
+
private constructTemplateBuffer;
|
|
67
|
+
}
|
|
@@ -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: object, destination?: object, 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: object, destination?: object, maxDepth?: any): any;
|
|
@@ -1,103 +1,103 @@
|
|
|
1
|
-
import { ApiEnumItemType } from '@rentman/backend-types';
|
|
2
|
-
import { RmCore } from '../../core';
|
|
3
|
-
import { AbstractCacheDependencyInterface } from '../../interfaces';
|
|
4
|
-
import { ItemEntry } from '../../models';
|
|
5
|
-
import { ApiRequestColumn, CollectionQuery, CollectionResourceParentIdMap, EntryParentNull, FieldMap, ItemIdConversionMap, PromiseInterface } from '../../types';
|
|
6
|
-
import { ChangesDelta } from '../ChangesDelta';
|
|
7
|
-
import { ChangesDeltaResult } from '../ChangesDeltaBase';
|
|
8
|
-
import { OnAfterCreateCallback } from '../ChangesProcessor';
|
|
9
|
-
import { InternalChangesDelta } from '../InternalChangesDelta';
|
|
10
|
-
import { ItemCache } from '../ItemCache';
|
|
11
|
-
import { CachedQueryItem } from './CachedQueryHandlerBase';
|
|
12
|
-
import { ItemHandlerBase } from './ItemHandlerBase';
|
|
13
|
-
import { ServerCache } from './server/ServerCache';
|
|
14
|
-
import { ServerCachedQueryHandler } from './server/ServerCachedQueryHandler';
|
|
15
|
-
import { ServerItemEntryChanges } from './server/ServerItemHandler';
|
|
16
|
-
import { TransactionCache } from './transaction/TransactionCache';
|
|
17
|
-
import { TransactionCachedQueryHandler } from './transaction/TransactionCachedQueryHandler';
|
|
18
|
-
import { TransactionItemEntryChanges } from './transaction/TransactionItemHandler';
|
|
19
|
-
import { TransactionValidatorFactory } from './transaction/TransactionValidator';
|
|
20
|
-
export declare abstract class AbstractCache {
|
|
21
|
-
dependencies: AbstractCacheDependencyInterface;
|
|
22
|
-
core: RmCore;
|
|
23
|
-
children: TransactionCache[];
|
|
24
|
-
readonly itemHandler: ItemHandlerBase;
|
|
25
|
-
readonly cachedQueryHandler: TransactionCachedQueryHandler | ServerCachedQueryHandler;
|
|
26
|
-
parent: AbstractCache | null;
|
|
27
|
-
protected constructor(dependencies: AbstractCacheDependencyInterface, core: RmCore);
|
|
28
|
-
abstract createChild(id?: string, validatorFactory?: TransactionValidatorFactory): TransactionCache;
|
|
29
|
-
onChildDestroy(cache: TransactionCache): void;
|
|
30
|
-
/**
|
|
31
|
-
* @description
|
|
32
|
-
* Expands the items in the collections with the passed columns
|
|
33
|
-
*
|
|
34
|
-
* todo[limit] move to TransactionCache ?
|
|
35
|
-
*/
|
|
36
|
-
abstract expandCollectionResources<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, collections: CollectionResourceParentIdMap<ItemTypeType>, newColumns: ApiRequestColumn[]): PromiseInterface<CollectionResourceParentIdMap>;
|
|
37
|
-
/**
|
|
38
|
-
* @description
|
|
39
|
-
* Returns {@link ItemEntry ItemEntries} that fit the collection's query, copies over the collectionChanges on all transactions in the chain.
|
|
40
|
-
*/
|
|
41
|
-
abstract getCollectionChangesRecursively<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, parsedQuery: CollectionQuery): CachedQueryItem<ItemTypeType> | undefined;
|
|
42
|
-
/**
|
|
43
|
-
* @description
|
|
44
|
-
* Returns this transaction and all parents
|
|
45
|
-
*/
|
|
46
|
-
getTransactionChain(): AbstractCache[];
|
|
47
|
-
/**
|
|
48
|
-
* @description
|
|
49
|
-
* Returns the {@link TransactionItemHandler.entries ItemCache} of the transaction
|
|
50
|
-
*/
|
|
51
|
-
getCurrentItemEntryCache(): ItemCache;
|
|
52
|
-
abstract getServerCache(): ServerCache;
|
|
53
|
-
abstract getLocalItemEntry(itemEntryId: ItemEntry['id']): ItemEntry | undefined;
|
|
54
|
-
abstract getLocalItemEntryByItemId(itemType: ApiEnumItemType, itemId: ItemEntry['itemId']): ItemEntry | undefined;
|
|
55
|
-
/**
|
|
56
|
-
* @description
|
|
57
|
-
* Applies changes from a child transaction to a parent
|
|
58
|
-
*/
|
|
59
|
-
abstract applyChangesFromChild(transaction: TransactionCache, breakUpByParent?: boolean, onAfterCreateCallback?: OnAfterCreateCallback): PromiseInterface<ItemIdConversionMap>;
|
|
60
|
-
/**
|
|
61
|
-
* @description
|
|
62
|
-
* Called by a parent transaction, propagates changes downwards to all child caches
|
|
63
|
-
*
|
|
64
|
-
* @remarks
|
|
65
|
-
* - Should only be used by the core
|
|
66
|
-
*
|
|
67
|
-
* todo[cache] Should we refetch derived values just like in applyChangesDelta ?
|
|
68
|
-
*
|
|
69
|
-
* @internal
|
|
70
|
-
*/
|
|
71
|
-
abstract applyChangesFromParent(internalChangesDelta: InternalChangesDelta, isCalledAfterApiSave: boolean, isCalledAfterSocketUpdate: boolean): void;
|
|
72
|
-
abstract getParent<ItemTypeType extends ApiEnumItemType = any>(itemEntry: ItemEntry<ItemTypeType>, fromInitial?: boolean, providedFields?: FieldMap<ItemTypeType>): EntryParentNull;
|
|
73
|
-
abstract getItemChangesRecursively(itemEntryId: ItemEntry['id'], copyFields?: boolean): FieldMap;
|
|
74
|
-
abstract getLocalItemEntryChangesTuple(itemEntryId: ItemEntry['id']): any;
|
|
75
|
-
/**
|
|
76
|
-
* @description
|
|
77
|
-
* 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
|
|
78
|
-
*
|
|
79
|
-
* @remarks
|
|
80
|
-
* - Should only be used by the core
|
|
81
|
-
*
|
|
82
|
-
* @internal
|
|
83
|
-
*/
|
|
84
|
-
abstract getChangesFromItemChanges<ItemTypeType extends ApiEnumItemType = any>(changesObject: ServerItemEntryChanges<ItemTypeType> | TransactionItemEntryChanges<FieldMap<ItemTypeType>>): FieldMap<ItemTypeType>;
|
|
85
|
-
abstract applyChangesDelta(changesDelta: ChangesDelta): PromiseInterface<ChangesDeltaResult>;
|
|
86
|
-
protected getParentFromFields<ItemTypeType extends ApiEnumItemType = any>(itemEntry: ItemEntry<ItemTypeType>, fields: FieldMap<ItemTypeType>): EntryParentNull;
|
|
87
|
-
/**
|
|
88
|
-
* @description
|
|
89
|
-
* Called by applyChangesDelta from ServerCache and TransactionCache. Applies creates, updates and moves, doesn't apply deletes
|
|
90
|
-
*
|
|
91
|
-
* @private
|
|
92
|
-
*/
|
|
93
|
-
protected _applyChangesDelta(changesDelta: ChangesDelta): {
|
|
94
|
-
result: ChangesDeltaResult;
|
|
95
|
-
internalChangesDelta: InternalChangesDelta;
|
|
96
|
-
matchingDelta: InternalChangesDelta;
|
|
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 { ApiEnumItemType } from '@rentman/backend-types';
|
|
2
|
+
import { RmCore } from '../../core';
|
|
3
|
+
import { AbstractCacheDependencyInterface } from '../../interfaces';
|
|
4
|
+
import { ItemEntry } from '../../models';
|
|
5
|
+
import { ApiRequestColumn, CollectionQuery, CollectionResourceParentIdMap, EntryParentNull, FieldMap, ItemIdConversionMap, PromiseInterface } from '../../types';
|
|
6
|
+
import { ChangesDelta } from '../ChangesDelta';
|
|
7
|
+
import { ChangesDeltaResult } from '../ChangesDeltaBase';
|
|
8
|
+
import { OnAfterCreateCallback } from '../ChangesProcessor';
|
|
9
|
+
import { InternalChangesDelta } from '../InternalChangesDelta';
|
|
10
|
+
import { ItemCache } from '../ItemCache';
|
|
11
|
+
import { CachedQueryItem } from './CachedQueryHandlerBase';
|
|
12
|
+
import { ItemHandlerBase } from './ItemHandlerBase';
|
|
13
|
+
import { ServerCache } from './server/ServerCache';
|
|
14
|
+
import { ServerCachedQueryHandler } from './server/ServerCachedQueryHandler';
|
|
15
|
+
import { ServerItemEntryChanges } from './server/ServerItemHandler';
|
|
16
|
+
import { TransactionCache } from './transaction/TransactionCache';
|
|
17
|
+
import { TransactionCachedQueryHandler } from './transaction/TransactionCachedQueryHandler';
|
|
18
|
+
import { TransactionItemEntryChanges } from './transaction/TransactionItemHandler';
|
|
19
|
+
import { TransactionValidatorFactory } from './transaction/TransactionValidator';
|
|
20
|
+
export declare abstract class AbstractCache {
|
|
21
|
+
dependencies: AbstractCacheDependencyInterface;
|
|
22
|
+
core: RmCore;
|
|
23
|
+
children: TransactionCache[];
|
|
24
|
+
readonly itemHandler: ItemHandlerBase;
|
|
25
|
+
readonly cachedQueryHandler: TransactionCachedQueryHandler | ServerCachedQueryHandler;
|
|
26
|
+
parent: AbstractCache | null;
|
|
27
|
+
protected constructor(dependencies: AbstractCacheDependencyInterface, core: RmCore);
|
|
28
|
+
abstract createChild(id?: string, validatorFactory?: TransactionValidatorFactory): TransactionCache;
|
|
29
|
+
onChildDestroy(cache: TransactionCache): void;
|
|
30
|
+
/**
|
|
31
|
+
* @description
|
|
32
|
+
* Expands the items in the collections with the passed columns
|
|
33
|
+
*
|
|
34
|
+
* todo[limit] move to TransactionCache ?
|
|
35
|
+
*/
|
|
36
|
+
abstract expandCollectionResources<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, collections: CollectionResourceParentIdMap<ItemTypeType>, newColumns: ApiRequestColumn[]): PromiseInterface<CollectionResourceParentIdMap>;
|
|
37
|
+
/**
|
|
38
|
+
* @description
|
|
39
|
+
* Returns {@link ItemEntry ItemEntries} that fit the collection's query, copies over the collectionChanges on all transactions in the chain.
|
|
40
|
+
*/
|
|
41
|
+
abstract getCollectionChangesRecursively<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, parsedQuery: CollectionQuery): CachedQueryItem<ItemTypeType> | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* @description
|
|
44
|
+
* Returns this transaction and all parents
|
|
45
|
+
*/
|
|
46
|
+
getTransactionChain(): AbstractCache[];
|
|
47
|
+
/**
|
|
48
|
+
* @description
|
|
49
|
+
* Returns the {@link TransactionItemHandler.entries ItemCache} of the transaction
|
|
50
|
+
*/
|
|
51
|
+
getCurrentItemEntryCache(): ItemCache;
|
|
52
|
+
abstract getServerCache(): ServerCache;
|
|
53
|
+
abstract getLocalItemEntry(itemEntryId: ItemEntry['id']): ItemEntry | undefined;
|
|
54
|
+
abstract getLocalItemEntryByItemId(itemType: ApiEnumItemType, itemId: ItemEntry['itemId']): ItemEntry | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* @description
|
|
57
|
+
* Applies changes from a child transaction to a parent
|
|
58
|
+
*/
|
|
59
|
+
abstract applyChangesFromChild(transaction: TransactionCache, breakUpByParent?: boolean, onAfterCreateCallback?: OnAfterCreateCallback): PromiseInterface<ItemIdConversionMap>;
|
|
60
|
+
/**
|
|
61
|
+
* @description
|
|
62
|
+
* Called by a parent transaction, propagates changes downwards to all child caches
|
|
63
|
+
*
|
|
64
|
+
* @remarks
|
|
65
|
+
* - Should only be used by the core
|
|
66
|
+
*
|
|
67
|
+
* todo[cache] Should we refetch derived values just like in applyChangesDelta ?
|
|
68
|
+
*
|
|
69
|
+
* @internal
|
|
70
|
+
*/
|
|
71
|
+
abstract applyChangesFromParent(internalChangesDelta: InternalChangesDelta, isCalledAfterApiSave: boolean, isCalledAfterSocketUpdate: boolean): void;
|
|
72
|
+
abstract getParent<ItemTypeType extends ApiEnumItemType = any>(itemEntry: ItemEntry<ItemTypeType>, fromInitial?: boolean, providedFields?: FieldMap<ItemTypeType>): EntryParentNull;
|
|
73
|
+
abstract getItemChangesRecursively(itemEntryId: ItemEntry['id'], copyFields?: boolean): FieldMap;
|
|
74
|
+
abstract getLocalItemEntryChangesTuple(itemEntryId: ItemEntry['id']): any;
|
|
75
|
+
/**
|
|
76
|
+
* @description
|
|
77
|
+
* 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
|
|
78
|
+
*
|
|
79
|
+
* @remarks
|
|
80
|
+
* - Should only be used by the core
|
|
81
|
+
*
|
|
82
|
+
* @internal
|
|
83
|
+
*/
|
|
84
|
+
abstract getChangesFromItemChanges<ItemTypeType extends ApiEnumItemType = any>(changesObject: ServerItemEntryChanges<ItemTypeType> | TransactionItemEntryChanges<FieldMap<ItemTypeType>>): FieldMap<ItemTypeType>;
|
|
85
|
+
abstract applyChangesDelta(changesDelta: ChangesDelta): PromiseInterface<ChangesDeltaResult>;
|
|
86
|
+
protected getParentFromFields<ItemTypeType extends ApiEnumItemType = any>(itemEntry: ItemEntry<ItemTypeType>, fields: FieldMap<ItemTypeType>): EntryParentNull;
|
|
87
|
+
/**
|
|
88
|
+
* @description
|
|
89
|
+
* Called by applyChangesDelta from ServerCache and TransactionCache. Applies creates, updates and moves, doesn't apply deletes
|
|
90
|
+
*
|
|
91
|
+
* @private
|
|
92
|
+
*/
|
|
93
|
+
protected _applyChangesDelta(changesDelta: ChangesDelta): {
|
|
94
|
+
result: ChangesDeltaResult;
|
|
95
|
+
internalChangesDelta: InternalChangesDelta;
|
|
96
|
+
matchingDelta: InternalChangesDelta;
|
|
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
|
+
}
|