@rentman/rm-core 12.1.0 → 12.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 +1495 -1487
- package/dist/rm-core.js +845 -883
- package/dist/rm-core.min.js +1 -1
- package/dist/types/src/FieldLookupProxy.d.ts +4 -4
- package/dist/types/src/classes/ApiFormatter.d.ts +76 -76
- package/dist/types/src/classes/ApiRequestService.d.ts +18 -18
- package/dist/types/src/classes/ApiResponseProcessor.d.ts +29 -29
- package/dist/types/src/classes/BusinessLogicManager/BusinessLogicManager.d.ts +100 -100
- package/dist/types/src/classes/BusinessLogicManager/BusinessLogicRule.d.ts +93 -93
- package/dist/types/src/classes/BusinessLogicManager/Customfield/CustomFieldTypeBusinessLogicRule.d.ts +17 -17
- package/dist/types/src/classes/BusinessLogicManager/Documents/DocumentTemplateBusinessLogicRule.d.ts +24 -24
- package/dist/types/src/classes/BusinessLogicManager/Exemplaar/ExemplaarAanschafdatumBusinessLogicRule.d.ts +13 -13
- package/dist/types/src/classes/BusinessLogicManager/Factuur/FactuurBetalingsconditieBusinessLogicRule.d.ts +19 -19
- package/dist/types/src/classes/BusinessLogicManager/Factuur/FactuurDatumBusinessLogicRule.d.ts +18 -18
- package/dist/types/src/classes/BusinessLogicManager/Factuur/FactuurNumberseriesBusinessLogicRule.d.ts +13 -13
- package/dist/types/src/classes/BusinessLogicManager/Functie/FunctieNaaminternBusinessLogicRule.d.ts +17 -17
- package/dist/types/src/classes/BusinessLogicManager/Functie/FunctieTwowayBusinessLogicRule.d.ts +13 -13
- package/dist/types/src/classes/BusinessLogicManager/Materiaal/MateriaalTelexemplarenBusinessLogicRule.d.ts +15 -15
- package/dist/types/src/classes/BusinessLogicManager/Materiaal/MateriaalTypeBusinessLogicRule.d.ts +17 -17
- package/dist/types/src/classes/BusinessLogicManager/Materiaal/MateriaalVerhuurBusinessLogicRule.d.ts +17 -17
- package/dist/types/src/classes/BusinessLogicManager/Materiaal/SurfaceArticleSizeBusinessLogicRule.d.ts +18 -18
- package/dist/types/src/classes/BusinessLogicManager/OfferteContract/OfferteContractDatumBusinessLogicRule.d.ts +25 -25
- package/dist/types/src/classes/BusinessLogicManager/PlanningPersoneelTransport/PlanningPersoneelTransportBusinessLogicRule.d.ts +28 -28
- package/dist/types/src/classes/BusinessLogicManager/Project/ProjectClientNoteBusinessLogicRule.d.ts +22 -22
- package/dist/types/src/classes/BusinessLogicManager/Reparatie/ReparatieExemplaarAantalBusinessLogicRule.d.ts +13 -13
- package/dist/types/src/classes/BusinessLogicManager/Reparatie/ReparatieExemplaarLocationBusinessLogicRule.d.ts +23 -23
- package/dist/types/src/classes/BusinessLogicManager/Rol/RolDocumentAccessBusinessLogicRule.d.ts +17 -17
- package/dist/types/src/classes/BusinessLogicManager/Rol/RolEditOwnDataBusinessLogicRule.d.ts +17 -17
- package/dist/types/src/classes/BusinessLogicManager/Rol/RolFileAccessBusinessLogicRule.d.ts +17 -17
- package/dist/types/src/classes/BusinessLogicManager/Rol/RolPersoneelsplannerToegangBusinessLogicRule.d.ts +17 -17
- package/dist/types/src/classes/BusinessLogicManager/Rol/RolProjectenBewerkenBusinessLogicRule.d.ts +17 -17
- package/dist/types/src/classes/BusinessLogicManager/Rol/RolProjectenToegangBusinessLogicRule.d.ts +17 -17
- package/dist/types/src/classes/CacheSyncer.d.ts +71 -71
- package/dist/types/src/classes/ChangesCompilation.d.ts +33 -33
- package/dist/types/src/classes/ChangesDelta.d.ts +65 -65
- package/dist/types/src/classes/ChangesDeltaBase.d.ts +88 -88
- package/dist/types/src/classes/ChangesProcessor.d.ts +40 -40
- package/dist/types/src/classes/CollectionEntryService.d.ts +24 -24
- package/dist/types/src/classes/CollectionResourceService.d.ts +6 -6
- package/dist/types/src/classes/ColumnCache.d.ts +19 -19
- package/dist/types/src/classes/ColumnExpansion.d.ts +19 -19
- package/dist/types/src/classes/ColumnHandler.d.ts +20 -20
- package/dist/types/src/classes/ColumnInfo.d.ts +15 -15
- package/dist/types/src/classes/ColumnSet.d.ts +37 -37
- package/dist/types/src/classes/ColumnUtil.d.ts +108 -108
- package/dist/types/src/classes/ConversionMapService.d.ts +25 -25
- package/dist/types/src/classes/CreateRequest.d.ts +17 -17
- package/dist/types/src/classes/CreatedChangesDelta.d.ts +17 -17
- package/dist/types/src/classes/InternalChangesDelta.d.ts +44 -44
- package/dist/types/src/classes/ItemCache.d.ts +27 -27
- package/dist/types/src/classes/ItemCreateService.d.ts +18 -18
- package/dist/types/src/classes/ItemEntryService.d.ts +32 -32
- package/dist/types/src/classes/KeyService.d.ts +18 -18
- package/dist/types/src/classes/LockService.d.ts +28 -28
- package/dist/types/src/classes/ModuleChangesCompilation.d.ts +17 -17
- package/dist/types/src/classes/ParentChangesDelta.d.ts +41 -41
- package/dist/types/src/classes/QueryColumnExtractor.d.ts +18 -18
- package/dist/types/src/classes/QueryContainsLocalIdParser.d.ts +17 -17
- package/dist/types/src/classes/QueryLinkedToParser.d.ts +17 -17
- package/dist/types/src/classes/QueryLocallyMatchableParser.d.ts +20 -20
- package/dist/types/src/classes/QueryMatcher.d.ts +25 -25
- package/dist/types/src/classes/QueryParser.d.ts +25 -25
- package/dist/types/src/classes/QueryParserBase.d.ts +20 -20
- package/dist/types/src/classes/QueryParserIdUpdater.d.ts +17 -17
- package/dist/types/src/classes/QueryService.d.ts +12 -12
- package/dist/types/src/classes/RequestBuffer.d.ts +26 -26
- package/dist/types/src/classes/RequestBufferManager.d.ts +21 -21
- package/dist/types/src/classes/RequestColumnExpansion.d.ts +13 -13
- package/dist/types/src/classes/RequestColumnsOperationsCache.d.ts +46 -46
- package/dist/types/src/classes/SocketMessageHandler.d.ts +34 -34
- package/dist/types/src/classes/TemplateCache.d.ts +64 -64
- package/dist/types/src/classes/Util.d.ts +28 -28
- package/dist/types/src/classes/cache/AbstractCache.d.ts +85 -92
- package/dist/types/src/classes/cache/CachedQueryHandlerBase.d.ts +70 -70
- package/dist/types/src/classes/cache/ItemHandlerBase.d.ts +107 -107
- package/dist/types/src/classes/cache/server/ServerCache.d.ts +65 -77
- package/dist/types/src/classes/cache/server/ServerCachedQueryHandler.d.ts +27 -27
- package/dist/types/src/classes/cache/server/ServerItemHandler.d.ts +39 -39
- package/dist/types/src/classes/cache/transaction/TransactionCache.d.ts +298 -310
- package/dist/types/src/classes/cache/transaction/TransactionCachedQueryHandler.d.ts +50 -50
- package/dist/types/src/classes/cache/transaction/TransactionCollectionHandler.d.ts +24 -24
- package/dist/types/src/classes/cache/transaction/TransactionEventHandler.d.ts +21 -21
- package/dist/types/src/classes/cache/transaction/TransactionItemHandler.d.ts +80 -80
- package/dist/types/src/classes/cache/transaction/TransactionValidator.d.ts +33 -33
- package/dist/types/src/constants.d.ts +7 -7
- package/dist/types/src/core.d.ts +48 -48
- package/dist/types/src/factories/ApiResponseProcessorFactory.d.ts +6 -6
- package/dist/types/src/factories/CacheSyncerFactory.d.ts +14 -14
- package/dist/types/src/factories/ChangesCompilationFactory.d.ts +5 -5
- package/dist/types/src/factories/ChangesDeltaFactory.d.ts +13 -13
- package/dist/types/src/factories/ChangesProcessorFactory.d.ts +13 -13
- package/dist/types/src/factories/CollectionEntryFactory.d.ts +11 -11
- package/dist/types/src/factories/CollectionResourceFactory.d.ts +18 -18
- package/dist/types/src/factories/ColumnExpansionFactory.d.ts +7 -7
- package/dist/types/src/factories/ColumnInfoFactory.d.ts +7 -7
- package/dist/types/src/factories/ColumnSetFactory.d.ts +18 -18
- package/dist/types/src/factories/CreateRequestFactory.d.ts +9 -9
- package/dist/types/src/factories/ItemCacheFactory.d.ts +6 -6
- package/dist/types/src/factories/ItemEntryFactory.d.ts +12 -12
- package/dist/types/src/factories/ItemResourceFactory.d.ts +11 -11
- package/dist/types/src/factories/ModuleChangesCompilationFactory.d.ts +6 -6
- package/dist/types/src/factories/QueryMatcherFactory.d.ts +8 -8
- package/dist/types/src/factories/QueryParserFactory.d.ts +5 -5
- package/dist/types/src/factories/RequestColumnExpansionFactory.d.ts +6 -6
- package/dist/types/src/factories/RequestColumnsOperationsCacheFactory.d.ts +8 -8
- package/dist/types/src/factories/TemplateFactory.d.ts +8 -8
- package/dist/types/src/factories/TransactionCacheFactory.d.ts +13 -13
- package/dist/types/src/index.d.ts +1 -1
- package/dist/types/src/interfaces/AbstractCacheDependencyInterface.d.ts +38 -38
- package/dist/types/src/interfaces/ApiRequestServiceInterface.d.ts +12 -12
- package/dist/types/src/interfaces/AuthInterface.d.ts +10 -10
- package/dist/types/src/interfaces/ErrorHandlerInterface.d.ts +6 -6
- package/dist/types/src/interfaces/ExceptionHandlerInterface.d.ts +3 -3
- package/dist/types/src/interfaces/LinkTreeServiceInterface.d.ts +4 -4
- package/dist/types/src/interfaces/PromiseLibraryInterface.d.ts +33 -33
- package/dist/types/src/interfaces/ServerCacheDependencyInterface.d.ts +5 -5
- package/dist/types/src/interfaces/SocketMessageInterface.d.ts +3 -3
- package/dist/types/src/interfaces/TransactionCollectionHandlerDependencyInterface.d.ts +17 -17
- package/dist/types/src/interfaces/TransactionItemHandlerDependencyInterface.d.ts +22 -22
- package/dist/types/src/internal.d.ts +128 -128
- package/dist/types/src/models/CachedQueryItem.d.ts +40 -40
- package/dist/types/src/models/CollectionEntry.d.ts +22 -22
- package/dist/types/src/models/CollectionOptions.d.ts +44 -44
- package/dist/types/src/models/CollectionResource.d.ts +87 -87
- package/dist/types/src/models/ItemEntry.d.ts +19 -19
- package/dist/types/src/models/ItemEntryOptions.d.ts +8 -8
- package/dist/types/src/models/ItemResource.d.ts +95 -90
- package/dist/types/src/models/Template.d.ts +11 -11
- package/dist/types/src/types/ItemTypesCollection.d.ts +361 -361
- package/dist/types/src/types/PromiseInterface.d.ts +2 -2
- package/dist/types/tests/integration/core.test.d.ts +1 -1
- package/dist/types/tests/integration/helpers/helpers.d.ts +32 -32
- package/dist/types/tests/integration/transactions/field_lookup.test.d.ts +1 -1
- package/dist/types/tests/integration/transactions/get_by.test.d.ts +1 -1
- package/dist/types/tests/integration/transactions/updates.test.d.ts +1 -1
- package/dist/types/tests/mocks/ApiMocked.d.ts +19 -19
- package/dist/types/tests/mocks/PromiseLibrary.mocked.d.ts +2 -2
- package/dist/types/tests/regression/RM4_17754.test.d.ts +1 -1
- package/dist/types/tests/regression/RM4_18216.test.d.ts +1 -1
- package/dist/types/tests/unit/query_contains_local_id_parser.test.d.ts +1 -1
- package/dist/types/tests/unit/query_linked_to_parser.test.d.ts +1 -1
- package/dist/types/tests/unit/query_matcher.test.d.ts +1 -1
- package/dist/types/tests/unit/query_parser_id_updater.test.d.ts +1 -1
- package/dist/types/tests/unit/query_service.test.d.ts +1 -1
- package/package.json +57 -57
- package/readme.md +16 -16
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ApiEnumItemType } from '@rentman/backend-types';
|
|
2
|
-
import { AbstractCache } from './classes/cache/AbstractCache';
|
|
3
|
-
import { ItemEntry } from './models/ItemEntry';
|
|
4
|
-
export declare const FieldLookupProxy: <ItemTypeType extends ApiEnumItemType>(transaction: AbstractCache, itemEntry: ItemEntry<ItemTypeType>, fromInitial?: boolean) => {};
|
|
1
|
+
import { ApiEnumItemType } from '@rentman/backend-types';
|
|
2
|
+
import { AbstractCache } from './classes/cache/AbstractCache';
|
|
3
|
+
import { ItemEntry } from './models/ItemEntry';
|
|
4
|
+
export declare const FieldLookupProxy: <ItemTypeType extends ApiEnumItemType>(transaction: AbstractCache, itemEntry: ItemEntry<ItemTypeType>, fromInitial?: boolean) => {};
|
|
@@ -1,76 +1,76 @@
|
|
|
1
|
-
import { ApiEnumApiType, ApiEnumItemType, ApiFields, ResponseColumn } from '@rentman/backend-types';
|
|
2
|
-
import moment from 'moment';
|
|
3
|
-
import { ApiEnumApiTypeToTsTypeMap, ColumnInfo, FieldMap, ItemTypeColumnIds } from '../internal';
|
|
4
|
-
declare type GetChangesResult<ItemTypeType extends ApiEnumItemType = any, ColumnId extends keyof ApiFields[ItemTypeType] = any> = {
|
|
5
|
-
oldValue: FieldMap<ItemTypeType, [ColumnId]>[ColumnId];
|
|
6
|
-
newValue: FieldMap<ItemTypeType, [ColumnId]>[ColumnId];
|
|
7
|
-
column: ResponseColumn<ItemTypeType, ColumnId>;
|
|
8
|
-
};
|
|
9
|
-
/**
|
|
10
|
-
* @description
|
|
11
|
-
* A service which provides functions to transform data that comes from/goes to the API
|
|
12
|
-
*
|
|
13
|
-
* @warning
|
|
14
|
-
* The code in these functions can be *very hot* on large databases, therefore performance must be kept in mind.
|
|
15
|
-
* This is also the reason why all column types are written out instead of using the enum
|
|
16
|
-
*/
|
|
17
|
-
export declare class ApiFormatter {
|
|
18
|
-
MOMENT_INVALID: string;
|
|
19
|
-
SERVER_DATETIME_FORMAT: string;
|
|
20
|
-
SERVER_TIME_FORMAT: string;
|
|
21
|
-
SERVER_DATE_FORMAT: string;
|
|
22
|
-
constructor();
|
|
23
|
-
/**
|
|
24
|
-
* @description
|
|
25
|
-
* Returns if a column type is an 'expensive' type, meaning that the action to format the field takes significant CPU time
|
|
26
|
-
*
|
|
27
|
-
* ----
|
|
28
|
-
* @remarks
|
|
29
|
-
* Currently only used for Moment objects
|
|
30
|
-
*/
|
|
31
|
-
isExpensiveFormat(columnType: ApiEnumApiType): boolean;
|
|
32
|
-
/**
|
|
33
|
-
* @description
|
|
34
|
-
* Overwrites the values in 'changes' if the values in 'initial' and 'changes' are the same and the parent transaction
|
|
35
|
-
* copied over the field (leaving user changes intact)
|
|
36
|
-
*
|
|
37
|
-
* We have to check the parent transaction because on a child transaction initial/modified can be equal (the copied field of the parent)
|
|
38
|
-
* and will then incorrectly be overwritten by applyChangesFromParent
|
|
39
|
-
*
|
|
40
|
-
* Note: parentChanges can be undefined for local items
|
|
41
|
-
*/
|
|
42
|
-
mergeCopyFields<ItemTypeType extends ApiEnumItemType, ColumnIds extends ItemTypeColumnIds<ItemTypeType> = any>(parentChanges: FieldMap<ItemTypeType, ColumnIds> | undefined, changes: FieldMap<ItemTypeType, ColumnIds>, initial: FieldMap<ItemTypeType, ColumnIds>, newInitial: FieldMap<ItemTypeType, ColumnIds>, columns: ColumnInfo<ItemTypeType>[]): FieldMap<ItemTypeType, ColumnIds>;
|
|
43
|
-
formatRequestLocal<ItemTypeType extends ApiEnumItemType>(fields: FieldMap<ItemTypeType>, columns: ColumnInfo<ItemTypeType>[]): {
|
|
44
|
-
[columnId: string]: any;
|
|
45
|
-
};
|
|
46
|
-
hasChanges<ItemTypeType extends ApiEnumItemType>(initial: FieldMap<ItemTypeType>, modified: FieldMap<ItemTypeType>, columns: ColumnInfo<ItemTypeType>[], includeReadOnlyColumns?: boolean, forceCompare?: boolean): boolean;
|
|
47
|
-
getChanges<ItemTypeType extends ApiEnumItemType = any, ColumnIds extends ItemTypeColumnIds<ItemTypeType> = any>(initial: FieldMap<ItemTypeType, ColumnIds>, modified: FieldMap<ItemTypeType, ColumnIds>, columns: ColumnInfo<ItemTypeType, ColumnIds[number]>[]): GetChangesResult<ItemTypeType, ColumnIds[number]>[];
|
|
48
|
-
copyFields<ItemTypeType extends ApiEnumItemType = any, ColumnIds extends ItemTypeColumnIds<ItemTypeType> = any>(source: Partial<FieldMap<ItemTypeType, ColumnIds>>, destination: Partial<FieldMap<ItemTypeType>>, columns: ColumnInfo<ItemTypeType, ColumnIds[number]>[]): FieldMap<ItemTypeType, ColumnIds>;
|
|
49
|
-
shallowCopyFields<ItemTypeType extends ApiEnumItemType>(shallowSource: FieldMap<ItemTypeType>, deepSource: FieldMap<ItemTypeType>, destination: FieldMap<ItemTypeType>, columns: ColumnInfo<ItemTypeType>[]): FieldMap<ItemTypeType>;
|
|
50
|
-
setDefaultValues<ItemTypeType extends ApiEnumItemType = any>(destination: FieldMap<ItemTypeType>, columns: ColumnInfo<ItemTypeType>[]): FieldMap<ItemTypeType>;
|
|
51
|
-
/**
|
|
52
|
-
* @description
|
|
53
|
-
* Compares the given fields, returns `true` when the fields are equal
|
|
54
|
-
*/
|
|
55
|
-
compareFields<ColumnType extends ApiEnumApiType>(columnType: ColumnType, first?: ApiEnumApiTypeToTsTypeMap[ColumnType], second?: ApiEnumApiTypeToTsTypeMap[ColumnType]): boolean;
|
|
56
|
-
compareFloats(a: number, b: number): boolean;
|
|
57
|
-
compareMomentObjects(first: moment.Moment, second: moment.Moment): boolean;
|
|
58
|
-
compareDurations(first: moment.Duration, second: moment.Duration): boolean;
|
|
59
|
-
formatResponseValue(columnType: string, value: any): any;
|
|
60
|
-
formatRequestValue(columnType: string, value: any): any;
|
|
61
|
-
formatResponseDate(value: null | any): moment.Moment;
|
|
62
|
-
formatResponseDuration(value: null | number): moment.Duration;
|
|
63
|
-
formatResponseColor(value: string): string;
|
|
64
|
-
formatRequestDateTime(value: moment.Moment): string | null;
|
|
65
|
-
formatRequestDate(value: moment.Moment): string | null;
|
|
66
|
-
formatRequestDuration(value: moment.Duration): number;
|
|
67
|
-
formatRequestColor(value: string): string;
|
|
68
|
-
getDefaultValue(columnType: ApiEnumApiType): any;
|
|
69
|
-
isDefaultValue(columnType: ApiEnumApiType, value: any): boolean;
|
|
70
|
-
clone(columnType: string, value: any): any;
|
|
71
|
-
getCloneFunction(columnType: string): ((duration: moment.Duration) => moment.Duration) | ((date: moment.Moment) => moment.Moment);
|
|
72
|
-
cloneDuration(duration: moment.Duration): moment.Duration;
|
|
73
|
-
cloneDate(date: moment.Moment): moment.Moment;
|
|
74
|
-
identity<T>(input: T): T;
|
|
75
|
-
}
|
|
76
|
-
export {};
|
|
1
|
+
import { ApiEnumApiType, ApiEnumItemType, ApiFields, ResponseColumn } from '@rentman/backend-types';
|
|
2
|
+
import moment from 'moment';
|
|
3
|
+
import { ApiEnumApiTypeToTsTypeMap, ColumnInfo, FieldMap, ItemTypeColumnIds } from '../internal';
|
|
4
|
+
declare type GetChangesResult<ItemTypeType extends ApiEnumItemType = any, ColumnId extends keyof ApiFields[ItemTypeType] = any> = {
|
|
5
|
+
oldValue: FieldMap<ItemTypeType, [ColumnId]>[ColumnId];
|
|
6
|
+
newValue: FieldMap<ItemTypeType, [ColumnId]>[ColumnId];
|
|
7
|
+
column: ResponseColumn<ItemTypeType, ColumnId>;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* @description
|
|
11
|
+
* A service which provides functions to transform data that comes from/goes to the API
|
|
12
|
+
*
|
|
13
|
+
* @warning
|
|
14
|
+
* The code in these functions can be *very hot* on large databases, therefore performance must be kept in mind.
|
|
15
|
+
* This is also the reason why all column types are written out instead of using the enum
|
|
16
|
+
*/
|
|
17
|
+
export declare class ApiFormatter {
|
|
18
|
+
MOMENT_INVALID: string;
|
|
19
|
+
SERVER_DATETIME_FORMAT: string;
|
|
20
|
+
SERVER_TIME_FORMAT: string;
|
|
21
|
+
SERVER_DATE_FORMAT: string;
|
|
22
|
+
constructor();
|
|
23
|
+
/**
|
|
24
|
+
* @description
|
|
25
|
+
* Returns if a column type is an 'expensive' type, meaning that the action to format the field takes significant CPU time
|
|
26
|
+
*
|
|
27
|
+
* ----
|
|
28
|
+
* @remarks
|
|
29
|
+
* Currently only used for Moment objects
|
|
30
|
+
*/
|
|
31
|
+
isExpensiveFormat(columnType: ApiEnumApiType): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* @description
|
|
34
|
+
* Overwrites the values in 'changes' if the values in 'initial' and 'changes' are the same and the parent transaction
|
|
35
|
+
* copied over the field (leaving user changes intact)
|
|
36
|
+
*
|
|
37
|
+
* We have to check the parent transaction because on a child transaction initial/modified can be equal (the copied field of the parent)
|
|
38
|
+
* and will then incorrectly be overwritten by applyChangesFromParent
|
|
39
|
+
*
|
|
40
|
+
* Note: parentChanges can be undefined for local items
|
|
41
|
+
*/
|
|
42
|
+
mergeCopyFields<ItemTypeType extends ApiEnumItemType, ColumnIds extends ItemTypeColumnIds<ItemTypeType> = any>(parentChanges: FieldMap<ItemTypeType, ColumnIds> | undefined, changes: FieldMap<ItemTypeType, ColumnIds>, initial: FieldMap<ItemTypeType, ColumnIds>, newInitial: FieldMap<ItemTypeType, ColumnIds>, columns: ColumnInfo<ItemTypeType>[]): FieldMap<ItemTypeType, ColumnIds>;
|
|
43
|
+
formatRequestLocal<ItemTypeType extends ApiEnumItemType>(fields: FieldMap<ItemTypeType>, columns: ColumnInfo<ItemTypeType>[]): {
|
|
44
|
+
[columnId: string]: any;
|
|
45
|
+
};
|
|
46
|
+
hasChanges<ItemTypeType extends ApiEnumItemType>(initial: FieldMap<ItemTypeType>, modified: FieldMap<ItemTypeType>, columns: ColumnInfo<ItemTypeType>[], includeReadOnlyColumns?: boolean, forceCompare?: boolean): boolean;
|
|
47
|
+
getChanges<ItemTypeType extends ApiEnumItemType = any, ColumnIds extends ItemTypeColumnIds<ItemTypeType> = any>(initial: FieldMap<ItemTypeType, ColumnIds>, modified: FieldMap<ItemTypeType, ColumnIds>, columns: ColumnInfo<ItemTypeType, ColumnIds[number]>[]): GetChangesResult<ItemTypeType, ColumnIds[number]>[];
|
|
48
|
+
copyFields<ItemTypeType extends ApiEnumItemType = any, ColumnIds extends ItemTypeColumnIds<ItemTypeType> = any>(source: Partial<FieldMap<ItemTypeType, ColumnIds>>, destination: Partial<FieldMap<ItemTypeType>>, columns: ColumnInfo<ItemTypeType, ColumnIds[number]>[]): FieldMap<ItemTypeType, ColumnIds>;
|
|
49
|
+
shallowCopyFields<ItemTypeType extends ApiEnumItemType>(shallowSource: FieldMap<ItemTypeType>, deepSource: FieldMap<ItemTypeType>, destination: FieldMap<ItemTypeType>, columns: ColumnInfo<ItemTypeType>[]): FieldMap<ItemTypeType>;
|
|
50
|
+
setDefaultValues<ItemTypeType extends ApiEnumItemType = any>(destination: FieldMap<ItemTypeType>, columns: ColumnInfo<ItemTypeType>[]): FieldMap<ItemTypeType>;
|
|
51
|
+
/**
|
|
52
|
+
* @description
|
|
53
|
+
* Compares the given fields, returns `true` when the fields are equal
|
|
54
|
+
*/
|
|
55
|
+
compareFields<ColumnType extends ApiEnumApiType>(columnType: ColumnType, first?: ApiEnumApiTypeToTsTypeMap[ColumnType], second?: ApiEnumApiTypeToTsTypeMap[ColumnType]): boolean;
|
|
56
|
+
compareFloats(a: number, b: number): boolean;
|
|
57
|
+
compareMomentObjects(first: moment.Moment, second: moment.Moment): boolean;
|
|
58
|
+
compareDurations(first: moment.Duration, second: moment.Duration): boolean;
|
|
59
|
+
formatResponseValue(columnType: string, value: any): any;
|
|
60
|
+
formatRequestValue(columnType: string, value: any): any;
|
|
61
|
+
formatResponseDate(value: null | any): moment.Moment;
|
|
62
|
+
formatResponseDuration(value: null | number): moment.Duration;
|
|
63
|
+
formatResponseColor(value: string): string;
|
|
64
|
+
formatRequestDateTime(value: moment.Moment): string | null;
|
|
65
|
+
formatRequestDate(value: moment.Moment): string | null;
|
|
66
|
+
formatRequestDuration(value: moment.Duration): number;
|
|
67
|
+
formatRequestColor(value: string): string;
|
|
68
|
+
getDefaultValue(columnType: ApiEnumApiType): any;
|
|
69
|
+
isDefaultValue(columnType: ApiEnumApiType, value: any): boolean;
|
|
70
|
+
clone(columnType: string, value: any): any;
|
|
71
|
+
getCloneFunction(columnType: string): ((duration: moment.Duration) => moment.Duration) | ((date: moment.Moment) => moment.Moment);
|
|
72
|
+
cloneDuration(duration: moment.Duration): moment.Duration;
|
|
73
|
+
cloneDate(date: moment.Moment): moment.Moment;
|
|
74
|
+
identity<T>(input: T): T;
|
|
75
|
+
}
|
|
76
|
+
export {};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { ApiEnumItemType, ApiQuery, ItemId } from '@rentman/backend-types';
|
|
2
|
-
import { ApiRequestColumnMap, ApiRequestItemMap, ApiRequestLimit, ApiRequestServiceInterface, ApiResponseProcessor, ApiResponseProcessorFactory, PromiseInterface } from '../internal';
|
|
3
|
-
export declare class ApiRequestService {
|
|
4
|
-
private externalApiRequestService;
|
|
5
|
-
private apiResponseProcessorFactory;
|
|
6
|
-
constructor(externalApiRequestService: ApiRequestServiceInterface, apiResponseProcessorFactory: ApiResponseProcessorFactory);
|
|
7
|
-
template(itemType: ApiEnumItemType, params: any): PromiseInterface<ApiResponseProcessor>;
|
|
8
|
-
create(itemType: ApiEnumItemType, itemId: ItemId, values: any, parentType?: ApiEnumItemType, parentId?: ItemId): PromiseInterface<ApiResponseProcessor>;
|
|
9
|
-
delete(itemType: ApiEnumItemType, itemIds: ItemId[]): PromiseInterface<ApiResponseProcessor>;
|
|
10
|
-
updateItems(itemType: ApiEnumItemType, items: ApiRequestItemMap, columns: any): PromiseInterface<ApiResponseProcessor>;
|
|
11
|
-
requestSkeleton(params: any, requestCanceler?: PromiseInterface<any>): PromiseInterface<ApiResponseProcessor>;
|
|
12
|
-
moveItems(parentType: ApiEnumItemType, parentId: ItemId, items: {
|
|
13
|
-
[itemType: string]: ItemId[];
|
|
14
|
-
}): PromiseInterface<ApiResponseProcessor>;
|
|
15
|
-
columns(itemType: ApiEnumItemType, columns: ApiRequestColumnMap, params?: any): PromiseInterface<ApiResponseProcessor>;
|
|
16
|
-
query<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, query: ApiQuery<ItemTypeType>, columns: ApiRequestColumnMap, limit?: ApiRequestLimit): PromiseInterface<ApiResponseProcessor>;
|
|
17
|
-
processResponse(request: any): PromiseInterface<ApiResponseProcessor>;
|
|
18
|
-
}
|
|
1
|
+
import { ApiEnumItemType, ApiQuery, ItemId } from '@rentman/backend-types';
|
|
2
|
+
import { ApiRequestColumnMap, ApiRequestItemMap, ApiRequestLimit, ApiRequestServiceInterface, ApiResponseProcessor, ApiResponseProcessorFactory, PromiseInterface } from '../internal';
|
|
3
|
+
export declare class ApiRequestService {
|
|
4
|
+
private externalApiRequestService;
|
|
5
|
+
private apiResponseProcessorFactory;
|
|
6
|
+
constructor(externalApiRequestService: ApiRequestServiceInterface, apiResponseProcessorFactory: ApiResponseProcessorFactory);
|
|
7
|
+
template(itemType: ApiEnumItemType, params: any): PromiseInterface<ApiResponseProcessor>;
|
|
8
|
+
create(itemType: ApiEnumItemType, itemId: ItemId, values: any, parentType?: ApiEnumItemType, parentId?: ItemId): PromiseInterface<ApiResponseProcessor>;
|
|
9
|
+
delete(itemType: ApiEnumItemType, itemIds: ItemId[]): PromiseInterface<ApiResponseProcessor>;
|
|
10
|
+
updateItems(itemType: ApiEnumItemType, items: ApiRequestItemMap, columns: any): PromiseInterface<ApiResponseProcessor>;
|
|
11
|
+
requestSkeleton(params: any, requestCanceler?: PromiseInterface<any>): PromiseInterface<ApiResponseProcessor>;
|
|
12
|
+
moveItems(parentType: ApiEnumItemType, parentId: ItemId, items: {
|
|
13
|
+
[itemType: string]: ItemId[];
|
|
14
|
+
}): PromiseInterface<ApiResponseProcessor>;
|
|
15
|
+
columns(itemType: ApiEnumItemType, columns: ApiRequestColumnMap, params?: any): PromiseInterface<ApiResponseProcessor>;
|
|
16
|
+
query<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, query: ApiQuery<ItemTypeType>, columns: ApiRequestColumnMap, limit?: ApiRequestLimit): PromiseInterface<ApiResponseProcessor>;
|
|
17
|
+
processResponse(request: any): PromiseInterface<ApiResponseProcessor>;
|
|
18
|
+
}
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { ApiEnumItemType, ItemId, ResponseColumn } from '@rentman/backend-types';
|
|
2
|
-
import { ApiFormatter, ApiResponse, ColumnInfo, FieldMap, ItemTypeMap, ResponseColumnItemTypeMap, ResponseColumnMap } from '../internal';
|
|
3
|
-
export declare class ApiResponseProcessor<RequestItemType extends ApiEnumItemType = any> {
|
|
4
|
-
apiFormatter: ApiFormatter;
|
|
5
|
-
response: ApiResponse;
|
|
6
|
-
itemType: RequestItemType;
|
|
7
|
-
columns: ItemTypeMap<ResponseColumn[]>;
|
|
8
|
-
links: ItemTypeMap<ItemId[]>;
|
|
9
|
-
cacheable: boolean;
|
|
10
|
-
map: any;
|
|
11
|
-
items: any;
|
|
12
|
-
columnIndexMap: {
|
|
13
|
-
[itemType: string]: {
|
|
14
|
-
[columnId: string]: number;
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
columnMap: any;
|
|
18
|
-
constructor(apiFormatter: ApiFormatter, response: ApiResponse);
|
|
19
|
-
fetchColumnObject(itemType: ApiEnumItemType): ResponseColumnMap;
|
|
20
|
-
fetchValue(itemType: ApiEnumItemType, itemId: ItemId, columnId: string): any;
|
|
21
|
-
fetchColumnArray(itemType: ApiEnumItemType): ResponseColumn[];
|
|
22
|
-
fetchDerivedObject(itemType: ApiEnumItemType, itemId: ItemId, rootColumns: ColumnInfo[]): {};
|
|
23
|
-
fetchDerivedValues(value: any, column: ColumnInfo, destination: any): void;
|
|
24
|
-
fetchObject<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, itemId: string | ItemId): FieldMap<ItemTypeType> | undefined;
|
|
25
|
-
fetchObjectArray<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, idArray?: ItemId[] | null): FieldMap<ItemTypeType>[];
|
|
26
|
-
fetchColumnsObject(): ResponseColumnItemTypeMap;
|
|
27
|
-
private addLazyFormattingFunction;
|
|
28
|
-
private createColumnMaps;
|
|
29
|
-
}
|
|
1
|
+
import { ApiEnumItemType, ItemId, ResponseColumn } from '@rentman/backend-types';
|
|
2
|
+
import { ApiFormatter, ApiResponse, ColumnInfo, FieldMap, ItemTypeMap, ResponseColumnItemTypeMap, ResponseColumnMap } from '../internal';
|
|
3
|
+
export declare class ApiResponseProcessor<RequestItemType extends ApiEnumItemType = any> {
|
|
4
|
+
apiFormatter: ApiFormatter;
|
|
5
|
+
response: ApiResponse;
|
|
6
|
+
itemType: RequestItemType;
|
|
7
|
+
columns: ItemTypeMap<ResponseColumn[]>;
|
|
8
|
+
links: ItemTypeMap<ItemId[]>;
|
|
9
|
+
cacheable: boolean;
|
|
10
|
+
map: any;
|
|
11
|
+
items: any;
|
|
12
|
+
columnIndexMap: {
|
|
13
|
+
[itemType: string]: {
|
|
14
|
+
[columnId: string]: number;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
columnMap: any;
|
|
18
|
+
constructor(apiFormatter: ApiFormatter, response: ApiResponse);
|
|
19
|
+
fetchColumnObject(itemType: ApiEnumItemType): ResponseColumnMap;
|
|
20
|
+
fetchValue(itemType: ApiEnumItemType, itemId: ItemId, columnId: string): any;
|
|
21
|
+
fetchColumnArray(itemType: ApiEnumItemType): ResponseColumn[];
|
|
22
|
+
fetchDerivedObject(itemType: ApiEnumItemType, itemId: ItemId, rootColumns: ColumnInfo[]): {};
|
|
23
|
+
fetchDerivedValues(value: any, column: ColumnInfo, destination: any): void;
|
|
24
|
+
fetchObject<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, itemId: string | ItemId): FieldMap<ItemTypeType> | undefined;
|
|
25
|
+
fetchObjectArray<ItemTypeType extends ApiEnumItemType>(itemType: ItemTypeType, idArray?: ItemId[] | null): FieldMap<ItemTypeType>[];
|
|
26
|
+
fetchColumnsObject(): ResponseColumnItemTypeMap;
|
|
27
|
+
private addLazyFormattingFunction;
|
|
28
|
+
private createColumnMaps;
|
|
29
|
+
}
|
|
@@ -1,100 +1,100 @@
|
|
|
1
|
-
import { ApiModuleFunctionLocalsGetLocals } from '@rentman/backend-types';
|
|
2
|
-
import { ChangesDeltaFactory } from '../../factories/ChangesDeltaFactory';
|
|
3
|
-
import { ErrorHandlerInterface } from '../../interfaces/ErrorHandlerInterface';
|
|
4
|
-
import { PromiseLibraryInterface } from '../../interfaces/PromiseLibraryInterface';
|
|
5
|
-
import { PromiseInterface } from '../../types/PromiseInterface';
|
|
6
|
-
import { ApiFormatter } from '../ApiFormatter';
|
|
7
|
-
import { TransactionCache } from '../cache/transaction/TransactionCache';
|
|
8
|
-
import { ChangesDelta } from '../ChangesDelta';
|
|
9
|
-
import { CustomFieldTypeBusinessLogicRule } from './Customfield/CustomFieldTypeBusinessLogicRule';
|
|
10
|
-
import { DocumentTemplateBusinessLogicRule } from './Documents/DocumentTemplateBusinessLogicRule';
|
|
11
|
-
import { ExemplaarAanschafdatumBusinessLogicRule } from './Exemplaar/ExemplaarAanschafdatumBusinessLogicRule';
|
|
12
|
-
import { FactuurBetalingsconditieBusinessLogicRule } from './Factuur/FactuurBetalingsconditieBusinessLogicRule';
|
|
13
|
-
import { FactuurDatumBusinessLogicRule } from './Factuur/FactuurDatumBusinessLogicRule';
|
|
14
|
-
import { FactuurNumberseriesBusinessLogicRule } from './Factuur/FactuurNumberseriesBusinessLogicRule';
|
|
15
|
-
import { FunctieNaaminternBusinessLogicRule } from './Functie/FunctieNaaminternBusinessLogicRule';
|
|
16
|
-
import { FunctieTwowayBusinessLogicRule } from './Functie/FunctieTwowayBusinessLogicRule';
|
|
17
|
-
import { MateriaalTelexemplarenBusinessLogicRule } from './Materiaal/MateriaalTelexemplarenBusinessLogicRule';
|
|
18
|
-
import { MateriaalTypeBusinessLogicRule } from './Materiaal/MateriaalTypeBusinessLogicRule';
|
|
19
|
-
import { MateriaalVerhuurBusinessLogicRule } from './Materiaal/MateriaalVerhuurBusinessLogicRule';
|
|
20
|
-
import { SurfaceArticleSizeBusinessLogicRule } from './Materiaal/SurfaceArticleSizeBusinessLogicRule';
|
|
21
|
-
import { OfferteContractDatumBusinessLogicRule } from './OfferteContract/OfferteContractDatumBusinessLogicRule';
|
|
22
|
-
import { PlanningPersoneelTransportBusinessLogicRule } from './PlanningPersoneelTransport/PlanningPersoneelTransportBusinessLogicRule';
|
|
23
|
-
import { ProjectClientNoteBusinessLogicRule } from './Project/ProjectClientNoteBusinessLogicRule';
|
|
24
|
-
import { ReparatiesExemplaarAantalBusinessLogicRule } from './Reparatie/ReparatieExemplaarAantalBusinessLogicRule';
|
|
25
|
-
import { ReparatiesExemplaarLocationBusinessLogicRule } from './Reparatie/ReparatieExemplaarLocationBusinessLogicRule';
|
|
26
|
-
import { RolDocumentAccessBusinessLogicRule } from './Rol/RolDocumentAccessBusinessLogicRule';
|
|
27
|
-
import { RolEditOwnDataBusinessLogicRule } from './Rol/RolEditOwnDataBusinessLogicRule';
|
|
28
|
-
import { RolFileAccessBusinessLogicRule } from './Rol/RolFileAccessBusinessLogicRule';
|
|
29
|
-
import { RolPersoneelsplannerToegangBusinessLogicRule } from './Rol/RolPersoneelsplannerToegangBusinessLogicRule';
|
|
30
|
-
import { RolProjectenBewerkenBusinessLogicRule } from './Rol/RolProjectenBewerkenBusinessLogicRule';
|
|
31
|
-
import { RolProjectenToegangBusinessLogicRule } from './Rol/RolProjectenToegangBusinessLogicRule';
|
|
32
|
-
/**
|
|
33
|
-
* @description
|
|
34
|
-
* The BusinessLogicManager is responsible for calling all business rules with a ChangesDelta and storing their results for the {@link BusinessLogicRule business logic phases}.
|
|
35
|
-
*/
|
|
36
|
-
export declare class BusinessLogicManager {
|
|
37
|
-
private apiFormatter;
|
|
38
|
-
private changesDeltaFactory;
|
|
39
|
-
private errorHandler;
|
|
40
|
-
private promiseLibrary;
|
|
41
|
-
private locals;
|
|
42
|
-
/**
|
|
43
|
-
* @description
|
|
44
|
-
* The business rules are stored in a map so that the core-consumer can overwrite the {@link BusinessLogicRule.confirmFn confirmFn} to show a confirmation
|
|
45
|
-
*
|
|
46
|
-
* @remark
|
|
47
|
-
* This property is intentionally not typed so that the keys can be inferred
|
|
48
|
-
*
|
|
49
|
-
* @private
|
|
50
|
-
*/
|
|
51
|
-
allBusinessRules: {
|
|
52
|
-
FunctieTwowayBusinessLogicRule: FunctieTwowayBusinessLogicRule;
|
|
53
|
-
FunctieNaaminternBusinessLogicRule: FunctieNaaminternBusinessLogicRule;
|
|
54
|
-
CustomFieldTypeBusinessLogicRule: CustomFieldTypeBusinessLogicRule;
|
|
55
|
-
RolDocumentAccessBusinessLogicRule: RolDocumentAccessBusinessLogicRule;
|
|
56
|
-
RolEditOwnDataBusinessLogicRule: RolEditOwnDataBusinessLogicRule;
|
|
57
|
-
RolFileAccessBusinessLogicRule: RolFileAccessBusinessLogicRule;
|
|
58
|
-
RolPersoneelsplannerToegangBusinessLogicRule: RolPersoneelsplannerToegangBusinessLogicRule;
|
|
59
|
-
RolProjectenBewerkenBusinessLogicRule: RolProjectenBewerkenBusinessLogicRule;
|
|
60
|
-
RolProjectenToegangBusinessLogicRule: RolProjectenToegangBusinessLogicRule;
|
|
61
|
-
ExemplaarAanschafdatumBusinessLogicRule: ExemplaarAanschafdatumBusinessLogicRule;
|
|
62
|
-
ReparatiesExemplaarAantalBusinessLogicRule: ReparatiesExemplaarAantalBusinessLogicRule;
|
|
63
|
-
ReparatiesExemplaarLocationBusinessLogicRule: ReparatiesExemplaarLocationBusinessLogicRule;
|
|
64
|
-
MateriaalVerhuurBusinessLogicRule: MateriaalVerhuurBusinessLogicRule;
|
|
65
|
-
MateriaalTypeBusinessLogicRule: MateriaalTypeBusinessLogicRule;
|
|
66
|
-
SurfaceArticleSizeBusinessLogicRule: SurfaceArticleSizeBusinessLogicRule;
|
|
67
|
-
MateriaalTelexemplarenBusinessLogicRule: MateriaalTelexemplarenBusinessLogicRule;
|
|
68
|
-
PlanningPersoneelTransportBusinessLogicRule: PlanningPersoneelTransportBusinessLogicRule;
|
|
69
|
-
ProjectClientNoteBusinessLogicRule: ProjectClientNoteBusinessLogicRule;
|
|
70
|
-
FactuurNumberseriesBusinessLogicRule: FactuurNumberseriesBusinessLogicRule;
|
|
71
|
-
FactuurBetalingsconditieBusinessLogicRule: FactuurBetalingsconditieBusinessLogicRule;
|
|
72
|
-
FactuurDatumBusinessLogicRule: FactuurDatumBusinessLogicRule;
|
|
73
|
-
OfferteContractDatumBusinessLogicRule: OfferteContractDatumBusinessLogicRule;
|
|
74
|
-
DocumentTemplateBusinessLogicRule: DocumentTemplateBusinessLogicRule;
|
|
75
|
-
};
|
|
76
|
-
constructor(apiFormatter: ApiFormatter, changesDeltaFactory: ChangesDeltaFactory, errorHandler: ErrorHandlerInterface, promiseLibrary: PromiseLibraryInterface, locals: ApiModuleFunctionLocalsGetLocals);
|
|
77
|
-
/**
|
|
78
|
-
* @description
|
|
79
|
-
* Handles the business logic for a given ChangesDelta. It will provide a *new* ChangesDelta on which the business rules can apply their data, so that
|
|
80
|
-
* if new changes are made on *only those new changes* the business logic can be run again.
|
|
81
|
-
*
|
|
82
|
-
* example:
|
|
83
|
-
* - `Functie.twoway` changes the `Functie.afstand` field
|
|
84
|
-
* - In a second iteration (recursive call) the `Functie.afstand` field updates `Functie.prijs`
|
|
85
|
-
* (by doing `Functie.afstand` * `Functie.kilometerprijs`)
|
|
86
|
-
* - In a third iteration (2nd recursive call) the `Functie.kilometerprijs` has no business logic, so the function
|
|
87
|
-
* exits early (`rulesToRun.size === 0`) and the recursion ends
|
|
88
|
-
*
|
|
89
|
-
* @param transaction The transaction the ChangesDelta will be applied on
|
|
90
|
-
* @param changesDelta The source ChangesDelta which contains the changes the rules should be checked on
|
|
91
|
-
*
|
|
92
|
-
* @private should only be called by the core
|
|
93
|
-
*/
|
|
94
|
-
handleBusinessLogic(transaction: TransactionCache, changesDelta: ChangesDelta): PromiseInterface<ChangesDelta>;
|
|
95
|
-
private waitForRuleApplication;
|
|
96
|
-
private waitForRuleDependencies;
|
|
97
|
-
private waitForRuleDependency;
|
|
98
|
-
private extractRulesToRun;
|
|
99
|
-
private extractRuleToRun;
|
|
100
|
-
}
|
|
1
|
+
import { ApiModuleFunctionLocalsGetLocals } from '@rentman/backend-types';
|
|
2
|
+
import { ChangesDeltaFactory } from '../../factories/ChangesDeltaFactory';
|
|
3
|
+
import { ErrorHandlerInterface } from '../../interfaces/ErrorHandlerInterface';
|
|
4
|
+
import { PromiseLibraryInterface } from '../../interfaces/PromiseLibraryInterface';
|
|
5
|
+
import { PromiseInterface } from '../../types/PromiseInterface';
|
|
6
|
+
import { ApiFormatter } from '../ApiFormatter';
|
|
7
|
+
import { TransactionCache } from '../cache/transaction/TransactionCache';
|
|
8
|
+
import { ChangesDelta } from '../ChangesDelta';
|
|
9
|
+
import { CustomFieldTypeBusinessLogicRule } from './Customfield/CustomFieldTypeBusinessLogicRule';
|
|
10
|
+
import { DocumentTemplateBusinessLogicRule } from './Documents/DocumentTemplateBusinessLogicRule';
|
|
11
|
+
import { ExemplaarAanschafdatumBusinessLogicRule } from './Exemplaar/ExemplaarAanschafdatumBusinessLogicRule';
|
|
12
|
+
import { FactuurBetalingsconditieBusinessLogicRule } from './Factuur/FactuurBetalingsconditieBusinessLogicRule';
|
|
13
|
+
import { FactuurDatumBusinessLogicRule } from './Factuur/FactuurDatumBusinessLogicRule';
|
|
14
|
+
import { FactuurNumberseriesBusinessLogicRule } from './Factuur/FactuurNumberseriesBusinessLogicRule';
|
|
15
|
+
import { FunctieNaaminternBusinessLogicRule } from './Functie/FunctieNaaminternBusinessLogicRule';
|
|
16
|
+
import { FunctieTwowayBusinessLogicRule } from './Functie/FunctieTwowayBusinessLogicRule';
|
|
17
|
+
import { MateriaalTelexemplarenBusinessLogicRule } from './Materiaal/MateriaalTelexemplarenBusinessLogicRule';
|
|
18
|
+
import { MateriaalTypeBusinessLogicRule } from './Materiaal/MateriaalTypeBusinessLogicRule';
|
|
19
|
+
import { MateriaalVerhuurBusinessLogicRule } from './Materiaal/MateriaalVerhuurBusinessLogicRule';
|
|
20
|
+
import { SurfaceArticleSizeBusinessLogicRule } from './Materiaal/SurfaceArticleSizeBusinessLogicRule';
|
|
21
|
+
import { OfferteContractDatumBusinessLogicRule } from './OfferteContract/OfferteContractDatumBusinessLogicRule';
|
|
22
|
+
import { PlanningPersoneelTransportBusinessLogicRule } from './PlanningPersoneelTransport/PlanningPersoneelTransportBusinessLogicRule';
|
|
23
|
+
import { ProjectClientNoteBusinessLogicRule } from './Project/ProjectClientNoteBusinessLogicRule';
|
|
24
|
+
import { ReparatiesExemplaarAantalBusinessLogicRule } from './Reparatie/ReparatieExemplaarAantalBusinessLogicRule';
|
|
25
|
+
import { ReparatiesExemplaarLocationBusinessLogicRule } from './Reparatie/ReparatieExemplaarLocationBusinessLogicRule';
|
|
26
|
+
import { RolDocumentAccessBusinessLogicRule } from './Rol/RolDocumentAccessBusinessLogicRule';
|
|
27
|
+
import { RolEditOwnDataBusinessLogicRule } from './Rol/RolEditOwnDataBusinessLogicRule';
|
|
28
|
+
import { RolFileAccessBusinessLogicRule } from './Rol/RolFileAccessBusinessLogicRule';
|
|
29
|
+
import { RolPersoneelsplannerToegangBusinessLogicRule } from './Rol/RolPersoneelsplannerToegangBusinessLogicRule';
|
|
30
|
+
import { RolProjectenBewerkenBusinessLogicRule } from './Rol/RolProjectenBewerkenBusinessLogicRule';
|
|
31
|
+
import { RolProjectenToegangBusinessLogicRule } from './Rol/RolProjectenToegangBusinessLogicRule';
|
|
32
|
+
/**
|
|
33
|
+
* @description
|
|
34
|
+
* The BusinessLogicManager is responsible for calling all business rules with a ChangesDelta and storing their results for the {@link BusinessLogicRule business logic phases}.
|
|
35
|
+
*/
|
|
36
|
+
export declare class BusinessLogicManager {
|
|
37
|
+
private apiFormatter;
|
|
38
|
+
private changesDeltaFactory;
|
|
39
|
+
private errorHandler;
|
|
40
|
+
private promiseLibrary;
|
|
41
|
+
private locals;
|
|
42
|
+
/**
|
|
43
|
+
* @description
|
|
44
|
+
* The business rules are stored in a map so that the core-consumer can overwrite the {@link BusinessLogicRule.confirmFn confirmFn} to show a confirmation
|
|
45
|
+
*
|
|
46
|
+
* @remark
|
|
47
|
+
* This property is intentionally not typed so that the keys can be inferred
|
|
48
|
+
*
|
|
49
|
+
* @private
|
|
50
|
+
*/
|
|
51
|
+
allBusinessRules: {
|
|
52
|
+
FunctieTwowayBusinessLogicRule: FunctieTwowayBusinessLogicRule;
|
|
53
|
+
FunctieNaaminternBusinessLogicRule: FunctieNaaminternBusinessLogicRule;
|
|
54
|
+
CustomFieldTypeBusinessLogicRule: CustomFieldTypeBusinessLogicRule;
|
|
55
|
+
RolDocumentAccessBusinessLogicRule: RolDocumentAccessBusinessLogicRule;
|
|
56
|
+
RolEditOwnDataBusinessLogicRule: RolEditOwnDataBusinessLogicRule;
|
|
57
|
+
RolFileAccessBusinessLogicRule: RolFileAccessBusinessLogicRule;
|
|
58
|
+
RolPersoneelsplannerToegangBusinessLogicRule: RolPersoneelsplannerToegangBusinessLogicRule;
|
|
59
|
+
RolProjectenBewerkenBusinessLogicRule: RolProjectenBewerkenBusinessLogicRule;
|
|
60
|
+
RolProjectenToegangBusinessLogicRule: RolProjectenToegangBusinessLogicRule;
|
|
61
|
+
ExemplaarAanschafdatumBusinessLogicRule: ExemplaarAanschafdatumBusinessLogicRule;
|
|
62
|
+
ReparatiesExemplaarAantalBusinessLogicRule: ReparatiesExemplaarAantalBusinessLogicRule;
|
|
63
|
+
ReparatiesExemplaarLocationBusinessLogicRule: ReparatiesExemplaarLocationBusinessLogicRule;
|
|
64
|
+
MateriaalVerhuurBusinessLogicRule: MateriaalVerhuurBusinessLogicRule;
|
|
65
|
+
MateriaalTypeBusinessLogicRule: MateriaalTypeBusinessLogicRule;
|
|
66
|
+
SurfaceArticleSizeBusinessLogicRule: SurfaceArticleSizeBusinessLogicRule;
|
|
67
|
+
MateriaalTelexemplarenBusinessLogicRule: MateriaalTelexemplarenBusinessLogicRule;
|
|
68
|
+
PlanningPersoneelTransportBusinessLogicRule: PlanningPersoneelTransportBusinessLogicRule;
|
|
69
|
+
ProjectClientNoteBusinessLogicRule: ProjectClientNoteBusinessLogicRule;
|
|
70
|
+
FactuurNumberseriesBusinessLogicRule: FactuurNumberseriesBusinessLogicRule;
|
|
71
|
+
FactuurBetalingsconditieBusinessLogicRule: FactuurBetalingsconditieBusinessLogicRule;
|
|
72
|
+
FactuurDatumBusinessLogicRule: FactuurDatumBusinessLogicRule;
|
|
73
|
+
OfferteContractDatumBusinessLogicRule: OfferteContractDatumBusinessLogicRule;
|
|
74
|
+
DocumentTemplateBusinessLogicRule: DocumentTemplateBusinessLogicRule;
|
|
75
|
+
};
|
|
76
|
+
constructor(apiFormatter: ApiFormatter, changesDeltaFactory: ChangesDeltaFactory, errorHandler: ErrorHandlerInterface, promiseLibrary: PromiseLibraryInterface, locals: ApiModuleFunctionLocalsGetLocals);
|
|
77
|
+
/**
|
|
78
|
+
* @description
|
|
79
|
+
* Handles the business logic for a given ChangesDelta. It will provide a *new* ChangesDelta on which the business rules can apply their data, so that
|
|
80
|
+
* if new changes are made on *only those new changes* the business logic can be run again.
|
|
81
|
+
*
|
|
82
|
+
* example:
|
|
83
|
+
* - `Functie.twoway` changes the `Functie.afstand` field
|
|
84
|
+
* - In a second iteration (recursive call) the `Functie.afstand` field updates `Functie.prijs`
|
|
85
|
+
* (by doing `Functie.afstand` * `Functie.kilometerprijs`)
|
|
86
|
+
* - In a third iteration (2nd recursive call) the `Functie.kilometerprijs` has no business logic, so the function
|
|
87
|
+
* exits early (`rulesToRun.size === 0`) and the recursion ends
|
|
88
|
+
*
|
|
89
|
+
* @param transaction The transaction the ChangesDelta will be applied on
|
|
90
|
+
* @param changesDelta The source ChangesDelta which contains the changes the rules should be checked on
|
|
91
|
+
*
|
|
92
|
+
* @private should only be called by the core
|
|
93
|
+
*/
|
|
94
|
+
handleBusinessLogic(transaction: TransactionCache, changesDelta: ChangesDelta): PromiseInterface<ChangesDelta>;
|
|
95
|
+
private waitForRuleApplication;
|
|
96
|
+
private waitForRuleDependencies;
|
|
97
|
+
private waitForRuleDependency;
|
|
98
|
+
private extractRulesToRun;
|
|
99
|
+
private extractRuleToRun;
|
|
100
|
+
}
|