@rentman/rm-core 63.4.1 → 64.0.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/dist/rm-core.js +1 -1
- package/dist/rm-core.js.map +1 -1
- package/dist/types/src/classes/BusinessLogicManager/AantalBusinessLogicRuleBase.d.ts +9 -11
- package/dist/types/src/classes/BusinessLogicManager/AantaltotaalBusinessLogicRuleBase.d.ts +12 -11
- package/dist/types/src/classes/BusinessLogicManager/BusinessLogicManager.d.ts +6 -7
- package/dist/types/src/classes/BusinessLogicManager/BusinessLogicRule.d.ts +2 -9
- package/dist/types/src/classes/BusinessLogicManager/BusinessLogicRuleApplyContext.d.ts +3 -10
- package/dist/types/src/classes/BusinessLogicManager/BusinessLogicRuleConditionContext.d.ts +5 -17
- package/dist/types/src/classes/BusinessLogicManager/BusinessLogicRuleContextBase.d.ts +4 -55
- package/dist/types/src/classes/BusinessLogicManager/Customfield/CustomFieldLinkedItemTypeBusinessLogicRule.d.ts +2 -1
- package/dist/types/src/classes/BusinessLogicManager/Customfield/CustomFieldTypeBusinessLogicRule.d.ts +2 -1
- package/dist/types/src/classes/BusinessLogicManager/DefaultContactPersonUpdateBusinessLogicRule.d.ts +34 -13
- package/dist/types/src/classes/BusinessLogicManager/Documents/DocumentTemplateBusinessLogicRule.d.ts +3 -2
- package/dist/types/src/classes/BusinessLogicManager/Exemplaar/ExemplaarAanschafdatumBusinessLogicRule.d.ts +2 -1
- package/dist/types/src/classes/BusinessLogicManager/Factuur/FactuurBetalingsconditieBusinessLogicRule.d.ts +11 -6
- package/dist/types/src/classes/BusinessLogicManager/Factuur/FactuurDatumBusinessLogicRule.d.ts +5 -4
- package/dist/types/src/classes/BusinessLogicManager/Factuur/FactuurNumberseriesBusinessLogicRule.d.ts +2 -1
- package/dist/types/src/classes/BusinessLogicManager/Files/FilesNameExtensionBusinessLogicRule.d.ts +3 -2
- package/dist/types/src/classes/BusinessLogicManager/Functie/FunctieNaaminternBusinessLogicRule.d.ts +2 -1
- package/dist/types/src/classes/BusinessLogicManager/Functie/FunctieTwowayBusinessLogicRule.d.ts +2 -1
- package/dist/types/src/classes/BusinessLogicManager/Functie/functieTravelDistanceUtils.d.ts +1 -1
- package/dist/types/src/classes/BusinessLogicManager/Functiegroep/FunctiegroepSubprojectBusinessLogicRule.d.ts +9 -3
- package/dist/types/src/classes/BusinessLogicManager/Materiaal/MateriaalBulkToSerialBusinessLogicRule.d.ts +4 -2
- package/dist/types/src/classes/BusinessLogicManager/Materiaal/MateriaalSerialToBulkBusinessLogicRule.d.ts +4 -2
- package/dist/types/src/classes/BusinessLogicManager/Materiaal/MateriaalVerhuurBusinessLogicRule.d.ts +2 -2
- package/dist/types/src/classes/BusinessLogicManager/Materiaal/SurfaceArticleSizeBusinessLogicRule.d.ts +2 -10
- package/dist/types/src/classes/BusinessLogicManager/MateriaalCatFunctieFunctiegroep/LinkedTimeItemBusinessLogicRuleBase.d.ts +10 -17
- package/dist/types/src/classes/BusinessLogicManager/MateriaalCatFunctieFunctiegroep/LinkedTimeItemDurationBusinessLogicRule.d.ts +4 -4
- package/dist/types/src/classes/BusinessLogicManager/MateriaalCatFunctieFunctiegroep/LinkedTimeItemMateriaalCatBusinessLogicRule.d.ts +6 -7
- package/dist/types/src/classes/BusinessLogicManager/MateriaalCatFunctieFunctiegroep/LinkedTimeItemSubprojectBusinessLogicRule.d.ts +5 -20
- package/dist/types/src/classes/BusinessLogicManager/MateriaalCatFunctieFunctiegroep/LinkedTimeItemTimeSchemeBusinessLogicRule.d.ts +7 -5
- package/dist/types/src/classes/BusinessLogicManager/MateriaalCatFunctieFunctiegroep/LinkedTimeItemTimeSchemeStartBusinessLogicRule.d.ts +7 -5
- package/dist/types/src/classes/BusinessLogicManager/MateriaalCatFunctieFunctiegroep/LinkedTimeItemTimeValueStartBusinessLogicRule.d.ts +6 -5
- package/dist/types/src/classes/BusinessLogicManager/MateriaalCatFunctieFunctiegroep/TimeColumnUtil.d.ts +1 -1
- package/dist/types/src/classes/BusinessLogicManager/OfferteContract/OfferteContractDatumBusinessLogicRule.d.ts +3 -2
- package/dist/types/src/classes/BusinessLogicManager/PlanningPersoneelTransport/PlanningPersoneelTransportBusinessLogicRule.d.ts +6 -4
- package/dist/types/src/classes/BusinessLogicManager/Planningmateriaal/PlanningmateriaalOptieBusinessLogicRule.d.ts +1 -1
- package/dist/types/src/classes/BusinessLogicManager/Planningmateriaal/PlanningmateriaalParentBusinessLogicRule.d.ts +1 -3
- package/dist/types/src/classes/BusinessLogicManager/Planningmateriaal/PlanningmateriaalStaysAtLocationBusinessLogicRule.d.ts +3 -10
- package/dist/types/src/classes/BusinessLogicManager/Project/ProjectContactProjectNoteBusinessLogicRule.d.ts +5 -3
- package/dist/types/src/classes/BusinessLogicManager/Project/ProjectOneSubLocationAlignBusinessRule.d.ts +4 -2
- package/dist/types/src/classes/BusinessLogicManager/Rate/RateDeactivateExistingOnCreateBusinessLogicRule.d.ts +2 -1
- package/dist/types/src/classes/BusinessLogicManager/Reparatie/ReparatieExemplaarAantalBusinessLogicRule.d.ts +2 -1
- package/dist/types/src/classes/BusinessLogicManager/Reparatie/ReparatieLostItemExemplaarLocationBusinessLogicRule.d.ts +2 -1
- package/dist/types/src/classes/BusinessLogicManager/Rol/RolEditOwnDataBusinessLogicRule.d.ts +2 -3
- package/dist/types/src/classes/BusinessLogicManager/Rol/RolPersoneelsplannerToegangBusinessLogicRule.d.ts +2 -3
- package/dist/types/src/classes/BusinessLogicManager/Rol/RolProjectenBewerkenBusinessLogicRule.d.ts +2 -3
- package/dist/types/src/classes/BusinessLogicManager/Rol/RolProjectenToegangBusinessLogicRule.d.ts +2 -4
- package/dist/types/src/classes/BusinessLogicManager/Rol/RolVisibilityFinancialsBusinessLogicRule.d.ts +2 -7
- package/dist/types/src/classes/BusinessLogicManager/Rol/RolWarehosueTrackingLogAccessBusinessLogicRule.d.ts +2 -3
- package/dist/types/src/classes/BusinessLogicManager/Setinhoud/SetinhoudCreateFixedBusinessLogicRule.d.ts +4 -4
- package/dist/types/src/classes/BusinessLogicManager/Subproject/SubprojectInPlanningBusinessLogicRule.d.ts +2 -1
- package/dist/types/src/classes/BusinessLogicManager/Subproject/SubprojectOneSubLocationAlignBusinessRule.d.ts +4 -2
- package/dist/types/src/classes/BusinessLogicManager/Subproject/SubprojectOneSubNameAlignBusinessRule.d.ts +4 -2
- package/dist/types/src/classes/BusinessLogicManager/Taak/TaakDeadlineOffsetBusinessLogicRule.d.ts +2 -2
- package/dist/types/src/classes/BusinessLogicManager/Tijd/TijdPropagateNameToFunctiegroepBusinessLogicRule.d.ts +4 -2
- package/dist/types/src/classes/BusinessLogicManager/Tijd/TijdSubprojectChangedBusinessLogicRule.d.ts +6 -2
- package/dist/types/src/classes/BusinessLogicManager/Uren/HoursTypeBusinessLogicRuleBase.d.ts +1 -2
- package/dist/types/src/classes/ChangesDelta.d.ts +7 -9
- package/dist/types/src/classes/ChangesDeltaBase.d.ts +11 -14
- package/dist/types/src/classes/ChangesProcessor.d.ts +3 -3
- package/dist/types/src/classes/ChildChangesDelta.d.ts +18 -7
- package/dist/types/src/classes/CreatedChangesDelta.d.ts +2 -2
- package/dist/types/src/classes/ParentChangesDelta.d.ts +7 -6
- package/dist/types/src/classes/SocketMessageHandler.d.ts +4 -2
- package/dist/types/src/classes/Util.d.ts +1 -0
- package/dist/types/src/classes/cache/AbstractCache.d.ts +1 -6
- package/dist/types/src/classes/cache/server/ServerCache.d.ts +4 -2
- package/dist/types/src/classes/cache/transaction/TransactionCache.d.ts +69 -23
- package/dist/types/src/core.d.ts +0 -2
- package/dist/types/src/interfaces/ServerCacheDependencyInterface.d.ts +1 -2
- package/dist/types/src/internal.d.ts +0 -1
- package/package.json +2 -2
- package/dist/types/src/factories/ChangesCompilationFactory.d.ts +0 -5
|
@@ -2,24 +2,22 @@ import { ItemId } from '@rentman/backend-types';
|
|
|
2
2
|
import { ItemResource } from '../../models/ItemResource';
|
|
3
3
|
import { GetFieldValueType } from '../../types/ItemTypesCollection';
|
|
4
4
|
import { TransactionCache } from '../cache/transaction/TransactionCache';
|
|
5
|
-
import { ChangesDeltaItemCreateDelta } from '../CreatedChangesDelta';
|
|
6
5
|
import { BLR_SKIP_RULE, BusinessLogicRule } from './BusinessLogicRule';
|
|
7
6
|
import { BusinessLogicRuleApplyContext } from './BusinessLogicRuleApplyContext';
|
|
8
7
|
import { BusinessLogicRuleConditionContext } from './BusinessLogicRuleConditionContext';
|
|
9
8
|
import { BusinessLogicRuleContextBase } from './BusinessLogicRuleContextBase';
|
|
10
9
|
export declare const commonEquipmentColumns: readonly ["id", "aantal", "parent", "materiaal"];
|
|
11
|
-
type
|
|
12
|
-
[equipmentId: number]:
|
|
10
|
+
type MateriaalPropertiesMap = {
|
|
11
|
+
[equipmentId: number]: {
|
|
12
|
+
is_physical: GetFieldValueType<'Materiaal', 'is_physical'>;
|
|
13
|
+
is_combination: GetFieldValueType<'Materiaal', 'is_combination'>;
|
|
14
|
+
};
|
|
13
15
|
};
|
|
14
16
|
type MateriaalType = 'Planningmateriaal' | 'Inhuurmateriaal';
|
|
15
|
-
type ConditionResult<ItemTypeType extends MateriaalType> =
|
|
16
|
-
created: ChangesDeltaItemCreateDelta<ItemTypeType>[];
|
|
17
|
-
updated: ItemId[];
|
|
18
|
-
};
|
|
17
|
+
type ConditionResult<ItemTypeType extends MateriaalType> = ItemId<ItemTypeType>[];
|
|
19
18
|
type Dependency<ItemTypeType extends MateriaalType> = {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
materiaalTypeMap: MateriaalTypeMap;
|
|
19
|
+
itemResources: ItemResource<ItemTypeType, typeof commonEquipmentColumns>[];
|
|
20
|
+
materiaalPropertiesMap: MateriaalPropertiesMap;
|
|
23
21
|
};
|
|
24
22
|
/**
|
|
25
23
|
* @description
|
|
@@ -31,6 +29,6 @@ export declare abstract class AantalBusinessLogicRuleBase<ItemTypeType extends M
|
|
|
31
29
|
condition({ previousChangesDelta, transaction, }: BusinessLogicRuleConditionContext): ConditionResult<ItemTypeType> | typeof BLR_SKIP_RULE;
|
|
32
30
|
dependency(transaction: TransactionCache, conditionResult: ConditionResult<ItemTypeType>, context: BusinessLogicRuleContextBase): Promise<Dependency<ItemTypeType>>;
|
|
33
31
|
apply(context: BusinessLogicRuleApplyContext, dependency: Dependency<ItemTypeType>): void;
|
|
34
|
-
private
|
|
32
|
+
private getMateriaalPropertiesMap;
|
|
35
33
|
}
|
|
36
34
|
export {};
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { ItemId } from '@rentman/backend-types';
|
|
2
|
+
import { ItemResource } from '../../models/ItemResource';
|
|
2
3
|
import { TransactionCache } from '../cache/transaction/TransactionCache';
|
|
3
4
|
import { BLR_SKIP_RULE, BusinessLogicRule } from './BusinessLogicRule';
|
|
4
5
|
import { BusinessLogicRuleApplyContext } from './BusinessLogicRuleApplyContext';
|
|
5
6
|
import { BusinessLogicRuleConditionContext } from './BusinessLogicRuleConditionContext';
|
|
6
|
-
import { BusinessLogicRuleContextBase
|
|
7
|
+
import { BusinessLogicRuleContextBase } from './BusinessLogicRuleContextBase';
|
|
7
8
|
declare const commonEquipmentColumns: readonly ["id", "aantal", "aantaltotaal", "parent", "materiaal"];
|
|
8
9
|
export declare const plannedEquipmentColumns: readonly ["id", "aantal", "aantaltotaal", "parent", "materiaal", "categorie"];
|
|
9
10
|
export declare const subhireEquipmentColumns: readonly ["id", "aantal", "aantaltotaal", "parent", "materiaal", "inhuurgroep"];
|
|
10
11
|
type PlannedEquipmentItemType = 'Planningmateriaal' | 'Inhuurmateriaal';
|
|
11
|
-
type
|
|
12
|
-
Planningmateriaal:
|
|
13
|
-
Inhuurmateriaal:
|
|
12
|
+
type PlannedEquipmentItem<ItemTypeType extends PlannedEquipmentItemType> = {
|
|
13
|
+
Planningmateriaal: ItemResource<'Planningmateriaal', typeof commonEquipmentColumns>;
|
|
14
|
+
Inhuurmateriaal: ItemResource<'Inhuurmateriaal', typeof commonEquipmentColumns>;
|
|
14
15
|
}[ItemTypeType];
|
|
15
|
-
type
|
|
16
|
-
type
|
|
16
|
+
type PlannedEquipmentItemIdMap<ItemTypeType extends PlannedEquipmentItemType> = Map<ItemId, PlannedEquipmentItem<ItemTypeType>>;
|
|
17
|
+
type PlannedEquipmentItemParentMap<ItemTypeType extends PlannedEquipmentItemType> = Map<ItemId | null, PlannedEquipmentItem<ItemTypeType>[]>;
|
|
17
18
|
type EquipmentIsPhysicalMap = Map<ItemId<'Materiaal'> | null, boolean>;
|
|
18
19
|
interface Dependency<ItemTypeType extends PlannedEquipmentItemType> {
|
|
19
20
|
/**
|
|
@@ -26,8 +27,8 @@ interface Dependency<ItemTypeType extends PlannedEquipmentItemType> {
|
|
|
26
27
|
* descendants of the created / updated items. The ancestors to determine the root items, and the descendants
|
|
27
28
|
* because their total quantity will change as well.
|
|
28
29
|
*/
|
|
29
|
-
affectedEquipmentItemsByParent:
|
|
30
|
-
affectedEquipmentItemsById:
|
|
30
|
+
affectedEquipmentItemsByParent: PlannedEquipmentItemParentMap<ItemTypeType>;
|
|
31
|
+
affectedEquipmentItemsById: PlannedEquipmentItemIdMap<ItemTypeType>;
|
|
31
32
|
equipmentIsPhysicalMap: EquipmentIsPhysicalMap;
|
|
32
33
|
}
|
|
33
34
|
/**
|
|
@@ -35,7 +36,7 @@ interface Dependency<ItemTypeType extends PlannedEquipmentItemType> {
|
|
|
35
36
|
* If Planningmateriaal total is changed recalculate the fields
|
|
36
37
|
* Note: We're assuming 'aantal' is fractional only for sets here.
|
|
37
38
|
*/
|
|
38
|
-
export declare abstract class AantaltotaalBusinessLogicRuleBase<ItemTypeType extends PlannedEquipmentItemType> extends BusinessLogicRule<
|
|
39
|
+
export declare abstract class AantaltotaalBusinessLogicRuleBase<ItemTypeType extends PlannedEquipmentItemType> extends BusinessLogicRule<ItemId<ItemTypeType>[], Dependency<ItemTypeType>> {
|
|
39
40
|
protected abstract readonly itemType: ItemTypeType;
|
|
40
41
|
protected abstract readonly groupingProperties: {
|
|
41
42
|
Planningmateriaal: {
|
|
@@ -51,8 +52,8 @@ export declare abstract class AantaltotaalBusinessLogicRuleBase<ItemTypeType ext
|
|
|
51
52
|
Planningmateriaal: typeof plannedEquipmentColumns;
|
|
52
53
|
Inhuurmateriaal: typeof subhireEquipmentColumns;
|
|
53
54
|
}[ItemTypeType];
|
|
54
|
-
condition(context: BusinessLogicRuleConditionContext):
|
|
55
|
-
dependency(transaction: TransactionCache,
|
|
55
|
+
condition(context: BusinessLogicRuleConditionContext): ItemId<ItemTypeType>[] | typeof BLR_SKIP_RULE;
|
|
56
|
+
dependency(transaction: TransactionCache, affectedEquipmentItemIds: ItemId<ItemTypeType>[], context: BusinessLogicRuleContextBase): Promise<Dependency<ItemTypeType>>;
|
|
56
57
|
apply(context: BusinessLogicRuleApplyContext, dependency: Dependency<ItemTypeType>): void;
|
|
57
58
|
private fetchEquipmentIsPhysicalMap;
|
|
58
59
|
private updatePlannedEquipmentItem;
|
|
@@ -50,15 +50,14 @@ export declare class BusinessLogicManager {
|
|
|
50
50
|
* - In a third iteration (2nd recursive call) the `Functie.kilometerprijs` has no business logic, so the function
|
|
51
51
|
* exits early (`rulesToRun.size === 0`) and the recursion ends
|
|
52
52
|
*
|
|
53
|
-
* @param
|
|
54
|
-
* @param
|
|
55
|
-
* previous rule application cycles.
|
|
56
|
-
* @param previousChangesDelta - A changes delta containing source changes, *or* the changes made during the last
|
|
57
|
-
* rule application cycle only. Should be used to determine whether the business logic rule should run.
|
|
53
|
+
* @param businessLogicTransaction The transaction the ChangesDelta will be applied on.
|
|
54
|
+
* @param changesDelta - A changes delta containing source changes.
|
|
58
55
|
*
|
|
59
|
-
* @
|
|
56
|
+
* @returns A child transaction where the business logic has been applied.
|
|
57
|
+
*
|
|
58
|
+
* @private Should only be called by the core.
|
|
60
59
|
*/
|
|
61
|
-
handleBusinessLogic(transaction: TransactionCache,
|
|
60
|
+
handleBusinessLogic(transaction: TransactionCache, changesDelta: ChangesDelta): Promise<TransactionCache | null>;
|
|
62
61
|
private findBusinessLogicRuleInstance;
|
|
63
62
|
private applyRules;
|
|
64
63
|
private waitForRuleDependencies;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { GetAccountSettignsFn, GetFieldValueType, HasFlagFn, ItemTypeColumnId } from '../../types/ItemTypesCollection';
|
|
1
|
+
import { ApiModuleFunctionResponse } from '@rentman/backend-types';
|
|
2
|
+
import { GetAccountSettignsFn, HasFlagFn } from '../../types/ItemTypesCollection';
|
|
4
3
|
import { TransactionCache } from '../cache/transaction/TransactionCache';
|
|
5
4
|
import { BusinessLogicRuleApplyContext } from './BusinessLogicRuleApplyContext';
|
|
6
5
|
import { BusinessLogicRuleConditionContext } from './BusinessLogicRuleConditionContext';
|
|
@@ -24,12 +23,6 @@ export interface RuleDependencyResultTuple extends RuleConditionResultTuple {
|
|
|
24
23
|
type MaybePromise<T> = T | Promise<T>;
|
|
25
24
|
export type BusinessLogicRuleConditionConfirmFn<ConditionResult, ConfirmResult> = (conditionResult: ConditionResult, transaction: TransactionCache) => MaybePromise<ConfirmResult | typeof BLR_SKIP_RULE | typeof BLR_ABANDON_CHANGES | typeof BLR_CONTINUE_WITH_DEFAULTS>;
|
|
26
25
|
export type BusinessLogicRuleConfirmFnWithDependency<ConditionResult, Dependency, ConfirmResult> = (conditionResult: ConditionResult, dependency: Dependency, transaction: TransactionCache) => MaybePromise<ConfirmResult | typeof BLR_SKIP_RULE | typeof BLR_ABANDON_CHANGES | typeof BLR_CONTINUE_WITH_DEFAULTS>;
|
|
27
|
-
export type BusinessLogicConditionResult<ItemTypeType extends ApiItemType, ColumnId extends ItemTypeColumnId<ItemTypeType>> = {
|
|
28
|
-
itemEntry: ItemEntry<ItemTypeType>;
|
|
29
|
-
responseColumn: ResponseColumn<ItemTypeType, ColumnId>;
|
|
30
|
-
oldValue: GetFieldValueType<ItemTypeType, ColumnId>;
|
|
31
|
-
newValue: GetFieldValueType<ItemTypeType, ColumnId>;
|
|
32
|
-
};
|
|
33
26
|
/**
|
|
34
27
|
* @description
|
|
35
28
|
* A business rule is a class that does some data transformation depending on other fields.
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { ApiItemType } from '@rentman/backend-types';
|
|
2
2
|
import { ItemEntry } from '../../models/ItemEntry';
|
|
3
|
-
import { FieldMap
|
|
3
|
+
import { FieldMap } from '../../types/ItemTypesCollection';
|
|
4
4
|
import { TransactionCache } from '../cache/transaction/TransactionCache';
|
|
5
5
|
import { ChangesDelta } from '../ChangesDelta';
|
|
6
|
+
import { ParentChangesDelta } from '../ParentChangesDelta';
|
|
6
7
|
import { BusinessLogicRuleContextBase } from './BusinessLogicRuleContextBase';
|
|
7
8
|
/**
|
|
8
9
|
* Class that represents the context for the business logic rule `apply()` function.
|
|
@@ -12,21 +13,13 @@ export declare class BusinessLogicRuleApplyContext extends BusinessLogicRuleCont
|
|
|
12
13
|
/**
|
|
13
14
|
* @param destinationChangesDelta - Changes should be written to this changes delta.
|
|
14
15
|
*/
|
|
15
|
-
constructor(transactionCache: TransactionCache, previousChangesDelta:
|
|
16
|
+
constructor(transactionCache: TransactionCache, previousChangesDelta: ParentChangesDelta, destinationChangesDelta: ChangesDelta);
|
|
16
17
|
/**
|
|
17
18
|
* An alias for `destinationChangesDelta.setItemUpdated().
|
|
18
|
-
*
|
|
19
|
-
* In most cases, `setUpdatedValue()`, would be preferred, because it only sets the value when differs from the
|
|
20
|
-
* current value.
|
|
21
19
|
*/
|
|
22
20
|
setItemUpdated<ItemTypeType extends ApiItemType>(entry: ItemEntry<ItemTypeType>, fields: Partial<FieldMap<ItemTypeType>>): void;
|
|
23
21
|
/**
|
|
24
22
|
* An alias for `destinationChangesDelta.setItemsDeleted().
|
|
25
23
|
*/
|
|
26
24
|
setItemsDeleted<ItemTypeType extends ApiItemType>(entries: ItemEntry<ItemTypeType>[]): void;
|
|
27
|
-
/**
|
|
28
|
-
* Convenience function to write an updated value to the destination changes delta. Only sets the value when differs
|
|
29
|
-
* from the current value.
|
|
30
|
-
*/
|
|
31
|
-
setUpdatedValue<ItemTypeType extends ApiItemType, ColumnId extends ItemTypeColumnId<ItemTypeType>>(entry: ItemEntry<ItemTypeType>, columnId: ColumnId, newValue: GetFieldValueType<ItemTypeType, ColumnId>): void;
|
|
32
25
|
}
|
|
@@ -1,29 +1,17 @@
|
|
|
1
1
|
import { ApiItemType, ItemId } from '@rentman/backend-types';
|
|
2
|
-
import { ErrorHandlerInterface } from '../../interfaces/ErrorHandlerInterface';
|
|
3
2
|
import { GetFieldValueType, ItemTypeColumnId } from '../../types/ItemTypesCollection';
|
|
4
3
|
import { TransactionCache } from '../cache/transaction/TransactionCache';
|
|
5
|
-
import {
|
|
6
|
-
import { BLR_SKIP_RULE
|
|
4
|
+
import { ParentChangesDelta } from '../ParentChangesDelta';
|
|
5
|
+
import { BLR_SKIP_RULE } from './BusinessLogicRule';
|
|
7
6
|
import { BusinessLogicRuleContextBase } from './BusinessLogicRuleContextBase';
|
|
8
7
|
/**
|
|
9
8
|
* Class that represents the context for the business logic rule `condition()` function.
|
|
10
9
|
*
|
|
11
|
-
* Please note that, while the transaction
|
|
10
|
+
* Please note that, while the transaction and previous changes delta are available on the
|
|
12
11
|
* class instance, using the helper functions is preferred.
|
|
13
12
|
*/
|
|
14
13
|
export declare class BusinessLogicRuleConditionContext extends BusinessLogicRuleContextBase {
|
|
15
|
-
|
|
16
|
-
constructor(transaction: TransactionCache, previousChangesDelta: ChangesDelta, mergedChangesDelta: ChangesDelta, errorHandler: ErrorHandlerInterface);
|
|
17
|
-
/**
|
|
18
|
-
* @description
|
|
19
|
-
* This function will compare the stored changes with the given changes, and return a
|
|
20
|
-
* {@link BusinessLogicConditionResult} if the fields have been changed, `null` otherwise.
|
|
21
|
-
* If either the source or changed field is `undefined` it will always return `null` (not changed)
|
|
22
|
-
*
|
|
23
|
-
* @param tuple The {@link ChangesDelta.updated update tuple} from a ChangesDelta
|
|
24
|
-
* @param columnId The columnId of the field that should've been changed for the ID to be included
|
|
25
|
-
*/
|
|
26
|
-
fieldChanged<ItemTypeType extends ApiItemType, ColumnId extends ItemTypeColumnId<ItemTypeType>>(tuple: ChangesDeltaItemUpdateDelta<ItemTypeType>, columnId: ColumnId): null | BusinessLogicConditionResult<ItemTypeType, ColumnId>;
|
|
14
|
+
constructor(transaction: TransactionCache, previousChangesDelta: ParentChangesDelta);
|
|
27
15
|
/**
|
|
28
16
|
* This function is a utility function that will return the {@link ItemId ItemIds} of updated items in the
|
|
29
17
|
* {@link ChangesDelta ChangesDelta} which match the {@link ApiItemType ItemType} and of which the provided
|
|
@@ -32,7 +20,7 @@ export declare class BusinessLogicRuleConditionContext extends BusinessLogicRule
|
|
|
32
20
|
* @param itemType The ItemType of the item you want to compare a field from
|
|
33
21
|
* @param columnId The columnId of the field that should've been changed for the ID to be included
|
|
34
22
|
*/
|
|
35
|
-
getItemIdsWithUpdatedField<ItemTypeType extends ApiItemType>(itemType: ItemTypeType, columnId: ItemTypeColumnId<ItemTypeType
|
|
23
|
+
getItemIdsWithUpdatedField<ItemTypeType extends ApiItemType>(itemType: ItemTypeType, columnId: ItemTypeColumnId<ItemTypeType>, includeCreatedItems?: boolean): ItemId[] | typeof BLR_SKIP_RULE;
|
|
36
24
|
/**
|
|
37
25
|
* Like {@link getItemIdsWithUpdatedField}, but allows for a new value to be provided. Only IDs of items where the
|
|
38
26
|
* field has been updated to the new value will be included in the result.
|
|
@@ -1,58 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export type LatestItemColumnsArray<ItemTypeType extends ApiItemType> = readonly ItemTypeColumnId<ItemTypeType>[];
|
|
4
|
-
export type UpdatedLatestItem<ItemTypeType extends ApiItemType, ColumnIds extends LatestItemColumnsArray<ItemTypeType>> = {
|
|
5
|
-
itemEntry: ItemEntry<ItemTypeType>;
|
|
6
|
-
updatedTuple?: ChangesDeltaItemUpdateDelta<ItemTypeType>;
|
|
7
|
-
fields: FieldMap<ItemTypeType, ColumnIds>;
|
|
8
|
-
};
|
|
9
|
-
/**
|
|
10
|
-
* A 'latest' item can either be:
|
|
11
|
-
* - A created changes delta (for created items).
|
|
12
|
-
* - An object containing an item entry and a `fields` property (for updated items). The `fields` property will
|
|
13
|
-
* read updated values from the changes delta if available.
|
|
14
|
-
*
|
|
15
|
-
* In both cases, we can access the latest values through the `fields` property.
|
|
16
|
-
*/
|
|
17
|
-
export type LatestItem<ItemTypeType extends ApiItemType, ColumnIds extends LatestItemColumnsArray<ItemTypeType>> = UpdatedLatestItem<ItemTypeType, ColumnIds> | ChangesDeltaItemCreateDelta<ItemTypeType>;
|
|
1
|
+
import { TransactionCache } from '../cache/transaction/TransactionCache';
|
|
2
|
+
import { ParentChangesDelta } from '../ParentChangesDelta';
|
|
18
3
|
export declare abstract class BusinessLogicRuleContextBase {
|
|
19
4
|
readonly transaction: TransactionCache;
|
|
20
|
-
readonly previousChangesDelta:
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* @param transaction - The transaction the business logic rule is being applied on.
|
|
24
|
-
* @param previousChangesDelta - A changes delta containing source changes, *or* the changes made during the last
|
|
25
|
-
* rule application cycle only. Should be used to determine whether the business logic rule should run.
|
|
26
|
-
* @param mergedChangesDelta - A changes delta containing the source changes, plus the changes made during *all*
|
|
27
|
-
* previous rule application cycles.
|
|
28
|
-
*/
|
|
29
|
-
protected constructor(transaction: TransactionCache, previousChangesDelta: ChangesDelta, mergedChangesDelta: ChangesDelta);
|
|
30
|
-
/**
|
|
31
|
-
* This function will get the latest value of the given itemEntry by first looking in the merged changes delta.
|
|
32
|
-
* It will return the value found in the transaction chain otherwise.
|
|
33
|
-
*
|
|
34
|
-
* You could assume this function never returns `undefined` if you fetch the resource in your dependency function.
|
|
35
|
-
*/
|
|
36
|
-
getLatestValue<ItemTypeType extends ApiItemType, ColumnId extends ItemTypeColumnId<ItemTypeType>>(entry: ItemEntry<ItemTypeType>, columnId: ColumnId): GetFieldValueType<ItemTypeType, ColumnId> | undefined;
|
|
37
|
-
isUpdatedLatestItem<ItemTypeType extends ApiItemType, ColumnIds extends LatestItemColumnsArray<ItemTypeType>>(latestItem: LatestItem<ItemTypeType, ColumnIds>): latestItem is UpdatedLatestItem<ItemTypeType, ColumnIds>;
|
|
38
|
-
collectFields<ItemTypeType extends ApiItemType>(latestItem: LatestItem<ItemTypeType, any>): FieldMap<ItemTypeType>;
|
|
39
|
-
/**
|
|
40
|
-
* The equivalent of `getLinkCollections` on the transaction. Returns an array of 'latest' items for each parent
|
|
41
|
-
* ID. Covers the merged changes delta as well as the transaction. Currently doesn't take deleted items into account.
|
|
42
|
-
*
|
|
43
|
-
* TODO: Instead of replicating transaction functionality in the business rule context, we should apply business
|
|
44
|
-
* logic rules on a child transaction.
|
|
45
|
-
*/
|
|
46
|
-
fetchLatestItemsByParent<ParentItemType extends ApiItemType, ItemTypeType extends ApiItemType, ColumnIds extends LatestItemColumnsArray<ItemTypeType>>(parentItemType: ParentItemType, parentItemIds: ItemId<ParentItemType>[], itemType: ItemTypeType, requestColumns: ColumnIds): Promise<Map<ItemId<ParentItemType>, LatestItem<ItemTypeType, ColumnIds>[]>>;
|
|
47
|
-
/**
|
|
48
|
-
* This method should only be used when we're sure the items do not occur in the created changes. Generally,
|
|
49
|
-
* {@link fetchLatestItemsById} should be used instead.
|
|
50
|
-
*/
|
|
51
|
-
fetchUpdatedLatestItemsById<ItemTypeType extends ApiItemType, ColumnIds extends LatestItemColumnsArray<ItemTypeType>>(itemType: ItemTypeType, itemIds: ItemId[], requestColumns: ColumnIds): Promise<UpdatedLatestItem<ItemTypeType, ColumnIds>[]>;
|
|
52
|
-
/**
|
|
53
|
-
* Returns an array of {@link LatestItem}s, taking both changes on the transaction and the merged changes delta into
|
|
54
|
-
* account.
|
|
55
|
-
*/
|
|
56
|
-
fetchLatestItemsById<ItemTypeType extends ApiItemType, ColumnIds extends LatestItemColumnsArray<ItemTypeType>>(itemType: ItemTypeType, itemIds: Iterable<ItemId>, requestColumns: ColumnIds): Promise<LatestItem<ItemTypeType, ColumnIds>[]>;
|
|
57
|
-
private constructLatestItems;
|
|
5
|
+
readonly previousChangesDelta: ParentChangesDelta;
|
|
6
|
+
protected constructor(transaction: TransactionCache, previousChangesDelta: ParentChangesDelta);
|
|
58
7
|
}
|
|
@@ -4,8 +4,9 @@ import { TransactionCache } from '../../cache/transaction/TransactionCache';
|
|
|
4
4
|
import { BLR_SKIP_RULE, BusinessLogicRule } from '../BusinessLogicRule';
|
|
5
5
|
import { BusinessLogicRuleApplyContext } from '../BusinessLogicRuleApplyContext';
|
|
6
6
|
import { BusinessLogicRuleConditionContext } from '../BusinessLogicRuleConditionContext';
|
|
7
|
+
declare const customfieldColumns: readonly ["defaultvalue"];
|
|
7
8
|
type ConditionResult = ItemId[];
|
|
8
|
-
type Dependency = ItemResource<'Customfield',
|
|
9
|
+
type Dependency = ItemResource<'Customfield', typeof customfieldColumns>[];
|
|
9
10
|
/**
|
|
10
11
|
* @description
|
|
11
12
|
* If the 'type' field changes we reset the 'defaultvalue' and 'attribute' fields so that they do not contain invalid values
|
|
@@ -4,8 +4,9 @@ import { TransactionCache } from '../../cache/transaction/TransactionCache';
|
|
|
4
4
|
import { BLR_SKIP_RULE, BusinessLogicRule } from '../BusinessLogicRule';
|
|
5
5
|
import { BusinessLogicRuleApplyContext } from '../BusinessLogicRuleApplyContext';
|
|
6
6
|
import { BusinessLogicRuleConditionContext } from '../BusinessLogicRuleConditionContext';
|
|
7
|
+
declare const customfieldColumns: readonly ["defaultvalue", "attributes", "type"];
|
|
7
8
|
type ConditionResult = ItemId[];
|
|
8
|
-
type Dependency = ItemResource<'Customfield',
|
|
9
|
+
type Dependency = ItemResource<'Customfield', typeof customfieldColumns>[];
|
|
9
10
|
/**
|
|
10
11
|
* @description
|
|
11
12
|
* If the 'type' field changes we reset the 'defaultvalue' and 'attribute' fields so that they do not contain invalid values
|
package/dist/types/src/classes/BusinessLogicManager/DefaultContactPersonUpdateBusinessLogicRule.d.ts
CHANGED
|
@@ -1,30 +1,51 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ItemId } from '@rentman/backend-types';
|
|
2
2
|
import { ItemEntry } from '../../models/ItemEntry';
|
|
3
3
|
import { ItemResource } from '../../models/ItemResource';
|
|
4
|
-
import { ItemTypeColumnId } from '../../types/ItemTypesCollection';
|
|
5
4
|
import { TransactionCache } from '../cache/transaction/TransactionCache';
|
|
6
5
|
import { BLR_SKIP_RULE, BusinessLogicRule } from './BusinessLogicRule';
|
|
7
6
|
import { BusinessLogicRuleApplyContext } from './BusinessLogicRuleApplyContext';
|
|
8
7
|
import { BusinessLogicRuleConditionContext } from './BusinessLogicRuleConditionContext';
|
|
8
|
+
export declare const itemTypeFieldMap: {
|
|
9
|
+
readonly Offerte: {
|
|
10
|
+
readonly opdrachtgever: "contactpersoon";
|
|
11
|
+
};
|
|
12
|
+
readonly Contract: {
|
|
13
|
+
readonly opdrachtgever: "contactpersoon";
|
|
14
|
+
};
|
|
15
|
+
readonly Factuur: {
|
|
16
|
+
readonly opdrachtgever: "contactpersoon";
|
|
17
|
+
};
|
|
18
|
+
readonly Project: {
|
|
19
|
+
readonly opdrachtgever: "opdrachtgever_persoon";
|
|
20
|
+
readonly locatie: "locatie_persoon";
|
|
21
|
+
};
|
|
22
|
+
readonly Subproject: {
|
|
23
|
+
readonly locatie: "locatie_persoon";
|
|
24
|
+
};
|
|
25
|
+
readonly Inhuur: {
|
|
26
|
+
readonly locatie: "locatie_persoon";
|
|
27
|
+
readonly leverancier: "contactpersoon";
|
|
28
|
+
};
|
|
29
|
+
readonly ProjectRequest: {
|
|
30
|
+
readonly aanvrager: "accountmanager";
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
type ItemTypeFieldMap = typeof itemTypeFieldMap;
|
|
34
|
+
type ItemTypeWithContactPerson = keyof ItemTypeFieldMap;
|
|
9
35
|
type ConditionResult = {
|
|
10
|
-
[ItemTypeType in
|
|
11
|
-
[ColumnId in
|
|
36
|
+
[ItemTypeType in ItemTypeWithContactPerson]?: Map<ItemEntry<ItemTypeType>, {
|
|
37
|
+
[ColumnId in keyof ItemTypeFieldMap[ItemTypeType]]?: ItemId<'Contact'>;
|
|
12
38
|
}>;
|
|
13
39
|
};
|
|
14
|
-
declare const
|
|
15
|
-
type Dependency =
|
|
16
|
-
conditionResult: ConditionResult;
|
|
17
|
-
contactMap: {
|
|
18
|
-
[contactId: string]: ItemResource<'Contact', typeof dependencyColumns>;
|
|
19
|
-
};
|
|
20
|
-
};
|
|
40
|
+
declare const constactColumns: readonly ["id", "contactpersoon"];
|
|
41
|
+
type Dependency = ItemResource<'Contact', typeof constactColumns>[];
|
|
21
42
|
/**
|
|
22
|
-
* This business rule is responsible for setting the default
|
|
43
|
+
* This business rule is responsible for setting the default contact person related to a
|
|
23
44
|
* selected contact for itemTypes that have fields for this.
|
|
24
45
|
*/
|
|
25
46
|
export declare class DefaultContactPersonUpdateBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
|
|
26
47
|
condition(context: BusinessLogicRuleConditionContext): ConditionResult | typeof BLR_SKIP_RULE;
|
|
27
48
|
dependency(transaction: TransactionCache, conditionResult: ConditionResult): Promise<Dependency>;
|
|
28
|
-
apply(context: BusinessLogicRuleApplyContext,
|
|
49
|
+
apply(context: BusinessLogicRuleApplyContext, contactResources: Dependency, conditionResult: ConditionResult): void;
|
|
29
50
|
}
|
|
30
51
|
export {};
|
package/dist/types/src/classes/BusinessLogicManager/Documents/DocumentTemplateBusinessLogicRule.d.ts
CHANGED
|
@@ -4,13 +4,14 @@ import { TransactionCache } from '../../cache/transaction/TransactionCache';
|
|
|
4
4
|
import { BLR_SKIP_RULE, BusinessLogicRule } from '../BusinessLogicRule';
|
|
5
5
|
import { BusinessLogicRuleApplyContext } from '../BusinessLogicRuleApplyContext';
|
|
6
6
|
import { BusinessLogicRuleConditionContext } from '../BusinessLogicRuleConditionContext';
|
|
7
|
-
declare const documentTypes: readonly ["Factuur", "Offerte", "Contract", "Bon", "Inhuurbon", "Materiaalbon", "Medewerkerbon", "Aanmaning", "Reparatiebon", "Voertuigbon"];
|
|
7
|
+
export declare const documentTypes: readonly ["Factuur", "Offerte", "Contract", "Bon", "Inhuurbon", "Materiaalbon", "Medewerkerbon", "Aanmaning", "Reparatiebon", "Voertuigbon"];
|
|
8
8
|
type DocumentTypes = (typeof documentTypes)[number];
|
|
9
|
+
declare const documentColumns: readonly ["filename", "betreft"];
|
|
9
10
|
type ConditionResult = {
|
|
10
11
|
[key in DocumentTypes]?: ItemId[];
|
|
11
12
|
};
|
|
12
13
|
type Dependency = {
|
|
13
|
-
[key in DocumentTypes]?: ItemResource<DocumentTypes,
|
|
14
|
+
[key in DocumentTypes]?: ItemResource<DocumentTypes, typeof documentColumns>[];
|
|
14
15
|
};
|
|
15
16
|
export declare class DocumentTemplateBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
|
|
16
17
|
condition(context: BusinessLogicRuleConditionContext): ConditionResult | typeof BLR_SKIP_RULE;
|
|
@@ -4,8 +4,9 @@ import { TransactionCache } from '../../cache/transaction/TransactionCache';
|
|
|
4
4
|
import { BLR_SKIP_RULE, BusinessLogicRule } from '../BusinessLogicRule';
|
|
5
5
|
import { BusinessLogicRuleApplyContext } from '../BusinessLogicRuleApplyContext';
|
|
6
6
|
import { BusinessLogicRuleConditionContext } from '../BusinessLogicRuleConditionContext';
|
|
7
|
+
declare const exemplaarColumns: readonly ["actief"];
|
|
7
8
|
type ConditionResult = ItemId[];
|
|
8
|
-
type Dependency = ItemResource<'Exemplaar',
|
|
9
|
+
type Dependency = ItemResource<'Exemplaar', typeof exemplaarColumns>[];
|
|
9
10
|
export declare class ExemplaarAanschafdatumBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
|
|
10
11
|
condition({ previousChangesDelta, }: BusinessLogicRuleConditionContext): ConditionResult | typeof BLR_SKIP_RULE;
|
|
11
12
|
dependency(transaction: TransactionCache, exemplaarIds: ConditionResult): Promise<Dependency>;
|
|
@@ -1,21 +1,26 @@
|
|
|
1
1
|
import { ItemId } from '@rentman/backend-types';
|
|
2
2
|
import { ItemResource } from '../../../models/ItemResource';
|
|
3
3
|
import { TransactionCache } from '../../cache/transaction/TransactionCache';
|
|
4
|
-
import { BLR_SKIP_RULE,
|
|
4
|
+
import { BLR_SKIP_RULE, BusinessLogicRule } from '../BusinessLogicRule';
|
|
5
5
|
import { BusinessLogicRuleApplyContext } from '../BusinessLogicRuleApplyContext';
|
|
6
6
|
import { BusinessLogicRuleConditionContext } from '../BusinessLogicRuleConditionContext';
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
declare const factuurColumns: readonly ["vervaldatum", "datum", "betalingsconditie"];
|
|
8
|
+
declare const betalingsconditieColumns: readonly ["id", "dagen"];
|
|
9
|
+
type ConditionResult = ItemId<'Factuur'>[];
|
|
9
10
|
type Dependency = {
|
|
10
|
-
Factuur: ItemResource<'Factuur',
|
|
11
|
+
Factuur: ItemResource<'Factuur', typeof factuurColumns>[];
|
|
11
12
|
Betalingsconditie: {
|
|
12
|
-
[conditieId: string]: ItemResource<'Betalingsconditie',
|
|
13
|
+
[conditieId: string]: ItemResource<'Betalingsconditie', typeof betalingsconditieColumns>;
|
|
13
14
|
};
|
|
14
15
|
defaultPaymentConditionId: ItemId | null;
|
|
15
16
|
};
|
|
17
|
+
/**
|
|
18
|
+
* When setting the payment condition of an invoice, set the relevant due date.
|
|
19
|
+
* TODO: Test this.
|
|
20
|
+
*/
|
|
16
21
|
export declare class FactuurBetalingsconditieBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
|
|
17
22
|
condition(context: BusinessLogicRuleConditionContext): ConditionResult | typeof BLR_SKIP_RULE;
|
|
18
|
-
dependency(transaction: TransactionCache, result: ConditionResult
|
|
23
|
+
dependency(transaction: TransactionCache, result: ConditionResult): Promise<Dependency>;
|
|
19
24
|
apply(context: BusinessLogicRuleApplyContext, deps: Dependency): void;
|
|
20
25
|
}
|
|
21
26
|
export {};
|
package/dist/types/src/classes/BusinessLogicManager/Factuur/FactuurDatumBusinessLogicRule.d.ts
CHANGED
|
@@ -4,12 +4,13 @@ import { TransactionCache } from '../../cache/transaction/TransactionCache';
|
|
|
4
4
|
import { BLR_SKIP_RULE, BusinessLogicRule } from '../BusinessLogicRule';
|
|
5
5
|
import { BusinessLogicRuleApplyContext } from '../BusinessLogicRuleApplyContext';
|
|
6
6
|
import { BusinessLogicRuleConditionContext } from '../BusinessLogicRuleConditionContext';
|
|
7
|
-
|
|
7
|
+
declare const factuurColumns: readonly ["id", "taxschema", "vervaldatum", "betalingsconditie", "datum"];
|
|
8
|
+
declare const betalingsconditieColumns: readonly ["id", "dagen"];
|
|
8
9
|
type ConditionResult = ItemId[];
|
|
9
10
|
type Dependency = {
|
|
10
|
-
Factuur: ItemResource<'Factuur',
|
|
11
|
+
Factuur: ItemResource<'Factuur', typeof factuurColumns>[];
|
|
11
12
|
Betalingsconditie: {
|
|
12
|
-
[conditieId: string]: ItemResource<'Betalingsconditie',
|
|
13
|
+
[conditieId: string]: ItemResource<'Betalingsconditie', typeof betalingsconditieColumns>;
|
|
13
14
|
};
|
|
14
15
|
latestTaxSchemasByDateMap: {
|
|
15
16
|
[taxschemaId: string]: ItemId<'TaxSchema'>;
|
|
@@ -17,7 +18,7 @@ type Dependency = {
|
|
|
17
18
|
};
|
|
18
19
|
export declare class FactuurDatumBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
|
|
19
20
|
condition(context: BusinessLogicRuleConditionContext): ConditionResult | typeof BLR_SKIP_RULE;
|
|
20
|
-
dependency(transaction: TransactionCache, factuurIds: ConditionResult
|
|
21
|
+
dependency(transaction: TransactionCache, factuurIds: ConditionResult): Promise<Dependency>;
|
|
21
22
|
apply(context: BusinessLogicRuleApplyContext, deps: Dependency): void;
|
|
22
23
|
}
|
|
23
24
|
export {};
|
|
@@ -4,8 +4,9 @@ import { TransactionCache } from '../../cache/transaction/TransactionCache';
|
|
|
4
4
|
import { BLR_SKIP_RULE, BusinessLogicRule } from '../BusinessLogicRule';
|
|
5
5
|
import { BusinessLogicRuleApplyContext } from '../BusinessLogicRuleApplyContext';
|
|
6
6
|
import { BusinessLogicRuleConditionContext } from '../BusinessLogicRuleConditionContext';
|
|
7
|
+
declare const factuurColumns: readonly ["nummer"];
|
|
7
8
|
type ConditionResult = ItemId[];
|
|
8
|
-
type Dependency = ItemResource<'Factuur',
|
|
9
|
+
type Dependency = ItemResource<'Factuur', typeof factuurColumns>[];
|
|
9
10
|
export declare class FactuurNumberseriesBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
|
|
10
11
|
condition(context: BusinessLogicRuleConditionContext): ConditionResult | typeof BLR_SKIP_RULE;
|
|
11
12
|
dependency(transaction: TransactionCache, factuurIds: ConditionResult): Promise<Dependency>;
|
package/dist/types/src/classes/BusinessLogicManager/Files/FilesNameExtensionBusinessLogicRule.d.ts
CHANGED
|
@@ -4,8 +4,9 @@ import { TransactionCache } from '../../cache/transaction/TransactionCache';
|
|
|
4
4
|
import { BLR_SKIP_RULE, BusinessLogicRule } from '../BusinessLogicRule';
|
|
5
5
|
import { BusinessLogicRuleApplyContext } from '../BusinessLogicRuleApplyContext';
|
|
6
6
|
import { BusinessLogicRuleConditionContext } from '../BusinessLogicRuleConditionContext';
|
|
7
|
-
type ConditionResult = ItemId[];
|
|
8
|
-
|
|
7
|
+
type ConditionResult = ItemId<'Files'>[];
|
|
8
|
+
declare const filesColumns: readonly ["name", "friendlyname"];
|
|
9
|
+
type Dependency = ItemResource<'Files', typeof filesColumns>[];
|
|
9
10
|
/**
|
|
10
11
|
* @description
|
|
11
12
|
* Automatically appends the file extension again when the user removes it from the name
|
package/dist/types/src/classes/BusinessLogicManager/Functie/FunctieNaaminternBusinessLogicRule.d.ts
CHANGED
|
@@ -4,8 +4,9 @@ import { TransactionCache } from '../../cache/transaction/TransactionCache';
|
|
|
4
4
|
import { BLR_SKIP_RULE, BusinessLogicRule } from '../BusinessLogicRule';
|
|
5
5
|
import { BusinessLogicRuleApplyContext } from '../BusinessLogicRuleApplyContext';
|
|
6
6
|
import { BusinessLogicRuleConditionContext } from '../BusinessLogicRuleConditionContext';
|
|
7
|
+
declare const functieColumns: readonly ["naamintern", "naamofferte"];
|
|
7
8
|
type ConditionResult = ItemId[];
|
|
8
|
-
type Dependency = ItemResource<'Functie',
|
|
9
|
+
type Dependency = ItemResource<'Functie', typeof functieColumns>[];
|
|
9
10
|
/**
|
|
10
11
|
* @description
|
|
11
12
|
* If the `naamofferte` is set and the user hasn't filled in a `naamintern` we sync the fields
|
package/dist/types/src/classes/BusinessLogicManager/Functie/FunctieTwowayBusinessLogicRule.d.ts
CHANGED
|
@@ -4,8 +4,9 @@ import { TransactionCache } from '../../cache/transaction/TransactionCache';
|
|
|
4
4
|
import { BLR_SKIP_RULE, BusinessLogicRule } from '../BusinessLogicRule';
|
|
5
5
|
import { BusinessLogicRuleApplyContext } from '../BusinessLogicRuleApplyContext';
|
|
6
6
|
import { BusinessLogicRuleConditionContext } from '../BusinessLogicRuleConditionContext';
|
|
7
|
+
declare const functieColumns: readonly ["afstand", "twoway"];
|
|
7
8
|
type ConditionResult = ItemId[];
|
|
8
|
-
type Dependency = ItemResource<'Functie',
|
|
9
|
+
type Dependency = ItemResource<'Functie', typeof functieColumns>[];
|
|
9
10
|
export declare class FunctieTwowayBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
|
|
10
11
|
condition(context: BusinessLogicRuleConditionContext): ConditionResult | typeof BLR_SKIP_RULE;
|
|
11
12
|
dependency(transaction: TransactionCache, functionIds: ConditionResult): Promise<Dependency>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ItemResource } from '../../../models/ItemResource';
|
|
2
2
|
import { BusinessLogicRuleApplyContext } from '../BusinessLogicRuleApplyContext';
|
|
3
|
-
export declare const functieTravelDistanceColumns: readonly ["twoway", {
|
|
3
|
+
export declare const functieTravelDistanceColumns: readonly ["twoway", "afstand", "afstand_van_locatie", {
|
|
4
4
|
readonly subproject: readonly [{
|
|
5
5
|
readonly locatie: readonly ["kilometers"];
|
|
6
6
|
}];
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
+
import { ItemId } from '@rentman/backend-types';
|
|
2
|
+
import { ItemEntry } from '../../../models/ItemEntry';
|
|
1
3
|
import { ItemResource } from '../../../models/ItemResource';
|
|
2
4
|
import { TransactionCache } from '../../cache/transaction/TransactionCache';
|
|
3
|
-
import { BLR_SKIP_RULE,
|
|
5
|
+
import { BLR_SKIP_RULE, BusinessLogicRule } from '../BusinessLogicRule';
|
|
4
6
|
import { BusinessLogicRuleApplyContext } from '../BusinessLogicRuleApplyContext';
|
|
5
7
|
import { BusinessLogicRuleConditionContext } from '../BusinessLogicRuleConditionContext';
|
|
6
|
-
|
|
7
|
-
type
|
|
8
|
+
declare const functieColumns: readonly ["subproject"];
|
|
9
|
+
type ConditionResult = {
|
|
10
|
+
itemEntry: ItemEntry<'Functiegroep'>;
|
|
11
|
+
newValue: ItemId<'Subproject'>;
|
|
12
|
+
}[];
|
|
13
|
+
type Dependency = ItemResource<'Functie', typeof functieColumns>[][];
|
|
8
14
|
/**
|
|
9
15
|
* When the subproject field of a function group is updated, set the subproject field of all the functions within the
|
|
10
16
|
* function group to the same value.
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { ItemId } from '@rentman/backend-types';
|
|
2
2
|
import { BLR_SKIP_RULE, BusinessLogicRule, BusinessLogicRuleApplyContext, BusinessLogicRuleConditionContext, ItemEntry, ItemResource, TransactionCache } from '../../../internal';
|
|
3
|
+
declare const materiaalColumns: readonly ["is_combination"];
|
|
4
|
+
declare const containerContentColumns: readonly ["equipment"];
|
|
3
5
|
export type ConditionResult = ItemId[];
|
|
4
6
|
type Dependency = {
|
|
5
7
|
voorraadmutatieTuples: {
|
|
6
8
|
local: ItemEntry<'Voorraadmutatie'>[];
|
|
7
9
|
remote: ItemEntry<'Voorraadmutatie'>[];
|
|
8
10
|
};
|
|
9
|
-
materiaalResources: ItemResource<'Materiaal',
|
|
10
|
-
containerContentResources: ItemResource<'ContainerContent',
|
|
11
|
+
materiaalResources: ItemResource<'Materiaal', typeof materiaalColumns>[];
|
|
12
|
+
containerContentResources: ItemResource<'ContainerContent', typeof containerContentColumns>[];
|
|
11
13
|
};
|
|
12
14
|
export declare class MateriaalBulkToSerialBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
|
|
13
15
|
dependency(transaction: TransactionCache, materiaalIds: ConditionResult): Promise<Dependency>;
|
|
@@ -3,10 +3,12 @@ import { ItemResource } from '../../../models/ItemResource';
|
|
|
3
3
|
import { TransactionCache } from '../../cache/transaction/TransactionCache';
|
|
4
4
|
import { BLR_SKIP_RULE, BusinessLogicRule } from '../BusinessLogicRule';
|
|
5
5
|
import { BusinessLogicRuleConditionContext } from '../BusinessLogicRuleConditionContext';
|
|
6
|
+
declare const materiaalColumns: readonly ["is_combination"];
|
|
7
|
+
declare const containerContentColumns: readonly ["equipment"];
|
|
6
8
|
type ConditionResult = ItemId[];
|
|
7
9
|
type Dependency = {
|
|
8
|
-
materiaalResources: ItemResource<'Materiaal',
|
|
9
|
-
containerContentResources: ItemResource<'ContainerContent',
|
|
10
|
+
materiaalResources: ItemResource<'Materiaal', typeof materiaalColumns>[];
|
|
11
|
+
containerContentResources: ItemResource<'ContainerContent', typeof containerContentColumns>[];
|
|
10
12
|
};
|
|
11
13
|
export declare class MateriaalSerialToBulkBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
|
|
12
14
|
dependency(transaction: TransactionCache, materiaalIds: ConditionResult): Promise<Dependency>;
|
package/dist/types/src/classes/BusinessLogicManager/Materiaal/MateriaalVerhuurBusinessLogicRule.d.ts
CHANGED
|
@@ -4,11 +4,11 @@ import { TransactionCache } from '../../cache/transaction/TransactionCache';
|
|
|
4
4
|
import { BLR_SKIP_RULE, BusinessLogicRule } from '../BusinessLogicRule';
|
|
5
5
|
import { BusinessLogicRuleApplyContext } from '../BusinessLogicRuleApplyContext';
|
|
6
6
|
import { BusinessLogicRuleConditionContext } from '../BusinessLogicRuleConditionContext';
|
|
7
|
+
declare const materiaalColumns: readonly ["is_combination", "is_physical"];
|
|
7
8
|
type ConditionResult = ItemId[];
|
|
8
|
-
type Dependency = ItemResource<'Materiaal',
|
|
9
|
+
type Dependency = ItemResource<'Materiaal', typeof materiaalColumns>[];
|
|
9
10
|
/**
|
|
10
11
|
* @description
|
|
11
|
-
* A sales item can never be a case, so if it is we reset it to an item
|
|
12
12
|
* A physical sales item can never be a combination, if it is we set it to a single item
|
|
13
13
|
*/
|
|
14
14
|
export declare class MateriaalVerhuurBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
|