@rentman/rm-core 11.0.2 → 11.0.4

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.
Files changed (143) hide show
  1. package/changelog.md +1438 -1420
  2. package/dist/rm-core.js +829 -816
  3. package/dist/rm-core.min.js +1 -1
  4. package/dist/types/src/classes/ApiFormatter.d.ts +79 -79
  5. package/dist/types/src/classes/ApiRequestService.d.ts +18 -18
  6. package/dist/types/src/classes/ApiResponseProcessor.d.ts +29 -29
  7. package/dist/types/src/classes/BusinessLogicManager/BusinessLogicManager.d.ts +98 -98
  8. package/dist/types/src/classes/BusinessLogicManager/BusinessLogicRule.d.ts +94 -94
  9. package/dist/types/src/classes/BusinessLogicManager/Customfield/CustomFieldTypeBusinessLogicRule.d.ts +18 -18
  10. package/dist/types/src/classes/BusinessLogicManager/Documents/DocumentTemplateBusinessLogicRule.d.ts +25 -25
  11. package/dist/types/src/classes/BusinessLogicManager/Exemplaar/ExemplaarAanschafdatumBusinessLogicRule.d.ts +14 -14
  12. package/dist/types/src/classes/BusinessLogicManager/Factuur/FactuurBetalingsconditieBusinessLogicRule.d.ts +20 -20
  13. package/dist/types/src/classes/BusinessLogicManager/Factuur/FactuurDatumBusinessLogicRule.d.ts +19 -19
  14. package/dist/types/src/classes/BusinessLogicManager/Factuur/FactuurNumberseriesBusinessLogicRule.d.ts +14 -14
  15. package/dist/types/src/classes/BusinessLogicManager/Functie/FunctieNaaminternBusinessLogicRule.d.ts +18 -18
  16. package/dist/types/src/classes/BusinessLogicManager/Functie/FunctieTwowayBusinessLogicRule.d.ts +14 -14
  17. package/dist/types/src/classes/BusinessLogicManager/Materiaal/MateriaalTelexemplarenBusinessLogicRule.d.ts +15 -15
  18. package/dist/types/src/classes/BusinessLogicManager/Materiaal/MateriaalTypeBusinessLogicRule.d.ts +18 -18
  19. package/dist/types/src/classes/BusinessLogicManager/Materiaal/MateriaalVerhuurBusinessLogicRule.d.ts +18 -18
  20. package/dist/types/src/classes/BusinessLogicManager/Materiaal/SurfaceArticleSizeBusinessLogicRule.d.ts +19 -19
  21. package/dist/types/src/classes/BusinessLogicManager/OfferteContract/OfferteContractDatumBusinessLogicRule.d.ts +26 -26
  22. package/dist/types/src/classes/BusinessLogicManager/PlanningPersoneelTransport/PlanningPersoneelTransportBusinessLogicRule.d.ts +29 -29
  23. package/dist/types/src/classes/BusinessLogicManager/Project/ProjectClientNoteBusinessLogicRule.d.ts +23 -23
  24. package/dist/types/src/classes/BusinessLogicManager/Reparatie/ReparatieExemplaarBusinessLogicRule.d.ts +14 -14
  25. package/dist/types/src/classes/BusinessLogicManager/Rol/RolDocumentAccessBusinessLogicRule.d.ts +18 -18
  26. package/dist/types/src/classes/BusinessLogicManager/Rol/RolEditOwnDataBusinessLogicRule.d.ts +18 -18
  27. package/dist/types/src/classes/BusinessLogicManager/Rol/RolFileAccessBusinessLogicRule.d.ts +18 -18
  28. package/dist/types/src/classes/BusinessLogicManager/Rol/RolPersoneelsplannerToegangBusinessLogicRule.d.ts +18 -18
  29. package/dist/types/src/classes/BusinessLogicManager/Rol/RolProjectenBewerkenBusinessLogicRule.d.ts +18 -18
  30. package/dist/types/src/classes/BusinessLogicManager/Rol/RolProjectenToegangBusinessLogicRule.d.ts +18 -18
  31. package/dist/types/src/classes/CacheSyncer.d.ts +70 -70
  32. package/dist/types/src/classes/ChangesCompilation.d.ts +33 -33
  33. package/dist/types/src/classes/ChangesDelta.d.ts +65 -65
  34. package/dist/types/src/classes/ChangesDeltaBase.d.ts +79 -79
  35. package/dist/types/src/classes/ChangesProcessor.d.ts +40 -40
  36. package/dist/types/src/classes/CollectionEntryService.d.ts +24 -24
  37. package/dist/types/src/classes/CollectionResourceService.d.ts +6 -6
  38. package/dist/types/src/classes/ColumnCache.d.ts +19 -19
  39. package/dist/types/src/classes/ColumnExpansion.d.ts +19 -19
  40. package/dist/types/src/classes/ColumnHandler.d.ts +20 -20
  41. package/dist/types/src/classes/ColumnInfo.d.ts +15 -15
  42. package/dist/types/src/classes/ColumnSet.d.ts +37 -37
  43. package/dist/types/src/classes/ColumnSubsetCache.d.ts +14 -14
  44. package/dist/types/src/classes/ColumnUtil.d.ts +108 -108
  45. package/dist/types/src/classes/ConversionMapService.d.ts +25 -25
  46. package/dist/types/src/classes/CreateRequest.d.ts +17 -17
  47. package/dist/types/src/classes/CreatedChangesDelta.d.ts +17 -17
  48. package/dist/types/src/classes/InternalChangesDelta.d.ts +44 -44
  49. package/dist/types/src/classes/ItemCache.d.ts +27 -27
  50. package/dist/types/src/classes/ItemCreateService.d.ts +18 -18
  51. package/dist/types/src/classes/ItemEntryService.d.ts +32 -32
  52. package/dist/types/src/classes/KeyService.d.ts +18 -18
  53. package/dist/types/src/classes/LockService.d.ts +28 -28
  54. package/dist/types/src/classes/ModuleChangesCompilation.d.ts +18 -18
  55. package/dist/types/src/classes/ParentChangesDelta.d.ts +41 -41
  56. package/dist/types/src/classes/QueryColumnExtractor.d.ts +18 -18
  57. package/dist/types/src/classes/QueryContainsLocalIdParser.d.ts +17 -17
  58. package/dist/types/src/classes/QueryLinkedToParser.d.ts +17 -17
  59. package/dist/types/src/classes/QueryLocallyMatchableParser.d.ts +20 -20
  60. package/dist/types/src/classes/QueryMatcher.d.ts +24 -24
  61. package/dist/types/src/classes/QueryParser.d.ts +25 -25
  62. package/dist/types/src/classes/QueryParserBase.d.ts +20 -20
  63. package/dist/types/src/classes/QueryParserIdUpdater.d.ts +17 -17
  64. package/dist/types/src/classes/QueryService.d.ts +12 -12
  65. package/dist/types/src/classes/RequestBuffer.d.ts +26 -26
  66. package/dist/types/src/classes/RequestBufferManager.d.ts +21 -21
  67. package/dist/types/src/classes/RequestColumnExpansion.d.ts +15 -15
  68. package/dist/types/src/classes/SocketMessageHandler.d.ts +34 -34
  69. package/dist/types/src/classes/TemplateCache.d.ts +64 -64
  70. package/dist/types/src/classes/Util.d.ts +28 -28
  71. package/dist/types/src/classes/cache/AbstractCache.d.ts +86 -86
  72. package/dist/types/src/classes/cache/CachedQueryHandlerBase.d.ts +69 -69
  73. package/dist/types/src/classes/cache/ItemHandlerBase.d.ts +102 -102
  74. package/dist/types/src/classes/cache/server/ServerCache.d.ts +78 -78
  75. package/dist/types/src/classes/cache/server/ServerCachedQueryHandler.d.ts +26 -26
  76. package/dist/types/src/classes/cache/server/ServerItemHandler.d.ts +43 -43
  77. package/dist/types/src/classes/cache/transaction/TransactionCache.d.ts +318 -318
  78. package/dist/types/src/classes/cache/transaction/TransactionCachedQueryHandler.d.ts +39 -39
  79. package/dist/types/src/classes/cache/transaction/TransactionCollectionHandler.d.ts +24 -24
  80. package/dist/types/src/classes/cache/transaction/TransactionEventHandler.d.ts +21 -21
  81. package/dist/types/src/classes/cache/transaction/TransactionItemHandler.d.ts +90 -90
  82. package/dist/types/src/classes/cache/transaction/TransactionValidator.d.ts +33 -33
  83. package/dist/types/src/constants.d.ts +7 -7
  84. package/dist/types/src/core.d.ts +48 -48
  85. package/dist/types/src/factories/ApiResponseProcessorFactory.d.ts +6 -6
  86. package/dist/types/src/factories/CacheSyncerFactory.d.ts +10 -10
  87. package/dist/types/src/factories/ChangesCompilationFactory.d.ts +5 -5
  88. package/dist/types/src/factories/ChangesDeltaFactory.d.ts +13 -13
  89. package/dist/types/src/factories/ChangesProcessorFactory.d.ts +13 -13
  90. package/dist/types/src/factories/CollectionEntryFactory.d.ts +11 -11
  91. package/dist/types/src/factories/CollectionResourceFactory.d.ts +18 -18
  92. package/dist/types/src/factories/ColumnExpansionFactory.d.ts +7 -7
  93. package/dist/types/src/factories/ColumnInfoFactory.d.ts +7 -7
  94. package/dist/types/src/factories/ColumnSetFactory.d.ts +18 -18
  95. package/dist/types/src/factories/ColumnSubsetCacheFactory.d.ts +8 -8
  96. package/dist/types/src/factories/CreateRequestFactory.d.ts +9 -9
  97. package/dist/types/src/factories/ItemCacheFactory.d.ts +6 -6
  98. package/dist/types/src/factories/ItemEntryFactory.d.ts +12 -12
  99. package/dist/types/src/factories/ItemResourceFactory.d.ts +11 -11
  100. package/dist/types/src/factories/ModuleChangesCompilationFactory.d.ts +4 -4
  101. package/dist/types/src/factories/QueryMatcherFactory.d.ts +7 -7
  102. package/dist/types/src/factories/QueryParserFactory.d.ts +5 -5
  103. package/dist/types/src/factories/RequestColumnExpansionFactory.d.ts +8 -8
  104. package/dist/types/src/factories/TemplateFactory.d.ts +8 -8
  105. package/dist/types/src/factories/TransactionCacheFactory.d.ts +13 -13
  106. package/dist/types/src/index.d.ts +1 -1
  107. package/dist/types/src/interfaces/AbstractCacheDependencyInterface.d.ts +38 -38
  108. package/dist/types/src/interfaces/ApiRequestServiceInterface.d.ts +12 -12
  109. package/dist/types/src/interfaces/AuthInterface.d.ts +10 -10
  110. package/dist/types/src/interfaces/ErrorHandlerInterface.d.ts +6 -6
  111. package/dist/types/src/interfaces/ExceptionHandlerInterface.d.ts +3 -3
  112. package/dist/types/src/interfaces/LinkTreeServiceInterface.d.ts +4 -4
  113. package/dist/types/src/interfaces/PromiseLibraryInterface.d.ts +33 -33
  114. package/dist/types/src/interfaces/ServerCacheDependencyInterface.d.ts +5 -5
  115. package/dist/types/src/interfaces/SocketMessageInterface.d.ts +3 -3
  116. package/dist/types/src/interfaces/TransactionCollectionHandlerDependencyInterface.d.ts +17 -17
  117. package/dist/types/src/interfaces/TransactionItemHandlerDependencyInterface.d.ts +22 -22
  118. package/dist/types/src/internal.d.ts +128 -128
  119. package/dist/types/src/models/CachedQueryItem.d.ts +40 -40
  120. package/dist/types/src/models/CollectionEntry.d.ts +22 -22
  121. package/dist/types/src/models/CollectionOptions.d.ts +44 -44
  122. package/dist/types/src/models/CollectionResource.d.ts +87 -87
  123. package/dist/types/src/models/ItemEntry.d.ts +19 -19
  124. package/dist/types/src/models/ItemEntryOptions.d.ts +8 -8
  125. package/dist/types/src/models/ItemResource.d.ts +90 -90
  126. package/dist/types/src/models/Template.d.ts +11 -11
  127. package/dist/types/src/types/ItemTypesCollection.d.ts +345 -345
  128. package/dist/types/src/types/PromiseInterface.d.ts +2 -2
  129. package/dist/types/tests/integration/core.test.d.ts +1 -1
  130. package/dist/types/tests/integration/helpers/helpers.d.ts +31 -31
  131. package/dist/types/tests/integration/transactions/get_by.test.d.ts +1 -1
  132. package/dist/types/tests/integration/transactions/updates.test.d.ts +1 -1
  133. package/dist/types/tests/mocks/ApiMocked.d.ts +19 -19
  134. package/dist/types/tests/mocks/PromiseLibrary.mocked.d.ts +2 -2
  135. package/dist/types/tests/regression/RM4_17754.test.d.ts +1 -1
  136. package/dist/types/tests/regression/RM4_18216.test.d.ts +1 -1
  137. package/dist/types/tests/unit/query_contains_local_id_parser.test.d.ts +1 -0
  138. package/dist/types/tests/unit/query_linked_to_parser.test.d.ts +1 -1
  139. package/dist/types/tests/unit/query_matcher.test.d.ts +1 -1
  140. package/dist/types/tests/unit/query_parser_id_updater.test.d.ts +1 -0
  141. package/dist/types/tests/unit/query_service.test.d.ts +1 -1
  142. package/package.json +57 -57
  143. package/readme.md +16 -16
@@ -1,94 +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, changesDelta: ChangesDelta) => 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 a {@link BusinessLogicConditionResult} if the fields have been changed, null otherwise.
86
- * If either the source or changed field is `undefined` it will always return `null` (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
- }
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, changesDelta: ChangesDelta) => 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 a {@link BusinessLogicConditionResult} if the fields have been changed, null otherwise.
86
+ * If either the source or changed field is `undefined` it will always return `null` (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
+ }
@@ -1,18 +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 {};
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 {};
@@ -1,25 +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 {};
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 {};
@@ -1,14 +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 {};
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 {};
@@ -1,20 +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 {};
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 {};
@@ -1,19 +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 {};
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 {};
@@ -1,14 +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 {};
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 {};
@@ -1,18 +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 {};
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 {};
@@ -1,14 +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 {};
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 {};
@@ -1,15 +1,15 @@
1
- import { ApiEnumItemType, ItemId } from '@rentman/backend-types';
2
- import { ItemEntry, TransactionCache } from '../../..';
3
- import { ChangesDelta } from '../../ChangesDelta';
4
- import { BusinessLogicRule } from '../BusinessLogicRule';
5
- export declare type ConditionResult = ItemId[];
6
- declare type Dependency = {
7
- local: ItemEntry<ApiEnumItemType.Voorraadmutatie>[];
8
- remote: ItemEntry<ApiEnumItemType.Voorraadmutatie>[];
9
- };
10
- export declare class MateriaalTelexemplarenBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
11
- protected condition(changesDelta: ChangesDelta): ConditionResult | undefined;
12
- dependency(transaction: TransactionCache, conditionResult: ConditionResult): Promise<Dependency>;
13
- apply(_changesDelta: ChangesDelta, destinationChangesDelta: ChangesDelta, dependencies: Dependency): Promise<any> | void;
14
- }
15
- export {};
1
+ import { ApiEnumItemType, ItemId } from '@rentman/backend-types';
2
+ import { ItemEntry, TransactionCache } from '../../..';
3
+ import { ChangesDelta } from '../../ChangesDelta';
4
+ import { BusinessLogicRule } from '../BusinessLogicRule';
5
+ export declare type ConditionResult = ItemId[];
6
+ declare type Dependency = {
7
+ local: ItemEntry<ApiEnumItemType.Voorraadmutatie>[];
8
+ remote: ItemEntry<ApiEnumItemType.Voorraadmutatie>[];
9
+ };
10
+ export declare class MateriaalTelexemplarenBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
11
+ protected condition(changesDelta: ChangesDelta): ConditionResult | undefined;
12
+ dependency(transaction: TransactionCache, conditionResult: ConditionResult): Promise<Dependency>;
13
+ apply(_changesDelta: ChangesDelta, destinationChangesDelta: ChangesDelta, dependencies: Dependency): Promise<any> | void;
14
+ }
15
+ export {};
@@ -1,18 +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 {};
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 {};
@@ -1,18 +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 {};
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 {};