@rentman/rm-core 9.3.1 → 10.0.0-alpha.1
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 +4 -0
- package/dist/rm-core.js +5114 -1533
- package/dist/rm-core.min.js +1 -1
- package/dist/types/classes/BusinessLogicManager/BusinessLogicManager.d.ts +95 -0
- package/dist/types/classes/BusinessLogicManager/BusinessLogicRule.d.ts +94 -0
- package/dist/types/classes/BusinessLogicManager/Customfield/CustomFieldTypeBusinessLogicRule.d.ts +18 -0
- package/dist/types/classes/BusinessLogicManager/Documents/DocumentTemplateBusinessLogicRule.d.ts +25 -0
- package/dist/types/classes/BusinessLogicManager/Exemplaar/ExemplaarAanschafdatumBusinessLogicRule.d.ts +14 -0
- package/dist/types/classes/BusinessLogicManager/Factuur/FactuurBetalingsconditieBusinessLogicRule.d.ts +20 -0
- package/dist/types/classes/BusinessLogicManager/Factuur/FactuurDatumBusinessLogicRule.d.ts +19 -0
- package/dist/types/classes/BusinessLogicManager/Factuur/FactuurNumberseriesBusinessLogicRule.d.ts +14 -0
- package/dist/types/classes/BusinessLogicManager/Functie/FunctieNaaminternBusinessLogicRule.d.ts +18 -0
- package/dist/types/classes/BusinessLogicManager/Functie/FunctieTwowayBusinessLogicRule.d.ts +14 -0
- package/dist/types/classes/BusinessLogicManager/Materiaal/MateriaalTypeBusinessLogicRule.d.ts +18 -0
- package/dist/types/classes/BusinessLogicManager/Materiaal/MateriaalVerhuurBusinessLogicRule.d.ts +18 -0
- package/dist/types/classes/BusinessLogicManager/Materiaal/SurfaceArticleSizeBusinessLogicRule.d.ts +19 -0
- package/dist/types/classes/BusinessLogicManager/OfferteContract/OfferteContractDatumBusinessLogicRule.d.ts +26 -0
- package/dist/types/classes/BusinessLogicManager/PlanningPersoneelTransport/PlanningPersoneelTransportBusinessLogicRule.d.ts +29 -0
- package/dist/types/classes/BusinessLogicManager/Project/ProjectClientNoteBusinessLogicRule.d.ts +23 -0
- package/dist/types/classes/BusinessLogicManager/Reparatie/ReparatieExemplaarBusinessLogicRule.d.ts +14 -0
- package/dist/types/classes/BusinessLogicManager/Rol/RolDocumentAccessBusinessLogicRule.d.ts +18 -0
- package/dist/types/classes/BusinessLogicManager/Rol/RolEditOwnDataBusinessLogicRule.d.ts +18 -0
- package/dist/types/classes/BusinessLogicManager/Rol/RolFileAccessBusinessLogicRule.d.ts +18 -0
- package/dist/types/classes/BusinessLogicManager/Rol/RolPersoneelsplannerToegangBusinessLogicRule.d.ts +18 -0
- package/dist/types/classes/BusinessLogicManager/Rol/RolProjectenBewerkenBusinessLogicRule.d.ts +18 -0
- package/dist/types/classes/BusinessLogicManager/Rol/RolProjectenToegangBusinessLogicRule.d.ts +18 -0
- package/dist/types/classes/ChangesDelta.d.ts +1 -0
- package/dist/types/classes/ChangesDeltaBase.d.ts +2 -1
- package/dist/types/classes/InternalChangesDelta.d.ts +1 -0
- package/dist/types/core.d.ts +4 -1
- package/dist/types/interfaces/AbstractCacheDependencyInterface.d.ts +2 -0
- package/dist/types/interfaces/ErrorHandlerInterface.d.ts +1 -0
- package/dist/types/internal.d.ts +23 -0
- package/package.json +1 -1
|
@@ -0,0 +1,95 @@
|
|
|
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 { ApiFormatter } from '../ApiFormatter';
|
|
6
|
+
import { TransactionCache } from '../cache/transaction/TransactionCache';
|
|
7
|
+
import { ChangesDelta } from '../ChangesDelta';
|
|
8
|
+
import { CustomFieldTypeBusinessLogicRule } from './Customfield/CustomFieldTypeBusinessLogicRule';
|
|
9
|
+
import { DocumentTemplateBusinessLogicRule } from './Documents/DocumentTemplateBusinessLogicRule';
|
|
10
|
+
import { ExemplaarAanschafdatumBusinessLogicRule } from './Exemplaar/ExemplaarAanschafdatumBusinessLogicRule';
|
|
11
|
+
import { FactuurBetalingsconditieBusinessLogicRule } from './Factuur/FactuurBetalingsconditieBusinessLogicRule';
|
|
12
|
+
import { FactuurDatumBusinessLogicRule } from './Factuur/FactuurDatumBusinessLogicRule';
|
|
13
|
+
import { FactuurNumberseriesBusinessLogicRule } from './Factuur/FactuurNumberseriesBusinessLogicRule';
|
|
14
|
+
import { FunctieNaaminternBusinessLogicRule } from './Functie/FunctieNaaminternBusinessLogicRule';
|
|
15
|
+
import { FunctieTwowayBusinessLogicRule } from './Functie/FunctieTwowayBusinessLogicRule';
|
|
16
|
+
import { MateriaalTypeBusinessLogicRule } from './Materiaal/MateriaalTypeBusinessLogicRule';
|
|
17
|
+
import { MateriaalVerhuurBusinessLogicRule } from './Materiaal/MateriaalVerhuurBusinessLogicRule';
|
|
18
|
+
import { SurfaceArticleSizeBusinessLogicRule } from './Materiaal/SurfaceArticleSizeBusinessLogicRule';
|
|
19
|
+
import { OfferteContractDatumBusinessLogicRule } from './OfferteContract/OfferteContractDatumBusinessLogicRule';
|
|
20
|
+
import { PlanningPersoneelTransportBusinessLogicRule } from './PlanningPersoneelTransport/PlanningPersoneelTransportBusinessLogicRule';
|
|
21
|
+
import { ProjectClientNoteBusinessLogicRule } from './Project/ProjectClientNoteBusinessLogicRule';
|
|
22
|
+
import { ReparatieAanschafdatumBusinessLogicRule } from './Reparatie/ReparatieExemplaarBusinessLogicRule';
|
|
23
|
+
import { RolDocumentAccessBusinessLogicRule } from './Rol/RolDocumentAccessBusinessLogicRule';
|
|
24
|
+
import { RolEditOwnDataBusinessLogicRule } from './Rol/RolEditOwnDataBusinessLogicRule';
|
|
25
|
+
import { RolFileAccessBusinessLogicRule } from './Rol/RolFileAccessBusinessLogicRule';
|
|
26
|
+
import { RolPersoneelsplannerToegangBusinessLogicRule } from './Rol/RolPersoneelsplannerToegangBusinessLogicRule';
|
|
27
|
+
import { RolProjectenBewerkenBusinessLogicRule } from './Rol/RolProjectenBewerkenBusinessLogicRule';
|
|
28
|
+
import { RolProjectenToegangBusinessLogicRule } from './Rol/RolProjectenToegangBusinessLogicRule';
|
|
29
|
+
/**
|
|
30
|
+
* @description
|
|
31
|
+
* The BusinessLogicManager is responsible for calling all business rules with a ChangesDelta and storing their results for the {@link BusinessLogicRule business logic phases}.
|
|
32
|
+
*/
|
|
33
|
+
export declare class BusinessLogicManager {
|
|
34
|
+
private apiFormatter;
|
|
35
|
+
private changesDeltaFactory;
|
|
36
|
+
private errorHandler;
|
|
37
|
+
private promiseLibrary;
|
|
38
|
+
private locals;
|
|
39
|
+
/**
|
|
40
|
+
* @description
|
|
41
|
+
* The business rules are stored in a map so that the core-consumer can overwrite the {@link BusinessLogicRule.confirmFn confirmFn} to show a confirmation
|
|
42
|
+
*
|
|
43
|
+
* @remark
|
|
44
|
+
* This property is intentionally not typed so that the keys can be inferred
|
|
45
|
+
*
|
|
46
|
+
* @private
|
|
47
|
+
*/
|
|
48
|
+
allBusinessRules: {
|
|
49
|
+
FunctieTwowayBusinessLogicRule: FunctieTwowayBusinessLogicRule;
|
|
50
|
+
FunctieNaaminternBusinessLogicRule: FunctieNaaminternBusinessLogicRule;
|
|
51
|
+
CustomFieldTypeBusinessLogicRule: CustomFieldTypeBusinessLogicRule;
|
|
52
|
+
RolDocumentAccessBusinessLogicRule: RolDocumentAccessBusinessLogicRule;
|
|
53
|
+
RolEditOwnDataBusinessLogicRule: RolEditOwnDataBusinessLogicRule;
|
|
54
|
+
RolFileAccessBusinessLogicRule: RolFileAccessBusinessLogicRule;
|
|
55
|
+
RolPersoneelsplannerToegangBusinessLogicRule: RolPersoneelsplannerToegangBusinessLogicRule;
|
|
56
|
+
RolProjectenBewerkenBusinessLogicRule: RolProjectenBewerkenBusinessLogicRule;
|
|
57
|
+
RolProjectenToegangBusinessLogicRule: RolProjectenToegangBusinessLogicRule;
|
|
58
|
+
ExemplaarAanschafdatumBusinessLogicRule: ExemplaarAanschafdatumBusinessLogicRule;
|
|
59
|
+
ReparatieAanschafdatumBusinessLogicRule: ReparatieAanschafdatumBusinessLogicRule;
|
|
60
|
+
MateriaalVerhuurBusinessLogicRule: MateriaalVerhuurBusinessLogicRule;
|
|
61
|
+
MateriaalTypeBusinessLogicRule: MateriaalTypeBusinessLogicRule;
|
|
62
|
+
SurfaceArticleSizeBusinessLogicRule: SurfaceArticleSizeBusinessLogicRule;
|
|
63
|
+
PlanningPersoneelTransportBusinessLogicRule: PlanningPersoneelTransportBusinessLogicRule;
|
|
64
|
+
ProjectClientNoteBusinessLogicRule: ProjectClientNoteBusinessLogicRule;
|
|
65
|
+
FactuurNumberseriesBusinessLogicRule: FactuurNumberseriesBusinessLogicRule;
|
|
66
|
+
FactuurBetalingsconditieBusinessLogicRule: FactuurBetalingsconditieBusinessLogicRule;
|
|
67
|
+
FactuurDatumBusinessLogicRule: FactuurDatumBusinessLogicRule;
|
|
68
|
+
OfferteContractDatumBusinessLogicRule: OfferteContractDatumBusinessLogicRule;
|
|
69
|
+
DocumentTemplateBusinessLogicRule: DocumentTemplateBusinessLogicRule;
|
|
70
|
+
};
|
|
71
|
+
constructor(apiFormatter: ApiFormatter, changesDeltaFactory: ChangesDeltaFactory, errorHandler: ErrorHandlerInterface, promiseLibrary: PromiseLibraryInterface, locals: ApiModuleFunctionLocalsGetLocals);
|
|
72
|
+
/**
|
|
73
|
+
* @description
|
|
74
|
+
* 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
|
|
75
|
+
* if new changes are made on *only those new changes* the business logic can be run again.
|
|
76
|
+
*
|
|
77
|
+
* example:
|
|
78
|
+
* - `Functie.twoway` changes the `Functie.afstand` field
|
|
79
|
+
* - In a second iteration (recursive call) the `Functie.afstand` field updates `Functie.prijs`
|
|
80
|
+
* (by doing `Functie.afstand` * `Functie.kilometerprijs`)
|
|
81
|
+
* - In a third iteration (2nd recursive call) the `Functie.kilometerprijs` has no business logic, so the function
|
|
82
|
+
* exits early (`rulesToRun.size === 0`) and the recursion ends
|
|
83
|
+
*
|
|
84
|
+
* @param transaction The transaction the ChangesDelta will be applied on
|
|
85
|
+
* @param changesDelta The source ChangesDelta which contains the changes the rules should be checked on
|
|
86
|
+
*
|
|
87
|
+
* @private should only be called by the core
|
|
88
|
+
*/
|
|
89
|
+
handleBusinessLogic(transaction: TransactionCache, changesDelta: ChangesDelta): Promise<ChangesDelta>;
|
|
90
|
+
private waitForRuleApplication;
|
|
91
|
+
private waitForRuleDependencies;
|
|
92
|
+
private waitForRuleDependency;
|
|
93
|
+
private extractRulesToRun;
|
|
94
|
+
private extractRuleToRun;
|
|
95
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { ApiEnumItemType, ItemId, ResponseColumn } from '@rentman/backend-types';
|
|
2
|
+
import { ItemEntry } from '../../models/ItemEntry';
|
|
3
|
+
import { FieldMap, GetFieldValueType, ItemTypeColumnId } from '../../types/ItemTypesCollection';
|
|
4
|
+
import { ApiFormatter } from '../ApiFormatter';
|
|
5
|
+
import { TransactionCache } from '../cache/transaction/TransactionCache';
|
|
6
|
+
import { TransactionItemHandler } from '../cache/transaction/TransactionItemHandler';
|
|
7
|
+
import { ChangesDelta } from '../ChangesDelta';
|
|
8
|
+
import { ChangesDeltaItemUpdateDelta } from '../ChangesDeltaBase';
|
|
9
|
+
export declare type BusinessLogicRuleConfirmFn<ConditionResult = any> = (conditionResult: ConditionResult) => Promise<boolean>;
|
|
10
|
+
export declare type BusinessLogicConditionResult<ItemTypeType extends ApiEnumItemType, ColumnId extends ItemTypeColumnId<ItemTypeType>> = {
|
|
11
|
+
itemEntry: ItemEntry<ItemTypeType>;
|
|
12
|
+
responseColumn: ResponseColumn<ItemTypeType, ColumnId>;
|
|
13
|
+
oldValue: GetFieldValueType<ItemTypeType, ColumnId>;
|
|
14
|
+
newValue: GetFieldValueType<ItemTypeType, ColumnId>;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* @description
|
|
18
|
+
* A business rule is a class that does some data transformation depending on other fields.
|
|
19
|
+
* You can hook into any data change using the {@link BusinessLogicRule.condition `condition`} function (also deletes/creates)
|
|
20
|
+
*
|
|
21
|
+
* All business rule logic is always run in these phases:
|
|
22
|
+
* 1. condition checking - handled by the {@link BusinessLogicRule.condition `condition`} function
|
|
23
|
+
* 2. dependency fetching - handled by the {@link BusinessLogicRule.dependency `dependency`} function
|
|
24
|
+
* 3. rule applying - handled by the {@link BusinessLogicRule.apply `apply`} function
|
|
25
|
+
*/
|
|
26
|
+
export declare abstract class BusinessLogicRule<ConditionResult extends any = any, DependencyType extends any = any> {
|
|
27
|
+
protected apiFormatter: ApiFormatter;
|
|
28
|
+
confirmFn: null | BusinessLogicRuleConfirmFn<ConditionResult>;
|
|
29
|
+
constructor(apiFormatter: ApiFormatter);
|
|
30
|
+
/**
|
|
31
|
+
* @description
|
|
32
|
+
* Checks if the business rule should run. It will first check if there's any item in the changesDelta this rule applies to. If this is the case it will check if the rule has a {@link BusinessLogicRule.confirmFn confirmFn} and show it if there is one.
|
|
33
|
+
*
|
|
34
|
+
* @param changesDelta The changesDelta that is being applied
|
|
35
|
+
* @param itemChanges The transaction's item changes
|
|
36
|
+
*/
|
|
37
|
+
checkCondition(changesDelta: ChangesDelta, itemChanges: TransactionItemHandler['itemChanges']): Promise<ConditionResult | undefined>;
|
|
38
|
+
/**
|
|
39
|
+
* @description
|
|
40
|
+
* The {@link BusinessLogicRule.dependency `dependency`} function gets the result of the {@link BusinessLogicRule.condition `condition`} function and has to ensure that
|
|
41
|
+
* the data that the {@link BusinessLogicRule.apply `apply`} function reads/writes is fetched (because you cannot write columns you don't have)
|
|
42
|
+
*
|
|
43
|
+
* @param transaction The transaction that the delta is being applied on
|
|
44
|
+
* @param conditionResult The result of the {@link BusinessLogicRule.condition `condition`} call
|
|
45
|
+
* @param changesDelta The source changesDelta that triggered the business rule
|
|
46
|
+
*/
|
|
47
|
+
abstract dependency(transaction: TransactionCache, conditionResult: ConditionResult, changesDelta: ChangesDelta): Promise<DependencyType>;
|
|
48
|
+
/**
|
|
49
|
+
* @description
|
|
50
|
+
* The {@link BusinessLogicRule.apply `apply`} function gets the result of the {@link BusinessLogicRule.dependency `dependency`} function and is responsible for actually doing the business logic
|
|
51
|
+
* In this function other fields can be updated or new items can be created
|
|
52
|
+
*
|
|
53
|
+
* @remark
|
|
54
|
+
* Do not alter data in the `changesDelta` but use the `destinationChangesDelta`, this is so that for the changed values in the `destinationChangesDelta` business logic can also be done.
|
|
55
|
+
*
|
|
56
|
+
* @param changesDelta The source changesDelta that triggered the business rule
|
|
57
|
+
* @param destinationChangesDelta The destination changesDelta on which you should put the new changes you want to add
|
|
58
|
+
* @param dependencies The result of the {@link BusinessLogicRule.dependency `dependency`} function
|
|
59
|
+
* @param transaction The transaction that the delta is being applied on
|
|
60
|
+
*/
|
|
61
|
+
abstract apply(changesDelta: ChangesDelta, destinationChangesDelta: ChangesDelta, dependencies: DependencyType, transaction: TransactionCache): Promise<any> | void;
|
|
62
|
+
/**
|
|
63
|
+
* @description
|
|
64
|
+
* The {@link BusinessLogicRule.condition `condition`} function should extract the items from the {@link ChangesDelta `ChangesDelta`} so that the {@link BusinessLogicRule.dependency `dependency`} function can fetch the required data for the business rule.
|
|
65
|
+
* This function can return `undefined` if the rule does not apply to the items in the given ChangesDelta.
|
|
66
|
+
*
|
|
67
|
+
* @param changesDelta The source changesDelta that triggered the business rule
|
|
68
|
+
* @param itemChanges The {@link TransactionItemHandler.itemChanges ItemChanges} of the transaction
|
|
69
|
+
* @protected
|
|
70
|
+
*/
|
|
71
|
+
protected abstract condition(changesDelta: ChangesDelta, itemChanges: TransactionItemHandler['itemChanges']): ConditionResult | undefined;
|
|
72
|
+
/**
|
|
73
|
+
* @description
|
|
74
|
+
* This function is a utility function that will return the {@link ItemId ItemIds} of updated items in the {@link ChangesDelta ChangesDelta} which match the {@link ApiEnumItemType ItemType} and of which the provided column's field has changed
|
|
75
|
+
*
|
|
76
|
+
* @param changesDelta The source changesDelta that triggered the business rule
|
|
77
|
+
* @param itemChanges The {@link TransactionItemHandler.itemChanges ItemChanges} of the transaction
|
|
78
|
+
* @param itemType The ItemType of the item you want to compare a field from
|
|
79
|
+
* @param columnId The columnId of the field that should've been changed for the ID to be included
|
|
80
|
+
* @protected
|
|
81
|
+
*/
|
|
82
|
+
protected getItemIdsWithUpdatedField<ItemTypeType extends ApiEnumItemType>(changesDelta: ChangesDelta, itemChanges: TransactionItemHandler['itemChanges'], itemType: ItemTypeType, columnId: keyof FieldMap<ItemTypeType>): ItemId[] | undefined;
|
|
83
|
+
/**
|
|
84
|
+
* @description
|
|
85
|
+
* This function will compare the stored changes with the given changes, and return `false` if the fields have been changed.
|
|
86
|
+
* If either the source or changed field is `undefined` it will always return `true` (not changed)
|
|
87
|
+
*
|
|
88
|
+
* @param itemChanges The {@link TransactionItemHandler.itemChanges ItemChanges} of the transaction
|
|
89
|
+
* @param tuple The {@link ChangesDelta.updated update tuple} from a ChangesDelta
|
|
90
|
+
* @param columnId The columnId of the field that should've been changed for the ID to be included
|
|
91
|
+
* @protected
|
|
92
|
+
*/
|
|
93
|
+
protected fieldChanged<ItemTypeType extends ApiEnumItemType, ColumnId extends ItemTypeColumnId<ItemTypeType>>(itemChanges: TransactionItemHandler['itemChanges'], tuple: ChangesDeltaItemUpdateDelta<ItemTypeType>, columnId: ColumnId): null | BusinessLogicConditionResult<ItemTypeType, ColumnId>;
|
|
94
|
+
}
|
package/dist/types/classes/BusinessLogicManager/Customfield/CustomFieldTypeBusinessLogicRule.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ApiEnumItemType, ItemId } from '@rentman/backend-types';
|
|
2
|
+
import { ItemResource } from '../../../models/ItemResource';
|
|
3
|
+
import { TransactionCache } from '../../cache/transaction/TransactionCache';
|
|
4
|
+
import { TransactionItemHandler } from '../../cache/transaction/TransactionItemHandler';
|
|
5
|
+
import { ChangesDelta } from '../../ChangesDelta';
|
|
6
|
+
import { BusinessLogicRule } from '../BusinessLogicRule';
|
|
7
|
+
declare type ConditionResult = ItemId[];
|
|
8
|
+
declare type Dependency = ItemResource<ApiEnumItemType.Customfield, ['defaultvalue', 'attributes']>[];
|
|
9
|
+
/**
|
|
10
|
+
* @description
|
|
11
|
+
* If the 'type' field changes we reset the 'defaultvalue' and 'attribute' fields so that they do not contain invalid values
|
|
12
|
+
*/
|
|
13
|
+
export declare class CustomFieldTypeBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
|
|
14
|
+
condition(changesDelta: ChangesDelta, itemChanges: TransactionItemHandler['itemChanges']): ConditionResult | undefined;
|
|
15
|
+
dependency(transaction: TransactionCache, functionIds: ConditionResult): Promise<Dependency>;
|
|
16
|
+
apply(changesDelta: ChangesDelta, destinationChangesDelta: ChangesDelta, customFieldResources: Dependency): void;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
package/dist/types/classes/BusinessLogicManager/Documents/DocumentTemplateBusinessLogicRule.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ApiEnumItemType, ItemId } from '@rentman/backend-types';
|
|
2
|
+
import { PromiseLibraryInterface } from '../../../interfaces/PromiseLibraryInterface';
|
|
3
|
+
import { ItemResource } from '../../../models/ItemResource';
|
|
4
|
+
import { ApiFormatter } from '../../ApiFormatter';
|
|
5
|
+
import { TransactionCache } from '../../cache/transaction/TransactionCache';
|
|
6
|
+
import { TransactionItemHandler } from '../../cache/transaction/TransactionItemHandler';
|
|
7
|
+
import { ChangesDelta } from '../../ChangesDelta';
|
|
8
|
+
import { BusinessLogicRule } from '../BusinessLogicRule';
|
|
9
|
+
declare type DocumentTypes = ApiEnumItemType.Factuur | ApiEnumItemType.Offerte | ApiEnumItemType.Contract | ApiEnumItemType.Bon | ApiEnumItemType.Inhuurbon | ApiEnumItemType.Materiaalbon | ApiEnumItemType.Medewerkerbon | ApiEnumItemType.Aanmaning | ApiEnumItemType.Reparatiebon | ApiEnumItemType.Voertuigbon;
|
|
10
|
+
declare type ConditionResult = {
|
|
11
|
+
[key in DocumentTypes]?: ItemId[];
|
|
12
|
+
};
|
|
13
|
+
declare type Dependency = {
|
|
14
|
+
[key in DocumentTypes]?: ItemResource<DocumentTypes, ['filename', 'betreft']>[];
|
|
15
|
+
};
|
|
16
|
+
export declare class DocumentTemplateBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
|
|
17
|
+
protected apiFormatter: ApiFormatter;
|
|
18
|
+
private promiseLibrary;
|
|
19
|
+
constructor(apiFormatter: ApiFormatter, promiseLibrary: PromiseLibraryInterface);
|
|
20
|
+
condition(changesDelta: ChangesDelta, itemChanges: TransactionItemHandler['itemChanges']): ConditionResult | undefined;
|
|
21
|
+
dependency(transaction: TransactionCache, itemIdMap: ConditionResult): Promise<Dependency>;
|
|
22
|
+
apply(_changesDelta: ChangesDelta, destinationChangesDelta: ChangesDelta, items: Dependency): void;
|
|
23
|
+
private isDocumentType;
|
|
24
|
+
}
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ApiEnumItemType, ItemId } from '@rentman/backend-types';
|
|
2
|
+
import { ItemResource } from '../../../models/ItemResource';
|
|
3
|
+
import { TransactionCache } from '../../cache/transaction/TransactionCache';
|
|
4
|
+
import { TransactionItemHandler } from '../../cache/transaction/TransactionItemHandler';
|
|
5
|
+
import { ChangesDelta } from '../../ChangesDelta';
|
|
6
|
+
import { BusinessLogicRule } from '../BusinessLogicRule';
|
|
7
|
+
declare type ConditionResult = ItemId[];
|
|
8
|
+
declare type Dependency = ItemResource<ApiEnumItemType.Exemplaar, ['actief']>[];
|
|
9
|
+
export declare class ExemplaarAanschafdatumBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
|
|
10
|
+
condition(changesDelta: ChangesDelta, _itemChanges: TransactionItemHandler['itemChanges']): ConditionResult | undefined;
|
|
11
|
+
dependency(transaction: TransactionCache, exemplaarIds: ConditionResult): Promise<Dependency>;
|
|
12
|
+
apply(_changesDelta: ChangesDelta, destinationChangesDelta: ChangesDelta, exemplaarResources: Dependency): void;
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ApiEnumItemType, ItemId } from '@rentman/backend-types';
|
|
2
|
+
import { ItemResource } from '../../../models/ItemResource';
|
|
3
|
+
import { TransactionCache } from '../../cache/transaction/TransactionCache';
|
|
4
|
+
import { TransactionItemHandler } from '../../cache/transaction/TransactionItemHandler';
|
|
5
|
+
import { ChangesDelta } from '../../ChangesDelta';
|
|
6
|
+
import { BusinessLogicConditionResult, BusinessLogicRule } from '../BusinessLogicRule';
|
|
7
|
+
declare type ConditionResult = BusinessLogicConditionResult<ApiEnumItemType.Factuur, 'betalingsconditie'>[];
|
|
8
|
+
declare type Dependency = {
|
|
9
|
+
Factuur: ItemResource<ApiEnumItemType.Factuur, ['vervaldatum', 'datum']>[];
|
|
10
|
+
Betalingsconditie: {
|
|
11
|
+
[conditieId: string]: ItemResource<ApiEnumItemType.Betalingsconditie, ['dagen']>;
|
|
12
|
+
};
|
|
13
|
+
defaultPaymentConditionId: ItemId | null;
|
|
14
|
+
};
|
|
15
|
+
export declare class FactuurBetalingsconditieBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
|
|
16
|
+
condition(changesDelta: ChangesDelta, itemChanges: TransactionItemHandler['itemChanges']): ConditionResult | undefined;
|
|
17
|
+
dependency(transaction: TransactionCache, result: ConditionResult, changesDelta: ChangesDelta): Promise<Dependency>;
|
|
18
|
+
apply(changesDelta: ChangesDelta, destinationChangesDelta: ChangesDelta, deps: Dependency): void;
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ApiEnumItemType, ItemId } from '@rentman/backend-types';
|
|
2
|
+
import { ItemResource } from '../../../models/ItemResource';
|
|
3
|
+
import { TransactionCache } from '../../cache/transaction/TransactionCache';
|
|
4
|
+
import { TransactionItemHandler } from '../../cache/transaction/TransactionItemHandler';
|
|
5
|
+
import { ChangesDelta } from '../../ChangesDelta';
|
|
6
|
+
import { BusinessLogicRule } from '../BusinessLogicRule';
|
|
7
|
+
declare type ConditionResult = ItemId[];
|
|
8
|
+
declare type Dependency = {
|
|
9
|
+
Factuur: ItemResource<ApiEnumItemType.Factuur, ['vervaldatum', 'betalingsconditie']>[];
|
|
10
|
+
Betalingsconditie: {
|
|
11
|
+
[conditieId: string]: ItemResource<ApiEnumItemType.Betalingsconditie, ['dagen']>;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export declare class FactuurDatumBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
|
|
15
|
+
condition(changesDelta: ChangesDelta, itemChanges: TransactionItemHandler['itemChanges']): ConditionResult | undefined;
|
|
16
|
+
dependency(transaction: TransactionCache, factuurIds: ConditionResult, _changesDelta: ChangesDelta): Promise<Dependency>;
|
|
17
|
+
apply(changesDelta: ChangesDelta, destinationChangesDelta: ChangesDelta, deps: Dependency): void;
|
|
18
|
+
}
|
|
19
|
+
export {};
|
package/dist/types/classes/BusinessLogicManager/Factuur/FactuurNumberseriesBusinessLogicRule.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ApiEnumItemType, ItemId } from '@rentman/backend-types';
|
|
2
|
+
import { ItemResource } from '../../../models/ItemResource';
|
|
3
|
+
import { TransactionCache } from '../../cache/transaction/TransactionCache';
|
|
4
|
+
import { TransactionItemHandler } from '../../cache/transaction/TransactionItemHandler';
|
|
5
|
+
import { ChangesDelta } from '../../ChangesDelta';
|
|
6
|
+
import { BusinessLogicRule } from '../BusinessLogicRule';
|
|
7
|
+
declare type ConditionResult = ItemId[];
|
|
8
|
+
declare type Dependency = ItemResource<ApiEnumItemType.Factuur, ['nummer']>[];
|
|
9
|
+
export declare class FactuurNumberseriesBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
|
|
10
|
+
condition(changesDelta: ChangesDelta, itemChanges: TransactionItemHandler['itemChanges']): ConditionResult | undefined;
|
|
11
|
+
dependency(transaction: TransactionCache, factuurIds: ConditionResult): Promise<Dependency>;
|
|
12
|
+
apply(_changesDelta: ChangesDelta, destinationChangesDelta: ChangesDelta, factuurResources: Dependency): void;
|
|
13
|
+
}
|
|
14
|
+
export {};
|
package/dist/types/classes/BusinessLogicManager/Functie/FunctieNaaminternBusinessLogicRule.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ApiEnumItemType, ItemId } from '@rentman/backend-types';
|
|
2
|
+
import { ItemResource } from '../../../models/ItemResource';
|
|
3
|
+
import { TransactionCache } from '../../cache/transaction/TransactionCache';
|
|
4
|
+
import { TransactionItemHandler } from '../../cache/transaction/TransactionItemHandler';
|
|
5
|
+
import { ChangesDelta } from '../../ChangesDelta';
|
|
6
|
+
import { BusinessLogicRule } from '../BusinessLogicRule';
|
|
7
|
+
declare type ConditionResult = ItemId[];
|
|
8
|
+
declare type Dependency = ItemResource<ApiEnumItemType.Functie, ['naamintern']>[];
|
|
9
|
+
/**
|
|
10
|
+
* @description
|
|
11
|
+
* If the `naamofferte` is set and the user hasn't filled in a `naamintern` we sync the fields
|
|
12
|
+
*/
|
|
13
|
+
export declare class FunctieNaaminternBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
|
|
14
|
+
condition(changesDelta: ChangesDelta, itemChanges: TransactionItemHandler['itemChanges']): ConditionResult | undefined;
|
|
15
|
+
dependency(transaction: TransactionCache, functionIds: ConditionResult): Promise<Dependency>;
|
|
16
|
+
apply(changesDelta: ChangesDelta, destinationChangesDelta: ChangesDelta, functionResources: Dependency): void;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ApiEnumItemType, ItemId } from '@rentman/backend-types';
|
|
2
|
+
import { ItemResource } from '../../../models/ItemResource';
|
|
3
|
+
import { TransactionCache } from '../../cache/transaction/TransactionCache';
|
|
4
|
+
import { TransactionItemHandler } from '../../cache/transaction/TransactionItemHandler';
|
|
5
|
+
import { ChangesDelta } from '../../ChangesDelta';
|
|
6
|
+
import { BusinessLogicRule } from '../BusinessLogicRule';
|
|
7
|
+
declare type ConditionResult = ItemId[];
|
|
8
|
+
declare type Dependency = ItemResource<ApiEnumItemType.Functie, ['afstand']>[];
|
|
9
|
+
export declare class FunctieTwowayBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
|
|
10
|
+
condition(changesDelta: ChangesDelta, itemChanges: TransactionItemHandler['itemChanges']): ConditionResult | undefined;
|
|
11
|
+
dependency(transaction: TransactionCache, functionIds: ConditionResult): Promise<Dependency>;
|
|
12
|
+
apply(changesDelta: ChangesDelta, destinationChangesDelta: ChangesDelta, functionResources: Dependency): void;
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ApiEnumItemType, ItemId } from '@rentman/backend-types';
|
|
2
|
+
import { ItemResource } from '../../../models/ItemResource';
|
|
3
|
+
import { TransactionCache } from '../../cache/transaction/TransactionCache';
|
|
4
|
+
import { TransactionItemHandler } from '../../cache/transaction/TransactionItemHandler';
|
|
5
|
+
import { ChangesDelta } from '../../ChangesDelta';
|
|
6
|
+
import { BusinessLogicRule } from '../BusinessLogicRule';
|
|
7
|
+
declare type ConditionResult = ItemId[];
|
|
8
|
+
declare type Dependency = ItemResource<ApiEnumItemType.Materiaal, ['aantal']>[];
|
|
9
|
+
/**
|
|
10
|
+
* @description
|
|
11
|
+
* A sales item can never be a case, so if the user changes the item to a case we make it a rental item
|
|
12
|
+
*/
|
|
13
|
+
export declare class MateriaalTypeBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
|
|
14
|
+
condition(changesDelta: ChangesDelta, _itemChanges: TransactionItemHandler['itemChanges']): ConditionResult | undefined;
|
|
15
|
+
dependency(transaction: TransactionCache, materiaalIds: ConditionResult): Promise<Dependency>;
|
|
16
|
+
apply(_changesDelta: ChangesDelta, destinationChangesDelta: ChangesDelta, materiaalResources: Dependency): void;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
package/dist/types/classes/BusinessLogicManager/Materiaal/MateriaalVerhuurBusinessLogicRule.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ApiEnumItemType, ItemId } from '@rentman/backend-types';
|
|
2
|
+
import { ItemResource } from '../../../models/ItemResource';
|
|
3
|
+
import { TransactionCache } from '../../cache/transaction/TransactionCache';
|
|
4
|
+
import { TransactionItemHandler } from '../../cache/transaction/TransactionItemHandler';
|
|
5
|
+
import { ChangesDelta } from '../../ChangesDelta';
|
|
6
|
+
import { BusinessLogicRule } from '../BusinessLogicRule';
|
|
7
|
+
declare type ConditionResult = ItemId[];
|
|
8
|
+
declare type Dependency = ItemResource<ApiEnumItemType.Materiaal, ['aantal']>[];
|
|
9
|
+
/**
|
|
10
|
+
* @description
|
|
11
|
+
* A sales item can never be a case, so if it is we reset it to an item
|
|
12
|
+
*/
|
|
13
|
+
export declare class MateriaalVerhuurBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
|
|
14
|
+
condition(changesDelta: ChangesDelta, _itemChanges: TransactionItemHandler['itemChanges']): ConditionResult | undefined;
|
|
15
|
+
dependency(transaction: TransactionCache, materiaalIds: ConditionResult): Promise<Dependency>;
|
|
16
|
+
apply(_changesDelta: ChangesDelta, destinationChangesDelta: ChangesDelta, materiaalResources: Dependency): void;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
package/dist/types/classes/BusinessLogicManager/Materiaal/SurfaceArticleSizeBusinessLogicRule.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ApiEnumItemType, ApiModuleFunctionLocalsGetLocals, ItemId } from '@rentman/backend-types';
|
|
2
|
+
import { ItemResource } from '../../../models/ItemResource';
|
|
3
|
+
import { ApiFormatter } from '../../ApiFormatter';
|
|
4
|
+
import { TransactionCache } from '../../cache/transaction/TransactionCache';
|
|
5
|
+
import { TransactionItemHandler } from '../../cache/transaction/TransactionItemHandler';
|
|
6
|
+
import { ChangesDelta } from '../../ChangesDelta';
|
|
7
|
+
import { BusinessLogicRule } from '../BusinessLogicRule';
|
|
8
|
+
declare type ConditionResult = ItemId[];
|
|
9
|
+
declare type DependencyColumns = ['width', 'height', 'oppervlakteartikel', 'nieuwprijs', 'inhuurprijs', 'verhuurprijs', 'naam'];
|
|
10
|
+
declare type Dependency = ItemResource<ApiEnumItemType.Materiaal, DependencyColumns>[];
|
|
11
|
+
export declare class SurfaceArticleSizeBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
|
|
12
|
+
protected apiFormatter: ApiFormatter;
|
|
13
|
+
private locals;
|
|
14
|
+
constructor(apiFormatter: ApiFormatter, locals: ApiModuleFunctionLocalsGetLocals);
|
|
15
|
+
condition(changesDelta: ChangesDelta, _itemChanges: TransactionItemHandler['itemChanges']): ConditionResult | undefined;
|
|
16
|
+
dependency(transaction: TransactionCache, materiaalIds: ConditionResult): Promise<Dependency>;
|
|
17
|
+
apply(changesDelta: ChangesDelta, destinationChangesDelta: ChangesDelta, materiaalResources: Dependency): void;
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ApiEnumItemType, ItemId } from '@rentman/backend-types';
|
|
2
|
+
import { PromiseLibraryInterface } from '../../../interfaces/PromiseLibraryInterface';
|
|
3
|
+
import { ItemResource } from '../../../models/ItemResource';
|
|
4
|
+
import { ApiFormatter } from '../../ApiFormatter';
|
|
5
|
+
import { TransactionCache } from '../../cache/transaction/TransactionCache';
|
|
6
|
+
import { TransactionItemHandler } from '../../cache/transaction/TransactionItemHandler';
|
|
7
|
+
import { ChangesDelta } from '../../ChangesDelta';
|
|
8
|
+
import { BusinessLogicRule } from '../BusinessLogicRule';
|
|
9
|
+
declare type ConditionResult = {
|
|
10
|
+
Offerte: ItemId[];
|
|
11
|
+
Contract: ItemId[];
|
|
12
|
+
};
|
|
13
|
+
declare type Dependency = {
|
|
14
|
+
Offerte: ItemResource<ApiEnumItemType.Offerte, ['vervaldatum']>[];
|
|
15
|
+
Contract: ItemResource<ApiEnumItemType.Contract, ['vervaldatum']>[];
|
|
16
|
+
State: ItemResource<ApiEnumItemType.State, ['geldigheidofferte']>;
|
|
17
|
+
};
|
|
18
|
+
export declare class OfferteContractDatumBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
|
|
19
|
+
protected apiFormatter: ApiFormatter;
|
|
20
|
+
private promiseLibrary;
|
|
21
|
+
constructor(apiFormatter: ApiFormatter, promiseLibrary: PromiseLibraryInterface);
|
|
22
|
+
condition(changesDelta: ChangesDelta, itemChanges: TransactionItemHandler['itemChanges']): ConditionResult | undefined;
|
|
23
|
+
dependency(transaction: TransactionCache, itemIdMap: ConditionResult): Promise<Dependency>;
|
|
24
|
+
apply(_changesDelta: ChangesDelta, destinationChangesDelta: ChangesDelta, items: Dependency): void;
|
|
25
|
+
}
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ApiEnumItemType, ItemId } from '@rentman/backend-types';
|
|
2
|
+
import { PromiseLibraryInterface } from '../../../interfaces/PromiseLibraryInterface';
|
|
3
|
+
import { ItemResource } from '../../../models/ItemResource';
|
|
4
|
+
import { ApiFormatter } from '../../ApiFormatter';
|
|
5
|
+
import { TransactionCache } from '../../cache/transaction/TransactionCache';
|
|
6
|
+
import { TransactionItemHandler } from '../../cache/transaction/TransactionItemHandler';
|
|
7
|
+
import { ChangesDelta } from '../../ChangesDelta';
|
|
8
|
+
import { BusinessLogicRule } from '../BusinessLogicRule';
|
|
9
|
+
declare type ConditionResult = {
|
|
10
|
+
Planningpersoneel: ItemId[];
|
|
11
|
+
Planningtransport: ItemId[];
|
|
12
|
+
};
|
|
13
|
+
declare type Dependency = {
|
|
14
|
+
Planningpersoneel: ItemResource<ApiEnumItemType.Planningpersoneel, ['vervoer', 'functie', 'planvan', 'plantot']>[];
|
|
15
|
+
Planningtransport: ItemResource<ApiEnumItemType.Planningtransport, ['vervoer', 'functie', 'planvan', 'plantot']>[];
|
|
16
|
+
Functie: {
|
|
17
|
+
[functieId: string]: ItemResource<ApiEnumItemType.Functie, ['reistijd_vooraf', 'reistijd_achteraf']>;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export declare class PlanningPersoneelTransportBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
|
|
21
|
+
protected apiFormatter: ApiFormatter;
|
|
22
|
+
private promiseLibrary;
|
|
23
|
+
constructor(apiFormatter: ApiFormatter, promiseLibrary: PromiseLibraryInterface);
|
|
24
|
+
condition(changesDelta: ChangesDelta, itemChanges: TransactionItemHandler['itemChanges']): ConditionResult | undefined;
|
|
25
|
+
dependency(transaction: TransactionCache, itemIdMap: ConditionResult): Promise<Dependency>;
|
|
26
|
+
apply(changesDelta: ChangesDelta, destinationChangesDelta: ChangesDelta, items: Dependency): void;
|
|
27
|
+
private updatePlanningColumns;
|
|
28
|
+
}
|
|
29
|
+
export {};
|
package/dist/types/classes/BusinessLogicManager/Project/ProjectClientNoteBusinessLogicRule.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ApiEnumItemType, ItemId } from '@rentman/backend-types';
|
|
2
|
+
import { PromiseLibraryInterface } from '../../../interfaces/PromiseLibraryInterface';
|
|
3
|
+
import { ItemResource } from '../../../models/ItemResource';
|
|
4
|
+
import { ApiFormatter } from '../../ApiFormatter';
|
|
5
|
+
import { TransactionCache } from '../../cache/transaction/TransactionCache';
|
|
6
|
+
import { TransactionItemHandler } from '../../cache/transaction/TransactionItemHandler';
|
|
7
|
+
import { ChangesDelta } from '../../ChangesDelta';
|
|
8
|
+
import { BusinessLogicRule } from '../BusinessLogicRule';
|
|
9
|
+
declare type ConditionResult = {
|
|
10
|
+
[projectId: string]: ItemId;
|
|
11
|
+
};
|
|
12
|
+
declare type Dependency = {
|
|
13
|
+
[projectId: string]: ItemResource<ApiEnumItemType.Contact, ['projectnotitie_naam', 'projectnotitie']>;
|
|
14
|
+
};
|
|
15
|
+
export declare class ProjectClientNoteBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
|
|
16
|
+
protected apiFormatter: ApiFormatter;
|
|
17
|
+
private promiseLibrary;
|
|
18
|
+
constructor(apiFormatter: ApiFormatter, promiseLibrary: PromiseLibraryInterface);
|
|
19
|
+
condition(changesDelta: ChangesDelta, _itemChanges: TransactionItemHandler['itemChanges']): ConditionResult | undefined;
|
|
20
|
+
dependency(transaction: TransactionCache, obj: ConditionResult): Promise<Dependency>;
|
|
21
|
+
apply(_changesDelta: ChangesDelta, destinationChangesDelta: ChangesDelta, obj: Dependency): Promise<void>;
|
|
22
|
+
}
|
|
23
|
+
export {};
|
package/dist/types/classes/BusinessLogicManager/Reparatie/ReparatieExemplaarBusinessLogicRule.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ApiEnumItemType, ItemId } from '@rentman/backend-types';
|
|
2
|
+
import { ItemResource } from '../../../models/ItemResource';
|
|
3
|
+
import { TransactionCache } from '../../cache/transaction/TransactionCache';
|
|
4
|
+
import { TransactionItemHandler } from '../../cache/transaction/TransactionItemHandler';
|
|
5
|
+
import { ChangesDelta } from '../../ChangesDelta';
|
|
6
|
+
import { BusinessLogicRule } from '../BusinessLogicRule';
|
|
7
|
+
declare type ConditionResult = ItemId[];
|
|
8
|
+
declare type Dependency = ItemResource<ApiEnumItemType.Reparatie, ['aantal']>[];
|
|
9
|
+
export declare class ReparatieAanschafdatumBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
|
|
10
|
+
condition(changesDelta: ChangesDelta, _itemChanges: TransactionItemHandler['itemChanges']): ConditionResult | undefined;
|
|
11
|
+
dependency(transaction: TransactionCache, reparatieIds: ConditionResult): Promise<Dependency>;
|
|
12
|
+
apply(_changesDelta: ChangesDelta, destinationChangesDelta: ChangesDelta, reparatieResources: Dependency): void;
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ApiEnumItemType, ItemId } from '@rentman/backend-types';
|
|
2
|
+
import { ItemResource } from '../../../models/ItemResource';
|
|
3
|
+
import { TransactionCache } from '../../cache/transaction/TransactionCache';
|
|
4
|
+
import { TransactionItemHandler } from '../../cache/transaction/TransactionItemHandler';
|
|
5
|
+
import { ChangesDelta } from '../../ChangesDelta';
|
|
6
|
+
import { BusinessLogicRule } from '../BusinessLogicRule';
|
|
7
|
+
declare type ConditionResult = ItemId[];
|
|
8
|
+
declare type Dependency = ItemResource<ApiEnumItemType.Rol, ['general_bestanden_downloaden']>[];
|
|
9
|
+
/**
|
|
10
|
+
* @description
|
|
11
|
+
* If you have project access or can make quotations/contracts you should have permissions to download files
|
|
12
|
+
*/
|
|
13
|
+
export declare class RolDocumentAccessBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
|
|
14
|
+
condition(changesDelta: ChangesDelta, _itemChanges: TransactionItemHandler['itemChanges']): ConditionResult | undefined;
|
|
15
|
+
dependency(transaction: TransactionCache, rolIds: ConditionResult): Promise<Dependency>;
|
|
16
|
+
apply(_changesDelta: ChangesDelta, destinationChangesDelta: ChangesDelta, rolResources: Dependency): void;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ApiEnumItemType, ItemId } from '@rentman/backend-types';
|
|
2
|
+
import { ItemResource } from '../../../models/ItemResource';
|
|
3
|
+
import { TransactionCache } from '../../cache/transaction/TransactionCache';
|
|
4
|
+
import { TransactionItemHandler } from '../../cache/transaction/TransactionItemHandler';
|
|
5
|
+
import { ChangesDelta } from '../../ChangesDelta';
|
|
6
|
+
import { BusinessLogicRule } from '../BusinessLogicRule';
|
|
7
|
+
declare type ConditionResult = ItemId[];
|
|
8
|
+
declare type Dependency = ItemResource<ApiEnumItemType.Rol, ['general_eigen_medewerker_edit']>[];
|
|
9
|
+
/**
|
|
10
|
+
* @description
|
|
11
|
+
* If you can access update crew data, you can also always update your own data
|
|
12
|
+
*/
|
|
13
|
+
export declare class RolEditOwnDataBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
|
|
14
|
+
condition(changesDelta: ChangesDelta, _itemChanges: TransactionItemHandler['itemChanges']): ConditionResult | undefined;
|
|
15
|
+
dependency(transaction: TransactionCache, rolIds: ConditionResult): Promise<Dependency>;
|
|
16
|
+
apply(_changesDelta: ChangesDelta, destinationChangesDelta: ChangesDelta, rolResources: Dependency): void;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ApiEnumItemType, ItemId } from '@rentman/backend-types';
|
|
2
|
+
import { ItemResource } from '../../../models/ItemResource';
|
|
3
|
+
import { TransactionCache } from '../../cache/transaction/TransactionCache';
|
|
4
|
+
import { TransactionItemHandler } from '../../cache/transaction/TransactionItemHandler';
|
|
5
|
+
import { ChangesDelta } from '../../ChangesDelta';
|
|
6
|
+
import { BusinessLogicRule } from '../BusinessLogicRule';
|
|
7
|
+
declare type ConditionResult = ItemId[];
|
|
8
|
+
declare type Dependency = ItemResource<ApiEnumItemType.Rol, ['facturen_eigen', 'general_bestanden_downloaden', 'facturen_toegang']>[];
|
|
9
|
+
/**
|
|
10
|
+
* @description
|
|
11
|
+
* If you have project access or can make invoices you should have permissions to download files, see invoices and edit invoices
|
|
12
|
+
*/
|
|
13
|
+
export declare class RolFileAccessBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
|
|
14
|
+
condition(changesDelta: ChangesDelta, _itemChanges: TransactionItemHandler['itemChanges']): ConditionResult | undefined;
|
|
15
|
+
dependency(transaction: TransactionCache, rolIds: ConditionResult): Promise<Dependency>;
|
|
16
|
+
apply(_changesDelta: ChangesDelta, destinationChangesDelta: ChangesDelta, rolResources: Dependency): void;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ApiEnumItemType, ItemId } from '@rentman/backend-types';
|
|
2
|
+
import { ItemResource } from '../../../models/ItemResource';
|
|
3
|
+
import { TransactionCache } from '../../cache/transaction/TransactionCache';
|
|
4
|
+
import { TransactionItemHandler } from '../../cache/transaction/TransactionItemHandler';
|
|
5
|
+
import { ChangesDelta } from '../../ChangesDelta';
|
|
6
|
+
import { BusinessLogicRule } from '../BusinessLogicRule';
|
|
7
|
+
declare type ConditionResult = ItemId[];
|
|
8
|
+
declare type Dependency = ItemResource<ApiEnumItemType.Rol, ['personeelsplanner_toegang']>[];
|
|
9
|
+
/**
|
|
10
|
+
* @description
|
|
11
|
+
* If you can enter the crew planner you can also access projects
|
|
12
|
+
*/
|
|
13
|
+
export declare class RolPersoneelsplannerToegangBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
|
|
14
|
+
condition(changesDelta: ChangesDelta, _itemChanges: TransactionItemHandler['itemChanges']): ConditionResult | undefined;
|
|
15
|
+
dependency(transaction: TransactionCache, rolIds: ConditionResult): Promise<Dependency>;
|
|
16
|
+
apply(_changesDelta: ChangesDelta, destinationChangesDelta: ChangesDelta, rolResources: Dependency): void;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
package/dist/types/classes/BusinessLogicManager/Rol/RolProjectenBewerkenBusinessLogicRule.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ApiEnumItemType, ItemId } from '@rentman/backend-types';
|
|
2
|
+
import { ItemResource } from '../../../models/ItemResource';
|
|
3
|
+
import { TransactionCache } from '../../cache/transaction/TransactionCache';
|
|
4
|
+
import { TransactionItemHandler } from '../../cache/transaction/TransactionItemHandler';
|
|
5
|
+
import { ChangesDelta } from '../../ChangesDelta';
|
|
6
|
+
import { BusinessLogicRule } from '../BusinessLogicRule';
|
|
7
|
+
declare type ConditionResult = ItemId[];
|
|
8
|
+
declare type Dependency = ItemResource<ApiEnumItemType.Rol, ['materialen_tijdlijn']>[];
|
|
9
|
+
/**
|
|
10
|
+
* @description
|
|
11
|
+
* If you can edit projects you should be able to see the equipment availability
|
|
12
|
+
*/
|
|
13
|
+
export declare class RolProjectenBewerkenBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
|
|
14
|
+
condition(changesDelta: ChangesDelta, _itemChanges: TransactionItemHandler['itemChanges']): ConditionResult | undefined;
|
|
15
|
+
dependency(transaction: TransactionCache, rolIds: ConditionResult): Promise<Dependency>;
|
|
16
|
+
apply(_changesDelta: ChangesDelta, destinationChangesDelta: ChangesDelta, rolResources: Dependency): void;
|
|
17
|
+
}
|
|
18
|
+
export {};
|